From 44ea5356e5e498ac47fccb25321122ab81412b86 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 26 六月 2025 16:19:27 +0800
Subject: [PATCH] 取消任务档功能优化

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 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 8b0bba2..f0e2747 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
@@ -729,7 +729,8 @@
                 TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
         List<Task> tasks = this.list(new LambdaQueryWrapper<Task>()
                 .in(Task::getTaskType, list)
-                .in(Task::getId, ids).in(Task::getTaskStatus, longs));
+                .in(Task::getId, ids)
+                .in(Task::getTaskStatus, longs));
         if (tasks.isEmpty()) {
             throw new CoolException("浠诲姟宸插鎵ц鐘舵�佷笉鍙彇娑堬紒锛�");
         }
@@ -760,6 +761,7 @@
                         throw new CoolException("浠诲姟淇℃伅淇敼澶辫触锛侊紒");
                     }
                 }
+
             }
 
             if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) {
@@ -767,8 +769,7 @@
                 if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
                     basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                             .eq(BasStation::getStationName, task.getOrgSite())
-                            .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)
-                    );
+                            .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type));
                 } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
                         || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
                         || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
@@ -795,17 +796,36 @@
                         if (Objects.isNull(loc)) {
                             throw new CoolException("鏁版嵁閿欒锛氬簱浣嶄俊鎭笉瀛樺湪锛侊紒");
                         }
-
                         loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type).setBarcode(task.getBarcode()).setUpdateBy(loginUserId).setUpdateTime(new Date());
                         if (!locService.updateById(loc)) {
                             throw new CoolException("搴撲綅淇℃伅淇敼澶辫触锛侊紒");
                         }
-
                         //鍑哄簱
                         if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))) {
                             //搴撳瓨鍑哄簱
+                        } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val)) {
+                            WaveItem waveItem = waveItemService.getById(item.getSource());
+                            if (Objects.isNull(waveItem)) {
+                                throw new CoolException("娉㈡鏄庣粏涓嶅瓨鍦紒锛�");
+                            }
+                            Double workQty = Math.round((waveItem.getWorkQty() - item.getAnfme()) * 10000) / 10000.0;
+                            waveItem.setWorkQty(workQty).setExceStatus(WaveItemExceStatus.WAVE_ITEM_EXCE_STATUS_UN.val);
+                            if (!waveItemService.updateById(waveItem)) {
+                                throw new CoolException("娉㈡鏄庣粏鏇存柊澶辫触锛侊紒");
+                            }
+
+                            Wave wave = waveService.getOne(new LambdaQueryWrapper<Wave>().eq(Wave::getId, waveItem.getWaveId()));
+                            if (Objects.isNull(wave)) {
+                                throw new CoolException("娉㈡淇℃伅涓嶅瓨鍦紒锛�");
+                            }
+                            wave.setExceStatus(WaveExceStatus.WAVE_EXCE_STATUS_INIT.val).setWorkQty(0.0).setQty(0.0);
+                            if (!waveService.updateById(wave)) {
+                                throw new CoolException("娉㈡鏇存柊澶辫触锛侊紒");
+                            }
+
                         } else if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER.type))) {
                             //鍏跺畠鍑哄簱
+
                         } else {
                             //鍑哄簱鍗曞嚭搴�
                             AsnOrder asnOrder = outStockService.getById(item.getSourceId());

--
Gitblit v1.9.1