Example #1
0
        private static ClientGoodsSet FromProductNotice(IDmoSession session)
        {
            var client = new ClientGoodsSet();

            client.Name = "from生产通知单";//固定值
            var main   = new JoinAlias(typeof(ProductNotice));
            var detail = new JoinAlias(typeof(ProductNotice_Detail));
            var goods  = new JoinAlias(typeof(ButcheryGoods));
            var query  = new DQueryDom(main);

            query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "ProductNotice_ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(detail, "Goods_ID", goods, "ID"));
            query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "BillState", 20));
            query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(detail, "DeliveryDate", DateTime.Today.AddDays(-5)));
            query.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
            query.Columns.Add(DQSelectColumn.Field("DeliveryDate", detail));
            query.Columns.Add(DQSelectColumn.Field("GoodsProperty_ID", goods));
            query.Columns.Add(DQSelectColumn.Field("GoodsProperty_Name", goods));
            query.Columns.Add(DQSelectColumn.Field("MainUnitRatio", goods));
            query.Columns.Add(DQSelectColumn.Field("Spell", goods));
            query.Columns.Add(DQSelectColumn.Field("Spec", goods));
            query.Columns.Add(DQSelectColumn.Field("Code", goods));
            query.Columns.Add(DQSelectColumn.Field("SecondUnitII_MainUnitRatio", goods));
            query.Columns.Add(DQSelectColumn.Field("StandardSecondNumber", goods));

            using (var reader = session.ExecuteReader(query))
            {
                while (reader.Read())
                {
                    var clientDe = new  ClientGoodsSet_Detail();
                    clientDe.Goods_ID            = (long)reader[0];
                    clientDe.Goods_Name          = (string)reader[1];
                    clientDe.CompletedDate       = (DateTime?)reader[2];
                    clientDe.GoodsProperty_ID    = (long)reader[3];
                    clientDe.GoodsProperty_Name  = (string)reader[4];
                    clientDe.Goods_MainUnitRatio = (Money <decimal>?)reader[5];
                    clientDe.Goods_Spell         = (string)reader[6];
                    clientDe.Goods_Spec          = (string)reader[7];
                    clientDe.Goods_Code          = (string)reader[8];
                    clientDe.Goods_SecondUnitII_MainUnitRatio = (Money <decimal>?)reader[9];
                    clientDe.Goods_StandardSecondNumber       = (Money <decimal>?)reader[10];

                    client.Details.Add(clientDe);
                }
            }
            return(client);
        }
Example #2
0
        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);
        }