| | |
| | | using Microsoft.AspNetCore.Routing; |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.Http; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | |
| | | private readonly IRouterService _routerService; |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private readonly IRepository<Dt_StationManger> _stationMangerRepository; |
| | | |
| | | |
| | | public CommonConveyorLineJob(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_StationManger> stationMangerRepository, IRepository<Dt_Task> taskRepository, IRouterRepository routerRepository, IRouterService routerService) |
| | | { |
| | |
| | | // åºåº |
| | | if (conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK)//åºåº |
| | | { |
| | | if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//éè´å
¥åº |
| | | if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode)) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, 2011, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.TaskNo, 1111, item.StationCode); |
| | | |
| | | Dt_Task dt_Ta = _taskService.GetOutTaskInfo2(conveyorLineInfoRead.Barcode); |
| | | if (dt_Ta != null) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, dt_Ta.OutboundPlatform, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode); |
| | | |
| | | //å é¤ä»»å¡ |
| | | _taskRepository.DeleteData(dt_Ta); |
| | | } |
| | | } |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && ACK) |
| | |
| | | } |
| | | } |
| | | //åºå
¥åºç«å° |
| | | if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) |
| | | else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) |
| | | { |
| | | //å
¥åºçæå åæºå
¥åºä»»å¡ |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !ACK) |
| | | { |
| | | if (conveyorLineInfoRead.TaskNo == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//éè´å
¥åº |
| | | if (conveyorLineInfoRead.TaskNo != 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//éè´å
¥åº |
| | | { |
| | | WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.Barcode, item.StationCode); |
| | | if (content.Status) |
| | | WebResponseContent contentweb = _taskService.UpdateTaskIninfo(conveyorLineInfoRead.Barcode, conveyorLineInfoRead.TaskNo); |
| | | if (contentweb.Status) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.Barcode && x.CurrentAddress == item.StationCode && x.DeviceCode == device.DeviceCode && x.TaskState == (int)TaskStatusEnum.New.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: item.StackerCraneCode, sourceAddress: item.StackerCraneStationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.TaskNo, 1111, item.StationCode); |
| | | //_taskService.UpdateTask(task, TaskStatusEnum.RGV_NEW); |
| | | } |
| | | |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK && conveyorLineInfoRead.TaskNo == 0)//åºåº |
| | | else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !STB && !ACK)//åºåº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()); |
| | | if (task != null) |
| | | |
| | | Dt_Task dt_Ta = _taskService.GetOutTaskInfo(item.StationCode); |
| | | if (dt_Ta != null) |
| | | { |
| | | //å åæºä»»å¡å®æä¸ä¸å°åæ¹æè¾é线ä¸ä¸å°åï¼è®¾å¤ç¼å·æ¹æè¾é线 |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNo, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | Dt_Router dt_Router = _routerRepository.QueryFirst(x => x.StartPosi == dt_Ta.TargetAddress); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, dt_Router.NextPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); |
| | | //å åæºä»»å¡å®æä¸ä¸å°åæ¹æè¾é线ä¸ä¸å°åï¼è®¾å¤ç¼å·æ¹æè¾é线 |
| | | _taskService.UpdateTaskStatusToNext(dt_Ta.TaskNum); |
| | | |
| | | if (dt_Ta.TargetAddress !="2021" && dt_Ta.TargetAddress != "2020") |
| | | { |
| | | //å é¤ä»»å¡ |
| | | _taskRepository.DeleteData(dt_Ta); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | //å
¥åºç«å° |
| | | if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) |
| | | else if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) |
| | | { |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !ACK) |
| | | { |
| | | if (conveyorLineInfoRead.TaskNo == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//éè´å
¥åº |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, 2020, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.TaskNo, 1111, item.StationCode); |
| | | Dt_Task dt_Ta = _taskService.GetTaskIninfo(conveyorLineInfoRead.Barcode); |
| | | if(dt_Ta != null) |
| | | { |
| | | |
| | | device.SetValue(W_ConveyorLineDB.EndPos, dt_Ta.SourceAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.TaskNo, dt_Ta.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | catch (Exception) |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | |