예제 #1
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);
        }
예제 #2
0
        private DQueryDom GetQueryDom()
        {
            var query           = _mQueryContainer.Build();
            var root            = query.From.RootSource.Alias;
            var pptAlias        = JoinAlias.Create("gppt");
            var propertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog));
            var alreadySet      = new JoinAlias(typeof(Goods_Accounting_Store));

            query.From.AddJoin(JoinType.Left, new DQDmoSource(propertyCatalog), DQCondition.EQ(pptAlias, "GoodsPropertyCatalog_ID", propertyCatalog, "ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(alreadySet), DQCondition.EQ(root, "ID", alreadySet, "Goods_ID"));
            query.Columns.Add(DQSelectColumn.Field("ID", "存货ID"));
            query.Columns.Add(DQSelectColumn.Field("Code"));
            query.Columns.Add(DQSelectColumn.Field("Name"));
            query.Columns.Add(DQSelectColumn.Field("Spec"));
            query.Columns.Add(DQSelectColumn.Field("MainUnit"));
            query.Columns.Add(DQSelectColumn.Field("SecondUnit"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(pptAlias, "Name"), "存货属性"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(propertyCatalog, "Name"), "属性分类"));
            query.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name", alreadySet, "已配会计单位"));
            if (!_goodsPropertyCatalogBox.IsEmpty)
            {
                TreeUtil.AddTreeCondition <GoodsPropertyCatalog>(query, long.Parse(_goodsPropertyCatalogBox.Value), propertyCatalog);
            }
            if (_checkBox.Checked)
            {
                query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(alreadySet, "Goods_ID")));
            }
            return(query);
        }
예제 #3
0
            private static DQueryDom GetDom(DateTime?date)
            {
                var main = new JoinAlias("__frezenMain", typeof(FrozenOutStore));

                var detail = new JoinAlias(typeof(FrozenOutStore_Detail));
                var dom    = new DQueryDom(main);

                dom.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(detail, "FrozenOutStore_ID", main, "ID"));

                var exp = DQExpression.Snippet(" (CONVERT(varchar(10), [__frezenMain].[Date], 23))");

                dom.Columns.Add(DQSelectColumn.Create(exp, "Date"));
                dom.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
                dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, "Goods2_ID"), "成品ID"));
                dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, "Goods2_Name"), "成品Name"));

                dom.Columns.Add(DQSelectColumn.Field("Number", detail));
                dom.Columns.Add(DQSelectColumn.Field("SecondNumber2", detail));

                if (date != null)
                {
                    var c2 = DQCondition.LessThanOrEqual(main, "Date", date.Value.AddDays(2).AddSeconds(-1));
                    var c1 = DQCondition.GreaterThanOrEqual(main, "Date", date.Value.AddDays(1));
                    dom.Where.Conditions.Add(DQCondition.And(c1, c2));
                }
                dom.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 1));
                return(dom);
            }
예제 #4
0
        public DQueryDom CreatePartialQuery(AvailableStorageContext context)
        {
            var detail = new JoinAlias(typeof(ProductInStore_Detail));
            var bill   = new JoinAlias(typeof(ProductInStore));
            var query  = new DQueryDom(detail);

            query.From.AddJoin(JoinType.Inner, new DQDmoSource(bill), DQCondition.EQ(bill, "ID", detail, "ProductInStore_ID"));
            query.Where.Conditions.Add(DQCondition.EQ(bill, "BillState", 单据状态.未审核));
            if (context.Goods_ID.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.EQ("Goods_ID", context.Goods_ID));
            }
            if (context.Store_ID.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.EQ(bill, "Store_ID", context.Store_ID));
            }
            if (context.AccountingUnit_ID.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.EQ(bill, "AccountingUnit_ID", context.AccountingUnit_ID));
            }
            if (context.Date.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.LessThan(bill, "Time", context.Date.Value.Date.AddDays(1)));
            }

            query.Where.Conditions.Add(DQCondition.EQ(bill, "Domain_ID", DomainContext.Current.ID));

            query.Columns.Add(DQSelectColumn.Create(DQExpression.ConstValue("成品入库单"), "Source"));
            query.Columns.Add(DQSelectColumn.Field("Store_ID", bill));
            query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Multiply(DQExpression.Field("Number"), DQExpression.ConstValue(-1)), "Number"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Multiply(DQExpression.Field("SecondNumber"), DQExpression.ConstValue(-1)), "SecondNumber"));
            query.Columns.Add(DQSelectColumn.Field("GoodsBatch_ID"));
            return(query);
        }
예제 #5
0
        protected override DQueryDom GetQueryDom()
        {
            var dom    = base.GetQueryDom();
            var detail = JoinAlias.Create("detail");
            var alias  = dom.From.RootSource.Alias;

            dom.Columns.Add(DQSelectColumn.Field("ID", alias));
            dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, "ID"), "DetailID"));
            dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name"));
            dom.Columns.Add(DQSelectColumn.Field("Customer_Name"));
            dom.Columns.Add(DQSelectColumn.Field("Detail_Customer_Name", detail));
            dom.Columns.Add(DQSelectColumn.Field("ProductionUnit_ID"));
            dom.Columns.Add(DQSelectColumn.Field("ProductionUnit_Name"));
            dom.Columns.Add(DQSelectColumn.Field("Date", "单据日期"));
            dom.Columns.Add(DQSelectColumn.Field("ProduceDate", detail));
            dom.Columns.Add(DQSelectColumn.Field("DeliveryDate", detail));
            dom.Columns.Add(DQSelectColumn.Field("ProduceRequest", detail, "工艺描述"));
            dom.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
            dom.Columns.Add(DQSelectColumn.Field("Goods_MainUnit", detail));
            dom.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit", detail));
            dom.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
            dom.Columns.Add(DQSelectColumn.Field("Number", detail));
            dom.Columns.Add(DQSelectColumn.Field("SecondNumber", detail));
            dom.Columns.Add(DQSelectColumn.Field("DoneNumber", detail));
            dom.Columns.Add(DQSelectColumn.Field("BrandItem_Name", detail));
            dom.Columns.Add(DQSelectColumn.Field("BrandItem_ID", detail));
            dom.EAddCheckedCondition(alias);
            dom.Where.Conditions.Add(DQCondition.EQ(alias, "Domain_ID", DomainContext.Current.ID));
            if (_hideFinishedBill.Checked)
            {
                dom.Where.Conditions.Add(DQCondition.GreaterThan(DQExpression.Field(detail, "Number"), DQExpression.IfNull(DQExpression.Field(detail, "DoneNumber"), DQExpression.Value(0))));
            }
            return(dom);
        }
