自动化立体仓库 - WMS系统
zyx
2023-12-21 f35fc1f577af2cb76198a520f47b4c7b85fb170e
src/main/java/com/zy/asrs/service/impl/AgvLocMastServiceImpl.java
@@ -1,5 +1,6 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.asrs.entity.AgvLocMast;
import com.zy.asrs.entity.AgvLocRule;
@@ -18,10 +19,10 @@
public class AgvLocMastServiceImpl extends ServiceImpl<AgvLocMastMapper, AgvLocMast> implements AgvLocMastService {
    @Autowired
    AgvLocMastMapper agvLockMastMapper;
    AgvLocMastMapper agvLocMastMapper;
    public void clearLoc(){
        agvLockMastMapper.deleteAll();
        agvLocMastMapper.deleteAll();
    }
    public void initLocFloor1() {
@@ -32,20 +33,20 @@
    public void initLocFloor3() {
        //3楼 1-33排 1-14列 8层
        this.insertBatch(getLocMastList(1, 33, 1, 14, 1, 8, 3));
        //3楼 1-33排 1-14列 8层 ------>  1-33排 1-17列 8层
//        this.insertBatch(getLocMastList(1, 33, 1, 17, 1, 8, 3));
//
//        //3楼 1-27排 15-34列 8层 ------>  1-26排 18-25列 8层
//        this.insertBatch(getLocMastList(1, 27, 18, 25, 1, 8, 3));
//
//        //3楼 1-25排 35-46列 8层 ------>  1-25排 26-35列 8层
//        this.insertBatch(getLocMastList(1, 25, 26, 35, 1, 8, 3));
//
//        //3楼 3-25排 47-60列 8层 ------>  1-23排 36-70列 8层
//        this.insertBatch(getLocMastList(1, 23, 36, 70, 1, 8, 3));
        //3楼 1-27排 15-34列 8层
        this.insertBatch(getLocMastList(1, 27, 15, 34, 1, 8, 3));
        //3楼 1-25排 35-46列 8层
        this.insertBatch(getLocMastList(1, 25, 35, 46, 1, 8, 3));
        //3楼 3-25排 47-60列 8层
        this.insertBatch(getLocMastList(3, 25, 47, 60, 1, 8, 3));
        //3楼 4-25排 61-70列 8层
        this.insertBatch(getLocMastList(4, 25, 61, 70, 1, 8, 3));
        //3楼 3-23排 71-72列 8层
        this.insertBatch(getLocMastList(3, 23, 71, 72, 1, 8, 3));
    }
@@ -56,6 +57,22 @@
        for(int row=rowIndex; row<=rowMax; row++) {
            for (int bay = bayIndex; bay <= bayMax; bay++) {
                for (int lev = levIndex; lev <= levMax; lev++) {
                    if(!checkLocExist(row,bay,floor)){
                        continue;
                    }
//                    if(floor == 1 && (row == 8 || row == 9)){
//                        if((bay >=8 && bay <=11)
//                                || (bay >= 20 && bay <=23)
//                                || (bay>=37 && bay <=39)
//                                || (bay>=50 && bay <=52)
//                                || (bay>=63 && bay <=64)
//                                || (bay>=79 && bay <=80)){
//                            continue;
//                        }
//                    }
                    AgvLocMast loc = new AgvLocMast();
                    String locRow = row < 10 ? "-00" + row : "-0" + row;
                    String locBay = bay < 10 ? "-00" + bay : "-0" + bay;
@@ -78,6 +95,38 @@
        return  agvLocMastList;
    }
    private boolean checkLocExist(int row, int bay, int floor){
        if(floor == 1 && (row == 8 || row == 9)){
            if((bay >=8 && bay <=11)
                    || (bay >= 20 && bay <=23)
                    || (bay>=37 && bay <=39)
                    || (bay>=50 && bay <=52)
                    || (bay>=63 && bay <=64)
                    || (bay>=79 && bay <=80)){
                return false;
            }
        }
        if(floor == 3){
            if(row == 1 && bay > 63){
                return false;
            }
            if(row ==  2 && bay > 65){
                return false;
            }
            if(row > 23 && bay == 1){
                return false;
            }
            if(bay > 35 && bay < 39){
                if(row == 4 || row == 5 || row == 10 || row == 11 || row == 17 || row == 18){
                    return false;
                }
            }
        }
        return true;
    }
    @Override
    public List<AgvLocMast> queryFreeLocMast2(Short locType1, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd) {
        return this.baseMapper.queryFreeLocMast2(locType1, rowBeg, rowEnd, bayBeg, bayEnd, levBeg, levEnd);
@@ -88,10 +137,22 @@
        this.baseMapper.updateLocType2(locType2,locRule.getRowBeg(),locRule.getRowEnd(),locRule.getBayBeg(),locRule.getBayEnd(),locRule.getLevBeg(),locRule.getLevEnd(),locRule.getFloor());
    }
    public void updateLocStsByLocNo(String locNo, String locSts) {
    public void updateLocStsByLocNo(String locNo, String locSts, String barcode) {
        AgvLocMast agvLocMast = this.selectById(locNo);
        agvLocMast.setLocSts(locSts);
        agvLocMast.setBarcode(barcode);
        this.updateById(agvLocMast);
    }
    public List<String> queryGroupEmptyStock(int floor) {
        return this.baseMapper.queryGroupEmptyStock(floor);
    }
    public List<AgvLocMast> selectLocByLevAndFloor(int lev, int floor) {
        List<AgvLocMast> agvLocMastList = this.selectList(new EntityWrapper<AgvLocMast>().eq("lev1", lev).eq("floor", floor));
        return agvLocMastList;
        //return this.agvLocMastMapper.selectLocByLevAndFloor(lev,floor);
    }
}