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]