diff --git a/model/erp.go b/model/erp.go index ebf487e..2520d53 100644 --- a/model/erp.go +++ b/model/erp.go @@ -8,6 +8,7 @@ type TcSfcFile struct { TcSfc04 string `json:"tc_sfc04"` // 厂商编号 PmcFile PmcFile `gorm:"foreignKey:Pmc01;references:TcSfc04"` TcSfc08 string `json:"tc_sfc08"` // 加工类型 + TcSfc10 string `json:"tc_sfc10"` // 重测否 TcSfdFile []TcSfdFile `gorm:"foreignKey:TcSfd01;references:TcSfc01"` TcSfeFile []TcSfeFile `gorm:"foreignKey:TcSfe01;references:TcSfc01"` } @@ -38,6 +39,7 @@ type TcSfeFile struct { TcSfe02 int `json:"tc_sfe02"` // 回货项次 TcSfe04 string `json:"tc_sfe04"` // 料号 ImaFile ImaFile `gorm:"foreignKey:Ima01;references:TcSfe04"` + BmbFile BmbFile `gorm:"foreignKey:Bmb01;references:TcSfe04"` TcSfe10 string `json:"tc_sfe10"` // 晶圆批号 TcSfe12 float64 `json:"tc_sfe12"` // 发料数量 TcSfe14 float64 `json:"tc_sfe14"` // 参考数量 @@ -154,3 +156,11 @@ type SfbFile struct { } func (SfbFile) TableName() string { return "sfb_file" } + +type BmbFile struct { + Bmb01 string `json:"bmb01"` // 料号 + Bmb03 string `json:"bmb03"` // 晶圆料号 + ImaFile ImaFile `json:"ima_file" gorm:"foreignKey:Ima01;references:Bmb03"` +} + +func (BmbFile) TableName() string { return "bmb_file" } diff --git a/repository/test.data/report.list.cron.go b/repository/test.data/report.list.cron.go index baf1677..e7dfa7e 100644 --- a/repository/test.data/report.list.cron.go +++ b/repository/test.data/report.list.cron.go @@ -797,7 +797,9 @@ func CronCPList() { return db.Preload("IddFile").Preload("RvaFile") }) }).Preload("TcSfeFile", func(db *gorm.DB) *gorm.DB { - return db.Preload("ImaFile") + return db.Preload("ImaFile").Preload("BmbFile", func(db *gorm.DB) *gorm.DB { + return db.Preload("ImaFile") + }) }).Preload("PmcFile").Find(&pageTcSfcFile) newTcSfcFile = append(newTcSfcFile, pageTcSfcFile...) } @@ -1018,11 +1020,12 @@ func CronFTList() { global.PostGreSQL.Transaction(func(tx *gorm.DB) error { global.PostGreSQL.Model(&ftList).Where("pbi = ? AND outsourcing_pbi = ?", tcSfc.TcSfc01, tcSfd.TcSfd13).Updates(map[string]interface{}{ - "status": status, - "online_quantity": tcSfd.TcSfd05 - returnQuantity, - "return_quantity": returnQuantity, - "pass_quantity": passQuantity, - "fail_quantity": failQuantity, + "status": status, + "online_quantity": tcSfd.TcSfd05 - returnQuantity, + "return_quantity": returnQuantity, + "pass_quantity": passQuantity, + "fail_quantity": failQuantity, + "test_program_version": tcSfd.TcImbFile.TcImb04, }) for k, v := range orderDateStockMap { var ftListStock *model.FTListStock @@ -1104,7 +1107,11 @@ func CronFTList() { var waferProduct string for _, tcSfe := range tcSfc.TcSfeFile { if tcSfe.TcSfe01 == tcSfc.TcSfc01 && tcSfe.TcSfe02 == tcSfd.TcSfd02 { - waferProduct = tcSfe.ImaFile.Ima02 + if tcSfc.TcSfc08 == "FT" { + waferProduct = tcSfe.BmbFile.ImaFile.Ima02 + } else { + waferProduct = tcSfe.ImaFile.Ima02 + } } } var returnQuantity, passQuantity, failQuantity float64