Compare commits

..

No commits in common. "b74f847f76df7f937a264e596e76263983fa8318" and "a708f28c36a4d6dfc5023feed772a184e4518f0f" have entirely different histories.

5 changed files with 36 additions and 93 deletions

View File

@ -16,7 +16,7 @@ import { useSwal } from '@/hooks/useSwal'
import { canvasState, canvasZoomState } from '@/store/canvasAtom'
import { useTrestle } from '@/hooks/module/useTrestle'
import { moduleSelectionDataState, selectedModuleState } from '@/store/selectedModuleOptions'
import { selectedModuleState } from '@/store/selectedModuleOptions'
import { v4 as uuidv4 } from 'uuid'
import { useEstimate } from '@/hooks/useEstimate'
@ -60,7 +60,7 @@ export default function CircuitTrestleSetting({ id }) {
const [seletedSubOption, setSeletedSubOption] = useState(null)
const { setModuleStatisticsData } = useCircuitTrestle()
const { handleCanvasToPng } = useImgLoader()
const moduleSelectionData = useRecoilValue(moduleSelectionDataState)
const passivityCircuitAllocationRef = useRef()
const { setIsGlobalLoading } = useContext(QcastContext)
@ -340,15 +340,8 @@ export default function CircuitTrestleSetting({ id }) {
const target = pcsCheck.max ? moduleMaxQty : moduleStdQty
const placementModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
let moduleAmount = placementModules.reduce((acc, module) => {
if (moduleSelectionData.module.itemList.length === 1 || module.moduleInfo.itemId === moduleSelectionData.module.itemList[0].itemId) {
return acc + 1
} else {
return acc + 0.66
}
}, 0)
if (moduleAmount > target) {
if (placementModules.length > target) {
swalFire({
title: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.validation.error01'),
type: 'alert',

View File

@ -56,20 +56,19 @@ export default function StuffSubHeader({ type }) {
*/
const moveFloorPlan = () => {
setFloorPlanObjectNo({ floorPlanObjectNo: objectNo })
const param = {
pid: managementState?.planList?.length > 0 ? managementState?.planList[0].planNo : '1',
pid: managementState?.planList?.length === 0 ? '1' : managementState?.planList[0].planNo,
objectNo: objectNo,
}
if (managementState?.planList?.length > 0) {
if (managementState?.planList?.length === 0) {
setSelectedMenu('surface')
} else {
if (managementState?.planList[0].estimateDate) {
setSelectedMenu('module')
} else {
setSelectedMenu('surface')
}
} else {
setSelectedMenu('surface')
}
const url = `/floor-plan?${queryStringFormatter(param)}`

View File

@ -212,14 +212,9 @@ export function useMasterController() {
}
const getQuotationItem = async (params) => {
return await post({ url: '/api/v1/master/getQuotationItem', data: params })
.then((res) => {
return res
})
.catch((error) => {
console.log('🚀 ~ getQuotationItem ~ error:', error)
setIsGlobalLoading(false)
})
return await post({ url: '/api/v1/master/getQuotationItem', data: params }).then((res) => {
return res
})
}
/**

View File

@ -53,7 +53,6 @@ export const useTrestle = () => {
}
})
surfaces.forEach((surface) => {
getSameLineModules(surface)
const parent = canvas.getObjects().find((obj) => obj.id === surface.parentId)
const roofMaterialIndex = parent.roofMaterial.index
if (+roofSizeSet === 3) {
@ -68,7 +67,6 @@ export const useTrestle = () => {
let moduleRowsTotCnt = 0
let isEaveBar = construction.setupCover
let isSnowGuard = construction.setupSnowCover
let cvrLmtRow = construction.cvrLmtRow
const direction = parent.direction
const rack = surface.trestleDetail.rack
let { rackQty, rackIntvlPct, rackYn, cvrPlvrYn, lessSupFitIntvlPct, lessSupFitQty } = surface.trestleDetail
@ -151,10 +149,6 @@ export const useTrestle = () => {
if (isEaveBar) {
// 처마력바설치 true인 경우 설치
exposedBottomModules.forEach((module) => {
const level = module.level
if (level > cvrLmtRow) {
return
}
const bottomPoints = findTopTwoPoints([...module.getCurrentPoints()], direction)
if (!bottomPoints) return
const eaveBar = new fabric.Line([bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y], {
@ -173,10 +167,6 @@ export const useTrestle = () => {
if (isChidory && cvrPlvrYn === 'Y') {
leftExposedHalfBottomModules.forEach((module) => {
const level = module.level
if (level > cvrLmtRow) {
return
}
const bottomPoints = findTopTwoPoints([...module.getCurrentPoints()], direction)
let barPoints = []
//설치해야할 반처마커버 포인트를 방향에 따라 설정
@ -207,10 +197,6 @@ export const useTrestle = () => {
})
rightExposedHalfBottomPoints.forEach((module) => {
const level = module.level
if (level > cvrLmtRow) {
return
}
const bottomPoints = findTopTwoPoints([...module.points], direction)
let barPoints = []
//설치해야할 반처마커버 포인트를 방향에 따라 설정
@ -1073,8 +1059,7 @@ export const useTrestle = () => {
const roof = canvas.getObjects().find((obj) => obj.id === surface.parentId)
const degree = getDegreeByChon(roof.roofMaterial.pitch)
rackIntvlPct = rackIntvlPct === 0 ? 1 : rackIntvlPct // 0인 경우 1로 변경
rackIntvlPct = 100 / rackIntvlPct // 퍼센트로 변경
const moduleLeft = lastX ?? left
const moduleTop = lastY ?? top
@ -1588,9 +1573,7 @@ export const useTrestle = () => {
drawBracketWithOutRack(module, rackIntvlPct, module.leftRows + 1, 'L', surface.direction, moduleIntvlHor, moduleIntvlVer)
if (rackQty === 3 && !findSamePointInBottom(exposedBottomModules, module)) {
// 해당 모듈과 같은 위치 맨 아래에 모듈이 없는 경우 하나 더 설치 필요
if (module.level % 2 !== 0) {
drawBracketWithOutRack(module, rackIntvlPct / 3, module.leftRows + 1, 'L', surface.direction, moduleIntvlHor, moduleIntvlVer)
}
drawBracketWithOutRack(module, rackIntvlPct / 3, module.leftRows + 1, 'L', surface.direction, moduleIntvlHor, moduleIntvlVer)
}
if (rackQty === 4) {
drawBracketWithOutRack(module, rackIntvlPct / 3, module.leftRows + 1, 'L', surface.direction, moduleIntvlHor, moduleIntvlVer)
@ -1598,13 +1581,10 @@ export const useTrestle = () => {
})
rightExposedHalfBottomPoints.forEach((module) => {
console.log('rightmodule.level', module.level)
drawBracketWithOutRack(module, rackIntvlPct, module.rightRows + 1, 'R', surface.direction, moduleIntvlHor, moduleIntvlVer)
if (rackQty === 3 && !findSamePointInBottom(exposedBottomModules, module, direction)) {
// 해당 모듈과 같은 위치 맨 아래에 모듈이 없는 경우 하나 더 설치 필요
if (module.level % 2 === 0) {
drawBracketWithOutRack(module, rackIntvlPct / 3, module.rightRows + 1, 'R', surface.direction, moduleIntvlHor, moduleIntvlVer)
}
drawBracketWithOutRack(module, rackIntvlPct / 3, module.rightRows + 1, 'R', surface.direction, moduleIntvlHor, moduleIntvlVer)
}
if (rackQty === 4) {
drawBracketWithOutRack(module, rackIntvlPct / 3, module.rightRows + 1, 'R', surface.direction, moduleIntvlHor, moduleIntvlVer)
@ -2565,15 +2545,23 @@ export const useTrestle = () => {
return result
}
const getSameLineModules = (surface) => {
// 가장 왼쪽에 있는 모듈을 기준으로 같은 단에 있는 모듈들 파라미터 생성
const getMostLeftModules = (surface, exposedBottomModules) => {
const { direction, modules, isChidory } = 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
let isEaveBar = construction.setupCover
let isSnowGuard = construction.setupSnowCover
let { rackYn, cvrPlvrYn, moduleIntvlHor, moduleIntvlVer, rackQty, lessSupFitQty } = surface.trestleDetail
if (!modules || modules.length === 0) {
return
if (rackYn === 'N') {
rackQty = lessSupFitQty
}
// 같은 단에 있는 모듈들의 리스트
let sameLineModuleList = []
let result = []
if (direction === 'south') {
// 모듈의 top으로 groupBy
@ -2624,34 +2612,9 @@ export const useTrestle = () => {
sameLineModuleList = Object.values(groupedByLeft).sort((a, b) => a[0].left - b[0].left)
}
sameLineModuleList.forEach((modules, index) => {
modules.forEach((module) => {
module.set({ level: index + 1 }) // 각 모듈에 level 속성 추가
})
})
return sameLineModuleList
}
// 가장 왼쪽에 있는 모듈을 기준으로 같은 단에 있는 모듈들 파라미터 생성
const getMostLeftModules = (surface, exposedBottomModules) => {
const { direction, modules, isChidory } = 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
let isEaveBar = construction.setupCover
let isSnowGuard = construction.setupSnowCover
let cvrLmtRow = construction.cvrLmtRow
let { rackYn, cvrPlvrYn, moduleIntvlHor, moduleIntvlVer, rackQty, lessSupFitQty } = surface.trestleDetail
let result = []
if (rackYn === 'N') {
rackQty = lessSupFitQty
}
const sameLineModuleList = getSameLineModules(surface, exposedBottomModules)
sameLineModuleList.forEach((modules, index) => {
const moduleRowResultData = {
seq: index + 1,
seq: index,
moduleItemId: modules[0].moduleInfo.itemId,
moduleTpCd: modules[0].moduleInfo.itemTp,
moduleCnt: modules.length,
@ -2683,7 +2646,6 @@ export const useTrestle = () => {
}
// 모듈 하면,최하면 등 구해야함
modules.forEach((module, index) => {
const level = module.level
// 해당 모듈 주변에 다른 모듈이 있는지 확인
let {
bottomModule,
@ -2697,7 +2659,6 @@ export const useTrestle = () => {
bottomLeftModule,
bottomRightModule,
} = findSideModule(module, surface)
if (bottomModule) {
moduleRowResultData.touchedSurfaceCnt++
if (rackYn === 'N') {
@ -2741,12 +2702,10 @@ export const useTrestle = () => {
}
if (cvrPlvrYn === 'Y') {
if (level <= cvrLmtRow) {
moduleRowResultData.eavesHalfCnt++
if (bottomLeftModule || bottomRightModule || halfBottomLeftModule || halfBottomRightModule) {
//처마커버 한개 노출 추가
moduleRowResultData.exposedSideEavesCnt++
}
moduleRowResultData.eavesHalfCnt++
if (bottomLeftModule || bottomRightModule || halfBottomLeftModule || halfBottomRightModule) {
//처마커버 한개 노출 추가
moduleRowResultData.exposedSideEavesCnt++
}
}
} else {
@ -2755,15 +2714,13 @@ export const useTrestle = () => {
moduleRowResultData.exposedBottomBracketCnt += rackQty
}
if (isEaveBar) {
if (level <= cvrLmtRow) {
moduleRowResultData.eavesCnt++
if ((rightModule && !leftModule) || (!rightModule && leftModule)) {
// 둘중 하나가 없는경우는 처마커버 노출 추가
moduleRowResultData.exposedSideEavesCnt++
} else if (!rightModule && !leftModule) {
// 양쪽 둘다 없는경우는 처마커버 노출 2개 추가
moduleRowResultData.exposedSideEavesCnt += 2
}
moduleRowResultData.eavesCnt++
if ((rightModule && !leftModule) || (!rightModule && leftModule)) {
// 둘중 하나가 없는경우는 처마커버 노출 추가
moduleRowResultData.exposedSideEavesCnt++
} else if (!rightModule && !leftModule) {
// 양쪽 둘다 없는경우는 처마커버 노출 2개 추가
moduleRowResultData.exposedSideEavesCnt += 2
}
}
}

View File

@ -343,7 +343,6 @@ export function usePlan(params = {}) {
})
.catch((error) => {
swalFire({ text: error.message, icon: 'error' })
setIsGlobalLoading(false)
})
return rtn
}