wanshenmean
2026-02-26 3de39066b5894850d0f0dc311b60cc09f599a025
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -86,10 +86,10 @@
                    Dt_Task? task = GetTask(commonStackerCrane);
                    if (task != null)
                    {
                        var stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
                        object? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
                        if (stackerCraneTaskCommand != null)
                        {
                            bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                            bool sendFlag = SendStackerCraneCommand(commonStackerCrane, stackerCraneTaskCommand);
                            if (sendFlag)
                            {
                                commonStackerCrane.LastTaskType = task.TaskType;
@@ -152,10 +152,10 @@
            if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
            {
                if (IsOutTaskStationAvailable(task))
                {
                //if (IsOutTaskStationAvailable(task))
                //{
                    return task;
                }
                //}
                List<string> otherOutStationCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress, task.TaskType)
                    .Select(x => x.ChildPosi).ToList();
@@ -201,7 +201,7 @@
        /// <summary>
        /// 任务实体转换成命令Model
        /// </summary>
        public dynamic? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
        public object? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
        {
            // 根据配置判断命令类型
            string commandType = GetCommandType(task.Roadway);
@@ -211,6 +211,16 @@
            {
                "Formation" => BuildCommand(task, CreateFormationCommand(task)),
                _ => BuildCommand(task, CreateStandardCommand(task))
            };
        }
        private static bool SendStackerCraneCommand(IStackerCrane commonStackerCrane, object command)
        {
            return command switch
            {
                FormationStackerCraneTaskCommand formationCommand => commonStackerCrane.SendCommand(formationCommand),
                StackerCraneTaskCommand standardCommand => commonStackerCrane.SendCommand(standardCommand),
                _ => false
            };
        }
@@ -236,15 +246,15 @@
        {
            return new StackerCraneTaskCommand
            {
                Barcode = task.PalletCode,
                //Barcode = task.PalletCode,
                TaskNum = task.TaskNum,
                WorkType = 1,
                TrayType = 0
                WorkAction = 1
            };
        }
        /// <summary>
        /// 创建组盘堆垛机命令
        /// 创建分容堆垛机命令
        /// </summary>
        private static FormationStackerCraneTaskCommand CreateFormationCommand(Dt_Task task)
        {