Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -475,6 +475,16 @@ func normalizeNumericToken(s string) string {
|
||||
return s[i:]
|
||||
}
|
||||
|
||||
// normalizeDim1Token: variant karşılaştırması için Dim1'i eski kuralla normalize eder.
|
||||
// (boşluk, YAS ve Y kaldırılır; UPPER)
|
||||
func normalizeDim1Token(s string) string {
|
||||
s = strings.ToUpper(strings.TrimSpace(s))
|
||||
s = strings.ReplaceAll(s, " ", "")
|
||||
s = strings.ReplaceAll(s, "YAS", "")
|
||||
s = strings.ReplaceAll(s, "Y", "")
|
||||
return s
|
||||
}
|
||||
|
||||
// =======================================================
|
||||
// AKSBIR DETECTION
|
||||
// =======================================================
|
||||
@@ -514,7 +524,8 @@ func ValidateItemVariant(tx *sql.Tx, ln models.OrderDetail) error {
|
||||
color = normalizeEmpty(color)
|
||||
dim1 = normalizeEmpty(dim1)
|
||||
dim2 = normalizeEmpty(dim2)
|
||||
dim1Numeric := normalizeNumericToken(dim1)
|
||||
dim1Norm := normalizeDim1Token(dim1)
|
||||
dim1Numeric := normalizeNumericToken(dim1Norm)
|
||||
|
||||
if item == "" {
|
||||
return fmt.Errorf(
|
||||
@@ -559,7 +570,7 @@ func ValidateItemVariant(tx *sql.Tx, ln models.OrderDetail) error {
|
||||
)
|
||||
)
|
||||
) THEN 1 ELSE 0 END
|
||||
`, item, color, dim1, dim2, dim1Numeric).Scan(&exists)
|
||||
`, item, color, dim1Norm, dim2, dim1Numeric).Scan(&exists)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("ItemVariant kontrol query hatası: %w", err)
|
||||
@@ -640,7 +651,8 @@ func ValidateOrderVariants(db *sql.DB, lines []models.OrderDetail) ([]models.Inv
|
||||
color := normalizeEmpty(normalizeKeyPart(ln.ColorCode))
|
||||
dim1 := normalizeEmpty(normalizeKeyPart(ln.ItemDim1Code))
|
||||
dim2 := normalizeEmpty(normalizeKeyPart(ln.ItemDim2Code))
|
||||
dim1Numeric := normalizeNumericToken(dim1)
|
||||
dim1Norm := normalizeDim1Token(dim1)
|
||||
dim1Numeric := normalizeNumericToken(dim1Norm)
|
||||
|
||||
// ItemCode boş ise invalid
|
||||
if strings.TrimSpace(item) == "" {
|
||||
@@ -659,7 +671,7 @@ func ValidateOrderVariants(db *sql.DB, lines []models.OrderDetail) ([]models.Inv
|
||||
}
|
||||
|
||||
var exists int
|
||||
if err := stmt.QueryRow(item, color, dim1, dim2, dim1Numeric).Scan(&exists); err != nil {
|
||||
if err := stmt.QueryRow(item, color, dim1Norm, dim2, dim1Numeric).Scan(&exists); err != nil {
|
||||
return nil, fmt.Errorf("validate query hatası (i=%d): %w", i, err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user