自动化立体仓库 - WMS系统
zyx
2024-04-07 c135b2adb55f470ca20b434ed71ae48d8874d6b0
src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java
@@ -316,27 +316,19 @@
    入库
     */
    @Transactional
    public String emptyPlateIn(String station,String containerCode,Short containerType, Long userId) {
    public String emptyPlateIn(String station,String containerCode,Short containerType, Long userId, boolean emptyAutoIn) {
        Date now = new Date();
        // 源站点状态检测
        //AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(station);
        AgvBasDevp agvBasDevp = agvBasDevpService.selectById(station);
        //初始定义为空板入库类型
        int ioType = 10;
//        if(Cools.isEmpty(agvBasDevp.getBarcode())){
//            agvBasDevp.setBarcode(containerCode);
//        }
        if(!Cools.eq(agvBasDevp.getBarcode(),containerCode) && !agvBasDevp.getLocSts().equals("O")){
        if(!Cools.eq(agvBasDevp.getBarcode(),containerCode) && !agvBasDevp.getLocSts().equals("O") && !emptyAutoIn){
            throw new CoolException("当前工作位状态为" + agvBasDevp.getLocSts()+",无法进行空板入库");
        }
        //查询工作档
        AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(containerCode);
        if(!Cools.isEmpty(agvWrkMast)){
        if(!Cools.isEmpty(agvWrkMast) && !emptyAutoIn){
            throw new CoolException("当前容器已有入库任务,无法进行入库");
        }
@@ -360,12 +352,12 @@
            //修改入库通知档状态
            agvWaitPakinService.updateIoStatus(containerCode,"Y");
            //更新源站点状态
            updateAgvBasDevp(agvBasDevp,"R");
            updateAgvBasDevp(agvBasDevp,"R",containerType);
        }else {
            // 生成工作档 10.空板入库
            createWrkMast(10,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId,containerType);
            //更新源站点状态
            updateAgvBasDevp(agvBasDevp,"R",containerType);
            updateAgvBasDevp(agvBasDevp,"R",containerType,containerCode);
        }
        //更新目标库位状态和信息
@@ -388,6 +380,12 @@
        //寻找相应类型的空托盘
        AgvLocMast agvLocMast = agvLocMastService.selectEmptyZpallet(containerType);
        if(containerType == 0){
            //空板自动出库,根据站点类型选择
            agvLocMastService.selectEmptyZpalletByLocType1(agvBasDevp.getLocType1());
        }
        if (Cools.isEmpty(agvLocMast)) {
            throw new CoolException("暂无当前出库站点类型的空托盘!");
        }
@@ -398,7 +396,7 @@
        updateAgvLocMast(agvLocMast,"R");
        //修改站点状态
        updateAgvBasDevp(agvBasDevp,"S");
        updateAgvBasDevp(agvBasDevp,"S",(short)containerType,agvLocMast.getBarcode());
    }
@@ -594,6 +592,18 @@
            }
        }
        //保存工作档以及明细
        agvWrkMastLogService.save(wrkMast);
        agvWrkDetlLogService.save(wrkMast.getWrkNo());
        //删除工作档以及明细
        if(!agvWrkMastService.deleteByWrkNo(wrkMast.getWrkNo()) || !agvWrkDetlService.deleteByWrkNo(wrkMast.getWrkNo())){
            throw new CoolException("删除失败,请联系管理员");
        }
        if(wrkMast.getIoType() == 1 || wrkMast.getIoType() == 10){
            return;
        }
        //订单回滚
        //List<AgvWrkDetl> agvWrkDetlList = agvWrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
@@ -618,16 +628,6 @@
                }
            }
        });
        //保存工作档以及明细
        agvWrkMastLogService.save(wrkMast);
        agvWrkDetlLogService.save(wrkMast.getWrkNo());
        //删除工作档以及明细
        if(!agvWrkMastService.deleteByWrkNo(wrkMast.getWrkNo()) || !agvWrkDetlService.deleteByWrkNo(wrkMast.getWrkNo())){
            throw new CoolException("删除失败,请联系管理员");
        }
    }
@@ -669,6 +669,15 @@
        }
    }
    private void updateAgvBasDevp(AgvBasDevp agvBasDevp, String locSts, Short continerType, String containerCode){
        if(!Cools.isEmpty(agvBasDevp)){
            agvBasDevp.setLocSts(locSts);
            agvBasDevp.setLocType2(continerType);
            agvBasDevp.setBarcode(containerCode);
            agvBasDevpService.updateById(agvBasDevp);
        }
    }
    /*
    生成工作档明细
     */