132 lines
4.6 KiB
Go
132 lines
4.6 KiB
Go
package test_data
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"testData/model/response"
|
|
test_data "testData/repository/test.data"
|
|
"testData/request"
|
|
"testData/utils"
|
|
)
|
|
|
|
type IReportChartService interface {
|
|
}
|
|
|
|
type ReportChartService struct{}
|
|
|
|
func InitReportChartService() *ReportChartService {
|
|
return &ReportChartService{}
|
|
}
|
|
|
|
// @Tags 数据分析平台-生产
|
|
// @Summary 封装良率折线图
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.PackagePassProbabilityLine true "查询参数"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
|
// @Router /testData/report/packagePassProbabilityLine [post]
|
|
func (S *ReportChartService) PackagePassProbabilityLine(c *gin.Context) {
|
|
r := request.PackagePassProbabilityLine{}
|
|
_ = c.ShouldBind(&r)
|
|
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
|
response.FailWithMessage(msg, c)
|
|
return
|
|
}
|
|
lines, maxLimit, minLimit := test_data.PackagePassProbabilityLine(&r)
|
|
response.OkWithData(gin.H{"lines": lines, "max": maxLimit, "min": minLimit}, c)
|
|
}
|
|
|
|
// @Tags 数据分析平台-生产
|
|
// @Summary 封装良率折线图
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.PackagePassProbabilityLine true "查询参数"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
|
// @Router /testData/report/packageOrderNumberBar [post]
|
|
func (S *ReportChartService) PackageOrderNumberBar(c *gin.Context) {
|
|
r := request.PackagePassProbabilityLine{}
|
|
_ = c.ShouldBind(&r)
|
|
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
|
response.FailWithMessage(msg, c)
|
|
return
|
|
}
|
|
response.OkWithData(test_data.OrderNumberHistogram(&r), c)
|
|
}
|
|
|
|
// @Tags 数据分析平台-生产
|
|
// @Summary 测试良率-按供应商
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.PassProbabilityByFactory true "查询参数"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
|
// @Router /testData/report/fTPassProbabilityByFactory [post]
|
|
func (S *ReportChartService) FTPassProbabilityByFactory(c *gin.Context) {
|
|
r := request.PassProbabilityByFactory{}
|
|
_ = c.ShouldBind(&r)
|
|
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
|
response.FailWithMessage(msg, c)
|
|
return
|
|
}
|
|
lines, histogram, maxLimit, minLimit := test_data.PassProbabilityByFactory(&r)
|
|
response.OkWithData(gin.H{"lines": lines, "histogram": histogram, "max": maxLimit, "min": minLimit}, c)
|
|
}
|
|
|
|
// @Tags 数据分析平台-生产
|
|
// @Summary 测试良率-按产品型号
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.PassProbabilityByProduct true "查询参数"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
|
// @Router /testData/report/fTPassProbabilityByProduct [post]
|
|
func (S *ReportChartService) FTPassProbabilityByProduct(c *gin.Context) {
|
|
r := request.PassProbabilityByProduct{}
|
|
_ = c.ShouldBind(&r)
|
|
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
|
response.FailWithMessage(msg, c)
|
|
return
|
|
}
|
|
lines, histogram, binLines, binHistogram := test_data.FTPassProbabilityByProduct(&r)
|
|
response.OkWithData(gin.H{"lines": lines, "histogram": histogram, "bin_lines": binLines, "bin_histogram": binHistogram}, c)
|
|
}
|
|
|
|
// @Tags 数据分析平台-生产
|
|
// @Summary 测试良率-纵坐标良率
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.PassProbability true "查询参数"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
|
// @Router /testData/report/passProbability [post]
|
|
func (S *ReportChartService) PassProbability(c *gin.Context) {
|
|
r := request.PassProbability{}
|
|
_ = c.ShouldBind(&r)
|
|
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
|
response.FailWithMessage(msg, c)
|
|
return
|
|
}
|
|
binChart, y := test_data.PassProbability(&r)
|
|
response.OkWithData(gin.H{"bin_chart": binChart, "y": y}, c)
|
|
}
|
|
|
|
// @Tags 数据分析平台-生产
|
|
// @Summary 测试良率-纵坐标Bin
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.BinProbability true "查询参数"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
|
// @Router /testData/report/binProbability [post]
|
|
func (S *ReportChartService) BinProbability(c *gin.Context) {
|
|
r := request.BinProbability{}
|
|
_ = c.ShouldBind(&r)
|
|
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
|
response.FailWithMessage(msg, c)
|
|
return
|
|
}
|
|
binChart, y := test_data.BinProbability(&r)
|
|
response.OkWithData(gin.H{"bin_chart": binChart, "y": y}, c)
|
|
}
|