| | |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core.Helper; |
| | |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_TaskInfoService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | // _taskService.Repository ä»å¨å±ï¼è¿è¡æ°æ®åºè®¿é®- |
| | | try |
| | | { |
| | | List<Dt_Task> Uptasks = new List<Dt_Task>(); |
| | | var taskList = _taskService.Repository.QueryData(x => x.TaskType == TaskTypeEnum.CPInbound.ObjToInt() && x.TaskState == TaskStatusEnum.CheckShapeing.ObjToInt()); |
| | | var AGVtaskList = _taskService.Repository.QueryData(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt()&& (x.TaskType == TaskTypeEnum.Q3RK.ObjToInt() || x.TaskType == TaskTypeEnum.Q3CK.ObjToInt()));//1-6å6-1æ¥¼ä»»å¡ |
| | | //ä»»å¡çç®æ å°å对äºç«å°å·ï¼ |
| | | foreach (var task in taskList) |
| | | { |
| | | ////æ¾å°å¯¹äºç«å°ç管çä¿¡æ¯ï¼ççè¿ä¸ªç«å°ææ²¡æè´§ï¼å¦ææè´§çè¯ï¼å°±è¿è¡è´¨æ£ï¼å¦ææ²¡æè´§çè¯ï¼å°±ä¸è¿è¡è´¨æ£ |
| | | //var stationMangers = _stationMangerService.Repository.QueryFirst(x => x.StationCode == task.SourceAddress); |
| | | //device.SetValue(QualityInspectionCommandEnum.StartqualityInspection,true,task.SourceAddress); |
| | | //妿æè´§çè¯ï¼æè¿è¡è´¨æ£ï¼æç«å°ç¶æè¯¥ä¸ºå ç¨ |
| | | var R_StockAvailableSymbol = device.GetValue<QualityInspectionCommandEnum, bool>(QualityInspectionCommandEnum.R_StockAvailableSymbol, task.SourceAddress); |
| | | if (R_StockAvailableSymbol == true) |
| | | if (device.GetValue<QualityInspectionCommandEnum, bool>(QualityInspectionCommandEnum.R_QualityInspection, task.SourceAddress)) |
| | | { |
| | | //stationMangers.IsOccupied=1;//æ¹ä¸ºå ç¨ |
| | | //å¼å¯è´¨æ£ |
| | | device.SetValue(QualityInspectionCommandEnum.StartqualityInspection, true, task.SourceAddress); |
| | | //å¦æè¯»å°è´¨æ£æ§è¡ä¸ä¸ºtrueçè¯ï¼å°±å
³éè´¨æ£ |
| | | if (device.GetValue<QualityInspectionCommandEnum, bool>(QualityInspectionCommandEnum.R_QualityInspection, task.SourceAddress)) |
| | | { |
| | | device.SetValue(QualityInspectionCommandEnum.StartqualityInspection, false, task.SourceAddress); |
| | | } |
| | | device.SetValue(QualityInspectionCommandEnum.StartqualityInspection, false, task.SourceAddress); |
| | | //å读åè´¨æ£ç»æ |
| | | var qualityResult = device.GetValue<QualityInspectionCommandEnum, bool>(QualityInspectionCommandEnum.R_QualityInspectionInProgress, task.SourceAddress); |
| | | //å·¦è¶
宽è¦å |
| | |
| | | { |
| | | //å¦æè´¨æ£éè¿äºï¼å°±æä»»å¡ç¶ææ¹ä¸ºè´¨æ£å®æ |
| | | task.TaskState = TaskStatusEnum.CheckShapeingOk.ObjToInt(); |
| | | task.ExceptionMessage = ""; |
| | | Uptasks.Add(task); |
| | | } |
| | | else if (R_LeftOverWidthWarning) |
| | | else |
| | | { |
| | | task.ExceptionMessage += "è´¨æ£å¤±è´¥ï¼å·¦è¶
宽"; |
| | | task.TaskState = TaskStatusEnum.CheckShapeingNG.ObjToInt(); |
| | | } |
| | | else if (R_RightWideWarning) |
| | | { |
| | | task.ExceptionMessage += "è´¨æ£å¤±è´¥ï¼å³è¶
宽"; |
| | | } |
| | | else if (R_ExtremeWarning) |
| | | { |
| | | task.ExceptionMessage += "è´¨æ£å¤±è´¥,è¶
é«"; |
| | | } |
| | | else if (qualityResult == false) //å¦æè´¨æ£å¤±è´¥ï¼å°±å¤ä½ |
| | | { |
| | | task.ExceptionMessage = "夿£å¤±è´¥"; |
| | | if (R_LeftOverWidthWarning) task.ExceptionMessage += ",å·¦è¶
宽"; |
| | | if (R_RightWideWarning) task.ExceptionMessage += ",å³è¶
宽"; |
| | | if (R_ExtremeWarning) task.ExceptionMessage += ",è¶
é«"; |
| | | Uptasks.Add(task); |
| | | //åå
¥å¤ä½ä¿¡å· |
| | | device.SetValue(QualityInspectionCommandEnum.FaultReset, true, task.SourceAddress); |
| | | //device.SetValue(QualityInspectionCommandEnum.FaultReset, true, task.SourceAddress); |
| | | } |
| | | //åå
¥åæ¢è´¨æ£ä¿¡å· |
| | | device.SetValue(QualityInspectionCommandEnum.StopqualityInspection, true, task.SourceAddress); |
| | | Thread.Sleep(500); |
| | | device.SetValue(QualityInspectionCommandEnum.StopqualityInspection, false, task.SourceAddress); |
| | | } |
| | | //else |
| | | //{ |
| | | // //åå
¥åæ¢è´¨æ£ä¿¡å· |
| | | // device.SetValue(QualityInspectionCommandEnum.StopqualityInspection, false, task.SourceAddress); |
| | | // device.SetValue(QualityInspectionCommandEnum.StartqualityInspection, true, task.SourceAddress); |
| | | //} |
| | | else |
| | | { |
| | | task.TaskState = TaskStatusEnum.CheckShapeingNG.ObjToInt(); |
| | | task.ExceptionMessage = "æªæ£æµå°è´¨æ£å®æä¿¡å·"; |
| | | Uptasks.Add(task); |
| | | } |
| | | } |
| | | foreach (var item in AGVtaskList) |
| | | { |
| | | |
| | | if (device.GetValue<QualityInspectionCommandEnum, bool>(QualityInspectionCommandEnum.R_StockAvailableSymbol, item.SourceAddress)) |
| | | { |
| | | item.ExceptionMessage = $"{item.SourceAddress}ç«å°æè´§,æ æ³è¿å
¥"; |
| | | continue; |
| | | } |
| | | //intoè¿å
¥ä¸æ¥¼ä½ç½®çæ¶åï¼åå
¥è¿å
¥ä¿¡å· |
| | | device.SetValue(QualityInspectionCommandEnum.RequestToEnter, true, item.SourceAddress); |
| | | if (!device.GetValue<QualityInspectionCommandEnum,bool>(QualityInspectionCommandEnum.Blocking)==true) |
| | | { |
| | | item.ExceptionMessage = $"{item.TargetAddress}ç«å°å
æ
ä¸ä¸ºtrueï¼1ï¼!"; |
| | | } |
| | | var result = _taskService.Hikvisiontaskscontinue(item.WMSTaskNum); |
| | | if (result.Status == false) |
| | | { |
| | | if (item.ExceptionMessage != result.Message) |
| | | { |
| | | item.ExceptionMessage = result.Message; |
| | | Uptasks.Add(item); |
| | | } |
| | | continue; |
| | | } |
| | | item.TaskState = (int)TaskStatusEnum.AGV_ToExecute; |
| | | item.ExceptionMessage = ""; |
| | | Uptasks.Add(item); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | _taskService.UpdateData(Uptasks); |
| | | WriteInfo(device.DeviceName, "infoLog"); |
| | | |
| | | WriteDebug(device.DeviceName, "debugLog"); |