cl
5 天以前 0c2bb6236abf11a654a9c99d2c9cdba2fee5b227
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/CloudWmsNotifySchedule.java
@@ -249,7 +249,11 @@
        List<InOutResultReportParam> lines = new ArrayList<>();
        try {
            for (CloudWmsNotifyLog row : group) {
                lines.addAll(cloudWmsNotifyLogService.parseInOutLinesFromRequestBody(row.getRequestBody()));
                List<InOutResultReportParam> sub = cloudWmsNotifyLogService.parseInOutLinesFromRequestBody(row.getRequestBody());
                for (InOutResultReportParam line : sub) {
                    applyInboundFromNotifyLogRow(row, line);
                }
                lines.addAll(sub);
            }
        } catch (IOException e) {
            String msg = "反序列化失败: " + e.getMessage();
@@ -292,6 +296,17 @@
                int nextRetry = (row.getRetryCount() == null ? 0 : row.getRetryCount()) + 1;
                setFailResult(row, mergedBody, "请求异常: " + e.getMessage(), nextRetry, now, row.getMaxRetryCount());
            }
        }
    }
    /** 以表字段 inbound_flag 为准,避免 request_body 与落库不一致时误调 stockInCompleted */
    private static void applyInboundFromNotifyLogRow(CloudWmsNotifyLog row, InOutResultReportParam param) {
        if (row == null || param == null) {
            return;
        }
        Integer flag = row.getInboundFlag();
        if (flag != null) {
            param.setInbound(flag == 1);
        }
    }
@@ -346,9 +361,15 @@
                Map<String, Object> res;
                if (root.has("lines") && root.get("lines").isArray()) {
                    InOutResultBatchPayload batch = objectMapper.readValue(requestBody, InOutResultBatchPayload.class);
                    if (batch.getLines() != null) {
                        for (InOutResultReportParam line : batch.getLines()) {
                            applyInboundFromNotifyLogRow(logRecord, line);
                        }
                    }
                    res = cloudWmsReportService.reportInOutResults(batch.getLines());
                } else {
                    InOutResultReportParam param = objectMapper.readValue(requestBody, InOutResultReportParam.class);
                    applyInboundFromNotifyLogRow(logRecord, param);
                    res = cloudWmsReportService.reportInOutResult(param);
                }
                updateAfterNotify(logRecord, requestBody, res, nextRetry, now, effectiveMaxRetry);