feat: convert AM516 lead times to workdays
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
**日期**:2026-09-02
|
||||
**目的**:将 AM516 交期预测输出的自然日转换为工作日,并据此得到最终交货日期。
|
||||
|
||||
**当前临时处理**:因 AR836 排期较晚,AM516 飞书机器人先在 API 返回后的输出层执行同一换算;不修改 AR836 API 原始数据。待 API 正式提供工作日口径后,应移除本地临时换算,避免重复转换。
|
||||
|
||||
## 一、需求背景
|
||||
|
||||
AM516 当前输出的是自然日交期。销售希望得到工作日口径的交期,即:
|
||||
|
||||
@@ -14,6 +14,7 @@ Expected:
|
||||
|
||||
- model parses successfully;
|
||||
- quantity is accepted;
|
||||
- the bot immediately replies with `👀` after the valid trigger is accepted and before the API query starts;
|
||||
- the controlled script uses the macOS system trust store and keeps TLS verification enabled;
|
||||
- no temporary TLS-bypass parameter is required for the normal happy path;
|
||||
- API script runs;
|
||||
@@ -39,6 +40,18 @@ Expected:
|
||||
- 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 `—`;
|
||||
|
||||
## Sample 1B | Natural Days To Workdays
|
||||
|
||||
Rules and expected results:
|
||||
|
||||
- treat `AM516总交期`, or numeric `总交期` when the AM516 field is absent, as the original natural-day lead time `N`;
|
||||
- convert `N` with the approved quotient-and-remainder rule, including `r = 4` as one rest day and `r = 0` as no remainder workday;
|
||||
- exclude the local query date itself, then count the converted workdays using the configured China statutory workday calendar;
|
||||
- statutory holidays are excluded and official makeup weekend workdays are included;
|
||||
- for a query date of `2026-09-02`, `31` natural days convert to `22` workdays and produce `2026-10-09`;
|
||||
- output `2026-10-09(原始31个自然日,折算22个工作日)` instead of adding a separate National Day exception;
|
||||
- when counting reaches an unconfigured calendar year, do not silently fall back to a Monday-Friday estimate.
|
||||
|
||||
## Sample 1A | Continue With Other Candidates
|
||||
|
||||
Preconditions:
|
||||
@@ -59,6 +72,7 @@ is not required.
|
||||
|
||||
Expected:
|
||||
|
||||
- the bot immediately replies with `👀` after the continuation and active-context gates pass;
|
||||
- the bot reuses the active model and quantity only for that same sender and chat;
|
||||
- the bot queries candidate positions 5-8 in the unchanged rule order;
|
||||
- the original model and candidate positions 1-4 are not queried or displayed again;
|
||||
@@ -83,6 +97,7 @@ eRob110H160I-FHM-18ET[V6]
|
||||
Expected:
|
||||
|
||||
- bot stays silent;
|
||||
- no acknowledgement emoji is sent;
|
||||
- no API call is made;
|
||||
- no record is appended.
|
||||
|
||||
|
||||
@@ -8,20 +8,22 @@
|
||||
4. Confirm a separate trusted AR51 approval record explicitly covers `api.zeroerr-agent.com`, the AM516 use case, and API-key use.
|
||||
5. If that domain-and-permission record is absent, stop before any outbound request; a general functional-test approval is insufficient by itself.
|
||||
6. Use model recommendation rules to generate the complete ordered internal candidate pool.
|
||||
7. Run the controlled script for the original model baseline and only the first four candidate models.
|
||||
8. Summarize the current batch, state how many candidates remain, and invite the same sender to ask naturally for more when candidates remain; exact wording is not required.
|
||||
9. Append a non-secret record.
|
||||
10. Return Feishu-friendly text with the fixed disclaimer.
|
||||
7. Immediately reply with `👀` to acknowledge the valid request.
|
||||
8. Run the controlled script for the original model baseline and only the first four candidate models.
|
||||
9. Convert each numeric natural-day lead time to workdays with the approved quotient-and-remainder rule, then count those workdays from the local query date through the configured China statutory workday calendar. The query date itself is excluded.
|
||||
10. Summarize the current batch, including the original natural days, converted workdays, and calculated delivery date; state how many candidates remain and invite the same sender to ask naturally for more when candidates remain.
|
||||
11. Append a non-secret record.
|
||||
12. Return Feishu-friendly text with the fixed disclaimer.
|
||||
|
||||
## Candidate Continuation
|
||||
|
||||
1. Accept a clear request for more candidates only from the same sender in the same Feishu chat as the active initial query. Equivalent expressions such as `还有吗`、`有没有别的`、`再推荐几个`、`继续`、`下一批` or `more candidates` are valid; no exact phrase is required.
|
||||
2. The in-memory continuation context expires after six hours and is cleared by a bridge restart. If no matching context exists, stay silent and require a new complete model-and-quantity query.
|
||||
3. Query the next four unqueried rule candidates; do not re-query the original baseline or any earlier candidate.
|
||||
3. Immediately reply with `👀`, then query the next four unqueried rule candidates; do not re-query the original baseline or any earlier candidate.
|
||||
4. Missing or unsupported candidates still consume their rule-order positions and remain under `不可用候选`.
|
||||
5. Append one record block for the models queried in this continuation batch, then state whether more candidates remain.
|
||||
6. A new complete model-and-quantity request replaces the earlier continuation context for that sender and chat.
|
||||
7. Keep the dual gate of continuation intent plus valid context: unrelated text such as `more interesting` or `继续查询英语例句` must not trigger the old query.
|
||||
7. Keep the dual gate of continuation intent plus valid context: unrelated text such as `more interesting` or `继续查询英语例句` must not trigger the old query or acknowledgement.
|
||||
|
||||
## Approved Script
|
||||
|
||||
|
||||
@@ -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 `国办发明电〔2025〕7号`. 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}
|
||||
|
||||
Reference in New Issue
Block a user