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.StaDescService;
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
|
@Service("staDescService")
|
public class StaDescServiceImpl extends ServiceImpl<StaDescMapper, StaDesc> implements StaDescService {
|
|
@Override
|
public List<Integer> queryOutStaNosByLocNo(String locNo, Integer typeNo) {
|
return this.baseMapper.queryOutStaNosByLocNo(locNo, typeNo);
|
}
|
|
@Override
|
public StaDesc queryCrnStn(Integer typeNo, Integer crnNo, Integer stnNo, Integer row1) {
|
StaDesc staDesc = null;
|
if(crnNo==2){
|
Integer sourceStaNo = 0;
|
switch (stnNo){
|
case 100:
|
sourceStaNo = 104;
|
break;
|
case 200:
|
sourceStaNo = 204;
|
break;
|
case 300:
|
sourceStaNo = row1 < 12 ? 104 : 204;
|
break;
|
}
|
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
|
.eq("type_no", typeNo)
|
.eq("stn_no", stnNo)
|
.eq("crn_no", crnNo)
|
.eq("crn_stn", sourceStaNo);
|
staDesc = this.selectOne(wrapper);
|
} else {
|
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
|
.eq("type_no", typeNo)
|
.eq("stn_no", stnNo)
|
.eq("crn_no", crnNo);
|
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);
|
}
|
|
}
|