diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 83c110a..e5fc834 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -169,9 +169,6 @@ False ..\..\..\PlugInPlatform\Mesnac.PlugIn.dll - - ..\..\Microsoft.Office.Interop.Excel.dll - diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/BarcodeReport/SelectBarcodeAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/BarcodeReport/SelectBarcodeAction.cs new file mode 100644 index 0000000..db08d43 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/BarcodeReport/SelectBarcodeAction.cs @@ -0,0 +1,77 @@ +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 new file mode 100644 index 0000000..b098b56 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/ExportAction.cs @@ -0,0 +1,82 @@ +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 new file mode 100644 index 0000000..61ac76c --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/InitFormAction.cs @@ -0,0 +1,128 @@ +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 new file mode 100644 index 0000000..cc04579 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/MaterialStatisticsReport/SelectWeightAction.cs @@ -0,0 +1,123 @@ +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/ProductionAnalysisReport/ExportAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/ExportAction.cs new file mode 100644 index 0000000..b73c915 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/ExportAction.cs @@ -0,0 +1,248 @@ +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 new file mode 100644 index 0000000..0260a9f --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/InitFormAction.cs @@ -0,0 +1,28 @@ +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 new file mode 100644 index 0000000..d26d7a8 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionAnalysisReport/SelectAnalysisAction.cs @@ -0,0 +1,344 @@ +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 new file mode 100644 index 0000000..36ad060 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/InitFormAction.cs @@ -0,0 +1,28 @@ +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 new file mode 100644 index 0000000..0e2c90b --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectPlanAction.cs @@ -0,0 +1,112 @@ +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 new file mode 100644 index 0000000..b361f1c --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ProductionReport/SelectRowAction.cs @@ -0,0 +1,537 @@ +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/Controls/Mesnac.Controls.ChemicalWeighing/Resources/解包室动图.psd b/Controls/Mesnac.Controls.ChemicalWeighing/Resources/解包室动图.psd new file mode 100644 index 0000000..5e46de4 Binary files /dev/null and b/Controls/Mesnac.Controls.ChemicalWeighing/Resources/解包室动图.psd differ diff --git a/Main/MCEdit/Data/EventConfig/上辅机/LanguageDefault.xml b/Main/MCEdit/Data/EventConfig/上辅机/LanguageDefault.xml new file mode 100644 index 0000000..f4d0df1 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/LanguageDefault.xml @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/PLC管理.PLC管理.xml b/Main/MCEdit/Data/EventConfig/上辅机/PLC管理.PLC管理.xml new file mode 100644 index 0000000..5b5b329 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/PLC管理.PLC管理.xml @@ -0,0 +1,93 @@ + + + + + + + 实时记录保存 + 实时记录保存 + + + + + 数据存盘 + 数据存盘 + + + + + 数据库写入PLC + 数据库写入PLC + + + + + 文本框写入PLC + 文本框写入PLC + + + + + + 称量参数下载 + 称量参数下载 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/业务测试.xml b/Main/MCEdit/Data/EventConfig/上辅机/业务测试.xml new file mode 100644 index 0000000..32652aa --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/业务测试.xml @@ -0,0 +1,49 @@ + + + + + + 业务测试 + 业务测试 + + + 上辅机业务测试 + 上辅机业务测试 + + + 胶料称变量测试 + 胶料称监控画面变量测试 + + + 浮点数写入测试 + 浮点数写入测试 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/基础数据维护.xml b/Main/MCEdit/Data/EventConfig/上辅机/基础数据维护.xml new file mode 100644 index 0000000..5fe3334 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/基础数据维护.xml @@ -0,0 +1,229 @@ + + + + + + 导入报警参数 + 从老版本上辅机SCHEME.INI文件导入AlarmName信息至Pmt_AlarmInfo表 + + + + + 密炼条件同步 + 同步网络数据库的密炼条件数据 + + + + + 同步班次 + 从网络同步班次数据 + + + 同步班组 + 从网络同步班组数据 + + + + + 添加 + 添加原材料数据 + + + 原材料同步 + 同步网络数据库的原材料数据 + + + 选择罐类别 + 选择罐类别 + + + 日罐选择罐类别 + 日罐选择罐类别 + + + 罐参数选择罐号 + 罐参数选择罐号 + + + + + 同步日罐设置 + 从网络同步日罐物料参数设置 + + + 添加 + 添加日罐信息 + + + 修改 + 修改日罐信息 + + + + + + 添加 + 添加称量物料参数数据 + + + 修改 + 修改称量物料参数数据 + + + 从PLC获取称量物料参数 + 从PLC获取称量物料参数 + + + + + 同步配方类型 + 从网络库同步配方类型数据 + + + 下载所有配方 + 从网络库下载本机台所有配方数据 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/基础数据维护.物料细类.xml b/Main/MCEdit/Data/EventConfig/上辅机/基础数据维护.物料细类.xml new file mode 100644 index 0000000..9b2934d --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/基础数据维护.物料细类.xml @@ -0,0 +1,24 @@ + + + + + + 窗体初始化 + 窗体初始化 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/基础界面.单表界面.xml b/Main/MCEdit/Data/EventConfig/上辅机/基础界面.单表界面.xml new file mode 100644 index 0000000..05d6fcc --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/基础界面.单表界面.xml @@ -0,0 +1,114 @@ + + + + + + 界面初始化 + 界面初始化 + + + 添加 + 添加信息 + + + 删除 + 删除选中的信息 + + + 修改 + 配方管理中的条件信息查询 + + + 查询 + 配方管理中的条件信息查询 + + + 清空界面 + 选择表格中的行 + + + 选择行 + 选择表格中的行 + + + 上一行 + 选择表格中的行 + + + 下一行 + 选择表格中的行 + + + 第一行 + 选择表格中的行 + + + 最后一行 + 选择表格中的行 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/工艺回溯.xml b/Main/MCEdit/Data/EventConfig/上辅机/工艺回溯.xml new file mode 100644 index 0000000..fa9aee0 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/工艺回溯.xml @@ -0,0 +1,24 @@ + + + + + + 工艺回溯 + 工艺回溯 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/工艺配方.配方管理.xml b/Main/MCEdit/Data/EventConfig/上辅机/工艺配方.配方管理.xml new file mode 100644 index 0000000..1444092 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/工艺配方.配方管理.xml @@ -0,0 +1,182 @@ + + + + + + 加载 + 初始化信息 + + + 新建 + 新建 + + + 编辑 + 编辑(配方输入项进入到编辑状态) + + + 只读 + 只读(禁用配方输入项) + + + 保存 + 保存正在编辑的配方 + + + 配方另存 + 当前配方另存 + + + 删除 + 删除当前选中的配方 + + + 选择配方 + 查询选择配方 + + + 全部配方 + 查询全部配方 + + + 正用配方 + 查询正用配方 + + + 停用配方 + 查询停用配方 + + + 作废配方 + 查询作废配方 + + + 配方查询放大器 + 配方查询放大器 + + + 更新配方 + 从网络更新当前配方 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/报表.批报表.xml b/Main/MCEdit/Data/EventConfig/上辅机/报表.批报表.xml new file mode 100644 index 0000000..6af4834 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/报表.批报表.xml @@ -0,0 +1,49 @@ + + + + + + 窗体初始化 + 车报表查询条件初始化 + + + 查询 + 车报表查询 + + + 显示明细 + 显示明细 + + + 显示重量明细信息 + 显示重量明细信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/报表.报表设计.xml b/Main/MCEdit/Data/EventConfig/上辅机/报表.报表设计.xml new file mode 100644 index 0000000..9afc280 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/报表.报表设计.xml @@ -0,0 +1,33 @@ + + + + + + 设计器初始化 + 设计器初始化 + + + 通用报表显示 + 通用报表显示 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/报表.物料投放.xml b/Main/MCEdit/Data/EventConfig/上辅机/报表.物料投放.xml new file mode 100644 index 0000000..51674f6 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/报表.物料投放.xml @@ -0,0 +1,43 @@ + + + + + + 物料投放初始化 + 物料投放初始化 + + + 物料投放查询 + 物料投放查询 + + + 打印预览 + 打印预览 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/报表.车报表.xml b/Main/MCEdit/Data/EventConfig/上辅机/报表.车报表.xml new file mode 100644 index 0000000..c3aae5d --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/报表.车报表.xml @@ -0,0 +1,149 @@ + + + + + + 窗体初始化 + 车报表查询条件初始化 + + + 查询 + 车报表查询 + + + 首条 + 首页 + + + 上一条 + 上一条 + + + 下一条 + 下一条 + + + 末条 + 末条 + + + 初始化曲线图 + 初始化曲线图 + + + 报表明细 + 报表明细 + + + 刷新配方列表 + 刷新配方列表(包括车报表和批报表) + + + 复位 + 复位 + + + 左移 + 左移 + + + 右移 + 右移 + + + 放大 + 放大 + + + 缩小 + 缩小 + + + 上移 + 上移 + + + 下移 + 下移 + + + + + + + + + + v + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/数据回放.xml b/Main/MCEdit/Data/EventConfig/上辅机/数据回放.xml new file mode 100644 index 0000000..01a8947 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/数据回放.xml @@ -0,0 +1,59 @@ + + + + + + 播放 + 数据回访 + + + + + 暂停 + 数据回访 + + + + + 二倍速 + 数据回访 + + + + + 四倍速 + 数据回访 + + + + + 半倍速 + 数据回访 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/日志.报警日志.xml b/Main/MCEdit/Data/EventConfig/上辅机/日志.报警日志.xml new file mode 100644 index 0000000..a347cee --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/日志.报警日志.xml @@ -0,0 +1,53 @@ + + + + + + 系统报警日志初始化 + 系统报警日志初始化 + + + 系统报警日志查询 + 系统报警日志查询 + + + 导出报警日志 + 导出报警日志到Excel中 + + + + + 控件报警事件 + 控件报警事件处理 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/日志.系统日志.xml b/Main/MCEdit/Data/EventConfig/上辅机/日志.系统日志.xml new file mode 100644 index 0000000..6e3dcef --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/日志.系统日志.xml @@ -0,0 +1,42 @@ + + + + + + 系统日志初始化 + 系统日志初始化 + + + 系统日志查询 + 系统日志查询 + + + 导出系统日志 + 导出系统日志到Excel + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/生产管理.xml b/Main/MCEdit/Data/EventConfig/上辅机/生产管理.xml new file mode 100644 index 0000000..775e025 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/生产管理.xml @@ -0,0 +1,82 @@ + + + + + + 修改次数 + 修改生产计划数 + + + + + 配方重传 + 重新下配方 + + + + + 系统复位 + 系统复位 + + + + + 终止称量 + 终止称量 + + + + + 终止密炼 + 终止密炼 + + + + + 清除存盘标志 + 手动清除存盘标志 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/生产计划.xml b/Main/MCEdit/Data/EventConfig/上辅机/生产计划.xml new file mode 100644 index 0000000..5328821 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/生产计划.xml @@ -0,0 +1,64 @@ + + + + + + 计划执行 + 执行生产计划 + + + + + 暂停计划 + 暂停生产计划 + + + + + 修改生产数量 + 修改生产数量 + + + + + 修改称重次数 + 修改称重次数 + + + + + 输入条码 + 手动输入条码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/生产计划.当班计划.xml b/Main/MCEdit/Data/EventConfig/上辅机/生产计划.当班计划.xml new file mode 100644 index 0000000..4777d0e --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/生产计划.当班计划.xml @@ -0,0 +1,155 @@ + + + + + + 窗体初始化 + 绑定班次、绑定网络版生产计划 + + + 胶称画面计划列表初始化 + 初始化并刷新胶料称监控画面计划列表数据 + + + 刷新 + 刷新网络计划 + + + 选择接收 + 选择接收 网络计划 + + + 全部接收 + 全部接收 网络计划 + + + 修改 + 修改 本地计划 + + + 添加 + 添加 本地计划 + + + 删除 + 删除 本地计划 + + + 上移 + 上移 本地计划 + + + 下移 + 下移 本地计划 + + + 执行计划日期班次校验 + 执行计划日期班次校验 + + + 设置计划执行方式 + 设置计划执行方式 + + + 拆分计划(换班) + 换班时拆分计划 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/系统初始化.xml b/Main/MCEdit/Data/EventConfig/上辅机/系统初始化.xml new file mode 100644 index 0000000..0178c42 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/系统初始化.xml @@ -0,0 +1,54 @@ + + + + + + 判断是否能连接网络库 + 判断是否能连接网络库,否则自动转化为单机版 + + + 系统数据初始化 + 初始化缓存的系统数据:配方、称量... + + + 存盘扫描 + 循环处理存盘业务 + + + + Socket接收处理 + 接收到Socket客户端消息后,进行相应业务处理 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/系统工具.xml b/Main/MCEdit/Data/EventConfig/上辅机/系统工具.xml new file mode 100644 index 0000000..b60ff18 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/系统工具.xml @@ -0,0 +1,33 @@ + + + + + + 计算器 + 调用系统计算器 + + + 同步网络时间 + 同步网络服务器的系统时间 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/系统设置.xml b/Main/MCEdit/Data/EventConfig/上辅机/系统设置.xml new file mode 100644 index 0000000..2f0a891 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/系统设置.xml @@ -0,0 +1,54 @@ + + + + + + 设置为网络方式运行 + 设置为网络方式运行 + + + 设置为单机方式运行 + 设置为网络方式运行 + + + + + 窗体初始化 + 清除历史存盘数据界面初始化 + + + 清除历史存盘数据 + 执行清除历史存盘数据操作 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/系统配置.权限管理.xml b/Main/MCEdit/Data/EventConfig/上辅机/系统配置.权限管理.xml new file mode 100644 index 0000000..aa391e1 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/系统配置.权限管理.xml @@ -0,0 +1,122 @@ + + + + + + 窗体初始化 + 绑定角色、绑定角色权限树 + + + 权限初始化 + 根据工程文件填充权限基本信息 + + + 权限刷新 + 根据所选角色刷新权限树信息 + + + 权限保存 + 保存角色具有的权限信息 + + + 保存为默认权限 + 保存为默认权限信息 + + + 勾选所有权限项 + 勾选树形控件的所有权限项 + + + 勾选默认权限项 + 勾选树形控件的默认权限项 + + + 取消勾选所有权限项 + 取消勾选树形控件的所有权限项 + + + + + 通用权限控制 + 根据权限处理界面控件 + + + 通用权限验证 + 系统登录与权限验证 + + + 重新登录 + 重新登录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/上辅机/系统配置.通用配置.xml b/Main/MCEdit/Data/EventConfig/上辅机/系统配置.通用配置.xml new file mode 100644 index 0000000..d49503d --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/上辅机/系统配置.通用配置.xml @@ -0,0 +1,39 @@ + + + + + + 加载 + 初始化信息 + + + 保存 + 保存 + + + PLC类型 + PLC类型 + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Main/MCEdit/Data/EventConfig/小料称量/工程调试.xml b/Main/MCEdit/Data/EventConfig/小料称量/工程调试.xml new file mode 100644 index 0000000..457af53 --- /dev/null +++ b/Main/MCEdit/Data/EventConfig/小料称量/工程调试.xml @@ -0,0 +1,31 @@ + + + + + + 初始化界面 + 初始化界面 + + + 打开 + 打开 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file