From 84c580cccb118f5ec4a039d0009255935c3c2490 Mon Sep 17 00:00:00 2001 From: cjs <2216046164@qq.com> Date: 星期二, 17 六月 2025 17:31:40 +0800 Subject: [PATCH] 111 --- ams/Hanhe.iWCS.TaizhouGEMTwoProtocol/PLCControl.cs | 90 ++++++++++++++++++++++++++++++++++----------- 1 files changed, 68 insertions(+), 22 deletions(-) diff --git a/ams/Hanhe.iWCS.TaizhouGEMTwoProtocol/PLCControl.cs b/ams/Hanhe.iWCS.TaizhouGEMTwoProtocol/PLCControl.cs index e356c85..afa5106 100644 --- a/ams/Hanhe.iWCS.TaizhouGEMTwoProtocol/PLCControl.cs +++ b/ams/Hanhe.iWCS.TaizhouGEMTwoProtocol/PLCControl.cs @@ -1751,6 +1751,7 @@ host = plc.ip, port = plc.port }); + CMMLog.Info($"鍙犵洏涓嬬嚎璇诲彇閫氶亾{plc.ip}锛宲ort锛歿plc.port},鍦板潃锛歿plc.readAddr + 1}鐨勫�涓簕JsonConvert.SerializeObject(result)}"); if (result != null && result.errCode == 0) { //1.婊℃墭涓嬬嚎 @@ -1762,7 +1763,14 @@ string wmstaskno = ""; string traycode = ""; string trayType = ""; - if(plc.deviceType == "25") trayType = result.result[1] == 1 ? "宸濆瓧鎵� : "鐢板瓧鎵�; + if (plc.deviceType == "25") + { + trayType = result.result[1] == 1 ? "宸濆瓧鎵� : result.result[1] == 2 ? "鐢板瓧鎵� : ""; + if (string.IsNullOrEmpty(trayType)) + { + return; + } + } bool req = WMSHelper.WMSIn(plc.location, "", ref wmstaskno, ref traycode,"","",false, trayType); if (req) { @@ -2058,9 +2066,9 @@ if (timecuo != null) { string timeStamp = timecuo.TimeCuo; - string employeeId = timecuo.employeeId1; - // ERP鍙樻洿-璋冪敤ERP鎺ュ彛浼犺緭鐩稿叧鏁版嵁 - WMSHelper.WMSIn(plc.location, "time", ref wmstaskno, ref timeStamp, timeStamp, employeeId,true); + //string employeeId = timecuo.employeeId1; + //// ERP鍙樻洿-璋冪敤ERP鎺ュ彛浼犺緭鐩稿叧鏁版嵁 + //WMSHelper.WMSIn(plc.location, "time", ref wmstaskno, ref timeStamp, timeStamp, employeeId,true); } else CMMLog.Info($"鏃堕棿鎴虫帴鍙h繑鍥炲�涓虹┖锛�); } @@ -3977,7 +3985,7 @@ if (result != null && result.errCode == 0) { //3锛氫汉宸ュ彨绌烘墭鐩�宸濆瓧) 4:浜哄伐鍙┖鎵樼洏(鐢板瓧) - if (result.result[0] == 3 || result.result[0] == 4) + if ((pmInfo.deviceType == "1" && result.result[0] == 3)|| (pmInfo.deviceType == "21" &&(result.result[0] == 3 || result.result[0] == 4))) { //鍖呰绾胯ˉ绌烘祦绋� //鍒ゆ柇绌烘墭缂撳瓨鐐癸紙5 瀵�2锛夋槸鍚︽湁绌烘墭锛屾湁绌烘墭鍒ゆ柇鏄惁鏈変换鍔★紝鏈変换鍔″垯鍒ゆ柇鍙︿竴涓偣浣�@@ -3990,9 +3998,9 @@ { CMMLog.Info($"鍛ㄨ浆鎵樼洏浣嶏細{a}"); var ddInfo = Settings.GetDDSiteList().Where(b => b.ddLoc == a && b.Enable == 1).FirstOrDefault(); - if(ddInfo != null) + if (ddInfo != null) { - if(ddInfo.trayType == result.result[0] - 2) + if (ddInfo.trayType == result.result[0] - 2) { if (ProcessHelper.PickUpEndFree(pmInfo.location) && ProcessHelper.PickUpStartFree(a)) { @@ -4017,21 +4025,6 @@ CMMLog.Info("閰嶇疆鏂囦欢鏈厤缃寘瑁呮満绌烘墭缂撳瓨鐐�); } } - //娴佺▼鏈鎺ュソ锛屾槸鍚﹁繖鏍蜂娇鐢�寰呭畾 - //if (result.result[0] == 4) - //{ - // //璋冪敤wms鍑哄簱鎺ュ彛 - // var tasks = MongoDBSingleton.Instance.Find<TN_I_TASK_MST>(Query.EQ("CN_S_END_BIT", pmInfo.location), "TN_I_TASK_MST"); - // //鍒ゆ柇涓�笅褰撳墠鍙犳墭鐐规槸鍚︽湁浠诲姟鍗犵敤 - // if (ProcessHelper.CheckEndFree(pmInfo.location) && tasks.Count == 0) - // { - // //鍙互鐢熸垚浠诲姟锛岃皟WMS鎺ュ彛鑾峰彇浠诲姟淇℃伅 - // bool req = WMSHelper.WMSOut(pmInfo.location, ""); - // if (req) CMMLog.Debug($"璋冪敤WMS鑾峰彇杈呮潗鍑哄簱鐢熸垚浠诲姟鎴愬姛锛�);//鐜板湪浠诲姟鐢盬MS鑷繁涓嬪彂锛孉MS鍋氭嫤鎴鐞嗭紙鏌ヨext1閲岄潰瀵瑰簲鐨勪换鍔$被鍨嬶紝骞舵洿鏀逛换鍔$被鍨嬶級 - // else CMMLog.Debug($"璋冪敤WMS鑾峰彇杈呮潗鍑哄簱鐢熸垚浠诲姟澶辫触锛�); - // } - // else CMMLog.Debug($"妫�煡褰撳墠鍙犳墭鐐规槸鍚︽湁浠诲姟鍗犵敤锛屾垨鑰匨ST涓昏〃涓湁缂撳瓨鏋跺叆鍙犵洏鏈虹殑浠诲姟锛�); - //} } else { @@ -4204,6 +4197,59 @@ } Thread.Sleep(100000); } + + internal static void CheckPackingLineFullThree(Settings.PlcInfo plc) + { + var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel + { + dataNum = 25, + addr = plc.readAddr, + host = plc.ip, + port = plc.port + }); + if(result != null && result.errCode == 0) + { + if (result.result[0] == 1) + { + //鑾峰彇鐗╂枡淇℃伅 鏍规嵁鎵樼洏鐮佸尯鍒�+ string trayCode = RemoveNull(GetTrayCode(result.result.Skip(6).Take(3).ToArray()));//鎵樼洏鐮�+ + + var infoPack = MongoDBSingleton.Instance.FindOne<TimeCuoInfoComTwo>(Query.And(Query.EQ("trayCode", trayCode)), "TimeCuoInfoComTwo"); + if (infoPack != null) + { + string empCode = RemoveNull(GetTrayCode(result.result.Skip(1).Take(5).ToArray()));//鍛樺伐缂栫爜 + string machineCode = RemoveNull(GetTrayCode(result.result.Skip(9).Take(1).ToArray()));//鍖呰鏈哄彿 + int needWeight = Convert.ToInt32(Completion(result.result[10]) + Completion(result.result[11]), 2);//浜у搧闇�眰閲嶉噺 + int oneWeight = Convert.ToInt32(Completion(result.result[12]) + Completion(result.result[13]), 2);//鍗曟墭姣涢噸 + int readWeight = Convert.ToInt32(Completion(result.result[14]) + Completion(result.result[15]), 2);//鍗曟墭鍑�噸 + int fcWeight = Convert.ToInt32(Completion(result.result[16]) + Completion(result.result[17]), 2);//鍗曟墭澶嶇О閲嶉噺 + int trayType = Convert.ToInt32(Completion(result.result[18]), 2);//鎵樼洏绫诲瀷 + int addState = Convert.ToInt32(Completion(result.result[19]), 2);//鍙犲寘灞傛暟 + int bagNumber = Convert.ToInt32(Completion(result.result[20]), 2);//琚嬪彿 + int productTime = Convert.ToInt32(Completion(result.result[21]) + Completion(result.result[22]), 2);//鐢熶骇鏃ユ湡 + string timeCuoTwo = Convert.ToInt32(Completion(result.result[23]) + Completion(result.result[24]), 2).ToString(); //鏃堕棿鎴�+ + UpdateBuilder updateBuilder = Update.Set("employeeId", empCode).Set("trayCode", trayCode).Set("packingMachineNumber", machineCode).Set("needWeight", needWeight) + .Set("oneWeight", oneWeight).Set("realWeight", readWeight).Set("FCWeight", fcWeight).Set("trayType", trayType) + .Set("isFold", addState).Set("bagNumber", bagNumber).Set("productData", productTime); + //浜у搧鎵规鍙� 浜у搧鍨嬪彿 鐗╂枡鍚嶇О 璁¢噺鍗曚綅鍧囧彲鍦╡rp琛ㄤ腑鏍规嵁鐗╂枡缂栫爜鑾峰彇 + + result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel + { + dataNum = 15, + addr = plc.readAddr + 131, + host = plc.ip, + port = plc.port + }); + + string materialCode = RemoveNull(GetTrayCode(result.result.Skip(0).Take(15).ToArray()).Trim().ToString()); + UpdateBuilder update = Update.Set("materialCode", materialCode); + MongoDBSingleton.Instance.Update<TimeCuoInfoComTwo>(Query.EQ("trayCode", trayCode), update, UpdateFlags.None); + } + } + } + } #endregion } } -- Gitblit v1.9.1