Browse Source

加 打印设置。

master
yibo 7 years ago
parent
commit
928ec7dd69
8 changed files with 546 additions and 36 deletions
  1. +3
    -0
      B3ButcherManageToSale.Web/B3ButcherManageToSale.Web.csproj
  2. +26
    -10
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse2_/SaleOutStockAnalyse2.cs
  3. +369
    -0
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse2_/SaleOutStockPrint2.cs
  4. +36
    -12
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs
  5. +46
    -8
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockPrint.cs
  6. +17
    -6
      B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs
  7. +22
    -0
      WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrint2.xml
  8. +27
    -0
      WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrintOnlyGoods.xml

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

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


+ 26
- 10
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse2_/SaleOutStockAnalyse2.cs View File

@ -122,6 +122,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_
{
get
{
if (ViewState["TakeGoodsType"] == null)
return 0;
return (int)ViewState["TakeGoodsType"];
}
set
@ -146,16 +148,19 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_
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);
//}
TSButton previewBtn, printBtn;
protected override void AddToolboxPanel(HLayoutPanel hbox)
{
if (EnablePrint)
{
var printPage = "SaleOutStockPrint2.aspx?MinDate=" + "'+__QueryContainer.getControl('MinLoadTime').value+'&MaxDate=" + "'+__QueryContainer.getControl('MaxLoadTime').value+'&" + "'+__QueryContainer.getQueryString(['DeliverGoodsLine_ID','SequenceNumber','SaleGoods_ID'])+'&TakeGoodsType=" + TakeGoodsType.ToString();
previewBtn = hbox.Add(new TSButton("预览"));
previewBtn.OnClientClick = "preventEventDefault(event);Preview('" + printPage + "')";
printBtn = hbox.Add(new TSButton("打印"));
printBtn.OnClientClick = "preventEventDefault(event);Print('" + printPage + "')";
}
AddExcelExport(hbox);
}
void AddQueryButtons(VLayoutPanel vbox)
{
@ -173,6 +178,10 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_
void StartQuery(int type)
{
TakeGoodsType = type;
var old = string.Format("TakeGoodsType={0}", type == 0 ? 1 : 0);
var replace = string.Format("TakeGoodsType={0}", type);
previewBtn.OnClientClick = ReplaceLast(previewBtn.OnClientClick, old, replace);
printBtn.OnClientClick = ReplaceLast(printBtn.OnClientClick, old, replace);
mDFGrid.SortField = null;
mDFGrid.SortDirection = SortDirection.Ascending;
mDFGrid.CurrentPage = 0;
@ -180,6 +189,13 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_
mQueryControls.SaveLast();
}
string ReplaceLast(string str, string old, string replace)
{
if (!str.Contains(replace))
return str.Replace(old, replace);
return str;
}
Dictionary<string, string> fileDic = new Dictionary<string, string>();
public override PagedDFDataTable GetPagedDFDataTable(QuerySettings settings)
{


+ 369
- 0
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse2_/SaleOutStockPrint2.cs View File

@ -0,0 +1,369 @@
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;
using BWP.B3ButcherManage.BO;
namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse2_
{
class SaleOutStockPrint2 : 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 string Sequence
{
get
{
return Request.QueryString["SequenceNumber"].Trim();
}
}
public short TakeGoodsType
{
get
{
return short.Parse(Request.QueryString["TakeGoodsType"]);
}
}
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().ToList());
dic.Add("$DetailType", typeof(ProductDiffPrint));
}
IEnumerable<ProductDiffPrint> GetList()
{
long? maxSeque = null;
if (!string.IsNullOrEmpty(Sequence))
{
var arr = Sequence.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x));
if (arr.Any())
maxSeque = arr.Max();
}
IEnumerable<ProductDiffPrint> data;
List<MinObj> products;
using (var session = Dmo.NewSession())
{
if (DeliverGoodsLine_IDs.Any())
{
var m = GetMaxLine(session, DeliverGoodsLine_IDs);
if (m.HasValue && maxSeque.HasValue && m > maxSeque)
maxSeque = m;
}
data = GetMainInfo(maxSeque, Goods_IDs, MinDate, MaxDate, session);
products = GetInStoreNumber(Goods_IDs, MinDate, MaxDate, session);
}
foreach (var item in data)
{
var first = products.FirstOrDefault(x => x.Goods_ID == item.Goods_ID);
if (first != null)
{
if (item.TakeGoods_Type == .)
{
item.ProductMain = Math.Min((item.OrderMain ?? 0).Value, (first.MainNumber ?? 0).Value);
first.MainNumber -= item.ProductMain;
item.ProductSecond = Math.Min((item.OrderSecond ?? 0).Value, (first.SecondNumber ?? 0).Value);
first.SecondNumber -= item.ProductSecond;
}
else
{
item.ProductMain = first.MainNumber;
item.ProductSecond = first.SecondNumber;
}
if (item.ProductMain == 0)
item.ProductMain = null;
if (item.ProductSecond == 0)
item.ProductSecond = null;
}
}
data = data.Where(x => x.TakeGoods_Type == TakeGoodsType);
return data;
}
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)
{
var main = new JoinAlias(typeof(Output));
var detail = new JoinAlias(typeof(Output_Detail));
var config = new JoinAlias(typeof(GoodsViewConfig));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "Output_ID"));
query.From.AddJoin(JoinType.Inner, new DQDmoSource(config), DQCondition.EQ(detail, "Goods_ID", config, "Goods_ID"));
query.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
query.Columns.Add(DQSelectColumn.Sum(detail, "Number"));
query.Columns.Add(DQSelectColumn.Sum(detail, "SecondNumber"));
query.GroupBy.Expressions.Add(DQExpression.Field(detail, "Goods_ID"));
query.Where.Conditions.Add(DQCondition.InEQ("BillState", .));
if (start.HasValue)
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("Date", start));
if (start.HasValue)
query.Where.Conditions.Add(DQCondition.LessThanOrEqual("Date", end));
if (goodsIDs.Any())
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "Goods_ID"), goodsIDs.Select(x => DQExpression.Value(x)).ToArray()));
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<ProductDiffPrint> GetMainInfo(long? seque, IEnumerable<long> goodsIDs, DateTime? minDate, DateTime? maxDate, IDmoSession session)
{
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 query = new DQueryDom(main);
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.Columns.Add(DQSelectColumn.Field("SaleGoods_ID", detail));
query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail));
query.Columns.Add(DQSelectColumn.Field("Unit", detail));
query.Columns.Add(DQSelectColumn.Field("Goods_SecondUnit", detail));
query.Columns.Add(DQSelectColumn.Field("TakeGoods_Type"));
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.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 (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", .));
if (seque.HasValue)
query.Where.Conditions.Add(DQCondition.LessThanOrEqual(main, "SequenceNumber", seque));
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "TakeGoods_Type"), DQExpression.Value(.), DQExpression.Value(.)));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("TakeGoods_Type", true));
var list = new List<ProductDiffPrint>();
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
{
var entity = new ProductDiffPrint();
entity.Goods_ID = (long)reader[0];
entity.Goods_Name = (string)reader[1];
entity.Unit = (string)reader[2];
entity.SecondUnit = (string)reader[3];
entity.TakeGoods_Type = (NamedValue<>)reader[4];
entity.OrderMain = (Money<decimal>?)reader[5];
entity.OrderSecond = (Money<decimal>?)reader[6];
list.Add(entity);
}
}
return list;
}
class MinObj
{
public long Goods_ID { get; set; }
public Money<decimal>? MainNumber { get; set; }
public Money<decimal>? SecondNumber { get; set; }
}
}
[DFClass, Serializable]
[LogicName("备货打印")]
public class ProductDiffPrint
{
public long Goods_ID { get; set; }
public NamedValue<>? TakeGoods_Type { 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>? ProductMain { get; set; }
[LogicName("产出辅数量")]
public Money<decimal>? ProductSecond { get; set; }
[LogicName("差异数量")]
public Money<decimal>? ProductMainDiff
{
get
{
if (OrderMain == null)
return null;
var diff = OrderMain - (ProductMain ?? 0).Value;
if (diff > 0)
return diff;
return null;
}
}
[LogicName("差异辅数量")]
public Money<decimal>? ProductSecondDiff
{
get
{
if (OrderSecond == null)
return null;
var diff = OrderSecond - (ProductSecond ?? 0).Value;
if (diff > 0)
return diff;
return null;
}
}
}
}

