后端权限代码完善
This commit is contained in:
parent
035982a3d1
commit
6728ef10c4
|
@ -129,7 +129,8 @@ class TestRecordUpdateSerializer(serializers.ModelSerializer):
|
||||||
record_data = validated_data.pop('record_data')
|
record_data = validated_data.pop('record_data')
|
||||||
for attr, value in validated_data.items():
|
for attr, value in validated_data.items():
|
||||||
setattr(instance, attr, value)
|
setattr(instance, attr, value)
|
||||||
instance.save(update_by=update_by)
|
instance.update_by = update_by
|
||||||
|
instance.save()
|
||||||
for i in record_data:
|
for i in record_data:
|
||||||
tri = i['id']
|
tri = i['id']
|
||||||
if i['field_value'] != tri.field_value:
|
if i['field_value'] != tri.field_value:
|
||||||
|
|
|
@ -12,7 +12,8 @@ class CustomerViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
客户-增删改查
|
客户-增删改查
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'customer_create',
|
||||||
|
'put':'customer_update', 'delete':'customer_delete'}
|
||||||
queryset = Customer.objects.all()
|
queryset = Customer.objects.all()
|
||||||
serializer_class = CustomerSerializer
|
serializer_class = CustomerSerializer
|
||||||
search_fields = ['name', 'contact']
|
search_fields = ['name', 'contact']
|
||||||
|
@ -30,7 +31,8 @@ class ContractViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
合同-增删改查
|
合同-增删改查
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'contract_create',
|
||||||
|
'put':'contract_update', 'delete':'contract_delete'}
|
||||||
queryset = Contract.objects.select_related('customer').all()
|
queryset = Contract.objects.select_related('customer').all()
|
||||||
serializer_class = ContractSerializer
|
serializer_class = ContractSerializer
|
||||||
search_fields = ['name']
|
search_fields = ['name']
|
||||||
|
@ -47,7 +49,8 @@ class OrderViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
订单-增删改查
|
订单-增删改查
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'order_create',
|
||||||
|
'put':'order_update', 'delete':'order_delete'}
|
||||||
queryset = Order.objects.select_related('contract', 'customer').all()
|
queryset = Order.objects.select_related('contract', 'customer').all()
|
||||||
serializer_class = OrderSerializer
|
serializer_class = OrderSerializer
|
||||||
search_fields = ['number', 'product']
|
search_fields = ['number', 'product']
|
||||||
|
@ -60,7 +63,7 @@ class OrderViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
return OrderCreateUpdateSerializer
|
return OrderCreateUpdateSerializer
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, perms_map={'get':'*'})
|
@action(methods=['get'], detail=False, perms_map={'get':'order_toplan'})
|
||||||
def toplan(self, request, pk=None):
|
def toplan(self, request, pk=None):
|
||||||
queryset = Order.objects.filter(count__gt=F('planed_count')).order_by('-id')
|
queryset = Order.objects.filter(count__gt=F('planed_count')).order_by('-id')
|
||||||
page = self.paginate_queryset(queryset)
|
page = self.paginate_queryset(queryset)
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
||||||
"""
|
"""
|
||||||
销售记录
|
销售记录
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'sale_create', 'delete':'sale_delete'}
|
||||||
queryset = Sale.objects.select_related('customer', 'order', 'product', 'order__contract').all()
|
queryset = Sale.objects.select_related('customer', 'order', 'product', 'order__contract').all()
|
||||||
serializer_class = SaleListSerializer
|
serializer_class = SaleListSerializer
|
||||||
search_fields = ['customer__name', 'order__number']
|
search_fields = ['customer__name', 'order__number']
|
||||||
|
@ -57,7 +57,7 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
||||||
SaleProduct.objects.bulk_create(i_l)
|
SaleProduct.objects.bulk_create(i_l)
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=serializers.Serializer)
|
@action(methods=['post'], detail=True, perms_map={'post':'sale_audit'}, serializer_class=serializers.Serializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def audit(self, request, pk=None):
|
def audit(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -124,7 +124,7 @@ class SaleProductViewSet(ListModelMixin, DestroyModelMixin, CreateModelMixin, Ge
|
||||||
"""
|
"""
|
||||||
销售记录关联产品
|
销售记录关联产品
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'sale_update', 'delete':'sale_delete'}
|
||||||
queryset = SaleProduct.objects.select_related('iproduct', 'iproduct__material', 'iproduct__warehouse').all()
|
queryset = SaleProduct.objects.select_related('iproduct', 'iproduct__material', 'iproduct__warehouse').all()
|
||||||
serializer_class = SaleProductListSerializer
|
serializer_class = SaleProductListSerializer
|
||||||
search_fields = []
|
search_fields = []
|
||||||
|
|
|
@ -24,6 +24,7 @@ from .scripts import GetParticipants, HandleScripts
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
class FromCodeListView(APIView):
|
class FromCodeListView(APIView):
|
||||||
|
perms_map = {'*':'*'}
|
||||||
def get(self, request, format=None):
|
def get(self, request, format=None):
|
||||||
"""
|
"""
|
||||||
获取处理人代码列表
|
获取处理人代码列表
|
||||||
|
@ -88,7 +89,8 @@ class WorkflowViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
||||||
return Response(ret)
|
return Response(ret)
|
||||||
|
|
||||||
class StateViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
class StateViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
||||||
perms_map = {'*':'*'}
|
perms_map = {'get':'*', 'post':'workflow_update',
|
||||||
|
'put':'workflow_update', 'delete':'workflow_delete'}
|
||||||
queryset = State.objects.all()
|
queryset = State.objects.all()
|
||||||
serializer_class = StateSerializer
|
serializer_class = StateSerializer
|
||||||
search_fields = ['name']
|
search_fields = ['name']
|
||||||
|
@ -96,7 +98,8 @@ class StateViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, Destr
|
||||||
ordering = ['sort']
|
ordering = ['sort']
|
||||||
|
|
||||||
class TransitionViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
class TransitionViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
||||||
perms_map = {'*':'*'}
|
perms_map = {'get':'*', 'post':'workflow_update',
|
||||||
|
'put':'workflow_update', 'delete':'workflow_delete'}
|
||||||
queryset = Transition.objects.all()
|
queryset = Transition.objects.all()
|
||||||
serializer_class = TransitionSerializer
|
serializer_class = TransitionSerializer
|
||||||
search_fields = ['name']
|
search_fields = ['name']
|
||||||
|
@ -104,7 +107,8 @@ class TransitionViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin,
|
||||||
ordering = ['id']
|
ordering = ['id']
|
||||||
|
|
||||||
class CustomFieldViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
class CustomFieldViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet):
|
||||||
perms_map = {'*':'*'}
|
perms_map = {'get':'*', 'post':'workflow_update',
|
||||||
|
'put':'workflow_update', 'delete':'workflow_delete'}
|
||||||
queryset = CustomField.objects.all()
|
queryset = CustomField.objects.all()
|
||||||
serializer_class = CustomFieldSerializer
|
serializer_class = CustomFieldSerializer
|
||||||
search_fields = ['field_name']
|
search_fields = ['field_name']
|
||||||
|
@ -117,7 +121,7 @@ class CustomFieldViewSet(CreateModelMixin, UpdateModelMixin, RetrieveModelMixin,
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
class TicketViewSet(OptimizationMixin, CreateUpdateCustomMixin, CreateModelMixin, ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
class TicketViewSet(OptimizationMixin, CreateUpdateCustomMixin, CreateModelMixin, ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
perms_map = {'*':'*'}
|
perms_map = {'get':'*', 'post':'ticket_create'}
|
||||||
queryset = Ticket.objects.all()
|
queryset = Ticket.objects.all()
|
||||||
serializer_class = TicketSerializer
|
serializer_class = TicketSerializer
|
||||||
search_fields = ['title']
|
search_fields = ['title']
|
||||||
|
@ -348,7 +352,7 @@ class TicketViewSet(OptimizationMixin, CreateUpdateCustomMixin, CreateModelMixin
|
||||||
else:
|
else:
|
||||||
return Response('工单不可关闭', status=status.HTTP_400_BAD_REQUEST)
|
return Response('工单不可关闭', status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=TicketDestorySerializer)
|
@action(methods=['post'], detail=False, perms_map={'post':'ticket_deletes'}, serializer_class=TicketDestorySerializer)
|
||||||
def destory(self, request, pk=None):
|
def destory(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
批量物理删除
|
批量物理删除
|
||||||
|
@ -362,7 +366,7 @@ class TicketFlowViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
工单日志
|
工单日志
|
||||||
"""
|
"""
|
||||||
perms_map = {'*':'*'}
|
perms_map = {'get':'*'}
|
||||||
queryset = TicketFlow.objects.all()
|
queryset = TicketFlow.objects.all()
|
||||||
serializer_class = TicketFlowSerializer
|
serializer_class = TicketFlowSerializer
|
||||||
search_fields = ['suggestion']
|
search_fields = ['suggestion']
|
||||||
|
|
|
@ -47,7 +47,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
车间生产计划
|
车间生产计划
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*'}
|
||||||
queryset = SubProductionPlan.objects.select_related(
|
queryset = SubProductionPlan.objects.select_related(
|
||||||
'process', 'workshop', 'subproduction', 'product').exclude(state=0)
|
'process', 'workshop', 'subproduction', 'product').exclude(state=0)
|
||||||
search_fields = []
|
search_fields = []
|
||||||
|
@ -57,7 +57,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
||||||
ordering_fields = []
|
ordering_fields = []
|
||||||
ordering = ['-update_time']
|
ordering = ['-update_time']
|
||||||
|
|
||||||
@action(methods=['post', 'get'], detail=True, perms_map={'post': '*', 'get': '*'}, serializer_class=PickHalfsSerializer)
|
@action(methods=['post', 'get'], detail=True, perms_map={'post': 'pick_half', 'get': '*'}, serializer_class=PickHalfsSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def pick_half(self, request, pk=None):
|
def pick_half(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -124,7 +124,7 @@ class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
车间物料表
|
车间物料表
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*'}
|
||||||
queryset = WMaterial.objects.select_related(
|
queryset = WMaterial.objects.select_related(
|
||||||
'material', 'subproduction_plan').filter(count__gt=0)
|
'material', 'subproduction_plan').filter(count__gt=0)
|
||||||
serializer_class = WMaterialListSerializer
|
serializer_class = WMaterialListSerializer
|
||||||
|
@ -132,7 +132,7 @@ class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
|
||||||
ordering_fields = ['material__number']
|
ordering_fields = ['material__number']
|
||||||
ordering = ['material__number']
|
ordering = ['material__number']
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=PickSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post': 'pick'}, serializer_class=PickSerializer)
|
||||||
def pick(self, request, pk=None):
|
def pick(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
领料
|
领料
|
||||||
|
@ -148,7 +148,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
半成品
|
半成品
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
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').prefetch_related('wp_child')
|
||||||
|
@ -169,7 +169,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
queryset = queryset.filter(is_hidden=False)
|
queryset = queryset.filter(is_hidden=False)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WpmTestFormInitSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post': 'wp_test_init'}, serializer_class=WpmTestFormInitSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def test_init(self, request, pk=None):
|
def test_init(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -228,7 +228,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
return Response(TestRecordDetailSerializer(instance=tr).data)
|
return Response(TestRecordDetailSerializer(instance=tr).data)
|
||||||
|
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WproductPutInsSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post': 'wp_putins'}, serializer_class=WproductPutInsSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def putins(self, request, pk=None):
|
def putins(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -287,7 +287,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
WpmService.add_wproduct_flow_log(i, 'putins')
|
WpmService.add_wproduct_flow_log(i, 'putins')
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=WproductPutInSerializer)
|
@action(methods=['post'], detail=True, perms_map={'post': 'wp_putin'}, serializer_class=WproductPutInSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def putin(self, request, pk=None):
|
def putin(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -334,7 +334,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
WpmService.add_wproduct_flow_log(wproduct, 'putin')
|
WpmService.add_wproduct_flow_log(wproduct, 'putin')
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=ScrapSerializer)
|
@action(methods=['post'], detail=True, perms_map={'post': 'wp_scrap'}, serializer_class=ScrapSerializer)
|
||||||
def scrap(self, request, pk=None):
|
def scrap(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
报废操作
|
报废操作
|
||||||
|
@ -399,7 +399,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
else:
|
else:
|
||||||
raise exceptions.APIException('未找到对应审批流程')
|
raise exceptions.APIException('未找到对应审批流程')
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=WproductMtestSerializer)
|
@action(methods=['post'], detail=True, perms_map={'post': 'wp_mtest'}, serializer_class=WproductMtestSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def mtest(self, request, pk=None):
|
def mtest(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -424,7 +424,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
WpmService.add_wproduct_flow_log(instance=obj, change_str=change_str)
|
WpmService.add_wproduct_flow_log(instance=obj, change_str=change_str)
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['get'], detail=True, perms_map={'get': '*'})
|
@action(methods=['get'], detail=True, perms_map={'get': 'wp_card'})
|
||||||
def card(self, request, pk=None):
|
def card(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
流程卡
|
流程卡
|
||||||
|
@ -449,7 +449,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
ret.append([str(index + 1), item['step_name'], item['actions']])
|
ret.append([str(index + 1), item['step_name'], item['actions']])
|
||||||
return Response(ret)
|
return Response(ret)
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WproductNeedToOrderSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post': 'wp_need_to_order'}, serializer_class=WproductNeedToOrderSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def need_to_order(self, request, pk=None):
|
def need_to_order(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -467,7 +467,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||||
WpmService.add_wproduct_flow_log(i, change_str='need_to_order')
|
WpmService.add_wproduct_flow_log(i, change_str='need_to_order')
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=WproductToOrderSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post': 'wp_to_order'}, serializer_class=WproductToOrderSerializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def to_order(self, request, pk=None):
|
def to_order(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -496,7 +496,7 @@ class WproductTicketViewSet(ListModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
玻璃审批工单
|
玻璃审批工单
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
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')
|
||||||
|
@ -512,7 +512,8 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
"""
|
"""
|
||||||
生产操作记录
|
生产操作记录
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'operation_create',
|
||||||
|
'put':'operation_update', 'delete':'operation_delete'}
|
||||||
queryset = Operation.objects.select_related('step').prefetch_related(
|
queryset = Operation.objects.select_related('step').prefetch_related(
|
||||||
'ow_operation', 'oe_operation', 'or_operation').all()
|
'ow_operation', 'oe_operation', 'or_operation').all()
|
||||||
serializer_class = OperationListSerializer
|
serializer_class = OperationListSerializer
|
||||||
|
@ -622,7 +623,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
opm.save()
|
opm.save()
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post': '*'}, serializer_class=serializers.Serializer)
|
@action(methods=['post'], detail=True, perms_map={'post': 'operation_submit'}, serializer_class=serializers.Serializer)
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def submit(self, request, pk=None):
|
def submit(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -775,7 +776,8 @@ class OperationWproductViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMix
|
||||||
"""
|
"""
|
||||||
操作使用的半成品
|
操作使用的半成品
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'operation_update',
|
||||||
|
'put':'operation_update', 'delete':'operation_delete'}
|
||||||
queryset = OperationWproduct.objects.select_related(
|
queryset = OperationWproduct.objects.select_related(
|
||||||
'subproduction_plan', 'material').all()
|
'subproduction_plan', 'material').all()
|
||||||
serializer_class = OperationWproductListSerializer
|
serializer_class = OperationWproductListSerializer
|
||||||
|
@ -804,7 +806,8 @@ class OperationEquipViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin,
|
||||||
"""
|
"""
|
||||||
操作使用的设备
|
操作使用的设备
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'operation_update',
|
||||||
|
'put':'operation_update', 'delete':'operation_delete'}
|
||||||
queryset = OperationEquip.objects.select_related(
|
queryset = OperationEquip.objects.select_related(
|
||||||
'operation', 'equip').all()
|
'operation', 'equip').all()
|
||||||
serializer_class = OperationEquipListSerializer
|
serializer_class = OperationEquipListSerializer
|
||||||
|
@ -836,7 +839,8 @@ class OperationRecordViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin
|
||||||
"""
|
"""
|
||||||
操作使用的自定义表格
|
操作使用的自定义表格
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'operation_update',
|
||||||
|
'put':'operation_update', 'delete':'operation_delete'}
|
||||||
queryset = OperationRecord.objects.select_related(
|
queryset = OperationRecord.objects.select_related(
|
||||||
'operation', 'form').all()
|
'operation', 'form').all()
|
||||||
serializer_class = OperationRecordListSerializer
|
serializer_class = OperationRecordListSerializer
|
||||||
|
@ -880,7 +884,7 @@ class OperationMaterialInputViewSet(ListModelMixin, CreateModelMixin, DestroyMod
|
||||||
"""
|
"""
|
||||||
消耗物料
|
消耗物料
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'}
|
||||||
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
|
||||||
|
@ -893,7 +897,7 @@ class OperationMaterialInputViewSet(ListModelMixin, CreateModelMixin, DestroyMod
|
||||||
return OperationMaterialCreate1Serailizer
|
return OperationMaterialCreate1Serailizer
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
@action(methods=['post'], detail=False, perms_map={'post': 'operation_update'},
|
||||||
serializer_class=OperationMaterialCreate1ListSerailizer)
|
serializer_class=OperationMaterialCreate1ListSerailizer)
|
||||||
def creates(self, request, pk=None):
|
def creates(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -917,7 +921,7 @@ class CuttingListViewSet(ListModelMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
下料清单
|
下料清单
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*'}
|
||||||
queryset = OperationMaterial.objects.select_related('operation',
|
queryset = OperationMaterial.objects.select_related('operation',
|
||||||
'subproduction_plan', 'material',
|
'subproduction_plan', 'material',
|
||||||
'operation__create_by').filter(operation__step__id=1,
|
'operation__create_by').filter(operation__step__id=1,
|
||||||
|
@ -932,7 +936,7 @@ class OperationMaterialOutputViewSet(ListModelMixin, CreateModelMixin, DestroyMo
|
||||||
"""
|
"""
|
||||||
产出物料
|
产出物料
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'}
|
||||||
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
|
||||||
|
@ -945,7 +949,7 @@ class OperationMaterialOutputViewSet(ListModelMixin, CreateModelMixin, DestroyMo
|
||||||
return OperationMaterialCreate2Serailizer
|
return OperationMaterialCreate2Serailizer
|
||||||
return super().get_serializer_class()
|
return super().get_serializer_class()
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
@action(methods=['post'], detail=False, perms_map={'post': 'operation_update'},
|
||||||
serializer_class=OperationMaterialCreate2ListSerailizer)
|
serializer_class=OperationMaterialCreate2ListSerailizer)
|
||||||
def creates(self, request, pk=None):
|
def creates(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
@ -969,7 +973,7 @@ class OperationMaterialToolViewSet(ListModelMixin, CreateModelMixin, DestroyMode
|
||||||
"""
|
"""
|
||||||
工具工装
|
工具工装
|
||||||
"""
|
"""
|
||||||
perms_map = {'*': '*'}
|
perms_map = {'get': '*', 'post':'operation_update', 'delete':'operation_delete'}
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue