...
|
...
|
@@ -75,6 +75,7 @@ func (ptr *PGCommonStatisticsService) HourProductiveStatistics(queryOptions map[ |
|
|
productRecordDao, _ := dao.NewProductRecordDao(ptr.transactionContext)
|
|
|
|
|
|
var response = make([]interface{}, 0)
|
|
|
var tmpXData = make([]string, 0)
|
|
|
for _, v := range workshop.GetProductLines(domain.NotDeleted) {
|
|
|
var result = make([]*record, 0)
|
|
|
if err := productRecordDao.TimeSectionProductRecord(request.CompanyId, request.OrgId, request.WorkshopId, v.LineId, SectionNameCCJ, time.Now().Add(-time.Hour*5), &result); err != nil {
|
...
|
...
|
@@ -87,12 +88,18 @@ func (ptr *PGCommonStatisticsService) HourProductiveStatistics(queryOptions map[ |
|
|
xData = append(xData, r.Ts)
|
|
|
values = append(values, r.Total)
|
|
|
}
|
|
|
if len(tmpXData) == 0 {
|
|
|
tmpXData = xData
|
|
|
}
|
|
|
response = append(response, map[string]interface{}{
|
|
|
"lineName": v.LineName,
|
|
|
"data": NewXYData(xData, values),
|
|
|
})
|
|
|
}
|
|
|
return response, nil
|
|
|
return map[string]interface{}{
|
|
|
"xAxis": tmpXData,
|
|
|
"list": response,
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
type HourProductiveStatisticsRequest struct {
|
...
|
...
|
@@ -102,14 +109,15 @@ type HourProductiveStatisticsRequest struct { |
|
|
}
|
|
|
|
|
|
func NewXYData(xData []string, values interface{}) interface{} {
|
|
|
return map[string]interface{}{
|
|
|
"xAxis": map[string]interface{}{
|
|
|
"data": xData,
|
|
|
},
|
|
|
"source": map[string]interface{}{
|
|
|
"value": values,
|
|
|
},
|
|
|
}
|
|
|
//return map[string]interface{}{
|
|
|
//"xAxis": map[string]interface{}{
|
|
|
// "data": xData,
|
|
|
//},
|
|
|
//"source": map[string]interface{}{
|
|
|
// "value": values,
|
|
|
//},
|
|
|
//}
|
|
|
return values
|
|
|
}
|
|
|
|
|
|
// 时段产能-统计 (传串设备)
|
...
|
...
|
@@ -132,6 +140,8 @@ func (ptr *PGCommonStatisticsService) DailyProductiveStatistics(queryOptions map |
|
|
productRecordDao, _ := dao.NewDeviceDailyRunningRecordDao(ptr.transactionContext)
|
|
|
|
|
|
var response = make([]interface{}, 0)
|
|
|
var tmpXData = make([]string, 0)
|
|
|
|
|
|
for _, v := range workshop.GetProductLines(domain.NotDeleted) {
|
|
|
var result = make([]*record, 0)
|
|
|
if err := productRecordDao.TimeSectionRunningRecord(request.CompanyId, request.OrgId, request.WorkshopId, v.LineId, SectionNameCCJ, time.Now().Add(-time.Hour*24*7), &result); err != nil {
|
...
|
...
|
@@ -144,13 +154,19 @@ func (ptr *PGCommonStatisticsService) DailyProductiveStatistics(queryOptions map |
|
|
xData = append(xData, r.Ts)
|
|
|
values = append(values, r.Total)
|
|
|
}
|
|
|
if len(tmpXData) == 0 {
|
|
|
tmpXData = xData
|
|
|
}
|
|
|
response = append(response, map[string]interface{}{
|
|
|
"lineName": v.LineName,
|
|
|
"data": NewXYData(xData, values),
|
|
|
})
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"recent_7_day": response,
|
|
|
"recent_7_day": map[string]interface{}{
|
|
|
"xAxis": tmpXData,
|
|
|
"list": response,
|
|
|
},
|
|
|
}, nil
|
|
|
}
|
|
|
|
...
|
...
|
|