This commit is contained in:
yumoqing 2026-03-25 14:35:52 +08:00
parent 1101fed2f0
commit e6c8cdacd6
2 changed files with 3 additions and 3 deletions

View File

@ -231,7 +231,7 @@ class PricingProgram:
debug(f'id={ppid} pricing_program not found') debug(f'id={ppid} pricing_program not found')
r = recs[0] r = recs[0]
x = DictObject(** yaml.safe_load(r.pricing_spec)) x = DictObject(** yaml.safe_load(r.pricing_spec))
fpath = write_pattern_xlsx(x) fpath = write_pattern_xlsx(r.name, x)
return fpath return fpath
@staticmethod @staticmethod

View File

@ -19,7 +19,7 @@ def create_colnames():
colnames = create_colnames() colnames = create_colnames()
reverse_colnames = {v:k for k,v in colnames.items()} reverse_colnames = {v:k for k,v in colnames.items()}
def write_pattern_xlsx(fields: dict) -> str: def write_pattern_xlsx(name: str, fields: dict) -> str:
wb = Workbook() wb = Workbook()
ws_data = wb.active ws_data = wb.active
hidden = wb.create_sheet('dict') hidden = wb.create_sheet('dict')
@ -38,7 +38,7 @@ def write_pattern_xlsx(fields: dict) -> str:
opt_id = opt_id + 1 opt_id = opt_id + 1
c += 1 c += 1
fs = FileStorage() fs = FileStorage()
fp = fs._name2path(f'pricing_{getID()}.xlsx') fp = fs._name2path(f'{name}_定价模版.xlsx')
wb.save(fp) wb.save(fp)
return fp return fp