1
11 小时以前 c620f4cbc6f5ed50758ea548855773bfed2dcd39
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
@@ -264,6 +264,27 @@
            throw new CoolException("任务明细更新失败");
        }
        //判断任务明细是否全部完成
        List<TaskItem> allTaskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>()
                .eq(TaskItem::getTaskId, task.getId()));
        if (Cools.isEmpty(allTaskItems)) {
            throw new CoolException("未找到任务明细");
        }
        boolean allTaskItemsFinished = allTaskItems.stream().allMatch(item -> {
            BigDecimal workQty = BigDecimal.valueOf(Objects.isNull(item.getWorkQty()) ? 0D : item.getWorkQty());
            BigDecimal qty = BigDecimal.valueOf(Objects.isNull(item.getQty()) ? 0D : item.getQty());
            return workQty.compareTo(qty) == 0;
        });
        if (allTaskItemsFinished) {
            task.setTaskStatus(TaskStsType.COMPLETE_OUT.id)
                    .setUpdateBy(userId)
                    .setUpdateTime(new Date());
            if (!taskService.updateById(task)) {
                throw new CoolException("任务状态更新失败");
            }
        }
        return R.ok();
    }
@@ -272,7 +293,10 @@
        if (Cools.isEmpty(param.getContainerNo())) {
            throw new CoolException("无容器号");
        }
        Task task = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, param.getContainerNo()));
        Task task = taskService.getOne(new LambdaQueryWrapper<Task>()
                .eq(Task::getBarcode, param.getContainerNo())
                .eq(Task::getTaskStatus, TaskStsType.AWAIT.id)
        );
        if (null == task) {
            throw new CoolException("未找到任务");
        }