다양화: 530개 online/batch 프로그램을 모듈별 고유 실업무 로직으로 재작성
- 템플릿 클론(정규화 후 0줄 상이) → 전 코퍼스 530/530 고유 바디 - 11개 모듈(mg/au/ac/rc/vl/st/py/lg/mm/cm/cl) 각 파일이 distinct한 매입·대사·정산·수수료·지급·원장·마감·마스터·정합성·전문게이트웨이·공통 업무 - TxCore(ATMI 유사) + ECPG(EXEC SQL) 관용구, 프레임워크/헤더/DBIO API/파일ID·경로 유지 - 전체 docker make -j4 = EXIT 0, 958 오브젝트, 데모 바이너리 링크 - inventory.json loc 실측 갱신 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b96cf702ee
commit
c3a0259e95
1027 changed files with 68915 additions and 40962 deletions
|
|
@ -1,9 +1,17 @@
|
|||
/* @tier easy @module rc @transform reconciliation-online */
|
||||
/*
|
||||
* rc_ol_0030.pgc - 대사 온라인 서비스 (RC_OL_0030) [tier=easy]
|
||||
* rc_ol_0030.pgc - 대사 취소 온라인 서비스 (RC_OL_0030)
|
||||
*
|
||||
* TxCore TX_SERVICE 엔트리. 요청 TXBUF 를 검증하고 rc 표준 DBIO 를
|
||||
* 통해 처리한 뒤 응답 TXBUF 를 구성한다. (ATMI void SVC(TPSVCINFO*) 대응)
|
||||
* 요청 KEY 의 원장 1건에 대해 대사(매입/불일치) 결과를 취소하여 접수('R')
|
||||
* 상태로 되돌린다. 오취소를 막기 위해 확인 플래그(CFMFLAG="Y") 를 요구한다.
|
||||
*
|
||||
* 업무규칙:
|
||||
* - CFMFLAG != "Y" → RESULT=NOCONFIRM, 상태 변경 없음 (TX_OK)
|
||||
* - status == 정산완료('S') → RESULT=REJECT, 취소 불가 (상태 유지)
|
||||
* - status in {'M','U'} → 접수('R') 로 전이, RESULT=CANCELLED
|
||||
* - 그 외(이미 'R' 등) → RESULT=REJECT (취소 대상 아님)
|
||||
*
|
||||
* 응답: KEY, OLDSTATUS, NEWSTATUS, RESULT (조건부 갱신)
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -18,30 +26,95 @@ TX_SERVICE(RC_OL_0030, ctx)
|
|||
{
|
||||
rc_rec_t rec;
|
||||
char key[16];
|
||||
char cfmflag[4];
|
||||
char oldstatus[2];
|
||||
const char *newstatus;
|
||||
const char *result;
|
||||
int rc;
|
||||
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0030] 대사 단건조회 서비스 진입");
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0030] 대사 취소 서비스 진입");
|
||||
|
||||
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[RC_OL_0030] KEY 누락");
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
if (tx_buf_get(ctx->in, "CFMFLAG", cfmflag, sizeof(cfmflag)) != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[RC_OL_0030] CFMFLAG(확인 플래그) 누락");
|
||||
tx_return(ctx, TX_EINVAL, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&rec, 0, sizeof(rec));
|
||||
rc = rc_rec_select(key, &rec);
|
||||
if (rc != TX_OK) {
|
||||
tx_log(TX_LOG_WARN, "[RC_OL_0030] 조회 실패 key=%s rc=%d(%s)",
|
||||
tx_log(TX_LOG_WARN, "[RC_OL_0030] 원장 조회 실패 key=%s rc=%d(%s)",
|
||||
key, rc, tx_strerror(rc));
|
||||
tx_return(ctx, rc, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(oldstatus, 0, sizeof(oldstatus));
|
||||
strncpy(oldstatus, rec.status, sizeof(oldstatus) - 1);
|
||||
newstatus = oldstatus; /* 기본: 변경 없음 */
|
||||
|
||||
/* --- 확인 플래그 미승인 → 변경 없이 종료 --- */
|
||||
if (strcmp(cfmflag, "Y") != 0) {
|
||||
result = "NOCONFIRM";
|
||||
tx_log(TX_LOG_WARN,
|
||||
"[RC_OL_0030] 확인 플래그 미승인 key=%s flag=%s → 취소 보류",
|
||||
key, cfmflag);
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "KEY", rec.key);
|
||||
tx_buf_sets(ctx->out, "OLDSTATUS", oldstatus);
|
||||
tx_buf_sets(ctx->out, "NEWSTATUS", newstatus);
|
||||
tx_buf_sets(ctx->out, "RESULT", result);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
/* --- 정산완료 건은 취소 불가 --- */
|
||||
if (strcmp(rec.status, RC_ST_SETTLED) == 0) {
|
||||
result = "REJECT";
|
||||
tx_log(TX_LOG_WARN,
|
||||
"[RC_OL_0030] 정산완료 취소불가 key=%s status=S", key);
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "KEY", rec.key);
|
||||
tx_buf_sets(ctx->out, "OLDSTATUS", oldstatus);
|
||||
tx_buf_sets(ctx->out, "NEWSTATUS", newstatus);
|
||||
tx_buf_sets(ctx->out, "RESULT", result);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
return;
|
||||
}
|
||||
|
||||
/* --- 매입확정/불일치 건만 접수('R') 로 되돌림 --- */
|
||||
if (strcmp(rec.status, RC_ST_DONE) == 0 ||
|
||||
strcmp(rec.status, RC_ST_FAIL) == 0) {
|
||||
rc = rc_rec_update_status(key, RC_ST_RECV);
|
||||
if (rc != TX_OK) {
|
||||
tx_log(TX_LOG_ERROR, "[RC_OL_0030] 취소 전이 실패 key=%s rc=%d",
|
||||
key, rc);
|
||||
tx_return(ctx, rc, ctx->out);
|
||||
return;
|
||||
}
|
||||
newstatus = RC_ST_RECV;
|
||||
result = "CANCELLED";
|
||||
tx_log(TX_LOG_INFO,
|
||||
"[RC_OL_0030] 대사 취소 완료 key=%s %s→R", key, oldstatus);
|
||||
} else {
|
||||
result = "REJECT";
|
||||
tx_log(TX_LOG_WARN,
|
||||
"[RC_OL_0030] 취소 대상 아님 key=%s status=%s",
|
||||
key, oldstatus);
|
||||
}
|
||||
|
||||
tx_buf_reset(ctx->out);
|
||||
tx_buf_sets(ctx->out, "KEY", rec.key);
|
||||
tx_buf_sets(ctx->out, "MERCHID", rec.merch_id);
|
||||
tx_buf_setlong(ctx->out, "AMOUNT", rec.amount);
|
||||
tx_buf_sets(ctx->out, "STATUS", rec.status);
|
||||
tx_log(TX_LOG_INFO, "[RC_OL_0030] 조회완료 key=%s amount=%ld", key, rec.amount);
|
||||
tx_buf_sets(ctx->out, "OLDSTATUS", oldstatus);
|
||||
tx_buf_sets(ctx->out, "NEWSTATUS", newstatus);
|
||||
tx_buf_sets(ctx->out, "RESULT", result);
|
||||
tx_log(TX_LOG_INFO,
|
||||
"[RC_OL_0030] 대사 취소 서비스 종료 key=%s %s→%s 결과=%s",
|
||||
key, oldstatus, newstatus, result);
|
||||
tx_return(ctx, TX_OK, ctx->out);
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue