diff --git a/src/components/floor-plan/modal/basic/BasicSetting.jsx b/src/components/floor-plan/modal/basic/BasicSetting.jsx index 9a09aa1e..a930c148 100644 --- a/src/components/floor-plan/modal/basic/BasicSetting.jsx +++ b/src/components/floor-plan/modal/basic/BasicSetting.jsx @@ -334,9 +334,12 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { - + )} diff --git a/src/hooks/common/useMasterController.js b/src/hooks/common/useMasterController.js index 60aab800..21220726 100644 --- a/src/hooks/common/useMasterController.js +++ b/src/hooks/common/useMasterController.js @@ -18,7 +18,7 @@ export function useMasterController() { */ const getRoofMaterialList = async () => { return await get({ url: '/api/v1/master/getRoofMaterialList' }).then((res) => { - console.log('๐Ÿš€๐Ÿš€ ~ getRoofMaterialList ~ res:', res) + // console.log('๐Ÿš€๐Ÿš€ ~ getRoofMaterialList ~ res:', res) return res }) } diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 1871e34a..86279910 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -95,7 +95,7 @@ export function useModuleBasicSetting(tabNum) { setTrestleDetailList(roofConstructionArray) //๋ถ๋ฉด ์„ค์น˜ ๊ฐ€๋Šฅ ํŒ๋งค์  - if (moduleSelectionData.common.saleStoreNorthFlg === '1') { + if (moduleSelectionData.common.saleStoreNorthFlg == '1') { setSaleStoreNorthFlg(true) } } @@ -111,6 +111,10 @@ export function useModuleBasicSetting(tabNum) { } } + useEffect(() => { + console.log('saleStoreNorthFlg', saleStoreNorthFlg) + }, [saleStoreNorthFlg]) + //๊ฐ€๋Œ€ ์ƒ์„ธ ๋ฐ์ดํ„ฐ ๋“ค์–ด์˜ค๋ฉด ์‹คํ–‰ useEffect(() => { if (trestleDetailList.length > 0) { @@ -236,8 +240,26 @@ export function useModuleBasicSetting(tabNum) { } }) + let isNorth = false + const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id) + if (isExistSurface) { + if (canvasSetting.roofSizeSet != '3') { + //๋ถ๋ฉด์ด ์žˆ์ง€๋งŒ + if (roof.directionText && roof.directionText.indexOf('ๅŒ—') > -1) { + //๋ถ์ชฝ์ผ๋•Œ ํ•ด๋‹น ์„œ๋ถ์„œ, ๋™๋ถ๋™์€ ์ œ์™ธํ•œ๋‹ค๊ณ  ํ•œ๋‹ค + if (!(roof.directionText.indexOf('่ฅฟๅŒ—่ฅฟ') > -1 || roof.directionText.indexOf('ๆฑๅŒ—ๆฑ') > -1)) { + isNorth = true + } + } + + isExistSurface.set({ + isNorth: isNorth, //๋ถ๋ฉด์—ฌ๋ถ€ + isSaleStoreNorthFlg: moduleSelectionData.common.saleStoreNorthFlg == '1' ? true : false, //๋ถ๋ฉด์„ค์น˜๊ฐ€๋Šฅ์  ์—ฌ๋ถ€ + }) + } + addTargetMouseEventListener('mousedown', isExistSurface, function () { toggleSelection(isExistSurface) }) @@ -270,7 +292,6 @@ export function useModuleBasicSetting(tabNum) { //๋ชจ๋“ˆ์„ค์น˜์˜์—ญ?? ์ƒ์„ฑ const surfaceId = uuidv4() - let isNorth = false if (canvasSetting.roofSizeSet != '3') { //๋ถ๋ฉด์ด ์žˆ์ง€๋งŒ @@ -307,6 +328,7 @@ export function useModuleBasicSetting(tabNum) { trestleDetail: trestleDetail, isNorth: isNorth, perPixelTargetFind: true, + isSaleStoreNorthFlg: moduleSelectionData.common.saleStoreNorthFlg == '1' ? true : false, //๋ถ๋ฉด์„ค์น˜๊ฐ€๋Šฅ์  ์—ฌ๋ถ€ // angle: -compasDeg, }) @@ -352,8 +374,11 @@ export function useModuleBasicSetting(tabNum) { const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId) //์ตœ์ดˆ ์„ ํƒ์ผ๋•Œ if (!isExist) { - //์„ค์น˜๋ฉด์ด ๋ถ๋ฉด์ด๊ณ  ๋ถ๋ฉด์„ค์น˜ ํ—ˆ์šฉ์ ์ด ์•„๋‹ˆ๋ฉด - if (setupSurface.isNorth && !saleStoreNorthFlg) { + //๋ชจ๋“ˆ์— ๋ถ๋ฉด ์„ค์น˜ ๊ฐ€๋Šฅ ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•จ + const isNorthModuleYn = moduleSelectionData?.module.itemList.some((module) => module.northModuleYn === 'Y') + + //์„ค์น˜๋ฉด์ด ๋ถ๋ฉด์ด๊ณ  ๋ถ๋ฉด์„ค์น˜ ํ—ˆ์šฉ์ ์ด ์•„๋‹ˆ๋ฉด ๋ถ๋ฉด ๋ชจ๋“ˆ์ด ํ•œ๊ฐœ๋„ ์—†์œผ๋ฉด + if (setupSurface.isNorth && !setupSurface.isSaleStoreNorthFlg && !isNorthModuleYn) { swalFire({ text: getMessage('module.not.batch.north'), icon: 'warning' }) return } @@ -538,9 +563,15 @@ export function useModuleBasicSetting(tabNum) { parentId: moduleSetupSurfaces[i].parentId, }) + const northModuleYn = checkedModule.some((module) => module.northModuleYn === 'Y') //๋ถ๋ฉด์ด๊ณ  ๋ถ๋ฉด์„ค์น˜์ƒ์ ์ด ์•„๋‹ˆ๋ฉด ๊ทธ๋ƒฅ return - if (trestlePolygon.isNorth && !saleStoreNorthFlg) { - return + if (trestlePolygon.isNorth && !trestlePolygon.isSaleStoreNorthFlg) { + if (!northModuleYn) { + //๋ถ๋ฉด์ด๊ณ  ์„ค์น˜ ๊ฐ€๋Šฅ ์ƒ์ ์ด ์•„๋‹Œ๋ฐ ๋ถ๋ฉด ์„ค์น˜ ๋ชจ๋“ˆ์ด ์žˆ์œผ๋ฉด + return + } else { + canvas?.add(tempModule) //์›€์ง์—ฌ๊ฐ€๋ฉด์„œ ์ถ”๊ฐ€๋จ + } } else { canvas?.add(tempModule) //์›€์ง์—ฌ๊ฐ€๋ฉด์„œ ์ถ”๊ฐ€๋จ } @@ -765,7 +796,7 @@ export function useModuleBasicSetting(tabNum) { const mixAsgYn = trestlePolygon.modules[0].moduleInfo.mixAsgYn //ํ˜„์žฌ ์ฒดํฌ๋œ ๋ชจ๋“ˆ๊ธฐ์ค€์œผ๋กœ ํ˜ผํ•ฉ๊ฐ€๋Šฅ์ธ์ง€ ํ™•์ธ Y === Y, N === N ์ผ๋•Œ๋งŒ ์„ค์น˜ ๊ฐ€๋Šฅ if (checkedModule[0].mixAsgYn !== mixAsgYn) { - swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') }) + swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error'), icon: 'warning' }) return } } @@ -798,7 +829,7 @@ export function useModuleBasicSetting(tabNum) { const intersection = turf.intersect(turf.featureCollection([dormerTurfPolygon, tempTurfModule])) //๊ฒน์น˜๋Š”์ง€ ํ™•์ธ //๊ฒน์น˜๋ฉด ์•ˆ๋จ if (intersection) { - swalFire({ text: getMessage('module.place.overobject') }) + swalFire({ text: getMessage('module.place.overobject'), icon: 'warning' }) isIntersection = false } }) @@ -876,7 +907,7 @@ export function useModuleBasicSetting(tabNum) { } if (checkedModule.length === 0) { - swalFire({ text: getMessage('module.place.select.module') }) + swalFire({ text: getMessage('module.place.select.module'), icon: 'warning' }) setIsManualModuleLayoutSetup(false) setManualSetupMode(`manualLayoutSetup_false`) return @@ -890,7 +921,7 @@ export function useModuleBasicSetting(tabNum) { ) if (hasZeroLength) { - swalFire({ text: getMessage('module.layout.setup.has.zero.value') }) + swalFire({ text: getMessage('module.layout.setup.has.zero.value'), icon: 'warning' }) setIsManualModuleLayoutSetup(false) setManualSetupMode(`manualLayoutSetup_false`) return @@ -902,7 +933,7 @@ export function useModuleBasicSetting(tabNum) { //Y์ธ ๋ชจ๋“ˆ๊ณผ N์ธ ๋ชจ๋“ˆ์ด ๋‘˜๋‹ค ์กด์žฌํ•˜๋ฉด ์„ค์น˜ ๋ถˆ๊ฐ€ if (mixAsgY.length > 0 && mixAsgN.length > 0) { - swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') }) + swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error'), icon: 'warning' }) return } @@ -1068,9 +1099,15 @@ export function useModuleBasicSetting(tabNum) { parentId: moduleSetupSurfaces[i].parentId, }) + const northModuleYn = checkedModule.some((module) => module.northModuleYn === 'Y') //๋ถ๋ฉด์ด๊ณ  ๋ถ๋ฉด์„ค์น˜์ƒ์ ์ด ์•„๋‹ˆ๋ฉด ๊ทธ๋ƒฅ return - if (trestlePolygon.isNorth && !saleStoreNorthFlg) { - return + if (trestlePolygon.isNorth && !trestlePolygon.isSaleStoreNorthFlg) { + if (!northModuleYn) { + //๋ถ๋ฉด์ด๊ณ  ์„ค์น˜ ๊ฐ€๋Šฅ ์ƒ์ ์ด ์•„๋‹Œ๋ฐ ๋ถ๋ฉด ์„ค์น˜ ๋ชจ๋“ˆ์ด ์žˆ์œผ๋ฉด + return + } else { + canvas?.add(tempModule) //์›€์ง์—ฌ๊ฐ€๋ฉด์„œ ์ถ”๊ฐ€๋จ + } } else { canvas?.add(tempModule) //์›€์ง์—ฌ๊ฐ€๋ฉด์„œ ์ถ”๊ฐ€๋จ } @@ -1732,23 +1769,51 @@ export function useModuleBasicSetting(tabNum) { } //์ž๋™ ๋ชจ๋“ˆ ์„ค์น˜(๊ทธ๋ฆฌ๋“œ ๋ฐฉ์‹) - const autoModuleSetup = (placementRef) => { + const autoModuleSetup = (type, layoutSetupRef) => { initEvent() //๋งˆ์šฐ์Šค ์ด๋ฒคํŠธ ์ดˆ๊ธฐํ™” + //์‹คํŒจํ•œ ์ง€๋ถ•์žฌ ๋ฐฐ์—ด + let failAutoSetupRoof = [] + + let checkedLayoutData + + /** + * ์ž๋™ ๋ ˆ์ด์•„์›ƒ์ผ๋•Œ 0์ด ์žˆ๊ฑฐ๋‚˜ ํ˜ผํ•ฉ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + */ + if (type === 'layout') { + checkedLayoutData = layoutSetupRef.filter((module) => module.checked) + const hasZeroLength = checkedLayoutData.some((module) => module.row === 0 || module.col === 0) + + if (hasZeroLength) { + swalFire({ text: getMessage('module.layout.setup.has.zero.value'), icon: 'warning' }) + return + } + + //ํ˜ผํ•ฉ ๊ฐ€๋Šฅ ๋ชจ๋“ˆ๊ณผ ํ˜ผํ•ฉ ๋ถˆ๊ฐ€๋Šฅ ๋ชจ๋“ˆ์„ ์„ ํƒํ–ˆ์„๋•Œ ์นด์šดํŠธ๋ฅผ ํ•ด์„œ ํ™•์ธ + const mixAsgY = checkedModule.filter((obj) => obj.mixAsgYn === 'Y') + const mixAsgN = checkedModule.filter((obj) => obj.mixAsgYn === 'N') + + //Y์ธ ๋ชจ๋“ˆ๊ณผ N์ธ ๋ชจ๋“ˆ์ด ๋‘˜๋‹ค ์กด์žฌํ•˜๋ฉด ์„ค์น˜ ๋ถˆ๊ฐ€ + if (mixAsgY.length > 0 && mixAsgN.length > 0) { + swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error'), icon: 'warning' }) + return + } + } + if (checkedModule.length === 0) { - swalFire({ text: getMessage('module.place.select.module') }) + swalFire({ text: getMessage('module.place.select.module'), icon: 'warning' }) return } - //ํ˜ผํ•ฉ ๊ฐ€๋Šฅ ๋ชจ๋“ˆ๊ณผ ํ˜ผํ•ฉ ๋ถˆ๊ฐ€๋Šฅ ๋ชจ๋“ˆ์„ ์„ ํƒํ–ˆ์„๋•Œ ์นด์šดํŠธ๋ฅผ ํ•ด์„œ ํ™•์ธ - const mixAsgY = checkedModule.filter((obj) => obj.mixAsgYn === 'Y') - const mixAsgN = checkedModule.filter((obj) => obj.mixAsgYn === 'N') + // //ํ˜ผํ•ฉ ๊ฐ€๋Šฅ ๋ชจ๋“ˆ๊ณผ ํ˜ผํ•ฉ ๋ถˆ๊ฐ€๋Šฅ ๋ชจ๋“ˆ์„ ์„ ํƒํ–ˆ์„๋•Œ ์นด์šดํŠธ๋ฅผ ํ•ด์„œ ํ™•์ธ + // const mixAsgY = checkedModule.filter((obj) => obj.mixAsgYn === 'Y') + // const mixAsgN = checkedModule.filter((obj) => obj.mixAsgYn === 'N') - //Y์ธ ๋ชจ๋“ˆ๊ณผ N์ธ ๋ชจ๋“ˆ์ด ๋‘˜๋‹ค ์กด์žฌํ•˜๋ฉด ์„ค์น˜ ๋ถˆ๊ฐ€ - if (mixAsgY.length > 0 && mixAsgN.length > 0) { - swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') }) - return - } + // //Y์ธ ๋ชจ๋“ˆ๊ณผ N์ธ ๋ชจ๋“ˆ์ด ๋‘˜๋‹ค ์กด์žฌํ•˜๋ฉด ์„ค์น˜ ๋ถˆ๊ฐ€ + // if (mixAsgY.length > 0 && mixAsgN.length > 0) { + // swalFire({ text: getMessage('modal.module.basic.setting.module.placement.mix.asg.yn.error') }) + // return + // } const isChidori = moduleSetupOption.isChidori const setupLocation = moduleSetupOption.setupLocation @@ -1820,14 +1885,50 @@ export function useModuleBasicSetting(tabNum) { return turf.booleanContains(turfModuleSetupSurface, squarePolygon) || turf.booleanWithin(squarePolygon, turfModuleSetupSurface) } + /** + * ์ž๋™ ๋ ˆ์ด์•„์›ƒ ์„ค์น˜ ์ผ์‹œ row col ์ดˆ๊ณผ ์—ฌ๋ถ€ ํ™•์ธ + * @param {*} trestleDetailData + * @returns + */ + const checkAutoLayoutModuleSetup = (moduleSetupSurface, trestleDetailData) => { + const isMultipleModules = checkedModule.length > 1 //๋ชจ๋“ˆ์ด ์—ฌ๋Ÿฌ๊ฐœ๋ฉด + const maxCol = trestleDetailData.moduleMaxCols //์ตœ๋Œ€ ์—ด์ˆ˜ -> ์–˜๋Š” ๋ฉ€ํ‹ฐ๋ž‘ ๊ด€๊ณ„์—†์Œ + const maxRow = isMultipleModules + ? trestleDetailData.moduleMaxRows + : trestleDetailData.module.find((item) => item.moduleTpCd === checkedModule[0].moduleTpCd).moduleMaxRows //๋ฉ€ํ‹ฐ๋ชจ๋“ˆ์ด๋ฉด ๋ฐ–์— maxRows๋กœ ํŒ๋‹จ ์•„๋‹ˆ๋ฉด module->itemmList๋ฅผ ๊ฐ€์ง€๊ณ  ํŒ๋‹จ + + //๋‹จ์ˆ˜ ํ•ฉ๋‹จ์ˆ˜ + const sumRowCount = isMultipleModules + ? layoutSetupRef.filter((item) => item.checked).reduce((acc, cur) => acc + cur.row, 0) + : layoutSetupRef.find((item) => item.moduleId === checkedModule[0].itemId).row //๋ฉ€ํ‹ฐ๋ชจ๋“ˆ์ด๋ฉด ์ „์ฒด ํ•ฉ, ์ฒดํฌ๋œ ํ•œ๊ฐœ์˜ ์—ด + + // + const sumColCount = layoutSetupRef.filter((item) => item.col).some((item) => item.col > maxCol) + + if (sumRowCount > maxRow || sumColCount) { + failAutoSetupRoof.push(moduleSetupSurface) + return false + } + + // ํ˜ผํ•ฉ์ผ๋•Œ ๋ชจ๋“ˆ ๊ฐœ๋ณ„์˜ row๋ฅผ ์ฒดํฌํ•จ + const isPassedObject = + isMultipleModules && layoutSetupRef.find((item, index) => item.checked && item.row > trestleDetailData.module[index].mixModuleMaxRows) + + if (isPassedObject) { + failAutoSetupRoof.push(moduleSetupSurface) + return false + } + return true + } + //ํ๋ฆ„ ๋ฐฉํ–ฅ์ด ๋‚จ์ชฝ(์•„๋ž˜) const downFlowSetupModule = ( - surfaceMaxLines, + surfaceMaxLines, //deprecated maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, - isCenter = false, + isCenter = false, //deprecated intvHor, intvVer, ) => { @@ -1840,8 +1941,35 @@ export function useModuleBasicSetting(tabNum) { let installedModuleHeightCount = 0 //๋งˆ์ง€๋ง‰์œผ๋กœ ์„ค์น˜๋œ ๋ชจ๋“ˆ์˜ ์นด์šดํŠธ let isChidoriLine = false let flowLines + let installedModuleMixYn + const isNorthSurface = moduleSetupSurface.isNorth + const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //์ฒดํฌ๋œ ๋ชจ๋“ˆ ์ค‘์— ๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + + let layoutRow = 0 + let layoutCol = 0 + + if (type === 'layout') { + const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData) + if (!isPassed) { + return + } + } + + for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) { + const module = checkedModule[moduleIndex] + + if (type === 'layout' && checkedLayoutData) { + const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId) + layoutRow = layout.row + layoutCol = layout.col + } + //ํ˜ผํ•ฉ์—ฌ๋ถ€์— ๋”ฐ๋ผ ์„ค์น˜ ์—ฌ๋ถ€ ๊ฒฐ์ • + if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) { + continue + } + //๋ถ๋ฉด์ผ๋•Œ + const isNorthModuleYn = module.northModuleYn === 'Y' - checkedModule.forEach((module, moduleIndex) => { const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0] //ํ˜ผํ•ฉ๋ชจ๋“ˆ์ผ๋•Œ๋Š” mixModuleMaxRows ๊ฐ’์ด 0 ์ด์ƒ์ž„ // let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows @@ -1857,18 +1985,38 @@ export function useModuleBasicSetting(tabNum) { } } + if (moduleSetupSurface.isSaleStoreNorthFlg) { + //๋ถ๋ฉด์ผ๋•Œ + if (isIncludeNorthModule) { + if (!isNorthModuleYn && isNorthSurface) { + continue + } //ํ๋ฆ„ ๋ฐฉํ–ฅ์ด ๋ถ์ชฝ(์œ„) + } + } else { + if (isNorthSurface) { + if (!isNorthModuleYn) { + continue + } + } + } + //์œก์ง€๋ถ•์ด ์•„๋‹๋•Œ๋งŒ ๋„ฃ๋Š”๋‹ค ์œก์ง€๋ถ•์ผ๋• ํด๋ฆญ ์ด๋ฒคํŠธ์— ๋ณ„๋„๋กœ ๋„ฃ์–ด๋†“์Œ const moduleArray = [] let calcAreaWidth = Math.abs(flowLines.right.x1 - flowLines.left.x1) //์˜ค๋ฅธ์ชฝ x์—์„œ ์™ผ์ชฝ x๋ฅผ ๋บ€ ๊ฐ€์šด๋ฐ๋ฅผ ์ฐพ๋Š” ๋กœ์ง let calcModuleWidthCount = calcAreaWidth / (width + intvHor + 1) //๋บ€ ๊ณต๊ฐ„์—์„œ ๋ชจ๋“ˆ์„ ๋ช‡๊ฐœ๋ฅผ ๋„ฃ์„์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง - let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //์ตœ๋Œ€ ๋ชจ๋“ˆ ๋‹จ์ˆ˜๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ตœ๋Œ€ ๋‹จ์ˆ˜๋ณด๋‹ค ์นด์šดํŠธ๊ฐ€ ํฌ๋ฉด ์ตœ๋Œ€ ๋‹จ์ˆ˜๋กœ ์”€์”€ - let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค - let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1 let calcModuleHeightCount = calcAreaHeight / (height + intvVer + 1) + if (type === 'layout') { + calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol + calcModuleHeightCount = layoutRow + } + + let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //์ตœ๋Œ€ ๋ชจ๋“ˆ ๋‹จ์ˆ˜๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ตœ๋Œ€ ๋‹จ์ˆ˜๋ณด๋‹ค ์นด์šดํŠธ๊ฐ€ ํฌ๋ฉด ์ตœ๋Œ€ ๋‹จ์ˆ˜๋กœ ์”€์”€ + let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค + let calcStartPoint = flowLines.right.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * width) / 2 : 0 //๋ฐ˜์”ฉ ๋‚˜๋ˆ ์„œ ์ค‘์•™์— ๋งž์ถค bottom ๊ธฐ์ค€์œผ๋กœ ์–‘๋ณ€์ด ์ง์„ ์ผ๋•Œ๋งŒ ๊ฐ€์šด๋ฐ ์ •๋ ฌ let startPointX = flowLines.left.x1 + calcStartPoint //์‹œ์ž‘์ ์„ ๋งŒ๋“ ๋‹ค @@ -1882,7 +2030,7 @@ export function useModuleBasicSetting(tabNum) { let chidoriLength = 0 //์ฒซ๋ฒˆ์žฌ ๋ชจ๋“ˆ ์„ค์น˜ ํ›„ ๋‘๋ฒˆ์งธ ๋ชจ๋“ˆ์„ ๋ช‡๊ฐœ๊นŒ์ง€ ์„ค์น˜ ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ๊ณ„์‚ฐ - if (moduleIndex > 0) { + if (installedModuleHeightCount > 0) { // moduleMaxRows = totalModuleMaxRows - installedModuleHeightCount //๋‘๋ฒˆ์งธ ๋ชจ๋“ˆ์ผ๋•Œ isChidoriLine = installedModuleHeightCount % 2 != 0 ? true : false //์ฒซ๋ฒˆ์งธ์—์„œ ์ง์ˆ˜์—์„œ ๋๋‚ฌ์œผ๋ฉด ํ™€์ˆ˜๋Š” ์น˜๋„๋ฆฌ๊ฐ€ ์•„๋‹˜ ์ง์ˆ˜๋Š” ์น˜๋„๋ฆฌ } @@ -1892,12 +2040,12 @@ export function useModuleBasicSetting(tabNum) { let moduleY = flowLines.bottom.y1 - height * i - 1 //์‚ด์ง ์—ฌ์œ ๋ฅผ ์ค€๋‹ค //๋‘๋ฒˆ์งธ ๋ชจ๋“ˆ -> ํ˜ผํ•ฉ์ผ ๊ฒฝ์šฐ์˜ ์„ค์น˜๋  ๋ชจ๋“ˆ ๋†’์ด๋ฅผ ๊ณ„์‚ฐ - if (moduleIndex > 0) { - moduleY = installedLastHeightCoord - intvVer + if (installedModuleHeightCount > 0) { + moduleY = installedLastHeightCoord } //์ฒซ๋ฒˆ์งธ๋Š” ๋ถ™์—ฌ์„œ ๋‘๋ฒˆ์งธ๋Š” ๋งˆ์ง„์„ ์ฃผ๊ณ  ์„ค์น˜ - heightMargin = i === 0 ? 0 : intvVer * i + heightMargin = installedModuleHeightCount === 0 ? 0 : intvVer for (let j = 0; j < totalModuleWidthCount; j++) { let moduleX = startPointX + width * j + 1 //5์ •๋„ ๋งˆ์ง„์„ ์ค€๋‹ค @@ -1947,18 +2095,19 @@ export function useModuleBasicSetting(tabNum) { installedLastHeightCoord = moduleY - height - heightMargin } else { //๋””๋ฒ„๊น…์šฉ - // tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 }) - // canvas?.add(tempModule) - // canvas.renderAll() + tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 }) + canvas?.add(tempModule) + canvas.renderAll() } } if (isInstall) { ++installedModuleHeightCount + installedModuleMixYn = module.mixAsgYn } } setupModule.push(moduleArray) - }) + } } const topFlowSetupModule = ( @@ -1980,8 +2129,36 @@ export function useModuleBasicSetting(tabNum) { let installedModuleHeightCount = 0 //๋งˆ์ง€๋ง‰์œผ๋กœ ์„ค์น˜๋œ ๋ชจ๋“ˆ์˜ ์นด์šดํŠธ let isChidoriLine = false let flowLines + let installedModuleMixYn + const isNorthSurface = moduleSetupSurface.isNorth + const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //์ฒดํฌ๋œ ๋ชจ๋“ˆ ์ค‘์— ๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + + let layoutRow = 0 + let layoutCol = 0 + + if (type === 'layout') { + const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData) + if (!isPassed) { + return + } + } + + for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) { + const module = checkedModule[moduleIndex] + + if (type === 'layout' && checkedLayoutData) { + const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId) + layoutRow = layout.row + layoutCol = layout.col + } + + //ํ˜ผํ•ฉ์—ฌ๋ถ€์— ๋”ฐ๋ผ ์„ค์น˜ ์—ฌ๋ถ€ ๊ฒฐ์ • + if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) { + continue + } + + const isNorthModuleYn = module.northModuleYn === 'Y' - checkedModule.forEach((module, moduleIndex) => { const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0] //ํ˜ผํ•ฉ๋ชจ๋“ˆ์ผ๋•Œ๋Š” mixModuleMaxRows ๊ฐ’์ด 0 ์ด์ƒ์ž„ let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows @@ -1997,20 +2174,45 @@ export function useModuleBasicSetting(tabNum) { } } - //ํ๋ฆ„ ๋ฐฉํ–ฅ์ด ๋ถ์ชฝ(์œ„) + if (moduleSetupSurface.isSaleStoreNorthFlg) { + //๋ถ๋ฉด๊ฐ€๋Šฅ ์„ค์น˜ ๋Œ€๋ฆฌ์ ์ด๋ฉด + //๋ถ๋ฉด์ผ๋•Œ + if (isIncludeNorthModule) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + if (!isNorthModuleYn && isNorthSurface) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ์œผ๋ฉด ๋ถ๋ฉด ๋ชจ๋“ˆ๋งŒ ๊น”๊ณ  ๋‚˜๋จธ์ง€๋Š” ์Šคํ‚ต + continue + } //ํ๋ฆ„ ๋ฐฉํ–ฅ์ด ๋ถ์ชฝ(์œ„) + } + } else { + // ๋ถˆ๋ฉด์„ค์น˜ ๋ถˆ๊ฐ€ ๋Œ€๋ฆฌ์ ์ด๋ฉด + if (isNorthSurface) { + //๋ถ๋ฉด์ผ๋•Œ + if (!isNorthModuleYn) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์•„๋‹ˆ๋ฉด ์Šคํ‚ต + continue + } + } + } //์œก์ง€๋ถ•์ด ์•„๋‹๋•Œ๋งŒ ๋„ฃ๋Š”๋‹ค ์œก์ง€๋ถ•์ผ๋• ํด๋ฆญ ์ด๋ฒคํŠธ์— ๋ณ„๋„๋กœ ๋„ฃ์–ด๋†“์Œ const moduleArray = [] let calcAreaWidth = flowLines.right.x1 - flowLines.left.x1 //์˜ค๋ฅธ์ชฝ x์—์„œ ์™ผ์ชฝ x๋ฅผ ๋บ€ ๊ฐ€์šด๋ฐ๋ฅผ ์ฐพ๋Š” ๋กœ์ง let calcModuleWidthCount = calcAreaWidth / (width + intvHor + 1) //๋บ€ ๊ณต๊ฐ„์—์„œ ๋ชจ๋“ˆ์„ ๋ช‡๊ฐœ๋ฅผ ๋„ฃ์„์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1 + let calcModuleHeightCount = calcAreaHeight / (height + intvVer + 1) + + //๋‹จ์ˆ˜์ง€์ • ์ž๋™์ด๋ฉด + if (type === 'layout') { + calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol + calcModuleHeightCount = layoutRow + } + let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //์ตœ๋Œ€ ๋ชจ๋“ˆ ๋‹จ์ˆ˜๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ตœ๋Œ€ ๋‹จ์ˆ˜๋ณด๋‹ค ์นด์šดํŠธ๊ฐ€ ํฌ๋ฉด ์ตœ๋Œ€ ๋‹จ์ˆ˜๋กœ ์”€์”€ // let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค //??์–ด์ฉ”๋•Œ๋Š” ๋ถ™๊ณ  ์–ด์ฉ”๋•Œ๋Š” ์•ˆ๋ถ™๊ณ  ๋ฉ‹๋Œ€๋กœ??? let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค - let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1 - let calcModuleHeightCount = calcAreaHeight / (height + intvVer + 1) - let calcStartPoint = flowLines.left.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * width) / 2 : 0 //๋ฐ˜์”ฉ ๋‚˜๋ˆ ์„œ ์ค‘์•™์— ๋งž์ถค bottom ๊ธฐ์ค€์œผ๋กœ ์–‘๋ณ€์ด ์ง์„ ์ผ๋•Œ๋งŒ ๊ฐ€์šด๋ฐ ์ •๋ ฌ let startPointX = flowLines.right.x1 - calcStartPoint //์‹œ์ž‘์ ์„ ๋งŒ๋“ ๋‹ค @@ -2032,11 +2234,11 @@ export function useModuleBasicSetting(tabNum) { let isInstall = false let moduleY = flowLines.top.y1 + height * i //ํƒ‘์˜ y์ ์—์„œ๋ถ€ํ„ฐ ์•„๋ž˜๋กœ ๊ทธ๋ ค ๋‚ด๋ ค๊ฐ„๋‹ค - if (moduleIndex > 0) { - moduleY = installedLastHeightCoord + intvVer + 1 + if (installedModuleHeightCount > 0) { + moduleY = installedLastHeightCoord } - heightMargin = i === 0 ? 0 : intvVer * i //๋ชจ๋“ˆ๊ฐ„์— ๋งˆ์ง„์ด ์žˆ์–ด ๋งˆ์ง„๊ฐ’๋„ ๋„ฃ์Œ + heightMargin = installedModuleHeightCount === 0 ? 0 : intvVer //๋ชจ๋“ˆ๊ฐ„์— ๋งˆ์ง„์ด ์žˆ์–ด ๋งˆ์ง„๊ฐ’๋„ ๋„ฃ์Œ for (let j = 0; j < totalModuleWidthCount; j++) { //๋ชจ๋“ˆ ์—ด์ˆ˜ ๋งŒํผ ๋ฐ˜๋ณต let moduleX = startPointX - width * j - 1 //์‹œ์ž‘์ ์—์„œ ์šฐ -> ์ขŒ๋กœ ๊ทธ๋ ค ๋‚ด๋ ค๊ฐ„๋‹ค @@ -2087,11 +2289,12 @@ export function useModuleBasicSetting(tabNum) { } if (isInstall) { ++installedModuleHeightCount + installedModuleMixYn = module.mixAsgYn } } setupModule.push(moduleArray) - }) + } } //๋‚จ, ๋ถ๊ณผ ๊ฐ™์€ ๋กœ์ง์œผ๋กœ ์ ์šฉํ•˜๋ ค๋ฉด ์ขŒ์šฐ๋Š” ์—ด -> ํ–‰ ์œผ๋กœ ๊ทธ๋ ค์•ผํ•จ @@ -2115,8 +2318,36 @@ export function useModuleBasicSetting(tabNum) { let installedModuleHeightCount = 0 //๋งˆ์ง€๋ง‰์œผ๋กœ ์„ค์น˜๋œ ๋ชจ๋“ˆ์˜ ์นด์šดํŠธ let isChidoriLine = false let flowLines + let installedModuleMixYn + const isNorthSurface = moduleSetupSurface.isNorth + const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //์ฒดํฌ๋œ ๋ชจ๋“ˆ ์ค‘์— ๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง - checkedModule.forEach((module, moduleIndex) => { + let layoutRow = 0 + let layoutCol = 0 + + if (type === 'layout') { + const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData) + if (!isPassed) { + return + } + } + + for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) { + const module = checkedModule[moduleIndex] + + //๋‹จ์ˆ˜ ์ง€์ •์ด๋ฉด + if (type === 'layout' && checkedLayoutData) { + const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId) + layoutRow = layout.row + layoutCol = layout.col + } + + //ํ˜ผํ•ฉ์—ฌ๋ถ€์— ๋”ฐ๋ผ ์„ค์น˜ ์—ฌ๋ถ€ ๊ฒฐ์ • + if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) { + continue + } + + const isNorthModuleYn = module.northModuleYn === 'Y' const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0] //ํ˜ผํ•ฉ๋ชจ๋“ˆ์ผ๋•Œ๋Š” mixModuleMaxRows ๊ฐ’์ด 0 ์ด์ƒ์ž„ let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows @@ -2135,19 +2366,46 @@ export function useModuleBasicSetting(tabNum) { } } + if (moduleSetupSurface.isSaleStoreNorthFlg) { + //๋ถ๋ฉด๊ฐ€๋Šฅ ์„ค์น˜ ๋Œ€๋ฆฌ์ ์ด๋ฉด + //๋ถ๋ฉด์ผ๋•Œ + if (isIncludeNorthModule) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + if (!isNorthModuleYn && isNorthSurface) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ์œผ๋ฉด ๋ถ๋ฉด ๋ชจ๋“ˆ๋งŒ ๊น”๊ณ  ๋‚˜๋จธ์ง€๋Š” ์Šคํ‚ต + continue + } //ํ๋ฆ„ ๋ฐฉํ–ฅ์ด ๋ถ์ชฝ(์œ„) + } + } else { + // ๋ถˆ๋ฉด์„ค์น˜ ๋ถˆ๊ฐ€ ๋Œ€๋ฆฌ์ ์ด๋ฉด + if (isNorthSurface) { + //๋ถ๋ฉด์ผ๋•Œ + if (!isNorthModuleYn) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์•„๋‹ˆ๋ฉด ์Šคํ‚ต + continue + } + } + } + //์œก์ง€๋ถ•์ด ์•„๋‹๋•Œ๋งŒ ๋„ฃ๋Š”๋‹ค ์œก์ง€๋ถ•์ผ๋• ํด๋ฆญ ์ด๋ฒคํŠธ์— ๋ณ„๋„๋กœ ๋„ฃ์–ด๋†“์Œ const moduleArray = [] let calcAreaWidth = flowLines.bottom.y1 - flowLines.top.y1 //์•„๋ž˜์—์„œ y์—์„œ ์œ„๋ฅผ y๋ฅผ ๋บ€ ๊ฐ€์šด๋ฐ๋ฅผ ์ฐพ๋Š” ๋กœ์ง let calcModuleWidthCount = calcAreaWidth / (height + intvHor + 1) //๋บ€ ๊ณต๊ฐ„์—์„œ ๋ชจ๋“ˆ์„ ๋ช‡๊ฐœ๋ฅผ ๋„ฃ์„์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1 + let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1) + + //๋‹จ์ˆ˜์ง€์ • ์ž๋™์ด๋ฉด + if (type === 'layout') { + calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol + calcModuleHeightCount = layoutRow + } + let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //์ตœ๋Œ€ ๋ชจ๋“ˆ ๋‹จ์ˆ˜๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ตœ๋Œ€ ๋‹จ์ˆ˜๋ณด๋‹ค ์นด์šดํŠธ๊ฐ€ ํฌ๋ฉด ์ตœ๋Œ€ ๋‹จ์ˆ˜๋กœ ์”€์”€ // let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค - let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1 - let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1) - let calcStartPoint = flowLines.bottom.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * height) / 2 : 0 //๋ฐ˜์”ฉ ๋‚˜๋ˆ ์„œ ์ค‘์•™์— ๋งž์ถค left ๋†’์ด ๊ธฐ์ค€์œผ๋กœ ์–‘๋ณ€์ด ์ง์„ ์ผ๋•Œ๋งŒ ๊ฐ€์šด๋ฐ ์ •๋ ฌ let startPointX = flowLines.top.y1 + calcStartPoint //์‹œ์ž‘์ ์„ ๋งŒ๋“ ๋‹ค @@ -2171,12 +2429,12 @@ export function useModuleBasicSetting(tabNum) { let moduleY = flowLines.left.x1 + width * i + 1 //์‚ด์ง ์—ฌ์œ ๋ฅผ ์ค€๋‹ค //๋‘๋ฒˆ์งธ ๋ชจ๋“ˆ -> ํ˜ผํ•ฉ์ผ ๊ฒฝ์šฐ์˜ ์„ค์น˜๋  ๋ชจ๋“ˆ ๋†’์ด๋ฅผ ๊ณ„์‚ฐ - if (moduleIndex > 0) { - moduleY = installedLastHeightCoord + intvHor + if (installedModuleHeightCount > 0) { + moduleY = installedLastHeightCoord } //์ฒซ๋ฒˆ์งธ๋Š” ๋ถ™์—ฌ์„œ ๋‘๋ฒˆ์งธ๋Š” ๋งˆ์ง„์„ ์ฃผ๊ณ  ์„ค์น˜ - heightMargin = i === 0 ? 0 : intvHor * i + heightMargin = installedModuleHeightCount === 0 ? 0 : intvHor for (let j = 0; j < totalModuleWidthCount; j++) { let moduleX = startPointX + height * j + 1 //5์ •๋„ ๋งˆ์ง„์„ ์ค€๋‹ค @@ -2227,10 +2485,11 @@ export function useModuleBasicSetting(tabNum) { if (isInstall) { ++installedModuleHeightCount + installedModuleMixYn = module.mixAsgYn } } setupModule.push(moduleArray) - }) + } } const rightFlowSetupModule = ( @@ -2252,8 +2511,35 @@ export function useModuleBasicSetting(tabNum) { let installedModuleHeightCount = 0 //๋งˆ์ง€๋ง‰์œผ๋กœ ์„ค์น˜๋œ ๋ชจ๋“ˆ์˜ ์นด์šดํŠธ let isChidoriLine = false let flowLines + let installedModuleMixYn + const isNorthSurface = moduleSetupSurface.isNorth + const isIncludeNorthModule = checkedModule.some((module) => module.northModuleYn === 'Y') //์ฒดํฌ๋œ ๋ชจ๋“ˆ ์ค‘์— ๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง - checkedModule.forEach((module, moduleIndex) => { + let layoutRow = 0 + let layoutCol = 0 + + if (type === 'layout') { + const isPassed = checkAutoLayoutModuleSetup(moduleSetupSurface, trestleDetailData) + if (!isPassed) { + return + } + } + + for (let moduleIndex = 0; moduleIndex < checkedModule.length; moduleIndex++) { + const module = checkedModule[moduleIndex] + + if (type === 'layout' && checkedLayoutData) { + const layout = checkedLayoutData.find((item) => module.itemId === item.moduleId) + layoutRow = layout.row + layoutCol = layout.col + } + + //ํ˜ผํ•ฉ์—ฌ๋ถ€์— ๋”ฐ๋ผ ์„ค์น˜ ์—ฌ๋ถ€ ๊ฒฐ์ • + if (installedModuleMixYn && installedModuleMixYn !== module.mixAsgYn) { + continue + } + + const isNorthModuleYn = module.northModuleYn === 'Y' const tmpModuleData = trestleDetailData.module.filter((moduleObj) => module.moduleTpCd === moduleObj.moduleTpCd)[0] //ํ˜ผํ•ฉ๋ชจ๋“ˆ์ผ๋•Œ๋Š” mixModuleMaxRows ๊ฐ’์ด 0 ์ด์ƒ์ž„ let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows @@ -2272,18 +2558,45 @@ export function useModuleBasicSetting(tabNum) { } } + if (moduleSetupSurface.isSaleStoreNorthFlg) { + //๋ถ๋ฉด๊ฐ€๋Šฅ ์„ค์น˜ ๋Œ€๋ฆฌ์ ์ด๋ฉด + //๋ถ๋ฉด์ผ๋•Œ + if (isIncludeNorthModule) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + if (!isNorthModuleYn && isNorthSurface) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์žˆ์œผ๋ฉด ๋ถ๋ฉด ๋ชจ๋“ˆ๋งŒ ๊น”๊ณ  ๋‚˜๋จธ์ง€๋Š” ์Šคํ‚ต + continue + } //ํ๋ฆ„ ๋ฐฉํ–ฅ์ด ๋ถ์ชฝ(์œ„) + } + } else { + // ๋ถˆ๋ฉด์„ค์น˜ ๋ถˆ๊ฐ€ ๋Œ€๋ฆฌ์ ์ด๋ฉด + if (isNorthSurface) { + //๋ถ๋ฉด์ผ๋•Œ + if (!isNorthModuleYn) { + //๋ถ๋ฉด ๋ชจ๋“ˆ์ด ์•„๋‹ˆ๋ฉด ์Šคํ‚ต + continue + } + } + } + //์œก์ง€๋ถ•์ด ์•„๋‹๋•Œ๋งŒ ๋„ฃ๋Š”๋‹ค ์œก์ง€๋ถ•์ผ๋• ํด๋ฆญ ์ด๋ฒคํŠธ์— ๋ณ„๋„๋กœ ๋„ฃ์–ด๋†“์Œ const moduleArray = [] let calcAreaWidth = flowLines.bottom.y1 - flowLines.top.y1 //์•„๋ž˜์—์„œ y์—์„œ ์œ„๋ฅผ y๋ฅผ ๋บ€ ๊ฐ€์šด๋ฐ๋ฅผ ์ฐพ๋Š” ๋กœ์ง let calcModuleWidthCount = calcAreaWidth / (height + intvHor + 1) //๋บ€ ๊ณต๊ฐ„์—์„œ ๋ชจ๋“ˆ์„ ๋ช‡๊ฐœ๋ฅผ ๋„ฃ์„์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋กœ์ง + let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1 + let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1) + + //๋‹จ์ˆ˜์ง€์ • ์ž๋™์ด๋ฉด + if (type === 'layout') { + calcModuleWidthCount = layoutCol > calcModuleWidthCount ? calcModuleWidthCount : layoutCol + calcModuleHeightCount = layoutRow + } + let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //์ตœ๋Œ€ ๋ชจ๋“ˆ ๋‹จ์ˆ˜๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ตœ๋Œ€ ๋‹จ์ˆ˜๋ณด๋‹ค ์นด์šดํŠธ๊ฐ€ ํฌ๋ฉด ์ตœ๋Œ€ ๋‹จ์ˆ˜๋กœ ์”€์”€ // let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //์น˜์กฐ๋ฐฐ์น˜์ผ๊ฒฝ์šฐ๋Š” ํ•œ๊ฐœ ๋” ๋„ฃ๋Š”๋‹ค - let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1 - let calcModuleHeightCount = calcAreaHeight / (width + intvVer + 1) - let calcStartPoint = flowLines.top.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * height) / 2 : 0 //๋ฐ˜์”ฉ ๋‚˜๋ˆ ์„œ ์ค‘์•™์— ๋งž์ถค left ๋†’์ด ๊ธฐ์ค€์œผ๋กœ ์–‘๋ณ€์ด ์ง์„ ์ผ๋•Œ๋งŒ ๊ฐ€์šด๋ฐ ์ •๋ ฌ let startPointX = flowLines.bottom.y2 - calcStartPoint //์‹œ์ž‘์ ์„ ๋งŒ๋“ ๋‹ค @@ -2307,12 +2620,12 @@ export function useModuleBasicSetting(tabNum) { let moduleY = flowLines.right.x1 - width * i - 1 //์‚ด์ง ์—ฌ์œ ๋ฅผ ์ค€๋‹ค //๋‘๋ฒˆ์งธ ๋ชจ๋“ˆ -> ํ˜ผํ•ฉ์ผ ๊ฒฝ์šฐ์˜ ์„ค์น˜๋  ๋ชจ๋“ˆ ๋†’์ด๋ฅผ ๊ณ„์‚ฐ - if (moduleIndex > 0) { - moduleY = installedLastHeightCoord - intvHor + if (installedModuleHeightCount > 0) { + moduleY = installedLastHeightCoord } //์ฒซ๋ฒˆ์งธ๋Š” ๋ถ™์—ฌ์„œ ๋‘๋ฒˆ์งธ๋Š” ๋งˆ์ง„์„ ์ฃผ๊ณ  ์„ค์น˜ - heightMargin = i === 0 ? 0 : intvHor * i + heightMargin = installedModuleHeightCount === 0 ? 0 : intvHor for (let j = 0; j < totalModuleWidthCount; j++) { let moduleX = startPointX - height * j - 1 //5์ •๋„ ๋งˆ์ง„์„ ์ค€๋‹ค @@ -2366,11 +2679,12 @@ export function useModuleBasicSetting(tabNum) { if (isInstall) { ++installedModuleHeightCount + installedModuleMixYn = module.mixAsgYn } } setupModule.push(moduleArray) - }) + } } moduleSetupSurfaces.forEach((moduleSetupSurface, index) => { @@ -2460,6 +2774,18 @@ export function useModuleBasicSetting(tabNum) { } }) // calculateForApi() + + if (type === 'layout' && failAutoSetupRoof.length > 0) { + const roofNamesList = failAutoSetupRoof.map((roof) => ({ + roofName: roof.roofMaterial.roofMatlNmJp, + moduleMaxRows: roof.trestleDetail.moduleMaxRows, + })) + + const alertString = roofNamesList.map((item, index) => `${item.roofName}(${item.moduleMaxRows})`) + console.log('alertString', alertString) + + // swalFire({ text: alertString, icon: 'warning' }) + } } const coordToTurfPolygon = (points) => { diff --git a/src/locales/ja.json b/src/locales/ja.json index 5ab74329..1fc75a67 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -149,9 +149,10 @@ "modal.module.basic.setting.pitch.module.column.amount": "ๅˆ—ๆ•ฐ", "modal.module.basic.setting.pitch.module.column.margin": "ๅทฆๅณ้–“้š”", "modal.module.basic.setting.prev": "ๅ‰ใซๆˆปใ‚‹", - "modal.module.basic.setting.row.batch": "ๆฎตใƒปๅˆ—ๆ•ฐๆŒ‡ๅฎš้…็ฝฎ", + "modal.module.basic.setting.row.batch": "ใƒฌใ‚คใ‚ขใ‚ฆใƒˆๆŒ‡ๅฎš", "modal.module.basic.setting.passivity.placement": "ๆ‰‹ๅ‹•้…็ฝฎ", "modal.module.basic.setting.auto.placement": "่‡ชๅ‹•้…็ฝฎ", + "modal.module.basic.setting.auto.row.batch": "่‡ชๅ‹•ใƒฌใ‚คใ‚ขใ‚ฆใƒˆๆŒ‡ๅฎš", "plan.menu.module.circuit.setting.circuit.trestle.setting": "ๅ›ž่ทฏ่จญๅฎš", "modal.circuit.trestle.setting": "ๅ›ž่ทฏ่จญๅฎš", "modal.circuit.trestle.setting.alloc.trestle": "ๆžถๅฐ้…็ฝฎ", diff --git a/src/locales/ko.json b/src/locales/ko.json index 1090b4b1..cd8b855b 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -152,7 +152,8 @@ "modal.module.basic.setting.prev": "์ด์ „", "modal.module.basic.setting.row.batch": "๋‹จยท์—ด์ˆ˜ ์ง€์ • ๋ฐฐ์น˜", "modal.module.basic.setting.passivity.placement": "์ˆ˜๋™ ๋ฐฐ์น˜", - "modal.module.basic.setting.auto.placement": "์„ค์ •๊ฐ’์œผ๋กœ ์ž๋™ ๋ฐฐ์น˜", + "modal.module.basic.setting.auto.placement": "์ž๋™ ๋ฐฐ์น˜", + "modal.module.basic.setting.auto.row.batch": "์ž๋™ ๋‹จยท์—ด์ˆ˜ ์ง€์ • ๋ฐฐ์น˜ ", "plan.menu.module.circuit.setting.circuit.trestle.setting": "ํšŒ๋กœ์„ค์ •", "modal.circuit.trestle.setting": "ํšŒ๋กœ์„ค์ •", "modal.circuit.trestle.setting.alloc.trestle": "๊ฐ€๋Œ€ํ• ๋‹น",