| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.mapper.LocRuleMapper; |
| | | import com.zy.asrs.entity.LocRule; |
| | | import com.zy.asrs.service.LocRuleService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.service.MatService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("locRuleService") |
| | | public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService { |
| | | |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @Override |
| | | public LocRule find(String matnr, String batch, int startRow, int endRow) { |
| | | if (Cools.isEmpty(matnr)) { |
| | | return null; |
| | | } |
| | | Mat mat = matService.selectByMatnr(matnr); |
| | | 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; |
| | | } |
| | | } |