diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index e4ee52a8..f8bc9901 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -90,9 +90,13 @@ export const useTrestle = () => { let rackInfos = [] if (rack) { + console.log('Original rack data:', rack) rackInfos = Object.keys(rack).map((key) => { return { key, value: rack[key] } }) + console.log('Processed rackInfos:', rackInfos) + } else { + console.log('Rack is null or undefined') } // 모듈들의 centerPoint들을 이용해 각 모듈의 정보(가장 아랫라인 모듈, 가장 윗라인 모듈, 접면, 반접면 등 계산) @@ -451,6 +455,16 @@ export const useTrestle = () => { })?.value.racks mostRowsModule = Math.max(leftRows, rightRows, centerRows, mostRowsModule) + console.log('=== Debug rackInfos ===') + console.log('rackInfos:', rackInfos) + console.log('leftRowsInfo:', leftRowsInfo) + console.log('rightRowsInfo:', rightRowsInfo) + console.log('centerRowsInfo:', centerRowsInfo) + console.log('leftRacks:', leftRacks) + console.log('rightRacks:', rightRacks) + console.log('centerRacks:', centerRacks) + console.log('rackYn:', rackYn) + console.log('========================') if (rackYn === 'Y') { drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn) @@ -1082,14 +1096,19 @@ export const useTrestle = () => { const drawRacks = (rackInfos, rackQty, rackIntvlPct, module, direction, l, rackYn) => { const { width, height, left, top, lastX, lastY, surfaceId } = module const surface = canvas.getObjects().find((obj) => obj.id === surfaceId) - if (!rackInfos) { - const maxRows = surface.trestleDetail.moduleMaxRows - const maxCols = surface.trestleDetail.moduleMaxCols - const msg = `段数の上限は${maxRows}段です。 上限より上の段には設置できません` - swalFire({ title: msg, type: 'alert' }) - throw new Error('rackInfos is null') - } + // if (!rackInfos) { + // const maxRows = surface.trestleDetail.moduleMaxRows + // const maxCols = surface.trestleDetail.moduleMaxCols + // const msg = `段数の上限は${maxRows}段です。 上限より上の段には設置できません` + // swalFire({ title: msg, type: 'alert' }) + // throw new Error('rackInfos is null') + // } + if (!rackInfos) { + const msg = '該当モジュールタイプに関するラック情報がありません。' + swalFire({ title: msg, type: 'alert' }) + return + } const roof = canvas.getObjects().find((obj) => obj.id === surface.parentId) const degree = getDegreeByChon(roof.roofMaterial.pitch) rackIntvlPct = rackIntvlPct === 0 ? 1 : rackIntvlPct // 0인 경우 1로 변경