From c32d14d2f9fc51b1925436e286a99494560f7524 Mon Sep 17 00:00:00 2001 From: wangsr Date: Sun, 1 Oct 2023 10:25:56 +0800 Subject: [PATCH] =?UTF-8?q?update=20-=20=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LjPlanning/DownloadAction.cs | 7 ++++++ .../LjPlanning/LjPlanningDb.cs | 22 ++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) 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;