Browse Source

报表。

master
yibo 7 years ago
parent
commit
e7c693f5b0
13 changed files with 541 additions and 160 deletions
  1. +11
    -2
      B3ClientService.Web/B3ClientService.Web.csproj
  2. +49
    -9
      B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/CarcassInLossAnalyse.cs
  3. +208
    -0
      B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/CarcassOutLossAnalyse.cs
  4. +1
    -1
      B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/InStoreDetail.cs
  5. +123
    -0
      B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/OutStoreDetail.cs
  6. +47
    -0
      B3ClientService.Web/Pages/B3ClientService/ToolsPage.cs
  7. +1
    -1
      B3ClientService/B3ClientService.csproj
  8. +25
    -0
      B3ClientService/BO/Bill/ButcherTraceBackInfo.cs
  9. +0
    -14
      B3ClientService/BO/Bill/ButcherTraceBackLog.cs
  10. +42
    -0
      B3ClientService/OfflinRpc/GradeAndWeightBL.cs
  11. +23
    -10
      B3ClientService/OfflinRpc/SectionStoreDetailRpc.cs
  12. +9
    -121
      B3ClientService/Tasks/SyncCarcassInStoreToTrackBack.cs
  13. +2
    -2
      WebFolder/config/plugins/B3ClientService.plugin

+ 11
- 2
B3ClientService.Web/B3ClientService.Web.csproj View File

@ -126,16 +126,22 @@
<Compile Include="Pages\B3ClientService\Reports\CarcassGradeAnalyse_\CarcassGradeAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassInOutLossAnalyse_\CarcassOutLossAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassInOutLossAnalyse_\OutStoreDetail.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassInOutStoreAnalyse_\CarcassDetailDialog.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassInOutStoreAnalyse_\CarcassInOutStoreAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassInStoreLossAnalyse_\CarcassInStoreLossAnalyse.cs">
<Compile Include="Pages\B3ClientService\Reports\CarcassInOutLossAnalyse_\CarcassInLossAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassInStoreLossAnalyse_\InStoreDetail.cs">
<Compile Include="Pages\B3ClientService\Reports\CarcassInOutLossAnalyse_\InStoreDetail.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassLossAnalyse_\CarcassLossAnalyse.cs">
@ -162,6 +168,9 @@
<Compile Include="Pages\B3ClientService\ServerHostConfig.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\ToolsPage.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="PluginClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\B3ClientServiceChoiceBoxDataProvider.cs" />


B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInStoreLossAnalyse_/CarcassInStoreLossAnalyse.cs → B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/CarcassInLossAnalyse.cs View File

@ -21,14 +21,15 @@ using TSingSoft.WebPluginFramework;
using BWP.B3Frameworks.BO.MoneyTemplate;
using Forks.Utils;
using System.Web;
using BWP.Web.Utils;
namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutLossAnalyse_
{
class CarcassInStoreLossAnalyse : ServerPage
class CarcassInLossAnalyse : ServerPage
{
protected override void OnInit(EventArgs e)
{
if (!User.IsInRole("B3ClientService.报表展示.白条入库差异"))
if (!User.IsInRole("B3ClientService.报表展示.白条入库差异"))
throw new SecurityException();
base.OnInit(e);
}
@ -36,7 +37,7 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
DFBrowseGrid mBrowseGrid;
protected override void InitForm(HtmlForm form)
{
form.EAdd(new PageTitle("白条入库差异"));
form.EAdd(new PageTitle("白条入库差异"));
var queryPanel = new Panel();
queryPanel.Style.Add(HtmlTextWriterStyle.BackgroundColor, "white");
@ -61,7 +62,7 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
string BuildUrl(string livestockID)
{
var url = "~/B3ClientService/Reports/CarcassInStoreLossAnalyse_/InStoreDetail.aspx";
var url = "~/B3ClientService/Reports/CarcassInOutLossAnalyse_/InStoreDetail.aspx";
url = AspUtil.AddParamToUrl(url, "Date", dateInput.Text);
url = AspUtil.AddParamToUrl(url, "ProductBatchID", batchSelect.Value);
url = AspUtil.AddParamToUrl(url, "Livestock_ID", livestockID);
@ -78,15 +79,29 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
ChoiceBox batchSelect;
DFDateInput dateInput;
HyperLink inStore, outStore;
private void AddQueryControl(Panel queryPanel)
{
var hp = queryPanel.EAdd(new Panel());
hp.Style.Add("float", "right");
hp.EAdd(new SimpleLabel("生产日期"));
dateInput = hp.EAdd(new DFDateInput() { Date = DateTime.Today });
dateInput = hp.EAdd(new DFDateInput() { Date = DateTime.Today });
hp.EAdd(new SimpleLabel("生产批次"));
batchSelect = hp.EAdd(new ChoiceBox(B3ClientServiceConsts.DataSources.) { EnableInputArgument = true, EnableTopItem = true, AutoPostBack = true, Width = Unit.Pixel(180) });
batchSelect = hp.EAdd(new ChoiceBox(B3ClientServiceConsts.DataSources.) { EnableInputArgument = true, EnableTopItem = true, Width = Unit.Pixel(180) });
hp.EAdd(new TSButton("开始查询", delegate { StartQuery(); }));
inStore = hp.EAdd(new HyperLink());
inStore.Text = "白条入库";
inStore.Style.Add("margin", "0px 10px");
inStore.Style.Add("font-size", "15px");
inStore.Style.Add("background-color", "#3CC24C");
inStore.Style.Add("color", "#FFFFFF");
outStore = hp.EAdd(new HyperLink());
outStore.Text = "白条出库";
outStore.Style.Add("margin-right", "10px");
outStore.Style.Add("font-size", "15px");
outStore.Style.Add("color", "blue");
}
private TitlePanel CreateResultTab()
@ -95,7 +110,7 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
mBrowseGrid = result.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) });
mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn("Livestock_ID"));
var hPanel = result.EAdd(new HLayoutPanel());
PageUtil.AddExcelExportPanel(hPanel, mBrowseGrid, "白条损耗");
PageUtil.AddExcelExportPanel(hPanel, mBrowseGrid, "入库损耗");
return result;
}
@ -115,7 +130,7 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
query.GroupBy.Expressions.Add(DQExpression.Field(livestock, "Name"));
var gNumber = DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNotNull(DQExpression.Field("Livestock_ID")), DQExpression.Value(1), DQExpression.Value(0)));
query.Columns.Add(DQSelectColumn.Create(gNumber.ECastType<int?>(), "头数"));
var gWeight=DQExpression.Subtract(DQExpression.Field("GradeWeight"),DQExpression.Value(4.2m));
var gWeight = DQExpression.Subtract(DQExpression.Field("GradeWeight"), DQExpression.Value(4.2m));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(gWeight).ECastType<decimal?>(), "胴体重量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Divide(DQExpression.Sum(gWeight), DQExpression.NullIfZero(gNumber)).ECastType<Money<>?>(), "胴体均重"));
var iNumber = DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNotNull(DQExpression.Field("InStoreGoods_ID")), DQExpression.Value(1), DQExpression.Value(0)));
@ -142,11 +157,36 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
mBrowseGrid.DataBind();
}
void BindHyperLink()
{
string date = string.Empty;
if (dateInput.Value.HasValue)
date = HttpUtility.UrlEncode(dateInput.Date.ToShortDateString());
var url = string.Format("CarcassInLossAnalyse.aspx?ProductBatch_ID={0}&ProductDate={1}", batchSelect.Value, date);
inStore.NavigateUrl = url;
outStore.NavigateUrl = url.Replace("In", "Out");
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
FillCondition();
StartQuery();
}
BindHyperLink();
}
void FillCondition()
{
if (!string.IsNullOrEmpty(Request.QueryString["ProductDate"]))
dateInput.Date = DateTime.Parse(Request.QueryString["ProductDate"]);
if (!string.IsNullOrEmpty(Request.QueryString["ProductBatch_ID"]))
{
var name = WebBLUtil.GetDmoPropertyByID<string>(typeof(ProductBatch), "Name", long.Parse(Request.QueryString["ProductBatch_ID"]));
batchSelect.Fill(Request.QueryString["ProductBatch_ID"], name);
}
}
}
}

+ 208
- 0
B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/CarcassOutLossAnalyse.cs View File

@ -0,0 +1,208 @@
using BWP.B3ClientService;
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.Utils;
using BWP.Web.WebControls;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Controls;
using TSingSoft.WebPluginFramework.Pages;
using TSingSoft.WebPluginFramework;
using BWP.B3Frameworks.BO.MoneyTemplate;
using Forks.Utils;
using System.Web;
using BWP.Web.Utils;
namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutLossAnalyse_
{
class CarcassOutLossAnalyse : ServerPage
{
protected override void OnInit(EventArgs e)
{
if (!User.IsInRole("B3ClientService.报表展示.白条出入库差异"))
throw new SecurityException();
base.OnInit(e);
}
DFBrowseGrid mBrowseGrid;
protected override void InitForm(HtmlForm form)
{
form.EAdd(new PageTitle("白条出入库差异"));
var queryPanel = new Panel();
queryPanel.Style.Add(HtmlTextWriterStyle.BackgroundColor, "white");
queryPanel.CssClass = "QueryPanel PrintInVisible";
form.Controls.Add(queryPanel);
AddQueryControl(queryPanel);
var mZone = new TitlePanelZone();
form.Controls.Add(mZone);
mZone.Add(CreateResultTab());
mBrowseGrid.OnDetailDataBound = (tr, obj, index) =>
{
var row = obj as DFDataRow;
var lid = string.Format("{0}", row["InStoreGoods_ID"]);
var url = BuildUrl(string.Format("{0}", lid));
url = WpfPageUrl.ToGlobal(url);
url = AspUtil.AddParamToUrl(url, "Flag", "2");
SetCellAtt(tr.Cells[3], url, "出库明细");
url = AspUtil.UpdateUrlParam(url, "Flag", "1");
SetCellAtt(tr.Cells[5], url, "出库明细");
};
}
string BuildUrl(string goodsID)
{
var url = "~/B3ClientService/Reports/CarcassInOutLossAnalyse_/OutStoreDetail.aspx";
url = AspUtil.AddParamToUrl(url, "Date", dateInput.Text);
url = AspUtil.AddParamToUrl(url, "ProductBatchID", batchSelect.Value);
url = AspUtil.AddParamToUrl(url, "Goods_ID", goodsID);
return url;
}
void SetCellAtt(HtmlTableCell cell, string url, string title)
{
cell.Attributes["onclick"] = "OpenUrlInTopTab('" + url + "','" + title + "');";
cell.Style.Add("color", "blue");
cell.Style.Add("text-decoration", "underline");
cell.Style.Add("cursor", "pointer");
}
ChoiceBox batchSelect;
DFDateInput dateInput;
HyperLink inStore, outStore;
private void AddQueryControl(Panel queryPanel)
{
var hp = queryPanel.EAdd(new Panel());
hp.Style.Add("float", "right");
hp.EAdd(new SimpleLabel("生产日期"));
dateInput = hp.EAdd(new DFDateInput() { Date = DateTime.Today });
if (!string.IsNullOrEmpty(Request.QueryString["ProductDate"]))
dateInput.Date = DateTime.Parse(Request.QueryString["ProductDate"]);
hp.EAdd(new SimpleLabel("生产批次"));
batchSelect = hp.EAdd(new DFChoiceBox() { DataKind = B3ClientServiceConsts.DataSources., EnableInputArgument = true, EnableTopItem = true, Width = Unit.Pixel(180) });
if (!string.IsNullOrEmpty(Request.QueryString["ProductBatch_ID"]))
{
var name = WebBLUtil.GetDmoPropertyByID<string>(typeof(ProductBatch), "Name", long.Parse(Request.QueryString["ProductBatch_ID"]));
batchSelect.Fill(Request.QueryString["ProductBatch_ID"], name);
}
hp.EAdd(new TSButton("开始查询", delegate { StartQuery(); }));
inStore = hp.EAdd(new HyperLink());
inStore.Text = "白条入库";
inStore.Style.Add("margin", "0px 10px");
inStore.Style.Add("font-size", "15px");
inStore.Style.Add("color", "blue");
outStore = hp.EAdd(new HyperLink());
outStore.Text = "白条出库";
outStore.Style.Add("margin-right", "10px");
outStore.Style.Add("font-size", "15px");
outStore.Style.Add("background-color", "#3CC24C");
outStore.Style.Add("color", "#FFFFFF");
}
private TitlePanel CreateResultTab()
{
var result = new TitlePanel("查询结果");
mBrowseGrid = result.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) });
mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn("InStoreGoods_ID"));
var hPanel = result.EAdd(new HLayoutPanel());
PageUtil.AddExcelExportPanel(hPanel, mBrowseGrid, "白条出库损耗");
return result;
}
void StartQuery()
{
var main = new JoinAlias(typeof(CarcassFullInfo));
var goods = new JoinAlias(typeof(Goods));
var batch = new JoinAlias(typeof(ProductBatch));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "InStoreGoods_ID", goods, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(batch), DQCondition.EQ(main, "ProductBatch_ID", batch, "ID"));
query.Columns.Add(DQSelectColumn.Field("InStoreGoods_ID"));
query.GroupBy.Expressions.Add(DQExpression.Field("InStoreGoods_ID"));
query.Columns.Add(DQSelectColumn.Field("Name", goods, "存货名称"));
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Name"));
var inNumber = DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNull(DQExpression.Field("InStoreTime")), DQExpression.NULL, DQExpression.Value(1)));
var inWeight = DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNull(DQExpression.Field("InStoreTime")), DQExpression.NULL, DQExpression.Field("InStoreWeight")));
query.Columns.Add(DQSelectColumn.Create(inNumber.ECastType<int?>(), "入库头数"));
query.Columns.Add(DQSelectColumn.Create(inWeight.ECastType<decimal?>(), "入库重量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("PickType", 1), DQExpression.Field("PickNumber"))).ECastType<decimal?>(), "销售出库|头数"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("PickType", 1), DQExpression.Field("PickWeight"))).ECastType<decimal?>(), "销售出库|重量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("PickType", 0), DQExpression.Field("PickNumber"))).ECastType<decimal?>(), "分割领用|头数"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("PickType", 0), DQExpression.Field("PickWeight"))).ECastType<decimal?>(), "分割领用|重量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("PickType", 2), DQExpression.Field("PickNumber"))).ECastType<decimal?>(), "条转段|头数"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.EQ("PickType", 2), DQExpression.Field("PickWeight"))).ECastType<decimal?>(), "条转段|重量"));
query.Columns.Add(DQSelectColumn.Sum("PickNumber", "合计|头数"));
query.Columns.Add(DQSelectColumn.Sum("PickWeight", "合计|重量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Subtract(DQExpression.IfNull(inNumber, DQExpression.Value(0)), DQExpression.IfNull(DQExpression.Sum(DQExpression.Field("PickNumber")), DQExpression.Value(0))).ECastType<decimal?>(), "损耗|头数"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Subtract(DQExpression.IfNull(inWeight, DQExpression.Value(0)), DQExpression.IfNull(DQExpression.Sum(DQExpression.Field("PickWeight")), DQExpression.Value(0))).ECastType<decimal?>(), "损耗|重量"));
if (!batchSelect.IsEmpty)
query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", long.Parse(batchSelect.Value)));
if (!dateInput.IsEmpty)
query.Where.Conditions.Add(DQCondition.EQ(batch, "Date", dateInput.Date));
var args = new LoadArguments(query);
for (var i = 0; i < query.Columns.Count; i++)
{
if (i <= 1)
continue;
args.SumColumns.Add(i);
args.GroupSumColumns.Add(i);
}
mBrowseGrid.LoadArguments = args;
mBrowseGrid.DataBind();
}
void BindHyperLink()
{
string date = string.Empty;
if (dateInput.Value.HasValue)
date = HttpUtility.UrlEncode(dateInput.Date.ToShortDateString());
var url = string.Format("CarcassInLossAnalyse.aspx?ProductBatch_ID={0}&ProductDate={1}", batchSelect.Value, date);
inStore.NavigateUrl = url;
outStore.NavigateUrl = url.Replace("In", "Out");
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
FillCondition();
StartQuery();
}
BindHyperLink();
}
void FillCondition()
{
if (!string.IsNullOrEmpty(Request.QueryString["ProductDate"]))
dateInput.Date = DateTime.Parse(Request.QueryString["ProductDate"]);
if (!string.IsNullOrEmpty(Request.QueryString["ProductBatch_ID"]))
{
var name = WebBLUtil.GetDmoPropertyByID<string>(typeof(ProductBatch), "Name", long.Parse(Request.QueryString["ProductBatch_ID"]));
batchSelect.Fill(Request.QueryString["ProductBatch_ID"], name);
}
}
}
}

