1
wangxinhui
7 小时以前 cb3907de90eef531df10a078149b29c55ff86401
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs
@@ -12,6 +12,7 @@
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_DTO.Agv;
using SqlSugar;
using static Dm.net.buffer.ByteArrayBuffer;
namespace WIDESEAWCS_Tasks
{
@@ -106,7 +107,7 @@
        {
            try
            {
                var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
                var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).OrderBy(x => x.CreateDate).ToList();
                foreach (var WaitToTask in WaitToTasks)
                {
                    if (WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
@@ -189,6 +190,25 @@
                    }
                }
                _taskService.UpdateData(WaitToTasks);
                Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First();
                if (TakeErroeTask!=null)
                {
                    Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == TakeErroeTask.CurrentAddress);
                    if (stationManger == null)
                    {
                        throw new Exception($"未找到站台配置");
                    }
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode);
                    if (device == null)
                    {
                        throw new Exception($"未找到对应设备");
                    }
                    OtherDevice otherDevice = (OtherDevice)device;
                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode);
                    Thread.Sleep(1000);
                    otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode);
                    _taskService.TaskCompleted(TakeErroeTask.TaskNum);
                }
            }
            catch (Exception ex)
            {