From 53d582ad41d8450b21045b2d862a532ecc57a9ba Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期一, 26 五月 2025 17:29:57 +0800 Subject: [PATCH] 抽检移库基本测完,添加TCP模拟测试输送线产品下线的逻辑 --- core/WCSCore.cs | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/core/WCSCore.cs b/core/WCSCore.cs index 5fbf07f..e5a61f9 100644 --- a/core/WCSCore.cs +++ b/core/WCSCore.cs @@ -127,9 +127,19 @@ try { ModbusHelper.Relink(); - var prodLineInfo = Settings.ProductionLines[0]; + //var loc = db.Queryable<TN_Location>() + // .Where(l => l.S_AGV_SITE == model.station_name && Settings.AreaMap[AreaName.鍖呰鍖篯.Contains(l.S_AREA_CODE)) + // .First(); - var prodLineDevice = new ProductionLineDevice(prodLineInfo.PlcIp, prodLineInfo.PlcPort); + if (!Settings.AgvSite_ProdLineCodeMap.TryGetValue(model.station_name, out int prodIndex)) { + info = $"AGV 绔欑偣{model.station_name}涓嶆槸鍚堟硶鐨勪骇绾挎帴椹充綅绔欑偣"; + LogHelper.Info(info); + return NewReturnResult(1, info); + } + + var prodLineInfo = Settings.ProductionLines[prodIndex]; + + var prodLineDevice = new ProductionLineDevice(prodLineInfo); if (!prodLineDevice.LoadDeviceStateOk()) { info = "涓庝骇绾胯澶囬�璁け璐�; LogHelper.Info(info); @@ -155,7 +165,7 @@ return NewReturnResult(3, info); } - if (model.apply_code == "5") { + if (model.apply_code == "5") { // 璇锋眰鍙栬揣 if (prodLineDevice.FullOffline != 1) { info = $"褰撳墠杈撻�绾挎弧鏂欎笅绾夸俊鍙蜂笉涓�锛屾棤娉曞彇璐�; LogHelper.Info(info); @@ -173,7 +183,7 @@ return NewReturnResult(0, info); } - else if (model.apply_code == "1") { + else if (model.apply_code == "1") { // 璇锋眰鍗歌揣 if (prodLineDevice.AllowAgvPlacePallet != 1) { info = $"褰撳墠杈撻�绾垮厑璁告斁鎵樼洏淇″彿涓嶄负1锛屾棤娉曟斁璐�; LogHelper.Info(info); @@ -191,7 +201,7 @@ return NewReturnResult(0, info); } else { - info = $"褰撳墠杈撻�绾垮厑璁�; + info = $"褰撳墠AGV璇锋眰鐮佷笉涓�5鍙栬揣 鎴�1鍗歌揣"; LogHelper.Info(info); return NewReturnResult(8, info); } -- Gitblit v1.9.1