From c83d2bcb2af3de4d8c0c6b214d035a3c3f7c6770 Mon Sep 17 00:00:00 2001 From: jh_peng Date: Wed, 20 Nov 2024 16:42:48 +0800 Subject: [PATCH] =?UTF-8?q?V0=20FT=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repository/test.data/report.list.go | 33 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/repository/test.data/report.list.go b/repository/test.data/report.list.go index 6e15456..b5587b1 100644 --- a/repository/test.data/report.list.go +++ b/repository/test.data/report.list.go @@ -970,7 +970,7 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) { } var ftLists []*model.FTList var total int64 - global.PostGreSQL.Debug().Where(sql).Order("order_date desc").Find(&ftLists).Count(&total). + global.PostGreSQL.Where(sql).Order("order_date desc").Find(&ftLists).Count(&total). Offset(r.Page * r.PageSize).Limit(r.PageSize). Preload("FTListStock").Find(&ftLists) var ftShowLists []*model.FTShowList @@ -1267,9 +1267,32 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) { var quantity float64 var reportProportion string - reportSoftBinQuantityDecimal := decimal.NewFromFloat(hardBinQuantity) - quantity = hardBinQuantity - reportProportion = reportSoftBinQuantityDecimal.Div(testQuantityDecimal).Round(4). + var reportHardBinQuantity string + if hardBin == "1" { + reportHardBinQuantity = finalReport.Bin1 + } else if hardBin == "2" { + reportHardBinQuantity = finalReport.Bin2 + } else if hardBin == "3" { + reportHardBinQuantity = finalReport.Bin3 + } else if hardBin == "4" { + reportHardBinQuantity = finalReport.Bin4 + } else if hardBin == "5" { + reportHardBinQuantity = finalReport.Bin5 + } else if hardBin == "6" { + reportHardBinQuantity = finalReport.Bin6 + } else if hardBin == "7" { + reportHardBinQuantity = finalReport.Bin7 + } else if hardBin == "8" { + reportHardBinQuantity = finalReport.Bin8 + } else if hardBin == "9" { + reportHardBinQuantity = finalReport.Bin9 + } else if hardBin == "10" { + reportHardBinQuantity = finalReport.Bin10 + } + reportSoftBinQuantityDecimal, _ := decimal.NewFromString(reportHardBinQuantity) + reportTestQuantityDecimalDecimal, _ := decimal.NewFromString(finalReport.ReportTestQuantity) + quantity, _ = reportSoftBinQuantityDecimal.Float64() + reportProportion = reportSoftBinQuantityDecimal.Div(reportTestQuantityDecimalDecimal).Round(4). Mul(decimal.NewFromInt(100)).String() + "%" hardBinFail = append(hardBinFail, &model.ReportBinFail{ @@ -1372,7 +1395,7 @@ func FTList(r *request.FTList) ([]*model.FTShowList, int64) { Proportion: hardBinQuantityDecimal.Div(testQuantityDecimal).Round(4). Mul(decimal.NewFromInt(100)).String() + "%", ReportQuantity: reportHardBinFailMap[hardBin], - ReportProportion: reportSoftBinQuantityDecimal.Div(testQuantityDecimal).Round(4). + ReportProportion: reportSoftBinQuantityDecimal.Div(reportTestQuantityDecimal).Round(4). Mul(decimal.NewFromInt(100)).String() + "%", }) }