Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -565,18 +565,12 @@ func productSeriesRuleFitsGroup(group string, rule productSeriesAutoRule) bool {
|
|||||||
if rule.GroupKey != "" && rule.GroupKey != group {
|
if rule.GroupKey != "" && rule.GroupKey != group {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
groupSizes := map[string]struct{}{}
|
// NOTE: In this installation, Nebim ItemDim1Code (size_code) can be numeric tokens that do not match the
|
||||||
for _, size := range productSeriesSizeGroups[group] {
|
// hardcoded group size lists (e.g. "XS/S/M..."). Enforcing those lists causes valid rules to be rejected
|
||||||
groupSizes[normalizeProductSeriesSize(size)] = struct{}{}
|
// and series assignment to stay blank across many products.
|
||||||
}
|
//
|
||||||
if len(groupSizes) == 0 {
|
// We therefore rely only on explicit rule.GroupKey when provided, and otherwise allow the rule to compete
|
||||||
return true
|
// based on actual stock consumption.
|
||||||
}
|
|
||||||
for size := range rule.Ratio {
|
|
||||||
if _, ok := groupSizes[size]; !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -373,12 +373,20 @@ LIMIT 1
|
|||||||
row.MappingWarning = "PG urun veya varyant token eslesmesi bulunamadi"
|
row.MappingWarning = "PG urun veya varyant token eslesmesi bulunamadi"
|
||||||
}
|
}
|
||||||
assignKey := assignmentKey(row.ProductCode, row.Dim1ID, row.Dim3ID)
|
assignKey := assignmentKey(row.ProductCode, row.Dim1ID, row.Dim3ID)
|
||||||
for _, id := range existing[assignKey] {
|
appendSeries := func(key string) {
|
||||||
if d, ok := defByID[id]; ok {
|
for _, id := range existing[key] {
|
||||||
row.SeriesIDs = append(row.SeriesIDs, id)
|
if d, ok := defByID[id]; ok {
|
||||||
row.Series = append(row.Series, d)
|
row.SeriesIDs = append(row.SeriesIDs, id)
|
||||||
|
row.Series = append(row.Series, d)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
appendSeries(assignKey)
|
||||||
|
// Fallback: if we couldn't match dim3-specific assignments (dim3 token ambiguity / missing),
|
||||||
|
// show the default (dim3 NULL) assignments for the same product+color.
|
||||||
|
if len(row.SeriesIDs) == 0 && row.Dim3Code != "" && row.Dim1ID > 0 {
|
||||||
|
appendSeries(assignmentKey(row.ProductCode, row.Dim1ID, 0))
|
||||||
|
}
|
||||||
sort.Slice(row.Series, func(i, j int) bool { return row.Series[i].Code < row.Series[j].Code })
|
sort.Slice(row.Series, func(i, j int) bool { return row.Series[i].Code < row.Series[j].Code })
|
||||||
sort.Slice(row.SeriesIDs, func(i, j int) bool { return row.SeriesIDs[i] < row.SeriesIDs[j] })
|
sort.Slice(row.SeriesIDs, func(i, j int) bool { return row.SeriesIDs[i] < row.SeriesIDs[j] })
|
||||||
out = append(out, *row)
|
out = append(out, *row)
|
||||||
|
|||||||
Reference in New Issue
Block a user