diff --git a/hb_server/apps/wpm/migrations/0019_auto_20211122_1110.py b/hb_server/apps/wpm/migrations/0019_auto_20211122_1110.py new file mode 100644 index 0000000..aaffb4a --- /dev/null +++ b/hb_server/apps/wpm/migrations/0019_auto_20211122_1110.py @@ -0,0 +1,46 @@ +# Generated by Django 3.2.9 on 2021-11-22 03:10 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('mtm', '0035_auto_20211117_1637'), + ('pm', '0014_subproductionplan_number'), + ('wpm', '0018_auto_20211119_1340'), + ] + + operations = [ + migrations.AddField( + model_name='operationmaterial', + name='batch', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='批次号'), + ), + migrations.AddField( + model_name='operationmaterial', + name='subproduction_plan', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='pm.subproductionplan', verbose_name='关联的子计划'), + ), + migrations.AddField( + model_name='operationmaterial', + name='subproduction_progress', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='pm.subproductionprogress', verbose_name='关联的生产进度'), + ), + migrations.AlterField( + model_name='operationmaterial', + name='material', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='可能产出的产品'), + ), + migrations.AlterField( + model_name='operationmaterial', + name='type', + field=models.IntegerField(choices=[(1, '输入物料'), (2, '输出物料'), (3, '工具工装')], default=0, verbose_name='类型'), + ), + migrations.AlterField( + model_name='wproduct', + name='subproduction_plan', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wproduct_subplan', to='pm.subproductionplan', verbose_name='当前子生产计划'), + ), + ] diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 4bcf0b0..ed9e087 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -327,7 +327,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd ope.save() # 查询所需的工具工装 for i in SubprodctionMaterial.objects.filter(type=SubprodctionMaterial.SUB_MA_TYPE_TOOL, - subproduction__subplan_subprod__in = splans): + subproduction__subplan_subprod__in = splans, is_deleted=False).distinct(): opm = OperationMaterial() opm.operation = op opm.material = i.material