Merge branch 'dev' into dev-yj
This commit is contained in:
commit
603c83de53
@ -356,7 +356,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 회로할당(승압설정) 저장 버튼 클릭 시
|
// 회로할당(승압설정) 저장 버튼 클릭 시
|
||||||
const onApply = () => {
|
const onApply = async () => {
|
||||||
canvas
|
canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
@ -364,8 +364,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
obj.pcses = getStepUpListData()
|
obj.pcses = getStepUpListData()
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE))
|
const result = await apply()
|
||||||
apply()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onClickPrev = () => {
|
const onClickPrev = () => {
|
||||||
|
|||||||
@ -248,6 +248,7 @@ export default function StepUp(props) {
|
|||||||
circuitInfo: module.pcsItemId,
|
circuitInfo: module.pcsItemId,
|
||||||
})
|
})
|
||||||
targetModule.circuit = moduleCircuitText
|
targetModule.circuit = moduleCircuitText
|
||||||
|
targetModule.pcsItemId = module.pcsItemId
|
||||||
targetModule.circuitNumber = module.circuit
|
targetModule.circuitNumber = module.circuit
|
||||||
canvas.add(moduleCircuitText)
|
canvas.add(moduleCircuitText)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -249,8 +249,8 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log('uniqueCircuitNumbers', uniqueCircuitNumbers)
|
||||||
const pcsItemList = selectedModels.map((model) => {
|
const pcsItemList = selectedModels.map((model, index) => {
|
||||||
return {
|
return {
|
||||||
pcsMkrCd: model.pcsMkrCd,
|
pcsMkrCd: model.pcsMkrCd,
|
||||||
pcsSerCd: model.pcsSerCd,
|
pcsSerCd: model.pcsSerCd,
|
||||||
@ -260,7 +260,7 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
serQtyList: [
|
serQtyList: [
|
||||||
{
|
{
|
||||||
serQty: targetModules.length,
|
serQty: targetModules.length,
|
||||||
paralQty: 0,
|
paralQty: uniqueCircuitNumbers.length,
|
||||||
rmdYn: 'Y',
|
rmdYn: 'Y',
|
||||||
usePossYn: 'Y',
|
usePossYn: 'Y',
|
||||||
roofSurfaceList: roofSurfaceList,
|
roofSurfaceList: roofSurfaceList,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||||
import { canvasState } from '@/store/canvasAtom'
|
import { canvasState, currentAngleTypeSelector } from '@/store/canvasAtom'
|
||||||
import { POLYGON_TYPE } from '@/common/common'
|
import { POLYGON_TYPE } from '@/common/common'
|
||||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
import { getDegreeByChon, getTrestleLength } from '@/util/canvas-util'
|
import { getDegreeByChon, getTrestleLength } from '@/util/canvas-util'
|
||||||
@ -13,220 +13,207 @@ export const useTrestle = () => {
|
|||||||
const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
||||||
const { getQuotationItem } = useMasterController()
|
const { getQuotationItem } = useMasterController()
|
||||||
const [estimateParam, setEstimateParam] = useRecoilState(estimateParamAtom)
|
const [estimateParam, setEstimateParam] = useRecoilState(estimateParamAtom)
|
||||||
|
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
||||||
|
|
||||||
const apply = () => {
|
const apply = () => {
|
||||||
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
|
try {
|
||||||
// exposedBottomPoints는 노출 최하면 들의 centerPoint 배열.
|
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
|
||||||
|
// exposedBottomPoints는 노출 최하면 들의 centerPoint 배열.
|
||||||
|
|
||||||
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
// 기존 eaveBar를 삭제
|
// 기존 eaveBar를 삭제
|
||||||
canvas.getObjects().forEach((obj) => {
|
canvas.getObjects().forEach((obj) => {
|
||||||
if (obj.name === 'eaveBar' || obj.name === 'rack' || obj.name === 'halfEaveBar' || obj.name === 'smartRack') {
|
if (obj.name === 'eaveBar' || obj.name === 'rack' || obj.name === 'halfEaveBar' || obj.name === 'smartRack') {
|
||||||
canvas.remove(obj)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
canvas.getObjects().forEach((obj) => {
|
|
||||||
if (obj.name === 'bracket') {
|
|
||||||
canvas.remove(obj)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
surfaces.forEach((surface) => {
|
|
||||||
const parent = canvas.getObjects().find((obj) => obj.id === surface.parentId)
|
|
||||||
const roofMaterialIndex = parent.roofMaterial.index
|
|
||||||
const construction = moduleSelectionData?.roofConstructions?.find((construction) => construction.roofIndex === roofMaterialIndex).construction
|
|
||||||
if (!construction) {
|
|
||||||
alert('앞에서 셋팅 안됨')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let moduleRowsTotCnt = 0
|
|
||||||
let isEaveBar = construction.setupCover
|
|
||||||
let isSnowGuard = construction.setupSnowCover
|
|
||||||
const direction = parent.direction
|
|
||||||
const rack = surface.trestleDetail.rack
|
|
||||||
let { rackQty, rackIntvlPct, rackYn, cvrPlvrYn } = surface.trestleDetail
|
|
||||||
|
|
||||||
if (!rack) {
|
|
||||||
//25/01/16 기준 랙이 없는 경우는 그냥 안그려준다.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const rackInfos = Object.keys(rack).map((key) => {
|
|
||||||
return { key, value: rack[key] }
|
|
||||||
})
|
|
||||||
|
|
||||||
const result = calculateForApi(surface)
|
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const centerPoints = result.centerPoints
|
|
||||||
|
|
||||||
const exposedBottomModules = [] // 아래 두면이 모두 노출 되어있는 경우
|
|
||||||
const leftExposedHalfBottomModules = [] // 왼쪽 면만 노출되어있는 경우
|
|
||||||
const rightExposedHalfBottomPoints = [] // 오른쪽 면만 노출되어 있는 경우
|
|
||||||
const leftExposedHalfTopModules = [] // 왼쪽 면만 노출되어 있는 경우
|
|
||||||
const rightExposedHalfTopPoints = [] // 오른쪽 면만 노출되어 있는 경우
|
|
||||||
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
|
||||||
|
|
||||||
modules.forEach((module) => {
|
|
||||||
const { x, y } = module.getCenterPoint()
|
|
||||||
const isExposedBottom = result.exposedBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
|
||||||
const isLeftExposedHalfBottom = result.leftExposedHalfBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
|
||||||
const isRightExposedHalfBottom = result.rightExposedHalfBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
|
||||||
const isRightExposedHalfTop = result.rightExposedHalfTopPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
|
||||||
const isLeftExposedHalfTop = result.leftExposedHalfTopPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
|
||||||
if (isExposedBottom) {
|
|
||||||
exposedBottomModules.push(module)
|
|
||||||
}
|
|
||||||
if (isLeftExposedHalfBottom) {
|
|
||||||
leftExposedHalfBottomModules.push(module)
|
|
||||||
}
|
|
||||||
if (isRightExposedHalfBottom) {
|
|
||||||
rightExposedHalfBottomPoints.push(module)
|
|
||||||
}
|
|
||||||
if (isRightExposedHalfTop) {
|
|
||||||
leftExposedHalfTopModules.push(module)
|
|
||||||
}
|
|
||||||
if (isLeftExposedHalfTop) {
|
|
||||||
rightExposedHalfTopPoints.push(module)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 4개중 한개라도 있는 경우 치조배치로 간주한다.
|
|
||||||
const isChidory =
|
|
||||||
leftExposedHalfBottomModules.length > 0 ||
|
|
||||||
rightExposedHalfBottomPoints.length > 0 ||
|
|
||||||
leftExposedHalfTopModules.length > 0 ||
|
|
||||||
rightExposedHalfTopPoints.length > 0
|
|
||||||
|
|
||||||
surface.set({ isChidory: isChidory })
|
|
||||||
|
|
||||||
canvas
|
|
||||||
.getObjects()
|
|
||||||
.filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parentId === surface.id)
|
|
||||||
.forEach((obj) => {
|
|
||||||
canvas.remove(obj)
|
canvas.remove(obj)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
canvas.getObjects().forEach((obj) => {
|
||||||
|
if (obj.name === 'bracket') {
|
||||||
|
canvas.remove(obj)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
surfaces.forEach((surface) => {
|
||||||
|
const parent = canvas.getObjects().find((obj) => obj.id === surface.parentId)
|
||||||
|
const roofMaterialIndex = parent.roofMaterial.index
|
||||||
|
const construction = moduleSelectionData?.roofConstructions?.find((construction) => construction.roofIndex === roofMaterialIndex).construction
|
||||||
|
if (!construction) {
|
||||||
|
alert('앞에서 셋팅 안됨')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let moduleRowsTotCnt = 0
|
||||||
|
let isEaveBar = construction.setupCover
|
||||||
|
let isSnowGuard = construction.setupSnowCover
|
||||||
|
const direction = parent.direction
|
||||||
|
const rack = surface.trestleDetail.rack
|
||||||
|
let { rackQty, rackIntvlPct, rackYn, cvrPlvrYn } = surface.trestleDetail
|
||||||
|
|
||||||
|
if (!rack) {
|
||||||
|
//25/01/16 기준 랙이 없는 경우는 그냥 안그려준다.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const rackInfos = Object.keys(rack).map((key) => {
|
||||||
|
return { key, value: rack[key] }
|
||||||
})
|
})
|
||||||
|
|
||||||
if (isEaveBar) {
|
const result = calculateForApi(surface)
|
||||||
// 처마력바설치 true인 경우 설치
|
|
||||||
exposedBottomModules.forEach((module) => {
|
if (!result) {
|
||||||
//TODO : 방향별로 처마력바 설치해야함
|
return
|
||||||
const bottomPoints = findTopTwoPoints([...module.points], direction)
|
}
|
||||||
if (!bottomPoints) return
|
const centerPoints = result.centerPoints
|
||||||
const eaveBar = new fabric.Line([bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y], {
|
|
||||||
parent: surface,
|
const exposedBottomModules = [] // 아래 두면이 모두 노출 되어있는 경우
|
||||||
name: 'eaveBar',
|
const leftExposedHalfBottomModules = [] // 왼쪽 면만 노출되어있는 경우
|
||||||
stroke: 'blue',
|
const rightExposedHalfBottomPoints = [] // 오른쪽 면만 노출되어 있는 경우
|
||||||
strokeWidth: 4,
|
const leftExposedHalfTopModules = [] // 왼쪽 면만 노출되어 있는 경우
|
||||||
selectable: false,
|
const rightExposedHalfTopPoints = [] // 오른쪽 면만 노출되어 있는 경우
|
||||||
surfaceId: surface.id,
|
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
parentId: module.id,
|
|
||||||
|
modules.forEach((module) => {
|
||||||
|
const { x, y } = module.getCenterPoint()
|
||||||
|
const isExposedBottom = result.exposedBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
||||||
|
const isLeftExposedHalfBottom = result.leftExposedHalfBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
||||||
|
const isRightExposedHalfBottom = result.rightExposedHalfBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
||||||
|
const isRightExposedHalfTop = result.rightExposedHalfTopPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
||||||
|
const isLeftExposedHalfTop = result.leftExposedHalfTopPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
|
||||||
|
if (isExposedBottom) {
|
||||||
|
exposedBottomModules.push(module)
|
||||||
|
}
|
||||||
|
if (isLeftExposedHalfBottom) {
|
||||||
|
leftExposedHalfBottomModules.push(module)
|
||||||
|
}
|
||||||
|
if (isRightExposedHalfBottom) {
|
||||||
|
rightExposedHalfBottomPoints.push(module)
|
||||||
|
}
|
||||||
|
if (isRightExposedHalfTop) {
|
||||||
|
leftExposedHalfTopModules.push(module)
|
||||||
|
}
|
||||||
|
if (isLeftExposedHalfTop) {
|
||||||
|
rightExposedHalfTopPoints.push(module)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 4개중 한개라도 있는 경우 치조배치로 간주한다.
|
||||||
|
const isChidory =
|
||||||
|
leftExposedHalfBottomModules.length > 0 ||
|
||||||
|
rightExposedHalfBottomPoints.length > 0 ||
|
||||||
|
leftExposedHalfTopModules.length > 0 ||
|
||||||
|
rightExposedHalfTopPoints.length > 0
|
||||||
|
|
||||||
|
surface.set({ isChidory: isChidory })
|
||||||
|
|
||||||
|
canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parentId === surface.id)
|
||||||
|
.forEach((obj) => {
|
||||||
|
canvas.remove(obj)
|
||||||
})
|
})
|
||||||
canvas.add(eaveBar)
|
|
||||||
canvas.renderAll()
|
|
||||||
})
|
|
||||||
|
|
||||||
if (isChidory && cvrPlvrYn === 'Y') {
|
if (isEaveBar) {
|
||||||
leftExposedHalfBottomModules.forEach((module) => {
|
// 처마력바설치 true인 경우 설치
|
||||||
|
exposedBottomModules.forEach((module) => {
|
||||||
|
//TODO : 방향별로 처마력바 설치해야함
|
||||||
const bottomPoints = findTopTwoPoints([...module.points], direction)
|
const bottomPoints = findTopTwoPoints([...module.points], direction)
|
||||||
let barPoints = []
|
|
||||||
//설치해야할 반처마커버 포인트를 방향에 따라 설정
|
|
||||||
|
|
||||||
if (direction === 'south') {
|
|
||||||
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x - module.width / 2, bottomPoints[1].y]
|
|
||||||
} else if (direction === 'north') {
|
|
||||||
barPoints = [bottomPoints[0].x + module.width / 2, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y]
|
|
||||||
} else if (direction === 'east') {
|
|
||||||
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[0].y - module.height / 2]
|
|
||||||
} else if (direction === 'west') {
|
|
||||||
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y - module.height / 2]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bottomPoints) return
|
if (!bottomPoints) return
|
||||||
const halfEaveBar = new fabric.Line(barPoints, {
|
const eaveBar = new fabric.Line([bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y], {
|
||||||
parent: surface,
|
parent: surface,
|
||||||
name: 'halfEaveBar',
|
name: 'eaveBar',
|
||||||
stroke: 'blue',
|
stroke: 'blue',
|
||||||
strokeWidth: 4,
|
strokeWidth: 4,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
surfaceId: surface.id,
|
surfaceId: surface.id,
|
||||||
parentId: module.id,
|
parentId: module.id,
|
||||||
})
|
})
|
||||||
canvas.add(halfEaveBar)
|
canvas.add(eaveBar)
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
rightExposedHalfBottomPoints.forEach((module) => {
|
if (isChidory && cvrPlvrYn === 'Y') {
|
||||||
const bottomPoints = findTopTwoPoints([...module.points], direction)
|
leftExposedHalfBottomModules.forEach((module) => {
|
||||||
let barPoints = []
|
const bottomPoints = findTopTwoPoints([...module.points], direction)
|
||||||
//설치해야할 반처마커버 포인트를 방향에 따라 설정
|
let barPoints = []
|
||||||
|
//설치해야할 반처마커버 포인트를 방향에 따라 설정
|
||||||
|
|
||||||
if (direction === 'south') {
|
if (direction === 'south') {
|
||||||
barPoints = [bottomPoints[0].x + module.width / 2, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y]
|
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x - module.width / 2, bottomPoints[1].y]
|
||||||
} else if (direction === 'north') {
|
} else if (direction === 'north') {
|
||||||
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[0].x + module.width / 2, bottomPoints[1].y]
|
barPoints = [bottomPoints[0].x + module.width / 2, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y]
|
||||||
} else if (direction === 'east') {
|
} else if (direction === 'east') {
|
||||||
barPoints = [bottomPoints[0].x, bottomPoints[1].y + module.height / 2, bottomPoints[1].x, bottomPoints[1].y]
|
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[0].y - module.height / 2]
|
||||||
} else if (direction === 'west') {
|
} else if (direction === 'west') {
|
||||||
barPoints = [bottomPoints[0].x, bottomPoints[1].y - module.height / 2, bottomPoints[1].x, bottomPoints[1].y]
|
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y - module.height / 2]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bottomPoints) return
|
if (!bottomPoints) return
|
||||||
const halfEaveBar = new fabric.Line(barPoints, {
|
const halfEaveBar = new fabric.Line(barPoints, {
|
||||||
parent: surface,
|
parent: surface,
|
||||||
name: 'halfEaveBar',
|
name: 'halfEaveBar',
|
||||||
stroke: 'blue',
|
stroke: 'blue',
|
||||||
strokeWidth: 4,
|
strokeWidth: 4,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
parentId: module.id,
|
surfaceId: surface.id,
|
||||||
|
parentId: module.id,
|
||||||
|
})
|
||||||
|
canvas.add(halfEaveBar)
|
||||||
|
canvas.renderAll()
|
||||||
})
|
})
|
||||||
canvas.add(halfEaveBar)
|
|
||||||
canvas.renderAll()
|
rightExposedHalfBottomPoints.forEach((module) => {
|
||||||
})
|
const bottomPoints = findTopTwoPoints([...module.points], direction)
|
||||||
|
let barPoints = []
|
||||||
|
//설치해야할 반처마커버 포인트를 방향에 따라 설정
|
||||||
|
|
||||||
|
if (direction === 'south') {
|
||||||
|
barPoints = [bottomPoints[0].x + module.width / 2, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y]
|
||||||
|
} else if (direction === 'north') {
|
||||||
|
barPoints = [bottomPoints[0].x, bottomPoints[0].y, bottomPoints[0].x + module.width / 2, bottomPoints[1].y]
|
||||||
|
} else if (direction === 'east') {
|
||||||
|
barPoints = [bottomPoints[0].x, bottomPoints[1].y + module.height / 2, bottomPoints[1].x, bottomPoints[1].y]
|
||||||
|
} else if (direction === 'west') {
|
||||||
|
barPoints = [bottomPoints[0].x, bottomPoints[1].y - module.height / 2, bottomPoints[1].x, bottomPoints[1].y]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bottomPoints) return
|
||||||
|
const halfEaveBar = new fabric.Line(barPoints, {
|
||||||
|
parent: surface,
|
||||||
|
name: 'halfEaveBar',
|
||||||
|
stroke: 'blue',
|
||||||
|
strokeWidth: 4,
|
||||||
|
selectable: false,
|
||||||
|
parentId: module.id,
|
||||||
|
})
|
||||||
|
canvas.add(halfEaveBar)
|
||||||
|
canvas.renderAll()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
const horizontal = ['south', 'north'].includes(direction) ? surface.trestleDetail.moduleIntvlHor : surface.trestleDetail.moduleIntvlVer
|
||||||
const horizontal = ['south', 'north'].includes(direction) ? surface.trestleDetail.moduleIntvlHor : surface.trestleDetail.moduleIntvlVer
|
|
||||||
|
|
||||||
const vertical = ['south', 'north'].includes(direction) ? surface.trestleDetail.moduleIntvlVer : surface.trestleDetail.moduleIntvlHor
|
const vertical = ['south', 'north'].includes(direction) ? surface.trestleDetail.moduleIntvlVer : surface.trestleDetail.moduleIntvlHor
|
||||||
|
|
||||||
let mostRowsModule = 0 // 모듈 최대 단 수
|
let mostRowsModule = 0 // 모듈 최대 단 수
|
||||||
// 가대 설치를 위한 가장 아래 모듈로부터 위로 몇단인지 계산
|
// 가대 설치를 위한 가장 아래 모듈로부터 위로 몇단인지 계산
|
||||||
// 오른쪽,왼쪽 둘 다 아래에 아무것도 없는, 처마 커버를 필요로 하는 모듈
|
// 오른쪽,왼쪽 둘 다 아래에 아무것도 없는, 처마 커버를 필요로 하는 모듈
|
||||||
exposedBottomModules.forEach((module) => {
|
exposedBottomModules.forEach((module) => {
|
||||||
let { width, height } = { ...module }
|
let { width, height } = { ...module }
|
||||||
width = Math.floor(width)
|
width = Math.floor(width)
|
||||||
height = Math.floor(height)
|
height = Math.floor(height)
|
||||||
let { x: startX, y: startY } = { ...module.getCenterPoint() }
|
let { x: startX, y: startY } = { ...module.getCenterPoint() }
|
||||||
let { x, y } = { ...module.getCenterPoint() }
|
let { x, y } = { ...module.getCenterPoint() }
|
||||||
|
|
||||||
let leftRows = 1
|
let leftRows = 1
|
||||||
let rightRows = 1
|
let rightRows = 1
|
||||||
let centerRows = 1
|
let centerRows = 1
|
||||||
let hasNextModule = true
|
let hasNextModule = true
|
||||||
let findLeft = true
|
let findLeft = true
|
||||||
let findRight = true
|
let findRight = true
|
||||||
|
|
||||||
//우선 절반을 나눈 뒤 왼쪽부터 찾는다.
|
//우선 절반을 나눈 뒤 왼쪽부터 찾는다.
|
||||||
while (hasNextModule) {
|
while (hasNextModule) {
|
||||||
//바로 위에 있는지 확인한다.
|
//바로 위에 있는지 확인한다.
|
||||||
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
|
||||||
if (nextModule) {
|
|
||||||
// 바로 위 모듈을 찾는다.
|
|
||||||
leftRows++
|
|
||||||
x = nextModule.x
|
|
||||||
y = nextModule.y
|
|
||||||
} else {
|
|
||||||
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
|
||||||
if (findLeft) {
|
|
||||||
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findLeft = false
|
|
||||||
} else {
|
|
||||||
nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findLeft = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextModule) {
|
if (nextModule) {
|
||||||
// 바로 위 모듈을 찾는다.
|
// 바로 위 모듈을 찾는다.
|
||||||
@ -234,126 +221,126 @@ export const useTrestle = () => {
|
|||||||
x = nextModule.x
|
x = nextModule.x
|
||||||
y = nextModule.y
|
y = nextModule.y
|
||||||
} else {
|
} else {
|
||||||
hasNextModule = false
|
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
||||||
|
if (findLeft) {
|
||||||
|
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
findLeft = false
|
||||||
|
} else {
|
||||||
|
nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
findLeft = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextModule) {
|
||||||
|
// 바로 위 모듈을 찾는다.
|
||||||
|
leftRows++
|
||||||
|
x = nextModule.x
|
||||||
|
y = nextModule.y
|
||||||
|
} else {
|
||||||
|
hasNextModule = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
hasNextModule = true
|
hasNextModule = true
|
||||||
x = startX
|
x = startX
|
||||||
y = startY
|
y = startY
|
||||||
|
|
||||||
// 오른쪽 찾는다.
|
// 오른쪽 찾는다.
|
||||||
while (hasNextModule) {
|
while (hasNextModule) {
|
||||||
//바로 위에 있는지 확인한다.
|
//바로 위에 있는지 확인한다.
|
||||||
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
|
||||||
if (nextModule) {
|
|
||||||
// 바로 위 모듈을 찾는다.
|
|
||||||
rightRows++
|
|
||||||
x = nextModule.x
|
|
||||||
y = nextModule.y
|
|
||||||
} else {
|
|
||||||
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
|
||||||
if (findRight) {
|
|
||||||
nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findRight = false
|
|
||||||
} else {
|
|
||||||
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findRight = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextModule) {
|
if (nextModule) {
|
||||||
// 바로 위 모듈을 찾는다.
|
// 바로 위 모듈을 찾는다.
|
||||||
rightRows++
|
rightRows++
|
||||||
x = nextModule.x
|
x = nextModule.x
|
||||||
y = nextModule.y
|
y = nextModule.y
|
||||||
|
} else {
|
||||||
|
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
||||||
|
if (findRight) {
|
||||||
|
nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
findRight = false
|
||||||
|
} else {
|
||||||
|
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
findRight = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextModule) {
|
||||||
|
// 바로 위 모듈을 찾는다.
|
||||||
|
rightRows++
|
||||||
|
x = nextModule.x
|
||||||
|
y = nextModule.y
|
||||||
|
} else {
|
||||||
|
hasNextModule = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hasNextModule = true
|
||||||
|
x = startX
|
||||||
|
y = startY
|
||||||
|
|
||||||
|
// 센터 찾는다.
|
||||||
|
while (hasNextModule) {
|
||||||
|
//바로 위에 있는지 확인한다.
|
||||||
|
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
|
||||||
|
if (nextModule) {
|
||||||
|
// 바로 위 모듈을 찾는다.
|
||||||
|
centerRows++
|
||||||
|
x = nextModule.x
|
||||||
|
y = nextModule.y
|
||||||
} else {
|
} else {
|
||||||
hasNextModule = false
|
hasNextModule = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
hasNextModule = true
|
// 모듈의 왼쪽 부터 그릴 랙 정보를 가져온다.
|
||||||
x = startX
|
const leftRacks = rackInfos.find((rack) => {
|
||||||
y = startY
|
return rack.value.moduleRows === leftRows
|
||||||
|
})?.value.racks
|
||||||
|
|
||||||
// 센터 찾는다.
|
// 모듈의 오른쪽 부터 그릴 랙 정보를 가져온다.
|
||||||
while (hasNextModule) {
|
const rightRacks = rackInfos.find((rack) => {
|
||||||
//바로 위에 있는지 확인한다.
|
return rack.value.moduleRows === rightRows
|
||||||
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
})?.value.racks
|
||||||
|
// 해당 rack으로 그려준다.
|
||||||
|
|
||||||
if (nextModule) {
|
const centerRacks = rackInfos.find((rack) => {
|
||||||
// 바로 위 모듈을 찾는다.
|
return rack.value.moduleRows === centerRows
|
||||||
centerRows++
|
})?.value.racks
|
||||||
x = nextModule.x
|
|
||||||
y = nextModule.y
|
|
||||||
} else {
|
|
||||||
hasNextModule = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 모듈의 왼쪽 부터 그릴 랙 정보를 가져온다.
|
mostRowsModule = Math.max(leftRows, rightRows, centerRows, mostRowsModule)
|
||||||
const leftRacks = rackInfos.find((rack) => {
|
|
||||||
return rack.value.moduleRows === leftRows
|
|
||||||
})?.value.racks
|
|
||||||
|
|
||||||
// 모듈의 오른쪽 부터 그릴 랙 정보를 가져온다.
|
if (rackYn === 'Y') {
|
||||||
const rightRacks = rackInfos.find((rack) => {
|
drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn)
|
||||||
return rack.value.moduleRows === rightRows
|
drawRacks(rightRacks, rackQty, rackIntvlPct, module, direction, 'R', rackYn)
|
||||||
})?.value.racks
|
|
||||||
// 해당 rack으로 그려준다.
|
|
||||||
|
|
||||||
const centerRacks = rackInfos.find((rack) => {
|
if (rackQty === 3) {
|
||||||
return rack.value.moduleRows === centerRows
|
//rack 갯수가 3개인 경우는 중간렉도 추가해줘야함
|
||||||
})?.value.racks
|
drawRacks(centerRacks, rackQty, rackIntvlPct, module, direction, 'C', rackYn)
|
||||||
|
} else if (rackQty === 4) {
|
||||||
mostRowsModule = Math.max(leftRows, rightRows, centerRows, mostRowsModule)
|
drawRacks(leftRacks, rackQty, rackIntvlPct / 3, module, direction, 'L', rackYn)
|
||||||
|
drawRacks(rightRacks, rackQty, rackIntvlPct / 3, module, direction, 'R', rackYn)
|
||||||
if (rackYn === 'Y') {
|
|
||||||
drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn)
|
|
||||||
drawRacks(rightRacks, rackQty, rackIntvlPct, module, direction, 'R', rackYn)
|
|
||||||
|
|
||||||
if (rackQty === 3) {
|
|
||||||
//rack 갯수가 3개인 경우는 중간렉도 추가해줘야함
|
|
||||||
drawRacks(centerRacks, rackQty, rackIntvlPct, module, direction, 'C', rackYn)
|
|
||||||
} else if (rackQty === 4) {
|
|
||||||
drawRacks(leftRacks, rackQty, rackIntvlPct / 3, module, direction, 'L', rackYn)
|
|
||||||
drawRacks(rightRacks, rackQty, rackIntvlPct / 3, module, direction, 'R', rackYn)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.set({ leftRows, rightRows, centerRows })
|
|
||||||
})
|
|
||||||
// 왼쪽아래에 모듈이 없는 모듈들
|
|
||||||
leftExposedHalfBottomModules.forEach((module) => {
|
|
||||||
const { width, height } = module
|
|
||||||
let { x: startX, y: startY } = { ...module.getCenterPoint() }
|
|
||||||
let { x, y } = { ...module.getCenterPoint() }
|
|
||||||
//TODO : 방향별로 가대 설치해야함
|
|
||||||
|
|
||||||
let leftRows = 1
|
|
||||||
let hasNextModule = true
|
|
||||||
let findLeft = true
|
|
||||||
|
|
||||||
//우선 절반을 나눈 뒤 왼쪽부터 찾는다.
|
|
||||||
while (hasNextModule) {
|
|
||||||
//바로 위에 있는지 확인한다.
|
|
||||||
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
|
|
||||||
if (nextModule) {
|
|
||||||
// 바로 위 모듈을 찾는다.
|
|
||||||
leftRows++
|
|
||||||
x = nextModule.x
|
|
||||||
y = nextModule.y
|
|
||||||
} else {
|
|
||||||
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
|
||||||
if (findLeft) {
|
|
||||||
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findLeft = false
|
|
||||||
} else {
|
|
||||||
nextModule = nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findLeft = true
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
module.set({ leftRows, rightRows, centerRows })
|
||||||
|
})
|
||||||
|
// 왼쪽아래에 모듈이 없는 모듈들
|
||||||
|
leftExposedHalfBottomModules.forEach((module) => {
|
||||||
|
const { width, height } = module
|
||||||
|
let { x: startX, y: startY } = { ...module.getCenterPoint() }
|
||||||
|
let { x, y } = { ...module.getCenterPoint() }
|
||||||
|
//TODO : 방향별로 가대 설치해야함
|
||||||
|
|
||||||
|
let leftRows = 1
|
||||||
|
let hasNextModule = true
|
||||||
|
let findLeft = true
|
||||||
|
|
||||||
|
//우선 절반을 나눈 뒤 왼쪽부터 찾는다.
|
||||||
|
while (hasNextModule) {
|
||||||
|
//바로 위에 있는지 확인한다.
|
||||||
|
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
|
||||||
if (nextModule) {
|
if (nextModule) {
|
||||||
// 바로 위 모듈을 찾는다.
|
// 바로 위 모듈을 찾는다.
|
||||||
@ -361,52 +348,63 @@ export const useTrestle = () => {
|
|||||||
x = nextModule.x
|
x = nextModule.x
|
||||||
y = nextModule.y
|
y = nextModule.y
|
||||||
} else {
|
} else {
|
||||||
hasNextModule = false
|
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
||||||
|
if (findLeft) {
|
||||||
|
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
findLeft = false
|
||||||
|
} else {
|
||||||
|
nextModule = nextModule = findNextRightModule(
|
||||||
|
{
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
horizontal,
|
||||||
|
vertical,
|
||||||
|
},
|
||||||
|
centerPoints,
|
||||||
|
direction,
|
||||||
|
)
|
||||||
|
findLeft = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextModule) {
|
||||||
|
// 바로 위 모듈을 찾는다.
|
||||||
|
leftRows++
|
||||||
|
x = nextModule.x
|
||||||
|
y = nextModule.y
|
||||||
|
} else {
|
||||||
|
hasNextModule = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 모듈의 왼쪽 부터 그릴 랙 정보를 가져온다.
|
// 모듈의 왼쪽 부터 그릴 랙 정보를 가져온다.
|
||||||
const leftRacks = rackInfos.find((rack) => {
|
const leftRacks = rackInfos.find((rack) => {
|
||||||
return rack.value.moduleRows === leftRows
|
return rack.value.moduleRows === leftRows
|
||||||
})?.value.racks
|
})?.value.racks
|
||||||
mostRowsModule = Math.max(leftRows, mostRowsModule)
|
mostRowsModule = Math.max(leftRows, mostRowsModule)
|
||||||
if (rackYn === 'Y') {
|
if (rackYn === 'Y') {
|
||||||
drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn)
|
drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.set({ leftRows })
|
module.set({ leftRows })
|
||||||
})
|
})
|
||||||
// 오른쪽 아래에 모듈이 없는 모듈들
|
// 오른쪽 아래에 모듈이 없는 모듈들
|
||||||
rightExposedHalfBottomPoints.forEach((module) => {
|
rightExposedHalfBottomPoints.forEach((module) => {
|
||||||
const { width, height } = module
|
const { width, height } = module
|
||||||
let { x: startX, y: startY } = { ...module.getCenterPoint() }
|
let { x: startX, y: startY } = { ...module.getCenterPoint() }
|
||||||
let { x, y } = { ...module.getCenterPoint() }
|
let { x, y } = { ...module.getCenterPoint() }
|
||||||
//TODO : 방향별로 가대 설치해야함
|
//TODO : 방향별로 가대 설치해야함
|
||||||
|
|
||||||
let rightRows = 1
|
let rightRows = 1
|
||||||
let hasNextModule = true
|
let hasNextModule = true
|
||||||
let findRight = true
|
let findRight = true
|
||||||
|
|
||||||
// 오른쪽 찾는다.
|
// 오른쪽 찾는다.
|
||||||
while (hasNextModule) {
|
while (hasNextModule) {
|
||||||
//바로 위에 있는지 확인한다.
|
//바로 위에 있는지 확인한다.
|
||||||
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
let nextModule = findNextModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
|
||||||
if (nextModule) {
|
|
||||||
// 바로 위 모듈을 찾는다.
|
|
||||||
rightRows++
|
|
||||||
x = nextModule.x
|
|
||||||
y = nextModule.y
|
|
||||||
} else {
|
|
||||||
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
|
||||||
if (findRight) {
|
|
||||||
nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findRight = false
|
|
||||||
} else {
|
|
||||||
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
|
||||||
findRight = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextModule) {
|
if (nextModule) {
|
||||||
// 바로 위 모듈을 찾는다.
|
// 바로 위 모듈을 찾는다.
|
||||||
@ -414,43 +412,62 @@ export const useTrestle = () => {
|
|||||||
x = nextModule.x
|
x = nextModule.x
|
||||||
y = nextModule.y
|
y = nextModule.y
|
||||||
} else {
|
} else {
|
||||||
hasNextModule = false
|
// 바로 위가 없을 경우 먼저 왼쪽위가 있는지 확인 한다.
|
||||||
|
if (findRight) {
|
||||||
|
nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
findRight = false
|
||||||
|
} else {
|
||||||
|
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
|
findRight = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextModule) {
|
||||||
|
// 바로 위 모듈을 찾는다.
|
||||||
|
rightRows++
|
||||||
|
x = nextModule.x
|
||||||
|
y = nextModule.y
|
||||||
|
} else {
|
||||||
|
hasNextModule = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 모듈의 오른쪽 부터 그릴 랙 정보를 가져온다.
|
||||||
|
const rightRacks = rackInfos.find((rack) => {
|
||||||
|
return rack.value.moduleRows === rightRows
|
||||||
|
})?.value.racks
|
||||||
|
|
||||||
|
mostRowsModule = Math.max(rightRows, mostRowsModule)
|
||||||
|
// 해당 rack으로 그려준다.
|
||||||
|
if (rackYn === 'Y') {
|
||||||
|
drawRacks(rightRacks, rackQty, rackIntvlPct, module, direction, 'R', rackYn)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.set({ rightRows })
|
||||||
|
})
|
||||||
|
|
||||||
|
surface.set({ moduleRowsTotCnt: mostRowsModule })
|
||||||
|
|
||||||
|
if (rackYn === 'N') {
|
||||||
|
// rack이 없을경우
|
||||||
|
installBracketWithOutRack(surface, exposedBottomModules, leftExposedHalfBottomModules, rightExposedHalfBottomPoints, isChidory)
|
||||||
|
} else if (rackYn === 'Y') {
|
||||||
|
installBracket(surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 모듈의 오른쪽 부터 그릴 랙 정보를 가져온다.
|
const quotationParam = getTrestleParams(surface)
|
||||||
const rightRacks = rackInfos.find((rack) => {
|
|
||||||
return rack.value.moduleRows === rightRows
|
|
||||||
})?.value.racks
|
|
||||||
|
|
||||||
mostRowsModule = Math.max(rightRows, mostRowsModule)
|
surface.set({ quotationParam })
|
||||||
// 해당 rack으로 그려준다.
|
|
||||||
if (rackYn === 'Y') {
|
|
||||||
drawRacks(rightRacks, rackQty, rackIntvlPct, module, direction, 'R', rackYn)
|
|
||||||
}
|
|
||||||
|
|
||||||
module.set({ rightRows })
|
|
||||||
})
|
})
|
||||||
|
|
||||||
surface.set({ moduleRowsTotCnt: mostRowsModule })
|
return setEstimateData()
|
||||||
|
} catch (e) {
|
||||||
if (rackYn === 'N') {
|
return false
|
||||||
// rack이 없을경우
|
}
|
||||||
installBracketWithOutRack(surface, exposedBottomModules, leftExposedHalfBottomModules, rightExposedHalfBottomPoints, isChidory)
|
|
||||||
} else if (rackYn === 'Y') {
|
|
||||||
installBracket(surface)
|
|
||||||
}
|
|
||||||
|
|
||||||
const quotationParam = getTrestleParams(surface)
|
|
||||||
|
|
||||||
surface.set({ quotationParam })
|
|
||||||
})
|
|
||||||
setQuoationItem()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// itemList 조회 후 estimateParam에 저장
|
// itemList 조회 후 estimateParam에 저장
|
||||||
const setQuoationItem = () => {
|
const setEstimateData = async () => {
|
||||||
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
//surfaces.pcses들을 배열로 묶는다
|
//surfaces.pcses들을 배열로 묶는다
|
||||||
const pcses = surfaces[0].pcses
|
const pcses = surfaces[0].pcses
|
||||||
@ -461,16 +478,67 @@ export const useTrestle = () => {
|
|||||||
})
|
})
|
||||||
const params = { trestles: surfaces.map((surface) => surface.quotationParam), pcses }
|
const params = { trestles: surfaces.map((surface) => surface.quotationParam), pcses }
|
||||||
//견적서 itemList 조회
|
//견적서 itemList 조회
|
||||||
getQuotationItem(params).then((res) => {
|
const res = await getQuotationItem(params)
|
||||||
if (!res.data) {
|
if (!res.data) {
|
||||||
return
|
return false
|
||||||
}
|
}
|
||||||
const itemList = res.data
|
const itemList = res.data
|
||||||
//northArrangement 북면 설치 여부
|
//northArrangement 북면 설치 여부
|
||||||
const northArrangement = getNorthArrangement()
|
const northArrangement = getNorthArrangement()
|
||||||
|
// circuitItemList의 경우는 moduleList에서 circuitId만 groupBy한다.
|
||||||
|
let circuitItemList = []
|
||||||
|
|
||||||
setEstimateParam({ ...estimateParam, itemList, northArrangement })
|
// roofSurfaceList 생성
|
||||||
|
const roofSurfaceList = surfaces.map((surface) => {
|
||||||
|
const parent = canvas.getObjects().find((obj) => obj.id === surface.parentId)
|
||||||
|
const { directionText, roofMaterial, pitch: slope, moduleCompass, surfaceCompass } = parent
|
||||||
|
const roofMaterialIndex = parent.roofMaterial.index
|
||||||
|
const { nameJp: roofMaterialIdMulti } = roofMaterial
|
||||||
|
const moduleSelection = moduleSelectionData?.roofConstructions?.find((construction) => construction.roofIndex === roofMaterialIndex)
|
||||||
|
const { constTp: constructSpecification, constTpJp: constructSpecificationMulti } = moduleSelection.construction
|
||||||
|
const {
|
||||||
|
trestleMkrCd,
|
||||||
|
constMthdCd: supportMethodId,
|
||||||
|
roofBaseCd,
|
||||||
|
trestleMkrCdJp: supportMeaker,
|
||||||
|
constMthdCdJp: supportMethodIdMulti,
|
||||||
|
} = moduleSelection.trestle
|
||||||
|
|
||||||
|
const modules = surface.modules
|
||||||
|
const moduleList = modules.map((module) => {
|
||||||
|
circuitItemList.push(module.pcsItemId)
|
||||||
|
return {
|
||||||
|
itemId: module.moduleInfo.itemId,
|
||||||
|
circuit: module.circuitNumber,
|
||||||
|
pcItemId: module.pcsItemId,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
roofSurfaceId: surface.id,
|
||||||
|
roofSurface: directionText.replace(/[^0-9]/g, ''),
|
||||||
|
roofMaterialId: roofMaterial.roofMatlCd,
|
||||||
|
supportMethodId,
|
||||||
|
constructSpecification,
|
||||||
|
constructSpecificationMulti,
|
||||||
|
roofMaterialIdMulti,
|
||||||
|
supportMethodIdMulti,
|
||||||
|
supportMeaker,
|
||||||
|
slope,
|
||||||
|
classType: currentAngleType === 'slope' ? '0' : '1',
|
||||||
|
angle: getDegreeByChon(slope),
|
||||||
|
azimuth: surfaceCompass ?? moduleCompass ?? 0,
|
||||||
|
moduleList,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// circuitItemList 중복제거
|
||||||
|
circuitItemList = circuitItemList.filter((item, index) => circuitItemList.indexOf(item) === index)
|
||||||
|
|
||||||
|
setEstimateParam({ ...estimateParam, itemList, northArrangement, roofSurfaceList, circuitItemList })
|
||||||
|
|
||||||
|
// 정상적으로 완료 되면 true 반환
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const getNorthArrangement = () => {
|
const getNorthArrangement = () => {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export const estimateParamAtom = atom({
|
|||||||
standardWindSpeedId: '',
|
standardWindSpeedId: '',
|
||||||
snowfall: '',
|
snowfall: '',
|
||||||
northArrangement: '',
|
northArrangement: '',
|
||||||
drawingFlg: '',
|
drawingFlg: '1',
|
||||||
userId: '',
|
userId: '',
|
||||||
roofSurfaceList: [],
|
roofSurfaceList: [],
|
||||||
circuitItemList: [],
|
circuitItemList: [],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user