2 Commits b4f20cc4b7 ... 8c96404021

Author SHA1 Message Date
  zhangliwen 8c96404021 Merge branch '52台铃产线生产管理系统' of http://www.imaodou.com.cn:30030/c_jack/EICP3.0_48 into 52台铃产线生产管理系统 1 year ago
  zhangliwen 8117d850c8 更新任务 1 year ago
2 changed files with 35 additions and 35 deletions
  1. 34 34
      SCADA_DAQ/Customer/Jobs/SyncRunTime.cs
  2. 1 1
      SCADA_DAQ/SystemControl.cs

+ 34 - 34
SCADA_DAQ/Customer/Jobs/SyncRunTime.cs

@@ -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;

+ 1 - 1
SCADA_DAQ/SystemControl.cs

@@ -120,7 +120,7 @@ namespace SCADA_DAQ
                 CreateBackGroundTask(ReportOnLine, 10 * 1000 * 60, 10 * 1000, true, "ReportAppInfo");
                 CreateBackGroundTask(Plugin.CoreUI.SystemApp.SystemStatictics.UpdateLastOnLineTime, 1 * 1000 * 60, 10 * 1000, true, "UpdateLastTime");
                 CreateBackGroundTask(Plugin.CoreUI.SystemApp.SystemStatictics.StatisticsRunTime, 30 * 1000, 15 * 1000, true, "StatisticsRunTime");
-                CreateBackGroundTask(SyncRunTime, 60 * 1000, 10 * 1000, true, "SyncRunTime");  // 同步运行时长
+                //CreateBackGroundTask(SyncRunTime, 60 * 1000, 10 * 1000, true, "SyncRunTime");  // 同步运行时长
             });
 
             initServer = Task.Factory.StartNew(() =>