update - 小修改

dep_nodyang
wangsr 1 year ago
parent 1f219d415c
commit c32d14d2f9

@ -169,6 +169,10 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
//把状态变成执行 //把状态变成执行
LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); LjPlanningDb.UpdateStatus(1, ljPlanningView.Id);
LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id);
break; break;
case 2: case 2:
@ -237,6 +241,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
plc.PlcWriteByDataKey(plc.Plan1_Start, new object[] { 1 }); plc.PlcWriteByDataKey(plc.Plan1_Start, new object[] { 1 });
//把状态变成执行 //把状态变成执行
LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); LjPlanningDb.UpdateStatus(1, ljPlanningView.Id);
LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id);
break; break;
case 3: case 3:
@ -292,6 +297,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
plc.PlcWriteByDataKey(plc.Plan2_Start, new object[] { 1 }); plc.PlcWriteByDataKey(plc.Plan2_Start, new object[] { 1 });
//把状态变成执行 //把状态变成执行
LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); LjPlanningDb.UpdateStatus(1, ljPlanningView.Id);
LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id);
break; break;
case 4: case 4:
@ -352,6 +358,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
plc.PlcWriteByDataKey(plc.Plan3_Start, new object[] { 1 }); plc.PlcWriteByDataKey(plc.Plan3_Start, new object[] { 1 });
//把状态变成执行 //把状态变成执行
LjPlanningDb.UpdateStatus(1, ljPlanningView.Id); LjPlanningDb.UpdateStatus(1, ljPlanningView.Id);
LjPlanningDb.UpdateBeginTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ljPlanningView.Id);
break; break;
} }

@ -77,7 +77,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
/// <returns></returns> /// <returns></returns>
public static int GetStatusById(int id) 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); DataTable dt = GetTable(sql);
if (dt.Rows.Count == 1) if (dt.Rows.Count == 1)
{ {
@ -95,6 +95,16 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning
return 1; 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;
}
//

Loading…
Cancel
Save