|
|
|
@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.unit.exception.MesException;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.utils.BeanMapUtilsExt;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
@ -10,15 +11,21 @@ import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartType;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartTypeRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.cglib.beans.BeanMap;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
@ -27,6 +34,9 @@ public class MesPartService extends BaseMesService<MesPart> implements IMesPartS
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartRepository mesPartRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartTypeRepository mesPartTypeRepository;
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesPart bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getPartNo(), "partNo", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getPartName(), "partName", packBean);
|
|
|
|
@ -35,6 +45,22 @@ public class MesPartService extends BaseMesService<MesPart> implements IMesPartS
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setBeanModel(List<MesPart> list) {
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<String> typeCodeList = list.stream().map(MesPart::getPartTypeCode).filter(t -> !StringUtils.isEmpty(t)).distinct().collect(Collectors.toList());
|
|
|
|
|
if(!CollectionUtils.isEmpty(typeCodeList)){
|
|
|
|
|
Map<String, MesPartType> beanMap = BeanMapUtilsExt.getBeanMap(mesPartTypeRepository, "partTypeCode", list.iterator().next().getOrganizeCode(),typeCodeList, "零件类型");
|
|
|
|
|
list.forEach(t->{
|
|
|
|
|
if (beanMap.containsKey(t.getPartTypeCode())) {
|
|
|
|
|
t.setPartTypeName(beanMap.get(t.getPartTypeCode()).getPartTypeName());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MesPart getPartByPartNo(String partNo, String organizeCode) {
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(partNo, "partNo", ddlPackBean);
|
|
|
|
|