Merge branch 'qcast-pub' into dev
# Conflicts: # src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx
This commit is contained in:
commit
d056c80379
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useContext, useEffect, useRef } from 'react'
|
import { useContext, useEffect, useRef } from 'react'
|
||||||
|
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
|
||||||
|
|
||||||
import QContextMenu from '@/components/common/context-menu/QContextMenu'
|
import QContextMenu from '@/components/common/context-menu/QContextMenu'
|
||||||
import PanelBatchStatistics from '@/components/floor-plan/modal/panelBatch/PanelBatchStatistics'
|
import PanelBatchStatistics from '@/components/floor-plan/modal/panelBatch/PanelBatchStatistics'
|
||||||
@ -16,6 +16,7 @@ import { totalDisplaySelector } from '@/store/settingAtom'
|
|||||||
import { MENU } from '@/common/common'
|
import { MENU } from '@/common/common'
|
||||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||||
import { QcastContext } from '@/app/QcastProvider'
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
||||||
|
|
||||||
export default function CanvasFrame() {
|
export default function CanvasFrame() {
|
||||||
const canvasRef = useRef(null)
|
const canvasRef = useRef(null)
|
||||||
@ -27,7 +28,8 @@ export default function CanvasFrame() {
|
|||||||
const { currentCanvasPlan } = usePlan()
|
const { currentCanvasPlan } = usePlan()
|
||||||
const totalDisplay = useRecoilValue(totalDisplaySelector) // 집계표 표시 여부
|
const totalDisplay = useRecoilValue(totalDisplaySelector) // 집계표 표시 여부
|
||||||
const { setIsGlobalLoading } = useContext(QcastContext)
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
|
const [moduleStatistics, setModuleStatistics] = useRecoilState(moduleStatisticsState)
|
||||||
|
const reset = useResetRecoilState(moduleStatisticsState)
|
||||||
const loadCanvas = () => {
|
const loadCanvas = () => {
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
canvas?.clear() // 캔버스를 초기화합니다.
|
canvas?.clear() // 캔버스를 초기화합니다.
|
||||||
@ -43,6 +45,7 @@ export default function CanvasFrame() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadCanvas()
|
loadCanvas()
|
||||||
|
reset()
|
||||||
}, [currentCanvasPlan, canvas])
|
}, [currentCanvasPlan, canvas])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -163,7 +163,6 @@ 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
|
||||||
@ -430,6 +429,8 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
obj.circuit = null
|
obj.circuit = null
|
||||||
obj.pcsItemId = null
|
obj.pcsItemId = null
|
||||||
})
|
})
|
||||||
|
setAllocationType(ALLOCATION_TYPE.AUTO)
|
||||||
|
canvas.renderAll()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -507,7 +508,7 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
)}
|
)}
|
||||||
{tabNum === 1 && allocationType === ALLOCATION_TYPE.PASSIVITY && (
|
{tabNum === 1 && allocationType === ALLOCATION_TYPE.PASSIVITY && (
|
||||||
<div className="grid-btn-wrap">
|
<div className="grid-btn-wrap">
|
||||||
<button className="btn-frame modal mr5" onClick={() => setAllocationType(ALLOCATION_TYPE.AUTO)}>
|
<button className="btn-frame modal mr5" onClick={() => onClickPrev()}>
|
||||||
{getMessage('modal.common.prev')}
|
{getMessage('modal.common.prev')}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn-frame modal act" onClick={() => setTabNum(2)}>
|
<button className="btn-frame modal act" onClick={() => setTabNum(2)}>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { canvasState } from '@/store/canvasAtom'
|
|||||||
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
import { moduleStatisticsState } from '@/store/circuitTrestleAtom'
|
||||||
import { selectedModuleState } from '@/store/selectedModuleOptions'
|
import { selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { useContext, useEffect, useState } from 'react'
|
import { useContext, useEffect, useState } from 'react'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilState, useRecoilValue } from 'recoil'
|
||||||
|
|
||||||
export default function PassivityCircuitAllocation(props) {
|
export default function PassivityCircuitAllocation(props) {
|
||||||
const {
|
const {
|
||||||
@ -25,7 +25,7 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext)
|
||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
const moduleStatistics = useRecoilValue(moduleStatisticsState)
|
const [moduleStatistics, setModuleStatistics] = useRecoilState(moduleStatisticsState)
|
||||||
// const [totalWpout, setTotalWpout] = useState(0)
|
// const [totalWpout, setTotalWpout] = useState(0)
|
||||||
const [selectedPcs, setSelectedPcs] = useState(selectedModels[0])
|
const [selectedPcs, setSelectedPcs] = useState(selectedModels[0])
|
||||||
// const { header, rows: row } = moduleStatistics
|
// const { header, rows: row } = moduleStatistics
|
||||||
@ -157,6 +157,7 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleCircuitNumberFix = () => {
|
const handleCircuitNumberFix = () => {
|
||||||
|
let uniqueCircuitNumbers = null
|
||||||
if (!circuitNumber || circuitNumber === 0) {
|
if (!circuitNumber || circuitNumber === 0) {
|
||||||
swalFire({
|
swalFire({
|
||||||
text: '회로번호를 1 이상입력해주세요.',
|
text: '회로번호를 1 이상입력해주세요.',
|
||||||
@ -172,7 +173,7 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else if (selectedModels.length > 1) {
|
} else if (selectedModels.length > 1) {
|
||||||
const uniqueCircuitNumbers = [
|
uniqueCircuitNumbers = [
|
||||||
...new Set(
|
...new Set(
|
||||||
canvas
|
canvas
|
||||||
.getObjects()
|
.getObjects()
|
||||||
@ -255,7 +256,7 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
goodsNo: model.goodsNo,
|
goodsNo: model.goodsNo,
|
||||||
serQtyList: [
|
serQtyList: [
|
||||||
{
|
{
|
||||||
serQty: 0,
|
serQty: targetModules.length,
|
||||||
paralQty: 0,
|
paralQty: 0,
|
||||||
rmdYn: 'Y',
|
rmdYn: 'Y',
|
||||||
usePossYn: 'Y',
|
usePossYn: 'Y',
|
||||||
@ -311,15 +312,15 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
|
|
||||||
const setTableData = () => {
|
const setTableData = () => {
|
||||||
const tempHeader = [
|
const tempHeader = [
|
||||||
{ name: '지붕면', prop: 'name' },
|
{ name: getMessage('simulator.table.sub1'), prop: 'name' },
|
||||||
{ name: '회로', prop: 'circuit' },
|
{ name: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.circuit'), prop: 'circuit' },
|
||||||
...selectedModules.itemList.map((module) => {
|
...selectedModules.itemList.map((module) => {
|
||||||
return {
|
return {
|
||||||
name: module.itemNm,
|
name: module.itemNm,
|
||||||
prop: module.itemId,
|
prop: module.itemId,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
{ name: '발전량(kW)', prop: 'wpOut' },
|
{ name: `${getMessage('modal.panel.batch.statistic.power.generation.amount')}(kW)`, prop: 'wpOut' },
|
||||||
]
|
]
|
||||||
|
|
||||||
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)
|
||||||
@ -396,15 +397,16 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
selectedModules.itemList.forEach((module) => {
|
selectedModules.itemList.forEach((module) => {
|
||||||
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + row[module.itemId], 0)
|
tempFooter[module.itemId] = tempRows.reduce((acc, row) => acc + row[module.itemId], 0)
|
||||||
})
|
})
|
||||||
console.log('tempHeader, tempRows, tempFooter', tempHeader, tempRows, tempFooter)
|
|
||||||
setHeader(tempHeader)
|
setHeader(tempHeader)
|
||||||
setRows(tempRows.filter((row) => row.wpOut !== 0))
|
setRows(tempRows.filter((row) => row.wpOut !== 0))
|
||||||
setFooter(tempFooter)
|
setFooter(tempFooter)
|
||||||
|
setModuleStatistics({ header: tempHeader, rows: tempRows.filter((row) => row.wpOut !== 0), footer: tempFooter })
|
||||||
}
|
}
|
||||||
|
|
||||||
const initSelectedPcsCircuitNumber = () => {
|
const initSelectedPcsCircuitNumber = () => {
|
||||||
swalFire({
|
swalFire({
|
||||||
title: '선택된 파워 컨디셔너의 회로할당을 초기화합니다.',
|
title: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.init.info'),
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
confirmFn: () => {
|
confirmFn: () => {
|
||||||
@ -425,7 +427,7 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
const initAllPcsCircuitNumber = () => {
|
const initAllPcsCircuitNumber = () => {
|
||||||
canvas.discardActiveObject()
|
canvas.discardActiveObject()
|
||||||
swalFire({
|
swalFire({
|
||||||
title: '회로 할당의 설정을 초기화합니다.',
|
title: getMessage('modal.circuit.trestle.setting.circuit.allocation.passivity.init.setting.info'),
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
confirmFn: () => {
|
confirmFn: () => {
|
||||||
@ -467,7 +469,9 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
<tr key={'row' + index}>
|
<tr key={'row' + index}>
|
||||||
{header.map((header, i) => (
|
{header.map((header, i) => (
|
||||||
<td className="al-c" key={'rowcell' + i}>
|
<td className="al-c" key={'rowcell' + i}>
|
||||||
{row[header.prop]}
|
{typeof row[header.prop] === 'number'
|
||||||
|
? row[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 })
|
||||||
|
: row[header.prop]}
|
||||||
</td>
|
</td>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
@ -475,7 +479,9 @@ export default function PassivityCircuitAllocation(props) {
|
|||||||
<tr>
|
<tr>
|
||||||
{header.map((header, i) => (
|
{header.map((header, i) => (
|
||||||
<td className="al-c" key={'footer' + i}>
|
<td className="al-c" key={'footer' + i}>
|
||||||
{footer[header.prop]}
|
{typeof footer[header.prop] === 'number'
|
||||||
|
? footer[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 })
|
||||||
|
: footer[header.prop]}
|
||||||
</td>
|
</td>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -25,24 +25,27 @@ export default function PanelBatchStatistics() {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
{header.map((item, index) => (
|
{header.map((item, index) => (
|
||||||
<th key={index}>{item.name}</th>
|
<th key={`statistic-hd-${index}`}>{item.name}</th>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{rows.map((row, index) => (
|
{rows.map((row, index) => (
|
||||||
<tr key={index}>
|
<tr key={`statistic-row-${index}`}>
|
||||||
{header.map((item, i) => (
|
{header.map((item, i) => (
|
||||||
<td key={index}>
|
<td key={`statistic-col-${i}`}>
|
||||||
{typeof row[item.prop] === 'number' ? row[item.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 }) : row[item.prop]}
|
{typeof row[item.prop] === 'number' ? row[item.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 }) : row[item.prop]}
|
||||||
</td>
|
</td>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
<tr>
|
<tr>
|
||||||
{footer.map((item, index) => (
|
{header.map((header, index) => (
|
||||||
<td key={index}>{typeof item === 'number' ? item.toLocaleString('ko-KR', { maximumFractionDigits: 4 }) : item}</td>
|
<td key={`statistic-ft-${index}`}>
|
||||||
// <td className="al-r">{item.amount}</td>
|
{typeof footer[header.prop] === 'number'
|
||||||
|
? footer[header.prop].toLocaleString('ko-KR', { maximumFractionDigits: 4 })
|
||||||
|
: footer[header.prop]}
|
||||||
|
</td>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -149,6 +149,8 @@
|
|||||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.selected.power.conditional.reset": "選択されたパワーコンディショナーの回路番号の初期化",
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.selected.power.conditional.reset": "選択されたパワーコンディショナーの回路番号の初期化",
|
||||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.reset": "すべての回路番号の初期化",
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.reset": "すべての回路番号の初期化",
|
||||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "番号確定",
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "番号確定",
|
||||||
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.info": "선택된 파워 컨디셔너의 회로할당을 초기화합니다.(JA)",
|
||||||
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.setting.info": "회로 할당의 설정을 초기화합니다.(JA)",
|
||||||
"modal.circuit.trestle.setting.step.up.allocation": "昇圧設定",
|
"modal.circuit.trestle.setting.step.up.allocation": "昇圧設定",
|
||||||
"modal.circuit.trestle.setting.step.up.allocation.serial.amount": "シリアル枚数",
|
"modal.circuit.trestle.setting.step.up.allocation.serial.amount": "シリアル枚数",
|
||||||
"modal.circuit.trestle.setting.step.up.allocation.total.amount": "総回路数",
|
"modal.circuit.trestle.setting.step.up.allocation.total.amount": "総回路数",
|
||||||
|
|||||||
@ -155,6 +155,8 @@
|
|||||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.selected.power.conditional.reset": "선택된 파워컨디셔너의 회로번호 초기화",
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.selected.power.conditional.reset": "선택된 파워컨디셔너의 회로번호 초기화",
|
||||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.reset": "모든 회로번호 초기화",
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.all.power.conditional.reset": "모든 회로번호 초기화",
|
||||||
"modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "번호 확정",
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.circuit.num.fix": "번호 확정",
|
||||||
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.info": "선택된 파워 컨디셔너의 회로할당을 초기화합니다.",
|
||||||
|
"modal.circuit.trestle.setting.circuit.allocation.passivity.init.setting.info": "회로 할당의 설정을 초기화합니다.",
|
||||||
"modal.circuit.trestle.setting.step.up.allocation": "승압 설정",
|
"modal.circuit.trestle.setting.step.up.allocation": "승압 설정",
|
||||||
"modal.circuit.trestle.setting.step.up.allocation.serial.amount": "직렬매수",
|
"modal.circuit.trestle.setting.step.up.allocation.serial.amount": "직렬매수",
|
||||||
"modal.circuit.trestle.setting.step.up.allocation.total.amount": "총 회로수",
|
"modal.circuit.trestle.setting.step.up.allocation.total.amount": "총 회로수",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user