From 7fda4aeb36beda46d767a78082573692e7b85651 Mon Sep 17 00:00:00 2001 From: cjs <2216046164@qq.com> Date: 星期二, 15 七月 2025 17:23:05 +0800 Subject: [PATCH] 111 --- HH.WCS.Mobox3.NongFuLinZhi/process/DeviceProcess.cs | 62 ++++++++++++++++-------------- 1 files changed, 33 insertions(+), 29 deletions(-) diff --git a/HH.WCS.Mobox3.NongFuLinZhi/process/DeviceProcess.cs b/HH.WCS.Mobox3.NongFuLinZhi/process/DeviceProcess.cs index 2936566..a4067b6 100644 --- a/HH.WCS.Mobox3.NongFuLinZhi/process/DeviceProcess.cs +++ b/HH.WCS.Mobox3.NongFuLinZhi/process/DeviceProcess.cs @@ -544,7 +544,7 @@ if (data.Length == 6) { - if (data.Substring(0, 2) == "11") + if (data.Substring(2, 2) == "22") { if (LocationHelper.CheckLocFree(plc.TN_Location[0])) { @@ -635,7 +635,11 @@ var workInfo = db.Queryable<LinZhiBCPWorkOrder>().Where(a => a.S_PLineNo == plc.deviceName).First(); if (workInfo != null && workInfo.S_WorkState == "鎵ц涓�) { - LogHelper.Info($"鏌ヨ鍒版墽琛屼腑鐨勫伐鍗曪紝宸ュ崟绫诲瀷锛歿workInfo.S_PLineNo}"); + if (workInfo.S_ItemName == "灏忓寘瑁呯洊") + { + return; + } + LogHelper.Info($"鏌ヨ鍒版墽琛屼腑鐨勫伐鍗曪紝宸ュ崟绫诲瀷锛歿workInfo.S_PLineNo},鐗╂枡缂栫爜锛歿workInfo.S_ItemCode}锛岀墿鏂欑被鍨嬶細{workInfo.S_ITEM_TYPE}"); string startArea = ""; string fullTaskType = ""; string emptyTaskType = ""; @@ -652,7 +656,7 @@ if (data.Length == 6) { - if (data.Substring(0, 2) == "11") + if (data.Substring(2, 2) == "22") { if (LocationHelper.CheckLocFree(plc.TN_Location[0])) { @@ -718,7 +722,9 @@ if(itemInfo != null) { LogHelper.Info($"getFDSXArea:鏌ヨ鍒扮墿鏂欑紪鐮侊細{itemInfo.S_ITEM_CODE}"); - if (itemInfo.S_ITEM_CODE == workInfo.S_ItemCode) + LogHelper.Info($"getFDSXArea:鏌ヨ鍒扮墿鏂欐壒娆★細{itemInfo.S_BATCH_NO}"); + if (workInfo.S_PLineNo.Contains("鐡跺澂")) workInfo.S_ITEM_TYPE = ""; + if (itemInfo.S_ITEM_CODE + itemInfo.S_BATCH_NO == workInfo.S_ItemCode + workInfo.S_ITEM_TYPE) { result = a; break; @@ -754,20 +760,6 @@ LogHelper.Info($"{plc.deviceName}-{plc.address}-{data}", "鐡跺澂鏈�); var db = new SqlHelper<object>().GetInstance(); - LogHelper.Info($"鐡跺澂鏈猴紝鏌ヨ浠诲姟缁堢偣锛歿plc.TN_Location[0]}"); - if (LineState.Keys.Contains(plc.TN_Location[0])) - { - LogHelper.Info("鐡跺澂鏈哄寘鍚浠诲姟缁堢偣"); - LineState[plc.TN_Location[0]].status = data; - LineState[plc.TN_Location[0]].modify = DateTime.Now; - } - else - { - LogHelper.Info("鐡跺澂鏈烘湭鍖呭惈璇ヤ换鍔$粓鐐�); - LineState.Add(plc.TN_Location[0], new statemodel { status = data, modify = DateTime.Now }); - } - - var workInfo = db.Queryable<LinZhiBCPWorkOrder>().Where(a => a.S_PLineNo == plc.deviceName).First(); if (workInfo != null && workInfo.S_WorkState == "鎵ц涓�) { @@ -785,11 +777,11 @@ taskType = "娉ㄥ搴撳瓨婊℃墭涓嬬嚎锛堢摱鍧級"; } //endArea = Settings.GetLinJiangBCPAreaList().Where(a => a.AreaName == "鐡跺澂婊℃墭" && a.Enable == "1").FirstOrDefault().AreaNo; - if (data.Length == 4) + if (data.Length == 8) { - if (data == "1122") LinZhialysisBottleCapAndPreformTwo(plc, db, workInfo, endArea, taskType, plc.TN_Location[0], "鐡跺澂鏈�); + if (data.Substring(0, 2) == "12") LinZhialysisBottleCapAndPreformTwo(plc, db, workInfo, endArea, taskType, plc.TN_Location[0], "鐡跺澂鏈�, data); - if (data == "1221") LinZhialysisBottleCapAndPreformTwo(plc, db, workInfo, endArea, taskType, plc.TN_Location[1], "鐡跺澂鏈�); + if (data.Substring(2, 2) == "22") LinZhialysisBottleCapAndPreformTwo(plc, db, workInfo, endArea, taskType, plc.TN_Location[1], "鐡跺澂鏈�, data); } } else LogHelper.Info($"鐡跺澂鏈猴細{plc.deviceName} 鏈紑鍚伐鍗曪紝涓嶅彲瑙﹀彂婊℃墭涓嬬嚎", "鐡跺澂鏈�); @@ -806,9 +798,22 @@ /// <param name="taskType"></param> /// <param name="deviceBit"></param> /// <param name="type"></param> - private static void LinZhialysisBottleCapAndPreformTwo(Settings.deviceInfo plc, SqlSugar.SqlSugarClient db, LinZhiBCPWorkOrder workInfo, string endArea, string taskType, string deviceBit, string type) + private static void LinZhialysisBottleCapAndPreformTwo(Settings.deviceInfo plc, SqlSugar.SqlSugarClient db, LinZhiBCPWorkOrder workInfo, string endArea, string taskType, string deviceBit, string type,string data) { LogHelper.Info($"{type}娉ㄥ鏈轰换鍔″鐞嗗紑濮�); + + LogHelper.Info($"鐡跺澂鏈猴紝鏌ヨ浠诲姟缁堢偣锛歿deviceBit}"); + if (LineState.Keys.Contains(deviceBit)) + { + LogHelper.Info("鐡跺澂鏈哄寘鍚浠诲姟缁堢偣"); + LineState[deviceBit].status = data; + LineState[deviceBit].modify = DateTime.Now; + } + else + { + LogHelper.Info("鐡跺澂鏈烘湭鍖呭惈璇ヤ换鍔$粓鐐�); + LineState.Add(deviceBit, new statemodel { status = data, modify = DateTime.Now }); + } //鍐嶆鍒ゆ柇淇″彿 if (LocationHelper.CheckLocFree(deviceBit)) { @@ -862,12 +867,12 @@ { LogHelper.Info($"{type}娉ㄥ鏈轰笂鏈粦瀹氭墭鐩�鑷姩缁戝畾鎵樼洏"); - TaskProcess.BindLocCntr(deviceBit, cntrCode, workInfo.S_ItemCode, ""); + TaskProcess.BindLocCntr(deviceBit, cntrCode, workInfo.S_ItemCode, "","","",workInfo.S_ItemName); } else { cntrCode = cntrInfo.S_CNTR_CODE; - TaskProcess.BindCntrItem(cntrCode, workInfo.S_ItemCode, "", ""); + TaskProcess.BindCntrItem(cntrCode, workInfo.S_ItemCode, "", "",workInfo.S_ItemName); } //鍒涘缓浣滀笟 WMSHelper.CreateOpTask(deviceBit, "", "鍏ュ簱", taskType, cntrCode,"","",workInfo.S_WorkNo); @@ -929,7 +934,7 @@ if (mst.S_TYPE.Contains("缈绘枟鏈�)) { LogHelper.Info($"鏌ヨ缈绘枟鏈哄厑璁稿彇绌轰俊鍙�鍏佽鍙栫┖淇″彿={LineState[mst.S_START_LOC.Trim()].status} 鏃堕棿闂撮殧={DateTime.Now.Subtract(LineState[mst.S_START_LOC.Trim()].modify).TotalSeconds}", "瀹夊叏浜や簰"); - if ((LineState[mst.S_START_LOC.Trim()].status == "112100" || LineState[mst.S_START_LOC.Trim()].status == "112200") && DateTime.Now.Subtract(LineState[mst.S_START_LOC.Trim()].modify).TotalSeconds < 10) + if (LineState[mst.S_START_LOC.Trim()].status.Substring(4,2) == "00" && DateTime.Now.Subtract(LineState[mst.S_START_LOC.Trim()].modify).TotalSeconds < 10) { //NDCHelper.ChangeParam(mst.S_CODE.Trim(), 1101, 18); NDCApi.ChangeOrderParam(mst.S_CODE.Trim(), 18, "1101"); @@ -941,7 +946,7 @@ LogHelper.Info($"鏌ヨ杈撻�绾垮厑璁稿彇婊′俊鍙�鍏佽鍙栨弧淇″彿={LineState[mst.S_START_LOC.Trim()].status} 鏃堕棿闂撮殧={DateTime.Now.Subtract(LineState[mst.S_START_LOC.Trim()].modify).TotalSeconds}", "瀹夊叏浜や簰"); if (mst.S_TYPE.Contains("婊℃墭涓嬬嚎")) { - if ((LineState[mst.S_START_LOC.Trim()].status.Substring(4,2) == "01" || LineState[mst.S_START_LOC.Trim()].status.Substring(6,2) == "02") && DateTime.Now.Subtract(LineState[mst.S_START_LOC.Trim()].modify).TotalSeconds < 10) + if ((LineState[mst.S_START_LOC.Trim()].status.Substring(4,2) == "00" || LineState[mst.S_START_LOC.Trim()].status.Substring(4,2) == "02") && DateTime.Now.Subtract(LineState[mst.S_START_LOC.Trim()].modify).TotalSeconds < 10) { //NDCHelper.ChangeParam(mst.S_CODE.Trim(), 1101, 18); NDCApi.ChangeOrderParam(mst.S_CODE.Trim(), 18, "1101"); @@ -956,7 +961,6 @@ TaskProcess.sendSing(mst, 1101); } } - } } else LogHelper.Info($"瀛楀吀涓湭鎵惧埌璇ey鐨勬暟鎹紝key锛歿mst.S_START_LOC}"); @@ -973,7 +977,7 @@ if (mst.S_TYPE.Contains("缈绘枟鏈�)) { LogHelper.Info($"鏌ヨ缈绘枟鏈哄厑璁镐笂婊′俊鍙�鍏佽涓婃弧淇″彿={LineState[mst.S_END_LOC.Trim()].status} 鏃堕棿闂撮殧={DateTime.Now.Subtract(LineState[mst.S_END_LOC.Trim()].modify).TotalSeconds}", "瀹夊叏浜や簰"); - if ((LineState[mst.S_END_LOC.Trim()].status == "112100" || LineState[mst.S_END_LOC.Trim()].status == "112200") && DateTime.Now.Subtract(LineState[mst.S_END_LOC.Trim()].modify).TotalSeconds < 10) + if (LineState[mst.S_END_LOC.Trim()].status.Substring(4,2) == "00" && DateTime.Now.Subtract(LineState[mst.S_END_LOC.Trim()].modify).TotalSeconds < 10) { //NDCHelper.ChangeParam(mst.S_CODE.Trim(), 1103, 18); NDCApi.ChangeOrderParam(mst.S_CODE.Trim(), 18, "1103"); @@ -985,7 +989,7 @@ LogHelper.Info($"鏌ヨ杈撻�绾垮厑璁歌ˉ绌轰俊鍙�鍏佽琛ョ┖淇″彿={LineState[mst.S_END_LOC.Trim()].status} 鏃堕棿闂撮殧={DateTime.Now.Subtract(LineState[mst.S_END_LOC.Trim()].modify).TotalSeconds}", "瀹夊叏浜や簰"); if (mst.S_TYPE.Contains("绌烘墭涓婄嚎")) { - if ((LineState[mst.S_END_LOC.Trim()].status.Substring(4,2) == "01" || LineState[mst.S_END_LOC.Trim()].status.Substring(6,2) == "02") && DateTime.Now.Subtract(LineState[mst.S_END_LOC.Trim()].modify).TotalSeconds < 10) + if ((LineState[mst.S_END_LOC.Trim()].status.Substring(4,2) == "00" || LineState[mst.S_END_LOC.Trim()].status.Substring(4,2) == "02") && DateTime.Now.Subtract(LineState[mst.S_END_LOC.Trim()].modify).TotalSeconds < 10) { //NDCHelper.ChangeParam(mst.S_CODE.Trim(), 1103, 18); NDCApi.ChangeOrderParam(mst.S_CODE.Trim(), 18, "1103"); -- Gitblit v1.9.1