diff --git a/B3ButcherManageToSale.Web/B3ButcherManageToSale.Web.csproj b/B3ButcherManageToSale.Web/B3ButcherManageToSale.Web.csproj index 2680d61..c4d0982 100644 --- a/B3ButcherManageToSale.Web/B3ButcherManageToSale.Web.csproj +++ b/B3ButcherManageToSale.Web/B3ButcherManageToSale.Web.csproj @@ -122,6 +122,9 @@ ASPXCodeBehind + + ASPXCodeBehind + ASPXCodeBehind diff --git a/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/OutputToSaleOutDiff_/OutputToSaleOutDiff.cs b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/OutputToSaleOutDiff_/OutputToSaleOutDiff.cs index 590a968..7484145 100644 --- a/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/OutputToSaleOutDiff_/OutputToSaleOutDiff.cs +++ b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/OutputToSaleOutDiff_/OutputToSaleOutDiff.cs @@ -34,7 +34,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_ var row = (DFDataRow)dataRow; var diff = row["差异|数量"]; - if (diff != null && Convert.ToDecimal(diff) < 0) + if (diff != null && Convert.ToDecimal(diff) > 0) { for (var i = 1; i < htmlRow.Cells.Count-1; i++) htmlRow.Cells[i].Style.Add("background-color", "#FFA07A"); diff --git a/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs index 73c589b..a6641ec 100644 --- a/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs +++ b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs @@ -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("DeliverGoodsLine_ID").Value); url = AspUtil.AddParamToUrl(url, "BillState", billStateDp.SelectedValue); + url = AspUtil.AddParamToUrl(url, "Sequence", mQueryContainer.GetControl("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("DeliverGoodsLine_ID").GetValues().Select(x => long.Parse(x)); var goodsIds = mQueryContainer.GetControl("SaleGoods_ID").GetValues().Select(x => long.Parse(x)); var minDate = mQueryContainer.GetControl("MinLoadTime").Value; var maxDate = mQueryContainer.GetControl("MaxLoadTime").Value; + var sequenceInput = mQueryContainer.GetControl("SequenceNumber").Text.Trim(); + short? billState = null; + if (!string.IsNullOrEmpty(billStateDp.SelectedValue)) + billState = short.Parse(billStateDp.SelectedValue); + IEnumerable seques = new List(); + if (!string.IsNullOrEmpty(sequenceInput)) + seques = sequenceInput.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); List data; List products; List 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?)reader[1]; - entity.StockNumber = (Money?)reader[2]; + entity.StockSecondNumber = (decimal?)reader[1]; + entity.StockNumber = (decimal?)reader[2]; list.Add(entity); } } return list; } - List GetMainInfo(IEnumerable line, IEnumerable goodsIDs, DateTime? minDate, DateTime? maxDate, DFDropDownList billStateDp, IDmoSession session) + List GetMainInfo(IEnumerable line, IEnumerable seques, IEnumerable 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(); @@ -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? StockSecondNumber { get; set; } public Money? StockNumber { get; set; } - public static void Register(DQueryDom root, IEnumerable line, IEnumerable goodsIDs, DateTime? minDate, DateTime? maxDate, DFDropDownList billStateDp) + public static void Register(DQueryDom root, IEnumerable line, IEnumerable seques, IEnumerable 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); diff --git a/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockPrint.cs b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockPrint.cs new file mode 100644 index 0000000..3413192 --- /dev/null +++ b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockPrint.cs @@ -0,0 +1,265 @@ +using BWP.B3Frameworks.Utils; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices; +using Forks.EnterpriseServices.DataForm; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.Utils; +using Forks.Utils.IO; +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using TSingSoft.WebControls2; +using TSingSoft.WebControls2.BillReports; +using TSingSoft.WebPluginFramework; +using WebUnit = System.Web.UI.WebControls.Unit; +using StockUpClass = BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_.SaleOutStockAnalyse.StockUpClass; +using Forks.EnterpriseServices.SqlDoms; +using BWP.B3Frameworks.BO.NamedValueTemplate; +using BWP.B3Sale.Utils; + +namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ +{ + class SaleOutStockPrint : PrintPageBase + { + public DateTime? MinDate + { + get + { + if (string.IsNullOrEmpty(Request.QueryString["MinDate"])) + return null; + return DateTime.Parse(Request.QueryString["MinDate"]); + } + } + + public DateTime? MaxDate + { + get + { + if (string.IsNullOrEmpty(Request.QueryString["MaxDate"])) + return null; + return DateTime.Parse(Request.QueryString["MaxDate"]) + new TimeSpan(23, 59, 29); + } + } + + public IEnumerable Goods_IDs + { + get + { + if (string.IsNullOrEmpty(Request.QueryString["SaleGoods_ID"])) + return new List(); + return Request.QueryString["SaleGoods_ID"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); + } + } + + public IEnumerable DeliverGoodsLine_IDs + { + get + { + if (string.IsNullOrEmpty(Request.QueryString["DeliverGoodsLine_ID"])) + return new List(); + return Request.QueryString["DeliverGoodsLine_ID"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); + } + } + + public IEnumerable Sequence + { + get + { + if (string.IsNullOrEmpty(Request.QueryString["SequenceNumber"])) + return new List(); + return Request.QueryString["SequenceNumber"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); + } + } + + public short? BillState + { + get + { + if (string.IsNullOrEmpty(Request.QueryString["BillState"])) + return null; + return short.Parse(Request.QueryString["BillState"]); + } + } + + string GetTemplateFile() + { + return PrintUtil.GetTemplateFile(PluginName, GetType().Name + ".xml"); + } + + protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form) + { + Control pageContainer = CreatePageContainer(CreateReport()); + form.Controls.Add(pageContainer); + } + + private int pagesCount; + private int slipPages; + private WebUnit pageHeight = WebUnit.Empty; + private Control CreatePageContainer(Control control) + { + foreach (Control ctrl in control.Controls) + { + BillReport r = ctrl as BillReport; + if (r != null) + { + pagesCount += r.PagesCount; + if (pageHeight == WebUnit.Empty) + pageHeight = r.PageHeight; + } + } + HtmlGenericControl result = new HtmlGenericControl("div"); + result.Style[HtmlTextWriterStyle.Width] = "100%"; + result.Style[HtmlTextWriterStyle.Padding] = "0cm"; + result.Style[HtmlTextWriterStyle.BorderWidth] = "0cm"; + result.Style[HtmlTextWriterStyle.Margin] = "0cm"; + if (!pageHeight.IsEmpty) + { + result.Style[HtmlTextWriterStyle.Top] = new WebUnit((pageHeight.Value * slipPages), pageHeight.Type).ToString(); + result.Style[HtmlTextWriterStyle.Position] = "absolute"; + } + result.Controls.Add(control); + slipPages = pagesCount; + return result; + } + + private Control CreateReport() + { + var result = new TemplateBillReport(); + var parameters = new Dictionary(); + AddParameters(parameters); + + var autoAdd = new Dictionary(); + foreach (KeyValuePair pair in parameters) + { + if (pair.Value != null && pair.Value is ICollection) + { + string newKey = pair.Key + "_RecordCount"; + if (!parameters.ContainsKey(newKey)) + autoAdd.Add(newKey, ((ICollection)pair.Value).Count); + } + } + foreach (KeyValuePair pair in autoAdd) + { + parameters.Add(pair.Key, pair.Value); + } + + var printTemplateFile = Path.Combine(Wpf.Settings.ConfigFolder, GetTemplateFile()); + result.ParseTemplate(FS.OpenRead(printTemplateFile), parameters); + return result; + } + + void AddParameters(IDictionary dic) + { + dic.Add("$Details", GetList()); + dic.Add("$DetailType", typeof(PrintTemp)); + } + + List GetList() + { + var main = new JoinAlias("_m", typeof(SaleOutStore)); + var detail = new JoinAlias("_d", typeof(SaleOutStore_Detail)); + var config = new JoinAlias("_g1", typeof(GoodsViewConfig)); + var customer = new JoinAlias("_c1", typeof(CustomerViewConfig)); + var temp = new JoinAlias(typeof(StockUpClass)); + var query = new DQueryDom(main); + StockUpClass.Register(query, DeliverGoodsLine_IDs, Sequence, Goods_IDs, MinDate, MaxDate, BillState); + 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")); + 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("DeliverGoodsLine_Name")); + query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail)); + query.Columns.Add(DQSelectColumn.Field("Unit", detail)); + query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit", detail)); + foreach (var c in query.Columns) + query.GroupBy.Expressions.Add(c.Expression); + + query.Columns.Add(DQSelectColumn.Sum(detail, "UnitNum")); + query.Columns.Add(DQSelectColumn.Sum(detail, "SecondNumber")); + + query.Columns.Add(DQSelectColumn.Sum(temp, "StockNumber")); + 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) + query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "LoadTime", MaxDate.Value)); + if (DeliverGoodsLine_IDs.Any()) + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "DeliverGoodsLine_ID"), DeliverGoodsLine_IDs.Select(x => DQExpression.Value(x)).ToArray())); + else + query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(main, "DeliverGoodsLine_ID"))); + if (Goods_IDs.Any()) + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), Goods_IDs.Select(x => DQExpression.Value(x)).ToArray())); + + if (BillState.HasValue) + query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", BillState)); + else + query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); + if (Sequence.Any()) + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "SequenceNumber"), Sequence.Select(x => DQExpression.Value(x)).ToArray())); + query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); + + var list = new List(); + using (var session = Dmo.NewSession()) + { + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + { + var entity = new PrintTemp(); + entity.SequenceNumber = (long?)reader[0]; + entity.DeliverGoodsLine_Name = (string)reader[1]; + entity.Goods_Name = (string)reader[2]; + entity.Unit = (string)reader[3]; + entity.SecondUnit = (string)reader[4]; + entity.OrderMain = (Money?)reader[5]; + entity.OrderSecond = (Money?)reader[6]; + entity.StockNumber = (Money?)reader[7]; + entity.StockSecondNumber = (Money?)reader[8]; + + list.Add(entity); + } + } + } + + return list; + } + } + + [DFClass, Serializable] + [LogicName("备货打印")] + public class PrintTemp + { + [LogicName("顺序号")] + public long? SequenceNumber { get; set; } + [LogicName("线路")] + public string DeliverGoodsLine_Name { get; set; } + [LogicName("存货名称")] + public string Goods_Name { get; set; } + [LogicName("单位")] + public string Unit { get; set; } + [LogicName("辅单位")] + public string SecondUnit { get; set; } + [LogicName("订货数量")] + public Money? OrderMain { get; set; } + [LogicName("订货辅数量")] + public Money? OrderSecond { get; set; } + [LogicName("备货数量")] + public Money? StockNumber { get; set; } + [LogicName("备货辅数量")] + public Money? StockSecondNumber { get; set; } + [LogicName("差异数量")] + public Money StockDiffNumber { get { return (OrderMain ?? 0) - (StockNumber ?? 0); } } + [LogicName("差异辅数量")] + public Money StockDiffSecondNumber { get { return (OrderSecond ?? 0) - (StockSecondNumber ?? 0); } } + } +} diff --git a/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs index 0be0d94..42d56e3 100644 --- a/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs +++ b/B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs @@ -58,6 +58,16 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ } } + public IEnumerable Sequence + { + get + { + if (string.IsNullOrEmpty(Request.QueryString["Sequence"])) + return new List(); + return Request.QueryString["Sequence"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)); + } + } + public short? BillState { get @@ -100,6 +110,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ query.GroupBy.Expressions.Add(DQExpression.Field("Customer_Name")); 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) @@ -114,6 +125,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_ query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", BillState)); else query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", 单据状态.已作废)); + if (Sequence.Any()) + query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SequenceNumber"), Sequence.Select(x => DQExpression.Value(x)).ToArray())); query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", 配送方式.公司配送)); return query; } diff --git a/WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrint.xml b/WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrint.xml new file mode 100644 index 0000000..7935dee --- /dev/null +++ b/WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrint.xml @@ -0,0 +1,27 @@ + + + + + + 备货单 + + + + + + + + + + + + + + + +