莫海杰 1 week ago
parent
commit
eaee8be237
1 changed files with 9 additions and 3 deletions
  1. 9 3
      SCADA_DAQ/Customer/Machines/SampleMachine_DateTimeChanged.cs

+ 9 - 3
SCADA_DAQ/Customer/Machines/SampleMachine_DateTimeChanged.cs

@@ -51,10 +51,12 @@ namespace SCADA_DAQ.Customer.Machines
                 //var closeTaskSql = "UPDATE App_BC_ItemTask SET State_Int = 6 WHERE ErrorMsg_Str LIKE '%System.Reflection.TargetInvocation%' AND State_Int = 0";
                 //Env.DAL.ReadDataTable(closeTaskSql);
 
+                var delDeviceState = Env.DAL.Base_DeviceStateResume.DeleteOldData(DateTime.Now);
+                Log.Info($"Base_DeviceStateResume {delDeviceState.IsSucceed} {delDeviceState.ErrorMessage}");
+
                 // 把数量设置为1
                 var updateQtySql = "UPDATE App_BC_Inventory SET Qty_Dec = 1 WHERE  Qty_Dec != 1";
                 Env.DAL.ReadDataTable(updateQtySql);
-
                 // 超10000删除操作日志
                 var Logsql = $@"select count() as Total from App_BC_OperateLog";
                 var ItemLogTotal = Env.DAL.ReadDataTable(Logsql).DtToList<AppBCOperateLogVo>()[0].Total;
@@ -67,11 +69,15 @@ namespace SCADA_DAQ.Customer.Machines
                 var ItemTaskTotalList = Env.DAL.ReadDataTable(sql).DtToList<AppBCItemTaskVo>();
                 foreach (var itemTaskTotal in ItemTaskTotalList)
                 {
-                    if (itemTaskTotal.TaskType == false && itemTaskTotal.State == 5 && itemTaskTotal.Total >= 5000)
+                    if (itemTaskTotal.TaskType == false && itemTaskTotal.State == 5 && itemTaskTotal.Total >= 1000)
                     {
                         Env.DAL.App_BC_ItemTask.Delete("ID IN (SELECT ID FROM App_BC_ItemTask Where State_Int = 5 AND TaskType_Bit = 0 ORDER BY ID ASC LIMIT 10)");
                     }
-                    if (itemTaskTotal.TaskType == true && itemTaskTotal.State == 5 && itemTaskTotal.Total >= 5000)
+                    if (itemTaskTotal.TaskType == false && itemTaskTotal.State == 0 && itemTaskTotal.Total >= 1000)
+                    {
+                        Env.DAL.App_BC_ItemTask.Delete("ID IN (SELECT ID FROM App_BC_ItemTask Where State_Int = 0 AND TaskType_Bit = 0 ORDER BY ID ASC LIMIT 10)");
+                    }
+                    if (itemTaskTotal.TaskType == true && itemTaskTotal.State == 5 && itemTaskTotal.Total >= 10000)
                     {
                         Env.DAL.App_BC_ItemTask.Delete("ID IN (SELECT ID FROM App_BC_ItemTask Where State_Int = 5 AND TaskType_Bit = 1 ORDER BY ID ASC LIMIT 10)");
                     }