22 lines
944 B
Python
Executable File
22 lines
944 B
Python
Executable File
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['level'] = kd['BOM层级'].astype(str).str.strip()
|
||
|
||
# 金蝶第一层子项(层级 1.x)
|
||
kd_l1 = kd[kd['level'].str.match(r'^1\.\d+$', na=False)]['code'].tolist()
|
||
print(f"金蝶第一层子项数: {len(kd_l1)}")
|
||
print("金蝶第一层:", sorted(kd_l1))
|
||
|
||
db = pd.read_csv('db_bom.csv', dtype={'ChildMaterialId': str, 'ParentMaterialId': str})
|
||
db['code'] = db['ChildMaterialId'].astype(str).str.strip()
|
||
db_l1 = db[db['Level']==1]['code'].tolist()
|
||
print(f"\n数据库层级1条数: {len(db_l1)}")
|
||
print("数据库层级1:", sorted(db_l1))
|
||
|
||
print(f"\n金蝶独有: {sorted(set(kd_l1)-set(db_l1))}")
|
||
print(f"数据库独有: {sorted(set(db_l1)-set(kd_l1))}")
|
||
print(f"两边相同: {len(set(kd_l1)&set(db_l1))}")
|