[st] - feat: 입력 04 작업 중 & 수정 요청 사항 적용
This commit is contained in:
@@ -179,6 +179,29 @@ export function createSwrgInstlrtRateValueCallback(
|
||||
};
|
||||
}
|
||||
|
||||
/** 총양수량: Σ(펌프대수 + 예비펌프대수) × 대당 양수량 */
|
||||
export function createPumpGrossPpqtyValueCallback(
|
||||
pumpGroups: Array<{
|
||||
pumpCntField: string;
|
||||
rsrvPumpCntField: string;
|
||||
perPpqtyField: string;
|
||||
}>,
|
||||
): DataFieldValueCallback {
|
||||
return (_prod, _dataRow, _fieldName, fieldNamesArr, values) => {
|
||||
let total = 0;
|
||||
for (const group of pumpGroups) {
|
||||
const pumpIdx = fieldNamesArr.indexOf(group.pumpCntField);
|
||||
const rsrvIdx = fieldNamesArr.indexOf(group.rsrvPumpCntField);
|
||||
const perIdx = fieldNamesArr.indexOf(group.perPpqtyField);
|
||||
const pumpCnt = pumpIdx >= 0 ? toNum(values[pumpIdx]) : 0;
|
||||
const rsrvCnt = rsrvIdx >= 0 ? toNum(values[rsrvIdx]) : 0;
|
||||
const perPpqty = perIdx >= 0 ? toNum(values[perIdx]) : 0;
|
||||
total += (pumpCnt + rsrvCnt) * perPpqty;
|
||||
}
|
||||
return total;
|
||||
};
|
||||
}
|
||||
|
||||
/** 연산 타입에 맞는 valueCallback 반환 */
|
||||
export function getComputedValueCallback(config: ComputedFieldConfig): DataFieldValueCallback {
|
||||
switch (config.type) {
|
||||
@@ -209,5 +232,7 @@ export function getComputedValueCallback(config: ComputedFieldConfig): DataField
|
||||
return createCoverageRateValueCallback(config.numeratorFields, config.denominatorFields);
|
||||
case 'swrgInstlrtRate':
|
||||
return createSwrgInstlrtRateValueCallback(config.numeratorFields, config.denominatorFields, config.thirdFields);
|
||||
case 'pumpGrossPpqty':
|
||||
return createPumpGrossPpqtyValueCallback(config.pumpGroups);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user