From 5ffc36a1db18d3112a9b50a9cf3953d7fcf21bae Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期二, 19 八月 2025 16:37:24 +0800 Subject: [PATCH] 更新 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 147 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 116 insertions(+), 31 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" index 7473a18..6daab39 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" @@ -24,6 +24,7 @@ using Newtonsoft.Json; using Quartz; using SqlSugar; +using System.Net; using System.Reflection; using System.Threading.Tasks; using WIDESEAWCS_BasicInfoRepository; @@ -43,6 +44,7 @@ using WIDESEAWCS_QuartzJob.Service; using WIDESEAWCS_SignalR; using WIDESEAWCS_Tasks.ConveyorLineJob; +using WIDESEAWCS_Tasks.StackerCraneJob; using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_Tasks @@ -85,9 +87,12 @@ if (conveyorLine != null) { List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode); + + ConveyorLineTaskCommand command2 = new ConveyorLineTaskCommand(); foreach (var station in stationManagers) { ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode); + DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == station.stationChildCode && x.ProtocalDetailValue == command.ConveyorLineSingal.ToString()); @@ -140,11 +145,12 @@ } catch (Exception ex) { + //WriteError("CommonConveyorLineJob", ex); Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString()); } finally { - //WriteDebug("CommonConveyorLineJob", "test"); + WriteDebug("CommonConveyorLineJob", "test"); //Console.Out.WriteLine(DateTime.Now); } return; @@ -174,7 +180,17 @@ if (task != null) { conveyorLine.SetValue(ConveyorLineDBName.Number, task.PalletCode, stationInfo.stationChildCode); - conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.NextAddress, stationInfo.stationChildCode); + + if ((task.TargetAddress == "2042" || task.TargetAddress == "2032") && task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) + { + conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.TargetAddress, stationInfo.stationChildCode); + } + else + { + conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.NextAddress, stationInfo.stationChildCode); + } + + //conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.NextAddress, stationInfo.stationChildCode); conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); _taskService.UpdateTaskStatusToNext(task); @@ -189,7 +205,16 @@ else { conveyorLine.SetValue(ConveyorLineDBName.Number, taskNew.PalletCode, stationInfo.stationChildCode); - conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taskNew.NextAddress, stationInfo.stationChildCode); + + if ((taskNew.TargetAddress == "2042" || taskNew.TargetAddress == "2032") && taskNew.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) + { + conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taskNew.TargetAddress, stationInfo.stationChildCode); + } + else + { + conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taskNew.NextAddress, stationInfo.stationChildCode); + } + //conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taskNew.NextAddress, stationInfo.stationChildCode); conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); _taskService.UpdateTaskStatusToNext(taskNew); @@ -272,9 +297,15 @@ conveyorLine.SetValue(ConveyorLineDBName.WheelsDiameter, task.wheels_gkcc, stationInfo.stationChildCode); conveyorLine.SetValue(ConveyorLineDBName.WheelsLX, task.WheelsLX, stationInfo.stationChildCode); - conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); - - _taskService.UpdatePosition(task.TaskNum, stationInfo.stationChildCode); + Dt_Task dt_Task = _taskService.UpdatePosition(task.TaskNum, stationInfo.stationChildCode); + if (dt_Task != null) + { + conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); + } + else + { + conveyorLine.SetValue(ConveyorLineDBName.ResponState, 3, stationInfo.stationChildCode); + } } } @@ -318,35 +349,62 @@ var task = _taskService.QueryExecutingTaskByBarcode(command.Number, stationInfo.stationChildCode); if (task != null) { - //鏍规嵁杞﹁酱缂撳瓨浣嶇疆 鍐欏叆瀵瑰簲鐩爣鍦板潃 - if (task.TargetAddress == stationInfo.stationChildCode) + if (task.TargetAddress == "2032" || task.TargetAddress == "2042") { - WebResponseContent content = _taskService.RequestWheelsFlow(task.task_CZInfo).Result; + + bool k1 = conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode); + + bool k2 = conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.TargetAddress, stationInfo.stationChildCode); + bool k3 = conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); + WebResponseContent k4 = _taskService.UpdateTaskStatusToNext(task); + + Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},浠诲姟淇敼鐘舵�侊細{k4.Status}锛�)"); + + } + else + { + WebResponseContent content = _taskService.RequestWheelsFlow(task.PalletCode).Result; if (content.Status) { - string taraddress = content.Data.ToString(); // "2032"; + string taraddress = content.Data.ToString(); // "2032";SourceAddress - conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taraddress, stationInfo.stationChildCode); - conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); - _taskService.UpdateTaskStatusToNext(task); + bool k1 = conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode); + + bool k2 = conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.TargetAddress, stationInfo.stationChildCode); + bool k3 = conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); + WebResponseContent k4 = _taskService.UpdateTaskStatusToNext(task); + + Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},浠诲姟淇敼鐘舵�侊細{k4.Status}锛�)"); } else { conveyorLine.SetValue(ConveyorLineDBName.ResponState, 2, stationInfo.stationChildCode); + + Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屽悜WMS鐢宠鍘诲悜澶辫触锛屽師鍥狅細{content.Message},鍐欏叆鐢宠瘔淇℃晠闅滐細2"); } } - else - { - conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, task.TargetAddress, stationInfo.stationChildCode); - conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); - _taskService.UpdateTaskStatusToNext(task); - } + } else { - conveyorLine.SetValue(ConveyorLineDBName.ResponState, 2, stationInfo.stationChildCode); + + string taraddresspos = _taskService.RequestWheletHty(command.Number); + if (taraddresspos != null) + { + + bool k1 = conveyorLine.SetValue(ConveyorLineDBName.SourceAddress, "2021", stationInfo.stationChildCode); + + bool k2 = conveyorLine.SetValue(ConveyorLineDBName.TargetAddress, taraddresspos, stationInfo.stationChildCode); + bool k3 = conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); + + Console.Out.WriteLine($"鍘嗗彶鏌ヨ淇℃伅锛�,鐢宠鏉$爜锛歿command.Number}锛屽弽棣堣嚦杈撻�佺嚎淇℃伅====璧峰鍦板潃锛歿k1},鐩爣鍦板潃鈥渰k2},鍙嶉淇″彿锛歿k3},鍐欏叆鐩爣鍦板潃涓猴細{taraddresspos})"); + } + else + { + conveyorLine.SetValue(ConveyorLineDBName.ResponState, 2, stationInfo.stationChildCode); + Console.Out.WriteLine($"璇诲彇鍒拌緭閫佺嚎鐢宠,鐢宠鏉$爜锛歿command.Number}锛屾湭鎵惧埌浠诲姟锛岀敵璇蜂笅涓�鍦板潃涓猴細{stationInfo.stationChildCode},鍐欏叆鐢宠瘔淇℃晠闅滐細2"); + } } - //_taskService.UpdatePosition(task.TaskNum, stationInfo.stationChildCode); } #region 杞﹁酱绾夸氦浜� @@ -359,15 +417,16 @@ /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param> public void RequestCZInfo(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, Dt_StationManager stationInfo) { - var task = _taskService.QueryExecutingTaskByBarcode(command.Number, stationInfo.stationChildCode); - if (task == null) + WebResponseContent content = _taskService.GetFeedbackAxleloading(); + if (content.Status) { - //todo 鏌ヨWMS杞﹁酱鏁版嵁杩斿洖 - Random random = new Random(20); - string cztm = "CZ00" + random.Next(); - //conveyorLine - //conveyorLine.SetValue(ConveyorLineDBName.Number, cztm, stationInfo.stationChildCode); + conveyorLine.SetValue(ConveyorLineDBName.Number, content.Data.ToString(), stationInfo.stationChildCode); + conveyorLine.SetValue(ConveyorLineDBName.CarType, "001", stationInfo.stationChildCode); conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); + } + else + { + conveyorLine.SetValue(ConveyorLineDBName.ResponState, 2, stationInfo.stationChildCode); } } @@ -380,11 +439,37 @@ /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param> public void RequestTakeCZ(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, Dt_StationManager stationInfo) { - var task = _taskService.QueryExecutingTaskByBarcode(command.Number, stationInfo.stationChildCode); - if (task == null) + WebResponseContent content = _taskService.UpdateAxleCurrentStatue(command.Number); + if (content.Status) { - //conveyorLine conveyorLine.SetValue(ConveyorLineDBName.ResponState, 1, stationInfo.stationChildCode); + Console.Out.WriteLine("鎴愬姛锛佸啓鍑鸿溅杞寸嚎鏈鐢熸垚agv鍙栬揣浠诲姟锛屽弽棣堣緭閫佺嚎淇″彿锛�1"); + } + /*else + { + var log = $"銆恵conveyorLine.DeviceName}銆�,杞﹁酱鏉$爜锛歿command.Number}锛屾洿鏂板け璐ュ師鍥狅細{content.Message}"; + WriteInfo(conveyorLine.DeviceName, log); + conveyorLine.SetValue(ConveyorLineDBName.ResponState, 3, stationInfo.stationChildCode); + }*/ + } + + + /// <summary> + /// agv绔欏彴鐢宠鍙栨枡 + /// </summary> + /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param> + /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param> + /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> + /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param> + public void RequestagvStation(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, Dt_StationManager stationInfo) + { + DeviceProDTO? deviceProDTOt = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == "3022" && x.DeviceProParamName == "Number"); + string Number = conveyorLine.Communicator.Read<string>(deviceProDTOt.DeviceProAddress); + if (Number != "" && Number != null) + { + //璋冨彇wms鎺ュ彛鐢宠agv浠诲姟 + WebResponseContent content = _taskService.GetAGVTaskdistribution(stationInfo.stationLocation); + } } #endregion -- Gitblit v1.9.3