V0 测试图表数据来源调整
This commit is contained in:
parent
07472b43aa
commit
715ab41e82
@ -54,3 +54,41 @@ func (S *ReportChartSelectionService) GetLotSelection(c *gin.Context) {
|
||||
|
||||
response.OkWithData(test_data.GetLotSelection(&r), c)
|
||||
}
|
||||
|
||||
// @Tags 数据分析平台-生产
|
||||
// @Summary 测试良率项目选项-结批报告
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.ProbabilitySelection true "查询参数"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
||||
// @Router /testData/finalReport/probabilitySelection/product [post]
|
||||
func (S *ReportChartSelectionService) GetProductSelectionByFinalReport(c *gin.Context) {
|
||||
r := request.ProbabilitySelection{}
|
||||
_ = c.ShouldBind(&r)
|
||||
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
||||
response.FailWithMessage(msg, c)
|
||||
return
|
||||
}
|
||||
|
||||
response.OkWithData(test_data.GetProductSelectionByFinalReport(&r), c)
|
||||
}
|
||||
|
||||
// @Tags 数据分析平台-生产
|
||||
// @Summary 封装良率厂商选项
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.ProbabilitySelection true "查询参数"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
|
||||
// @Router /testData/report/abSelection/factory [post]
|
||||
func (S *ReportChartSelectionService) GetABFactorySelection(c *gin.Context) {
|
||||
r := request.ProbabilitySelection{}
|
||||
_ = c.ShouldBind(&r)
|
||||
if msg, ok := utils.ValidateInfo2CN(r); !ok {
|
||||
response.FailWithMessage(msg, c)
|
||||
return
|
||||
}
|
||||
|
||||
response.OkWithData(test_data.GetABFactorySelection(&r), c)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func GetProductSelection(r *request.ProbabilitySelection) []string {
|
||||
var products []string
|
||||
global.PostGreSQL.Debug().Model(&model.Report{}).Where("step = ? AND created_at BETWEEN Date(?) AND Date(?)",
|
||||
global.PostGreSQL.Model(&model.Report{}).Where("step = ? AND created_at BETWEEN Date(?) AND Date(?)",
|
||||
r.Step, r.StartDate, carbon.Parse(r.EndDate).AddDay().Format("Y-m-d")).Group("product").Select("product").Find(&products)
|
||||
return products
|
||||
}
|
||||
@ -20,3 +20,25 @@ func GetLotSelection(r *request.ProbabilitySelection) []string {
|
||||
r.Step, r.StartDate, carbon.Parse(r.EndDate).AddDay().Format("Y-m-d")).Group("lot").Select("lot").Find(&lots)
|
||||
return lots
|
||||
}
|
||||
|
||||
func GetProductSelectionByFinalReport(r *request.ProbabilitySelection) []string {
|
||||
var products []string
|
||||
r.StartDate = carbon.Now().SubYear().AddMonth().StartOfMonth().Format("Y-m-d")
|
||||
r.EndDate = carbon.Now().AddMonth().StartOfMonth().Format("Y-m-d")
|
||||
global.PostGreSQL.Model(&model.FinalReport{}).Where("step = ? AND created_at BETWEEN Date(?) AND Date(?)",
|
||||
r.Step, r.StartDate, carbon.Parse(r.EndDate)).Group("product").Select("product").Find(&products)
|
||||
return products
|
||||
}
|
||||
|
||||
func GetABFactorySelection(r *request.ProbabilitySelection) []string {
|
||||
var sql string
|
||||
if r.StartDate != "" && r.EndDate != "" {
|
||||
sql += "tc_sfc02 BETWEEN DATE '" + r.StartDate + "' AND DATE '" + r.EndDate + "'"
|
||||
}
|
||||
var factoryCodes []string
|
||||
global.Oracle.Model(&model.TcSfcFile{}).Where("tc_sfc08 LIKE ?", "%AB%").Where(sql).
|
||||
Group("tc_sfc04").Select("tc_sfc04").Find(&factoryCodes)
|
||||
var factories []string
|
||||
global.Oracle.Model(&model.PmcFile{}).Where("pmc01 IN ?", factoryCodes).Select("pmc03").Find(&factories)
|
||||
return factories
|
||||
}
|
||||
|
@ -11,5 +11,7 @@ func InitReportChartSelectionRouter(R *gin.RouterGroup) {
|
||||
{
|
||||
reportChartSelectionGroup.POST("report/probabilitySelection/product", reportChartService.GetProductSelection)
|
||||
reportChartSelectionGroup.POST("report/probabilitySelection/lot", reportChartService.GetLotSelection)
|
||||
reportChartSelectionGroup.POST("finalReport/probabilitySelection/product", reportChartService.GetProductSelectionByFinalReport)
|
||||
reportChartSelectionGroup.POST("report/abSelection/factory", reportChartService.GetABFactorySelection)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user