Fix product performance grouped JSON build

This commit is contained in:
M_Kececi
2026-08-26 20:19:57 +03:00
parent 372d7a8761
commit 66868cadce
@@ -3936,12 +3936,24 @@ async function fetchRequiredParcaMappings () {
const data = await fetchMappings(ilk) const data = await fetchMappings(ilk)
const mappings = Array.isArray(data) ? data : [] const mappings = Array.isArray(data) ? data : []
if (mappings.length > 0 || !isMalzemesizFasonProduct()) return mappings if (!isMalzemesizFasonProduct()) return mappings
// MALZEMESIZ FASON uses the same required-part definition as its // MALZEMESIZ FASON inherits required parts from MALZEMELI FASON at
// MALZEMELI FASON counterpart for the same product main/sub group. // Urun Ana Grubu level. Do not require an exact alt-group match: the
const fallback = await fetchMappings('MALZEMELI FASON') // business rule is defined by the main group, and a partial MALZEMESIZ
return Array.isArray(fallback) ? fallback : [] // mapping must not prevent the inherited missing parts from appearing.
const inheritedData = await get('/pricing/production-product-costing/maliyet-parca-eslestirme', {
trace_id: traceId.value,
only_active: 1,
urun_ilk_grubu: 'MALZEMELI FASON',
urun_ana_grubu: ana,
urun_alt_grubu: ''
})
const inheritedMappings = Array.isArray(inheritedData) ? inheritedData : []
// Keep both sources. ensureNoCostRequiredRowsFromMappings de-duplicates
// required rows by MT section + raw-material type.
return [...mappings, ...inheritedMappings]
} }
async function resolveHammaddeMetaForRequired (hNo) { async function resolveHammaddeMetaForRequired (hNo) {