lazhaoqian 3 лет назад
Родитель
Сommit
504e00b0d5

+ 13 - 19
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -940,7 +940,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		}
 		//销售审核不通过释放库存
 		if (order.getBillType().equals("XS") && SecureUtil.getTenantId().equals("681169")){
-				/**===========================Start 审核通过锁定库存=============================*/
+				/**===========================Start 审核驳回释放库存=============================*/
 				//获取此销售订单下,所有明细的库存
 				LambdaQueryWrapper<OrderItems> orderItemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
 				orderItemsLambdaQueryWrapper
@@ -956,12 +956,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						stockGoods.setTenantId(SecureUtil.getTenantId());
 						List<StockGoods> listStockGoods = stockGoodsClient.postListStockByCondition(stockGoods);
 						if (listStockGoods.size() > 1 || CollectionUtils.isEmpty(listStockGoods)) {
-							throw new SecurityException("锁定库存失败:未查询到库存 或者 存在多条库存记录");
+							throw new SecurityException("驳回失败:未查询到库存 或者 存在多条库存记录");
 						}
 						//开始锁定库存,减少可用
 						StockGoods oneStock = stockGoodsClient.getOneStock(stockGoods);
 						if (oneStock == null) {
-							throw new SecurityException("锁定库存失败:未查询到库存信息");
+							throw new SecurityException("驳回失败:未查询到库存信息");
 						}
 						//原单据的订货数量
 						BigDecimal orderQuantity = e.getOrderQuantity();
@@ -971,11 +971,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						BigDecimal lockingQuantity = oneStock.getLockingQuantity();
 
 						//判断比较大小
-						if (orderQuantity.compareTo(surplusRouteQuantity) == 1) {
-							throw new SecurityException("锁定库存失败:原单据的订货数量大于可用库存,无法锁定");
-						}
-						if (surplusRouteQuantity == null) {
-							throw new SecurityException("锁定库存失败:可用库存为空,禁止操作");
+						if (orderQuantity.compareTo(lockingQuantity) == 1) {
+							throw new SecurityException("驳回失败:原单据的订货数量大于锁定库存,无法释放库存");
 						}
 						//增加可用库存
 						oneStock.setSurplusRouteQuantity(surplusRouteQuantity.add(orderQuantity == null ? new BigDecimal("0") : orderQuantity));
@@ -984,7 +981,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						//更新库存
 						R r = stockGoodsClient.updateStock(oneStock);
 						if (!r.isSuccess()) {
-							throw new SecurityException("锁定库存失败: 更新失败");
+							throw new SecurityException("驳回失败: 更新库存失败");
 						}
 					});
 			}
@@ -1011,9 +1008,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		if (order.getStatus() != 1){
 			throw new SecurityException("订单已经开启审批不能撤销");
 		}
-		//销售审核不通过释放库存
+		//销售审核撤销释放库存
 		if (order.getBillType().equals("XS") && SecureUtil.getTenantId().equals("681169")){
-			/**===========================Start 审核通过锁定库存=============================*/
+			/**===========================Start 审核撤销释放库存=============================*/
 			//获取此销售订单下,所有明细的库存
 			LambdaQueryWrapper<OrderItems> orderItemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
 			orderItemsLambdaQueryWrapper
@@ -1029,12 +1026,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					stockGoods.setTenantId(SecureUtil.getTenantId());
 					List<StockGoods> listStockGoods = stockGoodsClient.postListStockByCondition(stockGoods);
 					if (listStockGoods.size() > 1 || CollectionUtils.isEmpty(listStockGoods)) {
-						throw new SecurityException("锁定库存失败:未查询到库存 或者 存在多条库存记录");
+						throw new SecurityException("撤销失败:未查询到库存 或者 存在多条库存记录");
 					}
 					//开始锁定库存,减少可用
 					StockGoods oneStock = stockGoodsClient.getOneStock(stockGoods);
 					if (oneStock == null) {
-						throw new SecurityException("锁定库存失败:未查询到库存信息");
+						throw new SecurityException("撤销失败:未查询到库存信息");
 					}
 					//原单据的订货数量
 					BigDecimal orderQuantity = e.getOrderQuantity();
@@ -1044,11 +1041,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					BigDecimal lockingQuantity = oneStock.getLockingQuantity();
 
 					//判断比较大小
-					if (orderQuantity.compareTo(surplusRouteQuantity) == 1) {
-						throw new SecurityException("锁定库存失败:原单据的订货数量大于可用库存,无法锁定");
-					}
-					if (surplusRouteQuantity == null) {
-						throw new SecurityException("锁定库存失败:可用库存为空,禁止操作");
+					if (orderQuantity.compareTo(lockingQuantity) == 1) {
+						throw new SecurityException("撤销失败:原单据的订货数量大于锁定库存,无法释放 库存");
 					}
 					//增加可用库存
 					oneStock.setSurplusRouteQuantity(surplusRouteQuantity.add(orderQuantity == null ? new BigDecimal("0") : orderQuantity));
@@ -1057,7 +1051,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					//更新库存
 					R r = stockGoodsClient.updateStock(oneStock);
 					if (!r.isSuccess()) {
-						throw new SecurityException("锁定库存失败: 更新失败");
+						throw new SecurityException("撤销失败: 更新库存失败");
 					}
 				});
 			}