其他入库serializer bug
This commit is contained in:
parent
e086bcda58
commit
28814649f6
|
@ -140,12 +140,12 @@ class FIFOInOtherSerializer(serializers.ModelSerializer):
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
details = validated_data.pop('details')
|
details = validated_data.pop('details')
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
validated_data['type'] = FIFO.FIFO_TYPE_PUR_IN
|
validated_data['type'] = FIFO.FIFO_TYPE_OTHER_IN
|
||||||
|
validated_data['number'] = 'RK' + ranstr(7)
|
||||||
obj = FIFO(**validated_data)
|
obj = FIFO(**validated_data)
|
||||||
obj.save()
|
obj.save()
|
||||||
for i in details:
|
for i in details:
|
||||||
if 'details' in i:
|
if 'details' in i:
|
||||||
i['number'] = 'RK' + ranstr(7)
|
|
||||||
p_details = i.pop('details')
|
p_details = i.pop('details')
|
||||||
if len(p_details) != i['count']:
|
if len(p_details) != i['count']:
|
||||||
raise serializers.ValidationError('数目对不上')
|
raise serializers.ValidationError('数目对不上')
|
||||||
|
@ -160,7 +160,6 @@ class FIFOInOtherSerializer(serializers.ModelSerializer):
|
||||||
FIFOItemProduct.objects.bulk_create(p_list0)
|
FIFOItemProduct.objects.bulk_create(p_list0)
|
||||||
else:
|
else:
|
||||||
i['fifo'] = obj
|
i['fifo'] = obj
|
||||||
i['number'] = 'RK' + ranstr(7)
|
|
||||||
FIFOItem.objects.create(**i)
|
FIFOItem.objects.create(**i)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
@ -179,6 +178,7 @@ class FIFOInPurSerializer(serializers.ModelSerializer):
|
||||||
pu_order = validated_data['pu_order']
|
pu_order = validated_data['pu_order']
|
||||||
validated_data['vendor'] = pu_order.vendor
|
validated_data['vendor'] = pu_order.vendor
|
||||||
validated_data['number'] = 'RK' + ranstr(7)
|
validated_data['number'] = 'RK' + ranstr(7)
|
||||||
|
validated_data['type'] = FIFO.FIFO_TYPE_PUR_IN
|
||||||
obj = FIFO.objects.create(**validated_data)
|
obj = FIFO.objects.create(**validated_data)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ class StepViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
子工序-增删改查
|
子工序-增删改查
|
||||||
"""
|
"""
|
||||||
perms_map = {'*':'*'}
|
perms_map = {'get':'*', 'post':'step_create',
|
||||||
|
'put':'step_update', 'delete':'step_delete'}
|
||||||
queryset = Step.objects.all()
|
queryset = Step.objects.all()
|
||||||
serializer_class = StepSerializer
|
serializer_class = StepSerializer
|
||||||
search_fields = ['name', 'number']
|
search_fields = ['name', 'number']
|
||||||
|
@ -74,7 +75,8 @@ class SubProductionViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
产品生产分解增删改查
|
产品生产分解增删改查
|
||||||
"""
|
"""
|
||||||
perms_map={'*':'*'}
|
perms_map={'get':'*', 'post':'subproduction_create',
|
||||||
|
'put':'subproduction_update', 'delete':'subproduction_delete'}
|
||||||
queryset = SubProduction.objects.select_related('process').all()
|
queryset = SubProduction.objects.select_related('process').all()
|
||||||
filterset_fields = ['product', 'process']
|
filterset_fields = ['product', 'process']
|
||||||
search_fields = ['name']
|
search_fields = ['name']
|
||||||
|
@ -89,7 +91,8 @@ class InputMaterialViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
输入物料-增删改查
|
输入物料-增删改查
|
||||||
"""
|
"""
|
||||||
perms_map = {'*':'*'}
|
perms_map = {'get':'*', 'post':'subproduction_material_create',
|
||||||
|
'put':'subproduction_update', 'delete':'subproduction_delete'}
|
||||||
queryset = SubprodctionMaterial.objects.select_related('material').filter(type=SubprodctionMaterial.SUB_MA_TYPE_IN)
|
queryset = SubprodctionMaterial.objects.select_related('material').filter(type=SubprodctionMaterial.SUB_MA_TYPE_IN)
|
||||||
serializer_class = InputMaterialSerializer
|
serializer_class = InputMaterialSerializer
|
||||||
filterset_fields = ['subproduction']
|
filterset_fields = ['subproduction']
|
||||||
|
|
Loading…
Reference in New Issue