From 00083c26fde57c0165427ae4cc712d24596fdbc6 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 21 五月 2026 11:09:46 +0800
Subject: [PATCH] refactor(purchase): 删除payment_registration 付款登记 invoice_purchase 发票信息 ticket_registration 来票登记 receipt_payment 回款登记 product_record 采购台账开票记录
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java | 102 ++++++++++++++++++++++----------------------------
1 files changed, 45 insertions(+), 57 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
index ee2ee05..daf5d88 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -14,9 +14,7 @@
import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
import com.ruoyi.purchase.pojo.PurchaseLedger;
import com.ruoyi.quality.mapper.QualityInspectMapper;
-import com.ruoyi.sales.dto.InvoiceRegistrationProductDto;
import com.ruoyi.sales.dto.SalesLedgerProductDto;
-import com.ruoyi.sales.mapper.InvoiceRegistrationProductMapper;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.mapper.ShippingInfoMapper;
@@ -30,7 +28,7 @@
import com.ruoyi.technology.mapper.TechnologyBomStructureMapper;
import com.ruoyi.technology.mapper.TechnologyRoutingMapper;
import com.ruoyi.technology.pojo.TechnologyRouting;
-import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -55,27 +53,42 @@
* @date 2025-05-08
*/
@Service
-@RequiredArgsConstructor
public class SalesLedgerProductServiceImpl extends ServiceImpl<SalesLedgerProductMapper, SalesLedgerProduct> implements ISalesLedgerProductService {
- private final SalesLedgerProductMapper salesLedgerProductMapper;
- private final ProductionAccountMapper productionAccountMapper;
- private final SalesLedgerMapper salesLedgerMapper;
- private final PurchaseLedgerMapper purchaseLedgerMapper;
- private final ProductionPlanMapper productionPlanMapper;
- private final ProductionOperationTaskMapper productionOperationTaskMapper;
- private final ProductionOrderService productionOrderService;
- private final TechnologyRoutingMapper technologyRoutingMapper;
- private final TechnologyBomStructureMapper technologyBomStructureMapper;
- private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
- private final ProductionProductMainMapper productionProductMainMapper;
- private final ProductionProductOutputMapper productionProductOutputMapper;
- private final ProductionProductInputMapper productionProductInputMapper;
- private final QualityInspectMapper qualityInspectMapper;
- private final ShippingInfoMapper shippingInfoMapper;
- private final ShippingInfoServiceImpl shippingInfoService;
- private final StockUtils stockUtils;
- private final StockInventoryMapper stockInventoryMapper;
+ @Autowired
+ private SalesLedgerProductMapper salesLedgerProductMapper;
+ @Autowired
+ private ProductionAccountMapper productionAccountMapper;
+ @Autowired
+ private SalesLedgerMapper salesLedgerMapper;
+ @Autowired
+ private PurchaseLedgerMapper purchaseLedgerMapper;
+ @Autowired
+ private ProductionPlanMapper productionPlanMapper;
+ @Autowired
+ private ProductionOperationTaskMapper productionOperationTaskMapper;
+ @Autowired
+ private ProductionOrderService productionOrderService;
+ @Autowired
+ private TechnologyRoutingMapper technologyRoutingMapper;
+ @Autowired
+ private TechnologyBomStructureMapper technologyBomStructureMapper;
+ @Autowired
+ private ProductionProductMainMapper productionProductMainMapper;
+ @Autowired
+ private ProductionProductOutputMapper productionProductOutputMapper;
+ @Autowired
+ private ProductionProductInputMapper productionProductInputMapper;
+ @Autowired
+ private QualityInspectMapper qualityInspectMapper;
+ @Autowired
+ private ShippingInfoMapper shippingInfoMapper;
+ @Autowired
+ private ShippingInfoServiceImpl shippingInfoService;
+ @Autowired
+ private StockUtils stockUtils;
+ @Autowired
+ private StockInventoryMapper stockInventoryMapper;
@Override
public SalesLedgerProduct selectSalesLedgerProductById(Long id) {
@@ -84,9 +97,6 @@
@Override
public List<SalesLedgerProduct> selectSalesLedgerProductList(SalesLedgerProduct salesLedgerProduct) {
-// LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>();
-// queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedgerProduct.getSalesLedgerId())
-// .eq(SalesLedgerProduct::getType, salesLedgerProduct.getType());
List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct);
if(!CollectionUtils.isEmpty(salesLedgerProducts)){
salesLedgerProducts.forEach(item -> {
@@ -98,39 +108,10 @@
if(shippingInfo != null){
item.setShippingDate(shippingInfo.getShippingDate());
item.setShippingCarNumber(shippingInfo.getShippingCarNumber());
- item.setShippingStatus(shippingInfo.getStatus());
item.setExpressCompany(shippingInfo.getExpressCompany());
item.setExpressNumber(shippingInfo.getExpressNumber());
}
});
- // 寮�绁�
- InvoiceRegistrationProductDto invoiceRegistrationProductDto = new InvoiceRegistrationProductDto();
- invoiceRegistrationProductDto.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId().intValue());
- List<InvoiceRegistrationProductDto> invoiceRegistrationProductDtoList = invoiceRegistrationProductMapper.invoiceRegistrationProductList(invoiceRegistrationProductDto);
- // 缁熻寮�绁ㄧ櫥璁颁骇鍝佺殑宸插紑绁ㄦ暟/宸插紑绁ㄩ噾棰�
- if (!CollectionUtils.isEmpty(invoiceRegistrationProductDtoList)) {
- for (SalesLedgerProduct ledgerProduct : salesLedgerProducts) {
- BigDecimal invoiceNum = BigDecimal.ZERO;
- BigDecimal invoiceAmount = BigDecimal.ZERO;
- BigDecimal noInvoiceNum = BigDecimal.ZERO;
- BigDecimal noInvoiceAmount = BigDecimal.ZERO;
- for (InvoiceRegistrationProductDto registrationProductDto : invoiceRegistrationProductDtoList) {
- if(ledgerProduct.getId().intValue() == registrationProductDto.getSalesLedgerProductId()){
- invoiceNum = invoiceNum.add(registrationProductDto.getInvoiceNum());
- invoiceAmount = invoiceAmount.add(registrationProductDto.getInvoiceAmount());
- }
- }
- noInvoiceNum = ledgerProduct.getQuantity().subtract(invoiceNum);
- noInvoiceAmount = ledgerProduct.getTaxInclusiveTotalPrice().subtract(invoiceAmount);
- ledgerProduct.setInvoiceNum(invoiceNum);
- ledgerProduct.setInvoiceAmount(invoiceAmount);
- ledgerProduct.setNoInvoiceNum(noInvoiceNum);
- ledgerProduct.setNoInvoiceAmount(noInvoiceAmount);
-
-
- }
- }
-
}
return salesLedgerProducts;
}
@@ -211,7 +192,6 @@
result = salesLedgerProductMapper.updateById(salesLedgerProduct);
/*鍒犻櫎瀵瑰簲鐨勭敓浜ф暟鎹苟閲嶆柊鏂板*/
deleteProductionData(Arrays.asList(salesLedgerProduct.getId()));
- // 鍒犻櫎鐢熶骇鏍哥畻鏁版嵁
addProductionData(salesLedgerProduct);
}
@@ -254,12 +234,17 @@
if (!salesLedgerProduct.getIsProduction()) {
return;
}
+ SalesLedger salesLedger = salesLedgerMapper.selectById(salesLedgerProduct.getSalesLedgerId());
ProductionPlan productionPlan = new ProductionPlan();
productionPlan.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId());
- productionPlan.setProductModelId(salesLedgerProduct.getProductModelId());
productionPlan.setSalesLedgerProductId(salesLedgerProduct.getId());
productionPlan.setMpsNo(generateNextPlanNo(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))));
+ productionPlan.setProductModelId(salesLedgerProduct.getProductModelId());
productionPlan.setQtyRequired(salesLedgerProduct.getQuantity());
+ productionPlan.setSource("閿�鍞�");
+ productionPlan.setStatus(0);
+ productionPlan.setRequiredDate(salesLedger.getDeliveryDate());//闇�姹傛棩鏈�=浜よ揣鏃ユ湡
+ productionPlan.setPromisedDeliveryDate(salesLedger.getDeliveryDate());//鎵胯鏃ユ湡=浜よ揣鏃ユ湡
productionPlanMapper.insert(productionPlan);
}
@@ -268,10 +253,13 @@
* 鍒犻櫎鐢熶骇璁″垝
*/
public void deleteProductionData(List<Long> productIds) {
+ if (CollectionUtils.isEmpty(productIds)) {
+ return;
+ }
List<ProductionPlan> productionPlans = productionPlanMapper.selectList(
new LambdaQueryWrapper<ProductionPlan>()
.in(ProductionPlan::getSalesLedgerProductId, productIds.stream().map(Long::intValue).collect(Collectors.toList())));
- if (org.springframework.util.CollectionUtils.isEmpty(productionPlans)) {
+ if (CollectionUtils.isEmpty(productionPlans)) {
return;
}
//濡傛灉鐢熶骇璁″垝宸蹭笅鍙戝垯涓嶈兘鍒犻櫎
--
Gitblit v1.9.3