|
@@ -23,6 +23,7 @@ import com.fjhx.service.stock.StockService;
|
|
|
import com.fjhx.utils.Assert;
|
|
|
import com.fjhx.utils.wrapperUtil.IWrapper;
|
|
|
import com.fjhx.utils.wrapperUtil.KeywordData;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -197,6 +198,12 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
// 获取产品库存
|
|
|
List<Stock> list = list(Wrappers.<Stock>query().in("CONCAT(goods_id, warehouse_id)", map.keySet()));
|
|
|
|
|
|
+ if (typeEnum instanceof OutTypeEnum) {
|
|
|
+ if (list.size() != map.size()) {
|
|
|
+ throw new ServiceException("产品库存不足,出库失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 遍历库存
|
|
|
for (Stock oldStock : list) {
|
|
|
Stock newStock = map.get(oldStock.getGoodsId().toString() + oldStock.getWarehouseId().toString());
|