예제 #6
0
        static DQueryDom SaleForecastQuery(long?customer, DateTime?dates, IEnumerable <long?> ids = null)
        {
            if (!PluginManager.Current.Installed("B3Sale"))
            {
                return(null);
            }
            var detail = new JoinAlias(Type.GetType("BWP.B3Sale.BO.SaleForecast_Detail, B3Sale"));
            var bill   = new JoinAlias(Type.GetType("BWP.B3Sale.BO.SaleForecast, B3Sale"));
            var dom    = new DQueryDom(detail);

            dom.From.AddJoin(JoinType.Inner, new DQDmoSource(bill), DQCondition.EQ(detail, "SaleForecast_ID", bill, "ID"));
            dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(bill, "ID"), "Forecase_ID"));
            dom.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail));
            dom.Columns.Add(DQSelectColumn.Create(GetNumber(detail, "UnitNum"), "Number"));
            dom.Columns.Add(DQSelectColumn.Field("Unit", detail));
            dom.Columns.Add(DQSelectColumn.Field("Price", detail));
            dom.Columns.Add(DQSelectColumn.Field("Money", detail));
            dom.Columns.Add(DQSelectColumn.Field("SecondNumber", detail));
            dom.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit", detail));
            dom.Columns.Add(DQSelectColumn.Field("Remark", detail));
            dom.Columns.Add(DQSelectColumn.Field("Goods_Code", detail));
            dom.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
            dom.Columns.Add(DQSelectColumn.Field("Goods_Spec", detail));
            dom.Where.Conditions.Add(DQCondition.EQ(bill, "Customer_ID", customer));
            dom.Where.Conditions.Add(DQCondition.EQ(bill, "BillState", 单据状态.已审核));
            dom.Where.Conditions.Add(DQCondition.EQ(bill, "Domain_ID", DomainContext.Current.ID));
            if (ids != null)
            {
                dom.Where.Conditions.EFieldInList(DQExpression.Field(bill, "ID"), ids.ToArray());
            }
            var date = dates ?? BLContext.Today;

            dom.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(bill, "Date", date.Date.AddDays(-7)));//只显示7天内的预报
            return(dom);
        }
예제 #7
0
 protected override void AddQueryOptions(VLayoutPanel vPanel)
 {
     mDisplayHelper.AddOptionItem("单号", "bill", "ID", false);
     mDisplayHelper.AddOptionItem("日期", "bill", "Date", false);
     mDisplayHelper.AddOptionItem("生产单位", "bill", "ProductionUnit_Name", false);
     mDisplayHelper.AddOptionItem("会计单位", "bill", "AccountingUnit_Name", false);
     mDisplayHelper.AddOptionItem("部门", "bill", "Department_Name", false);
     mDisplayHelper.AddOptionItem("经办人", "bill", "Employee_Name", false);
     mDisplayHelper.AddOptionItem("客户", "bill", "Customer_Name", false);
     mDisplayHelper.AddOptionItem("存货属性", "detail", "GoodsProperty_Name", false);
     mDisplayHelper.AddOptionItem("品牌项", "detail", "BrandItem_Name", false);
     mDisplayHelper.AddOptionItem("产品线", "goods", "ProductLine_Name", false);
     mDisplayHelper.AddOptionItem("存货编号", "detail", "Goods_Code", false);
     mDisplayHelper.AddOptionItem("存货名称", "detail", "Goods_Name", false);
     mDisplayHelper.AddOptionItem("规格", "detail", "Goods_Spec", false);
     mDisplayHelper.AddOptionItem("主单位", "detail", "Goods_MainUnit", false);
     mDisplayHelper.AddOptionItem("主数量", "detail", "Number", true, true);
     mDisplayHelper.AddOptionItem("辅单位", "detail", "Goods_SecondUnit", false);
     mDisplayHelper.AddOptionItem("辅数量", "detail", "SecondNumber", true, true);
     mDisplayHelper.AddOptionItem("计划数量", "noticDetail", "Number", true, true);
     mDisplayHelper.AddOptionItem("未完成数量", () => {
         return(DQExpression.Subtract(DQExpression.Field(JoinAlias.Create("noticDetail"), "Number"), DQExpression.Field(JoinAlias.Create("noticDetail"), "DoneNumber")));
     }, true, true);
     AddQueryOption("选项", mDisplayHelper.GetAllDisplayNames(), mDisplayHelper.GetDefaultSelelectedDisplayNames());
     base.AddQueryOptions(vPanel);
 }
