From 74ca5a83f24c53c48ad7e6f5b7739649fb411546 Mon Sep 17 00:00:00 2001
From: kazelee <1847801760@qq.com>
Date: 星期四, 17 七月 2025 17:19:53 +0800
Subject: [PATCH] 优化部分日志和未使用代码

---
 core/Monitor.cs |   60 +++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 33 insertions(+), 27 deletions(-)

diff --git a/core/Monitor.cs b/core/Monitor.cs
index dfadc6e..4165a59 100644
--- a/core/Monitor.cs
+++ b/core/Monitor.cs
@@ -102,7 +102,7 @@
 
                     if (doingCount == allCount) {
                         order.N_B_STATE = 2; // 鎵�湁浠诲姟閮藉凡鎵ц
-                        db.Updateable<TN_Outbound_Order>(order).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
+                        db.Updateable(order).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
                         continue;
                     }
 
@@ -163,21 +163,25 @@
 
                     var cntId = detail.S_CNTR_CODE;
 
-                    var erp_no = string.IsNullOrEmpty(detail.S_BS_NO) ? "" : detail.S_BS_NO;
-                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName, detail.S_OO_NO, erp_no);
+                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName);
+                    task.S_OP_CODE = detail.S_OO_NO;
+                    if (string.IsNullOrEmpty(detail.S_BS_NO)) {
+                        task.S_BS_NO = detail.S_BS_NO;
+                        task.S_BS_TYPE = "ERP";
+                    }
 
