From 4c6cf4c5bb9491dd98743f11fd3e657c2559523a Mon Sep 17 00:00:00 2001 From: zhanghonglin <zhanghonglin@hnkhzn.com> Date: 星期五, 11 七月 2025 10:19:18 +0800 Subject: [PATCH] 注释 --- 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPB.cs | 48 +++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 41 insertions(+), 7 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" index 91ec5eb..bba09d9 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPB.cs" @@ -72,16 +72,15 @@ { DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineCPDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); - if (deviceProRead != null && deviceProWrite!=null) + if (item.StationType==StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && deviceProRead != null && deviceProWrite!=null) { R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); - if (conveyorLineInfoRead.Command == 6 && conveyorLineInfoRead.TaskNo>0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) + if (conveyorLineInfoRead.Command == 5 && conveyorLineInfoRead.TaskNo>0 && !string.IsNullOrEmpty(conveyorLineInfoRead.PalletCode)) { - Dt_Task task = _taskRepository.QueryFirst(x =>x.TaskNum== conveyorLineInfoRead.TaskNo && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode==device.DeviceCode); + Dt_Task task = _taskRepository.QueryFirst(x =>x.TaskNum== conveyorLineInfoRead.TaskNo && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.DeviceCode==device.DeviceCode); if (task != null) { //鍒嗛厤宸烽亾 瀛樺叆鎵樼洏鏁版嵁 - List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, "SC01_CP", task.TaskType); Dt_Router? router = routers.FirstOrDefault(); if (routers == null || routers.Count == 0 || router == null) @@ -95,9 +94,10 @@ continue; } - device.SetValue(W_ConveyorLineCPDB.TargetAddress, router.NextPosi, item.StationCode); - device.SetValue(W_ConveyorLineCPDB.TaskNo, task.TaskNum, item.StationCode); - device.SetValue(W_ConveyorLineCPDB.Command, 1, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_TargetAddress, router.NextPosi, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_TaskNo, task.TaskNum, item.StationCode); + device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode); + task.CurrentAddress = item.StationCode; task.NextAddress=router.NextPosi; task.PalletType = 1; task.PalletCode = conveyorLineInfoRead.PalletCode; @@ -115,6 +115,40 @@ } } } + else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && deviceProRead != null) + { + R_ConveyorLineCPInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineCPInfo>(deviceProRead.DeviceProAddress); + if (conveyorLineInfoRead.Command == 4 && conveyorLineInfoRead.TaskNo > 0) + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNo && x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == device.DeviceCode); + if (task != null) + { + List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && task.CurrentAddress == x.StartPosi); + Dt_Router? router = routers.FirstOrDefault(); + if (routers == null || routers.Count == 0 || router == null) + { + WriteError(item.StationName, $"鏈壘鍒板搴旇矾鐢变俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } + if (routers.Count > 1) + { + WriteError(item.StationName, $"璺敱淇℃伅閰嶇疆閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + continue; + } + device.SetValue(W_ConveyorLineCPDB.W_Command, 2, item.StationCode); + task.NextAddress = router.NextPosi; + _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); + WriteError(item.StationName, $"浠诲姟鍙穥conveyorLineInfoRead.TaskNo}涓嬩竴姝�"); + //string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, "AGV_CP"); + //if (string.IsNullOrEmpty(locationCode) && task.TaskType != TaskTypeEnum.EmptyProductBack.ObjToInt()) + //{ + // WriteError(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); + // continue; + //} + + } + } + } else { WriteError(item.StationName, $"鏈壘鍒拌澶囧瓙缂栧彿{item.StationCode}鐨勫崗璁俊鎭�"); -- Gitblit v1.9.3