自动化立体仓库 - WMS系统
skyouc
2 天以前 9591d4a4184a76f2af997a47c3bd883beecb1ea2
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -656,6 +656,7 @@
                waitPakin.setAnfme(detlDto.getAnfme());
                waitPakin.setThreeCode(detlDto.getThreeCode());
                waitPakin.setStatus("Y");
                waitPakin.setSuppCode(detlDto.getStandby1());
                waitPakin.setStandby1(detlDto.getStandby1());
                waitPakin.setStandby2(detlDto.getStandby2());
                waitPakin.setStandby3(detlDto.getStandby3());
@@ -1589,17 +1590,16 @@
        if (Objects.isNull(params.getBsCode())) {
            throw new CoolException("BS码不能为空!!");
        }
        Task task = taskService.selectOne(new EntityWrapper<Task>()
                .eq("io_type", TaskIOType.PICK_OUT.type)
                .eq("wrk_sts", 14)
                .eq("barcode", params.getCarBarcode()));
        if (Objects.isNull(task)) {
            throw new CoolException("数据错误:任务信息存在!!");
        }
//        Task task = taskService.selectOne(new EntityWrapper<Task>()
//                .eq("io_type", TaskIOType.PICK_OUT.type)
//                .eq("wrk_sts", 14)
//                .eq("barcode", params.getCarBarcode()));
//        if (Objects.isNull(task)) {
//            throw new CoolException("数据错误:任务信息存在!!");
//        }
        List<TaskDetl> taskDetl = taskDetlService.selectList(new EntityWrapper<TaskDetl>()
        List<BasStationDetl> taskDetl = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
                .eq("three_code", params.getBsCode())
                .eq("wrk_no", task.getWrkNo())
                .eq("zpallet", params.getCarBarcode()));
        if (Objects.isNull(taskDetl) || taskDetl.isEmpty()) {
@@ -1688,9 +1688,23 @@
                throw new CoolException("物料:" + detlDto.getMatnr() + ", 超出当前托盘装载上限!!");
            }
            BasStationDetl stationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
                    .eq("zpallet", param.getCarBarcode())
                    .eq("three_code", detlDto.getThreeCode()));
            if (Objects.isNull(stationDetl)) {
                throw new CoolException("明细内容不存在!!");
            }
            Double v = Math.round((stationDetl.getAnfme() - stationDetl.getWorkQty()) * 10000) / 10000.0;
            if (detlDto.getAnfme().compareTo(v) > 0) {
                throw new CoolException("组托上限为:" + stationDetl.getAnfme() + ", 已组托:" + stationDetl.getWorkQty() + ", 还可组托:" + v);
            }
            WaitPakin waitPakin = new WaitPakin();
            BeanUtils.copyProperties(mat, waitPakin);
            waitPakin.setBatch(detlDto.getBatch());
            waitPakin.setType(param.getType());
            waitPakin.setZpallet(param.getBarcode());
            // 设置组托类型
            waitPakin.setType(param.getType());
@@ -1698,6 +1712,7 @@
            waitPakin.setAnfme(detlDto.getAnfme());
            waitPakin.setThreeCode(detlDto.getThreeCode());
            waitPakin.setStatus("Y");
            waitPakin.setSuppCode(detlDto.getStandby1());
            waitPakin.setStandby1(detlDto.getStandby1());
            waitPakin.setStandby2(detlDto.getStandby2());
            waitPakin.setStandby3(detlDto.getStandby3());
@@ -1711,6 +1726,33 @@
            if (!waitPakinService.insert(waitPakin)) {
                throw new CoolException("保存入库通知档失败");
            }
            Double v1 = Math.round((stationDetl.getWorkQty() + detlDto.getAnfme()) * 10000) / 10000.0 ;
            stationDetl.setWorkQty(v1);
            if (!basStationDetlService.updateById(stationDetl)) {
                throw new CoolException("站点明细修改失败");
            }
            if (v1.compareTo(stationDetl.getWorkQty()) >= 0) {
                if (!basStationDetlService.deleteById(stationDetl)) {
                    throw new CoolException("原始数据移除失败!");
                }
            }
            List<BasStationDetl> devNo = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>().eq("dev_no", stationDetl.getDevNo()));
            if (Objects.isNull(devNo) || devNo.isEmpty()) {
                BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
                        .eq("loc_sts", LocStsType.LOC_STS_TYPE_F.type)
                        .eq("dev_no", stationDetl.getDevNo()));
                if (!Objects.isNull(station)) {
                    station.setLocSts(LocStsType.LOC_STS_TYPE_D.type);
                    if (!basStationService.updateById(station)) {
                        throw new CoolException("站点状态修改失败~!!");
                    }
                }
            }
        }
    }
