|
|
|
@ -6,9 +6,9 @@ import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCarSeriesLoosePart;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerCarModelDetail;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCimGmCbrRuleRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustPartInvoicedRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesCustomerCarModelDetailRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
@ -32,10 +32,15 @@ import java.util.stream.Collectors;
|
|
|
|
|
@Service
|
|
|
|
|
public class MesCustomerPartService extends BaseMesService<MesCustomerPart> implements IMesCustomerPartService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustPartInvoicedRepository partInvoicedRao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCustomerCarModelDetailRepository mesCustomerCarModelDetailRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesCimGmCbrRuleRepository cbrRuleRao;
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesCustomerPart bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getCustPartNo(), "custPartNo", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getErpPartNo(), "erpPartNo", packBean);
|
|
|
|
@ -119,4 +124,49 @@ public class MesCustomerPartService extends BaseMesService<MesCustomerPart> impl
|
|
|
|
|
return baseRDao.findByHqlWhere(packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String findErpPartNoByCustPartNo(String custPartNo, String organizeCode) {
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(custPartNo, "custPartNo", ddlPackBean);
|
|
|
|
|
List<MesCustPartInvoiced> invoicedList = partInvoicedRao.findByHqlTopWhere(ddlPackBean, 1);
|
|
|
|
|
if (!CollectionUtils.isEmpty(invoicedList)) {
|
|
|
|
|
MesCustPartInvoiced mesCustPartInvoiced = invoicedList.get(0);
|
|
|
|
|
return mesCustPartInvoiced.getPartNo();
|
|
|
|
|
}
|
|
|
|
|
DdlPackBean erpPartNoPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(custPartNo, "custPartNo", erpPartNoPackBean);
|
|
|
|
|
List<MesCustomerPart> customerPartList = baseRDao.findByHqlTopWhere(erpPartNoPackBean, 1);
|
|
|
|
|
if (!CollectionUtils.isEmpty(customerPartList)) {
|
|
|
|
|
MesCustomerPart mesCustomerPart = customerPartList.get(0);
|
|
|
|
|
return mesCustomerPart.getCustPartNo();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String findPartNo(String custPartNo, String organizeCode) {
|
|
|
|
|
DdlPackBean cbrPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(custPartNo, "custPartNo", cbrPackBean);
|
|
|
|
|
List<MesCimGmCbrRule> cbrRules = cbrRuleRao.findByHqlTopWhere(cbrPackBean, 1);
|
|
|
|
|
if (!CollectionUtils.isEmpty(cbrRules)) {
|
|
|
|
|
MesCimGmCbrRule cbrRule = cbrRules.get(0);
|
|
|
|
|
return cbrRule.getErpPartNo();
|
|
|
|
|
}
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(custPartNo, "custPartNo", ddlPackBean);
|
|
|
|
|
List<MesCustPartInvoiced> invoicedList = partInvoicedRao.findByHqlTopWhere(ddlPackBean, 1);
|
|
|
|
|
if (!CollectionUtils.isEmpty(invoicedList)) {
|
|
|
|
|
MesCustPartInvoiced mesCustPartInvoiced = invoicedList.get(0);
|
|
|
|
|
return mesCustPartInvoiced.getPartNo();
|
|
|
|
|
}
|
|
|
|
|
DdlPackBean erpPartNoPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(custPartNo, "custPartNo", erpPartNoPackBean);
|
|
|
|
|
List<MesCustomerPart> customerPartList = baseRDao.findByHqlTopWhere(erpPartNoPackBean, 1);
|
|
|
|
|
if (!CollectionUtils.isEmpty(customerPartList)) {
|
|
|
|
|
MesCustomerPart mesCustomerPart = customerPartList.get(0);
|
|
|
|
|
return mesCustomerPart.getCustPartNo();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|