diff --git a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx index 00f3598f..618a65d2 100644 --- a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx @@ -475,15 +475,17 @@ export default function CircuitTrestleSetting({ id }) { // 승압설정 목록 조회 const getStepUpListData = () => { - return stepUpListData[0].pcsItemList.map((item) => { + const pcs = [] + console.log(stepUpListData) + stepUpListData[0].pcsItemList.map((item, index) => { return item.serQtyList .filter((serQty) => serQty.selected) - .map((serQty, index) => { - return { + .forEach((serQty) => { + pcs.push({ pcsMkrCd: item.pcsMkrCd, pcsSerCd: item.pcsSerCd, pcsItemId: item.itemId, - pscOptCd: index === 0 ? seletedMainOption.code : seletedSubOption.code, + pscOptCd: getPcsOptCd(index), paralQty: serQty.paralQty, connections: item.connList?.length ? [ @@ -492,9 +494,43 @@ export default function CircuitTrestleSetting({ id }) { }, ] : [], - } + }) + // return { + // pcsMkrCd: item.pcsMkrCd, + // pcsSerCd: item.pcsSerCd, + // pcsItemId: item.itemId, + // pscOptCd: getPcsOptCd(index), + // paralQty: serQty.paralQty, + // connections: item.connList?.length + // ? [ + // { + // connItemId: item.connList[0].itemId, + // }, + // ] + // : [], + // } }) }) + return pcs + } + + const getPcsOptCd = (index) => { + console.log(selectedModels) + console.log(seletedMainOption) + console.log(seletedSubOption) + if (selectedModels.some((model) => model.pcsSerParallelYn === 'Y')) { + if (selectedModels.length > 1) { + if (index === 0) { + return seletedMainOption.code + } else { + return seletedSubOption.code + } + } else { + return seletedMainOption.code + } + } else { + return seletedMainOption.code + } } const handleStepUp = () => { diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index 4f0bb116..48ad5913 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -640,13 +640,13 @@ export const useTrestle = () => { //surfaces.pcses들을 배열로 묶는다 const pcses = surfaces[0].pcses.filter((pcs) => pcs !== null && pcs !== undefined) - surfaces.forEach((surface, index) => { - if (index !== 0) { - if (surface.pcses) { - pcses.concat(surface.pcses) - } - } - }) + // surfaces.forEach((surface, index) => { + // if (index !== 0) { + // if (surface.pcses) { + // pcses.concat(surface.pcses) + // } + // } + // }) const allModules = surfaces.map((surface) => surface.modules).flat() // 모듈 파라미터 생성