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,8 +13,10 @@ 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 = () => {
|
||||||
|
try {
|
||||||
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
|
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
|
||||||
// exposedBottomPoints는 노출 최하면 들의 centerPoint 배열.
|
// exposedBottomPoints는 노출 최하면 들의 centerPoint 배열.
|
||||||
|
|
||||||
@ -351,7 +353,18 @@ export const useTrestle = () => {
|
|||||||
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||||
findLeft = false
|
findLeft = false
|
||||||
} else {
|
} else {
|
||||||
nextModule = nextModule = findNextRightModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
nextModule = nextModule = findNextRightModule(
|
||||||
|
{
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
horizontal,
|
||||||
|
vertical,
|
||||||
|
},
|
||||||
|
centerPoints,
|
||||||
|
direction,
|
||||||
|
)
|
||||||
findLeft = true
|
findLeft = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,11 +459,15 @@ export const useTrestle = () => {
|
|||||||
|
|
||||||
surface.set({ quotationParam })
|
surface.set({ quotationParam })
|
||||||
})
|
})
|
||||||
setQuoationItem()
|
|
||||||
|
return setEstimateData()
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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