|
|
@ -31,7 +31,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
|
|
|
|
|
|
protected override string Caption |
|
|
protected override string Caption |
|
|
{ |
|
|
{ |
|
|
get { return "销售备货分析(按产出)"; } |
|
|
|
|
|
|
|
|
get { return "产出差异"; } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected override string QueryOptionsTabName |
|
|
protected override string QueryOptionsTabName |
|
|
@ -102,7 +102,6 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
queryPanel.ConditonPanel.EAdd(CreateDataRangePanel()); |
|
|
queryPanel.ConditonPanel.EAdd(CreateDataRangePanel()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DFDropDownList billStateDp; |
|
|
|
|
|
DFCheckBox onlyGoodsCheck; |
|
|
DFCheckBox onlyGoodsCheck; |
|
|
HLayoutPanel CreateDataRangePanel() |
|
|
HLayoutPanel CreateDataRangePanel() |
|
|
{ |
|
|
{ |
|
|
@ -116,13 +115,6 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
hPanel.Add(new LiteralControl("存货:")); |
|
|
hPanel.Add(new LiteralControl("存货:")); |
|
|
hPanel.Add(QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["AccountingUnit_ID"], mQueryContainer, "SaleGoods_ID", B3SaleDataSources.可销售存货)); |
|
|
hPanel.Add(QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["AccountingUnit_ID"], mQueryContainer, "SaleGoods_ID", B3SaleDataSources.可销售存货)); |
|
|
|
|
|
|
|
|
hPanel.Add(new LiteralControl("单据状态:")); |
|
|
|
|
|
billStateDp = mQueryContainer.Add(hPanel.Add(new DFDropDownList() { Width = Unit.Pixel(80) }), "BillState"); |
|
|
|
|
|
billStateDp.Items.Add(""); |
|
|
|
|
|
billStateDp.Items.Add(new ListItem("未审核", "0")); |
|
|
|
|
|
billStateDp.Items.Add(new ListItem("已审核", "20")); |
|
|
|
|
|
billStateDp.SelectedIndex = 1; |
|
|
|
|
|
|
|
|
|
|
|
onlyGoodsCheck = hPanel.Add(new DFCheckBox() { TextAlign = TextAlign.Left, Text = "按存货" }); |
|
|
onlyGoodsCheck = hPanel.Add(new DFCheckBox() { TextAlign = TextAlign.Left, Text = "按存货" }); |
|
|
onlyGoodsCheck.InputAttributes.Add("style", "width:15px;height:15px;"); |
|
|
onlyGoodsCheck.InputAttributes.Add("style", "width:15px;height:15px;"); |
|
|
return hPanel; |
|
|
return hPanel; |
|
|
@ -146,32 +138,44 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
var minDate = mQueryContainer.GetControl<DFDateInput>("MinLoadTime").Value; |
|
|
var minDate = mQueryContainer.GetControl<DFDateInput>("MinLoadTime").Value; |
|
|
var maxDate = mQueryContainer.GetControl<DFDateInput>("MaxLoadTime").Value; |
|
|
var maxDate = mQueryContainer.GetControl<DFDateInput>("MaxLoadTime").Value; |
|
|
var sequenceInput = mQueryContainer.GetControl<DFTextBox>("SequenceNumber").Text.Trim(); |
|
|
var sequenceInput = mQueryContainer.GetControl<DFTextBox>("SequenceNumber").Text.Trim(); |
|
|
short? billState = null; |
|
|
|
|
|
if (!string.IsNullOrEmpty(billStateDp.SelectedValue)) |
|
|
|
|
|
billState = short.Parse(billStateDp.SelectedValue); |
|
|
|
|
|
IEnumerable<long> seques = new List<long>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long? maxSeque = null; |
|
|
if (!string.IsNullOrEmpty(sequenceInput)) |
|
|
if (!string.IsNullOrEmpty(sequenceInput)) |
|
|
seques = sequenceInput.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
var arr = sequenceInput.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); |
|
|
|
|
|
if (arr.Any()) |
|
|
|
|
|
maxSeque = arr.Max(); |
|
|
|
|
|
} |
|
|
List<TempObj> data; |
|
|
List<TempObj> data; |
|
|
List<MinObj> products; |
|
|
List<MinObj> products; |
|
|
IEnumerable<MinObj> back = null; |
|
|
IEnumerable<MinObj> back = null; |
|
|
List<StockUpClass> stockInfo; |
|
|
|
|
|
|
|
|
List<StockUpClass> stockInfo = null; |
|
|
using (var session = Dmo.NewSession()) |
|
|
using (var session = Dmo.NewSession()) |
|
|
{ |
|
|
{ |
|
|
data = GetMainInfo(line, seques, goodsIds, minDate, maxDate, billState, session); |
|
|
|
|
|
|
|
|
if (line.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
var m = GetMaxLine(session, line); |
|
|
|
|
|
if (m.HasValue && maxSeque.HasValue && m > maxSeque) |
|
|
|
|
|
maxSeque = m; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
data = GetMainInfo(maxSeque, goodsIds, minDate, maxDate, session); |
|
|
products = GetInStoreNumber(goodsIds, minDate, maxDate, session); |
|
|
products = GetInStoreNumber(goodsIds, minDate, maxDate, session); |
|
|
stockInfo = GetStockInfo(goodsIds, minDate, maxDate, session); |
|
|
|
|
|
|
|
|
if (!onlyGoodsCheck.Checked) |
|
|
|
|
|
stockInfo = GetStockInfo(goodsIds, minDate, maxDate, session); |
|
|
}; |
|
|
}; |
|
|
if (onlyGoodsCheck.Checked) |
|
|
if (onlyGoodsCheck.Checked) |
|
|
back = products.Select(item => new MinObj { Goods_ID = item.Goods_ID, MainNumber = item.MainNumber, SecondNumber = item.SecondNumber }); |
|
|
back = products.Select(item => new MinObj { Goods_ID = item.Goods_ID, MainNumber = item.MainNumber, SecondNumber = item.SecondNumber }); |
|
|
|
|
|
|
|
|
foreach (var g in stockInfo.GroupBy(x => x.Goods_ID)) |
|
|
|
|
|
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
var first = products.FirstOrDefault(x => x.Goods_ID == g.Key); |
|
|
|
|
|
if (first != null) |
|
|
|
|
|
|
|
|
foreach (var g in stockInfo.GroupBy(x => x.Goods_ID)) |
|
|
{ |
|
|
{ |
|
|
first.MainNumber = (first.MainNumber ?? 0) - g.Sum(x => (x.StockNumber ?? 0).Value); |
|
|
|
|
|
first.SecondNumber = (first.SecondNumber ?? 0) - g.Sum(x => (x.StockSecondNumber ?? 0).Value); |
|
|
|
|
|
|
|
|
var first = products.FirstOrDefault(x => x.Goods_ID == g.Key); |
|
|
|
|
|
if (first != null) |
|
|
|
|
|
{ |
|
|
|
|
|
first.MainNumber = (first.MainNumber ?? 0) - g.Sum(x => (x.StockNumber ?? 0).Value); |
|
|
|
|
|
first.SecondNumber = (first.SecondNumber ?? 0) - g.Sum(x => (x.StockSecondNumber ?? 0).Value); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -197,6 +201,13 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
entity.ProductSecond = bkFirst.SecondNumber; |
|
|
entity.ProductSecond = bkFirst.SecondNumber; |
|
|
} |
|
|
} |
|
|
list.Add(entity); |
|
|
list.Add(entity); |
|
|
|
|
|
var arr = list.Where(x => x.Goods_ID == g.Key); |
|
|
|
|
|
entity.ProductMainDiff = arr.Sum(x => (x.OrderMain ?? 0).Value) - (entity.ProductMain ?? 0); |
|
|
|
|
|
if (entity.ProductMainDiff <= 0) |
|
|
|
|
|
entity.ProductMainDiff = null; |
|
|
|
|
|
entity.ProductSecondDiff = arr.Sum(x => (x.OrderSecond ?? 0).Value) - (entity.ProductSecond ?? 0); |
|
|
|
|
|
if (entity.ProductSecondDiff <= 0) |
|
|
|
|
|
entity.ProductSecondDiff = null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
@ -254,22 +265,28 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
ColumnNames.Add("产出|数量"); |
|
|
ColumnNames.Add("产出|数量"); |
|
|
table.Data.Columns.Add(new DFCustomDataColumn("产出|辅数量", typeof(Money<decimal>?))); |
|
|
table.Data.Columns.Add(new DFCustomDataColumn("产出|辅数量", typeof(Money<decimal>?))); |
|
|
ColumnNames.Add("产出|辅数量"); |
|
|
ColumnNames.Add("产出|辅数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("差异|数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("差异|数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("差异|辅数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("差异|辅数量"); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("已备|数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("已备|数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("已备|辅数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("已备|辅数量"); |
|
|
|
|
|
|
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("备货差异|数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("备货差异|数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("备货差异|辅数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("备货差异|辅数量"); |
|
|
|
|
|
|
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("可用|数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("可用|数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("可用|辅数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("可用|辅数量"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("已备|数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("已备|数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("已备|辅数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("已备|辅数量"); |
|
|
|
|
|
|
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("备货差异|数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("备货差异|数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("备货差异|辅数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("备货差异|辅数量"); |
|
|
|
|
|
|
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("可用|数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("可用|数量"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("可用|辅数量", typeof(Money<decimal>?))); |
|
|
|
|
|
ColumnNames.Add("可用|辅数量"); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in list) |
|
|
foreach (var item in list) |
|
|
{ |
|
|
{ |
|
|
@ -291,13 +308,18 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
{ |
|
|
{ |
|
|
row["产出|数量"] = item.ProductMain; |
|
|
row["产出|数量"] = item.ProductMain; |
|
|
row["产出|辅数量"] = item.ProductSecond; |
|
|
row["产出|辅数量"] = item.ProductSecond; |
|
|
|
|
|
row["差异|数量"] = item.ProductMainDiff; |
|
|
|
|
|
row["差异|辅数量"] = item.ProductSecondDiff; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
row["已备|数量"] = item.StockNumber; |
|
|
|
|
|
row["已备|辅数量"] = item.StockSecondNumber; |
|
|
|
|
|
row["备货差异|数量"] = item.StockDiffNumber; |
|
|
|
|
|
row["备货差异|辅数量"] = item.StockDiffSecondNumber; |
|
|
|
|
|
row["可用|数量"] = item.AvailableMain; |
|
|
|
|
|
row["可用|辅数量"] = item.AvailableSecond; |
|
|
} |
|
|
} |
|
|
row["已备|数量"] = item.StockNumber; |
|
|
|
|
|
row["已备|辅数量"] = item.StockSecondNumber; |
|
|
|
|
|
row["备货差异|数量"] = item.StockDiffNumber; |
|
|
|
|
|
row["备货差异|辅数量"] = item.StockDiffSecondNumber; |
|
|
|
|
|
row["可用|数量"] = item.AvailableMain; |
|
|
|
|
|
row["可用|辅数量"] = item.AvailableSecond; |
|
|
|
|
|
} |
|
|
} |
|
|
SumColumnNames.Add("订货|数量"); |
|
|
SumColumnNames.Add("订货|数量"); |
|
|
table.Data.SumRow["订货|数量"] = list.Sum(x => (x.OrderMain ?? 0).Value); |
|
|
table.Data.SumRow["订货|数量"] = list.Sum(x => (x.OrderMain ?? 0).Value); |
|
|
@ -306,17 +328,30 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
{ |
|
|
{ |
|
|
table.Data.SumRow["产出|数量"] = list.Sum(x => (x.ProductMain ?? 0).Value); |
|
|
table.Data.SumRow["产出|数量"] = list.Sum(x => (x.ProductMain ?? 0).Value); |
|
|
table.Data.SumRow["产出|辅数量"] = list.Sum(x => (x.ProductSecond ?? 0).Value); |
|
|
table.Data.SumRow["产出|辅数量"] = list.Sum(x => (x.ProductSecond ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["差异|数量"] = list.Sum(x => (x.ProductMainDiff ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["差异|辅数量"] = list.Sum(x => (x.ProductSecondDiff ?? 0).Value); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
table.Data.SumRow["已备|数量"] = list.Sum(x => (x.StockNumber ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["已备|辅数量"] = list.Sum(x => (x.StockSecondNumber ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["备货差异|数量"] = list.Sum(x => x.StockDiffNumber.Value); |
|
|
|
|
|
table.Data.SumRow["备货差异|辅数量"] = list.Sum(x => x.StockDiffSecondNumber.Value); |
|
|
|
|
|
table.Data.SumRow["可用|数量"] = list.Sum(x => (x.AvailableMain ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["可用|辅数量"] = list.Sum(x => (x.AvailableSecond ?? 0).Value); |
|
|
} |
|
|
} |
|
|
table.Data.SumRow["已备|数量"] = list.Sum(x => (x.StockNumber ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["已备|辅数量"] = list.Sum(x => (x.StockSecondNumber ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["备货差异|数量"] = list.Sum(x => x.StockDiffNumber.Value); |
|
|
|
|
|
table.Data.SumRow["备货差异|辅数量"] = list.Sum(x => x.StockDiffSecondNumber.Value); |
|
|
|
|
|
table.Data.SumRow["可用|数量"] = list.Sum(x => (x.AvailableMain ?? 0).Value); |
|
|
|
|
|
table.Data.SumRow["可用|辅数量"] = list.Sum(x => (x.AvailableSecond ?? 0).Value); |
|
|
|
|
|
|
|
|
|
|
|
return table; |
|
|
return table; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
long? GetMaxLine(IDmoSession session, IEnumerable<long> ids) |
|
|
|
|
|
{ |
|
|
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(DeliverGoodsLine))); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Max("SequenceNumber")); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), ids.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
return query.EExecuteScalar<long?>(session); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<MinObj> GetInStoreNumber(IEnumerable<long> goodsIDs, DateTime? start, DateTime? end, IDmoSession session) |
|
|
List<MinObj> GetInStoreNumber(IEnumerable<long> goodsIDs, DateTime? start, DateTime? end, IDmoSession session) |
|
|
{ |
|
|
{ |
|
|
var main = new JoinAlias(typeof(Output)); |
|
|
var main = new JoinAlias(typeof(Output)); |
|
|
@ -390,7 +425,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
return list; |
|
|
return list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<TempObj> GetMainInfo(IEnumerable<long> line, IEnumerable<long> seques, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, short? billStateDp, IDmoSession session) |
|
|
|
|
|
|
|
|
List<TempObj> GetMainInfo(long? seque, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, IDmoSession session) |
|
|
{ |
|
|
{ |
|
|
var main = new JoinAlias("_m", typeof(SaleOutStore)); |
|
|
var main = new JoinAlias("_m", typeof(SaleOutStore)); |
|
|
var detail = new JoinAlias("_d", typeof(SaleOutStore_Detail)); |
|
|
var detail = new JoinAlias("_d", typeof(SaleOutStore_Detail)); |
|
|
@ -398,7 +433,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
var customer = new JoinAlias("_c1", typeof(CustomerViewConfig)); |
|
|
var customer = new JoinAlias("_c1", typeof(CustomerViewConfig)); |
|
|
var temp = new JoinAlias(typeof(StockUpClass)); |
|
|
var temp = new JoinAlias(typeof(StockUpClass)); |
|
|
var query = new DQueryDom(main); |
|
|
var query = new DQueryDom(main); |
|
|
StockUpClass.Register(query, line, seques, goodsIDs, minDate, maxDate, billStateDp); |
|
|
|
|
|
|
|
|
StockUpClass.Register(query, seque, goodsIDs, minDate, maxDate); |
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); |
|
|
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(config, "Goods_ID", detail, "SaleGoods_ID")); |
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(config), DQCondition.EQ(config, "Goods_ID", detail, "SaleGoods_ID")); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(customer), DQCondition.EQ(main, "Customer_ID", customer, "Customer_ID")); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(customer), DQCondition.EQ(main, "Customer_ID", customer, "Customer_ID")); |
|
|
@ -425,19 +460,13 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "LoadTime", minDate.Value)); |
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "LoadTime", minDate.Value)); |
|
|
if (maxDate.HasValue) |
|
|
if (maxDate.HasValue) |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", maxDate.Value)); |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", maxDate.Value)); |
|
|
if (line.Any()) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "DeliverGoodsLine_ID"), line.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
else |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(main, "DeliverGoodsLine_ID"))); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(main, "DeliverGoodsLine_ID"))); |
|
|
if (goodsIDs.Any()) |
|
|
if (goodsIDs.Any()) |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
|
|
|
if (billStateDp.HasValue) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", billStateDp)); |
|
|
|
|
|
else |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
|
|
|
if (seques.Any()) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "SequenceNumber"), seques.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
|
|
|
if (seque.HasValue) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "SequenceNumber", seque)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); |
|
|
|
|
|
|
|
|
var list = new List<TempObj>(); |
|
|
var list = new List<TempObj>(); |
|
|
@ -471,7 +500,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
public Money<decimal>? StockSecondNumber { get; set; } |
|
|
public Money<decimal>? StockSecondNumber { get; set; } |
|
|
public Money<decimal>? StockNumber { get; set; } |
|
|
public Money<decimal>? StockNumber { get; set; } |
|
|
|
|
|
|
|
|
public static void Register(DQueryDom root, IEnumerable<long> line, IEnumerable<long> seques, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, short? billStateDp) |
|
|
|
|
|
|
|
|
public static void Register(DQueryDom root, long? seque, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate) |
|
|
{ |
|
|
{ |
|
|
var main = new JoinAlias("_tMain", typeof(SaleOutStore)); |
|
|
var main = new JoinAlias("_tMain", typeof(SaleOutStore)); |
|
|
var detail = new JoinAlias("_tDetail", typeof(SaleOutStore_Detail)); |
|
|
var detail = new JoinAlias("_tDetail", typeof(SaleOutStore_Detail)); |
|
|
@ -488,18 +517,12 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "LoadTime", minDate.Value)); |
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "LoadTime", minDate.Value)); |
|
|
if (maxDate.HasValue) |
|
|
if (maxDate.HasValue) |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", maxDate.Value)); |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", maxDate.Value)); |
|
|
if (line.Any()) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "DeliverGoodsLine_ID"), line.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
else |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(main, "DeliverGoodsLine_ID"))); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(main, "DeliverGoodsLine_ID"))); |
|
|
if (goodsIDs.Any()) |
|
|
if (goodsIDs.Any()) |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
if (billStateDp.HasValue) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", billStateDp)); |
|
|
|
|
|
else |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
|
|
|
if (seques.Any()) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "SequenceNumber"), seques.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
|
|
|
if (seque.HasValue) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "SequenceNumber", seque)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); |
|
|
|
|
|
|
|
|
root.RegisterQueryTable(typeof(StockUpClass), new string[] { "DetailID", "StockSecondNumber", "StockNumber" }, query); |
|
|
root.RegisterQueryTable(typeof(StockUpClass), new string[] { "DetailID", "StockSecondNumber", "StockNumber" }, query); |
|
|
@ -517,6 +540,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_ |
|
|
public string SecondUnit { get; set; } |
|
|
public string SecondUnit { get; set; } |
|
|
public Money<decimal>? ProductMain { get; set; } |
|
|
public Money<decimal>? ProductMain { get; set; } |
|
|
public Money<decimal>? ProductSecond { get; set; } |
|
|
public Money<decimal>? ProductSecond { get; set; } |
|
|
|
|
|
public Money<decimal>? ProductMainDiff { get; set; } |
|
|
|
|
|
public Money<decimal>? ProductSecondDiff { get; set; } |
|
|
public Money<decimal>? OrderMain { get; set; } |
|
|
public Money<decimal>? OrderMain { get; set; } |
|
|
public Money<decimal>? OrderSecond { get; set; } |
|
|
public Money<decimal>? OrderSecond { get; set; } |
|
|
public Money<decimal>? StockNumber { get; set; } |
|
|
public Money<decimal>? StockNumber { get; set; } |
|
|
|