B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInStoreLossAnalyse_/InStoreDetail.cs → B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/InStoreDetail.cs View File

@ -18,7 +18,7 @@ using Forks.Utils;
using BWP.B3Frameworks.BO.MoneyTemplate;
using Forks.EnterpriseServices.DataForm;
namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInStoreLossAnalyse_
namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutLossAnalyse_
{
class InStoreDetail : ServerPage
{

+ 123
- 0
B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutLossAnalyse_/OutStoreDetail.cs View File

@ -0,0 +1,123 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.Utils;
using BWP.Web.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Controls;
using TSingSoft.WebPluginFramework.Pages;
using TSingSoft.WebPluginFramework;
using Forks.Utils;
using BWP.B3Frameworks.BO.MoneyTemplate;
using Forks.EnterpriseServices.DataForm;
using BWP.B3ClientService.NamedValueTemplate;
namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutLossAnalyse_
{
class OutStoreDetail : ServerPage
{
long? GoodsID
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["Goods_ID"]))
return null;
return long.Parse(Request.QueryString["Goods_ID"]);
}
}
DateTime? Date
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["Date"]))
return null;
return DateTime.Parse(Request.QueryString["Date"]);
}
}
long? ProductBatchID
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["ProductBatchID"]))
return null;
return long.Parse(Request.QueryString["ProductBatchID"]);
}
}
int Flag
{
get
{
return int.Parse(Request.QueryString["Flag"]);
}
}
DFBrowseGrid mBrowseGrid;
protected override void InitForm(HtmlForm form)
{
string lName = string.Empty;
if (GoodsID.HasValue)
lName = WebBLUtil.GetDmoPropertyByID<string>(typeof(Goods), "Name", GoodsID.Value);
form.Controls.Add(new PageTitle(string.Format("{0}{1}明细", lName, Flag == 1 ? "领用" : "销售")));
mBrowseGrid = form.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) });
mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn());
}
void StartQuery()
{
var jF="InStoreGoods_ID";
if (Flag == 2)
jF = "SaleGoods_ID";
var main = new JoinAlias(typeof(CarcassFullInfo));
var goods = new JoinAlias(typeof(Goods));
var batch = new JoinAlias(typeof(ProductBatch));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, jF, goods, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(batch), DQCondition.EQ(main, "ProductBatch_ID", batch, "ID"));
query.Columns.Add(DQSelectColumn.Field("Name", goods, "存货"));
query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Name"));
query.Columns.Add(DQSelectColumn.Sum("PickNumber", "头数"));
query.Columns.Add(DQSelectColumn.Sum("PickWeight", "重量"));
query.Where.Conditions.Add(DQCondition.EQ("PickType", Flag == 1 ? . : .));
if (ProductBatchID.HasValue)
query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", ProductBatchID));
if (Date.HasValue)
query.Where.Conditions.Add(DQCondition.EQ(batch, "Date", Date));
if (GoodsID.HasValue)
query.Where.Conditions.Add(DQCondition.EQ("InStoreGoods_ID", GoodsID));
else
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("InStoreGoods_ID")));
var args = new LoadArguments(query);
for (var i = 0; i < query.Columns.Count; i++)
{
if (i <= 0)
continue;
args.SumColumns.Add(i);
args.GroupSumColumns.Add(i);
}
mBrowseGrid.LoadArguments = args;
mBrowseGrid.DataBind();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
StartQuery();
}
}
}

