自动化立体仓库 - WMS系统
zhangc
2024-12-12 5dc8a9f9aba3310fd21cad9509635bb7ec2f007f
src/main/java/com/zy/asrs/service/impl/AgvLocMastServiceImpl.java
@@ -26,15 +26,17 @@
    }
    public void initLocFloor1() {
        //1楼 13排 86列 12层
        List<AgvLocMast> agvLocMastList = getLocMastList(1,45,1,33,1,1,1);
        this.insertBatch(agvLocMastList);
        this.insertBatch(getLocMastList(1, 22, 1, 39, 2, 2, 1));
    }
    public void initLocFloor2() {
        //2楼 1-25排 1-33列 1层
        this.insertBatch(getLocMastList(1, 25, 1, 33, 1, 1, 2));
    }
    public void initLocFloor3() {
        //2楼 1-25排 1-33列 1层
        this.insertBatch(getLocMastList(1, 26, 1, 34, 1, 1, 3));
    }
    //根据排列层获取AGV库位列表
@@ -45,7 +47,7 @@
            for (int bay = bayIndex; bay <= bayMax; bay++) {
                for (int lev = levIndex; lev <= levMax; lev++) {
                    if(!checkLocExistFloor2(row,bay)){
                    if(!checkLocExistFloor1_2(row,bay)){
                        continue;
                    }
@@ -63,13 +65,87 @@
                    loc.setModiTime(now);
                    loc.setFirstTime(now);
                    loc.setAppeTime(now);
                    loc.setLocType1(initLocMastSts(row,bay));
                    loc.setLocType1((short)3);
                    //  loc.setLocType1(initLocMastSts3(row,bay));
                    agvLocMastList.add(loc);
                }
            }
        }
        return  agvLocMastList;
    }
    private boolean checkLocExistFloor1_2(int row, int bay){
        if(row == 4 && bay == 19){
            return false;
        }
        if(row == 5 && (bay == 3 || bay == 8 || bay == 13 || bay == 18 || bay == 19 || bay == 24 || bay == 29)){
            return false;
        }
        if((row == 6 || row == 7) && bay == 39){
            return false;
        }
        if((row == 9 || row == 10 || row == 14 || row == 18) && (bay == 3 || bay == 8 || bay == 13 || bay == 14 || bay == 19 || bay == 24 || bay == 29 || bay == 30)){
            return false;
        }
        if ((row == 10 || row == 11) && (bay == 7 || bay == 12 || bay == 23 || bay == 28 )) {
            return false;
        }
        if ((row == 9 || row == 13) && bay == 35 ) {
            return false;
        }
        if(row == 13 && (bay == 18 || bay == 19 || bay == 20)){
            return false;
        }
        if(row == 9 && bay == 18){
            return false;
        }
        if((row == 14 || row == 15) && bay > 37){
            return false;
        }
        if(row >= 16 && bay >= 35){
            return false;
        }
        if((row >= 2 && row <= 21) && bay == 17){
            return false;
        }
        if(bay >= 33 && bay <= 34){
            return false;
        }
        return true;
    }
    private boolean checkLocExistFloor1_1(int row, int bay){
        if(row <= 2 && bay >= 20){
            return false;
        }
        if ((row == 4 || row == 9 || row == 14 || row == 20 || row == 25 || row == 30) && (bay == 7 || bay == 11 || bay == 12 || bay == 16 )) {
            return false;
        }
        if ((row == 7 || row == 13 || row == 21 || row == 26) && (bay == 12 || bay == 13 )) {
            return false;
        }
        if (row >= 10 && bay == 1) {
            return false;
        }
        if (row == 18 && bay <= 19) {
            return false;
        }
        if (row == 25 && bay == 20) {
            return false;
        }
        if ((row >= 26 && row <=27) && (bay >=18 && bay <= 19)) {
            return false;
        }
        if (row >= 28 && bay == 20) {
            return false;
        }
        return true;
    }
    private boolean checkLocExistFloor2(int row, int bay){
@@ -115,6 +191,79 @@
        }
        if(row >= 21){
            return 3;
        }
        return 2;
    }
    private boolean checkLocExistFloor3(int row, int bay){
        if(row == 1 && (bay <= 15 || bay >= 30)){
            return false;
        }
        if(row <= 6 && bay >= 30){
            return false;
        }
        if((row >= 9 && row <= 16) && (bay <= 4 || bay >= 33)){
            return false;
        }
        if(row == 17 && (bay <= 3 || bay >= 33)){
            return false;
        }
        if(row <= 21 && row != 7 && row != 8 && bay >= 33){
            return false;
        }
        if((row <= 24 && row != 7 && row != 8) && bay >= 34){
            return false;
        }
        if(row >= 25 && row <= 26 && bay >= 29){
            return false;
        }
        if((row != 8 && row != 21  && row != 23 && row != 24 && row != 25 && row != 26) && bay == 15){
            return  false;
        }
        if((row >= 22 && row != 26 ) && bay == 16){
            return  false;
        }
        if (row == 4 && (bay == 3 || bay == 4 || bay == 9 || bay == 14 || bay == 19 || bay == 20 || bay == 25)) {
            return  false;
        }
        if ((row == 13 || row == 17) && (bay == 8 || bay == 14 || bay == 19 || bay == 24 )) {
            return  false;
        }
        if (row == 22 && (bay == 4 || bay == 9 || bay == 14 || bay == 20 || bay == 25 )) {
            return  false;
        }
        return true;
    }
    private short initLocMastSts3(int row, int bay){
        if(row <= 8){
            return 1;
        }
        if(row <= 17){
            return 2;
        }
        if(row <= 18 && bay >= 9){
            return 2;
        }
        if(row <= 21){
            return 4;
        }
        if(row >= 22){
            return 3;
        }
@@ -221,6 +370,17 @@
        agvLocMast.setLocSts(locSts);
        agvLocMast.setBarcode(barcode);
        agvLocMast.setLocType2(containerType);
        agvLocMast.setModiTime(new Date());
        this.updateById(agvLocMast);
    }
    public void updateLocStsByLocNo(String locNo, String locSts, String barcode,Short containerType,String locType,Short locType3) {
        AgvLocMast agvLocMast = this.selectById(locNo);
        agvLocMast.setLocSts(locSts);
        agvLocMast.setBarcode(barcode);
        agvLocMast.setLocType2(containerType);
        agvLocMast.setLocType(locType);
        agvLocMast.setLocType3(locType3);
        agvLocMast.setModiTime(new Date());
        this.updateById(agvLocMast);
    }
@@ -236,9 +396,16 @@
    }
    @Override
    public AgvLocMast selectEmptyZpallet(int type) {
    public AgvLocMast selectEmptyZpallet(int type, int floor) {
        return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type2",type));
        return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type2",type).eq("floor",floor));
    }
    @Override
    public AgvLocMast selectEmptyZpalletByLocType1(int type) {
        return this.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_sts","D").eq("loc_type1",type));
    }
@@ -247,4 +414,10 @@
        return this.baseMapper.queryContainerTypeByLocType1(locType1);
    }
    @Override
    public List<AgvLocMast> selectDistinctLocByLevAndFloor(int lev, int floor) {
        return this.agvLocMastMapper.selectDistinctLocByLevAndFloor(lev,floor);
    }
}