📄 cms404.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms404.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 "cmsacctm.h"#include "cmscardkind.h"#include "dpsaccountinfo.h"EXEC SQL INCLUDE SQLCA;int cmsAcctDisassocitCard( PUBCOM *pstPubcom ){ /*定义局部变量*/ struct cmscardinfo stCmsCardInfo; /* 卡片信息表 */ struct cmsacctm stCmsAcctM; /* 卡账户对照表 */ struct cmscardkind stCmsCardKind; /* 卡片种类表 */ struct dpsaccountinfo stDpsAcctInfo; /* 存款静态表 */ char acCardStat[ BIT21_LEN ][BIT11_LEN]; /* 卡状态检查标志 */ char acPasswd[ PASSWD_LEN + 1 ]; /* 密码 */ char acCustomId[ CUSTNO_LEN + 1 ]; /* 卡客户号 */ char acAcctNo[ ACCT_LEN + 1 ]; /* 客户账号 */ char acSubAcct[ ACCT_LEN + 1 ]; /* 款项账号 */ char acCcy[ CCY_LEN + 1 ]; /* 币种 */ char acPrdCode[ PRDCODE_LEN + 1 ]; /* 产品代码 */ char acAcctSeqNo[ ACCTSEQNO_LEN+1 ]; /* 帐户序号 */ int iRtn; /* 函数返回值 */ int iNumx; /* 数组计数器 */ int iNumy; /* 数组计数器 */ strcpy( g_acTrcMsg, "子交易: 卡解除关联帐户处理开始.." ); TRCLOG4 /* 初始化 */ memset( &stCmsCardInfo, 0x00, sizeof( struct cmscardinfo ) ); memset( &stCmsCardKind, 0x00, sizeof( struct cmscardkind ) ); memset( &stCmsAcctM, 0x00, sizeof( struct cmsacctm ) ); memset( &stDpsAcctInfo, 0x00, sizeof( struct dpsaccountinfo) ); memset( acAcctNo, 0x00, sizeof( acAcctNo ) ); memset( acSubAcct, 0x00, sizeof( acSubAcct ) ); memset( acPasswd, 0x00, sizeof( acPasswd ) ); memset( acCustomId, 0x00, sizeof( acCustomId ) ); memset( acCcy, 0x00, sizeof( acCcy ) ); memset( acPrdCode, 0x00, sizeof( acPrdCode ) ); memset( acAcctSeqNo, 0x00, sizeof( acAcctSeqNo ) ); /* 卡检查状态数组全置未不检查 */ for ( iNumx = 0; iNumx < BIT21_LEN; iNumx ++ ) for ( iNumy = 0; iNumy < BIT11_LEN; iNumy ++ ) acCardStat[iNumx][iNumy] = CHECK_NO; /* 取数据字典值 */ getstring( "CardNo", stCmsCardInfo.cardno ); /* 从字典获取其他数据 */ getstring( "Passwd", acPasswd ); getstring( "CustomId", acCustomId ); getstring( "AcctNo", acAcctNo ); getstring( "SubAcct", acSubAcct ); getstring( "AcctSeqNo", acAcctSeqNo ); /* 获取卡片信息表 */ iRtn = pubReadCmscardinfo( &stCmsCardInfo ); if ( iRtn ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "卡号[%s]不存在", stCmsCardInfo.cardno ); ERRLOG goto Exit; } /* 获取卡片种类表 */ strcpy( stCmsCardKind.cardkind, stCmsCardInfo.cardkind ); iRtn = pubReadCmscardkind( &stCmsCardKind ); if ( iRtn ) { if ( SQLCODE == SQLNOTFOUND ) sprintf( g_acRspMsg, "卡片种类[%s]不存在", stCmsCardInfo.cardkind ); ERRLOG goto Exit; } strcpy( g_acTrcMsg, "pubReadCmscardkind finish" ); TRCLOG3 /* 检查卡状态是否正常 */ 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 goto Exit; } /* 检查卡密码 */ iRtn = cmsApiChkCardPwd( &stCmsCardInfo, acPasswd, pstPubcom->acChannelId ); if ( iRtn ) { ERRLOG goto Exit; } /* 检查卡号是否为主卡 */ if ( stCmsCardInfo.cardflg[ BIT1_LEN ] != MAIN_CARD ) { strcpy( g_acRspCode, "CMS131" ); pubCrtRspInfo( stCmsCardInfo.cardno ); ERRLOG goto Exit; } /* 获取卡账户对照表并锁住记录 */ strcpy( stCmsAcctM.cardno, stCmsCardInfo.cardno ); strcpy( stCmsAcctM.acctseqno, acAcctSeqNo ); pubStoVCmsacctm( &stCmsAcctM ); EXEC SQL DECLARE Acc_l_cur CURSOR FOR SELECT * FROM CMSACCTM WHERE cardno = :cmsacctm_cardno AND acctseqno = :cmsacctm_acctseqno FOR UPDATE; SQLOPENCUR(Acc_l_cur,"Acc_l_cur") /* 打开游标错误 */ if ( SQLCODE ) { strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo( "cmsacctm", SQLCODE ); ERRLOG goto Exit; } pubInitCmsacctm(); EXEC SQL FETCH Acc_l_cur INTO R_CMSACCTM ; /* 取游标错误 */ if ( SQLCODE && SQLCODE != SQLNOTFOUND ) { strcpy( g_acRspCode, "CMS112" ); pubCrtRspInfo( "cmsacctm", SQLCODE ); ERRLOG goto Exit; } /* 记录不存在 */ else if ( SQLCODE == SQLNOTFOUND ) { strcpy( g_acRspCode, "CMS113" ); sprintf( g_acRspMsg, "卡号[%s]帐户序号[%s]不存在", cmsacctm_cardno, cmsacctm_acctseqno ); ERRLOG goto Exit; } pubVtoSCmsacctm( &stCmsAcctM ); /* 为修改卡账户对照表准备数据 */ strcpy( stCmsAcctM.closebrc, pstPubcom->acBrc ); strcpy( stCmsAcctM.closeteller, pstPubcom->acTeller ); strcpy( stCmsAcctM.closedate, pstPubcom->acTranDate ); stCmsAcctM.status[ BIT1_LEN ] = MOVEOUT_STS; /* 移出 */ /* 修改卡账户对照表 */ pubInitCmsacctm(); pubStoVCmsacctm( &stCmsAcctM ); EXEC SQL UPDATE CMSACCTM SET ( U_CMSACCTM ) = ( W_CMSACCTM ) WHERE CURRENT OF Acc_l_cur; if ( SQLCODE ) { strcpy( g_acRspCode, "CMS114" ); /* 数据库更新错误 */ pubCrtRspInfo( "cmsacctm",SQLCODE ); ERRLOG goto Exit; }; /* 处理存款静态表 */ strcpy( stDpsAcctInfo.acctno, acAcctNo ); pubStoVDpsaccountinfo( &stDpsAcctInfo ); /* 定义静态游标 */ EXEC SQL DECLARE dps_cur CURSOR FOR SELECT * FROM dpsaccountinfo WHERE acctno = :dpsaccountinfo_acctno for UPDATE ; SQLOPENCUR(dps_cur,"dps_cur") if ( SQLCODE ) { sprintf( g_acRspCode, "DPS999" ); pubCrtRspInfo( SQLCODE ); ERRLOG goto Exit; } EXEC SQL FETCH dps_cur INTO R_DPSACCOUNTINFO; if ( SQLCODE && SQLCODE != SQLNOTFOUND ) { sprintf( g_acRspCode, "DPS998" ); pubCrtRspInfo( SQLCODE ); ERRLOG goto Exit; } else if ( SQLCODE == SQLNOTFOUND ) { sprintf( g_acRspCode, "DPS997" ); pubCrtRspInfo( SQLCODE ); ERRLOG goto Exit; } pubVtoSDpsaccountinfo( &stDpsAcctInfo ); /* 检查帐户状态 if(stDepStaTab.accstat[0]!='0') { strcpy( g_acRspCode, "DPS417" ); pubCrtRspInfo(acAcctNo); ERRLOG goto Exit; } */ /* 处理卡存款帐户状态 */ if(stDpsAcctInfo.crdflg[0]=='0' || (stDpsAcctInfo.opnvouflg[2]=='0' && stDpsAcctInfo.opnvouflg[3]=='0')) { strcpy( g_acRspCode, "DPS427" ); pubCrtRspInfo(acAcctNo); ERRLOG goto Exit; } stDpsAcctInfo.crdflg[0]='0'; stDpsAcctInfo.opnvouflg[3]='0'; stDpsAcctInfo.opnvouflg[2]='0'; pubStoVDpsaccountinfo( &stDpsAcctInfo ); EXEC SQL UPDATE dpsaccountinfo SET crdflg = :dpsaccountinfo_crdflg, opnvouflg = :dpsaccountinfo_opnvouflg WHERE CURRENT OF dps_cur; if ( SQLCODE ) { sprintf( g_acRspCode, "DPS999" ); pubCrtRspInfo( SQLCODE ); ERRLOG goto Exit; }Exit: SQLCLOSECUR(Acc_l_cur,"Acc_l_cur") SQLCLOSECUR(dps_cur,"dps_cur") strcpy( g_acTrcMsg, "子交易: 卡解除关联帐户处理结束.." ); TRCLOG4 if( !strcmp( g_acRspCode, RSP_OK ) ) return SUCCESS; else return FAILED ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -