fix: 粗中细磨的统计要涵盖粗磨和粗中磨的数据

This commit is contained in:
caoqianming 2025-02-11 14:40:38 +08:00
parent 44486b64a3
commit ac41f5a105
1 changed files with 5 additions and 2 deletions

View File

@ -230,8 +230,11 @@ def get_alldata_with_batch(batch: str):
# 六车间工段生产数据
mgroup_list = ["平头", "粘铁头", "粗中细磨", "抛光", "开槽"]
for mgroup_name in mgroup_list:
mgroup = Mgroup.objects.get(name=mgroup_name)
mlogs_qs = Mlog.objects.filter(submit_time__isnull=False, mgroup=mgroup, batch=batch)
if mgroup_name == '粗中细磨':
mgroups = Mgroup.objects.filter(name__in=['粗磨', '粗中磨', '粗中细磨'])
else:
mgroups = Mgroup.objects.filter(name=mgroup_name)
mlogs_qs = Mlog.objects.filter(submit_time__isnull=False, mgroup__in=mgroups, batch=batch)
if mlogs_qs.exists():
last_time = item.update_time if item.update_time > last_time else last_time
data[f'六车间_{mgroup_name}_日期'] = []