summaryrefslogtreecommitdiff
path: root/lib/soap/ecc/mapper
diff options
context:
space:
mode:
Diffstat (limited to 'lib/soap/ecc/mapper')
-rw-r--r--lib/soap/ecc/mapper/po-mapper.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/soap/ecc/mapper/po-mapper.ts b/lib/soap/ecc/mapper/po-mapper.ts
index a6363a87..6e282b98 100644
--- a/lib/soap/ecc/mapper/po-mapper.ts
+++ b/lib/soap/ecc/mapper/po-mapper.ts
@@ -98,10 +98,20 @@ export async function mapECCPOHeaderToBusiness(
}
};
+ // projectId와 vendorId 필수 체크
+ if (!projectId) {
+ debugError('프로젝트를 찾을 수 없어 매핑을 건너뜁니다', { pspid: eccHeader.PSPID });
+ throw new Error(`프로젝트를 찾을 수 없습니다: PSPID=${eccHeader.PSPID}`);
+ }
+ if (!vendorId) {
+ debugError('벤더를 찾을 수 없어 매핑을 건너뜁니다', { lifnr: eccHeader.LIFNR });
+ throw new Error(`벤더를 찾을 수 없습니다: LIFNR=${eccHeader.LIFNR}`);
+ }
+
// 매핑
const mappedData: ContractData = {
- projectId: projectId || 1, // TODO: 기본값 설정, 실제로는 유효한 projectId 필요
- vendorId: vendorId || 1, // TODO: 기본값 설정, 실제로는 유효한 vendorId 필요
+ projectId,
+ vendorId,
contractNo: eccHeader.EBELN || '',
contractName: eccHeader.ZTITLE || eccHeader.EBELN || '',
status: eccHeader.ZPO_CNFM_STAT || 'ACTIVE',
@@ -249,14 +259,14 @@ export async function mapECCPODetailToBusiness(
const calculatedTaxAmount = (unitPriceNum * quantity * taxRateNum) / 100;
taxAmount = calculatedTaxAmount.toString();
} catch (error) {
- debugError('세액 계산 오류', { unitPrice, taxRate, quantity, error });
+ debugError('세액(taxAmount) 계산 오류((unitPriceNum * quantity * taxRateNum) / 100)', { unitPrice, taxRate, quantity, error });
}
}
// 매핑
const mappedData: ContractItemData = {
contractId,
- itemId: itemId || 1, // TODO: 기본값 설정, 실제로는 유효한 itemId 필요
+ itemId: itemId!, // 아이템이 없으면 자동 생성되므로 null이 될 수 없음
description: eccDetail.MAKTX || null,
quantity,
unitPrice,