📄 cms032.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms032.SQC ** 所属子系统 : CMS ** 当前文件版本 : 4.0.0.0 ** 作者 : Feng ** 版本创建日期 : 2005/02/26 ** 功能描述 : 下传设备成功交易明细子交易 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include <errno.h>#include "sysdefine.h"#include <stdio.h>#include "code.h"#include "attrdef.h"#include "sysdef.h"#include "pubcom.h"#include "cmscode.h"#include "cmstxdet.h"EXEC SQL INCLUDE SQLCA;int cmsGetDevDetailInfPro( PUBCOM *pstPubcom ){ /*定义局部变量*/ int iRtn; /* 函数返回值 */ char acFrontDate[ DATE_LEN + 1 ]; /* 前置日期 */ char acTranDate[ DATE_LEN + 1 ]; /* 日期 */ char acFrontNo[ BIT9_LEN + 1 ]; /* 前置编号 */ char acTableName[ PRDCODE_LEN + 1]; /* 表名称 */ char acFileName[ RECBUF_LEN + 1]; /* 文件名称 */ FILE *pffp; struct cmstxdet stCmsTxdet; strcpy( g_acTrcMsg, "子交易: 下传设备成功交易明细子交易开始.." ); TRCLOG4 /* 初始化 */ memset( acFrontDate, 0x00, sizeof( acFrontDate ) ); memset( acFrontNo, 0x00, sizeof( acFrontNo ) ); memset( acFileName, 0x00, sizeof( acFileName ) ); memset( acTableName, 0x00, sizeof( acTableName ) ); /* 取数据字典值 */ getstring("QueryDate", acFrontDate); getstring("FrntNo", acFrontNo); strcpy( acTableName, "cms032" ); sprintf(acFileName, "%s/%s/%s%08ld", getenv("HOME"), getenv("FILDIR"), acTableName, pstPubcom->lSerSeqNo); strcpy( g_acTrcMsg, acFileName ); TRCLOG2 pffp = fopen( acFileName, "w" ); if ( pffp == NULL ) { strcpy( g_acRspCode, "DPS902" ); pubCrtRspInfo( ); ERRLOG return FAILED; } pubInitCmstxdet(); strcpy( cmstxdet_frntdate, acFrontDate ); strcpy( cmstxdet_frntno, acFrontNo ); EXEC SQL DECLARE rec_cur CURSOR FOR SELECT * FROM cmstxdet WHERE frntdate=:cmstxdet_frntdate AND frntno = :cmstxdet_frntno AND trandevtype not in ( '28', '97', '98', '30', '99' ) AND validf = '0' UNION SELECT * FROM cmstxdethis WHERE frntdate=:cmstxdet_frntdate AND frntno = :cmstxdet_frntno AND trandevtype not in ( '28', '97', '98', '30', '99' ) AND validf = '0'; SQLOPENCUR(rec_cur,"rec_cur") /* 打开游标错误 */ if ( SQLCODE ) { strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo( "cmstxdet", SQLCODE ); ERRLOG fclose( pffp ); return FAILED; } while ( 1 ) { pubInitCmstxdet(); memset( &stCmsTxdet, 0x00, sizeof( struct cmstxdet ) ); EXEC SQL FETCH rec_cur INTO R_CMSTXDET ; /* 取游标错误 */ if ( SQLCODE && SQLCODE != SQLNOTFOUND ) { strcpy( g_acRspCode, "CMS112" ); pubCrtRspInfo( "cmstxdet", SQLCODE ); ERRLOG SQLCLOSECUR(rec_cur,"rec_cur") fclose( pffp ); return FAILED; } /* 记录不存在 */ else if ( SQLCODE == SQLNOTFOUND ) { SQLCLOSECUR(rec_cur,"rec_cur") fclose( pffp ); break; } pubVtoSCmstxdet( &stCmsTxdet ); memset( acTranDate, 0x00, sizeof( acTranDate ) ); sprintf( acTranDate, "%4.4s%2.2s%2.2s", stCmsTxdet.trandate, stCmsTxdet.trandate+5, stCmsTxdet.trandate+8 ); memset( stCmsTxdet.trandate, 0x00, sizeof( stCmsTxdet.trandate ) ); strcpy( stCmsTxdet.trandate, acTranDate ); memset( acTranDate, 0x00, sizeof( acTranDate ) ); sprintf( acTranDate, "%4.4s%2.2s%2.2s", stCmsTxdet.frnttrandate, stCmsTxdet.frnttrandate+5, stCmsTxdet.frnttrandate+8 ); memset( stCmsTxdet.frnttrandate,0x00,sizeof(stCmsTxdet.frnttrandate) ); strcpy( stCmsTxdet.frnttrandate, acTranDate ); memset( acTranDate, 0x00, sizeof( acTranDate ) ); sprintf( acTranDate, "%4.4s%2.2s%2.2s", stCmsTxdet.frntdate, stCmsTxdet.frntdate+5, stCmsTxdet.frntdate+8 ); memset( stCmsTxdet.frntdate, 0x00, sizeof( stCmsTxdet.frntdate ) ); strcpy( stCmsTxdet.frntdate, acTranDate ); memset( acTranDate, 0x00, sizeof( acTranDate ) ); sprintf( acTranDate, "%4.4s%2.2s%2.2s", stCmsTxdet.settledate, stCmsTxdet.settledate+5, stCmsTxdet.settledate+8 ); memset( stCmsTxdet.settledate, 0x00, sizeof( stCmsTxdet.settledate ) ); strcpy( stCmsTxdet.settledate, acTranDate ); fprintf( pffp, "%s~%ld~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s" "~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%.2lf~%s~%.2lf" "~%s~%.2lf~%s~%s~%s~%s~%s~%s~%s~%.2lf~%.2lf~%.2lf" "~%.2lf~%.2lf~%.2lf~%.2lf~%.2lf~%s\n", stCmsTxdet.trandate, stCmsTxdet.serseqno, stCmsTxdet.teller, stCmsTxdet.brc, stCmsTxdet.frnttrandate, stCmsTxdet.frnttime, stCmsTxdet.frntstan, stCmsTxdet.frntno, stCmsTxdet.frntdate, stCmsTxdet.frnttrancode, stCmsTxdet.settledate, stCmsTxdet.devstan, stCmsTxdet.origfrntstan, stCmsTxdet.seqno, stCmsTxdet.subseqno, stCmsTxdet.operkind, stCmsTxdet.opflag, stCmsTxdet.trancode, stCmsTxdet.cardno1, stCmsTxdet.acctno1, stCmsTxdet.subacct1, stCmsTxdet.acctseqno1, stCmsTxdet.issuebrc1, stCmsTxdet.cardno2, stCmsTxdet.acctno2, stCmsTxdet.subacct2, stCmsTxdet.acctseqno2, stCmsTxdet.issuebrc2, stCmsTxdet.tranamt, stCmsTxdet.ccy, stCmsTxdet.amt2, stCmsTxdet.ccy2, stCmsTxdet.amt3, stCmsTxdet.ccy3, stCmsTxdet.trandevtype, stCmsTxdet.cardtrantype, stCmsTxdet.trankind, stCmsTxdet.mid, stCmsTxdet.devid, stCmsTxdet.validf, stCmsTxdet.delaychg, stCmsTxdet.bankgetfee, stCmsTxdet.custsharefee, stCmsTxdet.banksharefee, stCmsTxdet.bankassfee, stCmsTxdet.bankpayfee, stCmsTxdet.assfee1, stCmsTxdet.assfee2, " " ); } /* 子交易出口 */ sprintf( pstPubcom->acFileName, "%s/%s%08ld", getenv("FILDIR"), acTableName, pstPubcom->lSerSeqNo ); setpubdata ( "FileFlag" , "2" , 0 , 0 ); setpubdata ( "FileName" , pstPubcom->acFileName, 0 , 0 ); strcpy( g_acTrcMsg, "子交易: 下传设备成功交易明细子交易结束.." ); TRCLOG4 strcpy( g_acRspCode, RSP_OK ); return SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -