|
|
|
@ -1,537 +0,0 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Mesnac.Controls.Base;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Report.ProductionReport
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生产报表业务
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class SelectRowAction : ChemicalWeighingAction,IAction
|
|
|
|
|
{
|
|
|
|
|
#region 字段定义
|
|
|
|
|
|
|
|
|
|
public static bool IsFirstRun = true; //是否首次运行
|
|
|
|
|
private RuntimeParameter _runtime;
|
|
|
|
|
private Control _clientGridControl = null; //多维表控件
|
|
|
|
|
private DbMCControl _dgvLRPlan = null; //生产计划DGV
|
|
|
|
|
private DataTable dataTable = null;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime);
|
|
|
|
|
this._runtime = runtime;
|
|
|
|
|
|
|
|
|
|
#region 获取界面生产计划控件和称量明细控件
|
|
|
|
|
|
|
|
|
|
this._dgvLRPlan = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Base_PlanInfo").FirstOrDefault();
|
|
|
|
|
if (_dgvLRPlan == null || !(_dgvLRPlan.BaseControl is DataGridView))
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<SelectPlanAction>.Warn("{生产报表} 缺少生产计划DataGridView控件...");
|
|
|
|
|
runtime.IsReturn = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DataGridView lR_planGridView = this._dgvLRPlan.BaseControl as DataGridView;
|
|
|
|
|
|
|
|
|
|
bool gridFlag = false;
|
|
|
|
|
foreach (Control ib in GetAllControls())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (ib.Name.Contains("MultiColHeaderDgv"))
|
|
|
|
|
{
|
|
|
|
|
this._clientGridControl = ib;
|
|
|
|
|
gridFlag = true;
|
|
|
|
|
}
|
|
|
|
|
if (gridFlag)
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (_clientGridControl == null)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<SelectPlanAction>.Warn("{生产报表} 缺少缺少称量名细MultiColHeaderDgv控件...");
|
|
|
|
|
runtime.IsReturn = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Mesnac.Controls.Default.MultiColHeaderDgv clientGrid = (this._clientGridControl as Mesnac.Controls.Default.MultiColHeaderDgv);
|
|
|
|
|
|
|
|
|
|
dataTable = new DataTable("ProductionDT");
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 控件格式化
|
|
|
|
|
|
|
|
|
|
clientGrid.myColHeaderTreeView = null;
|
|
|
|
|
clientGrid.DataSource = null;
|
|
|
|
|
clientGrid.iNodeLevels = 0;
|
|
|
|
|
clientGrid.ColLists.Clear();
|
|
|
|
|
clientGrid.ColumnHeadersHeight = 23;
|
|
|
|
|
clientGrid.ScrollBars = ScrollBars.Both;
|
|
|
|
|
clientGrid.AllowUserToAddRows = false;
|
|
|
|
|
clientGrid.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
|
clientGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
|
|
|
|
clientGrid.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("宋体", 12);
|
|
|
|
|
clientGrid.DefaultCellStyle.Font = new System.Drawing.Font("宋体",10);
|
|
|
|
|
clientGrid.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (lR_planGridView.SelectedRows.Count == 1)
|
|
|
|
|
{
|
|
|
|
|
string lR_planID = lR_planGridView.SelectedRows[0].Cells["Plan_Id"].Value as string;
|
|
|
|
|
if (!string.IsNullOrEmpty(lR_planID))
|
|
|
|
|
{
|
|
|
|
|
#region 数据源获取及定义
|
|
|
|
|
|
|
|
|
|
List<Entity.LR_lot> lR_Lots = ReportHelper.GetLR_lotList(lR_planID);
|
|
|
|
|
List<Entity.LR_recipe> lR_Recipes = ReportHelper.GetLR_recipeList(lR_planID);
|
|
|
|
|
List<Entity.LR_weigh> lR_Weighs = ReportHelper.GetLR_weighList(lR_planID);
|
|
|
|
|
List<Entity.RecordSaveDataInfo> RecordSaveDataInfo = ReportHelper.GetReportSaveDataList(lR_planID);
|
|
|
|
|
|
|
|
|
|
TreeView treeView = new TreeView();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 表头建立
|
|
|
|
|
GHBuildTableHead(treeView, RecordSaveDataInfo);
|
|
|
|
|
//BuildTableHead(treeView, lR_Recipes);
|
|
|
|
|
//clientGrid.myColHeaderTreeView = treeView;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 数据填充
|
|
|
|
|
GHDataTableWrite(RecordSaveDataInfo);
|
|
|
|
|
|
|
|
|
|
//DataTableWrite(lR_Lots, lR_Recipes, lR_Weighs);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 增加最大最小平均合计值行
|
|
|
|
|
GHDataTableAdd(RecordSaveDataInfo.Count);
|
|
|
|
|
//DataTableAdd(lR_Recipes.Count);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
clientGrid.DataSource = dataTable;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < clientGrid.Columns.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
clientGrid.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 方法定义
|
|
|
|
|
|
|
|
|
|
#region 建立表头结构
|
|
|
|
|
private void GHBuildTableHead(TreeView treeView, List<Entity.RecordSaveDataInfo> RecordSaveDataInfo)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//decimal sumSet_Weight = 0.0M;
|
|
|
|
|
//decimal sumSet_Error = 0.0M;
|
|
|
|
|
//if (RecordSaveDataInfo != null && RecordSaveDataInfo.Count > 0)
|
|
|
|
|
//{
|
|
|
|
|
// for (int i = 0; i < RecordSaveDataInfo.Count; i++)
|
|
|
|
|
// {
|
|
|
|
|
// sumSet_Weight = sumSet_Weight + (decimal)RecordSaveDataInfo[i].SaveVCCAct;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//TreeNode childTreeNodeSaveFinishedNum = new TreeNode("车数");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveFinishedNum);
|
|
|
|
|
//TreeNode childTreeNodeSaveRecordTime = new TreeNode("记录时间");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveRecordTime);
|
|
|
|
|
//TreeNode childTreeNodeSaveCol = new TreeNode("格数");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveCol);
|
|
|
|
|
//TreeNode childTreeNodeSaveVCCSet = new TreeNode(" VCC应配");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveVCCSet);
|
|
|
|
|
//TreeNode childTreeNodeSaveVCCAct = new TreeNode(" VCC实配");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveVCCAct);
|
|
|
|
|
//TreeNode childTreeNodeSaveGFASet = new TreeNode("GFA应配");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveGFASet);
|
|
|
|
|
//TreeNode childTreeNodeSaveGFAAct = new TreeNode("GFA实配");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveGFAAct);
|
|
|
|
|
//TreeNode childTreeNodeSave3thSet = new TreeNode("树脂应配");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSave3thSet);
|
|
|
|
|
//TreeNode childTreeNodeSave3thAct = new TreeNode("树脂实配");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSave3thAct);
|
|
|
|
|
//TreeNode childTreeNodeSaveLevel = new TreeNode("系数");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveLevel);
|
|
|
|
|
//TreeNode childTreeNodeSaveFillTime = new TreeNode("VCC+GFA卸料速度");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveFillTime);
|
|
|
|
|
//TreeNode childTreeNodeSaveSpeed1 = new TreeNode("混料运行速度");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveSpeed1);
|
|
|
|
|
//TreeNode childTreeNodeSaveSpeed2 = new TreeNode("混合机卸料速度");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveSpeed2);
|
|
|
|
|
//TreeNode childTreeNodeSaveTime = new TreeNode("混料运行时间");
|
|
|
|
|
//treeView.Nodes.Add(childTreeNodeSaveTime);
|
|
|
|
|
|
|
|
|
|
dataTable.Columns.Add("车数", typeof(System.String));
|
|
|
|
|
dataTable.Columns.Add("格数", typeof(System.String));
|
|
|
|
|
dataTable.Columns.Add("记录时间", typeof(System.String));
|
|
|
|
|
dataTable.Columns.Add("罐A应配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("罐A实配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("罐B应配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("罐B实配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("树脂应配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("树脂实配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("罐A二次应配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("罐A二次实配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("罐B二次应配", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("罐B二次实配", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("VCC及GFA卸料速度", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("混料运行速度", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("混合机卸料速度", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("混料运行时间", typeof(decimal));
|
|
|
|
|
|
|
|
|
|
//dataTable.Columns.Add("系数", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveFinishedNum", typeof(System.String));
|
|
|
|
|
//dataTable.Columns.Add("Record_Time", typeof(System.String));
|
|
|
|
|
//dataTable.Columns.Add("SaveCol", typeof(System.String));
|
|
|
|
|
//dataTable.Columns.Add("SaveVCCSet", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveVCCAct", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveGFASet", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveGFAAct", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("Save3thSet", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("Save3thAct", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveFillTime", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveSpeed1", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveSpeed2", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveTime", typeof(decimal));
|
|
|
|
|
//dataTable.Columns.Add("SaveLevel", typeof(decimal));
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void BuildTableHead(TreeView treeView, List<Entity.LR_recipe> lR_Recipes)
|
|
|
|
|
{
|
|
|
|
|
int treeIndex = 0;
|
|
|
|
|
TreeNode rootTreeNode = new TreeNode("物料");
|
|
|
|
|
treeView.Nodes.Add(rootTreeNode);
|
|
|
|
|
TreeNode childTreeNodeSerial_Num = new TreeNode("车次");
|
|
|
|
|
TreeNode childTreeNodeWeight_Time = new TreeNode("检量时间");
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeSerial_Num);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeWeight_Time);
|
|
|
|
|
dataTable.Columns.Add("Serial_Num", typeof(System.String));
|
|
|
|
|
dataTable.Columns.Add("Weight_Time", typeof(System.String));
|
|
|
|
|
decimal sumSet_Weight = 0.0M;
|
|
|
|
|
decimal sumSet_Error = 0.0M;
|
|
|
|
|
|
|
|
|
|
if (lR_Recipes != null && lR_Recipes.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//物料表头
|
|
|
|
|
for (int i = 0; i < lR_Recipes.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
sumSet_Weight = sumSet_Weight + (decimal)lR_Recipes[i].Set_Weight;
|
|
|
|
|
sumSet_Error = sumSet_Error + (decimal)lR_Recipes[i].Set_Error;
|
|
|
|
|
TreeNode rootTreeNodeMaterialName = new TreeNode(lR_Recipes[i].Material_Name);
|
|
|
|
|
treeView.Nodes.Add(rootTreeNodeMaterialName);
|
|
|
|
|
treeIndex++;
|
|
|
|
|
TreeNode childTreeNodeSet_Weight = new TreeNode(lR_Recipes[i].Set_Weight.ToString("0.000"));
|
|
|
|
|
TreeNode childTreeNodeSet_Error = new TreeNode(lR_Recipes[i].Set_Error.ToString("0.000"));
|
|
|
|
|
TreeNode childTreeNodeWaste_Time = new TreeNode("T(s)");
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeSet_Weight);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeSet_Error);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeWaste_Time);
|
|
|
|
|
dataTable.Columns.Add("Set_Weight" + treeIndex.ToString(), typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("Set_Error" + treeIndex.ToString(), typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("Waste_Time" + treeIndex.ToString(), typeof(decimal));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//加和重量表头
|
|
|
|
|
TreeNode rootTreeNodeSum = new TreeNode("加和重量");
|
|
|
|
|
treeView.Nodes.Add(rootTreeNodeSum);
|
|
|
|
|
treeIndex++;
|
|
|
|
|
TreeNode childTreeNodeSumSet_Weight = new TreeNode(sumSet_Weight.ToString());
|
|
|
|
|
TreeNode childTreeNodeSumSet_Error = new TreeNode(sumSet_Error.ToString());
|
|
|
|
|
TreeNode childTreeNodesumWaste_Time = new TreeNode("T(s)");
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeSumSet_Weight);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeSumSet_Error);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodesumWaste_Time);
|
|
|
|
|
dataTable.Columns.Add("SumSet_Weight", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("SumSet_Error", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("SumWaste_Time", typeof(decimal));
|
|
|
|
|
|
|
|
|
|
//检量重量表头
|
|
|
|
|
TreeNode rootTreeNodeCheck = new TreeNode("检量重量");
|
|
|
|
|
treeView.Nodes.Add(rootTreeNodeCheck);
|
|
|
|
|
treeIndex++;
|
|
|
|
|
TreeNode childTreeNodeCheckSet_Weight = new TreeNode(sumSet_Weight.ToString());
|
|
|
|
|
TreeNode childTreeNodeCheckSet_Error = new TreeNode(sumSet_Error.ToString());
|
|
|
|
|
TreeNode childTreeNodeCheckWaste_Time = new TreeNode("T(s)");
|
|
|
|
|
TreeNode childTreeNodeCheckNet_Weight = new TreeNode("皮重");
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeCheckSet_Weight);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeCheckSet_Error);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeCheckWaste_Time);
|
|
|
|
|
treeView.Nodes[treeIndex].Nodes.Add(childTreeNodeCheckNet_Weight);
|
|
|
|
|
dataTable.Columns.Add("CheckSet_Weight", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("CheckSet_Error", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("CheckWaste_Time", typeof(decimal));
|
|
|
|
|
dataTable.Columns.Add("CheckNet_Weight", typeof(System.String));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 数据表填充
|
|
|
|
|
private void GHDataTableWrite(List<Entity.RecordSaveDataInfo> RecordSaveDataInfo)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (RecordSaveDataInfo != null && RecordSaveDataInfo.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < RecordSaveDataInfo.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
DataRow drow = dataTable.NewRow();
|
|
|
|
|
drow["车数"] = RecordSaveDataInfo[i].SaveFinishedNum;
|
|
|
|
|
drow["格数"] = RecordSaveDataInfo[i].SaveCol;
|
|
|
|
|
drow["记录时间"] = RecordSaveDataInfo[i].RecordTime;
|
|
|
|
|
|
|
|
|
|
drow["罐A应配"] = RecordSaveDataInfo[i].SaveVCCSet;
|
|
|
|
|
drow["罐A实配"] = RecordSaveDataInfo[i].SaveVCCAct;
|
|
|
|
|
drow["罐B应配"] = RecordSaveDataInfo[i].SaveGFASet;
|
|
|
|
|
drow["罐B实配"] = RecordSaveDataInfo[i].SaveGFAAct;
|
|
|
|
|
drow["树脂应配"] = RecordSaveDataInfo[i].Save3thSet;
|
|
|
|
|
drow["树脂实配"] = RecordSaveDataInfo[i].Save3thAct;
|
|
|
|
|
drow["罐A二次应配"] = RecordSaveDataInfo[i].SaveVCC2thSet;
|
|
|
|
|
drow["罐A二次实配"] = RecordSaveDataInfo[i].SaveVCC2thAct;
|
|
|
|
|
drow["罐B二次应配"] = RecordSaveDataInfo[i].SaveGFA2thSet;
|
|
|
|
|
drow["罐B二次实配"] = RecordSaveDataInfo[i].SaveGFA2thAct;
|
|
|
|
|
|
|
|
|
|
//drow["VCC及GFA卸料速度"] = RecordSaveDataInfo[i].SaveFillTime;
|
|
|
|
|
drow["混料运行速度"] = RecordSaveDataInfo[i].SaveSpeed1;
|
|
|
|
|
drow["混合机卸料速度"] = RecordSaveDataInfo[i].SaveSpeed2;
|
|
|
|
|
drow["混料运行时间"] = RecordSaveDataInfo[i].SaveTime;
|
|
|
|
|
//drow["系数"] = RecordSaveDataInfo[i].SaveLevel;
|
|
|
|
|
dataTable.Rows.Add(drow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void DataTableWrite(List<Entity.LR_lot> lR_Lots, List<Entity.LR_recipe> lR_Recipes, List<Entity.LR_weigh> lR_Weighs)
|
|
|
|
|
{
|
|
|
|
|
if(lR_Lots != null && lR_Lots.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < lR_Lots.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
int sumRealWaste_Time = 0; //加和时间
|
|
|
|
|
|
|
|
|
|
DataRow drow = dataTable.NewRow();
|
|
|
|
|
//车次和检量时间数据填入
|
|
|
|
|
drow["Serial_Num"] = lR_Lots[i].Serial_Num;
|
|
|
|
|
drow["Weight_Time"] = lR_Lots[i].Prd_date;
|
|
|
|
|
|
|
|
|
|
//每车物料数据填入
|
|
|
|
|
List<Entity.LR_weigh> curWeights = lR_Weighs.FindAll(x => x.Serial_Num == lR_Lots[i].Serial_Num);
|
|
|
|
|
if(curWeights != null && curWeights.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
for(int j = 0;j< curWeights.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
drow["Set_Weight" + (j + 1).ToString()] = curWeights[j].Real_Weight;
|
|
|
|
|
drow["Set_Error" + (j + 1).ToString()] = curWeights[j].Real_Error;
|
|
|
|
|
drow["Waste_Time" + (j + 1).ToString()] = curWeights[j].Waste_Time;
|
|
|
|
|
sumRealWaste_Time = sumRealWaste_Time + (int)curWeights[j].Waste_Time;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//加和重量数据填入
|
|
|
|
|
drow["SumSet_Weight"] = lR_Lots[i].Real_weight;
|
|
|
|
|
drow["SumSet_Error"] = lR_Lots[i].Real_Error;
|
|
|
|
|
drow["SumWaste_Time"] = sumRealWaste_Time;
|
|
|
|
|
|
|
|
|
|
//检量重量数据填入
|
|
|
|
|
|
|
|
|
|
drow["CheckSet_Weight"] = lR_Lots[i].Real_weight;
|
|
|
|
|
drow["CheckSet_Error"] = lR_Lots[i].Real_Error;
|
|
|
|
|
drow["CheckWaste_Time"] = lR_Lots[i].Waste_Time;
|
|
|
|
|
drow["CheckNet_Weight"] = lR_Lots[i].Net_Weight;
|
|
|
|
|
|
|
|
|
|
dataTable.Rows.Add(drow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region DataTable新增最大最小平均合计值行
|
|
|
|
|
|
|
|
|
|
private void GHDataTableAdd(int mNun)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataRow drowMax = dataTable.NewRow();
|
|
|
|
|
drowMax["记录时间"] = "最大值";
|
|
|
|
|
drowMax["罐A应配"] = dataTable.Compute("max(罐A应配)", "");
|
|
|
|
|
drowMax["罐A实配"] = dataTable.Compute("max(罐A实配)", "");
|
|
|
|
|
drowMax["罐B应配"] = dataTable.Compute("max(罐B应配)", "");
|
|
|
|
|
drowMax["罐B实配"] = dataTable.Compute("max(罐B实配)", "");
|
|
|
|
|
drowMax["树脂应配"] = dataTable.Compute("max(树脂应配)", "");
|
|
|
|
|
drowMax["树脂实配"] = dataTable.Compute("max(树脂实配)", "");
|
|
|
|
|
drowMax["罐A二次应配"] = dataTable.Compute("max(罐A二次应配)", "");
|
|
|
|
|
drowMax["罐A二次实配"] = dataTable.Compute("max(罐A二次实配)", "");
|
|
|
|
|
drowMax["罐B二次应配"] = dataTable.Compute("max(罐B二次应配)", "");
|
|
|
|
|
drowMax["罐B二次实配"] = dataTable.Compute("max(罐B二次实配)", "");
|
|
|
|
|
|
|
|
|
|
//drowMax["VCC及GFA卸料速度"] = dataTable.Compute("max(VCC及GFA卸料速度)", "");
|
|
|
|
|
drowMax["混料运行速度"] = dataTable.Compute("max(混料运行速度)", "");
|
|
|
|
|
drowMax["混合机卸料速度"] = dataTable.Compute("max(混合机卸料速度)", "");
|
|
|
|
|
drowMax["混料运行时间"] = dataTable.Compute("max(混料运行时间)", "");
|
|
|
|
|
//drowMax["系数"] = dataTable.Compute("max(系数)", "");
|
|
|
|
|
DataRow drowMin = dataTable.NewRow();
|
|
|
|
|
drowMin["记录时间"] = "最小值";
|
|
|
|
|
drowMin["罐A应配"] = dataTable.Compute("min(罐A应配)", "");
|
|
|
|
|
drowMin["罐A实配"] = dataTable.Compute("min(罐A实配)", "");
|
|
|
|
|
drowMin["罐B应配"] = dataTable.Compute("min(罐B应配)", "");
|
|
|
|
|
drowMin["罐B实配"] = dataTable.Compute("min(罐B实配)", "");
|
|
|
|
|
drowMin["树脂应配"] = dataTable.Compute("min(树脂应配)", "");
|
|
|
|
|
drowMin["树脂实配"] = dataTable.Compute("min(树脂实配)", "");
|
|
|
|
|
drowMin["罐A二次应配"] = dataTable.Compute("min(罐A二次应配)", "");
|
|
|
|
|
drowMin["罐A二次实配"] = dataTable.Compute("min(罐A二次实配)", "");
|
|
|
|
|
drowMin["罐B二次应配"] = dataTable.Compute("min(罐B二次应配)", "");
|
|
|
|
|
drowMin["罐B二次实配"] = dataTable.Compute("min(罐B二次实配)", "");
|
|
|
|
|
//drowMin["VCC及GFA卸料速度"] = dataTable.Compute("min(VCC及GFA卸料速度)", "");
|
|
|
|
|
drowMin["混料运行速度"] = dataTable.Compute("min(混料运行速度)", "");
|
|
|
|
|
drowMin["混合机卸料速度"] = dataTable.Compute("min(混合机卸料速度)", "");
|
|
|
|
|
drowMin["混料运行时间"] = dataTable.Compute("min(混料运行时间)", "");
|
|
|
|
|
//drowMin["系数"] = dataTable.Compute("min(系数)", "");
|
|
|
|
|
DataRow drowAvg = dataTable.NewRow();
|
|
|
|
|
drowAvg["记录时间"] = "平均值";
|
|
|
|
|
drowAvg["罐A应配"] = dataTable.Compute("avg(罐A应配)", "");
|
|
|
|
|
drowAvg["罐A实配"] = dataTable.Compute("avg(罐A实配)", "");
|
|
|
|
|
drowAvg["罐B应配"] = dataTable.Compute("avg(罐B应配)", "");
|
|
|
|
|
drowAvg["罐B实配"] = dataTable.Compute("avg(罐B实配)", "");
|
|
|
|
|
drowAvg["树脂应配"] = dataTable.Compute("avg(树脂应配)", "");
|
|
|
|
|
drowAvg["树脂实配"] = dataTable.Compute("avg(树脂实配)", "");
|
|
|
|
|
drowAvg["罐A二次应配"] = dataTable.Compute("avg(罐A二次应配)", "");
|
|
|
|
|
drowAvg["罐A二次实配"] = dataTable.Compute("avg(罐A二次实配)", "");
|
|
|
|
|
drowAvg["罐B二次应配"] = dataTable.Compute("avg(罐B二次应配)", "");
|
|
|
|
|
drowAvg["罐B二次实配"] = dataTable.Compute("avg(罐B二次实配)", "");
|
|
|
|
|
//drowAvg["VCC及GFA卸料速度"] = dataTable.Compute("avg(VCC及GFA卸料速度)", "");
|
|
|
|
|
drowAvg["混料运行速度"] = dataTable.Compute("avg(混料运行速度)", "");
|
|
|
|
|
drowAvg["混合机卸料速度"] = dataTable.Compute("avg(混合机卸料速度)", "");
|
|
|
|
|
drowAvg["混料运行时间"] = dataTable.Compute("avg(混料运行时间)", "");
|
|
|
|
|
//drowAvg["系数"] = dataTable.Compute("avg(系数)", "");
|
|
|
|
|
DataRow drowSum = dataTable.NewRow();
|
|
|
|
|
drowSum["记录时间"] = "合计";
|
|
|
|
|
drowSum["罐A应配"] = dataTable.Compute("sum([罐A应配])", "");
|
|
|
|
|
drowSum["罐A实配"] = dataTable.Compute("sum([罐A实配])", "");
|
|
|
|
|
drowSum["罐B应配"] = dataTable.Compute("sum([罐B应配])", "");
|
|
|
|
|
drowSum["罐B实配"] = dataTable.Compute("sum([罐B实配])", "");
|
|
|
|
|
drowSum["树脂应配"] = dataTable.Compute("sum([树脂应配])", "");
|
|
|
|
|
drowSum["树脂实配"] = dataTable.Compute("sum([树脂实配])", "");
|
|
|
|
|
drowSum["罐A二次应配"] = dataTable.Compute("sum([罐A二次应配])", "");
|
|
|
|
|
drowSum["罐A二次实配"] = dataTable.Compute("sum([罐A二次实配])", "");
|
|
|
|
|
drowSum["罐B二次应配"] = dataTable.Compute("sum([罐B二次应配])", "");
|
|
|
|
|
drowSum["罐B二次实配"] = dataTable.Compute("sum([罐B二次实配])", "");
|
|
|
|
|
//drowSum["VCC及GFA卸料速度"] = dataTable.Compute("sum([VCC及GFA卸料速度])", "");
|
|
|
|
|
drowSum["混料运行速度"] = dataTable.Compute("sum([混料运行速度])", "");
|
|
|
|
|
drowSum["混合机卸料速度"] = dataTable.Compute("sum(混合机卸料速度)", "");
|
|
|
|
|
drowSum["混料运行时间"] = dataTable.Compute("sum([混料运行时间])", "");
|
|
|
|
|
//drowSum["系数"] = dataTable.Compute("sum([系数])", "");
|
|
|
|
|
dataTable.Rows.Add(drowMax);
|
|
|
|
|
dataTable.Rows.Add(drowMin);
|
|
|
|
|
dataTable.Rows.Add(drowAvg);
|
|
|
|
|
dataTable.Rows.Add(drowSum);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void DataTableAdd(int mNum)
|
|
|
|
|
{
|
|
|
|
|
//最大值行
|
|
|
|
|
DataRow drowMax = dataTable.NewRow();
|
|
|
|
|
drowMax["Weight_Time"] = "最大值";
|
|
|
|
|
for (int i = 0; i < mNum; i++)
|
|
|
|
|
{
|
|
|
|
|
drowMax["Set_Weight" + (i + 1).ToString()] = dataTable.Compute("max(Set_Weight" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowMax["Set_Error" + (i + 1).ToString()] = dataTable.Compute("max(Set_Error" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowMax["Waste_Time" + (i + 1).ToString()] = dataTable.Compute("max(Waste_Time" + (i + 1).ToString() + ")", "");
|
|
|
|
|
}
|
|
|
|
|
drowMax["SumSet_Weight"] = dataTable.Compute("max(SumSet_Weight)", "");
|
|
|
|
|
drowMax["SumSet_Error"] = dataTable.Compute("max(SumSet_Error)", "");
|
|
|
|
|
drowMax["SumWaste_Time"] = dataTable.Compute("max(SumWaste_Time)", "");
|
|
|
|
|
drowMax["CheckSet_Weight"] = dataTable.Compute("max(CheckSet_Weight)", "");
|
|
|
|
|
drowMax["CheckSet_Error"] = dataTable.Compute("max(CheckSet_Error)", "");
|
|
|
|
|
drowMax["CheckWaste_Time"] = dataTable.Compute("max(CheckWaste_Time)", "");
|
|
|
|
|
//最小值行
|
|
|
|
|
DataRow drowMin = dataTable.NewRow();
|
|
|
|
|
drowMin["Weight_Time"] = "最小值";
|
|
|
|
|
for (int i = 0; i < mNum; i++)
|
|
|
|
|
{
|
|
|
|
|
drowMin["Set_Weight" + (i + 1).ToString()] = dataTable.Compute("min(Set_Weight" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowMin["Set_Error" + (i + 1).ToString()] = dataTable.Compute("min(Set_Error" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowMin["Waste_Time" + (i + 1).ToString()] = dataTable.Compute("min(Waste_Time" + (i + 1).ToString() + ")", "");
|
|
|
|
|
}
|
|
|
|
|
drowMin["SumSet_Weight"] = dataTable.Compute("min(SumSet_Weight)", "");
|
|
|
|
|
drowMin["SumSet_Error"] = dataTable.Compute("min(SumSet_Error)", "");
|
|
|
|
|
drowMin["SumWaste_Time"] = dataTable.Compute("min(SumWaste_Time)", "");
|
|
|
|
|
drowMin["CheckSet_Weight"] = dataTable.Compute("min(CheckSet_Weight)", "");
|
|
|
|
|
drowMin["CheckSet_Error"] = dataTable.Compute("min(CheckSet_Error)", "");
|
|
|
|
|
drowMin["CheckWaste_Time"] = dataTable.Compute("min(CheckWaste_Time)", "");
|
|
|
|
|
//平均值行
|
|
|
|
|
DataRow drowAvg = dataTable.NewRow();
|
|
|
|
|
drowAvg["Weight_Time"] = "平均值";
|
|
|
|
|
for (int i = 0; i < mNum; i++)
|
|
|
|
|
{
|
|
|
|
|
drowAvg["Set_Weight" + (i + 1).ToString()] = dataTable.Compute("avg(Set_Weight" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowAvg["Set_Error" + (i + 1).ToString()] = dataTable.Compute("avg(Set_Error" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowAvg["Waste_Time" + (i + 1).ToString()] = dataTable.Compute("avg(Waste_Time" + (i + 1).ToString() + ")", "");
|
|
|
|
|
}
|
|
|
|
|
drowAvg["SumSet_Weight"] = dataTable.Compute("avg(SumSet_Weight)", "");
|
|
|
|
|
drowAvg["SumSet_Error"] = dataTable.Compute("avg(SumSet_Error)", "");
|
|
|
|
|
drowAvg["SumWaste_Time"] = dataTable.Compute("avg(SumWaste_Time)", "");
|
|
|
|
|
drowAvg["CheckSet_Weight"] = dataTable.Compute("avg(CheckSet_Weight)", "");
|
|
|
|
|
drowAvg["CheckSet_Error"] = dataTable.Compute("avg(CheckSet_Error)", "");
|
|
|
|
|
drowAvg["CheckWaste_Time"] = dataTable.Compute("avg(CheckWaste_Time)", "");
|
|
|
|
|
//合计
|
|
|
|
|
DataRow drowSum = dataTable.NewRow();
|
|
|
|
|
drowSum["Weight_Time"] = "合计";
|
|
|
|
|
for (int i = 0; i < mNum; i++)
|
|
|
|
|
{
|
|
|
|
|
drowSum["Set_Weight" + (i + 1).ToString()] = dataTable.Compute("sum(Set_Weight" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowSum["Set_Error" + (i + 1).ToString()] = dataTable.Compute("sum(Set_Error" + (i + 1).ToString() + ")", "");
|
|
|
|
|
drowSum["Waste_Time" + (i + 1).ToString()] = dataTable.Compute("sum(Waste_Time" + (i + 1).ToString() + ")", "");
|
|
|
|
|
}
|
|
|
|
|
drowSum["SumSet_Weight"] = dataTable.Compute("sum(SumSet_Weight)", "");
|
|
|
|
|
drowSum["SumSet_Error"] = dataTable.Compute("sum(SumSet_Error)", "");
|
|
|
|
|
drowSum["SumWaste_Time"] = dataTable.Compute("sum(SumWaste_Time)", "");
|
|
|
|
|
drowSum["CheckSet_Weight"] = dataTable.Compute("sum(CheckSet_Weight)", "");
|
|
|
|
|
drowSum["CheckSet_Error"] = dataTable.Compute("sum(CheckSet_Error)", "");
|
|
|
|
|
drowSum["CheckWaste_Time"] = dataTable.Compute("sum(CheckWaste_Time)", "");
|
|
|
|
|
|
|
|
|
|
dataTable.Rows.Add(drowMax);
|
|
|
|
|
dataTable.Rows.Add(drowMin);
|
|
|
|
|
dataTable.Rows.Add(drowAvg);
|
|
|
|
|
dataTable.Rows.Add(drowSum);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|