package repository

import (
	"path"
	"strings"
	"testData/global"
	"testData/model"
)

// XinDe 芯德
func XinDe() {
	var fileTexts []*model.FileText
	global.PostGreSQL.
		Where("factory = ?", "xinde").Order("mod_time").Find(&fileTexts)
	for _, fileText := range fileTexts {
		//fileText.Name = strings.ToLower(fileText.Name)
		//if path.Ext(fileText.Name) != ".csv" && path.Ext(fileText.Name) != ".xls" && path.Ext(fileText.Name) != ".xlsx" {
		//	continue
		//}
		if strings.ToLower(path.Ext(fileText.Name)) != ".csv" &&
			strings.ToLower(path.Ext(fileText.Name)) != ".xls" && strings.ToLower(path.Ext(fileText.Name)) != ".xlsx" {
			continue
		}
		if fileText.ProductName == "" || fileText.Lot == "" {
			continue
		}
		HandleSTS8200Excel(fileText, "")
	}
}
