自动化立体仓库 - WMS系统
zhangc
2024-12-25 97c6071eaf01a3ce1a706cb0114dcb27d255aa3d
src/main/java/com/zy/asrs/service/impl/StaDescServiceImpl.java
@@ -1,9 +1,17 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.StaDesc;
import com.zy.asrs.mapper.StaDescMapper;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.StaDescService;
import com.zy.asrs.utils.Utils;
import com.zy.common.service.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -11,8 +19,65 @@
@Service("staDescService")
public class StaDescServiceImpl extends ServiceImpl<StaDescMapper, StaDesc> implements StaDescService {
    @Autowired
    private LocMastService locMastService;
    @Override
    public List<Integer> queryOutStaNosByLocNo(String locNo, Integer typeNo) {
        return this.baseMapper.queryOutStaNosByLocNo(locNo, typeNo);
        int crnNo = 0;
        int row = Utils.getRow(locNo);
        if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) {
            crnNo = 1;
        }
        if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) {
            crnNo = 3;
        }
        if (row == 1) {
            crnNo = 1;
        }
        if (row == 31 || row == 32) {
            crnNo = 3;
        }
        return this.baseMapper.queryOutStation();
        //return this.baseMapper.queryOutStaNosByCrnNo(crnNo, typeNo);
    }
    @Override
    public StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo) {
        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                .eq("type_no", typeNo)
                .eq("stn_no", stnNo);
        StaDesc staDesc = this.selectOne(wrapper);
        if (staDesc == null) {
            throw new CoolException("出库路径不存在");
        }
        return staDesc;
    }
    @Override
    public StaDesc queryCrnStnAuto(Integer typeNo, Integer crnNo, Integer stnNo) {
        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                .eq("type_no", typeNo)
                .eq("stn_no", stnNo);
                //.eq("crn_no", crnNo);
        StaDesc staDesc = this.selectOne(wrapper);
        if (staDesc == null) {
            wrapper = new EntityWrapper<StaDesc>()
                    .eq("type_no", typeNo);
                    //.eq("crn_no", crnNo);
            List<StaDesc> staDescs = this.selectList(wrapper);
            if (Cools.isEmpty(staDescs)) {
                throw new CoolException("出库路径不存在");
            }
            // todo:luxiaotao
            return staDescs.get(0);
        }
        return staDesc;
    }
    @Override
    public StaDesc queryCrnStn(Integer crnNo) {
        return this.baseMapper.queryCrnStn(crnNo);
    }
}