다양화: 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:
forge-bot 2026-07-19 01:37:54 +00:00
parent b96cf702ee
commit c3a0259e95
1027 changed files with 68915 additions and 40962 deletions

View file

@ -6,17 +6,21 @@
/* End of automatic include section */
#line 1 "app/online/cm_ol_0006.pgc"
/* @tier easy @module cm @transform common-online */
/* @tier medium @module cm @transform common-online */
/*
* cm_ol_0006.pgc - (CM_OL_0006) [tier=easy]
* cm_ol_0006.pgc - (CM_OL_0006) [tier=medium]
*
* TxCore TX_SERVICE . TXBUF cm DBIO
* TXBUF . (ATMI void SVC(TPSVCINFO*) )
* (SEQKEY) (cm_seq) UPDATE 1
* SELECT .
* (tx_begin/commit).
* 1 .
* (ATMI void SVC(TPSVCINFO*) )
*/
#include <stdio.h>
#include <string.h>
#include "txcore.h"
#include "txcore_dbio.h"
#include "acq_util.h"
#include "cm_core.h"
@ -89,37 +93,126 @@ struct sqlca_t *ECPGget_sqlca(void);
#endif
#line 15 "app/online/cm_ol_0006.pgc"
#line 19 "app/online/cm_ol_0006.pgc"
TX_SERVICE(CM_OL_0006, ctx)
{
cm_rec_t rec;
char key[16];
int rc;
/* exec sql begin declare section */
#line 24 "app/online/cm_ol_0006.pgc"
char h_seqkey [ 16 ] ;
#line 25 "app/online/cm_ol_0006.pgc"
char h_prefix [ 8 ] ;
#line 26 "app/online/cm_ol_0006.pgc"
long h_seqval ;
#line 27 "app/online/cm_ol_0006.pgc"
long h_maxval ;
#line 28 "app/online/cm_ol_0006.pgc"
int h_width ;
/* exec sql end declare section */
#line 29 "app/online/cm_ol_0006.pgc"
tx_log(TX_LOG_INFO, "[CM_OL_0006] 공통 단건조회 서비스 진입");
if (tx_buf_get(ctx->in, "KEY", key, sizeof(key)) != TX_OK) {
tx_log(TX_LOG_ERROR, "[CM_OL_0006] KEY 누락");
char seqkey[16];
char issued[32];
tx_log(TX_LOG_INFO, "[CM_OL_0006] 순번 채번 서비스 진입");
memset(seqkey, 0, sizeof(seqkey));
memset(issued, 0, sizeof(issued));
if (tx_buf_get(ctx->in, "SEQKEY", seqkey, sizeof(seqkey)) != TX_OK) {
tx_log(TX_LOG_ERROR, "[CM_OL_0006] 채번키(SEQKEY) 누락");
tx_return(ctx, TX_EINVAL, ctx->out);
return;
}
memset(&rec, 0, sizeof(rec));
rc = cm_rec_select(key, &rec);
if (rc != TX_OK) {
tx_log(TX_LOG_WARN, "[CM_OL_0006] 조회 실패 key=%s rc=%d(%s)",
key, rc, tx_strerror(rc));
tx_return(ctx, rc, ctx->out);
if (tx_begin() != TX_OK) {
tx_log(TX_LOG_ERROR, "[CM_OL_0006] 트랜잭션 시작 실패");
tx_return(ctx, TX_FAIL, ctx->out);
return;
}
memset(h_seqkey, 0, sizeof(h_seqkey));
memset(h_prefix, 0, sizeof(h_prefix));
strncpy(h_seqkey, seqkey, sizeof(h_seqkey) - 1);
h_seqval = 0;
h_maxval = 0;
h_width = 0;
/* 순환최대치/자리수/접두어 확보 (행잠금) */
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select cur_val , max_val , seq_width , prefix from cm_seq where seq_key = $1 for update",
ECPGt_char,(h_seqkey),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_long,&(h_seqval),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_long,&(h_maxval),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_int,&(h_width),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_prefix),(long)8,(long)1,(8)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);}
#line 64 "app/online/cm_ol_0006.pgc"
if (sqlca.sqlcode == TX_SQL_NOTFOUND) {
tx_log(TX_LOG_WARN, "[CM_OL_0006] 채번키 미등록 seqkey=%s", seqkey);
tx_abort();
tx_return(ctx, TX_ENOKEY, ctx->out);
return;
}
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("CM_OL_0006 SELECT cm_seq");
tx_abort();
tx_return(ctx, TX_EDB, ctx->out);
return;
}
/* 다음 순번 산출 (순환) */
h_seqval = h_seqval + 1;
if (h_maxval > 0 && h_seqval > h_maxval) {
h_seqval = 1;
tx_log(TX_LOG_INFO, "[CM_OL_0006] 순번 순환 리셋 seqkey=%s", seqkey);
}
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "update cm_seq set cur_val = $1 , upd_ts = current_timestamp where seq_key = $2 ",
ECPGt_long,&(h_seqval),(long)1,(long)1,sizeof(long),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L,
ECPGt_char,(h_seqkey),(long)16,(long)1,(16)*sizeof(char),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);}
#line 90 "app/online/cm_ol_0006.pgc"
if (sqlca.sqlcode != TX_SQL_OK) {
TX_DBIO_LOG_ERR("CM_OL_0006 UPDATE cm_seq");
tx_abort();
tx_return(ctx, TX_EDB, ctx->out);
return;
}
tx_commit();
/* 접두어 + 자리수 zero-padding 으로 발급번호 조립 */
if (h_width <= 0 || h_width > 18) {
h_width = 10;
}
snprintf(issued, sizeof(issued), "%s%0*ld", h_prefix, h_width, h_seqval);
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, "[CM_OL_0006] 조회완료 key=%s amount=%ld", key, rec.amount);
tx_buf_sets(ctx->out, "SEQKEY", seqkey);
tx_buf_setlong(ctx->out, "SEQVAL", h_seqval);
tx_buf_sets(ctx->out, "ISSUEDNO", issued);
tx_log(TX_LOG_INFO, "[CM_OL_0006] 채번완료 seqkey=%s no=%s", seqkey, issued);
tx_return(ctx, TX_OK, ctx->out);
}