|
|
|
@ -49,21 +49,28 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
{ |
|
|
|
var row = (DFDataRow)dataRow; |
|
|
|
BuildCell(htmlRow, row); |
|
|
|
var diff = row["备货差异|数量"]; |
|
|
|
if (diff != null && Convert.ToDecimal(diff) <= 0) |
|
|
|
var diff = Convert.ToDecimal(row["备货差异|数量"] ?? 0); |
|
|
|
var ava = Convert.ToDecimal(row["可用|数量"] ?? 0); |
|
|
|
var color = string.Empty; |
|
|
|
if (onlyGoodsCheck.Checked) |
|
|
|
{ |
|
|
|
var cIdx = onlyGoodsCheck.Checked ? 1 : 3; |
|
|
|
for (var i = 0; i < cIdx; i++) |
|
|
|
htmlRow.Cells[i].Style.Add("background-color", "pink"); |
|
|
|
if (ava < diff) |
|
|
|
color = "pink"; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var ava = row["可用|数量"]; |
|
|
|
if (ava != null && Convert.ToDecimal(diff ?? 0) == Convert.ToDecimal(ava)) |
|
|
|
{ |
|
|
|
var cIdx = onlyGoodsCheck.Checked ? 9 : 11; |
|
|
|
htmlRow.Cells[cIdx].Style.Add("background-color", "lightgreen"); |
|
|
|
} |
|
|
|
if (diff <= 0) |
|
|
|
color = "lightgreen"; |
|
|
|
else if (ava >= diff) |
|
|
|
color = "lightblue"; |
|
|
|
else if (ava < diff) |
|
|
|
color = "#FFA07A"; |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(color)) |
|
|
|
{ |
|
|
|
var cIdx = onlyGoodsCheck.Checked ? 0 : 2; |
|
|
|
for (var i = cIdx; i < htmlRow.Cells.Count; i++) |
|
|
|
htmlRow.Cells[i].Style.Add("background-color", color); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
@ -79,6 +86,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
else |
|
|
|
url = AspUtil.AddParamToUrl(url, "DeliverGoodsLine_ID", mQueryContainer.GetControl<DFChoiceBox>("DeliverGoodsLine_ID").Value); |
|
|
|
url = AspUtil.AddParamToUrl(url, "BillState", billStateDp.SelectedValue); |
|
|
|
url = AspUtil.AddParamToUrl(url, "Sequence", mQueryContainer.GetControl<DFTextBox>("SequenceNumber").Text.Trim()); |
|
|
|
url = WpfPageUrl.ToGlobal(url); |
|
|
|
var cIdx = onlyGoodsCheck.Checked ? 0 : 2; |
|
|
|
var cell = htmlRow.Cells[cIdx]; |
|
|
|
@ -103,12 +111,13 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
hPanel.Add(QueryCreator.DateRange(mDFInfo.Fields["LoadTime"], mQueryContainer, "MinLoadTime", "MaxLoadTime", DateTime.Today, DateTime.Today + new TimeSpan(23, 59, 29))); |
|
|
|
hPanel.Add(new LiteralControl("送货线路:")); |
|
|
|
hPanel.Add(QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["DeliverGoodsLine_ID"], mQueryContainer, "DeliverGoodsLine_ID", B3SaleDataSources.送货线路)); |
|
|
|
|
|
|
|
hPanel.Add(new LiteralControl("顺序:")); |
|
|
|
hPanel.Add(mQueryContainer.Add(QueryCreator.DFTextBox(mDFInfo.Fields["Remark"]), "SequenceNumber")); |
|
|
|
hPanel.Add(new LiteralControl("存货:")); |
|
|
|
hPanel.Add(QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["AccountingUnit_ID"], mQueryContainer, "SaleGoods_ID", B3SaleDataSources.可销售存货)); |
|
|
|
|
|
|
|
hPanel.Add(new LiteralControl("单据状态:")); |
|
|
|
billStateDp = hPanel.Add(new DFDropDownList() { Width = Unit.Pixel(80) }); |
|
|
|
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")); |
|
|
|
@ -119,18 +128,36 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
return hPanel; |
|
|
|
} |
|
|
|
|
|
|
|
protected override void AddToolboxPanel(HLayoutPanel hbox) |
|
|
|
{ |
|
|
|
if (EnablePrint) |
|
|
|
{ |
|
|
|
var printPage = "SaleOutStockPrint.aspx?MinDate=" + "'+__QueryContainer.getControl('MinLoadTime').value+'&MaxDate=" + "'+__QueryContainer.getControl('MaxLoadTime').value+'&" + "'+__QueryContainer.getQueryString(['DeliverGoodsLine_ID','SequenceNumber','SaleGoods_ID','BillState'])+'"; |
|
|
|
hbox.Add(new TSButton("预览")).OnClientClick = "preventEventDefault(event);Preview('" + printPage + "')"; |
|
|
|
hbox.Add(new TSButton("打印")).OnClientClick = "preventEventDefault(event);Print('" + printPage + "')"; |
|
|
|
} |
|
|
|
AddExcelExport(hbox); |
|
|
|
} |
|
|
|
|
|
|
|
public override PagedDFDataTable GetPagedDFDataTable(QuerySettings settings) |
|
|
|
{ |
|
|
|
var line = mQueryContainer.GetControl<DFChoiceBox>("DeliverGoodsLine_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 maxDate = mQueryContainer.GetControl<DFDateInput>("MaxLoadTime").Value; |
|
|
|
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>(); |
|
|
|
if (!string.IsNullOrEmpty(sequenceInput)) |
|
|
|
seques = sequenceInput.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); |
|
|
|
List<TempObj> data; |
|
|
|
List<MinObj> products; |
|
|
|
List<StockUpClass> stockInfo; |
|
|
|
using (var session = Dmo.NewSession()) |
|
|
|
{ |
|
|
|
data = GetMainInfo(line, goodsIds, minDate, maxDate, billStateDp, session); |
|
|
|
data = GetMainInfo(line, seques, goodsIds, minDate, maxDate, billState, session); |
|
|
|
products = GetInStoreNumber(goodsIds, minDate, maxDate, session); |
|
|
|
stockInfo = GetStockInfo(goodsIds, minDate, maxDate, session); |
|
|
|
}; |
|
|
|
@ -327,15 +354,15 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
{ |
|
|
|
var entity = new StockUpClass(); |
|
|
|
entity.Goods_ID = (long)reader[0]; |
|
|
|
entity.StockSecondNumber = (Money<decimal>?)reader[1]; |
|
|
|
entity.StockNumber = (Money<decimal>?)reader[2]; |
|
|
|
entity.StockSecondNumber = (decimal?)reader[1]; |
|
|
|
entity.StockNumber = (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) |
|
|
|
List<TempObj> GetMainInfo(IEnumerable<long> line, IEnumerable<long> seques, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, short? billStateDp, IDmoSession session) |
|
|
|
{ |
|
|
|
var main = new JoinAlias("_m", typeof(SaleOutStore)); |
|
|
|
var detail = new JoinAlias("_d", typeof(SaleOutStore_Detail)); |
|
|
|
@ -343,7 +370,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
var customer = new JoinAlias("_c1", typeof(CustomerViewConfig)); |
|
|
|
var temp = new JoinAlias(typeof(StockUpClass)); |
|
|
|
var query = new DQueryDom(main); |
|
|
|
StockUpClass.Register(query, line, goodsIDs, minDate, maxDate, billStateDp); |
|
|
|
StockUpClass.Register(query, line, seques, goodsIDs, minDate, maxDate, billStateDp); |
|
|
|
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.Left, new DQDmoSource(customer), DQCondition.EQ(main, "Customer_ID", customer, "Customer_ID")); |
|
|
|
@ -365,7 +392,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
query.Columns.Add(DQSelectColumn.Sum(temp, "StockSecondNumber")); |
|
|
|
|
|
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SequenceNumber")); |
|
|
|
|
|
|
|
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(customer, "Customer_ID"))); |
|
|
|
if (minDate.HasValue) |
|
|
|
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "LoadTime", minDate.Value)); |
|
|
|
if (maxDate.HasValue) |
|
|
|
@ -377,10 +404,12 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
if (goodsIDs.Any()) |
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(billStateDp.SelectedValue)) |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", short.Parse(billStateDp.SelectedValue))); |
|
|
|
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.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); |
|
|
|
|
|
|
|
var list = new List<TempObj>(); |
|
|
|
@ -407,14 +436,14 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
class StockUpClass |
|
|
|
public class StockUpClass |
|
|
|
{ |
|
|
|
public long Goods_ID { get; set; } |
|
|
|
public long DetailID { get; set; } |
|
|
|
public Money<decimal>? StockSecondNumber { 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> seques, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, short? billStateDp) |
|
|
|
{ |
|
|
|
var main = new JoinAlias("_tMain", typeof(SaleOutStore)); |
|
|
|
var detail = new JoinAlias("_tDetail", typeof(SaleOutStore_Detail)); |
|
|
|
@ -437,10 +466,12 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ |
|
|
|
query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(main, "DeliverGoodsLine_ID"))); |
|
|
|
if (goodsIDs.Any()) |
|
|
|
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
if (!string.IsNullOrEmpty(billStateDp.SelectedValue)) |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", short.Parse(billStateDp.SelectedValue))); |
|
|
|
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.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); |
|
|
|
|
|
|
|
root.RegisterQueryTable(typeof(StockUpClass), new string[] { "DetailID", "StockSecondNumber", "StockNumber" }, query); |
|
|
|
|