Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
shijing 2022-03-30 11:02:44 +08:00
commit bca780a781
5 changed files with 13 additions and 13 deletions

View File

@ -64,7 +64,7 @@ class ProcessViewSet(PageOrNot, CreateUpdateModelAMixin, ModelViewSet):
ordering_fields = ['number'] ordering_fields = ['number']
ordering = ['number'] ordering = ['number']
@action(methods=['get'], detail=True, perms_map={'get':'process_update'}, pagination_class=None, serializer_class=StepDetailSerializer) @action(methods=['get'], detail=True, perms_map={'get':'*'}, pagination_class=None, serializer_class=StepDetailSerializer)
def steps(self, request, pk=None): def steps(self, request, pk=None):
""" """
工序下的子工序 工序下的子工序

View File

@ -52,7 +52,7 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
""" """
检验记录 检验记录
""" """
perms_map = {'get': '*', 'post':'testrecord_update', 'delete':'testrecord_delete'} perms_map = {'get': '*', 'put':'testrecord_update', 'delete':'testrecord_delete'}
queryset = TestRecord.objects.select_related('fifo_item', 'form').prefetch_related('item_test_record').all() queryset = TestRecord.objects.select_related('fifo_item', 'form').prefetch_related('item_test_record').all()
serializer_class = TestRecordListSerializer serializer_class = TestRecordListSerializer
filterset_fields = ['wproduct', 'material', 'step', 'subproduction_plan', 'fifo_item', 'origin_test', 'type'] filterset_fields = ['wproduct', 'material', 'step', 'subproduction_plan', 'fifo_item', 'origin_test', 'type']

View File

