Browse Source

物料删除前检查物料是否存在

chenw 7 years ago
parent
commit
8a6313177c

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -450,6 +450,10 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
 
     @Override
     public boolean deleteByPrimaryKey(Long id) {
+        Product productTemp = getMapper().selectByPrimaryKey(id);
+        if (ObjectUtils.isEmpty(productTemp)){
+            throw new BizException(BizExceptionCode.ORDER_NOT_EXITTS);
+        }
         //校验物料是否已经在使用状态(采购单、销售单、BOM、出入库单)
         validProductOperation(id, BizExceptionCode.BIZ_RELDELETE_DELETEPROD);
         //校验是否存在关联单据