diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DownloadAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DownloadAction.cs index 137dce6..b8bee83 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DownloadAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/DownloadAction.cs @@ -169,6 +169,10 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning //把状态变成执行 LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); + + + LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id); + break; case 2: @@ -237,6 +241,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning plc.PlcWriteByDataKey(plc.Plan1_Start, new object[] { 1 }); //把状态变成执行 LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); + LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id); break; case 3: @@ -292,6 +297,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning plc.PlcWriteByDataKey(plc.Plan2_Start, new object[] { 1 }); //把状态变成执行 LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); + LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id); break; case 4: @@ -352,6 +358,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning plc.PlcWriteByDataKey(plc.Plan3_Start, new object[] { 1 }); //把状态变成执行 LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); + LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id); break; } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningDb.cs index ec8affc..9b02ab4 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningDb.cs @@ -77,7 +77,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning /// public static int GetStatusById(int id) { - string sql = $"select Id, No, Status from lj_planning where id={id}"; + string sql = $"select Status from lj_planning where id={id}"; DataTable dt = GetTable(sql); if (dt.Rows.Count == 1) { @@ -94,11 +94,21 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning ExecuteNonQuery(sql); return 1; } - - - - - + + public static int UpdateBeginTime(string begTime, int id) + { + + string sql = $"update lj_planning set BegTime='{begTime}' where id={id}"; + ExecuteNonQuery(sql); + return 1; + } + + // + + + + + public static LjPlanningView GetById(int id) { string sql = $"select Id, PlanNo, Status, CreateTime, UpdateTime, BegTime, EndTime, NumCar, Unit, Remark, IsEnable, FormulaId, FormulaName, PlanName, ClassName from lj_planning where Id = " + id;