chore(AdminCost): 移除 COS4 数据结构迁移的一次性脚本与参考资料

This commit is contained in:
lianjianwei2024
2026-11-01 15:27:27 +08:00
parent 386e1ad624
commit f0b1033b12
69 changed files with 5936 additions and 42964 deletions

View File

@@ -38,13 +38,13 @@ def _setup(server, tag):
audit = {"name": proj, "province": H.META["province"], "city": H.META["city"],
"district": H.META["district"], "period_from": H.PERIOD_202607,
"period_to": H.PERIOD_202607, "file_kind": 1}
sid = post(server, "/api/audit", dict(audit, path=hp))["session_id"]
# 决策 243:同一份文件前后台只能存在一边——工作台用同内容双胞胎件
sid = post(server, "/api/audit", dict(audit, path=H.twin_file(server, hp)))["session_id"]
rows = get(server, "/api/session/rows", session_id=sid, type="bill")
bill_id = [r[0] for r in rows["rows"] if r[1] == BILL[0]][0]
bid = _q(server["sessdb"], "SELECT x_batch_id FROM sessions WHERE id=?", (sid,))[0][0]
hc = sqlite3.connect("file:%s?mode=ro" % server["db"], uri=True)
src_id = hc.execute("SELECT id FROM bills WHERE batch_id=? AND Number=? AND Kind IS NULL",
(bid, BILL[0])).fetchone()[0]
(imp["batch_id"], BILL[0])).fetchone()[0]
hc.close()
r = post(server, "/api/session/bill/adopt", {"session_id": sid, "bill_id": bill_id,
"src_bill_id": src_id})
@@ -120,8 +120,16 @@ def test_adopt_gcl_default_and_price_overwrite(server):
zf = _zipfile.ZipFile(_io.BytesIO(resp.content))
cnt = sum(zf.read(n).count(b'Quantity="20.000000"') for n in zf.namelist())
assert cnt == 1, cnt
assert sum(zf.read(n).count(b'Price="600.0"') for n in zf.namelist()) == 1
assert sum(zf.read(n).count(b'Total="6000.0"') for n in zf.namelist()) == 1
# 决策 244 补六:清单行三值 = 数量 3 位、单价/合价 2 位(XML 精确断言;
# 子串计数会误配 NoTaxPrice / WorkContent 的既有 2 位值)
import xml.etree.ElementTree as _ET
_unit_txt = "".join(zf.read(n).decode("utf-8", "replace") for n in zf.namelist()
if n.lower() != "project.xml")
_root = _ET.fromstring(_unit_txt)
_we = _root.find(".//WorkElement")
assert _we is not None
assert _we.attrib["Quantity"] == "20.000" and _we.attrib["Price"] == "600.00" \
and _we.attrib["Total"] == "6000.00", dict(_we.attrib)
def test_norm_unadopt_hard_delete(server):