feat: 新增单位工程级工料机汇总(lme_uw)并将项目工料机数据源切换为项目级汇总

This commit is contained in:
lianjianwei2024
2026-10-12 08:32:34 +08:00
parent ced87bde6f
commit fb1875e8b2
25 changed files with 1775 additions and 190 deletions

View File

@@ -1,15 +1,25 @@
# -*- coding: utf-8 -*-
"""一次性核查:lmes / norm_res 在测试库里的真实行数(只读,不写任何东西)。"""
import glob
"""核查:lmes / norm_res 在测试库里的真实行数(只读,不写任何东西)。
2026-10-11:路径改走 gen_testdata.find_data_dir()(旧 glob 指向改名前的目录必 IndexError)。"""
import os
import sqlite3
import sys
sys.stdout.reconfigure(errors="replace")
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, HERE)
import gen_testdata as G
h = glob.glob("D:/Pricing review*/\u9020\u4ef7\u5ba1\u6838/data/history-test.db")[0]
s = glob.glob("D:/Pricing review*/\u9020\u4ef7\u5ba1\u6838/data/session-test.db")[0]
dd = G.find_data_dir()
if not dd:
print("!! 找不到数据目录(history.db)")
sys.exit(1)
h, s = G.db_paths(dd)[1], G.db_paths(dd)[3]
print("数据目录:", dd)
if not os.path.exists(h):
print("测试库 history-test.db 不存在——先在控制台生成一批。")
sys.exit(1)
print("history-test:", h)
print("session-test:", s)
hc = sqlite3.connect(h, timeout=10)
q = "FROM batches WHERE is_mock=1 AND Name LIKE '\u6d4b\u8bd5%'"
@@ -46,6 +56,10 @@ if bid:
print(" norm_res 行数:", row[0])
hc.close()
if not os.path.exists(s):
print("\nsession-test.db 不存在(工作台侧未生成),跳过。")
sys.exit(0)
print("\nsession-test:", s)
sc = sqlite3.connect(s, timeout=10)
print("\n== session-test.db 真实行数 ==")
for name, sql in {