feat: add LF reducer stock coverage gate

This commit is contained in:
ZE-TH5-AR516 committed 2026-11-27 11:07:48 +08:00
1 parent a017c4b48c
commit f1099c84dd
6 files changed
+391 -19

No files matched your search

@@ -48,6 +48,9 @@ Expected:
- 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 `—`; lack of a result does not itself establish that the model does not exist;
- generated LF candidates pass only when `现货数` and matching LF reducer actual availability cover the original demand; an LF candidate with insufficient combined coverage, missing stock fields, no matched reducer or an inconsistent `需排产数` is absent from the report, fastest comparison, candidate counts and `不可用候选`;
- retained results display `现货数` and `需排产数`; retained LF candidates needing production also display the matched reducer code and reducer actual available quantity;
- overdue unreserved sales orders returned by the API display the sales-order code and a human-review reminder without automatically releasing inventory;
## Sample 1B | API Workdays And Final Delivery Date
@@ -0,0 +1,59 @@
# 来福减速器存量清仓候选门禁
## 背景
来福减速器后续不再采购。使用来福减速器的候选整机只能依据当前整机现货和对应来福减速器实际可用库存推荐,不能用采购在途、待检、固定提前期或未来补货能力补足数量。
## AR836 接口字段
AM516 从 `data.库存信息` 读取以下精简字段:
- `现货数`:候选整机实际可用量。它不是 ERP 库存量,也不是未补扣销售订单占用的可用量。
- `需排产数`:`max(需求数量 - 现货数, 0)`。
- `对应来福减速器编码`:候选型号匹配的来福减速器物料编码。
- `减速器实际可用量`:ERP 即时库存口径下可用于本次生产的数量。
- `逾期待复核销售订单`:可选列表;订单超过要货日期 30 天但仍有待锁库/待预留数量时,包含销售订单编码、要货日期和逾期天数。
`现货数`由 AR836/ERP 侧计算:
```text
整机实际可用量
= max(
ERP可用量(主单位)
- 有效销售订单待锁库/待预留数量(换算为主单位), 0
)
```
AM516 不要求接口返回、也不在报告展示以下中间字段:
- `ERP可用量(主单位)`
- `待锁库待预留数量(主单位)`
- `实际可用量`
- `每台减速器用量`
- `合计可覆盖整机数量`
- `本次需求数量`
- `是否满足推荐门槛`
## 推荐门禁
当前业务按每台关节模组使用一件对应减速器判断:
```text
现货数 = 整机实际可用量
需排产数 = max(需求数量 - 现货数, 0)
需排产数 = 0
-> 整机现货已覆盖,可保留 LF 候选
需排产数 > 0 且 减速器实际可用量 >= 需排产数
-> 整机现货与减速器库存合计覆盖,可保留 LF 候选
其他情况
-> 剔除 LF 候选
```
以下情况同样剔除:字段缺失或不可读、`需排产数`与公式不一致、需要排产但无对应减速器编码。
被剔除的 LF 型号不出现在关节模组交期预估报告、不可用候选、最快交期比较、现货候选或候选统计中。原始输入型号仍作为基准展示,不按“生成候选”处理。
逾期销售订单只触发人工复核提醒,不自动释放库存;在 ERP 完成释放前,其待锁库/待预留数量仍由 AR836 扣除在`现货数`之外。
@@ -215,3 +215,23 @@ AI 生成推荐型号时,应按以下顺序判断:
| 2 | 被剔除型号 | 不推荐 | 剔除项 | 违反强约束或出现中约束降级 | 不进入候选交期计算 |
AI 输出中不得使用“已替代”“已承诺”“可直接交付”等确定性表述;应使用“候选型号”“推荐理由”“需确认差异”“需 AR516 复核”等内部候选表述。
---
## 15. 来福减速器存量清仓门禁(2026-11-27补充)
来福减速器后续不再采购,因此 `(Vx)` 来福候选不能只凭型号配置相似和预测交期进入报告。
对每个来福候选读取 AR836 返回的:
```text
现货数 = 候选整机实际可用量
需排产数 = max(本次需求数量 - 现货数, 0)
```
- `需排产数 = 0`:整机现货覆盖本次需求,可保留候选。
- `需排产数 > 0`:对应来福减速器实际可用量必须大于等于需排产数,才可保留候选。
- 整机现货与减速器库存合计不足,或库存字段缺失、无匹配减速器、数量口径矛盾:剔除候选。
- 被剔除型号不进入交期报告、最快交期比较或不可用候选清单。
- 采购在途、待检、固定提前期和未来采购不得作为放行依据。
- 超过要货日期30天且仍有待锁库/待预留数量的销售订单只提示人工复核,不自动释放现货。
@@ -44,8 +44,8 @@ Stop if:
- 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.
- Inventory accounting and delivery calculation belong to the upstream API. Do not change the API query quantity or issue a second production query. The sole local quantity check is the LF stock gate below, which validates the upstream compact stock fields without recalculating AR836 delivery dates.
- 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, except that a generated LF candidate must be removed when its mandatory stock-gate fields cannot be verified.
- 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 per model. Hide the technical explanation lines `数量传递规则`, `库存覆盖口径` and `API查询数量` in both initial and continuation replies, along with the obsolete local net-demand or production-quantity fields. New internal records preserve the actual API quantities and quantity rules for traceability; leave historical records unchanged.
@@ -126,6 +126,22 @@ Do not use temporary curl, WebFetch, or any API method outside the controlled sc
final batch explicitly states that all rule candidates have been queried.
- Missing or unsupported models count as queried positions and remain summarized
under `不可用候选`; do not silently skip them to pull later candidates forward.
- LF candidates rejected by the stock gate are not API-unavailable candidates. Omit
them entirely from the report, fastest comparison, candidate counts and
`不可用候选`, without pulling later rule positions into the current batch.
## LF Reducer Stock Gate
- Apply this gate only to generated LF candidates, identified by `(Vx)`.
- Read `现货数`、`需排产数`、`对应来福减速器编码`、`减速器实际可用量` from `data.库存信息`.
- `现货数` means the finished product's actual available quantity after AR836 has deducted valid sales-order quantities waiting for locking/reservation.
- Require `需排产数 = max(原始需求数量 - 现货数, 0)`.
- If `需排产数 = 0`, the finished-product stock covers demand and the candidate passes without reducer replenishment.
- Otherwise require a matched LF reducer code and `减速器实际可用量 >= 需排产数`.
- Missing, invalid, inconsistent or insufficient fields reject the LF candidate. Purchasing in transit, inspection stock, fixed lead time and future replenishment must not rescue it.
- Show `现货数` and `需排产数` for retained results. Show the matched LF reducer code and actual available quantity for retained LF candidates that need production.
- If `逾期待复核销售订单` is returned, show its sales-order code and request human review. Never release stock automatically.
- The original input model remains the baseline; this generated-candidate gate does not hide the user's original model.
## Unavailable Result Reasons
@@ -195,7 +211,7 @@ Use this field order for a successful Feishu report:
1. {model}({candidate type and reducer brand})
- 需求数量:{input quantity}台
- AM516预测交期:{API workdays}个工作日,最终交货日期:{API final delivery date}
- 可用库存/覆盖情况:{summary-level inventory and coverage only}
- 现货/排产情况:现货数{actual available finished goods}台;需排产数{remaining production quantity}台
- 主导因素:{main factor}
- 推荐理由:{rule-based recommendation reason}
- 差异项:{field changes formatted as `字段 原值→新值`; join multiple changes with `;`, for example `编码器 HS→HM;品牌 DZ→LF`}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.