+ 47
- 0
B3ClientService.Web/Pages/B3ClientService/ToolsPage.cs View File

@ -0,0 +1,47 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Pages;
namespace BWP.Web.Pages.B3ClientService
{
class ToolsPage : ServerPage
{
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form)
{
var textbox = form.EAdd(new DFDateInput());
var range = form.EAdd(new DFTextBox());
var minID = form.EAdd(new DFTextBox());
form.Controls.Add(new TSButton("DO", delegate
{
using (var session = Dmo.NewSession())
{
var q = new DmoQuery(typeof(GradeAndWeight_Detail));
q.Range = SelectRange.Top(int.Parse(range.Text));
q.Where.Conditions.Add(DQCondition.EQ("Date", textbox.Date));
q.Where.Conditions.Add(DQCondition.GreaterThan("ID", long.Parse(minID.Text)));
q.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
var lst = session.ExecuteList(q).Cast<GradeAndWeight_Detail>();
foreach (var item in lst)
{
GradeAndWeightBL.InsertTraceBack(item, session);
}
session.Commit();
var mx = 0L;
if (lst.Any())
mx = lst.Max(x => x.ID);
AspUtil.Alert(this, lst.Count().ToString() + "Max_" + mx);
}
}));
}
}
}

+ 1
- 1
B3ClientService/B3ClientService.csproj View File

@ -136,7 +136,7 @@
<Compile Include="BO\BaseInfo\WorkShop.cs" />
<Compile Include="BO\BaseInfo\WorkUnit.cs" />
<Compile Include="BO\BaseInfo\Zone.cs" />
<Compile Include="BO\Bill\ButcherTraceBackLog.cs" />
<Compile Include="BO\Bill\ButcherTraceBackInfo.cs" />
<Compile Include="BO\Bill\CarcassFullInfo.cs" />
<Compile Include="BO\Bill\CarcassInventory\CarcassInventory.cs" />
<Compile Include="BO\Bill\CarcassInventory\CarcassInventory_Detail.cs" />


+ 25
- 0
B3ClientService/BO/Bill/ButcherTraceBackInfo.cs View File

@ -0,0 +1,25 @@
using BWP.B3Frameworks.BO;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[BOClass]
public class ButcherTraceBackInfo
{
public long GID { get; set; }
public string Code { get; set; }
public string Goods_Name { get; set; }
public string ProductDate { get; set; }
public string PigFarmAddress { get; set; }
public string TestingNo { get; set; }
public string TestingMan { get; set; }
public string Farmer { get; set; }
public string ButcherBatch { get; set; }
public string ButcherTime { get; set; }
}
}

+ 0
- 14
B3ClientService/BO/Bill/ButcherTraceBackLog.cs View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[BOClass]
public class ButcherTraceBackLog
{
public long GradeAndWeight_ID { get; set; }
}
}

+ 42
- 0
B3ClientService/OfflinRpc/GradeAndWeightBL.cs View File

@ -2,6 +2,7 @@
using BWP.B3Frameworks.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
@ -21,6 +22,47 @@ namespace BWP.B3ClientService.BL
Update(id.Value, obj, session);
else
Insert(obj, session);
InsertTraceBack(obj, session);
}
public static void InsertTraceBack(GradeAndWeight_Detail obj, IDmoSession session)
{
var trace = new ButcherTraceBackInfo();
trace.Code = obj.BarCode;
trace.Goods_Name = obj.Technics == 0 ? "带皮白条" : "去皮白条";
trace.ProductDate = obj.Time.ToString("yyyyMMdd");
trace.ButcherTime = obj.Date.Value.ToString("yyyyMMdd");
trace.ButcherBatch = string.Format("{0}{1:000}", trace.ButcherTime, obj.Index);
trace.GID = obj.ID;
if (obj.OrderDetail_ID.HasValue)
{
var order = new JoinAlias(typeof(OrderDetail));
var weight = new JoinAlias(typeof(WeightBill));
var wf = new JoinAlias(typeof(WeightBill_FarmerDetail));
var query = new DQueryDom(order);
query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.EQ(order, "WeightBill_ID", weight, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(wf), DQCondition.And(DQCondition.EQ(wf, "DeleteState", false), DQCondition.EQ(weight, "ID", wf, "WeightBill_ID")));
query.Columns.Add(DQSelectColumn.Field("Farmer_Name", wf));
query.Columns.Add(DQSelectColumn.Field("Farmer_Address", wf));
query.Columns.Add(DQSelectColumn.Field("AnimalTestNumber", weight));
query.Columns.Add(DQSelectColumn.Field("AnimalTestMan", weight));
query.Where.Conditions.Add(DQCondition.EQ(order, "ID", obj.OrderDetail_ID));
query.Range = SelectRange.Top(1);
using (var reader = session.ExecuteReader(query))
{
if (reader.Read())
{
trace.Farmer = (string)reader[0];
trace.PigFarmAddress = (string)reader[1];
trace.TestingNo = (string)reader[2];
trace.TestingMan = (string)reader[3];
}
}
}
session.Insert(trace);
}
static long? GetID(string code, IDmoSession session)


+ 23
- 10
B3ClientService/OfflinRpc/SectionStoreDetailRpc.cs View File

@ -17,11 +17,13 @@ namespace BWP.B3ClientService.Rpcs
public static class SectionStoreDetailRpc
{
[Rpc(RpcFlags.SkipAuth)]
public static int Insert(string json)
public static string Insert(string json)
{
var arr = JsonConvert.DeserializeObject<List<SectionInfo>>(json);
if (arr.Count == 0)
return 0;
return "无转段信息";
var tp = new List<Tuple<long, DateTime, long>>();
var list = new List<SectionStoreDetail>();
using (var session = Dmo.NewSession())
{
var query = new DQueryDom(new JoinAlias(typeof(CarcassFullInfo)));
@ -31,8 +33,6 @@ namespace BWP.B3ClientService.Rpcs
query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNull(DQExpression.Field("PickTime")), DQCondition.InList(DQExpression.Field("BarCode"), arr.Select(x => DQExpression.Value(x.BarCode)).ToArray())));
var config = GetSectionConfig(session);
var tp = new List<Tuple<long, DateTime, long>>();
var list = new List<SectionStoreDetail>();
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
@ -59,15 +59,28 @@ namespace BWP.B3ClientService.Rpcs
list.Add(e2);
}
}
foreach (var item in list)
session.Insert(item);
if (list.Any())
{
foreach (var item in list)
session.Insert(item);
foreach (var item in tp)
SetCarcassTakeOut(session, item);
foreach (var item in tp)
SetCarcassTakeOut(session, item);
session.Commit();
session.Commit();
}
}
return arr.Count;
if (tp.Count == arr.Count)
return string.Format("成功,本次转段{0}头", arr.Count);
if (tp.Count == 0)
return string.Format("无转段信息,扫码重复", arr.Count);
var msg = string.Empty;
if (tp.Count > 0)
msg = string.Format("本次转段{0}头 ", tp.Count);
if (tp.Count < arr.Count)
msg += string.Format("重复{0}头", arr.Count - tp.Count);
return msg;
}
static void SetCarcassTakeOut(IDmoSession session, Tuple<long, DateTime, long> item)


+ 9
- 121
B3ClientService/Tasks/SyncCarcassInStoreToTrackBack.cs View File

