diff --git a/repository/test.data/DL6850.go b/repository/test.data/DL6850.go index 048849a..ca7b3c9 100644 --- a/repository/test.data/DL6850.go +++ b/repository/test.data/DL6850.go @@ -343,7 +343,12 @@ func HandleDL6850Excel(fileText *model.FileText) error { } if errors.Is(global.PostGreSQL.Where("product = ? AND pbi = ? AND factory = ? AND lot = ? AND step = ? AND sub_batch = ? AND wafer_id = ?", fileText.ProductName, fileText.PBI, fileText.Factory, fileText.Lot, step, fileText.SubBatch, fileText.ChipNum).First(&report).Error, gorm.ErrRecordNotFound) { - orderDate := carbon.Parse("20" + fileText.PBI[5:11]).Format("Y-m-d") + orderDate := "" + if len(fileText.PBI) == 12 { + orderDate = carbon.Parse(fileText.PBI[:8]).Format("Y-m-d") + } else { + orderDate = carbon.Parse("20" + fileText.PBI[5:11]).Format("Y-m-d") + } report = &model.Report{ Product: fileText.ProductName, PBI: fileText.PBI, diff --git a/repository/test.data/MT737.go b/repository/test.data/MT737.go index 136abc3..707764e 100644 --- a/repository/test.data/MT737.go +++ b/repository/test.data/MT737.go @@ -383,7 +383,12 @@ func MT737(summary, dataLog *model.FileText) { } if errors.Is(global.PostGreSQL.Where("product = ? AND pbi = ? AND factory = ? AND lot = ? AND step = ? AND sub_batch = ? AND wafer_id = ?", dataLog.ProductName, dataLog.PBI, dataLog.Factory, dataLog.Lot, step, dataLog.SubBatch, dataLog.ChipNum).First(&report).Error, gorm.ErrRecordNotFound) { - orderDate := carbon.Parse("20" + dataLog.PBI[5:11]).Format("Y-m-d") + orderDate := "" + if len(dataLog.PBI) == 12 { + orderDate = carbon.Parse(dataLog.PBI[:8]).Format("Y-m-d") + } else { + orderDate = carbon.Parse("20" + dataLog.PBI[5:11]).Format("Y-m-d") + } report = &model.Report{ Product: dataLog.ProductName, PBI: dataLog.PBI,