From 578327304672a37f026bf3be8168f31c836812ec Mon Sep 17 00:00:00 2001 From: wugang <425674808@qq.com> Date: Mon, 3 Dec 2018 19:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E7=A7=B0=E9=87=8D=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E6=92=A4=E9=94=80=E5=AE=8C=E6=AF=95=EF=BC=8C=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=94=B9=E4=B8=BA=E6=AD=A3=E9=85=8D=E8=B4=A7=EF=BC=8C?= =?UTF-8?q?=E5=90=A6=E5=88=99=E6=94=B9=E4=B8=BA=E6=9C=AA=E9=85=8D=E8=B4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Rpcs/SaleOutStoreRpc.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/B3CowButcherManageToSale/Rpcs/SaleOutStoreRpc.cs b/B3CowButcherManageToSale/Rpcs/SaleOutStoreRpc.cs index 26558db..97d8dbf 100644 --- a/B3CowButcherManageToSale/Rpcs/SaleOutStoreRpc.cs +++ b/B3CowButcherManageToSale/Rpcs/SaleOutStoreRpc.cs @@ -5,8 +5,10 @@ using System.Text; using BWP.B3CowButcherManage.BO; using BWP.B3CowButcherManage.Rpcs; using BWP.B3Frameworks.Utils; +using BWP.B3Sale.BL; using BWP.B3Sale.BO; using BWP.B3Sale.Utils; +using Forks.EnterpriseServices.BusinessInterfaces; using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2.DQuery; using Forks.EnterpriseServices.JsonRpc; @@ -178,6 +180,48 @@ namespace BWP.B3CowButcherManageToSale.Rpcs return 1; } + + [Rpc] + public static int SetFinishAssignState(long id, bool finish) + { + using (var session = Dmo.NewSession()) + { + var state = InnerBLUtil.GetDmoPropertyByID?>(session, typeof(SaleOutStore), "AssignState", id); + + if (finish && state == 配货状态.已配货) + return 1; + if (!finish && state == 配货状态.未配货) + return 1; + var bl = BIFactory.Create(session); + var dmo = bl.Load(id); + if (finish) + { + bl.FinishAssignGoods(dmo); + } + else + { + var query = new DQueryDom(new JoinAlias(typeof(WeightingInfor))); + query.Columns.Add(DQSelectColumn.Field("ID")); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("BillID", id), DQCondition.EQ("BillType", DmoTypeIDAttribute.GetID(typeof(SaleOutStore))))); + var wId = query.EExecuteScalar(session); + if (wId != null) + UpdateAssignStateByBillID(session,id); + bl.UnFinishAssignGoods(dmo); + } + session.Commit(); + } + return 1; + } + + private static void UpdateAssignStateByBillID(IDmoSession session, long billID) + { + var update2 = new DQUpdateDom(typeof(SaleOutStore)); + update2.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); + update2.Columns.Add(new DQUpdateColumn("AssignState", 配货状态.正在配货)); + update2.Where.Conditions.Add(DQCondition.EQ("ID", billID)); + session.ExecuteNonQuery(update2); + } + private static void UpdateAssignNumberByDetailID(IDmoSession session, long detailID,int packageNum) { var weightingInfo = GetWeightingInfor(session, detailID);