Browse Source

备货分析加打印。

master
yibo 7 years ago
parent
commit
5ccda20e9f
6 changed files with 365 additions and 26 deletions
  1. +3
    -0
      B3ButcherManageToSale.Web/B3ButcherManageToSale.Web.csproj
  2. +1
    -1
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/OutputToSaleOutDiff_/OutputToSaleOutDiff.cs
  3. +56
    -25
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs
  4. +265
    -0
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockPrint.cs
  5. +13
    -0
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs
  6. +27
    -0
      WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrint.xml

+ 3
- 0
B3ButcherManageToSale.Web/B3ButcherManageToSale.Web.csproj View File

@ -122,6 +122,9 @@
<Compile Include="Pages\B3ButcherManageToSale\Reports\SaleOutStockAnalyse_\SaleOutStockAnalyse.cs"> <Compile Include="Pages\B3ButcherManageToSale\Reports\SaleOutStockAnalyse_\SaleOutStockAnalyse.cs">
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
</Compile> </Compile>
<Compile Include="Pages\B3ButcherManageToSale\Reports\SaleOutStockAnalyse_\SaleOutStockPrint.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ButcherManageToSale\Reports\SaleOutStockAnalyse_\ShowGoodsCustomer.cs"> <Compile Include="Pages\B3ButcherManageToSale\Reports\SaleOutStockAnalyse_\ShowGoodsCustomer.cs">
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
</Compile> </Compile>


+ 1
- 1
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/OutputToSaleOutDiff_/OutputToSaleOutDiff.cs View File

@ -34,7 +34,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.OutputToSaleOutDiff_
var row = (DFDataRow)dataRow; var row = (DFDataRow)dataRow;
var diff = row["差异|数量"]; 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++) for (var i = 1; i < htmlRow.Cells.Count-1; i++)
htmlRow.Cells[i].Style.Add("background-color", "#FFA07A"); htmlRow.Cells[i].Style.Add("background-color", "#FFA07A");


+ 56
- 25
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs View File

@ -49,21 +49,28 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
{ {
var row = (DFDataRow)dataRow; var row = (DFDataRow)dataRow;
BuildCell(htmlRow, row); 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 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 else
url = AspUtil.AddParamToUrl(url, "DeliverGoodsLine_ID", mQueryContainer.GetControl<DFChoiceBox>("DeliverGoodsLine_ID").Value); url = AspUtil.AddParamToUrl(url, "DeliverGoodsLine_ID", mQueryContainer.GetControl<DFChoiceBox>("DeliverGoodsLine_ID").Value);
url = AspUtil.AddParamToUrl(url, "BillState", billStateDp.SelectedValue); url = AspUtil.AddParamToUrl(url, "BillState", billStateDp.SelectedValue);
url = AspUtil.AddParamToUrl(url, "Sequence", mQueryContainer.GetControl<DFTextBox>("SequenceNumber").Text.Trim());
url = WpfPageUrl.ToGlobal(url); url = WpfPageUrl.ToGlobal(url);
var cIdx = onlyGoodsCheck.Checked ? 0 : 2; var cIdx = onlyGoodsCheck.Checked ? 0 : 2;
var cell = htmlRow.Cells[cIdx]; 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(QueryCreator.DateRange(mDFInfo.Fields["LoadTime"], mQueryContainer, "MinLoadTime", "MaxLoadTime", DateTime.Today, DateTime.Today + new TimeSpan(23, 59, 29)));
hPanel.Add(new LiteralControl("送货线路:")); hPanel.Add(new LiteralControl("送货线路:"));
hPanel.Add(QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["DeliverGoodsLine_ID"], mQueryContainer, "DeliverGoodsLine_ID", B3SaleDataSources.线)); 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(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("单据状态:")); 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("");
billStateDp.Items.Add(new ListItem("未审核", "0")); billStateDp.Items.Add(new ListItem("未审核", "0"));
billStateDp.Items.Add(new ListItem("已审核", "20")); billStateDp.Items.Add(new ListItem("已审核", "20"));
@ -119,18 +128,36 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
return hPanel; 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) public override PagedDFDataTable GetPagedDFDataTable(QuerySettings settings)
{ {
var line = mQueryContainer.GetControl<DFChoiceBox>("DeliverGoodsLine_ID").GetValues().Select(x => long.Parse(x)); 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 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 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<TempObj> data;
List<MinObj> products; List<MinObj> products;
List<StockUpClass> stockInfo; List<StockUpClass> stockInfo;
using (var session = Dmo.NewSession()) 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); products = GetInStoreNumber(goodsIds, minDate, maxDate, session);
stockInfo = GetStockInfo(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(); var entity = new StockUpClass();
entity.Goods_ID = (long)reader[0]; 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); list.Add(entity);
} }
} }
return list; 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 main = new JoinAlias("_m", typeof(SaleOutStore));
var detail = new JoinAlias("_d", typeof(SaleOutStore_Detail)); 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 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, 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(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"));
@ -365,7 +392,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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"));
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(customer, "Customer_ID")));
if (minDate.HasValue) if (minDate.HasValue)
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)
@ -377,10 +404,12 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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))
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 else
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", .)); 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", .)); query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", .));
var list = new List<TempObj>(); var list = new List<TempObj>();
@ -407,14 +436,14 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
return list; return list;
} }
class StockUpClass
public class StockUpClass
{ {
public long Goods_ID { get; set; } 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> seques, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, short? billStateDp)
{ {
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));
@ -437,10 +466,12 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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 (!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 else
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", .)); 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", .)); 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);


