| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Autofac.Core; |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Microsoft.AspNetCore.Hosting; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Diagnostics.Eventing.Reader; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.Log; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | Signalinteraction(commonStackerCrane); //åºåºä¿¡å·äº¤äº |
| | | Siganlinteraction2(commonStackerCrane); //å
¥åºä¿¡å·äº¤äº |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | |
| | | private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task; |
| | | if (commonStackerCrane.LastTaskType == null) |
| | | /*if (commonStackerCrane.LastTaskType == null) |
| | | { |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | } |
| | |
| | | { |
| | | task = _taskService.QueryStackerCraneOutTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | } |
| | | }*/ |
| | | task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | if (task != null && task.TaskType== (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | string[] targetCodes = task.SourceAddress.Split("-"); |
| | | if (targetCodes[4] == "02") |
| | | { |
| | | |
| | | task = OutTaskMovelibrary(task); |
| | | if (task != null) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | |
| | | |
| | | /*if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); |
| | | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); |
| | | |
| | | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode); |
| | | foreach (var item in tasks) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | |
| | | return task; |
| | | } |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | //task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | }*/ |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault(); |
| | | if (router != null) |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.TargetAddress)); |
| | | if (device != null) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode); |
| | | if (device != null) |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_Event"); //æ ¹æ®å åæºå°åï¼å°ååç§°æ¾åè®® |
| | | if (deviceProDTO != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | if (conveyorLine.IsOccupied(router.ChildPosi))//åºåºç«å°æªè¢«å ç¨ |
| | | int B_Event_Test = GetLine(conveyorLine, deviceProDTO.DeviceProDataBlock); //夿è¾é线æ¯å¦å
许æ¾è´§ä¿¡å· |
| | | if (B_Event_Test == 1) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°åºåºç«å°ã{task.TargetAddress}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åºåºä»»å¡å¤ææ¯å¦éè¦è¿è¡ç§»åºMove the library |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private Dt_Task? OutTaskMovelibrary([NotNull] Dt_Task task) |
| | | { |
| | | try |
| | | { |
| | | string[] targetCodes = task.SourceAddress.Split("-"); |
| | | if (targetCodes[1] == "001") |
| | | { |
| | | targetCodes[1] = "002"; |
| | | |
| | | } |
| | | else if (targetCodes[1] == "004") |
| | | { |
| | | targetCodes[1] = "003"; |
| | | } |
| | | targetCodes[4] = "01"; |
| | | string SourceAddress = string.Join("-", targetCodes); //ç»è£
æµ
åºä½å°å |
| | | Dt_Task? tasks = _taskService.QueryStationIsOccupiedOutTasks(task.Roadway, SourceAddress).FirstOrDefault(); |
| | | if (tasks != null) |
| | | { |
| | | return tasks; |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°åºåºç«å°ã{router.ChildPosiDeviceCode}ã对åºçéè®¯å¯¹è±¡ï¼æ æ³å¤æåºåºç«å°æ¯å¦è¢«å ç¨"); |
| | | //åwmsç³è¯·å¤ææµ
åºä½æ¯å¦æè´§ï¼æ¯å¦éè¦è¿è¡ç§»åº |
| | | Dt_Task? taskst = _taskService.RequestWMSTaskMovelibrary(task); |
| | | if (taskst != null) |
| | | { |
| | | return taskst; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void Signalinteraction(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | if (Applyrelease(commonStackerCrane)) //读åå åæºæ¾è´§ç³è¯· |
| | | { |
| | | Dt_Task task = _taskService.IngStackerCraneTask2(commonStackerCrane.DeviceCode); |
| | | if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.TargetAddress)); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_Event"); //æ ¹æ®å åæºå°åï¼å°ååç§°æ¾åè®® |
| | | if (deviceProDTO != null) |
| | | { |
| | | int B_Event_Test = GetLine(conveyorLine, deviceProDTO.DeviceProDataBlock); //夿è¾é线æ¯å¦å
许æ¾è´§ä¿¡å· |
| | | if (B_Event_Test == 1) |
| | | { |
| | | |
| | | if (Releasespermitted(commonStackerCrane, task.TargetAddress,true)) //åå
¥å åæºå
许æ¾è´§ä¿¡ |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºå
许æ¾è´§ä¿¡å·æåï¼true", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºå
许æ¾è´§ä¿¡å·å¤±è´¥", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (Releasespermitted(commonStackerCrane, task.TargetAddress,false)) //åå
¥å åæºä¸å
许æ¾è´§ä¿¡ |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºä¸å
许æ¾è´§ä¿¡å·æåï¼false", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºä¸å
许æ¾è´§ä¿¡å·å¤±è´¥", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³æ ¡éªç«å°"); |
| | | Dt_Task task = _taskService.IngStackerCraneTask2(commonStackerCrane.DeviceCode); |
| | | if (task !=null && task.TaskType == (int)TaskOutboundTypeEnum.Outbound) |
| | | { |
| | | if (Completesignal(commonStackerCrane, task.TargetAddress)) //读åå°æ¾è´§å®æä¿¡å· |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.TargetAddress)); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | if (task.TargetAddress == "R02-002-027-011-01" || task.TargetAddress == "R01-002-041-011-01") //åå
¥è¾é线å»å |
| | | { |
| | | byte PLCtost = (byte)task.PLCTo; |
| | | if (PLCSignal2(conveyorLine, task.TargetAddress, "W_Destination", PLCtost)) |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å»åæåï¼å»å为ï¼{PLCtost}", $"åºæå£å»å"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å»å失败ï¼å»å为ï¼{PLCtost}", $"åºæå£å»å"); |
| | | } |
| | | } |
| | | |
| | | if (PLCSignal(conveyorLine, task.TargetAddress, (byte)1)) //åå
¥è¾é线 å åæºæ¾è´§ ä¿¡å· |
| | | { |
| | | //读åè¾é线åé¦ å åæºæ¾ä¸ä¿¡å· |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_StackerCraneLowered"); //è¾é线åè®®æ¾è¯»åä¿¡å· |
| | | if (deviceProDTO2 != null) |
| | | { |
| | | int B_TAKE = GetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock); //读åè¾é线ç å åæºæ¾ä¸ ä¿¡å· |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼è¯»åå°è¾é线-å åæºæ¾ä¸ä¿¡å·ï¼{B_TAKE}", $"ï¼æ¾è´§ï¼è¯»å{task.TargetAddress}"); |
| | | |
| | | if (B_TAKE == 1) |
| | | { |
| | | if (task.TargetAddress == "R02-002-027-011-01" || task.TargetAddress == "R01-002-041-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO3 = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_Destination"); |
| | | if (deviceProDTO3 != null) |
| | | { |
| | | int PLCwcstost = GetLine(conveyorLine, deviceProDTO3.DeviceProDataBlock); |
| | | if (PLCwcstost == task.PLCTo) |
| | | { |
| | | byte PLCtost2 = 0; |
| | | if (PLCSignal2(conveyorLine, task.TargetAddress, "W_Destination", PLCtost2)) |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼æ¸
é¤å»åæå", $"åºæå£å»å"); |
| | | |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼æ¸
é¤å»å失败", $"åºæå£å»å"); |
| | | } |
| | | // æ¸
é¤è¾é线 |
| | | if (PLCSignal(conveyorLine, task.TargetAddress, (byte)0)) |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥è¾é线æ¸
é¤-å åæºæ¾ä¸ä¿¡å·æå", $"åºæå£å»å"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥è¾é线æ¸
é¤-å åæºæ¾ä¸ä¿¡å·å¤±è´¥", $"åºæå£å»å"); |
| | | } |
| | | //å åæºå宿 |
| | | if (Releasespermitted4(commonStackerCrane, task.TargetAddress, true)) |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºæ¾ä¸ä¿¡å·æåï¼true", $"åºæå£å»å"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºæ¾ä¸ä¿¡å·å¤±è´¥:true", $"åºæå£å»å"); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼å»åæ¯å¯¹ä¸ä¸è´ï¼è¾é线å»å为ï¼{PLCwcstost}ï¼wcsåå
¥å»å为ï¼{task.PLCTo}", $"åºæå£å»å"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (task.TargetAddress != "R02-002-027-011-01" && task.TargetAddress != "R01-002-041-011-01") |
| | | { |
| | | // æ¸
é¤è¾é线 |
| | | if (PLCSignal(conveyorLine, task.TargetAddress, 0)) |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥è¾é线æ¸
é¤-å åæºæ¾ä¸ä¿¡å·æå", $"ï¼æ¾è´§ï¼è¯»å{task.TargetAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥è¾é线æ¸
é¤-å åæºæ¾ä¸ä¿¡å·å¤±è´¥", $"ï¼æ¾è´§ï¼è¯»å{task.TargetAddress}"); |
| | | } |
| | | |
| | | //å åæºå宿 |
| | | if (Releasespermitted4(commonStackerCrane, task.TargetAddress, true)) |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºæ¾ä¸ä¿¡å·æåï¼true", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥å åæºæ¾ä¸ä¿¡å·å¤±è´¥:true", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | // æ¸
é¤è¾é线 |
| | | if (PLCSignal(conveyorLine, task.TargetAddress, 0)) |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼æªè¯»åå°è¾é线åé¦å åæºå®æåé¦ä¿¡å·ï¼é置为0", $"ï¼æ¾è´§ï¼è¯»å{task.TargetAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼æªè¯»åå°è¾é线åé¦å åæºå®æåé¦ä¿¡å·ï¼é置为0", $"ï¼æ¾è´§ï¼è¯»å{task.TargetAddress}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("è¾é线").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼åå
¥è¾é线0-å åæºæ¾ä¸ä¿¡å·å¤±è´¥", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.TargetAddress},ä»»å¡å·ï¼{task.TaskNum},ä¿¡æ¯ï¼æªè¯»åå°å åæºæ¾è´§å®æä¿¡å·", $"ï¼æ¾è´§ï¼åå
¥{task.TargetAddress}"); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void Siganlinteraction2(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | Dt_Task task = _taskService.IngStackerCraneTask(commonStackerCrane.DeviceCode); |
| | | if (task != null && task.TaskType == (int)TaskInboundTypeEnum.Inbound) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceProDTOs.Exists(x => x.DeviceChildCode == task.SourceAddress)); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO(conveyorLine, task.SourceAddress, "R_Event"); //æ ¹æ®å åæºå°åï¼å°ååç§°æ¾åè®® |
| | | if (deviceProDTO != null) |
| | | { |
| | | int B_Event_Test = GetLine(conveyorLine, deviceProDTO.DeviceProDataBlock); //夿è¾é线æ¯å¦å
许åè´§ä¿¡å· |
| | | if (B_Event_Test == 1) |
| | | { |
| | | if (Releasespermitted2(commonStackerCrane, task.SourceAddress,true)) //åå
¥å åæºå
许åè´§ä¿¡å· |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼åå
¥å åæºå
许åè´§ä¿¡å·æå:true", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼åå
¥å åæºå
许åè´§ä¿¡å·å¤±è´¥", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (Releasespermitted2(commonStackerCrane, task.SourceAddress,false)) //åå
¥å åæºå
许åè´§ä¿¡å· |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼æªè¯»åå°è¾é线å
许åè´§ä¿¡å·ï¼åå
¥å åæºå
许åè´§ä¿¡å·æå:false", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼æªè¯»åå°è¾é线å
许åè´§ä¿¡å·ï¼åå
¥å åæºå
许åè´§ä¿¡å·å¤±è´¥", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if (Completesignal2(commonStackerCrane, task.SourceAddress)) //读åå åæºåè´§å®æä¿¡å· |
| | | { |
| | | if(PLCSignal2(conveyorLine, task.SourceAddress, "W_StackerCranePicked", 1)) //åå
¥è¾é线åè´§å®æä¿¡å· |
| | | { |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, task.SourceAddress, "R_StackerCranePicked"); //è¾é线åè®®æ¾è¯»åä¿¡å· |
| | | if (deviceProDTO != null) |
| | | { |
| | | int B_TAKE = GetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock); //读åè¾é线ç å åæºåèµ° ä¿¡å· |
| | | if (B_TAKE == 1) |
| | | { |
| | | //åå
¥ç»å åæºï¼è¾é线ç å åæºåèµ° ä¿¡å· |
| | | if(Releasespermitted3(commonStackerCrane, task.SourceAddress,true)) |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼åå
¥å åæºåèµ°ä¿¡å·æå:true", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼åå
¥å åæºåèµ°ä¿¡å·å¤±è´¥:true", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (Releasespermitted3(commonStackerCrane, task.SourceAddress,false)) |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼æªè¯»åè¾é线çå åæºåèµ°ä¿¡å·ï¼åå
¥å åæºåèµ°ä¿¡å·æå:false", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼æªè¯»åè¾é线çå åæºåèµ°ä¿¡å·ï¼åå
¥å åæºåèµ°ä¿¡å·å¤±è´¥:false", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (PLCSignal2(conveyorLine, task.SourceAddress, "W_StackerCranePicked", 0)) //åå
¥è¾é线æ¸
é¤ä¿¡å· |
| | | { |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, task.SourceAddress, "R_StackerCranePicked"); //è¾é线åè®®æ¾è¯»åä¿¡å· |
| | | if (deviceProDTO != null) |
| | | { |
| | | int B_TAKE = GetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock); //读åè¾é线ç å åæºåèµ° ä¿¡å· |
| | | if (B_TAKE == 0) |
| | | { |
| | | //åå
¥ç»å åæºï¼è¾é线ç å åæºåèµ° ä¿¡å· |
| | | if (Releasespermitted3(commonStackerCrane, task.SourceAddress, false)) |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼åå
¥å åæºåèµ°ä¿¡å·æå:true", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼åå
¥å åæºåèµ°ä¿¡å·å¤±è´¥:true", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (Releasespermitted3(commonStackerCrane, task.SourceAddress, false)) |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼æªè¯»åè¾é线çå åæºåèµ°ä¿¡å·ï¼åå
¥å åæºåèµ°ä¿¡å·æå:false", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | else |
| | | { |
| | | WriteLog.GetLog("å åæºä¿¡å·").Write($"ç«å°ç¼å·ï¼{task.SourceAddress},ä¿¡æ¯ï¼æªè¯»åè¾é线çå åæºåèµ°ä¿¡å·ï¼åå
¥å åæºåèµ°ä¿¡å·å¤±è´¥:false", $"ï¼åè´§ï¼åå
¥{task.SourceAddress}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //è·åè¾é线å®ä¾ |
| | | public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine,string SCAddress,string Interactivet) |
| | | { |
| | | return conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == Interactivet); |
| | | } |
| | | |
| | | //è·åå åæºä¾ |
| | | public DeviceProDTO? GetDeviceProDTO2(CommonStackerCrane commonStackerCrane, string DeviceName, string Interactivet) |
| | | { |
| | | return commonStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeviceName && x.DeviceProParamName == Interactivet); |
| | | } |
| | | |
| | | //读åå åæºç³è¯·æ¾è´§ä¿¡å· |
| | | public bool Applyrelease(CommonStackerCrane commonStackerCrane) |
| | | { |
| | | if (commonStackerCrane.DeviceCode == "SC02") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Bout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if(GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Dout"); |
| | | if (deviceProDTO2 != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO2.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (commonStackerCrane.DeviceCode == "SC01") |
| | | { |
| | | DeviceProDTO? deviceProDTO4 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Cout"); |
| | | if (deviceProDTO4 != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO4.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | DeviceProDTO? deviceProDTO3 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Dout"); |
| | | if (deviceProDTO3 != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO3.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | DeviceProDTO? deviceProDTO5 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_Aout"); |
| | | if (deviceProDTO5 != null) |
| | | { |
| | | if(GetStacker(commonStackerCrane, deviceProDTO5.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | DeviceProDTO? deviceProDTO6 = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryRequest_A2in"); //空æåºå
¥åº |
| | | if (deviceProDTO6 != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO6.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | |
| | | } |
| | | |
| | | //åå
¥å åæºå
许æ¾è´§ä¿¡å· |
| | | public bool Releasespermitted(CommonStackerCrane commonStackerCrane, string Destinationaddress,bool SCcrane) |
| | | { |
| | | if (Destinationaddress == "R02-002-027-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Bout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if(SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R02-002-027-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Dout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | //1å· |
| | | if (Destinationaddress == "R01-002-041-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Cout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-041-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Dout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | |
| | | if (Destinationaddress == "R01-002-044-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Aout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if(SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | |
| | | if (Destinationaddress == "R01-002-043-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_A2in"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | //读åå åæºçæ¾è´§å®æä¿¡å· |
| | | public bool Completesignal(CommonStackerCrane commonStackerCrane,string Destinationaddress) |
| | | { |
| | | if (Destinationaddress == "R02-002-027-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Bout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if(GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (Destinationaddress == "R02-002-027-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Dout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | //1å· |
| | | if (Destinationaddress == "R01-002-041-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Cout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-041-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Dout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (Destinationaddress == "R01-002-044-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_Aout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-043-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompleted_A2in"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | |
| | | } |
| | | |
| | | //åå
¥å åæºæ¾è´§ç¡®è®¤ä¿¡å· |
| | | public bool Releasespermitted4(CommonStackerCrane commonStackerCrane, string Destinationaddress, bool SCcrane) |
| | | { |
| | | if (Destinationaddress == "R02-002-027-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Bout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R02-002-027-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Dout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | //1å· |
| | | if (Destinationaddress == "R01-002-041-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Cout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-041-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Dout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-044-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Aout"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-043-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_A2in"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | //åå
¥å åæºå
许åè´§ä¿¡å· |
| | | public bool Releasespermitted2(CommonStackerCrane commonStackerCrane, string Destinationaddress, bool SCcrane) |
| | | { |
| | | if (Destinationaddress == "R02-003-027-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Bin"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R02-003-027-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Din"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | //1å· |
| | | if (Destinationaddress == "R01-003-041-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Cin"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-003-041-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Din"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | |
| | | if (Destinationaddress == "R01-002-042-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_Ain"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-043-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupRequest_A2in"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | //读åå åæºåè´§å®æä¿¡å· |
| | | public bool Completesignal2(CommonStackerCrane commonStackerCrane, string Destinationaddress) |
| | | { |
| | | if (Destinationaddress == "R02-003-027-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Bin"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R02-003-027-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Din"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | //1å· |
| | | if (Destinationaddress == "R01-003-041-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Cin"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-003-041-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Din"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (Destinationaddress == "R01-002-042-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_Ain"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (Destinationaddress == "R01-002-043-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompleted_A2in"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (GetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress).Status) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | |
| | | } |
| | | |
| | | //åå
¥å åæºåè´§ç¡®è®¤ä¿¡å· |
| | | public bool Releasespermitted3(CommonStackerCrane commonStackerCrane, string Destinationaddress, bool SCcrane) |
| | | { |
| | | if (Destinationaddress == "R02-003-027-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Bin"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R02-003-027-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Din"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | //1å· |
| | | if (Destinationaddress == "R01-003-041-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Cin"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-003-041-011-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Din"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | |
| | | if (Destinationaddress == "R01-002-042-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_Ain"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | if (Destinationaddress == "R01-002-043-001-01") |
| | | { |
| | | DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "PickupCompletion_A2in"); |
| | | if (deviceProDTO != null) |
| | | { |
| | | if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; } |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | //åå
¥è¾é线æ¾è´§å®æä¿¡å·ï¼æ¡ç ï¼å±æ°ï¼ç±»å |
| | | public bool PLCSignal(CommonConveyorLine conveyorLine,string TargetAddress,byte staLow) |
| | | { |
| | | //å¤çåºåºæ¾æå®æåé»è¾ |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, TargetAddress, "W_StackerCraneLowered"); //æ¾è´§å®æä¿¡å· |
| | | if (deviceProDTO2 != null) |
| | | { |
| | | if (SetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock, staLow)) |
| | | { |
| | | return true; |
| | | |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //åå
¥è¾é线 å åæºåè´§å®æä¿¡å· |
| | | public bool PLCSignal2(CommonConveyorLine conveyorLine, string SourceAddress,string DeviceProParamName,Byte stock) |
| | | { |
| | | DeviceProDTO? deviceProDTO2 = GetDeviceProDTO(conveyorLine, SourceAddress, DeviceProParamName); //åè´§å®æä¿¡å· |
| | | if (deviceProDTO2 != null) |
| | | { |
| | | return SetLine(conveyorLine, deviceProDTO2.DeviceProDataBlock, stock); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®åè®®ï¼å°åï¼å¼ï¼åå
¥è¾é线信æ¯, |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="DeviceProDataBlock"></param> |
| | | /// <param name="Pali"></param> |
| | | /// <returns></returns> |
| | | public bool SetLine(CommonConveyorLine conveyorLine,string DeviceProDataBlock,byte Pali) |
| | | { |
| | | return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali); |
| | | } |
| | | public bool SetLinestring(CommonConveyorLine conveyorLine, string DeviceProDataBlock, string Pali) |
| | | { |
| | | return conveyorLine.Communicator.Write(DeviceProDataBlock, Pali); |
| | | } |
| | | /// <summary> |
| | | /// æ ¹å°å读åè¾éçº¿ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="DeviceProDataBlock"></param> |
| | | /// <returns></returns> |
| | | public int GetLine(CommonConveyorLine conveyorLine, string DeviceProDataBlock) |
| | | { |
| | | return conveyorLine.Communicator.Read<byte>(DeviceProDataBlock); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读åå åæºå°å |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="DeviceProDataBlock"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GetStacker(CommonStackerCrane commonStackerCrane,string DeviceProDataBlock) |
| | | { |
| | | WebResponseContent content= new WebResponseContent(); |
| | | if (commonStackerCrane.Communicator.Read<bool>(DeviceProDataBlock)) |
| | | { |
| | | return content.OK(); |
| | | } |
| | | else |
| | | { |
| | | return content.Error(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åå
¥å åæºä¿¡å· |
| | | /// </summary> |
| | | /// <param name="conveyorLine"></param> |
| | | /// <param name="DeviceProDataBlock"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent SetStacker(CommonStackerCrane commonStackerCrane, string DeviceProDataBlock,bool Pali) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | if (commonStackerCrane.Communicator.Write(DeviceProDataBlock, Pali)) |
| | | { |
| | | return content.OK(); |
| | | } |
| | | else |
| | | { |
| | | return content.Error(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand(); |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.Barcode = ""; /*task.PalletCode;*/ |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 0; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(task.CurrentAddress, task.Roadway); |
| | | if (routers.Count > 0) |
| | | string[] targetCodest = task.SourceAddress.Split("-"); |
| | | if (targetCodest.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer); |
| | | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(targetCodest[1]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(targetCodest[2]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(targetCodest[3]); |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºåè´§ç«å°ä¿¡æ¯"); |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºèµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.SourceAddress}ã"); |
| | | return null; |
| | | } |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"å
¥åºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.NextAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | if (routers.Count > 0) |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]); |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°ç«å°ã{task.NextAddress}ãä¿¡æ¯ï¼æ æ³è·å对åºçå åæºæ¾è´§ç«å°ä¿¡æ¯"); |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | string[] sourceCodest = task.TargetAddress.Split("-"); |
| | | if (sourceCodest.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(sourceCodest[1]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(sourceCodest[2]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(sourceCodest[3]); |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"åºåºä»»å¡ç»ç¹é误ï¼èµ·ç¹ï¼ã{task.TargetAddress}ã"); |
| | | return null; |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | | { |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | if (targetCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]); |
| | | } |
| | | else |
| | | { |
| | |
| | | return null; |
| | | } |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | if (sourceCodes.Length == 5) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]); |
| | | } |
| | | else |
| | | { |