rackInfos is null: 랙을 그리려고 할 때 랙 정보가 없음 #672

Merged
ysCha merged 1 commits from dev into dev-deploy 2026-03-02 12:34:09 +09:00

View File

@ -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로 변경