自动化立体仓库 - WMS系统
zyx
2024-03-27 b5768fb9a6bf4216aba11d7f784e8cefc8fdaf9b
src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java
@@ -91,7 +91,7 @@
            //检索库位,选择合适的库位
            AgvLocMast agvLocMast = agvCommonService.getLocNo(agvBasDevp.getLocType1());
            //生成工作档
            AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),agvBasDevp.getBarcode(),now,userId, isConveyor);
            AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),agvBasDevp.getBarcode(),now,userId, agvBasDevp.getLocType2());
            //标记是否为输送线入库
            wrkMast.setMk(isConveyor ? "Y" : "N");
            //生成工作档明细
@@ -134,7 +134,7 @@
            //判断是否全板出库
            int ioType = isPakOut(sourceLocNo,taskDto) ?  101 : 103;
            //生成工作档
            AgvWrkMast wrkMast = createWrkMast(ioType,wrkSts,sourceLocNo,targetLocNo,containerCode,now,userId,false);
            AgvWrkMast wrkMast = createWrkMast(ioType,wrkSts,sourceLocNo,targetLocNo,containerCode,now,userId,0);
            //生成工作档明细
            taskDto.getLocDtos().forEach(locDto -> {
                if (!BaseController.isJSON(locDto.getOrderNo())) {
@@ -258,8 +258,10 @@
                return;
            }
            int containerType = getContainerTypeByloc(taskDto.getLocNo());
            //生成工作档
            AgvWrkMast wrkMast = createWrkMast(107, 21L,taskDto.getLocNo(),taskDto.getAgvStaNo(),taskDto.getLocDtos().get(0).getContainerCode(),now,userId,false);
            AgvWrkMast wrkMast = createWrkMast(107, 21L,taskDto.getLocNo(),taskDto.getAgvStaNo(),taskDto.getLocDtos().get(0).getContainerCode(),now,userId,containerType);
            //生成工作档明细
            taskDto.getLocDtos().forEach(locDto -> {
                //明细档所需参数
@@ -299,8 +301,9 @@
        }
        Date now = new Date();
        //生成移库工作档
        AgvWrkMast wrkMast = createWrkMast(11, 21L, sourceLocNo, targetLocNo, sourceLocDetl.getSuppCode(), now, userId,false);
        AgvWrkMast wrkMast = createWrkMast(11, 21L, sourceLocNo, targetLocNo, sourceLocDetl.getSuppCode(), now, userId,getContainerTypeByloc(sourceLocNo));
        //生成工作党明细
        createWrkDetlReWrite(sourceLocDetl.getMatnr(),wrkMast.getWrkNo(),null,sourceLocDetl.getBatch(),sourceLocDetl.getAnfme(),sourceLocDetl.getZpallet(),now,userId,sourceLocDetl.getThreeCode(),sourceLocDetl.getDeadTime());
        //修改目标库位状态
@@ -313,7 +316,7 @@
    入库
     */
    @Transactional
    public String emptyPlateIn(String station,String containerCode,int containerType, Long userId) {
    public String emptyPlateIn(String station,String containerCode,Short containerType, Long userId) {
        Date now = new Date();
        // 源站点状态检测
@@ -344,22 +347,24 @@
        List<AgvWaitPakin> agvWaitPakinList = agvWaitPakinService.selectByContainerCode(containerCode);
        if(!Cools.isEmpty(agvWaitPakinList)){
            //生成工作档
            AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId, false);
            AgvWrkMast wrkMast = createWrkMast(1,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId, agvBasDevp.getLocType2());
            //生成工作档明细
            agvWaitPakinList.forEach(wp -> {
                createWrkDetlReWrite(wp.getMatnr(),wrkMast.getWrkNo(),wp.getOrderNo(),wp.getBatch(),wp.getAnfme(),wp.getSuppCode(),now,userId,wp.getThreeCode(),wp.getDeadTime());
            });
            //修改入库通知档状态
            agvWaitPakinService.updateIoStatus(containerCode,"Y");
        }else {
            // 生成工作档 10.空板入库
            createWrkMast(10,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId,false);
        }
        //更新源站点状态
        updateAgvBasDevp(agvBasDevp,"R");
        }else {
            // 生成工作档 10.空板入库
            createWrkMast(10,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId,containerType);
            //更新源站点状态
            updateAgvBasDevp(agvBasDevp,"R",containerType);
        }
        //更新目标库位状态和信息
        updateAgvLocMast(agvLocMast,"S", (short) containerType);
        updateAgvLocMast(agvLocMast,"S");
        return agvLocMast.getLocNo();
    }
@@ -382,7 +387,7 @@
            throw new CoolException("暂无当前出库站点类型的空托盘!");
        }
        //生成工作档
        createWrkMast(110,21L,agvLocMast.getLocNo(),agvBasDevp.getDevNo(),agvLocMast.getBarcode(),now,userId,false);
        createWrkMast(110,21L,agvLocMast.getLocNo(),agvBasDevp.getDevNo(),agvLocMast.getBarcode(),now,userId,containerType);
        //修改源库位状态
        updateAgvLocMast(agvLocMast,"R");
@@ -569,7 +574,7 @@
            String devNo = wrkMast.getSourceLocNo();
            //目标库位
            String locNo = wrkMast.getLocNo();
            agvLocMastService.updateLocStsByLocNo(locNo,"O","");
            agvLocMastService.updateLocStsByLocNo(locNo,"O","",null);
            agvBasDevpService.updateLocStsAndBarcodeByDevNo(devNo,"F",wrkMast.getBarcode());
            //出库取消
@@ -578,7 +583,7 @@
            String locNo = wrkMast.getSourceLocNo();
            //目标站点
            String devNo = wrkMast.getLocNo();
            agvLocMastService.updateLocStsByLocNo(locNo,"F",wrkMast.getBarcode());
            agvLocMastService.updateLocStsByLocNo(locNo,"F",wrkMast.getBarcode(),(short)getContainerTypeByloc(locNo));
            if(devNo.contains("@")){
                agvBasDevpService.updateLocStsAndBarcodeByDevNo(devNo,"O","");
            }
@@ -649,6 +654,17 @@
    }
    /*
    更新源站点信息和库位托盘类型
     */
    private void updateAgvBasDevp(AgvBasDevp agvBasDevp, String locSts, Short continerType){
        if(!Cools.isEmpty(agvBasDevp)){
            agvBasDevp.setLocSts(locSts);
            agvBasDevp.setLocType2(continerType);
            agvBasDevpService.updateById(agvBasDevp);
        }
    }
    /*
    生成工作档明细
     */
    private void createWrkDetlReWrite(String matnr, int wrkNo, String orderNo,String batch, double anfme, String zpallet, Date now, Long userId, String csocode, String isoseq){
@@ -708,7 +724,7 @@
    /*
    生成工作档
     */
    private AgvWrkMast createWrkMast(int ioType, long wrkSts, String sourceLocNo, String locNo, String barcode,  Date now, Long userId, boolean isConveyor){
    private AgvWrkMast createWrkMast(int ioType, long wrkSts, String sourceLocNo, String locNo, String barcode,  Date now, Long userId, int containerType){
        AgvWrkMast wrkMast = new AgvWrkMast();
        //工作状态
        wrkMast.setWrkSts(wrkSts);
@@ -723,8 +739,9 @@
        wrkMast.setLocNo(locNo);
        //容器编码
        wrkMast.setBarcode(barcode);
        //标记是否为输送线入库
        wrkMast.setMk(isConveyor ? "Y" : "N");
        //容器类型
        wrkMast.setWhsType(containerType);
        wrkMast.setAppeUser(userId);
        wrkMast.setAppeTime(now);
        wrkMast.setModiUser(userId);
@@ -813,4 +830,10 @@
        }
    }
    private int getContainerTypeByloc(String locNo){
        return agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no",locNo)).getLocType2();
    }
}