59 lines
1.7 KiB
Go
59 lines
1.7 KiB
Go
package test_data
|
|
|
|
import (
|
|
"errors"
|
|
"gitee.com/golang-module/carbon/v2"
|
|
"github.com/shopspring/decimal"
|
|
"gorm.io/gorm"
|
|
"strings"
|
|
"testData/global"
|
|
"testData/model"
|
|
reader2 "testData/repository/report_reader"
|
|
"testData/request"
|
|
)
|
|
|
|
func ImportSTS8200(fileText *model.FileText) {
|
|
}
|
|
|
|
func ImportFinalReport(r *request.ImportFinalReport) {
|
|
if r.Step == "FT" {
|
|
if r.Factory == "华润赛美科" {
|
|
reader2.FTSMCReportReader(r.FilePath)
|
|
} else if r.Factory == "江苏长电科技" {
|
|
reader2.FTSuQianChangDianReportReader(r.FilePath)
|
|
} else if r.Factory == "气派" {
|
|
reader2.FTQiPaiReportReader(r.FilePath)
|
|
} else if r.Factory == "深圳睿思" {
|
|
reader2.FTRuiSiReportReader(r.FilePath)
|
|
} else if r.Factory == "江苏芯德" {
|
|
reader2.FTXinDeReportReader(r.FilePath)
|
|
}
|
|
} else if r.Step == "CP" {
|
|
if r.Factory == "华润赛美科" {
|
|
reader2.CPSMCReportReader(r.FilePath)
|
|
} else if r.Factory == "无锡圆方" {
|
|
reader2.CPYuanFangReportReader(r.FilePath)
|
|
} else if r.Factory == "深圳育诚" {
|
|
reader2.CPYuChengReportReader(r.FilePath)
|
|
}
|
|
}
|
|
}
|
|
|
|
func InitNewPBI() string {
|
|
pbiStart := carbon.Now().Format("Ymd")
|
|
var newHandler *model.FileHandled
|
|
var pbi string
|
|
if errors.Is(global.PostGreSQL.Where("pbi LIKE ?", pbiStart+"%").Order("pbi desc").Find(&newHandler).Error, gorm.ErrRecordNotFound) {
|
|
return pbiStart + "0001"
|
|
} else {
|
|
after, _ := strings.CutPrefix(newHandler.PBI, pbiStart)
|
|
afterDecimal, _ := decimal.NewFromString(after)
|
|
pbiSuffix := afterDecimal.Add(decimal.NewFromInt(1)).String()
|
|
if len(pbiSuffix) < 4 {
|
|
pbiSuffix = strings.Repeat("0", 4-len(pbiSuffix)) + pbiSuffix
|
|
}
|
|
pbi = pbiStart + pbiSuffix
|
|
}
|
|
return pbi
|
|
}
|