From ba2be18b4e2c7d39ecad322f26b1b5edf069b161 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Thu, 19 Oct 2017 10:07:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Rpcs/BillRpc/OrderDetailRpc.cs | 58 ++++++++++++++++--- .../Rpcs/BillRpc/SecondOrderRpc.cs | 1 + 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs b/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs index 9afca32..5b87410 100644 --- a/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs +++ b/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs @@ -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(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(session, "ID", id, "Order", "Date", "SecondarySplit"); - //if (entity.SecondarySplit) - // throw new Exception("已进行烫毛计数,不能修改"); + var entity = InnerBLUtil.GetSingleDmo(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(); + 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(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 } } diff --git a/B3ClientService/Rpcs/BillRpc/SecondOrderRpc.cs b/B3ClientService/Rpcs/BillRpc/SecondOrderRpc.cs index 8ad5b39..5f81562 100644 --- a/B3ClientService/Rpcs/BillRpc/SecondOrderRpc.cs +++ b/B3ClientService/Rpcs/BillRpc/SecondOrderRpc.cs @@ -35,6 +35,7 @@ namespace BWP.B3ClientService.Rpcs.BillRpc query.Columns.Add(DQSelectColumn.Field("HotFadeNumber", detail)); query.Columns.Add(DQSelectColumn.Field("IsOk", detail)); query.Columns.Add(DQSelectColumn.Field("Finish", detail)); + query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("OrderState", 10)); var list = new List(); using (var session = Dmo.NewSession()) {