📄 cms302.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms302.SQC ** 所属子系统 : CMS ** 当前文件版本 : 4.0.0.0 ** 作者 : ALex ** 版本创建日期 : 2004/10/09 ** 功能描述 : 附卡申请处理子交易 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include "code.h"#include "attrdef.h"#include "sysdef.h"#include "pubcom.h"#include "cmscode.h"#include "cmscardinfo.h"#include "cmscardkind.h"#include "cmsacctm.h"#include "ciscustomerinfo.h"EXEC SQL INCLUDE SQLCA;int cmsOpenAcceCardPro( PUBCOM *pstPubcom ){ /*定义局部变量*/ struct cmscardinfo stCmsFCardInfo; /* 卡片信息表 */ struct cmscardinfo stCmsCardInfo; /* 卡片信息表 */ struct cmsacctm stCmsAcctM; /* 卡账户对照表 */ struct cmscardkind stCmsFCardKind; /* 卡片种类表 */ struct ciscustomerinfo stCisInfo; /* 客户基本信息表 */ int iRtn; /* 函数返回值 */ char acTranType[ BIT3_LEN ]; /* 发卡类型 长度2 */ /* 0:无折发卡 */ /* 1:有折发卡 */ /* 2:专用卡发卡 */ char acPasswd[ PASSWD_LEN+1 ]; /* 密码 */ char acCardNo[ CARDNO_LEN+1 ]; /* 主卡卡号 */ char acMarkFlg[ FLAG_LEN+1 ]; /* 记名卡/非记名卡标志 */ strcpy( g_acTrcMsg, "子交易: 附卡申请处理开始.." ); TRCLOG4 /* 初始化 */ memset( &stCmsFCardInfo,0x00, sizeof( struct cmscardinfo ) ); memset( &stCmsCardInfo, 0x00, sizeof( struct cmscardinfo ) ); memset( &stCmsFCardKind,0x00, sizeof( struct cmscardkind ) ); memset( &stCmsAcctM, 0x00, sizeof( struct cmsacctm ) ); memset( &stCisInfo, 0x00, sizeof( struct ciscustomerinfo ) ); memset( acTranType, 0x00, sizeof( acTranType ) ); memset( acPasswd, 0x00, sizeof( acPasswd ) ); memset( acMarkFlg, 0x00, sizeof( acMarkFlg ) ); /* 取数据字典值 */ getstring( "CardNo", stCmsCardInfo.cardno ); getstring( "FCardNo", stCmsFCardInfo.cardno ); getstring( "FCardKind", stCmsFCardKind.cardkind ); getstring( "AcctSeqNo", stCmsAcctM.acctseqno ); getstring( "CardNo", stCmsAcctM.cardno ); /* 从字典获取其他字段 */ getstring( "CardPwd", acPasswd ); getstring( "CustNo", stCisInfo.customid ); getstring( "MarkFlg", acMarkFlg ); /* 获取客户信息 */ iRtn = pubReadCiscustomerinfo( &stCisInfo ) ; if ( iRtn ) { ERRLOG return FAILED; } /*取主卡卡片信息*/ if( pubReadCmscardinfo( &stCmsCardInfo ) ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "主卡号[%s]不存在", stCmsCardInfo.cardno ); ERRLOG return FAILED; } /*取附卡卡种信息*/ if( pubReadCmscardkind( &stCmsFCardKind ) ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "卡片种类[%s]不存在",stCmsFCardKind.cardkind ); ERRLOG return FAILED; } /*取主卡主账户卡账户对照表*/ if( cmsApiGetCmsAcctM( &stCmsAcctM ) ) { ERRLOG return FAILED; } /* 获取卡片信息并锁住记录 */ pubStoVCmscardinfo( &stCmsFCardInfo ); EXEC SQL DECLARE Inf_l_cur CURSOR FOR SELECT * FROM CMSCARDINFO WHERE cardno = :cmscardinfo_cardno FOR UPDATE; SQLOPENCUR(Inf_l_cur,"Inf_l_cur") /* 打开游标错误 */ if ( SQLCODE ) { strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo( "cmscardinfo", SQLCODE ); ERRLOG return FAILED; } pubInitCmscardinfo(); EXEC SQL FETCH Inf_l_cur INTO R_CMSCARDINFO ; /* 取游标错误 */ if ( SQLCODE && SQLCODE != SQLNOTFOUND ) { strcpy( g_acRspCode, "CMS112" ); pubCrtRspInfo( "cmscardinfo", SQLCODE ); ERRLOG SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") return FAILED; } /* 记录不存在 */ else if ( SQLCODE == SQLNOTFOUND ) { strcpy( g_acRspCode, "CMS113" ); sprintf( g_acRspMsg, "附卡号[%s]不存在", stCmsFCardInfo.cardno ); ERRLOG SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") return FAILED; } pubVtoSCmscardinfo( &stCmsFCardInfo ); /* 密码处理 --> stCmsFCardInfo.passwd */ /* strcpy( stCmsFCardInfo.passwd , acPasswd ); */ sprintf( g_acTrcMsg, "passwd[%s]DB[%s]",acPasswd,stCmsFCardInfo.passwd); TRCLOG3 if ( OverPINBLOCK( acPasswd, stCmsFCardInfo.cardno, stCmsFCardInfo.passwd )) { ERRLOG SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") return FAILED; } /* 开卡获取卡内新的账户序号 */ iRtn = cmsApiGetSeqNoInCard( stCmsFCardInfo.cardno, \ stCmsFCardInfo.acctseqno ); if ( iRtn ) { ERRLOG SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") return FAILED; } /* 为修改附卡片信息表做赋值准备 */ /*strcpy( stCmsFCardInfo.acctseqno, stCmsCardInfo.acctseqno );*/ strcpy( stCmsFCardInfo.subacct, stCmsCardInfo.subacct ); strcpy( stCmsFCardInfo.acctno, stCmsCardInfo.acctno ); strcpy( stCmsFCardInfo.issuebrc, pstPubcom->acBrc ); strcpy( stCmsFCardInfo.teller, pstPubcom->acTeller ); strcpy( stCmsFCardInfo.maincardno, stCmsCardInfo.cardno ); strcpy( stCmsFCardInfo.usedate, pstPubcom->acTranDate ); strcpy( stCmsFCardInfo.chgdate, pstPubcom->acTranDate ); strcpy( stCmsFCardInfo.custno, stCisInfo.customid ); strcpy( stCmsFCardInfo.hasbankbook, NOBANKBOOK ); strcpy( stCmsFCardInfo.markflg, acMarkFlg ); stCmsFCardInfo.serverlevel = stCisInfo.serverlevel; stCmsFCardInfo.cardflg[ BIT1_LEN ] = SUBMAIN_CARD; stCmsFCardInfo.crdsts[ BIT1_LEN ] = CARDOKSTS; stCmsFCardInfo.errnum = 0; stCmsFCardInfo.errnumtot = 0; stCmsFCardInfo.acdcnt = 0; stCmsFCardInfo.acdlmt = 0.0; stCmsFCardInfo.acduseamt = 0.0; stCmsFCardInfo.empflg[ BIT1_LEN ] = COMMONCARD; stCmsFCardInfo.yfeeflag[ BIT1_LEN ] = NOTAKEFEE; stCmsFCardInfo.yfee = 0.0; stCmsFCardInfo.yfeebal = 0.0; stCmsFCardInfo.hasbankbook[0] = '0'; stCmsFCardInfo.billway[0] = '0'; stCmsFCardInfo.billaddtype[0] = '0'; stCmsFCardInfo.madfeeflag[ BIT1_LEN ] = NOMADFEE; stCmsFCardInfo.currbal = 0.0; stCmsFCardInfo.availbal = 0.0; /* 修改卡片信息标记录 */ pubInitCmscardinfo(); pubStoVCmscardinfo( &stCmsFCardInfo ); EXEC SQL UPDATE CMSCARDINFO SET ( U_CMSCARDINFO ) = ( W_CMSCARDINFO ) WHERE CURRENT OF Inf_l_cur; if ( SQLCODE ) { strcpy( g_acRspCode, "CMS114" ); /* 数据库更新错误 */ pubCrtRspInfo( "cmscardinfo",SQLCODE ); ERRLOG SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") return FAILED; }; SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") /* 为增加卡账户对照表准备数据 */ strcpy( stCmsAcctM.cardno, stCmsFCardInfo.cardno ); strcpy( stCmsAcctM.acctseqno, stCmsCardInfo.acctseqno ); strcpy( stCmsAcctM.acctno, stCmsCardInfo.acctno ); strcpy( stCmsAcctM.subacct, stCmsCardInfo.subacct ); strcpy( stCmsAcctM.custno, stCmsFCardInfo.custno ); strcpy( stCmsAcctM.issuebrc, pstPubcom->acBrc ); strcpy( stCmsAcctM.issueteller, pstPubcom->acTeller ); strcpy( stCmsAcctM.issuedate, pstPubcom->acTranDate ); stCmsAcctM.accowner[ BIT1_LEN ] = BELONGFCARD; /* 属于附卡*/ stCmsAcctM.cardbookflag[ BIT1_LEN ] = ACCOPENFLG_CARD; /*无折*/ /* 插入卡账户对照表 */ iRtn = pubInstCmsacctm( &stCmsAcctM ); if ( iRtn ) { ERRLOG return FAILED; } /*修改主卡卡片信息,附卡张数*/ stCmsCardInfo.acdcnt=stCmsCardInfo.acdcnt+1; if( pubModiCmscardinfo( &stCmsCardInfo ) ) { ERRLOG return FAILED; } /* 登记账号索引表 */ iRtn = pubRegAcctNoIdx( stCmsFCardInfo.cardno, STR_CMS ); if ( iRtn ) { ERRLOG return FAILED; } /* 是否写子交易流水 */ if( cmsApiInsTranLog( pstPubcom, &stCmsFCardInfo, &stCmsAcctM, "发卡", "附卡发卡" ) ) { ERRLOG return FAILED; } /* 子交易出口 */ strcpy( g_acTrcMsg, "子交易: 附卡申请处理结束.." ); TRCLOG4 strcpy( g_acRspCode, RSP_OK ); return SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -