From 438f8ef02780f83c14a33c4ba95ed0dbc76ade0a Mon Sep 17 00:00:00 2001 From: wanshenmean <cathay_xy@163.com> Date: 星期二, 25 三月 2025 15:28:24 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/HuaYiZhongHeng/BaiBuSanlou --- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs | 125 ++++++++++++++++++++++++----------------- 1 files changed, 72 insertions(+), 53 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 2383341..01d61c4 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs @@ -1,6 +1,5 @@ -锘�//using HslCommunication; +锘縰sing HslCommunication; using Mapster; -using Masuit.Tools; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Newtonsoft.Json; using System.Text.RegularExpressions; @@ -283,10 +282,12 @@ private async Task RequestWmsTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, Dt_StationManager stationManager) { string isTrue = string.Empty; + ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); ResultTrayCellsStatus result = GetResultTrayCellsStatus(command, stationManager); - if(result.SerialNos.Count == 0) + + if (result.SerialNos.Count == 0) { var Traycontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); if (Traycontent.Status) @@ -417,12 +418,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 @@ -451,20 +467,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 @@ -493,7 +512,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, @@ -502,28 +521,25 @@ if (Taskcontent.Status) { ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode); + return; } else + { WriteInfo(conveyorLine.DeviceName, Taskcontent.Message); - + return; + } } else { ConsoleHelper.WriteWarningLine("浜屽皝缂撳瓨浣嶅凡婊�"); + return; } } } } - /// <summary> - /// 鎵ц杈撻�佺嚎浠诲姟 - /// </summary> - /// <param name="conveyorLine">杈撻�佺嚎瀵硅薄</param> - /// <param name="command">杈撻�佺嚎浠诲姟鍛戒护</param> - /// <param name="ProtocalDetailValue">鍗忚鏄庣粏鍊�</param> - /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> - //public void ExecuteConveyorLineTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, int ProtocalDetailValue, string childDeviceCode) + //public void ExecuteConveyorLineTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, int ProtocalDetailValue ,string childDeviceCode) //{ // var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); // if (task != null) @@ -542,45 +558,40 @@ // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); // } + // else if (task.TargetAddress == "1020-1") + // { + // var next = task.NextAddress; + // var taskCommand = MapTaskCommand(task, command); + // task.NextAddress = next; + + // var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�"; + // ConsoleHelper.WriteWarningLine(log); + + // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); + // WriteInfo(conveyorLine.DeviceName, log); + + // conveyorLine.SendCommand(taskCommand, childDeviceCode); + // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); + + // var taskHty = task.Adapt<Dt_Task_Hty>(); + // _task_HtyRepository.AddData(taskHty); + // _taskService.DeleteData(task); + // } // else // { - // if (task.Roadway.Contains("JZ")) - // { - // 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); - // if (outJZTask.IsNullOrEmpty()) - // { - // var next = task.NextAddress; - // var taskCommand = MapTaskCommand(task, command); - // task.NextAddress = next; + // var next = task.NextAddress; + // var taskCommand = MapTaskCommand(task, command); + // task.NextAddress = next; - // var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�"; - // ConsoleHelper.WriteWarningLine(log); + // var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�"; + // ConsoleHelper.WriteWarningLine(log); - // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); - // WriteInfo(conveyorLine.DeviceName, log); + // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); + // WriteInfo(conveyorLine.DeviceName, log); - // conveyorLine.SendCommand(taskCommand, childDeviceCode); - // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); - // _taskService.UpdateTaskStatusToNext(task); - // } - // else - // { - // ConsoleHelper.WriteWarningLine("宸插瓨鍦ㄩ潤缃嚭搴撲换鍔�,闈欑疆鍏ュ簱浠诲姟鏃犳硶涓嬪彂绾夸綋"); - // } - // } - // else - // { - // var next = task.NextAddress; - // var taskCommand = MapTaskCommand(task, command); - // task.NextAddress = next; - // var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�"; - // ConsoleHelper.WriteWarningLine(log); - // _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" }); - // WriteInfo(conveyorLine.DeviceName, log); - // conveyorLine.SendCommand(taskCommand, childDeviceCode); - // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); - // _taskService.UpdateTaskStatusToNext(task); - // } + // conveyorLine.SendCommand(taskCommand, childDeviceCode); + // ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); + // _taskService.UpdateTaskStatusToNext(task); // } // } //} @@ -596,6 +607,7 @@ { // 鏌ヨ浠诲姟淇℃伅 var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); + if (task == null) return; // 鑾峰彇閰嶇疆鍊煎苟杞崲涓哄垪琛� @@ -610,6 +622,7 @@ { // 璁剧疆鐩爣鍦板潃涓� "1000" conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode); + // 璁板綍鏃ュ織骞跺彂閫佸畬鎴愪俊鍙� LogAndSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, logMessage, "1000"); } @@ -625,10 +638,13 @@ { // 鏄犲皠浠诲姟鍛戒护 var taskCommand = MapTaskCommand(task, command); - // 璁板綍鏃ュ織骞跺彂閫佸畬鎴愪俊鍙� - LogAndSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, logMessage, taskCommand.TargetAddress.ToString()); + // 鍙戦�佷换鍔″懡浠� conveyorLine.SendCommand(taskCommand, childDeviceCode); + + // 璁板綍鏃ュ織骞跺彂閫佸畬鎴愪俊鍙� + LogAndSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, logMessage, taskCommand.TargetAddress.ToString()); + // 鏇存柊浠诲姟鐘舵�� _taskService.UpdateTaskStatusToNext(task); } @@ -641,10 +657,13 @@ { // 鏄犲皠浠诲姟鍛戒护 var taskCommand = MapTaskCommand(task, command); - // 璁板綍鏃ュ織骞跺彂閫佸畬鎴愪俊鍙� - LogAndSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, logMessage, taskCommand.TargetAddress.ToString()); + // 鍙戦�佷换鍔″懡浠� conveyorLine.SendCommand(taskCommand, childDeviceCode); + + // 璁板綍鏃ュ織骞跺彂閫佸畬鎴愪俊鍙� + LogAndSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, logMessage, taskCommand.TargetAddress.ToString()); + // 鏇存柊浠诲姟鐘舵�� _taskService.UpdateTaskStatusToNext(task); } -- Gitblit v1.9.3