Преглед изворни кода

更新判读物料是否标准的方法

hejq пре 7 година
родитељ
комит
6c79c4093d

+ 20 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ProductServiceImpl.java

@@ -2457,7 +2457,7 @@ public class ProductServiceImpl implements ProductService {
         }
         if (null == productInfo.getStandard()) {
             // 判断传入的数据是否是标准的
-            ResultMap criterionResultMap = checkCriterion(product);
+            ResultMap criterionResultMap = checkStandard(product);
             if (Objects.equals(CodeType.ERROR.code(), criterionResultMap.getCode())) {
                 productInfo.setStandard(IntegerConstant.NO_SHORT);
             } else {
@@ -2496,6 +2496,25 @@ public class ProductServiceImpl implements ProductService {
         return ResultMap.success();
     }
 
+    /**
+     * 判断是否是标准物料
+     *
+     * @param product product
+     * @return ResultMap
+     */
+    private ResultMap checkStandard(Product product) {
+        List<Brand> brands = brandDao.findByName(product.getBrand());
+        // 先判断标准品牌信息
+        if (CollectionUtils.isNotEmpty(brands)) {
+            // 判断标准器件信息
+            List<Component> components = componentDao.findByBrandidAndCode(brands.get(0).getId(), product.getCmpCode());
+            if (CollectionUtils.isNotEmpty(components)) {
+               return ResultMap.success();
+            }
+        }
+        return ResultMap.error(new NotFoundException("非标准物料"));
+    }
+
     /**
      * 新增库存记录
      *