대시보드 하절기 강우시 유입하수량 수정 완료
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
*/
|
||||
|
||||
import { getFetch } from "@/app/components/api";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import DataForm from "@/app/components/common/DataForm";
|
||||
import { fetchPlanInfo, OSU_PERCENT, roundUp } from "../common";
|
||||
import type { FacilityWaterQltyProps } from "../facilityWaterQlty";
|
||||
import { type ApiResponse, type FlowDataItem } from "../underWaterInput";
|
||||
import CalcRainEffect from "@/app/components/common/CalcRainEffect";
|
||||
import { fetchFlowRateModalList } from "../flowRate";
|
||||
import { type FlowDataItem } from "../underWaterInput";
|
||||
|
||||
// selectBox
|
||||
export type SelectDataType = {
|
||||
@@ -1124,6 +1125,8 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
let winterSunnyMin = 1;
|
||||
let winterSunnyAvg = 1;
|
||||
let winterSunnyMax = 1;
|
||||
|
||||
let summerRainInflAmnt = 1;
|
||||
|
||||
if(data && operationalStatusList){
|
||||
// 유량 - 유입
|
||||
@@ -1201,9 +1204,12 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
let minWinterChungchunSumFlow = 9999999;
|
||||
let maxWinterChungchunSumFlow = 0;
|
||||
|
||||
// 하수유입량 수정
|
||||
let summerRainDayFlow = 0;
|
||||
|
||||
// 연계처리수,지하수유입량
|
||||
const bscFctCd = fcltyCd;
|
||||
const res2 = await getFetch('fo', '/fclt/flow/' + bscFctCd + '/' + searchYear) as ApiResponse;
|
||||
const res2 = await fetchFlowRateModalList(bscFctCd, searchYear);
|
||||
yearDay = res2.data?res2.data.length:1;
|
||||
res2.data.forEach((item: FlowDataItem) => {
|
||||
yearSumFlow += item.sumFlow && item.sumFlow !== 'x' ? Number(item.sumFlow.toString().trim()) : 0;
|
||||
@@ -1222,8 +1228,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
}
|
||||
});
|
||||
|
||||
const calData = CalcRainEffect(res2.data, 'SUNNY');
|
||||
const calRainDate = CalcRainEffect(res2.data, 'RAIN');
|
||||
const clone = (arr: any[]) => arr?.map(v => ({ ...v })) ?? [];
|
||||
const calData = CalcRainEffect(clone(res2.data), 'SUNNY');
|
||||
const calRainDate = CalcRainEffect(clone(res2.data), 'RAIN', 'RAIN_DAY');
|
||||
|
||||
// 지하수유입량 - 청천시 기준
|
||||
let chungcunSumFlow = 0;
|
||||
@@ -1254,8 +1261,10 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
// 하절기 강우시 계산
|
||||
calRainDate.forEach((flowItem: FlowDataItem) => {
|
||||
if(flowItem.msrDt.substring(4,6) === '06' || flowItem.msrDt.substring(4,6) === '07' || flowItem.msrDt.substring(4,6) === '08') {
|
||||
console.log('rainDay : ', flowItem.msrDt);
|
||||
summerRainDay += 1;
|
||||
summerRainDaySumFlow += flowItem.sumFlow && flowItem.sumFlow !== 'x' ? Number(flowItem.sumFlow.toString().trim()) : 0;
|
||||
summerRainDayFlow += flowItem.inflAmnt && flowItem.inflAmnt !== 'x' ? Number(flowItem.inflAmnt.toString().trim()) : 0;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1271,6 +1280,9 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
winterSunnyAvg = winterChungchunSumFlow&&Number(winterChungchunSumFlow)!=0?(winterChungchunSumFlow / winterChungchuDay):0;
|
||||
winterSunnyMax = maxWinterChungchunSumFlow;
|
||||
|
||||
// 하수유입량 (청천, 강우시)
|
||||
summerRainInflAmnt = summerRainDayFlow&&Number(summerRainDayFlow)!=0?Number(summerRainDayFlow / summerRainDay):0;
|
||||
|
||||
operationalStatusList[0].yearAvg = roundUp(Number(operationalStatusList[0].yearAvg), 0) + roundUp(yearAvgSumFlow, 0);
|
||||
operationalStatusList[0].yearMax = roundUp(Number(operationalStatusList[0].yearMax), 0) + roundUp(yearMaxSumFlow, 0);
|
||||
operationalStatusList[0].yearMin = roundUp(Number(operationalStatusList[0].yearMin), 0) + roundUp(yearMinSumFlow, 0);
|
||||
@@ -1332,6 +1344,11 @@ export const dashBoardReducer:(set:(fn: (state: DashBoardType) => DashBoardType)
|
||||
}
|
||||
}
|
||||
|
||||
if(operationalStatusList[1]){
|
||||
operationalStatusList[1].summerThree = summerRainInflAmnt;
|
||||
dataFormSetting(operationalStatusList[1]);
|
||||
}
|
||||
|
||||
if(operationalStatusList[2]){
|
||||
operationalStatusList[2].yearAvg = yearAvgSumFlow;
|
||||
operationalStatusList[2].yearMax = yearMaxSumFlow;
|
||||
|
||||
Reference in New Issue
Block a user