feat: ftestwork添加设备和备注字段

This commit is contained in:
caoqianming 2024-11-21 10:45:31 +08:00
parent 3dfcbd8a8b
commit 9014a7c869
3 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,25 @@
# Generated by Django 3.2.12 on 2024-11-21 02:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('em', '0018_alter_equipment_mgroup'),
('qm', '0025_auto_20240920_0914'),
]
operations = [
migrations.AddField(
model_name='ftestwork',
name='equipment',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='em.equipment', verbose_name='所属检验设备'),
),
migrations.AddField(
model_name='ftestwork',
name='note',
field=models.TextField(blank=True, null=True, verbose_name='备注'),
),
]

View File

@ -2,6 +2,7 @@ from django.db import models
from apps.system.models import CommonAModel, CommonADModel, User
from apps.utils.models import CommonBDModel, BaseModel
from apps.mtm.models import Material, Mgroup, Team, Shift
from apps.em.models import Equipment
from apps.wpm.models import SfLog, WMaterial
from django.utils.translation import gettext_lazy as _
@ -131,6 +132,8 @@ class FtestWork(CommonBDModel):
User, verbose_name='操作人', on_delete=models.CASCADE, related_name='ftestwork_test_user', null=True, blank=True)
submit_time = models.DateTimeField('提交时间', null=True, blank=True)
submit_user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='提交人', null=True, blank=True)
note = models.TextField('备注', null=True, blank=True)
equipment = models.ForeignKey(Equipment, verbose_name='所属检验设备', on_delete=models.SET_NULL, null=True, blank=True)
class Ftest(CommonBDModel):

View File

@ -66,7 +66,11 @@ class QuaStatUpdateSerializer(CustomModelSerializer):
class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
class Meta:
model = FtestWork
fields = ['id', 'shift', 'wm', 'mb', 'type', 'type2', 'test_date', 'count', 'count_sampling', 'count_sampling_ok', 'count_ok', 'count_notok', 'count_notok_json', 'test_user', 'need_update_wm']
fields = ['id', 'shift', 'wm', 'mb',
'type', 'type2', 'test_date', 'count', 'count_sampling',
'count_sampling_ok', 'count_ok', 'count_notok',
'count_notok_json', 'test_user', 'need_update_wm',
'equipment', 'note']
extra_kwargs = {'test_user': {'required': True}, 'type': {'required': True}}
def validate(self, attrs):