| | |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using System.ComponentModel.Design; |
| | | using System.Reflection; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_Common; |
| | |
| | | } |
| | | } |
| | | |
| | | if (childDeviceCode == "1670"||childDeviceCode=="1666"||childDeviceCode=="1548"||childDeviceCode=="1448") |
| | | if (childDeviceCode == "1670" || childDeviceCode == "1666" || childDeviceCode == "1548" || childDeviceCode == "1448") |
| | | { |
| | | Platform platform = _platFormRepository.QueryFirst(x => x.DeviceCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active"); |
| | | if (platform != null) |
| | |
| | | else |
| | | { |
| | | var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList(); |
| | | if (GWTask.Count >= 2 && childDeviceCode == "1039"&& task.Roadway.Contains("GWSC2")) |
| | | if (GWTask.Count >= 2 && childDeviceCode == "1039" && task.Roadway.Contains("GWSC2")) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"托盘号:【{command.ConveyorLineBarcode}】高温二已存在【{GWTask.Count}】个任务大于2个任务不可下发"); |
| | | return; |
| | | } |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | if (newTask != null) |
| | | { |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateData(newTask); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateData(newTask); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (content.Status) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState,Convert.ToInt16(1), childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | } |
| | | |
| | | Console.Out.WriteLine(content.Serialize()); |
| | |
| | | if (task != null) |
| | | { |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.OutTray) |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.OutTray) |
| | | { |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (newTask != null) |
| | | { |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateData(newTask); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateData(newTask); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); |
| | | taskCommand.ConveyorLineTargetAddress = Convert.ToInt16(stationManager.stationNGChildCode); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | content = _taskService.UpdateTaskStatusToNext(task); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | content = _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | taskNext.ExceptionMessage = log; |
| | | content = _taskService.UpdateTaskStatusToNext(taskNext); |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | |
| | | taskNext.ExceptionMessage = log; |
| | | content = _taskService.UpdateTaskStatusToNext(taskNext); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public bool SendCommand(ConveyorLineTaskCommand_After taskCommand, CommonConveyorLine_GW conveyorLine, string childDeviceCode) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(taskCommand.ConveyorLineTargetAddress), childDeviceCode); |
| | | Thread.Sleep(100); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, taskCommand.ConveyorLineBarcode, childDeviceCode); |
| | | Thread.Sleep(100); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, taskCommand.ConveyorLineTaskNum, childDeviceCode); |
| | | for (int i = 0; i < 6; i++) |
| | | { |
| | | ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode); |
| | | if (command != null) |
| | | { |
| | | if (command.ConveyorLineBarcode == taskCommand.ConveyorLineBarcode && command.ConveyorLineTaskNum == taskCommand.ConveyorLineTaskNum && command.ConveyorLineTargetAddress == taskCommand.ConveyorLineTargetAddress) |
| | | { |
| | | return true; |
| | | } |
| | | if (command.ConveyorLineTargetAddress != taskCommand.ConveyorLineTargetAddress) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(taskCommand.ConveyorLineTargetAddress), childDeviceCode); |
| | | Thread.Sleep(100); |
| | | } |
| | | if (command.ConveyorLineBarcode != taskCommand.ConveyorLineBarcode) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, taskCommand.ConveyorLineBarcode, childDeviceCode); |
| | | Thread.Sleep(100); |
| | | } |
| | | if (command.ConveyorLineTaskNum != taskCommand.ConveyorLineTaskNum) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, taskCommand.ConveyorLineTaskNum, childDeviceCode); Thread.Sleep(100); |
| | | } |
| | | |
| | | } |
| | | } |
| | | WriteInfo(conveyorLine.DeviceName, $"写入任务失败任务号【{taskCommand.ConveyorLineTaskNum}】托盘号【{taskCommand.ConveyorLineBarcode}】目标地址【{taskCommand.ConveyorLineTargetAddress}】当前节点【{childDeviceCode}】"); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |