V0 AB信息抓取调整
This commit is contained in:
parent
ceb9a8f3ea
commit
a57228be1c
@ -223,7 +223,7 @@ func CronWaferList() {
|
|||||||
func CronABList() {
|
func CronABList() {
|
||||||
var oldTcSfcFile []*model.TcSfcFile
|
var oldTcSfcFile []*model.TcSfcFile
|
||||||
var abListIDs []string
|
var abListIDs []string
|
||||||
global.PostGreSQL.Model(&model.ABList{}).Where("status = ?", "未结案").
|
global.PostGreSQL.Model(&model.ABList{}).Where("status = ?", "未结案").Find(&abListIDs).
|
||||||
Select("pbi").Group("pbi").Find(&abListIDs)
|
Select("pbi").Group("pbi").Find(&abListIDs)
|
||||||
_ = global.Oracle.Transaction(func(tx *gorm.DB) error {
|
_ = global.Oracle.Transaction(func(tx *gorm.DB) error {
|
||||||
page := len(abListIDs)/200 + 1
|
page := len(abListIDs)/200 + 1
|
||||||
@ -304,9 +304,9 @@ func CronABList() {
|
|||||||
Round(4).Mul(decimal.NewFromFloat(100)).String()
|
Round(4).Mul(decimal.NewFromFloat(100)).String()
|
||||||
global.PostGreSQL.Transaction(func(tx *gorm.DB) error {
|
global.PostGreSQL.Transaction(func(tx *gorm.DB) error {
|
||||||
var abList *model.ABList
|
var abList *model.ABList
|
||||||
global.PostGreSQL.Where("pbi = ? AND outsourcing_pbi = ?",
|
tx.Where("pbi = ? AND outsourcing_pbi = ?",
|
||||||
tcSfc.TcSfc01, tcSfd.TcSfd13).Find(&abList)
|
tcSfc.TcSfc01, tcSfd.TcSfd13).Find(&abList)
|
||||||
global.PostGreSQL.Model(&abList).Where("pbi = ? AND outsourcing_pbi = ?",
|
tx.Model(&abList).Where("pbi = ? AND outsourcing_pbi = ?",
|
||||||
tcSfc.TcSfc01, tcSfd.TcSfd13).Updates(map[string]interface{}{
|
tcSfc.TcSfc01, tcSfd.TcSfd13).Updates(map[string]interface{}{
|
||||||
"status": status,
|
"status": status,
|
||||||
"quantity": quantity,
|
"quantity": quantity,
|
||||||
@ -318,24 +318,33 @@ func CronABList() {
|
|||||||
"online_quantity": tcSfd.TcSfd05 - returnQuantity,
|
"online_quantity": tcSfd.TcSfd05 - returnQuantity,
|
||||||
"pass_probability": passProbability + "%",
|
"pass_probability": passProbability + "%",
|
||||||
})
|
})
|
||||||
|
tx.Where("ab_list_id = ?", abList.ID).Delete(&model.ABListStock{})
|
||||||
for k, v := range orderDateStockMap {
|
for k, v := range orderDateStockMap {
|
||||||
var abListStock *model.ABListStock
|
tx.Create(&model.ABListStock{
|
||||||
if errors.Is(global.PostGreSQL.Where("ab_list_id = ? AND return_date = ?", abList.ID, k).
|
ABListID: abList.ID,
|
||||||
First(&abListStock).Error, gorm.ErrRecordNotFound) {
|
ReturnDate: k,
|
||||||
global.PostGreSQL.Create(&model.ABListStock{
|
PassQuantity: v[0],
|
||||||
ABListID: abList.ID,
|
FailQuantity: v[1],
|
||||||
ReturnDate: k,
|
})
|
||||||
PassQuantity: v[0],
|
|
||||||
FailQuantity: v[1],
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
global.PostGreSQL.Model(&abListStock).Where("ab_list_id = ? AND return_date = ?", abList.ID, k).
|
|
||||||
Updates(map[string]interface{}{
|
|
||||||
"pass_quantity": v[0],
|
|
||||||
"fail_quantity": v[1],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
//for k, v := range orderDateStockMap {
|
||||||
|
// var abListStock *model.ABListStock
|
||||||
|
// if errors.Is(global.PostGreSQL.Where("ab_list_id = ? AND return_date = ?", abList.ID, k).
|
||||||
|
// First(&abListStock).Error, gorm.ErrRecordNotFound) {
|
||||||
|
// global.PostGreSQL.Create(&model.ABListStock{
|
||||||
|
// ABListID: abList.ID,
|
||||||
|
// ReturnDate: k,
|
||||||
|
// PassQuantity: v[0],
|
||||||
|
// FailQuantity: v[1],
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// global.PostGreSQL.Model(&abListStock).Where("ab_list_id = ? AND return_date = ?", abList.ID, k).
|
||||||
|
// Updates(map[string]interface{}{
|
||||||
|
// "pass_quantity": v[0],
|
||||||
|
// "fail_quantity": v[1],
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
//}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -427,7 +436,7 @@ func CronABList() {
|
|||||||
quantity, _ = decimal.NewFromFloat(quantity).Round(6).Float64()
|
quantity, _ = decimal.NewFromFloat(quantity).Round(6).Float64()
|
||||||
|
|
||||||
var passProbability string
|
var passProbability string
|
||||||
if strings.Contains(tcSfc.TcSfc01, "M596") {
|
if strings.Contains(tcSfc.TcSfc01, "M596") && passQuantity == 0 {
|
||||||
var reports []*model.Report
|
var reports []*model.Report
|
||||||
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ?", tcSfc.TcSfc01, tcSfd.ImaFile.Ima02,
|
global.PostGreSQL.Where("pbi = ? AND product = ? AND lot = ?", tcSfc.TcSfc01, tcSfd.ImaFile.Ima02,
|
||||||
tcSfd.TcSfd06).Find(&reports)
|
tcSfd.TcSfd06).Find(&reports)
|
||||||
|
Loading…
Reference in New Issue
Block a user