feat: convert AM516 lead times to workdays

This commit is contained in:
ar51
2026-09-03 17:34:42 +08:00
parent fa8aee91b9
commit c7c5c3259c
6 changed files with 332 additions and 27 deletions

View File

@@ -44,8 +44,12 @@ Stop if:
- Enter the query workflow only when one message contains exactly one complete,
rule-valid eRob model and exactly one positive quantity.
- After a valid initial query or valid same-conversation candidate continuation
passes this gate, immediately reply with `👀` before starting the API query so
the sender knows the request was received.
- If the model or quantity is missing, invalid, multiple, or ambiguous, stay
silent: send no Feishu reply, make no API request, and append no record.
silent: send no acknowledgement or other Feishu reply, make no API request,
and append no record.
- An @mention by itself does not bypass this content gate.
- After a valid message passes the gate, API or runtime failures may still return
the bounded internal error response defined by this capability.
@@ -89,9 +93,12 @@ Do not use temporary curl, WebFetch, or any API method outside the controlled sc
## Output Selection
- Prefer `data.交期汇总.AM516预测交期` when the API returns it and AR51 confirms it is usable.
- If AM516 fields are absent, use original API prediction and mark it as original algorithm reference.
- If only total days are available, state the total days and ask for human review.
- Prefer numeric `data.交期汇总.AM516交期`; if it is absent, fall back to numeric `data.交期汇总.总交期`. Treat this value as the original natural-day lead time `N`.
- Convert `N` with `(q, r) = divmod(N, 7)`: `r = 0` gives `q × 5`; `1 ≤ r ≤ 4` gives `q × 5 + MAX(r - 1, 0)`; `5 ≤ r ≤ 6` gives `q × 5 + r - 2`. The result is workday lead time `W`.
- Starting from the local query date, exclude the query date itself and count forward `W` workdays using the configured China statutory calendar. Statutory holidays are not workdays, ordinary Saturdays and Sundays are not workdays, and official makeup Saturdays or Sundays are workdays.
- The configured 2026 calendar follows `国办发明电20257号`. If counting reaches a year whose official calendar is not configured, do not silently estimate a delivery date; mark that calendar year as pending.
- Display the calculated delivery date together with both `N` and `W`, for example `2026-10-09原始31个自然日折算22个工作日`.
- Use `data.交期汇总.AM516预测交期` only as a fallback when the API does not return a usable whole-number natural-day lead time, and explicitly mark that no conversion was performed.
## Candidate Batch Rule
@@ -156,13 +163,13 @@ Use this field order for a successful Feishu report:
总体判断:
- 现货候选:{fully covered candidate or none}
- 最快候选型号:{fastest candidate}
- 最快候选交期:{predicted date and total days}
- 最快候选交期:{calculated delivery date, original natural days, and converted workdays}
- 是否完全覆盖数量:{yes / no / unavailable}
- 主导因素:{main factor}
1. {model}{candidate type and reducer brand}
- 数量:{quantity}台
- AM516预测交期{date and total days}
- AM516预测交期{calculated delivery date}(原始{N}个自然日,折算{W}个工作日)
- 可用库存/覆盖情况:{summary-level inventory and coverage only}
- 主导因素:{main factor}
- 推荐理由:{rule-based recommendation reason}