def SubModuleDoFst(): #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(hdcbka_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_hdcbka_where_dict = {} or_hdcbka_where_dict['SNDBNKCO'] = TradeContext.OQTSBNK or_hdcbka_where_dict['TRCDAT'] = TradeContext.ORQYDAT or_hdcbka_where_dict['TRCNO'] = TradeContext.OQTNO AfaLoggerFunc.tradeInfo(">>>" + str(or_hdcbka_where_dict)) or_hdcbka_dict = {} or_hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(or_hdcbka_where_dict) if or_hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验原查询交易失败") if len(or_hdcbka_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_hdcbka_dict.has_key('BJEDTE'): TradeContext.BOJEDT = or_hdcbka_dict['BJEDTE'] if or_hdcbka_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = or_hdcbka_dict['BSPSQN'] if TradeContext.existVariable('TRCCO'): TradeContext.ORTRCCO = TradeContext.TRCCO TradeContext.ISDEAL = PL_ISDEAL_ISDO #=====张恒 20091010 新增 将机构落到原交易机构 ==== if or_hdcbka_dict.has_key('BSPSQN'): TradeContext.BESBNO = or_hdcbka_dict['BESBNO'] #接收机构号 hdcbka_insert_dict = {} if not rccpsMap1119CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") #=====刘雨龙 20080710 ==== #=====币种转换==== if TradeContext.ORCUR == 'CNY': hdcbka_insert_dict['CUR'] = '01' else: hdcbka_insert_dict['CUR'] = TradeContext.ORCUR hdcbka_insert_dict['OCCAMT'] = TradeContext.OROCCAMT AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") #==========登记会对查询查复自由格式登记簿======================================= AfaLoggerFunc.tradeInfo(">>>开始登记此查复业务") ret = rccpsDBTrcc_hdcbka.insert(hdcbka_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_hdcbka_update_dict = {} or_hdcbka_update_dict['ISDEAL'] = PL_ISDEAL_ISDO ret = rccpsDBTrcc_hdcbka.update(or_hdcbka_update_dict,or_hdcbka_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(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(hdcbka_dict) > 0: AfaLoggerFunc.tradeInfo("汇兑查询查复自由格式登记簿中存在相同查复交易,此报文为重复报文,进入下一流程,发送表示成功的通讯回执") #======为通讯回执报文赋值=============================================== out_context_dict = {} 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 = PL_BRSFLG_RCV #TradeContext.ISDEAL = PL_ISDEAL_ISDO hdcbka_insert_dict = {} if not rccpsMap1120CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") #==========登记汇兑查询查复自由格式登记簿======================================= AfaLoggerFunc.tradeInfo(">>>开始登记此自由格式书") ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict) if ret <= 0: if not AfaDBFunc.RollbackSql(): AfaFlowControl.ExitThisFlow("S999","Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") 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.本地操作).通存通兑查复书发送[TRC003_8584]进入***' ) #=================查询原查复信息============================================ if not TradeContext.existVariable('ORQYDAT'): return AfaFlowControl.ExitThisFlow("S999", "原查询日期不能为空") if not TradeContext.existVariable('OQTNO'): return AfaFlowControl.ExitThisFlow("S999", "原查询号不能为空") AfaLoggerFunc.tradeInfo(">>>开始查询原查询书信息") hdcbka_dict = {} hdcbka_where_dict = {'BJEDTE':TradeContext.ORQYDAT,'BSPSQN':TradeContext.OQTNO} hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","数据库操作失败") if len(hdcbka_dict) > 0: if hdcbka_dict['ISDEAL'] == PL_ISDEAL_ISDO: #PL_ISDEAL_ISDO 已查复或已处理 return AfaFlowControl.ExitThisFlow("S999","该查询已被查复") AfaLoggerFunc.tradeInfo(">>>开始查询通存通兑原交易信息") wtrbka_dict = {} ret = rccpsDBFunc.getTransWtr(hdcbka_dict['BOJEDT'],hdcbka_dict['BOSPSQ'],wtrbka_dict) if not ret: return False AfaLoggerFunc.tradeInfo(">>>结束查询数据库信息") #=================登记查复书信息============================================ AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务查复书信息") # RCVBNKCO=TradeContext.RCVBNKCO # TradeContext.RCVBNKCO = hdcbka_dict['SNDBNKCO'] # TradeContext.RCVBNKNM = hdcbka_dict['SNDBNKNM'] 注释于0724 by pgt TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.ISDEAL = PL_ISDEAL_ISDO #查复标识为已处理 TradeContext.BOJEDT = TradeContext.ORQYDAT #原交易日期 TradeContext.BOSPSQ = TradeContext.OQTNO #原报单序号 TradeContext.ORTRCCO = hdcbka_dict['TRCCO'] #原交易码 TradeContext.CUR = hdcbka_dict['CUR'] #币种 TradeContext.OCCAMT = str(wtrbka_dict['OCCAMT']) #交易金额 TradeContext.PYRACC = wtrbka_dict['PYRACC'] #付款人账号 TradeContext.PYEACC = wtrbka_dict['PYEACC'] #收款人账号 TradeContext.NOTE1 = hdcbka_dict['NOTE1'] TradeContext.NOTE2 = hdcbka_dict['NOTE2'] TradeContext.NOTE3 = hdcbka_dict['NOTE3'] TradeContext.NOTE4 = hdcbka_dict['NOTE4'] TradeContext.PRT_OROCCAMT = wtrbka_dict['OCCAMT'] hdcbka_insert_dict = {} if not rccpsMap8512CTradeContext2Dhdcbka.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999", "为汇兑业务查询查复登记簿赋值异常") ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "登记汇兑业务查复书信息异常") AfaLoggerFunc.tradeInfo(">>>结束登记汇兑业务查复书信息") #=================为汇兑查询书报文赋值====================================== AfaLoggerFunc.tradeInfo(">>>开始为汇兑查复书报文赋值") TradeContext.TRCCO = '9900512' TradeContext.MSGTYPCO = 'SET008' 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.ORMFN = TradeContext.RCVSTLBIN + hdcbka_dict['TRCDAT'] + hdcbka_dict['TRCNO'] TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRTYPNO = '99' TradeContext.ROPRTPNO = '99' TradeContext.TRANTYP = '0' TradeContext.TRCDAT = TradeContext.TRCDAT TradeContext.TRCNO = TradeContext.SerialNo TradeContext.ORTRCDAT = wtrbka_dict['TRCDAT'] TradeContext.ORTRCNO = wtrbka_dict['TRCNO'] TradeContext.ORSNDBNK = wtrbka_dict['SNDBNKCO'] TradeContext.ORRCVBNK = wtrbka_dict['RCVBNKCO'] TradeContext.ORTRCCO = hdcbka_dict['TRCCO'] TradeContext.ORCUR = TradeContext.CUR TradeContext.OROCCAMT = str(hdcbka_dict['OCCAMT']) TradeContext.ORQYDAT = hdcbka_dict['TRCDAT'] TradeContext.OQTSBNK = hdcbka_dict['SNDBNKCO'] TradeContext.OQTNO = hdcbka_dict['TRCNO'] AfaLoggerFunc.tradeInfo(">>>结束为汇兑查复书报文赋值") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作交易[TRC001_8531]进入***' ) #=====判断输入接口值是否存在==== 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]不存在' ) #=====生成查询语句==== wheresql="" wheresql = wheresql + "BESBNO='" + TradeContext.BESBNO + "' " wheresql=wheresql + " AND BJEDTE>='" + TradeContext.STRDAT + "'" wheresql=wheresql + " AND BJEDTE<='" + TradeContext.ENDDAT + "'" #=====判断交易代码是否为空==== if(TradeContext.TRCCO != ""): wheresql = wheresql + " AND TRCCO='" + TradeContext.TRCCO + "'" #=====判断往来标识是否为空==== if(TradeContext.BRSFLG != ""): wheresql = wheresql + " AND BRSFLG='" + TradeContext.BRSFLG + "'" #=====判断查复标识是否为空或者9-全部==== if(TradeContext.ISDEAL != "9" and TradeContext.ISDEAL!=""): wheresql = wheresql + " AND ISDEAL='" + TradeContext.ISDEAL + "'" AfaLoggerFunc.tradeDebug(">>>生成查询语句sql="+wheresql) #=====查询机构名==== 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_hdcbka.count(wheresql) if(allcount==-1): return AfaFlowControl.ExitThisFlow('A099','超找总记录数失败' ) #=====查询数据库==== ordersql=" order by BJEDTE DESC,BSPSQN DESC" records=rccpsDBTrcc_hdcbka.selectm(TradeContext.RECSTRNO,10,wheresql,ordersql) if(records==None): return AfaFlowControl.ExitThisFlow('A099','查询失败' ) elif( len(records)<=0 ): return AfaFlowControl.ExitThisFlow('A099','未查找到数据' ) else: #=====生成文件==== filename="rccps_"+TradeContext.BETELR+"_"+AfaUtilTools.GetHostDate()+"_"+TradeContext.TransCode fpath=os.environ["AFAP_HOME"]+"/tmp/" f=open(fpath+filename,"w") if(f==None): return AfaFlowControl.ExitThisFlow('A099','打开文件失败' ) filecontext="" #=====写文件操作==== for i in range(0,len(records)): 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]['CUR'] + "|" \ +str(records[i]['OCCAMT'])+ "|" \ +records[i]['PYRACC'] + "|" \ +records[i]['PYEACC'] + "|" \ +records[i]['PRCCO'] + "|" \ +records[i]['STRINFO'] + "|" \ +records[i]['PYRNAM'] + "|" \ +records[i]['PYENAM'] + "|" f.write(filecontext+"\n") AfaLoggerFunc.tradeInfo("生成文件结束") f.close() #=====输出接口赋值==== TradeContext.RECCOUNT=str(len(records)) #查询笔数 TradeContext.RECALLCOUNT=str(allcount) #总笔数 TradeContext.PBDAFILE=filename #文件名 TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" #=====1 打印==== elif TradeContext.PRTTYPE=='1': #=====判断报单序号是否为空==== if(TradeContext.BSPSQN!=""): wheresql = wheresql + " AND BSPSQN='" + TradeContext.BSPSQN + "'" else: return AfaFlowControl.ExitThisFlow('S999','报单序号[BSPSQN]不允许为空' ) #=====查询数据库==== records=rccpsDBTrcc_hdcbka.selectm(TradeContext.RECSTRNO,10,wheresql,"") if(records==None): return AfaFlowControl.ExitThisFlow('A099','查询失败' ) elif( len(records)<=0 ): return AfaFlowControl.ExitThisFlow('A099','未查找到数据' ) else: #=====查询书==== if(TradeContext.TRCCO=='9900511'): AfaLoggerFunc.tradeInfo(">>>业务类型为查询书") #=====查询原交易信息==== where_dict={'BJEDTE':records[0]['BOJEDT'],'BSPSQN':records[0]['BOSPSQ']} ret=rccpsDBTrcc_trcbka.selectu(where_dict) if(ret==None): return AfaFlowControl.ExitThisFlow('A099','查询原信息失败' ) if(len(ret)==0): return AfaFlowControl.ExitThisFlow('A099','未查找原信息' ) AfaLoggerFunc.tradeDebug(">>>开始生成查询书打印文本") #=====查询书打印格式==== txt="""\ %(BESBNM)s电子汇兑查询书 |-----------------------------------------------------------------------------| | 查询日期: | %(BJEDTE)s | |-----------------------------------------------------------------------------| | 查询书号: | %(BSPSQN)s | |-----------------------------------------------------------------------------| | 发起行行号: | %(SNDBNKCO)s | |-----------------------------------------------------------------------------| | 接收行行号: | %(RCVBNKCO)s | |-----------------------------------------------------------------------------| | 原交易金额: | %(OROCCAMT)-15.2f | |-----------------------------------------------------------------------------| | 原发起行行号: | %(ORSNDBNKCO)s | |-----------------------------------------------------------------------------| | 原接收行行号: | %(ORRCVBNKCO)s | |-----------------------------------------------------------------------------| | 查询内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #=====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8531' 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,' '),\ 'OROCCAMT':(records[0]['OCCAMT']),\ 'ORSNDBNKCO':(ret['SNDBNKCO']).ljust(10,' '),\ 'ORRCVBNKCO':(ret['RCVBNKCO']).ljust(10,' '),\ '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=='9900512'): AfaLoggerFunc.tradeInfo(">>>业务类型为查复书") #=====查询原交易信息==== where_dict={'BJEDTE':records[0]['BOJEDT'],'BSPSQN':records[0]['BOSPSQ']} ret=rccpsDBTrcc_hdcbka.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 | |-----------------------------------------------------------------------------| | 接收行行号: | %(RCVBNKCO)s | |-----------------------------------------------------------------------------| | 原查询日期: | %(BOJEDT)s | |-----------------------------------------------------------------------------| | 原查询书号: | %(BOSPSQ)s | |-----------------------------------------------------------------------------| | 原金额: | %(OROCCAMT)-15.2f | |-----------------------------------------------------------------------------| | 原币种: | 人民币 | |-----------------------------------------------------------------------------| | 查复内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8531' 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,' '),\ 'RCVBNKCO':(records[0]['RCVBNKCO']).ljust(10,' '),\ 'BOJEDT':(records[0]['BOJEDT']).ljust(8,' '),\ 'BOSPSQ':(records[0]['BOSPSQ']).ljust(12,' '),\ 'OROCCAMT':(ret['OCCAMT']),\ '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=='9900513'): AfaLoggerFunc.tradeInfo(">>>业务类型为自由格式书") #=====自由格式书打印格式==== txt="""\ %(BESBNM)s自由格式书 |-----------------------------------------------------------------------------| | 日期: | %(BJEDTE)s | |-----------------------------------------------------------------------------| | 自由格式书号: | %(BSPSQN)s | |-----------------------------------------------------------------------------| | 发起行行号: | %(SNDBNKCO)s | |-----------------------------------------------------------------------------| | 接收行行号: | %(RCVBNKCO)s | |-----------------------------------------------------------------------------| | 内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #=====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8531' 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,' '),\ '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=='9900522'): AfaLoggerFunc.tradeInfo(">>>业务类型为特约汇兑查询书") #=====查询原交易信息==== where_dict={'BJEDTE':records[0]['BOJEDT'],'BSPSQN':records[0]['BOSPSQ']} ret=rccpsDBTrcc_trcbka.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 | |-----------------------------------------------------------------------------| | 原报单号: | %(BOSPSQ)s | |-----------------------------------------------------------------------------| | 原金额: | %(OROCCAMT)-15.2f | |-----------------------------------------------------------------------------| | 原委托日期: | %(ORTRCDAT)s | |-----------------------------------------------------------------------------| | 原发起行行号: | %(ORSNDBNKCO)s | |-----------------------------------------------------------------------------| | 查询内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8531' 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,' '),\ 'BOSPSQ':(records[0]['BOSPSQ']).ljust(10,' '),\ 'OROCCAMT':(ret['OCCAMT']),\ 'ORTRCDAT':(ret['TRCDAT']).ljust(8,' '),\ 'ORSNDBNKCO':(ret['SNDBNKCO']).ljust(10,' '),\ '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=='9900523'): AfaLoggerFunc.tradeInfo(">>>业务类型为特约汇兑查复书") #=====查询原交易信息==== where_dict={'BJEDTE':records[0]['BOJEDT'],'BSPSQN':records[0]['BOSPSQ']} ret=rccpsDBTrcc_hdcbka.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 | |-----------------------------------------------------------------------------| | 原特约查询发起行行号: | %(ORSNDBNKCO)s | |-----------------------------------------------------------------------------| | 原特约查询日期: | %(BOJEDT)s | |-----------------------------------------------------------------------------| | 原金额: | %(OROCCAMT)-15.2f | |-----------------------------------------------------------------------------| | 原委托日期: | %(ORTRCDAT)s | |-----------------------------------------------------------------------------| | 原特约查询交易流水号: | %(ORTRCNO)s | |-----------------------------------------------------------------------------| | 查询内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8531' 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,' '),\ 'ORSNDBNKCO':(ret['SNDBNKCO']).ljust(10,' '),\ 'BOJEDT':(records[0]['BJEDTE']).ljust(8,' '),\ 'OROCCAMT':(ret['OCCAMT']),\ 'ORTRCDAT':(ret['TRCDAT']).ljust(8,' '),\ 'ORTRCNO':(ret['TRCNO']).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("结束生成打印文本") #=====特约汇兑自由格式书==== elif(TradeContext.TRCCO=='9900524'): AfaLoggerFunc.tradeInfo(">>>业务类型为特约汇兑自由格式书") #=====特约电子汇兑自由格式书打印格式==== txt="""\ %(BESBNM)s全国特约电子汇兑自由格式书 |-----------------------------------------------------------------------------| | 日期: | %(BJEDTE)s | |-----------------------------------------------------------------------------| | 特约汇兑自由格式书号: | %(BSPSQN)s | |-----------------------------------------------------------------------------| | 发起行行号: | %(SNDBNKCO)s | |-----------------------------------------------------------------------------| | 接收行行号: | %(RCVBNKCO)s | |-----------------------------------------------------------------------------| | 内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ #=====写文件操作==== file_name = 'rccps_' + records[0]['BJEDTE'] + '_' + TradeContext.BSPSQN + '_8531' 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,' '),\ '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.tradeInfo("结束生成打印文本") else: return AfaFlowControl.ExitThisFlow('A099','没有相关的业务类型' ) TradeContext.RECCOUNT="1" #查询笔数 TradeContext.RECALLCOUNT="1" #总笔数 TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" elif( len(TradeContext.PRTTYPE) == 0 ): return AfaFlowControl.ExitThisFlow('A099','打印标志为必输项' ) else: return AfaFlowControl.ExitThisFlow('A099','打印标志非法' ) AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作交易[TRC001_8531]退出***' ) return True
def SubModuleDoFst(): #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(hdcbka_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(">>>结束检查是否重复报文") #关彬捷 20080725 增加查询原交易信息 若未找到原交易信息则返回通讯回执 #=========查询原特约汇兑交易信息=========================================== AfaLoggerFunc.tradeInfo(">>>开始查询原交易信息") tran_dict = {} if not rccpsDBFunc.getTransTrcPK(TradeContext.RCVMBRCO,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,tran_dict): 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 TradeContext.ORTRCCO = tran_dict['TRCCO'] TradeContext.BOJEDT = tran_dict['BJEDTE'] TradeContext.BOSPSQ = tran_dict['BSPSQN'] #=====张恒 20091010 新增 将机构落到原交易机构 ==== TradeContext.BESBNO = tran_dict['BESBNO'] #接收机构号 #关彬捷 20070725 修改币种,金额,发送行名,接收行名 #TradeContext.CUR = tran_dict['CUR'] #TradeContext.OCCAMT = str(tran_dict['OCCAMT']) #TradeContext.PYRACC = tran_dict['PYRACC'] #TradeContext.PYEACC = tran_dict['PYEACC'] #TradeContext.SNDBNKNM = tran_dict['RCVBNKNM'] #TradeContext.RCVBNKNM = tran_dict['SNDBNKNM'] if TradeContext.ORCUR == 'CNY': TradeContext.CUR = '01' #原币种 else: TradeContext.CUR = TradeContext.ORCUR #原币种 TradeContext.OCCAMT = TradeContext.OROCCAMT #原金额 rccpsGetFunc.GetSndBnkCo(TradeContext.SNDBNKCO) rccpsGetFunc.GetRcvBnkCo(TradeContext.RCVBNKCO) hdcbka_insert_dict = {} if not rccpsMap1127CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") #==========登记汇兑查询查复自由格式登记簿====================================== AfaLoggerFunc.tradeInfo(">>>开始登记汇兑查询查复自由格式登记簿") ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_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(): #=================查询原查复信息============================================ if not TradeContext.existVariable('ORQYDAT'): return AfaFlowControl.ExitThisFlow("S999", "原查询日期不能为空") if not TradeContext.existVariable('OQTNO'): return AfaFlowControl.ExitThisFlow("S999", "原查询号不能为空") #=====刘雨龙 20080701 修改查询函数==== #=====使用错误函数,应该查询 查询查复登记簿 中关于特约汇兑查询的信息==== AfaLoggerFunc.tradeInfo(">>>开始查询原查询书信息") hdcbka = {} hdcbka['BJEDTE'] = TradeContext.ORQYDAT #查询日期 hdcbka['BSPSQN'] = TradeContext.OQTNO #报单序号 hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow('S999','查询数据库出错') if len(hdcbka_dict) <= 0: return AfaFlowControl.ExitThisFlow('S999','数据库中无相应记录') #=====刘雨龙 20080702 增加判断是否已查复==== if hdcbka_dict['ISDEAL'] == PL_ISDEAL_ISDO: return AfaFlowControl.ExitThisFlow('S999','报单序号['+TradeContext.OQTNO+']该笔业务已查复') #=====刘雨龙 20080725 增加判断是否来账==== if hdcbka_dict['BRSFLG'] != PL_BRSFLG_RCV: return AfaFlowControl.ExitThisFlow('S999','报单序号['+TradeContext.OQTNO+']该笔业务不为来账查询书') #=====刘雨龙 20080722 增加判断原交易代码是否为:特约汇兑查询书 9900522==== if hdcbka_dict['TRCCO'] != '9900522': return AfaFlowControl.ExitThisFlow('S999','报单序号['+TradeContext.OQTNO+']该笔业务不为特约汇兑查询书') AfaLoggerFunc.tradeInfo(">>>开始查询原交易信息") trcbka_dict = {} ret = rccpsDBFunc.getTransTrc(hdcbka_dict['BOJEDT'],hdcbka_dict['BOSPSQ'],trcbka_dict) if not ret: return AfaFlowControl.ExitThisFlow('S999','查询原交易信息失败') AfaLoggerFunc.tradeInfo(">>>结束查询数据库信息") #=================登记查复书信息============================================ AfaLoggerFunc.tradeInfo(">>>开始登记特约电子汇兑业务查复书信息") #TradeContext.RCVBNKCO = hdcbka_dict['SNDBNKCO'] #TradeContext.RCVBNKNM = hdcbka_dict['SNDBNKNM'] TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.ISDEAL = PL_ISDEAL_ISDO #查复标识为已处理 #=====刘雨龙 20080701 增加数据库内容==== TradeContext.CUR = trcbka_dict['CUR'] #币种 TradeContext.ORTRCCO = hdcbka_dict['TRCCO'] #原交易代码 TradeContext.OCCAMT = trcbka_dict['OCCAMT'] #交易金额 TradeContext.PYRACC = trcbka_dict['PYRACC'] #付款人账号 TradeContext.PYEACC = trcbka_dict['PYEACC'] #收款人账号 TradeContext.NOTE1 = hdcbka_dict['NOTE1'] #备注1 TradeContext.NOTE2 = hdcbka_dict['NOTE2'] #备注2 TradeContext.NOTE3 = hdcbka_dict['NOTE3'] #备注3 TradeContext.NOTE4 = hdcbka_dict['NOTE4'] #备注4 TradeContext.BRSFLG = PL_BRSFLG_SND #往来标志 hdcbka_insert_dict = {} if not rccpsMap8519CTradeContext2Dhdcbka.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999", "为特约电子汇兑业务查询查复登记簿赋值异常") #关彬捷 20080728 BJEDTE和BSPSQN在map函数中已赋值 #hdcbka_insert_dict['BJEDTE'] = TradeContext.BJEDTE #hdcbka_insert_dict['BSPSQN'] = TradeContext.BSPSQN #=====潘广通 20080729 生成打印表格中的数据==== TradeContext.OR_SNDBNKCO = trcbka_dict['SNDBNKCO'] TradeContext.OR_TRCDAT = trcbka_dict['TRCDAT'] TradeContext.OR_TRCNO = trcbka_dict['TRCNO'] TradeContext.OR_OCCAMT = trcbka_dict['OCCAMT'] ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999", "登记特约电子汇兑业务查复书信息异常") AfaLoggerFunc.tradeInfo(">>>结束登记特约电子汇兑业务查复书信息") #=================为特约电子汇兑查复书报文赋值====================================== AfaLoggerFunc.tradeInfo(">>>开始为特约电子汇兑查复书报文赋值") TradeContext.MSGTYPCO = 'SET008' 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.ORMFN = hdcbka_dict['SNDMBRCO'] + hdcbka_dict['TRCDAT'] + hdcbka_dict['TRCNO'] TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRTYPNO = '99' TradeContext.ROPRTPNO = '99' TradeContext.TRANTYP = '0' TradeContext.TRCDAT = TradeContext.TRCDAT TradeContext.TRCNO = TradeContext.SerialNo TradeContext.ORTRCDAT = hdcbka_dict['TRCDAT'] TradeContext.ORTRCNO = hdcbka_dict['TRCNO'] TradeContext.ORSNDBNK = hdcbka_dict['SNDBNKCO'] TradeContext.ORRCVBNK = hdcbka_dict['RCVBNKCO'] TradeContext.ORTRCCO = hdcbka_dict['TRCCO'] TradeContext.ORCUR = trcbka_dict['CUR'] TradeContext.OROCCAMT = str(trcbka_dict['OCCAMT']) TradeContext.ORQYDAT = hdcbka_dict['BJEDTE'] TradeContext.OQTSBNK = hdcbka_dict['SNDBNKCO'] #=====刘雨龙 20080701 新增收/付款人名称==== TradeContext.PYENAM = trcbka_dict['PYENAM'] #收款人名称 TradeContext.PYRNAM = trcbka_dict['PYRNAM'] #付款人名称 TradeContext.OROQTNO = hdcbka_dict['TRCNO'] #原特约查询交易流水号 TradeContext.BOJEDT = hdcbka_dict['BJEDTE'] TradeContext.BOSPSQ = hdcbka_dict['BSPSQN'] AfaLoggerFunc.tradeInfo(">>>结束为特约电子汇兑查复书报文赋值") return True
def SubModuleDoFst(): #=====得到来账查询书的参考业务类型==== ROPRTPNO = TradeContext.ROPRTPNO #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO #hdcbka_where_dict['TRCNO'] = TradeContext.ORTRCNO hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(hdcbka_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['ORMFN'] = TradeContext.MSGFLGNO out_context_dict['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo 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) AfaAfeFunc.CommAfe() return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #=====判断交易类型==== if( TradeContext.ROPRTPNO == '20' ): #汇兑 AfaLoggerFunc.tradeInfo("进入汇兑处理") #==========为汇兑查询查复自由格式登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询查复自由格式登记簿字典赋值") tran_dict = {} #if not rccpsDBFunc.getTransTrcPK(TradeContext.ORMFN[:10],TradeContext.ORMFN[10:18],TradeContext.ORMFN[18:26],tran_dict): if not rccpsDBFunc.getTransTrcAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,tran_dict): #======为通讯回执报文赋值=================================================== 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['ORMFN'] = TradeContext.MSGFLGNO out_context_dict['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo 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) AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','无原交易,丢弃此报文') if tran_dict.has_key('BJEDTE'): TradeContext.BOJEDT = tran_dict['BJEDTE'] if tran_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = tran_dict['BSPSQN'] TradeContext.ISDEAL = PL_ISDEAL_UNDO TradeContext.PYRACC = tran_dict['PYRACC'] #付款人账号 TradeContext.PYEACC = tran_dict['PYEACC'] #收款人账号 #=====张恒 20091010 新增 将机构落到原交易机构 ==== TradeContext.BESBNO = tran_dict['BESBNO'] #接收机构号 hdcbka_insert_dict = {} if not rccpsMap1118CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") elif( TradeContext.ROPRTPNO == '30' ): #通存通兑 AfaLoggerFunc.tradeInfo("进入通存通兑处理") #==========为汇兑查询查复自由格式登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询查复自由格式登记簿字典赋值") wtrbka_dict = {} if not rccpsDBFunc.getTransWtrAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,wtrbka_dict): #======为通讯回执报文赋值=================================================== 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['ORMFN'] = TradeContext.MSGFLGNO out_context_dict['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo 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) AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','无原交易,丢弃此报文') if wtrbka_dict.has_key('BJEDTE'): TradeContext.BOJEDT = wtrbka_dict['BJEDTE'] if wtrbka_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = wtrbka_dict['BSPSQN'] TradeContext.ISDEAL = PL_ISDEAL_UNDO TradeContext.PYRACC = wtrbka_dict['PYRACC'] #付款人账号 TradeContext.PYEACC = wtrbka_dict['PYEACC'] #收款人账号 hdcbka_insert_dict = {} if not rccpsMap1118CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") else: return AfaFlowControl.ExitThisFlow("S999","没有此交易类型") #==========登记汇兑查询查复自由格式登记簿====================================== AfaLoggerFunc.tradeInfo(">>>开始登记汇兑查询查复自由格式登记簿") hdcbka_insert_dict['BRSFLG'] = PL_BRSFLG_RCV #来账 if TradeContext.ORCUR == 'CNY': hdcbka_insert_dict['CUR'] = '01' #原币种 else: hdcbka_insert_dict['CUR'] = TradeContext.ORCUR #原币种 hdcbka_insert_dict['OCCAMT'] = TradeContext.OROCCAMT #原金额 ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","登记汇兑查询查复自由格式登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记汇兑查询查复自由格式登记簿") #======为通讯回执报文赋值===================================================回执前置里只要三个字段.1.2.末 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
def SubModuleDoFst(): #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO #hdcbka_where_dict['TRCDAT'] = TradeContext.ORQYDAT #hdcbka_where_dict['TRCNO'] = TradeContext.OQTNO hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") if len(hdcbka_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) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #==========判断是否存在原查询交易=========================================== AfaLoggerFunc.tradeInfo(">>>开始检查是否存在原查询交易") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.RCVBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.OQTDAT hdcbka_where_dict['TRCNO'] = TradeContext.OQTNO #or_hdcbka_where_dict['TRCNO'] = TradeContext.ORTRCNO #or_hdcbka_where_dict['TRCDAT'] = TradeContext.ORTRCDAT or_hdcbka_dict = {} or_hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if or_hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验原查询交易失败") if len(or_hdcbka_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) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 return True AfaLoggerFunc.tradeInfo(">>>结束检查是否存在原查询交易") #==========为汇兑查询查复自由格式登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询查复自由格式登记簿字典赋值") TradeContext.BOJEDT = or_hdcbka_dict['BJEDTE'] TradeContext.BOSPSQ = or_hdcbka_dict['BSPSQN'] #TradeContext.CUR = or_hdcbka_dict['CUR'] #TradeContext.OCCAMT = str(or_hdcbka_dict['OCCAMT']) TradeContext.ORTRCCO = or_hdcbka_dict['TRCCO'] #=========关彬捷 修改 币种,金额,付款人账号,收款人账号,发送行名,接收行名 #TradeContext.PYRACC = or_hdcbka_dict['PYRACC'] #TradeContext.PYEACC = or_hdcbka_dict['PYEACC'] TradeContext.ISDEAL = PL_ISDEAL_ISDO if TradeContext.ORCUR == 'CNY': TradeContext.CUR = '01' #原币种 else: TradeContext.CUR = TradeContext.ORCUR #原币种 TradeContext.OCCAMT = TradeContext.OROCCAMT #原金额 #=====张恒 20091010 新增 将机构落到原交易机构 ==== TradeContext.BESBNO = or_hdcbka_dict['BESBNO'] #接收机构号 rccpsGetFunc.GetSndBnkCo(TradeContext.SNDBNKCO) rccpsGetFunc.GetRcvBnkCo(TradeContext.RCVBNKCO) hdcbka_insert_dict = {} if not rccpsMap1128CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") #==========登记会对查询查复自由格式登记簿======================================= AfaLoggerFunc.tradeInfo(">>>开始登记此查复业务") ret = rccpsDBTrcc_hdcbka.insert(hdcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","登记汇兑查询查复自由格式登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记此查复业务") #======更新原查询交易信息=================================================== AfaLoggerFunc.tradeInfo(">>>开始更新原查询业务信息") or_hdcbka_update_dict = {} or_hdcbka_update_dict['ISDEAL'] = PL_ISDEAL_ISDO orhdcbka_where_dict = {} orhdcbka_where_dict['SNDBNKCO'] = TradeContext.OQTSBNK orhdcbka_where_dict['TRCDAT'] = TradeContext.OQTDAT orhdcbka_where_dict['TRCNO'] = TradeContext.OQTNO ret = rccpsDBTrcc_hdcbka.update(or_hdcbka_update_dict,orhdcbka_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(">>>Commit成功") #======为通讯回执报文赋值=================================================== 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'] = '成功' TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) return True