#
Junjie
2024-05-22 5989655fcf8c34f9091b1d328f8950dad8267725
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/WorkServiceImpl.java
@@ -94,6 +94,7 @@
        wrkMast.setModiUser(String.valueOf(userId));
        wrkMast.setModiTime(now);
        wrkMast.setHostId(hostId);
        wrkMast.setCrnNo(dto.getCrnNo());
        if (!wrkMastService.save(wrkMast)) {
            throw new CoolException("保存工作档失败");
        }
@@ -139,6 +140,64 @@
            locMast.setLocSts("S"); // S.入库预约
            locMast.setModiUser(userId);
            locMast.setModiTime(now);
            if (!locMastService.updateById(locMast)){
                throw new CoolException("改变库位状态失败");
            }
        } else {
            throw new CoolException(dto.getLocNo()+"目标库位已被占用");
        }
        return dto.getLocNo();
    }
    @Override
    public String emptyPlateIn(Integer devpNo, Long userId, Long hostId) {
        // 源站点状态检测
        BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true, hostId);
        // 检索库位
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        StartupDto dto = commonService.getLocNo(10, devpNo, null, null, hostId, locTypeDto, 0);
        int workNo = dto.getWorkNo();
        // 生成工作档
        WrkMast wrkMast = new WrkMast();
        wrkMast.setWrkNo(workNo);
        wrkMast.setIoTime(new Date());
        wrkMast.setWrkSts(1L); // 工作状态:生成入库ID
        wrkMast.setIoType(10); // 入出库状态:10.空板入库
        wrkMast.setIoPri(13D); // 优先级:13
        wrkMast.setCrnNo(dto.getCrnNo());
        wrkMast.setSourceStaNo(dto.getSourceStaNo());
        wrkMast.setStaNo(dto.getStaNo());
        wrkMast.setLocNo(dto.getLocNo());
        wrkMast.setFullPlt("N"); // 满板
        wrkMast.setPicking("N"); // 拣料
        wrkMast.setExitMk("N"); // 退出
        wrkMast.setEmptyMk("Y"); // 空板
        wrkMast.setCtnType(sourceStaNo.getCtnType()); // 容器类型
        // 操作人员数据
        wrkMast.setAppeUser(String.valueOf(userId));
        wrkMast.setAppeTime(new Date());
        wrkMast.setModiUser(String.valueOf(userId));
        wrkMast.setModiTime(new Date());
        wrkMast.setHostId(hostId);
        boolean res = wrkMastService.save(wrkMast);
        if (!res) {
            throw new CoolException("保存工作档失败");
        }
        // 更新源站点信息
        sourceStaNo.setWrkNo(workNo);
        sourceStaNo.setModiUser(userId);
        sourceStaNo.setModiTime(new Date());
        if (!basDevpService.updateById(sourceStaNo)){
            throw new CoolException("更新源站失败");
        }
        // 更新目标库位状态
        LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>()
                .eq(LocMast::getLocNo, dto.getLocNo())
                .eq(LocMast::getHostId, hostId));
        if (locMast.getLocSts().equals("O")){
            locMast.setLocSts("S"); // S.入库预约
            locMast.setModiUser(userId);
            locMast.setModiTime(new Date());
            if (!locMastService.updateById(locMast)){
                throw new CoolException("改变库位状态失败");
            }
@@ -367,7 +426,7 @@
        if (Cools.isEmpty(wrkMast)){
            throw new CoolException(workNo+"工作档不存在");
        }
        if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) {
        if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 199) {
            throw new CoolException("当前工作档已完成");
        }
        // 入库 + 库位转移