From 8fcd7a67e4391a5f1fbdb590c2a3f913aeb2a0a0 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期二, 31 三月 2026 14:11:23 +0800
Subject: [PATCH] PP平库功能上线,PDA优化,部分问题点优化

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP仓/AGV_PPExtend.cs |   69 +++++++++++++++++++++++-----------
 1 files changed, 47 insertions(+), 22 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/AGV_PPExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/AGV_PPExtend.cs"
index 5b734fc..8dc77cd 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/AGV_PPExtend.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/AGV_PPExtend.cs"
@@ -20,45 +20,70 @@
             try
             {
                 var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()||x.TaskState==TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList();
-                foreach (var task in newTasks)
+                foreach (var agvTask in newTasks)
                 {
                     try
                     {
-                        AgvTaskDTO TaskDTO = new AgvTaskDTO()
+                        string taskTyp;
+                        if (agvTask.TaskType == TaskTypeEnum.MesPPMove.ObjToInt())
                         {
-                            TaskCode = task.AgvTaskNum,
-                            ReqCode = DateTime.Now.ToString("yyMMddHHmmss") + task.AgvTaskNum,
-                            TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "FLC" : "FLR",
-                            ctnrCode = task.PalletCode,
+                            taskTyp = "110";
+                        }
+                        else if (agvTask.PalletType < 2)
+                        {
+                            taskTyp = "008";
+                        }
+                        else
+                        {
+                            taskTyp = "004";
+                        }
+
+                        AgvTaskDTO taskDTO = new AgvTaskDTO()
+                        {
+                            ReqCode = Guid.NewGuid().ToString().Replace("-", ""),
+                            TaskTyp = taskTyp,
                             PositionCodePath = new List<CodePath>()
-                        {
-                            new CodePath()
                             {
-                                type="00",
-                                positionCode=task.CurrentAddress
+                                new CodePath()
+                                {
+                                    type = "00",
+                                    positionCode = agvTask.CurrentAddress
+                                },
+                                new CodePath()
+                                {
+                                    type = (agvTask.TaskType == TaskTypeEnum.PPPKInbound.ObjToInt()||agvTask.TaskType == TaskTypeEnum.MesPPCutOutbound.ObjToInt()) ? "00" : "04",
+                                    positionCode = agvTask.NextAddress
+                                }
                             },
-                            new CodePath()
-                            {
-                                type="00",
-                                positionCode=task.NextAddress
-                            }
-                        },
+                            TaskCode = agvTask.AgvTaskNum,
                         };
-                        WebResponseContent content = _taskService.AgvSendTask(TaskDTO, APIEnum.Agv_PPSendTask);
-                        if (!content.Status) throw new Exception(content.Message);
-                        task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); 
+                        WebResponseContent content = _taskService.AgvSendTask(taskDTO);
+                        if (content.Status)
+                        {
+                            agvTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt();
+                            //agvTask.Remark = content.Data.ObjToString();
+                            _taskService.UpdateTask(agvTask, TaskStatusEnum.AGV_Executing);
+                        }
+                        else
+                        {
+                            agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt();
+                            //agvTask.Remark = content.Data.ObjToString();
+                            agvTask.ExceptionMessage = content.Message;
+                        }
                     }
                     catch (Exception ex)
                     {
-                        task.TaskState = TaskStatusEnum.Exception.ObjToInt();
-                        task.ExceptionMessage = ex.Message;
+                        agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt();
+                        //agvTask.Remark = content.Data.ObjToString();
+                        agvTask.ExceptionMessage = ex.Message;
+                        WriteError(nameof(AGV_PPJob), ex.Message, ex);
                     }
                 }
                 _taskService.UpdateData(newTasks);
             }
             catch (Exception ex)
             {
-                WriteError(nameof(AGV_FLJob), ex.Message, ex);
+                WriteError(nameof(AGV_PPJob), ex.Message, ex);
             }
         }
     }

--
Gitblit v1.9.3