其他出库不可操作成品或半成品
This commit is contained in:
parent
b4795ab9f2
commit
d3f999d2c8
|
@ -2,6 +2,7 @@ from rest_framework import exceptions
|
|||
from rest_framework import serializers
|
||||
|
||||
from apps.inm.models import FIFO, FIFOItem, FIFOItemProduct, IProduct, MaterialBatch, WareHouse, Inventory
|
||||
from apps.mtm.models import Material
|
||||
from apps.pum.models import PuOrder, Vendor
|
||||
from apps.qm.models import TestRecord, TestRecordItem
|
||||
from apps.sam.serializers import OrderSimpleSerializer
|
||||
|
@ -173,6 +174,8 @@ class FIFOOutOtherSerializer(serializers.ModelSerializer):
|
|||
obj.save()
|
||||
for i in details:
|
||||
mb = i.pop('material_batch')
|
||||
if mb.material.type in [Material.MA_TYPE_GOOD, Material.MA_TYPE_HALFGOOD]:
|
||||
raise ValidationError('不可直接出成品或半成品')
|
||||
i['material'] = mb.material
|
||||
i['batch'] = mb.batch
|
||||
i['warehouse'] = mb.warehouse
|
||||
|
|
|
@ -163,6 +163,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
|||
return super().destroy(request, *args, **kwargs)
|
||||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'fifo_in_pur'}, serializer_class=FIFOInPurSerializer)
|
||||
@transaction.atomic()
|
||||
def in_pur(self, request, pk=None):
|
||||
"""
|
||||
采购入库
|
||||
|
@ -174,6 +175,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
|||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'fifo_in_other'},
|
||||
serializer_class=FIFOInOtherSerializer)
|
||||
@transaction.atomic()
|
||||
def in_other(self, request, pk=None):
|
||||
"""
|
||||
其他入库
|
||||
|
@ -185,6 +187,7 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
|||
|
||||
@action(methods=['post'], detail=False, perms_map={'post': 'fifo_out_other'},
|
||||
serializer_class=FIFOOutOtherSerializer)
|
||||
@transaction.atomic()
|
||||
def out_other(self, request, pk=None):
|
||||
"""
|
||||
其他出库
|
||||
|
|
Loading…
Reference in New Issue