|
@@ -98,6 +98,9 @@ class UploadFileAPI(APIView):
|
|
|
successUploadedFiles.append({
|
|
|
"id": mission.id,
|
|
|
"name": mission.name,
|
|
|
+ # 防止近义词错误
|
|
|
+ "state": mission.state,
|
|
|
+ "status": mission.state,
|
|
|
"content": "mission",
|
|
|
})
|
|
|
|
|
@@ -183,6 +186,7 @@ class InputFileAPI(APIView):
|
|
|
mission.nodeFile = nodesFile
|
|
|
mission.edgeFile = edgesFile
|
|
|
mission.user = user
|
|
|
+ mission.state = 'init'
|
|
|
mission.save()
|
|
|
successUploadedFiles.append({
|
|
|
"id": mission.id,
|
|
@@ -216,7 +220,7 @@ class PlanAPI(APIView):
|
|
|
try:
|
|
|
mission = Mission.objects.get(id=request.GET.get('mission'))
|
|
|
except Mission.DoesNotExist:
|
|
|
- print("处理规划所属任务不存在", request.GET.get('mission'))
|
|
|
+ logger.error(f"处理规划所属任务不存在{request.GET.get('mission')}")
|
|
|
return failed(message="未找到规划任务所属任务")
|
|
|
plans = mission.own_plans.all()
|
|
|
response = []
|
|
@@ -245,7 +249,7 @@ class PlanAPI(APIView):
|
|
|
try:
|
|
|
mission = Mission.objects.get(id=request.data.get('mission'))
|
|
|
except Mission.DoesNotExist:
|
|
|
- print("处理规划所属任务不存在")
|
|
|
+ logger.error("处理规划所属任务不存在")
|
|
|
return failed(message="未找到规划任务所属任务")
|
|
|
# 重复提交同一Mission的规划将覆盖
|
|
|
if mission.own_plans.exists():
|
|
@@ -273,7 +277,7 @@ class PlanAPI(APIView):
|
|
|
try:
|
|
|
algorithm = Algorithm.objects.get(name=pJson['algorithm'])
|
|
|
except Algorithm.DoesNotExist:
|
|
|
- print("Not Exist Algorithm")
|
|
|
+ logger.error("传递算法不存在")
|
|
|
return failed(message=str(pJson['id']) + "规划选定算法不存在")
|
|
|
pModel = Plan(mission=mission, parent=rootPlan, algorithm=algorithm, user=user)
|
|
|
pModel.save()
|
|
@@ -293,7 +297,7 @@ class PlanAPI(APIView):
|
|
|
try:
|
|
|
algorithm = Algorithm.objects.get(name=childJson['algorithm'])
|
|
|
except Algorithm.DoesNotExist:
|
|
|
- print("Not Exist Algorithm")
|
|
|
+ logger.error("传递算法不存在")
|
|
|
return failed(message=str(pJson['id']) + "规划选定算法不存在")
|
|
|
childModel = Plan(mission=mission, parent=pModel, algorithm=algorithm, user=user)
|
|
|
childModel.save()
|