fix: 去除materialbatch的数据库约束
This commit is contained in:
parent
a1525d1289
commit
af999467db
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 3.2.12 on 2025-02-21 09:23
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('inm', '0026_mioitemw_ftest'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='materialbatch',
|
||||||
|
unique_together=set(),
|
||||||
|
),
|
||||||
|
]
|
|
@ -36,9 +36,6 @@ class MaterialBatch(BaseModel):
|
||||||
material_ofrom = models.ForeignKey(Material, verbose_name='原料物料', on_delete=models.SET_NULL, null=True, blank=True, related_name='mb_mofrom')
|
material_ofrom = models.ForeignKey(Material, verbose_name='原料物料', on_delete=models.SET_NULL, null=True, blank=True, related_name='mb_mofrom')
|
||||||
defect = models.ForeignKey('qm.defect', verbose_name='缺陷', on_delete=models.PROTECT, null=True, blank=True)
|
defect = models.ForeignKey('qm.defect', verbose_name='缺陷', on_delete=models.PROTECT, null=True, blank=True)
|
||||||
|
|
||||||
class Meta:
|
|
||||||
unique_together = ('material', 'batch', 'warehouse')
|
|
||||||
|
|
||||||
|
|
||||||
class MaterialBatchA(BaseModel):
|
class MaterialBatchA(BaseModel):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -325,7 +325,7 @@ class InmService:
|
||||||
state = WMaterial.WM_OK
|
state = WMaterial.WM_OK
|
||||||
if defect:
|
if defect:
|
||||||
state = WMaterial.WM_NOTOK
|
state = WMaterial.WM_NOTOK
|
||||||
mb, _ = MaterialBatch.safe_get_or_create(
|
mb, _ = MaterialBatch.objects.get_or_create(
|
||||||
material=material,
|
material=material,
|
||||||
warehouse=warehouse,
|
warehouse=warehouse,
|
||||||
batch=batch,
|
batch=batch,
|
||||||
|
|
Loading…
Reference in New Issue