⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cms512.sqc

📁 一整套完整的银行卡系统源代码
💻 SQC
字号:
/******************************************************************** *   源码文件名称 : cms512.SQC **   所属子系统   : CMS  **   当前文件版本 : 4.0.0.0 **   作者         : Feng **   版本创建日期 : 2004/09/21 **   功能描述     : 换卡处理子交易 **   修改记录     : **   修改人       修改日期     修改说明 **   Feng         2006-01-16   增加废卡登记簿中凭证的处理*********************************************************************/#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 "cmschgm.h"#include "cmscardcancelt.h"#include "ciscustomerinfo.h"EXEC SQL INCLUDE SQLCA;int cmsChgCardPro( PUBCOM *pstPubcom ){	/*定义局部变量*/	struct	cmscardinfo			stCmsCardInfo;	/* 卡片信息表		*/	struct	cmscardinfo			stNewCardInfo;	/* 新卡片信息表		*/    struct  cmscardkind     stCmsCardKind;     	/* 卡片种类表       */	struct	cmschgm				stCmsChgM;		/* 换卡登记簿		*/    struct  cmsacctm    	    stCmsAcctM;    	/* 卡账户对照表     */	struct	cmscardcancelt		stCmsCant;		/* 作废销毁登记簿	*/	struct	ciscustomerinfo     stCustomInfo;	/* 客户信息			*/	char	acChgFlg[ FLAG_LEN + 1 ];			/* 换卡标志			*/	char	acPasswd[ PASSWD_LEN + 1];			/* 新密码			*/	char	acChgPasswd[ PASSWD_LEN + 1];		/* 转换新密码		*/	int		iRtn;								/* 函数返回值		*/	strcpy( g_acTrcMsg, "子交易: 换卡处理开始.." );	TRCLOG4	/* 初始化 */	memset( &stCmsCardInfo,		0x00,	sizeof( struct cmscardinfo ) );	memset( &stNewCardInfo,		0x00,	sizeof( struct cmscardinfo ) );	memset( &stCmsChgM,			0x00,	sizeof( struct cmschgm ) );    memset( &stCmsCardKind,		0x00, sizeof( struct cmscardkind ) );    memset( &stCmsAcctM,		0x00,	sizeof( struct cmsacctm ) );	memset( acPasswd,			0x00,	sizeof( acPasswd ) );	memset( acChgPasswd,		0x00,	sizeof( acChgPasswd ) );	memset( acChgFlg,			0x00,	sizeof( acChgFlg ) );	/* 取数据字典值 */	getstring( "CardNo",	stCmsCardInfo.cardno	);	getstring( "CardNo1",	stNewCardInfo.cardno	);		/* 获取卡片信息并锁住记录 */	pubStoVCmscardinfo( &stCmsCardInfo );	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]不存在", stCmsCardInfo.cardno );		ERRLOG	SQLCLOSECUR(Inf_l_cur,"Inf_l_cur")		return FAILED;	}	pubVtoSCmscardinfo( &stCmsCardInfo );	/* 从字典获取其他数据 */	getstring( "ChgFlag",		acChgFlg				);	/* 为修改卡片信息表做赋值准备 */	strcpy( stCmsCardInfo.chgdate,			pstPubcom->acTranDate	);	if ( acChgFlg[ BIT1_LEN ] == NORMALCHGCARD )		stCmsCardInfo.cardstat[ BIT8_LEN ] = BIT8_CARDBAD;	else if ( acChgFlg[ BIT1_LEN ] == UNIONCHGCARD )		stCmsCardInfo.cardstat[ BIT8_LEN ] = BIT8_CARDCHGUNION;	else	{		strcpy( g_acRspCode, "CMS1C1" );		pubCrtRspInfo( );		ERRLOG	SQLCLOSECUR(Inf_l_cur,"Inf_l_cur")		return FAILED;	}	/*	strcpy( stCmsCardInfo.oldcardno, stCmsCardInfo.cardno );	*/	strcpy( stCmsCardInfo.newcardno, stNewCardInfo.cardno );	/* 修改卡片信息标记录 */	pubInitCmscardinfo();	pubStoVCmscardinfo( &stCmsCardInfo );	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")	/* Feng Add in 2006-01-16 Begin */    /* 获取卡片种类表 */    iRtn = cmsApiGetCmsCardKind( stCmsCardInfo.cardkind, &stCmsCardKind );    if ( iRtn )    {        ERRLOG        return FAILED;    }	/* Feng Add in 2006-01-16 End */	/* 修改所有主卡卡号为旧卡号的卡片信息主卡卡号为新卡号 */	if ( stCmsCardInfo.cardflg[ BIT1_LEN ] == MAIN_CARD )	{		strcpy( stCmsCardInfo.oldcardno, stCmsCardInfo.cardno );		pubStoVCmscardinfo( &stCmsCardInfo );		EXEC SQL	UPDATE CMSCARDINFO					SET		maincardno = :cmscardinfo_newcardno					WHERE	maincardno = :cmscardinfo_oldcardno					AND		cardno != :cmscardinfo_oldcardno;		if ( SQLCODE && SQLCODE != SQLNOTFOUND )		{			strcpy( g_acRspCode, "CMS114" );			/* 数据库更新错误 */			pubCrtRspInfo( "cmscardinfo",SQLCODE );			ERRLOG			return FAILED;		}	}	/* 从字典获取其他数据 */	getstring( "Passwd1",		acPasswd				);	getstring( "IdType1",		stCmsChgM.idtype		);	getstring( "IdNo1",			stCmsChgM.idcode		);	getstring( "CustomName",	stCmsChgM.custname		);	/* 获取新卡卡片信息并锁住记录 */	pubStoVCmscardinfo( &stNewCardInfo );	sprintf( g_acTrcMsg, "Newcardno[%s][%s]", cmscardinfo_cardno, stCmsCardInfo.cardno );	TRCLOG3	EXEC SQL	DECLARE Info_l_cur CURSOR FOR 				SELECT * FROM CMSCARDINFO				WHERE cardno = :cmscardinfo_cardno				FOR UPDATE;	/* 定义游标错误     if ( SQLCODE )	{		strcpy( g_acRspCode, "CMS110" );		pubCrtRspInfo( "cmscardinfo", SQLCODE );		ERRLOG		return FAILED;	} */	SQLOPENCUR(Info_l_cur,"Info_l_cur")	/* 打开游标错误 */	if ( SQLCODE )	{		strcpy( g_acRspCode, "CMS111" );		pubCrtRspInfo( "cmscardinfo", SQLCODE );		ERRLOG		return FAILED;	}	pubInitCmscardinfo();	EXEC SQL	FETCH Info_l_cur INTO R_CMSCARDINFO ;	/* 取游标错误 */	if ( SQLCODE && SQLCODE != SQLNOTFOUND )	{		strcpy( g_acRspCode, "CMS112" );		pubCrtRspInfo( "cmscardinfo", SQLCODE );		ERRLOG	SQLCLOSECUR(Info_l_cur,"Info_l_cur")		return FAILED;	}	/* 记录不存在 */	else if ( SQLCODE == SQLNOTFOUND )	{		strcpy( g_acRspCode, "CMS113" );		pubCrtRspInfo( "cmscardinfo", SQLCODE );		ERRLOG	SQLCLOSECUR(Info_l_cur,"Info_l_cur")		return FAILED;	}	pubVtoSCmscardinfo( &stNewCardInfo );	/* 新密码处理 --> stNewCardInfo.passwd */	/*	strcpy( stNewCardInfo.passwd, acPasswd );	sprintf( g_acTrcMsg, "passwd[%s]DB[%s]",acPasswd,stNewCardInfo.passwd);	TRCLOG3	if ( ChgPANPINBLOCK( acPasswd, stCmsCardInfo.cardno, stNewCardInfo.cardno, acChgPasswd ) )	{		ERRLOG	SQLCLOSECUR(Info_l_cur,"Info_l_cur")		return FAILED;	}	if ( OverPINBLOCK( acChgPasswd, stNewCardInfo.cardno, stNewCardInfo.passwd ))	*/	if ( OverPINBLOCK( acPasswd, stNewCardInfo.cardno, stNewCardInfo.passwd ))	{		ERRLOG	SQLCLOSECUR(Info_l_cur,"Info_l_cur")		return FAILED;	}	/* 为修改卡片信息表做赋值准备 */	/* 换卡更新卡片信息赋值 API*/	iRtn = cmsApiChgCardSetValue( &stCmsCardInfo, &stNewCardInfo );	if ( iRtn )	{		ERRLOG	SQLCLOSECUR(Info_l_cur,"Info_l_cur")		return FAILED;	}	strcpy( stNewCardInfo.chgdate,			pstPubcom->acTranDate	);	strcpy( stNewCardInfo.oldcardno, stCmsCardInfo.cardno );	strcpy( stNewCardInfo.cardflg, stCmsCardInfo.cardflg );	stNewCardInfo.crdsts[ BIT1_LEN ] = CARDOKSTS;	/* 修改卡片信息表记录 */	pubInitCmscardinfo();	pubStoVCmscardinfo( &stNewCardInfo );	EXEC SQL	UPDATE CMSCARDINFO				SET		( U_CMSCARDINFO ) = ( W_CMSCARDINFO )				WHERE	CURRENT OF Info_l_cur;	if ( SQLCODE )	{		strcpy( g_acRspCode, "CMS114" );		/* 数据库更新错误 */		pubCrtRspInfo( "cmscardinfo",SQLCODE );		ERRLOG	SQLCLOSECUR(Info_l_cur,"Info_l_cur")		return FAILED;	}	SQLCLOSECUR(Info_l_cur,"Info_l_cur")	/* 换卡更新卡账户对照表 */	iRtn = cmsApiChgCardSetAcct( &stCmsCardInfo, &stNewCardInfo );	if ( iRtn )	{		ERRLOG		return FAILED;	}	/* 为增加换卡登记簿做赋值准备 */	strcpy( stCmsChgM.oldcardno,	stCmsCardInfo.cardno	);	strcpy( stCmsChgM.newcardno,	stNewCardInfo.cardno	);	strcpy( stCmsChgM.chgdate,		pstPubcom->acTranDate	);	stCmsChgM.serseqno = pstPubcom->lSerSeqNo;	sprintf( stCmsChgM.vouchno,	"%s%0*ld", pstPubcom->acTranDate8, \					SERSEQNO_LEN, stCmsChgM.serseqno		);	strcpy( stCmsChgM.issuebrc,		stCmsCardInfo.issuebrc	);	strcpy( stCmsChgM.chgbrc,		pstPubcom->acBrc		);	strcpy( stCmsChgM.chgteller,	pstPubcom->acTeller		);	strcpy( stCmsChgM.chgflg,		acChgFlg				);	stCmsChgM.status[ BIT1_LEN ] = NORMAL_STS;	/* 换卡增加卡号顺序号文件 */	iRtn = cmsApiChgCardCmsSeqNo( stCmsCardInfo.cardno, stNewCardInfo.cardno );	if ( iRtn )	{		ERRLOG		return FAILED;	}	/* 插入换卡登记簿 */	iRtn = pubInstCmschgm( &stCmsChgM );	if ( iRtn )	{		ERRLOG		return FAILED;	}	/* 登记账号索引表 */	iRtn = pubRegAcctNoIdx( stNewCardInfo.cardno, STR_CMS );	if ( iRtn )	{		ERRLOG		return FAILED;	}	memset( &stCustomInfo, 0x00, sizeof( stCustomInfo ) );	strcpy( stCustomInfo.customid ,stCmsCardInfo.custno );	if ( pubReadCiscustomerinfo( &stCustomInfo ) )	{		ERRLOG		return FAILED;	}	memset( &stCmsCant,	0x00,	sizeof( struct cmscardcancelt ) );	strcpy( stCmsCant.canceldate,      pstPubcom->acTranDate   );	stCmsCant.serseqno = pstPubcom->lSerSeqNo;	strcpy( stCmsCant.cardno,    stCmsCardInfo.cardno    );	/* Feng Add in 2006-01-16 Begin */	strcpy( stCmsCant.cardkind,    stCmsCardInfo.cardkind    );	strcpy( stCmsCant.voukind,    stCmsCardKind.blankvoukind    );	strcpy( stCmsCant.precharcode,    stCmsCardInfo.precharcode    );	strcpy( stCmsCant.vouno,    stCmsCardInfo.vouno    );	/* Feng Add in 2006-01-16 End */	sprintf( stCmsCant.vouchno, "%s%0*ld", pstPubcom->acTranDate8, \							SERSEQNO_LEN, stCmsCant.serseqno );	stCmsCant.flag[ BIT1_LEN ] = FLAG_INVALID;	stCmsCant.cardflg[ BIT1_LEN ] = stCmsCardInfo.cardflg[ BIT1_LEN ];	strcpy( stCmsCant.custname, stCustomInfo.customname );	strcpy( stCmsCant.idtype,	stCustomInfo.idtype	);	strcpy( stCmsCant.idcode,	stCustomInfo.idno	);	strcpy( stCmsCant.cancelbrc,	pstPubcom->acBrc	);	strcpy( stCmsCant.cancelteller,pstPubcom->acTeller	);	/* 插入卡作废销毁登记簿 */	iRtn = pubInstCmscardcancelt( &stCmsCant );	if ( iRtn )	{		ERRLOG		return FAILED;	}	/* 是否写子交易流水 */	iRtn = cmsApiInsTranLog( pstPubcom, &stNewCardInfo, &stCmsAcctM, "换卡", "正常换卡" );	if ( iRtn )	{		ERRLOG		return FAILED;	}	/* 子交易出口 */ 	setstring( "VouchNo", stCmsChgM.vouchno ); /* 登记簿编号	*/		strcpy( g_acTrcMsg, "子交易: 换卡处理结束.." );	TRCLOG4	strcpy( g_acRspCode,  RSP_OK );	return SUCCESS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -