|
|
@ -48,11 +48,13 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
mDFGrid.AfterFillDetailRow += (htmlRow, dataRow) => |
|
|
mDFGrid.AfterFillDetailRow += (htmlRow, dataRow) => |
|
|
{ |
|
|
{ |
|
|
var row = (DFDataRow)dataRow; |
|
|
var row = (DFDataRow)dataRow; |
|
|
|
|
|
BuildCell(htmlRow, row); |
|
|
var diff = row["备货差异|数量"]; |
|
|
var diff = row["备货差异|数量"]; |
|
|
if (diff != null && Convert.ToDecimal(diff) <= 0) |
|
|
if (diff != null && Convert.ToDecimal(diff) <= 0) |
|
|
{ |
|
|
{ |
|
|
foreach (HtmlTableCell c in htmlRow.Cells) |
|
|
|
|
|
c.Style.Add("background-color", "lightgreen"); |
|
|
|
|
|
|
|
|
var cIdx = onlyGoodsCheck.Checked ? 1 : 3; |
|
|
|
|
|
for (var i = 0; i < cIdx; i++) |
|
|
|
|
|
htmlRow.Cells[i].Style.Add("background-color", "pink"); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
@ -63,10 +65,29 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
htmlRow.Cells[cIdx].Style.Add("background-color", "lightgreen"); |
|
|
htmlRow.Cells[cIdx].Style.Add("background-color", "lightgreen"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void BuildCell(HtmlTableRow htmlRow, DFDataRow dataRow) |
|
|
|
|
|
{ |
|
|
|
|
|
var url = "~/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.aspx"; |
|
|
|
|
|
url = AspUtil.AddParamToUrl(url, "minDate", mQueryContainer.GetControl<DFDateInput>("MinLoadTime").Text); |
|
|
|
|
|
url = AspUtil.AddParamToUrl(url, "maxDate", mQueryContainer.GetControl<DFDateInput>("MaxLoadTime").Text); |
|
|
|
|
|
url = AspUtil.AddParamToUrl(url, "Goods_ID", dataRow["Goods_ID"].ToString()); |
|
|
|
|
|
if (dataRow["DeliverGoodsLine_ID"] != null) |
|
|
|
|
|
url = AspUtil.AddParamToUrl(url, "DeliverGoodsLine_ID", dataRow["DeliverGoodsLine_ID"].ToString()); |
|
|
|
|
|
else |
|
|
|
|
|
url = AspUtil.AddParamToUrl(url, "DeliverGoodsLine_ID", mQueryContainer.GetControl<DFChoiceBox>("DeliverGoodsLine_ID").Value); |
|
|
|
|
|
url = AspUtil.AddParamToUrl(url, "BillState", billStateDp.SelectedValue); |
|
|
|
|
|
url = WpfPageUrl.ToGlobal(url); |
|
|
|
|
|
var cIdx = onlyGoodsCheck.Checked ? 0 : 2; |
|
|
|
|
|
var cell = htmlRow.Cells[cIdx]; |
|
|
|
|
|
cell.Attributes["onclick"] = "OpenUrlInTopTab('" + url + "','订单详情');"; |
|
|
|
|
|
cell.Style.Add("color", "blue"); |
|
|
|
|
|
cell.Style.Add("text-decoration", "underline"); |
|
|
|
|
|
cell.Style.Add("cursor", "pointer"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
protected override void InitQueryPanel(WebControls.QueryPanel queryPanel) |
|
|
protected override void InitQueryPanel(WebControls.QueryPanel queryPanel) |
|
|
{ |
|
|
{ |
|
|
//base.InitQueryPanel(queryPanel);
|
|
|
//base.InitQueryPanel(queryPanel);
|
|
|
@ -104,10 +125,16 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
var goodsIds = mQueryContainer.GetControl<DFChoiceBox>("SaleGoods_ID").GetValues().Select(x => long.Parse(x)); |
|
|
var goodsIds = mQueryContainer.GetControl<DFChoiceBox>("SaleGoods_ID").GetValues().Select(x => long.Parse(x)); |
|
|
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 data = GetMainInfo(line, goodsIds, minDate, maxDate, billStateDp); |
|
|
|
|
|
var products = GetInStoreNumber(goodsIds, minDate, maxDate); |
|
|
|
|
|
foreach (var g in data.GroupBy(x => x.Goods_ID)) |
|
|
|
|
|
|
|
|
List<TempObj> data; |
|
|
|
|
|
List<MinObj> products; |
|
|
|
|
|
List<StockUpClass> stockInfo; |
|
|
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
|
|
{ |
|
|
|
|
|
data = GetMainInfo(line, goodsIds, minDate, maxDate, billStateDp, session); |
|
|
|
|
|
products = GetInStoreNumber(goodsIds, minDate, maxDate, session); |
|
|
|
|
|
stockInfo = GetStockInfo(goodsIds, minDate, maxDate, session); |
|
|
|
|
|
}; |
|
|
|
|
|
foreach (var g in stockInfo.GroupBy(x => x.Goods_ID)) |
|
|
{ |
|
|
{ |
|
|
var first = products.FirstOrDefault(x => x.Goods_ID == g.Key); |
|
|
var first = products.FirstOrDefault(x => x.Goods_ID == g.Key); |
|
|
if (first != null) |
|
|
if (first != null) |
|
|
@ -124,6 +151,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
{ |
|
|
{ |
|
|
var first = g.First(); |
|
|
var first = g.First(); |
|
|
var entity = new TempObj(); |
|
|
var entity = new TempObj(); |
|
|
|
|
|
entity.Goods_ID = first.Goods_ID; |
|
|
entity.Goods_Name = first.Goods_Name; |
|
|
entity.Goods_Name = first.Goods_Name; |
|
|
entity.Unit = first.Unit; |
|
|
entity.Unit = first.Unit; |
|
|
entity.SecondUnit = first.SecondUnit; |
|
|
entity.SecondUnit = first.SecondUnit; |
|
|
@ -150,27 +178,13 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
if (item.StockDiffNumber > 0) |
|
|
if (item.StockDiffNumber > 0) |
|
|
{ |
|
|
{ |
|
|
item.AvailableMain = Math.Min(item.StockDiffNumber.Value, (first.MainNumber ?? 0).Value); |
|
|
item.AvailableMain = Math.Min(item.StockDiffNumber.Value, (first.MainNumber ?? 0).Value); |
|
|
|
|
|
|
|
|
first.MainNumber -= item.AvailableMain; |
|
|
first.MainNumber -= item.AvailableMain; |
|
|
|
|
|
|
|
|
if (item.AvailableMain < 0) |
|
|
|
|
|
item.AvailableMain = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (first.MainNumber < 0) |
|
|
|
|
|
first.MainNumber = 0; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (item.StockDiffSecondNumber > 0) |
|
|
if (item.StockDiffSecondNumber > 0) |
|
|
{ |
|
|
{ |
|
|
item.AvailableSecond = Math.Min(item.StockDiffSecondNumber.Value, (first.SecondNumber ?? 0).Value); |
|
|
item.AvailableSecond = Math.Min(item.StockDiffSecondNumber.Value, (first.SecondNumber ?? 0).Value); |
|
|
|
|
|
|
|
|
first.SecondNumber -= item.AvailableSecond; |
|
|
first.SecondNumber -= item.AvailableSecond; |
|
|
|
|
|
|
|
|
if (item.AvailableSecond < 0) |
|
|
|
|
|
item.AvailableSecond = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (first.SecondNumber < 0) |
|
|
|
|
|
first.SecondNumber = 0; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -185,6 +199,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
} |
|
|
} |
|
|
table.Data.Columns.Add(new DFCustomDataColumn("存货", typeof(string))); |
|
|
table.Data.Columns.Add(new DFCustomDataColumn("存货", typeof(string))); |
|
|
ColumnNames.Add("存货"); |
|
|
ColumnNames.Add("存货"); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("Goods_ID", typeof(long))); |
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("DeliverGoodsLine_ID", typeof(long?))); |
|
|
|
|
|
|
|
|
table.Data.Columns.Add(new DFCustomDataColumn("订货|数量", typeof(Money<decimal>?))); |
|
|
table.Data.Columns.Add(new DFCustomDataColumn("订货|数量", typeof(Money<decimal>?))); |
|
|
ColumnNames.Add("订货|数量"); |
|
|
ColumnNames.Add("订货|数量"); |
|
|
@ -217,8 +233,10 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
if (!onlyGoodsCheck.Checked) |
|
|
if (!onlyGoodsCheck.Checked) |
|
|
{ |
|
|
{ |
|
|
row["顺序号"] = item.SequenceNumber; |
|
|
row["顺序号"] = item.SequenceNumber; |
|
|
row["线路"] = item.LineName; |
|
|
|
|
|
|
|
|
row["线路"] = item.DeliverGoodsLine_Name; |
|
|
} |
|
|
} |
|
|
|
|
|
row["Goods_ID"] = item.Goods_ID; |
|
|
|
|
|
row["DeliverGoodsLine_ID"] = item.DeliverGoodsLine_ID; |
|
|
row["存货"] = item.Goods_Name; |
|
|
row["存货"] = item.Goods_Name; |
|
|
row["订货|数量"] = item.OrderMain; |
|
|
row["订货|数量"] = item.OrderMain; |
|
|
row["订货|单位"] = item.Unit; |
|
|
row["订货|单位"] = item.Unit; |
|
|
@ -244,7 +262,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
return table; |
|
|
return table; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
IEnumerable<MinObj> GetInStoreNumber(IEnumerable<long> goodsIDs, DateTime? start, DateTime? end) |
|
|
|
|
|
|
|
|
List<MinObj> GetInStoreNumber(IEnumerable<long> goodsIDs, DateTime? start, DateTime? end, IDmoSession session) |
|
|
{ |
|
|
{ |
|
|
var main = new JoinAlias(typeof(ProductInStore)); |
|
|
var main = new JoinAlias(typeof(ProductInStore)); |
|
|
var detail = new JoinAlias(typeof(ProductInStore_Detail)); |
|
|
var detail = new JoinAlias(typeof(ProductInStore_Detail)); |
|
|
@ -266,10 +284,58 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual("Date", end)); |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual("Date", end)); |
|
|
if (goodsIDs.Any()) |
|
|
if (goodsIDs.Any()) |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "Goods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "Goods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
return query.EExecuteList<long, Money<decimal>?, Money<decimal>?>().Select(x => new MinObj { Goods_ID = x.Item1, MainNumber = x.Item2, SecondNumber = x.Item3 }); |
|
|
|
|
|
|
|
|
var list = new List<MinObj>(); |
|
|
|
|
|
using (var reader = session.ExecuteReader(query)) |
|
|
|
|
|
{ |
|
|
|
|
|
while (reader.Read()) |
|
|
|
|
|
{ |
|
|
|
|
|
list.Add(new MinObj |
|
|
|
|
|
{ |
|
|
|
|
|
Goods_ID = (long)reader[0], |
|
|
|
|
|
MainNumber = (Money<decimal>?)reader[1], |
|
|
|
|
|
SecondNumber = (Money<decimal>?)reader[2] |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<TempObj> GetMainInfo(IEnumerable<long> line, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, DFDropDownList billStateDp) |
|
|
|
|
|
|
|
|
static List<StockUpClass> GetStockInfo(IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, IDmoSession session) |
|
|
|
|
|
{ |
|
|
|
|
|
var main = new JoinAlias("_tMain", typeof(SaleOutStore)); |
|
|
|
|
|
var detail = new JoinAlias("_tDetail", typeof(SaleOutStore_Detail)); |
|
|
|
|
|
var stockUp = new JoinAlias(typeof(StockUpDetail)); |
|
|
|
|
|
var query = new DQueryDom(stockUp); |
|
|
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(detail, "ID", stockUp, "DetailID")); |
|
|
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail)); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(stockUp, "SecondNumber")), "备货辅数量")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(stockUp, "UnitNumber")), "备货报价数量")); |
|
|
|
|
|
|
|
|
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(detail, "SaleGoods_ID")); |
|
|
|
|
|
if (minDate.HasValue) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "LoadTime", minDate.Value)); |
|
|
|
|
|
if (maxDate.HasValue) |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", maxDate.Value)); |
|
|
|
|
|
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.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
|
|
|
var list = new List<StockUpClass>(); |
|
|
|
|
|
using (var reader = session.ExecuteReader(query)) |
|
|
|
|
|
{ |
|
|
|
|
|
while (reader.Read()) |
|
|
|
|
|
{ |
|
|
|
|
|
var entity = new StockUpClass(); |
|
|
|
|
|
entity.Goods_ID = (long)reader[0]; |
|
|
|
|
|
entity.StockSecondNumber = (Money<decimal>?)reader[1]; |
|
|
|
|
|
entity.StockNumber = (Money<decimal>?)reader[2]; |
|
|
|
|
|
list.Add(entity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<TempObj> GetMainInfo(IEnumerable<long> line, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, DFDropDownList billStateDp, 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)); |
|
|
@ -283,6 +349,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
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")); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(temp), DQCondition.EQ(detail, "ID", temp, "DetailID")); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(temp), DQCondition.EQ(detail, "ID", temp, "DetailID")); |
|
|
query.Columns.Add(DQSelectColumn.Field("SequenceNumber")); |
|
|
query.Columns.Add(DQSelectColumn.Field("SequenceNumber")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Field("DeliverGoodsLine_ID")); |
|
|
query.Columns.Add(DQSelectColumn.Field("DeliverGoodsLine_Name")); |
|
|
query.Columns.Add(DQSelectColumn.Field("DeliverGoodsLine_Name")); |
|
|
query.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail)); |
|
|
query.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail)); |
|
|
query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail)); |
|
|
query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail)); |
|
|
@ -296,6 +363,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Sum(temp, "StockNumber")); |
|
|
query.Columns.Add(DQSelectColumn.Sum(temp, "StockNumber")); |
|
|
query.Columns.Add(DQSelectColumn.Sum(temp, "StockSecondNumber")); |
|
|
query.Columns.Add(DQSelectColumn.Sum(temp, "StockSecondNumber")); |
|
|
|
|
|
|
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SequenceNumber")); |
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SequenceNumber")); |
|
|
|
|
|
|
|
|
if (minDate.HasValue) |
|
|
if (minDate.HasValue) |
|
|
@ -305,7 +373,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
if (line.Any()) |
|
|
if (line.Any()) |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "DeliverGoodsLine_ID"), line.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "DeliverGoodsLine_ID"), line.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
else |
|
|
else |
|
|
query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("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())); |
|
|
|
|
|
|
|
|
@ -313,29 +381,27 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", short.Parse(billStateDp.SelectedValue))); |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", short.Parse(billStateDp.SelectedValue))); |
|
|
else |
|
|
else |
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); |
|
|
|
|
|
|
|
|
var list = new List<TempObj>(); |
|
|
var list = new List<TempObj>(); |
|
|
using (var session = Dmo.NewSession()) |
|
|
|
|
|
|
|
|
using (var reader = session.ExecuteReader(query)) |
|
|
{ |
|
|
{ |
|
|
using (var reader = session.ExecuteReader(query)) |
|
|
|
|
|
|
|
|
while (reader.Read()) |
|
|
{ |
|
|
{ |
|
|
while (reader.Read()) |
|
|
|
|
|
{ |
|
|
|
|
|
var entity = new TempObj(); |
|
|
|
|
|
entity.SequenceNumber = (long?)reader[0]; |
|
|
|
|
|
entity.LineName = (string)reader[1]; |
|
|
|
|
|
entity.Goods_ID = (long)reader[2]; |
|
|
|
|
|
entity.Goods_Name = (string)reader[3]; |
|
|
|
|
|
entity.Unit = (string)reader[4]; |
|
|
|
|
|
entity.SecondUnit = (string)reader[5]; |
|
|
|
|
|
|
|
|
|
|
|
entity.OrderMain = (Money<decimal>?)reader[6]; |
|
|
|
|
|
entity.OrderSecond = (Money<decimal>?)reader[7]; |
|
|
|
|
|
entity.StockNumber = (Money<decimal>?)reader[8]; |
|
|
|
|
|
entity.StockSecondNumber = (Money<decimal>?)reader[9]; |
|
|
|
|
|
|
|
|
|
|
|
list.Add(entity); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var entity = new TempObj(); |
|
|
|
|
|
entity.SequenceNumber = (long?)reader[0]; |
|
|
|
|
|
entity.DeliverGoodsLine_ID = (long?)reader[1]; |
|
|
|
|
|
entity.DeliverGoodsLine_Name = (string)reader[2]; |
|
|
|
|
|
entity.Goods_ID = (long)reader[3]; |
|
|
|
|
|
entity.Goods_Name = (string)reader[4]; |
|
|
|
|
|
entity.Unit = (string)reader[5]; |
|
|
|
|
|
entity.SecondUnit = (string)reader[6]; |
|
|
|
|
|
entity.OrderMain = (Money<decimal>?)reader[7]; |
|
|
|
|
|
entity.OrderSecond = (Money<decimal>?)reader[8]; |
|
|
|
|
|
entity.StockNumber = (Money<decimal>?)reader[9]; |
|
|
|
|
|
entity.StockSecondNumber = (Money<decimal>?)reader[10]; |
|
|
|
|
|
|
|
|
|
|
|
list.Add(entity); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return list; |
|
|
return list; |
|
|
@ -343,10 +409,9 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
|
|
|
|
|
class StockUpClass |
|
|
class StockUpClass |
|
|
{ |
|
|
{ |
|
|
|
|
|
public long Goods_ID { get; set; } |
|
|
public long DetailID { get; set; } |
|
|
public long DetailID { get; set; } |
|
|
|
|
|
|
|
|
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> goodsIDs, DateTime? minDate, DateTime? maxDate, DFDropDownList billStateDp) |
|
|
public static void Register(DQueryDom root, IEnumerable<long> line, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, DFDropDownList billStateDp) |
|
|
@ -358,8 +423,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(detail, "ID", stockUp, "DetailID")); |
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(detail, "ID", stockUp, "DetailID")); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); |
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "SaleOutStore_ID")); |
|
|
query.Columns.Add(DQSelectColumn.Field("ID", detail)); |
|
|
query.Columns.Add(DQSelectColumn.Field("ID", detail)); |
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(stockUp, "SecondNumber")).ECastType<Money<decimal>?>(), "备货辅数量")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(stockUp, "UnitNumber")).ECastType<Money<decimal>?>(), "备货报价数量")); |
|
|
|
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(stockUp, "SecondNumber")), "StockSecondNumber")); |
|
|
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field(stockUp, "UnitNumber")), "StockNumber")); |
|
|
|
|
|
|
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(detail, "ID")); |
|
|
query.GroupBy.Expressions.Add(DQExpression.Field(detail, "ID")); |
|
|
if (minDate.HasValue) |
|
|
if (minDate.HasValue) |
|
|
@ -368,13 +433,16 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", maxDate.Value)); |
|
|
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", maxDate.Value)); |
|
|
if (line.Any()) |
|
|
if (line.Any()) |
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "DeliverGoodsLine_ID"), line.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
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"))); |
|
|
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 (!string.IsNullOrEmpty(billStateDp.SelectedValue)) |
|
|
if (!string.IsNullOrEmpty(billStateDp.SelectedValue)) |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", short.Parse(billStateDp.SelectedValue))); |
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", short.Parse(billStateDp.SelectedValue))); |
|
|
else |
|
|
else |
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); |
|
|
|
|
|
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); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -382,7 +450,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
class TempObj |
|
|
class TempObj |
|
|
{ |
|
|
{ |
|
|
public long? SequenceNumber { get; set; } |
|
|
public long? SequenceNumber { get; set; } |
|
|
public string LineName { get; set; } |
|
|
|
|
|
|
|
|
public long? DeliverGoodsLine_ID { get; set; } |
|
|
|
|
|
public string DeliverGoodsLine_Name { get; set; } |
|
|
public long Goods_ID { get; set; } |
|
|
public long Goods_ID { get; set; } |
|
|
public string Goods_Name { get; set; } |
|
|
public string Goods_Name { get; set; } |
|
|
public string Unit { get; set; } |
|
|
public string Unit { get; set; } |
|
|
|