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