+ 36
- 12
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockAnalyse.cs View File

@ -123,7 +123,8 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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 = "按存货", ClientIDMode = ClientIDMode.Static });
onlyGoodsCheck.ID = "onlyGoodsCheck";
onlyGoodsCheck.InputAttributes.Add("style", "width:15px;height:15px;");
return hPanel;
}
@ -132,7 +133,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
{
if (EnablePrint)
{
var printPage = "SaleOutStockPrint.aspx?MinDate=" + "'+__QueryContainer.getControl('MinLoadTime').value+'&MaxDate=" + "'+__QueryContainer.getControl('MaxLoadTime').value+'&" + "'+__QueryContainer.getQueryString(['DeliverGoodsLine_ID','SequenceNumber','SaleGoods_ID','BillState'])+'";
var printPage = "SaleOutStockPrint.aspx?MinDate=" + "'+__QueryContainer.getControl('MinLoadTime').value+'&MaxDate=" + "'+__QueryContainer.getControl('MaxLoadTime').value+'&onlyGoods=" + "'+$('#onlyGoodsCheck')[0].checked+'" + "&'+__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 + "')";
}
@ -149,15 +150,12 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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, seques, goodsIds, minDate, maxDate, billState, session);
data = GetMainInfo(line, sequenceInput, goodsIds, minDate, maxDate, billState, session);
products = GetInStoreNumber(goodsIds, minDate, maxDate, session);
stockInfo = GetStockInfo(goodsIds, minDate, maxDate, session);
};
@ -362,7 +360,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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(IEnumerable<long> line, string 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));
@ -408,8 +406,21 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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()));
if (!string.IsNullOrEmpty(seques))
{
if (seques.Contains('-') && seques.Contains(','))
throw new Exception("不允许同时使用 - 和 ,同时查询");
if (seques.Contains('-'))
{
var arr = seques.Split(new char[] { '-' });
query.Where.Conditions.Add(DQCondition.Between("SequenceNumber", long.Parse(string.IsNullOrEmpty(arr[0]) ? "0" : arr[0]), long.Parse(string.IsNullOrEmpty(arr[1]) ? "10000" : arr[1])));
}
else
{
var arr = seques.Split(new char[] { ',' });
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SequenceNumber"), arr.Select(x => DQExpression.Value(long.Parse(x))).ToArray()));
}
}
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", .));
var list = new List<TempObj>();
@ -443,7 +454,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
public Money<decimal>? StockSecondNumber { 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, IEnumerable<long> line, string 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));
@ -470,8 +481,21 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
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()));
if (!string.IsNullOrEmpty(seques))
{
if (seques.Contains('-') && seques.Contains(','))
throw new Exception("不允许同时使用 - 和 ,同时查询");
if (seques.Contains('-'))
{
var arr = seques.Split(new char[] { '-' });
query.Where.Conditions.Add(DQCondition.Between(DQExpression.Field(main, "SequenceNumber"), long.Parse(string.IsNullOrEmpty(arr[0]) ? "0" : arr[0]), long.Parse(string.IsNullOrEmpty(arr[1]) ? "10000" : arr[1])));
}
else
{
var arr = seques.Split(new char[] { ',' });
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "SequenceNumber"), arr.Select(x => DQExpression.Value(long.Parse(x))).ToArray()));
}
}
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", .));
root.RegisterQueryTable(typeof(StockUpClass), new string[] { "DetailID", "StockSecondNumber", "StockNumber" }, query);


