Exemplo n.º 1
0
        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();
                }));
            }
        }
Exemplo n.º 2
0
        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);
        }