Merge remote-tracking branch 'origin/uat-temp-castle-2502070911-44952' into test

tags/yfai-mes-ext-v3.0
王杰 3 months ago
commit 8600e15fe6

@ -18,4 +18,10 @@ public interface IMesCustomerPartService extends IBaseMesService<MesCustomerPart
@ApiOperation("根据零件号获取客户零件关系")
List<MesCustomerPart> findMesCustomerPartByPartNo(String organizeCode,List<String> partNoList);
@ApiOperation("根据客户零件号查询客erp零件号")
String findErpPartNoByCustPartNo(String custPartNo,String organizeCode);
@ApiOperation("根据客户零件号查询客erp零件号")
String findPartNo(String custPartNo,String organizeCode);
}

@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -45,4 +46,28 @@ public class MesCustomerPartController extends BaseMesController<MesCustomerPart
return ResultBean.fail(e);
}
}
@GetMapping(value = "/customer-part/erp-part/one/{custPartNo}/{organizeCode}")
@ApiOperation(value = "根据客户零件号查询出对应erp零件号")
public ResultBean findCustomerPart(@PathVariable("custPartNo") String custPartNo,@PathVariable String organizeCode){
String erpPartNo = "";
try {
erpPartNo = mesCustomerPartService.findErpPartNoByCustPartNo(custPartNo, organizeCode);
} catch (Exception e) {
ResultBean.fail("查询失败").setErrorMsg(e.getMessage());
}
return ResultBean.success("查询成功").setResultObject(erpPartNo);
}
@GetMapping(value = "/customer-part/erp-part/two/{custPartNo}/{organizeCode}")
@ApiOperation(value = "根据客户零件号查询出对应erp零件号,先查询cbr然后查询代开票在查询客户零件号")
public ResultBean findCustomerPartTwo(@PathVariable("custPartNo") String custPartNo,@PathVariable String organizeCode){
String erpPartNo = "";
try {
erpPartNo = mesCustomerPartService.findPartNo(custPartNo, organizeCode);
} catch (Exception e) {
ResultBean.fail("查询失败").setErrorMsg(e.getMessage());
}
return ResultBean.success("查询成功").setResultObject(erpPartNo);
}
}

@ -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 "";
}
}

Loading…
Cancel
Save