huminmin
2026-06-01 0c9ee949b6a7ea8ce2bbc42cbbd2c64fb977e509
src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
@@ -105,6 +105,30 @@
        }
        records.forEach(vo -> {
            vo.setBusinessName(TypeEnums.getLabelByValue(vo.getBusinessType()));
            // 根据业务类型查询对应的单号
            if (vo.getBusinessType() != null && vo.getBusinessId() != null) {
                if (TypeEnums.PURCHASE_APPROVAL.getCode().equals(vo.getBusinessType())) {
                    // 采购审批 - 查询采购单号
                    PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(vo.getBusinessId());
                    System.out.println("业务类型:" + purchaseLedger.getPurchaseContractNumber());
                    if (purchaseLedger != null) {
                        vo.setPurchaseContractNumber(purchaseLedger.getPurchaseContractNumber());
                    }
                } else if (TypeEnums.QUOTATION_APPROVAL.getCode().equals(vo.getBusinessType())) {
                    // 报价审批 - 查询报价单号
                    SalesQuotation salesQuotation = salesQuotationMapper.selectById(vo.getBusinessId());
                    if (salesQuotation != null) {
                        vo.setQuotationNo(salesQuotation.getQuotationNo());
                    }
                } else if (TypeEnums.SHIPPING_APPROVAL.getCode().equals(vo.getBusinessType())) {
                    // 发货审批 - 查询发货单号
                    ShippingInfo shippingInfo = shippingInfoMapper.selectById(vo.getBusinessId());
                    if (shippingInfo != null) {
                        vo.setShippingNo(shippingInfo.getShippingNo());
                    }
                }
            }
        });
        Long currentUserId = SecurityUtils.getUserId();
@@ -229,6 +253,12 @@
        ApprovalInstance instance = getPendingApprovalInstance(approvalInstanceDto.getId());
        if (instance == null) {
            return R.fail("审批实例不存在");
        }
        // 如果前端传递了仓库信息,更新审批实例的仓库字段
        if (StringUtils.hasText(approvalInstanceDto.getWarehouse())) {
            instance.setWarehouse(approvalInstanceDto.getWarehouse());
            this.updateById(instance);
        }
        ApprovalInstanceNode currentNode = approveProcessConfigNodeUtils.getCurrentNode(instance.getId());
@@ -623,7 +653,9 @@
                            salesLedgerProduct.getQuantity(),
                            StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(),
                            purchaseLedger.getId(),
                            purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId()
                            purchaseLedger.getPurchaseContractNumber() + "-" + salesLedgerProduct.getId(),
                            null,
                            instance.getWarehouse()
                    );
                }
            }
@@ -658,8 +690,7 @@
    private void handleShippingApprovalFinished(ApprovalInstance instance, String status) {
        ShippingInfo shippingInfo = shippingInfoMapper.selectOne(
                new LambdaQueryWrapper<ShippingInfo>()
                        .eq(ShippingInfo::getId, instance.getTitle())
                        .orderByDesc(ShippingInfo::getCreateTime)
                        .eq(ShippingInfo::getId, instance.getBusinessId())
                        .last("limit 1")
        );
        if (shippingInfo == null) {