📄 cms558.sqc
字号:
/******************************************************************** * 源码文件名称 : cms558.SQC ** 所属子系统 : CMS ** 当前文件版本 : 4.0.0.0 ** 作者 : Feng ** 版本创建日期 : 2004/09/21 ** 功能描述 : 卡交易限额管理处理子交易 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include "code.h"#include "attrdef.h"#include "sysdef.h"#include "pubcom.h"#include "cmscode.h"#include "cmscardinfo.h"#include "cmstlimt.h"#include "cmstlimtm.h"#include "cmsacctm.h"EXEC SQL INCLUDE SQLCA;int cmsCardTranLimitAmtPro( PUBCOM *pstPubcom ){ /*定义局部变量*/ struct cmscardinfo stCmsCardInfo; /* 卡片信息表 */ struct cmstlimt stCmsTLimt; /* 卡片交易限额表 */ struct cmstlimtm stCmsTLimtM; /* 交易限额调整登记簿 */ struct cmsacctm stCmsAcctM; /* 卡账户对照表 */ char acCardStat[ BIT21_LEN ][BIT11_LEN]; /* 卡状态检查标志 */ char acPasswd[ PASSWD_LEN + 1 ]; /* 密码 */ int iRtn; /* 函数返回值 */ int iNumx; /* 数组计数器 */ int iNumy; /* 数组计数器 */ strcpy( g_acTrcMsg, "子交易: 卡交易限额管理处理开始.." ); TRCLOG4 /* 初始化 */ memset( &stCmsCardInfo, 0x00, sizeof( struct cmscardinfo ) ); memset( &stCmsTLimt, 0x00, sizeof( struct cmstlimt ) ); memset( &stCmsTLimtM, 0x00, sizeof( struct cmstlimtm ) ); memset( &stCmsAcctM, 0x00, sizeof( struct cmsacctm ) ); memset( acPasswd, 0x00, sizeof( acPasswd ) ); /* 卡检查状态数组全置未不检查 */ for ( iNumx = 0; iNumx < BIT21_LEN; iNumx ++ ) for ( iNumy = 0; iNumy < BIT11_LEN; iNumy ++ ) acCardStat[iNumx][iNumy] = CHECK_NO; /* 取数据字典值 */ getstring( "CardNo", stCmsCardInfo.cardno ); /* 获取卡片信息表 */ iRtn = pubReadCmscardinfo( &stCmsCardInfo ); if ( iRtn ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "卡号[%s]不存在", stCmsCardInfo.cardno ); ERRLOG return FAILED; } /* 检查卡号是否为主卡 */ iRtn = cmsApiChkCardNoIsMain( &stCmsCardInfo ); if ( iRtn ) { ERRLOG return FAILED; } /* 从字典获取其他数据 */ getstring( "Passwd", acPasswd ); /* 检查卡状态是否正常 */ acCardStat[ BIT1_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查销卡 */ acCardStat[ BIT2_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查书挂 */ acCardStat[ BIT3_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查密挂 */ acCardStat[ BIT5_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查吞卡 */ acCardStat[ BIT6_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查拣拾 */ acCardStat[ BIT8_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查挂失补发 */ acCardStat[ BIT9_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查锁卡 */ acCardStat[ BIT13_LEN ][ BIT1_LEN ] = CHECK_YES; /* 检查欠费 */ acCardStat[ BIT14_LEN ][ BIT1_LEN ] = CHECK_YES; iRtn = cmsApiChkCardStatIsNormal( &stCmsCardInfo, acCardStat ); if ( iRtn ) { ERRLOG return FAILED; } /* 检查卡密码 */ iRtn = cmsApiChkCardPwd( &stCmsCardInfo, acPasswd, pstPubcom->acChannelId ); if ( iRtn ) { ERRLOG return FAILED; } /* 获取上传的业务发生地类型、币种和周期长度 */ getstring( "TranDevType", stCmsTLimt.trandevtype ); getstring( "Ccy", stCmsTLimt.ccy ); getint ( "Period", &stCmsTLimt.period ); /*按卡号、设备交易类型、币种、周期长度获取卡的交易限额表记录*/ strcpy( stCmsTLimt.cardno, stCmsCardInfo.cardno ); pubStoVCmstlimt( &stCmsTLimt ); EXEC SQL DECLARE Lmt_l_cur CURSOR FOR SELECT * FROM CMSTLIMT WHERE cardno = :cmstlimt_cardno AND ccy = :cmstlimt_ccy AND period = :cmstlimt_period AND trandevtype = :cmstlimt_trandevtype FOR UPDATE; /* 定义游标错误 */ if ( SQLCODE ) { strcpy( g_acRspCode, "CMS110" ); pubCrtRspInfo( "cmstlimt", SQLCODE ); ERRLOG return FAILED; } SQLOPENCUR(Lmt_l_cur,"Lmt_l_cur") /* 打开游标错误 */ if ( SQLCODE ) { strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo( "cmstlimt", SQLCODE ); ERRLOG return FAILED; } pubInitCmstlimt(); EXEC SQL FETCH Lmt_l_cur INTO R_CMSTLIMT ; /* 取游标错误 */ if ( SQLCODE && SQLCODE != SQLNOTFOUND ) { strcpy( g_acRspCode, "CMS112" ); pubCrtRspInfo( "cmstlimt", SQLCODE ); ERRLOG SQLCLOSECUR(Lmt_l_cur,"Lmt_l_cur") return FAILED; } /* 记录不存在 */ else if ( SQLCODE == SQLNOTFOUND ) { SQLCLOSECUR(Lmt_l_cur,"Lmt_l_cur") /* 增加新的纪录 */ strcpy( stCmsTLimt.cardno, stCmsCardInfo.cardno ); getstring( "TranDevType", stCmsTLimt.trandevtype ); getstring( "Ccy", stCmsTLimt.ccy ); getint( "Period", &stCmsTLimt.period ); getdouble("Amt1", &stCmsTLimt.cashlimitamt ); getdouble("Amt2", &stCmsTLimt.depolimitamt ); getdouble("Amt3", &stCmsTLimt.conlimitamt ); getdouble("Amt4", &stCmsTLimt.tranoutlimitamt ); getint( "Times1", &stCmsTLimt.cashlimittime ); getint( "Times2", &stCmsTLimt.depolimittime ); getint( "Times3", &stCmsTLimt.conlimittime ); getint( "Times4", &stCmsTLimt.tranoutlimittime); /* 插入卡片交易限额表 */ iRtn = pubInstCmstlimt( &stCmsTLimt ); if ( iRtn ) { ERRLOG return FAILED; } } /* 记录存在 */ else { pubVtoSCmstlimt( &stCmsTLimt ); /* 修改记录 */ getdouble("Amt1", &stCmsTLimt.cashlimitamt ); getdouble("Amt2", &stCmsTLimt.depolimitamt ); getdouble("Amt3", &stCmsTLimt.conlimitamt ); getdouble("Amt4", &stCmsTLimt.tranoutlimitamt ); getint( "Times1", &stCmsTLimt.cashlimittime ); getint( "Times2", &stCmsTLimt.depolimittime ); getint( "Times3", &stCmsTLimt.conlimittime ); getint( "Times4", &stCmsTLimt.tranoutlimittime); /* 修改卡片交易限额表 */ pubStoVCmstlimt( &stCmsTLimt ); EXEC SQL UPDATE CMSTLIMT SET ( U_CMSTLIMT ) = ( W_CMSTLIMT ) WHERE CURRENT OF Lmt_l_cur; if ( SQLCODE ) { strcpy( g_acRspCode, "CMS114" ); pubCrtRspInfo( "cmstlimt", SQLCODE ); ERRLOG SQLCLOSECUR(Lmt_l_cur,"Lmt_l_cur") return FAILED; } SQLCLOSECUR(Lmt_l_cur,"Lmt_l_cur") } /* 为增加卡交易限额调整登记簿做赋值准备 */ strcpy( stCmsTLimtM.cardno, stCmsTLimt.cardno ); strcpy( stCmsTLimtM.ccy, stCmsTLimt.ccy ); strcpy( stCmsTLimtM.trandevtype,stCmsTLimt.trandevtype ); stCmsTLimtM.period = stCmsTLimt.period; stCmsTLimtM.cashlimitamt = stCmsTLimt.cashlimitamt; stCmsTLimtM.depolimitamt = stCmsTLimt.depolimitamt; stCmsTLimtM.conlimitamt = stCmsTLimt.conlimitamt; stCmsTLimtM.tranoutlimitamt = stCmsTLimt.tranoutlimitamt; stCmsTLimtM.cashlimittime = stCmsTLimt.cashlimittime; stCmsTLimtM.depolimittime = stCmsTLimt.depolimittime; stCmsTLimtM.conlimittime = stCmsTLimt.conlimittime; stCmsTLimtM.tranoutlimittime = stCmsTLimt.tranoutlimittime; strcpy( stCmsTLimtM.trandate, pstPubcom->acTranDate ); stCmsTLimtM.serseqno = pstPubcom->lSerSeqNo; sprintf( stCmsTLimtM.vouchno, "%s%0*ld", pstPubcom->acTranDate8, \ SERSEQNO_LEN, stCmsTLimtM.serseqno ); getstring( "IdType", stCmsTLimtM.idtype ); getstring( "IdNo", stCmsTLimtM.idcode ); getstring( "CustomName", stCmsTLimtM.custname ); strcpy( stCmsTLimtM.issuebrc, stCmsCardInfo.issuebrc ); strcpy( stCmsTLimtM.teller, stCmsCardInfo.teller ); strcpy( stCmsTLimtM.cardkind, stCmsCardInfo.cardkind ); strcpy( stCmsTLimtM.lmtbrc, pstPubcom->acBrc ); strcpy( stCmsTLimtM.lmtteller, pstPubcom->acTeller ); strcpy( stCmsTLimtM.lmtauthteller, pstPubcom->acAteller ); /* 插入卡交易限额调整登记簿 */ iRtn = pubInstCmstlimtm( &stCmsTLimtM ); if ( iRtn ) { ERRLOG return FAILED; } /* 是否写子交易流水 */ iRtn = cmsApiInsTranLog( pstPubcom, &stCmsCardInfo, &stCmsAcctM, "调整", "卡交易限额管理" ); if ( iRtn ) { ERRLOG return FAILED; } /* 子交易出口 */ setstring( "VouchNo", stCmsTLimtM.vouchno ); /* 登记簿编号 */ strcpy( g_acTrcMsg, "子交易: 卡交易限额管理处理结束.." ); TRCLOG4 strcpy( g_acRspCode, RSP_OK ); return SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -