|
@@ -58,42 +58,42 @@ namespace SCADA_DAQ.Customer.Jobs
|
|
|
var excuteMsg =new JobExcuteFinishEventArgs();
|
|
|
//TODO:这里执行需要的逻辑
|
|
|
|
|
|
- //var localValue = Env.LocalDAL.SysApp_DayStatistics?.GetTopOne($"DayStartTime_Dt='{DateTime.Now.Date.Format()}'", "Value_Dec", "DayStartTime_Dt desc");
|
|
|
- //if (localValue == null)
|
|
|
- // localValue = 0;
|
|
|
+ var localValue = Env.LocalDAL.SysApp_DayStatistics?.GetTopOne($"DayStartTime_Dt='{DateTime.Now.Date.Format()}'", "Value_Dec", "DayStartTime_Dt desc");
|
|
|
+ if (localValue == null)
|
|
|
+ localValue = 0;
|
|
|
|
|
|
-
|
|
|
- //var filterStr = $"ProductionLineId_Str='{CustomerEnv.ProductionLineConfigValue.ProductionLineId}' " +
|
|
|
- // $"AND WorkShopId_Str='{CustomerEnv.ProductionLineConfigValue.WorkShopId}' " +
|
|
|
- // $"AND DATEDIFF(dd, StartTime_Dt, GETDATE())=0";
|
|
|
- //ProductionLineStateModel tableInfo = null;
|
|
|
- //if (Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord != null && Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord.Exist(filterStr))
|
|
|
- //{
|
|
|
- // tableInfo = Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?
|
|
|
- // .GetData<ProductionLineStateModel>(filterStr)
|
|
|
- // .OrderBy(t => t.ID).Last();
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // tableInfo = null;
|
|
|
- //}
|
|
|
|
|
|
- //if (tableInfo == null)
|
|
|
- //{
|
|
|
- // Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Insert(
|
|
|
- // new UpdateItem("ProductionLineId_Str", CustomerEnv.ProductionLineConfigValue.ProductionLineId),
|
|
|
- // new UpdateItem("WorkShopId_Str", CustomerEnv.ProductionLineConfigValue.WorkShopId),
|
|
|
- // new UpdateItem("ProductionLineState_Str", "Running"),
|
|
|
- // new UpdateItem("StartTime_Dt", DateTime.Now.Date.Format()),
|
|
|
- // new UpdateItem("EndTime_Dt", DateTime.Now.AddDays(1).Date.Format()),
|
|
|
- // new UpdateItem("DurationSec_Int", localValue)
|
|
|
- // );
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Update(filterStr,
|
|
|
- // new UpdateItem("DurationSec_Int", localValue));
|
|
|
- //}
|
|
|
+ var filterStr = $"ProductionLineId_Str='{CustomerEnv.ProductionLineConfigValue.ProductionLineId}' " +
|
|
|
+ $"AND WorkShopId_Str='{CustomerEnv.ProductionLineConfigValue.WorkShopId}' " +
|
|
|
+ $"AND DATEDIFF(dd, StartTime_Dt, GETDATE())=0";
|
|
|
+ ProductionLineStateModel tableInfo = null;
|
|
|
+ if (Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord != null && Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord.Exist(filterStr))
|
|
|
+ {
|
|
|
+ tableInfo = Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?
|
|
|
+ .GetData<ProductionLineStateModel>(filterStr)
|
|
|
+ .OrderBy(t => t.ID).Last();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tableInfo = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tableInfo == null)
|
|
|
+ {
|
|
|
+ Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Insert(
|
|
|
+ new UpdateItem("ProductionLineId_Str", CustomerEnv.ProductionLineConfigValue.ProductionLineId),
|
|
|
+ new UpdateItem("WorkShopId_Str", CustomerEnv.ProductionLineConfigValue.WorkShopId),
|
|
|
+ new UpdateItem("ProductionLineState_Str", "Running"),
|
|
|
+ new UpdateItem("StartTime_Dt", DateTime.Now.Date.Format()),
|
|
|
+ new UpdateItem("EndTime_Dt", DateTime.Now.AddDays(1).Date.Format()),
|
|
|
+ new UpdateItem("DurationSec_Int", localValue)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Env.SgIDAL.APP_TaiLing_ProductionLineStateRecord?.Update(filterStr,
|
|
|
+ new UpdateItem("DurationSec_Int", localValue));
|
|
|
+ }
|
|
|
|
|
|
excuteMsg.IsSuccess= true;
|
|
|
return excuteMsg;
|