diff --git a/apps/wpm/datax.py b/apps/wpm/datax.py index b10252e5..6ade85d1 100644 --- a/apps/wpm/datax.py +++ b/apps/wpm/datax.py @@ -40,7 +40,7 @@ class AnaViewSet(GenericViewSet): mlog_qs = mlog_qs | Mlog.objects.filter(work_start_time__lte=now, work_end_time__gte=now) mlog_qs = mlog_qs.annotate(t_count_use=Sum('b_mlog__count_use')) mlog_qs = mlog_qs.order_by('work_start_time') - mlog_qs_v = mlog_qs.values('id', 'equipment__id', 't_count_use', 'reminder_interval_list', 'work_start_time') + mlog_qs_v = mlog_qs.values('id', 'equipment__id', 't_count_use', 'reminder_interval_list', 'work_start_time', 'work_end_time') mlog_qs_l = list(mlog_qs_v) mlog_dict = {item['equipment__id']: item for item in mlog_qs_l} @@ -56,7 +56,8 @@ class AnaViewSet(GenericViewSet): mlog_dict_v = mlog_dict[item['id']] item['t_count_use'] = mlog_dict_v['t_count_use'] item['reminder_interval_list'] = mlog_dict_v['reminder_interval_list'] - item['work_start_time'] = mlog_dict_v['work_start_time'] + item['work_start_time'] = mlog_dict_v['work_start_time'].strftime('%Y-%m-%d %H:%M:%S') if mlog_dict_v['work_start_time'] else None + item['work_end_time'] = mlog_dict_v['work_end_time'].strftime('%Y-%m-%d %H:%M:%S') if mlog_dict_v['work_end_time'] else None item['mstate'] = tran_time_to_mstate(mstate_json, mlog_dict_v['reminder_interval_list'], mlog_dict_v['work_start_time'], now) if item['state'] in [Equipment.EQUIP_STATE_SCRAP, Equipment.EQUIP_STATE_FIX]: