From 1a39a01ff6d99ab4c98e7243aa0d3e0a264008ad Mon Sep 17 00:00:00 2001 From: zhaowc <526854230@qq.com> Date: 星期日, 16 二月 2025 09:02:33 +0800 Subject: [PATCH] 修改测试出现的问题 --- Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 116 insertions(+), 0 deletions(-) diff --git a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs index 67583ce..312164b 100644 --- a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs +++ b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs @@ -1,4 +1,5 @@ 锘縰sing Dm.filter; +using DocumentFormat.OpenXml.Drawing.Charts; using DocumentFormat.OpenXml.Presentation; using Elastic.Clients.Elasticsearch; using Furion.Logging; @@ -398,4 +399,119 @@ } } + + /// <summary> + /// WCS鎺ュ彈WMS鍏ュ簱鏀捐揣纭鎺ュ彛 + /// </summary> + /// <param name="models"></param> + /// <returns>鍙嶉淇℃伅</returns> + [HttpPost] + [AllowAnonymous] + public IsBaleModel2 HttpInConfirm(PortModel models) + { + + try + { + string str = JsonConvert.SerializeObject(models); + Log.Information("鎺ユ敹WMS鍏ュ簱鏀捐揣纭锛屾斁璐у彛锛�" + models.Port+"鍏ュ簱鍙�"); + + //妫�娴嬪叆搴撳彛鐘舵�侊紝120涓哄彲鏀撅紝鍗犵敤鍒欎慨鏀逛负130 + WcsDeviceDto modDevice = new WcsDeviceDto(); + var modPosTask = modDevice.listStation.FirstOrDefault(m => m.Text == "PLC娴佺▼瀛�"); + var plcConn = modDevice.PLCUtil; + var (res1, val) = plcConn.GetPlcDBValue(modPosTask.PosType, modDevice.DbNumber, modPosTask.PlcPos); + if (val.ToString() == "120") + { + modPosTask = modDevice.listStation.FirstOrDefault(m => m.Text == "WCS娴佺▼瀛�"); + //璇诲彇鎴愬姛鍚庡啓鍏�130 + var ret = plcConn.SetPlcDBValue(modPosTask.PosType, modDevice.DbNumber, modPosTask.PlcPos, "130");//鍗犵敤姝ゅ伐浣� + if (ret.IsSucceed) + { + //鍥炰紶WMS鍙斁淇″彿 + return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" }; + } + } + return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" }; + } + catch (Exception ex) + { + return new IsBaleModel2() { Success = -1, Message = ex.Message }; + } + } + + + /// <summary> + /// WCS鎺ュ彈WMS鍏ュ簱鏀捐揣璇锋眰鎺ュ彛 + /// </summary> + /// <param name="models"></param> + /// <returns>鍙嶉淇℃伅</returns> + [HttpPost] + [AllowAnonymous] + public IsBaleModel2 HttpInRequest(PortRequestModel models) + { + try + { + string str = JsonConvert.SerializeObject(models); + Log.Information("鎺ユ敹WMS鍏ュ簱鏀捐揣纭锛屾斁璐у彛锛�" + models.Port + "鍏ュ簱鍙�"); + + WcsDeviceDto modDevice = new WcsDeviceDto(); + var plcConn = modDevice.PLCUtil; + //鑾峰彇宸ヤ綅鐐逛綅淇℃伅 + //modDevice = ......=models.Port + var modPosTask = modDevice.listStation.FirstOrDefault(m => m.Text == "浠诲姟鍙�"); + plcConn.SetPlcDBValue(modPosTask.PosType, modDevice.DbNumber, modPosTask.PlcPos, models.TaskNo);//鍐欏叆浠诲姟鍙� + // + modPosTask = modDevice.listStation.FirstOrDefault(m => m.Text == "WCS娴佺▼瀛�"); + + var ret = plcConn.SetPlcDBValue(modPosTask.PosType, modDevice.DbNumber, modPosTask.PlcPos, "140");//寮�濮嬫斁璐� + if (ret.IsSucceed) + { + //鍥炰紶WMS鏀捐揣淇″彿 + return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" }; + } + return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" }; + } + catch (Exception ex) + { + return new IsBaleModel2() { Success = -1, Message = ex.Message }; + } + } + + + + /// <summary> + /// WCS鎺ュ彈WMS灏忚溅鏀惧畬鎴愭帴鍙� + /// </summary> + /// <param name="models"></param> + /// <returns>鍙嶉淇℃伅</returns> + [HttpPost] + [AllowAnonymous] + public IsBaleModel2 HttpInFinish(PortModel models) + { + + try + { + string str = JsonConvert.SerializeObject(models); + Log.Information("鎺ユ敹WMS鍏ュ簱鏀捐揣纭锛屾斁璐у彛锛�" + models.Port + "鍏ュ簱鍙�"); + + WcsDeviceDto modDevice = new WcsDeviceDto(); + //鑾峰彇宸ヤ綅鐐逛綅淇℃伅 + //modDevice = ......=models.Port + + var modPosTask = modDevice.listStation.FirstOrDefault(m => m.Text == "WCS娴佺▼瀛�"); + var plcConn = modDevice.PLCUtil; + var ret = plcConn.SetPlcDBValue(modPosTask.PosType, modDevice.DbNumber, modPosTask.PlcPos, "140");//寮�濮嬫斁璐� + if (ret.IsSucceed) + { + //鍥炰紶WMS鏀捐揣淇″彿 + return new IsBaleModel2() { Success = 0, Message = "鎺ュ彈鎴愬姛" }; + } + return new IsBaleModel2() { Success = -1, Message = "璇诲彇PLC鐐逛綅淇℃伅澶辫触" }; + } + catch (Exception ex) + { + return new IsBaleModel2() { Success = -1, Message = ex.Message }; + } + } + } \ No newline at end of file -- Gitblit v1.8.0