2 天以前 f350465db70d6f9db9494483ee0cec7793a9007b
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
@@ -163,18 +163,22 @@
            } else {
                // 过程检验/出厂检验:通过关联关系查询销售台账的客户
                customerValue = inspect.getCustomer(); // 默认使用直接存储的客户
                Long workOrderId = inspect.getWorkOrderId();
                if (inspect.getProductMainId() != null) {
                    // 通过报工ID查询工单
                    ProductionProductMain productMain = productionProductMainMapper.selectById(inspect.getProductMainId());
                    if (productMain != null && productMain.getWorkOrderId() != null) {
                        ProductWorkOrder workOrder = productWorkOrderMapper.selectById(productMain.getWorkOrderId());
                        if (workOrder != null && workOrder.getProductOrderId() != null) {
                            ProductOrder productOrder = productOrderMapper.selectById(workOrder.getProductOrderId());
                            if (productOrder != null && productOrder.getSalesLedgerId() != null) {
                                SalesLedger salesLedger = salesLedgerMapper.selectById(productOrder.getSalesLedgerId());
                                if (salesLedger != null && salesLedger.getCustomerName() != null) {
                                    customerValue = salesLedger.getCustomerName();
                                }
                    if (productMain != null) {
                        workOrderId = productMain.getWorkOrderId();
                    }
                }
                if (workOrderId != null) {
                    ProductWorkOrder workOrder = productWorkOrderMapper.selectById(workOrderId);
                    if (workOrder != null && workOrder.getProductOrderId() != null) {
                        ProductOrder productOrder = productOrderMapper.selectById(workOrder.getProductOrderId());
                        if (productOrder != null && productOrder.getSalesLedgerId() != null) {
                            SalesLedger salesLedger = salesLedgerMapper.selectById(productOrder.getSalesLedgerId());
                            if (salesLedger != null && salesLedger.getCustomerName() != null) {
                                customerValue = salesLedger.getCustomerName();
                            }
                        }
                    }