skyouc
4 天以前 48b875f66aa0b9346b698e600f03361e972028e8
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java
@@ -120,8 +120,8 @@
        try {
            generateOutTask(items, loginUserId, waves);
        } catch (Exception e) {
            log.error(e.getMessage());
            throw new CoolException("出库任务生成失败!!!");
            log.error("UNK", e);
            throw new CoolException(e.getMessage());
        }
        return null;
    }
@@ -142,16 +142,19 @@
        for (WaveItem param : itemParams) {
            String locs = param.getStockLocs();
            List<LocItem> locItems = JSONArray.parseArray(locs, LocItem.class);
            if (locItems.isEmpty()) {
                continue;
            List<Long> list = new ArrayList<>();
            if (Objects.isNull(locItems) || locItems.isEmpty()) {
                //TODO
            } else {
                list = locItems.stream().map(LocItem::getLocId).collect(Collectors.toList());
            }
            List<Long> list = locItems.stream().map(LocItem::getLocId).collect(Collectors.toList());
            /**根据供应商批次,物料码, 动态字段查询指定的物料库存信息*/
            //TODO 这里需要要根据波次规则查找库存信息
            List<LocItem> items = locItemService.list(new LambdaQueryWrapper<LocItem>()
                    .eq(LocItem::getSplrBatch, param.getSplrBatch())
                    .in(LocItem::getLocId, list)
                    .eq(StringUtils.isNotBlank(param.getFieldsIndex()), LocItem::getFieldsIndex, param.getFieldsIndex())
                    .eq(LocItem::getBatch, param.getSplrBatch())
                    .in(!list.isEmpty(),  LocItem::getLocId, list)
//                    .eq(StringUtils.isNotBlank(param.getFieldsIndex()), LocItem::getFieldsIndex, param.getFieldsIndex())
                    .eq(LocItem::getMatnrCode, param.getMatnrCode()));
            if (items.isEmpty()) {
                throw new CoolException("库存信息有变,请取消当前波次,生新生成新的波次!!");
@@ -190,10 +193,10 @@
                throw new CoolException("库位不存在!!");
            }
            List<TaskItem> items = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getSourceId, wave.getId()));
            if (items.isEmpty()) {
                throw new CoolException("波次任务已生成,不能重复生成!!");
            }
//            List<TaskItem> items = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getSourceId, wave.getId()));
//            if (!items.isEmpty()) {
//                throw new CoolException("波次任务已生成,不能重复生成!!");
//            }
            task.setTaskCode(ruleCode)
                    .setTaskType(TaskType.TASK_TYPE_OUT.type)
@@ -214,7 +217,7 @@
                TaskItem taskItem = new TaskItem();
                BeanUtils.copyProperties(item, taskItem);
                taskItem.setTaskId(task.getId())
                        .setAnfme(waveItem.getAnfme())
                        .setAnfme(item.getAnfme())
                        .setId(null)
                        .setSourceCode(wave.getCode())
                        .setSourceId(wave.getId())
@@ -229,7 +232,7 @@
            taskItems.forEach(item -> {
                boolean update = waveItemService.update(new LambdaUpdateWrapper<WaveItem>()
                        .eq(WaveItem::getId, item.getSource())
                                .set(WaveItem::getExceStatus, AsnExceStatus)
                                .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_SEED.val)
                        .set(WaveItem::getWorkQty, item.getAnfme()));
                if (!update) {
                    throw new CoolException("波次执行数量修改失败!!");