diff --git a/B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetEdit.cs b/B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetEdit.cs index 25bbae1..fa89b91 100644 --- a/B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetEdit.cs +++ b/B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetEdit.cs @@ -75,10 +75,15 @@ namespace BWP.Web.Pages.B3ClientService.BaseInfos.ClientGoodsSet_ addGoods.Click += delegate { _detailGrid.GetFromUI(); - foreach (var detail in DialogUtil.GetCachedObj(this)) + foreach (var goods in DialogUtil.GetCachedObj(this)) { - if (Dmo.Details.Any(x => x.Goods_ID == detail.Goods_ID)) + if (Dmo.Details.Any(x => x.Goods_ID == goods.ID)) continue; + var detail = new ClientGoodsSet_Detail(); + detail.Goods_ID = goods.ID; + detail.Goods_Name = goods.Name; + detail.Goods_Code = goods.Code; + detail.Goods_Spec = goods.Spec; Dmo.Details.Add(detail); } _detailGrid.DataBind(); diff --git a/B3ClientService.Web/Pages/B3ClientService/Bills/CarcassInventory_/CarcassInventoryEdit.cs b/B3ClientService.Web/Pages/B3ClientService/Bills/CarcassInventory_/CarcassInventoryEdit.cs index 86990ec..048166d 100644 --- a/B3ClientService.Web/Pages/B3ClientService/Bills/CarcassInventory_/CarcassInventoryEdit.cs +++ b/B3ClientService.Web/Pages/B3ClientService/Bills/CarcassInventory_/CarcassInventoryEdit.cs @@ -1,4 +1,5 @@ -using BWP.B3ClientService.BL; +using BWP.B3ClientService; +using BWP.B3ClientService.BL; using BWP.B3ClientService.BO; using BWP.Web.Layout; using BWP.Web.WebControls; @@ -16,12 +17,12 @@ namespace BWP.Web.Pages.B3ClientService.Bills.CarcassInventory_ { protected override void BuildBasePropertiesEditor(WebControls.TitlePanel titlePanel, CustomPageLayout.PageLayoutSection pageLayoutSection) { - var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer); + var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer); var config = new AutoLayoutConfig(); config.Add("Date"); - config.Add("ProductBatch_Name"); + config.Add("ProductBatch_ID"); layoutManager.Config = config; - pageLayoutSection.SetRequired("Date", "ProductBatch_Name"); + pageLayoutSection.SetRequired("Date", "ProductBatch_ID"); pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo); titlePanel.Controls.Add(layoutManager.CreateLayout()); } @@ -35,20 +36,36 @@ namespace BWP.Web.Pages.B3ClientService.Bills.CarcassInventory_ DFEditGrid _detailGrid; private void CreateDetailPanel(TitlePanel titlePanel) { + if (CanSave) + { + var hPanel = titlePanel.EAdd(new HLayoutPanel()); + hPanel.Add(new SimpleLabel("存货")); + var goodsSelect = hPanel.Add(new ChoiceBox(B3ClientServiceConsts.DataSources.存货) { Width = Unit.Pixel(160), EnableTopItem = true, EnableInputArgument = true }); + hPanel.Add(new TSButton("新增", delegate + { + GetFromUI(); + long? goodsID = null; + if (!goodsSelect.IsEmpty) + goodsID = long.Parse(goodsSelect.Value); + if (!Dmo.Details.Any(x => x.Goods_ID == goodsID)) + Dmo.Details.Add(new CarcassInventory_SummaryDetail { Goods_ID = goodsID, Goods_Name = goodsSelect.DisplayValue }); + AppToUI(); + })); + } var btn = titlePanel.NavPanel.EAdd(new DialogButton()); btn.Text = "盘点详情"; btn.BeforeClientClick = "var behindSelect=__DFContainer.getControl('$Details').behind.selectedRow().dfContainer; if(behindSelect==undefined){alert('请先选择盘点明细');return false;}"; btn.Url = string.Format("CarcassInventoryDialog.aspx?ID={0}&Goods_ID='+__DFContainer.getControl('$Details').behind.selectedRow().dfContainer.getValue('Goods_ID')+'", MinDmo.ID); var editor = new DFCollectionEditor(() => Dmo.Details); - //editor.AllowDeletionFunc = () => CanSave; - //editor.IsEditableFunc = (field, detail) => CanSave; - //editor.CanDeleteFunc = detail => CanSave; + editor.AllowDeletionFunc = () => CanSave; + editor.IsEditableFunc = (field, detail) => CanSave; + editor.CanDeleteFunc = detail => CanSave; _detailGrid = new DFEditGrid(editor) { Width = Unit.Percentage(100) }; _detailGrid.Columns.Add(new DFEditGridColumn("Goods_Name")); - _detailGrid.Columns.Add(new DFEditGridColumn("Number")); + _detailGrid.Columns.Add(new DFEditGridColumn("Number")); _detailGrid.Columns.Add(new DFEditGridColumn("StoreNumber")); _detailGrid.Columns.Add(new DFEditGridColumn("DiffNumber")); - _detailGrid.Columns.Add(new DFEditGridColumn("Weight")); + _detailGrid.Columns.Add(new DFEditGridColumn("Weight")); _detailGrid.Columns.Add(new DFEditGridColumn("StoreWeight")); _detailGrid.Columns.Add(new DFEditGridColumn("DiffWeight")); _detailGrid.ValueColumns.Add("Goods_ID"); @@ -57,7 +74,7 @@ namespace BWP.Web.Pages.B3ClientService.Bills.CarcassInventory_ titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(CarcassInventory_SummaryDetail))); mDFContainer.AddNonDFControl(_detailGrid, "$Details"); - titlePanel.Controls.Add(_detailGrid); + titlePanel.Controls.Add(_detailGrid); } protected override bool EnablePrint @@ -71,8 +88,14 @@ namespace BWP.Web.Pages.B3ClientService.Bills.CarcassInventory_ public override void AppToUI() { base.AppToUI(); - mDFContainer.Readonly = true; + //mDFContainer.Readonly = true; _detailGrid.DataBind(); } + + public override void GetFromUI() + { + base.GetFromUI(); + _detailGrid.GetFromUI(); + } } } diff --git a/B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.cs b/B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.cs index a6053ee..91fbd11 100644 --- a/B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.cs +++ b/B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.cs @@ -8,7 +8,7 @@ using TSingSoft.WebControls2; namespace BWP.Web.Pages.B3ClientService.Dialogs { - class SelectGoodsDialogs : DmoMultiSelectDialog + class SelectGoodsDialogs : DmoMultiSelectDialog { protected override void CreateQuery(VLayoutPanel vPanel) { @@ -29,12 +29,12 @@ namespace BWP.Web.Pages.B3ClientService.Dialogs grid.Columns.Add(new DFBrowseGridColumn("MainUnit")); } - protected override void SetResultFromDFDataRow(ClientGoodsSet_Detail dmo, Forks.EnterpriseServices.DataForm.DFDataRow row) + protected override void SetResultFromDFDataRow(Goods dmo, Forks.EnterpriseServices.DataForm.DFDataRow row) { - dmo.Goods_ID = (long)row["ID"]; - dmo.Goods_Name = (string)row["Name"]; - dmo.Goods_Code = (string)row["Code"]; - dmo.Goods_Spec = (string)row["Spec"]; + dmo.ID = (long)row["ID"]; + dmo.Name = (string)row["Name"]; + dmo.Code = (string)row["Code"]; + dmo.Spec = (string)row["Spec"]; } } } diff --git a/B3ClientService/BL/Bill/CarcassInventoryBL.cs b/B3ClientService/BL/Bill/CarcassInventoryBL.cs index d501513..67283e4 100644 --- a/B3ClientService/BL/Bill/CarcassInventoryBL.cs +++ b/B3ClientService/BL/Bill/CarcassInventoryBL.cs @@ -1,4 +1,5 @@ using BWP.B3ClientService.BO; +using BWP.B3ClientService.Rpcs; using BWP.B3Frameworks.BL; using Forks.EnterpriseServices.BusinessInterfaces; using System; @@ -14,5 +15,10 @@ namespace BWP.B3ClientService.BL public class CarcassInventoryBL : BillBL, ICarcassInventoryBL { + protected override void beforeSave(CarcassInventory dmo) + { + CarcassInventoryRpc.FillStoreInfo(dmo, Session); + base.beforeSave(dmo); + } } } diff --git a/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory.cs b/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory.cs index c14769a..c31dec0 100644 --- a/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory.cs +++ b/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory.cs @@ -21,6 +21,7 @@ namespace BWP.B3ClientService.BO [DFExtProperty("WebControlType", DFEditControl.ChoiceBox)] [DFDataKind(B3ClientServiceConsts.DataSources.生产批次)] [DFExtProperty(B3FrameworksConsts.DFExtProperties.QueryDataKind, B3ClientServiceConsts.DataSources.生产批次)] + [DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "ProductBatch_Name")] public long? ProductBatch_ID { get; set; } private CarcassInventory_SummaryDetailCollection _details = new CarcassInventory_SummaryDetailCollection(); diff --git a/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory_SummaryDetail.cs b/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory_SummaryDetail.cs index f89ddd0..b8b880d 100644 --- a/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory_SummaryDetail.cs +++ b/B3ClientService/BO/Bill/CarcassInventory/CarcassInventory_SummaryDetail.cs @@ -19,9 +19,11 @@ namespace BWP.B3ClientService.BO public long? Goods_ID { get; set; } [LogicName("头数")] + [DFNotEmpty] public int Number { get; set; } [LogicName("重量")] + [DFNotEmpty] public decimal Weight { get; set; } [LogicName("账存头数")] diff --git a/B3ClientService/OfflinRpc/CarcassInventoryRpc.cs b/B3ClientService/OfflinRpc/CarcassInventoryRpc.cs index d421fa7..b3a0a93 100644 --- a/B3ClientService/OfflinRpc/CarcassInventoryRpc.cs +++ b/B3ClientService/OfflinRpc/CarcassInventoryRpc.cs @@ -93,7 +93,7 @@ namespace BWP.B3ClientService.Rpcs return productBatchID; } - static void FillStoreInfo(CarcassInventory dmo, IDmoSession session) + public static void FillStoreInfo(CarcassInventory dmo, IDmoSession session) { var numCol = DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Field("Number"), DQExpression.Multiply(DQExpression.Value(-1), DQExpression.Field("Number")))); var weightCol = DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("InStore", true), DQExpression.Field("Weight"), DQExpression.Multiply(DQExpression.Value(-1), DQExpression.Field("Weight")))); @@ -105,14 +105,13 @@ namespace BWP.B3ClientService.Rpcs query.Columns.Add(DQSelectColumn.Create(numCol, "Number")); query.Columns.Add(DQSelectColumn.Create(weightCol, "Weight")); - query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("Goods_ID"))); query.Having.Conditions.Add(DQCondition.Or(DQCondition.InEQ(DQExpression.IfNull(numCol, DQExpression.Value(0)), DQExpression.Value(0)), DQCondition.InEQ(DQExpression.IfNull(weightCol, DQExpression.Value(0)), DQExpression.Value(0)))); using (var reader = session.ExecuteReader(query)) { while (reader.Read()) { - var gid = (long)reader[0]; + var gid = (long?)reader[0]; var f = dmo.Details.FirstOrDefault(x => x.Goods_ID == gid); if (f == null) { diff --git a/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs b/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs index aee65e2..57bbfb9 100644 --- a/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs +++ b/B3ClientService/Rpcs/BillRpc/OrderDetailRpc.cs @@ -506,6 +506,8 @@ namespace BWP.B3ClientService.Rpcs.BillRpc update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1)))); update.Columns.Add(new DQUpdateColumn("PlanNumber", DQExpression.Add(DQExpression.Field("PlanNumber"), DQExpression.Value(subNumber)))); session.ExecuteNonQuery(update); + + UpdateSecondOrder(ID, session); } static long? GetOrderID(long weightBillId)