30 lines
1.1 KiB
Python
Executable File
30 lines
1.1 KiB
Python
Executable File
# -*- coding: utf-8 -*-
|
|
import pandas as pd
|
|
|
|
kd = pd.read_excel('物料清单正查_1.xlsx', sheet_name='树形单据体')
|
|
kd = kd[kd['子项物料编码'].notna()].copy()
|
|
kd['code'] = kd['子项物料编码'].astype(str).str.strip()
|
|
kd['name'] = kd['物料名称'].astype(str).str.strip()
|
|
kd['lv'] = kd['BOM层级'].astype(str).str.strip()
|
|
|
|
out = []
|
|
# 金蝶中搜这4个子件
|
|
for c in ['100201446', '208220306121', '208230310001', '400802089']:
|
|
hits = kd[kd['code'] == c]
|
|
if len(hits) == 0:
|
|
out.append(f"{c}: 金蝶文件中不存在")
|
|
else:
|
|
for _, r in hits.iterrows():
|
|
out.append(f"{c}: 层级={r['lv']} 名称={r['name']}")
|
|
|
|
# 金蝶 1.11.2 直接子件里有没有 LoRa板/固定钣金 相关
|
|
d4 = kd[kd['lv'].apply(lambda x: x.startswith('1.11.2.') and len(x.split('.')) == 4)]
|
|
for kw in ['LoRa', 'LORA', 'lora', '模块']:
|
|
hits = d4[d4['name'].str.contains(kw, case=False, na=False)]
|
|
for _, r in hits.iterrows():
|
|
out.append(f"关键词[{kw}]: {r['lv']} {r['code']} {r['name']}")
|
|
|
|
with open('cmp_3420b.txt', 'w', encoding='utf-8') as f:
|
|
f.write('\n'.join(out))
|
|
print("done")
|