fix: MyThread 调用错误

This commit is contained in:
caoqianming 2024-07-18 15:36:23 +08:00
parent 950b017073
commit 6fd2f2a009
1 changed files with 4 additions and 4 deletions

View File

@ -215,8 +215,8 @@ class MlogViewSet(CustomModelViewSet):
vdata_new = MlogSerializer(ins).data vdata_new = MlogSerializer(ins).data
create_auditlog('submit', ins, vdata_new, create_auditlog('submit', ins, vdata_new,
vdata_old, now, self.request.user) vdata_old, now, self.request.user)
MyThread(cal_mtask_progress_from_mlog,args=(ins,)).start() MyThread(target=cal_mtask_progress_from_mlog,args=(ins,)).start()
MyThread(cal_material_count_from_mlog,args=(ins,)).start() MyThread(target=cal_material_count_from_mlog,args=(ins,)).start()
return Response(vdata_new) return Response(vdata_new)
@action(methods=['post'], detail=True, perms_map={'post': 'mlog.submit'}, serializer_class=MlogRevertSerializer) @action(methods=['post'], detail=True, perms_map={'post': 'mlog.submit'}, serializer_class=MlogRevertSerializer)
@ -236,8 +236,8 @@ class MlogViewSet(CustomModelViewSet):
mlog_revert(ins, user, now) mlog_revert(ins, user, now)
create_auditlog('revert', ins, {}, {}, now, user, create_auditlog('revert', ins, {}, {}, now, user,
request.data.get('change_reason', '')) request.data.get('change_reason', ''))
MyThread(cal_mtask_progress_from_mlog,args=(ins,)).start() MyThread(target=cal_mtask_progress_from_mlog,args=(ins,)).start()
MyThread(cal_material_count_from_mlog,args=(ins,)).start() MyThread(target=cal_material_count_from_mlog,args=(ins,)).start()
return Response(MlogSerializer(instance=ins).data) return Response(MlogSerializer(instance=ins).data)
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=MlogRelatedSerializer) @action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=MlogRelatedSerializer)