@ -40,7 +40,7 @@ namespace BWP.B3ClientService.Tasks
var arr = JsonConvert.SerializeObject(infos);
TraceBackInfoUtil.Insert(sUrl, arr);
}
DeleteSyncd(session, list.Min(x => x.ID), list.Max(x => x.ID));
DeleteSyncd <SyncCarcassInStoreLog>(session, list.Min(x => x.ID), list.Max(x => x.ID),"ID");
}
List<TraceBackInStoreInfo> GetUnSyncdInfo(IDmoSession session)
@ -54,10 +54,10 @@ namespace BWP.B3ClientService.Tasks
return list.Select(x => new TraceBackInStoreInfo { ID = x.Item1, Code = x.Item2, InStoreDate = x.Item3 }).ToList();
}
void DeleteSyncd(IDmoSession session, long min, long max)
void DeleteSyncd<T>(IDmoSession session, long min, long max,string idF)
{
var delete = new DQDeleteDom(typeof(SyncCarcassInStoreLog));
delete.Where.Conditions.Add(DQCondition.Between("ID", min, max));
var delete = new DQDeleteDom(typeof(T));
delete.Where.Conditions.Add(DQCondition.Between(idF, min, max));
session.ExecuteNonQuery(delete);
}
@ -69,133 +69,21 @@ namespace BWP.B3ClientService.Tasks
return;
var arr = JsonConvert.SerializeObject(list);
TraceBackInfoUtil.Insert(sUrl, arr);
foreach (var item in list)
session.Insert(new ButcherTraceBackLog { GradeAndWeight_ID = item.ID });
DeleteSyncd<ButcherTraceBackInfo>(session, list.Min(x => x.GID), list.Max(x => x.GID), "GID");
}
List<TraceBackInfo> GetTraceBackInfo(IDmoSession session)
IEnumerable<ButcherTraceBackInfo> GetTraceBackInfo(IDmoSession session)
{
var list = new List<TraceBackInfo>();
var main = new JoinAlias(typeof(GradeAndWeight_Detail));
var log = new JoinAlias(typeof(ButcherTraceBackLog));
var detail = new JoinAlias(typeof(OrderDetail));
var weight = new JoinAlias(typeof(WeightBill));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Left, new DQDmoSource(log), DQCondition.EQ(main, "ID", log, "GradeAndWeight_ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "OrderDetail_ID", detail, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.EQ(detail, "WeightBill_ID", weight, "ID"));
var wd = WeightFramerTemp.Register(query, weight);
var wf = new JoinAlias("_farmerQ2", typeof(WeightBill_FarmerDetail));
var farmer = new JoinAlias(typeof(Farmer));
query.From.AddJoin(JoinType.Left, new DQDmoSource(wf), DQCondition.EQ(wd, "FID", wf, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(farmer), DQCondition.EQ(wf, "Farmer_ID", farmer, "ID"));
query.Columns.Add(DQSelectColumn.Field("BarCode"));
query.Columns.Add(DQSelectColumn.Field("Technics"));
query.Columns.Add(DQSelectColumn.Field("Time"));
query.Columns.Add(DQSelectColumn.Field("Date"));
query.Columns.Add(DQSelectColumn.Field("Index"));
query.Columns.Add(DQSelectColumn.Field("AnimalTestNumber", weight));
query.Columns.Add(DQSelectColumn.Field("AnimalTestMan", weight));
query.Columns.Add(DQSelectColumn.Field("Name", farmer));
query.Columns.Add(DQSelectColumn.Field("Address", farmer));
query.Columns.Add(DQSelectColumn.Field("Farmer_Name", wf));
query.Columns.Add(DQSelectColumn.Field("Farmer_Address", wf));
query.Columns.Add(DQSelectColumn.Field("ID"));
var query = new DmoQuery(typeof(ButcherTraceBackInfo));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("GID"));
query.Range = SelectRange.Top(500);
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.InEQ(DQExpression.Field("BarCode"), DQExpression.Value("")), DQCondition.IsNull(DQExpression.Field(log, "GradeAndWeight_ID"))));
query.Where.Conditions.Add(DQCondition.GreaterThan("Date", new DateTime(2018, 5, 12)));
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
{
var info = new TraceBackInfo();
info.Code = (string)reader[0];
info.Goods_Name = (short)reader[1] == 0 ? "带皮白条" : "去皮白条";
info.ProductDate = string.Format("{0:yyyyMMdd}", reader[2]);
info.ExpirationTime = "0-4℃ 4日";
info.ProductCompany = "青岛万福集团股份有限公司";
info.CompanyAddress = "青岛莱西市珠海路五号";
info.CompanyTel = "0532-55650698";
info.ButcherTime = string.Format("{0:yyyyMMdd}", reader[3]);
info.ButcherBatch = string.Format("{0}{1:000}", info.ButcherTime, reader[4]);
info.TestingNo = (string)reader[5];
info.TestingMan = (string)reader[6];
if (!string.IsNullOrEmpty(info.TestingNo))
info.TestingResult = "合格";
info.Farmer = (string)reader[7];
info.PigFarmAddress = (string)reader[8];
if (string.IsNullOrEmpty(info.Farmer))
info.Farmer = (string)reader[9];
if (string.IsNullOrEmpty(info.PigFarmAddress))
info.PigFarmAddress = (string)reader[10];
info.ID = (long)reader[11];
list.Add(info);
}
}
return list;
return session.ExecuteList(query).Cast<ButcherTraceBackInfo>();
}
public string Name
{
get { return "抽取白条信息到追溯服务器"; }
}
class WeightFramerTemp
{
public long WeightID { get; set; }
public long FID { get; set; }
public static JoinAlias Register(DQueryDom root, JoinAlias weight)
{
var query = new DQueryDom(new JoinAlias("_farmer1", typeof(WeightBill_FarmerDetail)));
query.Columns.Add(DQSelectColumn.Field("WeightBill_ID"));
query.Columns.Add(DQSelectColumn.Max("ID"));
query.GroupBy.Expressions.Add(DQExpression.Field("WeightBill_ID"));
query.Where.Conditions.Add(DQCondition.EQ("DeleteState", false));
var alias = new JoinAlias(typeof(WeightFramerTemp));
root.RegisterQueryTable(typeof(WeightFramerTemp), new string[] { "WeightID", "FID" }, query);
root.From.AddJoin(JoinType.Left, new DQDmoSource(alias), DQCondition.EQ(weight, "ID", alias, "WeightID"));
return alias;
}
}
}
class TraceBackInfo
{
[JsonIgnore]
public long ID { get; set; }
//[LogicName("条码")]
public string Code { get; set; }
//[LogicName("产品名称")]
public string Goods_Name { get; set; }
//[LogicName("生产日期")]
public string ProductDate { get; set; }
//[LogicName("保质期")]
public string ExpirationTime { get; set; }
//[LogicName("生产厂家")]
public string ProductCompany { get; set; }
//[LogicName("生产厂址")]
public string CompanyAddress { get; set; }
//[LogicName("电话")]
public string CompanyTel { get; set; }
//[LogicName("生猪产地")]
public string PigFarmAddress { get; set; }
//[LogicName("动检证号")]
public string TestingNo { get; set; }
//[LogicName("动检结果")]
public string TestingResult { get; set; }
//[LogicName("动检人员")]
public string TestingMan { get; set; }
//[LogicName("养殖户")]
public string Farmer { get; set; }
//[LogicName("屠宰批次")]
public string ButcherBatch { get; set; }
//[LogicName("屠宰时间")]
public string ButcherTime { get; set; }
}
class TraceBackInStoreInfo


+ 2
- 2
WebFolder/config/plugins/B3ClientService.plugin View File

@ -48,7 +48,7 @@
<Function index="5" name="白条进销存"/>
<Function index="6" name="条段进销存"/>
<Function index="7" name="条段损耗"/>
<Function index="8" name="白条入库差异"/>
<Function index="8" name="白条入库差异"/>
</FunctionGroup>
<FunctionGroup name ="操作员" roleSchemas="default">
<Function index="0" name="访问" />
@ -136,7 +136,7 @@
<Menu id="0032" name="MES系统/MES报表展示/白条进销存" roles="B3ClientService.报表展示.白条进销存" url="B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassInOutStoreAnalyse.aspx"/>
<Menu id="0033" name="MES系统/MES报表展示/条段进销存" roles="B3ClientService.报表展示.条段进销存" url="B3ClientService/Reports/SectionInOutStoreAnalyse_/SectionInOutStoreAnalyse.aspx"/>
<Menu id="0034" name="MES系统/MES报表展示/条段损耗" roles="B3ClientService.报表展示.条段损耗" url="B3ClientService/Reports/SectionLossAnalyse_/SectionLossAnalyse.aspx"/>
<Menu id="0035" name="MES系统/MES报表展示/白条入库差异" roles="B3ClientService.报表展示.白条入库差异" url="B3ClientService/Reports/CarcassInStoreLossAnalyse_/CarcassInStoreLossAnalyse.aspx"/>
<Menu id="0035" name="MES系统/MES报表展示/白条入库差异" roles="B3ClientService.报表展示.白条入库差异" url="B3ClientService/Reports/CarcassInOutLossAnalyse_/CarcassInLossAnalyse.aspx"/>
</Menus>
<Features>
</Features>


Loading…
Cancel
Save