From d95047d4d0e212896d1a1ed1f4528b46553d4e09 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期二, 12 八月 2025 15:28:34 +0800
Subject: [PATCH] 保存一个版本

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java |    8 +++++---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java        |   18 ++++++++++--------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
index afc92d9..2eb63f7 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -132,6 +132,8 @@
         if (!busService.save(bus)) {
             throw new BusinessException("Internal Server Error!");
         }
+        Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, false);
+
 
         // 淇濆瓨浠诲姟
         for (Task task : taskList) {
@@ -149,7 +151,7 @@
             switch (TaskTypeType.get(task.getTaskTypeEl())) {
                 case LOC_TO_LOC:
                     oriLoc = locService.getById(task.getOriLoc());
-                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+                    if (locStaStatusCheck && !oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                         throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
                     }
                     oriLoc.setLocSts(LocStsType.PAKOUT.val());
@@ -159,7 +161,7 @@
                     }
 
                     destLoc = locService.getById(task.getDestLoc());
-                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+                    if (locStaStatusCheck && !destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                         throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
                     }
                     destLoc.setLocSts(LocStsType.PAKIN.val());
@@ -170,7 +172,7 @@
                     break;
                 case LOC_TO_STA:
                     oriLoc = locService.getById(task.getOriLoc());
-                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+                    if (locStaStatusCheck && !oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
                         throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
                     }
                     oriLoc.setLocSts(LocStsType.PAKOUT.val());
@@ -180,7 +182,7 @@
                     }
 
                     destSta = staService.getById(task.getDestSta());
-                    if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
+                    if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                         throw new BusinessException("destSta锛�" + task.getDestSta$() + " is not in IDLE status");
                     }
                     destSta.setStaSts(StaStsType.READY_RELEASE.val());
@@ -191,7 +193,7 @@
                     break;
                 case STA_TO_LOC:
                     oriSta = staService.getById(task.getOriSta());
-                    if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
+                    if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                         throw new BusinessException("oriSta锛�" + task.getOriSta$() + " is not in STOCK status");
                     }
                     oriSta.setStaSts(StaStsType.READY_TAKE.val());
@@ -201,7 +203,7 @@
                     }
 
                     destLoc = locService.getById(task.getDestLoc());
-                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+                    if (locStaStatusCheck && !destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
                         throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
                     }
                     destLoc.setLocSts(LocStsType.PAKIN.val());
@@ -212,7 +214,7 @@
                     break;
                 case STA_TO_STA:
                     oriSta = staService.getById(task.getOriSta());
-                    if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
+                    if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                         throw new BusinessException("oriSta锛�" + task.getOriSta$() + " is not in STOCK status");
                     }
                     oriSta.setStaSts(StaStsType.READY_TAKE.val());
@@ -222,7 +224,7 @@
                     }
 
                     destSta = staService.getById(task.getDestSta());
-                    if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
+                    if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                         throw new BusinessException("destSta锛�" + task.getDestSta$() + " is not in IDLE status");
                     }
                     destSta.setStaSts(StaStsType.READY_RELEASE.val());
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java
index c394e79..e4055e2 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/third/ReportThirdScheduler.java
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.zy.acs.framework.common.Cools;
 import com.zy.acs.manager.core.utils.HttpHandler;
 import com.zy.acs.manager.manager.entity.TaskReport;
 import com.zy.acs.manager.manager.entity.TaskReportLog;
@@ -34,7 +35,7 @@
     private ConfigService configService;
 
 
-    @Scheduled(fixedDelay = 1000)
+    @Scheduled(fixedDelay = 3000)
     public void execute() {
         Boolean report = configService.getVal("REPORT", Boolean.class, false);
         if (report) {
@@ -43,14 +44,14 @@
             Integer times = configService.getVal("REPORT_TIMES", Integer.class, 3);
             List<TaskReport> list = taskReportService.list();
             for (TaskReport taskReport : list) {
-                if (taskReport.getReportTimes() > times) {
+                if ((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) > times) {
                     toLog(taskReport);
                     continue;
                 }
                 if (report(taskReport, wmsUrl, wmsPath)) {
                     toLog(taskReport);
                 } else {
-                    taskReport.setReportTimes(taskReport.getReportTimes() + 1);
+                    taskReport.setReportTimes((Cools.isEmpty(taskReport.getReportTimes()) ? 0 : taskReport.getReportTimes()) + 1);
                     taskReport.setUpdateTime(new Date());
                     taskReportService.updateById(taskReport);
                 }
@@ -68,6 +69,7 @@
                     .setJson(JSON.toJSONString(taskReport))
                     .build()
                     .doPost();
+            log.info("杩斿洖鍙傛暟锛歿}", response);
             JSONObject jsonObject = JSON.parseObject(response);
             if (jsonObject.getInteger("code").equals(200)) {
                 return true;

--
Gitblit v1.9.1