Files
pricing_review/CostReview/app/core/_recheck.py

34 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""主人指正:单位级和项目级都有这4个槽(ExtKind/Concrete/PriceSource/Delivery)。
重新到原文件核实:广联达件单位成员的 LME_SUM 是否真有这4列。"""
import sys
sys.path.insert(0, '.')
import classic_skeleton as cs
import sqlite3
import zipfile
import io
import re
con = sqlite3.connect(r'D:/PricingReview/CostReview/data/history.db')
con.row_factory = sqlite3.Row
r = con.execute("SELECT blob, original_name FROM classic_skel WHERE original_name LIKE '%广联达导出最新%'").fetchone()
src = zipfile.ZipFile(io.BytesIO(r['blob']))
for nm in src.namelist():
if not nm.lower().endswith('.xml'):
continue
t = src.read(nm).decode('utf-8', errors='replace')
if 'LabourMaterialsEquipmentsMachinesSummary' not in t:
continue
print(f'=== 成员: {nm[:40]} ===')
# 找 RGFTZ 行
for m in re.finditer(r'<LabourMaterialsEquipmentsMachinesSummary\b[^>]*Number="RGFTZ"[^>]*>', t):
line = m.group(0)
for col in ('ExtKind', 'Concrete', 'PriceSource', 'Delivery'):
hit = re.search(col + r'="([^"]*)"', line)
print(f' {col} = {hit.group(1) if hit else "(无属性)"}', end=' ')
print()
break
# 也看第 2 条四列行
break