def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).票据查复书发送[TRC003_8515]进入***' ) #=================查询原交易信息============================================ if not TradeContext.existVariable('BOSPSQ'): return AfaFlowControl.ExitThisFlow("S999", "原票据查询书号不能为空") if not TradeContext.existVariable('BOJEDT'): return AfaFlowControl.ExitThisFlow("S999", "原票据查询日期不能为空") AfaLoggerFunc.tradeInfo(">>>开始查询原查询书信息") pjcbka_dict = {} pjcbka_dict['BJEDTE'] = TradeContext.BOJEDT pjcbka_dict['BSPSQN'] = TradeContext.BOSPSQ ret = rccpsDBTrcc_pjcbka.selectu(pjcbka_dict) if ret == None: return AfaFlowControl.ExitThisFlow('S999','查询票据查询查复业务登记簿异常') TradeContext.OR_BJEDTE=ret['BJEDTE'] TradeContext.OR_SNDBNKCO=ret['SNDBNKCO'] AfaLoggerFunc.tradeInfo(">>>结束查询数据库信息") #=================登记查询书信息============================================ AfaLoggerFunc.tradeInfo(">>>开始登记票据业务查询书信息") TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.ISDEAL = PL_ISDEAL_ISDO #查复标识为未查复 TradeContext.ORTRCCO = ret['TRCCO'] #原交易代码 TradeContext.BILNO = ret['BILNO'] #票据号码 TradeContext.BILDAT = ret['BILDAT'] #票据日期 TradeContext.BILPNAM = ret['BILPNAM'] #出票人名称 TradeContext.BILENDDT = ret['BILENDDT'] #票据截至日期 TradeContext.BILAMT = str(ret['BILAMT']) #出票金额 TradeContext.PYENAM = ret['PYENAM'] #收款人名称 TradeContext.HONBNKNM = ret['HONBNKNM'] #出票人名称 TradeContext.OQTSBNK = ret['SNDBNKCO'] #原发起行号 TradeContext.OQTNO = ret['TRCNO'] #原交易流水号 TradeContext.ORQYDAT = ret['BJEDTE'] #原查询日期 #====begin 蔡永贵 20110215 增加==== #新票据号是16位,需要取后8位,版本号为02,同时要兼容老票据号8位,版本号为01 if len(TradeContext.BILNO) == 16: TradeContext.TMP_BILNO = TradeContext.BILNO[-8:] else: TradeContext.TMP_BILNO = TradeContext.BILNO #============end============ #=====TradeContext向字典赋值操作==== pjcbka_insert_dict = {} if not rccpsMap8515CTradeContext2Dpjcbka.map(pjcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999", "为票据业务查询查复登记簿赋值异常") #=====插入pjcbka票据查询查复登记簿==== ret = rccpsDBTrcc_pjcbka.insertCmt(pjcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "登记票据业务查询书信息异常") AfaLoggerFunc.tradeInfo(">>>结束登记票据业务查询书信息") #=====刘雨龙 2008-07-21 新增更新原交易查询查复标志==== pjcbka_update = {} pjcbka_set = {} pjcbka_update['BJEDTE'] = TradeContext.BOJEDT pjcbka_update['BSPSQN'] = TradeContext.BOSPSQ pjcbka_set['ISDEAL'] = TradeContext.ISDEAL ret = rccpsDBTrcc_pjcbka.updateCmt(pjcbka_set,pjcbka_update) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "更新原票据查询书查询查复标识异常") #=================为票据查询书报文赋值====================================== AfaLoggerFunc.tradeInfo(">>>开始为票据查询书报文赋值") TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR TradeContext.SNDTRDAT = TradeContext.BJEDTE TradeContext.SNDTRTIM = TradeContext.BJETIM #TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRTYPNO = '99' TradeContext.ROPRTPNO = '20' TradeContext.TRANTYP = '0' TradeContext.TRCNO = TradeContext.SerialNo TradeContext.ORPYENAM = TradeContext.PYENAM AfaLoggerFunc.tradeInfo(">>>结束为票据查询书报文赋值") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作交易[TRC001_8532]进入***' ) #=====判断输入接口值是否存在==== if( not TradeContext.existVariable( "STRDAT" ) ): return AfaFlowControl.ExitThisFlow('A099', '起始日期[STRDAT]不存在') if( not TradeContext.existVariable( "ENDDAT" ) ): return AfaFlowControl.ExitThisFlow('A099', '结束日期[ENDDAT]不存在') if( not TradeContext.existVariable( "RECSTRNO" ) ): return AfaFlowControl.ExitThisFlow('A099', '起始笔数[RECSTRNO]不存在') if(len(TradeContext.PRTTYPE)==0): return AfaFlowControl.ExitThisFlow("S999", "打印标志[PRTTYPE]不允许为空") #=====组织sql语句==== wheresql="" wheresql = wheresql + "BESBNO='" + TradeContext.BESBNO + "' " wheresql=wheresql+" and BJEDTE>='"+TradeContext.STRDAT+"'" wheresql=wheresql+" AND BJEDTE<='"+TradeContext.ENDDAT+"'" #=====判断查复标识是否为空或为9-全部==== if(TradeContext.ISDEAL != "" and TradeContext.ISDEAL != "9"): wheresql=wheresql+" AND ISDEAL='"+TradeContext.ISDEAL+"'" #=====判断往来标识是否为空==== if(TradeContext.BRSFLG!=""): wheresql=wheresql+" AND BRSFLG='"+TradeContext.BRSFLG+"'" #=====判断交易代码是否为空==== if(TradeContext.TRCCO !="" ): wheresql=wheresql+" AND TRCCO='"+TradeContext.TRCCO+"'" #业务类型(交易代码) start_no=TradeContext.RECSTRNO #起始笔数 sel_size=10 #=====查询机构名==== subbra_dict={'BESBNO':TradeContext.BESBNO} sub=rccpsDBTrcc_subbra.selectu(subbra_dict) if(sub==None): return AfaFlowControl.ExitThisFlow('A099','查询机构名失败' ) if(len(sub)==0): return AfaFlowControl.ExitThisFlow('A099','机构名称无满足条件记录' ) #=====判断打印类型 0 不打印==== if(TradeContext.PRTTYPE=='0'): AfaLoggerFunc.tradeInfo(">>>进入不打印处理") #=====判断查询查复书号是否为空==== if(TradeContext.BSPSQN!="" ): wheresql=wheresql+" AND BSPSQN='"+TradeContext.BSPSQN+"'" #=====查询总记录数==== allcount=rccpsDBTrcc_pjcbka.count(wheresql) if(allcount==-1): return AfaFlowControl.ExitThisFlow('A099','查找总记录数失败' ) #=====查询数据库==== ordersql=" order by BJEDTE DESC,BSPSQN DESC" records=rccpsDBTrcc_pjcbka.selectm(start_no,sel_size,wheresql,ordersql) if records==None: return AfaFlowControl.ExitThisFlow('A099','查询失败' ) if len(records)<=0: return AfaFlowControl.ExitThisFlow('A099','没有查找到数据' ) else: #=====生成文件==== filename="rccps_"+TradeContext.BETELR+"_"+AfaUtilTools.GetHostDate()+"_"+TradeContext.TransCode fpath=os.environ["AFAP_HOME"]+"/tmp/" try: f=open(fpath+filename,"w") except : AfaLoggerFunc.tradeInfo(">>>打开文件失败") return AfaFlowControl.ExitThisFlow('A099','打开文件失败' ) filecontext="" #=====写文件操作==== for i in range(0,len(records)): #=====生成文件内容==== AfaLoggerFunc.tradeDebug( "生成文件内容 ") filecontext=records[i]['BJEDTE'] + "|" \ +records[i]['BSPSQN'] + "|" \ +records[i]['BRSFLG'] + "|" \ +records[i]['BESBNO'] + "|" \ +records[i]['BETELR'] + "|" \ +records[i]['BEAUUS'] + "|" \ +records[i]['NCCWKDAT'] + "|" \ +records[i]['TRCCO'] + "|" \ +records[i]['TRCDAT'] + "|" \ +records[i]['TRCNO'] + "|" \ +records[i]['SNDBNKCO'] + "|" \ +records[i]['SNDBNKNM'] + "|" \ +records[i]['RCVBNKCO'] + "|" \ +records[i]['RCVBNKNM'] + "|" \ +records[i]['BOJEDT'] + "|" \ +records[i]['BOSPSQ'] + "|" \ +records[i]['ORTRCCO'] + "|" \ +records[i]['CONT'] + "|" \ +records[i]['ISDEAL'] + "|" \ +records[i]['BILDAT'] + "|" \ +records[i]['BILNO'] + "|" \ +records[i]['BILPNAM'] + "|" \ +records[i]['BILENDDT'] + "|" \ +str(records[i]['BILAMT'])+ "|" \ +records[i]['PYENAM'] + "|" \ +records[i]['HONBNKNM'] + "|" \ +records[i]['PRCCO'] + "|" \ +records[i]['STRINFO'] + "|" f.write(filecontext+"\n") f.close() #=====输出接口赋值==== TradeContext.PBDAFILE=filename #文件名 TradeContext.RECCOUNT=str(len(records)) #查询笔数 TradeContext.RECALLCOUNT=str(allcount) #总笔数 #=====打印处理 1 打印==== elif(TradeContext.PRTTYPE=='1'): AfaLoggerFunc.tradeInfo(">>>进入打印处理") #=====判断查询查复书号是否为空==== if(TradeContext.BSPSQN!="" ): wheresql=wheresql+" AND BSPSQN='"+TradeContext.BSPSQN+"'" else: return AfaFlowControl.ExitThisFlow('A099','查询查复书号[BSPSQN]不允许为空' ) #=====查询数据库==== records = rccpsDBTrcc_pjcbka.selectm(TradeContext.RECSTRNO,10,wheresql,"") if(records==None): return AfaFlowControl.ExitThisFlow('A099','查询失败' ) elif( len(records)<=0 ): return AfaFlowControl.ExitThisFlow('A099','未查找到数据' ) else: #=====票据查询书==== if(TradeContext.TRCCO=='9900520'): AfaLoggerFunc.tradeInfo(">>>业务类型为票据查询书") #=====票据查询书打印格式==== txt = """\ %(BESBNM)s票据查询书 |-----------------------------------------------------------------------------| | 查询日期: | %(BJEDTE)s | |-----------------------------------------------------------------------------| | 票据查询书号: | %(BSPSQN)s | |-----------------------------------------------------------------------------| | 发起行行号: | %(SNDBNKCO)s | |-----------------------------------------------------------------------------| | 接收行行号: | %(RCVBNKCO)s | |-----------------------------------------------------------------------------| | 票据日期: | %(BILDAT)s | |-----------------------------------------------------------------------------| | 票据到期日: | %(BILENDDT)s | |-----------------------------------------------------------------------------| | 票据号码: | %(BILNO)s | |-----------------------------------------------------------------------------| | 出票人名称: | %(BILPNAM)s| |-----------------------------------------------------------------------------| | 付款行名称: | %(HONBNKNM)s| |-----------------------------------------------------------------------------| | 查询内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8532' out_file = open(os.environ['AFAP_HOME'] + '/tmp/' + file_name,"wb") if out_file == None: return AfaFlowControl.ExitThisFlow("S999", "生成打印文件异常") print >> out_file,txt % {'BESBNM':(sub['BESBNM']).ljust(10,' '),\ 'BJEDTE':(records[0]['BJEDTE']).ljust(8,' '),\ 'BSPSQN':(TradeContext.BSPSQN).ljust(12,' '),\ 'SNDBNKCO':(records[0]['SNDBNKCO']).ljust(10,' '),\ 'RCVBNKCO':(records[0]['RCVBNKCO']).ljust(10,' '),\ 'BILDAT':(records[0]['BILDAT']).ljust(8,' '),\ 'BILENDDT':(records[0]['BILENDDT']).ljust(8,' '),\ 'BILNO':(records[0]['BILNO']).ljust(16,' '),\ 'BILPNAM':(records[0]['BILPNAM']).ljust(60,' '),\ 'HONBNKNM':(records[0]['HONBNKNM']).ljust(60,' '),\ 'CONT1':(records[0]['CONT'][:68]).ljust(68,' '),\ 'CONT2':(records[0]['CONT'][68:138]).ljust(70,' '),\ 'CONT3':(records[0]['CONT'][138:208]).ljust(70,' '),\ 'CONT4':(records[0]['CONT'][208:]).ljust(70,' ')} out_file.close() TradeContext.PBDAFILE = file_name #文件名 AfaLoggerFunc.tradeDebug("结束生成打印文本") #=====票据查复书==== elif(TradeContext.TRCCO=='9900521'): AfaLoggerFunc.tradeInfo(">>>业务类型为票据查复书") #=====查询原交易信息==== where_dict={'BJEDTE':records[0]['BOJEDT'],'BSPSQN':records[0]['BOSPSQ']} ret=rccpsDBTrcc_pjcbka.selectu(where_dict) if(ret==None): return AfaFlowControl.ExitThisFlow('A099','查询原信息失败' ) if(len(ret)==0): return AfaFlowControl.ExitThisFlow('A099','未查找原信息' ) #=====票据查复书打印格式==== txt = """\ %(BESBNM)s票据查复书 |---------------------------------------------------------------------------------------| | 查复日期: | %(BJEDTE)s | |---------------------------------------------------------------------------------------| | 票据查复书号: | %(BSPSQN)s | |---------------------------------------------------------------------------------------| | 发起行行号: | %(SNDBNKCO)s | |---------------------------------------------------------------------------------------| | 接收行行号: | %(RCVBNKCO)s | |---------------------------------------------------------------------------------------| | 票据日期: | %(BILDAT)s | |---------------------------------------------------------------------------------------| | 票据到期日: | %(BILENDDT)s | |---------------------------------------------------------------------------------------| | 票据号码: | %(BILNO)s | |---------------------------------------------------------------------------------------| | 出票人名称: | %(BILPNAM)s| |---------------------------------------------------------------------------------------| | 收款人名称: | %(PYENAM)s| |---------------------------------------------------------------------------------------| | 付款行名称: | %(HONBNKNM)s| |---------------------------------------------------------------------------------------| | 原票据查询日期: | %(BOJEDT)s | |---------------------------------------------------------------------------------------| | 原票据查询发起行行号: | %(ORSNDBNKCO)s | |---------------------------------------------------------------------------------------| | 原票据查询书号: | %(BOSPSQ)s | |---------------------------------------------------------------------------------------| | 查复内容: | | |---------------------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |---------------------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8532' out_file = open(os.environ['AFAP_HOME'] + '/tmp/' + file_name,"wb") if out_file == None: return AfaFlowControl.ExitThisFlow("S999", "生成打印文件异常") print >> out_file,txt % {'BESBNM':(sub['BESBNM']).ljust(10,' '),\ 'BJEDTE':(records[0]['BJEDTE']).ljust(8,' '),\ 'BSPSQN':(TradeContext.BSPSQN).ljust(12,' '),\ 'SNDBNKCO':(records[0]['SNDBNKCO']).ljust(10,' '),\ 'RCVBNKCO':(records[0]['RCVBNKCO']).ljust(10,' '),\ 'BILDAT':(records[0]['BILDAT']).ljust(8,' '),\ 'BILENDDT':(records[0]['BILENDDT']).ljust(8,' '),\ 'BILNO':(records[0]['BILNO']).ljust(16,' '),\ 'BILPNAM':(records[0]['BILPNAM']).ljust(60,' '),\ 'PYENAM':(records[0]['PYENAM']).ljust(60,' '),\ 'HONBNKNM':(records[0]['HONBNKNM']).ljust(60,' '),\ 'BOJEDT':(records[0]['BOJEDT']).ljust(8,' '),\ 'ORSNDBNKCO':(ret['SNDBNKCO']).ljust(10,' '),\ 'BOSPSQ':(records[0]['BOSPSQ']).ljust(12,' '),\ 'CONT1':(records[0]['CONT'][:68]).ljust(68,' '),\ 'CONT2':(records[0]['CONT'][68:138]).ljust(70,' '),\ 'CONT3':(records[0]['CONT'][138:208]).ljust(70,' '),\ 'CONT4':(records[0]['CONT'][208:]).ljust(70,' ')} out_file.close() TradeContext.PBDAFILE = file_name #文件名 AfaLoggerFunc.tradeDebug("结束生成打印文本") else: return AfaFlowControl.ExitThisFlow("S999", "业务类型非法") TradeContext.RECCOUNT='1' #查询笔数 TradeContext.RECALLCOUNT='1' #总笔数 TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" else: return AfaFlowControl.ExitThisFlow("S999", "打印标志非法") TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作交易[TRC001_8532]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).票据查复接收[RCC00R6_1126]进入***' ) #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") pjcbka_where_dict = {} pjcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO pjcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT pjcbka_where_dict['TRCNO'] = TradeContext.TRCNO pjcbka_dict = rccpsDBTrcc_pjcbka.selectu(pjcbka_where_dict) if pjcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(pjcbka_dict) > 0: 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) return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #==========判断是否存在原查询交易=========================================== AfaLoggerFunc.tradeInfo(">>>开始检查是否存在原查询交易") or_pjcbka_where_dict = {} or_pjcbka_where_dict['SNDBNKCO'] = TradeContext.OQTSBNK or_pjcbka_where_dict['TRCDAT'] = TradeContext.OQTDAT or_pjcbka_where_dict['TRCNO'] = TradeContext.OQTNO or_pjcbka_dict = {} or_pjcbka_dict = rccpsDBTrcc_pjcbka.selectu(or_pjcbka_where_dict) if or_pjcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验原查询交易失败") if len(or_pjcbka_dict) <= 0: 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) return True AfaLoggerFunc.tradeInfo(">>>结束检查是否存在原查询交易") #==========为票据查复查复登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为票据查复查复登记簿字典赋值") TradeContext.BRSFLG = '1' if or_pjcbka_dict.has_key('BJEDTE'): TradeContext.BOJEDT = or_pjcbka_dict['BJEDTE'] if or_pjcbka_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = or_pjcbka_dict['BSPSQN'] #关彬捷 20080728 删除 #if TradeContext.existVariable('TRCCO'): # TradeContext.ORTRCCO = TradeContext.TRCCO TradeContext.ORTRCCO = or_pjcbka_dict['TRCCO'] TradeContext.ISDEAL = PL_ISDEAL_ISDO AfaLoggerFunc.tradeDebug(">>>SNDBNKNM" + str(TradeContext.SNDBNKNM) ) pjcbka_insert_dict = {} if not rccpsMap1126CTradeContext2Dpjcbka_dict.map(pjcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为票据查复查复登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为票据查复查复登记簿字典赋值") #==========登记会对查询查复自由格式登记簿======================================= AfaLoggerFunc.tradeInfo(">>>开始登记此查复业务") ret = rccpsDBTrcc_pjcbka.insert(pjcbka_insert_dict) if ret <= 0: if not AfaDBFunc.RollbackSql(): AfaFlowControl.ExitThisFlow("S999","Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","登记票据查复查复登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记此查复业务") #======更新原查询交易信息=================================================== AfaLoggerFunc.tradeInfo(">>>开始更新原查询业务信息") or_pjcbka_update_dict = {} or_pjcbka_update_dict['ISDEAL'] = PL_ISDEAL_ISDO ret = rccpsDBTrcc_pjcbka.update(or_pjcbka_update_dict,or_pjcbka_where_dict) if (ret <= 0): if not AfaDBFunc.RollbackSql(): AfaFlowControl.ExitThisFlow("S999","Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","更新原查询业务信息异常") if not AfaDBFunc.CommitSql(): 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) return True
def SubModuleDoFst(): #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") pjcbka_where_dict = {} pjcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO pjcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT pjcbka_where_dict['TRCNO'] = TradeContext.TRCNO pjcbka_dict = rccpsDBTrcc_pjcbka.selectu(pjcbka_where_dict) if pjcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(pjcbka_dict) > 0: 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) return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #==========为票据查询查复登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为票据查询查复登记簿字典赋值") TradeContext.ISDEAL = PL_ISDEAL_UNDO pjcbka_insert_dict = {} if not rccpsMap1125CTradeContext2Dpjcbka_dict.map(pjcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为票据查询查复登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为票据查询查复登记簿字典赋值") #==========登记票据查询查复登记簿====================================== AfaLoggerFunc.tradeInfo(">>>开始登记票据查询查复登记簿") AfaLoggerFunc.tradeInfo(">>>" + str(TradeContext.SNDBNKNM)) ret = rccpsDBTrcc_pjcbka.insertCmt(pjcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","登记票据查询查复登记簿异常") 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) 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