Browse Source

增加自助服务打印洗车票。

master
yibo 7 years ago
parent
commit
861e9b3bee
5 changed files with 169 additions and 22 deletions
  1. +1
    -0
      B3ClientService/B3ClientService.csproj
  2. +2
    -0
      B3ClientService/BO/BaseInfo/Car.cs
  3. +33
    -0
      B3ClientService/BO/Bill/WeightBill/WashCarPrint.cs
  4. +110
    -2
      B3ClientService/Rpcs/SelfHelpRpc.cs
  5. +23
    -20
      B3ClientService/Tasks/SyncInfoFromServer.cs

+ 1
- 0
B3ClientService/B3ClientService.csproj View File

@ -163,6 +163,7 @@
<Compile Include="BO\Bill\SegmentProductionInfo.cs" /> <Compile Include="BO\Bill\SegmentProductionInfo.cs" />
<Compile Include="BO\Bill\SyncCarcassInStoreLog.cs" /> <Compile Include="BO\Bill\SyncCarcassInStoreLog.cs" />
<Compile Include="BO\Bill\WeightBill\SelfHelpSendMsg.cs" /> <Compile Include="BO\Bill\WeightBill\SelfHelpSendMsg.cs" />
<Compile Include="BO\Bill\WeightBill\WashCarPrint.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBill.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBill.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBillCheck.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBillCheck.cs" />
<Compile Include="BO\Bill\WeightBill\WeightBillShowRelate.cs" /> <Compile Include="BO\Bill\WeightBill\WeightBillShowRelate.cs" />


+ 2
- 0
B3ClientService/BO/BaseInfo/Car.cs View File

@ -10,5 +10,7 @@ namespace BWP.B3ClientService.BO
public class Car : BaseInfo public class Car : BaseInfo
{ {
public string Driver_IDCard { get; set; } public string Driver_IDCard { get; set; }
public int? Standard { get; set; }
} }
} }

+ 33
- 0
B3ClientService/BO/Bill/WeightBill/WashCarPrint.cs View File

@ -0,0 +1,33 @@
using Forks.EnterpriseServices.DataDictionary;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[BOClass]
public class WashCarPrint
{
[DbColumn(Index = IndexType.Normal)]
public long BillID { get; set; }
public DateTime Date { get; set; }
public DateTime LastPrintTime { get; set; }
public int RowIndex { get; set; }
public int PrintDegree { get; set; }
public string CarNumber { get; set; }
public int CarSize { get; set; }
public decimal Fee { get; set; }
public string WeightMan { get; set; }
}
}

+ 110
- 2
B3ClientService/Rpcs/SelfHelpRpc.cs View File

