|
|
@ -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; } |
|
|
|