From cc59be985bc955c8721827f42b9e3a76827c911d Mon Sep 17 00:00:00 2001 From: luanhui <1029149336@qq.com> Date: Wed, 3 Jan 2018 17:16:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E6=80=A7=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProductionNotificationEdit.cs | 8 +++++ .../SelectOrderDialog.cs | 21 +++++++++++- .../SelectOrderDialog.xml | 1 + .../ProductionNotificationBL.cs | 33 +++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/ProductionNotificationEdit.cs b/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/ProductionNotificationEdit.cs index 73f575c..b38733f 100644 --- a/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/ProductionNotificationEdit.cs +++ b/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/ProductionNotificationEdit.cs @@ -72,6 +72,14 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Bills.ProductionNotification_ mBL.UpdateUnitNumber(Dmo); _detailGrid.DataBind(); }; + + var buttonUpdateOutStore = hPanel.Add(new TSButton("更改出库数量")); + buttonUpdateOutStore.Click += delegate + { + _detailGrid.GetFromUI(); + mBL.UpdateSaleOutStoreUnitNum(Dmo); + AspUtil.Alert(this,"更新成功"); + }; } var detailEditor = new DFCollectionEditor(() => Dmo.Details); detailEditor.AllowDeletionFunc = () => CanSave; diff --git a/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.cs b/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.cs index 37ca3d5..cf3cee1 100644 --- a/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.cs +++ b/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.cs @@ -4,22 +4,32 @@ using System.Linq; using System.Text; using B3_DongFangWanQi.BO; using BWP.B3Frameworks; +using BWP.B3Frameworks.BO; using BWP.B3Frameworks.BO.NamedValueTemplate; using BWP.B3Sale.BO; using BWP.Web.Layout; using BWP.Web.Utils; using Forks.EnterpriseServices.DataForm; +using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.SqlDoms; using TSingSoft.WebControls2; namespace BWP.Web.Pages.B3_DongFangWanQi.Bills.ProductionNotification_ { class SelectOrderDialog: DmoMultiSelectDialog { + private DFChoiceBox _liuchengfenlei; protected override void CreateQuery(VLayoutPanel vPanel) { var layoutManager = new LayoutManager("", mDFInfo, mQueryContainer); + + _liuchengfenlei = QueryCreator.DFChoiceBox(mDFInfo.Fields["ID"], B3FrameworksConsts.DataSources.流程状态分类); + layoutManager.Add("DepartmentWorkFlowStateCategory_ID", new SimpleLabel("流程状态分类"), _liuchengfenlei); + layoutManager["DepartmentWorkFlowStateCategory_ID"].NotAutoAddToContainer = true; + + var config = new AutoLayoutConfig(); config.Add("ID"); config.Add("Customer_ID"); @@ -31,6 +41,8 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Bills.ProductionNotification_ config.Add("SaleKind_ID"); config.Add("OrderDate"); config.Add("LoadTime"); + config.Add("DepartmentWorkFlowStateCategory_ID"); + layoutManager.Config = config; vPanel.Add(layoutManager.CreateLayout()); base.CreateQuery(vPanel); @@ -52,9 +64,16 @@ namespace BWP.Web.Pages.B3_DongFangWanQi.Bills.ProductionNotification_ protected override DQueryDom GetQueryDom() { var dom= base.GetQueryDom(); -// var bill = dom.From.RootSource.Alias; + var bill = dom.From.RootSource.Alias; dom.Where.Conditions.Add(DQCondition.EQ("BillState",单据状态.未审核)); + var flowdetail = new JoinAlias("flowdetail", typeof(DepartmentWorkFlow_Detail)); + dom.From.AddJoin(JoinType.Left, new DQDmoSource(flowdetail), DQCondition.EQ(bill, "DepartmentWorkFlow_Detail_ID", flowdetail, "ID")); + if (!_liuchengfenlei.IsEmpty) + { + dom.Where.Conditions.Add(DQCondition.EQ(flowdetail, "DepartmentWorkFlowStateCategory_ID", long.Parse(_liuchengfenlei.Value))); + } + return dom; } } diff --git a/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.xml b/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.xml index fef5c7b..5156181 100644 --- a/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.xml +++ b/B3_DongFangWanQi.Web/Pages/B3_DongFangWanQi/Bills/ProductionNotification_/SelectOrderDialog.xml @@ -96,6 +96,7 @@ + diff --git a/B3_DongFangWanQi/BL/ProductionNotificationBL_/ProductionNotificationBL.cs b/B3_DongFangWanQi/BL/ProductionNotificationBL_/ProductionNotificationBL.cs index 983f752..2c0e6b3 100644 --- a/B3_DongFangWanQi/BL/ProductionNotificationBL_/ProductionNotificationBL.cs +++ b/B3_DongFangWanQi/BL/ProductionNotificationBL_/ProductionNotificationBL.cs @@ -22,6 +22,7 @@ namespace B3_DongFangWanQi.BL { void UpdateUnitNumber(ProductionNotification dmo); void LoadDetailsByOrders(ProductionNotification dmo, IList resultDetails); + void UpdateSaleOutStoreUnitNum(ProductionNotification dmo); } public class ProductionNotificationBL : SaleDepartmentWorkFlowBillBL, IProductionNotificationBL @@ -80,5 +81,37 @@ namespace B3_DongFangWanQi.BL } } } + + public void UpdateSaleOutStoreUnitNum(ProductionNotification dmo) + { + var outstorebl = BIFactory.Create(Session); + foreach (IGrouping grouping in dmo.Details.GroupBy(x=>x.Order_ID)) + { + var orderid = grouping.Key; + var saleoutstoreid = GetSaleOutStoreId(orderid); + if (saleoutstoreid.HasValue) + { + var outstore = outstorebl.Load(saleoutstoreid.Value); + foreach (SaleOutStore_Detail detail in outstore.Details) + { + var fd = grouping.FirstOrDefault(x => x.Goods_ID == detail.SaleGoods_ID); + if (fd != null) + { + detail.UnitNum = fd.LoadCarNumber; + } + } + outstorebl.Update(outstore); + } + + } + } + + private long? GetSaleOutStoreId(long orderid) + { + var query=new DQueryDom(new JoinAlias(typeof(SaleOutStore))); + query.Where.Conditions.Add(DQCondition.EQ("Order_ID",orderid)); + query.Columns.Add(DQSelectColumn.Field("ID")); + return query.EExecuteScalar(Session); + } } }