From 74848b76f6ba1239f53cdf603a2f4904aa2434ef Mon Sep 17 00:00:00 2001 From: cjs <2216046164@qq.com> Date: 星期四, 26 六月 2025 17:15:22 +0800 Subject: [PATCH] 11 --- ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs index 6217aaf..600e210 100644 --- a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs +++ b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs @@ -201,7 +201,14 @@ if (ERPService.ERPSwitch01 == "0") MongoDBSingleton.Instance.Remove<MachineInfoTwo>(Query.EQ("machineNo", pmInfo.location), "MachineInfoTwo", RemoveFlags.None); CMMLog.Debug($"鍖呰涓嬬嚎娴佺▼-{pmInfo.location}锛氬彔鎵樺眰鏁颁负0锛屼笉鍏佽鐢熸垚浠诲姟"); } - else if (tray.trayCode != "0" && !string.IsNullOrEmpty(tray.trayCode)) + if (string.IsNullOrEmpty(tray.lotNo)) + { + MongoDBSingleton.Instance.Remove<MachineInfo>(Query.EQ("machineNo", pmInfo.location), "MachineInfo", RemoveFlags.None); + if (ERPService.ERPSwitch01 == "0") MongoDBSingleton.Instance.Remove<MachineInfoTwo>(Query.EQ("machineNo", pmInfo.location), "MachineInfoTwo", RemoveFlags.None); + CMMLog.Debug($"鍖呰涓嬬嚎娴佺▼-{pmInfo.location}锛氭壒娆″彿涓虹┖锛屼笉鍏佽鐢熸垚浠诲姟"); + + } + if (tray.trayCode != "0" && !string.IsNullOrEmpty(tray.trayCode)) { string timeStamp = ProcessHelper.GetTimeStamp(31, 1, 1); HHAmsExecuteResult req = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), pmInfo.location, PlcBit02, "3妤煎寘瑁呭彇鏂�, 0, tray.trayCode, timeStamp); @@ -402,7 +409,14 @@ if (ERPService.ERPSwitch01 == "0") MongoDBSingleton.Instance.Remove<MachineInfoTwo>(Query.EQ("machineNo", pmInfo.location), "MachineInfoTwo", RemoveFlags.None); CMMLog.Debug($"鍖呰涓嬬嚎娴佺▼-{pmInfo.location}锛氬彔鎵樺眰鏁颁负0锛屼笉鍏佽鐢熸垚浠诲姟"); } - else if (tray.trayCode != "0" && !string.IsNullOrEmpty(tray.trayCode)) + if (string.IsNullOrEmpty(tray.lotNo)) + { + MongoDBSingleton.Instance.Remove<MachineInfo>(Query.EQ("machineNo", pmInfo.location), "MachineInfo", RemoveFlags.None); + if (ERPService.ERPSwitch01 == "0") MongoDBSingleton.Instance.Remove<MachineInfoTwo>(Query.EQ("machineNo", pmInfo.location), "MachineInfoTwo", RemoveFlags.None); + CMMLog.Debug($"鍖呰涓嬬嚎娴佺▼-{pmInfo.location}锛氭壒娆″彿涓虹┖锛屼笉鍏佽鐢熸垚浠诲姟"); + + } + if (tray.trayCode != "0" && !string.IsNullOrEmpty(tray.trayCode)) { string timeStamp = ProcessHelper.GetTimeStamp(31, 1, 1); HHAmsExecuteResult req = AMSHelper.CreateTask(DateTime.Now.Ticks.ToString(), pmInfo.location, PlcBit02, "3妤煎寘瑁呭彇鏂�, 0, tray.trayCode, timeStamp); @@ -1156,10 +1170,10 @@ //Convert.ToInt32(Completion(result[8]) + Completion(result[9]), 2).ToString() //(decimal.Parse(tray.oneTrayWeight1) / 100).ToString("F2"); //string weight = (decimal.Parse(Convert.ToInt32(Completion(result.result[4]) + Completion(result.result[5]), 2).ToString()) / 100).ToString("F2"); - string weight = ((result.result[4] * 65536 + result.result[5]) / 100).ToString(); + string weight = ((result.result[3] * 65536 + result.result[4]) / 100).ToString(); - CMMLog.Debug($"SecondWeightActionOne: 璇诲彇璁惧{plc.location},ip:{plc.ip}閫氶亾{plc.readAddr + 4}閲岄潰鏁版嵁涓簕result.result[4]}."); - CMMLog.Debug($"SecondWeightActionOne: 璇诲彇璁惧{plc.location},ip:{plc.ip}閫氶亾{plc.readAddr + 5}閲岄潰鏁版嵁涓簕result.result[5]}."); + CMMLog.Info($"SecondWeightActionOne: 璇诲彇璁惧{plc.location},ip:{plc.ip}閫氶亾{plc.readAddr + 4}閲岄潰鏁版嵁涓簕result.result[3]}."); + CMMLog.Info($"SecondWeightActionOne: 璇诲彇璁惧{plc.location},ip:{plc.ip}閫氶亾{plc.readAddr + 5}閲岄潰鏁版嵁涓簕result.result[4]}."); //double x = (double)Convert.ToInt32(Completion(result[8]) + Completion(result[9]), 2) / 100; //CMMLog.Info($"SecondWeightActionOne: 璇诲彇璁惧{plc.location},ip:{plc.ip}閫氶亾{plc.readAddr + 4}閲岄潰鏁版嵁涓簕result.result[3]}."); CMMLog.Info($"SecondWeightActionOne: weight:{weight}"); -- Gitblit v1.9.1