1Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
5d21c4e72e
|
@ -92,6 +92,7 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
||||||
raise exceptions.APIException('存在未填写项目:'+ ','.join(list(items_not.values_list('form_field__field_name', flat=True))))
|
raise exceptions.APIException('存在未填写项目:'+ ','.join(list(items_not.values_list('form_field__field_name', flat=True))))
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
obj.is_submited=True
|
obj.is_submited=True
|
||||||
|
obj.update_by = request.user
|
||||||
obj.save()
|
obj.save()
|
||||||
if obj.wproduct:
|
if obj.wproduct:
|
||||||
WpmService.update_wproduct_by_test(obj, request.user) # 这里已经做了日志记录和进度计算
|
WpmService.update_wproduct_by_test(obj, request.user) # 这里已经做了日志记录和进度计算
|
||||||
|
|
|
@ -168,6 +168,8 @@ class WProductListSerializer(DynamicFieldsSerializerMixin, serializers.ModelSeri
|
||||||
children = serializers.SerializerMethodField()
|
children = serializers.SerializerMethodField()
|
||||||
to_order_ = OrderSimpleSerializer(source='to_order', read_only=True)
|
to_order_ = OrderSimpleSerializer(source='to_order', read_only=True)
|
||||||
order_ = serializers.SerializerMethodField()
|
order_ = serializers.SerializerMethodField()
|
||||||
|
create_by_ = UserSimpleSerializer(source='create_by', read_only=True)
|
||||||
|
update_by_ = UserSimpleSerializer(source='update_by', read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WProduct
|
model = WProduct
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -242,6 +244,8 @@ class WProductDetailSerializer(serializers.ModelSerializer):
|
||||||
children = serializers.SerializerMethodField()
|
children = serializers.SerializerMethodField()
|
||||||
to_order_ = OrderSimpleSerializer(source='to_order', read_only=True)
|
to_order_ = OrderSimpleSerializer(source='to_order', 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)
|
||||||
|
create_by_ = UserSimpleSerializer(source='create_by', read_only=True)
|
||||||
|
update_by_ = UserSimpleSerializer(source='update_by', read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = WProduct
|
model = WProduct
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
|
@ -160,7 +160,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
perms_map = {'get': '*'}
|
perms_map = {'get': '*'}
|
||||||
queryset = WProduct.objects.select_related('step', 'material',
|
queryset = WProduct.objects.select_related('step', 'material',
|
||||||
'subproduction_plan', 'warehouse', 'subproduction_plan__production_plan__order',
|
'subproduction_plan', 'warehouse', 'subproduction_plan__production_plan__order',
|
||||||
'to_order').prefetch_related('wp_child')
|
'to_order', 'update_by', 'create_by').prefetch_related('wp_child')
|
||||||
serializer_class = WProductListSerializer
|
serializer_class = WProductListSerializer
|
||||||
filterset_class = WProductFilterSet
|
filterset_class = WProductFilterSet
|
||||||
search_fields = ['number', 'material__name', 'subproduction_plan__number']
|
search_fields = ['number', 'material__name', 'subproduction_plan__number']
|
||||||
|
@ -530,7 +530,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
"""
|
"""
|
||||||
perms_map = {'get': '*', 'post':'operation_create',
|
perms_map = {'get': '*', 'post':'operation_create',
|
||||||
'put':'operation_update', 'delete':'operation_delete'}
|
'put':'operation_update', 'delete':'operation_delete'}
|
||||||
queryset = Operation.objects.select_related('step').prefetch_related(
|
queryset = Operation.objects.select_related('step', 'create_by', 'update_by').prefetch_related(
|
||||||
'ow_operation', 'oe_operation', 'or_operation').all()
|
'ow_operation', 'oe_operation', 'or_operation').all()
|
||||||
serializer_class = OperationListSerializer
|
serializer_class = OperationListSerializer
|
||||||
filterset_fields = ['step', 'step__process', 'is_submited']
|
filterset_fields = ['step', 'step__process', 'is_submited']
|
||||||
|
@ -634,7 +634,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
opm.material = i.material
|
opm.material = i.material
|
||||||
opm.type = SubprodctionMaterial.SUB_MA_TYPE_TOOL
|
opm.type = SubprodctionMaterial.SUB_MA_TYPE_TOOL
|
||||||
opm.save()
|
opm.save()
|
||||||
return Response()
|
return Response(OperationListSerializer(instance=op).data)
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post': 'operation_submit'}, serializer_class=serializers.Serializer)
|
@action(methods=['post'], detail=True, perms_map={'post': 'operation_submit'}, serializer_class=serializers.Serializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
|
|
Loading…
Reference in New Issue