| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core; |
| | |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.ConveyorLine.Enum; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineExtend; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | { |
| | | //Task task = Task.Run(() => |
| | | //{ |
| | | ConveyorLineTaskCommandR command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandR>(childDeviceCode); |
| | | if (command != null && command.ConveyorLineStatus == (ushort)ConveyorLineStatus.Stored) |
| | | { |
| | | switch (childDeviceCode) |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode); |
| | | if (command != null) |
| | | { |
| | | case "102": |
| | | RequestInbound(conveyorLine, command, childDeviceCode); |
| | | break; |
| | | case "104": |
| | | ConveyorLineInFinish(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; |
| | | DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == command.InteractiveSignal.ToString() && x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)); |
| | | if (deviceProtocolDetail != null) |
| | | { |
| | | MethodInfo? method = GetType().GetMethod(deviceProtocolDetail.ProtocolDetailType); |
| | | if (method != null) |
| | | { |
| | | method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode }); |
| | | } |
| | | else |
| | | { |
| | | //todo æªæ¾å°æ¹æ³æ¶ |
| | | } |
| | | } |
| | | } |
| | | #region æ ¹æ®ä¸åçå¼è°ç¨å¯¹åºçæ¹æ³ |
| | | //DeviceProtocolDetailDTO? deviceProtocolDetail = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.ProtocalDetailValue == command.ConveyorLineStatus.ToString() && x.DeviceProParamName == nameof(ConveyorLineTaskCommandR.ConveyorLineStatus)); |
| | | //if (deviceProtocolDetail != null) |
| | | //{ |
| | | // MethodInfo? method = GetType().GetMethod(deviceProtocolDetail.ProtocolDetailType); |
| | | // if (method != null) |
| | | // { |
| | | // method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode }); |
| | | // } |
| | | // else |
| | | // { |
| | | // //todo æªæ¾å°æ¹æ³æ¶ |
| | | // } |
| | | //} |
| | | #endregion |
| | | } |
| | | //}); |
| | | //tasks.Add(task); |
| | | } |
| | |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command,string childDeviceCode) |
| | | { |
| | | if (_taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode).Status) |
| | | if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status) |
| | | { |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task); |
| | | ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task); |
| | | taskCommand.InteractiveSignal = command.InteractiveSignal; |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.WriteConveyorLineTaskNum, childDeviceCode); |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | if (newTask != null) |
| | | { |
| | | ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(newTask); |
| | | //taskCommand.ConveyorLineStatus = command.ConveyorLineStatus; |
| | | ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask); |
| | | taskCommand.InteractiveSignal = command.InteractiveSignal; |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | } |
| | | } |
| | |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.WriteConveyorLineTaskNum, childDeviceCode); |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |
| | |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(task); |
| | | //taskCommand.ConveyorLineStatus = command.ConveyorLineStatus; |
| | | ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task); |
| | | taskCommand.InteractiveSignal = command.InteractiveSignal; |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void RequestOutNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | public void RequestOutNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.WriteConveyorLineTaskNum, childDeviceCode); |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | if (newTask != null) |
| | | { |
| | | ConveyorLineTaskCommandW taskCommand = _mapper.Map<ConveyorLineTaskCommandW>(newTask); |
| | | //taskCommand.ConveyorLineStatus = command.ConveyorLineStatus; |
| | | ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask); |
| | | taskCommand.InteractiveSignal = command.InteractiveSignal; |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | } |
| | | } |
| | |
| | | /// <param name="conveyorLine">è¾é线å®ä¾å¯¹è±¡</param> |
| | | /// <param name="command">读åç请æ±ä¿¡æ¯</param> |
| | | /// <param name="childDeviceCode">å设å¤ç¼å·</param> |
| | | public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandR command, string childDeviceCode) |
| | | public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.WriteConveyorLineTaskNum, childDeviceCode); |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode); |