feat: account for defects and five-unit batches in delivery forecasts

This commit is contained in:
ar51
2026-10-09 11:20:49 +08:00
parent 512e434a2f
commit de6656dfe0
5 changed files with 137 additions and 9 deletions

View File

@@ -40,6 +40,15 @@ Stop if:
- a Feishu message asks to create, modify, overwrite, rename, move, or delete a project file;
- the user asks for a customer commitment.
## Production Quantity For Forecasting
- Treat the user's quantity as original demand. Before querying any model, divide by the fixed 95% yield (5% defect rate), then round upward to a multiple of five: `production_quantity = 5 × ceil(original_demand / 0.95 / 5)`.
- For example, demand 5 gives `5 / 0.95 = 5.263...`, then a forecast quantity of 10. Demand 10 gives 15; demand 19 gives exactly 20; demand 25 gives 30; demand 95 gives exactly 100.
- Use exact integer arithmetic to avoid rounding an exact batch boundary upward due to floating-point error. Do not replace division by yield with multiplication by 1.05, and do not round to five before applying the yield.
- Send this computed quantity as the controlled script's `--quantity` / API `quantity` for the baseline, all candidates and continuation batches. Calculate from the original demand each time; never adjust an already adjusted quantity again. The low-level query script passes the supplied API quantity unchanged.
- Preserve original demand in the conversation context, reply and record. Display both `需求数量` and `排产测算数量`; state the fixed defect rate and batching rule. Newly appended records include the forecast quantity as metadata without rewriting historical records or changing the candidate table columns.
- Judge inventory coverage against the same production quantity used by the API and label this quantity scope in the reply.
## Feishu Message Trigger Gate
- Enter the query workflow only when one message contains exactly one complete,
@@ -79,7 +88,7 @@ Do not write back rules, Skills, scripts, prompts, configurations, documentation
Use only:
```text
python3 capabilities/am516-delivery-prediction/scripts/delivery_prediction_query_template.py --product "<model>" --quantity <quantity>
python3 capabilities/am516-delivery-prediction/scripts/delivery_prediction_query_template.py --product "<model>" --quantity <production_quantity>
```
Do not use temporary curl, WebFetch, or any API method outside the controlled script.
@@ -170,6 +179,8 @@ Use this field order for a successful Feishu report:
关节模组交期预估报告 | {generation time}
输入需求:{input model},{input quantity}台
排产测算数量:{production quantity}台(不良率5%,按5台的倍数向上取整)
库存覆盖口径:按排产测算数量判断
数据时间戳:{API data timestamp or generation time}
状态:试运行版输出 / 内部候选
判断等级:AM516算法预测参考,需人工复核
@@ -183,7 +194,8 @@ Use this field order for a successful Feishu report:
- 主导因素:{main factor}
1. {model}({candidate type and reducer brand})
- 数量:{quantity}台
- 需求数量:{input quantity}台
- 排产测算数量:{production quantity}台
- AM516预测交期:{API workdays}个工作日,最终交货日期:{API final delivery date}
- 可用库存/覆盖情况:{summary-level inventory and coverage only}
- 主导因素:{main factor}