|
|
@@ -122,7 +122,41 @@ public class PurcProductServiceImpl implements PurcProductService {
|
|
|
product.setStandard(Constant.YES);
|
|
|
product.setMessage("success");
|
|
|
} else if (components.size() > 1) {
|
|
|
- product.setMessage(product.getCode() + "存在多个品牌,需要手动选择匹配");
|
|
|
+ for (Component cmp : components) {// 器件有多个,先匹配品牌
|
|
|
+ if (cmp.getBrand().getNameEn().equals(product.getBrand())) {// 先匹配英文文
|
|
|
+ product.setPbranden(cmp.getBrand().getNameEn());
|
|
|
+ product.setPbrand(cmp.getBrand().getNameCn());
|
|
|
+ product.setCmpUuId(cmp.getUuid());
|
|
|
+ product.setPcmpcode(cmp.getCode());
|
|
|
+ product.setKind(cmp.getKind().getNameCn());
|
|
|
+ product.setKinden(cmp.getKind().getNameEn());
|
|
|
+ product.setStandard(Constant.YES);
|
|
|
+ product.setMessage("success");
|
|
|
+ } else if (!cmp.getBrand().getNameEn().equals(product.getBrand())
|
|
|
+ && cmp.getBrand().getNameCn().equals(product.getBrand())) {// 在匹配中文
|
|
|
+ product.setPbranden(cmp.getBrand().getNameEn());
|
|
|
+ product.setPbrand(cmp.getBrand().getNameCn());
|
|
|
+ product.setCmpUuId(cmp.getUuid());
|
|
|
+ product.setPcmpcode(cmp.getCode());
|
|
|
+ product.setKind(cmp.getKind().getNameCn());
|
|
|
+ product.setKinden(cmp.getKind().getNameEn());
|
|
|
+ product.setStandard(Constant.YES);
|
|
|
+ product.setMessage("success");
|
|
|
+ }else if(!cmp.getBrand().getNameEn().equals(product.getBrand())
|
|
|
+ && !cmp.getBrand().getNameCn().equals(product.getBrand())
|
|
|
+ && cmp.getKind().getNameCn().equals(product.getTitle())) {// 在匹配类目
|
|
|
+ product.setPbranden(cmp.getBrand().getNameEn());
|
|
|
+ product.setPbrand(cmp.getBrand().getNameCn());
|
|
|
+ product.setCmpUuId(cmp.getUuid());
|
|
|
+ product.setPcmpcode(cmp.getCode());
|
|
|
+ product.setKind(cmp.getKind().getNameCn());
|
|
|
+ product.setKinden(cmp.getKind().getNameEn());
|
|
|
+ product.setStandard(Constant.YES);
|
|
|
+ product.setMessage("success");
|
|
|
+ } else {// 给出提示
|
|
|
+ product.setMessage(product.getCode() + "存在多个品牌,需要手动选择匹配");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
Product oldProd = prods.get(0);
|