예제 #8
0
        private DQueryDom GetQueryDom()
        {
            var query           = _mQueryContainer.Build();
            var goods           = JoinAlias.Create("goods");
            var pptAlias        = JoinAlias.Create("gppt");
            var propertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog));

            query.From.AddJoin(JoinType.Left, new DQDmoSource(propertyCatalog), DQCondition.EQ(pptAlias, "GoodsPropertyCatalog_ID", propertyCatalog, "ID"));
            query.Columns.Add(DQSelectColumn.Field("ID", "序号"));
            query.Columns.Add(DQSelectColumn.Field("Code", goods, "存货编码"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "Name"), "存货名称"));
            query.Columns.Add(DQSelectColumn.Field("Spec", goods));
            query.Columns.Add(DQSelectColumn.Field("MainUnit", goods));
            query.Columns.Add(DQSelectColumn.Field("SecondUnit", goods));
            query.Columns.Add(DQSelectColumn.Field("Name", pptAlias, "存货属性"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(propertyCatalog, "Name"), "属性分类"));
            query.Columns.Add(DQSelectColumn.Field("Store_Name"));
            query.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name"));
            query.Where.Conditions.Add(DQCondition.EQ("AccountingUnit_Domain_ID", DomainContext.Current.ID));
            if (!_goodsPropertyCatalogBox.IsEmpty)
            {
                TreeUtil.AddTreeCondition <GoodsPropertyCatalog>(query, long.Parse(_goodsPropertyCatalogBox.Value), propertyCatalog);
            }
            return(query);
        }
예제 #9
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);
            }
        }
예제 #10
0
        public static List <ProductPlanInfo> GetProductPlanInfo(long[] id)
        {
            if (id.Length == 0)
            {
                return(new List <ProductPlanInfo>());
            }
            var query = new DQueryDom(new JoinAlias(typeof(ProductPlan)));

            query.Columns.Add(DQSelectColumn.Field("ID"));
            query.Columns.Add(DQSelectColumn.Field("PlanNumber"));
            query.Columns.Add(DQSelectColumn.Field("Date"));
            query.Columns.Add(DQSelectColumn.Field("RowVersion"));
            query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), id.Select(x => DQExpression.Value(x)).ToArray()));
            query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
            var result = query.EExecuteList <long, string, DateTime, int>();
            var rst    = new List <ProductPlanInfo>();

            foreach (var item in result)
            {
                rst.Add(new ProductPlanInfo {
                    ID = item.Item1, PlanNumber = item.Item2, PlanDate = item.Item3, RowVersion = item.Item4
                });
            }
            return(rst);
        }
예제 #11
0
        public static List <GoodsInfoDto> GetTodayGoodsByStore(long accountUnitId, long departId, long storeId, long productPlanId)
        {
            var list   = new List <GoodsInfoDto>();
            var bill   = new JoinAlias(typeof(ProduceOutput));
            var detail = new JoinAlias(typeof(ProduceOutput_Detail));
            var query  = new DQueryDom(bill);

            query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(bill, "ID", detail, "ProduceOutput_ID"));
            query.Where.Conditions.Add(DQCondition.EQ("AccountingUnit_ID", accountUnitId));

            //query.Where.Conditions.Add(DQCondition.EQ("Department_ID", departId));
            //DQCondition.EQ(string.Format("Department_TreeDeep{0}ID", context.Department_Depth), context.Department_ID)

            query.Where.Conditions.Add(DQCondition.EQ(bill, "Domain_ID", DomainContext.Current.ID));
            query.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.已审核));
            query.Where.Conditions.Add(DQCondition.And(DQCondition.GreaterThanOrEqual(bill, "Time", DateTime.Today.AddDays(-3)), DQCondition.LessThanOrEqual(bill, "Time", DateTime.Today.AddDays(1))));
            //query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(bill, "Time", DateTime.Today));
            //query.Where.Conditions.Add(DQCondition.LessThan(bill, "Time", DateTime.Today.AddDays(1)));
            query.Where.Conditions.Add(DQCondition.EQ("FrozenStore_ID", storeId));
            query.Where.Conditions.Add(DQCondition.EQ("PlanNumber_ID", productPlanId));
            query.Where.Conditions.Add(DQCondition.NotInSubQuery(DQExpression.Field(detail, "Goods_ID"), GetTodayGoodsByStoreSubQuery(accountUnitId, departId, storeId, productPlanId)));
            query.Where.Conditions.EFieldInList(DQExpression.Field(bill, "PlanNumber_ID"), GetProductPlan().Select(x => x.ID).ToArray());

            OrganizationUtil.AddOrganizationLimit(query, typeof(ProduceOutput));

            query.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
            //query.Columns.Add(DQSelectColumn.Field("Goods_InnerPackingPer", detail));
            query.Columns.Add(DQSelectColumn.Sum(detail, "Number"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Divide(DQExpression.Sum(DQExpression.Field(detail, "Number")), DQExpression.Field(detail, "Goods_InnerPackingPer")), "InnerPackingPer"));
            query.Columns.Add(DQSelectColumn.Field("Goods_InnerPackingPer", detail));
            //query.Columns.Add(DQSelectColumn.Create(DQExpression.Divide(DQExpression.Field(detail,"Number"),DQExpression.Field(detail, "Goods_InnerPackingPer")),"包装数"));


            query.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_ID"));
            query.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_Name"));
            query.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_InnerPackingPer"));

            using (var session = Dmo.NewSession())
            {
                using (var reader = session.ExecuteReader(query))
                {
                    while (reader.Read())
                    {
                        var goods = new GoodsInfoDto
                        {
                            Goods_ID              = (long)reader[0],
                            Goods_Name            = (string)reader[1],
                            Number                = (decimal?)(Money <decimal>?)reader[2],
                            InnerPackingPer       = (decimal?)reader[3],
                            Goods_InnerPackingPer = (decimal?)reader[4]
                        };
                        list.Add(goods);
                    }
                }
            }
            return(list);
        }
예제 #12
0
            public static void AddJoin(DQueryDom mainDom, JoinAlias selfAlias)
            {
                var root     = mainDom.From.RootSource.Alias;
                var datediff =
                    DQExpression.DateDiff(DQExpression.Field(selfAlias, "Date"), DQExpression.Field(root, "Time"));

                mainDom.From.AddJoin(JoinType.Left, new DQDmoSource(selfAlias), DQCondition.And(
                                         DQCondition.EQ(DQExpression.Value(-1), datediff),
                                         DQCondition.EQ(selfAlias, "Goods_ID", root, "Goods_ID")));
            }
