|  |  |  | 
|---|
|  |  |  | using System.Linq; | 
|---|
|  |  |  | using System.Text; | 
|---|
|  |  |  | using System.Threading.Tasks; | 
|---|
|  |  |  | using WIDESEAWCS_Common; | 
|---|
|  |  |  | using WIDESEAWCS_Common.TaskEnum; | 
|---|
|  |  |  | using WIDESEAWCS_Core.Helper; | 
|---|
|  |  |  | using WIDESEAWCS_IBasicInfoRepository; | 
|---|
|  |  |  | 
|---|
|  |  |  | task.NextAddress = locationCode; | 
|---|
|  |  |  | task.DeviceCode = stationManger.StackerCraneCode; | 
|---|
|  |  |  | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, currentAddress: task.CurrentAddress, nextAddress: task.NextAddress); | 
|---|
|  |  |  | bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); | 
|---|
|  |  |  | if (isWrite) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, currentAddress: task.CurrentAddress, nextAddress: task.NextAddress); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (leisure && !tray && !requestIn && !inbounding && !requestOut && !outbounding) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskType != TaskTypeEnum.MesOutbound.ObjToInt()); | 
|---|
|  |  |  | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == deviceChildCode); | 
|---|
|  |  |  | if (stationManger == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WriteError(hoister.DeviceName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{deviceChildCode}"); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (stationManger.StationType != StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskType != TaskTypeEnum.MesOutbound.ObjToInt() && x.Roadway== stationManger.StackerCraneCode); | 
|---|
|  |  |  | if (task != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | task.TaskState=TaskStatusEnum.HT_Executing.ObjToInt(); | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.HT_Executing); | 
|---|
|  |  |  | bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode); | 
|---|
|  |  |  | if (isWrite) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.HT_Executing); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | WriteError(hoister.DeviceName, $"请æ±åºåº,设å¤ç¼å·:{deviceChildCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | task.NextAddress = stationManger.StackerCraneStationCode; ; | 
|---|
|  |  |  | task.DeviceCode = stationManger.StackerCraneCode; | 
|---|
|  |  |  | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); | 
|---|
|  |  |  | _taskRepository.UpdateData(task); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, false, deviceChildCode); | 
|---|
|  |  |  | if (isWrite) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, nextAddress: task.NextAddress); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|