Ejemplo n.º 1
0
        protected override void AddQueryControls(VLayoutPanel vPanel)
        {
            var customPanel = new LayoutManager("Main", mainInfo, mQueryContainer);

            customPanel.Add("ID", QueryCreator.DFTextBox(mainInfo.Fields["ID"]));
            customPanel.Add("AccountingUnit_ID", QueryCreator.DFChoiceBoxEnableMultiSelection(mainInfo.Fields["AccountingUnit_ID"], mQueryContainer, "AccountingUnit_ID", DataKind.授权会计单位全部));
            customPanel["AccountingUnit_ID"].NotAutoAddToContainer = true;
            customPanel.Add("Department_ID", QueryCreator.DFChoiceBoxEnableMultiSelection(mainInfo.Fields["Department_ID"], mQueryContainer, "Department_ID", DataKind.授权部门全部));
            customPanel["Department_ID"].NotAutoAddToContainer = true;
            customPanel.Add("Store_ID", _storeInput            = QueryCreator.DFChoiceBoxEnableMultiSelection(mainInfo.Fields["Store_ID"], mQueryContainer, "Store_ID", DataKind.授权仓库全部), false);
            customPanel["Store_ID"].NotAutoAddToContainer      = true;
            customPanel.Add("InStoreType_ID", QueryCreator.DFChoiceBoxEnableMultiSelection(mainInfo.Fields["InStoreType_ID"], mQueryContainer, "InStoreType_ID", B3ButcheryDataSource.屠宰分割入库类型全部));
            customPanel["InStoreType_ID"].NotAutoAddToContainer = true;
            customPanel.Add("CheckDate", QueryCreator.DateRange(mainInfo.Fields["CheckDate"], mQueryContainer, "MinCheckDate", "MaxCheckDate"));

            customPanel.Add("InStoreDate", new SimpleLabel("生产日期"), QueryCreator.DateRange(detailInfo.Fields["ProductionDate"], mQueryContainer, "MinProductionDate", "MaxProductionDate"));
            customPanel.Add("ProductPlan_ID", new SimpleLabel("生产计划号"), QueryCreator.DFChoiceBoxEnableMultiSelection(detailInfo.Fields["ProductPlan_ID"], mQueryContainer, "ProductPlan_ID", B3ButcheryDataSource.计划号));
            customPanel["ProductPlan_ID"].NotAutoAddToContainer = true;
            customPanel.Add("Remark", QueryCreator.DFTextBox(mainInfo.Fields["Remark"]));
            DFChoiceBox goodsInput;

            customPanel.Add("Goods_ID", new SimpleLabel("存货名称"), goodsInput = QueryCreator.DFChoiceBoxEnableMultiSelection(detailInfo.Fields["Goods_ID"], mQueryContainer, "Goods_ID", B3ButcheryDataSource.存货带编号全部));
            goodsInput.PlaceHolder = "名称 编号 简拼";
            customPanel["Goods_ID"].NotAutoAddToContainer = true;
            customPanel.Add("Origin", new SimpleLabel("存货产地"), goodsOrigin   = QueryCreator.DFTextBox(detailInfo.Fields["Goods_Code"]));
            customPanel.Add("Goods_Name", new SimpleLabel("存货名称"), goodsName = QueryCreator.DFTextBox(detailInfo.Fields["Goods_Name"]));
            customPanel.Add("Goods_Code", new SimpleLabel("存货编号"), QueryCreator.DFTextBox(detailInfo.Fields["Goods_Code"]));
            customPanel.Add("Goods_Brand", new SimpleLabel("存货品牌"), QueryCreator.DFChoiceBox(detailInfo.Fields["Goods_Name"], B3ButcheryDataSource.存货品牌));
            customPanel.Add("GoodsProperty_ID", new SimpleLabel("存货属性"), QueryCreator.DFChoiceBox(detailInfo.Fields["ID"], B3UnitedInfos.B3UnitedInfosConsts.DataSources.存货属性全部));
            customPanel.Add("PropertyCatalog_ID", new SimpleLabel("属性分类"), QueryCreator.DFChoiceBox(detailInfo.Fields["ID"], B3UnitedInfos.B3UnitedInfosConsts.DataSources.存货属性分类全部));
            customPanel.Add("DRemark", new SimpleLabel("备注"), QueryCreator.DFTextBox(detailInfo.Fields["Remark"]));
            customPanel.Add("CargoSpace_ID", new SimpleLabel("货位"), cargoSpaceName = QueryCreator.DFChoiceBoxEnableMultiSelection(detailInfo.Fields["CargoSpace_ID"], mQueryContainer, "CargoSpace_ID", B3ButcheryDataSource.货位), false);
            customPanel["CargoSpace_ID"].NotAutoAddToContainer = true;

            customPanel.Add("ProductLine_ID", new SimpleLabel("产品线"), _productLine = QueryCreator.DFChoiceBoxEnableMultiSelection(detailInfo.Fields["ID"], mQueryContainer, "ProductLine_ID", B3UnitedInfosConsts.DataSources.产品线全部));
            customPanel["ProductLine_ID"].NotAutoAddToContainer = true;

            customPanel.Add("ProductLineCategory_ID", new SimpleLabel("产品线分类"), _producttypeLine = QueryCreator.DFChoiceBoxEnableMultiSelection(detailInfo.Fields["ID"], mQueryContainer, "ProductLineCategory_ID", B3UnitedInfosConsts.DataSources.产品线分类));
            customPanel["ProductLineCategory_ID"].NotAutoAddToContainer = true;



            AddOtherQuery(customPanel, mainInfo);
            customPanel.Add("BillState", QueryCreator.一般单据状态(mainInfo.Fields["BillState"]));
            if (_useBrand)
            {
                customPanel.Add("BrandItem_ID", new SimpleLabel("品牌项"), QueryCreator.DFChoiceBoxEnableMultiSelection(detailInfo.Fields["ID"], B3UnitedInfosConsts.DataSources.品牌项));
            }
            var config = customPanel.CreateDefaultConfig(4);

            config.Expand = false;
            TagWebUtil.AddTagQueryInput(mDmoTypeID, customPanel, config, mQueryContainer);
            vPanel.Add(customPanel.CreateLayout());
        }