예제 #13
0
        public static List <EmpInfoTable> GetEmpInfo()
        {
            var user    = new JoinAlias(typeof(WpfUser));
            var rel     = new JoinAlias(typeof(User_Employee));
            var emp     = new JoinAlias(typeof(Employee));
            var du      = new JoinAlias(typeof(DomainUser));
            var setting = new JoinAlias(typeof(B3ButcheryUserProfile));
            var query   = new DQueryDom(user);

            query.From.AddJoin(JoinType.Left, new DQDmoSource(rel), DQCondition.EQ(user, "ID", rel, "User_ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(emp), DQCondition.EQ(rel, "Employee_ID", emp, "ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(du), DQCondition.And(DQCondition.EQ(rel, "User_ID", du, "User_ID"), DQCondition.EQ(du, "Domain_ID", emp, "Domain_ID")));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(setting), DQCondition.EQ(du, "ID", setting, "ID"));


            query.Columns.Add(DQSelectColumn.Field("ID", user));
            query.Columns.Add(DQSelectColumn.Field("Name", user));
            query.Columns.Add(DQSelectColumn.Field("Domain_ID", emp));
            query.Columns.Add(DQSelectColumn.Field("ID", emp));
            query.Columns.Add(DQSelectColumn.Field("Name", emp));
            query.Columns.Add(DQSelectColumn.Field("Department_ID", emp));
            query.Columns.Add(DQSelectColumn.Field("Department_Name", emp));
            query.Columns.Add(DQSelectColumn.Field("AccountingUnit_ID", setting));
            query.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name", setting));
            query.Columns.Add(DQSelectColumn.Field("ProductionUnit_ID", setting));
            query.Columns.Add(DQSelectColumn.Field("ProductionUnit_Name", setting));
            query.Columns.Add(DQSelectColumn.Field("Remark", emp));
            query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(rel, "Employee_ID")));
            var list = new List <EmpInfoTable>();

            using (var context = new TransactionContext())
            {
                using (var reader = context.Session.ExecuteReader(query))
                {
                    while (reader.Read())
                    {
                        var entity = new EmpInfoTable();
                        entity.User_ID             = (long)reader[0];
                        entity.User_Name           = (string)reader[1];
                        entity.Domain_ID           = (long)reader[2];
                        entity.Employee_ID         = (long)reader[3];
                        entity.Employee_Name       = (string)reader[4];
                        entity.Department_ID       = (long?)reader[5];
                        entity.Department_Name     = (string)reader[6];
                        entity.AccountingUnit_ID   = (long?)reader[7];
                        entity.AccountingUnit_Name = (string)reader[8];
                        entity.ProductionUnit_ID   = (long?)reader[9];
                        entity.ProductionUnit_Name = (string)reader[10];
                        entity.Role = (string)reader[11];
                        list.Add(entity);
                    }
                }
            }
            return(list);
        }
예제 #14
0
        //载入存货列表
        public List <ProductPlanOrLinkOutput> GetGoodsList(ProduceOutput dmo)
        {
            var       planBill         = new JoinAlias(typeof(ProductPlan));
            var       outputPlanDetail = new JoinAlias(typeof(ProductPlan_OutputDetail));
            var       linkDetail       = new JoinAlias(typeof(ProductLinks_OutputDetail));
            DQueryDom query            = new DQueryDom(outputPlanDetail);

            query.From.AddJoin(JoinType.Inner, new DQDmoSource(planBill), DQCondition.EQ(planBill, "ID", outputPlanDetail, "ProductPlan_ID"));
            query.From.AddJoin(JoinType.Inner, new DQDmoSource(linkDetail), DQCondition.EQ(linkDetail, "Goods_ID", outputPlanDetail, "Goods_ID"));

            query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(planBill, "BillState", 单据状态.已审核),
                                                       DQCondition.EQ(planBill, "PlanNumber", dmo.PlanNumber_Name),
                                                       DQCondition.EQ(linkDetail, "ProductLinks_ID", dmo.ProductLinks_ID)));

            query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Name"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Code"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Spec"));
            query.Columns.Add(DQSelectColumn.Field("Goods_MainUnit"));
            query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit"));
            query.Columns.Add(DQSelectColumn.Sum("PlanNumber"));
            query.Columns.Add(DQSelectColumn.Sum("PlanSecondNumber"));

            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_ID"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Name"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Code"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Spec"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_MainUnit"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_SecondUnit"));

            var list = new List <ProductPlanOrLinkOutput>();

            using (var context = new TransactionContext())
            {
                using (var reader = context.Session.ExecuteReader(query))
                {
                    while (reader.Read())
                    {
                        var goodsList = new ProductPlanOrLinkOutput();
                        goodsList.Goods_ID         = (long)reader[0];
                        goodsList.Goods_Name       = (string)reader[1];
                        goodsList.Goods_Code       = (string)reader[2];
                        goodsList.Goods_Spec       = (string)reader[3];
                        goodsList.Goods_MainUnit   = (string)reader[4];
                        goodsList.Goods_SecondUnit = (string)reader[5];
                        goodsList.Number           = (Money <decimal>?)reader[6];
                        goodsList.SecondNumber     = (Money <decimal>?)reader[7];
                        list.Add(goodsList);
                    }
                }
            }

            return(list);
        }
