|
|
|
@ -190,6 +190,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
|
entity.SecondarySplit = (bool)reader[7]; |
|
|
|
entity.Supplier_Name = (string)reader[8]; |
|
|
|
entity.OrderState = (int)reader[9]; |
|
|
|
entity.Date = date; |
|
|
|
list.Add(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -222,7 +223,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
|
var entity = serializer.Deserialize<OrderDetail>(insert); |
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
{ |
|
|
|
//CheckCanInsert(session, entity.Order, entity.Date.Value);
|
|
|
|
CheckCanInsert(session, entity.Order, entity.Date.Value); |
|
|
|
entity.ModifyTime = DateTime.Now; |
|
|
|
UpdateOrder(session, entity.Order - 1, 1, entity.Date); |
|
|
|
session.Insert(entity); |
|
|
|
@ -236,7 +237,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(OrderDetail))); |
|
|
|
query.Range = SelectRange.Top(1); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c")); |
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Date", date), DQCondition.EQ("DeleteState", false), DQCondition.EQ("SecondarySplit", true), DQCondition.GreaterThanOrEqual("Order", order))); |
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Date", date), DQCondition.EQ("DeleteState", false), DQCondition.GreaterThanOrEqual("OrderState", 10), DQCondition.GreaterThanOrEqual("Order", order))); |
|
|
|
if (query.EExecuteScalar(session) != null) |
|
|
|
throw new Exception("不允许插入到已进行烫毛计数顺序之前"); |
|
|
|
} |
|
|
|
@ -270,11 +271,12 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
|
{ |
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
{ |
|
|
|
var entity = InnerBLUtil.GetSingleDmo<OrderDetail>(session, "ID", id, "Order", "Date", "SecondarySplit"); |
|
|
|
//if (entity.SecondarySplit)
|
|
|
|
// throw new Exception("已进行烫毛计数,不能修改");
|
|
|
|
var entity = InnerBLUtil.GetSingleDmo<OrderDetail>(session, "ID", id, "Order", "Date", "OrderState"); |
|
|
|
if (entity.OrderState != 0) |
|
|
|
throw new Exception("已开始宰杀,不能修改"); |
|
|
|
UpdateOrder(session, entity.Order, -1, entity.Date); |
|
|
|
UpdateOrderDetailPartial(session, id, "DeleteState", true); |
|
|
|
ClearHurryRecordToOrderID(session, id); |
|
|
|
session.Commit(); |
|
|
|
} |
|
|
|
return 1; |
|
|
|
@ -308,7 +310,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
|
|
|
|
|
#region hurryButcher
|
|
|
|
[Rpc] |
|
|
|
public static string GetHurryRecords(long weightId) |
|
|
|
public static string GetHurryRecordList(long weightId) |
|
|
|
{ |
|
|
|
var query = new DmoQuery(typeof(HurryRecord)); |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("WeightBill_ID", weightId)); |
|
|
|
@ -393,7 +395,16 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
|
return id; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc] |
|
|
|
public static string GetHurryRecord(long id) |
|
|
|
{ |
|
|
|
var query = new DmoQuery(typeof(HurryRecord)); |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("ID", id)); |
|
|
|
var entity = query.EExecuteScalar<HurryRecord>(); |
|
|
|
if (entity == null) |
|
|
|
throw new Exception(string.Format("急宰单No.{0} 已被删除", id)); |
|
|
|
return serializer.Serialize(entity); |
|
|
|
} |
|
|
|
|
|
|
|
[Rpc] |
|
|
|
public static string GetSelectHurryList() |
|
|
|
@ -467,6 +478,39 @@ namespace BWP.B3ClientService.Rpcs.BillRpc |
|
|
|
update.EExecute(); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
[Rpc] |
|
|
|
public static long InsertByHurryRecord(string insert,long hurryID) |
|
|
|
{ |
|
|
|
insert = insert.ESerializeDateTime(); |
|
|
|
var entity = serializer.Deserialize<OrderDetail>(insert); |
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
{ |
|
|
|
CheckCanInsert(session, entity.Order, entity.Date.Value); |
|
|
|
entity.ModifyTime = DateTime.Now; |
|
|
|
UpdateOrder(session, entity.Order - 1, 1, entity.Date); |
|
|
|
session.Insert(entity); |
|
|
|
SetHurryRecordToOrderID(session, entity.ID, hurryID); |
|
|
|
session.Commit(); |
|
|
|
} |
|
|
|
return entity.ID; |
|
|
|
} |
|
|
|
|
|
|
|
static void SetHurryRecordToOrderID(IDmoSession session, long orderID, long hurryID) |
|
|
|
{ |
|
|
|
var update = new DQUpdateDom(typeof(HurryRecord)); |
|
|
|
update.Where.Conditions.Add(DQCondition.EQ("ID",hurryID)); |
|
|
|
update.Columns.Add(new DQUpdateColumn("ToOrderDetail_ID", orderID)); |
|
|
|
session.ExecuteNonQuery(update); |
|
|
|
} |
|
|
|
|
|
|
|
static void ClearHurryRecordToOrderID(IDmoSession session, long orderID) |
|
|
|
{ |
|
|
|
var update = new DQUpdateDom(typeof(HurryRecord)); |
|
|
|
update.Where.Conditions.Add(DQCondition.EQ("ToOrderDetail_ID", orderID)); |
|
|
|
update.Columns.Add(new DQUpdateColumn("ToOrderDetail_ID", DQExpression.NULL)); |
|
|
|
session.ExecuteNonQuery(update); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
} |