From b4585e530be988a1b9cb5ab24db2122ddcf36cc1 Mon Sep 17 00:00:00 2001 From: Simmons <1815481@qq.com> Date: Sun, 29 Sep 2024 17:32:32 +0800 Subject: [PATCH] =?UTF-8?q?V0=20=E8=AE=B0=E5=BD=95=E7=BB=93=E6=89=B9?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E9=83=A8=E5=88=86=E8=AE=A1=E7=AE=97=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log/message.log | 12 ++ repository/report_reader/ft_reader.go | 2 +- repository/test.data/report.list.go | 242 +++++++++++++++----------- 3 files changed, 156 insertions(+), 100 deletions(-) diff --git a/log/message.log b/log/message.log index 8851f58..e997888 100644 --- a/log/message.log +++ b/log/message.log @@ -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 diff --git a/repository/report_reader/ft_reader.go b/repository/report_reader/ft_reader.go index b3fa824..f3a689d 100644 --- a/repository/report_reader/ft_reader.go +++ b/repository/report_reader/ft_reader.go @@ -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 { diff --git a/repository/test.data/report.list.go b/repository/test.data/report.list.go index 933cbeb..6b4cf19 100644 --- a/repository/test.data/report.list.go +++ b/repository/test.data/report.list.go @@ -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) @@ -525,39 +525,61 @@ func CPList(r *request.CPList) ([]*model.CPShowList, int64) { }) } cpShowList = model.CPShowList{ - Status: cpShowList.Status, - OrderDate: cpShowList.OrderDate, - PBI: cpShowList.PBI, - OutsourcingPBI: cpShowList.OutsourcingPBI, - Product: cpShowList.Product, - Package: cpShowList.Package, - Lot: cpShowList.Lot, - Factory: cpShowList.Factory, - WaferID: cpShowList.WaferID, - TestMachine: report.TestMachine, - TestProgram: cpShowList.TestProgram, - TestProgramVersion: cpShowList.TestProgramVersion, - Quantity: cpShowList.Quantity, - OnlineQuantity: cpShowList.OnlineQuantity, - ReturnQuantity: cpShowList.ReturnQuantity, - DieQuantity: cpShowList.DieQuantity, - CPListStock: cpShowList.CPListStock, - TestQuantity: report.TestQuantity, - FirstPassQuantity: report.FirstPassQuantity, - FirstPassProbability: report.FirstPassProbability, - PassQuantity: report.PassQuantity, - PassProbability: report.PassProbability, - ReportTestQuantity: reportTestQuantity, - ReportPassQuantity: reportPassQuantity, - ReportPassProbability: reportPassProbability, - TestTime: report.TestTime, - StackingMaterials: report.StackingMaterials, - SoftBinFailMap: softBinFail, - HardBinFailMap: hardBinFail, - Site: reportListSites, + Status: cpShowList.Status, + OrderDate: cpShowList.OrderDate, + PBI: cpShowList.PBI, + OutsourcingPBI: cpShowList.OutsourcingPBI, + Product: cpShowList.Product, + Package: cpShowList.Package, + Lot: cpShowList.Lot, + Factory: cpShowList.Factory, + WaferID: cpShowList.WaferID, + TestMachine: report.TestMachine, + TestProgram: cpShowList.TestProgram, + TestProgramVersion: cpShowList.TestProgramVersion, + Quantity: cpShowList.Quantity, + OnlineQuantity: cpShowList.OnlineQuantity, + ReturnQuantity: cpShowList.ReturnQuantity, + DieQuantity: cpShowList.DieQuantity, + CPListStock: cpShowList.CPListStock, + TestQuantity: report.TestQuantity, + FirstPassQuantity: report.FirstPassQuantity, + FirstPassProbability: report.FirstPassProbability, + PassQuantity: report.PassQuantity, + PassProbability: report.PassProbability, + //ReportTestQuantity: reportTestQuantity, + //ReportPassQuantity: reportPassQuantity, + //ReportPassProbability: reportPassProbability, + TestTime: report.TestTime, + StackingMaterials: report.StackingMaterials, + SoftBinFailMap: softBinFail, + HardBinFailMap: hardBinFail, + Site: reportListSites, } } + 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) @@ -990,40 +1012,62 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) { }) } ftShowList = model.FTShowList{ - Status: ftShowList.Status, - OrderDate: ftShowList.OrderDate, - PBI: ftShowList.PBI, - OutsourcingPBI: ftShowList.OutsourcingPBI, - Product: ftShowList.Product, - Package: ftShowList.Package, - Factory: ftShowList.Factory, - Lot: ftShowList.Lot, - Seal: ftShowList.Seal, - TestProgram: ftShowList.TestProgram, - TestProgramVersion: ftShowList.TestProgramVersion, - Quantity: ftShowList.Quantity, - OnlineQuantity: ftShowList.OnlineQuantity, - ReturnQuantity: ftShowList.ReturnQuantity, - FTPassQuantity: ftShowList.FTPassQuantity, - FTFailQuantity: ftShowList.FTFailQuantity, - FTListStock: ftShowList.FTListStock, - TestMachine: report.TestMachine, - TestQuantity: report.TestQuantity, - FirstPassQuantity: report.FirstPassQuantity, - FirstPassProbability: report.FirstPassProbability, - PassQuantity: report.PassQuantity, - PassProbability: report.PassProbability, - ReportTestQuantity: reportTestQuantity, - ReportPassQuantity: reportPassQuantity, - ReportPassProbability: reportPassProbability, - TestTime: report.TestTime, - StackingMaterials: report.StackingMaterials, - SoftBinFailMap: softBinFail, - HardBinFailMap: hardBinFail, - Site: reportListSites, + Status: ftShowList.Status, + OrderDate: ftShowList.OrderDate, + PBI: ftShowList.PBI, + OutsourcingPBI: ftShowList.OutsourcingPBI, + Product: ftShowList.Product, + Package: ftShowList.Package, + Factory: ftShowList.Factory, + Lot: ftShowList.Lot, + Seal: ftShowList.Seal, + TestProgram: ftShowList.TestProgram, + TestProgramVersion: ftShowList.TestProgramVersion, + Quantity: ftShowList.Quantity, + OnlineQuantity: ftShowList.OnlineQuantity, + ReturnQuantity: ftShowList.ReturnQuantity, + FTPassQuantity: ftShowList.FTPassQuantity, + FTFailQuantity: ftShowList.FTFailQuantity, + FTListStock: ftShowList.FTListStock, + TestMachine: report.TestMachine, + TestQuantity: report.TestQuantity, + FirstPassQuantity: report.FirstPassQuantity, + FirstPassProbability: report.FirstPassProbability, + PassQuantity: report.PassQuantity, + PassProbability: report.PassProbability, + //ReportTestQuantity: reportTestQuantity, + //ReportPassQuantity: reportPassQuantity, + //ReportPassProbability: reportPassProbability, + TestTime: report.TestTime, + StackingMaterials: report.StackingMaterials, + SoftBinFailMap: softBinFail, + HardBinFailMap: hardBinFail, + Site: reportListSites, } } + 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 {