28 lines
1.7 KiB
Python
28 lines
1.7 KiB
Python
from pathlib import Path
|
||
p=Path('/root/.openclaw/workspace/websites.yaml')
|
||
text=p.read_text(encoding='utf-8')
|
||
for kw in [' - 库存\n',' - 缺货\n',' - 补货\n',' - 安全库存\n']:
|
||
if kw not in text:
|
||
text=text.replace(' - 上周\n force_site_id: company-sales-db-analysis\n', ' - 上周\n'+kw+' force_site_id: company-sales-db-analysis\n')
|
||
|
||
for kw in [' - 库存\n',' - 缺货\n',' - 补货\n',' - 安全库存\n']:
|
||
if kw not in text:
|
||
text=text.replace(' - 预览图\n login_required: false\n', ' - 预览图\n'+kw+' login_required: false\n')
|
||
|
||
add_tables = [' - jst_inventoryInfo\n',' - pm_InventoryMonitor\n',' - pm_stockMonitor\n',' - wp_stock\n']
|
||
for t in add_tables:
|
||
if t not in text:
|
||
text=text.replace(' - pc_kfChatLog\n', ' - pc_kfChatLog\n'+t)
|
||
|
||
line=' - 产品信息查询(SKU编码/成本/材质/预览图)优先命令:`product-info "<sku或关键词>" --days 30 --limit 20`\n'
|
||
newline=' - 产品信息/库存查询(SKU编码/成本/材质/预览图/库存/缺货天数)优先命令:`product-info "<sku或关键词>" --days 30 --limit 20`\n'
|
||
if line in text:
|
||
text=text.replace(line,newline)
|
||
|
||
stock_rule=' - 库存预警口径:输出当前库存、近30天日均发货件数、预计缺货天数;若预计缺货天数<=10天,必须标记补货紧急。\n'
|
||
if stock_rule not in text:
|
||
text=text.replace(' - 默认以发货件数/售后件数/订单数作为主口径,金额字段仅作补充说明。\n', ' - 默认以发货件数/售后件数/订单数作为主口径,金额字段仅作补充说明。\n'+stock_rule)
|
||
|
||
p.write_text(text,encoding='utf-8')
|
||
print('updated',p)
|