| | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", "å¼å§æ¶é´" + DateTime.Now); |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", $"大å åæºä»»å¡æ§è¡ä¸..."); |
| | | //CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | CommonStackerCrane commonStackerCrane = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC01") as CommonStackerCrane; |
| | | try |
| | |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", $"大å åæºä»»å¡å·{task.TaskNum}"); |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | |
| | | |
| | | |
| | | //æ¥è¯¢æåæº/ç»ç«æºä¿¡å· |
| | | Task.Run(delegate |
| | | { |
| | | //Task.Run(delegate |
| | | //{ |
| | | try |
| | | { |
| | | |
| | | if (commonStackerCrane != null) |
| | | { |
| | | |
| | | Dt_Task? task1001 = _taskService.QueryStackerCraneTaskByAGVRequest("SC01"); |
| | | if (task1001 != null) |
| | | { |
| | |
| | | int IsWriteTwo = 0; |
| | | if (task3001.SourceAddress == "SC01-002-000-001")//WMS 1001ç«ç¹ |
| | | { |
| | | //æåæºæ¯å¦å¤äºå°±ç»ªç¶æ |
| | | int IsReady= commonStackerCrane.Communicator.Read<short>("DB2.0.0"); |
| | | //åå
¥æåä¿¡æ¯ |
| | | IsWriteOne = commonStackerCrane.Communicator.Read<short>("DB1.0.0"); |
| | | if(IsWriteOne == 0) |
| | | if(IsWriteOne == 0&& IsReady == 1) |
| | | { |
| | | |
| | | var d= commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1); |
| | | commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1); |
| | | } |
| | | //读åæåæºä¿¡å·ï¼ç¡®å®æ¯å¦æå宿 |
| | | |
| | |
| | | } |
| | | else if (task3001.SourceAddress == "SC01-002-000-002")//WMS 1002ç«ç¹ |
| | | { |
| | | //æåæºæ¯å¦å¤äºå°±ç»ªç¶æ |
| | | int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0"); |
| | | //åå
¥æåä¿¡æ¯ |
| | | IsWriteTwo = commonStackerCrane.Communicator.Read<short>("DB1.6.0"); |
| | | if (IsWriteTwo == 0) |
| | | if (IsWriteTwo == 0 && IsReady == 1) |
| | | { |
| | | commonStackerCrane.Communicator.Write<short>("DB1.6.0", 1); |
| | | } |
| | |
| | | { |
| | | WriteDebug(nameof(CommonStackerCraneJob), $"æåæºæå宿ï¼åä¼ WMS失败ï¼ä»»å¡å·{task3001.TaskNum}"); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (!string.IsNullOrEmpty(Levels[0]) && !string.IsNullOrEmpty(Levels[1])) |
| | | { |
| | | int level = Convert.ToInt16(Levels[0]) - Convert.ToInt16(Levels[1]); |
| | | |
| | | //å©ä½å±æ°åå
¥ |
| | | bool issuccess = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth + ".0", Convert.ToInt16(level)); |
| | | WriteDebug(nameof(CommonStackerCraneJob), $"å©ä½å±æ°ä¿¡å·åå
¥{level}-ä»»å¡å·{taskSmall.TaskNum}"); |
| | | |
| | | |
| | | //妿å½åæå屿°çäºæ»å±æ°ï¼å表示æè½¦ææç屿°åå® |
| | | if (level == 0) |
| | | { |
| | |
| | | { |
| | | //æ ¹æ®ç®æ å°åæ¥è¯¢ç»ç«æºç«ç¹ä¿¡æ¯ï¼è·ååå
¥æ´è½¦å®æçDBå Depth |
| | | Dt_LocationInfo location2 = _locationInfoRepository.QueryFirst(x => x.LocationCode == location.Remark); |
| | | //æ´è½¦å®æåå
¥ |
| | | bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth+".0", 1); |
| | | //æ´è½¦å®æåå
¥å±æ° |
| | | int sn = 0; |
| | | if(taskSmall.SourceAddress== "SC01-001-006-001"|| taskSmall.SourceAddress == "SC01-001-012-001"|| taskSmall.SourceAddress == "SC01-001-018-001" || taskSmall.SourceAddress == "SC01-001-022-001"|| taskSmall.SourceAddress == "SC01-001-026-001") |
| | | { |
| | | sn = 1; |
| | | } |
| | | else if(taskSmall.SourceAddress == "SC01-001-007-001" || taskSmall.SourceAddress == "SC01-001-013-001" || taskSmall.SourceAddress == "SC01-001-019-001" || taskSmall.SourceAddress == "SC01-001-023-001" || taskSmall.SourceAddress == "SC01-001-027-001") |
| | | { |
| | | sn = 2; |
| | | } |
| | | else |
| | | { |
| | | sn = 3; |
| | | } |
| | | bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location2.Depth+".0", Convert.ToInt16(sn)); |
| | | if (issuccess2&&issuccess) |
| | | { |
| | | _taskService.UpdateTaskStatus(taskSmall.TaskId, (int)TaskOutStatusEnum.OutFinish); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), "æ¥è¯¢æåå
¥PLCç¶æå¤±è´¥ï¼", ex); |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | |
| | | |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", "ç»ææ¶é´" + DateTime.Now); |
| | | //}); |
| | | return Task.CompletedTask; |
| | | } |
| | | |