-                    LocationHelper.LockStartLoc(ref startLoc); // 璧风偣鍑哄簱閿�-                    LocationHelper.LockEndLoc(ref endLoc); // 缁堢偣鍏ュ簱閿�+                    WCSHelper.LockStartLoc(ref startLoc); // 璧风偣鍑哄簱閿�+                    WCSHelper.LockEndLoc(ref endLoc); // 缁堢偣鍏ュ簱閿� 
                     using (var tran = db.Ado.UseTran()) {
-                        if (db.Updateable<TN_Outbound_Detail>(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
+                        if (db.Updateable(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
                             tran.RollbackTran();
                             info = $"杞锛歿taskName}锛氫慨鏀规槑缁嗚〃鐘舵�涓哄畬鎴�-澶辫触锛�;
                             LogHelper.Info(info);
                             continue;
                         }
 
-                        if (db.Updateable<TN_Location>(startLoc).UpdateColumns(it => new {
+                        if (db.Updateable(startLoc).UpdateColumns(it => new {
                             it.N_LOCK_STATE,
                             it.S_LOCK_STATE,
                             it.S_LOCK_OP,
@@ -190,7 +194,7 @@
                             continue;
                         }
 
-                        if (db.Updateable<TN_Location>(endLoc).UpdateColumns(it => new {
+                        if (db.Updateable(endLoc).UpdateColumns(it => new {
                             it.N_LOCK_STATE,
                             it.S_LOCK_STATE,
                             it.S_LOCK_OP,
@@ -202,7 +206,7 @@
                             continue;
                         }
 
-                        if (db.Insertable<TN_Task>(task).ExecuteCommand() <= 0) {
+                        if (db.Insertable(task).ExecuteCommand() <= 0) {
                             tran.RollbackTran();
                             info = $"鐢熸垚浠诲姟'{taskName}'澶辫触锛屼换鍔″彿={task.S_CODE}锛屽鍣ㄥ彿={cntId}锛岃捣鐐�{startLoc.S_CODE}锛岀粓鐐�{endLoc.S_CODE}";
                             LogHelper.Info(info);
@@ -260,7 +264,7 @@
 
                     if (doingCount == allCount) {
                         order.N_B_STATE = 2; // 鎵�湁浠诲姟閮藉凡鎵ц
-                        db.Updateable<TN_Spot_Check>(order).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
+                        db.Updateable(order).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
                         continue;
                     }
 
@@ -302,19 +306,20 @@
                     detail.N_B_STATE = 2;
 
                     var cntId = detail.S_CNTR_CODE;
-                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName, detail.S_OO_NO);
+                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName);
+                    task.S_OP_CODE = detail.S_OO_NO;
 
-                    LocationHelper.LockStartLoc(ref startLoc); // 璧风偣鍑哄簱閿�-                    LocationHelper.LockEndLoc(ref endLoc); // 缁堢偣鍏ュ簱閿�+                    WCSHelper.LockStartLoc(ref startLoc); // 璧风偣鍑哄簱閿�+                    WCSHelper.LockEndLoc(ref endLoc); // 缁堢偣鍏ュ簱閿� 
                     using (var tran = db.Ado.UseTran()) {
-                        if (db.Updateable<TN_SpotCheck_Detail>(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
+                        if (db.Updateable(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
                             tran.RollbackTran();
                             LogHelper.Info($"杞锛歿taskName}锛氫慨鏀箋taskName}鍗曟槑缁嗚〃鐘舵�涓哄畬鎴�-澶辫触锛�);
                             continue;
                         }
 
-                        if (db.Updateable<TN_Location>(startLoc).UpdateColumns(it => new {
+                        if (db.Updateable(startLoc).UpdateColumns(it => new {
                             it.N_LOCK_STATE,
                             it.S_LOCK_STATE,
                             it.S_LOCK_OP,
@@ -327,7 +332,7 @@
                             continue;
                         }
 
-                        if (db.Updateable<TN_Location>(endLoc).UpdateColumns(it => new {
+                        if (db.Updateable(endLoc).UpdateColumns(it => new {
                             it.N_LOCK_STATE,
                             it.S_LOCK_STATE,
                             it.S_LOCK_OP,
@@ -339,7 +344,7 @@
                             continue;
                         }
 
-                        if (db.Insertable<TN_Task>(task).ExecuteCommand() <= 0) {
+                        if (db.Insertable(task).ExecuteCommand() <= 0) {
                             tran.RollbackTran();
                             info = $"鐢熸垚浠诲姟'{taskName}'澶辫触锛屼换鍔″彿={task.S_CODE}锛屽鍣ㄥ彿={cntId}锛岃捣鐐�{startLoc.S_CODE}锛岀粓鐐�{endLoc.S_CODE}";
                             LogHelper.Info(info);
@@ -386,7 +391,7 @@
 
                     if (doingCount == allCount) {
                         order.N_B_STATE = 2; // 鎵�湁浠诲姟閮藉凡鎵ц
-                        db.Updateable<TN_Relocation_List>(order).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
+                        db.Updateable(order).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
                         continue;
                     }
 
@@ -432,19 +437,20 @@
                     detail.N_B_STATE = 2;
 
                     var cntId = detail.S_CNTR_CODE;
-                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName, detail.S_OO_NO);
+                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName);
+                    task.S_OP_CODE = detail.S_OO_NO;
 
-                    LocationHelper.LockStartLoc(ref startLoc); // 璧风偣鍑哄簱閿�-                    LocationHelper.LockEndLoc(ref endLoc); // 缁堢偣鍏ュ簱閿�+                    WCSHelper.LockStartLoc(ref startLoc); // 璧风偣鍑哄簱閿�+                    WCSHelper.LockEndLoc(ref endLoc); // 缁堢偣鍏ュ簱閿� 
                     using (var tran = db.Ado.UseTran()) {
-                        if (db.Updateable<TN_RelocationList_Detail>(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
+                        if (db.Updateable(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
                             tran.RollbackTran();
                             LogHelper.Info($"杞锛歿taskName}锛氫慨鏀箋taskName}鍗曟槑缁嗚〃鐘舵�涓哄畬鎴�-澶辫触锛�);
                             continue;
                         }
 
-                        if (db.Updateable<TN_Location>(startLoc).UpdateColumns(it => new {
+                        if (db.Updateable(startLoc).UpdateColumns(it => new {
                             it.N_LOCK_STATE,
                             it.S_LOCK_STATE,
                             it.S_LOCK_OP,
@@ -457,7 +463,7 @@
                             continue;
                         }
 
-                        if (db.Updateable<TN_Location>(endLoc).UpdateColumns(it => new {
+                        if (db.Updateable(endLoc).UpdateColumns(it => new {
                             it.N_LOCK_STATE,
                             it.S_LOCK_STATE,
                             it.S_LOCK_OP,
@@ -469,7 +475,7 @@
                             continue;
                         }
 
-                        if (db.Insertable<TN_Task>(task).ExecuteCommand() <= 0) {
+                        if (db.Insertable(task).ExecuteCommand() <= 0) {
                             tran.RollbackTran();
                             info = $"鐢熸垚浠诲姟'{taskName}'澶辫触锛屼换鍔″彿={task.S_CODE}锛屽鍣ㄥ彿={cntId}锛岃捣鐐�{startLoc.S_CODE}锛岀粓鐐�{endLoc.S_CODE}";
                             LogHelper.Info(info);
@@ -571,14 +577,14 @@
                 model.ph = cgDetail.S_BATCH_NO;
 
                 var jsonInfo = JsonConvert.SerializeObject(model);
-                var result = httpH.WebPost(Settings.ErpApiUrl + "CreateTaskReturn", jsonInfo);
+                var result = httpH.WebPost(Settings.ErpApiUrl + Settings.ErpRoute.CreateTaskReturn, jsonInfo);
 
                 LogHelper.InfoApi($"鍒涘缓浠诲姟瀹屾垚鍙嶉ERP鎺ュ彛锛岀粨鏋�{result}锛岃皟鐢ㄥ弬鏁帮細", model);
 
                 plan.HW = model.hw;
                 plan.HWZT = model.hwzt;
                 plan.PH = model.ph;
-                var success = db.Updateable<TN_Outbound_Plan>(plan).UpdateColumns(p => new { p.HW, p.HWZT, p.PH }).ExecuteCommand() > 0;
+                var success = db.Updateable(plan).UpdateColumns(p => new { p.HW, p.HWZT, p.PH }).ExecuteCommand() > 0;
                 info = "鏇存柊鍑哄簱璁″垝鍗曡褰曡〃" + (success ? "鎴愬姛" : "澶辫触");
                 LogHelper.Info(info);
             }

--
Gitblit v1.9.1