feat: add pcf analysis web app and api

This commit is contained in:
2026-06-30 14:29:02 +08:00
commit e600a73e48
44 changed files with 12412 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
from pathlib import Path
import xlrd
from app.config import AppConfig
from app.excel_writer import XlsTemplateWriter
from app.pcf_parser import PcfParser
def test_write_sample_xls(tmp_path):
config = AppConfig.load()
parser = PcfParser(config)
files = list(Path("PCF文件样本(1)").glob("*.pcf"))
records, _candidates, _messages = parser.parse_files(files)
output = tmp_path / "result.xls"
XlsTemplateWriter(config).write(records, output)
book = xlrd.open_workbook(output)
sheet = book.sheet_by_name("Sheet1")
assert sheet.cell_value(0, 0) == "单位代码"
assert sheet.nrows >= 170
assert sheet.cell_value(1, 2)
assert sheet.cell_value(1, 3)
assert sheet.cell_value(1, 11) in {"安装", "预制"}