From 06eb604f71605c47f015b88b1620b72b6f69df8c Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期一, 22 九月 2025 05:20:41 +0800 Subject: [PATCH] 功能增加,代码优化 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/RGVJob_BC.cs | 54 +++++++++++++++++++++++++++++++++--------------------- 1 files changed, 33 insertions(+), 21 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" index 8d0bb30..c2574f6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" @@ -116,24 +116,6 @@ } if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt()) { - //if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱 - //{ - // List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); - // WebResponseContent responseContent = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, conveyorLineInfoRead.Spare2, stations); - // if (responseContent.Status) - // { - // Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.Barcode && x.CurrentAddress == item.StationCode && x.DeviceCode == device.DeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); - // if (task != null) - // { - // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); - // device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); - // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); - // device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); - // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); - // } - // } - //} if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱 { @@ -152,7 +134,7 @@ } } } - else if (conveyorLineSignalRead.STB /*&& conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm*/ && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//鍑哄簱 + else if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//鍑哄簱 { WriteDebug(device.DeviceName, $"浠诲姟瀹屾垚,浠诲姟鍙�:{conveyorLineInfoRead.TaskNum}"); _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum); @@ -169,8 +151,8 @@ } } //鍏佽鏀捐涓�鍙峰紑鏂欏彛鍑哄簱浠诲姟 - bool outAllow = device.Communicator.Read<bool>("DB14.4.6"); - if (outAllow) + bool outAllowLine1 = device.Communicator.Read<bool>("DB14.4.6"); + if (outAllowLine1) { Dt_Task taskExcuting = _taskRepository.QueryFirst(x => x.WarehouseId== warehouseDevice.WarehouseId && (x.TargetAddress== "SCUTL-001" || x.TargetAddress == "1101") && (x.TaskState==TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() @@ -183,6 +165,36 @@ WriteDebug($"涓�鍙峰紑鏂欏彛鏀捐浠诲姟", $"浠诲姟鍙穥taskExecute.TaskNum}"); } } + //鍏佽鏀捐浜屽彿寮�鏂欏彛鍑哄簱浠诲姟 + bool outAllowLine2 = device.Communicator.Read<bool>("DB14.12.6"); + if (outAllowLine2) + { + Dt_Task taskExcuting = _taskRepository.QueryFirst(x => x.WarehouseId == warehouseDevice.WarehouseId && (x.TargetAddress == "SCUTL-002" || x.TargetAddress == "1103") + && (x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() + || x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt())); + Dt_Task? taskExecute = _taskRepository.QueryData(x => x.WarehouseId == warehouseDevice.WarehouseId && x.TargetAddress == "SCUTL-002" + && x.TaskState == TaskStatusEnum.MesPending.ObjToInt()).OrderByDescending(x => x.Grade).ThenBy(x => x.TaskNum).ThenBy(x => x.CreateDate).FirstOrDefault(); + if (taskExcuting == null && taskExecute != null) + { + _taskService.UpdateTask(taskExecute, TaskStatusEnum.SC_Execute); + WriteDebug($"浜屽彿寮�鏂欏彛鏀捐浠诲姟", $"浠诲姟鍙穥taskExecute.TaskNum}"); + } + } + //鍏佽鏀捐鎵嬪姩寮�鏂欏彛鍑哄簱浠诲姟 + bool outAllowMusual = device.Communicator.Read<bool>("DB14.4.7"); + if (outAllowMusual) + { + Dt_Task taskExcuting = _taskRepository.QueryFirst(x => x.WarehouseId == warehouseDevice.WarehouseId && (x.TargetAddress == "SCUTL_04-001" || x.TargetAddress == "1102") + && (x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt() + || x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt())); + Dt_Task? taskExecute = _taskRepository.QueryData(x => x.WarehouseId == warehouseDevice.WarehouseId && x.TargetAddress == "SCUTL_04-001" + && x.TaskState == TaskStatusEnum.MesPending.ObjToInt()).OrderByDescending(x => x.Grade).ThenBy(x => x.TaskNum).ThenBy(x => x.CreateDate).FirstOrDefault(); + if (taskExcuting == null && taskExecute != null) + { + _taskService.UpdateTask(taskExecute, TaskStatusEnum.SC_Execute); + WriteDebug($"鎵嬪姩寮�鏂欏彛鏀捐浠诲姟", $"浠诲姟鍙穥taskExecute.TaskNum}"); + } + } } else { -- Gitblit v1.9.3