From 107891ad6d64443d511bd814b77d04199867b995 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 30 Aug 2021 13:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BE=93=E5=85=A5=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E7=89=A9=E6=96=99=E8=AE=A1=E6=95=B0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mtm/migrations/0006_auto_20210830_1331.py | 23 +++++++++++++++++++ hb_server/apps/mtm/models.py | 4 ++-- hb_server/apps/mtm/serializers.py | 8 +++---- 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 hb_server/apps/mtm/migrations/0006_auto_20210830_1331.py diff --git a/hb_server/apps/mtm/migrations/0006_auto_20210830_1331.py b/hb_server/apps/mtm/migrations/0006_auto_20210830_1331.py new file mode 100644 index 0000000..1c9e75a --- /dev/null +++ b/hb_server/apps/mtm/migrations/0006_auto_20210830_1331.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.6 on 2021-08-30 05:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('mtm', '0005_auto_20210830_1313'), + ] + + operations = [ + migrations.RenameField( + model_name='inputmaterial', + old_name='number', + new_name='count', + ), + migrations.RenameField( + model_name='outputmaterial', + old_name='number', + new_name='count', + ), + ] diff --git a/hb_server/apps/mtm/models.py b/hb_server/apps/mtm/models.py index b005006..680e770 100644 --- a/hb_server/apps/mtm/models.py +++ b/hb_server/apps/mtm/models.py @@ -116,7 +116,7 @@ class InputMaterial(CommonAModel): 输入物料 """ material = models.ForeignKey(Material, verbose_name='输入物料', on_delete=models.CASCADE, related_name='inputmaterial') - number = models.FloatField('消耗量', default=1) + count = models.FloatField('消耗量', default=1) product = models.ForeignKey(Material, verbose_name='关联产品', on_delete=models.CASCADE, related_name='inputmaterial_product') process = models.ForeignKey(Process, verbose_name='关联工序', on_delete=models.CASCADE) sort = models.IntegerField('排序号', default=1) @@ -131,7 +131,7 @@ class OutputMaterial(CommonAModel): 输出物料 """ material = models.ForeignKey(Material, verbose_name='输出物料', on_delete=models.CASCADE, related_name='outputmaterial') - number = models.FloatField('产出量', default=1) + count = models.FloatField('产出量', default=1) product = models.ForeignKey(Material, verbose_name='关联产品', on_delete=models.CASCADE, related_name='outputmaterial_product') process = models.ForeignKey(Process, verbose_name='关联工序', on_delete=models.CASCADE) sort = models.IntegerField('排序号', default=1) diff --git a/hb_server/apps/mtm/serializers.py b/hb_server/apps/mtm/serializers.py index 870a9a0..1b3009b 100644 --- a/hb_server/apps/mtm/serializers.py +++ b/hb_server/apps/mtm/serializers.py @@ -70,7 +70,7 @@ class OutputMaterialListSerializer(serializers.ModelSerializer): class InputMaterialSerializer(serializers.ModelSerializer): class Meta: model = InputMaterial - fields = ['number', 'unit', 'sort', 'material', 'product', 'process'] + fields = ['count', 'sort', 'material', 'product', 'process'] def create(self, validated_data): if InputMaterial.objects.filter(material=validated_data['material'], product=validated_data['product'], process=validated_data['process'], is_deleted=False).exists(): @@ -80,12 +80,12 @@ class InputMaterialSerializer(serializers.ModelSerializer): class InputMaterialUpdateSerializer(serializers.ModelSerializer): class Meta: model = InputMaterial - fields = ['number', 'unit', 'sort'] + fields = ['count', 'sort'] class OutputMaterialSerializer(serializers.ModelSerializer): class Meta: model = OutputMaterial - fields = ['number', 'unit', 'sort', 'material', 'product', 'process'] + fields = ['count', 'sort', 'material', 'product', 'process'] def create(self, validated_data): if OutputMaterial.objects.filter(material=validated_data['material'], product=validated_data['product'], process=validated_data['process'], is_deleted=False).exists(): @@ -95,4 +95,4 @@ class OutputMaterialSerializer(serializers.ModelSerializer): class OutputMaterialUpdateSerializer(serializers.ModelSerializer): class Meta: model = OutputMaterial - fields = ['number', 'unit', 'sort'] \ No newline at end of file + fields = ['count', 'sort'] \ No newline at end of file