diff --git a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx index fa4abd4c..1d6ac400 100644 --- a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx @@ -62,6 +62,7 @@ export default function CircuitTrestleSetting({ id }) { const passivityProps = { tabNum, setTabNum, + pcsCheck, selectedModels, setSelectedModels, } diff --git a/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx b/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx index fbaef41a..3c581e6f 100644 --- a/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/step/PowerConditionalSelect.jsx @@ -141,7 +141,7 @@ export default function PowerConditionalSelect(props) { return } - setSelectedModels([...selectedModels, selectedRow]) + setSelectedModels([...selectedModels, { ...selectedRow, id: uuidv4() }]) setSelectedRow(null) } diff --git a/src/components/floor-plan/modal/circuitTrestle/step/type/PassivityCircuitAllocation.jsx b/src/components/floor-plan/modal/circuitTrestle/step/type/PassivityCircuitAllocation.jsx index 62e54ec1..e1c2b29b 100644 --- a/src/components/floor-plan/modal/circuitTrestle/step/type/PassivityCircuitAllocation.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/step/type/PassivityCircuitAllocation.jsx @@ -1,5 +1,6 @@ import { GlobalDataContext } from '@/app/GlobalDataProvider' import { POLYGON_TYPE } from '@/common/common' +import { useMasterController } from '@/hooks/common/useMasterController' import { useMessage } from '@/hooks/useMessage' import { canvasState } from '@/store/canvasAtom' import { moduleStatisticsState } from '@/store/circuitTrestleAtom' @@ -8,7 +9,7 @@ import { useContext, useEffect, useState } from 'react' import { useRecoilValue } from 'recoil' export default function PassivityCircuitAllocation(props) { - const { tabNum, setTabNum, selectedModels } = props + const { tabNum, setTabNum, selectedModels, pcsCheck } = props const { getMessage } = useMessage() const canvas = useRecoilValue(canvasState) const { managementState, setManagementState, managementStateLoaded } = useContext(GlobalDataContext) @@ -22,6 +23,7 @@ export default function PassivityCircuitAllocation(props) { const [footer, setFooter] = useState(['합계']) const [circuitNumber, setCircuitNumber] = useState(1) const [targetModules, setTargetModules] = useState([]) + const { pcsMaualConfChk } = useMasterController() useEffect(() => { console.log('🚀 ~ PassivityCircuitAllocation ~ targetModules:', targetModules) @@ -145,15 +147,752 @@ export default function PassivityCircuitAllocation(props) { const handleCircuitNumberFix = () => { console.log('🚀 ~ handleCircuitNumberFix ~ circuitNumber:', circuitNumber) + console.log('🚀 ~ handleCircuitNumberFix ~ selectedPcs:', selectedPcs) + // const params = { + // maxConnYn: pcsCheck.max ? 'Y' : 'N', + // smpCirYn: 'Y', + // coldZoneYn: 'Y', + // useModuleItemList: [{ itemId: '107077', mixMatlNo: '0' }], + // pcsItemList: [ + // { + // pcsMkrCd: 'MKR001', + // pcsSerCd: 'SER001', + // itemId: '106857', + // itemNm: 'HQJP-KA55-5 パワーコンディショナ5.5kW屋内', + // goodsNo: 'HQJP-KA55-5', + // serQtyList: [ + // { + // serQty: 5, + // paralQty: 3, + // rmdYn: 'Y', + // usePossYn: 'Y', + // roofSurfaceList: [ + // { + // roofSurfaceId: '1', + // roofSurface: '남서', + // roofSurfaceIncl: '5', + // moduleList: [ + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // ], + // cirLastIdx: 5, + // isCirLastDupCircuit: true, + // roofSurfacePossibleModuleCnt: 0, + // totCirModuleWpOut: 0, + // roofSurfaceCirModuleWpOut: 3960, + // }, + // { + // roofSurfaceId: '2', + // roofSurface: '남서', + // roofSurfaceIncl: '5', + // moduleList: [ + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: null, + // pcsItemId: null, + // }, + // ], + // cirLastIdx: 3, + // isCirLastDupCircuit: true, + // roofSurfacePossibleModuleCnt: 1, + // totCirModuleWpOut: 0, + // roofSurfaceCirModuleWpOut: 2200, + // }, + // { + // roofSurfaceId: '3', + // roofSurface: '남', + // roofSurfaceIncl: '3', + // moduleList: [ + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // ], + // cirLastIdx: 6, + // isCirLastDupCircuit: true, + // roofSurfacePossibleModuleCnt: 0, + // totCirModuleWpOut: 0, + // roofSurfaceCirModuleWpOut: 3960, + // }, + // ], + // }, + // ], + // }, + // { + // pcsMkrCd: 'MKR001', + // pcsSerCd: 'SER001', + // itemId: '106856', + // itemNm: 'HQJP-KA40-5 パワーコンディショナ4.0kW屋内', + // goodsNo: 'HQJP-KA40-5', + // circuitCfg: '4, 4', + // serQtyList: [ + // { + // pcsTpCd: 'INDFCS', + // serQty: 4, + // paralQty: 2, + // rmdYn: 'Y', + // usePossYn: 'Y', + // cirModuleWpOutSum: 3520, + // roofSurfaceList: [ + // { + // roofSurfaceId: '1', + // roofSurface: '남서', + // roofSurfaceIncl: '5', + // moduleList: [ + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-1', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-4', + // pcsItemId: '106856', + // }, + // ], + // cirLastIdx: 5, + // isCirLastDupCircuit: true, + // roofSurfacePossibleModuleCnt: 0, + // totCirModuleWpOut: 0, + // roofSurfaceCirModuleWpOut: 3960, + // }, + // { + // roofSurfaceId: '2', + // roofSurface: '남서', + // roofSurfaceIncl: '5', + // moduleList: [ + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-2', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: null, + // pcsItemId: null, + // }, + // ], + // }, + // { + // roofSurfaceId: '3', + // roofSurface: '남', + // roofSurfaceIncl: '3', + // moduleList: [ + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '1-3', + // pcsItemId: '106857', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // { + // pcsMkrCd: null, + // pcsSerCd: null, + // applySerQty: null, + // itemId: '107077', + // itemTp: null, + // wpOut: 440, + // moduleStdVol: 42, + // moduleColdZoneVol: null, + // mixMatlNo: null, + // circuit: '2-5', + // pcsItemId: '106856', + // }, + // ], + // }, + // ], + // }, + // ], + // }, + // ], + // } + // pcsMaualConfChk() + canvas.discardActiveObject() canvas .getObjects() .filter((obj) => targetModules.includes(obj.id)) .forEach((obj) => { obj.set({ circuit: circuitNumber, + strokeWidth: 0.3, }) + obj.pscId = selectedPcs.id + obj.pscIndex = selectedModels.findIndex((model) => model.itemId === selectedPcs.itemId) + 1 canvas.add( - new fabric.Text(`(${circuitNumber})`, { + new fabric.Text(getCircuitNumber(), { left: obj.left + obj.width / 2, top: obj.top + obj.height / 2, fill: 'red', @@ -171,7 +910,29 @@ export default function PassivityCircuitAllocation(props) { console.log(obj) }) setTargetModules([]) - setCircuitNumber(circuitNumber + 1) + setCircuitNumber(+circuitNumber + 1) + canvas.renderAll() + } + + const getCircuitNumber = () => { + if (selectedModels.length === 1) { + return `(${circuitNumber})` + } else { + return `(${selectedModels.findIndex((model) => model.itemId === selectedPcs.itemId) + 1}-${circuitNumber})` + } + } + + const initSelectedPcsCircuitNumber = () => { + const modules = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber' && obj.pscId === selectedPcs.id) + canvas.remove(...modules) + canvas + .getObjects() + .filter((obj) => obj.pscIndex === selectedPcs.id) + .forEach((obj) => { + obj.pscId = null + obj.pscIndex = null + }) + canvas.renderAll() } @@ -280,7 +1041,7 @@ export default function PassivityCircuitAllocation(props) {
-