From 2a20cd300ab6d9233a708a0f4558ba3d92c9f0a2 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <1247017146@qq.com> Date: 星期一, 21 四月 2025 14:16:51 +0800 Subject: [PATCH] 优化入库查询任务方法,高温2号堆垛机缓存俩框 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 12 ++++-- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 18 ++++++-- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 22 +++++++++++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 17 ++++++++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs | 15 ++++++- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs | 2 6 files changed, 73 insertions(+), 13 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs index 96bd474..be5deb7 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs @@ -112,6 +112,15 @@ /// <summary> + /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�銆佹墭鐩樺彿鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟 + /// </summary> + /// <param name="deviceNo">璁惧缂栧彿</param> + /// <param name="currentAddress">褰撳墠鍦板潃</param> + /// <param name="Barcode">鎵樼洏鍙�</param> + /// <returns></returns> + Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress,string Barcode); + + /// <summary> /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟 /// </summary> /// <param name="deviceNo">璁惧缂栧彿</param> @@ -136,6 +145,14 @@ Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress); /// <summary> + /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟 + /// </summary> + /// <param name="taskNum">浠诲姟鍙�</param> + /// <param name="nextAddress">涓嬩竴鍦板潃</param> + /// <returns></returns> + Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress, string Barcode); + + /// <summary> /// 鏍规嵁鎵樼洏鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟 /// </summary> /// <param name="taskNum">浠诲姟鍙�</param> diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs index 5cafee4..3d3b6b5 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs @@ -266,6 +266,17 @@ /// <param name="deviceNo">璁惧缂栧彿</param> /// <param name="currentAddress">褰撳墠鍦板潃</param> /// <returns></returns> + public Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress,string Barcode) + { + return BaseDal.QueryFirst(x => ((TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew) || (TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)) && x.CurrentAddress == currentAddress && x.PalletCode == Barcode, TaskOrderBy); + } + + /// <summary> + /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟 + /// </summary> + /// <param name="deviceNo">璁惧缂栧彿</param> + /// <param name="currentAddress">褰撳墠鍦板潃</param> + /// <returns></returns> public Dt_Task QueryNextConveyorLineTask(string deviceNo, string currentAddress) { return BaseDal.QueryFirst(x => ((TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew) || (TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)) && x.NextAddress == currentAddress, TaskOrderBy); @@ -294,6 +305,17 @@ } /// <summary> + /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟 + /// </summary> + /// <param name="taskNum">浠诲姟鍙�</param> + /// <param name="nextAddress">涓嬩竴鍦板潃</param> + /// <returns></returns> + public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress,string Barcode) + { + return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy); + } + + /// <summary> /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎瀹屾垚鐨勪换鍔� /// </summary> /// <param name="taskNum">浠诲姟鍙�</param> diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs index 9719f2b..9b1752f 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs @@ -382,7 +382,8 @@ _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); WriteInfo(conveyorLine.DeviceName, log); - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode); if (task != null) { if (command.Barcode == task.PalletCode) @@ -428,7 +429,8 @@ _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); WriteInfo(conveyorLine.DeviceName, log); - var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + //var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode); if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish) { if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress) @@ -550,7 +552,8 @@ WriteInfo(conveyorLine.DeviceName, log); // 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟锛屾牴鎹换鍔″彿鍜屽瓙璁惧浠g爜鑾峰彇浠诲姟淇℃伅 - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode); // 濡傛灉浠诲姟瀛樺湪 if (task != null) @@ -610,7 +613,8 @@ WriteInfo(conveyorLine.DeviceName, logs); // 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟 - var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + //var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); + var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode, command.Barcode); // 濡傛灉浠诲姟瀛樺湪 if (task != null) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs index f90762f..18fa8b4 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs @@ -152,7 +152,7 @@ var content = CreateAndSendTask(taskDTO); if (content.Status) { - var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); + var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode, command.Barcode); if (task != null) { //var taskCommand = MapTaskCommand(task, command); diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs index 6dc3b07..40d2264 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs @@ -212,6 +212,12 @@ } else { + var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList(); + if (GWTask.Count >= 2 && childDeviceCode == "1039") + { + ConsoleHelper.WriteErrorLine($"鎵樼洏鍙凤細銆恵command.ConveyorLineBarcode}銆戦珮娓╀簩宸插瓨鍦ㄣ�恵GWTask.Count}銆戜釜浠诲姟澶т簬2涓换鍔′笉鍙笅鍙�"); + return; + } ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); conveyorLine.SendCommand(taskCommand, childDeviceCode); conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); @@ -232,7 +238,8 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void RequestInNextAddress(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) { - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); + //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); + Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode, command.ConveyorLineBarcode); if (task != null) { if (command.ConveyorLineBarcode != task.PalletCode) @@ -308,7 +315,8 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void RequestOutNextAddress(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) { - Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); + //Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); + Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode, command.ConveyorLineBarcode); if (task != null) { var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); @@ -367,7 +375,8 @@ /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> public void ConveyorLineOutFinish(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) { - var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); + //var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); + var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode, command.ConveyorLineBarcode); if (task != null) { WebResponseContent content = new WebResponseContent(); diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs index ca89b74..3445fb0 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs @@ -183,7 +183,7 @@ // break; //} - RequestWmsTask(conveyorLine, command, childDeviceCode); + RequestWmsTask(conveyorLine, command, childDeviceCode,stationManager); break; } } @@ -272,7 +272,7 @@ var content = CreateAndSendTask(taskDTO); if (content.Status) { - var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); + var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode, command.ConveyorLineBarcode); if (task != null) { var taskCommand = MapTaskCommand(task, command); @@ -318,7 +318,7 @@ /// <summary> /// 璇锋眰WMS浠诲姟 /// </summary> - private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) + private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, Dt_StationManager stationManager) { //var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && (x.TaskState == (int)TaskOutStatusEnum.OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutPending)); //if (taskGW != null) @@ -333,16 +333,24 @@ //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, task.TaskNum, childDeviceCode); //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, command.ConveyorLineBarcode, childDeviceCode); + var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList(); + if (GWTask.Count >= 2 && childDeviceCode == "1039") + { + ConsoleHelper.WriteErrorLine($"鎵樼洏鍙凤細銆恵command.ConveyorLineBarcode}銆戦珮娓╀簩宸插瓨鍦ㄣ�恵GWTask.Count}銆戜釜浠诲姟澶т簬2涓换鍔′笉鍙笅鍙�"); + return; + } ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); - conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); conveyorLine.SendCommand(taskCommand, childDeviceCode); - //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); + conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); + _taskService.UpdateTaskStatusToNext(task); } } else { WriteInfo(conveyorLine.DeviceName, content.Message); + conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, stationManager.stationNGChildCode, childDeviceCode); + conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); ConsoleHelper.WriteErrorLine($"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戣姹傜偣浣嶏細銆恵childDeviceCode}銆戝紓甯镐俊鎭�恵content.Message}銆�"); //_taskRepository.AddData(taskGW); } -- Gitblit v1.9.3