kazelee
2025-05-30 cbba9b897a865fbf253a03cd818a1044637e8334
core/Monitor.cs
@@ -67,14 +67,14 @@
                    };
                    // BEG 每次轮询都检查对应容器是否已登记,登记则更新,未登记则插入
                    var cntrItemRel = db.Queryable<TN_Container_Item>()
                    var cntrItemRel = db.Queryable<TN_Container_ItemType>()
                        .Where(i => i.S_CNTR_CODE == cntrCode).First();
                    var insertTable = cntrItemRel == null;
                    if (insertTable) {
                        // 暂定在满托下线入库的时候,登记托盘容器-物料号关系(后面可能会改成系统维护)
                        cntrItemRel = new TN_Container_Item {
                        cntrItemRel = new TN_Container_ItemType {
                            S_ITEM_CODE = itemCode,
                            S_CNTR_CODE = cntrCode,
                        };
@@ -124,8 +124,8 @@
                    var cntId = locCntrRel.S_CNTR_CODE;
                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName);
                    LocationHelper.LockLoc(ref startLoc, 2); // 起点出库锁
                    LocationHelper.LockLoc(ref endLoc, 1); // 终点入库锁
                    LocationHelper.LockStartLoc(ref startLoc); // 起点出库锁
                    LocationHelper.LockEndLoc(ref endLoc); // 终点入库锁
                    using (var tran = db.Ado.UseTran()) {
                        if (db.Insertable<TN_CG_Detail>(cgDetail).ExecuteCommand() <= 0) {
@@ -137,7 +137,7 @@
                        // BEG 插入或更新容器与物料类型的绑定表
                        if (insertTable) {
                            if (db.Insertable<TN_Container_Item>(cntrItemRel).ExecuteCommand() <= 0) {
                            if (db.Insertable<TN_Container_ItemType>(cntrItemRel).ExecuteCommand() <= 0) {
                                tran.RollbackTran();
                                info = $"登记容器物料类型绑定表失败:物料编码{cntrItemRel.S_ITEM_CODE},容器编码{cntrItemRel.S_CNTR_CODE}";
                                LogHelper.Info(info);
@@ -145,7 +145,7 @@
                            }
                        }
                        else {
                            if (db.Updateable<TN_Container_Item>(cntrItemRel).ExecuteCommand() <= 0) {
                            if (db.Updateable<TN_Container_ItemType>(cntrItemRel).ExecuteCommand() <= 0) {
                                tran.RollbackTran();
                                info = $"登记容器物料类型绑定表失败:物料编码{cntrItemRel.S_ITEM_CODE},容器编码{cntrItemRel.S_CNTR_CODE}";
                                LogHelper.Info(info);
@@ -288,14 +288,14 @@
                        LogHelper.Info($"轮询--{taskName}:没有找到合适的终点货位!单号'{detail.S_OO_NO}'要求终点库区为'{detail.S_END_AREA}'");
                        continue;
                    }
                    detail.N_B_STATE = 2;
                    var cntId = detail.S_CNTR_CODE;
                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName);
                    LocationHelper.LockLoc(ref startLoc, 2); // 起点出库锁
                    LocationHelper.LockLoc(ref endLoc, 1); // 终点入库锁
                    LocationHelper.LockStartLoc(ref startLoc); // 起点出库锁
                    LocationHelper.LockEndLoc(ref endLoc); // 终点入库锁
                    using (var tran = db.Ado.UseTran()) {
                        if (db.Updateable<TN_Outbound_Detail>(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
@@ -451,8 +451,8 @@
                    var cntId = detail.S_CNTR_CODE;
                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName);
                    LocationHelper.LockLoc(ref startLoc, 2); // 起点出库锁
                    LocationHelper.LockLoc(ref endLoc, 1); // 终点入库锁
                    LocationHelper.LockStartLoc(ref startLoc); // 起点出库锁
                    LocationHelper.LockEndLoc(ref endLoc); // 终点入库锁
                    using (var tran = db.Ado.UseTran()) {
                        if (db.Updateable<TN_SpotCheck_Detail>(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {
@@ -575,8 +575,8 @@
                    var cntId = detail.S_CNTR_CODE;
                    var task = WCSHelper.BuildTask(startLoc, endLoc, cntId, taskName);
                    LocationHelper.LockLoc(ref startLoc, 2); // 起点出库锁
                    LocationHelper.LockLoc(ref endLoc, 1); // 终点入库锁
                    LocationHelper.LockStartLoc(ref startLoc); // 起点出库锁
                    LocationHelper.LockEndLoc(ref endLoc); // 终点入库锁
                    using (var tran = db.Ado.UseTran()) {
                        if (db.Updateable<TN_RelocationList_Detail>(detail).UpdateColumns(it => it.N_B_STATE).ExecuteCommand() <= 0) {