예제 #15
0
        protected override DQueryDom GetQueryDom()
        {
            var query = base.GetQueryDom();

            OrganizationUtil.AddOrganizationLimit <Department>(query, "Department_ID");
            var detail     = JoinAlias.Create("detail");
            var goodsAlias = new JoinAlias(typeof(Goods));

            query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsAlias), DQCondition.EQ(detail, "Goods_ID", goodsAlias, "ID"));
            foreach (ListItem field in checkbox.Items)
            {
                if (field.Selected)
                {
                    if (sumFileds.Contains(field.Value))
                    {
                        query.Columns.Add(DQSelectColumn.Sum(detail, field.Value));
                        SumColumnIndexs.Add(query.Columns.Count - 1);
                    }
                    else if (goodsFields.Contains(field.Value))
                    {
                        query.Columns.Add(DQSelectColumn.Field(field.Value, goodsAlias));
                        query.GroupBy.Expressions.Add(DQExpression.Field(goodsAlias, field.Value));
                    }
                    else
                    {
                        query.Columns.Add(DQSelectColumn.Field(field.Value));
                        query.GroupBy.Expressions.Add(DQExpression.Field(field.Value));
                    }
                }
            }
            if (!string.IsNullOrEmpty(goodsName.Text))
            {
                query.Where.Conditions.Add(DQCondition.Or(DQCondition.Like(goodsAlias, "Name", goodsName.Text), DQCondition.Like(goodsAlias, "Spell", goodsName.Text)));
            }
            if (!string.IsNullOrEmpty(goodsCode.Text))
            {
                query.Where.Conditions.Add(DQCondition.Like(goodsAlias, "Code", goodsCode.Text));
            }
            if (sd.Value.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("Date", sd.Value.Value));
            }
            if (ed.Value.HasValue)
            {
                query.Where.Conditions.Add(DQCondition.LessThanOrEqual("Date", ed.Value.Value));
            }

            query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("BillState", 单据状态.已审核), DQCondition.EQ("Domain_ID", DomainContext.Current.ID)));
            if (query.Columns.Count == 0)
            {
                throw new Exception("至少选择一条显示列");
            }
            return(query);
        }
예제 #16
0
        public static IList <ProductInStoreTemplate> GetProductInStoreTemplate(long[] id)
        {
            if (id.Length == 0)
            {
                return(new List <ProductInStoreTemplate>());
            }
            var query = new DmoQuery(typeof(ProductInStoreTemplate));

            query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
            query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), id.Select(x => DQExpression.Value(x)).ToArray()));
            return(query.EExecuteList().Cast <ProductInStoreTemplate>().ToList());
        }
예제 #17
0
        protected override DQueryDom GetQueryDom()
        {
            var query = base.GetQueryDom();

            if (!planNumberBox.IsEmpty)
            {
                var qType  = typeof(ProductInStoreTemp);
                var detail = new JoinAlias(qType);
                query.RegisterQueryTable(qType, new string[] { "MainID" }, ProductInStoreTemp.GetQueryDom(planNumberBox.Value));
                query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(query.From.RootSource.Alias, "ID", detail, "MainID"));
                query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(detail, "MainID")));
            }
            return(query);
        }
예제 #18
0
        private static IEnumerable <WordPair> SelectGoodsBrand(ChoiceBoxArgument argu)
        {
            var query = new DQueryDom(new JoinAlias(typeof(Goods)));

            query.Range = SelectRange.Top(30);
            query.Columns.Add(DQSelectColumn.Field("Brand"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Brand"));
            if (!string.IsNullOrEmpty(argu.InputArgument))
            {
                query.Where.Conditions.Add(DQCondition.Like("Brand", argu.InputArgument));
            }
            return(query.EExecuteList <string>().Select((l)
                                                        => new WordPair(l, l)));
        }
예제 #19
0
        protected override DQueryDom GetQueryDom()
        {
            var main   = JoinAlias.Create("bill");
            var detail = JoinAlias.Create("detail");
            var query  = base.GetQueryDom();

            OrganizationUtil.AddOrganizationLimit <Department>(query, "Department_ID");
            foreach (ListItem field in _checkbox.Items)
            {
                if (field.Selected)
                {
                    switch (field.Text)
                    {
                    case "日期":
                    case "单据号":
                    case "会计单位":
                    case "部门":
                    case "仓库":
                    case "摘要":
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(main, field.Value), field.Text));
                        query.GroupBy.Expressions.Add(DQExpression.Field(main, field.Value));
                        break;

                    case "计划号":
                    case "存货名称":

                    case "存货编码":
                    case "规格":
                    case "主单位":
                    case "辅单位":
                    case "辅单位II":
                    case "备注":
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, field.Value), field.Text));
                        query.GroupBy.Expressions.Add(DQExpression.Field(detail, field.Value));
                        break;

                    case "主数量":

                    case "辅数量":
                    case "辅数量II":

                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, field.Value)), field.Text));
                        SumColumnIndexs.Add(query.Columns.Count - 1);
                        break;
                    }
                }
            }
            return(query);
        }
예제 #20
0
        protected override DQueryDom GetQueryDom()
        {
            var alias = new JoinAlias(typeof(tempClass));
            var query = new DQueryDom(alias);

            query.RegisterQueryTable(typeof(tempClass), new string[] { "Department_ID", "AccountingUnit_ID", "PlanNumber_ID", "AccountingUnit_Name", "PlanNumber_Name", "Name", "Code", "OutputNumber", "InStoreNumber" }, tempClass.GetQueryDom(mQueryContainer, sd, ed));
            foreach (ListItem field in checkbox.Items)
            {
                if (field.Selected)
                {
                    if (field.Value == "OutputNumber" || field.Value == "InStoreNumber")
                    {
                        query.Columns.Add(DQSelectColumn.Sum(field.Value));
                        SumColumnIndexs.Add(query.Columns.Count - 1);
                    }
                    else if (field.Value == "DiffNumber")
                    {
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Subtract(DQExpression.IfNull(DQExpression.Field("OutputNumber"), DQExpression.Value(0)), DQExpression.IfNull(DQExpression.Field("InStoreNumber"), DQExpression.Value(0)))), field.Text));
                        SumColumnIndexs.Add(query.Columns.Count - 1);
                    }
                    else
                    {
                        query.Columns.Add(DQSelectColumn.Field(field.Value));
                        query.GroupBy.Expressions.Add(DQExpression.Field(field.Value));
                    }
                }
            }
            var accids = mQueryContainer.GetControl <DFChoiceBox>("AccountingUnit_ID").Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

            var pnumberids = mQueryContainer.GetControl <DFChoiceBox>("PlanNumber_ID").Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

            if (accids.Length > 0)
            {
                query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("AccountingUnit_ID"), accids.Select(x => DQExpression.Value(long.Parse(x))).ToArray()));
            }

            if (pnumberids.Length > 0)
            {
                query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("PlanNumber_ID"), pnumberids.Select(x => DQExpression.Value(long.Parse(x))).ToArray()));
            }

            OrganizationUtil.AddOrganizationLimit <Department>(query, "Department_ID");

            if (query.Columns.Count == 0)
            {
                throw new Exception("至少选择一条显示列");
            }
            return(query);
        }
예제 #21
0
        static DQueryDom GetPlanDquery(out JoinAlias billAlias, bool isAndSetedGoods = false)
        {
            var bill = new JoinAlias(typeof(ProductPlan));

            billAlias = bill;
            var detail = new JoinAlias(typeof(ProductPlan_OutputDetail));
            var goods  = new JoinAlias(typeof(Goods));
            var query  = new DQueryDom(bill);

            query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(bill, "ID", detail, "ProductPlan_ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(goods, "ID", detail, "Goods_ID"));

            query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(bill, "Date", DateTime.Today));
            query.Where.Conditions.Add(DQCondition.LessThan(bill, "Date", DateTime.Today.AddDays(1)));
            query.Where.Conditions.Add(DQCondition.EQ(bill, "BillState", 单据状态.已审核));

            OrganizationUtil.AddOrganizationLimit(query, typeof(ProductPlan));

            query.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_MainUnit", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_UnitConvertDirection", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_MainUnitRatio", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnitRatio", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_Code", detail));

            query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnitII", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnitII_MainUnitRatio", detail));
            query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnitII_SecondUnitRatio", detail));

            query.Columns.Add(DQSelectColumn.Field("GoodsProperty_ID", goods));
            query.Columns.Add(DQSelectColumn.Field("GoodsProperty_Name", goods));
            query.Columns.Add(DQSelectColumn.Field("GoodsPropertyCatalog_Name", goods));

            //      query.Columns.Add(DQSelectColumn.Field("GoodsPropertyCatalog_Sort", goods));

            query.Columns.Add(DQSelectColumn.Field("Spell", goods));
            query.Columns.Add(DQSelectColumn.Field("Spec", goods));

            //      query.OrderBy.Expressions.Add(DQOrderByExpression.Create(goods, "GoodsPropertyCatalog_Sort"));

            query.Where.Conditions.Add(DQCondition.EQ(bill, "Domain_ID", DomainContext.Current.ID));
            if (isAndSetedGoods)
            {
                query.Where.Conditions.Add(DQCondition.InSubQuery(DQExpression.Field(goods, "ID"), GetAllSettingedGoodsSubQuery()));
            }
            return(query);
        }
예제 #22
0
        protected override DQueryDom GetQueryDom()
        {
            var dom  = base.GetQueryDom();
            var prop = new JoinAlias(typeof(GoodsProperty));

            dom.From.AddJoin(JoinType.Inner, new DQDmoSource(prop), DQCondition.EQ(prop, "ID", dom.From.RootSource.Alias, "GoodsProperty_ID"));
            var catalog = dom.EJoin <GoodsPropertyCatalog>("GoodsPropertyCatalog_ID", JoinType.Left, prop);

            dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(prop, "Name"), "存货属性"));
            dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(catalog, "Name"), "存货属性分类"));

            TreeUtil.AddTreeCondition <GoodsPropertyCatalog>(dom, mQueryContainer, "存货属性分类", catalog);
            DomainUtil.AddDomainPermissionLimit(dom, typeof(GoodsProperty), prop);
            return(dom);
        }
예제 #23
0
        void LoadOutputDetail()
        {
            Dmo.OutputDetails.Clear();
            var main   = new JoinAlias(typeof(ProductInStore));
            var detail = new JoinAlias(typeof(ProductInStore_Detail));
            var referencePirceAlias = new JoinAlias(typeof(GoodsReferencePrice));
            var query = new DQueryDom(detail);

            query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "ProductInStore_ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(referencePirceAlias), DQCondition.EQ(detail, "Goods_ID", referencePirceAlias, "Goods_ID"));
            query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Name"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Code"));
            query.Columns.Add(DQSelectColumn.Sum("Number"));
            query.Columns.Add(DQSelectColumn.Field("ReferencePrice", referencePirceAlias));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_ID"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Name"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Code"));
            query.GroupBy.Expressions.Add(DQExpression.Field(referencePirceAlias, "ReferencePrice"));
            query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(main, "AccountingUnit_ID", Dmo.AccountingUnit_ID), DQCondition.EQ(main, "Department_ID", Dmo.Department_ID), DQCondition.EQ(detail, "ProductPlan_ID", Dmo.PlanNumber_ID), DQCondition.EQ(main, "BillState", 单据状态.已审核)));
            using (var session = Forks.EnterpriseServices.DomainObjects2.Dmo.NewSession())
            {
                using (var reader = session.ExecuteReader(query))
                {
                    var inputSum = Dmo.InputDetails.Sum(x => x.Weight ?? 0);
                    while (reader.Read())
                    {
                        var d = new DailyProductReport_OutputDetail
                        {
                            Goods_ID   = (long?)reader[0],
                            Goods_Name = (string)reader[1],
                            Goods_Code = (string)reader[2],
                            Number     = ((Money <decimal>?)reader[3]).EToDecimal(),
                            Price      = ((decimal?)reader[4] ?? 0)
                        };
                        d.Money = d.Price * d.Number;
                        if (inputSum != 0)
                        {
                            d.OutputPrecent = d.Number / inputSum;
                        }
                        Dmo.OutputDetails.Add(d);
                    }
                }
            }
            outputGrid.DataBind();
        }
