From 8f7e1bf264a5beaca1cf563452bc9ef72dea848f Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 21 五月 2025 08:16:22 +0800
Subject: [PATCH] 修复取消组托,收货数量修改错误问题
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 64 ++++++++++++++++++++++++++++++++
1 files changed, 64 insertions(+), 0 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 a943509..0863d97 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
@@ -60,6 +60,8 @@
private WaveItemService waveItemService;
@Autowired
private WaveService waveService;
+ @Autowired
+ private BasStationService basStationService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -383,6 +385,68 @@
}
}
+ @Override
+ public R removeTask(Long[] ids) {
+ List<Short> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
+ List<Task> tasks = this.list(new LambdaQueryWrapper<Task>().in(Task::getId, ids).in(Task::getTaskStatus, longs));
+ if (tasks.isEmpty()) {
+ throw new CoolException("浠诲姟宸插鎵ц鐘舵�佷笉鍙彇娑堬紒锛�");
+ }
+ for (Task task : tasks) {
+ //鎭㈠缁勬墭鐘舵��
+ WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
+ .eq(WaitPakin::getBarcode, task.getBarcode())
+ );
+ if (null != waitPakin) {
+ waitPakin.setIoStatus(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
+ if (!waitPakinService.updateById(waitPakin)) {
+ 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.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)) {
+ 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>()
+ .eq(BasStation::getStationName, task.getOrgSite())
+ .eq(BasStation::getUseStatus, StaUseStatusType.TYPE_R.type)
+ );
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
+ || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_IN.type)
+ || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
+ || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
+ || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
+ ) {
+ basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+ .eq(BasStation::getStationName, task.getTargLoc())
+ .eq(BasStation::getUseStatus, StaUseStatusType.TYPE_R.type)
+ );
+ }
+ if (null == basStation) {
+ throw new CoolException("绔欑偣鐘舵�侀敊璇紒锛�");
+ }
+ basStation.setUseStatus(StaUseStatusType.TYPE_F.type);
+ if (!basStationService.updateById(basStation)) {
+ throw new CoolException("鏇存柊绔欑偣鐘舵�佸け璐ワ紒锛�");
+ }
+ }
+ }
+ if (!this.removeByIds(Arrays.asList(ids))) {
+ throw new CoolException("Delete Fail");
+ }
+
+ return R.ok("鎿嶄綔鎴愬姛");
+ }
+
/**
* @author Ryan
* @date 2025/5/20
--
Gitblit v1.9.1