diff --git a/apps/fo/app/components/common/SearchInput.tsx b/apps/fo/app/components/common/SearchInput.tsx index 11bdd3676..c15ab7506 100644 --- a/apps/fo/app/components/common/SearchInput.tsx +++ b/apps/fo/app/components/common/SearchInput.tsx @@ -47,11 +47,6 @@ export default function SearchInputText({label=undefined, setValue=()=>{}, sidoS }, [fcltyName]); const handleSuggestionClick = useCallback((bscFctCd: string, bscFctNm: string, fctCpc: number | '', trtFrfNm: string | '', efflWqltStndrdNm: string | '') => { - console.log('bscFctNm : ', bscFctNm); - console.log('bscFctCd : ', bscFctCd); - console.log('fctCpc : ', fctCpc); - console.log('trtFrfNm : ', trtFrfNm); - console.log('efflWqltStndrdNm : ', efflWqltStndrdNm); setTextValue(bscFctNm); setValue(bscFctCd, bscFctNm, fctCpc, trtFrfNm, efflWqltStndrdNm); setIsOpen(false); diff --git a/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx b/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx index 9c16161f5..2ca8354b6 100644 --- a/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx +++ b/apps/fo/app/pages/(with-layout)/dashboard/facilityInfo/page.tsx @@ -171,7 +171,6 @@ export default function ProcessFacilitySearch({searchYear = '', fcltyList = []}: el['provisionalApproval'] = waterUsage1; } }); - console.log('planFcltyList :', planFcltyList); } }, [waterUsage1, waterUsage2, waterUsage3, searchYear, planFcltyList]); // 연도가 바뀌면 hasSearched를 false로 리셋 diff --git a/apps/fo/app/store/dashboard/index.tsx b/apps/fo/app/store/dashboard/index.tsx index 87091a3a1..319bbd5cd 100644 --- a/apps/fo/app/store/dashboard/index.tsx +++ b/apps/fo/app/store/dashboard/index.tsx @@ -152,21 +152,21 @@ export interface RainManageExcelType { 강우량: string, 강우조건비율: number | '', 일수: number | '', - 유입유량: number | '', - 시설용량대비: number | '', - 설계유입수질BOD: number | '', - 설계유입수질TOC: number | '', - 설계유입수질SS: number | '', + 유입유량: string | number | '', + 시설용량대비: string |number | '', + 설계유입수질BOD: string | number | '', + 설계유입수질TOC: string | number | '', + 설계유입수질SS: string | number | '', 설계유입수질TN: string | number | '', 설계유입수질TP: string | number | '', - 유입수질BOD: number | '', - 유입수질TOC: number | '', - 유입수질SS: number | '', + 유입수질BOD: string | number | '', + 유입수질TOC: string | number | '', + 유입수질SS: string | number | '', 유입수질TN: string | number | '', 유입수질TP: string | number | '', - 방류수질BOD: number | '', - 방류수질TOC: number | '', - 방류수질SS: number | '', + 방류수질BOD: string | number | '', + 방류수질TOC: string |number | '', + 방류수질SS: string | number | '', 방류수질TN: string | number | '', 방류수질TP: string | number | '', } @@ -1203,7 +1203,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 연계처리수,지하수유입량 const bscFctCd = fcltyCd; const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse; - console.log('res2', res2); yearDay = res2.data?res2.data.length:1; res2.data.forEach((item: FlowDataItem) => { yearSumFlow += item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0; @@ -1343,7 +1342,6 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) } } - console.log('operationalStatusList', operationalStatusList); //const excelDownList: RainManageExcelType[] = []; /* if(isExcel){ res.data.forEach(item => { @@ -1539,7 +1537,31 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) const rainEffectList = calRainEffectDayRainManage(res.data.wqltObjs); // Process the data and create rain management list + + const totItemCnt = rainEffectList?rainEffectList.length : 1; + let totInflAssctBfrWqltBod = 0; + let totInflAssctBfrWqltToc = 0; + let totInflAssctBfrWqltSs = 0; + let totInflAssctBfrWqltTn = 0; + let totInflAssctBfrWqltTp = 0; + let totEfflWqltBod = 0; + let totEfflWqltToc = 0; + let totEfflWqltSs = 0; + let totEfflWqltTn = 0; + let totEfflWqltTp = 0; + rainEffectList.forEach((item: RainManageListProps) => { + totInflAssctBfrWqltBod += item.inflAssctBfrWqltBod ? Number(item.inflAssctBfrWqltBod.toString().trim()) : 0; + totInflAssctBfrWqltToc += item.inflAssctBfrWqltToc ? Number(item.inflAssctBfrWqltToc.toString().trim()) : 0; + totInflAssctBfrWqltSs += item.inflAssctBfrWqltSs ? Number(item.inflAssctBfrWqltSs.toString().trim()) : 0; + totInflAssctBfrWqltTn += item.inflAssctBfrWqltTn ? Number(item.inflAssctBfrWqltTn.toString().trim()) : 0; + totInflAssctBfrWqltTp += item.inflAssctBfrWqltTp ? Number(item.inflAssctBfrWqltTp.toString().trim()) : 0; + totEfflWqltBod += item.efflWqltBod ? Number(item.efflWqltBod.toString().trim()) : 0; + totEfflWqltToc += item.efflWqltToc ? Number(item.efflWqltToc.toString().trim()) : 0; + totEfflWqltSs += item.efflWqltSs ? Number(item.efflWqltSs.toString().trim()) : 0; + totEfflWqltTn += item.efflWqltTn ? Number(item.efflWqltTn.toString().trim()) : 0; + totEfflWqltTp += item.efflWqltTp ? Number(item.efflWqltTp.toString().trim()) : 0; + if(Number(item.infoRnDay) >= 3 && Number(item.infoRnDay) < 10){ rainDate[1] = Number(rainDate[1] || 0) + 1; inflAmtCnt[1] = Number(inflAmtCnt[1] || 0) + 1; @@ -1627,7 +1649,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) inflAssctBfrWqltSsCnt[4] = Number(inflAssctBfrWqltSsCnt[4] || 0) + 1; inflAssctBfrWqltSs[4] = Number(inflAssctBfrWqltSs[4] || 0) + Number(item.inflAssctBfrWqltSs || 0); inflAssctBfrWqltTnCnt[4] = Number(inflAssctBfrWqltTnCnt[4] || 0) + 1; - inflAssctBfrWqltTn[4] = Number(inflAssctBfrWqltTn[5] || 0) + Number(item.inflAssctBfrWqltTn || 0); + inflAssctBfrWqltTn[4] = Number(inflAssctBfrWqltTn[4] || 0) + Number(item.inflAssctBfrWqltTn || 0); inflAssctBfrWqltTpCnt[4] = Number(inflAssctBfrWqltTpCnt[4] || 0) + 1; inflAssctBfrWqltTp[4] = Number(inflAssctBfrWqltTp[4] || 0) + Number(item.inflAssctBfrWqltTp || 0); efflWqltBodCnt[4] = Number(efflWqltBodCnt[4] || 0) + 1; @@ -1636,9 +1658,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) efflWqltToc[4] = Number(efflWqltToc[4] || 0) + Number(item.efflWqltToc || 0); efflWqltSsCnt[4] = Number(efflWqltSsCnt[4] || 0) + 1; efflWqltSs[4] = Number(efflWqltSs[4] || 0) + Number(item.efflWqltSs || 0); - efflWqltTnCnt[4] = Number(efflWqltTnCnt[5] || 0) + 1; + efflWqltTnCnt[4] = Number(efflWqltTnCnt[4] || 0) + 1; efflWqltTn[4] = Number(efflWqltTn[4] || 0) + Number(item.efflWqltTn || 0); - efflWqltTpCnt[4] = Number(efflWqltTpCnt[5] || 0) + 1; + efflWqltTpCnt[4] = Number(efflWqltTpCnt[4] || 0) + 1; efflWqltTp[4] = Number(efflWqltTp[4] || 0) + Number(item.efflWqltTp || 0); }else if(Number(item.infoRnDay) >= 40 && Number(item.infoRnDay) < 50){ rainDate[5] = Number(rainDate[5] || 0) + 1; @@ -1773,7 +1795,7 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 평균 및 합계 계산 const calculateAverage = (value: number, count: number) => { - return count > 0 ? Number((value / count).toFixed(1)) : 0; + return count > 0 ? Number((value / count)) : 0; }; // 데이터 있는 항목만 계산 @@ -1800,44 +1822,44 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) // 합계 계산 (index 0) const calculateTotal = (arr: number[]) => { - return Number((arr.slice(1).reduce((sum, val) => sum + Number(val), 0)).toFixed(1)); + return Number((arr.slice(1).reduce((sum, val) => sum + Number(val), 0))); }; inflAmnt[0] = calculateAverage(calculateTotal(inflAmnt), dataIsCount); fcltyCpct[0] = calculateTotal(fcltyCpct); - inflAssctBfrWqltBod[0] = Number((calculateTotal(inflAssctBfrWqltBod)/7).toFixed(1)); - inflAssctBfrWqltToc[0] = Number((calculateTotal(inflAssctBfrWqltToc)/7).toFixed(1)); - inflAssctBfrWqltSs[0] = Number((calculateTotal(inflAssctBfrWqltSs)/7).toFixed(1)); - inflAssctBfrWqltTn[0] = Number((calculateTotal(inflAssctBfrWqltTn)/7).toFixed(3)); - inflAssctBfrWqltTp[0] = Number((calculateTotal(inflAssctBfrWqltTp)/7).toFixed(3)); - efflWqltBod[0] = Number((calculateTotal(efflWqltBod)/7).toFixed(1)); - efflWqltToc[0] = Number((calculateTotal(efflWqltToc)/7).toFixed(1)); - efflWqltSs[0] = Number((calculateTotal(efflWqltSs as number[])/7).toFixed(1)); - efflWqltTn[0] = Number((calculateTotal(efflWqltTn as number[])/7).toFixed(3)); - efflWqltTp[0] = Number((calculateTotal(efflWqltTp as number[])/7).toFixed(3)); + inflAssctBfrWqltBod[0] = Number((Math.round((totInflAssctBfrWqltBod / totItemCnt) * 10) / 10).toFixed(1)); + inflAssctBfrWqltToc[0] = Number((Math.round((totInflAssctBfrWqltToc / totItemCnt) * 10) / 10).toFixed(1)); + inflAssctBfrWqltSs[0] = Number((Math.round((totInflAssctBfrWqltSs / totItemCnt) * 10) / 10).toFixed(1)); + inflAssctBfrWqltTn[0] = Number((Math.round((totInflAssctBfrWqltTn / totItemCnt) * 1000) / 1000).toFixed(3)); + inflAssctBfrWqltTp[0] = Number((Math.round((totInflAssctBfrWqltTp / totItemCnt) * 1000) / 1000).toFixed(3)); + efflWqltBod[0] = Number((Math.round((totEfflWqltBod / totItemCnt) * 10) / 10).toFixed(1)); + efflWqltToc[0] = Number((Math.round((totEfflWqltToc / totItemCnt) * 10) / 10).toFixed(1)); + efflWqltSs[0] = Number((Math.round((totEfflWqltSs / totItemCnt) * 10) / 10).toFixed(1)); + efflWqltTn[0] = Number((Math.round((totEfflWqltTn / totItemCnt) * 1000) / 1000).toFixed(3)); + efflWqltTp[0] = Number((Math.round((totEfflWqltTp / totItemCnt) * 1000) / 1000).toFixed(3)); // 최종 리스트 const filteredData = itemList.map((item, index) => ({ rainItem: item, rainRate: rainRate[index] || '0', rainDay: rainDate[index] ? Number(rainDate[index].toFixed(1)) : '', - inflAmnt: inflAmnt[index] ? Number(inflAmnt[index].toFixed(1)) : '', - fctCpc: inflAmnt[index] ? Number((inflAmnt[index] / fcltyCpcValue).toFixed(1)) : '', - dsInflWqltBod: dsInflWqltBod[index] ? Number(dsInflWqltBod[index].toFixed(1)) : '', - dsInflWqltCod: dsInflWqltCod[index] ? Number(dsInflWqltCod[index].toFixed(1)) : '', - dsInflWqltSs: dsInflWqltSs[index] ? Number(dsInflWqltSs[index].toFixed(1)) : '', - dsInflWqltTn: dsInflWqltTn[index] ? dsInflWqltTn[index].toFixed(3) : '', - dsInflWqltTp: dsInflWqltTp[index] ? dsInflWqltTp[index].toFixed(3) : '', - inflAssctBfrWqltBod: inflAssctBfrWqltBod[index] ? Number(inflAssctBfrWqltBod[index].toFixed(1)) : '', - inflAssctBfrWqltToc: inflAssctBfrWqltToc[index] ? Number(inflAssctBfrWqltToc[index].toFixed(1)) : '', - inflAssctBfrWqltSs: inflAssctBfrWqltSs[index] ? Number(inflAssctBfrWqltSs[index].toFixed(1)) : '', - inflAssctBfrWqltTn: inflAssctBfrWqltTn[index] ? inflAssctBfrWqltTn[index].toFixed(3) : '', - inflAssctBfrWqltTp: inflAssctBfrWqltTp[index] ? inflAssctBfrWqltTp[index].toFixed(3) : '', - efflWqltBod: efflWqltBod[index] ? Number(efflWqltBod[index].toFixed(1)) : '', - efflWqltToc: efflWqltToc[index] ? Number(efflWqltToc[index].toFixed(1)) : '', - efflWqltSs: efflWqltSs[index] ? Number(efflWqltSs[index].toFixed(1)) : '', - efflWqltTn: efflWqltTn[index] ? efflWqltTn[index].toFixed(3) : '', - efflWqltTp: efflWqltTp[index] ? efflWqltTp[index].toFixed(3) : '' + inflAmnt: inflAmnt[index] ? Number((Math.round(inflAmnt[index] * 10) / 10).toFixed(1)) : '', + fctCpc: inflAmnt[index] ? (Math.round((inflAmnt[index] / fcltyCpcValue) * 10) / 10).toFixed(1) : '', + dsInflWqltBod: dsInflWqltBod[index] ? (Math.round(dsInflWqltBod[index] * 10) / 10).toFixed(1) : '', + dsInflWqltCod: dsInflWqltCod[index] ? (Math.round(dsInflWqltCod[index] * 10) / 10).toFixed(1) : '', + dsInflWqltSs: dsInflWqltSs[index] ? (Math.round(dsInflWqltSs[index] * 10) / 10).toFixed(1) : '', + dsInflWqltTn: dsInflWqltTn[index] ? (Math.round(dsInflWqltTn[index] * 1000) / 1000).toFixed(3) : '', + dsInflWqltTp: dsInflWqltTp[index] ? (Math.round(dsInflWqltTp[index] * 1000) / 1000).toFixed(3) : '', + inflAssctBfrWqltBod: inflAssctBfrWqltBod[index] ? (Math.round(inflAssctBfrWqltBod[index] * 10) / 10).toFixed(1) : '', + inflAssctBfrWqltToc: inflAssctBfrWqltToc[index] ? (Math.round(inflAssctBfrWqltToc[index] * 10) / 10).toFixed(1) : '', + inflAssctBfrWqltSs: inflAssctBfrWqltSs[index] ? (Math.round(inflAssctBfrWqltSs[index] * 10) / 10).toFixed(1) : '', + inflAssctBfrWqltTn: inflAssctBfrWqltTn[index] ? (Math.round(inflAssctBfrWqltTn[index] * 1000) / 1000).toFixed(3) : '', + inflAssctBfrWqltTp: inflAssctBfrWqltTp[index] ? (Math.round(inflAssctBfrWqltTp[index] * 1000) / 1000).toFixed(3) : '', + efflWqltBod: efflWqltBod[index] ? (Math.round(efflWqltBod[index] * 10) / 10).toFixed(1): '', + efflWqltToc: efflWqltToc[index] ? (Math.round(efflWqltToc[index] * 10) / 10).toFixed(1) : '', + efflWqltSs: efflWqltSs[index] ? (Math.round(efflWqltSs[index] * 10) / 10).toFixed(1) : '', + efflWqltTn: efflWqltTn[index] ? (Math.round(efflWqltTn[index] * 1000) / 1000).toFixed(3) : '', + efflWqltTp: efflWqltTp[index] ? (Math.round(efflWqltTp[index] * 1000) / 1000).toFixed(3) : '' })); const excelList : RainManageExcelType[] = []; @@ -1847,23 +1869,23 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) 강우량: item.rainItem, 강우조건비율: item.rainRate ? Number(Number(item.rainRate).toFixed(1)) : '', 일수: item.rainDay ? Number(Number(item.rainDay).toFixed(1)) : '', - 유입유량: item.inflAmnt ? Number(Number(item.inflAmnt).toFixed(1)) : '', - 시설용량대비: item.fctCpc ? Number(Number(item.fctCpc).toFixed(1)) : '', - 설계유입수질BOD: item.dsInflWqltBod ? Number(Number(item.dsInflWqltBod).toFixed(1)) : '', - 설계유입수질TOC: item.dsInflWqltCod ? Number(Number(item.dsInflWqltCod).toFixed(1)) : '', - 설계유입수질SS: item.dsInflWqltSs ? Number(Number(item.dsInflWqltSs).toFixed(1)) : '', - 설계유입수질TN: item.dsInflWqltTn ? Number(item.dsInflWqltTn).toFixed(3) : '', - 설계유입수질TP: item.dsInflWqltTp ? Number(item.dsInflWqltTp).toFixed(3) : '', - 유입수질BOD: item.inflAssctBfrWqltBod ? Number(Number(item.inflAssctBfrWqltBod).toFixed(1)) : '', - 유입수질TOC: item.inflAssctBfrWqltToc ? Number(Number(item.inflAssctBfrWqltToc).toFixed(1)) : '', - 유입수질SS: item.inflAssctBfrWqltSs ? Number(Number(item.inflAssctBfrWqltSs).toFixed(1)) : '', - 유입수질TN: item.inflAssctBfrWqltTn ? Number(item.inflAssctBfrWqltTn).toFixed(3) : '', - 유입수질TP: item.inflAssctBfrWqltTp ? Number(item.inflAssctBfrWqltTp).toFixed(3) : '', - 방류수질BOD: item.efflWqltBod ? Number(Number(item.efflWqltBod).toFixed(1)) : '', - 방류수질TOC: item.efflWqltToc ? Number(Number(item.efflWqltToc).toFixed(1)) : '', - 방류수질SS: item.efflWqltSs ? Number(Number(item.efflWqltSs).toFixed(1)) : '', - 방류수질TN: item.efflWqltTn ? Number(item.efflWqltTn).toFixed(3) : '', - 방류수질TP: item.efflWqltTp ? Number(item.efflWqltTp).toFixed(3) : '', + 유입유량: item.inflAmnt ? Number((Math.round(Number(item.inflAmnt) * 10) / 10).toFixed(1)) : '', + 시설용량대비: item.fctCpc ? (Math.round(Number(item.fctCpc) * 10) / 10).toFixed(1) : '', + 설계유입수질BOD: item.dsInflWqltBod ? (Math.round(Number(item.dsInflWqltBod) * 10) / 10).toFixed(1) : '', + 설계유입수질TOC: item.dsInflWqltCod ? (Math.round(Number(item.dsInflWqltCod) * 10) / 10).toFixed(1) : '', + 설계유입수질SS: item.dsInflWqltSs ? (Math.round(Number(item.dsInflWqltSs) * 10) / 10).toFixed(1) : '', + 설계유입수질TN: item.dsInflWqltTn ?(Math.round(Number(item.dsInflWqltTn) * 1000) / 1000).toFixed(3) : '', + 설계유입수질TP: item.dsInflWqltTp ? (Math.round(Number(item.dsInflWqltTp) * 1000) / 1000).toFixed(3) : '', + 유입수질BOD: item.inflAssctBfrWqltBod ? (Math.round(Number(item.inflAssctBfrWqltBod) * 10) / 10).toFixed(1) : '', + 유입수질TOC: item.inflAssctBfrWqltToc ? (Math.round(Number(item.inflAssctBfrWqltToc) * 10) / 10).toFixed(1) : '', + 유입수질SS: item.inflAssctBfrWqltSs ? (Math.round(Number(item.inflAssctBfrWqltSs) * 10) / 10).toFixed(1) : '', + 유입수질TN: item.inflAssctBfrWqltTn ? (Math.round(Number(item.inflAssctBfrWqltTn) * 1000) / 1000).toFixed(3) : '', + 유입수질TP: item.inflAssctBfrWqltTp ? (Math.round(Number(item.inflAssctBfrWqltTp) * 1000) / 1000).toFixed(3) : '', + 방류수질BOD: item.efflWqltBod ? (Math.round(Number(item.efflWqltBod) * 10) / 10).toFixed(1) : '', + 방류수질TOC: item.efflWqltToc ? (Math.round(Number(item.efflWqltToc) * 10) / 10).toFixed(1) : '', + 방류수질SS: item.efflWqltSs ? (Math.round(Number(item.efflWqltSs) * 10) / 10).toFixed(1) : '', + 방류수질TN: item.efflWqltTn ? (Math.round(Number(item.efflWqltTn) * 1000) / 1000).toFixed(3) : '', + 방류수질TP: item.efflWqltTp ? (Math.round(Number(item.efflWqltTp) * 1000) / 1000).toFixed(3) : '', }); }); } @@ -1872,12 +1894,12 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType) ...state, RainManage: isExcel ? { ...state.RainManage, - rainManageList: filteredData as RainManageListProps[], + rainManageList: filteredData as any[], excelList: excelList, isLoadingRainManage : false, } : { ...state.RainManage, - rainManageList: filteredData as RainManageListProps[], + rainManageList: filteredData as any[], isLoadingRainManage : false, } })); diff --git a/apps/fo/app/store/processFacility/index.tsx b/apps/fo/app/store/processFacility/index.tsx index 022c28c3e..988be1e46 100644 --- a/apps/fo/app/store/processFacility/index.tsx +++ b/apps/fo/app/store/processFacility/index.tsx @@ -676,7 +676,6 @@ export const processFacilityReducer:(set:SetStateFunction)=>ProcessFacilityActio item.plInflWqltBod = item.plInflWqltBod ? Number(item.plInflWqltBod).toFixed(1) : ''; item.dsInflWqltBod = item.dsInflWqltBod ? Number(item.dsInflWqltBod).toFixed(1) : ''; }) */ - console.log(res.data); set((state:ProcessFacilityType) => ({ ...state, ProcessFacilityList: { diff --git a/apps/fo/app/store/rdi/index.tsx b/apps/fo/app/store/rdi/index.tsx index 398c51a52..1dd1a6334 100644 --- a/apps/fo/app/store/rdi/index.tsx +++ b/apps/fo/app/store/rdi/index.tsx @@ -259,10 +259,11 @@ export const rdiReducer:(set:SetStateFunction)=>RdiActions=(set: SetStateFunctio }); calRainEffectDay(rtnWqltData, 'SUNNY'); - + const rtnWqltWinterData = rtnWqltData.filter((dataItem: any) => - dataItem.msrDt.substring(4, 6) === '01' || - dataItem.msrDt.substring(4, 6) === '02' + (dataItem.msrDt.substring(4, 6) === '01' || + dataItem.msrDt.substring(4, 6) === '02') && + dataItem.rainEffectDay == 0 ); rtnWqltWinterData.forEach((dataItem: any) => {