| | |
| | | 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(); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |