Parcourir la source

2023年8月1日17:20:08

纪新园 il y a 2 ans
Parent
commit
998437a511
14 fichiers modifiés avec 72 ajouts et 27 suppressions
  1. 6 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/dto/CorpsDescDto.java
  2. 10 0
      blade-service-api/blade-stock-api/src/main/java/org/springblade/stock/feign/IStockGoodsClient.java
  3. 1 1
      blade-service/blade-check/src/main/java/org/springblade/check/service/impl/AuditProecessServiceImpl.java
  4. 6 2
      blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsDescPartsController.java
  5. 3 3
      blade-service/blade-client/src/main/java/org/springblade/client/scheduled/CorpsProfitTimer.java
  6. 3 2
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryItemsServiceImpl.java
  7. 13 6
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java
  8. 2 1
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/controller/OrderController.java
  9. 3 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/OrderItemsExport.java
  10. 1 2
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/feign/OrderDescClient.java
  11. 1 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml
  12. 14 0
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/partsapp/AppPartsController.java
  13. 4 10
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java
  14. 5 0
      blade-service/blade-stock/src/main/java/org/springblade/stock/feign/StockGoodsClient.java

+ 6 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/dto/CorpsDescDto.java

@@ -252,5 +252,11 @@ public class CorpsDescDto implements Serializable {
 	@ApiModelProperty("会员余额")
 	private BigDecimal balanceAmounts;
 
+	/**
+	 * 商城价格
+	 */
+	@ApiModelProperty(value = "商城价格")
+	private String shoppingMall;
+
 
 }

+ 10 - 0
blade-service-api/blade-stock-api/src/main/java/org/springblade/stock/feign/IStockGoodsClient.java

