fix: pass original demand to delivery prediction API
This commit is contained in:
@@ -40,17 +40,14 @@ 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
|
||||
## Original Demand For Forecasting
|
||||
|
||||
- Treat the user's quantity as original demand `D`. Query each model first with `D` through the controlled script to read its own `data.库存信息.可用库存(扣除了待产数量)` (`S`). Never reuse the baseline inventory for another candidate.
|
||||
- Usable finished stock is 100% available: `net_demand = max(D - max(S, 0), 0)`. Apply the fixed 95% yield only to this net demand, then round upward to five: `production_quantity = 5 × ceil(net_demand / 0.95 / 5)`. A zero net demand requires zero production.
|
||||
- For demand 24 and inventory 6, net demand is 18 and production quantity is 20. With inventory 0 it is 30; with inventory 24 or more it is 0. Net demand 19 gives exactly 20, and net demand 95 gives exactly 100.
|
||||
- Use exact integer arithmetic. Missing, boolean, fractional or non-finite stock is unavailable, never zero. A negative integer stock balance contributes zero usable stock.
|
||||
- If stock covers original demand, retain the first API's stock-delivery result and do not send a zero-quantity API request. Otherwise query with the computed production quantity and use that response's workdays/date and shortage information. Reuse the first response if production quantity equals original demand.
|
||||
- The existing interface uses `quantity` both for the finished-stock shortcut and production/material calculations. If stock partially covers original demand but is at least the computed production quantity, report the forecast as unavailable: a production-quantity request would falsely take the stock shortcut. The API must support separate original demand and production quantity for this case. Do not add stock back to production quantity, which would inflate material requirements, or invent a date locally.
|
||||
- If stock differs between the first and production queries, report the result as unavailable and request a fresh query; do not mix snapshots or retry automatically.
|
||||
- Preserve original demand in continuation context. Every newly queried candidate repeats this calculation using its own current stock; never apply yield twice or reuse an earlier candidate's result.
|
||||
- Replies show original demand, net demand and production quantity per model. Judge inventory coverage against original demand. Record per-model net demand, production quantity and final API quantity as metadata, retaining the existing candidate table columns and leaving historical records unchanged.
|
||||
- AR51 confirmed on 2026-10-15 that the upstream API already accounts for available inventory and explicitly cancelled local inventory deduction, 95% yield adjustment and rounding to five. Follow `docs/production_quantity.md`.
|
||||
- Treat the user's positive integer quantity as original demand `D`. Query each model exactly once through the controlled script with `quantity=D`, unchanged. Preserve `D` in continuation context and pass it unchanged for every newly queried candidate.
|
||||
- Inventory accounting and delivery calculation belong to the upstream API. Do not calculate a local production quantity, send a reduced or inflated quantity, or issue a second production query.
|
||||
- Display each model's own returned inventory coverage against original demand. A displayed inventory gap is informational and must not become a new API quantity. Missing or invalid stock means unknown coverage, never zero; do not discard valid API workdays/date solely because inventory display is unavailable.
|
||||
- Remove the obsolete partial-stock/production-quantity shortcut rejection. API failures and missing or invalid workdays/date retain existing error handling.
|
||||
- Replies show original demand and actual API query quantity per model, without local net-demand or production-quantity fields. New records preserve the same actual API quantities; leave historical records unchanged.
|
||||
|
||||
## Feishu Message Trigger Gate
|
||||
|
||||
@@ -91,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 <original_demand_or_production_quantity>
|
||||
python3 capabilities/am516-delivery-prediction/scripts/delivery_prediction_query_template.py --product "<model>" --quantity <original_demand>
|
||||
```
|
||||
|
||||
Do not use temporary curl, WebFetch, or any API method outside the controlled script.
|
||||
@@ -182,8 +179,8 @@ Use this field order for a successful Feishu report:
|
||||
关节模组交期预估报告 | {generation time}
|
||||
|
||||
输入需求:{input model},{input quantity}台
|
||||
排产测算规则:各型号先扣可用库存,再除以95%合格率并向上取5台的倍数;库存足量时排产为0
|
||||
库存覆盖口径:按原始需求数量判断(可用库存按100%可用)
|
||||
数量传递规则:原始需求原样传入API,库存及交期测算由API处理
|
||||
库存覆盖口径:按原始需求数量展示API返回的库存覆盖情况
|
||||
数据时间戳:{API data timestamp or generation time}
|
||||
状态:试运行版输出 / 内部候选
|
||||
判断等级:AM516算法预测参考,需人工复核
|
||||
@@ -198,8 +195,7 @@ Use this field order for a successful Feishu report:
|
||||
|
||||
1. {model}({candidate type and reducer brand})
|
||||
- 需求数量:{input quantity}台
|
||||
- 扣库存后净需求:{model net demand}台
|
||||
- 排产测算数量:{model production quantity}台
|
||||
- API查询数量:{original demand}台
|
||||
- AM516预测交期:{API workdays}个工作日,最终交货日期:{API final delivery date}
|
||||
- 可用库存/覆盖情况:{summary-level inventory and coverage only}
|
||||
- 主导因素:{main factor}
|
||||
|
||||
Reference in New Issue
Block a user