From a4a7479ffbee57c642387baeca5783b943bb1af3 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期五, 26 十二月 2025 15:00:31 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java |   39 ++++++++-------------------------------
 1 files changed, 8 insertions(+), 31 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 9e7f54a..554082d 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
@@ -177,29 +177,15 @@
                         throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
                     }
 
-                    // reserver station inbound, qty: 1
                     destSta = staService.getById(task.getDestSta());
                     if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
                         throw new BusinessException("destSta锛�" + task.getDestSta$() + " failed to reserve");
                     }
-//                    if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
-//                        throw new BusinessException("destSta锛�" + task.getDestSta$() + " is not in IDLE status");
-//                    }
-//                    destSta.setStaSts(StaStsType.READY_RELEASE.val());
-//                    destSta.setUpdateTime(now);
-//                    if (!staService.updateById(destSta)) {
-//                        throw new BusinessException("destSta锛�" + task.getDestSta$() + " failed to update");
-//                    }
                     break;
                 case STA_TO_LOC:
                     oriSta = staService.getById(task.getOriSta());
-                    if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
-                        throw new BusinessException("oriSta锛�" + task.getOriSta$() + " is not in STOCK status");
-                    }
-                    oriSta.setStaSts(StaStsType.READY_TAKE.val());
-                    oriSta.setUpdateTime(now);
-                    if (!staService.updateById(oriSta)) {
-                        throw new BusinessException("oriSta锛�" + task.getOriSta$() + " failed to update");
+                    if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
+                        throw new BusinessException("oriSta锛�" + task.getOriSta$() + " failed to reserve");
                     }
 
                     destLoc = locService.getById(task.getDestLoc());
@@ -214,23 +200,13 @@
                     break;
                 case STA_TO_STA:
                     oriSta = staService.getById(task.getOriSta());
-                    if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
-                        throw new BusinessException("oriSta锛�" + task.getOriSta$() + " is not in STOCK status");
-                    }
-                    oriSta.setStaSts(StaStsType.READY_TAKE.val());
-                    oriSta.setUpdateTime(now);
-                    if (!staService.updateById(oriSta)) {
-                        throw new BusinessException("oriSta锛�" + task.getOriSta$() + " failed to update");
+                    if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
+                        throw new BusinessException("oriSta锛�" + task.getOriSta$() + " failed to reserve");
                     }
 
                     destSta = staService.getById(task.getDestSta());
-                    if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
-                        throw new BusinessException("destSta锛�" + task.getDestSta$() + " is not in IDLE status");
-                    }
-                    destSta.setStaSts(StaStsType.READY_RELEASE.val());
-                    destSta.setUpdateTime(now);
-                    if (!staService.updateById(destSta)) {
-                        throw new BusinessException("destSta锛�" + task.getDestSta$() + " failed to update");
+                    if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
+                        throw new BusinessException("destSta锛�" + task.getDestSta$() + " failed to reserve");
                     }
                     break;
                 default:
@@ -1530,7 +1506,7 @@
             }
 
             if (taskComplete) {
-                locService.taskCallBack(task);
+//                locService.taskCallBack(task);
 
                 task.setTaskSts(TaskStsType.COMPLETE.val());
                 task.setEndTime(now);
@@ -1538,6 +1514,7 @@
                 if (!taskService.updateById(task)) {
                     log.error("Task [{}] 鏇存柊澶辫触 锛侊紒锛�", task.getSeqNum());
                 } else {
+                    taskService.maintainLocAndSta(task);
                     log.info("Task [{}] 浣滀笟瀹屾瘯 ==========>> ", task.getSeqNum());
                 }
 

--
Gitblit v1.9.1