From bf44ae2dd15b2b139ce56b1ba1294fdfd220c763 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 25 十二月 2024 17:13:34 +0800
Subject: [PATCH] #问题修复 1. 列表字段空间调整 2. 地址链接放至配置文件中 3. 定时任务执行完成后,状态修改补上 4. 修改状态时,需校验上一步状态是否对应 5. 下发任务完成后,查看是否修改状态为2 7. 任务状态列表,数据显示不全问题修复 8. 波次列表,表格合并问题导致多订单出库问题

---
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java |   65 +++++++++++++++++++++++---------
 1 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
index ca3385f..e36b3d9 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
@@ -1,6 +1,7 @@
 package com.zy.asrs.wms.asrs.timer;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
 import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
 import com.zy.asrs.framework.exception.CoolException;
@@ -8,6 +9,7 @@
 import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
 import com.zy.asrs.wms.asrs.entity.enums.TaskStsType;
 import com.zy.asrs.wms.asrs.service.*;
+import io.jsonwebtoken.lang.Collections;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -15,8 +17,11 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.util.Collection;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Component
@@ -58,9 +63,12 @@
     @Autowired
     private OrderDetlService orderDetlService;
 
+    @Autowired
+    private CacheSiteService cacheSiteService;
 
-    @Scheduled(cron = "0/30 * * * * ? ")
-    @Transactional
+
+    @Scheduled(cron = "0/3 * * * * ? ")
+    @Transactional(rollbackFor = Exception.class)
     public void inExecute() {
         InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
         try {
@@ -100,8 +108,8 @@
         }
     }
 
-//    @Scheduled(cron = "0/3 * * * * ? ")
-    @Transactional
+    @Scheduled(cron = "0/10 * * * * ? ")
+    @Transactional(rollbackFor = Exception.class)
     public void outExecute() {
         InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
         try {
@@ -113,7 +121,7 @@
             for (Task task : list) {
                 //鍚屾鏁版嵁
                 switch (task.getTaskType().intValue()) {
-                    case 101://鍑哄簱
+                    case 101://鍑哄簱xx
                         executeTask101(task);
                         break;
                     case 103://鎷f枡
@@ -122,13 +130,24 @@
                     default:
                         throw new CoolException("鏈煡浠诲姟绫诲瀷");
                 }
-
                 task.setTaskSts(TaskStsType.UPDATED_OUT.id);//200.搴撳瓨鏇存柊瀹屾垚
                 if (!taskService.updateById(task)) {
                     throw new CoolException("搴撳瓨鏇存柊澶辫触");
+                } else {
+                    //CacheSite 閲婃斁宸茶鍗犵敤鐨勯�氶亾
+                    List<TaskDetl> detls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getTaskId, task.getId()));
+                    if (!Collections.isEmpty(detls)) {
+                        List<Long> waveIds = detls.stream().map(TaskDetl::getWaveId).collect(Collectors.toList());
+                        List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getWaveId, waveIds));
+                        List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList());
+                        cacheSiteService.update(new LambdaUpdateWrapper<CacheSite>()
+                                .in(CacheSite::getOrderId, orderIds)
+                                .set(CacheSite::getSiteStatus, 0)
+                                .set(CacheSite::getOrderId, null)
+                                .set(CacheSite::getOrderNo, null));
+                    }
                 }
             }
-
         } catch (Exception e) {
             e.printStackTrace();
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -140,8 +159,9 @@
     //鍏ュ簱
     private void executeTask1(Task task) {
         Long hostId = task.getHostId();
-
-        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
+        //fixme 鏆傛椂鍏抽棴HOSTID
+//        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
+        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()));
         if (loc == null) {
             log.info("搴撲綅涓嶅瓨鍦�" + "=======>" + task.getTargetLoc());
             throw new CoolException("搴撲綅涓嶅瓨鍦�");
@@ -177,9 +197,10 @@
             if (!locDetlService.save(locDetl)) {
                 throw new CoolException("鎻掑叆搴撳瓨鏄庣粏澶辫触");
             }
-
+            //fixme 鏆傛椂鍏抽棴HOSTID,鍚庣画鎵撳紑鏈烘瀯ID
             //娣诲姞搴撳瓨鏄庣粏鎵╁睍瀛楁
-            List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()).eq(TaskDetlField::getHostId, hostId));
+//            List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()).eq(TaskDetlField::getHostId, hostId));
+            List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()));
             for (TaskDetlField detlField : detlFields) {
                 LocDetlField locDetlField = new LocDetlField();
                 locDetlField.setDetlId(locDetl.getId());
@@ -192,9 +213,10 @@
                 }
             }
         }
-
+        //fixme 鏆傛椂鍏抽棴HOSTID,鍚庣画鎵撳紑鏈烘瀯ID
         //缁勬墭閫氱煡妗h浆鍘嗗彶妗�
-        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, task.getBarcode()).eq(WaitPakin::getHostId, hostId));
+//        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, task.getBarcode()).eq(WaitPakin::getHostId, hostId));
+        List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, task.getBarcode()));
         if (waitPakins.isEmpty()) {
             throw new CoolException("缁勬墭閫氱煡妗d笉瀛樺湪");
         }
@@ -295,8 +317,9 @@
     //鎷f枡鍐嶅叆搴�
     private void executeTask53(Task task) {
         Long hostId = task.getHostId();
-
-        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
+        //fixme
+//        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
+        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()));
         if (loc == null) {
             throw new CoolException("搴撲綅涓嶅瓨鍦�");
         }
@@ -338,7 +361,9 @@
             }
 
             //娣诲姞搴撳瓨鏄庣粏鎵╁睍瀛楁
-            List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()).eq(TaskDetlField::getHostId, hostId));
+            //fixme 娉ㄩ噴
+//            List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()).eq(TaskDetlField::getHostId, hostId));
+            List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()));
             for (TaskDetlField detlField : detlFields) {
                 LocDetlField locDetlField = new LocDetlField();
                 locDetlField.setDetlId(locDetl.getId());
@@ -356,7 +381,8 @@
     //鍑哄簱
     private void executeTask101(Task task) {
         Long hostId = task.getHostId();
-        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()).eq(Loc::getHostId, hostId));
+//        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()).eq(Loc::getHostId, hostId));
+        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()));
         if (loc == null) {
             throw new CoolException("搴撲綅涓嶅瓨鍦�");
         }
@@ -391,7 +417,9 @@
     //鎷f枡鍑哄簱
     private void executeTask103(Task task) {
         Long hostId = task.getHostId();
-        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()).eq(Loc::getHostId, hostId));
+        //FIXME 鏆傛椂娉ㄩ噴HOSTID绛涢�夋潯浠�
+//        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()).eq(Loc::getHostId, hostId));
+        Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc()));
         if (loc == null) {
             throw new CoolException("搴撲綅涓嶅瓨鍦�");
         }
@@ -408,6 +436,7 @@
         if (!locService.updateById(loc)) {
             throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐�");
         }
+
         List<LocDetl> detlList = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, loc.getId()).eq(LocDetl::getHostId, hostId));
         //鍒犻櫎搴撳瓨鏄庣粏
         for (LocDetl locDetl : detlList) {

--
Gitblit v1.9.1