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

@@ -2689,7 +2689,7 @@ async function onModelChange(modelCode) {
}
if (!bedenGrpKey) {
const anaN = String(form.urunAnaGrubu || '')
const anaNRaw = String(form.urunAnaGrubu || '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
@@ -2704,6 +2704,10 @@ async function onModelChange(modelCode) {
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
.trim()
const anaN =
(katN.includes('yetiskin') && anaNRaw.includes('gomlek klasik'))
? anaNRaw.replace('gomlek klasik', 'gomlek ata yaka')
: anaNRaw
const hasGarsonMeta =
anaN.includes('garson') ||
@@ -2862,6 +2866,10 @@ const onSaveOrUpdateRow = async () => {
recalcVat: typeof recalcVat === 'function' ? recalcVat : null,
resetEditor: typeof resetEditor === 'function' ? resetEditor : null,
loadProductSizes: async () => {
await orderStore.loadProductSizes(form, true, $q, productCache)
await loadOrderInventory(true)
},
// gerekiyorsa pass edebilirsin (store tarafında zaten optional)
stockMap,
@@ -2910,6 +2918,10 @@ const onSaveAndNextColor = async () => {
form,
recalcVat: typeof recalcVat === 'function' ? recalcVat : null,
resetEditor: () => {},
loadProductSizes: async () => {
await orderStore.loadProductSizes(form, true, $q, productCache)
await loadOrderInventory(true)
},
stockMap,
$q
})

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, '')