📄 cms301.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms301.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 "ciscustomerinfo.h"EXEC SQL INCLUDE SQLCA;int cmsOpenMainCardPro( PUBCOM *pstPubcom ){ /*定义局部变量*/ struct cmscardinfo stCmsCardInfo; /* 卡片信息表 */ struct cmsacctm stCmsAcctM; /* 卡账户对照表 */ struct ciscustomerinfo stCisInfo; /* 客户基本信息表 */ int iRtn; /* 函数返回值 */ char acTranType[ BIT3_LEN ]; /* 发卡类型 长度2 */ /* 0:无折发卡 */ /* 1:有折发卡 */ /* 2:专用卡发卡 */ char acPasswd[ PASSWD_LEN ]; /* 密码 */ char acInqPasswd[ PASSWD_LEN ]; /* 用户查询密码 */ char acCardFlag[ FLAG_LEN+1 ]; /* 卡标志 */ char acCardFlg[ FLAG_LEN+1 ]; /* 卡标志 */ char acMarkFlg[ FLAG_LEN+1 ]; /* 记名卡/非记名卡标志 */ char acWthMode[ WTHCODE_LEN + 1 ]; /* 支取方式 */ char acPasswd1[ PASSWD_LEN ]; /* 存折密码 */ char acVouKind[ VOUKIND_LEN+1 ]; /* 存折凭证类别 */ char acVouNo[ VOUNO_LEN + 1 ]; /* 存折凭证号码 */ char acIdNo[ IDNO_LEN + 1 ]; /* 证件类型 */ char acIdType[ IDTYPE_LEN + 1 ]; /* 证件号码 */ char acMemo[ MEMO_LEN + 1 ]; /* 备注 */ char acFlag4[ FLAG_LEN+1 ]; /* 自带卡标志长度2 */ /* 0:自带卡 */ /* 1:本行发卡 */ strcpy( g_acTrcMsg, "子交易: 主卡发卡处理开始.." ); TRCLOG4 /* 初始化 */ memset( &stCmsCardInfo, 0x00, sizeof( struct cmscardinfo ) ); memset( &stCmsAcctM, 0x00, sizeof( struct cmsacctm ) ); memset( &stCisInfo, 0x00, sizeof( struct ciscustomerinfo ) ); memset( acTranType, 0x00, sizeof( acTranType ) ); memset( acPasswd, 0x00, sizeof( acPasswd ) ); memset( acInqPasswd, 0x00, sizeof( acInqPasswd ) ); memset( acCardFlag, 0x00, sizeof( acCardFlag ) ); memset( acCardFlg, 0x00, sizeof( acCardFlg ) ); memset( acMarkFlg, 0x00, sizeof( acMarkFlg ) ); memset( acWthMode, 0x00, sizeof( acWthMode ) ); memset( acPasswd1, 0x00, sizeof( acPasswd1 ) ); memset( acVouNo, 0x00, sizeof( acVouNo ) ); memset( acVouKind, 0x00, sizeof( acVouKind ) ); memset( acIdNo, 0x00, sizeof( acIdNo ) ); memset( acIdType, 0x00, sizeof( acIdType ) ); memset( acFlag4, 0x00, sizeof( acFlag4 ) ); /* 取数据字典值 */ getstring( "CardNo", stCmsCardInfo.cardno ); /* 从字典获取其他字段 */ getstring( "Passwd", acPasswd ); getstring( "CustomId", stCisInfo.customid ); getstring( "OpenTranType", acTranType ); getstring( "Flag4", acFlag4 ); getstring( "MarkFlg", acMarkFlg ); getstring( "CardFlg", acCardFlg ); sprintf( g_acTrcMsg, "CardNo[%s]", stCmsCardInfo.cardno ); TRCLOG3 /* 获取客户信息 */ iRtn = pubReadCiscustomerinfo( &stCisInfo ) ; if ( iRtn ) { ERRLOG return FAILED; } /* 获取卡片信息并锁住记录 */ 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 ); sprintf( g_acTrcMsg, "acMarkFlg[%s]acCardFlg[%s]",acMarkFlg,acCardFlg); TRCLOG3 /* 密码处理 --> stCmsCardInfo.passwd */ sprintf( g_acTrcMsg, "passwd[%s]DB[%s]",acPasswd,stCmsCardInfo.passwd); TRCLOG3 if ( OverPINBLOCK( acPasswd, stCmsCardInfo.cardno, stCmsCardInfo.passwd )) { ERRLOG SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") return FAILED; } if ( acTranType[ BIT1_LEN ] == HASBOOK_OPEN ) /* 有折发卡 */ { getstring( "Ccy2", stCmsAcctM.ccy ); getstring( "PrdCode1", stCmsAcctM.prdcod ); getstring( "AcctNo1", stCmsCardInfo.acctno ); getstring( "SubAcct1", stCmsCardInfo.subacct ); getstring( "Passwd1", acPasswd1 ); getstring( "DrwType", acWthMode ); getstring( "VouNo", acVouNo ); getstring( "VouKind", acVouKind ); getstring( "IdNo1", acIdNo ); getstring( "IdType1", acIdType ); /* 开卡获取卡内新的账户序号 */ iRtn = cmsApiGetSeqNoInCard( stCmsCardInfo.cardno, \ stCmsCardInfo.acctseqno ); if ( iRtn ) { ERRLOG SQLCLOSECUR(Inf_l_cur,"Inf_l_cur") return FAILED; } } else { getstring( "Ccy1", stCmsAcctM.ccy ); getstring( "PrdCode", stCmsAcctM.prdcod ); getstring( "AcctNo", stCmsCardInfo.acctno ); getstring( "SubAcct", stCmsCardInfo.subacct ); getstring( "AcctSeqNo", stCmsCardInfo.acctseqno ); } /* 为修改卡片信息表做赋值准备 */ strcpy( stCmsCardInfo.issuebrc, pstPubcom->acBrc ); strcpy( stCmsCardInfo.teller, pstPubcom->acTeller ); strcpy( stCmsCardInfo.maincardno, stCmsCardInfo.cardno ); strcpy( stCmsCardInfo.usedate, pstPubcom->acTranDate ); strcpy( stCmsCardInfo.chgdate, pstPubcom->acTranDate ); strcpy( stCmsCardInfo.custno, stCisInfo.customid ); strcpy( stCmsCardInfo.cardflg, acCardFlg ); strcpy( stCmsCardInfo.markflg, acMarkFlg ); stCmsCardInfo.crdsts[ BIT1_LEN ] = CARDOKSTS; /* Feng Add in 2006-01-16 Begin */ stCmsCardInfo.cardstat[ BIT16_LEN ] = BIT16_CARDOK; stCmsCardInfo.serverlevel = stCisInfo.serverlevel; /* Feng Add in 2006-01-16 End */ stCmsCardInfo.errnum = 0; stCmsCardInfo.errnumtot = 0; stCmsCardInfo.acdcnt = 0; stCmsCardInfo.acdlmt = 0.0; stCmsCardInfo.acduseamt = 0.0; stCmsCardInfo.empflg[ BIT1_LEN ] = COMMONCARD; stCmsCardInfo.yfeeflag[ BIT1_LEN ] = NOTAKEFEE; stCmsCardInfo.yfee = 0.0; stCmsCardInfo.yfeebal = 0.0; stCmsCardInfo.billway[0] = '0'; stCmsCardInfo.billaddtype[0] = '0'; stCmsCardInfo.madfeeflag[ BIT1_LEN ] = NOMADFEE; stCmsCardInfo.currbal = 0.0; stCmsCardInfo.availbal = 0.0; /* 有折开卡 */ if ( acTranType[ BIT1_LEN ] == HASBOOK_OPEN ) stCmsCardInfo.hasbankbook[ BIT1_LEN ] = BANKBOOK; else stCmsCardInfo.hasbankbook[ BIT1_LEN ] = NOBANKBOOK; /* 修改卡片信息标记录 */ 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") strcpy( g_acTrcMsg, "修改卡片信息结束" ); TRCLOG3 if ( acTranType[ BIT1_LEN ] == HASBOOK_OPEN ) /* 有折发卡 */ { /* 为增加卡账户对照表准备数据 */ strcpy( stCmsAcctM.cardno, stCmsCardInfo.cardno ); strcpy( stCmsAcctM.acctseqno, stCmsCardInfo.acctseqno ); /* 按产品代码获取业务种类 */ iRtn = cmsApiGetBussKindByPrdCod( stCmsAcctM.prdcod, stCmsAcctM.busskind ); if ( iRtn ) { ERRLOG return FAILED; } strcpy( stCmsAcctM.acctno, stCmsCardInfo.acctno ); strcpy( stCmsAcctM.subacct, stCmsCardInfo.subacct ); strcpy( stCmsAcctM.custno, stCmsCardInfo.custno ); strcpy( stCmsAcctM.subsys, STR_DPS ); strcpy( stCmsAcctM.issuebrc, pstPubcom->acBrc ); strcpy( stCmsAcctM.issueteller, pstPubcom->acTeller ); strcpy( stCmsAcctM.issuedate, pstPubcom->acTranDate ); stCmsAcctM.accowner[ BIT1_LEN ] = BELONGMAINCARD; /* 属于主卡 */ stCmsAcctM.cardbookflag[ BIT1_LEN ] = ACCOPENFLG_BOOK; /* 有折 */ stCmsAcctM.status[ BIT1_LEN ] = NORMAL_STS; /* 正常 */ /* 插入卡账户对照表 */ iRtn = pubInstCmsacctm( &stCmsAcctM ); if ( iRtn ) { ERRLOG return FAILED; } /* 调用存款api修改静态文件 */ acCardFlag[ BIT1_LEN ] = CARDFLAG_YES; iRtn = dpsBooAddCarStaOper( stCmsCardInfo.acctno, acCardFlag, \ acVouKind, acVouNo, acWthMode, "", acIdType, acIdNo, \ acPasswd1, "0" ); if ( iRtn ) { ERRLOG return FAILED; } } else { strcpy( stCmsAcctM.cardno, stCmsCardInfo.cardno ); strcpy( stCmsAcctM.acctseqno, stCmsCardInfo.acctseqno ); /* 获取卡账户对照表 */ iRtn = pubReadCmsacctm( &stCmsAcctM ); if ( iRtn ) { ERRLOG return FAILED; } } /* 是否写子交易流水 */ memset( acMemo, 0x00, sizeof( acMemo ) ); sprintf( acMemo, "%c%c", acTranType[ BIT1_LEN ], acFlag4[ BIT1_LEN ] ); iRtn = cmsApiInsTranLog( pstPubcom, &stCmsCardInfo, &stCmsAcctM, "开卡", acMemo ); if ( iRtn ) { ERRLOG return FAILED; } /* 子交易出口 */ setstring( "AcctSeqNo", stCmsCardInfo.acctseqno ); /* 账户序号 */ setstring( "AcctNo", stCmsCardInfo.acctno ); /* 客户账号 */ setstring( "SubAcct", stCmsCardInfo.subacct ); /* 款项代码 */ strcpy( g_acTrcMsg, "子交易: 主卡发卡处理结束.." ); TRCLOG4 strcpy( g_acRspCode, RSP_OK ); return SUCCESS;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -