diff --git a/B3ClientService.Web/B3ClientService.Web.csproj b/B3ClientService.Web/B3ClientService.Web.csproj
index 6c272ce..d9b493d 100644
--- a/B3ClientService.Web/B3ClientService.Web.csproj
+++ b/B3ClientService.Web/B3ClientService.Web.csproj
@@ -171,6 +171,12 @@
ASPXCodeBehind
+
+ ASPXCodeBehind
+
+
+ ASPXCodeBehind
+
ASPXCodeBehind
diff --git a/B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductAnalyse_/SegmentInStoreAnalyse.cs b/B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductAnalyse_/SegmentInStoreAnalyse.cs
new file mode 100644
index 0000000..964b5ae
--- /dev/null
+++ b/B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductAnalyse_/SegmentInStoreAnalyse.cs
@@ -0,0 +1,203 @@
+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.WebControls;
+using TSingSoft.WebControls2;
+using TSingSoft.WebPluginFramework.Controls;
+using TSingSoft.WebPluginFramework.Pages;
+using TSingSoft.WebPluginFramework;
+using Forks.Utils;
+
+namespace BWP.Web.Pages.B3ClientService.Reports.SegmentProductAnalyse_
+{
+ class SegmentInStoreAnalyse : ServerPage
+ {
+ protected override void OnInit(EventArgs e)
+ {
+ if (!User.IsInRole("B3ClientService.报表展示.分割入库分析"))
+ throw new SecurityException();
+ base.OnInit(e);
+ }
+
+ DFBrowseGrid mBrowseGrid;
+ protected override void InitForm(System.Web.UI.HtmlControls.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());
+ }
+
+ ChoiceBox batchSelect;
+ DFCheckBox showDetail;
+ private void AddQueryControl(Panel queryPanel)
+ {
+ var hp = queryPanel.EAdd(new Panel());
+ hp.Style.Add("float", "right");
+ hp.EAdd(new SimpleLabel("生产批次"));
+ batchSelect = hp.EAdd(new ChoiceBox(B3ClientServiceConsts.DataSources.生产批次) { EnableInputArgument = true, EnableTopItem = true, Width = Unit.Pixel(180) });
+ showDetail = hp.EAdd(new DFCheckBox() { Text = "查看明细" });
+ showDetail.InputAttributes.Add("style", "width:15px;height:15px;");
+ hp.EAdd(new TSButton("开始查询", delegate { StartQuery(); }));
+ }
+
+ private void StartQuery()
+ {
+ long? productBatci = null;
+ if (!batchSelect.IsEmpty)
+ productBatci = long.Parse(batchSelect.Value);
+
+ var main = new JoinAlias(typeof(TempClass));
+ var goods = new JoinAlias(typeof(Goods));
+ var unit = new JoinAlias(typeof(WorkUnit));
+ var productBatch = new JoinAlias(typeof(ProductBatch));
+ var query = new DQueryDom(main);
+ TempClass.Regist(query, productBatci);
+ query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID"));
+ query.From.AddJoin(JoinType.Left, new DQDmoSource(unit), DQCondition.EQ(main, "WorkUnit_ID", unit, "ID"));
+ query.From.AddJoin(JoinType.Left, new DQDmoSource(productBatch), DQCondition.EQ(main, "ProductBatch_ID", productBatch, "ID"));
+
+ if (showDetail.Checked)
+ {
+ query.Columns.Add(DQSelectColumn.Field("BarCode", "条码"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(productBatch, "Name"), "生产批次"));
+ query.Columns.Add(DQSelectColumn.Field("ProductTime", "生产时间"));
+ if (query.OrderBy.Expressions.Count == 0)
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ProductTime"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(unit, "Name"), "工作单元"));
+
+ query.Columns.Add(DQSelectColumn.Field("InStoreTime", "入库时间"));
+ query.Columns.Add(DQSelectColumn.Field("BackTime", "退库时间"));
+ }
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.LogicCase(DQCondition.EQ("Flag", 1), DQExpression.Value("入库"), DQExpression.Value("退库")).ECastType(), "标识"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "Code"), "存货编码"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "Name"), "存货名称"));
+ if (!showDetail.Checked)
+ {
+ query.GroupBy.Expressions.Add(DQExpression.Field("Flag"));
+ query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Code"));
+ query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Name"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("Number")), "数量"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("Weight")).ECastType?>(), "重量"));
+ }
+ else
+ {
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field("Number"), "数量"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field("Weight").ECastType?>(), "重量"));
+ }
+
+ if (!batchSelect.IsEmpty)
+ query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", long.Parse(batchSelect.Value)));
+ var args = new LoadArguments(query);
+ for (var i = query.Columns.Count - 2; i <= query.Columns.Count - 1; i++)
+ {
+ args.SumColumns.Add(i);
+ if (!showDetail.Checked)
+ args.GroupSumColumns.Add(i);
+ }
+ mBrowseGrid.LoadArguments = args;
+ mBrowseGrid.DataBind();
+ }
+
+ private TitlePanel CreateResultTab()
+ {
+ var result = new TitlePanel("查询结果");
+ mBrowseGrid = result.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) });
+ mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn());
+ var hPanel = result.EAdd(new HLayoutPanel());
+ PageUtil.AddExcelExportPanel(hPanel, mBrowseGrid, "分割入库分析");
+ return result;
+ }
+ }
+
+ class TempClass
+ {
+ public long ProductBatch_ID { get; set; }
+
+ public long? WorkUnit_ID { get; set; }
+
+ public long Goods_ID { get; set; }
+
+ public string BarCode { get; set; }
+
+ public DateTime ProductTime { get; set; }
+
+ public DateTime? InStoreTime { get; set; }
+
+ public DateTime? BackTime { get; set; }
+
+ public int Number { get; set; }
+
+ public Money Weight { get; set; }
+
+ public int Flag { get; set; }
+
+ public static void Regist(DQueryDom root, long? productBatchID)
+ {
+ var q1 = GetInStore(productBatchID);
+ var q2 = GetBackStore(productBatchID);
+ q1.UnionNext.Select = q2;
+ q1.UnionNext.Type = UnionType.All;
+
+ root.RegisterQueryTable(typeof(TempClass), new string[] { "ProductBatch_ID", "WorkUnit_ID", "Goods_ID", "BarCode", "ProductTime", "InStoreTime", "BackTime", "Number", "Weight", "Flag" }, q1);
+ }
+
+ static DQueryDom GetInStore(long? productBatchID)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(SegmentProductionInfo)));
+ query.Columns.Add(DQSelectColumn.Field("ProductBatch_ID"));
+ query.Columns.Add(DQSelectColumn.Field("WorkUnit_ID"));
+ query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
+ query.Columns.Add(DQSelectColumn.Field("BarCode"));
+ query.Columns.Add(DQSelectColumn.Field("ProductTime"));
+ query.Columns.Add(DQSelectColumn.Field("InStoreTime"));
+ query.Columns.Add(DQSelectColumn.Field("BackTime"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "Number"));
+ query.Columns.Add(DQSelectColumn.Field("Weight"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "Flag"));
+ query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNotNull(DQExpression.Field("InStoreTime")), DQCondition.IsNull(DQExpression.Field("BackTime"))));
+ if (productBatchID.HasValue)
+ query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", productBatchID.Value));
+ return query;
+ }
+
+ static DQueryDom GetBackStore(long? productBatchID)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(SegmentProductionInfo)));
+ query.Columns.Add(DQSelectColumn.Field("ProductBatch_ID"));
+ query.Columns.Add(DQSelectColumn.Field("WorkUnit_ID"));
+ query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
+ query.Columns.Add(DQSelectColumn.Field("BarCode"));
+ query.Columns.Add(DQSelectColumn.Field("ProductTime"));
+ query.Columns.Add(DQSelectColumn.Field("InStoreTime"));
+ query.Columns.Add(DQSelectColumn.Field("BackTime"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(-1), "Number"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Multiply(DQExpression.Field("Weight"), DQExpression.Value(-1)), "Weight"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(-1), "Flag"));
+ query.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field("BackTime")));
+ if (productBatchID.HasValue)
+ query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", productBatchID.Value));
+ return query;
+ }
+ }
+}
diff --git a/B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductAnalyse_/SegmentProductAnalyse.cs b/B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductAnalyse_/SegmentProductAnalyse.cs
new file mode 100644
index 0000000..443c930
--- /dev/null
+++ b/B3ClientService.Web/Pages/B3ClientService/Reports/SegmentProductAnalyse_/SegmentProductAnalyse.cs
@@ -0,0 +1,122 @@
+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.WebControls;
+using TSingSoft.WebControls2;
+using TSingSoft.WebPluginFramework.Controls;
+using TSingSoft.WebPluginFramework.Pages;
+using TSingSoft.WebPluginFramework;
+using Forks.Utils;
+
+namespace BWP.Web.Pages.B3ClientService.Reports.SegmentProductAnalyse_
+{
+ class SegmentProductAnalyse : ServerPage
+ {
+ protected override void OnInit(EventArgs e)
+ {
+ if (!User.IsInRole("B3ClientService.报表展示.分割产出分析"))
+ throw new SecurityException();
+ base.OnInit(e);
+ }
+
+ DFBrowseGrid mBrowseGrid;
+ protected override void InitForm(System.Web.UI.HtmlControls.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());
+ }
+
+ ChoiceBox batchSelect;
+ DFCheckBox showDetail;
+ private void AddQueryControl(Panel queryPanel)
+ {
+ var hp = queryPanel.EAdd(new Panel());
+ hp.Style.Add("float", "right");
+ hp.EAdd(new SimpleLabel("生产批次"));
+ batchSelect = hp.EAdd(new ChoiceBox(B3ClientServiceConsts.DataSources.生产批次) { EnableInputArgument = true, EnableTopItem = true, Width = Unit.Pixel(180) });
+ showDetail = hp.EAdd(new DFCheckBox() { Text = "查看明细" });
+ showDetail.InputAttributes.Add("style", "width:15px;height:15px;");
+ hp.EAdd(new TSButton("开始查询", delegate { StartQuery(); }));
+ }
+
+ private void StartQuery()
+ {
+ var main = new JoinAlias(typeof(SegmentProductionInfo));
+ var goods = new JoinAlias(typeof(Goods));
+ var unit = new JoinAlias(typeof(WorkUnit));
+ var productBatch = new JoinAlias(typeof(ProductBatch));
+ var query = new DQueryDom(main);
+ query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID"));
+ query.From.AddJoin(JoinType.Left, new DQDmoSource(unit), DQCondition.EQ(main, "WorkUnit_ID", unit, "ID"));
+ query.From.AddJoin(JoinType.Left, new DQDmoSource(productBatch), DQCondition.EQ(main, "ProductBatch_ID", productBatch, "ID"));
+
+ if (showDetail.Checked)
+ {
+ query.Columns.Add(DQSelectColumn.Field("BarCode"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(productBatch, "Name"), "生产批次"));
+ query.Columns.Add(DQSelectColumn.Field("ProductTime"));
+ if (query.OrderBy.Expressions.Count == 0)
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ProductTime"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(unit, "Name"), "工作单元"));
+ }
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "Code"), "存货编码"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field(goods, "Name"), "存货名称"));
+ if (!showDetail.Checked)
+ {
+ query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Code"));
+ query.GroupBy.Expressions.Add(DQExpression.Field(goods, "Name"));
+ query.Columns.Add(DQSelectColumn.Count("数量"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Sum(DQExpression.Field("Weight")).ECastType?>(), "重量"));
+ }
+ else
+ {
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "数量"));
+ query.Columns.Add(DQSelectColumn.Create(DQExpression.Field("Weight").ECastType?>(), "重量"));
+ }
+
+ if (!batchSelect.IsEmpty)
+ query.Where.Conditions.Add(DQCondition.EQ("ProductBatch_ID", long.Parse(batchSelect.Value)));
+ var args = new LoadArguments(query);
+ for (var i = query.Columns.Count - 2; i <= query.Columns.Count - 1; i++)
+ {
+ args.SumColumns.Add(i);
+ if (!showDetail.Checked)
+ args.GroupSumColumns.Add(i);
+ }
+ mBrowseGrid.LoadArguments = args;
+ mBrowseGrid.DataBind();
+ }
+
+ private TitlePanel CreateResultTab()
+ {
+ var result = new TitlePanel("查询结果");
+ mBrowseGrid = result.EAdd(new DFBrowseGrid(new DFDataTableEditor()) { Width = Unit.Percentage(100) });
+ mBrowseGrid.Columns.Add(new DFBrowseGridAutoColumn());
+ var hPanel = result.EAdd(new HLayoutPanel());
+ PageUtil.AddExcelExportPanel(hPanel, mBrowseGrid, "分割产出分析");
+ return result;
+ }
+ }
+}
diff --git a/B3ClientService/BO/Bill/SegmentProductionInfo.cs b/B3ClientService/BO/Bill/SegmentProductionInfo.cs
index bb6d948..3c92305 100644
--- a/B3ClientService/BO/Bill/SegmentProductionInfo.cs
+++ b/B3ClientService/BO/Bill/SegmentProductionInfo.cs
@@ -59,13 +59,27 @@ namespace BWP.B3ClientService.BO
public long? Store_ID { get; set; }
#endregion
- #region 领用信息
- [LogicName("领用时间")]
- public DateTime? PickTime { get; set; }
- #endregion
+ #region 退库信息
+ [LogicName("退库时间")]
+ [DbColumn(DbType = SqlDbType.DateTime)]
+ public DateTime? BackTime { get; set; }
+ [LogicName("退库")]
public bool IsDelete { get; set; }
+ #endregion
+
+ #region 销售时间
+ [LogicName("销售时间")]
+ public DateTime? PickTime { get; set; }
+ #endregion
public bool IsSync { get; set; }
+
+ [DbColumn(DefaultValue = 0)]
+ public int RowVersion { get; set; }
+
+ public long? BillID { get; set; }
+
+ public long? DetailID { get; set; }
}
}
diff --git a/B3ClientService/OfflinRpc/SegmentInStoreRpc.cs b/B3ClientService/OfflinRpc/SegmentInStoreRpc.cs
index 62d9d51..94a8705 100644
--- a/B3ClientService/OfflinRpc/SegmentInStoreRpc.cs
+++ b/B3ClientService/OfflinRpc/SegmentInStoreRpc.cs
@@ -67,6 +67,7 @@ namespace BWP.B3ClientService.Rpcs
if (item.State == 2)
{
entity.InStoreTime = item.InStoreTime;
+ entity.BackTime = item.BackStoreTime;
entity.Store_ID = item.Store_ID;
entity.IsDelete = true;
}
@@ -98,10 +99,16 @@ namespace BWP.B3ClientService.Rpcs
var update = new DQUpdateDom(typeof(SegmentProductionInfo));
if (entity.Delete || entity.State == 2)
{
- update.Columns.Add(new DQUpdateColumn("InStoreTime", DQExpression.NULL));
- update.Columns.Add(new DQUpdateColumn("Store_ID", DQExpression.NULL));
- if (entity.State == 2)
+ if (entity.Delete)
+ {
+ update.Columns.Add(new DQUpdateColumn("InStoreTime", DQExpression.NULL));
+ update.Columns.Add(new DQUpdateColumn("Store_ID", DQExpression.NULL));
+ }
+ else
+ {
+ update.Columns.Add(new DQUpdateColumn("BackTime", entity.BackStoreTime));
update.Columns.Add(new DQUpdateColumn("IsDelete", true));
+ }
}
else
{
@@ -174,9 +181,12 @@ namespace BWP.B3ClientService.Rpcs
public long? Store_ID { get; set; }
+ //0入库 2退库
public int State { get; set; }
public bool Delete { get; set; }
+
+ public DateTime? BackStoreTime { get; set; }
}
class SegmentProductObj
diff --git a/WebFolder/config/plugins/B3ClientService.plugin b/WebFolder/config/plugins/B3ClientService.plugin
index 22ea92e..c41fbcc 100644
--- a/WebFolder/config/plugins/B3ClientService.plugin
+++ b/WebFolder/config/plugins/B3ClientService.plugin
@@ -49,6 +49,8 @@
+
+
@@ -141,13 +143,15 @@
-
+
+
+