feat: mlogb添加qct字段以便调用检验表
This commit is contained in:
parent
98f4af2f8c
commit
7c9feb23ac
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 3.2.12 on 2025-01-07 07:28
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('qm', '0033_alter_ftest_test_numer'),
|
||||||
|
('wpm', '0081_auto_20250107_1423'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='mlogb',
|
||||||
|
name='qct',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='qm.qct', verbose_name='所用质检表'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -292,6 +292,7 @@ class Mlog(CommonADModel):
|
||||||
return mlog_count_fields
|
return mlog_count_fields
|
||||||
|
|
||||||
class Mlogb(BaseModel):
|
class Mlogb(BaseModel):
|
||||||
|
qct = models.ForeignKey("qm.qct", verbose_name='所用质检表', on_delete=models.SET_NULL, null=True, blank=True)
|
||||||
mlog = models.ForeignKey(Mlog, verbose_name='关联日志',
|
mlog = models.ForeignKey(Mlog, verbose_name='关联日志',
|
||||||
on_delete=models.CASCADE, related_name='b_mlog')
|
on_delete=models.CASCADE, related_name='b_mlog')
|
||||||
note = models.TextField('备注', default='', blank=True)
|
note = models.TextField('备注', default='', blank=True)
|
||||||
|
@ -343,6 +344,11 @@ class Mlogb(BaseModel):
|
||||||
count_n_qt = models.PositiveIntegerField('其他', default=0)
|
count_n_qt = models.PositiveIntegerField('其他', default=0)
|
||||||
count_notok_json = models.JSONField('不合格情况', default=list, blank=True)
|
count_notok_json = models.JSONField('不合格情况', default=list, blank=True)
|
||||||
|
|
||||||
|
# class MlogbDefect(BaseModel):
|
||||||
|
# mlogb = models.ForeignKey(Mlogb, verbose_name='关联记录', on_delete=models.CASCADE)
|
||||||
|
# defect = models.ForeignKey("qm.defect", verbose_name='缺陷', on_delete=models.CASCADE)
|
||||||
|
# count = models.PositiveIntegerField('数量', default=0)
|
||||||
|
|
||||||
class Mlogbw(BaseModel):
|
class Mlogbw(BaseModel):
|
||||||
number = models.TextField('单个编号')
|
number = models.TextField('单个编号')
|
||||||
mlogb = models.ForeignKey(Mlogb, verbose_name='生产记录', on_delete=models.CASCADE)
|
mlogb = models.ForeignKey(Mlogb, verbose_name='生产记录', on_delete=models.CASCADE)
|
||||||
|
|
|
@ -28,6 +28,7 @@ from .services import mlog_submit, handover_submit, mlog_revert
|
||||||
from apps.wpm.services import mlog_submit_validate, generate_new_batch
|
from apps.wpm.services import mlog_submit_validate, generate_new_batch
|
||||||
from apps.wf.models import State
|
from apps.wf.models import State
|
||||||
from apps.wpmw.models import Wpr
|
from apps.wpmw.models import Wpr
|
||||||
|
from apps.qm.models import QctMat
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,6 +519,10 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
xcount = math.ceil( mlogbin.count_use / route.div_number)
|
xcount = math.ceil( mlogbin.count_use / route.div_number)
|
||||||
d_count_real = xcount
|
d_count_real = xcount
|
||||||
d_count_ok = xcount
|
d_count_ok = xcount
|
||||||
|
# 找寻质检表
|
||||||
|
qctmat = QctMat.objects.filter(material=material_out).order_by("-create_time").frist()
|
||||||
|
if qctmat:
|
||||||
|
mlogbout.qct = qctmat.qct
|
||||||
mlogbout.count_real = d_count_real
|
mlogbout.count_real = d_count_real
|
||||||
mlogbout.count_ok = d_count_ok
|
mlogbout.count_ok = d_count_ok
|
||||||
mlogbout.save()
|
mlogbout.save()
|
||||||
|
|
Loading…
Reference in New Issue