V0 图表工序模糊

This commit is contained in:
jh_peng 2024-10-25 14:21:42 +08:00
parent 8664dd811a
commit 289e2438a2
2 changed files with 27 additions and 14 deletions

View File

@ -1608,3 +1608,16 @@
2024-10-12 10:24:07 INFO | 192.168.0.172 | 200 | 34.1357627s | POST | 未登录 | /testData/upload
2024-10-12 10:25:24 INFO | 192.168.0.172 | 200 | 9.8706437s | POST | 未登录 | /testData/upload
2024-10-12 11:07:57 INFO | 192.168.0.172 | 200 | 3.6585071s | POST | 未登录 | /testData/upload
2024-10-25 11:45:36 INFO | 192.168.0.172 | 200 | 8.9895476s | POST | 未登录 | /testData/report/fTPassProbabilityByFactory
2024-10-25 11:45:54 INFO | 192.168.0.172 | 200 | 12.0813898s | POST | 未登录 | /testData/report/fTPassProbabilityByFactory
2024-10-25 11:47:59 INFO | 192.168.0.172 | 200 | 1m7.2460034s | POST | 未登录 | /testData/report/fTPassProbabilityByFactory
2024-10-25 11:47:59 INFO | 192.168.0.172 | 200 | 537.1648ms | POST | 未登录 | /testData/report/fTPassProbabilityByFactory
2024-10-25 11:48:04 INFO | 192.168.0.172 | 200 | 1.3197859s | POST | 未登录 | /testData/report/fTPassProbabilityByFactory
2024-10-25 13:38:18 INFO | 192.168.0.172 | 200 | 1h50m8.5600005s | POST | 未登录 | /testData/report/fTPassProbabilityByFactory
2024-10-25 14:18:57 INFO | 192.168.0.172 | 200 | 2.76ms | POST | 未登录 | /testData/report/fTPassProbabilityByProduct
2024-10-25 14:19:00 INFO | 192.168.0.172 | 200 | 1.8711ms | POST | 未登录 | /testData/report/fTPassProbabilityByProduct
2024-10-25 14:19:03 INFO | 192.168.0.172 | 200 | 1.7605ms | POST | 未登录 | /testData/report/fTPassProbabilityByProduct
2024-10-25 14:19:04 INFO | 192.168.0.172 | 200 | 1.6458ms | POST | 未登录 | /testData/report/fTPassProbabilityByProduct
2024-10-25 14:19:05 INFO | 192.168.0.172 | 200 | 690.6µs | POST | 未登录 | /testData/report/fTPassProbabilityByProduct
2024-10-25 14:21:11 INFO | 192.168.0.172 | 200 | 12.1305132s | POST | 未登录 | /testData/report/fTPassProbabilityByProduct
2024-10-25 14:21:27 INFO | 192.168.0.172 | 200 | 2.3926672s | POST | 未登录 | /testData/report/fTPassProbabilityByProduct

View File

@ -274,8 +274,8 @@ func OrderNumberHistogram(r *request.PackagePassProbabilityLine) []*model.Histog
func PassProbabilityByFactory(r *request.PassProbabilityByFactory) ([]*model.Line, []*model.Histogram, int, int) {
var lines []*model.Line
var histogram []*model.Histogram
max := math.MinInt
min := math.MaxInt
maxValue := math.MinInt
minValue := math.MaxInt
startDate := carbon.Now().SubYear().StartOfMonth().Format("Y-m-d")
endDate := carbon.Now().EndOfMonth().Format("Y-m-d")
var factorys []string
@ -288,7 +288,7 @@ func PassProbabilityByFactory(r *request.PassProbabilityByFactory) ([]*model.Lin
for _, factory := range factorys {
var x, lineY, histogramY []string
var reports []*model.Report
global.PostGreSQL.Where("step = ? AND factory = ? AND order_date BETWEEN ? AND ?", "%"+r.Type+"%", factory, startDate, endDate).
global.PostGreSQL.Where("step LIKE ? AND factory = ? AND order_date BETWEEN ? AND ?", "%"+r.Type+"%", factory, startDate, endDate).
Find(&reports)
factoryMap := make(map[string][]string)
for _, report := range reports {
@ -318,11 +318,11 @@ func PassProbabilityByFactory(r *request.PassProbabilityByFactory) ([]*model.Lin
passProbability := passQuantity.Div(testQuantity).
Round(4).Mul(decimal.NewFromFloat(100))
passProbabilityInt, _ := strconv.Atoi(passProbability.Round(0).String())
if passProbabilityInt > max {
max = passProbabilityInt + 1
if passProbabilityInt > maxValue {
maxValue = passProbabilityInt + 1
}
if passProbabilityInt < min {
min = passProbabilityInt - 1
if passProbabilityInt < minValue {
minValue = passProbabilityInt - 1
}
lineY = append(lineY, passProbability.String())
histogramY = append(histogramY, factoryMap[month][0])
@ -340,14 +340,14 @@ func PassProbabilityByFactory(r *request.PassProbabilityByFactory) ([]*model.Lin
Y: histogramY,
})
}
return lines, histogram, max, min
return lines, histogram, maxValue, minValue
}
func FTPassProbabilityByProduct(r *request.PassProbabilityByProduct) (*model.Line, *model.Histogram, *model.Line, *model.Histogram) {
var line, binLine *model.Line
var histogram, binHistogram *model.Histogram
max := math.MinInt
min := math.MaxInt
maxValue := math.MinInt
minValue := math.MaxInt
startDate := carbon.Now().SubYear().StartOfMonth().Format("Y-m-d")
endDate := carbon.Now().EndOfMonth().Format("Y-m-d")
var sql string
@ -402,11 +402,11 @@ func FTPassProbabilityByProduct(r *request.PassProbabilityByProduct) (*model.Lin
passProbability := passQuantity.Div(testQuantity).
Round(4).Mul(decimal.NewFromFloat(100))
passProbabilityInt, _ := strconv.Atoi(passProbability.Round(0).String())
if passProbabilityInt > max {
max = passProbabilityInt + 1
if passProbabilityInt > maxValue {
maxValue = passProbabilityInt + 1
}
if passProbabilityInt < min {
min = passProbabilityInt - 1
if passProbabilityInt < minValue {
minValue = passProbabilityInt - 1
}
lineY = append(lineY, passProbability.String())
histogramY = append(histogramY, productMap[month][0])