opl不可重复申请

This commit is contained in:
曹前明 2022-09-20 20:09:40 +08:00
parent cfd4235a2b
commit 1835067962
5 changed files with 11 additions and 14 deletions

View File

@ -220,9 +220,9 @@ def create_remind(event: Event, params: dict):
})
# 开始发送通知
for i in Remind.objects.filter(event=event):
if i.notify_setting.sms_enable and i.recipient.employee.phone:
if i.notify_setting.sms_enable and i.recipient.phone:
# 发送短信通知
Thread(target=send_sms, args=(i.recipient.employee.phone,
Thread(target=send_sms, args=(i.recipient.phone,
1003, params), daemon=True).start()
if i.notify_setting.wechat_enable:
pass

View File

@ -184,6 +184,9 @@ class OplCreateUpdateSerializer(CustomModelSerializer):
operation = validated_data['operation']
if operation.state == Operation.OP_DONE:
raise ParseError('作业已关闭不可创建许可')
cate = validated_data['cate']
if Opl.objects.filter(operation=operation, cate=cate).exists():
raise ParseError('该类许可证已存在,不可重复申请')
return super().create(validated_data)

View File

@ -82,11 +82,9 @@ def opl_audit_end(ticket: Ticket):
# 授予相关工作人员区域进入权限
# worker_ep_ids = list(OplWorker.objects.filter(opl=opl).values_list('worker__id', flat=True))
# 发送通知
try:
phone = opl.create_by.employee.phone
phone = opl.create_by.phone
if phone:
send_sms(phone=phone, template_code=1005, template_param={'name': ticket.workflow.name})
except Exception:
pass
def opl_start(ticket: Ticket):

View File

@ -131,8 +131,6 @@ def rpj_audit_end(ticket):
rpj.state = Rpj.RPJ_ENTER
rpj.save()
# 发送通知?
try:
phone = rpj.create_by.employee.phone
phone = rpj.create_by.phone
if phone:
send_sms(phone=phone, template_code=1004, template_param={'name': '相关方项目'})
except Exception:
pass

View File

@ -60,11 +60,9 @@ def visit_audit_end(ticket):
visit.state = Visit.V_ENTER
visit.save()
# 发送通知?
try:
phone = visit.create_by.employee.phone
phone = visit.create_by.phone
if phone:
send_sms(phone=phone, template_code=1004, template_param={'name': '访客项目'})
except Exception:
pass
def visit_driver_end(visit: Visit):