diff --git a/services/pln/implments/CustOrder.service.impl.go b/services/pln/implments/CustOrder.service.impl.go index 7d70552..89d8613 100644 --- a/services/pln/implments/CustOrder.service.impl.go +++ b/services/pln/implments/CustOrder.service.impl.go @@ -3126,7 +3126,7 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, dayModel *b productFamilyRelateMap := make(map[string]map[string]interface{}) productFamilyMeterMap := make(map[string]float64) now := time.Now() - //now, _ := time.ParseInLocation(grmi.DateTimeOutFormat, "2022-03-30 23:00:00", utils.TimezoneLocation) + //now, _ := time.ParseInLocation(grmi.DateTimeOutFormat, "2022-04-28 23:00:00", utils.TimezoneLocation) endTime := now.Format(grmi.DateOutFormat) + " 23:59:59" todayStart := now.Format(grmi.DateOutFormat) + " 00:00:00" dateTimeLi := make([]int, 0, now.Hour()) @@ -3283,8 +3283,11 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, dayModel *b } } displayHourLi := make([]string, 0, len(productFamilyAccomplishMap)) - for hour, _ := range productFamilyAccomplishMap { - displayHourLi = append(displayHourLi, strconv.Itoa(hour)+"时") + for hour := 0; hour < 24; hour++ { + _, exist := productFamilyAccomplishMap[hour] + if exist { + displayHourLi = append(displayHourLi, strconv.Itoa(hour)+"时") + } } result = model.CutLine1{ TimeLi: displayHourLi, @@ -3317,7 +3320,8 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, dayModel *b meter := productFamilyMeterMap[productFamilyProductData.ProductFamilyId] var percent float64 if productFamilyProductData.Qty != 0 && usedTime != 0 && hourAllUsedTime != 0 { - percent = meter / (float64(usedTime) / float64(productFamilyProductData.Qty)) * (float64(usedTime) / float64(hourAllUsedTime)) + percent = float64(productFamilyProductData.Qty) / (meter * (float64(usedTime) / float64(hourAllUsedTime))) + //percent = meter / (float64(usedTime) / float64(productFamilyProductData.Qty)) * (float64(usedTime) / float64(hourAllUsedTime)) } hourPercent += percent }