Browse Source

快速出入库报错

3254194295 1 year ago
parent
commit
1d2ec8d88b

+ 7 - 1
platform-service/src/main/java/com/platform/service/store/impl/InStoreFormServiceImpl.java

@@ -411,8 +411,14 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
         SpareStore spareStore = new SpareStore();
         spareStore.setSpareId(model.getSpareId());
         spareStore = spareStoreMapper.selectOne(spareStore);
+        if(spareStore==null){
+            throw new BusinessException("该备件暂未选择库位,请前往备件基础信息修改!");
+        }
+
+        BigDecimal num = spareStore.getNum()==null?new BigDecimal(0):spareStore.getNum();
+        BigDecimal maxStock = sparePartInfo.getMaxStock()==null?new BigDecimal(0):sparePartInfo.getMaxStock();
 
-        if (spareStore.getNum().intValue()+model.getInNum()>sparePartInfo.getMaxStock().intValue()){
+        if (num.intValue()+model.getInNum()>maxStock.intValue()){
             throw new BusinessException("该备件的最大库存量为"+sparePartInfo.getMaxStock()+"目前已超出,请修改入库数量!");
         }
         UserInfo userInfo = SecurityUtils.getUserInfo();