# Conflicts:
#	Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/InItDbAction.cs
dep_nodyang
wangsr 1 year ago
commit 46ce634bd5

@ -20,6 +20,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
this._runtime = runtime;
AddAction.OnAdd -= Process_Event;
AddAction.OnAdd += Process_Event;
@ -30,19 +31,35 @@ 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<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
// PlanStatus = mcControllist.FirstOrDefault(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "PlanStatus").BaseControl as MCCombobox;
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";
String sql = @"select statusid as CmbValue ,statusname as CmbDisplay from lj_planning_status";
DataTable dataTable = DBHelp.GetTable(sql);
// PlanStatus.DataSource = dataTable;
var dr = dataTable.NewRow();
dr[0] = "-2";
dr[1] = "全部";
dataTable.Rows.InsertAt(dr, 0);
PlanStatus.DataSource = dataTable;
FileControl();
}

@ -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<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
@ -51,13 +58,59 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
ICSharpCode.Core.LoggingService<SelectAction>.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;

@ -52,7 +52,7 @@
<Property name="MCEnabled">True</Property>
<Property name="TextAlign">TopCenter</Property>
<Property name="Text">计划状态</Property>
<Property name="Location">533, 18</Property>
<Property name="Location">575, 18</Property>
<Property name="Name">MCLabel3</Property>
<Property name="Size">53, 12</Property>
</Object>
@ -78,7 +78,7 @@
<Property name="DbOptionType">Query</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="Location">592, 15</Property>
<Property name="Location">634, 15</Property>
<Property name="Name">MCCombobox1</Property>
<Property name="Size">95, 20</Property>
<Property name="TabIndex">31</Property>

Loading…
Cancel
Save