33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package test_data
|
|
|
|
import (
|
|
"strings"
|
|
"testData/global"
|
|
"testData/model"
|
|
"testData/request"
|
|
)
|
|
|
|
func ProductSelection(step string) []string {
|
|
var products []string
|
|
if strings.Contains(step, "FT") {
|
|
global.PostGreSQL.Model(&model.FTList{}).Group("product").Select("product").Find(&products)
|
|
} else if strings.Contains(step, "CP") {
|
|
global.PostGreSQL.Model(&model.CPList{}).Group("product").Select("product").Find(&products)
|
|
}
|
|
return products
|
|
}
|
|
|
|
func LotSelection(r *request.ChartSelection) []string {
|
|
var lots []string
|
|
global.PostGreSQL.Model(&model.FileHandled{}).Where("product = ? AND created_at BETWEEN Date(?) AND Date(?)",
|
|
r.Product, r.StartDate, r.EndDate).Group("lot").Select("lot").Find(&lots)
|
|
return lots
|
|
}
|
|
|
|
func PBISelection(r *request.ChartSelection) []string {
|
|
var pbis []string
|
|
global.PostGreSQL.Model(&model.FileHandled{}).Where("product = ? AND lot = ? AND created_at BETWEEN Date(?) AND Date(?)",
|
|
r.Product, r.Lot, r.StartDate, r.EndDate).Group("pbi").Select("pbi").Find(&pbis)
|
|
return pbis
|
|
}
|