wangxinhui
10 天以前 834294889ab62bafaf034b1b87c2ead961c33476
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/AGV_CPExtend.cs
@@ -38,6 +38,16 @@
                                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);
                            //添加任务路径及高度
@@ -93,7 +103,7 @@
                                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)//潜伏顶升车
@@ -101,7 +111,7 @@
                                    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)//潜伏顶升车
@@ -109,7 +119,7 @@
                                    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)//潜伏顶升车
@@ -117,7 +127,7 @@
                                    agvTaskSend.TaskCode = "DUOLUN3";
                                }
                            }
                            else if (stationMangerStart.StationCode.Contains("PNT") && stationMangerEnd.StationCode.Contains("PNT"))//无请求
                            else//无请求
                            {
                                agvTaskSend.TaskCode = "DUIGAO4";
                                if (stationMangerStart.StationType == 998 || stationMangerEnd.StationType == 998)//潜伏顶升车
@@ -129,6 +139,40 @@
                            {
                                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()
@@ -137,16 +181,19 @@
                                    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)
                        {