自动化立体仓库 - WMS系统
skyouc
1 天以前 90aea4830974e3687222aa266952923d59aa088f
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1741,7 +1741,7 @@
                    throw new CoolException("数据错误,站点不存在!!");
                }
                station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
                station.setBarcode(null);
                station.setBarcode("");
                if (!basStationService.updateById(station)) {
                    throw new CoolException("站点状态更新失败!!");
                }
@@ -1786,7 +1786,7 @@
        }
        station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
        station.setBarcode(null);
        station.setBarcode("");
        if (!basStationService.updateById(station)) {
            throw new CoolException("站点状态修改失败!");
        }
@@ -2381,11 +2381,6 @@
     */
    @Transactional(rollbackFor = Exception.class)
    public void generateAgvTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
        List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
        if (Objects.isNull(pakins) || pakins.isEmpty()) {
            throw new CoolException("组托信息不存在!!");
        }
        List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode));
        if (!tasks.isEmpty()) {
            throw new CoolException("托盘已在任务执行中..");
@@ -2416,32 +2411,39 @@
            throw new CoolException("保存工作档失败");
        }
        for (WaitPakin pakin : pakins) {
            TaskDetl wrkDetl = new TaskDetl();
            BeanUtils.copyProperties(pakin, wrkDetl);
            wrkDetl.setId(null).setWrkNo(workNo)
                    .setIoTime(new Date())
                    .setOrderNo(pakin.getOrderNo())
                    .setAnfme(pakin.getAnfme())
                    .setZpallet(pakin.getZpallet())
                    .setBatch(pakin.getBatch())
                    .setMatnr(pakin.getMatnr())
                    .setMaktx(pakin.getMaktx())
                    .setAppeUser(userId)
                    .setUnit(pakin.getUnit())
                    .setModel(pakin.getModel())
                    .setAppeTime(new Date())
                    .setModiUser(userId);
            if (!taskDetlService.insert(wrkDetl)) {
                throw new CoolException("保存工作档明细失败");
        if (!type.equals("agv_back")) {
            List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
            if (Objects.isNull(pakins) || pakins.isEmpty()) {
                throw new CoolException("组托信息不存在!!");
            }
        }
            for (WaitPakin pakin : pakins) {
                TaskDetl wrkDetl = new TaskDetl();
                BeanUtils.copyProperties(pakin, wrkDetl);
                wrkDetl.setId(null).setWrkNo(workNo)
                        .setIoTime(new Date())
                        .setOrderNo(pakin.getOrderNo())
                        .setAnfme(pakin.getAnfme())
                        .setZpallet(pakin.getZpallet())
                        .setBatch(pakin.getBatch())
                        .setMatnr(pakin.getMatnr())
                        .setMaktx(pakin.getMaktx())
                        .setAppeUser(userId)
                        .setUnit(pakin.getUnit())
                        .setModel(pakin.getModel())
                        .setAppeTime(new Date())
                        .setModiUser(userId);
                if (!taskDetlService.insert(wrkDetl)) {
                    throw new CoolException("保存工作档明细失败");
                }
        for (WaitPakin pakin : pakins) {
            pakin.setIoStatus("Y");
            if (!waitPakinService.updateById(pakin)) {
                throw new CoolException("更新组托信息失败");
            }
            for (WaitPakin pakin : pakins) {
                pakin.setIoStatus("Y");
                if (!waitPakinService.updateById(pakin)) {
                    throw new CoolException("更新组托信息失败");
                }
            }
        }
@@ -2463,9 +2465,9 @@
            throw new CoolException("站点不存在!!");
        }
        if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
        if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type) || station.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) {
            station.setLocSts("R"); // S.入库预约
//            station.setBarcode(barcode);
            station.setBarcode(barcode);
            station.setModiTime(new Date());
            station.setModiUser(userId);
            if (!basStationService.updateById(station)) {
@@ -2531,7 +2533,7 @@
    }
    /**
     * 呼叫AGV返回
     * 呼叫AGV空台车返回
     * @author Ryan
     * @date 2025/9/24
     * @param callAgvBackParam
@@ -2550,9 +2552,16 @@
        if (Objects.isNull(locCache)) {
            return R.error("未查询到可用库位");
        }
        // 修改目标站点信息
        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", callAgvBackParam.getOrgSite()));
        if (Objects.isNull(station)) {
            throw new CoolException("站点不存在!!");
        }
        try {
            generateAgvTask("agv", locCache, callAgvBackParam.getOrgSite(), callAgvBackParam.getBarcode(), userId);
            //空台车回库
            generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId);
        } catch (Exception e) {
            e.printStackTrace();
            return R.error(e.getMessage());