feat: 新增多插件 UI 支持及运行日志集中回传功能
本次提交包含多项功能更新: 1. 为多个插件(xq0002/0003/0004/0008/0010/0011/0020/0031_xq0032/0033/0035/0037/0045_xq0046/0047/0048)新增 UI 界面及配置支持 2. 新增运行日志集中回传功能,客户端自动上传运行日志到中心机集中存储 3. 新增插件分类字段支持,用于场景库分组管理 4. 优化 xq0034/0037/0048 等插件的功能及描述 5. 修复控制面响应兼容问题,支持新旧版本数据格式 6. 新增 xq0033 插件的状态存储模块,用于历史记录管理 7. 优化 CRM 登录窗口模式,支持全屏置顶
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""XQ0033 插件 - 离职当月再入职人员无效积分段踢除。"""
|
||||
from datetime import date
|
||||
|
||||
from .. import config
|
||||
|
||||
_CODE = "hr_staff_base.base_code"
|
||||
_NAME = "hr_staff_base.staff_name"
|
||||
|
||||
|
||||
def _clean(v):
|
||||
if v is None:
|
||||
return ""
|
||||
return str(v).strip()
|
||||
|
||||
|
||||
def blank_rejoin_gap(report_rows, rejoin_rows, old_codes_map=None):
|
||||
"""就地清空再入职人员无效积分段,返回清空的考勤状态单元格数。
|
||||
|
||||
- 台账工号:清 [离职日, 再入职日) 中间段;
|
||||
- 历史工号(换工号再入职):清 [再入职日, 月末],但要求报告行工号+姓名同时匹配,
|
||||
避免工号被复用后误清他人积分。
|
||||
"""
|
||||
old_codes_map = old_codes_map or {}
|
||||
gaps = {} # 台账工号 -> (leave_day, join_day)
|
||||
old_gaps = {} # 历史工号 -> (join_day, 再入职人姓名)
|
||||
for r in rejoin_rows:
|
||||
code = _clean(r.get(_CODE))
|
||||
name = _clean(r.get(_NAME))
|
||||
ld = r.get(f"{config.REJOIN_FIELD_PREFIX}.leave_date")
|
||||
jd = r.get(f"{config.REJOIN_FIELD_PREFIX}.join_date")
|
||||
if not code or not ld or not jd:
|
||||
continue
|
||||
try:
|
||||
leave = date.fromisoformat(str(ld).strip()[:10])
|
||||
join = date.fromisoformat(str(jd).strip()[:10])
|
||||
except ValueError:
|
||||
continue
|
||||
gaps[code] = (leave.day, join.day)
|
||||
for old_code in old_codes_map.get(code, ()):
|
||||
old_gaps[old_code] = (join.day, name)
|
||||
if not gaps and not old_gaps:
|
||||
return 0
|
||||
|
||||
cleared = 0
|
||||
for row in report_rows:
|
||||
code, row_name = row[0], row[8]
|
||||
if code in gaps:
|
||||
leave_day, join_day = gaps[code]
|
||||
for d in range(leave_day, join_day):
|
||||
if 1 <= d <= 31 and row[8 + d] not in (None, ""):
|
||||
row[8 + d] = ""
|
||||
cleared += 1
|
||||
elif code in old_gaps:
|
||||
join_day, rejoin_name = old_gaps[code]
|
||||
if row_name != rejoin_name:
|
||||
continue
|
||||
for d in range(join_day, 32):
|
||||
if 1 <= d <= 31 and row[8 + d] not in (None, ""):
|
||||
row[8 + d] = ""
|
||||
cleared += 1
|
||||
return cleared
|
||||
Reference in New Issue
Block a user