diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index 3fa0a32..b5c702f 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -559,6 +559,7 @@ class WproductTicketListSerializer(serializers.ModelSerializer): resp_process_ = ProcessSimpleSerializer(source='resp_process', read_only=True) order_ = OrderSimpleSerializer(source='subproduction_plan.production_plan.order', read_only=True) product_ = MaterialSimpleSerializer(source='subproduction_plan.production_plan.product', read_only=True) + workflow = serializers.PrimaryKeyRelatedField(source='ticket.workflow', read_only=True) class Meta: model = WprouctTicket diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 392ceb4..98d1a2d 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -499,7 +499,8 @@ class WproductTicketViewSet(ListModelMixin, GenericViewSet): perms_map = {'get': '*'} queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan', 'resp_process', 'subproduction_plan__production_plan__order', - 'subproduction_plan__production_plan') + 'subproduction_plan__production_plan', + 'ticket__workflow') serializer_class = WproductTicketListSerializer filterset_fields = ['step', 'material', 'subproduction_plan', 'resp_process'] @@ -631,6 +632,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd """ op = self.get_object() step = op.step + processId = op.step.process.id if op.is_submited: raise exceptions.APIException('该操作已提交') omis = OperationMaterial.objects.filter(operation=op, @@ -645,7 +647,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd if set(list(sps_omi_l)) != set(list(sps_omo_l)): raise exceptions.APIException('消耗与产出不一致') else: - if not omis.exists(): + if not omis.exists() and processId !=1: # 不是冷加工 raise exceptions.APIException('请选择消耗物料') # 检查自定义表单填写 @@ -766,7 +768,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd op.save() # 如果是冷加工 - if step.process.id == 1: + if processId == 1: WpmService.update_cutting_list_with_operation(op=op) return Response()