From 95e4c26be20829d7fe5e46e12b4d879ceb48c468 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <1247017146@qq.com> Date: 星期二, 25 三月 2025 10:17:11 +0800 Subject: [PATCH] 优化二封入料逻辑 --- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs | 104 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 63 insertions(+), 41 deletions(-) diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs index 4b2fcb7..8a99dbb 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs @@ -148,12 +148,12 @@ { string isTrue = string.Empty; - //ResultTrayCellsStatus result = GetResultTrayCellsStatus(command, stationManager); + ResultTrayCellsStatus result = GetResultTrayCellsStatus(command, stationManager); List<string> strings = stationManager.Roadway.Split(",").ToList(); foreach (string item in strings) { - isTrue = RequestInboundPlatform(item, "ZJ-11", true); + isTrue = RequestInboundPlatform(item, result.ProductionLine, true); if (isTrue != null) { break; @@ -174,7 +174,7 @@ TaskState = (int)TaskOutStatusEnum.OutNew, Id = 0, TaskType = (int)TaskOutboundTypeEnum.TrayInToOut, - ProductionLine = "ZJ-11", + ProductionLine = result.ProductionLine, }; } else @@ -283,47 +283,47 @@ { string isTrue = string.Empty; - //ResultTrayCellsStatus result = GetResultTrayCellsStatus(command, stationManager); + ResultTrayCellsStatus result = GetResultTrayCellsStatus(command, stationManager); - //List<string> strings = stationManager.Roadway.Split(",").ToList(); - //foreach (string item in strings) - //{ - // isTrue = RequestInboundPlatform(conveyorLine, item, result.ProductionLine, false); - // if (isTrue != null) - // { - // break; - // } - //} - //if (isTrue != null && isTrue != string.Empty) - //{ - // WMSTaskDTO taskDTO = new WMSTaskDTO - // { - // TaskNum = _taskRepository.GetTaskNo().Result, - // Grade = 1, - // PalletCode = command.Barcode, - // RoadWay = childDeviceCode, - // SourceAddress = childDeviceCode, - // TargetAddress = isTrue, - // TaskState = (int)TaskOutStatusEnum.OutNew, - // Id = 2, - // TaskType = (int)TaskOutboundTypeEnum.InToOut, - // ProductionLine = result.ProductionLine, - // }; - // var Taskcontent = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); - // if (Taskcontent.Status) - // { - // ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); - // } + List<string> strings = stationManager.Roadway.Split(",").ToList(); + foreach (string item in strings) + { + isTrue = RequestInboundPlatform(item, result.ProductionLine, false); + if (isTrue != null) + { + break; + } + } + if (isTrue != null && isTrue != string.Empty) + { + WMSTaskDTO taskDTO = new WMSTaskDTO + { + TaskNum = _taskRepository.GetTaskNo().Result, + Grade = 1, + PalletCode = command.Barcode, + RoadWay = childDeviceCode, + SourceAddress = childDeviceCode, + TargetAddress = isTrue, + TaskState = (int)TaskOutStatusEnum.OutNew, + Id = 2, + TaskType = (int)TaskOutboundTypeEnum.InToOut, + ProductionLine = result.ProductionLine, + }; + var Taskcontent = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); + if (Taskcontent.Status) + { + ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); + } - //} - //else - //{ + } + else + { var Taskcontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); if (Taskcontent.Status) { ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); } - //} + } #region //if (Taskcontent.Status) @@ -406,12 +406,27 @@ var serialNosError = resultTrayCellsStatus.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); if (serialNosError.Count > 0) { - //绌烘閫昏緫 + //NG娴佺▼ + var platform = _platFormRepository.QueryFirst(x => x.ProductionLine == resultTrayCellsStatus.ProductionLine); + ConveyorLineTaskCommand conveyorLineTaskCommand = new ConveyorLineTaskCommand() + { + TaskNum = 1, + TargetAddress=Convert.ToInt32( platform.Capacity), + Barcode= resultTrayCellsStatus.TrayBarcode, + }; + conveyorLine.SendCommand(conveyorLineTaskCommand, childDeviceCode); + ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); + ConsoleHelper.WriteSuccessLine($"MOM鏁版嵁寮傚父,閫佽嚦浜屽皝銆恵resultTrayCellsStatus.ProductionLine}銆戝紓甯稿彛銆恵Convert.ToInt32(platform.Capacity)}銆�"); + return; + } + if (resultTrayCellsStatus.SerialNos.Count < 0) + { var Traycontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); if (Traycontent.Status) { ConsoleHelper.WriteSuccessLine("鍖栨垚绌烘璇锋眰鍥炴祦闈欑疆"); ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); + return; } } else @@ -440,20 +455,23 @@ { ConsoleHelper.WriteSuccessLine("鍖栨垚瀹炴墭璇锋眰鍏ラ潤缃�"); ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); + return; } else { ConsoleHelper.WriteWarningLine("鍑哄簱浠诲姟鏈畬鎴�"); + return; } } else if (task != null && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) { ConsoleHelper.WriteWarningLine("宸插瓨鍦ㄩ潤缃嚭搴撲换鍔�"); + return; } else { - ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); + return; } } else @@ -482,7 +500,7 @@ RoadWay = isTrue, SourceAddress = childDeviceCode, TargetAddress = isTrue, - TaskState = (int)TaskOutStatusEnum.OutNew, + TaskState = (int)TaskOutStatusEnum.SC_OutFinish, Id = 2, TaskType = (int)TaskOutboundTypeEnum.InToOut, ProductionLine = resultTrayCellsStatus.ProductionLine, @@ -491,14 +509,18 @@ if (Taskcontent.Status) { ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); + return; } else + { WriteInfo(conveyorLine.DeviceName, Taskcontent.Message); - + return; + } } else { ConsoleHelper.WriteWarningLine("浜屽皝缂撳瓨浣嶅凡婊�"); + return; } } -- Gitblit v1.9.3