自动化立体仓库 - WMS系统
zyx
2023-09-24 c832c7f5d6f8c015d609e044e902e070da5240b0
src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
@@ -2,23 +2,31 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.mapper.LocRuleMapper;
import com.zy.asrs.entity.LocRule;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.LocRuleService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.asrs.service.MatService;
import com.zy.asrs.utils.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service("locRuleService")
public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService {
    @Autowired
    private MatService matService;
    @Autowired
    private LocMastService locMastService;
    @Override
    public LocRule find(String matnr, String batch, int startRow, int endRow) {
    public List<LocRule> find(String matnr) {
        if (Cools.isEmpty(matnr)) {
            return null;
        }
@@ -26,25 +34,29 @@
        if (Cools.isEmpty(mat)) {
            return null;
        }
        LocRule locRule = null;
        do {
            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
            if (null != locRule) {
                break;
            }
            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
            if (null != locRule) {
                break;
            }
            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
            if (null != locRule) {
                break;
            }
            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
            if (null != locRule) {
                break;
            }
        } while (false);
        return locRule;
        return this.baseMapper.selectByMatnr(matnr);
    }
    //找混载库位规则
    @Override
    public List<LocRule> findMixed() {
        return this.baseMapper.selectByMixed(1);//搜索混载库位规则
    }
    //将库位规则转换为库位组(能查出来的都是空库位)
    @Override
    public List<LocMast> locRuleToLocNos(LocRule locRule) {
        return locMastService.queryFreeLocMast2(null, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
    }
    @Override
    public int updateKeepGoByMatnr(String matnr, Integer keepGo) {
        return this.baseMapper.updateKeepGoByMatnr(matnr, keepGo);
    }
    @Override
    public int updateKeepGoByMixed(Integer keepGo) {
        return this.baseMapper.updateKeepGoByMixed(keepGo);
    }
}