|
|
@@ -396,97 +396,99 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|
|
}
|
|
|
List<Product> products = productDao.findByEnUUAndCode(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
prodInfo.getCode());
|
|
|
- if (prodInfo.getCmpUuId() != null) {
|
|
|
- Component component = componentDao.findByUuid(prodInfo.getCmpUuId());
|
|
|
- if (component != null) {
|
|
|
- prodInfo.setPbranden(component.getBrand().getNameEn());
|
|
|
- prodInfo.setPbrand(component.getBrand().getNameCn());
|
|
|
- prodInfo.setKind(component.getKind().getNameCn());
|
|
|
- prodInfo.setPcmpcode(component.getCode());
|
|
|
- prodInfo.setKinden(component.getKind().getNameEn());
|
|
|
- prodInfo.setStandard(Constant.YES);
|
|
|
- }
|
|
|
- } else {
|
|
|
- List<Component> components = componentDao.findByCode(prodInfo.getCmpCode());
|
|
|
- if (components.size() == 1) { // 存在一个,全部赋值成标准数据
|
|
|
- Component comp = components.get(0);
|
|
|
- prodInfo.setKind(comp.getKind().getNameCn());
|
|
|
- prodInfo.setKinden(comp.getKind().getNameEn());
|
|
|
- prodInfo.setPbranden(comp.getBrand().getNameEn());
|
|
|
- prodInfo.setPbrand(comp.getBrand().getNameCn());
|
|
|
- prodInfo.setPcmpcode(comp.getCode());
|
|
|
- }
|
|
|
- }
|
|
|
- Product product = new Product();
|
|
|
- if (prodInfo.getCmpUuId() != null) {
|
|
|
- product = productDao.findByEnUUAndCmpUuId(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
- prodInfo.getCmpUuId());
|
|
|
- }
|
|
|
+ // if (prodInfo.getCmpUuId() != null) {
|
|
|
+ // Component component = componentDao.findByUuid(prodInfo.getCmpUuId());
|
|
|
+ // if (component != null) {
|
|
|
+ // prodInfo.setPbranden(component.getBrand().getNameEn());
|
|
|
+ // prodInfo.setPbrand(component.getBrand().getNameCn());
|
|
|
+ // prodInfo.setKind(component.getKind().getNameCn());
|
|
|
+ // prodInfo.setPcmpcode(component.getCode());
|
|
|
+ // prodInfo.setKinden(component.getKind().getNameEn());
|
|
|
+ // prodInfo.setStandard(Constant.YES);
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // List<Component> components =
|
|
|
+ // componentDao.findByCode(prodInfo.getCmpCode());
|
|
|
+ // if (components.size() == 1) { // 存在一个,全部赋值成标准数据
|
|
|
+ // Component comp = components.get(0);
|
|
|
+ // prodInfo.setKind(comp.getKind().getNameCn());
|
|
|
+ // prodInfo.setKinden(comp.getKind().getNameEn());
|
|
|
+ // prodInfo.setPbranden(comp.getBrand().getNameEn());
|
|
|
+ // prodInfo.setPbrand(comp.getBrand().getNameCn());
|
|
|
+ // prodInfo.setPcmpcode(comp.getCode());
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // Product product = new Product();
|
|
|
+ // if (prodInfo.getCmpUuId() != null) {
|
|
|
+ // product =
|
|
|
+ // productDao.findByEnUUAndCmpUuId(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
+ // prodInfo.getCmpUuId());
|
|
|
+ // }
|
|
|
if (!CollectionUtils.isEmpty(products)) {
|
|
|
map.put("error", "物料已存在");
|
|
|
map.put("id", products.get(0).getId());
|
|
|
}
|
|
|
- if (product != null && product.getId() != null) {
|
|
|
- map.put("error", "该器件物料已存在,正在跳转详情页面.....");
|
|
|
- map.put("id", product.getId());
|
|
|
- } else {
|
|
|
- if (CollectionUtils.isEmpty(products)) {
|
|
|
- prodInfo.setUserUU(SystemSession.getUser().getUserUU());
|
|
|
- prodInfo.setEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
- prodInfo.setSourceApp("B2B");
|
|
|
- prodInfo.setStandard(Constant.NO);
|
|
|
- // 进行与标准库进行匹配
|
|
|
- if (prodInfo.getCmpCode() != null && prodInfo.getBrand() != null && prodInfo.getTitle() != null) {
|
|
|
- List<Component> comps = componentDao.findByCode(prodInfo.getCmpCode());
|
|
|
- if (!CollectionUtils.isEmpty(comps)) {
|
|
|
- for (Component cmp : comps) {
|
|
|
- if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
|
|
|
- && cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {// 标准物料
|
|
|
- prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
- prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
- prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
- prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
- prodInfo.setPcmpcode(cmp.getCode());
|
|
|
- prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
- prodInfo.setStandard(Constant.YES);
|
|
|
- } else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
|
|
|
- && cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {
|
|
|
- prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
- prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
- prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
- prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
- prodInfo.setPcmpcode(cmp.getCode());
|
|
|
- prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
- prodInfo.setStandard(Constant.YES);
|
|
|
- } else if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
|
|
|
- && cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
|
|
|
- prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
- prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
- prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
- prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
- prodInfo.setPcmpcode(cmp.getCode());
|
|
|
- prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
- prodInfo.setStandard(Constant.YES);
|
|
|
- }else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
|
|
|
- && cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
|
|
|
- prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
- prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
- prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
- prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
- prodInfo.setPcmpcode(cmp.getCode());
|
|
|
- prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
- prodInfo.setStandard(Constant.YES);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (prodInfo.getCmpCode() == null) {
|
|
|
- prodInfo.setCmpCode(prodInfo.getCode());
|
|
|
- }
|
|
|
- prodInfo = productDao.save(prodInfo);
|
|
|
- map.put("id", prodInfo.getId());
|
|
|
- map.put("success", "物料添加成功");
|
|
|
- }
|
|
|
- }
|
|
|
+// if (product != null && product.getId() != null) {
|
|
|
+// map.put("error", "该器件物料已存在,正在跳转详情页面.....");
|
|
|
+// map.put("id", product.getId());
|
|
|
+// } else {
|
|
|
+// if (CollectionUtils.isEmpty(products)) {
|
|
|
+// prodInfo.setUserUU(SystemSession.getUser().getUserUU());
|
|
|
+// prodInfo.setEnUU(SystemSession.getUser().getEnterprise().getUu());
|
|
|
+// prodInfo.setSourceApp("B2B");
|
|
|
+// prodInfo.setStandard(Constant.NO);
|
|
|
+// // 进行与标准库进行匹配
|
|
|
+// if (prodInfo.getCmpCode() != null && prodInfo.getBrand() != null && prodInfo.getTitle() != null) {
|
|
|
+// List<Component> comps = componentDao.findByCode(prodInfo.getCmpCode());
|
|
|
+// if (!CollectionUtils.isEmpty(comps)) {
|
|
|
+// for (Component cmp : comps) {
|
|
|
+// if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
|
|
|
+// && cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {// 标准物料
|
|
|
+// prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
+// prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
+// prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
+// prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
+// prodInfo.setPcmpcode(cmp.getCode());
|
|
|
+// prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
+// prodInfo.setStandard(Constant.YES);
|
|
|
+// } else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
|
|
|
+// && cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {
|
|
|
+// prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
+// prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
+// prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
+// prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
+// prodInfo.setPcmpcode(cmp.getCode());
|
|
|
+// prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
+// prodInfo.setStandard(Constant.YES);
|
|
|
+// } else if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
|
|
|
+// && cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
|
|
|
+// prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
+// prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
+// prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
+// prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
+// prodInfo.setPcmpcode(cmp.getCode());
|
|
|
+// prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
+// prodInfo.setStandard(Constant.YES);
|
|
|
+// }else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
|
|
|
+// && cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
|
|
|
+// prodInfo.setPbrand(cmp.getBrand().getNameCn());
|
|
|
+// prodInfo.setPbranden(cmp.getBrand().getNameEn());
|
|
|
+// prodInfo.setKind(cmp.getKind().getNameCn());
|
|
|
+// prodInfo.setKinden(cmp.getKind().getNameEn());
|
|
|
+// prodInfo.setPcmpcode(cmp.getCode());
|
|
|
+// prodInfo.setCmpUuId(cmp.getUuid());
|
|
|
+// prodInfo.setStandard(Constant.YES);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else if (prodInfo.getCmpCode() == null) {
|
|
|
+// prodInfo.setCmpCode(prodInfo.getCode());
|
|
|
+// }
|
|
|
+ prodInfo = productDao.save(prodInfo);
|
|
|
+ map.put("id", prodInfo.getId());
|
|
|
+ map.put("success", "物料添加成功");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
return map;
|
|
|
}
|
|
|
|