wproduct_ticket list 增加workflow字段
This commit is contained in:
parent
264da03d4e
commit
39704bade9
|
@ -559,6 +559,7 @@ class WproductTicketListSerializer(serializers.ModelSerializer):
|
||||||
resp_process_ = ProcessSimpleSerializer(source='resp_process', read_only=True)
|
resp_process_ = ProcessSimpleSerializer(source='resp_process', read_only=True)
|
||||||
order_ = OrderSimpleSerializer(source='subproduction_plan.production_plan.order', 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)
|
product_ = MaterialSimpleSerializer(source='subproduction_plan.production_plan.product', read_only=True)
|
||||||
|
workflow = serializers.PrimaryKeyRelatedField(source='ticket.workflow', read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WprouctTicket
|
model = WprouctTicket
|
||||||
|
|
|
@ -499,7 +499,8 @@ class WproductTicketViewSet(ListModelMixin, GenericViewSet):
|
||||||
perms_map = {'get': '*'}
|
perms_map = {'get': '*'}
|
||||||
queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan',
|
queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan',
|
||||||
'resp_process', 'subproduction_plan__production_plan__order',
|
'resp_process', 'subproduction_plan__production_plan__order',
|
||||||
'subproduction_plan__production_plan')
|
'subproduction_plan__production_plan',
|
||||||
|
'ticket__workflow')
|
||||||
serializer_class = WproductTicketListSerializer
|
serializer_class = WproductTicketListSerializer
|
||||||
filterset_fields = ['step', 'material',
|
filterset_fields = ['step', 'material',
|
||||||
'subproduction_plan', 'resp_process']
|
'subproduction_plan', 'resp_process']
|
||||||
|
@ -631,6 +632,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
"""
|
"""
|
||||||
op = self.get_object()
|
op = self.get_object()
|
||||||
step = op.step
|
step = op.step
|
||||||
|
processId = op.step.process.id
|
||||||
if op.is_submited:
|
if op.is_submited:
|
||||||
raise exceptions.APIException('该操作已提交')
|
raise exceptions.APIException('该操作已提交')
|
||||||
omis = OperationMaterial.objects.filter(operation=op,
|
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)):
|
if set(list(sps_omi_l)) != set(list(sps_omo_l)):
|
||||||
raise exceptions.APIException('消耗与产出不一致')
|
raise exceptions.APIException('消耗与产出不一致')
|
||||||
else:
|
else:
|
||||||
if not omis.exists():
|
if not omis.exists() and processId !=1: # 不是冷加工
|
||||||
raise exceptions.APIException('请选择消耗物料')
|
raise exceptions.APIException('请选择消耗物料')
|
||||||
|
|
||||||
# 检查自定义表单填写
|
# 检查自定义表单填写
|
||||||
|
@ -766,7 +768,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
op.save()
|
op.save()
|
||||||
|
|
||||||
# 如果是冷加工
|
# 如果是冷加工
|
||||||
if step.process.id == 1:
|
if processId == 1:
|
||||||
WpmService.update_cutting_list_with_operation(op=op)
|
WpmService.update_cutting_list_with_operation(op=op)
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue