From f23e0326aa05a1c5b47d4aec4c06e73d0d86b8e7 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期二, 29 七月 2025 17:43:15 +0800 Subject: [PATCH] 代码提交 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs | 50 +++++++++++++++++++++++++++++++++++++------------- 1 files changed, 37 insertions(+), 13 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs" index 717bf2f..bcfdc58 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs" @@ -48,7 +48,7 @@ namespace WIDESEAWCS_Tasks { [DisallowConcurrentExecution] - public class CommonRGVJob :JobBase, IJob + public class CommonRGVJob : JobBase, IJob { private readonly ITaskService _taskService; private readonly ITaskRepository _taskRepository; @@ -84,7 +84,6 @@ { if (commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.WorkCompleted)) { - var x = commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum); RGVTaskFinish(commonRGV, commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum)); } @@ -161,7 +160,7 @@ var task = _taskRepository.QueryFirst(x => x.TaskNum == TaskNum); if (task != null) { - if (task.TaskState == (int)TaskInStatusEnum.RGV_Indispatch) + if (task.TaskState == (int)TaskInStatusEnum.InRetuen) { Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress); if (stationManager != null) @@ -170,12 +169,41 @@ if (device != null) { CommonConveyorLine conveyorLine = (CommonConveyorLine)device; - Thread.Sleep(100); - - var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode); + conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, Convert.ToSByte(3), stationManager.stationChildCode); - if (Barcode == null||Barcode=="") + var content = _taskService.RGVTaskCompleted(TaskNum); + } + } + } + if (task.TaskState == (int)TaskInStatusEnum.RGV_Indispatch) + { + if (task.SourceAddress == "3002") + { + task.TaskState = (int)TaskInStatusEnum.RGV_IndispatchFinish; + _taskRepository.UpdateData(task); + return; + } + Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress); + if (stationManager != null) + { + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC); + if (device != null) + { + CommonConveyorLine conveyorLine = (CommonConveyorLine)device; + Thread.Sleep(100); + + DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceChildCode == stationManager.stationChildCode && x.DeviceProParamName == "ConveyorLineBarcode").FirstOrDefault(); + var x = conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 5); + string Barcode = Encoding.UTF8.GetString(x); + + if (Barcode == null || Barcode == "") { + conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, Convert.ToSByte(3), stationManager.stationChildCode); + commonRGV.SetValue(StackerCraneDBName.PutcargoLocation, Convert.ToSByte(stationManager.stationRemark)); + commonRGV.SetValue(StackerCraneDBName.TaskNum, Convert.ToInt16(task.TaskNum)); + // commonRGV.SetValue(StackerCraneDBName.TaskType, Convert.ToSByte(4)); + task.TaskState = (int)TaskInStatusEnum.InRetuen; + _taskRepository.UpdateData(task); return; } var content = _taskService.RGVTaskCompleted(TaskNum, Barcode); @@ -194,7 +222,6 @@ { CommonConveyorLine conveyorLine = (CommonConveyorLine)device; Thread.Sleep(100); - var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode); conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, Convert.ToInt16(stationManager.stationNextChildCode), stationManager.stationChildCode); Thread.Sleep(100); conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTaskNum, Convert.ToInt16(1000), stationManager.stationChildCode); @@ -219,7 +246,7 @@ Dt_Task task; if (InStock) { - task = _taskService.QueryRGVExecutingTask(commonRGV.DeviceCode); + task = _taskService.QueryRGVExecutingTask(commonRGV.DeviceCode, commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum)); if (task != null) { return task; @@ -277,11 +304,9 @@ rgvTaskCommand.TaskNum = Convert.ToInt16(task.TaskNum); if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔� { - //rgvTaskCommand.TaskType = (byte)Convert.ToSByte(16); - //rgvTaskCommand.TaskType = (byte)Convert.ToSByte(64); 閫�鍥� if (task.TaskState == (int)TaskInStatusEnum.InNew) { - Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress); + Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); rgvTaskCommand.TaskType = (byte)Convert.ToSByte(3); rgvTaskCommand.PickupLocation = (byte)Convert.ToSByte(stationManager.stationRemark); } @@ -299,7 +324,6 @@ } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - if (task.TaskState == (int)TaskOutStatusEnum.Line_OutFinish) { Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.CurrentAddress); -- Gitblit v1.9.3