from django.db import models
from apps.utils.models import BaseModel
from apps.mtm.models import Material
from apps.pum.models import Supplier
# Create your models here.

class LableMat(BaseModel):
    state = models.PositiveSmallIntegerField('状态', default=10, choices=((10, '合格'), (20, '不合格'), (30, '返修'), (40, '检验'), (50, '报废')))
    material = models.ForeignKey(Material, on_delete=models.CASCADE)
    batch = models.CharField('批次号', max_length=100)
    supplier = models.ForeignKey(Supplier, verbose_name='外协供应商', on_delete=models.SET_NULL, null=True, blank=True)
    notok_sign = models.CharField('不合格标记', max_length=10, null=True, blank=True)
    material_origin = models.ForeignKey(Material, verbose_name='原始物料', on_delete=models.SET_NULL, null=True, blank=True, related_name='lm_mo')