更新数据库

This commit is contained in:
caoqianming 2021-11-22 11:11:22 +08:00
parent eba134a2c3
commit 684f4b997f
2 changed files with 47 additions and 1 deletions

View File

@ -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='当前子生产计划'),
),
]

View File

@ -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