Beispiel #1
0
        private static int?GetDepartment(long?id)
        {
            var query = new DQueryDom(new JoinAlias(typeof(Department)));

            query.Columns.Add(DQSelectColumn.Field("Depth"));
            query.Where.Conditions.Add(DQCondition.EQ("ID", id));
            return(query.EExecuteScalar <int?>());
        }
Beispiel #2
0
        private long?GetBanChengPinByGoodsID(long goodID)
        {
            var main  = new JoinAlias(typeof(ChengPinToBanChengPinConfig));
            var query = new DQueryDom(main);

            query.Columns.Add(DQSelectColumn.Field("Goods2_ID", main));
            query.Where.Conditions.Add(DQCondition.EQ(main, "Goods_ID", goodID));
            return(query.EExecuteScalar <long?>(Session));
        }
Beispiel #3
0
        static long?GetProductIdByName(IDmoSession session, string name)
        {
            var query = new DQueryDom(new JoinAlias(typeof(ProductPlan)));

            query.Where.Conditions.Add(DQCondition.EQ("PlanNumber", name));
            query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("BillState", 20));
            query.Columns.Add(DQSelectColumn.Field("ID"));
            return(query.EExecuteScalar <long?>(session));
        }
Beispiel #4
0
        private static long?GetGoodsIdByName2(IDmoSessionWithTransaction session, string name)
        {
            var query = new DQueryDom(new JoinAlias(typeof(Goods)));

            query.Where.Conditions.Add(DQCondition.EQ("Name", name));
            query.Columns.Add(DQSelectColumn.Field("ID"));
            var goodsID = query.EExecuteScalar <long?>(session);

            return(goodsID);
        }
Beispiel #5
0
        private static Tuple <long?, long?> GetCalculateCatalogIDByName(IDmoSession session, string name)
        {
            var query = new DQueryDom(new JoinAlias(typeof(CalculateGoods)));

            query.Where.Conditions.Add(DQCondition.EQ("Name", name));
            query.Columns.Add(DQSelectColumn.Field("CalculateCatalog_ID"));
            query.Columns.Add(DQSelectColumn.Field("ID"));
            query.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
            return(query.EExecuteScalar <long?, long?>(session));
        }
Beispiel #6
0
        static Tuple <long?, string> GetProductPlan(long?nullable1, long?nullable2, DateTime?nullable3)
        {
            var query = new DQueryDom(new JoinAlias(typeof(ProductPlan)));

            query.Columns.Add(DQSelectColumn.Field("ID"));
            query.Columns.Add(DQSelectColumn.Field("PlanNumber"));
            query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("AccountingUnit_ID", nullable1), DQCondition.EQ("Date", nullable3), DQCondition.EQ("BillState", 单据状态.已审核)));
            query.Where.Conditions.Add(B3ButcheryUtil.部门或上级部门条件(nullable2 ?? 0));
            return(query.EExecuteScalar <long?, string>());
        }
Beispiel #7
0
        static DateTime?GetProductPlanDate(long?productPlanID)
        {
            if (productPlanID == null)
            {
                return(null);
            }
            var query = new DQueryDom(new JoinAlias(typeof(ProductPlan)));

            query.Columns.Add(DQSelectColumn.Field("Date"));
            query.Where.Conditions.Add(DQCondition.EQ("ID", productPlanID));
            return(query.EExecuteScalar <DateTime?>());
        }
Beispiel #8
0
        private static void SetProductPlan(FrozenInStore dmo, IDmoSessionWithTransaction session)
        {
            var query = new DQueryDom(new JoinAlias(typeof(ProductPlan)));

            query.Columns.Add(DQSelectColumn.Field("ID"));
            query.Where.Conditions.Add(DQCondition.LessThanOrEqual("Date", dmo.Date));
            query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("EndDate", dmo.Date));
            query.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.已审核));
            var planid = query.EExecuteScalar <long?>(session);

            dmo.ProductionPlan_ID = planid;
        }
Beispiel #9
0
        public static long?GetCurrentBindingEmployeeID(IDmoSession session)
        {
            if (BLContext.User.RoleSchema != B3FrameworksConsts.RoleSchemas.employee)
            {
                throw new Exception("当前用户不是员工类型");
            }
            var query = new DQueryDom(new JoinAlias(typeof(User_Employee)));

            query.Where.Conditions.Add(DQCondition.EQ("User_ID", BLContext.User.ID));
            query.Columns.Add(DQSelectColumn.Field("Employee_ID"));

            var result = (long?)query.EExecuteScalar(session);

            return(result);
        }
Beispiel #10
0
        public static bool TryGetID <TDmo>(ExecelImportColumn col, Row row, string fieldsName, ref long dmoID)
        {
            string name = default(string);

            if (!col.TryGetValue(row, ref name))
            {
                return(false);
            }

            var logicName = DFInfo.Get(typeof(TDmo)).LogicName;

            if (dmoID > 0)
            {
                var verifyNameQuery = new DQueryDom(new JoinAlias(typeof(TDmo)));
                verifyNameQuery.Columns.Add(DQSelectColumn.Field(fieldsName));
                verifyNameQuery.Where.Conditions.Add(DQCondition.EQ("ID", dmoID));
                verifyNameQuery.Range = SelectRange.Top(1);

                var verifyName = (string)verifyNameQuery.EExecuteScalar <string>();

                if (verifyName != name)
                {
                    throw new Exception(string.Format("{0}字段{4}:{1}和已得到ID:{2}上的名称:{3}不一致", logicName, name, dmoID, verifyName, fieldsName));
                }
                return(false);
            }

            var query = new DQueryDom(new JoinAlias(typeof(TDmo)));

            if (TypeUtil.IsWithinDomain <TDmo>())
            {
                query.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID));
            }
            query.Where.Conditions.Add(DQCondition.EQ(fieldsName, name));
            query.Range = SelectRange.Top(2);
            query.Columns.Add(DQSelectColumn.Field("ID"));
            var result = query.EExecuteList <long>();

            if (result.Count == 0)
            {
                throw new Exception(string.Format("未能发现字段{2}为{0}的{1}", name, logicName, fieldsName));
            }

            dmoID = result[0];
            return(true);
        }
Beispiel #11
0
        static long?GetGoodsIdByName(IDmoSession session, string name)
        {
            var firstQuery = new DQueryDom(new JoinAlias(typeof(CalculateGoods)));

            firstQuery.Columns.Add(DQSelectColumn.Field("Goods_ID"));
            firstQuery.Where.Conditions.Add(DQCondition.EQ("Name", name));
            firstQuery.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
            var goodsID = firstQuery.EExecuteScalar <long?>(session);

            if (goodsID == null || goodsID == 0)
            {
                var query = new DQueryDom(new JoinAlias(typeof(Goods)));
                query.Where.Conditions.Add(DQCondition.EQ("Name", name));
                query.Columns.Add(DQSelectColumn.Field("ID"));
                goodsID = query.EExecuteScalar <long?>(session);
            }

            return(goodsID);
        }