Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-24 15:38:26 +03:00
parent d0e43c03fc
commit 96ede55936
3 changed files with 66 additions and 14 deletions

View File

@@ -1685,18 +1685,32 @@ export const useOrderEntryStore = defineStore('orderentry', {
const overLimit = []
for (let i = 0; i < bedenLabels.length; i++) {
const lbl = String(bedenLabels[i] ?? '').trim()
const stok = Number(stockMapLocal?.[lbl] ?? 0)
const rawLbl = String(bedenLabels[i] ?? '')
const lbl = rawLbl.trim() === '' ? ' ' : rawLbl
const hasExactKey = Object.prototype.hasOwnProperty.call(stockMapLocal || {}, lbl)
const hasTrimKey = Object.prototype.hasOwnProperty.call(stockMapLocal || {}, rawLbl.trim())
const stokRaw = hasExactKey
? stockMapLocal?.[lbl]
: hasTrimKey
? stockMapLocal?.[rawLbl.trim()]
: undefined
const stok = Number(stokRaw ?? 0)
const girilen = Number(bedenValues?.[i] ?? 0)
if (stok > 0 && girilen > stok) {
overLimit.push({ beden: lbl, stok, girilen })
// Stok 0 veya stok kaydı yokken giriş yapılırsa da uyarı ver.
if (girilen > 0 && girilen > stok) {
overLimit.push({
beden: lbl,
stok,
girilen,
stokKaydiVar: hasExactKey || hasTrimKey
})
}
}
if (overLimit.length && $q) {
const msg = overLimit
.map(x => `• <b>${x.beden}</b>: ${x.girilen} (Stok: ${x.stok})`)
.map(x => `• <b>${x.beden}</b>: ${x.girilen} (Stok: ${x.stokKaydiVar ? x.stok : 'kayıt yok'})`)
.join('<br>')
const stokOK = await new Promise(resolve => {
@@ -3617,6 +3631,21 @@ export function detectBedenGroup(bedenList, urunAnaGrubu = '', urunKategori = ''
? bedenList.map(v => (v || '').toString().trim().toUpperCase())
: [' ']
const rawAna = normalizeTextForMatch(urunAnaGrubu || '')
const rawKat = normalizeTextForMatch(urunKategori || '')
const rawYetiskinGarson = normalizeTextForMatch(yetiskinGarson || '')
const isYetiskin = rawKat.includes('YETISKIN')
const isGomlekKlasikOrAtayaka =
rawAna.includes('GOMLEK KLASIK') ||
rawAna.includes('GOMLEK ATA YAKA') ||
rawAna.includes('GOMLEK ATAYAKA')
// Özel kural:
// Kategorisi YETISKIN ve ana grubu GOMLEK KLASIK/ATA YAKA olanlar her zaman "gom" grubundadır.
if (isYetiskin && isGomlekKlasikOrAtayaka) {
return 'gom'
}
// Beden seti çocuk yaş formatındaysa metadata beklemeden "yas" aç.
// Örn: 2,4,6,8,10,12,14 veya 2Y,4Y,6Y...
const yasNums = new Set(['2', '4', '6', '8', '10', '12', '14'])
@@ -3626,18 +3655,19 @@ export function detectBedenGroup(bedenList, urunAnaGrubu = '', urunKategori = ''
return 'yas'
}
const rawAna = normalizeTextForMatch(urunAnaGrubu || '')
const rawKat = normalizeTextForMatch(urunKategori || '')
const rawYetiskinGarson = normalizeTextForMatch(yetiskinGarson || '')
const isYetiskinGomlekKlasik = isYetiskin && rawAna.includes('GOMLEK KLASIK')
const mappedRawAna = isYetiskinGomlekKlasik
? rawAna.replace('GOMLEK KLASIK', 'GOMLEK ATA YAKA')
: rawAna
// Ozel kural:
// YETISKIN/GARSON = GARSON ve URUN ANA GRUBU "GOMLEK ATA YAKA" veya "GOMLEK KLASIK" ise
// sonuc "yas" olmalidir.
const isGarsonGomlekAnaGrubu =
rawAna.includes('GOMLEK ATAYAKA') ||
rawAna.includes('GOMLEK ATA YAKA') ||
rawAna.includes('GOMLEK KLASIK')
const hasGarsonSignal = rawAna.includes('GARSON') || rawKat.includes('GARSON') || rawYetiskinGarson.includes('GARSON')
mappedRawAna.includes('GOMLEK ATAYAKA') ||
mappedRawAna.includes('GOMLEK ATA YAKA') ||
mappedRawAna.includes('GOMLEK KLASIK')
const hasGarsonSignal = mappedRawAna.includes('GARSON') || rawKat.includes('GARSON') || rawYetiskinGarson.includes('GARSON')
if (isGarsonGomlekAnaGrubu && (rawKat.includes('GARSON') || rawYetiskinGarson.includes('GARSON'))) {
return 'yas'
}
@@ -3650,7 +3680,7 @@ export function detectBedenGroup(bedenList, urunAnaGrubu = '', urunKategori = ''
const harfliBedenler = ['XS','S','M','L','XL','2XL','3XL','4XL','5XL','6XL','7XL']
if (list.some(b => harfliBedenler.includes(b))) return 'gom'
const ana = normalizeTextForMatch(urunAnaGrubu || '')
const ana = mappedRawAna
.trim()
.replace(/\(.*?\)/g, '')
.replace(/[^A-Z0-9\s]/g, '')