From 70cbc3af5300fe44b48215f8520f465ffa231df6 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@DESKTOP-JIE70N9> Date: 星期二, 22 七月 2025 09:55:17 +0800 Subject: [PATCH] 修改问题 --- Admin.NET/WCS.Application/PLC/PLCService.cs | 64 ++++++++++++++++++++++++------- 1 files changed, 49 insertions(+), 15 deletions(-) diff --git a/Admin.NET/WCS.Application/PLC/PLCService.cs b/Admin.NET/WCS.Application/PLC/PLCService.cs index 7167186..ccbe536 100644 --- a/Admin.NET/WCS.Application/PLC/PLCService.cs +++ b/Admin.NET/WCS.Application/PLC/PLCService.cs @@ -9,6 +9,8 @@ using Furion.Logging; using IoTClient; using NewLife.Reflection; +using Newtonsoft.Json; +using Org.BouncyCastle.Ocsp; using SixLabors.ImageSharp.ColorSpaces; using WCS.Application.Entity; using WCS.Application.Util; @@ -39,7 +41,7 @@ AGV(mod); // AGV璋冨害 break; case PLCTypeEnum.ShuttleCar: //绌挎杞� - //if (mod.PlcIdIP == "10.26.254.28") + //if (mod.PlcIdIP == "10.26.254.28") //{ // break; //} @@ -541,18 +543,23 @@ var modPosTaskStatus2 = modDevice.listStation.FirstOrDefault(s => s.Text == "浠诲姟鐘舵��"); var (resultTaskStatus2, valueTaskStatus2) = plcConn.GetDBValue(modPosTaskStatus.PosType, modPosTaskStatus.PlcPos); - if (resultCar.IsSucceed && valueCar == 1 && resultTaskStatus2.IsSucceed && (valueTaskStatus2 == 0 || valueTaskStatus2 == 1)) + if (resultCar.IsSucceed && valueCar == 1 && resultTaskStatus2.IsSucceed && (valueTaskStatus2 == 0 || valueTaskStatus2 == 1)) { - //鍏堝浣� - var modRest = modDevice.listStation.FirstOrDefault(s => s.Text == "澶嶄綅"); - plcConn.SetDBValue(modRest.PosType, modRest.PlcPos, "1"); + var carnew = _db.Queryable<WcsCarTasks>().Where(m => m.IsDelete == false && m.TaskNo == modTask.TaskNo && m.CarNo == modDevice.PlcIdIP && m.Status == TaskStatusEnum.Doing).OrderBy(m => m.CreateTime).First(); + + if (carnew == null) + { + //鍏堝浣� + var modRest = modDevice.listStation.FirstOrDefault(s => s.Text == "澶嶄綅"); + plcConn.SetDBValue(modRest.PosType, modRest.PlcPos, "1"); + } } else { return; } - List<Result> listResult = new List<Result>(); + List<Result> listResult = new List<Result>(); //鑾峰彇灏忚溅浠诲姟鍙� var carTaskNo = FourWayCarUtil.GetTaskNo(); @@ -1424,11 +1431,33 @@ taskModel.taskType = taskTypeModel; if (jiebo == "") { - taskModel.targetRoute = new List<targetRoute>() + + taskModel.targetRoute = new List<targetRoute>(); + + if (taskModel.taskType == "DPJRK") { - new targetRoute(){seq = 0,type = type1,code = modTask.StartLocate}, - new targetRoute(){seq = 1,type = type2,code = modTask.EndLocate} - }; + //var code = "[{\"type\":\"SITE\",\"code\":\"B100101\"},{\"type\":\"PILE_COUNT\",\"code\":\"8\"}]"; + var code = new List<object>() + { + new {type = "SITE" , code = modTask.StartLocate}, + new { type = "PILE_COUNT", code = modTask.Qty } + }; + + taskModel.targetRoute.Add(new targetRoute() { + seq = 0, + type = "MIX_CONDITION", + code = JsonConvert.SerializeObject(code) // "[{\"type":\"SITE", code = modTask.StartLocate },new { type = "PILE_COUNT", code = modTask.Qty }]" + + + }); + taskModel.targetRoute.Add(new targetRoute() { seq = 1, type = type2, code = modTask.EndLocate }); + } + else + { + taskModel.targetRoute.Add(new targetRoute() { seq = 0, type = type1, code = modTask.StartLocate }); + taskModel.targetRoute.Add(new targetRoute() { seq = 1, type = type2, code = modTask.EndLocate }); + } + } else { @@ -1439,14 +1468,19 @@ new targetRoute(){seq = 2,type = type2,code = modTask.EndLocate} }; } - - taskModel.extra = new extra() + + taskModel.extra = new extra(); + + if (taskModel.taskType != "DPJRK") { - carrierInfo = new List<carrierInfo>() + taskModel.extra.carrierInfo = new List<carrierInfo>() { new carrierInfo(){ carrierType = "TP",carrierCode = modTask.PalletNo} - } - }; + }; + } + + + var response = new HttpService().GenAgvSendTask(taskModel).Result; if (response.code == "SUCCESS") { -- Gitblit v1.8.0