예제 #24
0
        private DQueryDom GetQueryDom()
        {
            var detail = new JoinAlias("__detail", typeof(ProduceOutput_Detail));
            var main   = new JoinAlias("__main", typeof(ProduceOutput));
            var goods  = new JoinAlias("__goods", typeof(ButcheryGoods));

            var query = new DQueryDom(detail);

            query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "ProduceOutput_ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(goods, "ID", detail, "Goods_ID"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Name"));
            query.Columns.Add(DQSelectColumn.Field("PlanNumber_Name", detail));

            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, "Remark"), "计数规格"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "SecondNumber")), "盘数"));

            query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "SecondNumber2")), "袋数"));

            query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(detail, "Number")), "重量"));

            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "PackageModel"), "包装模式"));

            query.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_Name"));
            query.GroupBy.Expressions.Add(DQExpression.Field(detail, "PlanNumber_Name"));
            query.GroupBy.Expressions.Add(DQExpression.Field(detail, "Remark"));
            query.GroupBy.Expressions.Add(DQExpression.Field(goods, "PackageModel"));

            if (Shift_ID != null)
            {
                query.Where.Conditions.Add(DQCondition.EQ(detail, "Goods_ProductShift_ID", Shift_ID));
            }
            if (PackMode != null)
            {
                query.Where.Conditions.Add(DQCondition.EQ(goods, "PackageModel", PackMode));
            }
            if (BeginDate != null)
            {
                query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "Time", BeginDate));
            }
            if (EndDate != null)
            {
                query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "Time", EndDate));
            }
            query.OrderBy.Expressions.Add(DQOrderByExpression.Create(DQExpression.Field(goods, "PackageModel"), false));
            return(query);
        }
예제 #25
0
            //        产出辅数量


            private static DQueryDom GetDom(DateTime?date)
            {
                var main = new JoinAlias("__produMain", typeof(ProduceOutput));

                var detail = new JoinAlias("__prodDetail", typeof(ProduceOutput_Detail));
                var dom    = new DQueryDom(main);

                dom.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(detail, "ProduceOutput_ID", main, "ID"));

                dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_ID", main));
                dom.Columns.Add(DQSelectColumn.Field("ProductionUnit_ID", main));
                dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name", main));
                dom.Columns.Add(DQSelectColumn.Field("Department_Name", main));
                var exp = DQExpression.Snippet(" (CONVERT(varchar(10), [__produMain].[Time], 23))");

                dom.Columns.Add(DQSelectColumn.Create(exp, "Time"));
                dom.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));


                dom.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
                dom.Columns.Add(DQSelectColumn.Field("GoodsCategory_ID", detail));
                dom.Columns.Add(DQSelectColumn.Sum(detail, "Number"));
                dom.Columns.Add(DQSelectColumn.Sum(detail, "SecondNumber2"));



                dom.GroupBy.Expressions.Add(exp);
                dom.GroupBy.Expressions.Add(DQExpression.Field(main, "AccountingUnit_ID"));
                dom.GroupBy.Expressions.Add(DQExpression.Field(main, "ProductionUnit_ID"));
                dom.GroupBy.Expressions.Add(DQExpression.Field(main, "AccountingUnit_Name"));
                dom.GroupBy.Expressions.Add(DQExpression.Field(main, "Department_Name"));
                dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_ID"));
                dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_Name"));
                dom.GroupBy.Expressions.Add(DQExpression.Field(detail, "GoodsCategory_ID"));

                if (date != null)
                {
                    var c2 = DQCondition.LessThanOrEqual(main, "Time", date.Value.AddDays(1).AddSeconds(-1));
                    var c1 = DQCondition.GreaterThanOrEqual(main, "Time", date.Value);
                    dom.Where.Conditions.Add(DQCondition.And(c1, c2));
                }

                dom.Where.Conditions.Add(DQCondition.EQ(main, "BillState", 单据状态.已审核));
                return(dom);
            }
예제 #26
0
        public static List <RpcEasyProductInStore> GetProductInStoreList()
        {
            var query = new DQueryDom(new JoinAlias(typeof(ProductInStore)));

            query.Columns.Add(DQSelectColumn.Field("ID"));
            query.Columns.Add(DQSelectColumn.Field("InStoreDate"));
            query.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.未审核));
            OrganizationUtil.AddOrganizationLimit(query, typeof(ProductInStore));
            OrganizationUtil.AddOrganizationLimit <Store>(query, "Store_ID");
            query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("InStoreDate")));
            try
            {
                return(query.EExecuteList <long, DateTime>().Select(x => new RpcEasyProductInStore(x.Item1, x.Item2)).ToList());
            }
            catch (Exception)
            {
                return(new List <RpcEasyProductInStore>());
            }
        }
예제 #27
0
        public static DQueryDom GetQueryDom(string planNumber)
        {
            var query = new DQueryDom(new JoinAlias(typeof(ProductInStore_Detail)));

            query.Columns.Add(DQSelectColumn.Field("ProductInStore_ID", "MainID"));
            if (!string.IsNullOrEmpty(planNumber))
            {
                var expression = new List <IDQExpression>();
                foreach (var item in planNumber.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    expression.Add(DQExpression.Value(long.Parse(item)));
                }
                if (expression.Count > 0)
                {
                    query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ProductPlan_ID"), expression.ToArray()));
                }
            }
            query.Distinct = true;
            return(query);
        }