Ejemplo n.º 2
0
        protected override DQueryDom GetQueryDom()
        {
            mBrowseGrid.EnableRowsGroup = _showTypeList.Items.FindByText("合并单元格").Selected;
            var query = base.GetQueryDom();

            OrganizationUtil.AddOrganizationLimit <Department>(query, "Department_ID");
            OrganizationUtil.AddOrganizationLimit <Store>(query, "Store_ID");
            var bill            = query.From.RootSource.Alias;
            var detail          = JoinAlias.Create("detail");
            var goodsAlias      = new JoinAlias(typeof(Goods));
            var goodsProperty   = new JoinAlias(typeof(GoodsProperty));
            var propertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog));

            query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsAlias), DQCondition.EQ(detail, "Goods_ID", goodsAlias, "ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(goodsProperty), DQCondition.EQ(goodsAlias, "GoodsProperty_ID", goodsProperty, "ID"));
            query.From.AddJoin(JoinType.Left, new DQDmoSource(propertyCatalog), DQCondition.EQ(goodsProperty, "GoodsPropertyCatalog_ID", propertyCatalog, "ID"));

            foreach (ListItem field in checkbox.Items)
            {
                if (field.Selected)
                {
                    SetQueryResult(query, field);
                    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 if (mainFields.Contains(field.Value))
                    {
                        query.Columns.Add(DQSelectColumn.Field(field.Value));
                        query.GroupBy.Expressions.Add(DQExpression.Field(field.Value));
                    }
                    else if (field.Text == "每日")
                    {
                        var snippetDay = DQExpression.Snippet <DateTime?>("(Convert(nvarchar(10),[bill].[InStoreDate], 23))");
                        query.Columns.Add(DQSelectColumn.Create(snippetDay, "每日"));
                        query.GroupBy.Expressions.Add(snippetDay);
                    }
                    else if (field.Text == "每月")
                    {
                        var snippetMonth = DQExpression.Snippet <string>("Left(Convert(nvarchar(10),[bill].[InStoreDate], 23),7)");
                        query.Columns.Add(DQSelectColumn.Create(snippetMonth, "每月"));
                        query.GroupBy.Expressions.Add(snippetMonth);
                    }
                    else if (field.Text == "每年")
                    {
                        var snippetMonth = DQExpression.Snippet <string>("Left(Convert(nvarchar(10),[bill].[InStoreDate], 23),4)");
                        query.Columns.Add(DQSelectColumn.Create(snippetMonth, "每月"));
                        query.GroupBy.Expressions.Add(snippetMonth);
                    }
                    else if (field.Text == "标签")
                    {
                        var tarName = new JoinAlias(typeof(Dmo_TagNames));
                        query.From.AddJoin(JoinType.Left, new DQDmoSource(tarName), DQCondition.And(DQCondition.EQ(tarName, "DmoID", query.From.RootSource.Alias, "ID"), DQCondition.EQ(tarName, "DmoTypeID", mDmoTypeID)));
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(tarName, "Names"), "标签"));
                        query.GroupBy.Expressions.Add(DQExpression.Field(tarName, "Names"));
                    }
                    else if (field.Text == "存货属性")
                    {
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goodsProperty, "Name"), field.Text));
                        query.GroupBy.Expressions.Add(DQExpression.Field(goodsProperty, "Name"));
                    }
                    else if (field.Text == "属性分类")
                    {
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(propertyCatalog, "Name"), field.Text));
                        query.GroupBy.Expressions.Add(DQExpression.Field(propertyCatalog, "Name"));
                        var v = 0;
                        if (!depth.IsEmpty && int.TryParse(depth.Text, out v))
                        {
                            if (v < 0)
                            {
                                v = 0;
                            }
                            if (v > 8)
                            {
                                v = 8;
                            }
                            for (var i = 1; i <= v; i++)
                            {
                                var p = new JoinAlias("_p" + i, typeof(GoodsPropertyCatalog));
                                query.From.AddJoin(JoinType.Left, new DQDmoSource(p), DQCondition.EQ(p, "ID", propertyCatalog, string.Format("TreeDeep{0}ID", i)));
                                query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(p, "Name"), i + "级分类"));
                                query.GroupBy.Expressions.Add(DQExpression.Field(p, "Name"));
                            }
                        }
                    }
                    else if (field.Text == "货位")
                    {
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, "CargoSpace_Name"), field.Text));
                        query.GroupBy.Expressions.Add(DQExpression.Field(detail, "CargoSpace_Name"));
                    }
                    else if (field.Text == "产品线")
                    {
                        query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goodsAlias, field.Value), field.Text));
                        query.GroupBy.Expressions.Add(DQExpression.Field(goodsAlias, field.Value));
                    }
                    else
                    {
                        //用户自定义模块的字段 比如永达
                        if (field.Value.StartsWith(CustomMainFieldBegin))
                        {
                            continue;
                        }
                        var s = field.Value;
                        if (field.Value == "DRemark")
                        {
                            s = "Remark";
                            query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, s), "备注"));
                        }
                        else
                        {
                            query.Columns.Add(DQSelectColumn.Field(s, detail));
                        }
                        query.GroupBy.Expressions.Add(DQExpression.Field(detail, s));
                    }
                }
            }
            if (!string.IsNullOrEmpty(goodsOrigin.Text))
            {
                query.Where.Conditions.Add(DQCondition.Like(goodsAlias, "Origin", goodsOrigin.Text));
            }
            if (!goodsName.IsEmpty)
            {
                var nameList     = goodsName.Text.Split(' ');
                var conditonList = new List <IDQExpression>();
                foreach (var n in nameList)
                {
                    conditonList.Add(DQCondition.Like(goodsAlias, "Name", n));
                }
                query.Where.Conditions.Add(DQCondition.Or(conditonList));
            }
            query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Domain_ID", DomainContext.Current.ID)));
            var brand = mQueryContainer.GetControl <DFChoiceBox>("Goods_Brand");

            if (!brand.IsEmpty)
            {
                query.Where.Conditions.Add(DQCondition.EQ(goodsAlias, "Brand", brand.Value));
            }
            var gProperty = mQueryContainer.GetControl <DFChoiceBox>("GoodsProperty_ID");

            if (!gProperty.IsEmpty)
            {
                query.Where.Conditions.Add(DQCondition.EQ(goodsProperty, "ID", gProperty.Value));
            }

            if (!_productLine.IsEmpty)
            {
                query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(goodsAlias, "ProductLine_ID"), _productLine.GetValues().Select(x => DQExpression.Value(x)).ToArray()));
            }
            if (!_producttypeLine.IsEmpty)
            {
                query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(goodsAlias, "ProductLineCategory_ID"), _producttypeLine.GetValues().Select(x => DQExpression.Value(x)).ToArray()));
            }
            TreeUtil.AddTreeCondition <GoodsPropertyCatalog>(query, mQueryContainer, "PropertyCatalog_ID", propertyCatalog);
            TagWebUtil.AddTagQueryCondition(mDmoTypeID, query, bill, mQueryContainer);
            if (query.Columns.Count == 0)
            {
                throw new Exception("至少选择一条显示列");
            }
            return(query);
        }