diff --git a/apps/wpm/migrations/0026_alter_wmaterial_unique_together.py b/apps/wpm/migrations/0026_alter_wmaterial_unique_together.py new file mode 100644 index 00000000..f813567d --- /dev/null +++ b/apps/wpm/migrations/0026_alter_wmaterial_unique_together.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.12 on 2023-11-01 10:15 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('mtm', '0022_alter_material_cate'), + ('system', '0002_myschedule'), + ('wpm', '0025_auto_20231101_1751'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='wmaterial', + unique_together={('material', 'batch', 'belong_dept')}, + ), + ] diff --git a/apps/wpm/models.py b/apps/wpm/models.py index 052b877f..80dd9b71 100644 --- a/apps/wpm/models.py +++ b/apps/wpm/models.py @@ -78,6 +78,9 @@ class WMaterial(CommonBDModel): batch = models.CharField('批次号', max_length=50) count = models.PositiveIntegerField('当前数量', default=0) + class Meta: + unique_together = ('material', 'batch', 'belong_dept') + class Mlog(CommonADModel): """