dengjunjie
2025-02-24 cde56aae50adc11ff8db84e424d873843c566bfd
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -213,16 +213,14 @@
        public Dt_Task QueryStackerCraneRelocationTask(string deviceNo, string currentAddress = "")
        {
            Dt_Task task = null;
            List<Dt_Task> tasks = new List<Dt_Task>();
            if (string.IsNullOrEmpty(currentAddress))
                task = BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskRelocationTypes.Contains(x.TaskType), TaskOrderBy);
                tasks = BaseDal.QueryData(x => x.Roadway == deviceNo && TaskRelocationTypes.Contains(x.TaskType) && x.TaskState < TaskRelocationStatusEnum.SC_RelocationExecuting.ObjToInt()).OrderBy(x => x.TaskNum).ToList();
            else
                task = BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && TaskRelocationTypes.Contains(x.TaskType), TaskOrderBy);
            if (task != null)
                tasks = BaseDal.QueryData(x => x.Roadway == deviceNo && x.CurrentAddress == currentAddress && TaskRelocationTypes.Contains(x.TaskType) && x.TaskState < TaskRelocationStatusEnum.SC_RelocationExecuting.ObjToInt()).OrderBy(x => x.TaskNum).ToList();
            if (tasks != null && tasks.Count > 0)
            {
                if (task.SourceIsPickPlace && task.TaskState == (int)TaskRelocationStatusEnum.RelocationNew || !task.SourceIsPickPlace && task.TaskState == (int)TaskRelocationStatusEnum.CarSource_Finish)
                    return task;
                else
                    return null;
                task = tasks.First();
            }
            return task;
        }
@@ -367,8 +365,9 @@
                    }
                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
                    task.TaskState = nextStatus;
                    if (task.SourceIsPickPlace && task.TaskState == TaskOutStatusEnum.OutNew.ObjToInt())
                        task.TaskState = TaskOutStatusEnum.SC_OutExecuting.ObjToInt();
                }
                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                {
@@ -396,15 +395,29 @@
                    }
                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskRelocationStatusEnum>();
                    task.TaskState = nextStatus;
                    if (task.SourceIsPickPlace && task.TaskState == TaskRelocationStatusEnum.RelocationNew.ObjToInt())
                        task.TaskState = TaskRelocationStatusEnum.SC_RelocationExecuting.ObjToInt();
                }
                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup)//库内移车
                {
                    if (task.TaskState >= (int)TaskCarStatusEnum.RelocationCarFinish)
                    if (task.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt())
                    {
                        return content = WebResponseContent.Instance.Error($"该任务状态不可跳转到下一步,任务号:【{task.TaskNum}】,任务状态:【{task.TaskState}】");
                        if (task.TaskState >= (int)TaskCarStatusEnum.RelocationCarFinish)
                        {
                            return content = WebResponseContent.Instance.Error($"该任务状态不可跳转到下一步,任务号:【{task.TaskNum}】,任务状态:【{task.TaskState}】");
                        }
                        int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskCarStatusEnum>();
                        task.TaskState = nextStatus;
                    }
                    int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskCarStatusEnum>();
                    task.TaskState = nextStatus;
                    else if (task.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt())
                    {
                        if (task.TaskState >= (int)CarChargingTaskEnum.RelocationCarFinish)
                        {
                            return content = WebResponseContent.Instance.Error($"该任务状态不可跳转到下一步,任务号:【{task.TaskNum}】,任务状态:【{task.TaskState}】");
                        }
                        int nextStatus = task.TaskState.GetNextNotCompletedStatus<CarChargingTaskEnum>();
                        task.TaskState = nextStatus;
                    }
                }
                else
                {
@@ -598,6 +611,16 @@
        /// <exception cref="NotImplementedException"></exception>
        public WebResponseContent AddRelocationCarTask(string SourceAddress, string TargetAddress, string ShuttleCarCode = "", string remark = "")
        {
            if (!string.IsNullOrEmpty(SourceAddress) && SourceAddress != "")
            {
                Dt_Task? task = BaseDal.QueryFirst(x => x.SourceAddress == SourceAddress && x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt());
                if (task != null) return WebResponseContent.Instance.Error();
            }
            if (!string.IsNullOrEmpty(TargetAddress) && TargetAddress != "")
            {
                Dt_Task? task = BaseDal.QueryFirst(x => x.SourceAddress == TargetAddress && x.TaskType == TaskOtherTypeEnum.RelocationCar.ObjToInt());
                if (task != null) return WebResponseContent.Instance.Error();
            }
            #region åˆ›å»ºå †åž›æœºç§»è½¦ä»»åŠ¡
            Dt_Task dt_Task = new Dt_Task()
            {