@ -148,7 +148,7 @@ class AtWorkCountView(CreateAPIView):
ret = ClockRecord.objects.filter( ret = ClockRecord.objects.filter(
update_time__year = vdata['year'], update_time__year = vdata['year'],
update_time__month = vdata['month'], update_time__month = vdata['month'],
create_by__show_atwork = True create_by__employee_user__show_atwork = True
).values( ).values(
user_id = F('create_by'), user_id = F('create_by'),
number = F('create_by__employee_user__number'), number = F('create_by__employee_user__number'),

View File

@ -254,6 +254,7 @@ class WProductDetailSerializer(serializers.ModelSerializer):
class OperationDetailSerializer(serializers.ModelSerializer): class OperationDetailSerializer(serializers.ModelSerializer):
create_by_ = UserSimpleSerializer(source='create_by', read_only=True) create_by_ = UserSimpleSerializer(source='create_by', read_only=True)
update_by_ = UserSimpleSerializer(source='update_by', read_only=True)
step_ = StepSimpleSerializer(source='step', read_only=True) step_ = StepSimpleSerializer(source='step', read_only=True)
class Meta: class Meta:
model = Operation model = Operation
@ -261,6 +262,7 @@ class OperationDetailSerializer(serializers.ModelSerializer):
class OperationListSerializer(serializers.ModelSerializer): class OperationListSerializer(serializers.ModelSerializer):
create_by_ = UserSimpleSerializer(source='create_by', read_only=True) create_by_ = UserSimpleSerializer(source='create_by', read_only=True)
update_by_ = UserSimpleSerializer(source='update_by', read_only=True)
step_ = StepSimpleSerializer(source='step', read_only=True) step_ = StepSimpleSerializer(source='step', read_only=True)
# wproduct_ = serializers.SerializerMethodField() # wproduct_ = serializers.SerializerMethodField()
count_work = serializers.SerializerMethodField() count_work = serializers.SerializerMethodField()

View File

@ -11,7 +11,7 @@ from apps.pm.serializers import SubProductionPlanListSerializer, SubProductionPr
from apps.qm.models import TestRecord, TestRecordItem from apps.qm.models import TestRecord, TestRecordItem
from apps.qm.serializers import TestRecordDetailSerializer from apps.qm.serializers import TestRecordDetailSerializer
from apps.system.mixins import CreateUpdateModelAMixin from apps.system.mixins import CreateUpdateCustomMixin, CreateUpdateModelAMixin
from rest_framework.decorators import action from rest_framework.decorators import action
from apps.wf.models import Workflow from apps.wf.models import Workflow
from apps.wpm.filters import CuttingFilterSet, OperationRecordFilterSet, WMaterialFilterSet, WProductFilterSet from apps.wpm.filters import CuttingFilterSet, OperationRecordFilterSet, WMaterialFilterSet, WProductFilterSet
@ -537,9 +537,6 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
ordering_fields = ['id'] ordering_fields = ['id']
ordering = ['-id'] ordering = ['-id']
def get_queryset(self):
return self.queryset.filter(create_by=self.request.user)
def get_serializer_class(self): def get_serializer_class(self):
if self.action == 'retrieve': if self.action == 'retrieve':
return OperationDetailSerializer return OperationDetailSerializer
@ -787,6 +784,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
else: else:
raise exceptions.APIException('产出物料未填写或填写错误') raise exceptions.APIException('产出物料未填写或填写错误')
op.is_submited = True op.is_submited = True
op.update_by = request.user
op.save() op.save()
# 如果是冷加工 # 如果是冷加工
@ -800,7 +798,7 @@ class OperationWproductViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMix
操作使用的半成品 操作使用的半成品
""" """
perms_map = {'get': '*', 'post':'operation_update', perms_map = {'get': '*', 'post':'operation_update',
'put':'operation_update', 'delete':'operation_delete'} 'put':'operation_update', 'delete':'operation_update'}
queryset = OperationWproduct.objects.select_related( queryset = OperationWproduct.objects.select_related(
'subproduction_plan', 'material').all() 'subproduction_plan', 'material').all()
serializer_class = OperationWproductListSerializer serializer_class = OperationWproductListSerializer
@ -831,7 +829,7 @@ class OperationEquipViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin,
操作使用的设备 操作使用的设备
""" """
perms_map = {'get': '*', 'post':'operation_update', perms_map = {'get': '*', 'post':'operation_update',
'put':'operation_update', 'delete':'operation_delete'} 'put':'operation_update', 'delete':'operation_update'}
queryset = OperationEquip.objects.select_related( queryset = OperationEquip.objects.select_related(
'operation', 'equip').all() 'operation', 'equip').all()
serializer_class = OperationEquipListSerializer serializer_class = OperationEquipListSerializer
@ -864,7 +862,7 @@ class OperationRecordViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin
操作使用的自定义表格 操作使用的自定义表格
""" """
perms_map = {'get': '*', 'post':'operation_update', perms_map = {'get': '*', 'post':'operation_update',
'put':'operation_update', 'delete':'operation_delete'} 'put':'operation_update', 'delete':'operation_update'}
queryset = OperationRecord.objects.select_related( queryset = OperationRecord.objects.select_related(
'operation', 'form').all() 'operation', 'form').all()
serializer_class = OperationRecordListSerializer serializer_class = OperationRecordListSerializer
@ -908,7 +906,7 @@ class OperationMaterialInputViewSet(ListModelMixin, CreateModelMixin, DestroyMod
""" """
消耗物料 消耗物料
""" """
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'} perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_update'}
queryset = OperationMaterial.objects.select_related( queryset = OperationMaterial.objects.select_related(
'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_IN) 'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_IN)
serializer_class = OperationMaterialListSerializer serializer_class = OperationMaterialListSerializer
@ -960,7 +958,7 @@ class OperationMaterialOutputViewSet(ListModelMixin, CreateModelMixin, DestroyMo
""" """
产出物料 产出物料
""" """
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'} perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_update'}
queryset = OperationMaterial.objects.select_related( queryset = OperationMaterial.objects.select_related(
'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_OUT) 'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_OUT)
serializer_class = OperationMaterialListSerializer serializer_class = OperationMaterialListSerializer
@ -997,7 +995,7 @@ class OperationMaterialToolViewSet(ListModelMixin, CreateModelMixin, DestroyMode
""" """
工具工装 工具工装
""" """
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'} perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_update'}
queryset = OperationMaterial.objects.select_related( queryset = OperationMaterial.objects.select_related(
'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_TOOL) 'operation', 'subproduction_plan').filter(type=SubprodctionMaterial.SUB_MA_TYPE_TOOL)
serializer_class = OperationMaterialListSerializer serializer_class = OperationMaterialListSerializer