From 7aad8496845890ae1e8f11888be91ef68fd9d1e7 Mon Sep 17 00:00:00 2001 From: zhangxin Date: Thu, 26 May 2022 16:00:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9dashboard=E5=92=8C=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E6=B4=BE=E5=B7=A5=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pln/implments/CustOrder.Dashborad.impl.go | 5 +++-- services/pln/implments/CustOrderLogic.service.impl.go | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/services/pln/implments/CustOrder.Dashborad.impl.go b/services/pln/implments/CustOrder.Dashborad.impl.go index 45a978d..952b573 100644 --- a/services/pln/implments/CustOrder.Dashborad.impl.go +++ b/services/pln/implments/CustOrder.Dashborad.impl.go @@ -1147,14 +1147,15 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, dayModel *b } currentTime = todayStartTime.Add(time.Hour * time.Duration(hour)) for _, productFamilyProductData := range productDataLi { + usedTime := impl.GetUsefulTime(currentTime, productFamilyProductData.LastDoneTime, timeModelList) currentTime = productFamilyProductData.LastDoneTime meter := productFamilyMeterMap[productFamilyProductData.ProductFamilyId] var percent float64 if productFamilyProductData.Qty != 0 && usedTime != 0 && hourAllUsedTime != 0 && meter != 0 { - percent = float64(productFamilyProductData.Qty) / (meter * (float64(usedTime) / float64(hourAllUsedTime))) - //percent = meter / (float64(usedTime) / float64(productFamilyProductData.Qty)) * (float64(usedTime) / float64(hourAllUsedTime)) + percent = (meter / (float64(usedTime) / float64(productFamilyProductData.Qty))) * (float64(usedTime) / float64(hourAllUsedTime)) } + hourPercent += percent } result.ProduceData = append(result.ProduceData, utils.Decimal(hourPercent, 2)) diff --git a/services/pln/implments/CustOrderLogic.service.impl.go b/services/pln/implments/CustOrderLogic.service.impl.go index 86869c8..4b2f41b 100644 --- a/services/pln/implments/CustOrderLogic.service.impl.go +++ b/services/pln/implments/CustOrderLogic.service.impl.go @@ -81,7 +81,9 @@ func (impl *CustOrderServiceImplement) LockCustOrder(user *global.User, custOrde sort.Slice(custOrderLi, func(i, j int) bool { itemI := custOrderLi[i] itemJ := custOrderLi[j] - return itemJ.PlanStartTime.Restore().Before(itemI.PlanStartTime.Restore()) + iUnix := itemI.PlanStartTime.Restore().Unix() + jUnix := itemJ.PlanStartTime.Restore().Unix() + return iUnix < jUnix }) plantNr := user.PlantNr channel, exist := common.ReleaseTaskChannel[plantNr] @@ -266,7 +268,9 @@ func (impl *CustOrderServiceImplement) AnalysisPlanFromExcel(user *global.User, sort.Slice(releaseCustOrderLi, func(i, j int) bool { itemI := releaseCustOrderLi[i] itemJ := releaseCustOrderLi[j] - return itemI.PlanStartTime.Restore().Before(itemJ.PlanStartTime.Restore()) + iUnix := itemI.PlanStartTime.Restore().Unix() + jUnix := itemJ.PlanStartTime.Restore().Unix() + return iUnix < jUnix }) plantNr := user.PlantNr channel, exist := common.ReleaseTaskChannel[plantNr]