#1068 [오류] 견적서 생성된 플랜복사 --> 복사된 플랜에서 모듈삭제 --> 견적서 진입이 됨..

This commit is contained in:
hyojun.choi 2025-05-28 10:26:38 +09:00
parent 8ab41c8eda
commit 4e8cc409d4
3 changed files with 14 additions and 0 deletions

View File

@ -50,6 +50,7 @@ import JA from '@/locales/ja.json'
import { QcastContext } from '@/app/QcastProvider' import { QcastContext } from '@/app/QcastProvider'
import { useRoofFn } from '@/hooks/common/useRoofFn' import { useRoofFn } from '@/hooks/common/useRoofFn'
import { usePolygon } from '@/hooks/usePolygon' import { usePolygon } from '@/hooks/usePolygon'
import { useTrestle } from '@/hooks/module/useTrestle'
export default function CanvasMenu(props) { export default function CanvasMenu(props) {
const { selectedMenu, setSelectedMenu } = props const { selectedMenu, setSelectedMenu } = props
const pathname = usePathname() const pathname = usePathname()
@ -67,6 +68,7 @@ export default function CanvasMenu(props) {
const globalLocale = useRecoilValue(globalLocaleStore) const globalLocale = useRecoilValue(globalLocaleStore)
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
const { handleZoomClear, handleZoom } = useCanvasEvent() const { handleZoomClear, handleZoom } = useCanvasEvent()
const { setAllModuleSurfaceIsComplete, isAllComplete } = useTrestle()
const { handleMenu } = useMenu() const { handleMenu } = useMenu()
// const urlParams = useSearchParams() // const urlParams = useSearchParams()
const { handleEstimateSubmit, fetchSetting, estimateContextState, setEstimateContextState } = useEstimateController() const { handleEstimateSubmit, fetchSetting, estimateContextState, setEstimateContextState } = useEstimateController()
@ -194,6 +196,7 @@ export default function CanvasMenu(props) {
confirmFn: () => { confirmFn: () => {
// //
setAllModuleSurfaceIsComplete(false)
const moduleSurfacesArray = canvas const moduleSurfacesArray = canvas
.getObjects() .getObjects()
.filter((obj) => [POLYGON_TYPE.MODULE_SETUP_SURFACE, POLYGON_TYPE.MODULE, POLYGON_TYPE.OBJECT_SURFACE].includes(obj.name)) .filter((obj) => [POLYGON_TYPE.MODULE_SETUP_SURFACE, POLYGON_TYPE.MODULE, POLYGON_TYPE.OBJECT_SURFACE].includes(obj.name))
@ -233,6 +236,10 @@ export default function CanvasMenu(props) {
await reloadCanvasStatus(objectNo, pid) await reloadCanvasStatus(objectNo, pid)
break break
case 'estimate': case 'estimate':
if (!isAllComplete()) {
swalFire({ text: getMessage('estimate.menu.move.valid1') })
return
}
setIsGlobalLoading(true) setIsGlobalLoading(true)
promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => { promiseGet({ url: `/api/estimate/${objectNo}/${selectedPlan.planNo}/detail` }).then((res) => {
if (res.status === 200) { if (res.status === 200) {

View File

@ -154,6 +154,7 @@ export default function CircuitTrestleSetting({ id }) {
getPcsVoltageChk(pcsVoltageChkParams).then((res) => { getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
if (res.resultCode === 'S') { if (res.resultCode === 'S') {
setTabNum(2) setTabNum(2)
setAllModuleSurfaceIsComplete(false)
} else { } else {
swalFire({ swalFire({
title: res.resultMsg, title: res.resultMsg,
@ -187,6 +188,7 @@ export default function CircuitTrestleSetting({ id }) {
}).then((res) => { }).then((res) => {
if (res?.result.resultCode === 'S' && res?.data) { if (res?.result.resultCode === 'S' && res?.data) {
setTabNum(2) setTabNum(2)
setAllModuleSurfaceIsComplete(false)
} else { } else {
swalFire({ text: getMessage('common.message.send.error') }) swalFire({ text: getMessage('common.message.send.error') })
} }
@ -286,6 +288,7 @@ export default function CircuitTrestleSetting({ id }) {
setSelectedModels(pcsItemList) setSelectedModels(pcsItemList)
getPcsVoltageChk(pcsVoltageChkParams).then((res) => { getPcsVoltageChk(pcsVoltageChkParams).then((res) => {
setAllocationType(ALLOCATION_TYPE.PASSIVITY) setAllocationType(ALLOCATION_TYPE.PASSIVITY)
setAllModuleSurfaceIsComplete(false)
}) })
} else { } else {
swalFire({ swalFire({
@ -654,6 +657,7 @@ export default function CircuitTrestleSetting({ id }) {
return return
} else { } else {
setTabNum(2) setTabNum(2)
setAllModuleSurfaceIsComplete(false)
} }
}) })
} }

View File

@ -3077,6 +3077,9 @@ export const useTrestle = () => {
// 배치면 전체에 가대 설치 여부 // 배치면 전체에 가대 설치 여부
const isAllComplete = () => { const isAllComplete = () => {
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)
if (surfaces.length === 0) {
return false
}
return surfaces.every((surface) => surface.isComplete) return surfaces.every((surface) => surface.isComplete)
} }