From e79700d34620c495667b7b8e7b852f23ed7d7e4e Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期三, 16 七月 2025 17:30:42 +0800 Subject: [PATCH] 简化增删改表达式,避免类型匹配出错 --- core/Monitor.cs | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core/Monitor.cs b/core/Monitor.cs index 93892f7..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; } @@ -174,14 +174,14 @@ 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, @@ -194,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, @@ -206,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); @@ -264,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; } @@ -313,13 +313,13 @@ 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, @@ -332,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, @@ -344,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); @@ -391,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; } @@ -444,13 +444,13 @@ 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, @@ -463,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, @@ -475,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); @@ -584,7 +584,7 @@ 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