自动化立体仓库 - WMS系统
#
luxiaotao1123
2021-01-12 4b0fec6fd68a7f6ac0f5b226cf11b3e71cbe68e1
src/main/java/com/zy/common/service/CommonService.java
@@ -7,9 +7,11 @@
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -20,6 +22,7 @@
 * 货架核心功能
 * Created by vincent on 2020/6/11
 */
@Slf4j
@Service
public class CommonService {
@@ -86,11 +89,11 @@
     * @param whsType 类型 1:双深式货架
     * @param staDescId 路径工作类型
     * @param sourceStaNo 源站
     * @param matNos 物料号集合
     * @param matNos 商品编号集合
     * @return locNo 检索到的库位号
     */
    @Transactional
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto) {
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) {
        StartupDto startupDto = new StartupDto();
        // 生成工作号
        int workNo = getWorkNo(0);
@@ -127,7 +130,7 @@
        // 靠近摆放规则 --- 同天同规格物料
        if (!Cools.isEmpty(matNos)) {
            List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0));
            List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow);
            for (String locNo : locNos) {
                if (Utils.isShallowLoc(slaveProperties, locNo)) {
                    continue;
@@ -145,7 +148,7 @@
        // 靠近摆放规则 --- 空托
        if (staDescId == 10) {
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D"));
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").gt("row1", sRow).lt("row1", eRow));
            if (locMasts.size() > 0) {
                for (LocMast loc : locMasts) {
                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
@@ -226,6 +229,9 @@
        BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
        int inQty = staNo.getInQty()==null?0:staNo.getInQty();
        if (staNo.getAutoing().equals("Y") && inQty<2) {
            // 更新库位排号
            rowLastno.setCurrentRow(curRow);
            rowLastnoService.updateById(rowLastno);
            // 查找库位
            if (locMast == null) {
                if (Utils.isShallowLoc(slaveProperties, curRow)) {
@@ -240,15 +246,16 @@
                // 轻货物找轻库位为空时,可以去找重库位仓
                if (locTypeDto.getLocType1() == 1) {
                    locTypeDto.setLocType1((short) 2);
                    return getLocNo(null, staDescId, sourceStaNo, matNos, locTypeDto);
                    return getLocNo(null, staDescId, sourceStaNo, matNos, locTypeDto, times);
                }
                throw new CoolException("没有空库位");
                if (times >= rowCount) {
                    log.error("没有空库位");
                    throw new CoolException("没有空库位");
                }
                times = times + 1;
                return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
            }
            String locNo = locMast.getLocNo();
            // 更新库位排号
            rowLastno.setCurrentRow(curRow);
            rowLastnoService.updateById(rowLastno);
            // 返回dto
            startupDto.setCrnNo(crnNo);