Ejemplo n.º 1
0
        private void UpdateDoneNumber(ProduceFinish dmo)
        {
            var ids    = dmo.Details.Select(x => x.ProductNotice_Detail_ID).ToList();
            var detail = new JoinAlias(typeof(ProduceFinish_Detail));
            var bill   = new JoinAlias(typeof(ProduceFinish));
            var dom    = new DQueryDom(detail);

            dom.From.AddJoin(JoinType.Inner, new DQDmoSource(bill), DQCondition.EQ(bill, "ID", detail, "ProduceFinish_ID"));
            dom.EAddCheckedCondition(bill);
            dom.Where.Conditions.EFieldInList(DQExpression.Field(detail, "ProductNotice_Detail_ID"), ids);

            dom.Columns.Add(DQSelectColumn.Sum(detail, "Number"));
            dom.Columns.Add(DQSelectColumn.Field("ProductNotice_Detail_ID", detail));
            dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "ProductNotice_Detail_ID"));

            var tupleList = dom.EExecuteList <Money <decimal>?, long>(Session);

            foreach (var id in ids)
            {
                var number = tupleList.Where(x => x.Item2 == id).Sum(x => ((x.Item1 ?? 0).Value));

                var update = new DQUpdateDom(typeof(ProductNotice_Detail));
                update.Columns.Add(new DQUpdateColumn("DoneNumber", number));
                update.Where.Conditions.Add(DQCondition.EQ("ID", id));
                Session.ExecuteNonQuery(update);
            }
        }
Ejemplo n.º 2
0
        public static bool UpdateGoodsPackingRelation(string json, string token)
        {
            if (token != "bwpsoft")
            {
                throw new Exception("请联系开发人员");
            }

            var list = JsonConvert.DeserializeObject <List <GoodsPackingRelationDto> >(json);

            using (var session = Dmo.NewSession())
            {
                foreach (GoodsPackingRelationDto dto in list)
                {
                    if (dto.GoodsPacking_ID == 0 || dto.Goods_ID == 0)
                    {
                        continue;
                    }

                    var updateDom = new DQUpdateDom(typeof(PackingBagType_Detail));
                    updateDom.Where.Conditions.Add(DQCondition.EQ("Goods_ID", dto.Goods_ID));
                    updateDom.Where.Conditions.Add(DQCondition.InSubQuery(DQExpression.Field("PackingBagType_ID"), GetSubQuery(dto.Department_ID)));
                    updateDom.Columns.Add(new DQUpdateColumn("GoodsPacking_ID", dto.GoodsPacking_ID));

                    session.ExecuteNonQuery(updateDom);
                }
                session.Commit();
            }
            return(true);
        }
Ejemplo n.º 3
0
        protected override void BuildBody(Control container)
        {
            var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer);
            var config        = new AutoLayoutConfig();

            config.Add("Date");
            config.Add("EndDate");
            config.Add("AccountingUnit_ID");
            config.Add("Department_ID");
            config.Add("Employee_ID");
            config.Add("PlanNumber");
            config.Add("ProductType");
            layoutManager.Config = config;
            container.Controls.Add(layoutManager.CreateLayout());

            var planNumberPanel = new HLayoutPanel();

            container.Controls.Add(planNumberPanel);
            planNumberButton = new TSButton();
            planNumberPanel.Add(planNumberButton).Click += delegate
            {
                if (Dmo.BillState == 单据状态.已审核 && !string.IsNullOrEmpty(Dmo.PlanNumber))
                {
                    using (var context = new TransactionContext())
                    {
                        var update = new DQUpdateDom(typeof(ProductPlan));
                        update.Where.Conditions.Add(DQCondition.EQ("PlanNumber", Dmo.PlanNumber));
                        update.Columns.Add(new DQUpdateColumn("PlanNumbers", true));

                        context.Session.ExecuteNonQuery(update);
                        context.Commit();
                    }

                    Dmo.PlanNumbers = true;
                    mBL.Update(Dmo);
                }
                AspUtil.RedirectAndAlert(this, Request.RawUrl, "计划号关闭成功");
            };
            var vPanel = container.EAdd(new VLayoutPanel());

            CreateInputDetailPanel(vPanel);
            CreateOutputDetailPanel(vPanel);
        }