Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -3069,20 +3069,22 @@ export const useOrderEntryStore = defineStore('orderentry', {
|
||||
}
|
||||
|
||||
// =======================================================
|
||||
// 🧪 PRE-VALIDATE — prItemVariant ön kontrol
|
||||
// - invalid varsa CREATE/UPDATE ÇALIŞMAZ
|
||||
// 🧪 PRE-VALIDATE — prItemVariant ön kontrol (NEW + EDIT)
|
||||
// - invalid varsa CREATE/UPDATE çalışmaz
|
||||
// =======================================================
|
||||
if (!isNew) {
|
||||
const linesToValidate = lines.filter(
|
||||
l => l._deleteSignal === true || l._dirty === true || !l.OrderLineID
|
||||
)
|
||||
const linesToValidate = lines.filter(l =>
|
||||
Number(l?.Qty1 || 0) > 0 &&
|
||||
l?._deleteSignal !== true &&
|
||||
String(l?.ItemCode || '').trim() !== ''
|
||||
)
|
||||
|
||||
if (linesToValidate.length > 0) {
|
||||
const v = await api.post('/order/validate', { header, lines: linesToValidate })
|
||||
const invalid = v?.data?.invalid || []
|
||||
|
||||
if (invalid.length > 0) {
|
||||
await this.showInvalidVariantDialog?.($q, invalid)
|
||||
return // ❌ update ÇALIŞMAZ
|
||||
return // ❌ create/update ÇALIŞMAZ
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3245,6 +3247,31 @@ export const useOrderEntryStore = defineStore('orderentry', {
|
||||
} catch (err) {
|
||||
console.error('❌ submitAllReal:', err)
|
||||
|
||||
const data = err?.response?.data || {}
|
||||
const status = Number(err?.response?.status || 0)
|
||||
if (err?.response?.status === 400 && data?.code === 'INVALID_ITEM_VARIANT') {
|
||||
const oneInvalid = [{
|
||||
clientKey: data?.clientKey || '',
|
||||
itemCode: data?.itemCode || '',
|
||||
colorCode: data?.colorCode || '',
|
||||
dim1: data?.dim1 || '',
|
||||
dim2: data?.dim2 || '',
|
||||
qty1: 0,
|
||||
reason: data?.message || 'Tanımsız ürün kombinasyonu'
|
||||
}]
|
||||
await this.showInvalidVariantDialog?.($q, oneInvalid)
|
||||
return
|
||||
}
|
||||
|
||||
if (status === 524) {
|
||||
$q.notify({
|
||||
type: 'warning',
|
||||
timeout: 36000,
|
||||
message: 'Sunucu zaman aşımına uğradı (524). Sipariş kısmen kaydedilmiş olabilir; önce listeden kontrol edin, sonra tekrar deneyin.'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message:
|
||||
|
||||
Reference in New Issue
Block a user