18 lines
638 B
Python
Executable File
18 lines
638 B
Python
Executable File
# -*- coding: utf-8 -*-
|
|
import pandas as pd
|
|
|
|
db = pd.read_csv('db_bom2.csv', dtype=str)
|
|
db['code'] = db['ChildMaterialId'].astype(str).str.strip()
|
|
db['parent'] = db['ParentMaterialId'].astype(str).str.strip()
|
|
|
|
out = []
|
|
# 数据库中 9000010400-A01 的63个直接子件完整列表
|
|
sub = db[db['parent'] == '9000010400-A01'].copy()
|
|
out.append(f"数据库 9000010400-A01 直接子件 {len(sub)} 个:")
|
|
for _, r in sub.sort_values('Level').iterrows():
|
|
out.append(f" L{r['Level']} {r['code']} {r['MaterialName']}")
|
|
|
|
with open('cmp_10400_full.txt', 'w', encoding='utf-8') as f:
|
|
f.write('\n'.join(out))
|
|
print("done")
|