def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作).异转本_卡应答[TRCC004_1158]进入***' ) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=====根据参考报文标识号查找原交易==== TradeContext.ORSNDBNKCO = TradeContext.ORMFN[:10] #原发送行号 TradeContext.BOJEDT = TradeContext.ORMFN[10:18] #原交易日期 TradeContext.ORTRCNO = TradeContext.ORMFN[18:] #原交易流水号 wtr_dict = {} if not rccpsDBFunc.getTransWtrAK(TradeContext.ORSNDBNKCO,TradeContext.BOJEDT,TradeContext.ORTRCNO,wtr_dict): #=====查询原交易失败,等待前台超时发起冲正,抛弃此报文==== return AfaFlowControl.ExitThisFlow('S999','等待前台发起冲正,抛弃报文') AfaLoggerFunc.tradeInfo( '>>>查询原交易结束' ) #=================若应答报文回复拒绝,则设置状态为拒绝,停止处理============= if TradeContext.PRCCO != 'RCCI0000': AfaLoggerFunc.tradeInfo(">>>对方返回拒绝应答") #=============设置业务状态为拒绝处理中================================= if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝成功异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=============设置业务状态为拒绝成功=================================== stat_dict = {} stat_dict['BJEDTE'] = wtr_dict['BJEDTE'] stat_dict['BSPSQN'] = wtr_dict['BSPSQN'] stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO'] = TradeContext.STRINFO if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为拒绝成功异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") return AfaFlowControl.ExitThisFlow('S999',"对方拒绝,交易终止") #====查找自动冲正登记簿是否存在本交易的冲正==== #====查找自动冲正登记簿是否存在本交易的冲正==== wheresql = '' wheresql = wheresql + "BOJEDT = '" + wtr_dict['BJEDTE'] + "'" #报单日期 wheresql = wheresql + "AND BOSPSQ = '" + wtr_dict['BSPSQN'] + "'" #报单序号 ret = rccpsDBTrcc_atcbka.count(wheresql) if ret == -1: return AfaFlowControl.ExitThisFlow('S999','查找自动冲正登记簿异常') elif ret > 0: #=====原交易已自动冲正,抛弃报文==== return AfaFlowControl.ExitThisFlow('S999','原交易已冲正,抛弃报文') AfaLoggerFunc.tradeInfo( '>>>查询冲正登记簿结束' ) #=====主机记账前处理==== TradeContext.BESBNO = wtr_dict['BESBNO'] #机构号 TradeContext.BETELR = wtr_dict['BETELR'] #柜员号 TradeContext.BEAUUS = wtr_dict['BEAUUS'] #授权柜员 TradeContext.BEAUPS = wtr_dict['BEAUPS'] #授权密码 TradeContext.TERMID = wtr_dict['TERMID'] #终端号 TradeContext.BJEDTE = wtr_dict['BJEDTE'] #交易日期 TradeContext.BSPSQN = wtr_dict['BSPSQN'] #报单序号 TradeContext.BRSFLG = wtr_dict['BRSFLG'] #往来账标志 TradeContext.HostCode= '8813' #主机交易码 AfaLoggerFunc.tradeInfo( '>>>主机前处理赋值结束' ) #=====开始更新原交易,新增状态记账-处理中==== if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_ACC,PL_BDWFLG_WAIT): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo( '>>>设置状态记账-处理中结束' ) #=====根据原记录中的手续费收取方式,判断账务处理模式==== if wtr_dict['CHRGTYP'] == '1': #=====转账==== TradeContext.ACUR = '3' #记账次数 #=========交易金额+手续费=================== TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 PL_RCCSMCD_YZBWZ 异转本 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银往账' #借方户名 TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '应解汇款' #贷方户名 TradeContext.OCCAMT = str(wtr_dict['OCCAMT'] + wtr_dict['CUSCHRG']) #发生额 TradeContext.PKFG = 'T' TradeContext.CTFG = '9' TradeContext.WARNTNO = '' TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:借方账号' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:贷方账号' + TradeContext.RBAC ) #=========交易金额============ TradeContext.I2SMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.I2SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I2SBAC = rccpsHostFunc.CrtAcc(TradeContext.I2SBAC,25) TradeContext.I2ACNM = '应解汇款' #借方户名 TradeContext.I2RBAC = TradeContext.PYEACC #贷方账号 TradeContext.I2OTNM = TradeContext.PYENAM #贷方户名 TradeContext.I2TRAM = str(wtr_dict['OCCAMT']) #发生额 TradeContext.I2CTFG = '7' TradeContext.I2PKFG = 'T' #TradeContext.I2WARNTNO = '' #TradeContext.I2CERTTYPE = '' #TradeContext.I2CERTNO = '' AfaLoggerFunc.tradeInfo( '>>>交易金额:借方账号' + TradeContext.I2SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额:贷方账号' + TradeContext.I2RBAC ) #=========结算手续费收入户=========== TradeContext.I3SMCD = PL_RCCSMCD_SXF #摘要代码 TradeContext.I3SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I3SBAC = rccpsHostFunc.CrtAcc(TradeContext.I3SBAC,25) TradeContext.I3ACNM = '应解汇款' #借方户名 TradeContext.I3RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号 TradeContext.I3RBAC = rccpsHostFunc.CrtAcc(TradeContext.I3RBAC,25) TradeContext.I3OTNM = '结算手续费' #贷方户名 TradeContext.I3TRAM = str(wtr_dict['CUSCHRG']) #发生额 TradeContext.I3CTFG = '8' TradeContext.I3PKFG = 'T' AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:借方账号' + TradeContext.I3SBAC ) AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:贷方账号' + TradeContext.I3RBAC ) elif wtr_dict['CHRGTYP'] == '0': #=====本金==== TradeContext.ACUR = '2' #记账次数 TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银往账' #借方户名 TradeContext.RBAC = TradeContext.PYEACC #贷方账号 TradeContext.OTNM = TradeContext.PYENAM #贷方户名 TradeContext.OCCAMT = str(wtr_dict['OCCAMT']) #金额 TradeContext.CTFG = '7' TradeContext.PKFG = 'T' TradeContext.WARNTNO = '' TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' #=====手续费记账赋值==== TradeContext.I2SMCD = PL_RCCSMCD_SXF #摘要代码 TradeContext.I2SBAC = '' #借方账号 TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号 TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2OTNM = '手续费科目' #贷方户名 TradeContext.I2TRAM = str(wtr_dict['CUSCHRG']) #金额 TradeContext.I2CTFG = '8' TradeContext.I2PKFG = 'T' TradeContext.I2CATR = '0' #现转标志 elif wtr_dict['CHRGTYP'] == '2': #=====不收费==== TradeContext.ACUR = '1' #记账次数 TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.RBAC = TradeContext.PYEACC #贷方账号 TradeContext.OTNM = TradeContext.PYENAM #贷方户名 TradeContext.OCCAMT = str(wtr_dict['OCCAMT']) #金额 TradeContext.CTFG = '7' TradeContext.PKFG = 'T' TradeContext.WARNTNO = '' TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' else: #=====出错==== return AfaFlowControl.ExitThisFlow('S999','手续费收费方式错,抛弃报文') AfaLoggerFunc.tradeInfo( '>>>根据手续费收取方式记账赋值处理结束' ) #=====主机记账处理==== rccpsHostFunc.CommHost(TradeContext.HostCode) #=====主机后处理==== set_dict = {} set_dict['BSPSQN'] = TradeContext.BSPSQN set_dict['BJEDTE'] = TradeContext.BJEDTE set_dict['BCSTAT'] = PL_BCSTAT_ACC set_dict["SBAC"] = TradeContext.SBAC #借方账号 set_dict["RBAC"] = TradeContext.RBAC #贷方账号 set_dict["OTNM"] = TradeContext.OTNM #贷方户名 set_dict['MGID'] = TradeContext.errorCode #主机返回码 set_dict["STRINFO"]= TradeContext.errorMsg #主机返回信息 if TradeContext.errorCode == '0000': #=====主机记账成功==== set_dict['BDWFLG'] = PL_BDWFLG_SUCC set_dict['TRDT'] = TradeContext.TRDT set_dict['TLSQ'] = TradeContext.TLSQ else: set_dict['BDWFLG'] = PL_BDWFLG_FAIL if not rccpsState.setTransState(set_dict): return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>设置主机返回状态成功') if TradeContext.errorCode == '0000': #=====开始更新原交易,新增状态清算成功==== if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_MFESTL,PL_BDWFLG_SUCC): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作).异转本_卡应答[TRCC004_1158]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲正应答报文接收[TRC004_1161]进入***' ) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #查询原冲正交易信息 atcbka_dict = {} atcbka_where_dict = {} atcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where_dict) if atcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","查询原冲正交易信息异常") if len(atcbka_dict) <= 0: return AfaFlowControl.ExitThisFlow("S999","未找到原冲正交易信息,丢弃报文") #查询原被冲正交易是否已开始被冲销 mpcbka_dict = {} mpcbka_where_dict = {} mpcbka_where_dict['ORMFN'] = atcbka_dict['ORMFN'] mpcbka_dict = rccpsDBTrcc_mpcbka.selectu(mpcbka_where_dict) if mpcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","查询原冲正交易信息异常") if len(mpcbka_dict) > 0: return AfaFlowControl.ExitThisFlow("S999","原交易已开始冲销,停止处理本冲正应答") #=====给机构号和柜员号赋值==== TradeContext.BETELR = atcbka_dict['BETELR'] TradeContext.BESBNO = atcbka_dict['BESBNO'] #更新冲正登记簿中心返回信息 AfaLoggerFunc.tradeInfo(">>>开始更新冲正登记簿中心返回信息") atcbka_update_dict = {} atcbka_update_dict['PRCCO'] = TradeContext.PRCCO atcbka_update_dict['STRINFO'] = TradeContext.STRINFO ret = rccpsDBTrcc_atcbka.update(atcbka_update_dict,atcbka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","更新冲正登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束更新冲正登记簿中心返回信息") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") if atcbka_dict['ORTRCCO'] != '3000504': AfaLoggerFunc.tradeInfo(">>>原被冲正交易为通存或通兑账务类交易") #查询原被冲正交易信息 wtr_dict = {} if not rccpsDBFunc.getTransWtr(atcbka_dict['BOJEDT'],atcbka_dict['BOSPSQ'],wtr_dict): return AfaFlowControl.ExitThisFlow("S999","查询原被冲正交易信息异常") #如果原被冲正交易当前状态已为冲正,表示已收到冲正应答,停止处理 if wtr_dict['BCSTAT'] == PL_BCSTAT_CANCEL: return AfaFlowControl.ExitThisFlow("S999","已收到冲正应答,丢弃报文") TradeContext.TERMID = wtr_dict['TERMID'] TradeContext.BRSFLG = wtr_dict['BRSFLG'] #若原被冲正交易为通存类交易,应抹账 if wtr_dict['TRCCO'] in ('3000002','3000003','3000004','3000005'): AfaLoggerFunc.tradeInfo(">>>开始发起主机抹账") #为抹账赋值会计分录 entries_dict = {} entries_dict['FEDT'] = wtr_dict['BJEDTE'] entries_dict['RBSQ'] = wtr_dict['BSPSQN'] entries_dict['PYRACC'] = wtr_dict['PYRACC'] entries_dict['PYRNAM'] = wtr_dict['PYRNAM'] entries_dict['PYEACC'] = wtr_dict['PYEACC'] entries_dict['PYENAM'] = wtr_dict['PYENAM'] entries_dict['OCCAMT'] = wtr_dict['OCCAMT'] entries_dict['CHRGTYP'] = wtr_dict['CHRGTYP'] entries_dict['CUSCHRG'] = wtr_dict['CUSCHRG'] entries_dict['RCCSMCD'] = PL_RCCSMCD_CX TradeContext.BRSFLG = wtr_dict['BRSFLG'] if TradeContext.ORTRCCO == '3000002' or TradeContext.ORTRCCO == '3000004': rccpsEntries.KZTCWZMZ(entries_dict) if TradeContext.ORTRCCO == '3000003' or TradeContext.ORTRCCO == '3000005': rccpsEntries.KZBZYWZMZ(entries_dict) #=====生成新的前置日期和前置流水号==== if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 : return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常") #设置原交易状态为冲正处理中 AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲正处理中') if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_CANCEL,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲正处理中异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲正处理中') #=====调起主机接口===== rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束发起主机记账") else: AfaLoggerFunc.tradeInfo(">>>原交易未记账,冲正不抹账") #设置原交易状态为冲正处理中 AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲正处理中') if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_CANCEL,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲正处理中异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲正处理中') TradeContext.errorCode = "0000" TradeContext.errorMsg = "冲正前未记账,冲正不抹账" #根据主机返回信息,设置交易状态 stat_dict = {} stat_dict['BJEDTE'] = wtr_dict['BJEDTE'] stat_dict['BSPSQN'] = wtr_dict['BSPSQN'] stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO'] = TradeContext.errorMsg AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]") if TradeContext.errorCode == '0000': #设置原交易状态为冲正成功 AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲正成功") stat_dict['BCSTAT'] = PL_BCSTAT_CANCEL stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if TradeContext.existVariable('TRDT'): stat_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): stat_dict['TLSQ'] = TradeContext.TLSQ if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态为冲正成功异常') AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲正成功") else: #设置原交易状态为冲正失败 AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲正失败") stat_dict['BCSTAT'] = PL_BCSTAT_CANCEL stat_dict['BDWFLG'] = PL_BDWFLG_FAIL if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态为冲正失败异常') AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲正成功") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") else: AfaLoggerFunc.tradeInfo(">>>原被冲正交易为冲销交易") #查询原冲销交易详细信息 AfaLoggerFunc.tradeInfo(">>>冲销交易报单日期[" + atcbka_dict['BOJEDT'] + "]报单序号[" + atcbka_dict['BOSPSQ'] + "]") AfaLoggerFunc.tradeInfo(">>>开始查询原冲销交易详细信息") mpc_dict = {} if not rccpsDBFunc.getTransMpc(atcbka_dict['BOJEDT'],atcbka_dict['BOSPSQ'],mpc_dict): return AfaFlowControl.ExitThisFlow("S999","查询原冲销交易详细信息异常") AfaLoggerFunc.tradeInfo(">>>结束查询原冲销交易详细信息") #查询原被冲销交易详细信息 AfaLoggerFunc.tradeInfo(">>>被冲销交易报单日期[" + mpc_dict['BOJEDT'] + "]报单序号[" + mpc_dict['BOSPSQ'] + "]") AfaLoggerFunc.tradeInfo(">>>开始查询原被冲销交易详细信息") wtr_dict = {} if not rccpsDBFunc.getTransWtr(mpc_dict['BOJEDT'],mpc_dict['BOSPSQ'],wtr_dict): return AfaFlowControl.ExitThisFlow("S999","查询原被冲销交易详细信息异常") AfaLoggerFunc.tradeInfo(">>>结束查询原被冲销交易详细信息") #更新冲销登记簿 AfaLoggerFunc.tradeInfo(">>>开始更新冲销登记簿") mpcbka_update_dict = {} mpcbka_update_dict['PRCCO'] = "RCCI1000" mpcbka_update_dict['STRINFO'] = "冲销交易被成功冲正" mpcbka_where_dict = {} mpcbka_where_dict['BJEDTE'] = mpc_dict['BJEDTE'] mpcbka_where_dict['BSPSQN'] = mpc_dict['BSPSQN'] ret = rccpsDBTrcc_mpcbka.update(mpcbka_update_dict,mpcbka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("更新冲销登记簿返回码和返回信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新冲销登记簿") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲正应答报文接收[TRC004_1161]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲销应答报文接收[TRC004_1162]进入***' ) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #查询冲正登记簿中是否有对此冲销交易的冲正 AfaLoggerFunc.tradeInfo(">>>开始检查此冲销交易是否已被冲正") where_sql = "ORMFN = '" + TradeContext.ORMFN + "'" ret = rccpsDBTrcc_atcbka.count(where_sql) if ret < 0: return AfaFlowControl.ExitThisFlow("S999","查询冲正登记簿异常,退出主流程") if ret > 0: return AfaFlowControl.ExitThisFlow("S999","冲正登记簿中存在对此冲销交易的冲正,退出主流程") AfaLoggerFunc.tradeInfo(">>>结束检查此冲销交易是否已被冲正") #=====更改柜员号和机构号为发起柜员号、发起机构号==== AfaLoggerFunc.tradeInfo("<<<<<<开始更改柜员号,机构号") #=====查找冲销交易的信息===== mpcbka_where_dict = {} mpcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN mpcbka_record = rccpsDBTrcc_mpcbka.selectu(mpcbka_where_dict) if(mpcbka_record == None): return AfaFlowControl.ExitThisFlow("S999","查询原冲销交易信息异常") if(len(mpcbka_record) <= 0): return AfaFlowControl.ExitThisFlow("S999","未找到原冲销交易信息,丢弃报文") #=====给机构号和柜员号赋值==== TradeContext.BETELR = mpcbka_record['BETELR'] TradeContext.BESBNO = mpcbka_record['BESBNO'] AfaLoggerFunc.tradeInfo("<<<<<<更改柜员号,机构号结束") #更新冲销登记簿中心返回信息 AfaLoggerFunc.tradeInfo(">>>开始更新冲销登记簿中心返回信息") mpcbka_update_dict = {} mpcbka_update_dict['PRCCO'] = TradeContext.PRCCO mpcbka_update_dict['STRINFO'] = TradeContext.STRINFO ret = rccpsDBTrcc_mpcbka.update(mpcbka_update_dict,mpcbka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","更新冲销登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束更新冲销登记簿中心返回信息") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=====查询被冲销交易信息==== AfaLoggerFunc.tradeInfo("<<<<<<开始查询被冲销的交易的信息") wtrbka_record = {} if not rccpsDBFunc.getTransWtr(mpcbka_record['BOJEDT'],mpcbka_record['BOSPSQ'],wtrbka_record): return AfaFlowControl.ExitThisFlow("S999","查询被冲销原交易详细信息异常") AfaLoggerFunc.tradeInfo("<<<<<<结束查询被冲销的交易的信息") #====为终端号和往来标识赋值==== TradeContext.TERMID = wtrbka_record['TERMID'] TradeContext.BRSFLG = wtrbka_record['BRSFLG'] #=====判断对方行冲销是否成功===== AfaLoggerFunc.tradeInfo("<<<<<<判断对方行冲销是否成功PRCCO=[" + TradeContext.PRCCO + "]") if(TradeContext.PRCCO == 'RCCI0000' or TradeContext.PRCCO == 'RCCO1106'): AfaLoggerFunc.tradeInfo("<<<<<<对方行冲销成功") #=====发起主机记账==== AfaLoggerFunc.tradeInfo("<<<<<<开始发起主机记账") #=====取最后一个记账成功状态的前置日期和前置流水号==== stat_list = [] if rccpsState.getTransStateSetm(wtrbka_record['BJEDTE'],wtrbka_record['BSPSQN'],PL_BCSTAT_ACC,PL_BDWFLG_SUCC,stat_list): entries_dict = {} entries_dict['FEDT'] = stat_list[0]['FEDT'] entries_dict['RBSQ'] = stat_list[0]['RBSQ'] entries_dict['PYRACC'] = wtrbka_record['PYRACC'] entries_dict['PYRNAM'] = wtrbka_record['PYRNAM'] entries_dict['PYEACC'] = wtrbka_record['PYEACC'] entries_dict['PYENAM'] = wtrbka_record['PYENAM'] entries_dict['OCCAMT'] = wtrbka_record['OCCAMT'] entries_dict['CHRGTYP'] = wtrbka_record['CHRGTYP'] entries_dict['CUSCHRG'] = wtrbka_record['CUSCHRG'] entries_dict['RCCSMCD'] = PL_RCCSMCD_CX TradeContext.BRSFLG = wtrbka_record['BRSFLG'] #卡折通存往账抹账会计分录赋值 if wtrbka_record['TRCCO'] == '3000002' or wtrbka_record['TRCCO'] == '3000004': rccpsEntries.KZTCWZMZ(entries_dict) #卡折本转异往账抹账会计分录赋值 if wtrbka_record['TRCCO'] == '3000003' or wtrbka_record['TRCCO'] == '3000005': rccpsEntries.KZBZYWZMZ(entries_dict) #卡折通兑往账抹账会计分录赋值 if wtrbka_record['TRCCO'] == '3000102' or wtrbka_record['TRCCO'] == '3000104': rccpsEntries.KZTDWZMZ(entries_dict) #卡折异转本往账抹账会计分录赋值 if wtrbka_record['TRCCO'] == '3000103' or wtrbka_record['TRCCO'] == '3000105': rccpsEntries.KZYZBWZMZ(entries_dict) #=====生成新的前置日期和前置流水号,并且更新到数据库中==== if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 : return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常") #设置原交易状态为冲销处理中 AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲销处理中') if not rccpsState.newTransState(mpcbka_record['BOJEDT'],mpcbka_record['BOSPSQ'],PL_BCSTAT_CANC,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲销处理中异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲销处理中') #=====调用主机接口函数===== rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo("<<<<<<发起主机抹账结束") else: AfaLoggerFunc.tradeInfo(">>>原交易未记账,冲销不抹账") #设置原交易状态为冲销处理中 AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲销处理中') if not rccpsState.newTransState(mpcbka_record['BOJEDT'],mpcbka_record['BOSPSQ'],PL_BCSTAT_CANC,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲销处理中异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲销处理中') TradeContext.errorCode = '0000' TradeContext.errorMsg = '原交易未记账,冲销不抹账' #根据主机返回信息,设置交易状态 stat_dict = {} stat_dict['BJEDTE'] = wtrbka_record['BJEDTE'] stat_dict['BSPSQN'] = wtrbka_record['BSPSQN'] stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO']= TradeContext.errorMsg AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]") if(TradeContext.errorCode == '0000'): #=====设置原交易状态为冲销成功==== AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲销成功") stat_dict['BCSTAT'] = PL_BCSTAT_CANC stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if TradeContext.existVariable('TRDT'): stat_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): stat_dict['TLSQ'] = TradeContext.TLSQ if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态冲销成功异常') AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲销成功") else: #=====设置原交易状态为冲销失败==== AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲销失败") stat_dict['BCSTAT'] = PL_BCSTAT_CANC stat_dict['BDWFLG'] = PL_BDWFLG_FAIL if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态冲销失败异常') AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲销失败") else: AfaLoggerFunc.tradeInfo("<<<<<<对方行冲销拒绝应答,不设置原交易状态") ##设置原交易状态为冲销处理中 #AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲销处理中') # #if not rccpsState.newTransState(wtrbka_record['BJEDTE'],wtrbka_record['BSPSQN'],PL_BCSTAT_CANC,PL_BDWFLG_WAIT): # return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲销处理中异常") # #AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲销处理中') # #if not AfaDBFunc.CommitSql( ): # AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) # return AfaFlowControl.ExitThisFlow("S999","Commit异常") # ##=====设置原交易状态为冲销失败==== #AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲销失败") # #stat_dict = {} #stat_dict['BJEDTE'] = wtrbka_record['BJEDTE'] #stat_dict['BSPSQN'] = wtrbka_record['BSPSQN'] #stat_dict['PRCCO'] = TradeContext.PRCCO #stat_dict['STRINFO']= TradeContext.STRINFO #stat_dict['BCSTAT'] = PL_BCSTAT_CANC #stat_dict['BDWFLG'] = PL_BDWFLG_FAIL # #if not rccpsState.setTransState(stat_dict): # return AfaFlowControl.ExitThisFlow('S999','设置业务状态冲销失败异常') # #AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲销失败") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲销应答报文接收[TRC004_1162]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo("'***农信银系统:通存通兑来账接收交易.卡 余额查询[1133] 进入") #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) AfaLoggerFunc.tradeInfo("交易前处理(登记流水,主机前处理)") #=====判断是否存在重复交易==== AfaLoggerFunc.tradeInfo("判断是否存在重复交易") balbka_dict = {'TRCDAT':TradeContext.TRCDAT,'TRCNO':TradeContext.TRCNO,'SNDBNKCO':TradeContext.SNDBNKCO} record_balbka = rccpsDBTrcc_balbka.selectu(balbka_dict) if( record_balbka == None ): return AfaFlowControl.ExitThisFlow('A009','判断重复交易时查询余额登记簿失败') if( len(record_balbka) > 0 ): #存在重复交易 AfaLoggerFunc.tradeInfo("存在重复交易") #====组织应答报文==== Rcvmbrco = TradeContext.SNDMBRCO Sndmbrco = TradeContext.RCVMBRCO Ormfn = TradeContext.MSGFLGNO #=====报文头==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.RCVMBRCO = Rcvmbrco #接受方成员行号 TradeContext.SNDMBRCO = Sndmbrco #发送方成员行号 TradeContext.SNDBRHCO = TradeContext.BESBNO #发起行网点号 TradeContext.SNDCLKNO = TradeContext.BETELR #发起行柜员号 TradeContext.SNDTRDAT = TradeContext.BJEDTE #发起行交易日期 TradeContext.SNDTRTIM = TradeContext.BJETIM #发起行交易时间 TradeContext.MSGFLGNO = Rcvmbrco+TradeContext.BJEDTE + TradeContext.SerialNo #报文标示号 TradeContext.ORMFN = Ormfn #参考报文标示号 TradeContext.NCCWKDAT = TradeContext.NCCworkDate #中心工作日期 TradeContext.OPRTYPNO = '30' #业务类型 TradeContext.ROPRTPNO = '30' #参考业务类型 TradeContext.TRANTYP = '0' #传输类型 #=====业务要素集==== TradeContext.CURPIN = "" #异地客户密码 TradeContext.PRCCO = "RCCS1105" #返回码 TradeContext.STRINFO = "重复报文" #附言 TradeContext.AVLBAL = record_balbka['AVLBAL'] #可用余额 TradeContext.ACCBAL = record_balbka['ACCBAL'] #账面余额 #=====直接向AFE发送通讯回执==== AfaLoggerFunc.tradeInfo("直接向AFE发送通讯回执") AfaAfeFunc.CommAfe() AfaLoggerFunc.tradeInfo("重复报文,做丢弃处理") return AfaFlowControl.ExitThisFlow('A009','重复报文做丢弃处理') ##############非重复交易################################################################# AfaLoggerFunc.tradeInfo("非重复交易") #=====组织登记余额查询查询登记簿的插入字典==== AfaLoggerFunc.tradeInfo("组织登记余额查询查询登记簿的插入字典") insert_dict = {} insert_dict['BJEDTE'] = TradeContext.BJEDTE insert_dict['BSPSQN'] = TradeContext.BSPSQN insert_dict['BRSFLG'] = PL_BRSFLG_RCV insert_dict['BESBNO'] = TradeContext.BESBNO insert_dict['BEACSB'] = "" #账务机构号 insert_dict['BETELR'] = TradeContext.BETELR insert_dict['BEAUUS'] = "" #授权柜员号 insert_dict['BEAUPS'] = "" #授权柜员密码 insert_dict['TERMID'] = "" #终端号 insert_dict['OPRNO'] = TradeContext.OPRTYPNO #业务类型 insert_dict['OPRATTNO'] = "" #业务属性 insert_dict['NCCWKDAT'] = TradeContext.NCCWKDAT #中心工作日期 insert_dict['TRCCO'] = TradeContext.TRCCO #交易代码 insert_dict['TRCDAT'] = TradeContext.TRCDAT #委托日期 insert_dict['TRCNO'] = TradeContext.TRCNO #交易流水号 insert_dict['MSGFLGNO'] = TradeContext.MSGFLGNO #报文标示号 insert_dict['SNDMBRCO'] = TradeContext.SNDMBRCO #发送方成员行号 insert_dict['RCVMBRCO'] = TradeContext.RCVMBRCO #接受方成员行号 insert_dict['SNDBNKCO'] = TradeContext.SNDBNKCO #发送方行号 insert_dict['SNDBNKNM'] = TradeContext.SNDBNKNM #发送方行名 insert_dict['RCVBNKCO'] = TradeContext.RCVBNKCO #接受方行号 insert_dict['RCVBNKNM'] = TradeContext.RCVBNKNM #接受方行名 insert_dict['CUR'] = '01' #币种 insert_dict['CHRGTYP'] = "" #手续费收取方式 insert_dict['LOCCUSCHRG'] = "" #本地客户手续费 insert_dict['CUSCHRG'] = TradeContext.CUSCHRG #异地客户手续费 insert_dict['PYRACC'] = TradeContext.PYRACC #付款人账号 insert_dict['PYEACC'] = TradeContext.PYEACC #收款人账号 insert_dict['STRINFO'] = TradeContext.STRINFO #附言 insert_dict['CERTTYPE'] = "" #证件类型 insert_dict['CERTNO'] = "" #证件号码 insert_dict['BNKBKNO'] = "" #存折号码 insert_dict['AVLBAL'] = "" #可用余额 insert_dict['ACCBAL'] = "" #账面余额 insert_dict['PRCCO'] = "" #返回码 #insert_dict['PRCINFO'] = "" #返回信息 #=====登记查询登记簿==== AfaLoggerFunc.tradeInfo("开始登记余额查询登记簿") res = rccpsDBTrcc_balbka.insertCmt(insert_dict) if( res == -1 ): return AfaFlowControl.ExitThisFlow('A009','登记余额查询登记簿失败') #解密客户密码 MIMA = ' ' PIN = TradeContext.CURPIN ACC = TradeContext.PYEACC AfaLoggerFunc.tradeDebug('密码[' + PIN + ']') AfaLoggerFunc.tradeDebug('账号[' + ACC + ']') ret = jiami.secDecryptPin(PIN,ACC,MIMA) if ret != 0: AfaLoggerFunc.tradeDebug("ret=[" + str(ret) + "]") AfaLoggerFunc.tradeDebug('调用加密服务器失败') else: TradeContext.CURPIN = MIMA AfaLoggerFunc.tradeDebug('密码new[' + TradeContext.CURPIN + ']') #=====调用主机交易,组织调用主机交易所需要的参数==== AfaLoggerFunc.tradeInfo("为主机交易赋参数") TradeContext.HostCode = '8810' TradeContext.ACCNO = TradeContext.PYEACC TradeContext.PASSWD = TradeContext.CURPIN TradeContext.CFFG = '1' TradeContext.WARNTNO = TradeContext.PYEACC[6:18] AfaLoggerFunc.tradeInfo("交易前处理(登记流水,主机前处理) 结束") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.回执操作).存款确认应答报文接收[TRCC004_1160]进入 ") #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=================匹配原交易信息=========================================== AfaLoggerFunc.tradeInfo(">>>开始匹配原请求交易信息") wtr_dict = {} if not rccpsDBFunc.getTransWtrCK(TradeContext.SNDBNKCO,TradeContext.TRCDAT,TradeContext.TRCNO,wtr_dict): return AfaFlowControl.ExitThisFlow('S999', "匹配原请求交易信息异常") TradeContext.BJEDTE = wtr_dict['BJEDTE'] TradeContext.BSPSQN = wtr_dict['BSPSQN'] AfaLoggerFunc.tradeInfo(">>>结束匹配原请求交易信息") #=================必要性检查=============================================== AfaLoggerFunc.tradeInfo(">>>开始进行必要性检查") #=================如果此交易已被冲正或冲销,则停止处理============================ where_sql = "ORMFN = '" + wtr_dict['MSGFLGNO'] + "'" AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲正") ret = rccpsDBTrcc_atcbka.count(where_sql) if ret < 0: return AfaFlowControl.ExitThisFlow("S999","查询冲正登记簿异常,退出主流程") if ret > 0: return AfaFlowControl.ExitThisFlow("S999","冲正登记簿中存在对此交易的冲正,退出主流程") AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲正") AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲销") ret = rccpsDBTrcc_mpcbka.count(where_sql) if ret < 0: return AfaFlowControl.ExitThisFlow("S999","查询冲销登记簿异常,退出主流程") if ret > 0: return AfaFlowControl.ExitThisFlow("S999","冲销登记簿中存在对此交易的冲销,退出主流程") AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲销") AfaLoggerFunc.tradeInfo(">>>结束进行必要性检查") #=================设置业务状态为清算======================================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为清算处理中") if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFESTL,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为清算处理中异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为清算处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为清算成功") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BESBNO'] = TradeContext.BESBNO stat_dict['BETELR'] = TradeContext.BETELR stat_dict['BCSTAT'] = PL_BCSTAT_MFESTL stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO'] = TradeContext.STRINFO if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为清算成功异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为清算成功") AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.回执操作).存款确认应答报文接收[TRCC004_1160]退出 ") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.本地操作).折本转异应答报文接收[TRCC006_1155]进入 ") #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=================必要性检查=============================================== AfaLoggerFunc.tradeInfo(">>>开始必要性检查") #=================若交易已被冲正或冲销,则停止处理================================ AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲正") where_sql = "ORMFN = '" + TradeContext.ORMFN + "'" ret = rccpsDBTrcc_atcbka.count(where_sql) if ret < 0: return AfaFlowControl.ExitThisFlow("S999","查询冲正登记簿异常,退出主流程") if ret > 0: return AfaFlowControl.ExitThisFlow("S999","冲正登记簿中存在对此交易的冲正,退出主流程") AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲正") AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲销") ret = rccpsDBTrcc_mpcbka.count(where_sql) if ret < 0: return AfaFlowControl.ExitThisFlow("S999","查询冲销登记簿异常,退出主流程") if ret > 0: return AfaFlowControl.ExitThisFlow("S999","冲销登记簿中存在对此交易的冲销,退出主流程") AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲销") AfaLoggerFunc.tradeInfo(">>>结束必要性检查") #=================匹配原交易信息=========================================== AfaLoggerFunc.tradeInfo(">>>开始匹配原交易") wtr_dict = {} if not rccpsDBFunc.getTransWtrAK(TradeContext.SNDBNKCO,TradeContext.TRCDAT,TradeContext.TRCNO,wtr_dict): return AfaFlowControl.ExitThisFlow('S999', "未找到原存款请求交易,停止处理") TradeContext.BJEDTE = wtr_dict['BJEDTE'] TradeContext.BSPSQN = wtr_dict['BSPSQN'] TradeContext.TRCCO = wtr_dict['TRCCO'] TradeContext.BESBNO = wtr_dict['BESBNO'] TradeContext.BETELR = wtr_dict['BETELR'] TradeContext.OCCAMT = str(wtr_dict['OCCAMT']) TradeContext.CHRGTYP = wtr_dict['CHRGTYP'] TradeContext.LOCCUSCHRG = str(wtr_dict['CUSCHRG']) TradeContext.PYRTYP = wtr_dict['PYRTYP'] TradeContext.PYRACC = wtr_dict['PYRACC'] TradeContext.PYRNAM = wtr_dict['PYRNAM'] TradeContext.CERTTYPE = wtr_dict['CERTTYPE'] TradeContext.CERTNO = wtr_dict['CERTNO'] TradeContext.TERMID = wtr_dict['TERMID'] TradeContext.WARNTNO = wtr_dict['BNKBKNO'] AfaLoggerFunc.tradeInfo(">>>结束匹配原交易") #=================若应答报文回复拒绝,则设置状态为拒绝,停止处理============= if TradeContext.PRCCO != 'RCCI0000': AfaLoggerFunc.tradeInfo(">>>对方返回拒绝应答") #=============设置业务状态为拒绝处理中================================= if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝处理中异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BESBNO'] = TradeContext.BESBNO stat_dict['BETELR'] = TradeContext.BETELR stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO'] = TradeContext.STRINFO if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为拒绝成功异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=============发起主机抹账============================================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账处理中") #=====特殊处理 关彬捷 20081127 调8813抹账,需产生新的前置流水号进行记账==== if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 : return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常") #为抹账赋值会计分录 entries_dict = {} entries_dict['FEDT'] = wtr_dict['BJEDTE'] entries_dict['RBSQ'] = wtr_dict['BSPSQN'] entries_dict['PYRACC'] = wtr_dict['PYRACC'] entries_dict['PYRNAM'] = wtr_dict['PYRNAM'] entries_dict['PYEACC'] = wtr_dict['PYEACC'] entries_dict['PYENAM'] = wtr_dict['PYENAM'] entries_dict['OCCAMT'] = wtr_dict['OCCAMT'] entries_dict['CHRGTYP'] = wtr_dict['CHRGTYP'] entries_dict['CUSCHRG'] = wtr_dict['CUSCHRG'] entries_dict['RCCSMCD'] = PL_RCCSMCD_CZ TradeContext.BRSFLG = PL_BRSFLG_SND rccpsEntries.KZBZYWZMZ(entries_dict) #====设置业务状态为抹账处理中==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999','设置业务状态为抹账处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #====自动抹账==== AfaLoggerFunc.tradeInfo(">>>开始发起主机抹账") #=====调起抹账主机接口==== rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束发起主机抹账") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO'] = TradeContext.errorMsg AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]") if TradeContext.errorCode == '0000': AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账成功") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['TRDT'] = TradeContext.TRDT stat_dict['TLSQ'] = TradeContext.TLSQ stat_dict['PRTCNT'] = 1 if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态抹账成功异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账成功") else: AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账失败") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_FAIL if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态抹账成功异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账失败") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") return AfaFlowControl.ExitThisFlow("S999","对方拒绝,停止处理") else: AfaLoggerFunc.tradeInfo(">>>对方返回成功应答") #=================设置业务状态为确认付款处理中============================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为确认付款处理中") if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CONFPAY,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为确认付款处理中异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为确认付款处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=================更新存款确认委托日期和交易流水号========================= AfaLoggerFunc.tradeInfo(">>>开始更新存款确认委托日期和交易流水号") wtrbka_update_dict = {} wtrbka_update_dict['COTRCDAT'] = TradeContext.TRCDAT wtrbka_update_dict['COTRCNO'] = TradeContext.SerialNo wtrbka_update_dict['COMSGFLGNO'] = TradeContext.RCVMBRCO + TradeContext.TRCDAT + TradeContext.SerialNo wtrbka_where_dict = {} wtrbka_where_dict['BJEDTE'] = TradeContext.BJEDTE wtrbka_where_dict['BSPSQN'] = TradeContext.BSPSQN ret = rccpsDBTrcc_wtrbka.update(wtrbka_update_dict,wtrbka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow('S999', "更新存款确认委托日期和交易流水号异常") AfaLoggerFunc.tradeInfo(">>>结束更新存款确认委托日期和交易流水号") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=================为存款确认请求报文做准备================================= AfaLoggerFunc.tradeInfo(">>>开始为存款确认请求报文做准备") TradeContext.MSGTYPCO = 'SET009' TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR #TradeContext.SNDTRDAT = TradeContext.BJEDTE #TradeContext.SNDTRTIM = TradeContext.BJETIM #TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.BJEDTE + TradeContext.TRCNO TradeContext.ORMFN = TradeContext.ORMFN TradeContext.OPRTYPNO = '30' TradeContext.ROPRTPNO = '30' TradeContext.TRANTYP = '0' TradeContext.ORTRCCO = TradeContext.TRCCO TradeContext.ORTRCNO = TradeContext.TRCNO TradeContext.TRCCO = '3000503' TradeContext.TRCNO = TradeContext.SerialNo TradeContext.CURPIN = "" TradeContext.STRINFO = '收到存款应答,自动发送存款确认' AfaLoggerFunc.tradeInfo(">>>结束为存款确认请求报文做准备") AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.本地操作).卡本转异应答报文接收[TRCC006_1155]退出 ") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑业务回执报文接收[TRC004_1147]进入***' ) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=================匹配原交易信息=========================================== wtrbka_where_dict = {} wtrbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN wtrbka_dict = {} wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(wtrbka_where_dict) if wtrbka_dict == None: return AfaFlowControl.ExitThisFlow('S999', "查询通存通兑业务信息登记簿异常") if len(wtrbka_dict) > 0: TradeContext.BJEDTE = wtrbka_dict['BJEDTE'] TradeContext.BSPSQN = wtrbka_dict['BSPSQN'] TradeContext.TRCCO = wtrbka_dict['TRCCO'] TradeContext.BESBNO = wtrbka_dict['BESBNO'] TradeContext.BETELR = wtrbka_dict['BETELR'] TradeContext.OCCAMT = str(wtrbka_dict['OCCAMT']) TradeContext.CHRGTYP = wtrbka_dict['CHRGTYP'] TradeContext.LOCCUSCHRG = str(wtrbka_dict['CUSCHRG']) TradeContext.PYETYP = wtrbka_dict['PYETYP'] TradeContext.PYEACC = wtrbka_dict['PYEACC'] TradeContext.PYENAM = wtrbka_dict['PYENAM'] TradeContext.PYRTYP = wtrbka_dict['PYRTYP'] TradeContext.PYRACC = wtrbka_dict['PYRACC'] TradeContext.PYRNAM = wtrbka_dict['PYRNAM'] TradeContext.CERTTYPE = wtrbka_dict['CERTTYPE'] TradeContext.CERTNO = wtrbka_dict['CERTNO'] TradeContext.TERMID = wtrbka_dict['TERMID'] TradeContext.WARNTNO = wtrbka_dict['BNKBKNO'] #============设置原交易状态为拒绝====================================== AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为拒绝处理中") if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝处理中异常") AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为拒绝成功") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO'] = TradeContext.STRINFO if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为拒绝成功异常") AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝成功") else: AfaLoggerFunc.tradeInfo(">>>通存通兑业务登记簿中未找到原请求交易信息,开始查询原存款确认信息") wtrbka_where_dict = {} wtrbka_where_dict['COMSGFLGNO'] = TradeContext.ORMFN wtrbka_dict = {} wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(wtrbka_where_dict) if wtrbka_dict == None: return AfaFlowControl.ExitThisFlow('S999', "查询通存通兑业务信息登记簿异常") if len(wtrbka_dict) > 0: TradeContext.BJEDTE = wtrbka_dict['BJEDTE'] TradeContext.BSPSQN = wtrbka_dict['BSPSQN'] TradeContext.TRCCO = wtrbka_dict['TRCCO'] TradeContext.BESBNO = wtrbka_dict['BESBNO'] TradeContext.BETELR = wtrbka_dict['BETELR'] TradeContext.OCCAMT = str(wtrbka_dict['OCCAMT']) TradeContext.CHRGTYP = wtrbka_dict['CHRGTYP'] TradeContext.LOCCUSCHRG = str(wtrbka_dict['CUSCHRG']) TradeContext.PYETYP = wtrbka_dict['PYETYP'] TradeContext.PYEACC = wtrbka_dict['PYEACC'] TradeContext.PYENAM = wtrbka_dict['PYENAM'] TradeContext.PYRTYP = wtrbka_dict['PYRTYP'] TradeContext.PYRACC = wtrbka_dict['PYRACC'] TradeContext.PYRNAM = wtrbka_dict['PYRNAM'] TradeContext.CERTTYPE = wtrbka_dict['CERTTYPE'] TradeContext.CERTNO = wtrbka_dict['CERTNO'] TradeContext.TERMID = wtrbka_dict['TERMID'] TradeContext.WARNTNO = wtrbka_dict['BNKBKNO'] #============设置原交易状态为拒绝====================================== AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为拒绝处理中") if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝处理中异常") AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为拒绝成功") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BESBNO'] = TradeContext.BESBNO stat_dict['BETELR'] = TradeContext.BETELR stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO'] = TradeContext.STRINFO if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为拒绝成功异常") AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝成功") else: AfaLoggerFunc.tradeInfo(">>>通存通兑业务登记簿中未找到原存款确认信息,开始查询余额查询登记簿") balbka_where_dict = {} balbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN balbka_dict = {} balbka_dict = rccpsDBTrcc_balbka.selectu(balbka_where_dict) if balbka_dict == None: return AfaFlowControl.ExitThisFlow('S999', "查询余额查询登记簿异常") if len(balbka_dict) > 0: TradeContext.TRCCO = balbka_dict['TRCCO'] #=====更新原余额查询交易返回码================================= AfaLoggerFunc.tradeInfo(">>>开始更新原余额查询交易返回码") balbka_update_dict = {} balbka_update_dict['PRCCO'] = TradeContext.PRCCO balbka_update_dict['STRINFO'] = TradeContext.STRINFO ret = rccpsDBTrcc_balbka.update(balbka_update_dict,balbka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow('S999', "更新原余额查询交易返回码异常") AfaLoggerFunc.tradeInfo(">>>结束更新原余额查询交易返回码") else: AfaLoggerFunc.tradeInfo(">>>余额查询登记簿中未找到原交易信息,开始查询自动冲正登记簿") atcbka_where_dict = {} atcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN atcbka_dict = {} atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where_dict) if atcbka_dict == None: return AfaFlowControl.ExitThisFlow('S999', "查询自动冲正登记簿异常") if len(atcbka_dict) > 0: TradeContext.BOJEDT = atcbka_dict['BOJEDT'] TradeContext.BOSPSQ = atcbka_dict['BOSPSQ'] TradeContext.TRCCO = atcbka_dict['TRCCO'] #====更新自动冲正交易返回码================================ AfaLoggerFunc.tradeInfo(">>>开始更新原自动冲正交易返回码") atcbka_update_dict = {} atcbka_update_dict['PRCCO'] = TradeContext.PRCCO atcbka_update_dict['STRINFO'] = TradeContext.STRINFO ret = rccpsDBTrcc_atcbka.update(atcbka_update_dict,atcbka_where_dict) if ret<= 0: return AfaFlowControl.ExitThisFlow('S999', "更新原冲正交易返回码异常") AfaLoggerFunc.tradeInfo(">>>结束更新原自动冲正交易返回码") #====设置原被冲正交易业务状态为冲正失败================ #AfaLoggerFunc.tradeInfo(">>>开始设置原被冲正交易业务状态为冲正失败") # #stat_dict = {} #stat_dict['BJEDTE'] = TradeContext.BOJEDT #stat_dict['BSPSQN'] = TradeContext.BOSPSQ #stat_dict['BCSTAT'] = PL_BCSTAT_CANC #stat_dict['BDWFLG'] = PL_BDWFLG_FAIL #stat_dict['PRCCO'] = TradeContext.PRCCO #stat_dict['STRINFO'] = TradeContext.STRINFO # #if not rccpsState.setTransState(stat_dict): # return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为冲正失败异常") # #AfaLoggerFunc.tradeInfo(">>>结束设置原被冲正交易业务状态为冲正失败") else: AfaLoggerFunc.tradeInfo(">>>自动冲正登记簿中未找到原交易信息,开始查询柜面冲销登记簿") mpcbka_where_dict = {} mpcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN mpcbka_dict = {} mpcbka_dict = rccpsDBTrcc_mpcbka.selectu(mpcbka_where_dict) if mpcbka_dict == None: return AfaFlowControl.ExitThisFlow('S999', "查询柜面冲销登记簿异常") if len(mpcbka_dict) > 0: TradeContext.BOJEDT = mpcbka_dict['BOJEDT'] TradeContext.BOSPSQ = mpcbka_dict['BOSPSQ'] TradeContext.TRCCO = mpcbka_dict['TRCCO'] TradeContext.ORTRCCO = mpcbka_dict['ORTRCCO'] TradeContext.BESBNO = mpcbka_dict['BESBNO'] TradeContext.BETELR = mpcbka_dict['BETELR'] TradeContext.TERMID = mpcbka_dict['TERMID'] #====更新柜台冲销交易返回码================================ AfaLoggerFunc.tradeInfo(">>>开始更新原柜台冲销交易返回码") mpcbka_update_dict = {} mpcbka_update_dict['PRCCO'] = TradeContext.PRCCO mpcbka_update_dict['STRINFO'] = TradeContext.STRINFO ret = rccpsDBTrcc_mpcbka.update(mpcbka_update_dict,mpcbka_where_dict) if ret <=0: return AfaFlowControl.ExitThisFlow('S999', "更新原柜面冲销交易返回码异常") AfaLoggerFunc.tradeInfo(">>>结束更新原柜面冲销交易返回码") #====设置原被冲销交易业务状态为冲销失败================ #AfaLoggerFunc.tradeInfo(">>>开始设置原被冲销交易业务状态为冲销处理中") # #if not rccpsState.newTransState(TradeContext.BOJEDT,TradeContext.BOSPSQ,PL_BCSTAT_CANC,PL_BDWFLG_WAIT): # return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为冲销失败异常") # #AfaLoggerFunc.tradeInfo(">>>结束设置原被冲销交易业务状态为冲销处理中") # #if not AfaDBFunc.CommitSql( ): # AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) # return AfaFlowControl.ExitThisFlow("S999","Commit异常") #AfaLoggerFunc.tradeInfo(">>>Commit成功") # #AfaLoggerFunc.tradeInfo(">>>开始设置原被冲销交易业务状态为冲销失败") # #stat_dict = {} # #stat_dict['BJEDTE'] = TradeContext.BJEDTE #stat_dict['BSPSQN'] = TradeContext.BSPSQN #stat_dict['PRCCO'] = TradeContext.PRCCO #stat_dict['STRINFO'] = TradeContext.STRINFO #stat_dict['BCSTAT'] = PL_BCSTAT_CANC #stat_dict['BDWFLG'] = PL_BDWFLG_FAIL # #AfaLoggerFunc.tradeInfo(">>>结束设置原被冲销交易业务状态为冲销失败") else: return AfaFlowControl.ExitThisFlow('S999', "未找到原交易信息,丢弃报文") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") #=================若原交易为通存交易,开始自动抹账========================== if TradeContext.TRCCO == '3000002' or TradeContext.TRCCO == '3000003' or TradeContext.TRCCO == '3000004' or TradeContext.TRCCO == '3000005': #=====特殊处理 关彬捷 20081127 调8813抹账,需产生新的前置流水号进行记账==== if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 : return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常") else: AfaLoggerFunc.tradeInfo(">>>成功产生新的前置流水号") #为抹账赋值会计分录 entries_dict = {} entries_dict['FEDT'] = TradeContext.BJEDTE entries_dict['RBSQ'] = TradeContext.BSPSQN entries_dict['PYRACC'] = TradeContext.PYRACC entries_dict['PYRNAM'] = TradeContext.PYRNAM entries_dict['PYEACC'] = TradeContext.PYEACC entries_dict['PYENAM'] = TradeContext.PYENAM entries_dict['OCCAMT'] = TradeContext.OCCAMT entries_dict['CHRGTYP'] = TradeContext.CHRGTYP entries_dict['CUSCHRG'] = TradeContext.LOCCUSCHRG entries_dict['RCCSMCD'] = PL_RCCSMCD_CX TradeContext.BRSFLG = PL_BRSFLG_SND if TradeContext.TRCCO == '3000002' or TradeContext.TRCCO == '3000004': rccpsEntries.KZTCWZMZ(entries_dict) if TradeContext.TRCCO == '3000003' or TradeContext.TRCCO == '3000005': rccpsEntries.KZBZYWZMZ(entries_dict) #=============设置原交易业务状态为抹账处理中=========================== AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为抹账处理中") #====设置业务状态为抹账处理中==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999','设置业务状态为抹账处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为抹账处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=============开始发起主机抹账========================================= AfaLoggerFunc.tradeInfo(">>>开始主机抹账") #=====调起抹账主机接口==== rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束主机抹账") AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO'] = TradeContext.errorMsg if TradeContext.errorCode == '0000': #=========设置原交易业务状态为抹账成功============================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账成功") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['TRDT'] = TradeContext.TRDT stat_dict['TLSQ'] = TradeContext.TLSQ stat_dict['PRTCNT'] = 1 if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态抹账成功异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账成功") else: #=========设置原交易业务状态为抹账失败============================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账失败") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_FAIL if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态抹账成功异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账失败") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑业务回执报文接收[TRC004_1147]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.本地操作).业务回执报文接收[TRCC006_1110]进入***' ) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #==========检查业务类型========== if TradeContext.ROPRTPNO == "20": #==========实时汇兑业务============================================= AfaLoggerFunc.tradeInfo(">>>原业务类型为20,汇兑业务") #==========根据发送行号,委托日期,交易流水号查询原交易信息=========== AfaLoggerFunc.tradeInfo(">>>开始根据发送行号,委托日期,交易流水号查询交易信息") ORSNDMBRCO = TradeContext.ORMFN[:10] ORTRCDAT = TradeContext.ORMFN[10:18] ORTRCNO = TradeContext.ORMFN[18:] trc_dict = {} if not rccpsDBFunc.getTransTrcPK(ORSNDMBRCO,ORTRCDAT,ORTRCNO,trc_dict): return False AfaLoggerFunc.tradeInfo(">>>结束根据发送行号,委托日期,交易流水号查询交易信息") #==========检查原业务是否MFE收妥=================================== tmp_stat_dict = {} if not rccpsState.getTransStateSet(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_MFERCV,PL_BDWFLG_SUCC,tmp_stat_dict): return AfaFlowControl.ExitThisFlow("S999","原汇兑业务MFE尚未收妥,停止处理") #==========根据中心返回码设置原交易状态============================ AfaLoggerFunc.tradeInfo(">>>中心处理码为[" + TradeContext.PRCCO + "]") stat_dict = {} stat_dict['BJEDTE'] = trc_dict['BJEDTE'] stat_dict['BSPSQN'] = trc_dict['BSPSQN'] stat_dict['BESBNO'] = trc_dict['BESBNO'] stat_dict['BETELR'] = TradeContext.BETELR stat_dict['PRCCO'] = TradeContext.PRCCO #stat_dict['STRINFO']= TradeContext.STRINFO if TradeContext.PRCCO == "RCCI0000": return AfaFlowControl.ExitThisFlow("S999","业务回执报文中心处理码不应为RCCI0000") elif TradeContext.PRCCO == "RCCO1078" or TradeContext.PRCCO == "RCCO1079": #==========中心返回表示排队的处理码,开始设置状态为排队===== AfaLoggerFunc.tradeInfo(">>>开始设置状态为排队") if not rccpsState.newTransState(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_MFEQUE,PL_BDWFLG_WAIT): return False if not AfaDBFunc.CommitSql( ): return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") stat_dict['BCSTAT'] = PL_BCSTAT_MFEQUE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为排队") else: #==========中心返回表示拒绝的处理码,开始设置状态为拒绝===== AfaLoggerFunc.tradeInfo(">>>开始设置状态为拒绝") if not rccpsState.newTransState(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT): return False if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为拒绝") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") #==========设置当前机构为原机构============================ TradeContext.BESBNO = trc_dict['BESBNO'] TradeContext.BETELR = trc_dict['BETELR'] TradeContext.TERMID = trc_dict['TERMID'] #==========设置原交易状态为抹账处理中====================== AfaLoggerFunc.tradeInfo(">>>开始设置状态为抹账处理中") TradeContext.NOTE3 = "中心拒绝,行内自动抹账" if not rccpsState.newTransState(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_HCAC,PL_BDWFLG_WAIT): return False if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") AfaLoggerFunc.tradeInfo(">>>结束设置状态为抹账处理中") #==========发起主机抹账==================================== AfaLoggerFunc.tradeInfo(">>>开始主机抹账") ##====== 张恒 抹账操作 增加于20091112 ==============## #汇兑往帐抹帐字典赋值 input_dict = {} input_dict['BJEDTE'] = trc_dict['BJEDTE'] input_dict['BSPSQN'] = trc_dict['BSPSQN'] if len(trc_dict['PYRACC']) != 0 : input_dict['PYRACC'] = trc_dict['PYRACC'] else: input_dict['PYRACC'] = '' input_dict['OCCAMT'] = str(trc_dict['OCCAMT']) input_dict['BBSSRC'] = trc_dict['BBSSRC'] input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑往帐抹帐 rccpsEntries.HDWZMZ(input_dict) #=====设置记账函数接口==== rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束主机抹账") stat_dict['PRCCO'] = '' if TradeContext.errorCode == '0000': #==========设置原交易状态为抹账成功============================ AfaLoggerFunc.tradeInfo(">>>开始设置状态为抹账成功") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if TradeContext.existVariable('TRDT'): AfaLoggerFunc.tradeInfo("TRDT:" + TradeContext.TRDT) stat_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): AfaLoggerFunc.tradeInfo("TLSQ:" + TradeContext.TLSQ) stat_dict['TLSQ'] = TradeContext.TLSQ if TradeContext.existVariable('DASQ'): AfaLoggerFunc.tradeInfo("DASQ:" + TradeContext.DASQ) stat_dict['DASQ'] = TradeContext.DASQ stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO']= TradeContext.errorMsg if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为抹账成功") if trc_dict['TRCCO'] == '2000004': #===========退汇业务,更新原交易挂账代销账序号============== AfaLoggerFunc.tradeInfo(">>>开始更新原交易挂账代销账序号") orstat_dict = {} orstat_dict['BJEDTE'] = trc_dict['BOJEDT'] orstat_dict['BSPSQN'] = trc_dict['BOSPSQ'] orstat_dict['BCSTAT'] = PL_BCSTAT_HANG orstat_dict['BDWFLG'] = PL_BDWFLG_SUCC if TradeContext.existVariable('DASQ'): orstat_dict['DASQ'] = TradeContext.DASQ if not rccpsState.setTransState(orstat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束更新原交易挂账代销账序号") else: #==========设置原交易状态为抹账失败======================== AfaLoggerFunc.tradeInfo(">>>开始设置状态为抹账失败") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_FAIL if TradeContext.existVariable('TRDT'): AfaLoggerFunc.tradeInfo("TRDT:" + TradeContext.TRDT) stat_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): AfaLoggerFunc.tradeInfo("TLSQ:" + TradeContext.TLSQ) stat_dict['TLSQ'] = TradeContext.TLSQ if TradeContext.existVariable('DASQ'): AfaLoggerFunc.tradeInfo("DASQ:" + TradeContext.DASQ) stat_dict['DASQ'] = TradeContext.DASQ stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO']= TradeContext.errorMsg if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为抹账失败") elif TradeContext.ROPRTPNO == "21": #==========全国汇票业务============================================ AfaLoggerFunc.tradeInfo(">>>原业务类型为21,汇票业务") #==========根据发送行号,委托日期,交易流水号查询原交易信息========== AfaLoggerFunc.tradeInfo(">>>开始根据发送行号,委托日期,交易流水号查询交易信息") ORSNDMBRCO = TradeContext.ORMFN[:10] ORTRCDAT = TradeContext.ORMFN[10:18] ORTRCNO = TradeContext.ORMFN[18:] trc_dict = {} if not rccpsDBFunc.getTransBilPK(ORSNDMBRCO,ORTRCDAT,ORTRCNO,trc_dict): return False if not rccpsDBFunc.getInfoBil(trc_dict['BILVER'],trc_dict['BILNO'],trc_dict['BILRS'],trc_dict): return False TradeContext.ORTRCCO = trc_dict['TRCCO'] AfaLoggerFunc.tradeInfo(">>>结束根据发送行号,委托日期,交易流水号查询交易信息") #==========检查原业务是否MFE收妥=================================== tmp_stat_dict = {} if not rccpsState.getTransStateSet(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_MFERCV,PL_BDWFLG_SUCC,tmp_stat_dict): return AfaFlowControl.ExitThisFlow("S999","原汇票业务MFE尚未收妥,停止处理") #==========根据中心返回码设置原交易状态============================ AfaLoggerFunc.tradeInfo(">>>中心处理码为[" + TradeContext.PRCCO + "]") stat_dict = {} stat_dict['BJEDTE'] = trc_dict['BJEDTE'] stat_dict['BSPSQN'] = trc_dict['BSPSQN'] stat_dict['BESBNO'] = trc_dict['BESBNO'] stat_dict['BETELR'] = TradeContext.BETELR stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO']= TradeContext.STRINFO if TradeContext.PRCCO == "RCCI0000": return AfaFlowControl.ExitThisFlow("S999","业务回执报文中心处理码不应为RCCI0000") elif TradeContext.PRCCO == "RCCO1078" or TradeContext.PRCCO == "RCCO1079": #==========中心返回表示排队的处理码,开始设置状态为排队====== AfaLoggerFunc.tradeInfo(">>>开始设置状态为排队") if not rccpsState.newTransState(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_MFEQUE,PL_BDWFLG_WAIT): return False if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") stat_dict['BCSTAT'] = PL_BCSTAT_MFEQUE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为排队") else: #==========中心返回表示拒绝的处理码,开始设置状态为拒绝====== AfaLoggerFunc.tradeInfo(">>>开始设置状态为拒绝") if not rccpsState.newTransState(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT): return False if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为拒绝") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") #==========如果原交易为汇票签发,需自动抹账======= if TradeContext.ORTRCCO == '2100001': #==========设置当前机构为原机构,当前柜员为原柜员=========== TradeContext.BESBNO = trc_dict['BESBNO'] TradeContext.BETELR = trc_dict['BETELR'] TradeContext.TERMID = trc_dict['TERMID'] #==========设置原交易状态为抹账处理中====================== AfaLoggerFunc.tradeInfo(">>>开始设置状态为抹账处理中") TradeContext.NOTE3 = "中心拒绝,行内自动抹账" if not rccpsState.newTransState(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_HCAC,PL_BDWFLG_WAIT): return False if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") AfaLoggerFunc.tradeInfo(">>>结束设置状态为抹账处理中") #==========发起主机抹账==================================== AfaLoggerFunc.tradeInfo(">>>开始主机抹账") #=====如果资金来源为代销账,使用8813红字冲销==== if trc_dict['BBSSRC'] == '3': #待销账 TradeContext.BJEDTE = trc_dict['BJEDTE'] TradeContext.BSPSQN = trc_dict['BSPSQN'] TradeContext.OCCAMT = str(trc_dict['BILAMT']) #抹账金额为出票金额 TradeContext.HostCode = '8813' TradeContext.RCCSMCD = PL_RCCSMCD_HPQF #主机摘要码:汇票签发 TradeContext.DASQ = '' TradeContext.RVFG = '0' #红蓝字标志 0 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_HCHK #借方账号(汇票签发,借汇出汇款) TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDXZ #贷方账号(贷农信银代销账) #=====开始调函数拼贷方账号第25位校验位==== TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC, 25) TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC, 25) AfaLoggerFunc.tradeInfo( '借方账号:' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '贷方账号:' + TradeContext.RBAC ) else: TradeContext.BOJEDT = trc_dict['BJEDTE'] TradeContext.BOSPSQ = trc_dict['BSPSQN'] TradeContext.HostCode='8820' #=====调起主机记账接口==== rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束主机抹账") if TradeContext.errorCode == '0000': #==========设置原交易状态为抹账成功======================== AfaLoggerFunc.tradeInfo(">>>开始设置状态为抹账成功") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_SUCC if TradeContext.existVariable('TRDT'): AfaLoggerFunc.tradeInfo("TRDT:" + TradeContext.TRDT) stat_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): AfaLoggerFunc.tradeInfo("TLSQ:" + TradeContext.TLSQ) stat_dict['TLSQ'] = TradeContext.TLSQ if TradeContext.existVariable('DASQ'): AfaLoggerFunc.tradeInfo("DASQ:" + TradeContext.DASQ) stat_dict['DASQ'] = TradeContext.DASQ stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO']= TradeContext.errorMsg if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为抹账成功") else: #==========设置原交易状态为抹账失败======================== AfaLoggerFunc.tradeInfo(">>>开始设置状态为抹账失败") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_FAIL if TradeContext.existVariable('TRDT'): AfaLoggerFunc.tradeInfo("TRDT:" + TradeContext.TRDT) stat_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): AfaLoggerFunc.tradeInfo("TLSQ:" + TradeContext.TLSQ) stat_dict['TLSQ'] = TradeContext.TLSQ if TradeContext.existVariable('DASQ'): AfaLoggerFunc.tradeInfo("DASQ:" + TradeContext.DASQ) stat_dict['DASQ'] = TradeContext.DASQ stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO']= TradeContext.errorMsg if not rccpsState.setTransState(stat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束设置状态为抹账失败") #==========如果原交易为汇票退票,需重置实际结算金额和结余金额======= if TradeContext.ORTRCCO == '2100103': AfaLoggerFunc.tradeInfo(">>>汇票退票,开始重置实际结算金额和结余金额") bilinf_update_dict = {} bilinf_update_dict['OCCAMT'] = "0.00" bilinf_update_dict['RMNAMT'] = "0.00" bilinf_where_dict = {} bilinf_where_dict['BILVER'] = trc_dict['BILVER'] bilinf_where_dict['BILNO'] = trc_dict['BILNO'] ret = rccpsDBTrcc_bilinf.update(bilinf_update_dict,bilinf_where_dict) if ret == None: return AfaFlowControl.ExitThisFlow("S999","更新汇票信息登记簿异常") if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","无对应的汇票信息") AfaLoggerFunc.tradeInfo(">>>汇票退票,结束重置实际结算金额和结余金额") elif TradeContext.ROPRTPNO == "99": #==========信息类业务=============================================== AfaLoggerFunc.tradeInfo(">>>原业务类型为99,信息类业务") #==========根据发送行号,委托日期,交易流水号查询原交易信息=========== AfaLoggerFunc.tradeInfo(">>>开始根据发送行号,委托日期,交易流水号查询交易信息") bka_where_dict = {} bka_where_dict['SNDMBRCO'] = TradeContext.ORMFN[:10] bka_where_dict['TRCDAT'] = TradeContext.ORMFN[10:18] bka_where_dict['TRCNO'] = TradeContext.ORMFN[18:] bka_update_dict = {} bka_update_dict['PRCCO'] = TradeContext.PRCCO bka_update_dict['STRINFO'] = TradeContext.STRINFO #==========查询汇兑查询查复登记簿====================================== AfaLoggerFunc.tradeInfo(">>>开始查询汇兑查询查复登记簿") bka_dict = rccpsDBTrcc_hdcbka.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询汇兑查询业务登记簿异常") if len(bka_dict) > 0: #======汇兑查询查复登记簿中找到原交易信息,开始更新回执信息========= AfaLoggerFunc.tradeInfo(">>>汇兑查询查复登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_hdcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") if (bka_dict['TRCCO'] == '9900512' or bka_dict['TRCCO'] == '9900523') and TradeContext.PRCCO != 'RCCI0000': #======汇兑\特约汇兑查复业务,中心返回码非成功,修改原查询交易查询查复标识为未查复== AfaLoggerFunc.tradeInfo(">>>汇兑\特约汇兑查复业务,中心返回码非成功") AfaLoggerFunc.tradeInfo(">>>开始修改原汇兑\特约汇兑查询交易查询查复标识为未查复") bka_update_dict = {'ISDEAL':PL_ISDEAL_UNDO} bka_where_dict = {'BJEDTE':bka_dict['BOJEDT'],'BSPSQN':bka_dict['BOSPSQ']} ret = rccpsDBTrcc_hdcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新原汇兑\特约汇兑查询交易查询查复标识为未查复异常") AfaLoggerFunc.tradeInfo(">>>结束修改原汇兑\特约汇兑查询交易查询查复标识为未查复") else: #======汇兑查询查复登记簿中未找到原交易信息,开始查询票据查询查复登记簿==== AfaLoggerFunc.tradeInfo(">>>汇兑查询查复登记簿中未找到原交易信息,开始查询票据查询查复登记簿") bka_dict = rccpsDBTrcc_pjcbka.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询票据查询业务登记簿异常") if len(bka_dict) > 0: #======票据查询查复登记簿中找到原交易信息,开始更新回执信息==== AfaLoggerFunc.tradeInfo(">>>票据查询查复登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_pjcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") if bka_dict['TRCCO'] == '9900521' and TradeContext.PRCCO != 'RCCI0000': #======票据查复业务,中心返回码非成功,修改原查询交易查询查复标识为未查复== AfaLoggerFunc.tradeInfo(">>>票据查复业务,中心返回码非成功") AfaLoggerFunc.tradeInfo(">>>开始修改原票据查询交易查询查复标识为未查复") bka_update_dict = {'ISDEAL':PL_ISDEAL_UNDO} bka_where_dict = {'BJEDTE':bka_dict['BOJEDT'],'BSPSQN':bka_dict['BOSPSQ']} ret = rccpsDBTrcc_pjcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新原票据查询交易查询查复标识为未查复异常") AfaLoggerFunc.tradeInfo(">>>结束修改原票据查询交易查询查复标识为未查复") else: #======票据查询查复登记簿中未找到原交易信息,开始查询汇票查询查复登记簿==== AfaLoggerFunc.tradeInfo(">>>票据查询查复登记簿中未找到原交易信息,开始查询汇票查询查复登记簿") bka_dict = rccpsDBTrcc_hpcbka.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询汇票查询业务登记簿异常") if len(bka_dict) > 0: #======汇票查询查复登记簿中找到原交易信息,开始更新回执信息==== AfaLoggerFunc.tradeInfo(">>>汇票查询查复登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_hpcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") if bka_dict['TRCCO'] == '9900527' and TradeContext.PRCCO != 'RCCI0000': #======汇票查复业务,中心返回码非成功,修改原查询交易查询查复标识为未查复== AfaLoggerFunc.tradeInfo(">>>汇票查复业务,中心返回码非成功") AfaLoggerFunc.tradeInfo(">>>开始修改原汇票查询交易查询查复标识为未查复") bka_update_dict = {'ISDEAL':PL_ISDEAL_UNDO} bka_where_dict = {'BJEDTE':bka_dict['BOJEDT'],'BSPSQN':bka_dict['BOSPSQ']} ret = rccpsDBTrcc_hpcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新原汇票查询交易查询查复标识为未查复异常") AfaLoggerFunc.tradeInfo(">>>结束修改原汇票查询交易查询查复标识为未查复") else: #======汇票查询查复登记簿中未找到原交易信息,开始查询支付业务状态查询查复登记簿==== AfaLoggerFunc.tradeInfo(">>>汇票查询查复登记簿中未找到原交易信息,开始查询支付业务状态查询查复登记簿") bka_dict = rccpsDBTrcc_ztcbka.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询业务状态查询业务登记簿异常") if len(bka_dict) > 0: #======业务状态查询查复登记簿中找到原交易信息,开始更新回执信息==== AfaLoggerFunc.tradeInfo(">>>业务状态查询查复登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_ztcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") if bka_dict['TRCCO'] == '9900507' and TradeContext.PRCCO != 'RCCI0000': #======支付业务状态查复业务,中心返回码非成功,修改原查询交易查询查复标识为未查复== AfaLoggerFunc.tradeInfo(">>>支付业务状态查复业务,中心返回码非成功") AfaLoggerFunc.tradeInfo(">>>开始修改原支付业务状态查询交易查询查复标识为未查复") bka_update_dict = {'ISDEAL':PL_ISDEAL_UNDO} bka_where_dict = {'BJEDTE':bka_dict['BOJEDT'],'BSPSQN':bka_dict['BOSPSQ']} ret = rccpsDBTrcc_hpcbka.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新原支付业务状态查询交易查询查复标识为未查复异常") AfaLoggerFunc.tradeInfo(">>>结束修改原支付业务状态查询交易查询查复标识为未查复") else: #==支付业务状态查询查复登记簿中未找到原交易信息,开始查询撤销申请登记簿== AfaLoggerFunc.tradeInfo(">>>支付业务状态查询查复登记簿中未找到原交易信息,开始查询撤销申请登记簿") bka_dict = rccpsDBTrcc_trccan.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询资金调拨申请登记簿异常") if len(bka_dict) > 0: #==撤销申请登记簿中找到原交易信息,开始更新回执信息========= AfaLoggerFunc.tradeInfo(">>>撤销申请登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_trccan.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") else: #==撤销申请登记簿中未找到原交易信息,开始查询紧急止付登记簿== AfaLoggerFunc.tradeInfo(">>>支付业务状态查询查复登记簿中未找到原交易信息,开始查询紧急止付登记簿") bka_dict = rccpsDBTrcc_existp.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询紧急止付登记簿异常") if len(bka_dict) > 0: #==紧急止付登记簿中找到原交易信息,开始更新回执信息=========== AfaLoggerFunc.tradeInfo(">>>紧急止付登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_existp.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") else: #==紧急止付登记簿中未找到原交易信息,开始查询资金调拨申请登记簿== AfaLoggerFunc.tradeInfo(">>>紧急止付登记簿中未找到原交易信息,开始查询资金调拨申请登记簿") bka_dict = rccpsDBTrcc_mrqtbl.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询资金调拨申请登记簿异常") if len(bka_dict) > 0: #==资金调拨申请登记簿中找到原交易信息,开始更新回执信息========= AfaLoggerFunc.tradeInfo(">>>资金调拨申请登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_mrqtbl.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") else: #==资金调拨申请登记簿中未找到原交易信息,开始查询清算账户余额通知登记簿== AfaLoggerFunc.tradeInfo(">>>资金调拨申请登记簿中未找到原交易信息,开始查询清算账户余额通知登记簿") bka_dict = rccpsDBTrcc_rekbal.selectu(bka_where_dict) if bka_dict == None: return AfaFlowControl.ExitThisFlow("S999", "查询清算账户余额通知登记簿异常") if len(bka_dict) > 0: #==清算账户余额通知登记簿中找到原交易信息,开始更新回执信息== AfaLoggerFunc.tradeInfo(">>清算账户余额通知登记簿中找到原交易信息,开始更新回执信息") ret = rccpsDBTrcc_rekbal.updateCmt(bka_update_dict,bka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","更新回执信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新回执信息") else: #==未找到原交易信息,丢弃报文=========== return AfaFlowControl.ExitThisFlow("S999", "未找到原交易信息,丢弃报文") else: #==========原业务类型非法=========================================== return AfaFlowControl.ExitThisFlow("S999", "原业务类型[" + TradeContext.ROPRTPNO + "]非法") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") #================为通讯回执报文赋值========================================= AfaLoggerFunc.tradeInfo(">>>开始为通讯回执报文赋值") #======为通讯回执报文赋值=================================================== out_context_dict = {} out_context_dict['sysType'] = 'rccpst' out_context_dict['TRCCO'] = '9900503' out_context_dict['MSGTYPCO'] = 'SET008' out_context_dict['RCVMBRCO'] = TradeContext.SNDMBRCO out_context_dict['SNDMBRCO'] = TradeContext.RCVMBRCO out_context_dict['SNDBRHCO'] = TradeContext.BESBNO out_context_dict['SNDCLKNO'] = TradeContext.BETELR out_context_dict['SNDTRDAT'] = TradeContext.BJEDTE out_context_dict['SNDTRTIM'] = TradeContext.BJETIM out_context_dict['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO out_context_dict['NCCWKDAT'] = TradeContext.NCCworkDate out_context_dict['OPRTYPNO'] = '99' out_context_dict['ROPRTPNO'] = TradeContext.OPRTYPNO out_context_dict['TRANTYP'] = '0' out_context_dict['ORTRCCO'] = TradeContext.TRCCO out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) AfaLoggerFunc.tradeInfo(">>>结束为通讯回执报文赋值") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.本地操作).业务回执报文接收[TRCC006_1110]退出***' ) return True