feat(plugin): 新增 XQ0006 周考勤异常处理、XQ0083 调动流程生效确认;其余插件累积改动
XQ0001 排班异常识别 / XQ0002 雇主险增减操作 / XQ0012 ERP 付款申请 / XQ0013 社保费用申报 / XQ0042 抖音平台核对 / XQ0084 银行卡更新:逻辑与界面 bundle 更新(含各自版本号变更)
This commit is contained in:
@@ -19,6 +19,7 @@ from ..config import (
|
||||
TARGET_HEADER_ROW, DATA_COLUMNS, CODE_COL, ID_COL, JOIN_DATE_COL, NAME_COL, POST_COL,
|
||||
EXCLUDE_REGIONS, EXCLUDE_NAME_KEYWORDS, EXCLUDE_POST_KEYWORDS, category_folder,
|
||||
employee_file, find_target_file, to_text, parse_join_date, ref_date, CACHE_DIR,
|
||||
POST_SEQ_COL, POST_SEQ_FILL_UNIT, POST_SEQ_FILL_MAP,
|
||||
)
|
||||
from ..data.roster_export_api import export_roster
|
||||
|
||||
@@ -48,6 +49,60 @@ def _read_source(employee_path):
|
||||
return data[data.iloc[:, 0].notna()]
|
||||
|
||||
|
||||
def fill_post_sequence(employee_path=""):
|
||||
"""导出后补全职位序列:所属单位=灸生生事业部 且 职位序列为空 的行按岗位映射回填。
|
||||
|
||||
直接改写花名册源表(仅在实际补全时保存),供后续筛选复制/调度使用。
|
||||
|
||||
Returns:
|
||||
(补全行数, 未匹配岗位的明细列表)
|
||||
"""
|
||||
path = os.path.abspath(employee_path or employee_file())
|
||||
if not os.path.exists(path):
|
||||
raise FileNotFoundError(f"源表不存在:{path}")
|
||||
|
||||
wb = load_workbook(path)
|
||||
ws = wb.worksheets[0]
|
||||
header_row = None
|
||||
for r in range(1, min(ws.max_row, 10) + 1):
|
||||
if str(ws.cell(row=r, column=2).value or "").strip() == SOURCE_HEADER_MARK:
|
||||
header_row = r
|
||||
break
|
||||
if header_row is None:
|
||||
raise ValueError(f"源表未找到表头行(B 列应为「{SOURCE_HEADER_MARK}」)")
|
||||
|
||||
unit_col, post_col, seq_col = 2, 2 + POST_COL, 2 + POST_SEQ_COL
|
||||
name_col, code_col = 2 + NAME_COL, 2 + CODE_COL
|
||||
mapping = {_norm_post(k): v for k, v in POST_SEQ_FILL_MAP.items()}
|
||||
|
||||
filled, unmatched = 0, []
|
||||
for r in range(header_row + 1, ws.max_row + 1):
|
||||
unit = str(ws.cell(row=r, column=unit_col).value or "").strip()
|
||||
if unit != POST_SEQ_FILL_UNIT:
|
||||
continue
|
||||
seq_cell = ws.cell(row=r, column=seq_col)
|
||||
if str(seq_cell.value or "").strip():
|
||||
continue
|
||||
post = ws.cell(row=r, column=post_col).value
|
||||
target = mapping.get(_norm_post(post))
|
||||
if target:
|
||||
seq_cell.value = target
|
||||
filled += 1
|
||||
else:
|
||||
name = to_text(ws.cell(row=r, column=name_col).value) or ""
|
||||
code = to_text(ws.cell(row=r, column=code_col).value) or ""
|
||||
unmatched.append(f"{name}({code}),岗位:{str(post or '').strip() or '空'}")
|
||||
|
||||
if filled:
|
||||
wb.save(path)
|
||||
logger.info("职位序列补全:所属单位「%s」且职位序列为空的行,补全 %d 行,未匹配 %d 行",
|
||||
POST_SEQ_FILL_UNIT, filled, len(unmatched))
|
||||
if unmatched:
|
||||
logger.warning("职位序列补全:以下行岗位不在映射表内,需人工确认:%s",
|
||||
";".join(unmatched))
|
||||
return filled, unmatched
|
||||
|
||||
|
||||
def filter_and_copy_roster(category, employee_path="", target_file=None):
|
||||
"""从员工花名册按类别筛选数据,复制到该类别的雇主险变更记录表(仅复制,不校验)。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user