Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-04-02 10:34:50 +03:00
parent 4af852c853
commit a97accbdb1
5 changed files with 129 additions and 82 deletions

View File

@@ -968,7 +968,7 @@ VALUES (
nullableBool(header.IsSalesViaInternet, false),
nullableBool(header.IsSuspended, false),
nullableBool(header.IsCompleted, false),
nullableBool(header.IsCompleted, true),
nullableBool(header.IsPrinted, false),
nullableBool(header.IsLocked, false),

View File

@@ -3,18 +3,27 @@ package queries
const GetProductColors = `
DECLARE @ProductCode VARCHAR(30) = @p1;
WITH NormalizedColors AS (
SELECT
p.ProductCode,
CASE
WHEN ISNULL(v.ColorCode, '') = '000' THEN '001'
ELSE ISNULL(v.ColorCode, '')
END AS ColorCode
FROM ProductFilterWithDescription('TR') AS p
INNER JOIN prItemVariant AS v WITH(NOLOCK)
ON v.ItemCode = p.ProductCode
WHERE
p.ProductCode = @ProductCode
AND ISNULL(v.ColorCode, '') <> ''
)
SELECT DISTINCT
p.ProductCode,
v.ColorCode,
ISNULL(cd.ColorDescription, '') AS ColorDescription
FROM ProductFilterWithDescription('TR') AS p
INNER JOIN prItemVariant AS v WITH(NOLOCK)
ON v.ItemCode = p.ProductCode
n.ProductCode,
n.ColorCode,
ISNULL(cd.ColorDescription, CASE WHEN n.ColorCode = '001' THEN 'SIYAH' ELSE '' END) AS ColorDescription
FROM NormalizedColors AS n
LEFT JOIN cdColorDesc AS cd WITH(NOLOCK)
ON cd.ColorCode = v.ColorCode
ON cd.ColorCode = n.ColorCode
AND cd.LangCode = 'TR'
WHERE
p.ProductCode = @ProductCode
AND ISNULL(v.ColorCode, '') <> ''
ORDER BY v.ColorCode;
ORDER BY n.ColorCode;
`

View File

@@ -1,24 +1,40 @@
package queries
const GetProductSecondColors = `
WITH NormalizedVariants AS (
SELECT
Product.ProductCode,
CASE
WHEN ISNULL(prItemVariant.ColorCode, '') = '000' THEN '001'
ELSE ISNULL(prItemVariant.ColorCode, '')
END AS ColorCode,
CASE
WHEN ISNULL(prItemVariant.ItemDim2Code, '') = '000' THEN '001'
ELSE ISNULL(prItemVariant.ItemDim2Code, '')
END AS ItemDim2Code
FROM prItemVariant WITH(NOLOCK)
INNER JOIN ProductFilterWithDescription('TR') AS Product
ON prItemVariant.ItemCode = Product.ProductCode
WHERE Product.ProductCode = @ProductCode
)
SELECT
Product.ProductCode,
ISNULL(prItemVariant.ColorCode, '') AS ColorCode,
ISNULL(prItemVariant.ItemDim2Code, '') AS ItemDim2Code,
ISNULL(ColorDesc.ColorDescription, '') AS ColorDescription
FROM prItemVariant WITH(NOLOCK)
INNER JOIN ProductFilterWithDescription('TR') AS Product
ON prItemVariant.ItemCode = Product.ProductCode
Variant.ProductCode,
Variant.ColorCode,
Variant.ItemDim2Code,
ISNULL(ColorDesc.ColorDescription, CASE WHEN Variant.ItemDim2Code = '001' THEN 'SIYAH' ELSE '' END) AS ColorDescription
FROM NormalizedVariants AS Variant
LEFT JOIN cdColorDesc AS ColorDesc WITH(NOLOCK)
ON ColorDesc.ColorCode = prItemVariant.ItemDim2Code
ON ColorDesc.ColorCode = Variant.ItemDim2Code
AND ColorDesc.LangCode = 'TR'
WHERE Product.ProductCode = @ProductCode
AND prItemVariant.ColorCode = @ColorCode
AND ISNULL(prItemVariant.ItemDim2Code, '') <> ''
WHERE Variant.ColorCode = CASE
WHEN ISNULL(@ColorCode, '') = '000' THEN '001'
ELSE ISNULL(@ColorCode, '')
END
AND Variant.ItemDim2Code <> ''
GROUP BY
Product.ProductCode,
prItemVariant.ItemDim2Code,
prItemVariant.ColorCode,
Variant.ProductCode,
Variant.ItemDim2Code,
Variant.ColorCode,
ColorDesc.ColorDescription
ORDER BY ItemDim2Code
ORDER BY Variant.ItemDim2Code
`

View File

@@ -2928,8 +2928,8 @@ async function onColorChange(colorCode) {
const data = res?.data || []
if (Array.isArray(data) && data.length > 0) {
renkOptions2.value = data.map(x => ({
label: x.item_dim2_code,
value: x.item_dim2_code
label: `${x.item_dim2_code || x.ItemDim2Code || ''} - ${x.color_description || x.ColorDescription || ''}`.trim(),
value: x.item_dim2_code || x.ItemDim2Code || ''
}))
console.log('🎨 2. renk listesi yüklendi:', renkOptions2.value.length)
} else {

View File

@@ -108,44 +108,46 @@
<template #body-cell-NewItemCode="props">
<q-td :props="props">
<q-select
v-model="props.row.NewItemEntryMode"
dense
filled
emit-value
map-options
:options="newItemEntryModeOptions"
label="Kod Giris Tipi"
@update:model-value="val => onNewItemEntryModeChange(props.row, val)"
/>
<q-select
v-if="props.row.NewItemEntryMode === 'selected'"
class="q-mt-xs"
v-model="props.row.NewItemCode"
dense
filled
use-input
emit-value
map-options
option-label="label"
option-value="value"
:options="productCodeSelectOptions"
label="Eski Kod Sec"
@update:model-value="val => onSelectProduct(props.row, val)"
/>
<q-input
v-else-if="props.row.NewItemEntryMode === 'typed'"
class="q-mt-xs"
v-model="props.row.NewItemCode"
dense
filled
maxlength="13"
label="Yeni Urun"
placeholder="X999-XX99999"
label="Yeni Kod Ekle"
:class="newItemInputClass(props.row)"
@update:model-value="val => onNewItemChange(props.row, val, 'typed')"
>
<template #append>
<q-icon name="arrow_drop_down" class="cursor-pointer" />
</template>
<q-menu
anchor="bottom left"
self="top left"
fit
>
<div class="q-pa-sm" style="min-width:260px">
<q-input
v-model="productSearch"
dense
filled
debounce="200"
placeholder="Urun ara..."
/>
<q-list class="q-mt-xs" bordered separator>
<q-item
v-for="opt in filteredProducts"
:key="opt.ProductCode"
clickable
@click="onSelectProduct(props.row, opt.ProductCode)"
>
<q-item-section>{{ opt.ProductCode }}</q-item-section>
</q-item>
</q-list>
</div>
</q-menu>
</q-input>
/>
<div v-if="props.row.NewItemMode && props.row.NewItemMode !== 'empty'" class="q-mt-xs row items-center no-wrap">
<q-badge :color="newItemBadgeColor(props.row)" text-color="white">
{{ newItemBadgeLabel(props.row) }}
@@ -361,8 +363,8 @@ import { normalizeSearchText } from 'src/utils/searchText'
const route = useRoute()
const $q = useQuasar()
const store = useOrderProductionItemStore()
const BAGGI_CODE_PATTERN = /^[A-Z][0-9]{3}-[A-Z]{3}[0-9]{5}$/
const BAGGI_CODE_ERROR = 'Girdiginiz kod BAGGI kod sistemine uyumlu degil. Format: X999-XXX99999'
const BAGGI_CODE_PATTERN = /^[A-Z][0-9]{3}-[A-Z]{2,3}[0-9]{5}$/
const BAGGI_CODE_ERROR = 'Girdiginiz kod BAGGI kod sistemine uyumlu degil. Format: X999-XX99999'
const orderHeaderID = computed(() => String(route.params.orderHeaderID || '').trim())
const header = computed(() => store.header || {})
@@ -377,7 +379,6 @@ const cariLabel = computed(() => {
const rows = ref([])
const descFilter = ref('')
const productOptions = ref([])
const productSearch = ref('')
const selectedMap = ref({})
const cdItemDialogOpen = ref(false)
const cdItemTargetCode = ref('')
@@ -429,14 +430,6 @@ function formatDate (val) {
return text.length >= 10 ? text.slice(0, 10) : text
}
const filteredProducts = computed(() => {
const needle = normalizeSearchText(productSearch.value)
if (!needle) return productOptions.value.slice(0, 50)
return productOptions.value.filter(p =>
normalizeSearchText(p?.ProductCode).includes(needle)
).slice(0, 50)
})
const filteredRows = computed(() => {
const needle = normalizeSearchText(descFilter.value)
if (!needle) return rows.value
@@ -449,6 +442,17 @@ const visibleRowKeys = computed(() => filteredRows.value.map(r => r.RowKey))
const selectedVisibleCount = computed(() => visibleRowKeys.value.filter(k => !!selectedMap.value[k]).length)
const allSelectedVisible = computed(() => visibleRowKeys.value.length > 0 && selectedVisibleCount.value === visibleRowKeys.value.length)
const someSelectedVisible = computed(() => selectedVisibleCount.value > 0)
const newItemEntryModeOptions = [
{ label: 'Eski Kod Sec', value: 'selected' },
{ label: 'Yeni Kod Ekle', value: 'typed' }
]
const productCodeSelectOptions = computed(() =>
(productOptions.value || []).map(p => {
const code = String(p?.ProductCode || '').trim().toUpperCase()
return { label: code, value: code }
}).filter(x => !!x.value)
)
function applyNewItemVisualState (row, source = 'typed') {
const info = store.classifyItemCode(row?.NewItemCode || '')
@@ -485,10 +489,20 @@ function newItemHintText (row) {
}
function onSelectProduct (row, code) {
productSearch.value = ''
row.NewItemEntryMode = 'selected'
onNewItemChange(row, code, 'selected')
}
function onNewItemEntryModeChange (row, mode) {
const next = String(mode || '').trim()
row.NewItemEntryMode = next
row.NewItemCode = ''
row.NewItemMode = 'empty'
row.NewItemSource = ''
row.NewColor = ''
row.NewDim2 = ''
}
function onNewItemChange (row, val, source = 'typed') {
const prevCode = String(row?.NewItemCode || '').trim().toUpperCase()
const next = String(val || '').trim().toUpperCase()
@@ -529,7 +543,7 @@ function getColorOptions (row) {
const list = store.colorOptionsByCode[code] || []
return list.map(c => ({
...c,
colorLabel: `${c.color_code} - ${c.color_description || ''}`.trim()
colorLabel: `${c.color_code || c.ColorCode || ''} - ${c.color_description || c.ColorDescription || ''}`.trim()
}))
}
@@ -540,7 +554,8 @@ function getSecondColorOptions (row) {
const list = store.secondColorOptionsByKey[key] || []
return list.map(c => ({
...c,
item_dim2_label: `${c.item_dim2_code} - ${c.color_description || ''}`.trim()
item_dim2_code: c.item_dim2_code || c.ItemDim2Code || '',
item_dim2_label: `${c.item_dim2_code || c.ItemDim2Code || ''} - ${c.color_description || c.ColorDescription || ''}`.trim()
}))
}
@@ -569,12 +584,14 @@ function isValidBaggiModelCode (code) {
}
function validateRowInput (row) {
const entryMode = String(row?.NewItemEntryMode || '').trim()
const newItemCode = String(row.NewItemCode || '').trim().toUpperCase()
const newColor = normalizeShortCode(row.NewColor, 3)
const newDim2 = normalizeShortCode(row.NewDim2, 3)
const oldColor = String(row.OldColor || '').trim()
const oldDim2 = String(row.OldDim2 || '').trim()
if (!entryMode) return 'Lutfen once kod giris tipini seciniz (Eski Kod Sec / Yeni Kod Ekle).'
if (!newItemCode) return 'Yeni model kodu zorunludur.'
if (!isValidBaggiModelCode(newItemCode)) {
return BAGGI_CODE_ERROR
@@ -928,14 +945,15 @@ function groupItems (items, prevRows = []) {
const prevMap = new Map()
for (const r of prevRows || []) {
if (!r?.RowKey) continue
prevMap.set(r.RowKey, {
NewDesc: String(r.NewDesc || '').trim(),
NewItemCode: String(r.NewItemCode || '').trim().toUpperCase(),
NewColor: String(r.NewColor || '').trim().toUpperCase(),
NewDim2: String(r.NewDim2 || '').trim().toUpperCase(),
NewItemMode: String(r.NewItemMode || '').trim(),
NewItemSource: String(r.NewItemSource || '').trim()
})
prevMap.set(r.RowKey, {
NewDesc: String(r.NewDesc || '').trim(),
NewItemCode: String(r.NewItemCode || '').trim().toUpperCase(),
NewColor: String(r.NewColor || '').trim().toUpperCase(),
NewDim2: String(r.NewDim2 || '').trim().toUpperCase(),
NewItemMode: String(r.NewItemMode || '').trim(),
NewItemSource: String(r.NewItemSource || '').trim(),
NewItemEntryMode: String(r.NewItemEntryMode || '').trim()
})
}
const map = new Map()
@@ -962,6 +980,7 @@ function groupItems (items, prevRows = []) {
NewDesc: prevDesc || fallbackDesc,
NewItemMode: prev.NewItemMode || 'empty',
NewItemSource: prev.NewItemSource || '',
NewItemEntryMode: prev.NewItemEntryMode || '',
IsVariantMissing: !!it.IsVariantMissing
})
}
@@ -986,6 +1005,9 @@ function groupItems (items, prevRows = []) {
g.NewItemCode = info.normalized
g.NewItemMode = info.mode
if (info.mode === 'empty') g.NewItemSource = ''
if (!g.NewItemEntryMode && g.NewItemCode) {
g.NewItemEntryMode = g.NewItemSource === 'selected' ? 'selected' : 'typed'
}
delete g.__sizeMap
out.push(g)
}