V0 记录结批报告部分计算顺序调整

This commit is contained in:
Simmons 2024-09-29 17:32:32 +08:00
parent eebda87529
commit b4585e530b
3 changed files with 156 additions and 100 deletions

View File

@ -1516,3 +1516,15 @@
2024-09-29 16:29:33 INFO | 192.168.0.219 | 200 | 17.0949ms | POST | 未登录 | /testData/report/ft
2024-09-29 16:29:54 INFO | 192.168.0.219 | 200 | 52.2078ms | POST | 未登录 | /testData/report/ft
2024-09-29 16:52:06 INFO | 192.168.0.219 | 200 | 20.394ms | POST | 未登录 | /testData/report/ft
2024-09-29 16:53:06 INFO | 192.168.0.219 | 200 | 60.6637ms | POST | 未登录 | /testData/report/ft
2024-09-29 16:53:26 INFO | 192.168.0.219 | 200 | 24.5048ms | POST | 未登录 | /testData/report/ft
2024-09-29 16:59:11 INFO | 192.168.0.219 | 200 | 4m48.7113148s | POST | 未登录 | /testData/report/ft
2024-09-29 16:59:53 INFO | 192.168.0.219 | 200 | 2.5398666s | POST | 未登录 | /testData/report/ft
2024-09-29 17:00:44 INFO | 192.168.0.219 | 200 | 45.7187336s | POST | 未登录 | /testData/report/ft
2024-09-29 17:01:02 INFO | 192.168.0.219 | 200 | 2.5681577s | POST | 未登录 | /testData/report/ft
2024-09-29 17:02:10 INFO | 192.168.0.219 | 200 | 35.2280563s | POST | 未登录 | /testData/report/ft
2024-09-29 17:14:58 INFO | 192.168.0.219 | 200 | 28.1923ms | POST | 未登录 | /testData/report/ft
2024-09-29 17:19:52 INFO | 192.168.0.219 | 200 | 31.3355ms | POST | 未登录 | /testData/report/ft
2024-09-29 17:20:05 INFO | 192.168.0.219 | 200 | 31.6519ms | POST | 未登录 | /testData/report/ft
2024-09-29 17:29:03 INFO | 192.168.0.219 | 200 | 28.9785ms | POST | 未登录 | /testData/report/ft
2024-09-29 17:30:05 INFO | 192.168.0.219 | 200 | 34.3785ms | POST | 未登录 | /testData/report/ft

View File

