From 89255f6e9692026ffe4ce20bf4454c963a35ad69 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 26 五月 2025 12:56:30 +0800 Subject: [PATCH] 移库任务优化 --- rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 44 +++++++++++++++++++++++--------------------- 1 files changed, 23 insertions(+), 21 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 ff45705..42555f0 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 @@ -414,7 +414,7 @@ Loc orgLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc())); if (Objects.isNull(orgLoc)) { - throw new CoolException("鐩爣搴撲綅涓嶅瓨鍦紒"); + throw new CoolException("婧愬簱浣嶄笉瀛樺湪锛�"); } if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)) { @@ -444,12 +444,21 @@ // throw new CoolException(e.getMessage()); // } /**淇敼搴撲綅鐘舵�佷负F.鍦ㄥ簱*/ - if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).eq(Loc::getCode, task.getTargLoc()))) { + if (!locService.update(new LambdaUpdateWrapper<Loc>() + .set(Loc::getBarcode, task.getBarcode()) + .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) + .eq(Loc::getCode, task.getTargLoc()))) { throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�"); } - if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).eq(Loc::getCode, task.getOrgLoc()))) { + if (!locService.update(new LambdaUpdateWrapper<Loc>() + .set(Loc::getBarcode, null) + .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).eq(Loc::getCode, task.getOrgLoc()))) { throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�"); + } + + if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { + throw new CoolException("婧愬簱浣嶆槑缁嗗垹闄ゅけ璐ワ紒"); } if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { @@ -524,18 +533,10 @@ throw new CoolException("鏁版嵁閿欒锛屼綔涓氫腑搴撳瓨鏁版嵁涓㈠け锛侊紒"); } if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { - locWorking.setWorkQty(0.0); locWorking.setAnfme(taskItem.getAnfme()); - } else { - if (locWorking.getAnfme().compareTo(taskItem.getAnfme()) >= 0) { - locWorking.setWorkQty(0.0); - locWorking.setAnfme(Math.round((locWorking.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0); - } else { - continue; - } } BeanUtils.copyProperties(locWorking, locItem); - locItem.setLocCode(loc.getCode()).setLocId(loc.getId()).setId(null); + locItem.setWorkQty(0.0).setLocCode(loc.getCode()).setLocId(loc.getId()).setId(null); items.add(locItem); } @@ -547,13 +548,11 @@ //淇濆瓨鍏ュ嚭搴撴祦姘� saveStockItems(taskItems, task, null, null, taskItem.getWkType(), taskItem.getOrderType()); - if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { throw new CoolException("浣滀笟涓簱瀛樺垹闄ゅけ璐ワ紒锛�"); } - task.setTaskStatus(TaskStsType.UPDATED_IN.id); - + task.setTaskStatus(TaskStsType.UPDATED_IN.id).setUpdateTime(null); if (!taskService.updateById(task)) { throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�"); } @@ -569,7 +568,10 @@ @Override public R removeTask(Long[] ids) { List<Integer> 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)); + List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, 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)); if (tasks.isEmpty()) { throw new CoolException("浠诲姟宸插鎵ц鐘舵�佷笉鍙彇娑堬紒锛�"); } @@ -831,9 +833,9 @@ } //鍏ㄦ澘鍑哄簱锛屽垹闄や复鏃跺簱瀛� - if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { - throw new CoolException("涓存椂搴撳瓨娓呴櫎澶辫触锛侊紒"); - } + if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { + throw new CoolException("涓存椂搴撳瓨娓呴櫎澶辫触锛侊紒"); + } } @@ -938,7 +940,7 @@ List<TaskItem> items = orderMap.get(key); try { //淇濆瓨搴撳瓨鏄庣粏 - saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType()); + saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType()); //绉诲嚭鏀惰揣鍖哄簱瀛橈紝 淇敼缁勬墭鐘舵�� removeReceiptStock(pakinItem); } catch (Exception e) { @@ -1045,7 +1047,7 @@ task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type) || - task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) ) { + task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { stock.setLocCode(task.getTargLoc()); } else { stock.setLocCode(task.getOrgLoc()); -- Gitblit v1.9.1