From b20fdb26e9d1d091fd7864de1edcc639e9da01b8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 16 十月 2024 15:04:14 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 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 6ac9ad2..9337548 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
@@ -93,7 +93,11 @@
 
     @SuppressWarnings("all")
     @Transactional
-    public void generateBusAndTask(OpenBusSubmitParam busSubmitParam, String memo) {
+    public Bus generateBusAndTask(OpenBusSubmitParam busSubmitParam, String memo) {
+        String errorMsg = busService.checkoutValid(busSubmitParam);
+        if (!Cools.isEmpty(errorMsg)) {
+            throw new BusinessException(errorMsg);
+        }
         String batch = busSubmitParam.getBatch();
         List<TaskDto> taskDtoList = busSubmitParam.getTaskList();
         if (Cools.isEmpty(taskDtoList)) {
@@ -110,7 +114,7 @@
         Date now = new Date();
         Bus bus = new Bus();
         bus.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3));
-        bus.setSeqNum(batch);
+        bus.setBusNo(batch);
         bus.setStartTime(now);
         bus.setBusSts(BusStsType.RECEIVE.val());
         bus.setMemo(memo);
@@ -183,7 +187,7 @@
             }
 
         }
-
+        return bus;
     }
 
     /**
@@ -255,7 +259,7 @@
                 throw new CoolException("generate [task] action fail, cause can not acquire lock ...");
             }
             Date now = new Date();
-            final String sameGroupXy = configService.getVal( "sameGroupXy");
+            final String sameGroupXy = configService.getVal( "sameGroupXy", String.class);
 
             Agv agv = agvService.getById(agvId);
             if (!agvService.judgeEnable(agv.getId(), agvDetail -> agvDetail.getVol() > agv.getChargeLine())) {
@@ -281,8 +285,9 @@
                     return 0;
                 }
             });
-            if (taskList.size() > agv.getStage()) {
-                taskList = taskList.subList(0, agv.getStage());
+            Integer backpack = agvService.getBackpack(agv);
+            if (taskList.size() > backpack) {
+                taskList = taskList.subList(0, backpack);
             }
 
             /**
@@ -349,7 +354,7 @@
 
                 }
 
-                if (backpackLev > agv.getStage()) {
+                if (backpackLev > backpack) {
                     throw new BusinessException("瑙f瀽Task澶辫触,AGV鑳岀瘬宸叉弧......");
                 }
 
@@ -590,7 +595,7 @@
         try {
             if (Cools.isEmpty(agvId, segmentList)) { return; }
             Date now = new Date();
-            JSONObject storeDirection = JSON.parseObject(configService.getVal("storeDirection"));
+            JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class);
             Agv agv = agvService.getById(agvId);
             if (!agvService.judgeEnable(agv.getId())) {
                 throw new CoolException("AGV[" + agv.getUuid() + "]褰撳墠涓嶅彲鐢�...");
@@ -994,6 +999,7 @@
             }
             for (Action action : actionList) {
                 action.setActionSts(ActionStsType.ISSUED.val());
+                action.setStartTime(now);
                 action.setUpdateTime(now);
                 if (!actionService.updateById(action)) {
                     throw new BusinessException(action.getPriority() + " - " + action.getName() + "鍔ㄤ綔鏇存柊澶辫触");
@@ -1143,6 +1149,7 @@
 
                             if (null != action) {
                                 action.setActionSts(ActionStsType.FINISH.val());
+                                action.setEndTime(now);
                                 action.setUpdateTime(now);
                                 if (!actionService.updateById(action)) {
                                     log.error("Action [{}] 鏇存柊澶辫触 锛侊紒锛�", action.getPriority() + " - " + action.getName());
@@ -1175,6 +1182,7 @@
                             );
                             if (null != action) {
                                 action.setActionSts(ActionStsType.FINISH.val());
+                                action.setEndTime(now);
                                 action.setUpdateTime(now);
                                 if (!actionService.updateById(action)) {
                                     log.error("Action [{}] 鏇存柊澶辫触 锛侊紒锛�", action.getPriority() + " - " + action.getName());
@@ -1249,6 +1257,7 @@
                 );
                 for (Action action : actionList) {
                     action.setActionSts(ActionStsType.FINISH.val());
+                    action.setEndTime(now);
                     action.setUpdateTime(now);
                     if (!actionService.updateById(action)) {
                         log.error("Action [{}] 鏇存柊澶辫触 锛侊紒锛�", action.getPriority() + " - " + action.getName());

--
Gitblit v1.9.1