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

📄 cms401.sqc

📁 一整套完整的银行卡系统源代码
💻 SQC
字号:
/******************************************************************** **   源码文件名称 : cms401.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 "cmscardcancelt.h"#include "ciscustomerinfo.h"EXEC SQL INCLUDE SQLCA;int cmsCloseMainCardPro( PUBCOM *pstPubcom ){	/*定义局部变量*/	struct	cmscardinfo			stCmsCardInfo;		/* 卡片信息表		*/	struct	cmsacctm			stCmsAcctM;			/* 卡账户对照表		*/	struct	cmscardcancelt		stCmsCant;			/* 作废销毁登记簿	*/	struct	ciscustomerinfo     stCustomInfo;		/* 客户信息			*/    struct  cmscardkind     stCmsCardKind;      	/* 卡片种类表       */	int		iRtn;									/* 函数返回值		*/	char	acCloseType[ FLAG_LEN + 1 ];			/* 销卡类型			*/	char	acCcy[ CCY_LEN + 1 ];				/* 币种				*/	strcpy( g_acTrcMsg, "子交易: 主卡销卡处理开始.." );	TRCLOG4	/* 初始化 */	memset( &stCmsCardInfo,		0x00,	sizeof( struct cmscardinfo ) );    memset( &stCmsCardKind, 0x00, sizeof( struct cmscardkind ) );	memset( &stCmsAcctM,		0x00,	sizeof( struct cmsacctm ) );	memset( acCloseType,		0x00,	sizeof( acCloseType ) );	/* 取数据字典值 */	getstring( "CardNo",	stCmsCardInfo.cardno	);	getstring( "OprType",	acCloseType				);	getstring( "Ccy",		acCcy				);		/* 获取卡片信息并锁住记录 */	pubStoVCmscardinfo( &stCmsCardInfo );	EXEC SQL	DECLARE Inf_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(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 );	/* 为修改卡片信息表做赋值准备 */	stCmsCardInfo.crdsts[ BIT1_LEN ] = CARDCCSTS;	if ( acCloseType[ BIT1_LEN ] == NORMALCLOSE )	/* 正常销卡		*/		stCmsCardInfo.cardstat[ BIT1_LEN ] = BIT1_CARDCANCEL;	else	/* 挂失销卡 */		stCmsCardInfo.cardstat[ BIT1_LEN ] = BIT1_CARDLOSTCAN;	strcpy( stCmsCardInfo.closedate,		pstPubcom->acTranDate	);	strcpy( stCmsCardInfo.chgdate,			pstPubcom->acTranDate	);	strcpy( stCmsCardInfo.lastdate,			pstPubcom->acTranDate	);	strcpy( stCmsCardInfo.clsbrc,			pstPubcom->acBrc		);	strcpy( stCmsCardInfo.clsteller,		pstPubcom->acTeller		);	/* 修改卡片信息标记录 */	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.hasbankbook[ BIT1_LEN ] == BANKBOOK ) /* 有折 */	{		/* 获取卡账户对照表并锁住记录 */		strcpy( stCmsAcctM.cardno,		stCmsCardInfo.cardno		);		strcpy( stCmsAcctM.acctseqno,	stCmsCardInfo.acctseqno		);		pubStoVCmsacctm( &stCmsAcctM );		EXEC SQL	DECLARE Acc_l_cur CURSOR FOR 					SELECT * FROM CMSACCTM					WHERE cardno = :cmsacctm_cardno					AND	acctseqno = :cmsacctm_acctseqno;	SQLOPENCUR(Acc_l_cur,"Acc_l_cur")		/* 打开游标错误 */		if ( SQLCODE )		{			strcpy( g_acRspCode, "CMS111" );			pubCrtRspInfo( "cmsacctm", SQLCODE );			ERRLOG			return FAILED;		}			pubInitCmsacctm();		EXEC SQL	FETCH Acc_l_cur INTO R_CMSACCTM ;		/* 取游标错误 */		if ( SQLCODE && SQLCODE != SQLNOTFOUND )		{			strcpy( g_acRspCode, "CMS112" );			pubCrtRspInfo( "cmsacctm", SQLCODE );			ERRLOG	SQLCLOSECUR(Acc_l_cur,"Acc_l_cur")			return FAILED;		}		/* 记录不存在 */		else if ( SQLCODE == SQLNOTFOUND )		{			strcpy( g_acRspCode, "CMS113" );			pubCrtRspInfo( "cmsacctm", SQLCODE );			ERRLOG	SQLCLOSECUR(Acc_l_cur,"Acc_l_cur")			return FAILED;		}		pubVtoSCmsacctm( &stCmsAcctM );	SQLCLOSECUR(Acc_l_cur,"Acc_l_cur")			/* 为修改卡账户对照表准备数据 */		strcpy( stCmsAcctM.closebrc,	pstPubcom->acBrc			);		strcpy( stCmsAcctM.closeteller,	pstPubcom->acTeller			);		strcpy( stCmsAcctM.closedate,	pstPubcom->acTranDate		);		stCmsAcctM.status[ BIT1_LEN ] = MOVEOUT_STS;	/* 移出			*/			/* 修改卡账户对照表 */		iRtn = pubModiCmsacctm( &stCmsAcctM );		if ( iRtn )		{			ERRLOG			return FAILED;		}		/* 调用存款API折取消卡 */		iRtn = dpsBooCancleCardStaOper ( stCmsCardInfo.acctno );		if ( iRtn )		{			ERRLOG			return FAILED;		}	}	else	{		/* 暂不支持外币卡销卡 */		if ( strcmp( acCcy, CCY_CNY ) )		{			strcpy( g_acRspCode, "CMS1D3" );			/* 数据库更新错误 */			pubCrtRspInfo( );			ERRLOG			return FAILED;		}		strcpy( stCmsAcctM.cardno,		stCmsCardInfo.cardno		);		strcpy( stCmsAcctM.acctseqno,	stCmsCardInfo.acctseqno		);		/* 获取卡账户对照表 */		iRtn = pubReadCmsacctm( &stCmsAcctM );		if ( iRtn )		{			ERRLOG			return FAILED;		}	}	/* 删除卡账户序号表记录	iRtn = cmsApiDltCmsSeqNo( stCmsCardInfo.cardno );	if ( iRtn )	{		ERRLOG		return FAILED;	}	*/	/* 正常销卡		*/	if ( acCloseType[ BIT1_LEN ] == NORMALCLOSE )	{		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, &stCmsCardInfo, &stCmsAcctM, "销卡", "主卡销卡" );	if ( iRtn )	{		ERRLOG		return FAILED;	}	/* 子交易出口 */ 	setstring( "AcctSeqNo",	stCmsCardInfo.acctseqno );	/* 账户序号	*/		strcpy( g_acTrcMsg, "子交易: 主卡销卡处理结束.." );	TRCLOG4	strcpy( g_acRspCode,  RSP_OK );	return SUCCESS;}

⌨️ 快捷键说明

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