예제 #28
0
        protected override DQueryDom GetQueryDom()
        {
            var dom  = base.GetQueryDom();
            var bill = dom.From.RootSource.Alias;

            mDisplayHelper.AddAlias("bill", JoinAlias.Create("bill"));
            var detail      = new JoinAlias("detail", typeof(ProduceFinish_Detail));
            var noticDetail = new JoinAlias("noticDetail", typeof(ProductNotice_Detail));
            var goods       = new JoinAlias("goods", typeof(Goods));

            mDisplayHelper.AddAlias("detail", JoinAlias.Create("detail"));
            mDisplayHelper.AddAlias("noticDetail", JoinAlias.Create("noticDetail"));
            mDisplayHelper.AddAlias("goods", JoinAlias.Create("goods"));
            dom.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(bill, "ID", detail, "ProduceFinish_ID"));
            dom.From.AddJoin(JoinType.Left, new DQDmoSource(noticDetail), DQCondition.EQ(detail, "ProductNotice_Detail_ID", noticDetail, "ID"));
            dom.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(detail, "Goods_ID", goods, "ID"));
            var goodsChb = mQueryContainer.GetControl <DFChoiceBox>("Goods_ID");
            var proChb   = mQueryContainer.GetControl <DFChoiceBox>("GoodsProperty_ID");
            var brandChb = mQueryContainer.GetControl <DFChoiceBox>("BrandItem_ID");
            var lineChb  = mQueryContainer.GetControl <DFChoiceBox>("ProductLine_ID");

            if (!goodsChb.IsEmpty)
            {
                dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "Goods_ID"), goodsChb.GetValues().Select(x => DQExpression.Value(x)).ToArray()));
            }
            if (!proChb.IsEmpty)
            {
                dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "GoodsProperty_ID"), proChb.GetValues().Select(x => DQExpression.Value(x)).ToArray()));
            }
            if (!brandChb.IsEmpty)
            {
                dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "BrandItem_ID"), brandChb.GetValues().Select(x => DQExpression.Value(x)).ToArray()));
            }
            if (!lineChb.IsEmpty)
            {
                dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(goods, "ProductLine_ID"), lineChb.GetValues().Select(x => DQExpression.Value(x)).ToArray()));
            }
            mDisplayHelper.AddSelectColumns(dom, (name) => OptionIsSelected("选项", name), SumColumnIndexs);
            return(dom);
        }
예제 #29
0
        void LoadInputDetail()
        {
            Dmo.InputDetails.Clear();
            var main               = new JoinAlias(typeof(ProduceInput));
            var detail             = new JoinAlias(typeof(ProduceInput_Detail));
            var productLinksDetail = new JoinAlias(typeof(ProductLinks_InputDetail));
            var query              = new DQueryDom(detail);

            query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "ProduceInput_ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(productLinksDetail), DQCondition.And(DQCondition.EQ(main, "ProductLinks_ID", productLinksDetail, "ProductLinks_ID"), DQCondition.EQ(detail, "Goods_ID", productLinksDetail, "Goods_ID")));
            query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Name"));
            query.Columns.Add(DQSelectColumn.Field("Goods_Code"));
            query.Columns.Add(DQSelectColumn.Sum("Number"));
            query.Columns.Add(DQSelectColumn.Sum("SecondNumber"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_ID"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Name"));
            query.GroupBy.Expressions.Add(DQExpression.Field("Goods_Code"));
            query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(main, "Time", Dmo.Date), DQCondition.EQ(main, "AccountingUnit_ID", Dmo.AccountingUnit_ID), DQCondition.EQ(main, "Department_ID", Dmo.Department_ID), DQCondition.EQ(main, "PlanNumber_ID", Dmo.PlanNumber_ID), DQCondition.EQ(main, "BillState", 单据状态.已审核), DQCondition.EQ(productLinksDetail, "LivingBodyMark", true)));
            using (var session = Forks.EnterpriseServices.DomainObjects2.Dmo.NewSession())
            {
                using (var reader = session.ExecuteReader(query))
                {
                    while (reader.Read())
                    {
                        var d = new DailyProductReport_InputDetail
                        {
                            Goods_ID   = (long?)reader[0],
                            Goods_Name = (string)reader[1],
                            Goods_Code = (string)reader[2],
                            Weight     = ((Money <decimal>?)reader[3]).EToDecimal(),
                            Number     = ((Money <decimal>?)reader[4]).EToDecimal()
                        };
                        Dmo.InputDetails.Add(d);
                    }
                }
            }
            inputGrid.DataBind();
        }
예제 #30
0
        static DQueryDom GetOutputQuery(long domainID, QueryContainer mQueryContainer, DateInput sd, DateInput ed)
        {
            var main       = new JoinAlias(typeof(ProduceOutput));
            var detail     = new JoinAlias(typeof(ProduceOutput_Detail));
            var goodsAlias = new JoinAlias("g1", typeof(Goods));
            var query      = new DQueryDom(detail);

            query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "ProduceOutput_ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsAlias), DQCondition.EQ(detail, "Goods_ID", goodsAlias, "ID"));
            query.Columns.Add(DQSelectColumn.Field("Department_ID", main));
            query.Columns.Add(DQSelectColumn.Field("AccountingUnit_ID", main));
            query.Columns.Add(DQSelectColumn.Field("PlanNumber_ID", main));
            query.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name", main));
            query.Columns.Add(DQSelectColumn.Field("PlanNumber_Name", main));
            query.Columns.Add(DQSelectColumn.Field("Name", goodsAlias));
            query.Columns.Add(DQSelectColumn.Field("Code", goodsAlias));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, "Number"), "OutputNumber"));
            query.Columns.Add(DQSelectColumn.Create(DQExpression.Value <Money <decimal> >(0m), "InStoreNumber"));
            query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(main, "BillState", 单据状态.已审核), DQCondition.EQ(main, "Domain_ID", domainID)));
            AddCondition(main, goodsAlias, query, "Time", mQueryContainer, sd, ed);
            return(query);
        }