feat: mlog count_fields 可不带count_ok_full

This commit is contained in:
caoqianming 2025-03-20 09:51:15 +08:00
parent fa66a9a4d5
commit 5e3069b147
2 changed files with 6 additions and 2 deletions

View File

@ -274,11 +274,13 @@ class FtestWork(CommonBDModel):
qct = models.ForeignKey(Qct, verbose_name='关联质检表', on_delete=models.SET_NULL, null=True, blank=True) qct = models.ForeignKey(Qct, verbose_name='关联质检表', on_delete=models.SET_NULL, null=True, blank=True)
@classmethod @classmethod
def count_fields(cls): def count_fields(cls, without_count_ok_full=True):
ftestwork_count_fields = [] ftestwork_count_fields = []
for f in FtestWork._meta.fields: for f in FtestWork._meta.fields:
if f.name.startswith("count"): if f.name.startswith("count"):
ftestwork_count_fields.append(f.name) ftestwork_count_fields.append(f.name)
if without_count_ok_full:
ftestwork_count_fields.remove('count_ok_full')
return ftestwork_count_fields return ftestwork_count_fields
def cal_count(self): def cal_count(self):

View File

@ -301,12 +301,14 @@ class Mlog(CommonADModel):
return MlogbDefect.objects.filter(mlogb__mlog=self, mlogb__material_in__isnull=False) return MlogbDefect.objects.filter(mlogb__mlog=self, mlogb__material_in__isnull=False)
@classmethod @classmethod
def count_fields(cls): def count_fields(cls, without_count_ok_full=True):
mlog_count_fields = [] mlog_count_fields = []
for f in Mlog._meta.fields: for f in Mlog._meta.fields:
if f.name.startswith("count"): if f.name.startswith("count"):
mlog_count_fields.append(f.name) mlog_count_fields.append(f.name)
mlog_count_fields.remove("count_real_eweight") mlog_count_fields.remove("count_real_eweight")
if without_count_ok_full:
mlog_count_fields.remove("count_ok_full")
return mlog_count_fields return mlog_count_fields
class Mlogb(BaseModel): class Mlogb(BaseModel):