From b7dcf71a817da7b0bea591b8a5d3ab53b0aea136 Mon Sep 17 00:00:00 2001 From: cjs <2216046164@qq.com> Date: 星期五, 11 七月 2025 17:25:17 +0800 Subject: [PATCH] 11 --- ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs | 26 +++++++++++++++----------- ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs | 4 +++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs index 5361853..2cf0755 100644 --- a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs +++ b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/PLCControl.cs @@ -215,6 +215,7 @@ if (req.success) { string weight = (double.Parse(tray.oneTrayWeight1) / 100).ToString(); + //CMMLog.Debug("鍖楀尯娴嬭瘯鏁版嵁锛氬寘瑁呬笅绾块噸閲忥細"+(decimal.Parse(tray.oneTrayWeight1) / 100).ToString("F2")); //int weight = int.Parse(tray.oneTrayWeight) / 100; ERPService.packageInfo(tray.machineNo, tray.trayCode, tray.lotNo, weight,1); } @@ -1167,15 +1168,12 @@ { CMMLog.Info($"SecondWeightActionOne: machine:{query.machineNo},trayCode:{query.trayCode},weight:{query.weight}"); //璇诲彇澶嶇О骞冲彴鐨勯噸閲�- //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[3] * 65536 + result.result[4]) / 100).ToString(); + //string weight = ((result.result[3] * 65536 + result.result[4]) / 100).ToString(); + string weight = ((double)Convert.ToInt32(Completion(result.result[3]) + Completion(result.result[4]), 2) / 100).ToString(); + //CMMLog.Debug("鍖楀尯娴嬭瘯鏁版嵁锛氬绉伴噸閲忥細" + ((double)Convert.ToInt32(Completion(result.result[3]) + Completion(result.result[4]), 2) / 100).ToString()); 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}"); //閲嶉噺宸� @@ -1432,7 +1430,7 @@ //璇诲彇閫氶亾1閲岄潰鍙傛暟鏄惁涓�锛屽垽鏂彔鐩樻満鏄惁闇�涓婃枡 var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel { - dataNum = 1, + dataNum = 3, addr = pmInfo.readAddr + 1, host = pmInfo.ip, port = pmInfo.port @@ -1442,14 +1440,20 @@ //鍙傛暟1琛ㄧず鍙犳墭鐐圭敵璇峰叆鏂� if (result.result[0] == 1) { + CMMLog.Debug($"鑾峰彇纰熺洏鏈轰俊鍙凤細{JsonConvert.SerializeObject(result)}"); 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鑾峰彇纰熺洏鍑哄簱鐢熸垚浠诲姟澶辫触锛�); + string trayType = result.result[2] == 1 ? "鐢板瓧鎵� : result.result[2] == 2 ? "宸濆瓧鎵� : ""; + if (result.result[2] >= 1 && result.result[2] <= 2) + { + //鍙互鐢熸垚浠诲姟锛岃皟WMS鎺ュ彛鑾峰彇浠诲姟淇℃伅 + bool req = WMSHelper.WMSOut(pmInfo.location, "",trayType); + if (req) CMMLog.Debug($"璋冪敤WMS鑾峰彇纰熺洏鍑哄簱鐢熸垚浠诲姟鎴愬姛锛�);//鐜板湪浠诲姟鐢盬MS鑷繁涓嬪彂锛孉MS鍋氭嫤鎴鐞嗭紙鏌ヨext1閲岄潰瀵瑰簲鐨勪换鍔$被鍨嬶紝骞舵洿鏀逛换鍔$被鍨嬶級 + else CMMLog.Debug($"璋冪敤WMS鑾峰彇纰熺洏鍑哄簱鐢熸垚浠诲姟澶辫触锛�); + } + } else CMMLog.Debug($"妫�煡褰撳墠鍙犳墭鐐规槸鍚︽湁浠诲姟鍗犵敤锛屾垨鑰匨ST涓昏〃涓湁缂撳瓨鏋跺叆鍙犵洏鏈虹殑浠诲姟锛�); } diff --git a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs index d429892..b490081 100644 --- a/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs +++ b/ams/Hanhe.iWCS.JingmenGLMNorthProtocol/WMSHelper.cs @@ -110,6 +110,7 @@ public string endBit { get; set; } public string trayDimension { get; set; } public string needCreateAMSTask { get; set; } + public string TrayType { get; set; } public int priority { get; set; } //public int isFull { get; set; } public string projectCode { get; set; } @@ -503,7 +504,7 @@ return result; } - public static bool WMSOut(string endBit, string ItemCode) { + public static bool WMSOut(string endBit, string ItemCode,string trayType) { //endBit = endBit.Substring(0, 9); bool result = false; HardwareAccessObject hao = HardwareAccessHelper.Instance.GetEquipmentsHAO(Constants.WMS_DEVICE_TYPE_WMS); @@ -514,6 +515,7 @@ model.endBit = endBit; model.projectCode = "glm"; model.needCreateAMSTask = "Y"; + model.TrayType = trayType; //model.Data = new List<ItemData>(); //if (!string.IsNullOrEmpty(ItemCode)) //{ -- Gitblit v1.9.1