From c19cf2f4c2419e403294ebdc025fe90ff7dee74c Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期四, 13 三月 2025 14:28:48 +0800
Subject: [PATCH] 配置信息

---
 src/main/java/com/zy/asrs/task/TaskLogScheduler.java |   63 ++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/TaskLogScheduler.java b/src/main/java/com/zy/asrs/task/TaskLogScheduler.java
index d547639..8ea8636 100644
--- a/src/main/java/com/zy/asrs/task/TaskLogScheduler.java
+++ b/src/main/java/com/zy/asrs/task/TaskLogScheduler.java
@@ -1,18 +1,20 @@
 package com.zy.asrs.task;
 
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.zy.asrs.entity.CommandInfo;
+import com.core.exception.CoolException;
 import com.zy.asrs.entity.TaskWrk;
-import com.zy.asrs.entity.WaitPakin;
-import com.zy.asrs.entity.param.TaskStatusFeedbackParam;
-import com.zy.asrs.service.CommandInfoService;
+import com.zy.asrs.entity.TaskWrkLog;
+import com.zy.asrs.entity.TaskWrkReport;
+import com.zy.asrs.service.TaskWrkReportService;
 import com.zy.asrs.service.TaskWrkService;
-import com.zy.asrs.utils.PostMesDataUtils;
+import com.zy.asrs.service.impl.TaskWrkLogServiceImpl;
+import com.zy.common.utils.Synchro;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+
+import java.io.IOException;
 
 /**
  * 瀹氭椂灏嗕换鍔�(瀹屾垚銆佸彇娑�)杞垚鏃ュ織
@@ -23,34 +25,43 @@
 
     @Autowired
     private TaskWrkService taskWrkService;
+
     @Autowired
-    private CommandInfoService commandInfoService;
+    private TaskWrkLogServiceImpl wrkLogService;
+
+
+    @Autowired
+    private TaskWrkReportService taskWrkReportService;
 
     @Value("${wms.url}")
     private String wmsUrl;
-    @Value("${wms.movePath}")
-    private String movePath;
+
+    @Value("${wms.TaskExecCallback}")
+    private String TaskExecCallback;
+
 
     @Scheduled(cron = "0/3 * * * * ? ")
-    public void execute() {
+    public void execute() throws IOException {
+
         for (TaskWrk taskWrk : taskWrkService.selectToBeHistoryData()) {
-            TaskStatusFeedbackParam taskStatusFeedbackParam = new TaskStatusFeedbackParam(taskWrk);
-            if (taskWrk.getStatus()==3){
-                taskStatusFeedbackParam.setTaskStatus("done");
-                new PostMesDataUtils().postMesData("瀹屾垚涓婃姤",wmsUrl,movePath,taskWrk);
-            }else {
-                taskStatusFeedbackParam.setTaskStatus("cancelled");
-                new PostMesDataUtils().postMesData("鍙栨秷浠诲姟瀹屾垚",wmsUrl,movePath,taskWrk);
-
+            switch (taskWrk.getStatus()) {
+                case 4:
+                    break;
+                case 5:
+                    break;
             }
-            if (taskWrkService.saveToHistory(taskWrk.getTaskNo()) > 0) {
-                //浠诲姟宸茬粡杞棩蹇楋紝灏嗚浠诲姟涓嬮潰鐨勬寚浠よ浆鏃ュ織
-                commandInfoService.saveToHistory(taskWrk.getTaskNo());
-
-                //鍒犻櫎浠诲姟
-                taskWrkService.delete(new EntityWrapper<TaskWrk>().eq("task_no", taskWrk.getTaskNo()));
-                //鍒犻櫎鎸囦护
-                commandInfoService.delete(new EntityWrapper<CommandInfo>().eq("task_no", taskWrk.getTaskNo()));
+            TaskWrkReport taskWrkReport = new TaskWrkReport();
+            TaskWrkLog taskWrkLog = new TaskWrkLog();
+            Synchro.Copy(taskWrk, taskWrkReport);
+            Synchro.Copy(taskWrk, taskWrkLog);
+            if (!taskWrkReportService.insert(taskWrkReport)) {
+                throw new CoolException("杞Щ鑷充笂鎶ヨ〃" + taskWrk);
+            }
+            if (!wrkLogService.insert(taskWrkLog)) {
+                throw new CoolException("杞巻鍙叉。澶辫触" + taskWrk);
+            }
+            if (!taskWrkService.deleteById(taskWrk)) {
+                throw new CoolException("浠诲姟妗e垹闄ゅけ璐�" + taskWrk);
             }
         }
     }

--
Gitblit v1.9.1