From b8f0938c46299b821eb73b3b4aec9fc807178354 Mon Sep 17 00:00:00 2001 From: cjs <2216046164@qq.com> Date: 星期二, 10 六月 2025 17:33:09 +0800 Subject: [PATCH] 11 --- ams/Hanhe.iWCS.JingmenGEMTwoProtocol/PLCControl.cs | 90 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 90 insertions(+), 0 deletions(-) diff --git a/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/PLCControl.cs b/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/PLCControl.cs index cced9a5..890bb65 100644 --- a/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/PLCControl.cs +++ b/ams/Hanhe.iWCS.JingmenGEMTwoProtocol/PLCControl.cs @@ -4478,6 +4478,96 @@ CMMLog.Info($"鍦ㄩ�閬搟plc.writeAddr + 2}涓啓鍏JsonConvert.SerializeObject(num)}锛宨p锛歿plc.ip}锛岀鍙o細{plc.port}"); } + /// <summary> + /// 鍥涢挻A锛堟礂鏉跨儤骞叉満缁勶級璁惧涓婄┖涓嬫弧 + /// </summary> + /// <param name="plc"></param> + /// <exception cref="NotImplementedException"></exception> + internal static void AMachine(Settings.PlcInfo plc) + { + if (PickUpStartFree(plc.location) && PickUpEndFree(plc.location)) + { + try + { + var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel + { + dataNum = 1, + addr = plc.readAddr, + host = plc.ip, + port = plc.port + }); + if (result != null && result.errCode == 0) + { + if (result.result[0] == 1) + { + //閫佺┖ + bool req = WMSHelper.WMSOut(plc.location, "", ""); + if (req) CMMLog.Debug($"鍥涢挻A璁惧 璋冪敤WMS鑾峰彇绌烘墭鍑哄簱鐢熸垚浠诲姟鎴愬姛锛�);//鐜板湪浠诲姟鐢盬MS鑷繁涓嬪彂锛孉MS鍋氭嫤鎴鐞嗭紙鏌ヨext1閲岄潰瀵瑰簲鐨勪换鍔$被鍨嬶紝骞舵洿鏀逛换鍔$被鍨嬶級 + else CMMLog.Debug($"鍥涢挻A璁惧 璋冪敤WMS鑾峰彇绌烘墭鍑哄簱鐢熸垚浠诲姟澶辫触锛�); + } + if (result.result[0] == 2) + { + //鍙栨弧 + string wmstaskno = ""; + string traycode = ""; + bool req = WMSHelper.WMSIn(plc.location, "", ref wmstaskno, ref traycode); + if (req) CMMLog.Debug($"鍥涢挻A璁惧 璋冪敤WMS鑾峰彇婊℃墭鍏ュ簱鐢熸垚浠诲姟鎴愬姛锛�);//鐜板湪浠诲姟鐢盬MS鑷繁涓嬪彂锛孉MS鍋氭嫤鎴鐞嗭紙鏌ヨext1閲岄潰瀵瑰簲鐨勪换鍔$被鍨嬶紝骞舵洿鏀逛换鍔$被鍨嬶級 + else CMMLog.Debug($"鍥涢挻A璁惧 璋冪敤WMS鑾峰彇婊℃墭鍏ュ簱鐢熸垚浠诲姟澶辫触锛�); + } + } + } + catch (Exception ex) + { + CMMLog.Info($"鍥涢挻A璁惧 err:{ex.Message}"); + } + } + } + + /// <summary> + /// 鍥涢挻C锛堥挻鏉垮壀鍒囨満缁勶級璁惧涓婃弧涓嬬┖ + /// </summary> + /// <param name="a"></param> + /// <exception cref="NotImplementedException"></exception> + internal static void CMachine(Settings.PlcInfo plc) + { + if (PickUpStartFree(plc.location) && PickUpEndFree(plc.location)) + { + try + { + var result = OITcpHelper.RegisterReadOutPut(new OITcpHelper.RegisterReadOutPutModel + { + dataNum = 1, + addr = plc.readAddr, + host = plc.ip, + port = plc.port + }); + if (result != null && result.errCode == 0) + { + if (result.result[0] == 1) + { + //閫佹弧 + bool req = WMSHelper.WMSOut(plc.location, "", ""); + if (req) CMMLog.Debug($"鍥涢挻C璁惧 璋冪敤WMS鑾峰彇婊℃墭鍑哄簱鐢熸垚浠诲姟鎴愬姛锛�);//鐜板湪浠诲姟鐢盬MS鑷繁涓嬪彂锛孉MS鍋氭嫤鎴鐞嗭紙鏌ヨext1閲岄潰瀵瑰簲鐨勪换鍔$被鍨嬶紝骞舵洿鏀逛换鍔$被鍨嬶級 + else CMMLog.Debug($"鍥涢挻C璁惧 璋冪敤WMS鑾峰彇婊℃墭鍑哄簱鐢熸垚浠诲姟澶辫触锛�); + } + if (result.result[0] == 2) + { + //鍙栫┖ + string wmstaskno = ""; + string traycode = ""; + bool req = WMSHelper.WMSIn(plc.location, "", ref wmstaskno, ref traycode); + if (req) CMMLog.Debug($"鍥涢挻C璁惧 璋冪敤WMS鑾峰彇绌烘墭鍏ュ簱鐢熸垚浠诲姟鎴愬姛锛�);//鐜板湪浠诲姟鐢盬MS鑷繁涓嬪彂锛孉MS鍋氭嫤鎴鐞嗭紙鏌ヨext1閲岄潰瀵瑰簲鐨勪换鍔$被鍨嬶紝骞舵洿鏀逛换鍔$被鍨嬶級 + else CMMLog.Debug($"鍥涢挻C璁惧 璋冪敤WMS鑾峰彇绌烘墭鍏ュ簱鐢熸垚浠诲姟澶辫触锛�); + } + } + } + catch (Exception ex) + { + CMMLog.Info($"鍥涢挻C璁惧 err:{ex.Message}"); + } + } + } + #endregion public class WMS_STOCK_VIEW -- Gitblit v1.9.1