package com.zy.asrs.service.impl;
|
|
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) {
|
if (Cools.isEmpty(matnr)) {
|
return null;
|
}
|
Mat mat = matService.selectByMatnr(matnr);
|
if (Cools.isEmpty(mat)) {
|
return null;
|
}
|
|
return this.baseMapper.selectByMatnr(matnr);
|
}
|
|
//找混载库位规则
|
@Override
|
public LocRule findMixed() {
|
return this.baseMapper.selectByMixed(1);//搜索混载库位规则
|
}
|
|
//将库位规则转换为库位组
|
@Override
|
public List<LocMast> locRuleToLocNos(LocRule locRule) {
|
ArrayList<String> locNos = new ArrayList<>();
|
//将所有符合混载规则的库位号进行存储
|
Integer rowBeg = locRule.getRowBeg();
|
Integer rowEnd = locRule.getRowEnd();
|
|
Integer bayBeg = locRule.getBayBeg();
|
Integer bayEnd = locRule.getBayEnd();
|
|
Integer levBeg = locRule.getLevBeg();
|
Integer levEnd = locRule.getLevEnd();
|
|
for (int i = rowBeg; i <= rowEnd; i++) {
|
for (int j = bayBeg; j <= bayEnd; j++) {
|
for (int k = levBeg; k <= levEnd; k++) {
|
String locNo = Utils.getLocNo(i, j, k);
|
locNos.add(locNo);
|
}
|
}
|
}
|
|
return locMastService.selectEmptyByLocNos(locNos);
|
}
|
}
|