feat: 光子棒管综合统计添加数据
This commit is contained in:
parent
e6b27950b2
commit
8cbb921969
|
@ -228,7 +228,7 @@ def get_alldata_with_batch(batch: str):
|
|||
# 六车间工段生产数据
|
||||
|
||||
# 六车间工段生产数据
|
||||
mgroup_list = ["平头", "粘铁头", "粗中细磨", "抛光", "开槽"]
|
||||
mgroup_list = ["平头", "粘铁头", "粗中细磨", "平磨", "掏管", "抛光", "开槽", "倒角"]
|
||||
for mgroup_name in mgroup_list:
|
||||
if mgroup_name == '粗中细磨':
|
||||
mgroups = Mgroup.objects.filter(name__in=['粗磨', '粗中磨', '粗中细磨'])
|
||||
|
@ -276,9 +276,38 @@ def get_alldata_with_batch(batch: str):
|
|||
# data["六车间生产入库_日期"] = list(set(data["六车间生产入库_日期"]))
|
||||
# data["六车间生产入库_日期"] = ";".join([item.strftime("%Y-%m-%d") for item in data["六车间生产入库_日期"]])
|
||||
|
||||
# 成品检验数据
|
||||
ftestwork_count_fields = FtestWork.count_fields()
|
||||
ftestwork_qs = FtestWork.objects.filter(batch=batch)
|
||||
# 六车间中检数据
|
||||
ftestwork_qs = FtestWork.objects.filter(batch=batch, type="process")
|
||||
if ftestwork_qs.exists():
|
||||
data["六车间中检_日期"] = []
|
||||
data['六车间中检_检验人'] = []
|
||||
for item in ftestwork_qs:
|
||||
last_time = item.update_time if item.update_time > last_time else last_time
|
||||
if item.test_date:
|
||||
data["六车间中检_日期"].append(item.test_date)
|
||||
if item.test_user:
|
||||
data['六车间中检_检验人'].append(item.test_user)
|
||||
for field in ftestwork_count_fields:
|
||||
if field == 'count_notok_json':
|
||||
for k, v in getattr(item, field).items():
|
||||
if f'六车间中检_{k}' not in data:
|
||||
data[f'六车间中检_{k}'] = v
|
||||
else:
|
||||
data[f'六车间中检_{k}'] += v
|
||||
else:
|
||||
if getattr(item, field) > 0 or field in ["count", "count_ok"]:
|
||||
if f'六车间中检_{field}' not in data:
|
||||
data[f'六车间中检_{field}'] = getattr(item, field)
|
||||
else:
|
||||
data[f'六车间中检_{field}'] += getattr(item, field)
|
||||
data["六车间中检_日期"] = list(set(data["六车间中检_日期"]))
|
||||
data["六车间中检_日期"] = ";".join([item.strftime("%Y-%m-%d") for item in data["六车间中检_日期"]])
|
||||
data['六车间中检_检验人'] = list(set(data['六车间中检_检验人']))
|
||||
data['六车间中检_检验人'] = ";".join([item.name for item in data['六车间中检_检验人']])
|
||||
|
||||
# 成品检验数据
|
||||
ftestwork_qs = FtestWork.objects.filter(batch=batch, type="prod")
|
||||
if ftestwork_qs.exists():
|
||||
data["成品检验_日期"] = []
|
||||
data['成品检验_检验人'] = []
|
||||
|
|
Loading…
Reference in New Issue