| | |
| | | MapCode="01", |
| | | Variables=new List<PointDetail>() |
| | | }; |
| | | if (task.NextAddress== "䏿¥¼æå°ç 头") |
| | | { |
| | | string? address =_taskService.RequestTargetAddress(task.TaskNum); |
| | | if (address.IsNullOrEmpty()) |
| | | { |
| | | task.ExceptionMessage = "æªæ¾å°AGVç«ç¹"; |
| | | continue; |
| | | } |
| | | task.NextAddress = address; |
| | | } |
| | | Dt_StationManger stationMangerStart = _stationMangerRepository.QueryFirst(x=>x.StationCode==task.CurrentAddress); |
| | | Dt_StationManger stationMangerEnd = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress); |
| | | //æ·»å ä»»å¡è·¯å¾åé«åº¦ |
| | |
| | | throw new Exception("æªæ¾å°AGVç«ç¹"); |
| | | } |
| | | //忾任塿¨¡ç |
| | | if (stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT"))//è¯·æ±æ¾ |
| | | if (stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT") && stationMangerEnd.IsManual==0)//è¯·æ±æ¾ |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO1"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | |
| | | agvTaskSend.TaskCode = "DUOLUN1"; |
| | | } |
| | | } |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT"))//请æ±å |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT") && stationMangerStart.IsManual == 0)//请æ±å |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO2"; |
| | | if (stationMangerStart.StationType==998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | |
| | | agvTaskSend.TaskCode = "DUOLUN2"; |
| | | } |
| | | } |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT"))//请æ±åæ¾ |
| | | else if (!stationMangerStart.StationCode.Contains("PNT") && !stationMangerEnd.StationCode.Contains("PNT") && stationMangerStart.IsManual == 0 && stationMangerStart.IsManual == 0)//请æ±åæ¾ |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO3"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | |
| | | agvTaskSend.TaskCode = "DUOLUN3"; |
| | | } |
| | | } |
| | | else if (stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT"))//æ è¯·æ± |
| | | else//æ è¯·æ± |
| | | { |
| | | agvTaskSend.TaskCode = "DUIGAO4"; |
| | | if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//æ½ä¼é¡¶å车 |
| | |
| | | { |
| | | agvTaskSend.Variables.FirstOrDefault(x => x.Code == "FHMH").Value = "0"; |
| | | agvTaskSend.Variables.FirstOrDefault(x => x.Code == "GoodPoint").Value = ""; |
| | | //å¤æäººå·¥æå¨ |
| | | PointDetail complete = new(); |
| | | if (stationMangerStart.IsManual==1 && stationMangerEnd.IsManual==0) |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "1" |
| | | }; |
| | | } |
| | | else if (stationMangerStart.IsManual == 0 && stationMangerEnd.IsManual == 1) |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "2" |
| | | }; |
| | | } |
| | | else if (stationMangerStart.IsManual == 1 && stationMangerEnd.IsManual == 1) |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "3" |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | complete = new() |
| | | { |
| | | Code = "Complete", |
| | | Value = "0" |
| | | }; |
| | | } |
| | | //ä¸åä»»å¡AGVä»»å¡é群 |
| | | agvTaskSend.AgvGroupCode = "QianF"; |
| | | PointDetail pointDetail2 = new PointDetail() |
| | |
| | | Value = stationMangerStart.AGVStationCode |
| | | }; |
| | | agvTaskSend.Variables.Add(pointDetail2); |
| | | agvTaskSend.Variables.Add(complete); |
| | | } |
| | | //å»¶æ¶ |
| | | Thread.Sleep(500); |
| | | if (task.TaskType==TaskTypeEnum.OutCarton.ObjToInt()) |
| | | { |
| | | agvTaskSend.AgvGroupCode = "GAOc"; |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(agvTaskSend, APIEnum.AgvSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | Thread.Sleep(200); |
| | | Thread.Sleep(500); |
| | | } |
| | | catch (Exception ex) |
| | | { |