fix(plugin): XQ0004 1.2.0 当天加班单跳过不审核,待打卡齐全后再次处理
This commit is contained in:
@@ -27,7 +27,7 @@ class OvertimeApprovalPlugin(ScenePlugin):
|
||||
|
||||
id = "xq0004"
|
||||
name = "EHR系统加班流程审核"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
description = ("自动审核 EHR 加班待办:拉取待办与加班表单,按加班类型(延时/法定假日/休息日)"
|
||||
"校验加班日期、时长、排班与打卡区间及弹性到岗兑换;校验通过自动提交审批,"
|
||||
"并生成审批报告与钉钉群推送。")
|
||||
@@ -100,6 +100,7 @@ class OvertimeApprovalPlugin(ScenePlugin):
|
||||
|
||||
browser = None
|
||||
results = []
|
||||
skipped = []
|
||||
try:
|
||||
if docs:
|
||||
for idx, doc in enumerate(docs, 1):
|
||||
@@ -107,6 +108,14 @@ class OvertimeApprovalPlugin(ScenePlugin):
|
||||
detail = hr_api.fetch_doc_detail(doc)
|
||||
result = overtime_rules.validate_doc(detail, session)
|
||||
|
||||
# 当天发起当天的加班:本次跳过不审核(不提交、不入报告/推送),后续再审核
|
||||
if result.get("decision") == "跳过":
|
||||
skipped.append(result)
|
||||
ctx.log(f"已跳过 {idx}/{len(docs)}: {result.get('creator')} - "
|
||||
f"{result.get('title')} -> {result.get('note')}", "INFO")
|
||||
ctx.progress(15 + int(75 * idx / len(docs)))
|
||||
continue
|
||||
|
||||
if approve_enabled and result.get("decision") == "通过":
|
||||
if browser is None:
|
||||
browser = hr_browser.build_browser(session)
|
||||
@@ -152,6 +161,9 @@ class OvertimeApprovalPlugin(ScenePlugin):
|
||||
push_message = ""
|
||||
if push_enabled:
|
||||
push_items = overtime_report.build_push_summary(results, subject)
|
||||
if not push_items and skipped:
|
||||
push_items = [{"text": f"本次跳过 {len(skipped)} 条当天加班单据(当天打卡未完成),"
|
||||
f"待打卡完成后再次审核"}]
|
||||
if not push_items:
|
||||
push_items = [{"text": f"暂无待审批的{subject}单据"}]
|
||||
push_res = dingtalk_robot.main(
|
||||
@@ -169,12 +181,15 @@ class OvertimeApprovalPlugin(ScenePlugin):
|
||||
"overdue": sum(1 for r in results if r.get("decision") == "超期"),
|
||||
"abnormal": sum(1 for r in results if r.get("decision") == "异常"),
|
||||
"failed": sum(1 for r in results if r.get("decision") == "失败"),
|
||||
"skipped": len(skipped),
|
||||
}
|
||||
if not docs:
|
||||
summary = f"暂无待审批的{subject}单据;报告:{report_path}"
|
||||
else:
|
||||
summary = (f"{subject}审批完成,共 {counts['total']} 单:通过 {counts['passed']},"
|
||||
f"校验不通过未处理 {counts['rejected']},人工复核 {counts['review']}")
|
||||
f"校验不通过未处理 {counts['rejected']},人工复核 {counts['review']}")
|
||||
if counts["skipped"]:
|
||||
summary += f",当天加班跳过 {counts['skipped']}"
|
||||
if counts["overdue"]:
|
||||
summary += f",超期待人资处理 {counts['overdue']}"
|
||||
if counts["abnormal"]:
|
||||
|
||||
Reference in New Issue
Block a user