记录表格分类2
This commit is contained in:
parent
bfc4634281
commit
a708f261af
|
@ -190,24 +190,11 @@ class RecordFormCreateSerializer(serializers.ModelSerializer):
|
|||
model = RecordForm
|
||||
fields = ['name', 'type', 'step', 'material', 'number', 'enabled']
|
||||
|
||||
def validate(self, attrs):
|
||||
if attrs['enabled']:
|
||||
if RecordForm.objects.filter(type=attrs['type'],
|
||||
enabled=True).exists():
|
||||
raise ValidationError('已存在启用的同类检查表')
|
||||
return super().validate(attrs)
|
||||
|
||||
class RecordFormUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = RecordForm
|
||||
fields = ['name', 'type', 'number', 'enabled']
|
||||
|
||||
def validate(self, attrs):
|
||||
if attrs['enabled']:
|
||||
if RecordForm.objects.filter(type=attrs['type'],
|
||||
enabled=True).exists():
|
||||
raise ValidationError('已存在启用的同类检查表')
|
||||
return super().validate(attrs)
|
||||
|
||||
class RecordFormFieldSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
|
@ -7,7 +7,7 @@ import django.utils.timezone as timezone
|
|||
from django.db.models.query import QuerySet
|
||||
|
||||
from utils.model import SoftModel, BaseModel
|
||||
from apps.mtm.models import Material, Process, SubProduction, SubprodctionMaterial
|
||||
from apps.mtm.models import Material, Process, RecordFormField, SubProduction, SubprodctionMaterial
|
||||
from apps.sam.models import Order
|
||||
|
||||
class ProductionPlan(CommonAModel):
|
||||
|
@ -91,6 +91,16 @@ class SubProductionPlan(CommonAModel):
|
|||
verbose_name = '子生产计划'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
class FirstItem(BaseModel):
|
||||
"""
|
||||
首件确认表记录条目
|
||||
"""
|
||||
form_field = models.ForeignKey(RecordFormField, verbose_name='关联自定义表格字段', on_delete=models.CASCADE)
|
||||
field_value = models.JSONField('录入值', null=True, blank=True)
|
||||
is_hidden = models.BooleanField('是否隐藏', default=False)
|
||||
is_testok = models.BooleanField('是否合格', null=True, blank=True)
|
||||
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联的子计划', on_delete=models.CASCADE, related_name='item_test_record')
|
||||
|
||||
class SubProductionProgress(BaseModel):
|
||||
"""
|
||||
子计划生产进度统计表/物料消耗
|
||||
|
@ -104,3 +114,4 @@ class SubProductionProgress(BaseModel):
|
|||
count_real = models.PositiveIntegerField('实际消耗/产出数', default=0)
|
||||
count_ok = models.PositiveIntegerField('合格数量', default=0)
|
||||
count_notok = models.PositiveIntegerField('不合格数量', default=0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue