数据分析平台

This commit is contained in:
jh_peng 2025-04-29 18:01:49 +08:00
parent 04e4ca1225
commit 06d52c108e

View File

@ -1561,17 +1561,17 @@ func ExportFT() string {
// String() + "%"
//}
}
var testQuantityDiff, passQuantityDiff string
finalTestQuantityDecimal, _ := decimal.NewFromString(finalTestQuantity)
finalPassQuantityDecimal, _ := decimal.NewFromString(finalPassQuantity)
if !finalTestQuantityDecimal.IsZero() {
finalPassProbability = finalPassQuantityDecimal.Div(finalTestQuantityDecimal).Round(4).
Mul(decimal.NewFromInt(100)).String() + "%"
testQuantityDiff = testQuantityDecimal.Sub(finalTestQuantityDecimal).Div(finalTestQuantityDecimal).Round(4).
Mul(decimal.NewFromInt(100)).String() + "%"
}
var testQuantityDiff, passQuantityDiff string
hardBinState := "正常"
if !testQuantityDecimal.IsZero() {
testQuantityDiff = testQuantityDecimal.Sub(finalTestQuantityDecimal).Div(testQuantityDecimal).Round(4).
Mul(decimal.NewFromInt(100)).String() + "%"
passQuantityDiff = passQuantityDecimal.Sub(finalPassQuantityDecimal).Div(passQuantityDecimal).Round(4).
Mul(decimal.NewFromInt(100)).String() + "%"
for _, binControl := range warning.BinControl {
@ -1757,25 +1757,25 @@ func ExportFT() string {
_ = file.SetCellStyle(sheetName, "P"+strconv.Itoa(ftRecordIndex), "P"+strconv.Itoa(ftRecordIndex), ExportWarningStyle(file))
}
}
for _, productionControl := range warning.ProductionControl {
if productionControl.Factory == ftList.Factory {
testQuantityDiffStr := strings.ReplaceAll(testQuantityDiff, "%", "")
sDecimal, _ := decimal.NewFromString(testQuantityDiffStr)
testQuantityDiffHDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.TestQuantityDiffH, "%", ""))
testQuantityDiffLDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.TestQuantityDiffL, "%", ""))
if sDecimal.LessThan(testQuantityDiffLDecimal) || testQuantityDiffHDecimal.LessThan(sDecimal) {
_ = file.SetCellStyle(sheetName, "Q"+strconv.Itoa(ftRecordIndex), "Q"+strconv.Itoa(ftRecordIndex), ExportWarningStyle(file))
}
passQuantityDiffStr := strings.ReplaceAll(passQuantityDiff, "%", "")
saDecimal, _ := decimal.NewFromString(passQuantityDiffStr)
passQuantityDiffHDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.PassQuantityDiffH, "%", ""))
passQuantityDiffLDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.PassQuantityDiffL, "%", ""))
if saDecimal.LessThan(passQuantityDiffLDecimal) || passQuantityDiffHDecimal.LessThan(saDecimal) {
_ = file.SetCellStyle(sheetName, "R"+strconv.Itoa(ftRecordIndex), "R"+strconv.Itoa(ftRecordIndex), ExportWarningStyle(file))
}
break
}
}
//for _, productionControl := range warning.ProductionControl {
// if productionControl.Factory == ftList.Factory {
// testQuantityDiffStr := strings.ReplaceAll(testQuantityDiff, "%", "")
// sDecimal, _ := decimal.NewFromString(testQuantityDiffStr)
// testQuantityDiffHDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.TestQuantityDiffH, "%", ""))
// testQuantityDiffLDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.TestQuantityDiffL, "%", ""))
// if sDecimal.LessThan(testQuantityDiffLDecimal) || testQuantityDiffHDecimal.LessThan(sDecimal) {
// _ = file.SetCellStyle(sheetName, "Q"+strconv.Itoa(ftRecordIndex), "Q"+strconv.Itoa(ftRecordIndex), ExportWarningStyle(file))
// }
// passQuantityDiffStr := strings.ReplaceAll(passQuantityDiff, "%", "")
// saDecimal, _ := decimal.NewFromString(passQuantityDiffStr)
// passQuantityDiffHDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.PassQuantityDiffH, "%", ""))
// passQuantityDiffLDecimal, _ := decimal.NewFromString(strings.ReplaceAll(productionControl.PassQuantityDiffL, "%", ""))
// if saDecimal.LessThan(passQuantityDiffLDecimal) || passQuantityDiffHDecimal.LessThan(saDecimal) {
// _ = file.SetCellStyle(sheetName, "R"+strconv.Itoa(ftRecordIndex), "R"+strconv.Itoa(ftRecordIndex), ExportWarningStyle(file))
// }
// break
// }
//}
if hardBinState == "异常" {
_ = file.SetCellStyle(sheetName, "S"+strconv.Itoa(ftRecordIndex), "S"+strconv.Itoa(ftRecordIndex), ExportWarningStyle(file))
}