Browse Source

加产出入库差异分析

master
yibo 7 years ago
parent
commit
ec3830f019
6 changed files with 266 additions and 0 deletions
  1. +9
    -0
      B3ClientService.Web/B3ClientService.Web.csproj
  2. +171
    -0
      B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductInstoreDiff_/SegmentProductInstoreDiff.cs
  3. +1
    -0
      B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductInstoreDiff_/SegmentProductInstoreDiff.xml
  4. +79
    -0
      B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductInstoreDiff_/ShowGoodsDetail.cs
  5. +4
    -0
      B3ClientService/BO/Bill/SegmentProductionInfo.cs
  6. +2
    -0
      WebFolder/config/plugins/B3ClientService.plugin

+ 9
- 0
B3ClientService.Web/B3ClientService.Web.csproj View File

@ -177,6 +177,12 @@
<Compile Include="Pages\B3ClientService\Reports\SegmentProductAnalyse_\SegmentProductAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\SegmentProductInstoreDiff_\SegmentProductInstoreDiff.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\SegmentProductInstoreDiff_\ShowGoodsDetail.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\ServerHostConfig.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -216,6 +222,9 @@
<ItemGroup>
<EmbeddedResource Include="Pages\B3ClientService\BaseInfos\Store_\StoreList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3ClientService\Reports\SegmentProductInstoreDiff_\SegmentProductInstoreDiff.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.


+ 171
- 0
B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductInstoreDiff_/SegmentProductInstoreDiff.cs View File

@ -0,0 +1,171 @@
using BWP.B3ClientService.BO;
using BWP.B3ClientService.NamedValueTemplate;
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.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework;
namespace BWP.Web.Pages.B3ClientService.Reports.SegmentProductInstoreDiff_
{
class SegmentProductInstoreDiff : DFGridReportPage
{
protected override string AccessRoleName
{
get { return "B3ClientService.报表展示.产出入库差异"; }
}
protected override string Caption
{
get { return "产出入库差异"; }
}
long? SelectBatch
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["BatchID"]))
{
if (BatchList.Any())
return BatchList.Last().Item2;
return null;
}
return long.Parse(Request.QueryString["BatchID"]);
}
}
List<Tuple<string, long>> BatchList
{
get
{
if (ViewState["BatchList"] == null)
ViewState["BatchList"] = GetBatch();
return (List<Tuple<string, long>>)ViewState["BatchList"];
}
}
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form)
{
base.InitForm(form);
mDFGrid.HeaderPagerLock = true;
mDFGrid.AllowRowGroup = true;
mDFGrid.AllowColGroup = true;
mDFGrid.AfterFillDetailRow += (htmlRow, dataRow) =>
{
var row = (DFDataRow)dataRow;
var diff = Convert.ToDecimal(row["差异|数量"] ?? 0);
if (diff > 0)
{
BuildCell(htmlRow, row);
htmlRow.Cells[6].Style.Add("background-color", "pink");
htmlRow.Cells[7].Style.Add("background-color", "pink");
}
};
}
private void BuildCell(HtmlTableRow htmlRow, DFDataRow dataRow)
{
var url = "~/B3ClientService/Reports/SegmentProductInstoreDiff_/ShowGoodsDetail.aspx";
url = AspUtil.AddParamToUrl(url, "BatchID", string.Format("{0}", SelectBatch));
url = AspUtil.AddParamToUrl(url, "Goods_ID", dataRow["Goods_ID"].ToString());
url = WpfPageUrl.ToGlobal(url);
for (var i = 6; i <= 7; i++)
{
var cell = htmlRow.Cells[i];
cell.Attributes["onclick"] = "OpenUrlInTopTab('" + url + "','差异详情');";
cell.Style.Add("color", "blue");
cell.Style.Add("text-decoration", "underline");
cell.Style.Add("cursor", "pointer");
}
}
protected override void InitQueryPanel(WebControls.QueryPanel queryPanel)
{
//base.InitQueryPanel(queryPanel);
queryPanel.ConditonPanel.EAdd(CreateDateBtnPanel());
queryPanel.ButtonsPanel.Controls.Clear();
}
private HLayoutPanel CreateDateBtnPanel()
{
var panel = new HLayoutPanel();
var url = Request.Url.ToString();
foreach (var item in BatchList)
{
var hl = panel.Add(new HyperLink() { Text = item.Item1 });
hl.Style.Add("margin-right", "10px");
hl.Style.Add("font-size", "15px");
hl.NavigateUrl = AspUtil.UpdateUrlParam(url, "BatchID", item.Item2.ToString());
if (SelectBatch.HasValue && item.Item2 == SelectBatch)
{
hl.Style.Add("background-color", "#3CC24C");
hl.Style.Add("color", "#FFFFFF");
}
}
return panel;
}
List<Tuple<string, long>> GetBatch()
{
var query = new DQueryDom(new JoinAlias(typeof(ProductBatch)));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("BatchType", .), DQCondition.Between("Date", DateTime.Today.AddDays(-4), DateTime.Today)));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Date"));
return query.EExecuteList<string, long>();
}
protected override DQueryDom GetQueryDom()
{
var query = new DQueryDom(new JoinAlias(typeof(SegmentProductionInfo)));
query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
query.Columns.Add(DQSelectColumn.Field("Goods_Code", "存货编码"));
query.Columns.Add(DQSelectColumn.Field("Goods_Name", "存货名称"));
foreach (var c in query.Columns)
query.GroupBy.Expressions.Add(c.Expression);
query.Columns.Add(DQSelectColumn.Create(DQExpression.Count(), "生产|数量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("Weight")), "生产|重量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNull(DQExpression.Field("InStoreTime")), DQExpression.NULL, DQExpression.Value(1))), "入库|数量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNull(DQExpression.Field("InStoreTime")), DQExpression.NULL, DQExpression.Field("Weight"))), "入库|重量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNull(DQExpression.Field("InStoreTime")), DQExpression.Value(1), DQExpression.NULL)), "差异|数量"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.LogicCase(DQCondition.IsNull(DQExpression.Field("InStoreTime")), DQExpression.Field("Weight"), DQExpression.NULL)), "差异|重量"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ProductBatch_ID", SelectBatch), DQCondition.EQ("Delete", false)));
var idx = -1;
foreach (var c in query.Columns)
{
idx++;
if (idx == 0)
continue;
else
ColumnNames.Add(c.Name);
if (idx > 2)
{
SumColumnNames.Add(c.Name);
GroupSumColumnNamnes.Add(c.Name);
}
}
return query;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
StartQuery();
}
}
}
}

+ 1
- 0
B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductInstoreDiff_/SegmentProductInstoreDiff.xml View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8" ?>

+ 79
- 0
B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductInstoreDiff_/ShowGoodsDetail.cs View File

@ -0,0 +1,79 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.Utils;
using BWP.Web.Utils;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework.Controls;
using TSingSoft.WebPluginFramework.Pages;
namespace BWP.Web.Pages.B3ClientService.Reports.SegmentProductInstoreDiff_
{
class ShowGoodsDetail : ServerPage
{
public long Goods_ID
{
get
{
return long.Parse(Request.QueryString["Goods_ID"]);
}
}
public long? BatchID
{
get
{
if (string.IsNullOrEmpty(Request.QueryString["BatchID"]))
return null;
return long.Parse(Request.QueryString["BatchID"]);
}
}
DFBrowseGrid mDFGrid;
protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form)
{
var batchName = string.Empty;
if (BatchID.HasValue)
batchName = WebBLUtil.GetDmoPropertyByID<string>(typeof(ProductBatch), "Name", BatchID.Value);
form.Controls.Add(new PageTitle(string.Format("{0}-{1} 入库差异", batchName, WebBLUtil.GetDmoPropertyByID<string>(typeof(Goods), "Name", Goods_ID))));
mDFGrid = form.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) });
mDFGrid.Columns.Add(new DFBrowseGridAutoColumn());
}
List<int> SumColumnIndex = new List<int>();
DQueryDom GetQueryDom()
{
var query = new DQueryDom(new JoinAlias(typeof(SegmentProductionInfo)));
query.Columns.Add(DQSelectColumn.Field("BarCode"));
query.Columns.Add(DQSelectColumn.Field("ProductTime"));
query.Columns.Add(DQSelectColumn.Field("WorkUnit_Name", "生产员"));
query.Columns.Add(DQSelectColumn.Field("Worker_Name", "工作单元"));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "数量"));
SumColumnIndex.Add(query.Columns.Count - 1);
query.Columns.Add(DQSelectColumn.Field("Weight"));
SumColumnIndex.Add(query.Columns.Count - 1);
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Goods_ID", Goods_ID), DQCondition.EQ("ProductBatch_ID", BatchID), DQCondition.EQ("Delete", false), DQCondition.IsNull(DQExpression.Field("InStoreTime"))));
return query;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
var args = new LoadArguments(GetQueryDom());
foreach (var idx in SumColumnIndex)
args.SumColumns.Add(idx);
mDFGrid.LoadArguments = args;
mDFGrid.DataBind();
}
}
}
}

+ 4
- 0
B3ClientService/BO/Bill/SegmentProductionInfo.cs View File

@ -129,6 +129,10 @@ namespace BWP.B3ClientService.BO
[Join("Worker_ID", "ID")]
public string Worker_Name { get; set; }
[ReferenceTo(typeof(WorkUnit), "Name")]
[Join("WorkUnit_ID", "ID")]
public string WorkUnit_Name { get; set; }
[ReferenceTo(typeof(ProductBatch), "Name")]
[Join("ProductBatch_ID", "ID")]
public string ProductBatch_Name { get; set; }


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

@ -51,6 +51,7 @@
<Function index="8" name="白条出入库差异"/>
<Function index="9" name="分割产出分析"/>
<Function index="10" name="分割入库分析"/>
<Function index="11" name="产出入库差异"/>
</FunctionGroup>
<FunctionGroup name ="操作员" roleSchemas="default">
<Function index="0" name="访问" />
@ -152,6 +153,7 @@
<Menu id="0035" name="MES系统/MES报表展示/白条出入库差异" roles="B3ClientService.报表展示.白条出入库差异" url="B3ClientService/Reports/CarcassInOutLossAnalyse_/CarcassInLossAnalyse.aspx"/>
<Menu id="0036" name="MES系统/MES报表展示/分割产出分析" roles="B3ClientService.报表展示.分割产出分析" url="B3ClientService/Reports/SegmentProductAnalyse_/SegmentProductAnalyse.aspx"/>
<Menu id="0037" name="MES系统/MES报表展示/分割入库分析" roles="B3ClientService.报表展示.分割入库分析" url="B3ClientService/Reports/SegmentProductAnalyse_/SegmentInStoreAnalyse.aspx"/>
<Menu id="0038" name="MES系统/MES报表展示/产出入库差异" roles="B3ClientService.报表展示.产出入库差异" url="B3ClientService/Reports/SegmentProductInstoreDiff_/SegmentProductInstoreDiff.aspx"/>
</Menus>
<Features>
</Features>


Loading…
Cancel
Save