肖洋
2024-11-29 8c14b292f460c55e41e1ff1ba3b8487d98442384
优化HandleNewTask方法
已修改1个文件
136 ■■■■ 文件已修改
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs 136 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
@@ -51,24 +51,111 @@
        {
            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
            if (stationManager.stationType == 8)
            if (stationManager == null)
            {
                // Handle the case where stationManager is not found, if necessary
                Console.WriteLine($"未找到{childDeviceCode}站台");
                return;
            }
            // 根据站类型执行相应的方法
            switch (stationManager.stationType)
            {
                case 8:
                case 9:
                case 11:
                case 12:
                var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
                if (task != null)
                {
                        ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
                    }
                    break;
                case 1:
                case 10:
                    ExecuteStationAction(stationManager, conveyorLine, command, childDeviceCode);
                    break;
            }
            #region
            //Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
            //if (stationManager.stationType == 8)
            //{
            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
            //    if (task != null)
            //    {
            //        RequestInNextAddress(conveyorLine, command, childDeviceCode);
            //    }
            //}
            //else if (stationManager.stationType == 9)
            //{
            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
            //    if (task != null)
            //    {
            //        ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
            //    }
            //}
            //else if (stationManager.stationType == 1)
            //{
            //    if (stationManager.stationArea.Contains("GW"))
            //    {
            //        var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish);
            //        if (taskGW != null)
            //        {
            //            command.ConveyorLineBarcode = taskGW.PalletCode;
            //        }
            //    }
            //    RequestWmsTask(conveyorLine, command, childDeviceCode);
            //}
            //else if (stationManager.stationType == 10)
            //{
            //    var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
            //    if (task != null)
            //    {
            //        RequestOutbound(conveyorLine, command, childDeviceCode);
            //    }
            //}
            //else if (stationManager.stationType == 11)
            //{
            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
            //    if (task != null)
            //    {
            //        RequestOutNextAddress(conveyorLine, command, childDeviceCode);
            //    }
            //}
            //else if (stationManager.stationType == 12)
            //{
            //    var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
            //    if (task != null)
            //    {
            //        ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
            //    }
            //}
            #endregion
        }
        private void ExecuteStationAction(Dt_StationManager stationManager, CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
        {
            switch (stationManager.stationType)
            {
                case 8:
                    RequestInNextAddress(conveyorLine, command, childDeviceCode);
                }
            }
            else if (stationManager.stationType == 9)
            {
                var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
                if (task != null)
                {
                    break;
                case 9:
                    ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
                }
            }
            else if (stationManager.stationType == 1)
            {
                    break;
                case 10:
                    RequestOutbound(conveyorLine, command, childDeviceCode);
                    break;
                case 11:
                    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
                    break;
                case 12:
                    ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
                    break;
                case 1:
                if (stationManager.stationArea.Contains("GW"))
                {
                    var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish);
@@ -78,30 +165,7 @@
                    }
                }
                RequestWmsTask(conveyorLine, command, childDeviceCode);
            }
            else if (stationManager.stationType == 10)
            {
                var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
                if (task != null)
                {
                    RequestOutbound(conveyorLine, command, childDeviceCode);
                }
            }
            else if (stationManager.stationType == 11)
            {
                var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
                if (task != null)
                {
                    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
                }
            }
            else if (stationManager.stationType == 12)
            {
                var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
                if (task != null)
                {
                    RequestOutNextAddress(conveyorLine, command, childDeviceCode);
                }
                    break;
            }
        }