Files

23 lines
936 B
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 = []
# 金蝶 1.11.2 直接子件(深度4)中,位置在 LORA 组件附近(1.11.2.45~1.11.2.50)的
d4 = kd[kd['lv'].apply(lambda x: x.startswith('1.11.2.') and len(x.split('.')) == 4)]
out.append(f"1.11.2 直接子件总数: {len(d4)}")
out.append("\n=== 序号 40~55 的直接子件 ===")
for _, r in d4.iterrows():
seq = int(r['lv'].split('.')[-1])
if 40 <= seq <= 55:
out.append(f" {r['lv']} {r['code']} {r['name']} 跳层={r['是否跳层']}")
with open('kd_3420c.txt', 'w', encoding='utf-8') as f:
f.write('\n'.join(out))
print("done")