@ -61,7 +61,7 @@ namespace BWP.B3ClientService.Rpcs
q1.From.AddJoin(JoinType.Left, new DQDmoSource(employee1), DQCondition.EQ(employee1, "ID", m1, "Employee_ID")); q1.From.AddJoin(JoinType.Left, new DQDmoSource(employee1), DQCondition.EQ(employee1, "ID", m1, "Employee_ID"));
q1.Columns.Add(DQSelectColumn.Field("ID")); q1.Columns.Add(DQSelectColumn.Field("ID"));
q1.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "BillType")); q1.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "BillType"));
q1.Columns.Add(DQSelectColumn.Field("Name",car1));
q1.Columns.Add(DQSelectColumn.Field("Name", car1));
q1.Columns.Add(DQSelectColumn.Field("Number", d1)); q1.Columns.Add(DQSelectColumn.Field("Number", d1));
q1.Columns.Add(DQSelectColumn.Field("WeighTime")); q1.Columns.Add(DQSelectColumn.Field("WeighTime"));
q1.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("PrintNumber", 0), DQCondition.EQ("DeleteState", false))); q1.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("PrintNumber", 0), DQCondition.EQ("DeleteState", false)));
@ -83,7 +83,7 @@ namespace BWP.B3ClientService.Rpcs
q1.From.AddJoin(JoinType.Left, new DQDmoSource(employee2), DQCondition.EQ(m1, "employeeID", employee2, "ID")); q1.From.AddJoin(JoinType.Left, new DQDmoSource(employee2), DQCondition.EQ(m1, "employeeID", employee2, "ID"));
q1.Columns.Add(DQSelectColumn.Field("ID")); q1.Columns.Add(DQSelectColumn.Field("ID"));
q1.Columns.Add(DQSelectColumn.Create(DQExpression.Value(0), "BillType")); q1.Columns.Add(DQSelectColumn.Create(DQExpression.Value(0), "BillType"));
q1.Columns.Add(DQSelectColumn.Field("Name",car2));
q1.Columns.Add(DQSelectColumn.Field("Name", car2));
q1.Columns.Add(DQSelectColumn.Field("number", d1)); q1.Columns.Add(DQSelectColumn.Field("number", d1));
q1.Columns.Add(DQSelectColumn.Field("BillTime")); q1.Columns.Add(DQSelectColumn.Field("BillTime"));
q1.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("WeightBill_ID"))); q1.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("WeightBill_ID")));
@ -234,6 +234,114 @@ namespace BWP.B3ClientService.Rpcs
} }
} }
[Rpc(RpcFlags.SkipAuth)]
public static string GetWashPrintEntity(long id, decimal fee)
{
WashCarPrint enitity;
using (var session = Dmo.NewSession())
{
if (Exist(session, id))
{
UpdatePrint(session, id, fee);
enitity = LoadCarPrint(session, id);
}
else
enitity = InsertPrint(session, id, fee);
session.Commit();
}
return JsonConvert.SerializeObject(enitity);
}
static bool Exist(IDmoSession session, long billID)
{
var query = new DQueryDom(new JoinAlias(typeof(WashCarPrint)));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c"));
query.Where.Conditions.Add(DQCondition.EQ("BillID", billID));
return query.EExecuteScalar() != null;
}
static void UpdatePrint(IDmoSession session, long id, decimal fee)
{
var update = new DQUpdateDom(typeof(WashCarPrint));
update.Where.Conditions.Add(DQCondition.EQ("BillID", id));
update.Columns.Add(new DQUpdateColumn("Fee", fee));
update.Columns.Add(new DQUpdateColumn("LastPrintTime", DateTime.Today));
update.Columns.Add(new DQUpdateColumn("PrintDegree", DQExpression.Add(DQExpression.Field("PrintDegree"), DQExpression.Value(1))));
session.ExecuteNonQuery(update);
}
static WashCarPrint LoadCarPrint(IDmoSession session, long id)
{
var dom = new DmoQuery(typeof(WashCarPrint));
dom.Where.Conditions.Add(DQCondition.EQ("BillID", id));
return (WashCarPrint)session.ExecuteScalar(dom);
}
static WashCarPrint InsertPrint(IDmoSession session, long id, decimal fee)
{
var entity = new WashCarPrint();
var obj = GetMinWeightInfo(session, id);
entity.BillID = id;
entity.CarNumber = obj.Item1;
entity.CarSize = obj.Item3;
entity.WeightMan = obj.Item2;
entity.Date = obj.Item4;
entity.Fee = fee;
entity.LastPrintTime = DateTime.Now;
entity.PrintDegree = 1;
entity.RowIndex = GetTodayNumber(session, entity.Date);
session.Insert(entity);
return entity;
}
static Tuple<string, string, int, DateTime> GetMinWeightInfo(IDmoSession session, long id)
{
var main = new JoinAlias(typeof(WeightBill));
var car = new JoinAlias(typeof(Car));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Left, new DQDmoSource(car), DQCondition.EQ(main, "Car_ID", car, "ID"));
query.Where.Conditions.Add(DQCondition.EQ("ID", id));
query.Columns.Add(DQSelectColumn.Field("Car_Name"));
query.Columns.Add(DQSelectColumn.Field("Creator"));
query.Columns.Add(DQSelectColumn.Field("Standard", car));
query.Columns.Add(DQSelectColumn.Field("WeighTime"));
using (var reader = session.ExecuteReader(query))
{
if (reader.Read())
{
var carName = (string)reader[0];
var creator = (string)reader[1];
var standard = (int)(reader[2] ?? 0);
var date = (DateTime)reader[3];
return new Tuple<string, string, int, DateTime>(carName, creator, standard, date.Date);
}
}
return new Tuple<string, string, int, DateTime>(string.Empty, string.Empty, 0, DateTime.Today);
}
static int GetTodayNumber(IDmoSession session, DateTime date)
{
var query = new DQueryDom(new JoinAlias(typeof(WashCarPrint)));
query.Columns.Add(DQSelectColumn.Max("RowIndex"));
query.Where.Conditions.Add(DQCondition.EQ("Date", date));
var maxID = session.ExecuteScalar(query);
if (maxID == null)
return 1;
return (int)maxID + 1;
}
[Rpc(RpcFlags.SkipAuth)]
public static int? GetCarStandad(long id)
{
var main = new JoinAlias(typeof(WeightBill));
var car = new JoinAlias(typeof(Car));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Left, new DQDmoSource(car), DQCondition.EQ(main, "Car_ID", car, "ID"));
query.Where.Conditions.Add(DQCondition.EQ("ID", id));
query.Columns.Add(DQSelectColumn.Field("Standard", car));
return query.EExecuteScalar<int?>();
}
class ViewEntity class ViewEntity
{ {
public long ID { get; set; } public long ID { get; set; }


+ 23
- 20
B3ClientService/Tasks/SyncInfoFromServer.cs View File

@ -83,24 +83,24 @@ namespace BWP.B3ClientService.Tasks
// } // }
//} //}
// private void SyncProductBatch()
// {
// var json = RpcFacade.Call<string>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/SyncProductBatch");
// json = json.ESerializeDateTime();
// var list = JsonConvert.DeserializeObject<List<ProductBatch>>(json);
// using (var context = new TransactionContext())
// {
// var sql1 = @"truncate table [B3ClientService_ProductBatch];";
// context.Session.ExecuteSqlNonQuery(sql1);
// foreach (ProductBatch dmo in list)
// {
//// var dmo = new ProductBatch();
//// dmo.Name = name;
// context.Session.Insert(dmo);
// }
// context.Commit();
// }
// }
// private void SyncProductBatch()
// {
// var json = RpcFacade.Call<string>("/MainSystem/B3ButcherManage/Rpcs/TouchScreenRpcs/SyncProductBatch");
// json = json.ESerializeDateTime();
// var list = JsonConvert.DeserializeObject<List<ProductBatch>>(json);
// using (var context = new TransactionContext())
// {
// var sql1 = @"truncate table [B3ClientService_ProductBatch];";
// context.Session.ExecuteSqlNonQuery(sql1);
// foreach (ProductBatch dmo in list)
// {
//// var dmo = new ProductBatch();
//// dmo.Name = name;
// context.Session.Insert(dmo);
// }
// context.Commit();
// }
// }
//private void SyncWorkUnit() //private void SyncWorkUnit()
//{ //{
@ -211,7 +211,7 @@ namespace BWP.B3ClientService.Tasks
} }
context.Commit(); context.Commit();
} }
}
}
void SyncSupplier() void SyncSupplier()
{ {
@ -260,7 +260,7 @@ namespace BWP.B3ClientService.Tasks
} }
context.Commit(); context.Commit();
} }
}
}
void SyncBaseInfo<T>(string rpcMethodName, string rpcClassName = null) void SyncBaseInfo<T>(string rpcMethodName, string rpcClassName = null)
where T : BWP.B3ClientService.BO.BaseInfo, new() where T : BWP.B3ClientService.BO.BaseInfo, new()
@ -283,6 +283,9 @@ namespace BWP.B3ClientService.Tasks
{ {
var car = entity as Car; var car = entity as Car;
car.Driver_IDCard = o.Get<string>("Driver_IDCard"); car.Driver_IDCard = o.Get<string>("Driver_IDCard");
var standard = o.Get<string>("Remark");
if (!string.IsNullOrEmpty(standard))//不支持NamedValue 这里用Remark传值
car.Standard = int.Parse(standard);
context.Session.Insert(car); context.Session.Insert(car);
} }
else else


Loading…
Cancel
Save