@@ -1731,37 +1773,37 @@
        if (Objects.isNull(param.getStation())) {
            throw new CoolException("站点不能为空!!");
        }
        // TODO 修改缓存站点状态及数据
        Task task = taskService.selectOne(new EntityWrapper<Task>()
                .eq("wrk_sts", 14L)
                .eq("barcode", param.getCarBarcode()));
        if (Objects.isNull(task)) {
            throw new CoolException("数据错误,任务不存在!!");
        }
        List<TaskDetl> taskDetls = taskDetlService
                .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
        if (Objects.isNull(taskDetls) || taskDetls.isEmpty()) {
            throw new CoolException("数据错误,任务明细不存在!!");
        }
//        // TODO 修改缓存站点状态及数据
//        Task task = taskService.selectOne(new EntityWrapper<Task>()
//                .eq("wrk_sts", 14L)
//                .eq("barcode", param.getCarBarcode()));
//        if (Objects.isNull(task)) {
//            throw new CoolException("数据错误,任务不存在!!");
//        }
//        List<TaskDetl> taskDetls = taskDetlService
//                .selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", task.getWrkNo()));
//        if (Objects.isNull(taskDetls) || taskDetls.isEmpty()) {
//            throw new CoolException("数据错误,任务明细不存在!!");
//        }
        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
                .eq("dev_no", task.getStaNo()));
                .eq("dev_no", param.getStation()));
        if (Objects.isNull(station)) {
            throw new CoolException("站点不存在!!");
        }
        station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
        if (!basStationService.updateById(station)) {
            throw new CoolException("站点状态修改失败!");
        }
        basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
//        station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
//        if (!basStationService.updateById(station)) {
//            throw new CoolException("站点状态修改失败!");
//        }
//        basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
        // 任务完成
        task.setWrkSts(15L);
        if (!taskService.updateById(task)) {
            throw new CoolException("AGV任务完成失败!!");
        }
//        // 任务完成
//        task.setWrkSts(15L);
//
//        if (!taskService.updateById(task)) {
//            throw new CoolException("AGV任务完成失败!!");
//        }
        List<WaitPakin> waitPakins = waitPakinService
                .selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
@@ -1814,6 +1856,7 @@
                        .setOrderNo(orderPakin.getOrderNo())
                        .setDevNo(basStation.getDevNo())
                        .setBarcode(params.getTarBarcode())
                        .setZpallet(params.getTarBarcode())
                        .setBatch(combMat.getBatch())
                        .setStandby1(combMat.getStandby1())
                        .setAnfme(combMat.getWorkQty().doubleValue());
@@ -1946,6 +1989,7 @@
        waitPakins.forEach(waitPakin -> {
            WrkDetl wrkDetl = new WrkDetl();
            wrkDetl.sync(waitPakin);
            wrkDetl.setSuppCode(waitPakin.getSuppCode());
            wrkDetl.setWrkNo(wrkMast.getWrkNo());
            wrkDetl.setIoTime(wrkMast.getIoTime());
            wrkDetl.setAppeTime(now);
@@ -1954,16 +1998,16 @@
                throw new CoolException("保存工作明细失败");
            }
        });
        // 更新入库通知档 ioStatus ===>> Y
        Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
                .eq("zpallet", pakin.getZpallet());
        WaitPakin setParam = new WaitPakin();
        setParam.setLocNo(dto.getLocNo());
        setParam.setIoStatus("Y");
        setParam.setModiTime(now);
        if (!waitPakinService.update(setParam, wrapper)) {
            throw new CoolException("更新通知档失败");
        }
//        // 更新入库通知档 ioStatus ===>> Y
//        Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
//                .eq("zpallet", pakin.getZpallet());
//        WaitPakin setParam = new WaitPakin();
//        setParam.setLocNo(dto.getLocNo());
//        setParam.setIoStatus("Y");
//        setParam.setModiTime(now);
//        if (!waitPakinService.update(setParam, wrapper)) {
//            throw new CoolException("更新通知档失败");
//        }
        // 更新源站点信息
        sourceStaNo.setWrkNo(workNo);
        sourceStaNo.setModiTime(now);