| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.ConveyorLineEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.WMSInfo; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class CommonConveyorLineJob : IJob |
| | | public class CommonConveyorLineJob : JobBase, IJob |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | |
| | | case "104": |
| | | ConveyorLineInFinish(conveyorLine, command, childDeviceCode); |
| | | break; |
| | | case "105": |
| | | RequestOutbound(conveyorLine, command, childDeviceCode); |
| | | break; |
| | | //case "105": |
| | | // RequestOutbound(conveyorLine, command, childDeviceCode); |
| | | // break; |
| | | case "108": |
| | | ConveyorLineOutFinish(conveyorLine, command, childDeviceCode); |
| | | break; |
| | | default: |
| | | RequestInNextAddress(conveyorLine, command, childDeviceCode); |
| | | RequestOutNextAddress(conveyorLine, command, childDeviceCode); |
| | | break; |
| | | //default: |
| | | // RequestInNextAddress(conveyorLine, command, childDeviceCode); |
| | | // RequestOutNextAddress(conveyorLine, command, childDeviceCode); |
| | | // break; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | { |
| | | if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)//éæ·»å åWMSæ¥å£ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode, command.Barcode); |
| | | if (task != null) |
| | | { |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | if (task != null) |
| | | ConveyorLineDTO lineDTO = new ConveyorLineDTO() |
| | | { |
| | | //TaskNum = task.TaskNum, |
| | | stationCode = childDeviceCode, |
| | | Barcode = command.Barcode, |
| | | Spec = command.Spec, |
| | | Weight = command.Weight, |
| | | }; |
| | | var content = _taskService.RequestWMSTask(lineDTO); |
| | | |
| | | if (content.Status) |
| | | { |
| | | task.TargetAddress = AppSettings.Configuration["OKAddress"]; |
| | | task.NextAddress = task.TargetAddress; |
| | | ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task); |
| | | |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | if (conveyorLine.SendCommand(taskCommand, childDeviceCode)) |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | else |
| | | { |
| | | if (content.Code == 404)//ä¿®æ¹ç»ç¹å°å |
| | | { |
| | | task.TargetAddress = AppSettings.Configuration["NGAddress"]; |
| | | task.NextAddress = task.TargetAddress; |
| | | task.ExceptionMessage = content.Message; |
| | | task.TaskState = (int)TaskInStatusEnum.InException; |
| | | ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task); |
| | | if (conveyorLine.SendCommand(taskCommand, childDeviceCode)) _taskService.UpdateData(task); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | if (task != null) _taskService.UpdateTaskStatusToNext(task); |
| | | |
| | | task = _taskService.QueryCompletedConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null && string.IsNullOrEmpty(task.TargetAddress)) |
| | | { |
| | | //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |
| | | WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); |
| | | //Console.Out.WriteLine(content.Serialize()); |
| | | _taskService.StackerCraneRequestInbound(task); |
| | | } |
| | | //if (task != null) |
| | | //{ |
| | | // //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |
| | | // //åWMSæ´æ°ä»»å¡ç¶æï¼WMSè¿åå
¥åºä»»å¡ç»ç¹ |
| | | // WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); |
| | | // //Console.Out.WriteLine(content.Serialize()); |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode, command.Barcode); |
| | | if (task != null) |
| | | { |
| | | ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task); |