feat: 入厂和作业时进行证书过期校验
This commit is contained in:
parent
171348fbbd
commit
1b2f201786
|
@ -107,6 +107,8 @@ class OplWorkerCreateSerializer(CustomModelSerializer):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
oplw = super().create(validated_data)
|
oplw = super().create(validated_data)
|
||||||
for x in certificates:
|
for x in certificates:
|
||||||
|
if x.state == Certificate.CERT_EXPIRED:
|
||||||
|
raise ParseError(f'证书{x.number}已过期!')
|
||||||
oplc = OplCert.objects.filter(opl_worker=oplw, certificate=x).first()
|
oplc = OplCert.objects.filter(opl_worker=oplw, certificate=x).first()
|
||||||
if oplc:
|
if oplc:
|
||||||
pass
|
pass
|
||||||
|
@ -133,6 +135,8 @@ class OplWorkerUpdateSerializer(CustomModelSerializer):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
oplw = super().update(instance, validated_data)
|
oplw = super().update(instance, validated_data)
|
||||||
for x in certificates:
|
for x in certificates:
|
||||||
|
if x.state == Certificate.CERT_EXPIRED:
|
||||||
|
raise ParseError(f'证书{x.number}已过期!')
|
||||||
oplc = OplCert.objects.filter(opl_worker=oplw, certificate=x).first()
|
oplc = OplCert.objects.filter(opl_worker=oplw, certificate=x).first()
|
||||||
if oplc:
|
if oplc:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -196,6 +196,7 @@ def rpj_certificate_in(rpjm: Rpjmember):
|
||||||
ct.expiration_date = i.expiration_date
|
ct.expiration_date = i.expiration_date
|
||||||
ct.review_date = i.review_date
|
ct.review_date = i.review_date
|
||||||
ct.file = i.file
|
ct.file = i.file
|
||||||
|
ct.state = ct.get_state()
|
||||||
ct.save()
|
ct.save()
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,6 +220,7 @@ def rpj_audit_end(ticket):
|
||||||
ct.expiration_date = i.expiration_date
|
ct.expiration_date = i.expiration_date
|
||||||
ct.review_date = i.review_date
|
ct.review_date = i.review_date
|
||||||
ct.file = i.file
|
ct.file = i.file
|
||||||
|
ct.state = ct.get_state()
|
||||||
ct.save()
|
ct.save()
|
||||||
# 更新相关方资料库后续可从资料库里选择
|
# 更新相关方资料库后续可从资料库里选择
|
||||||
for i in Rpjfile.objects.filter(rpj=rpj):
|
for i in Rpjfile.objects.filter(rpj=rpj):
|
||||||
|
|
Loading…
Reference in New Issue