feat(lme): 名称规格单位编辑回写与项目级联动显示

This commit is contained in:
lianjianwei2024
2026-10-22 20:12:07 +08:00
parent d09c6150f6
commit 378855cd3e
13 changed files with 1299 additions and 229 deletions

View File

@@ -350,10 +350,11 @@ def test_new_loose_bill_appends_at_end():
assert out.index('Number="B1"') < out.index('Name="末尾新增清单"'), out
def test_amount_aggregate_row_price_never_synced():
"""决策 106 补记九:广联达文件的「人工费」类汇总行是金额汇总行(数量=金额合计、
单价恒 1、单位=元)。会话里合并改价把它的单价改成资源口径(如人工 500 元/工日)
后,导出同步不得回写——原文件 数量×500 会让 Glodon 人工费爆炸外溢(样例工程实测)。"""
def test_amount_aggregate_row_synced_like_normal():
"""决策 169(2026-10-22 主人定):金额汇总行(数量=金额合计、单价=1 的费用科目行)
**视同普通工料机**——编辑/同步/导出回填全部同普通行,价格照写。
原决策 106 补记九「金额行不回写价格」防护撤除:实测爆炸来自旧全量同步的大面积
误写,现通道(merged_codes/field_codes 白名单)只有编辑过的编码才会被写。"""
txt = ('<ConstructionProject>'
'<LabourMaterialsEquipmentsMachinesSummary Number="00010010" Name="人工费" Unit="元"'
' Quantity="4142082.6" NoTaxPrice="1" TaxRate="0" TaxPrice="1"/>'
@@ -364,13 +365,9 @@ def test_amount_aggregate_row_price_never_synced():
("990101015", "履带式推土机", "", "台班", 1232.54, 0.0, 1232.54)]
out = xcos.transform_project(txt, [], [], sync_rows=sync)
agg = re.search(r'<LabourMaterialsEquipmentsMachinesSummary Number="00010010"[^>]*', out).group(0)
assert 'NoTaxPrice="1"' in agg and 'TaxPrice="1"' in agg # 金额汇总行价格不动
assert 'NoTaxPrice="500.0"' in agg and 'TaxPrice="500.0"' in agg # 视同普通行:价格照写
mac = re.search(r'<LabourMaterialsEquipmentsMachinesSummary Number="990101015"[^>]*', out).group(0)
assert 'NoTaxPrice="1232.54"' in mac # 正常资源行照常回写
assert xcos._is_amount_aggregate(
'<LabourMaterialsEquipmentsMachinesSummary Number="X" Unit="元" NoTaxPrice="1"/>')
assert not xcos._is_amount_aggregate(
'<LabourMaterialsEquipmentsMachinesSummary Number="X" Unit="台班" NoTaxPrice="1039.8"/>')
assert 'NoTaxPrice="1232.54"' in mac # 正常资源行照常回写
def test_adoption_carries_express_adjustment(server):