台账按月接口导出并追加目标工作簿;整表刷新「预支办结流程」供单据头 XLOOKUP 取收款信息;发起前对账命中回填已付;按台账口径新旧系统分流;建单后套打 ERP 单据 + 单子传递打印;含离线自检与打包脚本。
36 lines
1.6 KiB
Python
36 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""新旧系统分流:按目标工作簿 FBillHead sheet 的 AS 列口径判定走哪个 ERP。
|
|
|
|
AS(行 3 起同构):
|
|
|
|
=IF(AND(AR3<>"-", AQ3="否"), "旧系统", "新系统")
|
|
AR「服务岗参保情况」= 预支报酬台账!AW
|
|
= IF(职位序列<>"门店服务序列","-", IF(参保…,"服务岗未参保"/"服务岗已参保"))
|
|
⇒ 职位序列不是「门店服务序列」时恒为 "-"
|
|
AQ「是否标准化门店」= XLOOKUP(会馆, '辅助0-标准化门店收款账号'!B:B, F:F, "否")
|
|
|
|
⇒ **旧系统** = 职位序列为「门店服务序列」且会馆不是标准化门店;其余一律新系统。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from .. import config
|
|
|
|
|
|
def pick(row: dict, std_stores: dict) -> str:
|
|
"""判定该行走哪个 ERP,返回 ``config.SYSTEM_NEW`` / ``config.SYSTEM_OLD``。"""
|
|
if str(row.get('job_seq') or '').strip() != config.JOB_SEQ_STORE:
|
|
return config.SYSTEM_NEW # AR = "-"
|
|
venue = str(row.get('dept4') or '').strip()
|
|
flag = str((std_stores or {}).get(venue, config.STD_STORE_MISS)).strip()
|
|
return config.SYSTEM_OLD if flag == config.STD_STORE_MISS else config.SYSTEM_NEW
|
|
|
|
|
|
def label(site: str) -> str:
|
|
"""站点键 → 中文标签(日志/结果展示用)。"""
|
|
return '旧系统' if site == config.SYSTEM_OLD else '新系统'
|
|
|
|
|
|
def dept_for(site: str, new_dept: str) -> str:
|
|
"""申请部门跟系统走:旧系统 BM000881,新系统用传入的部门(默认 BM000477)。"""
|
|
return config.DEPT_OLD_SYSTEM if site == config.SYSTEM_OLD else new_dept
|