diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 99d619c..1a15fa7 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -4,7 +4,7 @@ from rest_framework.mixins import CreateModelMixin, DestroyModelMixin, \ from rest_framework.viewsets import GenericViewSet from apps.inm.models import FIFO, FIFOItem, FIFOItemProduct from apps.inm.services import InmService -from apps.mtm.models import Material, RecordForm, RecordFormField, Step, SubprodctionMaterial, TechDoc +from apps.mtm.models import Material, RecordForm, RecordFormField, Step, SubprodctionMaterial, TechDoc, UsedStep from apps.mtm.serializers import RecordFormDetailSerializer, SubprodctionMaterialListSerializer, TechDocListSerializer from apps.pm.models import ProductionPlan, SubProductionPlan, SubProductionProgress from apps.pm.serializers import SubProductionPlanListSerializer, SubProductionProgressSerializer @@ -212,9 +212,9 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet): savedict['type'] = TestRecord.TEST_FINAL elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOCOMBTEST: savedict['type'] = TestRecord.TEST_COMB - elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST and\ - wproduct.step != wproduct.pre_step: # 如果是工序内检验 - savedict['is_midtesting'] = True + elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOTEST: + if UsedStep.objects.filter(subproduction=wproduct.subproduction_plan.subproduction).first().need_test: + savedict['is_midtesting'] = True tr = TestRecord.objects.create(**savedict) # 更新wproduct wproduct.test = tr