feat: ftestwork 增加shift字段

This commit is contained in:
caoqianming 2024-09-11 16:39:09 +08:00
parent 1caba24321
commit bc92e90765
4 changed files with 25 additions and 3 deletions

View File

@ -34,5 +34,6 @@ class FtestWorkFilter(filters.FilterSet):
"mb": ["exact"], "mb": ["exact"],
"batch": ["exact"], "batch": ["exact"],
"type": ["exact"], "type": ["exact"],
"type2": ["exact"], "type2": ["exact"],
"shift": ["exact"]
} }

View File

@ -0,0 +1,20 @@
# Generated by Django 3.2.12 on 2024-09-11 08:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mtm', '0041_process_mstate_json'),
('qm', '0023_ftestwork_need_update_wm'),
]
operations = [
migrations.AddField(
model_name='ftestwork',
name='shift',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='mtm.shift', verbose_name='班次'),
),
]

View File

@ -1,7 +1,7 @@
from django.db import models from django.db import models
from apps.system.models import CommonAModel, CommonADModel, User from apps.system.models import CommonAModel, CommonADModel, User
from apps.utils.models import CommonBDModel, BaseModel from apps.utils.models import CommonBDModel, BaseModel
from apps.mtm.models import Material, Mgroup, Team from apps.mtm.models import Material, Mgroup, Team, Shift
from apps.wpm.models import SfLog, WMaterial from apps.wpm.models import SfLog, WMaterial
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
@ -111,6 +111,7 @@ class FtestWork(CommonBDModel):
""" """
type = models.CharField('检验类型', max_length=20, choices=FTEST_TYPE_CHOICES, default='prod') type = models.CharField('检验类型', max_length=20, choices=FTEST_TYPE_CHOICES, default='prod')
type2 = models.PositiveSmallIntegerField('检验类型2', choices=((10, '抽检'), (20, '全检')), default=10) type2 = models.PositiveSmallIntegerField('检验类型2', choices=((10, '抽检'), (20, '全检')), default=10)
shift = models.ForeignKey(Shift, verbose_name='班次', on_delete=models.SET_NULL, null=True, blank=True)
wm = models.ForeignKey(WMaterial, verbose_name='关联车间库存', on_delete=models.SET_NULL, null=True, blank=True) wm = models.ForeignKey(WMaterial, verbose_name='关联车间库存', on_delete=models.SET_NULL, null=True, blank=True)
mb = models.ForeignKey('inm.materialbatch', verbose_name='关联仓库', on_delete=models.SET_NULL, null=True, blank=True) mb = models.ForeignKey('inm.materialbatch', verbose_name='关联仓库', on_delete=models.SET_NULL, null=True, blank=True)
test_date = models.DateField('检验日期') test_date = models.DateField('检验日期')

View File

@ -63,7 +63,7 @@ class QuaStatUpdateSerializer(CustomModelSerializer):
class FtestWorkCreateUpdateSerializer(CustomModelSerializer): class FtestWorkCreateUpdateSerializer(CustomModelSerializer):
class Meta: class Meta:
model = FtestWork model = FtestWork
fields = ['id', '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']
extra_kwargs = {'test_user': {'required': True}, 'type': {'required': True}} extra_kwargs = {'test_user': {'required': True}, 'type': {'required': True}}
def validate(self, attrs): def validate(self, attrs):