diff --git a/SlnMesnac.Model/domain/WmsProductInstock.cs b/SlnMesnac.Model/domain/WmsProductInstock.cs
new file mode 100644
index 0000000..33556d2
--- /dev/null
+++ b/SlnMesnac.Model/domain/WmsProductInstock.cs
@@ -0,0 +1,189 @@
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Security.Principal;
+using System.Text;
+
+namespace SlnMesnac.Model.domain
+{
+ [SugarTable("wms_product_instock"), TenantAttribute("mes")]
+ public class WmsProductInstock
+ {
+ [SugarColumn(ColumnName = "product_instock_id", IsPrimaryKey = true, IsIdentity = true)]
+ public long productInstockId { get; set; }
+
+ ///
+ /// 任务编号
+ ///
+ [SugarColumn(ColumnName = "task_code")]
+ public string taskCode { get; set; }
+
+ ///
+ /// 仓库ID
+ ///
+ [SugarColumn(ColumnName = "warehouse_id")]
+ public long warehouseId { get; set; }
+
+ ///
+ /// 仓库楼层
+ ///
+ [SugarColumn(ColumnName = "warehouse_floor")]
+ public int? warehouseFloor { get; set; }
+
+ ///
+ /// 库位编码
+ ///
+ [SugarColumn(ColumnName = "location_code")]
+ public string locationCode { get; set; }
+
+ ///
+ /// 成品类型(2半成品,3成品)
+ ///
+ [SugarColumn(ColumnName = "product_type")]
+ public char productType { get; set; }
+
+ ///
+ /// 操作类型(0自动,1人工,2强制,3调度)
+ ///
+ [SugarColumn(ColumnName = "operation_type")]
+ public char operationType { get; set; }
+
+ ///
+ /// 计划编号,关联pd_base_plan_info的plan_code
+ ///
+ [SugarColumn(ColumnName = "plan_code")]
+ public string planCode { get; set; }
+
+ ///
+ /// 计划明细编号,关联pd_base_plan_detail的plan_detail_code
+ ///
+ [SugarColumn(ColumnName = "plan_detail_code")]
+ public string planDetailCode { get; set; }
+
+ ///
+ /// 销售订单ID,关联销售订单主键
+ ///
+ [SugarColumn(ColumnName = "sale_order_id")]
+ public long? saleOrderId { get; set; }
+
+ ///
+ /// 销售订单编号
+ ///
+ [SugarColumn(ColumnName = "saleorder_code")]
+ public string saleorderCode { get; set; }
+
+ ///
+ /// 入库类型(1生产入库,2出半成品库,9其他入库)
+ ///
+ [SugarColumn(ColumnName = "instock_type")]
+ public char instockType { get; set; }
+
+ ///
+ /// 成品ID
+ ///
+ [SugarColumn(ColumnName = "product_id")]
+ public long? productId { get; set; }
+
+ ///
+ /// 存成品条码
+ ///
+ [SugarColumn(ColumnName = "product_batch")]
+ public string productBatch { get; set; }
+
+ ///
+ /// 入库数量
+ ///
+ [SugarColumn(ColumnName = "instock_amount")]
+ public decimal? instockAmount { get; set; }
+
+ ///
+ /// 托盘RFID代码
+ ///
+ [SugarColumn(ColumnName = "pallet_info_code")]
+ public string palletInfoCode { get; set; }
+
+ ///
+ /// 申请原因
+ ///
+ [SugarColumn(ColumnName = "apply_reason")]
+ public string applyReason { get; set; }
+
+ ///
+ /// 审核原因
+ ///
+ [SugarColumn(ColumnName = "audit_reason")]
+ public string auditReason { get; set; }
+
+ ///
+ /// 审核状态(0待审核,1审核通过,2审核未通过)
+ ///
+ [SugarColumn(ColumnName = "audit_status")]
+ public char auditStatus { get; set; }
+
+ ///
+ /// 执行状态(0待执行,1执行中,2执行完成)
+ ///
+ [SugarColumn(ColumnName = "execute_status")]
+ public char executeStatus { get; set; }
+
+ ///
+ /// 申请人
+ ///
+ [SugarColumn(ColumnName = "apply_by")]
+ public string applyBy { get; set; }
+
+ ///
+ /// 申请时间
+ ///
+ [SugarColumn(ColumnName = "apply_date")]
+ public DateTime? applyDate { get; set; }
+
+ ///
+ /// 审核人
+ ///
+ [SugarColumn(ColumnName = "audit_by")]
+ public string auditBy { get; set; }
+
+ ///
+ /// 审核时间
+ ///
+ [SugarColumn(ColumnName = "audit_date")]
+ public DateTime? auditDate { get; set; }
+
+ ///
+ /// 同步ERP状态(0:失败,1成功)
+ ///
+ [SugarColumn(ColumnName = "erp_status")]
+ public char? erpStatus { get; set; }
+
+ ///
+ /// 同步给ERP的数量
+ ///
+ [SugarColumn(ColumnName = "erp_amount")]
+ public decimal? erpAmount { get; set; }
+
+ ///
+ /// 最后更新人
+ ///
+ [SugarColumn(ColumnName = "update_by")]
+ public string updateBy { get; set; }
+
+ ///
+ /// 最后更新时间
+ ///
+ [SugarColumn(ColumnName = "update_date")]
+ public DateTime? updateDate { get; set; }
+
+ ///
+ /// 开始时间;AGV处理开始时间
+ ///
+ [SugarColumn(ColumnName = "begin_time")]
+ public DateTime? beginTime { get; set; }
+
+ ///
+ /// 结束时间;AGV处理结束时间
+ ///
+ [SugarColumn(ColumnName = "end_time")]
+ public DateTime? endTime { get; set; }
+ }
+}
diff --git a/SlnMesnac.WPF/Page/ProdStatisticsPage.xaml b/SlnMesnac.WPF/Page/ProdStatisticsPage.xaml
index dc4f176..a559597 100644
--- a/SlnMesnac.WPF/Page/ProdStatisticsPage.xaml
+++ b/SlnMesnac.WPF/Page/ProdStatisticsPage.xaml
@@ -124,6 +124,14 @@
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Visible" BorderThickness="0" CanUserAddRows="False" HorizontalAlignment="Center"
Foreground="White" >
+
+
+
+
+
@@ -149,21 +157,27 @@
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
@@ -207,7 +221,41 @@ Foreground="#FFFFFF" >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SlnMesnac.WPF/ViewModel/ProdStatisticsViewModel.cs b/SlnMesnac.WPF/ViewModel/ProdStatisticsViewModel.cs
index c22d281..dc3f75f 100644
--- a/SlnMesnac.WPF/ViewModel/ProdStatisticsViewModel.cs
+++ b/SlnMesnac.WPF/ViewModel/ProdStatisticsViewModel.cs
@@ -68,7 +68,7 @@ namespace SlnMesnac.WPF.ViewModel
#region 参数定义
- #region 日产量柱状图X轴日期
+ #region 投料X轴日期
///
/// 日产量柱状图X轴日期
///
@@ -81,9 +81,9 @@ namespace SlnMesnac.WPF.ViewModel
}
#endregion
- #region 型号统计柱状图
+ #region 投料柱状图
///
- /// 投料日产量统计柱状图
+ /// 投料统计柱状图
///
private SeriesCollection outAchievement = new SeriesCollection();
@@ -95,6 +95,35 @@ namespace SlnMesnac.WPF.ViewModel
#endregion
+ #region 日产量柱状图X轴日期
+ ///
+ /// 日产量柱状图X轴日期
+ ///
+ private List productDayList = new List();
+
+ public List ProductDayList
+ {
+ get { return productDayList; }
+ set { productDayList = value; }
+ }
+ #endregion
+
+ #region 型号统计柱状图
+ ///
+ /// 日产量统计柱状图
+ ///
+ private SeriesCollection productAchievement = new SeriesCollection();
+
+ public SeriesCollection ProductAchievement
+ {
+ get { return productAchievement; }
+ set { productAchievement = value; }
+ }
+ #endregion
+
+
+
+
private DateTime _BeginDate;
public DateTime BeginDate
{
@@ -135,14 +164,14 @@ namespace SlnMesnac.WPF.ViewModel
}
///
- /// 条码队列DataGrid
+ /// 成品入库记录DataGrid
///
- private ObservableCollection barCodeTaskDataGrid;
+ private ObservableCollection productDataGrid = new ObservableCollection();
- public ObservableCollection BarCodeTaskDataGrid
+ public ObservableCollection ProductDataGrid
{
- get { return barCodeTaskDataGrid; }
- set { barCodeTaskDataGrid = value; RaisePropertyChanged(() => BarCodeTaskDataGrid); }
+ get { return productDataGrid; }
+ set { productDataGrid = value; RaisePropertyChanged(() => ProductDataGrid); }
}
#endregion
@@ -177,6 +206,7 @@ namespace SlnMesnac.WPF.ViewModel
else
{
await RefreshWmsRawOutstockDetailDataGrid(BeginDate, EndDate);
+ await RefreshProductDataGrid(BeginDate, EndDate);
}
}
@@ -189,7 +219,7 @@ namespace SlnMesnac.WPF.ViewModel
- #region 原材料出库记录及图表
+ #region 3F原材料出库记录及图表
///
/// 刷新原材料出库记录
///
@@ -214,6 +244,7 @@ namespace SlnMesnac.WPF.ViewModel
// 刷新图表
RefreshWmsRawOutstockDetailChart(list);
+
}
}
@@ -257,5 +288,65 @@ namespace SlnMesnac.WPF.ViewModel
#endregion
+ #region 2F成品生产记录及统计图表
+ private async Task RefreshProductDataGrid(DateTime beginDate, DateTime endDate)
+ {
+ List list;
+
+ list = await sqlClient.AsTenant().GetConnection("mes").Queryable().Where(x => x.warehouseId == 231 && x.updateDate >= beginDate && x.updateDate <= endDate).OrderByDescending(t => t.updateDate).ToListAsync();
+
+ if (list != null && list.Count > 0)
+ {
+ await App.Current.Dispatcher.BeginInvoke((Action)(() =>
+ {
+ productDataGrid.Clear();
+ int i = 1;
+ foreach (WmsProductInstock verify in list)
+ {
+ verify.productInstockId = i++;
+ productDataGrid.Add(verify);
+ }
+ }));
+
+ // 刷新图表
+ RefreshProductChart(list);
+ }
+ }
+
+ private void RefreshProductChart(List list)
+ {
+ App.Current.Dispatcher.BeginInvoke((Action)(() =>
+ {
+ ProductAchievement.Clear();
+ ProductDayList.Clear();
+ ChartValues achievement = new ChartValues();
+ var listByDate = list
+ .GroupBy(detail => detail.updateDate.Value.Date) // 按日期分组
+ .Select(group => new
+ {
+ Date = group.Key,
+ TotalAmount = group.Count() // 统计出库数量
+ })
+ .ToList();
+ int i = 0;
+ foreach (var item in listByDate)
+ {
+ ProductDayList.Add(item.Date.ToString("MM-dd"));
+ achievement.Add(new ObservablePoint(i++, double.Parse(item.TotalAmount.ToString())));
+
+ }
+ //加一个汇总柱状图
+ ProductDayList.Add("合计");
+ achievement.Add(new ObservablePoint(i, list.Count));
+ var column = new ColumnSeries();
+ column.DataLabels = true;
+ column.Title = "日生产量";
+ column.Values = achievement;
+ column.Foreground = Brushes.White;
+ ProductAchievement.Add(column);
+ }));
+ }
+
+ #endregion
}
}