dalongxia/update_tools_stock_helper.py
2026-03-04 13:25:48 +08:00

12 lines
984 B
Python

from pathlib import Path
p = Path('/root/.openclaw/workspace/TOOLS.md')
text = p.read_text(encoding='utf-8')
text = text.replace(
'- Returns:\n 1) Product master info (`cost_price`, `board_material`, `preview_pic_url`)\n 2) Last N days shipped/aftersale counts\n 3) Last N days shop distribution by shipped piece count\n',
'- Returns:\n 1) Product master info (`cost_price`, `board_material`, `preview_pic_url`)\n 2) Last N days shipped/aftersale counts\n 3) Last N days shop distribution by shipped piece count\n 4) Last N days daily shipped pieces by SKU\n 5) Stock risk estimation (`available_qty`, `avg_daily_shipped_30d`, `estimated_stockout_days`, `suggest_replenish_qty_to_10d`)\n'
)
if '- Replenishment warning rule: when `estimated_stockout_days <= 10`, mark as urgent restock.' not in text:
text += '\n- Replenishment warning rule: when `estimated_stockout_days <= 10`, mark as urgent restock.\n'
p.write_text(text, encoding='utf-8')
print('updated', p)