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
|
||||
.getObjects()
|
||||
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||
@ -364,8 +364,7 @@ export default function CircuitTrestleSetting({ id }) {
|
||||
obj.pcses = getStepUpListData()
|
||||
})
|
||||
|
||||
console.log(canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE))
|
||||
apply()
|
||||
const result = await apply()
|
||||
}
|
||||
|
||||
const onClickPrev = () => {
|
||||
|
||||
@ -248,6 +248,7 @@ export default function StepUp(props) {
|
||||
circuitInfo: module.pcsItemId,
|
||||
})
|
||||
targetModule.circuit = moduleCircuitText
|
||||
targetModule.pcsItemId = module.pcsItemId
|
||||
targetModule.circuitNumber = module.circuit
|
||||
canvas.add(moduleCircuitText)
|
||||
})
|
||||
|
||||
@ -249,8 +249,8 @@ export default function PassivityCircuitAllocation(props) {
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
const pcsItemList = selectedModels.map((model) => {
|
||||
console.log('uniqueCircuitNumbers', uniqueCircuitNumbers)
|
||||
const pcsItemList = selectedModels.map((model, index) => {
|
||||
return {
|
||||
pcsMkrCd: model.pcsMkrCd,
|
||||
pcsSerCd: model.pcsSerCd,
|
||||
@ -260,7 +260,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
serQtyList: [
|
||||
{
|
||||
serQty: targetModules.length,
|
||||
paralQty: 0,
|
||||
paralQty: uniqueCircuitNumbers.length,
|
||||
rmdYn: 'Y',
|
||||
usePossYn: 'Y',
|
||||
roofSurfaceList: roofSurfaceList,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||
import { canvasState } from '@/store/canvasAtom'
|
||||
import { canvasState, currentAngleTypeSelector } from '@/store/canvasAtom'
|
||||
import { POLYGON_TYPE } from '@/common/common'
|
||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||
import { getDegreeByChon, getTrestleLength } from '@/util/canvas-util'
|
||||
@ -13,8 +13,10 @@ export const useTrestle = () => {
|
||||
const moduleSelectionData = useRecoilValue(moduleSelectionDataState) //다음으로 넘어가는 최종 데이터
|
||||
const { getQuotationItem } = useMasterController()
|
||||
const [estimateParam, setEstimateParam] = useRecoilState(estimateParamAtom)
|
||||
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
||||
|
||||
const apply = () => {
|
||||
try {
|
||||
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
|
||||
// exposedBottomPoints는 노출 최하면 들의 centerPoint 배열.
|
||||
|
||||
@ -351,7 +353,18 @@ export const useTrestle = () => {
|
||||
nextModule = findNextLeftModule({ x, y, width, height, horizontal, vertical }, centerPoints, direction)
|
||||
findLeft = false
|
||||
} 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
|
||||
}
|
||||
|
||||
@ -446,11 +459,15 @@ export const useTrestle = () => {
|
||||
|
||||
surface.set({ quotationParam })
|
||||
})
|
||||
setQuoationItem()
|
||||
|
||||
return setEstimateData()
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// itemList 조회 후 estimateParam에 저장
|
||||
const setQuoationItem = () => {
|
||||
const setEstimateData = async () => {
|
||||
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||
//surfaces.pcses들을 배열로 묶는다
|
||||
const pcses = surfaces[0].pcses
|
||||
@ -461,16 +478,67 @@ export const useTrestle = () => {
|
||||
})
|
||||
const params = { trestles: surfaces.map((surface) => surface.quotationParam), pcses }
|
||||
//견적서 itemList 조회
|
||||
getQuotationItem(params).then((res) => {
|
||||
const res = await getQuotationItem(params)
|
||||
if (!res.data) {
|
||||
return
|
||||
return false
|
||||
}
|
||||
const itemList = res.data
|
||||
//northArrangement 북면 설치 여부
|
||||
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 = () => {
|
||||
|
||||
@ -14,7 +14,7 @@ export const estimateParamAtom = atom({
|
||||
standardWindSpeedId: '',
|
||||
snowfall: '',
|
||||
northArrangement: '',
|
||||
drawingFlg: '',
|
||||
drawingFlg: '1',
|
||||
userId: '',
|
||||
roofSurfaceList: [],
|
||||
circuitItemList: [],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user