自动化立体仓库 - WMS系统
#
LSH
2023-02-10 f9dd569895f007d09c3b568b4a4755d7ae8add45
#
6个文件已修改
126 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/mapper/LocMastMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/LocMastService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/CommonService.java 98 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocMastMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/LocMastMapper.java
@@ -15,9 +15,9 @@
    LocMast queryFreeLocMast(@Param("row") Integer row, @Param("locType1") Short locType1);
    LocMast queryFreeLocMast1(@Param("row") Integer row, @Param("locType1") Short locType1);
    LocMast queryFreeLocMast1(@Param("row") Integer row, @Param("locType1") Short locType1 ,@Param("channelMax") int channelMax);
    LocMast queryFreeLocMast2(@Param("row") Integer row, @Param("locType1") Short locType1, @Param("bay") Integer bay);
    LocMast queryFreeLocMast2(@Param("row") Integer row, @Param("locType1") Short locType1);
    @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo}")
    List<String> queryGroupEmptyStock(Integer crnNo);
src/main/java/com/zy/asrs/service/LocMastService.java
@@ -16,12 +16,12 @@
    /**
     * 检索可用库位
     */
    LocMast queryFreeLocMast1(Integer row, Short locType1);
    LocMast queryFreeLocMast1(Integer row, Short locType1 ,int channelMax);
    /**
     * 检索可用库位
     */
    LocMast queryFreeLocMast2(Integer row, Short locType1, Integer bay);
    LocMast queryFreeLocMast2(Integer row, Short locType1);
    /**
     * 获取同组货架的空库位
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -24,15 +24,16 @@
    }
    @Override
    public LocMast queryFreeLocMast1(Integer row, Short locType1) {
        return this.baseMapper.queryFreeLocMast1(row, locType1);
    public LocMast queryFreeLocMast1(Integer row, Short locType1 ,int channelMax) {
        return this.baseMapper.queryFreeLocMast1(row, locType1 ,channelMax);
    }
    @Override
    public LocMast queryFreeLocMast2(Integer row, Short locType1, Integer bay) {
        return this.baseMapper.queryFreeLocMast2(row, locType1, bay);
    public LocMast queryFreeLocMast2(Integer row, Short locType1) {
        return this.baseMapper.queryFreeLocMast2(row, locType1);
    }
    @Override
    public List<String> queryGroupEmptyStock(String sourceLocNo) {
        if (Cools.isEmpty(sourceLocNo)) {
src/main/java/com/zy/common/service/CommonService.java
@@ -17,6 +17,7 @@
import com.zy.common.properties.SlaveProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -48,6 +49,8 @@
    private LocDetlService locDetlService;
    @Autowired
    private SlaveProperties slaveProperties;
    @Value("${channel.channelMax}")
    private Integer channelMax;
    /**
     * 生成工作号
@@ -98,9 +101,13 @@
     */
    @Transactional
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) {
//        whsType = getWhsType(sourceStaNo, times);
        StartupDto startupDto = new StartupDto();
        if (sourceStaNo.equals(100)){
            whsType=1;
        }else if (sourceStaNo.equals(200)){
            whsType=2;
        }
        StartupDto startupDto = new StartupDto();
        RowLastno rowLastno = rowLastnoService.selectById(whsType);
        if (Cools.isEmpty(rowLastno)) {
            throw new CoolException("数据异常,请联系管理员");
@@ -111,52 +118,18 @@
        int sRow = rowLastno.getsRow();
        int eRow = rowLastno.geteRow();
        int crn_qty = rowLastno.getCrnQty();
        int rowCount = eRow - sRow + 1;
        int rowCount = eRow - sRow;
        // 目标堆垛机号
        int crnNo = crn_qty;
        // 目标库位
        LocMast locMast = null;
        // 如果没有相近物料,则按规则轮询货架
        if (null == locMast) {
            switch (curRow){
                case 2:
        if (curRow==3){
                    curRow = 4;
                    break;
                case 4:
                    curRow = 6;
                    break;
                case 6:
                    curRow = 8;
                    break;
                case 8:
                    curRow = 11;
                    break;
                case 11:
                    curRow = 13;
                    break;
                case 13:
        }else if (curRow==4){
                    curRow = 3;
                    break;
                case 3:
                    curRow = 5;
                    break;
                case 5:
                    curRow = 7;
                    break;
                case 7:
                    curRow = 9;
                    break;
                case 9:
                    curRow = 12;
                    break;
                case 12:
                    curRow = 14;
                    break;
                case 14:
                    curRow = 2;
                    break;
            }
        }else {
            rowCount=0;
        }
        if (crnNo == 0) {
@@ -182,33 +155,19 @@
        rowLastnoService.updateById(rowLastno);
        // 开始查找库位 ==============================>>
        // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排
//        if (locMast == null) {
//            if (Utils.isShallowLoc(slaveProperties, curRow)) {
//                Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
//                locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1());
//                // todo:luxiaotao 如果用浅排找到的深库位,那么则需要判断这个深库位对应的浅库位是否有货(F、X、D)
//                // 因库位移转、需预留空库位
//                if (!locMastService.checkEmptyCount(locMast)) {
//                    locMast = null;
//                }
//            }
            if (Cools.isEmpty(locMast)) {
                Integer ruleId = Integer.parseInt(Parameter.get().getFindLocRule());
                if (ruleId == 0){//默认规则
                    locMast = locMastService.queryFreeLocMast(2, locTypeDto.getLocType1());
            if (whsType!=1){
                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
                } else if (ruleId == 1){ //按测试设备排序,优先排满单台设备
                    locMast = locMastService.queryFreeLocMast1(2, locTypeDto.getLocType1());
                locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1() ,channelMax+1);
                } else if (ruleId == 2){//按通道排序,均匀分配每台设备
                    locMast = locMastService.queryFreeLocMast2(2, locTypeDto.getLocType1(), curRow);
                } else {
                    locMast = locMastService.queryFreeLocMast(2, locTypeDto.getLocType1());
                }
                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1() );
            } else { //默认规则
                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
            }
//        }
        }
        // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位
        if (Cools.isEmpty(locMast)) {
@@ -232,21 +191,6 @@
        startupDto.setStaNo(staNo.getDevNo());
        startupDto.setLocNo(locNo);
        return startupDto;
    }
    public static String zerofill(String msg, Integer count) {
        if (msg.length() == count) {
            return msg;
        } else if (msg.length() > count) {
            return msg.substring(0, 16);
        } else {
            StringBuilder msgBuilder = new StringBuilder(msg);
            for(int i = 0; i < count - msg.length(); ++i) {
                msgBuilder.insert(0, "0");
            }
            return msgBuilder.toString();
        }
    }
}
src/main/resources/application.yml
@@ -52,6 +52,12 @@
  # 一个堆垛机负责的货架排数
  groupCount: 2
# 充放电测试通道
channel:
  # 最大通道数
  channelMax: 48
# MES系统
mes:
  url: 172.28.15.251:7899
  # 入库上报
@@ -59,6 +65,7 @@
  # 出库上报
  outPath: mes-pm/in/stock/condition/exWarehouse
# 充放电测试系统
ren:
  # 1~8通道
  url1: 172.28.15.196:12784
src/main/resources/mapper/LocMastMapper.xml
@@ -57,10 +57,12 @@
        from asr_loc_mast
        where row1=#{row}
        and loc_sts='O'
        and channel > 0
        and channel &lt; #{channelMax}
        <if test="locType1 != null">
            and loc_type1 = #{locType1}
        </if>
        order by loc_type2 asc,lev1 asc,bay1 asc
        order by channel asc
    </select>
    <select id="queryFreeLocMast2" resultMap="BaseResultMap">