自动化立体仓库 - WCS系统
#
luxiaotao1123
2021-01-16 0d9501a652286d621e81725d15251afc7dba8c6b
src/main/java/com/zy/common/service/CommonService.java
@@ -8,10 +8,12 @@
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.model.LocTypeDto;
import com.zy.common.model.Shelves;
import com.zy.common.model.StartupDto;
import com.zy.core.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;
@@ -22,6 +24,7 @@
 * 货架核心功能
 * Created by vincent on 2020/6/11
 */
@Slf4j
@Service
public class CommonService {
@@ -92,7 +95,7 @@
     * @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);
@@ -129,7 +132,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;
@@ -138,16 +141,18 @@
                // 检测目标库位是否为空库位
                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
                    locMast = shallowLoc;
                    crnNo = locMast.getCrnNo();
                    break;
                    if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) {
                        locMast = shallowLoc;
                        crnNo = locMast.getCrnNo();
                        break;
                    }
                }
            }
        }
        // 靠近摆放规则 --- 空托
        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").ge("row1", sRow).le("row1", eRow));
            if (locMasts.size() > 0) {
                for (LocMast loc : locMasts) {
                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
@@ -228,6 +233,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)) {
@@ -242,15 +250,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);