+ 265
- 0
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockPrint.cs View File

@ -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<long> Goods_IDs
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["SaleGoods_ID"]))
return new List<long>();
return Request.QueryString["SaleGoods_ID"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x));
}
}
public IEnumerable<long> DeliverGoodsLine_IDs
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["DeliverGoodsLine_ID"]))
return new List<long>();
return Request.QueryString["DeliverGoodsLine_ID"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x));
}
}
public IEnumerable<long> Sequence
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["SequenceNumber"]))
return new List<long>();
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<string, object>();
AddParameters(parameters);
var autoAdd = new Dictionary<string, object>();
foreach (KeyValuePair<string, object> 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<string, object> 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<string, object> dic)
{
dic.Add("$Details", GetList());
dic.Add("$DetailType", typeof(PrintTemp));
}
List<PrintTemp> 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<PrintTemp>();
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<decimal>?)reader[5];
entity.OrderSecond = (Money<decimal>?)reader[6];
entity.StockNumber = (Money<decimal>?)reader[7];
entity.StockSecondNumber = (Money<decimal>?)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<decimal>? OrderMain { get; set; }
[LogicName("订货辅数量")]
public Money<decimal>? OrderSecond { get; set; }
[LogicName("备货数量")]
public Money<decimal>? StockNumber { get; set; }
[LogicName("备货辅数量")]
public Money<decimal>? StockSecondNumber { get; set; }
[LogicName("差异数量")]
public Money<decimal> StockDiffNumber { get { return (OrderMain ?? 0) - (StockNumber ?? 0); } }
[LogicName("差异辅数量")]
public Money<decimal> StockDiffSecondNumber { get { return (OrderSecond ?? 0) - (StockSecondNumber ?? 0); } }
}
}

+ 13
- 0
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs View File

@ -58,6 +58,16 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
} }
} }
public IEnumerable<long> Sequence
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["Sequence"]))
return new List<long>();
return Request.QueryString["Sequence"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x));
}
}
public short? BillState public short? BillState
{ {
get get
@ -100,6 +110,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
query.GroupBy.Expressions.Add(DQExpression.Field("Customer_Name")); query.GroupBy.Expressions.Add(DQExpression.Field("Customer_Name"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SequenceNumber")); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SequenceNumber"));
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field(customer, "Customer_ID")));
if (minDate.HasValue) if (minDate.HasValue)
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)
@ -114,6 +125,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", BillState)); query.Where.Conditions.Add(DQCondition.EQ(main, "BillState", BillState));
else else
query.Where.Conditions.Add(DQCondition.InEQ(main, "BillState", .)); 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", .)); query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", .));
return query; return query;
} }


+ 27
- 0
WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrint.xml View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<BillReports xmlns="urn:BillReports" version="1.0" displayName="备货打印" phyName="备货打印">
<Report phyName="标准格式">
<BillReport xmlns="urn:BillReport" version="1" displayName="标准格式" >
<Bands>
<TextBand fontName="黑体" fontSize="15" align="Center">备货单</TextBand>
<DFListBand collection="$Details" itemType="$DetailType" enableRowGroup="true" enablePaging="false" fontSize="12" rowHeight="20">
<!--
<Field name="SequenceNumber"/>
-->
<Field name="DeliverGoodsLine_Name"/>
<Field name="Goods_Name"/>
<Field name="OrderMain" sum="true"/>
<!-- <Field name="Unit" /> -->
<Field name="OrderSecond" sum="true"/>
<!-- <Field name="SecondUnit" /> -->
<Field name="StockNumber" sum="true"/>
<Field name="StockSecondNumber" sum="true"/>
<!--
<Field name="StockDiffNumber" sum="true"/>
<Field name="StockDiffSecondNumber" sum="true"/>
-->
</DFListBand>
</Bands>
</BillReport>
</Report>
</BillReports>

Loading…
Cancel
Save