From 02c1e461dd4612fcda8122c98af6c693d8853849 Mon Sep 17 00:00:00 2001 From: wangsr Date: Thu, 28 Sep 2023 17:39:28 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E6=A6=84=E8=8F=8A=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E7=AE=A1=E7=90=86=20=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LjPlanning/DelAction.cs | 4 +- .../LjPlanning/InItDbAction.cs | 19 +++++- .../LjPlanning/SelectAction.cs | 59 ++++++++++++++++++- .../Mesnac.Action.ChemicalWeighing.csproj | 3 - .../Data/MCProject/nodeForm/FormPlan.xml | 4 +- 5 files changed, 77 insertions(+), 12 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DelAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DelAction.cs index 294b701..18824cc 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DelAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DelAction.cs @@ -9,8 +9,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning { private DbMCControl _materialGridControl = null; //物料列表控件 private RuntimeParameter _runtime; - - + + public static event EventHandler OnDelete; public void Run(RuntimeParameter runtime) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/InItDbAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/InItDbAction.cs index e504634..d093fce 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/InItDbAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/InItDbAction.cs @@ -20,6 +20,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning this._runtime = runtime; + AddAction.OnAdd -= Process_Event; AddAction.OnAdd += Process_Event; @@ -30,19 +31,33 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning DownloadAction.OnDown -= Process_Event; DownloadAction.OnDown += Process_Event; + //SelectAction.OnSelect -= Process_Event; + //SelectAction.OnSelect += Process_Event; + DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_planning") .FirstOrDefault(); //获取物料数据控件 this._materialGridControl = materialGridControl; List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件 + IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl; + startdate.MCValue = DateTime.Now.AddDays(-7); + PlanStatus = mcControllist.FirstOrDefault(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "PlanStatus").BaseControl as MCCombobox; - String sql = @"select statusid as CmbValue ,statusname as CmbDisplay from lj_planning_status"; - DataTable dataTable = DBHelp.GetTable(sql); + string sql = @"select statusid as CmbValue ,statusname as CmbDisplay from lj_planning_status"; + + DataTable dataTable = DBHelp.GetTable(sql); + + var dr = dataTable.NewRow(); + dr[0] = "-2"; + dr[1] = "全部"; + + dataTable.Rows.InsertAt(dr, 0); PlanStatus.DataSource = dataTable; + FileControl(); } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/SelectAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/SelectAction.cs index 13be6ba..7b3bd16 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/SelectAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/SelectAction.cs @@ -6,12 +6,15 @@ using System.Data; using System.Linq; using System.Text; using Mesnac.Codd.Session; - +using Mesnac.Controls.Default; +using Mesnac.Action.ChemicalWeighing.LjMaterial; namespace Mesnac.Action.ChemicalWeighing.LjPlanning { public class SelectAction : ChemicalWeighingAction, IAction { + //public static event EventHandler OnSelect; + private DbMCControl _materialGridControl = null; //物料列表控件 private RuntimeParameter _runtime; public void Run(RuntimeParameter runtime) @@ -27,6 +30,10 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning StringBuilder sbSql = new StringBuilder(@" select Id, PlanName, PlanNo, Status, CreateTime, UpdateTime, BegTime, EndTime, NumCar, Unit, Remark, IsEnable, FormulaId, FormulaName,'' as StatusName ,ClassName from lj_planning where IsEnable=1"); + + + + List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件 IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl; @@ -51,14 +58,60 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning ICSharpCode.Core.LoggingService.Debug("{榄菊计划报表查询} 缺少key值为enddate的时间查询条件..."); return; } - sbSql.Append(" ORDER BY CreateTime desc"); + MCCombobox PlanStatus = mcControllist.FirstOrDefault(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "PlanStatus").BaseControl as MCCombobox; + + if (Convert.ToString(PlanStatus.MCValue) != "-2") + { + sbSql.Append(@" and Status = " + PlanStatus.MCValue); + } + + + sbSql.Append(@" ORDER BY CreateTime desc"); dbHelper.CommandText = sbSql.ToString(); dbHelper.CommandType = System.Data.CommandType.Text; DataTable table = dbHelper.ToDataTable(); + if (table.Columns["StatusName"].ReadOnly) + { + table.Columns["StatusName"].ReadOnly = false; + } + + table.Columns["StatusName"].MaxLength = 20; + //-1 任务暂停 0 新建任务 1 任务下发 2 重发 3执行中 10 任务完成 11 放弃 20 异常 + foreach (DataRow tableRow in table.Rows) + { + int status = Convert.ToInt32(tableRow["Status"].ToString()); + string statusName = ""; + switch (status) + { + case -1: + statusName = "任务暂停"; + break; + case 0: + statusName = "新建任务"; + break; + case 1: + statusName = "任务下发"; + break; + case 2: + statusName = "重发"; + break; + case 3: + statusName = "执行中"; + break; + case 10: + statusName = "任务完成"; + break; + case 20: + statusName = "异常"; + break; + + } + + tableRow["StatusName"] = statusName; + } - _materialGridControl.BaseControl.BindDataSource = table; diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index e76397b..8525b46 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/Main/MCEdit/Data/MCProject/nodeForm/FormPlan.xml b/Main/MCEdit/Data/MCProject/nodeForm/FormPlan.xml index 81231d6..8291781 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FormPlan.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FormPlan.xml @@ -52,7 +52,7 @@ True TopCenter 计划状态 - 533, 18 + 575, 18 MCLabel3 53, 12 @@ -78,7 +78,7 @@ Query True True - 592, 15 + 634, 15 MCCombobox1 95, 20 31