wproduct_ticket list 增加workflow字段

This commit is contained in:
caoqianming 2022-02-14 10:48:28 +08:00
parent 264da03d4e
commit 39704bade9
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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()