|
@@ -411,9 +411,15 @@ 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()){
|
|
|
- throw new BusinessException("该备件的最大库存量为"+sparePartInfo.getMaxStock()+"目前已超出,请修改入库数量!");
|
|
|
+ if (num.intValue()+model.getInNum()>maxStock.intValue()){
|
|
|
+ throw new BusinessException("该备件的最大库存量为"+maxStock+"目前已超出,请修改入库数量!");
|
|
|
}
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
Weekend<InStoreForm> weekend = new Weekend<>(InStoreForm.class);
|
|
@@ -425,7 +431,7 @@ public class InStoreFormServiceImpl extends BaseServiceImpl<InStoreFormMapper, I
|
|
|
model.setStatus(InStoreStatusEnum.EXECUTING.getValue());
|
|
|
InStoreForm inStoreForm = super.saveModelByDTO(model);
|
|
|
//修改库存
|
|
|
- spareStore.setNum(new BigDecimal(spareStore.getNum().intValue()+model.getInNum()));
|
|
|
+ spareStore.setNum(new BigDecimal(num.intValue()+model.getInNum()));
|
|
|
spareStoreMapper.updateByPrimaryKeySelective(spareStore);
|
|
|
}
|
|
|
|