wangxinhui
2026-03-26 5c272c606bdf2da3577dbaa5f48d0ee163f1e7d2
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/StackerCraneJob_CP.cs
@@ -23,6 +23,7 @@
using SqlSugar.Extensions;
using WIDESEAWCS_Tasks.ConveyorLineJob;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.StackerCrane;
namespace WIDESEAWCS_Tasks
{
@@ -57,8 +58,13 @@
                    {
                        commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订阅任务完成事件
                    }
                    commonStackerCrane.CheckStackerCraneTaskCompleted();//防止任务完成事件监测超时,再手动触发一次
                    if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby)
                    //commonStackerCrane.CheckStackerCraneTaskCompleted();//防止任务完成事件监测超时,再手动触发一次
                    if (commonStackerCrane.CurrentTaskNum > 0 && (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.WorkCompleted || commonStackerCrane.Communicator.Read<short>("DB1000.40.0") == 3))
                    {
                        StackerCraneTaskCompletedEventArgs e = new StackerCraneTaskCompletedEventArgs(commonStackerCrane.CurrentTaskNum);
                        CommonStackerCrane_StackerCraneTaskCompletedEventHandler(commonStackerCrane, e);
                    }
                    else if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby)
                    {
                        short stackerError = commonStackerCrane.Communicator.Read<short>("DB1000.54.0");
                        if (stackerError == 0)
@@ -121,7 +127,7 @@
                {
                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                    {
                        Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneStationCode == task.NextAddress && x.StackerCraneCode==deviceCode);
                        Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode==deviceCode);
                        if (stationManger == null)
                        {
                            _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"输送线出库站点未配置,{task.NextAddress}");
@@ -182,6 +188,13 @@
        /// <returns></returns>
        private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane)
        {
            //判断是否有正执行的任务,如果有则不下发
            Dt_Task? taskOld = _taskRepository.QueryFirst(x => x.DeviceCode == commonStackerCrane.DeviceCode && x.Roadway == commonStackerCrane.DeviceCode && x.TaskState == TaskStatusEnum.SC_Executing.ObjToInt());
            if (taskOld!=null)
            {
                return null;
            }
            Dt_Task task;
            if (commonStackerCrane.LastTaskType == null)
            {
@@ -252,8 +265,8 @@
                    short command = client.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode);
                    if (command==3)//出库站台未被占用
                    {
                        task.NextAddress = stationManger.StackerCraneStationCode;
                        _taskRepository.UpdateData(task);
                        //task.NextAddress = stationManger.StackerCraneStationCode;
                        //_taskRepository.UpdateData(task);
                        return task;
                    }
                    else
@@ -319,7 +332,8 @@
            }
            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)//判断是否是出库任务
            {
                string[] targetCodes = task.NextAddress.Split("-");
                Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress && x.StackerCraneCode == task.DeviceCode);
                string[] targetCodes = stationManger.StackerCraneStationCode.Split("-");
                if (targetCodes.Length == 3)
                {
                    stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]);