private static void UpdateDetail(ProductNotice dmo) { foreach (var detail in dmo.Details) { DmoUtil.RefreshDependency(detail, "Goods_ID"); } }
private void CreateFrozenOutStore(WorkShopPackBill dmo) { var bl = BIFactory.Create <IFrozenOutStoreBL>(Session); var bo = new FrozenOutStore(); bl.InitNewDmo(bo); bo.AccountingUnit_ID = dmo.AccountingUnit_ID; bo.Department_ID = dmo.Department_ID; bo.WorkBill_ID = dmo.ID; bo.Date = dmo.Date; var group = dmo.Details.GroupBy(x => new { x.PlanNumber_ID, x.Goods_ID }); foreach (var one in group) { var de = new FrozenOutStore_Detail(); de.Goods2_ID = one.Key.Goods_ID; de.Goods_ID = GetBanChengPinByGoodsID(one.Key.Goods_ID) ?? 0; DmoUtil.RefreshDependency(de, "Goods_ID", "Goods2_ID"); de.PlanNumber_ID = one.Key.PlanNumber_ID; de.Number = one.Sum(x => (x.Number ?? 0).Value); if (de.Goods_SecondUnitII_MainUnitRatio != null && de.Goods_SecondUnitII_MainUnitRatio != 0) { de.SecondNumber2 = de.Number / de.Goods_SecondUnitII_MainUnitRatio * de.Goods_SecondUnitII_SecondUnitRatio; } if (de.Goods_MainUnitRatio != null && de.Goods_MainUnitRatio != 0) { de.SecondNumber = de.Number / de.Goods_MainUnitRatio * de.Goods_SecondUnitRatio; } bo.Details.Add(de); } bl.Insert(bo); }
static void SetSecondNumberByNumber(ProduceOutput dmo) { foreach (ProduceOutput_Detail detail in dmo.Details) { DmoUtil.RefreshDependency(detail, "Goods_ID"); if (detail.Goods_UnitConvertDirection == null) { continue; } if (detail.Goods_UnitConvertDirection == 主辅转换方向.双向转换 || detail.Goods_UnitConvertDirection == 主辅转换方向.由主至辅) { //辅单位数量 if (detail.Goods_MainUnitRatio != null && detail.Goods_SecondUnitRatio != null) { detail.SecondNumber = detail.Number * detail.Goods_SecondUnitRatio / detail.Goods_MainUnitRatio; } //辅单位Ⅱ数量 if (detail.Goods_SecondUnitII_MainUnitRatio != null && detail.Goods_SecondUnitII_SecondUnitRatio != null) { detail.SecondNumber2 = detail.Number * detail.Goods_SecondUnitII_SecondUnitRatio / detail.Goods_SecondUnitII_MainUnitRatio; } } } }
private void AddToolsPanel(HLayoutPanel toobar) { toobar.Add(new SimpleLabel("选择存货")); var goodsSelect = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(120), AutoPostBack = true, EnableMultiSelection = true, EnableInputArgument = true }; toobar.Add(goodsSelect); goodsSelect.SelectedValueChanged += (sender, e) => { _detailGrid.GetFromUI(); foreach (var sGoodsID in goodsSelect.GetValues()) { var goods = GoodsBL.Instance.Load(Convert.ToInt64(sGoodsID)); var detail = new PackingRecipients_Detail(); detail.Goods_ID = goods.ID; DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } goodsSelect.DisplayValue = string.Empty; _detailGrid.DataBind(); }; // var quickSelctButton = new DialogButton { Url = "~/B3UnitedInfos/Dialogs/QucicklySelectGoodsDetailsDialog.aspx", Text = "快速选择" }; // quickSelctButton.Click += delegate { // ReceiveSelectedGoodsDetailDialog(); // }; // toobar.Add(quickSelctButton); }
private void AddToolsPanel(HLayoutPanel toobar) { toobar.Add(new SimpleLabel("选择存货")); var goodsSelect = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(120), AutoPostBack = true, EnableMultiSelection = true, EnableInputArgument = true }; toobar.Add(goodsSelect); goodsSelect.SelectedValueChanged += (sender, e) => { _detailGrid.GetFromUI(); foreach (var sGoodsID in goodsSelect.GetValues()) { var goodsid = Convert.ToInt64(sGoodsID); if (Dmo.Details.Any(x => x.Goods_ID == goodsid)) { continue; } var detail = new PackingBagType_Detail(); detail.Goods_ID = goodsid; DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } goodsSelect.DisplayValue = string.Empty; _detailGrid.DataBind(); }; }
private void CreateOutputDetailPanel(VLayoutPanel vPanel) { var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new LiteralControl("<h2>明细清单:</h2>")); if (CanSave) { hPanel.Add(new TSButton("载入明细")).Click += delegate { GetFromUI(); Dmo.Details.Clear(); AddLoadDetailQy(); outputDetailGrid.DataBind(); AspUtil.Alert(this, "载入投入明细成功"); }; hPanel.Add(new SimpleLabel("选择存货")); var selectEmp = hPanel.Add(new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true }); selectEmp.SelectedValueChanged += delegate { outputDetailGrid.GetFromUI(); if (!selectEmp.IsEmpty) { var empID = long.Parse(selectEmp.Value); if (!Dmo.Details.Any(x => x.Goods_ID == empID)) { var d = new ProduceInput_Detail() { Goods_ID = empID }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectEmp.Clear(); outputDetailGrid.DataBind(); }; } var detailEditor = new DFCollectionEditor <ProduceInput_Detail>(() => Dmo.Details) { AllowDeletionFunc = () => CanSave, CanDeleteFunc = detail => CanSave, IsEditableFunc = (field, detail) => CanSave }; outputDetailGrid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(100) }); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); AddDetailColumn(outputDetailGrid); }
private void ReceiveSelectedGoodsDetailDialog() { var selectedList = DialogUtil.GetCachedObj <SelectedGoodsDetail>(this); selectedList.Select(item => new ProductNotice_Detail { Goods_ID = item.Goods_ID, Number = item.Number, SecondNumber = item.SecondNumber }).ToList() .EEnumerate(detail => DmoUtil.RefreshDependency(detail, "Goods_ID")) .EAddToCollection(Dmo.Details); _detailGrid.DataBind(); }
private void CreateInputDetailPanel(VLayoutPanel vPanel) { var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new LiteralControl("<h2>投入明细:</h2>")); if (CanSave) { hPanel.Add(new SimpleLabel("选择存货")); var selectEmp = hPanel.Add(new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true }); selectEmp.SelectedValueChanged += delegate { inputDetailGrid.GetFromUI(); if (!selectEmp.IsEmpty) { var empID = long.Parse(selectEmp.Value); if (!Dmo.InputDetails.Any(x => x.Goods_ID == empID)) { var d = new ProductPlan_InputDetail() { Goods_ID = empID }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.InputDetails.Add(d); } } selectEmp.Clear(); inputDetailGrid.DataBind(); }; } var detailEditor = new DFCollectionEditor <ProductPlan_InputDetail>(() => Dmo.InputDetails); detailEditor.AllowDeletionFunc = () => CanSave; detailEditor.CanDeleteFunc = (detail) => CanSave; detailEditor.IsEditableFunc = (field, detail) => CanSave; inputDetailGrid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(100) }); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("PlanNumber")); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("PlanSecondNumber")); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit")); inputDetailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Remark")); }
public static long InsertProductInStore(ProductInStore dmo) { using (var context = new TransactionContext()) { var bl = BIFactory.Create <IProductInStoreBL>(context); bl.InitNewDmo(dmo); dmo.InStoreDate = BLContext.Today; foreach (var detail in dmo.Details) { DmoUtil.RefreshDependency(detail, "Goods_ID"); } bl.Insert(dmo); context.Commit(); return(dmo.ID); } }
public static long AppInsert(ProductInStore dmo) { var bl = BIFactory.Create <IProductInStoreBL>(); foreach (ProductInStore_Detail detail in dmo.Details) { DmoUtil.RefreshDependency(detail, "Goods_ID"); if (detail.Number == null && detail.SecondNumber.HasValue) { detail.Number = detail.SecondNumber * detail.Goods_MainUnitRatio / detail.Goods_SecondUnitRatio; } } // bl.InitNewDmo(dmo); dmo.Domain_ID = DomainContext.Current.ID; bl.Insert(dmo); return(dmo.ID); }
private void CreateStoreDetailPanel(VLayoutPanel vPanel) { var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new LiteralControl("<h2>仓库明细:</h2>")); if (CanSave) { hPanel.Add(new SimpleLabel("选择仓库")); var selectStore = hPanel.Add(new ChoiceBox(B3FrameworksConsts.DataSources.授权仓库) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true }); selectStore.SelectedValueChanged += delegate { storeDetailGrid.GetFromUI(); if (!selectStore.IsEmpty) { var storeID = long.Parse(selectStore.Value); if (!Dmo.StoreDetails.Any(x => x.Store_ID == storeID)) { var d = new ProductInStoreTemplate_StoreDetail() { Store_ID = storeID }; DmoUtil.RefreshDependency(d, "Store_ID"); Dmo.StoreDetails.Add(d); } } selectStore.Clear(); storeDetailGrid.DataBind(); }; } var detailEditor = new DFCollectionEditor <ProductInStoreTemplate_StoreDetail>(() => Dmo.StoreDetails); detailEditor.AllowDeletionFunc = () => CanSave; detailEditor.CanDeleteFunc = (detail) => CanSave; detailEditor.IsEditableFunc = (field, detail) => CanSave; storeDetailGrid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(100) }); storeDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Store_Name")); storeDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Store_Code")); storeDetailGrid.Columns.Add(new DFEditGridColumn("Remark")); }
private void AddCopyAndPaste(HLayoutPanel toobar) { toobar.Add(new TSButton("复制", delegate { GoodsDetailSummaryClipboardUtil.Copy(Dmo.Details.Select(item => (GoodsDetailSummaryBase)item).ToList()); AspUtil.Alert(this, "复制成功!"); })); if (CanSave) { toobar.Add(new TSButton("粘贴", delegate { var list = GoodsDetailSummaryClipboardUtil.Paste <ProductNotice_Detail>(); foreach (var detail in list) { DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } _detailGrid.DataBind(); })); } }
private void CreateOutputDetailPanel(TitlePanel tPanel) { var hPanel = new HLayoutPanel(); if (CanSave) { tPanel.Controls.Add(hPanel); hPanel.Add(new SimpleLabel("选择存货")); var selectEmp = hPanel.Add(new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true }); mDFContainer.AddNonDFControl(selectEmp, "$SelectGoods"); selectEmp.SelectedValueChanged += delegate { _detailGrid.GetFromUI(); if (!selectEmp.IsEmpty) { var empID = long.Parse(selectEmp.Value); if (!Dmo.Details.Any(x => x.Goods_ID == empID)) { var d = new ProduceFinish_Detail() { Goods_ID = empID }; var last = Dmo.Details.LastOrDefault(); if (last != null) { d.BrandItem_ID = last.BrandItem_ID; d.BrandItem_Name = last.BrandItem_Name; } DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectEmp.Clear(); _detailGrid.DataBind(); var script = B3ButcheryWebUtil.SetCursorPositionScript(butcheryConfig.ProduceFinishCursorField, "$DetailGrid", Dmo.Details.Count, _detailGrid.PageSize); if (!string.IsNullOrEmpty(script)) { Page.ClientScript.RegisterStartupScript(GetType(), "Startup", script, true); } }; var addGoodsbt = hPanel.Add(new DialogButton { Text = "选择存货", }); addGoodsbt.Url = "/B3Butchery/Dialogs/SelectGoodsDialog.aspx"; addGoodsbt.Click += delegate { _detailGrid.GetFromUI(); var details = DialogUtil.GetCachedObj <TemGoodsDetail>(this); foreach (var temGoodsDetail in details) { var detail = new ProduceFinish_Detail { Goods_ID = temGoodsDetail.Goods_ID }; DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } _detailGrid.DataBind(); }; var addbt = hPanel.Add(new DialogButton { Text = "选择生产通知单", }); addbt.Url = "/B3Butchery/Dialogs/SelectProductNoticeDialog.aspx"; addbt.Click += delegate { _detailGrid.GetFromUI(); var details = DialogUtil.GetCachedObj <ProduceFinish_Detail>(this); foreach (var temGoodsDetail in details) { DmoUtil.RefreshDependency(temGoodsDetail, "Goods_ID"); Dmo.Details.Add(temGoodsDetail); } _detailGrid.DataBind(); }; AddCustomerToolBar(hPanel); } var detailEditor = new DFCollectionEditor <ProduceFinish_Detail>(() => Dmo.Details) { AllowDeletionFunc = () => CanSave, CanDeleteFunc = detail => CanSave, IsEditableFunc = (field, detail) => CanSave }; _detailGrid = new DFEditGrid(detailEditor) { Width = Unit.Percentage(100) }; mDFContainer.AddNonDFControl(_detailGrid, "$DetailGrid"); _detailGrid.NextRowOnEnter = true; _detailGrid.LastRowOnDown = "__DFContainer.getControl('$SelectGoods').behind.focus();"; tPanel.Controls.Add(_detailGrid); if (_useBrand) { _detailGrid.Columns.Add(new DFEditGridColumn("BrandItem_ID")); } _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); _detailGrid.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); _detailGrid.Add(new DFEditGridColumn <DFTextBox>("Number")); _detailGrid.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); _detailGrid.Add(new DFEditGridColumn <DFTextBox>("SecondNumber")); _detailGrid.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Remark")); _detailGrid.ValueColumns.Add("Goods_UnitConvertDirection"); _detailGrid.ValueColumns.Add("Goods_MainUnitRatio"); _detailGrid.ValueColumns.Add("Goods_SecondUnitRatio"); new Main_Second_ConvertRatioRowManager(_detailGrid, "Number", "SecondNumber"); }
private void CreateDetailPanel(TitlePanel titlePanel) { var hPanel = titlePanel.EAdd(new HLayoutPanel()); hPanel.Add(new LiteralControl("<h2>入库清单:</h2>")); if (CanSave) { hPanel.Add(new SimpleLabel("选择存货")); var selectGoods = hPanel.Add(new ChoiceBox(B3ButcheryDataSource.存货带编号) { Width = Unit.Pixel(130), EnableMultiSelection = true, EnableInputArgument = true, AutoPostBack = true }); selectGoods.SelectedValueChanged += delegate { detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { foreach (var item in selectGoods.GetValues()) { var d = new ProductInStore_Temp_Detail() { Goods_ID = long.Parse(item) }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectGoods.Clear(); detailGrid.DataBind(); }; var addGoodsbt = hPanel.Add(new DialogButton { Text = "选择存货", }); addGoodsbt.Url = "/B3Butchery/Dialogs/SelectGoodsDialog.aspx"; addGoodsbt.Click += delegate { detailGrid.GetFromUI(); var details = DialogUtil.GetCachedObj <TemGoodsDetail>(this); foreach (var temGoodsDetail in details) { var detail = new ProductInStore_Temp_Detail(); detail.Goods_ID = temGoodsDetail.Goods_ID; DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } detailGrid.DataBind(); }; } var detailGridEditor = new DFCollectionEditor <ProductInStore_Temp_Detail>(() => Dmo.Details); detailGridEditor.AllowDeletionFunc = () => CanSave; detailGridEditor.CanDeleteFunc = (detail) => CanSave; detailGridEditor.IsEditableFunc = (field, detail) => CanSave; detailGrid = titlePanel.EAdd(new DFEditGrid(detailGridEditor) { Width = Unit.Percentage(100) }); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); new MainToSecondConvertRowManger(detailGrid); var section = mPageLayoutManager.AddSection("DetailColumns", "明细列"); section.ApplyLayout(detailGrid, mPageLayoutManager, DFInfo.Get(typeof(ProductInStore_Temp_Detail))); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); var hPanel2 = new HLayoutPanel() { Align = HorizontalAlign.Left }; titlePanel.Controls.Add(detailGrid); }
public void Import(Stream fileStream) { var man = new ExcelImportManager(); var accColumn = man.Add(new ExecelImportColumn() { Name = "会计单位", Required = true, Nullable = false }); var deptColumn = man.Add(new ExecelImportColumn() { Name = "部门", Required = true, Nullable = false }); var empColumn = man.Add(new ExecelImportColumn() { Name = "经办人", Required = true, Nullable = false }); var timeColumn = man.Add(new ExecelImportColumn() { Name = "日期", Required = true, Nullable = false }); var planNumberColumn = man.Add(new ExecelImportColumn() { Name = "计划号", Required = false, Nullable = true }); var productLinksColumn = man.Add(new ExecelImportColumn() { Name = "生产环节", Required = false, Nullable = true }); var remarkColumn = man.Add(new ExecelImportColumn() { Name = "摘要", Required = false, Nullable = true }); var nameColumn = man.Add(new ExecelImportColumn() { Name = "存货名称", Required = true, Nullable = false }); var codeColumn = man.Add(new ExecelImportColumn() { Name = "存货编码", Required = false, Nullable = true }); var numberColumn = man.Add(new ExecelImportColumn() { Name = "数量", Required = true, Nullable = false }); var detailRemarkColumn = man.Add(new ExecelImportColumn() { Name = "备注", Required = false, Nullable = true }); var billList = new DmoCollection <ProduceOutput>(); int i = 0; using (var context = new TransactionContext()) { var bl = BIFactory.Create <IProduceOutputBL>(context); foreach (var row in man.Parse(fileStream)) { var bill = new ProduceOutput(); bl.InitNewDmo(bill); i++; bill.ID = i; billList.Add(bill); long accID = default(long); if (accColumn.TryGetIDByName <AccountingUnit>(row, ref accID)) { bill.AccountingUnit_ID = accID; } long deptID = default(long); if (deptColumn.TryGetIDByName <Department>(row, ref deptID)) { bill.Department_ID = deptID; } long empID = default(long); if (empColumn.TryGetIDByName <Employee>(row, ref empID)) { bill.Employee_ID = empID; } long planNumberID = default(long); if (ExecelImportHelper.TryGetID <ProductPlan>(planNumberColumn, row, "PlanNumber", ref planNumberID)) { bill.PlanNumber_ID = planNumberID; } long productLinksID = default(long); if (productLinksColumn.TryGetIDByName <ProductLinks>(row, ref productLinksID)) { bill.ProductLinks_ID = productLinksID; } DateTime time = default(DateTime); if (timeColumn.TryGetValue(row, ref time)) { bill.Time = time; } bill.Remark = remarkColumn.GetStringValue(row); var detail = new ProduceOutput_Detail(); long goodsID = default(long); if (codeColumn.TryGetIDByCode <Goods>(row, ref goodsID)) { detail.Goods_ID = goodsID; } else if (nameColumn.TryGetIDByName <Goods>(row, ref goodsID)) { detail.Goods_ID = goodsID; } decimal number = default(decimal); if (numberColumn.TryGetValue(row, ref number)) { detail.Number = number; } detail.Remark = detailRemarkColumn.GetStringValue(row); DmoUtil.RefreshDependency(detail, "Goods_ID"); ConvertToSecondNumber(detail); bill.Details.Add(detail); } foreach (var group in billList.GroupBy(x => new { x.Time, x.AccountingUnit_ID, x.Employee_ID, x.Department_ID, x.PlanNumber_ID, x.ProductLinks_ID })) { var dmo = group.FirstOrDefault(); foreach (var produceOutput in group) { if (dmo.ID == produceOutput.ID) { continue; } foreach (var detail in produceOutput.Details) { dmo.Details.Add(detail); } } dmo.ID = 0; bl.Insert(dmo); } context.Commit(); } }
private void CreateDetailPanel(TitlePanel titlePanel) { var hPanel = titlePanel.EAdd(new HLayoutPanel()); hPanel.Add(new LiteralControl("<h2>入库清单:</h2>")); if (CanSave) { hPanel.Add(new SimpleLabel("选择存货")); var selectGoods = hPanel.Add(new ChoiceBox(B3ButcheryDataSource.存货带编号) { Width = Unit.Pixel(130), EnableMultiSelection = true, EnableInputArgument = true, AutoPostBack = true }); selectGoods.SelectedValueChanged += delegate { detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { foreach (var item in selectGoods.GetValues()) { var d = new ProductInStore_Temp_Detail() { Goods_ID = long.Parse(item), ProductionDate = DateTime.Today, Price = 0 }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectGoods.Clear(); detailGrid.DataBind(); }; var addGoodsbt = hPanel.Add(new DialogButton { Text = "选择存货", }); addGoodsbt.Url = "/B3Butchery/Dialogs/SelectGoodsDialog.aspx"; addGoodsbt.Click += delegate { detailGrid.GetFromUI(); var details = DialogUtil.GetCachedObj <TemGoodsDetail>(this); foreach (var temGoodsDetail in details) { var detail = new ProductInStore_Temp_Detail(); detail.Goods_ID = temGoodsDetail.Goods_ID; DmoUtil.RefreshDependency(detail, "Goods_ID"); detail.TaxRate = detail.Goods_TaxRate; detail.Number = temGoodsDetail.Number; detail.SecondNumber = temGoodsDetail.SecondNumber; Dmo.Details.Add(detail); } detailGrid.DataBind(); }; var updateButton = hPanel.Add(new TSButton("更新生产计划号", delegate { GetFromUI(); foreach (var item in Dmo.Details) { item.ProductPlan_ID = Dmo.ProductPlan_ID; item.ProductPlan_Name = Dmo.ProductPlan_Name; } detailGrid.DataBind(); })); } var detailGridEditor = new DFCollectionEditor <ProductInStore_Temp_Detail>(() => Dmo.Details); detailGridEditor.AllowDeletionFunc = () => CanSave; detailGridEditor.CanDeleteFunc = (detail) => CanSave; detailGridEditor.IsEditableFunc = (field, detail) => CanSave; detailGrid = titlePanel.EAdd(new DFEditGrid(detailGridEditor) { Width = Unit.Percentage(100) }); detailGrid.Columns.Add(new DFEditGridColumn("ProductionDate")); var productPlanCol = new DFEditGridColumn <DFChoiceBox>("ProductPlan_ID"); productPlanCol.InitEditControl += delegate(object sender, InitEditControlEventArgs <DFChoiceBox> e) { e.Control.DataKind = B3ButcheryDataSource.计划号; e.Control.DFDisplayField = "ProductPlan_Name"; e.Control.EnableInputArgument = true; e.Control.EnableTopItem = true; e.Control.Width = Unit.Pixel(120); }; detailGrid.Columns.Add(productPlanCol); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); var script = @" var id =parseInt(this.front.value); simpleRestCall('/MainSystem/B3Butchery/Rpcs/GoodsBatchRpc/Get', [id,['ProductionDate','QualityDays']], function(result,dfContainer){ dfContainer.setValue('ProductionDate',getDateTime(result.ProductionDate)); dfContainer.setValue('QualityDays',result.QualityDays ); },{context:this.dfContainer});"; detailGrid.Columns.EAdd(new DFEditGridColumn <DFChoiceBox>("GoodsBatch_ID")).InitEditControl += (sender, e) => { e.Control.EnableTopItem = true; e.Control.OnBeforeDrop = "this.codeArgument = dfContainer.getValue('Goods_ID');this.dialogArguments='Goods_ID=' + this.codeArgument+'&TaxRate='+dfContainer.getValue('TaxRate')+'&TmpTaxRate='+dfContainer.getValue('TmpTaxRate')"; e.Control.DataKind = B3UnitedInfosConsts.DataSources.存货批次; e.Control.DFDisplayField = "GoodsBatch_Name"; e.Control.DialogUrl = WpfPageUrl.ToGlobal("~/B3Butchery/Dialogs/GoodsBatchEdit.aspx?IsNewDialog=1"); e.Control.OnClientSelected = script; e.Control.Width = Unit.Pixel(160); }; detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Number")).SumMode = SumMode.Sum;; detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("SecondNumber")).SumMode = SumMode.Sum;; detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Price")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Money")).SumMode = SumMode.Sum;; detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Remark")); detailGrid.ValueColumns.Add("Goods_ID"); detailGrid.ValueColumns.Add("Goods_UnitConvertDirection"); detailGrid.ValueColumns.Add("Goods_MainUnitRatio"); detailGrid.ValueColumns.Add("Goods_SecondUnitRatio"); new MainToSecondConvertRowManger(detailGrid); var section = mPageLayoutManager.AddSection("DetailColumns", "明细列"); section.ApplyLayout(detailGrid, mPageLayoutManager, DFInfo.Get(typeof(ProductInStore_Temp_Detail))); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); var hPanel2 = new HLayoutPanel() { Align = HorizontalAlign.Left }; titlePanel.Controls.Add(detailGrid); }
private void AddPayDetails(TitlePanel titlePanel) { var vPanel = titlePanel.EAdd(new VLayoutPanel()); if (CanSave) { var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new SimpleLabel("选择存货")); var selectGoods = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true, EnableTopItem = true, EnableMultiSelection = true }; selectGoods.SelectedValueChanged += delegate { _detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { var gids = selectGoods.GetValues().Distinct(); foreach (var g in gids) { var d = new ClientGoodsSet_Detail() { Goods_ID = long.Parse(g) }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectGoods.Clear(); _detailGrid.DataBind(); }; hPanel.Add(selectGoods); var addGoods = hPanel.Add(new DialogButton { Text = "选择存货", }); addGoods.Url = "SelectGoodsDialogs.aspx"; addGoods.Click += delegate { _detailGrid.GetFromUI(); foreach (var goodsID in DialogUtil.GetCachedObj <long>(this)) { if (Dmo.Details.Any(x => x.Goods_ID == goodsID)) { continue; } var detail = new ClientGoodsSet_Detail() { Goods_ID = goodsID }; DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } _detailGrid.DataBind(); }; } ; var editor = new DFCollectionEditor <ClientGoodsSet_Detail>(() => Dmo.Details); editor.AllowDeletionFunc = () => CanSave; editor.CanDeleteFunc = detail => CanSave; editor.IsEditableFunc = (field, detail) => CanSave; _detailGrid = new DFEditGrid(editor); _detailGrid.DFGridSetEnabled = false; _detailGrid.Width = Unit.Percentage(100); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("GoodsProperty_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_StandardSecondNumber")); _detailGrid.ValueColumns.Add("Goods_ID"); var section = mPageLayoutManager.AddSection("GoodsDetaiColumns", "存货明细"); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(ClientGoodsSet_Detail))); vPanel.Add(_detailGrid); }
private void CreateDetailPanel(TitlePanel titlePanel) { var vPanel = new VLayoutPanel(); titlePanel.Controls.Add(vPanel); var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); if (CanSave) { hPanel.Add(new SimpleLabel("成品明细")); var selectGoods = hPanel.Add(new ChoiceBox(B3ButcheryDataSource.存货带编号) { Width = Unit.Pixel(130), EnableMultiSelection = true, EnableInputArgument = true, AutoPostBack = true }); selectGoods.SelectedValueChanged += delegate { _detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { foreach (var item in selectGoods.GetValues()) { var d = new ProductPackaging_Detail() { Goods_ID = long.Parse(item) }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectGoods.Clear(); _detailGrid.DataBind(); }; } var detailEditor = new DFCollectionEditor <ProductPackaging_Detail>(() => Dmo.Details); detailEditor.AllowDeletionFunc = () => CanSave; detailEditor.CanDeleteFunc = (detail) => CanSave; detailEditor.IsEditableFunc = (field, detail) => CanSave; detailEditor.CanSelectFunc = (detail) => CanSave; _detailGrid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(100) }); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); _detailGrid.Columns.EAdd(new DFEditGridColumn <DFChoiceBox>("NeiGoods_ID")).InitEditControl += (sender, e) => { e.Control.DataKind = B3ButcheryDataSource.存货带编号; e.Control.DFDisplayField = "NeiGoods_Name"; e.Control.Width = Unit.Pixel(180); e.Control.EnableInputArgument = true; e.Control.EnableTopItem = true; }; _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("NeiGoods_Code")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("NeiGoodsRatio")); _detailGrid.Columns.EAdd(new DFEditGridColumn <DFChoiceBox>("WaiGoods_ID")).InitEditControl += (sender, e) => { e.Control.DataKind = B3ButcheryDataSource.存货带编号; e.Control.DFDisplayField = "WaiGoods_Name"; e.Control.Width = Unit.Pixel(180); e.Control.EnableInputArgument = true; e.Control.EnableTopItem = true; }; _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("WaiGoods_Code")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("WaiGoodsRatio")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Remark")); var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(ProductPackaging_Detail))); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); }
private void AddDetails(TitlePanel titlePanel) { var vPanel = titlePanel.EAdd(new VLayoutPanel()); if (CanSave) { var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new SimpleLabel("选择存货")); var selectGoods = hPanel.Add(new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableMultiSelection = true, EnableInputArgument = true, AutoPostBack = true }); selectGoods.SelectedValueChanged += delegate { _detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { foreach (var item in selectGoods.GetValues()) { if (Dmo.Details.Any(x => x.Goods_ID == long.Parse(item))) { continue; } var detail = new WorkShopCountConfig_Detail { Goods_ID = long.Parse(item) }; DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } } selectGoods.Clear(); _detailGrid.DataBind(); }; //var addGoodsbt = hPanel.Add(new DialogButton //{ // Text = "选择计数名称", //}); //addGoodsbt.Url = "/B3Butchery/Dialogs/SelectGoodsDialog.aspx"; //addGoodsbt.Click += delegate //{ // _detailGrid.GetFromUI(); // var details = DialogUtil.GetCachedObj<TemGoodsDetail>(this); // foreach (var temGoodsDetail in details) // { // var detail = new WorkShopCountConfig_Detail { Goods_ID = temGoodsDetail.Goods_ID }; // DmoUtil.RefreshDependency(detail, "Goods_ID"); // Dmo.Details.Add(detail); // } // _detailGrid.DataBind(); //}; } var editor = new DFCollectionEditor <WorkShopCountConfig_Detail>(() => Dmo.Details) { AllowDeletionFunc = () => CanSave, CanDeleteFunc = detail => true, IsEditableFunc = (field, detail) => CanSave }; _detailGrid = new DFEditGrid(editor) { DFGridSetEnabled = false, Width = Unit.Percentage(100) }; _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("GoodsProperty_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); _detailGrid.Columns.EAdd(new DFEditGridColumn <DFValueLabel>("Goods_MainUnitRatio")).HeaderText = "主辅换算主单位比例"; _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnitII_MainUnitRatio")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnitII")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("DefaultNumber1")); _detailGrid.ValueColumns.Add("Goods_ID"); var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(WorkShopCountConfig_Detail))); vPanel.Add(_detailGrid); }
private void AddDetail(TitlePanel titlePanel) { var vPanel = titlePanel.EAdd(new VLayoutPanel()); if (CanSave) { var hPanel = new HLayoutPanel(); vPanel.Add(hPanel, new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new SimpleLabel("选择存货")); var selectGoods = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true, EnableTopItem = true, EnableMultiSelection = true }; selectGoods.SelectedValueChanged += delegate { detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { var gids = selectGoods.GetValues().Distinct(); foreach (var g in gids) { if (Dmo.Details.Any(x => x.Goods_ID == long.Parse(g))) { continue; } var d = new Picking_Detail() { Goods_ID = long.Parse(g) }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectGoods.Clear(); detailGrid.DataBind(); }; hPanel.Add(selectGoods); } var editor = new DFCollectionEditor <Picking_Detail>(() => Dmo.Details); 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 <DFValueLabel>("Goods_Code")); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Number")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("SecondNumber")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Remark")); detailGrid.ValueColumns.Add("Goods_ID"); detailGrid.ValueColumns.Add("Goods_UnitConvertDirection"); detailGrid.ValueColumns.Add("Goods_MainUnitRatio"); detailGrid.ValueColumns.Add("Goods_SecondUnitRatio"); mDFContainer.AddNonDFControl(detailGrid, "$detailGrid"); var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); section.SetRequired("Number", "SecondNumber"); section.ApplyLayout(detailGrid, mPageLayoutManager, DFInfo.Get(typeof(Picking_Detail))); new NumberSecondNumberConvertRowMangerWithMoneyChanged(detailGrid); vPanel.Add(detailGrid); }
private void AddToolsBar(HLayoutPanel hPanel) { if (!CanSave) { return; } hPanel.Add(new SimpleLabel("选择存货")); var selectGoods = hPanel.Add(new ChoiceBox(B3ButcheryDataSource.存货带编号) { Width = Unit.Pixel(130), EnableMultiSelection = true, EnableInputArgument = true, AutoPostBack = true }); mDFContainer.AddNonDFControl(selectGoods, "$SelectGoods"); selectGoods.SelectedValueChanged += delegate { detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { var config = new B3ButcheryConfig(); DateTime?productionDate = null; //判断当前配置 否为当天时间,是 为入库时间 默认是 否 if (config.ProductInStoreChooseDate.Value) { productionDate = Dmo.InStoreDate; } else { productionDate = DateTime.Today; } foreach (var item in selectGoods.GetValues()) { var d = new ProductInStore_Detail() { Goods_ID = long.Parse(item), ProductionDate = productionDate, Price = 0 }; DmoUtil.RefreshDependency(d, "Goods_ID"); var last = Dmo.Details.LastOrDefault(); if (last != null) { d.BrandItem_ID = last.BrandItem_ID; d.BrandItem_Name = last.BrandItem_Name; } Dmo.Details.Add(d); } } selectGoods.Clear(); detailGrid.DataBind(); var script = B3ButcheryWebUtil.SetCursorPositionScript(butcheryConfig.ProductInStoreCursorField, "$DetailGrid", Dmo.Details.Count, detailGrid.PageSize); if (!string.IsNullOrEmpty(script)) { Page.ClientScript.RegisterStartupScript(GetType(), "Startup", script, true); } }; var addGoodsbt = hPanel.Add(new DialogButton { Text = "选择存货", }); addGoodsbt.Url = "/B3Butchery/Dialogs/SelectGoodsDialog.aspx"; addGoodsbt.Click += delegate { detailGrid.GetFromUI(); var details = DialogUtil.GetCachedObj <TemGoodsDetail>(this); foreach (var temGoodsDetail in details) { var detail = new ProductInStore_Detail(); detail.Goods_ID = temGoodsDetail.Goods_ID; DmoUtil.RefreshDependency(detail, "Goods_ID"); detail.TaxRate = detail.Goods_TaxRate; detail.Number = temGoodsDetail.Number; detail.SecondNumber = temGoodsDetail.SecondNumber; Dmo.Details.Add(detail); } detailGrid.DataBind(); }; hPanel.Add(new SimpleLabel("生产日期")); var selectDate = new DateInput(); hPanel.Add(selectDate); var summary = new TSButton() { Text = "统一生产日期" }; summary.Click += (sender, e) => { if (!selectDate.IsEmpty) { detailGrid.GetFromUI(); var date = selectDate.Value; foreach (var r in Dmo.Details) { r.ProductionDate = date; } detailGrid.DataBind(); } }; hPanel.Add(summary); var quickSelctButton = new DialogButton() { Url = "~/B3UnitedInfos/Dialogs/QucicklySelectGoodsDetailsDialog.aspx", Text = "快速选择" }; quickSelctButton.Click += delegate { ReceiveSelectedGoodsDetailDialog(); }; hPanel.Add(quickSelctButton); hPanel.Add(new TSButton("更新生产计划号", delegate { GetFromUI(); foreach (var item in Dmo.Details) { item.ProductPlan_ID = Dmo.ProductPlan_ID; item.ProductPlan_Name = Dmo.ProductPlan_Name; } detailGrid.DataBind(); })); ProduceFinishBtn(hPanel, this);//耘垦选择生产完工单button var loadProductInStoreTemp = hPanel.Add(new DialogButton { Text = "选择模板", }); loadProductInStoreTemp.Url = "/B3Butchery/Dialogs/ProductInStoreTempDialog.aspx"; loadProductInStoreTemp.Click += delegate { detailGrid.GetFromUI(); var temp = DialogUtil.GetCachedObj <ProductInStore_Temp>(this).FirstOrDefault(); Dmo.AccountingUnit_ID = temp.AccountingUnit_ID; Dmo.AccountingUnit_Name = temp.AccountingUnit_Name; Dmo.Department_ID = temp.Department_ID; Dmo.Department_Name = temp.Department_Name; Dmo.Employee_ID = temp.Employee_ID; Dmo.Employee_Name = temp.Employee_Name; Dmo.InStoreType_ID = temp.InStoreType_ID; Dmo.InStoreType_Name = temp.InStoreType_Name; Dmo.Store_ID = temp.Store_ID; Dmo.Store_Name = temp.Store_Name; Dmo.CheckEmployee_ID = temp.CheckEmployee_ID; Dmo.CheckEmployee_Name = temp.CheckEmployee_Name; Dmo.CheckDate = temp.CheckDate; if (Dmo.InStoreDate != null) { Dmo.InStoreDate = temp.InStoreDate; } foreach (var de in temp.Details) { var detail = new ProductInStore_Detail(); detail.BrandItem_ID = de.BrandItem_ID; detail.BrandItem_Name = de.BrandItem_Name; detail.Goods_ID = de.Goods_ID; detail.Goods_Name = de.Goods_Name; detail.Goods_Spec = de.Goods_Spec; detail.Goods_Code = de.Goods_Code; DmoUtil.RefreshDependency(detail, "Goods_ID"); Dmo.Details.Add(detail); } AppToUI(); detailGrid.DataBind(); }; }
private void CreateDetailPanel(TitlePanel titlePanel) { var hPanel = titlePanel.EAdd(new HLayoutPanel()); hPanel.Add(new LiteralControl("<h2>入库清单:</h2>")); AddToolsBar(hPanel); hPanel.Add(new TSButton("复制", delegate { GoodsDetailSummaryClipboardUtil.Copy(Dmo.Details.Select((item) => (GoodsDetailSummaryBase)item).ToList()); AspUtil.Alert(this, "复制成功"); })); if (CanSave) { hPanel.Add(new TSButton("粘贴", delegate { var list = GoodsDetailSummaryClipboardUtil.Paste <ProductInStore_Detail>(); foreach (var detail in list) { Dmo.Details.Add(detail); DmoUtil.RefreshDependency(detail, "Goods_ID"); } detailGrid.DataBind(); })); } if (CanSave) { if (EnableAddSameCargoSpace) { AddSameCargoSpace(hPanel); } } var detailGridEditor = new DFCollectionEditor <ProductInStore_Detail>(() => Dmo.Details); detailGridEditor.AllowDeletionFunc = () => CanSave; detailGridEditor.CanDeleteFunc = (detail) => CanSave; detailGridEditor.IsEditableFunc = (field, detail) => { switch (field.Name) { case "GoodsBatch_ID": return(GoodsUtil.EnableBatch(detail.Goods_ID, detail.GoodsProperty_ID) && CanSave); case "Money": return(false); case "SecondNumber": var hasSecondUnit = !string.IsNullOrEmpty(detail.Goods_SecondUnit); return(CanSave && hasSecondUnit); } return(CanSave); }; detailGrid = titlePanel.EAdd(new DFEditGrid(detailGridEditor) { Width = Unit.Percentage(100), ShowLineNo = true }); mDFContainer.AddNonDFControl(detailGrid, "$DetailGrid"); detailGrid.NextRowOnEnter = true; detailGrid.LastRowOnDown = "__DFContainer.getControl('$SelectGoods').behind.focus();"; if (GlobalFlags.get(B3UnitedInfosConsts.GlobalFlags.库存支持品牌项)) { detailGrid.Columns.Add(new DFEditGridColumn("BrandItem_ID")); } detailGrid.Columns.Add(new DFEditGridColumn("ProductionDate")); var productPlanCol = new DFEditGridColumn <DFChoiceBox>("ProductPlan_ID"); productPlanCol.InitEditControl += delegate(object sender, InitEditControlEventArgs <DFChoiceBox> e) { e.Control.DataKind = B3ButcheryDataSource.计划号; e.Control.DFDisplayField = "ProductPlan_Name"; e.Control.EnableInputArgument = true; e.Control.EnableTopItem = true; e.Control.Width = Unit.Pixel(120); }; detailGrid.Columns.Add(productPlanCol); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); var script = @" var id =parseInt(this.front.value); simpleRestCall('/MainSystem/B3Butchery/Rpcs/GoodsBatchRpc/Get', [id,['ProductionDate']], function(result,dfContainer){ dfContainer.setValue('ProductionDate',getDateTime(result.ProductionDate)); },{context:this.dfContainer});"; detailGrid.Columns.EAdd(new DFEditGridColumn <DFChoiceBox>("GoodsBatch_ID")).InitEditControl += (sender, e) => { e.Control.EnableTopItem = true; e.Control.OnBeforeDrop = "this.codeArgument = dfContainer.getValue('Goods_ID');this.dialogArguments='Goods_ID=' + this.codeArgument+'&TaxRate='+dfContainer.getValue('TaxRate')+'&TmpTaxRate='+dfContainer.getValue('TmpTaxRate')"; e.Control.DataKind = B3UnitedInfosConsts.DataSources.存货批次; e.Control.DFDisplayField = "GoodsBatch_Name"; e.Control.DialogUrl = WpfPageUrl.ToGlobal("~/B3Butchery/Dialogs/GoodsBatchEdit.aspx?IsNewDialog=1"); e.Control.OnClientSelected = script; e.Control.Width = Unit.Pixel(160); }; detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); var cargoSpaceColumn = detailGrid.Columns.EAdd(new DFEditGridColumn <DFChoiceBox>("CargoSpace_ID")); cargoSpaceColumn.InitEditControl += (sender, e) => { e.Control.EnableTopItem = true; e.Control.OnBeforeDrop = "this.codeArgument = __DFContainer.getValue('Store_ID');"; e.Control.DataKind = B3FrameworksConsts.DataSources.货位; e.Control.DFDisplayField = "CargoSpace_Name"; e.Control.Width = Unit.Pixel(160); }; detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Number")).SumMode = SumMode.Sum; detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit")); detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("SecondNumber")).SumMode = SumMode.Sum; if (CheckDefaultRole("隐藏单价")) { detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Price")); } AddColumn(detailGrid); if (CheckDefaultRole("隐藏单价")) { detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Money")).SumMode = SumMode.Sum; } detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Remark")); detailGrid.ValueColumns.Add("Goods_ID"); detailGrid.ValueColumns.Add("Goods_UnitConvertDirection"); detailGrid.ValueColumns.Add("Goods_MainUnitRatio"); detailGrid.ValueColumns.Add("Goods_SecondUnitRatio"); new MainToSecondConvertRowManger(detailGrid); var section = mPageLayoutManager.AddSection("DetailColumns", "明细列"); section.ApplyLayout(detailGrid, mPageLayoutManager, DFInfo.Get(typeof(ProductInStore_Detail))); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); }
private void CreateDetailPanel(TitlePanel titlePanel) { var vPanel = new VLayoutPanel(); titlePanel.Controls.Add(vPanel); var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); if (CanSave) { hPanel.Add(new SimpleLabel("成品明细")); var selectGoods = hPanel.Add(new ChoiceBox(B3ButcheryDataSource.存货带编号) { Width = Unit.Pixel(130), EnableMultiSelection = true, EnableInputArgument = true, AutoPostBack = true }); selectGoods.SelectedValueChanged += delegate { _detailGrid.GetFromUI(); if (!selectGoods.IsEmpty) { var index = 1; foreach (var item in selectGoods.GetValues()) { var d = new TemporaryStorage_Detail { Goods_ID = long.Parse(item) }; var serialNumber = Dmo.Details.Max(x => x.SerialNumber); if (serialNumber == null) { d.SerialNumber = index++; } else { d.SerialNumber = serialNumber + 1; } DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectGoods.Clear(); _detailGrid.DataBind(); }; } var detailEditor = new DFCollectionEditor <TemporaryStorage_Detail>(() => Dmo.Details) { AllowDeletionFunc = () => CanSave, CanDeleteFunc = detail => CanSave, IsEditableFunc = (field, detail) => CanSave, CanSelectFunc = detail => CanSave }; _detailGrid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(100) }); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("SerialNumber")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Number")); var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(TemporaryStorage_Detail))); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); }
private void AddDetails(TitlePanel titlePanel) { var vPanel = titlePanel.EAdd(new VLayoutPanel()); if (CanSave) { var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new SimpleLabel("选择存货")); var selectEmp = hPanel.Add(new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true }); selectEmp.SelectedValueChanged += delegate { _detailGrid.GetFromUI(); if (!selectEmp.IsEmpty) { var empID = long.Parse(selectEmp.Value); var d = new WorkShopRecord() { Goods_ID = empID }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } selectEmp.Clear(); _detailGrid.DataBind(); }; } var editor = new DFCollectionEditor <WorkShopRecord>(() => Dmo.Details) { AllowDeletionFunc = () => CanSave, CanDeleteFunc = detail => true, IsEditableFunc = (field, detail) => CanSave }; _detailGrid = new DFEditGrid(editor) { DFGridSetEnabled = false, Width = Unit.Percentage(100) }; _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("PlanNumber_Name")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("ChaCarBoardCode")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("BarCode")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Number")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("SecondNumber")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit")); _detailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("SecondNumber2")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnitII")); _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Remark")); var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列"); titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name); section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(WorkShopRecord))); vPanel.Add(_detailGrid); }
protected virtual void AddToolsPanel(HLayoutPanel toobar) { toobar.Add(new SimpleLabel("选择存货")); var goodsSelect = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(120), AutoPostBack = true, EnableMultiSelection = true, EnableInputArgument = true }; mDFContainer.AddNonDFControl(goodsSelect, "$SelectGoods"); toobar.Add(goodsSelect); goodsSelect.SelectedValueChanged += (sender, e) => { _detailGrid.GetFromUI(); last = Dmo.Details.LastOrDefault(); foreach (var sGoodsID in goodsSelect.GetValues()) { var goods = GoodsBL.Instance.Load(Convert.ToInt64(sGoodsID)); var detail = new ProductNotice_Detail(); detail.Goods_ID = goods.ID; DmoUtil.RefreshDependency(detail, "Goods_ID"); AddBrandItem(detail); Dmo.Details.Add(detail); } goodsSelect.DisplayValue = string.Empty; _detailGrid.DataBind(); var script = B3ButcheryWebUtil.SetCursorPositionScript(butcheryConfig.ProductNoticeCursorField, "$detailGrid", Dmo.Details.Count, _detailGrid.PageSize); if (!string.IsNullOrEmpty(script)) { Page.ClientScript.RegisterStartupScript(GetType(), "Startup", script, true); } }; var quickSelctButton = new DialogButton { Url = "~/B3UnitedInfos/Dialogs/QucicklySelectGoodsDetailsDialog.aspx", Text = "快速选择" }; quickSelctButton.Click += delegate { ReceiveSelectedGoodsDetailDialog(); }; toobar.Add(quickSelctButton); var dialogButton = new DialogButton { Url = "~/B3UnitedInfos/Dialogs/SelectGoodsDetailDialog.aspx", Text = "查询存货" }; toobar.Add(dialogButton); dialogButton.Click += delegate { ReceiveSelectedGoodsDetailDialog(); }; toobar.Add(new TSButton("载入预报")).Click += delegate { GetFromUI(); Dmo.Details.Clear(); mBL.LoadPredictDetail(Dmo); _detailGrid.DataBind(); //AspUtil.Alert(this, "载入预报成功"); }; }
private void CreateOutputDetailPanel(VLayoutPanel vPanel) { var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left)); hPanel.Add(new LiteralControl("<h2>明细清单:</h2>")); if (CanSave) { hPanel.Add(new TSButton("载入明细")).Click += delegate { GetFromUI(); Dmo.Details.Clear(); AddLoadDetailQy(Dmo); outputDetailGrid.DataBind(); AspUtil.Alert(this, "载入产出明细成功"); }; hPanel.Add(new SimpleLabel("选择存货")); var selectEmp = hPanel.Add(new ChoiceBox(B3UnitedInfosConsts.DataSources.存货) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true }); selectEmp.SelectedValueChanged += delegate { outputDetailGrid.GetFromUI(); if (!selectEmp.IsEmpty) { var empID = long.Parse(selectEmp.Value); if (!Dmo.Details.Any(x => x.Goods_ID == empID)) { var d = new ProduceOutput_Detail() { Goods_ID = empID }; DmoUtil.RefreshDependency(d, "Goods_ID"); Dmo.Details.Add(d); } } selectEmp.Clear(); outputDetailGrid.DataBind(); }; } var detailEditor = new DFCollectionEditor <ProduceOutput_Detail>(() => Dmo.Details); detailEditor.AllowDeletionFunc = () => CanSave; detailEditor.CanDeleteFunc = (detail) => CanSave; detailEditor.IsEditableFunc = (field, detail) => CanSave; outputDetailGrid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(100) }); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name")); foreach (var ioc in TypeIOCCenter.GetIOCList <IOCs.BeforeDetailGridApplyLayout>(this.GetType())) { //仙坛添加数据 ioc.Invoke(outputDetailGrid); } outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Number")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("SecondNumber")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("SecondNumber2")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit2")); outputDetailGrid.Columns.Add(new DFEditGridColumn <DFTextBox>("Remark")); outputDetailGrid.ValueColumns.Add("Goods_UnitConvertDirection"); outputDetailGrid.ValueColumns.Add("Goods_MainUnitRatio"); outputDetailGrid.ValueColumns.Add("Goods_SecondUnitRatio"); new Main_Second_ConvertRatioRowManager(outputDetailGrid, "Number", "SecondNumber", "SecondNumber2"); }