|
|
|
@ -43,12 +43,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_ |
|
|
|
HLayoutPanel CreateDataRangePanel() |
|
|
|
{ |
|
|
|
var hPanel = new HLayoutPanel(); |
|
|
|
hPanel.Add(new LiteralControl("<span style='color:red'>*</span>仓库:")); |
|
|
|
hPanel.Add(QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "Store_ID", B3FrameworksConsts.DataSources.授权仓库全部)); |
|
|
|
hPanel.Add(new LiteralControl("<span style='color:red'>*</span>日期:")); |
|
|
|
hPanel.Add(QueryCreator.DateRange(mDFInfo.Fields["Date"], mQueryContainer, "MinDate", "MaxDate", DateTime.Today, DateTime.Today + new TimeSpan(23, 59, 29))); |
|
|
|
hPanel.Add(new LiteralControl("<span style='margin-left:10px'>存货属性:</span>")); |
|
|
|
hPanel.Add(QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "GoodsProperty_Catalog_ID", B3UnitedInfos.B3UnitedInfosConsts.DataSources.存货属性分类全部)); |
|
|
|
hPanel.Add(new LiteralControl("单据状态:")); |
|
|
|
stateDp = hPanel.Add(new DFDropDownList() { Width = Unit.Pixel(80) }); |
|
|
|
stateDp.Items.Add(""); |
|
|
|
@ -61,8 +57,6 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_ |
|
|
|
{ |
|
|
|
var minInput = mQueryContainer.GetControl<DateInput>("MinDate"); |
|
|
|
var maxInput = mQueryContainer.GetControl<DateInput>("MaxDate"); |
|
|
|
var storeInput = mQueryContainer.GetControl<DFChoiceBox>("Store_ID"); |
|
|
|
var gpc = mQueryContainer.GetControl<DFChoiceBox>("GoodsProperty_Catalog_ID"); |
|
|
|
int? billState = null; |
|
|
|
if (stateDp.SelectedIndex > 0) |
|
|
|
billState = int.Parse(stateDp.SelectedValue); |
|
|
|
@ -70,13 +64,11 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_ |
|
|
|
throw new Exception("请选择开始日期"); |
|
|
|
if (maxInput.IsEmpty) |
|
|
|
throw new Exception("请选择结束日期"); |
|
|
|
if (storeInput.IsEmpty) |
|
|
|
throw new Exception("请选择仓库"); |
|
|
|
|
|
|
|
var main = new JoinAlias(typeof(UnionTemp)); |
|
|
|
var goods = new JoinAlias(typeof(Goods)); |
|
|
|
var query = new DQueryDom(main); |
|
|
|
UnionTemp.Register(query, minInput.Date, maxInput.Date, billState, storeInput.GetValues().Select(x => long.Parse(x))); |
|
|
|
UnionTemp.Register(query, minInput.Date, maxInput.Date, billState); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("Code", goods, "编码")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("Name", goods, "名称")); |
|
|
|
@ -103,9 +95,6 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_ |
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Spec")); |
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "MainUnit")); |
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "SecondUnit")); |
|
|
|
if (!gpc.IsEmpty) |
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(goods, "GoodsPropertyCatalog_ID"), gpc.GetValues().Select(x => DQExpression.Value(long.Parse(x))).ToArray())); |
|
|
|
|
|
|
|
return query; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -118,26 +107,28 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_ |
|
|
|
public Money<decimal>? OutUnitNum { get; set; } |
|
|
|
public Money<decimal>? OutSecondNumber { get; set; } |
|
|
|
|
|
|
|
public static void Register(DQueryDom root, DateTime minDate, DateTime maxDate, int? billState, IEnumerable<long> storeID) |
|
|
|
public static void Register(DQueryDom root, DateTime minDate, DateTime maxDate, int? billState) |
|
|
|
{ |
|
|
|
var query = GetSaleOutStore(minDate, maxDate, billState, storeID); |
|
|
|
var query = GetSaleOutStore(minDate, maxDate, billState); |
|
|
|
query.UnionNext.Select = GetOutput(minDate, maxDate); |
|
|
|
OrganizationUtil.RegisterOrganizationQueryTable(root); |
|
|
|
root.RegisterQueryTable(typeof(UnionTemp), new string[] { "Goods_ID", "UnitNum", "SecondNumber", "OutUnitNum", "OutSecondNumber" }, query); |
|
|
|
} |
|
|
|
|
|
|
|
static DQueryDom GetSaleOutStore(DateTime minDate, DateTime maxDate, int? billState, IEnumerable<long> storeID) |
|
|
|
static DQueryDom GetSaleOutStore(DateTime minDate, DateTime maxDate, int? billState) |
|
|
|
{ |
|
|
|
var main = new JoinAlias(typeof(SaleOutStore)); |
|
|
|
var detail = new JoinAlias(typeof(SaleOutStore_Detail)); |
|
|
|
var config = new JoinAlias("_gvc1",typeof(GoodsViewConfig)); |
|
|
|
var query = new DQueryDom(main); |
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); |
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(config), DQCondition.EQ(detail, "SaleGoods_ID", config, "Goods_ID")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("UnitNum", detail)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("SecondNumber", detail)); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.NULL, "OutUnitNum")); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.NULL, "OutSecondNumber")); |
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.Between("LoadTime", minDate, maxDate), DQCondition.InList(DQExpression.Field("Store_ID"), storeID.Select(x => DQExpression.Value(x)).ToArray()))); |
|
|
|
query.Where.Conditions.Add(DQCondition.Between("LoadTime", minDate, maxDate)); |
|
|
|
if (billState.HasValue) |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("BillState", billState)); |
|
|
|
else |
|
|
|
@ -150,8 +141,10 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_ |
|
|
|
{ |
|
|
|
var main = new JoinAlias(typeof(Output)); |
|
|
|
var detail = new JoinAlias(typeof(Output_Detail)); |
|
|
|
var config = new JoinAlias("_gvc2", typeof(GoodsViewConfig)); |
|
|
|
var query = new DQueryDom(main); |
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "Output_ID")); |
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(config), DQCondition.EQ(config, "Goods_ID", detail, "Goods_ID")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("Goods_ID", detail)); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.NULL, "UnitNum")); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.NULL, "SecondNumber")); |
|
|
|
|