feat: 相关方出入厂人员添加去除等功能-待完成
This commit is contained in:
parent
bb5e9925ea
commit
8b19556aff
|
@ -19,6 +19,7 @@ import time
|
|||
from django.core.cache import cache
|
||||
from django.conf import settings
|
||||
from apps.utils.tasks import CustomTask
|
||||
from apps.ecm.models import AlgoChannel
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
|
@ -118,6 +119,22 @@ def opl_task(vc_codes: list, opl_id: str):
|
|||
opl.mtask_uid = None
|
||||
opl.save()
|
||||
|
||||
@shared_task(base=CustomTask)
|
||||
def monitor_check():
|
||||
"""监控 监控任务的执行
|
||||
"""
|
||||
acs = AlgoChannel.objects.filter(always_on=True)
|
||||
for i in acs:
|
||||
td = i.vchannel
|
||||
if td.mtask_uid:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
|
||||
@shared_task(base=CustomTask)
|
||||
def loop_and_analyse(vchannel_code: str):
|
||||
td = TDevice.objects.filter(code=vchannel_code).first()
|
||||
pass
|
||||
|
||||
@shared_task(base=CustomTask)
|
||||
def monitor_and_analyse(vchannel_code: str, algo_codes: list):
|
||||
|
|
|
@ -211,8 +211,8 @@ class RpjmemberCreateSerializer(CustomModelSerializer):
|
|||
|
||||
def create(self, validated_data):
|
||||
rpj = validated_data['rpj']
|
||||
if rpj.state != Rpj.RPJ_CREATE:
|
||||
raise ParseError('成员非创建状态不可新增')
|
||||
if rpj.state in [Rpj.RPJ_DONE, Rpj.RPJ_CLOSE]:
|
||||
raise ParseError('成员该项目状态不可新增')
|
||||
rcertificates = validated_data.pop('rcertificates')
|
||||
remployee = validated_data['remployee']
|
||||
if remployee.phone and remployee.photo and remployee.id_number:
|
||||
|
@ -238,6 +238,8 @@ class RpjmemberCreateSerializer(CustomModelSerializer):
|
|||
rpjc.save()
|
||||
if ins.is_manager:
|
||||
Rpjmember.objects.exclude(id=ins.id).update(is_manager=False)
|
||||
if rpj.state in [Rpj.RPJ_ENTER, Rpj.RPJ_WORKING]: # 如果是待入厂后添加的
|
||||
pass
|
||||
return ins
|
||||
|
||||
|
||||
|
@ -250,8 +252,8 @@ class RpjmemberUpdateSerializer(CustomModelSerializer):
|
|||
|
||||
def update(self, instance, validated_data):
|
||||
rpj = validated_data['rpj']
|
||||
if rpj.state != Rpj.RPJ_CREATE:
|
||||
raise ParseError('成员非创建状态不可修改')
|
||||
if rpj.state in [Rpj.RPJ_DONE, Rpj.RPJ_CLOSE]:
|
||||
raise ParseError('成员该项目状态不可修改')
|
||||
rcertificates = validated_data.pop('rcertificates')
|
||||
with transaction.atomic():
|
||||
ins = super().update(instance, validated_data)
|
||||
|
@ -269,6 +271,8 @@ class RpjmemberUpdateSerializer(CustomModelSerializer):
|
|||
rpjc.save()
|
||||
if ins.is_manager:
|
||||
Rpjmember.objects.exclude(id=ins.id).update(is_manager=False)
|
||||
if rpj.state in [Rpj.RPJ_ENTER, Rpj.RPJ_WORKING]: # 如果是待入厂后更改的
|
||||
pass
|
||||
return ins
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue