feat: refresh material names in background every two days

This commit is contained in:
ar51
2026-10-09 10:44:03 +08:00
parent cf31549415
commit 512e434a2f
11 changed files with 406 additions and 37 deletions

View File

@@ -131,7 +131,7 @@ Do not use temporary curl, WebFetch, or any API method outside the controlled sc
- For every usable model, add `缺料物料明细`. First read `物料名称`, or `缺料物料名称` when the former is absent or blank, from `data.采购信息.缺料明细[]`. If neither name is usable, look up that shortage record's `缺料物料` code in the Git-synchronized `data/material_names.json` cache.
- Preserve the API order, omit duplicate names, and display names separated by `;`. Include both reducer and non-reducer shortage names.
- Do not display material codes in the names list, infer names from code prefixes, or list materials from the complete BOM. The lookup only enriches API-returned shortages; it never identifies shortages itself. This added detail contains no codes, quantities, or specifications.
- Read the local dictionary once per bot process and use in-memory lookups thereafter. Never call Kingdee or refresh/write the cache while replying to Feishu messages. Pulling a new cache requires a bot restart to reload it.
- Reuse the local dictionary in memory and reload it when the file's timestamp, size or inode changes. Never call Kingdee or refresh/write the cache while replying to Feishu messages. Background cache updates take effect on the next lookup without restarting the bot.
- If a name is absent from both the API and local cache, retain the available names and state how many records could not be resolved. Report missing or invalid cache files explicitly. Ask for cache maintenance outside Feishu; do not invent names or treat unresolved records as no shortage.
- If the shortage list is empty, state `API未返回缺料记录`; missing shortage data or an invalid BOM retains the existing unavailable-data reminder. Do not infer that missing data means no shortage.