@@ -42,6 +42,7 @@ public interface IStockGoodsClient {
 	String UPDATE_STOCK_LIST = API_PREFIX + "/updateStockList";
 	String SAVE_OR_UPDATE_BATCH_LIST = API_PREFIX + "/saveOrUpdateBatchList";
 	String SAVE_OR_UPDATE_BATCH_LIST_LOG = API_PREFIX + "/saveOrUpdateBatchListLog";
+	String REMOVE_STOCK = API_PREFIX + "/removeStock";
 
 
 	@GetMapping("/stockgoods/stocklist")
@@ -262,4 +263,13 @@ public interface IStockGoodsClient {
 	 */
 	@PostMapping(SAVE_OR_UPDATE_BATCH_LIST_LOG)
 	boolean saveOrUpdateBatchListLog(@RequestBody List<StockGoodsLog> stockGoodsLogList);
+
+	/**
+	 * 删除库存
+	 *
+	 * @param stockId
+	 * @return
+	 */
+	@GetMapping(REMOVE_STOCK)
+	R removeStock(@RequestParam("stockId") Long stockId);
 }

+ 1 - 1
blade-service/blade-check/src/main/java/org/springblade/check/service/impl/AuditProecessServiceImpl.java

@@ -321,7 +321,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
 					if("销售审批".equals(auditProecess.getProcessType())){
 						auditProecess.setAuditStatus("A");
 					}else{
-						auditProecess.setAuditStatus("N");
+						auditProecess.setAuditStatus("S");
 					}
 				}else{
 					auditProecess.setAuditStatus("S");

+ 6 - 2
blade-service/blade-client/src/main/java/org/springblade/client/goods/controller/GoodsDescPartsController.java

@@ -150,7 +150,11 @@ public class GoodsDescPartsController extends BladeController {
 	public R delete(@RequestParam(name = "id") String id) {
 		R<StockGoodsVO> r = stockGoodsClient.selectStockParts(null, null, Long.parseLong(id), null, null, null, null, null, null);
 		if (r.isSuccess() && ObjectUtils.isNotNull(r.getData())) {
-			throw new RuntimeException("该产品已有库存不删除");
+			if (new BigDecimal("0.00").compareTo(r.getData().getBalanceQuantity()) != 0) {
+				throw new RuntimeException("该产品已有库存不删除");
+			} else {
+				stockGoodsClient.removeStock(r.getData().getId());
+			}
 		}
 		goodsDescService.removeByIds(Func.toLongList(id));
 		redisClient.basicData("goods");
@@ -192,7 +196,7 @@ public class GoodsDescPartsController extends BladeController {
 		if (r.isSuccess() && r.getData().size() > 0) {
 			return R.fail(500, "该产品已有订单禁用失败");
 		}
-		if (ObjectUtils.isNotNull(goodsDesc.getStatus()) && 1 == goodsDesc.getStatus()){
+		if (ObjectUtils.isNotNull(goodsDesc.getStatus()) && 1 == goodsDesc.getStatus()) {
 			goodsDesc.setUpperFrame("1");
 		}
 		boolean status = goodsDescService.updateById(goodsDesc);

+ 3 - 3
blade-service/blade-client/src/main/java/org/springblade/client/scheduled/CorpsProfitTimer.java

@@ -99,11 +99,11 @@ public class CorpsProfitTimer
 
 /*	*//**
 	 * 达沃特 48 小时内 为付款账单驳回审核 且释放库存
-	 *//*
-	@Scheduled(cron="0 10 * * * ?")
+	 */
+	@Scheduled(cron="0 0 2 * * ?")
 	public void releaseStock() {
 		//获取 48 小时内提交审核未 付款的销售订单
 		orderDescClient.releaseStock(null);
 		//释放库存撤销审核
-	}*/
+	}
 }

+ 3 - 2
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryItemsServiceImpl.java

@@ -259,6 +259,7 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 						goods = stockGoodsList.stream().filter(s ->
 							s.getGoodsId().equals(deliveryItems.getItemId())
 								&& s.getTradeType().equals("GN")
+								&& s.getCorpId().equals(delivery.getCorpId())
 								&& s.getWarehouseId().equals(delivery.getStorageId())
 								&& s.getStorageId().equals(deliveryItems.getStorageId())
 						).findFirst().orElse(null);
@@ -468,8 +469,8 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 		if (stockGoods.getBalanceQuantity().compareTo(deliveryItems.getActualQuantity()) < 0) {
 			throw new RuntimeException("当前结余数量为:" + stockGoods.getBalanceQuantity() + "小于发货数量,发货数量为:" + deliveryItems.getActualQuantity());
 		}
-		if (stockGoods.getSurplusRouteQuantity().compareTo(deliveryItems.getActualQuantity()) < 0) {
-			throw new RuntimeException("当前可用数量为:" + stockGoods.getSurplusRouteQuantity() + "小于发货数量,发货数量为:" + deliveryItems.getActualQuantity());
+		if (stockGoods.getLockingQuantity().compareTo(deliveryItems.getActualQuantity()) < 0) {
+			throw new RuntimeException("当前可用数量为:" + stockGoods.getLockingQuantity() + "小于发货数量,发货数量为:" + deliveryItems.getActualQuantity());
 		}
 		stockGoods.setOutQuantity(stockGoods.getOutQuantity().add(deliveryItems.getActualQuantity()));//出库数量 加
 		if (DeliveryEnum.DELIVER.getType().equals(deliveryType)) {

+ 13 - 6
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java

@@ -960,12 +960,18 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 					throw new SecurityException("贸易类型未指定");
 				}
 				StockGoods stock = model;
-
-				stockGoodsLog.setBalanceQuantityOld(stock.getBalanceQuantity());
-				stockGoodsLog.setSurplusRouteQuantityOld(stock.getSurplusRouteQuantity());
-				stockGoodsLog.setLockingQuantityOld(stock.getLockingQuantity());
-				stockGoodsLog.setStockId(stock.getId());
-				stockGoodsLog.setOrderQuantity(e.getActualQuantity());
+				if ("681169".equals(AuthUtil.getTenantId())){
+					stockGoodsLog.setBalanceQuantityOld(stock.getBalanceQuantity());
+					stockGoodsLog.setSurplusRouteQuantityOld(stock.getSurplusRouteQuantity());
+					stockGoodsLog.setLockingQuantityOld(stock.getLockingQuantity());
+					stockGoodsLog.setStockId(stock.getId());
+					stockGoodsLog.setOrderQuantity(e.getActualQuantity());
+				}else{
+					stockGoodsLog.setBalanceQuantityOld(e.getActualQuantity());
+					stockGoodsLog.setSurplusRouteQuantityOld(e.getActualQuantity());
+					stockGoodsLog.setLockingQuantityOld(e.getActualQuantity());
+					stockGoodsLog.setOrderQuantity(e.getActualQuantity());
+				}
 
 				// 比较2个库存值是否相等
 				//BigDecimal surplusRouteQuantity = stockGoodsVOR.getData().getSurplusRouteQuantity();
@@ -1434,6 +1440,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 				} else if ("GN".equals(delivery.getTradeType())) {
 					model = stockGoodsList.stream().filter(s ->
 						s.getItemType().equals(e.getSpecificationAndModel())
+							&& s.getCorpId().equals(select.getCorpId())
 							&& s.getStorageId().equals(e.getStorageId())//库区
 					).findFirst().orElse(null);
 				} else {

+ 2 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/controller/OrderController.java

@@ -982,6 +982,7 @@ public class OrderController extends BladeController {
 		order.setTenantId(AuthUtil.getTenantId());
 		List<OrderItemsExport> list = orderService.export(order);
 		for (OrderItemsExport item : list) {
+			item.setItemCDescribe(item.getCname() + " " + (item.getItemCDescribe() == null ? "" : item.getItemCDescribe()));
 			StringBuilder itemCapsuleAccessory = new StringBuilder("瓶帽配件: ");
 			StringBuilder itemValveAccessory = new StringBuilder("阀门配件: ");
 			StringBuilder itemAttribute = new StringBuilder("产品属性: ");
@@ -1001,7 +1002,7 @@ public class OrderController extends BladeController {
 				}
 			}
 			//阀门配件
-			if (ObjectUtils.isNotNull(item.getPartsCapValue())) {
+			if (ObjectUtils.isNotNull(item.getPartsValveValue())) {
 				JSONArray objects = JSONArray.parseArray(item.getPartsValveValue());
 				List<OrderParts> categoryConstantInfos = objects.toJavaList(OrderParts.class);
 				if (ObjectUtils.isNotNull(categoryConstantInfos)) {

+ 3 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/excel/OrderItemsExport.java

@@ -23,6 +23,9 @@ public class OrderItemsExport {
 	@ExcelIgnore
 	private String itemId;
 
+	@ExcelIgnore
+	private String cname;
+
 	@ExcelProperty(value = "产品描述(中)")
 	@ColumnWidth(100)
 	private String itemCDescribe;

+ 1 - 2
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/feign/OrderDescClient.java

@@ -9,10 +9,8 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.trade.purchase.order.enums.OrderTypeEnum;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.time.DateUtils;
-import org.springblade.client.entity.CorpsAttn;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.feign.ICorpsDescClient;
-import org.springblade.client.feign.IFeesDescClient;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tenant.annotation.TenantIgnore;
@@ -227,6 +225,7 @@ public class OrderDescClient implements IOrderDescClient {
 		lambdaQueryWrapper.eq(Order::getTradeType, OrderTypeEnum.DOMESTIC.getType());
 		lambdaQueryWrapper.eq(Order::getBillType, OrderTypeEnum.SALES.getType());
 		lambdaQueryWrapper.isNotNull(Order::getCheckDate);
+		lambdaQueryWrapper.ne(Order::getSpecialCheck, 1);
 		lambdaQueryWrapper.eq(Order::getSettlmentAmount, BigDecimal.ZERO);
 		List<Order> list = iOrderService.list(lambdaQueryWrapper);
 		if (CollectionUtils.isNotEmpty(list)) {

+ 1 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml

@@ -3784,6 +3784,7 @@ ORDER BY
         SELECT
             bo.order_no as orderNo,
             boi.item_id as itemId,
+            bgd.cname as cname,
             bgd.cname_description as itemDescribe,
             bgd.name_description as itemCDescribe,
             boi.order_quantity as orderQuantity,

+ 14 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/partsapp/AppPartsController.java

@@ -778,4 +778,18 @@ public class AppPartsController extends BladeController {
 		return R.data(orderService.integralRecord(Condition.getPage(query),order));
 	}
 
+	/**
+	 * 消费记录
+	 */
+	@GetMapping("/consumptionRecords")
+	public R<IPage<Order>> consumptionRecords(Order order, Query query) {
+		LambdaQueryWrapper<Order> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(Order::getTenantId,AuthUtil.getTenantId())
+			.eq(Order::getIsDeleted,0)
+			.eq(Order::getTradeType,OrderTypeEnum.PARTS.getType())
+			.eq(Order::getWhetherIntegral,"0")
+			.eq(Order::getCorpId,order.getCorpId());
+		return R.data(orderService.page(Condition.getPage(query), lambdaQueryWrapper));
+	}
+
 }

+ 4 - 10
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -2933,7 +2933,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						stockGoods.setGoodsId(orderItems.getItemId());
 						stockGoods.setStorageId(orderItems.getStorageId());
 						stockGoods.setPurchasePrice(orderItems.getPrice());
-						stockGoods.setStockPrice(orderItems.getPrice());
+//						stockGoods.setStockPrice(orderItems.getPrice());
 						stockGoods.setBalanceQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
 						stockGoods.setBalanceAmount(new BigDecimal("0.00").subtract(stockGoods.getBalanceQuantity().multiply(orderItems.getPrice())));
 						stockGoods.setSurplusRouteQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
@@ -3195,7 +3195,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				}
 				settlement.setSettlementDate(new Date());
 				settlement.setAccount(order.getAccount());
-				settlement.setAmount(order.getCurrentAmount().add(order.getMemberBalance()));
+				settlement.setAmount(order.getCurrentAmount());
 				settlement.setOverPayment(order.getOverPayment());
 				settlementList.add(settlement);
 				order.setSettlementList(settlementList);
@@ -3779,7 +3779,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 								stockGoods.setGoodsId(orderItems.getItemId());
 								stockGoods.setStorageId(orderItems.getStorageId());
 								stockGoods.setPurchasePrice(orderItems.getPrice());
-								stockGoods.setStockPrice(orderItems.getPrice());
 								stockGoods.setBalanceQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
 								stockGoods.setBalanceAmount(new BigDecimal("0.00").subtract(stockGoods.getBalanceQuantity().multiply(orderItems.getPrice())));
 								stockGoods.setSurplusRouteQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
@@ -3808,9 +3807,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				this.paymentApply(order, order.getBillType(), order.getTradeType());
 //				order.setPurchaseAmount(order.getOrderAmount());
 				order.setDebitAmount(order.getOrderAmount());
-				order.setBalanceAmount(order.getOrderAmount().subtract(order.getMemberBalance()));
+				order.setBalanceAmount(order.getOrderAmount());
 				order.setPurchaseAmount(order.getOrderAmount());
-				order.setSettlmentAmount(order.getOrderAmount().subtract(order.getBalanceAmount()));
+				order.setSettlmentAmount(order.getOrderAmount());
 				baseMapper.updateById(order);
 				// 保存订单文件信息
 				if (CollectionUtils.isNotEmpty(order.getOrderFilesList())) {
@@ -4409,7 +4408,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 									stockGoods.setGoodsId(orderItems.getItemId());
 									stockGoods.setStorageId(orderItems.getStorageId());
 									stockGoods.setPurchasePrice(orderItems.getPrice());
-									stockGoods.setStockPrice(orderItems.getPrice());
 									stockGoods.setBalanceQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
 									stockGoods.setBalanceAmount(new BigDecimal("0.00").subtract(stockGoods.getBalanceQuantity().multiply(orderItems.getPrice())));
 									stockGoods.setSurplusRouteQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
@@ -4636,7 +4634,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 									stockGoods.setGoodsId(orderItems.getItemId());
 									stockGoods.setStorageId(orderItems.getStorageId());
 									stockGoods.setPurchasePrice(orderItems.getPrice());
-									stockGoods.setStockPrice(orderItems.getPrice());
 									stockGoods.setBalanceQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
 									stockGoods.setBalanceAmount(new BigDecimal("0.00").subtract(stockGoods.getBalanceQuantity().multiply(orderItems.getPrice())));
 									stockGoods.setSurplusRouteQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
@@ -6415,7 +6412,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						stockGoods.setGoodsId(orderItems.getItemId());
 						stockGoods.setStorageId(orderItems.getStorageId());
 						stockGoods.setPurchasePrice(orderItems.getPrice());
-						stockGoods.setStockPrice(orderItems.getPrice());
 						stockGoods.setBalanceQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
 						stockGoods.setBalanceAmount(new BigDecimal("0.00").subtract(stockGoods.getBalanceQuantity().multiply(orderItems.getPrice())));
 						stockGoods.setSurplusRouteQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
@@ -7608,7 +7604,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						stockGoods.setGoodsId(orderItems.getItemId());
 						stockGoods.setStorageId(orderItems.getStorageId());
 						stockGoods.setPurchasePrice(orderItems.getPrice());
-						stockGoods.setStockPrice(orderItems.getPrice());
 						stockGoods.setBalanceQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
 						stockGoods.setBalanceAmount(new BigDecimal("0.00").subtract(stockGoods.getBalanceQuantity().multiply(orderItems.getPrice())));
 						stockGoods.setSurplusRouteQuantity(new BigDecimal("0.00").subtract(orderItems.getStorageInQuantity()));
@@ -8225,7 +8220,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 			applyDTO.setChargeMember(order.getChargeMember());
 			applyDTO.setUnit("条");
 			applyDTO.setRemarks(order.getOrderRemark());
-			applyDTO.setSettlementAmount(order.getSettlmentAmount());
 			applyDTO.setMemberBalance(order.getMemberBalance());
 			//获取费用id
 			R<FeesDesc> fees = feesDescClient.getFeesByName("货款");

+ 5 - 0
blade-service/blade-stock/src/main/java/org/springblade/stock/feign/StockGoodsClient.java

@@ -432,6 +432,11 @@ public class StockGoodsClient implements IStockGoodsClient {
 		return stockGoodsLogService.saveOrUpdateBatch(stockGoodsLogList);
 	}
 
+	@Override
+	public R removeStock(Long stockId) {
+		return R.data(stockGoodsLogService.removeById(stockId));
+	}
+
 	/**
 	 * 将Object转换成List类型
 	 *