From 6654c7a847347732a58c9625a60667fd828b7db6 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <1247017146@qq.com> Date: 星期三, 02 四月 2025 09:53:03 +0800 Subject: [PATCH] 代码更新 --- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs | 38 +++++++++++++++++++++++--------------- 1 files changed, 23 insertions(+), 15 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 899fc54..e7669eb 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.CodeAnalysis; using Microsoft.VisualBasic; +using MoYu.Logging; using Newtonsoft.Json; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -173,9 +174,9 @@ RoadWay = childDeviceCode, SourceAddress = childDeviceCode, TargetAddress = isTrue, - TaskState = (int)TaskOutStatusEnum.OutNew, - Id = 0, - TaskType = (int)TaskOutboundTypeEnum.TrayInToOut, + TaskState = (int)TaskOutStatusEnum.SC_OutFinish, + Id = 2, + TaskType = (int)TaskOutboundTypeEnum.OutTray, ProductionLine = result.ProductionLine, }; } @@ -318,9 +319,9 @@ RoadWay = childDeviceCode, SourceAddress = childDeviceCode, TargetAddress = isTrue, - TaskState = (int)TaskOutStatusEnum.OutNew, + TaskState = (int)TaskOutStatusEnum.SC_OutFinish, Id = 2, - TaskType = (int)TaskOutboundTypeEnum.InToOut, + TaskType = (int)TaskOutboundTypeEnum.OutTray, ProductionLine = result.ProductionLine, }; var Taskcontent = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); @@ -414,22 +415,28 @@ /// <exception cref="InvalidOperationException"></exception> private async Task JZRequestInBound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, Dt_StationManager stationManager) { + + ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); + ResultTrayCellsStatus resultTrayCellsStatus = GetResultTrayCellsStatus(command, stationManager); + + //todo鍒ゆ柇鏄惁涓虹┖妗� var serialNosError = resultTrayCellsStatus.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); - if (serialNosError.Count > 0) + if (serialNosError.Count > 0|| !resultTrayCellsStatus.Success) { //NG娴佺▼ - var platform = _platFormRepository.QueryFirst(x => x.ProductionLine == resultTrayCellsStatus.ProductionLine); + var platform = _platFormRepository.QueryFirst(x => x.ProductionLine == resultTrayCellsStatus.ProductionLine&&x.PLCCode=="1005"); ConveyorLineTaskCommand conveyorLineTaskCommand = new ConveyorLineTaskCommand() { TaskNum = 1, TargetAddress=Convert.ToInt32( platform.Capacity), Barcode= resultTrayCellsStatus.TrayBarcode, + InteractiveSignal=command.InteractiveSignal }; conveyorLine.SendCommand(conveyorLineTaskCommand, childDeviceCode); - ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); - ConsoleHelper.WriteSuccessLine($"MOM鏁版嵁寮傚父,閫佽嚦浜屽皝銆恵resultTrayCellsStatus.ProductionLine}銆戝紓甯稿彛銆恵Convert.ToInt32(platform.Capacity)}銆�"); + var logMessage = $"MOM鏁版嵁寮傚父,閫佽嚦浜屽皝銆恵resultTrayCellsStatus.ProductionLine}銆戝紓甯稿彛銆恵Convert.ToInt32(platform.Capacity)}銆�"; + LogAndSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, logMessage, conveyorLineTaskCommand.TargetAddress.ToString()); return; } if (resultTrayCellsStatus.SerialNos.Count == 0) @@ -452,15 +459,16 @@ throw new InvalidOperationException("WMS IP 鏈厤缃�"); } var wmsIpAddrss = wmsbase + address; - var result = await HttpHelper.PostAsync(wmsIpAddrss, new { ProductLine = resultTrayCellsStatus.ProductionLine }.ToJsonString()); + var result = await HttpHelper.PostAsync(wmsIpAddrss, new { ProductLine = resultTrayCellsStatus.ProductionLine, PalletCode = command.Barcode }.ToJsonString()); var StockInfocontent = JsonConvert.DeserializeObject<WebResponseContent>(result); if (StockInfocontent.Status) { var Taskcontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); + ConsoleHelper.WriteErrorLine($"{JsonConvert.SerializeObject(Taskcontent)}"); if (Taskcontent.Status) { - var task = _taskRepository.QueryFirst(x => x.Roadway.Contains("JZ") && x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish); - if (task != null && task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) + var task = _taskRepository.QueryFirst(x => x.Roadway.Contains("JZ") && ( x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish||x.TaskState==(int)TaskOutStatusEnum.OutNew)); + if (task != null && task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting && task.CurrentAddress == "1537") { ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(stationManager.stationLocation); @@ -540,6 +548,7 @@ else { var Task = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); + ConsoleHelper.WriteErrorLine($"{JsonConvert.SerializeObject(Task)}"); if (Task.Status) { ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); @@ -643,9 +652,8 @@ { // 鏌ヨ鏄惁瀛樺湪闈欑疆鍑哄簱浠诲姟 var outJZTask = _taskRepository.QueryData(x => x.Roadway == task.Roadway && - (x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting || - x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || - x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)); + (x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || + x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutNew)); if (outJZTask.IsNullOrEmpty()) { -- Gitblit v1.9.3