From 3210698902c4e0f3e6f1433d24e62923fbfa794d Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 28 五月 2025 12:59:42 +0800
Subject: [PATCH] 组托IO类型优化

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index 2e3cd67..9c2cab2 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -82,10 +82,9 @@
             throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
         }
         /**鑾峰彇缁勬嫋*/
-//        List<Long> ids = pakins.stream().map(WaitPakin::getId).collect(Collectors.toList());
         List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
                 .in(WaitPakin::getId, pakins.getId())
-                .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)));
+                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
         if (waitPakins.isEmpty()) {
             throw new CoolException("璇锋鏌ョ粍鎵樼姸鎬佹槸鍚﹀畬鎴愶紒锛�");
         }
@@ -105,7 +104,7 @@
             task.setTaskCode(ruleCode)
                     .setTaskStatus(TaskStsType.GENERATE_IN.id)
                     .setTaskType(TaskType.TASK_TYPE_IN.type)
-                    .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.id)
+                    .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val)
                     .setTargLoc(targetLoc)
                     .setOrgSite(orgSta)
                     .setBarcode(pakin.getBarcode())
@@ -170,7 +169,7 @@
         /**鑾峰彇缁勬嫋*/
         List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
                 .in(WaitPakin::getId, pakins.getId())
-                .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)));
+                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
         if (waitPakins.isEmpty()) {
             throw new CoolException("璇锋鏌ョ粍鎵樼姸鎬佹槸鍚﹀畬鎴愶紒锛�");
         }
@@ -190,7 +189,7 @@
             task.setTaskCode(ruleCode)
                     .setTaskStatus(TaskStsType.COMPLETE_IN.id)
                     .setTaskType(TaskType.TASK_TYPE_IN.type)
-                    .setWarehType(WarehType.WAREHOUSE_TYPE_PLAT.id)
+                    .setWarehType(WarehType.WAREHOUSE_TYPE_PLAT.val)
                     .setTargLoc(targetLoc)
                     .setBarcode(pakin.getBarcode())
                     .setCreateBy(loginUserId)
@@ -277,7 +276,7 @@
         List<Long> ids = waitPakin.getWaitPakins().stream().map(WaitPakin::getId).collect(Collectors.toList());
         List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
                 .in(WaitPakin::getId, ids)
-                .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val)));
+                .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
         if (waitPakins.isEmpty()) {
             throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
         }
@@ -583,17 +582,15 @@
                     throw new CoolException("鏇存柊缁勬墭鐘舵�佸け璐ワ紒锛�");
                 }
             }
-            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc()));
-            if (null != loc
-                    && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)
-                    || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) {
 
+            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc()));
+            if (null != loc && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) {
                 loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type);
                 if (!locService.updateById(loc)) {
                     throw new CoolException("鏇存柊搴撲綅鐘舵�佸け璐ワ紒锛�");
                 }
             }
-            if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.id)) {
+            if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) {
                 BasStation basStation = null;
                 if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
                     basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
@@ -608,8 +605,7 @@
                 ) {
                     basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                             .eq(BasStation::getStationName, task.getTargLoc())
-                            .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)
-                    );
+                            .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type));
                 }
                 if (null == basStation) {
                     throw new CoolException("绔欑偣鐘舵�侀敊璇紒锛�");
@@ -619,6 +615,10 @@
                     throw new CoolException("鏇存柊绔欑偣鐘舵�佸け璐ワ紒锛�");
                 }
             }
+
+            if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) {
+                throw new CoolException("浠诲姟鏄庣粏鍒犻櫎澶辫触锛侊紒");
+            }
         }
         if (!this.removeByIds(Arrays.asList(ids))) {
             throw new CoolException("Delete Fail");

--
Gitblit v1.9.1