diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/DayWhiteEmbryoInitDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/DayWhiteEmbryoInitDb.cs
index 1eaf533..0e7c885 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/DayWhiteEmbryoInitDb.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/DayWhiteEmbryo/DayWhiteEmbryoInitDb.cs
@@ -46,7 +46,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
dataGridView = control.FirstOrDefault(x => x.Name == "MCDataGridView1") as DataGridView;
dataGridView.AutoGenerateColumns = true;
- mCDateTimePicker.Value = DateTime.Now.AddDays(-1);
+ mCDateTimePicker.Value = DateTime.Now.AddDays(0);
dt=new DataTable();
dt.Columns.Add("机台",typeof(string));
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/OpenDoor/OpenDoorEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/OpenDoor/OpenDoorEntity.cs
new file mode 100644
index 0000000..2bc5a1f
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjReport/OpenDoor/OpenDoorEntity.cs
@@ -0,0 +1,63 @@
+using FreeSql.DataAnnotations;
+using FreeSql.Extensions.EntityUtil;
+
+using Microsoft.Office.Interop.Excel;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor
+{
+ [Table(Name = "OpenDoor")]
+ public class OpenDoorEntity
+ {
+ [Column(IsPrimary = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 设备编号
+ ///
+ public int? DeviceId { get; set; }
+
+
+ ///
+ /// 有料的时间
+ ///
+ public DateTime? OpenTime { get; set; }
+
+
+ ///
+ /// 当前时间
+ ///
+ public DateTime? CreateTime { get; set; }
+
+
+ ///
+ /// 状态
+ ///
+ public int Status { get; set; }
+ }
+
+
+ public class OpenDoorService
+ {
+ public static void Insert(OpenDoorEntity entity)
+ {
+ var ctx= FreeDb.FreeSqlUnit.Instance;
+
+ var openDoorEntity = ctx.Queryable().Where(x => x.Status == entity.Status)
+ .Where(x => x.DeviceId == entity.DeviceId).OrderByDescending(x => x.CreateTime)
+ .Limit(1).ToOne();
+
+ if (openDoorEntity == null || entity.Status!=openDoorEntity.Status)
+ {
+ ctx.Insert(entity).ExecuteInserted();
+ }
+
+
+ }
+ }
+}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs
index 04395ee..af14528 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs
@@ -8,6 +8,7 @@ using Mesnac.Action.ChemicalWeighing.FreeDb;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking;
using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity;
using Mesnac.Action.ChemicalWeighing.LjMaterial;
+using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor;
using Mesnac.Basic;
using Mesnac.Controls.Base;
using Mesnac.Core.Service;
@@ -178,6 +179,15 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl
private void Time(int deviceNo,int statu)
{
+
+ OpenDoorService.Insert(new OpenDoorEntity()
+ {
+ DeviceId = deviceNo,
+ OpenTime = DateTime.Now,
+ CreateTime = DateTime.Now,
+ Status = statu
+ });
+
TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity()
{
reqCode = System.Guid.NewGuid().ToString(),
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
index 32727d9..ac30446 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
@@ -466,6 +466,7 @@
+
Form
@@ -609,6 +610,7 @@
+
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/BarcodeReport/SelectBarcodeAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/BarcodeReport/SelectBarcodeAction.cs
deleted file mode 100644
index db08d43..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/BarcodeReport/SelectBarcodeAction.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using Mesnac.Action.Base;
-using Mesnac.Codd.Session;
-using Mesnac.Controls.Base;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.BarcodeReport
-{
- ///
- /// 查询条码扫描信息
- ///
- class SelectBarcodeAction : ChemicalWeighingAction, IAction
- {
- private RuntimeParameter _runtime;
- private IBaseControl _startdate = null; //开始日期
- private IBaseControl _enddate = null; //结束日期
- private IBaseControl _starttime = null; //开始时间
- private IBaseControl _endtime = null; //结束时间
- private DbMCControl _clientDGV = null;
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime);
- this._runtime = runtime;
- ICSharpCode.Core.LoggingService.Debug("条码扫描信息报表-查询..");
-
- DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
- dbHelper.ClearParameter();
-
- StringBuilder sbSql = new StringBuilder(@"SELECT *, CASE Scan_State WHEN '1' THEN '通过' ELSE '不通过' END AS 'state' FROM LR_BarcodeLog WHERE 1=1 ");
-
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- //开始时间条件
- this._startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
- this._starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- if (_startdate != null && _starttime != null)
- {
- sbSql.AppendLine(@"And Scan_Time >= '" + Convert.ToDateTime(_startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_starttime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{条码扫描信息报表} 缺少key值为startdate或者starttime的时间查询条件...");
- return;
- }
- //结束时间条件
- this._enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
- this._endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- if (_enddate != null && _endtime != null)
- {
- sbSql.AppendLine(@"And Scan_Time <= '" + Convert.ToDateTime(_enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_endtime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{条码扫描信息报表} 缺少key值为enddate或者enddate的时间查询条件...");
- return;
- }
-
- dbHelper.CommandText = sbSql.ToString();
- dbHelper.CommandType = System.Data.CommandType.Text;
- DataTable table = dbHelper.ToDataTable();
-
- this._clientDGV = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "LR_BarcodeLog").FirstOrDefault();
- if (_clientDGV == null || !(_clientDGV.BaseControl is DataGridView))
- {
- ICSharpCode.Core.LoggingService.Warn("{条码扫描信息报表-查询} 缺少DataGridView控件...");
- runtime.IsReturn = false;
- return;
- }
- _clientDGV.BaseControl.BindDataSource = null;
- _clientDGV.BaseControl.BindDataSource = table;
- }
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/ExportAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/ExportAction.cs
deleted file mode 100644
index b098b56..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/ExportAction.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using ICSharpCode.Core;
-using Mesnac.Action.Base;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.MaterialStatisticsReport
-{
- ///
- /// 导出物料统计报表业务
- ///
- class ExportAction : ChemicalWeighingAction, IAction
- {
- private DbMCControl _clientDGV = null;
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime); //必须要调用的
- ICSharpCode.Core.LoggingService.Debug("物料统计-导出...");
-
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.Filter = "xls files(*.xls)|*.xls";
- sfd.FileName = String.Format("物料统计报表_{0:yyyyMMdd}", DateTime.Now);
- sfd.AddExtension = true;
- DialogResult result = sfd.ShowDialog();
- if (result == DialogResult.OK)
- {
- this._clientDGV = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "LR_weigh").FirstOrDefault();
- if (_clientDGV == null || !(_clientDGV.BaseControl is DataGridView))
- {
- ICSharpCode.Core.LoggingService.Warn("{物料统计报表-导出} 缺少DataGridView控件...");
- runtime.IsReturn = false;
- return;
- }
- DataTable dt = _clientDGV.BaseControl.BindDataSource as DataTable;
- dt.Columns["Recipe_Name"].ColumnName = "配方名";
- dt.Columns["Material_Code"].ColumnName = "物料代码";
- dt.Columns["Material_name"].ColumnName = "物料名";
- dt.Columns["realWeight"].ColumnName = "重量(kg)";
- string fileName = sfd.FileName;
- if (!String.IsNullOrEmpty(fileName))
- {
- try
- {
- System.IO.Stream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
- Mesnac.Basic.DataToFileHandler.Instance.ToExcel(dt, ref fs);
- fs.Close();
- string msg1 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Report_MaterialStatisticsReport_ExportAction_msg1")); //导出物料统计数据至Excel成功!
- ICSharpCode.Core.LoggingService.Info(msg1);
-
- #region 记录操作日志
-
- base.DBLog(msg1);
-
- #endregion
-
- MessageBox.Show(msg1, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- catch (Exception ex)
- {
- string msg2 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Report_MaterialStatisticsReport_ExportAction_msg2")); //导出物料统计数据至Excel失败:{0}!
- msg2 = String.Format(msg2, ex.Message);
- ICSharpCode.Core.LoggingService.Error(msg2);
-
- #region 记录操作日志
-
- base.DBLog(msg2);
-
- #endregion
-
- MessageBox.Show(msg2, Mesnac.Basic.LanguageHelper.WarnCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- runtime.IsReturn = true;
- return;
- }
- }
- }
- }
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/InitFormAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/InitFormAction.cs
deleted file mode 100644
index 61ac76c..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/InitFormAction.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-using Mesnac.Action.Base;
-using Mesnac.Action.ChemicalWeighing.MaterialManage;
-using Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe;
-using Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe.entity;
-using Mesnac.Codd.Session;
-using Mesnac.Controls.Base;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.MaterialStatisticsReport
-{
- public class InitFormAction : ChemicalWeighingAction, IAction
- {
- private DbMCControl _dgvLRPlan = null;
- private IBaseControl _startdate = null; //开始日期
- private IBaseControl _enddate = null; //结束日期
- private IBaseControl _starttime = null; //开始时间
- private IBaseControl _endtime = null; //结束时间
- private DbMCControl _clientDGV = null;
- private IBaseControl _recipeName = null; //配方名
- private string[] DataTypeArray = { "--", "早", "中", "晚" };
- private string[] materialDataTypeArray;
- private string[] recipeDataTypeArray;
-
-
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime); //必须要调用的
- ICSharpCode.Core.LoggingService.Debug("生产报表-窗体初始化...");
-
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- IBaseControl starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- IBaseControl endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- starttime.MCValue = DateTime.Parse("00:00:00");
- endtime.MCValue = DateTime.Parse("23:59:59");
- this._recipeName = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "[DataSource1].[Base_RecipeInfo].[recipe_Name]").FirstOrDefault().BaseControl;
-
- #region 下拉框班次加载
- ComboBox comboBox1 = base.GetControlById("MCCombobox1") as ComboBox;
- List DataType = new List(DataTypeArray);
- comboBox1.DataSource = DataType;
- #endregion
- #region 下拉框物料名称加载
- List base_MaterialInfos = MaterialHelper.getMaterialList();
- materialDataTypeArray = new string[base_MaterialInfos.Count + 1];
- materialDataTypeArray[0] = "--";
- for (int i = 0; i < base_MaterialInfos.Count; i++)
- {
- materialDataTypeArray[i + 1] = base_MaterialInfos[i].materialName;
- }
- ComboBox comboBox2 = base.GetControlById("MCCombobox3") as ComboBox;
- comboBox2.DataSource = materialDataTypeArray;
- #endregion
- #region 下拉框配方名称加载
- ComboBox comboBox3 = base.GetControlById("MCCombobox2") as ComboBox;
- List base_RecipeInfos = RecipeHelper.GetBaseRecipeInfo();
- recipeDataTypeArray = new string[base_RecipeInfos.Count + 1];
- recipeDataTypeArray[0] = "--";
- for (int i = 0; i < base_RecipeInfos.Count; i++)
- {
- recipeDataTypeArray[i + 1] = base_RecipeInfos[i].recipeName;
- }
- comboBox3.DataSource = recipeDataTypeArray;
- #endregion
-
-
-
-
-
-
-
- //2.按名称累加物料统计
- DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
- dbHelper.ClearParameter();
-
- StringBuilder sbSql = new StringBuilder(@"SELECT Base_PlanInfo.recipe_Name AS Recipe_Name,Base_MaterialInfo.material_Id AS Material_Code,Base_MaterialInfo.material_Name AS Material_Name, SUM(LR_Weigh.Real_Weight) as realWeight,Pmt_Shiftime.Shift_name FROM
- LR_weigh,Base_PlanInfo,Base_RecipeInfo,Base_MaterialInfo,Pmt_Shiftime
-WHERE Base_PlanInfo.plan_Id = LR_weigh.Plan_id AND Base_MaterialInfo.material_Id = LR_weigh.Material_Code AND Base_RecipeInfo.recipe_Id = LR_weigh.Recipe_code AND Pmt_Shiftime.Shift_id = Base_PlanInfo.plan_Team ");
-
- //开始时间条件
- this._startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
- this._starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- if (_startdate != null && _starttime != null)
- {
- sbSql.AppendLine(@"And LR_Weigh.Weight_Time >= '" + Convert.ToDateTime(_startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_starttime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{物料统计报表} 缺少key值为startdate或者starttime的时间查询条件...");
- return;
- }
- //结束时间条件
- this._enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
- this._endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- if (_enddate != null && _endtime != null)
- {
- sbSql.AppendLine(@"And LR_Weigh.Weight_Time <= '" + Convert.ToDateTime(_enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_endtime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{物料统计报表} 缺少key值为enddate或者enddate的时间查询条件...");
- return;
- }
-
-
- sbSql.Append(" GROUP BY Base_PlanInfo.recipe_Name,Base_MaterialInfo.material_Id,Base_MaterialInfo.material_Name,Pmt_Shiftime.Shift_name");
-
- dbHelper.CommandText = sbSql.ToString();
- dbHelper.CommandType = System.Data.CommandType.Text;
- DataTable table = dbHelper.ToDataTable();
-
- this._clientDGV = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "LR_weigh").FirstOrDefault();
- if (_clientDGV == null || !(_clientDGV.BaseControl is DataGridView))
- {
- ICSharpCode.Core.LoggingService.Warn("{物料统计报表-查询} 缺少DataGridView控件...");
- runtime.IsReturn = false;
- return;
- }
- _clientDGV.BaseControl.BindDataSource = null;
- _clientDGV.BaseControl.BindDataSource = table;
- }
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/SelectWeightAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/SelectWeightAction.cs
deleted file mode 100644
index cc04579..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/SelectWeightAction.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-using Mesnac.Action.Base;
-using Mesnac.Action.ChemicalWeighing.Test;
-using Mesnac.Codd.Session;
-using Mesnac.Controls.Base;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.MaterialStatisticsReport
-{
- ///
- /// 物料统计报表
- ///
- class SelectWeightAction : ChemicalWeighingAction, IAction
- {
- public static event EventHandler MaterialSynchronousComplete;
- private RuntimeParameter _runtime;
- private IBaseControl _startdate = null; //开始日期
- private IBaseControl _enddate = null; //结束日期
- private IBaseControl _starttime = null; //开始时间
- private IBaseControl _endtime = null; //结束时间
- private DbMCControl _clientDGV = null;
- private IBaseControl _recipeName = null; //配方名
- private IBaseControl _shiftName = null; //班次
- private IBaseControl _materialName = null; //物料名称
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime);
- this._runtime = runtime;
- ICSharpCode.Core.LoggingService.Debug("物料统计报表-查询..");
- //1.按配方、按时间、按班次物料统计
- //ComboBox comboBox = base.GetControlById("MCCombobox1") as ComboBox;
- //if (SelectWeightAction.MaterialSynchronousComplete != null)
- //{
- // SelectWeightAction.MaterialSynchronousComplete(null, EventArgs.Empty);
- //}
-
-
-
- //2.按名称累加物料统计
- DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
- dbHelper.ClearParameter();
-
- StringBuilder sbSql = new StringBuilder(@"SELECT Base_PlanInfo.recipe_Name AS Recipe_Name,Base_MaterialInfo.material_Id AS Material_Code,Base_MaterialInfo.material_Name AS Material_Name, SUM(LR_Weigh.Real_Weight) as realWeight,Pmt_Shiftime.Shift_name FROM
- LR_weigh,Base_PlanInfo,Base_RecipeInfo,Base_MaterialInfo,Pmt_Shiftime
-WHERE Base_PlanInfo.plan_Id = LR_weigh.Plan_id AND Base_MaterialInfo.material_Id = LR_weigh.Material_Code AND Base_RecipeInfo.recipe_Id = LR_weigh.Recipe_code AND Pmt_Shiftime.Shift_id = Base_PlanInfo.plan_Team ");
-
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- //开始时间条件
- this._startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
- this._starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- if (_startdate != null && _starttime != null)
- {
- sbSql.AppendLine(@"And LR_Weigh.Weight_Time >= '" + Convert.ToDateTime(_startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_starttime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{物料统计报表} 缺少key值为startdate或者starttime的时间查询条件...");
- return;
- }
- //结束时间条件
- this._enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
- this._endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- if (_enddate != null && _endtime != null)
- {
- sbSql.AppendLine(@"And LR_Weigh.Weight_Time <= '" + Convert.ToDateTime(_enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_endtime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{物料统计报表} 缺少key值为enddate或者enddate的时间查询条件...");
- return;
- }
- //配方名称、物料名称及班次
- this._recipeName = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "[DataSource1].[Base_RecipeInfo].[recipe_Name]").FirstOrDefault().BaseControl;
- this._shiftName = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "[DataSource1].[Pmt_Shiftime].[Shift_name]").FirstOrDefault().BaseControl;
-
- this._materialName = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "[DataSource1].[Base_MaterialInfo].[material_Name]").FirstOrDefault().BaseControl;
-
- if (!String.IsNullOrEmpty(this._recipeName.MCValue.ToString()))
- {
- if (_recipeName.MCValue.ToString() != "--")
- {
- sbSql.AppendLine(@"And Base_PlanInfo.Recipe_Name = '" + _recipeName.MCValue.ToString() + "' ");
- }
- }
- if (!String.IsNullOrEmpty(this._shiftName.MCValue.ToString()))
- {
- if (_shiftName.MCValue.ToString() != "--")
- {
- sbSql.AppendLine(@"And Shift_Name = '" + _shiftName.MCValue.ToString() + "' ");
- }
- }
- if (!String.IsNullOrEmpty(this._materialName.MCValue.ToString()))
- {
- if (_materialName.MCValue.ToString() != "--")
- {
- sbSql.AppendLine(@"And Material_Name = '" + _materialName.MCValue.ToString() + "' ");
- }
- }
-
-
- sbSql.Append(" GROUP BY Base_PlanInfo.recipe_Name,Base_MaterialInfo.material_Id,Base_MaterialInfo.material_Name,Pmt_Shiftime.Shift_name");
-
- dbHelper.CommandText = sbSql.ToString();
- dbHelper.CommandType = System.Data.CommandType.Text;
- DataTable table = dbHelper.ToDataTable();
-
- this._clientDGV = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "LR_weigh").FirstOrDefault();
- if (_clientDGV == null || !(_clientDGV.BaseControl is DataGridView))
- {
- ICSharpCode.Core.LoggingService.Warn("{物料统计报表-查询} 缺少DataGridView控件...");
- runtime.IsReturn = false;
- return;
- }
- _clientDGV.BaseControl.BindDataSource = null;
- _clientDGV.BaseControl.BindDataSource = table;
- }
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/OpenDoor/OpenDoor.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/OpenDoor/OpenDoor.cs
new file mode 100644
index 0000000..6e9c8c9
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/OpenDoor/OpenDoor.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Mesnac.Action.ChemicalWeighing.Report.OpenDoor
+{
+ //public class OpenDoorEntity
+ //{
+ //}
+}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/ExportAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/ExportAction.cs
deleted file mode 100644
index b73c915..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/ExportAction.cs
+++ /dev/null
@@ -1,248 +0,0 @@
-using ICSharpCode.Core;
-using Mesnac.Action.Base;
-using Mesnac.Controls.Base;
-using Microsoft.Office.Interop.Excel;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.ProductionAnalysisReport
-{
- ///
- /// 生产分析报表导出业务
- ///
- class ExportAction : ChemicalWeighingAction, Base.IAction
- {
- private IBaseControl _startdate = null; //开始日期
- private IBaseControl _enddate = null; //结束日期
- private IBaseControl _starttime = null; //开始时间
- private IBaseControl _endtime = null; //结束时间
- private DbMCControl _recipeNameControl = null; //配方名Combobox控件
- private Control _clientDGV = null; //生产分析DGV
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime); //必须要调用的
- ICSharpCode.Core.LoggingService.Debug("生产分析报表-导出...");
-
- #region 时间配方名控件
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- //开始时间条件
- this._startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
- this._starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- if (_startdate == null && _starttime == null)
- {
- ICSharpCode.Core.LoggingService.Debug("{生产分析报表} 缺少key值为startdate或者starttime的时间查询条件...");
- return;
- }
- string start = Convert.ToDateTime(_startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_starttime.MCValue).ToShortTimeString();
-
- //结束时间条件
- this._enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
- this._endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- if (_enddate == null && _endtime == null)
- {
- ICSharpCode.Core.LoggingService.Debug("{生产分析报表} 缺少key值为enddate或者enddate的时间查询条件...");
- return;
- }
- string end = Convert.ToDateTime(_enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_endtime.MCValue).ToShortTimeString();
-
- this._recipeNameControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[Pmt_recipe].[Recipe_Name]").FirstOrDefault();
- if (_recipeNameControl == null)
- {
- ICSharpCode.Core.LoggingService.Warn("{生产分析报表} 缺少配方名控件...");
- runtime.IsReturn = false;
- return;
- }
- ComboBox recipeNameCB = this._recipeNameControl.BaseControl as ComboBox;
- #endregion
-
-
- List PlanIds = ReportHelper.GetPlanIDList(start, end, recipeNameCB.Text);
- string lR_planID = PlanIds[0];
- string lR_reName = recipeNameCB.Text;
-
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.Filter = "xls files(*.xls)|*.xls";
- sfd.FileName = String.Format("生产分析报表_{0:yyyyMMdd}", DateTime.Now);
- sfd.AddExtension = true;
- DialogResult result = sfd.ShowDialog();
- if (result == DialogResult.OK)
- {
-
- bool gridFlag = false;
- foreach (Control ib in GetAllControls())
- {
-
- if (ib.Name.Contains("MultiColHeaderDgv"))
- {
- this._clientDGV = ib;
- gridFlag = true;
- }
- if (gridFlag)
- {
- break;
- }
- }
- if (_clientDGV == null)
- {
- ICSharpCode.Core.LoggingService.Warn("{生产分析报表-导出} 缺少DataGridView控件...");
- runtime.IsReturn = false;
- return;
- }
- Mesnac.Controls.Default.MultiColHeaderDgv clientGrid = (this._clientDGV as Mesnac.Controls.Default.MultiColHeaderDgv);
- System.Data.DataTable dt = clientGrid.DataSource as System.Data.DataTable;
-
- string fileName = sfd.FileName;
- if (!String.IsNullOrEmpty(fileName))
- {
- try
- {
- List lR_Recipes = ReportHelper.GetLR_recipeList(lR_planID);
-
- DataTabletoExcel(dt, fileName, lR_Recipes, lR_reName);
-
- string msg1 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Report_ProductionAnalysisReport_ExportAction_msg1")); //导出生产分析报表数据至Excel成功!
- ICSharpCode.Core.LoggingService.Info(msg1);
-
- #region 记录操作日志
-
- base.DBLog(msg1);
-
- #endregion
-
- MessageBox.Show(msg1, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- catch (Exception ex)
- {
- string msg2 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Report_ProductionAnalysisReport_ExportAction_msg2")); //导出生产分析数据至Excel失败:{0}!
- msg2 = String.Format(msg2, ex.Message);
- ICSharpCode.Core.LoggingService.Error(msg2);
-
- #region 记录操作日志
-
- base.DBLog(msg2);
-
- #endregion
-
- MessageBox.Show(msg2, Mesnac.Basic.LanguageHelper.WarnCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- runtime.IsReturn = true;
- return;
- }
- }
- }
-
-
- }
- public void DataTabletoExcel(System.Data.DataTable tmpDataTable, string strFileName, List lR_Recipes, string reName)
- {
- ///先得到datatable的行数
- int rowNum = tmpDataTable.Rows.Count;
- ///列数
- int columnNum = tmpDataTable.Columns.Count;
- ///声明一个应用程序类实例
- Microsoft.Office.Interop.Excel.Application xlApp = new ApplicationClass();
-
- //创建一个新工作簿
- Workbook xlBook = xlApp.Workbooks.Add();
- ///在工作簿中得到sheet。
- _Worksheet oSheet = (_Worksheet)xlBook.Worksheets[1];
-
- #region 绘制列
-
- //绘制配方名和开始时间
- oSheet.Cells[1, 1] = "配方名";
- oSheet.Cells[1, 2] = reName;
-
- //自定义方法,绘制合并表头
- RangeBuild(oSheet, oSheet.Cells[2, 1], oSheet.Cells[2, 2], "物料");
- oSheet.Cells[3, 1] = "车次";
- oSheet.Cells[3, 2] = "检量时间";
-
- decimal sumSet_Weight = 0.0M;
- decimal sumSet_Error = 0.0M;
-
- int ordinate = 3;
- if (lR_Recipes != null && lR_Recipes.Count > 0)
- {
- //物料表头
- for (int i = 0; i < lR_Recipes.Count; i++)
- {
- sumSet_Weight += (decimal)lR_Recipes[i].Set_Weight;
- sumSet_Error += (decimal)lR_Recipes[i].Set_Error;
-
- RangeBuild(oSheet, oSheet.Cells[2, ordinate], oSheet.Cells[2, ordinate + 2], lR_Recipes[i].Material_Name);
- oSheet.Cells[3, ordinate] = lR_Recipes[i].Set_Weight.ToString("0.000");
- oSheet.Cells[3, ordinate + 1] = lR_Recipes[i].Set_Error.ToString("0.000");
- oSheet.Cells[3, ordinate + 2] = "T(s)";
- ordinate += 3;
- }
-
- //加和重量表头
- RangeBuild(oSheet, oSheet.Cells[2, ordinate], oSheet.Cells[2, ordinate + 2], "加和重量");
- oSheet.Cells[3, ordinate] = sumSet_Weight.ToString();
- oSheet.Cells[3, ordinate + 1] = sumSet_Error.ToString();
- oSheet.Cells[3, ordinate + 2] = "T(s)";
- ordinate += 3;
-
- //检量重量表头
- RangeBuild(oSheet, oSheet.Cells[2, ordinate], oSheet.Cells[2, ordinate + 3], "检量重量");
- oSheet.Cells[3, ordinate] = sumSet_Weight.ToString();
- oSheet.Cells[3, ordinate + 1] = sumSet_Error.ToString();
- oSheet.Cells[3, ordinate + 2] = "T(s)";
- oSheet.Cells[3, ordinate + 3] = "皮重";
- ordinate += 4;
- }
-
- #endregion
-
- //将DataTable中的数据导入Excel中
- for (int i = 0; i < rowNum; i++)
- {
- for (int j = 0; j < columnNum; j++)
- {
- ///excel中的列是从1开始的
- xlApp.Cells[i + 4, j + 1] = tmpDataTable.Rows[i][j].ToString();
- }
- }
- ///保存,路径一块穿进去。否则回到一个很奇妙的地方,貌似是system32里 temp下....
- oSheet.SaveAs(strFileName);
- }
-
- ///
- /// 合并单元格业务方法
- ///
- /// 工作簿中的sheet
- /// 起始cell
- /// 结束cell
- /// 合并后单元格文本
- private static void RangeBuild(_Worksheet oSheet, object startcell, object endcell, string value)
- {
- Range excelRange = oSheet.Range[startcell, endcell];/*需要合并的单元格*/
- ///合并方法
- excelRange.Merge(excelRange.MergeCells);/*合并*/
- ///合并单元格之后,设置其中的文本
- excelRange.Value = value;
-
- //横向居中
- excelRange.HorizontalAlignment = XlVAlign.xlVAlignCenter;
- //字体大小
- //range.Font.Size = 18;
- //字体
- //range.Font.Name = "黑体";
- //行高
- //range.RowHeight = 24;
- //自动调整列宽
- excelRange.EntireColumn.AutoFit();
- //填充颜色
- //range.Interior.ColorIndex = 20;
- //设置单元格边框的粗细
- excelRange.Cells.Borders.LineStyle = 1;
- }
-
-
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/InitFormAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/InitFormAction.cs
deleted file mode 100644
index 0260a9f..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/InitFormAction.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using Mesnac.Action.Base;
-using Mesnac.Controls.Base;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.ProductionAnalysisReport
-{
- ///
- /// 初始化生产分析报表
- ///
- class InitFormAction : ChemicalWeighingAction, IAction
- {
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime); //必须要调用的
- ICSharpCode.Core.LoggingService.Debug("生产报表-窗体初始化...");
-
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- IBaseControl starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- IBaseControl endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- starttime.MCValue = DateTime.Parse("00:00:00");
- endtime.MCValue = DateTime.Parse("23:59:59");
- }
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/SelectAnalysisAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/SelectAnalysisAction.cs
deleted file mode 100644
index d26d7a8..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/SelectAnalysisAction.cs
+++ /dev/null
@@ -1,344 +0,0 @@
-using Mesnac.Action.Base;
-using Mesnac.Controls.Base;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.ProductionAnalysisReport
-{
- ///
- /// 生产质量分析
- ///
- class SelectAnalysisAction : ChemicalWeighingAction, IAction
- {
- #region 字段定义
-
- private RuntimeParameter _runtime;
- private IBaseControl _startdate = null; //开始日期
- private IBaseControl _enddate = null; //结束日期
- private IBaseControl _starttime = null; //开始时间
- private IBaseControl _endtime = null; //结束时间
- private DbMCControl _recipeNameControl = null; //配方名Combobox控件
- private Control _clientGridControl = null; //多维表控件
- private DataTable dataTable = null;
-
- #endregion
-
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime);
- this._runtime = runtime;
-
- #region 获取开始/结束时间控件和质量分析控件
-
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- //开始时间条件
- this._startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
- this._starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- if(_startdate == null && _starttime == null)
- {
- ICSharpCode.Core.LoggingService.Debug("{生产分析报表} 缺少key值为startdate或者starttime的时间查询条件...");
- return;
- }
- string start = Convert.ToDateTime(_startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_starttime.MCValue).ToShortTimeString();
-
- //结束时间条件
- this._enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
- this._endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- if (_enddate == null && _endtime == null)
- {
- ICSharpCode.Core.LoggingService.Debug("{生产分析报表} 缺少key值为enddate或者enddate的时间查询条件...");
- return;
- }
- string end = Convert.ToDateTime(_enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_endtime.MCValue).ToShortTimeString();
-
- this._recipeNameControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[Pmt_recipe].[Recipe_Name]").FirstOrDefault();
- if (_recipeNameControl == null)
- {
- ICSharpCode.Core.LoggingService.Warn("{生产分析报表} 缺少配方名控件...");
- runtime.IsReturn = false;
- return;
- }
- ComboBox recipeNameCB = this._recipeNameControl.BaseControl as ComboBox;
-
- 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.Warn("{生产分析报表} 缺少质量分析MultiColHeaderDgv控件...");
- runtime.IsReturn = false;
- return;
- }
- Mesnac.Controls.Default.MultiColHeaderDgv clientGrid = (this._clientGridControl as Mesnac.Controls.Default.MultiColHeaderDgv);
-
- dataTable = new DataTable("AnalysisDT");
-
- #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);
-
- #endregion
-
- if (!string.IsNullOrEmpty(recipeNameCB.Text))
- {
- List PlanIds = ReportHelper.GetPlanIDList(start,end,recipeNameCB.Text);
- if (PlanIds.Count == 0)
- {
- MessageBox.Show("未查询到该时间段的配方计划信息");
- return;
- }
-
- string lR_planID = PlanIds[0];
-
- List lR_Recipes = ReportHelper.GetLR_recipeList(lR_planID);
- TreeView treeView = new TreeView();
-
- List lR_Lots = ReportHelper.GetAllLR_lotList(PlanIds);
- List lR_Weighs = ReportHelper.GetAllLR_weighList(PlanIds, lR_Recipes.Count);
-
- #region 表头建立
-
- BuildTableHead(treeView, lR_Recipes);
- clientGrid.myColHeaderTreeView = treeView;
-
- #endregion
-
- #region 数据填充
-
- DataTableWrite(lR_Lots, lR_Weighs);
-
- #endregion
-
- #region 增加最大最小平均合计值行
-
- DataTableAdd(lR_Recipes.Count);
-
- #endregion
-
- clientGrid.DataSource = dataTable;
-
- }
- }
-
- #region 建立表头结构
-
- private void BuildTableHead(TreeView treeView, List 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("重量(kg)");
- TreeNode childTreeNodeSet_Error = new TreeNode("误差(kg)");
- TreeNode childTreeNodeWaste_Time = new TreeNode("时间(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("重量(kg)");
- TreeNode childTreeNodeSumSet_Error = new TreeNode("误差(kg)");
- 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("重量(kg)");
- TreeNode childTreeNodeCheckSet_Error = new TreeNode("误差(kg)");
- 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 DataTableWrite(List lR_Lots, List 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 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_weight;
- drow["SumWaste_Time"] = sumRealWaste_Time;
-
- //检量重量数据填入
-
- drow["CheckSet_Weight"] = lR_Lots[i].Real_weight;
- drow["CheckSet_Error"] = lR_Lots[i].Real_weight;
- 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 DataTableAdd(int mNum)
- {
- //最大值行
- DataRow drowMax = dataTable.NewRow();
- drowMax["Weight_Time"] = "最大值";
- for (int i=0; i
- /// 生产报表导出Action
- ///
- class ExportAction : ChemicalWeighingAction, Base.IAction
- {
- private Control _clientDGV = null; //称量明细DGV
- private DbMCControl _dgvLRPlan = null; //生产计划DGV
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime); //必须要调用的
- ICSharpCode.Core.LoggingService.Debug("生产报表-导出...");
-
- this._dgvLRPlan = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Base_PlanInfo").FirstOrDefault();
- DataGridView lR_planGridView = this._dgvLRPlan.BaseControl as DataGridView;
- string lR_planID = lR_planGridView.SelectedRows[0].Cells["plan_Id"].Value as string;
- string lR_reName = lR_planGridView.SelectedRows[0].Cells["recipe_Name"].Value as string;
- string lR_starTime = lR_planGridView.SelectedRows[0].Cells["plan_beginTime"].Value as string;
- string plan_count = Convert.ToInt32(lR_planGridView.SelectedRows[0].Cells["plan_Amount"].Value).ToString();
- string real_count = Convert.ToInt32(lR_planGridView.SelectedRows[0].Cells["real_Amount"].Value).ToString();
- string plan_State = lR_planGridView.SelectedRows[0].Cells["plan_State"].Value as string;
- string plan_endTime = lR_planGridView.SelectedRows[0].Cells["plan_endTime"].Value as string;
- string Shift_Name = lR_planGridView.SelectedRows[0].Cells["Shift_Name"].Value as string;
-
-
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.Filter = "xls files(*.xls)|*.xls";
- sfd.FileName = String.Format("生产报表_{0:yyyyMMdd}", DateTime.Now);
- sfd.AddExtension = true;
- DialogResult result = sfd.ShowDialog();
- if (result == DialogResult.OK)
- {
-
- bool gridFlag = false;
- foreach (Control ib in GetAllControls())
- {
-
- if (ib.Name.Contains("MultiColHeaderDgv"))
- {
- this._clientDGV = ib;
- gridFlag = true;
- }
- if (gridFlag)
- {
- break;
- }
- }
- if (_clientDGV == null)
- {
- ICSharpCode.Core.LoggingService.Warn("{生产报表-导出} 缺少DataGridView控件...");
- runtime.IsReturn = false;
- return;
- }
- Mesnac.Controls.Default.MultiColHeaderDgv clientGrid = (this._clientDGV as Mesnac.Controls.Default.MultiColHeaderDgv);
- System.Data.DataTable dt = clientGrid.DataSource as System.Data.DataTable;
-
- string fileName = sfd.FileName;
- if (!String.IsNullOrEmpty(fileName))
- {
- try
- {
- List lR_Recipes = ReportHelper.GetLR_recipeList(lR_planID);
-
- DataTabletoExcel(dt, fileName, lR_Recipes, lR_planID, lR_reName, plan_count, real_count, plan_State, lR_starTime, plan_endTime, Shift_Name);
- string msg1 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Report_ProductionReport_ExportAction_msg1")); //导出生产报表数据至Excel成功!
- ICSharpCode.Core.LoggingService.Info(msg1);
-
- #region 记录操作日志
-
- base.DBLog(msg1);
-
- #endregion
-
- MessageBox.Show(msg1, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- catch (Exception ex)
- {
- string msg2 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_ChemicalWeighing_Report_ProductionReport_ExportAction_msg2")); //导出生产报表数据至Excel失败:{0}!
- msg2 = String.Format(msg2, ex.Message);
- ICSharpCode.Core.LoggingService.Error(msg2);
-
- #region 记录操作日志
-
- base.DBLog(msg2);
-
- #endregion
-
- MessageBox.Show(msg2, Mesnac.Basic.LanguageHelper.WarnCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- runtime.IsReturn = true;
- return;
- }
- }
- }
-
- }
-
-
- public void DataTabletoExcel(System.Data.DataTable tmpDataTable, string strFileName, List lR_Recipes, string lR_planID , string reName,string plan_count, string real_count, string plan_State, string startTime,string plan_endTime,string Shift_Name)
- {
- ///先得到datatable的行数
- int rowNum = tmpDataTable.Rows.Count;
- ///列数
- int columnNum = tmpDataTable.Columns.Count;
- ///声明一个应用程序类实例
- Microsoft.Office.Interop.Excel.Application xlApp = new ApplicationClass();
-
- //创建一个新工作簿
- Workbook xlBook = xlApp.Workbooks.Add();
- ///在工作簿中得到sheet。
- _Worksheet oSheet = (_Worksheet)xlBook.Worksheets[1];
-
- #region 绘制列
-
- //绘制配方名和开始时间
- oSheet.Cells[1, 1] = "计划号";
- oSheet.Cells[1, 2] = "配方名";
- oSheet.Cells[1, 3] = "计划数量";
- oSheet.Cells[1, 4] = "完成数量";
- oSheet.Cells[1, 5] = "完成数量";
- oSheet.Cells[1, 5] = "计划状态";
- oSheet.Cells[1, 6] = "开始时间";
- oSheet.Cells[1, 7] = "完成时间";
- oSheet.Cells[1, 8] = "计划班组";
- oSheet.Cells[2, 1] = lR_planID;
- oSheet.Cells[2, 2] = reName;
- oSheet.Cells[2, 3] = plan_count;
- oSheet.Cells[2, 4] = real_count;
- oSheet.Cells[2, 5] = plan_State;
- oSheet.Cells[2, 6] = startTime;
- oSheet.Cells[2, 7] = plan_endTime;
- oSheet.Cells[2, 8] = Shift_Name;
-
-
-
- //自定义方法,绘制合并表头
- //RangeBuild(oSheet, oSheet.Cells[2, 1], oSheet.Cells[2, 2], "物料");
- oSheet.Cells[3, 1] = "车数";
- oSheet.Cells[3, 2] = "格数";
- oSheet.Cells[3, 3] = "完成时间";
- oSheet.Cells[3, 4] = "罐A应配";
- oSheet.Cells[3, 5] = "罐A实配";
- oSheet.Cells[3, 6] = "罐B应配";
- oSheet.Cells[3, 7] = "罐B实配";
- oSheet.Cells[3, 8] = "树脂应配";
- oSheet.Cells[3, 9] = "树脂实配";
- //oSheet.Cells[3, 10] = "VCC及GFA卸料速度";
- //oSheet.Cells[3, 11] = "混料运行速度";
- //oSheet.Cells[3, 12] = "混合机卸料速度";
- //oSheet.Cells[3, 13] = "混合机运行时间";
- //oSheet.Cells[3, 14] = "系数";
-
- oSheet.Cells[3, 10] = "混料运行速度";
- oSheet.Cells[3, 11] = "混合机卸料速度";
- oSheet.Cells[3, 12] = "混合机运行时间";
-
-
- decimal sumSet_Weight = 0.0M;
- decimal sumSet_Error = 0.0M;
-
- int ordinate = 3;
- //if (lR_Recipes != null && lR_Recipes.Count > 0)
- //{
- // //物料表头
- // for (int i = 0; i < lR_Recipes.Count; i++)
- // {
- // sumSet_Weight += (decimal)lR_Recipes[i].Set_Weight;
- // sumSet_Error += (decimal)lR_Recipes[i].Set_Error;
-
- // RangeBuild(oSheet, oSheet.Cells[2, ordinate], oSheet.Cells[2, ordinate+2], lR_Recipes[i].Material_Name);
- // oSheet.Cells[3, ordinate] = lR_Recipes[i].Set_Weight.ToString("0.000");
- // oSheet.Cells[3, ordinate+1] = lR_Recipes[i].Set_Error.ToString("0.000");
- // oSheet.Cells[3, ordinate+2] = "T(s)";
- // ordinate += 3;
- // }
-
- // //加和重量表头
- // RangeBuild(oSheet, oSheet.Cells[2, ordinate], oSheet.Cells[2, ordinate + 2], "加和重量");
- // oSheet.Cells[3, ordinate] = sumSet_Weight.ToString();
- // oSheet.Cells[3, ordinate + 1] = sumSet_Error.ToString();
- // oSheet.Cells[3, ordinate + 2] = "T(s)";
- // ordinate += 3;
-
- // //检量重量表头
- // RangeBuild(oSheet, oSheet.Cells[2, ordinate], oSheet.Cells[2, ordinate + 3], "检量重量");
- // oSheet.Cells[3, ordinate] = sumSet_Weight.ToString();
- // oSheet.Cells[3, ordinate + 1] = sumSet_Error.ToString();
- // oSheet.Cells[3, ordinate + 2] = "T(s)";
- // oSheet.Cells[3, ordinate + 3] = "皮重";
- // ordinate += 4;
- //}
-
-
-
- #endregion
-
- //将DataTable中的数据导入Excel中
- for (int i = 0; i < rowNum; i++)
- {
- for (int j = 0; j < columnNum; j++)
- {
- ///excel中的列是从1开始的
- xlApp.Cells[i + 4, j + 1] = tmpDataTable.Rows[i][j].ToString();
- }
- }
- ///保存,路径一块穿进去。否则回到一个很奇妙的地方,貌似是system32里 temp下....
- oSheet.SaveAs(strFileName);
- }
-
- ///
- /// 合并单元格业务方法
- ///
- /// 工作簿中的sheet
- /// 起始cell
- /// 结束cell
- /// 合并后单元格文本
- private static void RangeBuild(_Worksheet oSheet, object startcell, object endcell, string value)
- {
- Range excelRange = oSheet.Range[startcell, endcell];/*需要合并的单元格*/
- ///合并方法
- excelRange.Merge(excelRange.MergeCells);/*合并*/
- ///合并单元格之后,设置其中的文本
- excelRange.Value = value;
-
- //横向居中
- excelRange.HorizontalAlignment = XlVAlign.xlVAlignCenter;
- //字体大小
- //range.Font.Size = 18;
- //字体
- //range.Font.Name = "黑体";
- //行高
- //range.RowHeight = 24;
- //自动调整列宽
- excelRange.EntireColumn.AutoFit();
- //填充颜色
- //range.Interior.ColorIndex = 20;
- //设置单元格边框的粗细
- excelRange.Cells.Borders.LineStyle = 1;
- }
-
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/InitFormAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/InitFormAction.cs
deleted file mode 100644
index 36ad060..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/InitFormAction.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using Mesnac.Action.Base;
-using Mesnac.Controls.Base;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.ProductionReport
-{
- ///
- /// 生产报表初始化窗体
- ///
- class InitFormAction : ChemicalWeighingAction, IAction
- {
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime); //必须要调用的
- ICSharpCode.Core.LoggingService.Debug("生产报表-窗体初始化...");
-
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- IBaseControl starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- IBaseControl endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- starttime.MCValue = DateTime.Parse("00:00:00");
- endtime.MCValue = DateTime.Parse("23:59:59");
- }
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectPlanAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectPlanAction.cs
deleted file mode 100644
index 0e2c90b..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectPlanAction.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-using Mesnac.Action.Base;
-using Mesnac.Codd.Session;
-using Mesnac.Controls.Base;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Mesnac.Action.ChemicalWeighing.Report.ProductionReport
-{
- ///
- /// 生产报表中查询生产计划Action
- ///
- class SelectPlanAction : ChemicalWeighingAction, IAction
- {
-
- private RuntimeParameter _runtime;
- private IBaseControl _equipCode = null; //机台号
- private IBaseControl _version = null; //版本
- private IBaseControl _startdate = null; //开始日期
- private IBaseControl _enddate = null; //结束日期
- private IBaseControl _starttime = null; //开始时间
- private IBaseControl _endtime = null; //结束时间
- private IBaseControl _recipeName = null; //配方名
- private IBaseControl _shiftName = null; //班次
- private DbMCControl _dgvLRPlan = null; //生产计划DGV
-
- public void Run(RuntimeParameter runtime)
- {
- base.RunIni(runtime);
- this._runtime = runtime;
- ICSharpCode.Core.LoggingService.Debug("生产报表-生产计划-查询..");
-
-
- DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
- dbHelper.ClearParameter();
-
- //StringBuilder sbSql = new StringBuilder(@"Select A.Plan_Id,A.Equip_Code,A.Plan_ID,A.Recipe_Code,A.Recipe_Name,A.Version,A.Mixer_Line,A.Plan_num,A.Real_Num,A.Start_Date,A.End_Date,A.Weight_Man,B.Shift_Name
- // From LR_Plan A Left Join Pmt_ShifTime B On(A.Shift_ID = B.Shift_ID) WHERE 1=1 ");
-
- StringBuilder sbSql = new StringBuilder(@"select A.plan_Id,A.recipe_Name,A.plan_Amount,A.real_Amount,case plan_State when '0' then '待执行' when '1' then '执行中' when '2' then '已完成' when '3' then '已终止' else '异常' end as 'plan_State',A.plan_beginTime,A.plan_endTime,B.Shift_name as Shift_Name from Base_PlanInfo A Left Join Pmt_ShifTime B On(A.plan_Team = B.Shift_ID) WHERE 1=1 ");
-
- List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
- //开始时间条件
- this._startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
- this._starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
- if (_startdate != null && _starttime != null)
- {
- sbSql.AppendLine(@"And A.plan_beginTime >= '" + Convert.ToDateTime(_startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_starttime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{生产报表} 缺少key值为startdate或者starttime的时间查询条件...");
- return;
- }
- //结束时间条件
- this._enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
- this._endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
- if (_enddate != null && _endtime != null)
- {
- sbSql.AppendLine(@"And A.plan_beginTime <= '" + Convert.ToDateTime(_enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(_endtime.MCValue).ToShortTimeString() + "' ");
- }
- else
- {
- ICSharpCode.Core.LoggingService.Debug("{生产报表} 缺少key值为enddate或者enddate的时间查询条件...");
- return;
- }
- //配方名和班次条件
- this._recipeName = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "[DataSource1].[Base_RecipeInfo].[recipe_Name]").FirstOrDefault().BaseControl;
- this._shiftName = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "[DataSource1].[Pmt_Shiftime].[Shift_name]").FirstOrDefault().BaseControl;
- if (!String.IsNullOrEmpty(this._recipeName.MCValue.ToString()))
- {
- sbSql.AppendLine(@"And A.Recipe_Name = '" + _recipeName.MCValue.ToString() + "' ");
- }
- if (!String.IsNullOrEmpty(this._shiftName.MCValue.ToString()))
- {
- sbSql.AppendLine(@"And Shift_Name = '" + _shiftName.MCValue.ToString() + "' ");
- }
- //机台号和版本条件
- //this._equipCode = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "EquipCode").FirstOrDefault().BaseControl;
- //this._version = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "version").FirstOrDefault().BaseControl;
- //if (!String.IsNullOrEmpty(this._equipCode.MCValue.ToString()))
- //{
- // sbSql.AppendLine(@"And A.Equip_Code = '" + _equipCode.MCValue.ToString() + "' ");
- //}
- //if (!String.IsNullOrEmpty(this._version.MCValue.ToString()))
- //{
- // sbSql.AppendLine(@"And A.Version = '" + _version.MCValue.ToString() + "' ");
- //}
-
- sbSql.Append(" ORDER BY A.plan_beginTime desc");
-
- dbHelper.CommandText = sbSql.ToString();
- dbHelper.CommandType = System.Data.CommandType.Text;
- DataTable table = dbHelper.ToDataTable();
-
- //刷新生产计划DataGridView数据
- this._dgvLRPlan = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Base_PlanInfo").FirstOrDefault();
- if (_dgvLRPlan == null || !(_dgvLRPlan.BaseControl is DataGridView))
- {
- ICSharpCode.Core.LoggingService.Warn("{生产报表-查询} 缺少生产计划DataGridView控件...");
- runtime.IsReturn = false;
- return;
- }
- _dgvLRPlan.BaseControl.BindDataSource = null;
- _dgvLRPlan.BaseControl.BindDataSource = table;
- }
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectRowAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectRowAction.cs
deleted file mode 100644
index b361f1c..0000000
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectRowAction.cs
+++ /dev/null
@@ -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
-{
- ///
- /// 生产报表业务
- ///
- 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.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.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 lR_Lots = ReportHelper.GetLR_lotList(lR_planID);
- List lR_Recipes = ReportHelper.GetLR_recipeList(lR_planID);
- List lR_Weighs = ReportHelper.GetLR_weighList(lR_planID);
- List 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 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 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 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 lR_Lots, List lR_Recipes, List 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 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
- }
-}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs
index 187f685..0837728 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs
@@ -5,6 +5,9 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
+
+using DevExpress.XtraEditors.Filtering.Templates;
+
using ICSharpCode.Core;
using Mesnac.Action.Base;
@@ -15,6 +18,7 @@ using Mesnac.Action.ChemicalWeighing.LjMixFormula;
using Mesnac.Action.ChemicalWeighing.LjMixManager;
using Mesnac.Action.ChemicalWeighing.LjPlanning;
using Mesnac.Action.ChemicalWeighing.LjProdcutLine;
+using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor;
using Mesnac.Basic;
using Mesnac.Codd.Session;
using Mesnac.Controls.Base;
@@ -27,177 +31,40 @@ namespace Mesnac.Action.ChemicalWeighing.Test
public class TestAction : DatabaseAction, IAction
{
+ MCButton mCButton;
+
public void timer1EventProcessor(object source, EventArgs e)
{
- DataTable dt2 = FreeSqlUnit.Instance.Select