feat: show shortage names and explain unavailable delivery results

This commit is contained in:
ar51
2026-10-08 16:37:20 +08:00
parent f35351d540
commit ad7c45d2d6
4 changed files with 361 additions and 34 deletions

View File

@@ -26,6 +26,8 @@ Expected:
- Feishu output uses rich-text `post`; the report title, overall-judgment heading, numbered candidate headings, and unavailable-candidate heading are bold;
- the judgment level and fixed disclaimer provide the global human-review boundary;
- inventory output is limited to summary-level available quantity and coverage; non-reducer shortage output never exposes material codes or raw ERP details;
- each usable model includes `缺料物料明细` listing only names from the API shortage records (`物料名称`, with `缺料物料名称` as the fallback), preserving order and deduplicating names; the same behavior applies to continuation replies;
- missing names are reported explicitly without substituting codes or inferring names; an empty shortage list says `API未返回缺料记录`, and missing shortage data or invalid BOM keeps the unavailable-data reminder;
- reducer shortages are the sole exception: when `缺料物料` starts with `20.30.`, output only the reducer code, inventory, inspection, in-transit, existing-demand quantities, and in-transit coverage conclusion in the Skill-defined order;
- shortage items outside the `20.30.` reducer prefix never expose their material codes or quantity details;
- result is marked as internal candidate;
@@ -38,7 +40,7 @@ Expected:
- the appended record contains query metadata, model parsing, and a complete Markdown table with one row per model queried in the current batch;
- each future appended candidate row records the same query-completion time in `YYYY-MM-DD HH:mm:ss +0800` form (with the actual local UTC offset), without rewriting or backfilling historical records;
- record-table columns follow this order: 序号、记录时间、型号、推荐类型、差异项、API状态、AM516预测交期、可用库存、主导因素;
- unavailable candidates remain in their original rule order and are recorded as `❌ 不存在` with unavailable result fields shown as `—`;
- unavailable candidates remain in their original rule order and are recorded as `❌ 不可用` with unavailable result fields shown as `—`; lack of a result does not itself establish that the model does not exist;
## Sample 1B | API Workdays And Final Delivery Date
@@ -51,6 +53,9 @@ Rules and expected results:
- a valid API date in another calendar year remains usable without a local holiday calendar;
- accept zero workdays; reject negative, fractional, boolean, or non-numeric workday values and invalid dates;
- if either new field is missing or invalid, report the lead-time result as unavailable instead of falling back to old fields or estimating;
- a stopped original-model reply includes `原因:` identifying each missing, empty, or invalid field and a suggestion to check the API data; no record is appended;
- each unavailable candidate is listed with its own reason; HTTP 404 or missing fields must not be summarized as a confirmed nonexistent model;
- controlled-query failures show their safe category (configuration, authentication/permissions, HTTP, TLS, DNS/network, timeout, or JSON format), without displaying raw response bodies or secret-bearing error strings;
- choose the fastest candidate using the API workday count, even when the natural-day totals would rank candidates differently.
## Sample 1A | Continue With Other Candidates

View File

@@ -118,6 +118,22 @@ Do not use temporary curl, WebFetch, or any API method outside the controlled sc
- Missing or unsupported models count as queried positions and remain summarized
under `不可用候选`; do not silently skip them to pull later candidates forward.
## Unavailable Result Reasons
- When the original model has no usable result, stop before recording and include a separate `原因:` line. Identify missing or empty `data` / `交期汇总` objects, or each missing, empty, or invalid required workday/date field. If old lead-time fields were returned, explain that they cannot substitute for the required fields.
- Mention missing BOM only when the response explicitly marks it as absent. Field omissions alone do not establish that a model does not exist or that materials are short.
- Preserve a separate reason for every unavailable candidate in initial and continuation replies; do not merge them into `不存在或接口未返回交期汇总`.
- For controlled-query failures, explain the known category: missing API Key, HTTP status and its meaning, TLS validation, DNS/connection failure, timeout, or response-format failure. Do not copy raw error messages, response bodies, secrets, or ERP details into replies.
- If no deeper service-side cause can be confirmed, explicitly say it was not provided and needs runtime/service-log verification. Do not invent a business cause. Keep the fixed disclaimer once at the end.
## Shortage Material Names Rule
- For every usable model, add `缺料物料明细` using only names from `data.采购信息.缺料明细[]`. Read `物料名称`, or `缺料物料名称` when the former is absent or blank.
- Preserve the API order, omit duplicate names, and display names separated by `;`. Include both reducer and non-reducer shortage names.
- Do not substitute material codes, infer names from code prefixes, or list materials from the complete BOM. This added detail contains no codes, quantities, or specifications.
- If some shortage records lack a nonblank string name, retain the available names and state how many records did not return a name. If all names are missing, state `N项缺料记录未返回物料名称,需人工复核`.
- If the shortage list is empty, state `API未返回缺料记录`; missing shortage data or an invalid BOM retains the existing unavailable-data reminder. Do not infer that missing data means no shortage.
## Reducer Shortage Detail Rule
- Treat a shortage item as a reducer only when `data.采购信息.缺料明细[].缺料物料` starts with `20.30.`.
@@ -172,6 +188,7 @@ Use this field order for a successful Feishu report:
- 主导因素:{main factor}
- 推荐理由:{rule-based recommendation reason}
- 差异项:{field changes formatted as `字段 原值→新值`; join multiple changes with `;`, for example `编码器 HS→HM;品牌 DZ→LF`}
- 缺料物料明细:{shortage material names only, separated by `;`; report missing names explicitly}
- 减速器缺料展开:{only for shortage material codes starting with `20.30.`; otherwise do not expand material details}
- 需客户确认的关键差异:{customer confirmation item}