自动化立体仓库 - WMS系统
#
LSH
2023-02-11 0e370ca374b0d0b15c0f4c92aff576c9e7de0fa1
src/main/java/com/zy/common/service/CommonService.java
@@ -3,16 +3,12 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Arith;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.entity.Parameter;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.Shelves;
import com.zy.common.model.StartupDto;
import com.zy.common.properties.SlaveProperties;
import lombok.extern.slf4j.Slf4j;
@@ -51,6 +47,8 @@
    private SlaveProperties slaveProperties;
    @Value("${channel.channelMax}")
    private Integer channelMax;
    @Value("${channel.equipmentCount}")
    private Integer equipmentCount;
    /**
     * 生成工作号
@@ -162,10 +160,10 @@
            } else if (ruleId == 1){  //按测试设备排序,优先排满单台设备
                locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1() ,channelMax+1);
            } else if (ruleId == 2){  //按通道排序,均匀分配每台设备
                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1() );
                Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1());
                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1() ,locType2);
            } else { //默认规则
                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1(),(short)0);
            }
        }
@@ -193,4 +191,18 @@
        return startupDto;
    }
    public Short getLocType2Small(Integer curRow,short locType1){
        Integer OCount = locMastService.queryFreeLocMastCount(curRow, locType1, (short)1);
        Short locType2=1;
        for (int i=2;i<equipmentCount+1;i++){
            Integer integer =locMastService.queryFreeLocMastCount(curRow, locType1, (short)i);
            if (OCount<integer){
                OCount=integer;
                locType2=(short)i;
            }
        }
        return locType2;
    }
}