|
|
|
@ -1,13 +1,25 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPackingDefineService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.utils.BeanMapUtilsExt;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.utils.MesException;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCustomer;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPackingDefine;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 包装定义维护
|
|
|
|
@ -20,6 +32,25 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesPackingDefineServiceImpl extends BaseMesService<MesPackingDefine> implements IMesPackingDefineService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustomerRepository customerRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setBeanModel(List<MesPackingDefine> list) {
|
|
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<String> custCodeList = list.stream().filter(o -> !StringUtils.isEmpty(o.getCustCode())).map(MesPackingDefine::getCustCode).filter(t -> !StringUtils.isEmpty(t)).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<String, MesCustomer> beanMap = CollectionUtils.isEmpty(custCodeList) ? new HashMap<>() : BeanMapUtilsExt.getBeanMap(customerRepository, MesExtConstWords.CUST_CODE, list.iterator().next().getOrganizeCode(), custCodeList);
|
|
|
|
|
if(!CollectionUtils.isEmpty(beanMap)){
|
|
|
|
|
list.forEach(t->{
|
|
|
|
|
if (!StringUtils.isEmpty(t.getCustCode()) && beanMap.containsKey(t.getCustCode())) {
|
|
|
|
|
t.setCustName(beanMap.get(t.getCustCode()).getCustName());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setPackQueryBean(MesPackingDefine bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getPackCode(), "packCode", packBean);
|
|
|
|
|