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); }
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); }
private DQueryDom GetDQueryDom() { DQueryDom dom = mQueryContainer.Build(); var main = dom.From.RootSource.Alias; var detail = new JoinAlias(typeof(ProductInStore_Temp_Detail)); dom.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "ProductInStoreTemp_ID")); dom.Columns.Add(DQSelectColumn.Field("ID", main)); dom.Columns.Add(DQSelectColumn.Field("Name", main)); dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_ID", main)); dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name", main)); dom.Columns.Add(DQSelectColumn.Field("Department_ID", main)); dom.Columns.Add(DQSelectColumn.Field("Department_Name", main)); dom.Columns.Add(DQSelectColumn.Field("Store_ID", main)); dom.Columns.Add(DQSelectColumn.Field("Store_Name", main)); dom.Columns.Add(DQSelectColumn.Field("Employee_ID", main)); dom.Columns.Add(DQSelectColumn.Field("Employee_Name", main)); dom.Columns.Add(DQSelectColumn.Field("InStoreType_ID", main)); dom.Columns.Add(DQSelectColumn.Field("InStoreType_Name", main)); dom.Columns.Add(DQSelectColumn.Field("CheckEmployee_ID", main)); dom.Columns.Add(DQSelectColumn.Field("CheckEmployee_Name", main)); dom.Columns.Add(DQSelectColumn.Field("InStoreDate", main)); dom.Columns.Add(DQSelectColumn.Field("CheckDate", main)); dom.Distinct = true; dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); //dom.Columns.Add(DQSelectColumn.Field("Goods_ID", detail)); //dom.Columns.Add(DQSelectColumn.Field("Goods_Name", detail)); //dom.Columns.Add(DQSelectColumn.Field("Goods_Code", detail)); //dom.Columns.Add(DQSelectColumn.Field("Goods_Spec", detail)); //dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(detail, "ID"), "DetailID")); dom.Where.Conditions.Add(DQCondition.EQ(main, "Domain_ID", DomainContext.Current.ID)); return(dom); }
DQueryDom GetQueryDom() { var dom = mQueryContainer.Build(); var goodsAlias = dom.From.RootSource.Alias; var refAlias = new JoinAlias(typeof(GoodsReferencePrice)); dom.From.AddJoin(JoinType.Left, new DQDmoSource(refAlias), DQCondition.EQ(goodsAlias, "ID", refAlias, "Goods_ID")); dom.Columns.Add(DQSelectColumn.Field("ID")); dom.Columns.Add(DQSelectColumn.Field("Name")); dom.Columns.Add(DQSelectColumn.Field("Code")); dom.Columns.Add(DQSelectColumn.Field("Spec")); dom.Columns.Add(DQSelectColumn.Field("ReferencePrice", refAlias)); dom.Columns.Add(DQSelectColumn.Field("Remark", refAlias)); dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); return(dom); }
public virtual void GetDetail() { Details.Clear(); var prop = JoinAlias.Create("prop"); DQueryDom dom = mQueryContainer.Build(); // dom.Where.Conditions.Add(DQCondition.EQ(prop, "IsButchery", true)); var rootAlias = dom.From.RootSource.Alias; var goodsPropertyCatalog = new JoinAlias(typeof(GoodsPropertyCatalog)); dom.From.AddJoin(JoinType.Left, new DQDmoSource(goodsPropertyCatalog), DQCondition.EQ(prop, "GoodsPropertyCatalog_ID", goodsPropertyCatalog, "ID")); dom.Columns.Add(DQSelectColumn.Field("Code", rootAlias)); dom.Columns.Add(DQSelectColumn.Field("Name", rootAlias)); dom.Columns.Add(DQSelectColumn.Field("Spec", rootAlias)); dom.Columns.Add(DQSelectColumn.Field("MainUnit", rootAlias)); dom.Columns.Add(DQSelectColumn.Field("SecondUnit", rootAlias)); dom.Columns.Add(DQSelectColumn.Field("Name", prop)); dom.Columns.Add(DQSelectColumn.Field("Name", goodsPropertyCatalog)); dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); DomainUtil.AddDomainPermissionLimit(dom, typeof(GoodsProperty), prop); using (var session = Dmo.NewSession()) { using (var reader = session.ExecuteReader(dom)) { while (reader.Read()) { var detail = new Goods(); detail.ID = (long)reader[0]; detail.Code = (string)reader[1]; detail.Name = (string)reader[2]; detail.Spec = (string)reader[3]; detail.MainUnit = (string)reader[4]; detail.SecondUnit = (string)reader[5]; detail.GoodsProperty_Name = (string)reader[6]; detail.GoodsPropertyCatalog_Name = (string)reader[7]; Details.Add(detail); } } } }
DQueryDom GetQueryDom() { var dom = mQueryContainer.Build(); var goodsAlias = dom.From.RootSource.Alias; var prop = new JoinAlias("pro", typeof(GoodsProperty)); var refAlias = new JoinAlias(typeof(ChengPinToBanChengPinConfig)); dom.From.AddJoin(JoinType.Left, new DQDmoSource(refAlias), DQCondition.EQ(goodsAlias, "ID", refAlias, "Goods_ID")); dom.From.AddJoin(JoinType.Left, new DQDmoSource(prop), DQCondition.EQ(goodsAlias, "GoodsProperty_ID", prop, "ID")); dom.Columns.Add(DQSelectColumn.Field("ID")); dom.Columns.Add(DQSelectColumn.Field("Name", "成品名称")); dom.Columns.Add(DQSelectColumn.Field("Code", "成品编码")); dom.Columns.Add(DQSelectColumn.Field("Spec", "成品规格")); dom.Columns.Add(DQSelectColumn.Field("Goods2_ID", refAlias)); dom.Columns.Add(DQSelectColumn.Field("Goods2_Name", refAlias)); dom.Columns.Add(DQSelectColumn.Field("Goods2_Code", refAlias)); dom.Columns.Add(DQSelectColumn.Field("Goods2_Spec", refAlias)); dom.Columns.Add(DQSelectColumn.Field("Remark", refAlias)); dom.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); dom.Where.Conditions.Add(DQCondition.EQ(prop, "EnableSale", true)); return(dom); }