feat(outbound): 完善出库审批邮件通知逻辑,支持申请人与审批人同时收到邮件(带物料明细),审批通过后申请人和库管均收到带物料明细的通知
This commit is contained in:
@ -120,9 +120,10 @@ def send_email(to_email: Union[str, List[str]], subject: str, content: str):
|
||||
|
||||
def send_new_request_notify(to_emails: List[str], request_no: str,
|
||||
applicant_name: str = '', remark: str = '',
|
||||
items: list = None):
|
||||
items: list = None, is_applicant_notify: bool = False):
|
||||
"""
|
||||
通知审批人有新的出库申请单待审批(可附带物料清单)
|
||||
或通知申请人其申请已提交(is_applicant_notify=True 时)
|
||||
|
||||
Args:
|
||||
to_emails: 审批人邮箱列表
|
||||
@ -130,9 +131,9 @@ def send_new_request_notify(to_emails: List[str], request_no: str,
|
||||
applicant_name: 申请人姓名
|
||||
remark: 申请备注
|
||||
items: 物料明细列表(可选)
|
||||
is_applicant_notify: True=通知申请人(标题:您的出库申请已提交),False=通知审批人(标题:您有一笔新的出库审批待处理)
|
||||
"""
|
||||
print(f"[DEBUG send_new_request_notify] 入参 items={items}")
|
||||
print(f"[DEBUG send_new_request_notify] items 类型={type(items)}, 长度={len(items) if items else 0}")
|
||||
print(f"[DEBUG send_new_request_notify] 入参 items={items}, is_applicant_notify={is_applicant_notify}")
|
||||
|
||||
# 拼装物料表格
|
||||
rows = []
|
||||
@ -147,8 +148,29 @@ def send_new_request_notify(to_emails: List[str], request_no: str,
|
||||
else:
|
||||
rows.append("(无物料明细)")
|
||||
|
||||
subject = f"【待审批】出库申请单 {request_no}"
|
||||
content = f"""您好,
|
||||
if is_applicant_notify:
|
||||
subject = f"【已提交】您的出库申请单 {request_no} 已提交"
|
||||
content = f"""您好,
|
||||
|
||||
您的出库申请单 {request_no} 已成功提交,等待审批。
|
||||
|
||||
申请单号:{request_no}
|
||||
申请人:{applicant_name or '未知'}
|
||||
备注说明:{remark or '无'}
|
||||
|
||||
物料清单如下:
|
||||
{chr(10).join(rows)}
|
||||
|
||||
---
|
||||
您可以点击下方链接查看申请状态:
|
||||
https://172.16.0.198/outbound/selection
|
||||
---
|
||||
|
||||
此邮件由系统自动发送,请勿回复。
|
||||
"""
|
||||
else:
|
||||
subject = f"【待审批】出库申请单 {request_no}"
|
||||
content = f"""您好,
|
||||
|
||||
您有一笔新的出库审批申请待处理:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user