skyouc
2 天以前 d36f413965c4ef2ea35a7e0ecefd32001a1e66f8
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -1017,17 +1017,18 @@
                .setBarcode(task.getBarcode())
                .setTaskStatus(TaskStsType.GENERATE_IN.id);
        TaskInParam param = new TaskInParam();
        param.setSourceStaNo(task.getTargSite())
                .setIoType(type)
                .setLocType1(Integer.parseInt(loc.getType()));
//        TaskInParam param = new TaskInParam();
//        param.setSourceStaNo(task.getTargSite())
//                .setIoType(type)
//                .setLocType1(Integer.parseInt(loc.getType()));
        //获取新库位
        InTaskMsgDto locInfo = wcsService.getLocNo(param);
//        InTaskMsgDto locInfo = wcsService.getLocNo(param);
        if (Objects.isNull(locInfo)) {
            throw new CoolException("获取库位失败!!");
        }
        task.setTargLoc(locInfo.getLocNo())
//        if (Objects.isNull(locInfo)) {
//            throw new CoolException("获取库位失败!!");
//        }
        //希日上报物有情况,不需要获取新库位
        task.setTargLoc(task.getOrgLoc())
                .setOrgSite(task.getTargSite());
        if (!this.updateById(task)) {
@@ -1096,26 +1097,25 @@
        List<LocItemWorking> workings = new ArrayList<>();
        List<TaskItem> items = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
        items.forEach(taskItem -> {
            if (taskItem.getAnfme() > 0) {
                LocItemWorking itemWorking = new LocItemWorking();
                BeanUtils.copyProperties(taskItem, itemWorking);
                itemWorking.setTaskId(task.getId())
                        .setQty(0.0)
                        .setLocId(loc1.getId())
                        .setLocCode(loc1.getCode());
                workings.add(itemWorking);
            }
            LocItemWorking itemWorking = new LocItemWorking();
            BeanUtils.copyProperties(taskItem, itemWorking);
            itemWorking.setTaskId(task.getId())
                    .setQty(0.0)
                    .setLocId(loc1.getId())
                    .setLocCode(loc1.getCode());
            workings.add(itemWorking);
        });
        if (!locItemWorkingService.saveBatch(workings)) {
            throw new CoolException("临时库存更新失败!!");
        if (!workings.isEmpty()) {
            if (!locItemWorkingService.saveBatch(workings)) {
                throw new CoolException("临时库存更新失败!!");
            }
        }
        loc1.setUseStatus(LocStsType.LOC_STS_TYPE_S.type);
        if (!locService.updateById(loc1)) {
            throw new CoolException("库位预约入库失败!!");
        }
        locService.updateById(loc1);
//        if (!locService.updateById(loc1)) {
//            throw new CoolException("库位预约入库失败!!");
//        }
        return task;
    }
@@ -1127,7 +1127,7 @@
     */
    @Synchronized
    @Transactional(rollbackFor = Exception.class)
    public void complateOutStock(Task task, Long loginUserId) throws Exception {
    public void complateOutStock(Task task, Long loginUserId) {
        if (Objects.isNull(task)) {
            throw new CoolException("参数不能为空!!");
        }
@@ -1224,15 +1224,26 @@
                throw new CoolException(e.getMessage());
            }
        }
        /**修改为库位状态为O.空库*/
        if (!locService.update(new LambdaUpdateWrapper<Loc>()
                .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                .set(Loc::getBarcode, null)
                .set(Loc::getUpdateBy, loginUserId)
                .set(Loc::getUpdateTime, new Date())
                .eq(Loc::getId, loc.getId()))) {
            throw new CoolException("库位状态修改失败!!");
        if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) {
            /**修改为库位状态为S.预约入库,保留原有库位*/
            if (!locService.update(new LambdaUpdateWrapper<Loc>()
                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type)
                    .set(Loc::getBarcode, null)
                    .set(Loc::getUpdateBy, loginUserId)
                    .set(Loc::getUpdateTime, new Date())
                    .eq(Loc::getId, loc.getId()))) {
                throw new CoolException("库位状态修改失败!!");
            }
        } else {
            /**修改为库位状态为O.空库*/
            if (!locService.update(new LambdaUpdateWrapper<Loc>()
                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
                    .set(Loc::getBarcode, null)
                    .set(Loc::getUpdateBy, loginUserId)
                    .set(Loc::getUpdateTime, new Date())
                    .eq(Loc::getId, loc.getId()))) {
                throw new CoolException("库位状态修改失败!!");
            }
        }
        if (!this.update(new LambdaUpdateWrapper<Task>()