From 6a9cb330790ca75dffe43e87bd5c5ad8a5ec3311 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周六, 07 9月 2024 07:09:56 +0800
Subject: [PATCH] 如果主工序表没有数据,就创建

---
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/ClearDataHandler.cs |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/ClearDataHandler.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/ClearDataHandler.cs
index 88bf30f..ea64e1d 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/ClearDataHandler.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/ClearDataHandler.cs
@@ -64,5 +64,33 @@
         }
 
 
+
+        /// <summary>
+        /// 绉婚櫎XX澶╁墠鐨� WorkPieceLog 鏁版嵁
+        /// </summary>
+        /// <param name="edm"></param>
+        public static void Delete_AccessInterfaceLogForRequest(int days)
+        {
+            try
+            {
+                using (DbModel edm = new DbModel())
+                {
+                    var queryTime = DateTime.Now.AddDays(-days);
+
+                    var removeList = edm.AccessInterfaceLogForRequest.Where(x => x.CreatedTime <= queryTime).ToList();
+                    if (removeList != null && removeList.Count > 0)
+                    {
+                        edm.AccessInterfaceLogForRequest.RemoveRange(removeList);
+                    }
+                    edm.SaveChanges();
+                }
+            }
+            catch (Exception ex)
+            {
+                Log4NetHelper.WriteErrorLog(LogType.DeleteData, "绉婚櫎XX澶╁墠鐨� AccessInterfaceLogForRequest 鏁版嵁 鍑虹幇寮傚父", ex);
+            }
+        }
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3