+ 46
- 8
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/SaleOutStockPrint.cs View File

@ -67,13 +67,19 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
}
}
public IEnumerable<long> Sequence
public string 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));
return Request.QueryString["SequenceNumber"];
}
}
public bool onlyGoods
{
get
{
return bool.Parse(Request.QueryString["onlyGoods"]);
}
}
@ -89,7 +95,7 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
string GetTemplateFile()
{
return PrintUtil.GetTemplateFile(PluginName, GetType().Name + ".xml");
return PrintUtil.GetTemplateFile(PluginName, GetType().Name + (onlyGoods ? "OnlyGoods" : "") + ".xml");
}
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form)
@ -204,8 +210,21 @@ 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(main, "SequenceNumber"), Sequence.Select(x => DQExpression.Value(x)).ToArray()));
if (!string.IsNullOrEmpty(Sequence))
{
if (Sequence.Contains('-') && Sequence.Contains(','))
throw new Exception("不允许同时使用 - 和 ,同时查询");
if (Sequence.Contains('-'))
{
var arr = Sequence.Split(new char[] { '-' });
query.Where.Conditions.Add(DQCondition.Between(DQExpression.Field(main, "SequenceNumber"), long.Parse(string.IsNullOrEmpty(arr[0]) ? "0" : arr[0]), long.Parse(string.IsNullOrEmpty(arr[1]) ? "10000" : arr[1])));
}
else
{
var arr = Sequence.Split(new char[] { ',' });
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "SequenceNumber"), arr.Select(x => DQExpression.Value(long.Parse(x))).ToArray()));
}
}
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", .));
var list = new List<PrintTemp>();
@ -230,8 +249,27 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
}
}
}
var result = new List<PrintTemp>();
if (onlyGoods)
{
foreach (var g in list.GroupBy(x => x.Goods_Name))
{
var first = g.First();
var entity = new PrintTemp();
entity.Goods_Name = first.Goods_Name;
entity.Unit = first.Unit;
entity.SecondUnit = first.SecondUnit;
entity.OrderMain = g.Sum(x => (x.OrderMain ?? 0).Value);
entity.OrderSecond = g.Sum(x => (x.OrderSecond ?? 0).Value);
entity.StockNumber = g.Sum(x => (x.StockNumber ?? 0).Value);
entity.StockSecondNumber = g.Sum(x => (x.StockSecondNumber ?? 0).Value);
result.Add(entity);
}
}
else
result = list;
return list;
return result;
}
}


+ 17
- 6
B3ButcherManageToSale.Web/Pages/B3ButcherManageToSale/Reports/SaleOutStockAnalyse_/ShowGoodsCustomer.cs View File

@ -58,13 +58,11 @@ namespace BWP.Web.Pages.B3ButcherManageToSale.Reports.SaleOutStockAnalyse_
}
}
public IEnumerable<long> Sequence
public string 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));
return Request.QueryString["Sequence"];
}
}
@ -125,8 +123,21 @@ 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()));
if (!string.IsNullOrEmpty(Sequence))
{
if (Sequence.Contains('-') && Sequence.Contains(','))
throw new Exception("不允许同时使用 - 和 ,同时查询");
if (Sequence.Contains('-'))
{
var arr = Sequence.Split(new char[] { '-' });
query.Where.Conditions.Add(DQCondition.Between(DQExpression.Field(main, "SequenceNumber"), long.Parse(string.IsNullOrEmpty(arr[0]) ? "0" : arr[0]), long.Parse(string.IsNullOrEmpty(arr[1]) ? "10000" : arr[1])));
}
else
{
var arr = Sequence.Split(new char[] { ',' });
query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(main, "SequenceNumber"), arr.Select(x => DQExpression.Value(long.Parse(x))).ToArray()));
}
}
query.Where.Conditions.Add(DQCondition.EQ(main, "TakeGoods_Type", .));
return query;
}


+ 22
- 0
WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrint2.xml View File

@ -0,0 +1,22 @@
<?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" >
<LineNo header="序号"/>
<Field name="Goods_Name"/>
<Field name="OrderMain" sum="true"/>
<!-- <Field name="Unit" /> -->
<Field name="OrderSecond" sum="true"/>
<!-- <Field name="SecondUnit" /> -->
<Field name="ProductMain" sum="true"/>
<Field name="ProductSecond" sum="true"/>
<Field name="ProductMainDiff" sum="true"/>
<Field name="ProductSecondDiff" sum="true"/>
</DFListBand>
</Bands>
</BillReport>
</Report>
</BillReports>

+ 27
- 0
WebFolder/config/billreports/B3ButcherManageToSale/SaleOutStockPrintOnlyGoods.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"/>
-->
<LineNo header="序号"/>
<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