Merge branch 'dev' into dev-yj
This commit is contained in:
commit
401d9c4104
@ -43,7 +43,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
const [circuitAllocationType, setCircuitAllocationType] = useState(1)
|
const [circuitAllocationType, setCircuitAllocationType] = useState(1)
|
||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
const { getPcsAutoRecommendList } = useMasterController()
|
const { getPcsAutoRecommendList, getPcsVoltageChk } = useMasterController()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!managementState) {
|
if (!managementState) {
|
||||||
@ -75,32 +75,48 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
pcsItemList: getPcsItemList(),
|
pcsItemList: getPcsItemList(),
|
||||||
}
|
}
|
||||||
|
|
||||||
getPcsAutoRecommendList(params).then((res) => {
|
if (selectedModels.length === 0) {
|
||||||
if (res.data?.pcsItemList) {
|
getPcsAutoRecommendList(params).then((res) => {
|
||||||
setModels(
|
if (res.data?.pcsItemList) {
|
||||||
res.data.pcsItemList.map((model) => {
|
const itemList = models.filter((model) => {
|
||||||
|
return res.data?.pcsItemList.map((item) => item.itemId).includes(model.itemId)
|
||||||
|
})
|
||||||
|
const selectedModels = itemList.map((model) => {
|
||||||
return {
|
return {
|
||||||
...model,
|
...model,
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
)
|
const pcsVoltageChkParams = {
|
||||||
setTabNum(2)
|
...getOptYn(),
|
||||||
} else {
|
useModuleItemList: getUseModuleItemList(),
|
||||||
// 데이터가 없는 경우 오류 메시지 확인 필요
|
roofSurfaceList: getRoofSurfaceList(),
|
||||||
if (res.result.resultCode === 'E') {
|
pcsItemList: getPcsItemList(),
|
||||||
swalFire({
|
}
|
||||||
title: res.result.resultMsg,
|
setSelectedModels(selectedModels)
|
||||||
type: 'alert',
|
getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
|
||||||
|
setTabNum(2)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
swalFire({
|
// 데이터가 없는 경우 오류 메시지 확인 필요
|
||||||
title: '파워컨디셔너를 추가해 주세요.',
|
if (res.result.resultCode === 'E') {
|
||||||
type: 'alert',
|
swalFire({
|
||||||
})
|
title: res.result.resultMsg,
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
swalFire({
|
||||||
|
title: '파워컨디셔너를 추가해 주세요.',
|
||||||
|
type: 'alert',
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
} else {
|
||||||
|
getPcsVoltageChk(params).then((res) => {
|
||||||
|
setTabNum(2)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getOptYn = () => {
|
const getOptYn = () => {
|
||||||
@ -135,6 +151,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
.getObjects()
|
.getObjects()
|
||||||
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||||
.map((obj) => {
|
.map((obj) => {
|
||||||
|
getModuleList(obj)
|
||||||
return {
|
return {
|
||||||
roofSurfaceId: obj.id,
|
roofSurfaceId: obj.id,
|
||||||
roofSurface: canvas
|
roofSurface: canvas
|
||||||
@ -142,7 +159,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
.filter((o) => o.id === obj.parentId)[0]
|
.filter((o) => o.id === obj.parentId)[0]
|
||||||
.directionText.replace(/[0-9]/g, ''),
|
.directionText.replace(/[0-9]/g, ''),
|
||||||
roofSurfaceIncl: canvas.getObjects().filter((o) => o.id === obj.parentId)[0].roofMaterial.pitch,
|
roofSurfaceIncl: canvas.getObjects().filter((o) => o.id === obj.parentId)[0].roofMaterial.pitch,
|
||||||
moduleList: obj.modules.map((module) => {
|
moduleList: getModuleList(obj).map((module) => {
|
||||||
return {
|
return {
|
||||||
itemId: module.moduleInfo.itemId,
|
itemId: module.moduleInfo.itemId,
|
||||||
circuit: module.circuitNumber ? module.circuitNumber : null,
|
circuit: module.circuitNumber ? module.circuitNumber : null,
|
||||||
@ -153,6 +170,79 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getModuleList = (surface) => {
|
||||||
|
let moduleList = []
|
||||||
|
let [xObj, yObj] = [{}, {}]
|
||||||
|
let [xPoints, yPoints] = [[], []]
|
||||||
|
surface.modules.forEach((module) => {
|
||||||
|
if (!xObj[module.left]) {
|
||||||
|
xObj[module.left] = module.left
|
||||||
|
xPoints.push(module.left)
|
||||||
|
}
|
||||||
|
if (!yObj[module.top]) {
|
||||||
|
yObj[module.top] = module.top
|
||||||
|
yPoints.push(module.top)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
switch (surface.direction) {
|
||||||
|
case 'south':
|
||||||
|
xPoints.sort((a, b) => a - b)
|
||||||
|
yPoints.sort((a, b) => b - a)
|
||||||
|
yPoints.forEach((y, index) => {
|
||||||
|
let temp = surface.modules.filter((m) => m.top === y)
|
||||||
|
if (index % 2 === 0) {
|
||||||
|
temp.sort((a, b) => a.left - b.left)
|
||||||
|
} else {
|
||||||
|
temp.sort((a, b) => b.left - a.left)
|
||||||
|
}
|
||||||
|
moduleList = [...moduleList, ...temp]
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'north':
|
||||||
|
xPoints.sort((a, b) => b - a)
|
||||||
|
yPoints.sort((a, b) => a - b)
|
||||||
|
yPoints.forEach((y, index) => {
|
||||||
|
let temp = surface.modules.filter((m) => m.top === y)
|
||||||
|
if (index % 2 === 0) {
|
||||||
|
temp.sort((a, b) => b.left - a.left)
|
||||||
|
} else {
|
||||||
|
temp.sort((a, b) => a.left - b.left)
|
||||||
|
}
|
||||||
|
moduleList = [...moduleList, ...temp]
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'west':
|
||||||
|
xPoints.sort((a, b) => a - b)
|
||||||
|
yPoints.sort((a, b) => a - b)
|
||||||
|
xPoints.forEach((x, index) => {
|
||||||
|
let temp = surface.modules.filter((m) => m.left === x)
|
||||||
|
if (index % 2 === 0) {
|
||||||
|
temp.sort((a, b) => a.top - b.top)
|
||||||
|
} else {
|
||||||
|
temp.sort((a, b) => b.top - a.top)
|
||||||
|
}
|
||||||
|
moduleList = [...moduleList, ...temp]
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'east':
|
||||||
|
xPoints.sort((a, b) => b - a)
|
||||||
|
yPoints.sort((a, b) => b - a)
|
||||||
|
xPoints.forEach((x, index) => {
|
||||||
|
let temp = surface.modules.filter((m) => m.left === x)
|
||||||
|
if (index % 2 === 0) {
|
||||||
|
temp.sort((a, b) => b.top - a.top)
|
||||||
|
} else {
|
||||||
|
temp.sort((a, b) => a.top - b.top)
|
||||||
|
}
|
||||||
|
moduleList = [...moduleList, ...temp]
|
||||||
|
})
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return moduleList
|
||||||
|
}
|
||||||
|
|
||||||
const onAutoAllocation = () => {
|
const onAutoAllocation = () => {
|
||||||
let moduleStdQty = 0
|
let moduleStdQty = 0
|
||||||
let moduleMaxQty = 0
|
let moduleMaxQty = 0
|
||||||
@ -168,19 +258,19 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
return acc + parseInt(model.moduleMaxQty)
|
return acc + parseInt(model.moduleMaxQty)
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
const target = pcsCheck.max ? moduleMaxQty : moduleStdQty
|
// const target = pcsCheck.max ? moduleMaxQty : moduleStdQty
|
||||||
const placementModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
// const placementModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
|
||||||
|
|
||||||
if (placementModules.length > target) {
|
// if (placementModules.length > target) {
|
||||||
swalFire({
|
// swalFire({
|
||||||
title: '배치가능 매수를 초과합니다. 파워컨디셔너를 다시 선택해 주세요.',
|
// title: '배치가능 매수를 초과합니다. 파워컨디셔너를 다시 선택해 주세요.',
|
||||||
type: 'alert',
|
// type: 'alert',
|
||||||
})
|
// })
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
// setAllocationType(ALLOCATION_TYPE.AUTO)
|
// setAllocationType(ALLOCATION_TYPE.AUTO)
|
||||||
setTabNum(2)
|
// setTabNum(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPassivityAllocation = () => {
|
const onPassivityAllocation = () => {
|
||||||
@ -197,14 +287,20 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
const itemList = models.filter((model) => {
|
const itemList = models.filter((model) => {
|
||||||
return res.data?.pcsItemList.map((item) => item.itemId).includes(model.itemId)
|
return res.data?.pcsItemList.map((item) => item.itemId).includes(model.itemId)
|
||||||
})
|
})
|
||||||
setSelectedModels(
|
const selectedModels = itemList.map((model) => {
|
||||||
itemList.map((model) => {
|
return {
|
||||||
return {
|
...model,
|
||||||
...model,
|
id: uuidv4(),
|
||||||
id: uuidv4(),
|
}
|
||||||
}
|
})
|
||||||
}),
|
const PcsVoltageChkParams = {
|
||||||
)
|
...getOptYn(),
|
||||||
|
useModuleItemList: getUseModuleItemList(),
|
||||||
|
roofSurfaceList: getRoofSurfaceList(),
|
||||||
|
pcsItemList: getPcsItemList(),
|
||||||
|
}
|
||||||
|
setSelectedModels(selectedModels)
|
||||||
|
getPcsVoltageChk(PcsVoltageChkParams).then((res) => {})
|
||||||
} else {
|
} else {
|
||||||
swalFire({
|
swalFire({
|
||||||
title: '파워컨디셔너를 추가해 주세요.',
|
title: '파워컨디셔너를 추가해 주세요.',
|
||||||
|
|||||||
@ -173,6 +173,22 @@ export function useMasterController() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PCS로 회로 구성 가능 여부 체크
|
||||||
|
* @param {Max접속(과적)여부} maxConnYn
|
||||||
|
* @param {동일회로도여부} smpCirYn
|
||||||
|
* @param {한랭지여부} coldZoneYn
|
||||||
|
* @param {사용된 모듈 아이템 List} useModuleItemList
|
||||||
|
* @param {지붕면별 목록} roofSurfaceList
|
||||||
|
* @param {PCS 제품 목록} pcsItemList
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const getPcsVoltageChk = async (params = null) => {
|
||||||
|
return await post({ url: '/api/v1/master/getPcsVoltageChk', data: params }).then((res) => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PCS 승압설정 정보 조회
|
* PCS 승압설정 정보 조회
|
||||||
* @param {Max접속(과적)여부} maxConnYn
|
* @param {Max접속(과적)여부} maxConnYn
|
||||||
@ -195,10 +211,7 @@ export function useMasterController() {
|
|||||||
pcsItemList: params2.pcsItemList,
|
pcsItemList: params2.pcsItemList,
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('🚀 ~ getPcsVoltageStepUpList ~ params >>>>> :', params)
|
|
||||||
|
|
||||||
return await post({ url: '/api/v1/master/getPcsVoltageStepUpList', data: params }).then((res) => {
|
return await post({ url: '/api/v1/master/getPcsVoltageStepUpList', data: params }).then((res) => {
|
||||||
console.log('🚀🚀 ~ getPcsVoltageStepUpList ~ res:', res)
|
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -212,6 +225,7 @@ export function useMasterController() {
|
|||||||
getPcsMakerList,
|
getPcsMakerList,
|
||||||
getPcsModelList,
|
getPcsModelList,
|
||||||
getPcsAutoRecommendList,
|
getPcsAutoRecommendList,
|
||||||
|
getPcsVoltageChk,
|
||||||
getPcsManualConfChk,
|
getPcsManualConfChk,
|
||||||
getPcsVoltageStepUpList,
|
getPcsVoltageStepUpList,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,6 +182,8 @@ export const useTrestle = () => {
|
|||||||
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 // 모듈 최대 단 수
|
||||||
// 가대 설치를 위한 가장 아래 모듈로부터 위로 몇단인지 계산
|
// 가대 설치를 위한 가장 아래 모듈로부터 위로 몇단인지 계산
|
||||||
// 오른쪽,왼쪽 둘 다 아래에 아무것도 없는, 처마 커버를 필요로 하는 모듈
|
// 오른쪽,왼쪽 둘 다 아래에 아무것도 없는, 처마 커버를 필요로 하는 모듈
|
||||||
exposedBottomModules.forEach((module) => {
|
exposedBottomModules.forEach((module) => {
|
||||||
@ -299,7 +301,7 @@ export const useTrestle = () => {
|
|||||||
return rack.value.moduleRows === centerRows
|
return rack.value.moduleRows === centerRows
|
||||||
})?.value.racks
|
})?.value.racks
|
||||||
|
|
||||||
moduleRowsTotCnt = Math.max(leftRows, rightRows, centerRows)
|
mostRowsModule = Math.max(leftRows, rightRows, centerRows, mostRowsModule)
|
||||||
|
|
||||||
if (rackYn === 'Y') {
|
if (rackYn === 'Y') {
|
||||||
drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn)
|
drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn)
|
||||||
@ -361,7 +363,7 @@ export const useTrestle = () => {
|
|||||||
const leftRacks = rackInfos.find((rack) => {
|
const leftRacks = rackInfos.find((rack) => {
|
||||||
return rack.value.moduleRows === leftRows
|
return rack.value.moduleRows === leftRows
|
||||||
})?.value.racks
|
})?.value.racks
|
||||||
moduleRowsTotCnt = Math.max(leftRows, moduleRowsTotCnt)
|
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)
|
||||||
}
|
}
|
||||||
@ -415,7 +417,7 @@ export const useTrestle = () => {
|
|||||||
return rack.value.moduleRows === rightRows
|
return rack.value.moduleRows === rightRows
|
||||||
})?.value.racks
|
})?.value.racks
|
||||||
|
|
||||||
moduleRowsTotCnt = Math.max(rightRows, moduleRowsTotCnt)
|
mostRowsModule = Math.max(rightRows, mostRowsModule)
|
||||||
// 해당 rack으로 그려준다.
|
// 해당 rack으로 그려준다.
|
||||||
if (rackYn === 'Y') {
|
if (rackYn === 'Y') {
|
||||||
drawRacks(rightRacks, rackQty, rackIntvlPct, module, direction, 'R', rackYn)
|
drawRacks(rightRacks, rackQty, rackIntvlPct, module, direction, 'R', rackYn)
|
||||||
@ -424,7 +426,7 @@ export const useTrestle = () => {
|
|||||||
module.set({ rightRows })
|
module.set({ rightRows })
|
||||||
})
|
})
|
||||||
|
|
||||||
surface.set({ moduleRowsTotCnt })
|
surface.set({ moduleRowsTotCnt: mostRowsModule })
|
||||||
|
|
||||||
if (rackYn === 'N') {
|
if (rackYn === 'N') {
|
||||||
// rack이 없을경우
|
// rack이 없을경우
|
||||||
@ -1642,6 +1644,7 @@ export const useTrestle = () => {
|
|||||||
if (cvrPlvrYn === 'Y') {
|
if (cvrPlvrYn === 'Y') {
|
||||||
moduleRowResultData.eavesHalfCnt++
|
moduleRowResultData.eavesHalfCnt++
|
||||||
if (bottomLeftModule || bottomRightModule || halfBottomLeftModule || halfBottomRightModule) {
|
if (bottomLeftModule || bottomRightModule || halfBottomLeftModule || halfBottomRightModule) {
|
||||||
|
//처마커버 한개 노출 추가
|
||||||
moduleRowResultData.exposedSideEavesCnt++
|
moduleRowResultData.exposedSideEavesCnt++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1649,10 +1652,10 @@ export const useTrestle = () => {
|
|||||||
moduleRowResultData.exposedBottomCnt++
|
moduleRowResultData.exposedBottomCnt++
|
||||||
if (isEaveBar) {
|
if (isEaveBar) {
|
||||||
moduleRowResultData.eavesCnt++
|
moduleRowResultData.eavesCnt++
|
||||||
}
|
if ((rightModule && !leftModule) || (!rightModule && leftModule)) {
|
||||||
|
// 둘중 하나가 없는경우는 처마커버 노출 추가
|
||||||
if (!(leftModule && rightModule)) {
|
moduleRowResultData.exposedSideEavesCnt++
|
||||||
moduleRowResultData.exposedSideEavesCnt++
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user