feat: labelmat和wpr都加上返修Enum
This commit is contained in:
parent
0c5cc55b54
commit
553fbcc826
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2.12 on 2025-02-24 02:21
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('cm', '0002_lablemat_defect'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='lablemat',
|
||||||
|
name='state',
|
||||||
|
field=models.PositiveSmallIntegerField(choices=[(10, '合格'), (20, '不合格'), (30, '返修'), (34, '返修完成'), (40, '检验'), (50, '报废')], default=10, verbose_name='状态'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -2,10 +2,11 @@ from django.db import models
|
||||||
from apps.utils.models import BaseModel
|
from apps.utils.models import BaseModel
|
||||||
from apps.mtm.models import Material
|
from apps.mtm.models import Material
|
||||||
from apps.pum.models import Supplier
|
from apps.pum.models import Supplier
|
||||||
|
from apps.wpm.models import WmStateOption
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
class LableMat(BaseModel):
|
class LableMat(BaseModel):
|
||||||
state = models.PositiveSmallIntegerField('状态', default=10, choices=((10, '合格'), (20, '不合格'), (30, '返修'), (40, '检验'), (50, '报废')))
|
state = models.PositiveSmallIntegerField('状态', default=10, choices=WmStateOption.choices)
|
||||||
material = models.ForeignKey(Material, on_delete=models.CASCADE)
|
material = models.ForeignKey(Material, on_delete=models.CASCADE)
|
||||||
batch = models.CharField('批次号', max_length=100)
|
batch = models.CharField('批次号', max_length=100)
|
||||||
supplier = models.ForeignKey(Supplier, verbose_name='外协供应商', on_delete=models.SET_NULL, null=True, blank=True)
|
supplier = models.ForeignKey(Supplier, verbose_name='外协供应商', on_delete=models.SET_NULL, null=True, blank=True)
|
||||||
|
|
|
@ -18,6 +18,6 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='wmaterial',
|
model_name='wmaterial',
|
||||||
name='state',
|
name='state',
|
||||||
field=models.PositiveSmallIntegerField(choices=[(10, '合格'), (20, '不合格'), (30, '返修'), (32, '返修完成'), (40, '检验'), (50, '报废')], default=10, verbose_name='状态'),
|
field=models.PositiveSmallIntegerField(choices=[(10, '合格'), (20, '不合格'), (30, '返修'), (34, '返修完成'), (40, '检验'), (50, '报废')], default=10, verbose_name='状态'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -96,6 +96,7 @@ class WmStateOption(models.IntegerChoices):
|
||||||
OK = 10, _("合格")
|
OK = 10, _("合格")
|
||||||
NOTOK = 20, _("不合格")
|
NOTOK = 20, _("不合格")
|
||||||
REPAIR = 30, _("返修")
|
REPAIR = 30, _("返修")
|
||||||
|
REPAIRED = 34, _("返修完成")
|
||||||
TEST = 40, _("检验")
|
TEST = 40, _("检验")
|
||||||
SCRAP = 50, _("报废")
|
SCRAP = 50, _("报废")
|
||||||
|
|
||||||
|
@ -108,7 +109,7 @@ class WMaterial(CommonBDModel):
|
||||||
WM_REPAIR = 30
|
WM_REPAIR = 30
|
||||||
WM_TEST = 40
|
WM_TEST = 40
|
||||||
WM_SCRAP = 50
|
WM_SCRAP = 50
|
||||||
state = models.PositiveSmallIntegerField('状态', default=10, choices=((10, '合格'), (20, '不合格'), (30, '返修'), (32, '返修完成'), (40, '检验'), (50, '报废')))
|
state = models.PositiveSmallIntegerField('状态', default=10, choices=WmStateOption.choices)
|
||||||
material = models.ForeignKey(
|
material = models.ForeignKey(
|
||||||
Material, verbose_name='物料', on_delete=models.CASCADE, related_name='wm_m')
|
Material, verbose_name='物料', on_delete=models.CASCADE, related_name='wm_m')
|
||||||
supplier = models.ForeignKey(Supplier, verbose_name='外协供应商', on_delete=models.SET_NULL, null=True, blank=True)
|
supplier = models.ForeignKey(Supplier, verbose_name='外协供应商', on_delete=models.SET_NULL, null=True, blank=True)
|
||||||
|
@ -144,7 +145,7 @@ class WMaterial(CommonBDModel):
|
||||||
material_out=mtask.material_in
|
material_out=mtask.material_in
|
||||||
).values_list('batch', flat=True)
|
).values_list('batch', flat=True)
|
||||||
),
|
),
|
||||||
state__in=[WMaterial.WM_OK]
|
state__in=[WMaterial.WM_OK, WMaterial.WM_REPAIR]
|
||||||
)
|
)
|
||||||
|
|
||||||
class Fmlog(CommonADModel):
|
class Fmlog(CommonADModel):
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2.12 on 2025-02-24 02:21
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('wpmw', '0002_wpr_oinfo'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='wpr',
|
||||||
|
name='state',
|
||||||
|
field=models.PositiveSmallIntegerField(choices=[(10, '合格'), (20, '不合格'), (30, '返修'), (34, '返修完成'), (40, '检验'), (50, '报废')], default=10, verbose_name='状态'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -4,6 +4,7 @@ from apps.qm.models import FtestDefect, FtestItem
|
||||||
from apps.utils.models import BaseModel
|
from apps.utils.models import BaseModel
|
||||||
from apps.mtm.models import Material
|
from apps.mtm.models import Material
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
|
from apps.wpm.models import WmStateOption
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Wpr(BaseModel):
|
class Wpr(BaseModel):
|
||||||
|
@ -12,7 +13,7 @@ class Wpr(BaseModel):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
number = models.CharField("编号", max_length=50, unique=True, null=True, blank=True)
|
number = models.CharField("编号", max_length=50, unique=True, null=True, blank=True)
|
||||||
state = models.PositiveSmallIntegerField('状态', default=10, choices=((10, '合格'), (20, '不合格'), (30, '返修'), (40, '检验'), (50, '报废')))
|
state = models.PositiveSmallIntegerField('状态', default=10, choices=WmStateOption.choices)
|
||||||
material = models.ForeignKey(Material, verbose_name="当前物料形态", on_delete=models.CASCADE)
|
material = models.ForeignKey(Material, verbose_name="当前物料形态", on_delete=models.CASCADE)
|
||||||
defects = models.ManyToManyField("qm.defect", through="wpmw.wprdefect", verbose_name="缺陷项")
|
defects = models.ManyToManyField("qm.defect", through="wpmw.wprdefect", verbose_name="缺陷项")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue