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