@ -407,7 +407,7 @@ func FTEmptyInfoHandler(titleMap map[string]int, finalReportExcel *model.FinalRe
if _, ok := titleMap[finalReportExcel.Product]; !ok {
info["product"] = ""
} else if finalReportExcel.Product != "" {
info["product"] = row[titleMap[finalReportExcel.Product]]
info["product"] = row[titleMap[finalReportExcel.Product]][:strings.Index(row[titleMap[finalReportExcel.Product]], "(")]
}
finalReportExcel.Lot = strings.ReplaceAll(finalReportExcel.Lot, " ", "")
if _, ok := titleMap[finalReportExcel.Lot]; !ok {

View File

@ -424,7 +424,7 @@ func CPList(r *request.CPList) ([]*model.CPShowList, int64) {
HardBinFailMap: make(map[string]float64),
}
var reports []*model.Report
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?", cpList.PBI, cpList.Product, cpList.Lot, "CP").
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?", cpList.PBI, cpList.Product, cpList.Lot, "%CP%").
Order("pbi").
Preload("BinFail", func(db *gorm.DB) *gorm.DB {
return db.Where("report_site_id = ?", "0")
@ -433,24 +433,24 @@ func CPList(r *request.CPList) ([]*model.CPShowList, int64) {
}).Find(&reports)
for _, report := range reports {
var finalReports []*model.FinalReport
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?",
report.PBI, report.Product, report.Lot, "CP").Find(&finalReports)
var reportTestQuantity, reportPassQuantity, reportPassProbability string
for _, finalReport := range finalReports {
reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
finalReportTestQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportTestQuantity)
finalReportPassQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportPassQuantity)
reportTestQuantity = reportTestQuantityDecimal.Add(finalReportTestQuantityDecimal).String()
reportPassQuantity = reportPassQuantityDecimal.Add(finalReportPassQuantityDecimal).String()
}
reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
if !reportTestQuantityDecimal.IsZero() {
reportPassProbability = reportPassQuantityDecimal.Div(reportTestQuantityDecimal).
Mul(decimal.NewFromInt(100).Round(2)).String() + "%"
}
//var finalReports []*model.FinalReport
//global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?",
// report.PBI, report.Product, report.Lot, "CP").Find(&finalReports)
//var reportTestQuantity, reportPassQuantity, reportPassProbability string
//for _, finalReport := range finalReports {
// reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
// reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
// finalReportTestQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportTestQuantity)
// finalReportPassQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportPassQuantity)
// reportTestQuantity = reportTestQuantityDecimal.Add(finalReportTestQuantityDecimal).String()
// reportPassQuantity = reportPassQuantityDecimal.Add(finalReportPassQuantityDecimal).String()
//}
//reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
//reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
//if !reportTestQuantityDecimal.IsZero() {
// reportPassProbability = reportPassQuantityDecimal.Div(reportTestQuantityDecimal).
// Mul(decimal.NewFromInt(100).Round(2)).String() + "%"
//}
firstPassQuantity, _ := decimal.NewFromString(report.FirstPassQuantity)
listFirstPassQuantity, _ := decimal.NewFromString(cpShowList.PassQuantity)
@ -547,9 +547,9 @@ func CPList(r *request.CPList) ([]*model.CPShowList, int64) {
FirstPassProbability: report.FirstPassProbability,
PassQuantity: report.PassQuantity,
PassProbability: report.PassProbability,
ReportTestQuantity: reportTestQuantity,
ReportPassQuantity: reportPassQuantity,
ReportPassProbability: reportPassProbability,
//ReportTestQuantity: reportTestQuantity,
//ReportPassQuantity: reportPassQuantity,
//ReportPassProbability: reportPassProbability,
TestTime: report.TestTime,
StackingMaterials: report.StackingMaterials,
SoftBinFailMap: softBinFail,
@ -558,6 +558,28 @@ func CPList(r *request.CPList) ([]*model.CPShowList, int64) {
}
}
var finalReports []*model.FinalReport
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?",
cpList.PBI, cpList.Product, cpList.Lot, "%CP%").Find(&finalReports)
var reportTestQuantity, reportPassQuantity, reportPassProbability string
for _, finalReport := range finalReports {
reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
finalReportTestQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportTestQuantity)
finalReportPassQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportPassQuantity)
reportTestQuantity = reportTestQuantityDecimal.Add(finalReportTestQuantityDecimal).String()
reportPassQuantity = reportPassQuantityDecimal.Add(finalReportPassQuantityDecimal).String()
}
finalReportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
finalReportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
if !finalReportTestQuantityDecimal.IsZero() {
reportPassProbability = finalReportPassQuantityDecimal.Div(finalReportTestQuantityDecimal).Round(4).
Mul(decimal.NewFromInt(100)).String() + "%"
}
cpShowList.ReportTestQuantity = reportTestQuantity
cpShowList.ReportPassQuantity = reportPassQuantity
cpShowList.ReportPassProbability = reportPassProbability
for _, report := range reports {
softBinFailMap, hardBinFailMap := make(map[string]float64), make(map[string]float64)
for _, binFail := range report.BinFail {
@ -889,7 +911,7 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) {
}
var reports []*model.Report
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?", ftList.PBI, ftList.Product, ftList.Lot, "FT").
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?", ftList.PBI, ftList.Product, ftList.Lot, "%FT%").
Order("pbi").
Preload("BinFail", func(db *gorm.DB) *gorm.DB {
return db.Where("report_site_id = ?", "0")
@ -898,24 +920,24 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) {
}).Find(&reports)
for _, report := range reports {
var finalReports []*model.FinalReport
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?",
report.PBI, report.Product, report.Lot, "FT").Find(&finalReports)
var reportTestQuantity, reportPassQuantity, reportPassProbability string
for _, finalReport := range finalReports {
reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
finalReportTestQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportTestQuantity)
finalReportPassQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportPassQuantity)
reportTestQuantity = reportTestQuantityDecimal.Add(finalReportTestQuantityDecimal).String()
reportPassQuantity = reportPassQuantityDecimal.Add(finalReportPassQuantityDecimal).String()
}
reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
if !reportTestQuantityDecimal.IsZero() {
reportPassProbability = reportPassQuantityDecimal.Div(reportTestQuantityDecimal).
Mul(decimal.NewFromInt(100).Round(2)).String() + "%"
}
//var finalReports []*model.FinalReport
//global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?",
// report.PBI, report.Product, report.Lot, "FT").Find(&finalReports)
//var reportTestQuantity, reportPassQuantity, reportPassProbability string
//for _, finalReport := range finalReports {
// reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
// reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
// finalReportTestQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportTestQuantity)
// finalReportPassQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportPassQuantity)
// reportTestQuantity = reportTestQuantityDecimal.Add(finalReportTestQuantityDecimal).String()
// reportPassQuantity = reportPassQuantityDecimal.Add(finalReportPassQuantityDecimal).String()
//}
//reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
//reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
//if !reportTestQuantityDecimal.IsZero() {
// reportPassProbability = reportPassQuantityDecimal.Div(reportTestQuantityDecimal).
// Mul(decimal.NewFromInt(100).Round(2)).String() + "%"
//}
firstPassQuantity, _ := decimal.NewFromString(report.FirstPassQuantity)
listFirstPassQuantity, _ := decimal.NewFromString(ftShowList.PassQuantity)
@ -1013,9 +1035,9 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) {
FirstPassProbability: report.FirstPassProbability,
PassQuantity: report.PassQuantity,
PassProbability: report.PassProbability,
ReportTestQuantity: reportTestQuantity,
ReportPassQuantity: reportPassQuantity,
ReportPassProbability: reportPassProbability,
//ReportTestQuantity: reportTestQuantity,
//ReportPassQuantity: reportPassQuantity,
//ReportPassProbability: reportPassProbability,
TestTime: report.TestTime,
StackingMaterials: report.StackingMaterials,
SoftBinFailMap: softBinFail,
@ -1024,6 +1046,28 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) {
}
}
var finalReports []*model.FinalReport
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ? AND step LIKE ?",
ftList.PBI, ftList.Product, ftList.Lot, "FT").Find(&finalReports)
var reportTestQuantity, reportPassQuantity, reportPassProbability string
for _, finalReport := range finalReports {
reportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
reportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
finalReportTestQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportTestQuantity)
finalReportPassQuantityDecimal, _ := decimal.NewFromString(finalReport.ReportPassQuantity)
reportTestQuantity = reportTestQuantityDecimal.Add(finalReportTestQuantityDecimal).String()
reportPassQuantity = reportPassQuantityDecimal.Add(finalReportPassQuantityDecimal).String()
}
finalReportTestQuantityDecimal, _ := decimal.NewFromString(reportTestQuantity)
finalReportPassQuantityDecimal, _ := decimal.NewFromString(reportPassQuantity)
if !finalReportTestQuantityDecimal.IsZero() {
reportPassProbability = finalReportPassQuantityDecimal.Div(finalReportTestQuantityDecimal).Round(4).
Mul(decimal.NewFromInt(100)).String() + "%"
}
ftShowList.ReportTestQuantity = reportTestQuantity
ftShowList.ReportPassQuantity = reportPassQuantity
ftShowList.ReportPassProbability = reportPassProbability
for _, report := range reports {
softBinFailMap, hardBinFailMap := make(map[string]float64), make(map[string]float64)
for _, binFail := range report.BinFail {