def SubModuleDoFst(): #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") cshalm_where_dict = {} cshalm_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO cshalm_where_dict['TRCDAT'] = TradeContext.TRCDAT cshalm_where_dict['TRCNO'] = TradeContext.TRCNO cshalm_dict = rccpsDBTrcc_cshalm.selectu(cshalm_where_dict) if cshalm_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") if len(cshalm_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(">>>结束检查是否重复报文") #=====向字典赋值==== cshalm = {} cshalm['BJEDTE'] = TradeContext.BJEDTE #交易日期 cshalm['BSPSQN'] = TradeContext.BSPSQN #报单序号 #cshalm['NCCWKDAT'] = TradeContext.NCCworkDate #中心日期 #关彬捷 20080924 中心日期赋值报文中的中心日期 cshalm['NCCWKDAT'] = TradeContext.NCCWKDAT #中心日期 cshalm['TRCCO'] = TradeContext.TRCCO #交易代码 cshalm['TRCDAT'] = TradeContext.TRCDAT #委托日期 cshalm['TRCNO'] = TradeContext.TRCNO #交易流水号 cshalm['SNDBNKCO'] = TradeContext.SNDBNKCO #发送行号 cshalm['RCVBNKCO'] = TradeContext.RCVBNKCO #接收行号 #=====币种转换==== if TradeContext.CUR == 'CNY': cshalm['CUR'] = '01' #币种 cshalm['POSITION'] = TradeContext.POSITION #头寸当前金额 cshalm['POSALAMT'] = TradeContext.POSALAMT #头寸预警金额 #=====登记头寸预警登记簿==== AfaLoggerFunc.tradeInfo('>>>开始登记头寸预警登记簿') AfaLoggerFunc.tradeInfo('>>>字典:' + str(cshalm)) ret = rccpsDBTrcc_cshalm.insertCmt(cshalm) if ret <= 0: #=====发送回执字典赋值==== TradeContext.PRCCO = 'RCCS1105' TradeContext.STRINFO = '其它错误' else: TradeContext.PRCCO = 'RCCI0000' TradeContext.STRINFO = '成功' #=====发送通存回执==== TradeContext.sysType = 'rccpst' TradeContext.ORTRCCO = TradeContext.TRCCO TradeContext.TRCCO = '9900503' TradeContext.MSGTYPCO = 'SET008' TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR TradeContext.SNDTRDAT = TradeContext.BJEDTE TradeContext.SNDTRTIM = TradeContext.BJETIM TradeContext.ORMFN = TradeContext.MSGFLGNO TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.ROPRTPNO = TradeContext.OPRTYPNO TradeContext.OPRTYPNO = '99' TradeContext.TRANTYP = '0' #=====通过接收行号取行名和成员行号==== rccpsGetFunc.GetRcvBnkCo(TradeContext.RCVBNKCO) #=====通过发送行号取行名和成员行号==== rccpsGetFunc.GetSndBnkCo(TradeContext.SNDBNKCO) TradeContext.tmp = TradeContext.SNDSTLBIN TradeContext.SNDSTLBIN= TradeContext.RCVSTLBIN TradeContext.RCVSTLBIN= TradeContext.tmp return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo("***农信银系统:来账.中心类操作(1.本地操作).汇票查复书接收[TRC006_1132]进入***") #================检查是否重复报文=========================================== AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hpcbka_where_dict = {} hpcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hpcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hpcbka_where_dict['TRCNO'] = TradeContext.TRCNO hpcbka_dict = rccpsDBTrcc_hpcbka.selectu(hpcbka_where_dict) if hpcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") if len(hpcbka_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_hpcbka_where_dict = {} or_hpcbka_where_dict['SNDBNKCO'] = TradeContext.OQTSBNK or_hpcbka_where_dict['TRCDAT'] = TradeContext.ORQYDAT or_hpcbka_where_dict['TRCNO'] = TradeContext.OQTNO or_hpcbka_dict = rccpsDBTrcc_hpcbka.selectu(or_hpcbka_where_dict) if or_hpcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","查询原查询交易信息异常") if len(or_hpcbka_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(">>>开始为汇票查询查复登记簿赋值") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' TradeContext.BOJEDT = or_hpcbka_dict['BJEDTE'] TradeContext.BOSPSQ = or_hpcbka_dict['BSPSQN'] TradeContext.ISDEAL = PL_ISDEAL_ISDO TradeContext.PYEACC = TradeContext.ORPYENAM hpcbka_dict = {} if not rccpsMap1132CTradeContext2Dhpcbka.map(hpcbka_dict): return AfaFlowControl.ExitThisFlow("S999","为汇票查询查复登记簿赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇票查询查复登记簿赋值") #================登记查询查复登记簿========================================= AfaLoggerFunc.tradeInfo(">>>开始登记查询查复登记簿") ret = rccpsDBTrcc_hpcbka.insertCmt(hpcbka_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","登记汇票查询查复登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记查询查复登记簿") #================为通讯回执报文赋值========================================= 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(">>>结束为通讯回执报文赋值") #=====pgt 0910 更改原交易的查复状态==== AfaLoggerFunc.tradeInfo(">>>更改原交易查复标示") or_hpcbka_where_dict = {} or_hpcbka_where_dict = {'BJEDTE':or_hpcbka_dict['BJEDTE'],'BSPSQN':or_hpcbka_dict['BSPSQN']} or_hpcbka_update_dict = {'ISDEAL':'1'} ret = rccpsDBTrcc_hpcbka.updateCmt(or_hpcbka_update_dict,or_hpcbka_where_dict) if( ret < 0 ): return AfaFlowControl.ExitThisFlow("S999", "登记汇票查询查复登记簿异常") AfaLoggerFunc.tradeInfo("***农信银系统:来账.中心类操作(1.本地操作).汇票查询书接收[TRC006_1132]进入***") 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.本地操作).系统状态变更报文接收[RCC00R6_1121]进入***' ) #=================查询本地相关业务状态的系统状态============================ mbrifa_where_dict = {} mbrifa_where_dict['OPRTYPNO'] = TradeContext.RELOPRTYPNO mbrifa_dict = rccpsDBTrcc_mbrifa.selectu(mbrifa_where_dict) if mbrifa_dict == None: return AfaFlowControl.ExitThisFlow("S999","查询本地系统状态信息异常") if len(mbrifa_dict) <= 0: return AfaFlowControl.ExitThisFlow("S999","无相关业务类型本地系统状态信息") #=================校验报文新工作日期============================================ if int(TradeContext.NWWKDAT) < int(mbrifa_dict['NWWKDAT']): AfaLoggerFunc.tradeInfo("报文新工作日期[" + TradeContext.NWWKDAT + "]在本地新工作日期[" + mbrifa_dict['NWWKDAT'] + "]之前,丢弃此报文,进入下一流程,发送表示成功的通讯回执") #======为通讯回执报文赋值=================================================== 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 elif int(TradeContext.NWWKDAT) == int(mbrifa_dict['NWWKDAT']): #============报文新工作日期与本地新工作日期相同,校验报文新工作状态====== if int(TradeContext.NWSYSST) <= int(mbrifa_dict['NWSYSST']): AfaLoggerFunc.tradeInfo("报文新工作状态[" + TradeContext.NWSYSST + "]不在本地新工作状态[" + mbrifa_dict['NWSYSST'] + "]之后,丢弃此报文,进入下一流程,发送表示成功的通讯回执") #======为通讯回执报文赋值=================================================== 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 #增加日切报文后发先至情况的处理 #通存通兑顺序10-20-30-10 if TradeContext.RELOPRTYPNO == "30": if mbrifa_dict['NWSYSST'] == '10' and TradeContext.NWSYSST != '20': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为日间开始[10],但日切报文中变更状态非业务截止准备[20],停止处理") if mbrifa_dict['NWSYSST'] == '20' and TradeContext.NWSYSST != '30': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为业务截止准备[20],但日切报文中变更状态非业务截止[30],停止处理") if mbrifa_dict['NWSYSST'] == '30' and TradeContext.NWSYSST != '10': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为业务截止[30],但日切报文中变更状态非日间开始[10],停止处理") #汇兑汇票顺序10-30-10 else: if mbrifa_dict['NWSYSST'] == '10' and TradeContext.NWSYSST != '30': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为日间开始[10],但日切报文中变更状态非业务截止[30],停止处理") if mbrifa_dict['NWSYSST'] == '30' and TradeContext.NWSYSST != '10': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为业务截止[30],但日切报文中变更状态非日间开始[10],停止处理") mbrifa_update_dict = {} mbrifa_update_dict['ORWKDAT'] = mbrifa_dict['NWWKDAT'] mbrifa_update_dict['ORSYSST'] = mbrifa_dict['NWSYSST'] mbrifa_update_dict['NWWKDAT'] = TradeContext.NWWKDAT mbrifa_update_dict['NWSYSST'] = TradeContext.NWSYSST mbrifa_update_dict['HOLFLG'] = TradeContext.HOLFLG mbrifa_update_dict['NOTE1'] = mbrifa_dict['NWWKDAT'] ret = rccpsDBTrcc_mbrifa.update(mbrifa_update_dict,mbrifa_where_dict) if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","更新系统状态异常") #======若新系统状态为业务截止,则打开对账系统调度============================ if TradeContext.NWSYSST == '30' and TradeContext.HOLFLG == '2': if TradeContext.RELOPRTYPNO == '20': #====打开汇兑对账系统调度======================================= AfaLoggerFunc.tradeInfo(">>>开始打开汇兑对账系统调度") if not rccpsCronFunc.openCron("00031"): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","打开汇兑对账系统调度异常") AfaLoggerFunc.tradeInfo(">>>结束打开汇兑对账系统调度") #====打开汇票对账系统调度======================================= AfaLoggerFunc.tradeInfo(">>>开始打开汇票对账系统调度") if not rccpsCronFunc.openCron("00041"): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","打开汇票对账系统调度异常") AfaLoggerFunc.tradeInfo(">>>结束打开汇票对账系统调度") elif TradeContext.RELOPRTYPNO == '30': #====打开通存通兑对账系统调度=================================== AfaLoggerFunc.tradeInfo(">>>开始打开通存通兑对账系统调度") if not rccpsCronFunc.openCron("00061"): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","打开通存通兑对账系统调度异常") AfaLoggerFunc.tradeInfo(">>>结束打开通存通兑对账系统调度") #====打开信息类业务量统计系统调度====================== AfaLoggerFunc.tradeInfo(">>>开始打开信息类业务量统计系统调度") # if not rccpsCronFunc.openCron("00067"): # if not AfaDBFunc.RollbackSql( ): # AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) # AfaLoggerFunc.tradeError(">>>Rollback异常") # AfaLoggerFunc.tradeInfo(">>>Rollback成功") # return AfaFlowControl.ExitThisFlow("S999","打开信息类业务量统计系统调度异常") # AfaLoggerFunc.tradeInfo(">>>结束打开信息类业务量统计系统调度") #======若通存通兑新系统状态为日间开始,则打开行名行号生效系统调度=================== if TradeContext.NWSYSST == '10' and TradeContext.RELOPRTYPNO == '30': #====开始打开行名行号生效系统调度======================================= AfaLoggerFunc.tradeInfo(">>>开始打开行名行号生效系统调度") if not rccpsCronFunc.openCron("00050"): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") 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'] = '成功' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).系统状态变更报文接收[RCC00R6_1121]退出***' ) return True
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('>>>主机记账后处理') #=====开始向字典赋值==== sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 sst_dict['SBAC'] = TradeContext.SBAC #借方账号 sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 if (TradeContext.existVariable( "NOTE3" ) and len(TradeContext.NOTE3) != 0): sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 sst_dict['MGID'] = TradeContext.errorCode #主机返回代码 sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 sst_dict['BETELR'] = TradeContext.BETELR #柜员号 #=====开始判断主机返回结果==== out_context_dict = {} if TradeContext.errorCode == '0000' : AfaLoggerFunc.tradeDebug('>>>主机通讯成功,更新表状态开始') trcbka_jgh = {} trcbka_where = {} trcbka_jgh['BESBNO'] = TradeContext.BESBNO trcbka_where['BSPSQN'] = TradeContext.BSPSQN trcbka_where['BJEDTE'] = TradeContext.BJEDTE if not rccpsDBTrcc_trcbka.updateCmt( trcbka_jgh,trcbka_where ): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '更新数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('更新登记簿,COMMIT成功') if (TradeContext.existVariable( "RBAC" ) and len(TradeContext.RBAC) != 0): sst_dict['RBAC'] = TradeContext.RBAC AfaLoggerFunc.tradeDebug('>>>test RBAC =['+TradeContext.RBAC +']') if (TradeContext.existVariable( "REAC" ) and len(TradeContext.REAC) != 0): sst_dict['REAC'] = TradeContext.REAC AfaLoggerFunc.tradeDebug('>>>test REAC =['+TradeContext.REAC +']') #自动挂账 if TradeContext.accflag == 1 : sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 AfaLoggerFunc.tradeDebug('>>>test BCSTAT=['+str(sst_dict['BCSTAT']) +']') #自动入账 elif TradeContext.accflag == 0 : sst_dict['BCSTAT'] = PL_BCSTAT_AUTO #自动入账 AfaLoggerFunc.tradeDebug('>>>test BCSTAT=['+str(sst_dict['BCSTAT']) +']') if (TradeContext.existVariable( "DASQ" ) and len(TradeContext.DASQ) != 0): sst_dict['DASQ'] = TradeContext.DASQ #销账序号 AfaLoggerFunc.tradeDebug('>>>test DASQ =['+TradeContext.DASQ +']') sst_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 AfaLoggerFunc.tradeDebug('>>>test BDWFLG=['+str(sst_dict['BDWFLG']) +']') sst_dict['TRDT'] = TradeContext.TRDT #主机日期 AfaLoggerFunc.tradeDebug('>>>test TRDT =['+TradeContext.TRDT +']') sst_dict['TLSQ'] = TradeContext.TLSQ #主机流水 AfaLoggerFunc.tradeDebug('>>>test TLSQ =['+TradeContext.TLSQ +']') AfaLoggerFunc.tradeDebug('>>>主机通讯成功,更新表状态结束') out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else : if TradeContext.accflag == 1 : sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 sst_dict['BDWFLG'] = PL_BDWFLG_FAIL #处理失败 out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '挂账失败,交易失败' elif TradeContext.accflag == 0 : #记账失败,挂代理机构账 TradeContext.BESBNO = TradeContext.BESBNOFIRST #汇兑来帐挂帐字典赋值 input_dict = {} input_dict['accflag'] = str(TradeContext.accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['BESBNO'] = TradeContext.BESBNOFIRST #调用汇兑记账接口 rccpsEntries.HDLZGZ(input_dict) rccpsHostFunc.CommHost( '8813' ) sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 AfaLoggerFunc.tradeDebug('>>>test BSPSQN=['+TradeContext.BSPSQN+']') sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 AfaLoggerFunc.tradeDebug('>>>test BJEDTE=['+TradeContext.BJEDTE+']') sst_dict['SBAC'] = TradeContext.SBAC #借方账号 AfaLoggerFunc.tradeDebug('>>>test SBAC=['+TradeContext.SBAC+']') sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 AfaLoggerFunc.tradeDebug('>>>test BESBNO=['+TradeContext.BESBNO+']') if (TradeContext.existVariable( "NOTE3" ) and len(TradeContext.NOTE3) != 0): sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 AfaLoggerFunc.tradeDebug('>>>test BJETIM=['+TradeContext.BJETIM+']') sst_dict['MGID'] = TradeContext.errorCode #主机返回代码 sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 sst_dict['BETELR'] = TradeContext.BETELR #柜员号 if TradeContext.errorCode == '0000': AfaLoggerFunc.tradeDebug(">>>SubModuleDoSnd--挂帐成功") sst_dict['BCSTAT'] = PL_BCSTAT_HANG sst_dict['BDWFLG'] = PL_BDWFLG_SUCC out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else: AfaLoggerFunc.tradeDebug(">>>SubModuleDoSnd--挂帐失败") sst_dict['BCSTAT'] = PL_BCSTAT_HANG sst_dict['BDWFLG'] = PL_BDWFLG_FAIL out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '挂账失败,交易失败' AfaLoggerFunc.tradeDebug('>>>当前业务状态[' + str(sst_dict['BCSTAT']) + ']') AfaLoggerFunc.tradeDebug('>>>当前流转标志[' + str(sst_dict['BDWFLG']) + ']') #=====设置状态为 记账/挂账-成功 ==== if not rccpsState.setTransState(sst_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>commit成功') # 关彬捷 20080730 更新原交易状态为退汇成功 if TradeContext.BOJEDT != "" and TradeContext.BOSPSQ != "": AfaLoggerFunc(">>>开始修改原交易状态为退汇成功") if not rccpsState.newTransState(TradeContext.BOJEDT,TradeContext.BOSPSQ,PL_BCSTAT_QTR,PL_BDWFLG_SUCC): #return False return AfaFlowControl.ExitThisFlow('S999','设置状态出错') AfaLoggerFunc(">>>开始修改原交易状态为退汇成功") #=====开始设置通讯回执报文信息==== AfaLoggerFunc.tradeInfo('>>>开始组织通讯回执报文') 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 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['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(): #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_existp.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询汇兑业务登记簿相同报文异常') elif len(record) > 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'] = trc_dict['TRCCO'] out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '重复报文' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') #=====根据发送行号,委托日期,交易流水号查询原交易信息=========== AfaLoggerFunc.tradeInfo(">>>开始根据发送行号,委托日期,交易流水号查询交易信息") trc_dict = {} if not rccpsDBFunc.getTransTrcPK(TradeContext.SNDMBRCO,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,trc_dict): return AfaFlowControl.ExitThisFlow('S999','汇兑业务登记簿中无此交易,抛弃报文') AfaLoggerFunc.tradeInfo(">>>结束根据发送行号,委托日期,交易流水号查询交易信息") #=====需要插入紧急止付业务登记簿existp==== existp = {} if not rccpsMap1130CTradeContext2Dexistp.map(existp): return AfaFlowControl.ExitThisFlow('S999','字典赋值出错,抛弃报文') existp['BOJEDT'] = trc_dict['BJEDTE'] existp['BOSPSQ'] = trc_dict['BSPSQN'] existp['CUR'] = '01' #=====张恒 20091203 新增 将机构落到原交易机构 ==== existp['BESBNO'] = trc_dict['BESBNO'] ret = rccpsDBTrcc_existp.insertCmt(existp) if ret < 0: return AfaFlowControl.ExitThisflow('S999','插入止付业务登记簿出错,抛弃报文') #======检查原业务状态是否为自动挂账-成功==== #if not (trc_dict['BCSTAT'] != PL_BCSTAT_HANG and trc_dict['BDWFLG'] != PL_BDWFLG_SUCC ): if (trc_dict['BCSTAT'] != PL_BCSTAT_HANG or trc_dict['TRCCO'][:2] != '20' or trc_dict['TRCCO'] == '2000009'): 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'] = trc_dict['TRCCO'] out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '该笔业务已入账,不允许退汇' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') TradeContext.BOSPSQ = trc_dict['BSPSQN'] TradeContext.BOJEDT = trc_dict['BJEDTE'] TradeContext.ORPYRACC = trc_dict['PYRACC'] TradeContext.ORPYRNAM = trc_dict['PYRNAM'] TradeContext.ORPYEACC = trc_dict['PYEACC'] TradeContext.ORPYENAM = trc_dict['PYENAM'] TradeContext.ORTRCCO = trc_dict['TRCCO'] #=====汇兑业务登记簿trcbka赋值新增一条记录==== trc_dict['BOJEDT'] = trc_dict['BJEDTE'] trc_dict['BOSPSQ'] = trc_dict['BSPSQN'] trc_dict['ORTRCDAT']= trc_dict['TRCDAT'] trc_dict['ORTRCNO'] = trc_dict['TRCNO'] trc_dict['ORTRCCO'] = trc_dict['TRCCO'] trc_dict['TRCCO'] = '2000004' trc_dict['OPRNO'] = '09' trc_dict['DCFLG'] = PL_DCFLG_CRE trc_dict['BJEDTE'] = TradeContext.BJEDTE trc_dict['BSPSQN'] = TradeContext.BSPSQN trc_dict['TRCDAT'] = TradeContext.TRCDAT trc_dict['TRCNO'] = TradeContext.SerialNo trc_dict['BRSFLG'] = PL_BRSFLG_SND #往账 trc_dict['BBSSRC'] = '3' #待销账 #=====接收成员行号与发送成员行号互换==== TradeContext.temp = trc_dict['SNDMBRCO'] trc_dict['SNDMBRCO']= trc_dict['RCVMBRCO'] trc_dict['RCVMBRCO']= TradeContext.temp #=====接收行号与发送行号互换==== TradeContext.temp = trc_dict['SNDBNKCO'] trc_dict['SNDBNKCO']= trc_dict['RCVBNKCO'] trc_dict['RCVBNKCO']= TradeContext.temp #=====接收行名与发送行名互换==== TradeContext.temp = trc_dict['SNDBNKNM'] trc_dict['SNDBNKNM']= trc_dict['RCVBNKNM'] trc_dict['RCVBNKNM']= TradeContext.temp #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(trc_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('插入汇兑业务登记簿,COMMIT成功') #=====设置状态为记账-处理中==== sstlog = {} sstlog['BSPSQN'] = TradeContext.BSPSQN sstlog['BJEDTE'] = TradeContext.BJEDTE sstlog['BCSTAT'] = PL_BCSTAT_ACC sstlog['BDWFLG'] = PL_BDWFLG_WAIT if not rccpsState.setTransState(sstlog): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====开始拼借贷方账号==== TradeContext.DASQ = trc_dict['DASQ'] TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ TradeContext.OCCAMT= TradeContext.OROCCAMT TradeContext.HostCode = '8813' #=====开始调函数拼贷方账号第25位校验位==== TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC, 25) AfaLoggerFunc.tradeInfo( '贷方账号:' + TradeContext.RBAC ) rccpsHostFunc.CommHost(TradeContext.HostCode) AfaLoggerFunc.tradeInfo( '>>>开始判断主机返回结果' ) status_dict = {} status_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 status_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 status_dict['BCSTAT'] = PL_BCSTAT_ACC #记账 #=====判断主机返回结果==== if TradeContext.errorCode != '0000': status_dict['BDWFLG'] = PL_BDWFLG_FAIL #失败 else: status_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 status_dict['TRDT'] = TradeContext.TRDT #主机日期 status_dict['TLSQ'] = TradeContext.TLSQ #主机流水号 status_dict['MGID'] = TradeContext.MGID #主机返回信息 status_dict['DASQ'] = TradeContext.DASQ #销账序号 #=====修改退汇记录的状态==== if not rccpsState.setTransState(status_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====判断主机返回结果,是否继续流程==== if TradeContext.errorCode != '0000': 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.TRCDAT 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.ORTRCCO out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '该笔业务已入账,不允许退汇' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','该笔业务已被主机处理,不允许退汇') #=====新增记录的状态为:发送-处理中==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_SND,PL_BDWFLG_WAIT): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() 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.TRCDAT 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.ORTRCCO out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 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(">>>开始检查是否重复报文") 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(): #=====得到来账查询书的参考业务类型==== 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_1122]进入***' ) #=================判断是否重复报文========================================== AfaLoggerFunc.tradeInfo(">>>开始判断是否重复报文") pbdata_where_dict = {} pbdata_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO pbdata_where_dict['TRCDAT'] = TradeContext.TRCDAT pbdata_where_dict['TRCNO'] = TradeContext.TRCNO pbdata_dict = rccpsDBTrcc_pbdata.selectu(pbdata_where_dict) if pbdata_dict == None: return AfaFlowControl.ExitThisFlow("S999","判断是否重复报文,查询公共数据登记簿相同报文异常") if len(pbdata_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(">>>开始下载公共数据文件") rccps_path_list = TradeContext.PBDAFILE.split('/') file_path = AfaUtilTools.trim(rccps_path_list[len(rccps_path_list)-2] + "/" + rccps_path_list[len(rccps_path_list)-1]) if not rccpsFtpFunc.getRccps(file_path): return AfaFlowControl.ExitThisFlow("S999","下载公共数据文件" + file_path + "异常") AfaLoggerFunc.tradeInfo(">>>结束下载公共数据文件") #=================登记公共数据通知登记簿==================================== AfaLoggerFunc.tradeInfo(">>>开始登记公共数据通知登记簿") pbdata_insert_dict = {} if not rccpsMap1122CTradeContext2Dpbdata.map(pbdata_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为公共数据通知登记簿赋值异常") ret = rccpsDBTrcc_pbdata.insert(pbdata_insert_dict) if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","登记公共数据通知登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记公共数据通知登记簿") #=================处理接收到的数据========================================== AfaLoggerFunc.tradeInfo(">>>开始处理接收到的数据") local_file_home = os.environ['AFAP_HOME'] + "/data/rccps/" #AfaLoggerFunc.tradeInfo(local_file_home + file_path) #=================农信银资金清算系统行名行号================================ if TradeContext.PBDATYP == '001': AfaLoggerFunc.tradeInfo(">>>开始更新行名行号表农信银资金清算系统行名行号") pfile = open(local_file_home + file_path,"rb") file_line = " " while file_line: file_line = AfaUtilTools.trim(pfile.readline()) file_line = rccpsUtilTools.replaceRet(file_line) if file_line == "": continue line_list = file_line.split('|') paybnk_where_dict = {} paybnk_where_dict['BANKBIN'] = line_list[0] tmp_paybnk_dict = rccpsDBTrcc_paybnk.selectu(paybnk_where_dict) if tmp_paybnk_dict == None: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","查询将登记行号是否存在异常") paybnk_dict = {} paybnk_dict['BANKBIN'] = line_list[0][:10] paybnk_dict['BANKSTATUS'] = line_list[1][:1] paybnk_dict['BANKATTR'] = line_list[2][:2] paybnk_dict['STLBANKBIN'] = line_list[3][:10] paybnk_dict['BANKNAM'] = line_list[4][:60] paybnk_dict['BANKADDR'] = line_list[5][:60] paybnk_dict['BANKPC'] = line_list[6][:6] paybnk_dict['BANKTEL'] = line_list[7][:30] paybnk_dict['EFCTDAT'] = line_list[8][:8] paybnk_dict['INVDAT'] = line_list[9][:8] paybnk_dict['ALTTYPE'] = line_list[10][:1] paybnk_dict['PRIVILEGE'] = line_list[11][:20] paybnk_dict['STRINFO'] = line_list[12][:60] if len(tmp_paybnk_dict) <= 0: #=====行名行号表中不存在此行号,插入新行号======================= ret = rccpsDBTrcc_paybnk.insert(paybnk_dict) AfaLoggerFunc.tradeInfo("插入新行号") if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","插入新行号异常") else: #=====行名行号表中存在此行号,更新行号信息======================= ret = rccpsDBTrcc_paybnk.update(paybnk_dict,paybnk_where_dict) AfaLoggerFunc.tradeInfo("更新旧行号") if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","更新旧行号异常") AfaLoggerFunc.tradeInfo(">>>结束更新行名行号表农信银资金清算系统行名行号") #=================特约汇兑系统行名行号====================================== elif TradeContext.PBDATYP == '011': AfaLoggerFunc.tradeInfo(">>>开始更新行名行号表特约汇兑系统行名行号") pfile = open(local_file_home + file_path,"rb") file_line = " " while file_line: file_line = AfaUtilTools.trim(pfile.readline()) file_line = rccpsUtilTools.replaceRet(file_line) if file_line == "": continue line_list = file_line.split('|') paybnk_where_dict = {} paybnk_where_dict['BANKBIN'] = line_list[0] tmp_paybnk_dict = rccpsDBTrcc_paybnk.selectu(paybnk_where_dict) if tmp_paybnk_dict == None: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","查询将登记行号是否存在异常") paybnk_dict = {} paybnk_dict['BANKBIN'] = line_list[0][:10] paybnk_dict['BANKNAM'] = line_list[1][:60] paybnk_dict['BANKADDR'] = line_list[2][:60] paybnk_dict['BANKPC'] = line_list[3][:6] paybnk_dict['BANKTEL'] = line_list[4][:30] paybnk_dict['EFCTDAT'] = line_list[5][:8] paybnk_dict['INVDAT'] = line_list[6][:8] paybnk_dict['ALTTYPE'] = line_list[7][:1] paybnk_dict['NEWOFLG'] = line_list[8][:1] paybnk_dict['STRINFO'] = line_list[9][:60] if len(tmp_paybnk_dict) <= 0: #=====行名行号表中不存在此行号,插入新行号========= ret = rccpsDBTrcc_paybnk.insert(paybnk_dict) if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","插入新行号异常") else: #=====行名行号表中存在此行号,更新行号信息========= ret = rccpsDBTrcc_paybnk.update(paybnk_dict,paybnk_where_dict) if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","插入新行号异常") AfaLoggerFunc.tradeInfo(">>>结束更新行名行号表特约汇兑系统行名行号") #=================中心下发通知============================================== elif TradeContext.PBDATYP == '002': AfaLoggerFunc.tradeInfo(">>>开始处理中心下发通知") AfaLoggerFunc.tradeInfo(">>>中心下发通知文件,不做处理") AfaLoggerFunc.tradeInfo(">>>结束处理中心下发通知") #=================存款利息清单============================================== elif TradeContext.PBDATYP == '003': AfaLoggerFunc.tradeInfo(">>>开始处理存款利息清单") #=============为存款利息清单文件加抬头================================== file = "" file = file + "\n" file = file + " 上存农信银资金清算中心存款利息单 " + "\n" file = file + "\n" file = file + "\n" file = file + " 成员行号:1340000008 成员行名:安徽省联社清算中心 " + "\n" file = file + "\n" file = file + "".ljust(145,"-") file = file + "\n" file = file + "账号".ljust(18," ") + "|" file = file + "户名".ljust(60," ") + "|" file = file + "积数".ljust(20," ") + "|" file = file + "利率".ljust(10," ") + "|" file = file + "起息日".ljust(8," ") + "|" file = file + "结息日".ljust(8," ") + "|" file = file + "利息金额".ljust(14," ") + "\n" file = file + "".ljust(145,"-") file = file + "\n" pfile = open(local_file_home + file_path,"rb") file = file + pfile.read() pfile.close file = file + "".ljust(145,"-") file = file + "\n" file = file + "\n" file = file + "\n" file = file + "打印日期: 记账: 复核: " + "\n" pfile = open(local_file_home + file_path,"wb") pfile.write(file) pfile.close() AfaLoggerFunc.tradeInfo(">>>结束处理存款利息清单") #=================透支利息清单============================================== elif TradeContext.PBDATYP == '004': AfaLoggerFunc.tradeInfo(">>>开始处理存款利息清单") #=============为透支利息清单文件加抬头================================== file = "" file = file + "\n" file = file + " 上存农信银资金清算中心存款透支利息单 " + "\n" file = file + "\n" file = file + "\n" file = file + " 成员行号:1340000008 成员行名:安徽省联社清算中心 " + "\n" file = file + "\n" file = file + "".ljust(145,"-") file = file + "\n" file = file + "账号".ljust(18," ") + "|" file = file + "户名".ljust(60," ") + "|" file = file + "透支积数".ljust(20," ") + "|" file = file + "透支利率".ljust(10," ") + "|" file = file + "起息日".ljust(8," ") + "|" file = file + "结息日".ljust(8," ") + "|" file = file + "利息金额".ljust(14," ") + "\n" file = file + "".ljust(145,"-") file = file + "\n" pfile = open(local_file_home + file_path,"rb") file = file + pfile.read() pfile.close file = file + "".ljust(145,"-") file = file + "\n" file = file + "\n" file = file + "\n" file = file + "打印日期: 记账: 复核: " + "\n" pfile = open(local_file_home + file_path,"wb") pfile.write(file) pfile.close() AfaLoggerFunc.tradeInfo(">>>结束处理存款利息清单") #=================手续费扣收清单============================================ elif TradeContext.PBDATYP == '005': AfaLoggerFunc.tradeInfo(">>>开始登记手续费扣收清单") #=============为手续费扣收清单文件加抬头================================== file = "" file = file + "\n" file = file + " 农信银资金清算中心业务手续费扣划单 " + "\n" file = file + "\n" file = file + "\n" file = file + " 成员行号:1340000008 成员行名:安徽省联社清算中心 " + "\n" file = file + "\n" file = file + "".ljust(268,"-") file = file + "\n" file = file + "账号".ljust(18," ") + "|" file = file + "户名".ljust(60," ") + "|" file = file + "起始日期".ljust(8," ") + "|" file = file + "终止日期".ljust(8," ") + "|" file = file + "计费总金额".ljust(15," ") + "|" file = file + "折扣率".ljust(11," ") + "|" file = file + "扣费总金额".ljust(15," ") + "|" file = file + "汇兑累计笔数".ljust(10," ") + "|" file = file + "汇兑手续费/笔".ljust(13," ") + "|" file = file + "汇兑计费金额".ljust(16," ") + "|" file = file + "汇票累计笔数".ljust(10," ") + "|" file = file + "汇票手续费/笔".ljust(13," ") + "|" file = file + "汇票计费金额".ljust(16, " ") + "|" file = file + "通存通兑累计笔数".ljust(10," ") + "|" file = file + "通存通兑手续费/笔".ljust(13," ") + "|" file = file + "通存通兑计费金额".ljust(16," ") + "\n" file = file + "".ljust(268,"-") file = file + "\n" pfile = open(local_file_home + file_path,"rb") file = file + pfile.read() pfile.close file = file + "".ljust(268,"-") file = file + "\n" file = file + "\n" file = file + "\n" file = file + "打印日期: 记账: 复核: " + "\n" pfile = open(local_file_home + file_path,"wb") pfile.write(file) pfile.close() AfaLoggerFunc.tradeInfo(">>>结束登记手续费扣收清单") #=================卡BIN与行号对照=========================================== elif TradeContext.PBDATYP == '006': AfaLoggerFunc.tradeInfo(">>>开始更新卡BIN与行号对照表") pfile = open(local_file_home + file_path,"r") file_line = " " while file_line: file_line = AfaUtilTools.trim(pfile.readline()) file_line = rccpsUtilTools.replaceRet(file_line) #AfaLoggerFunc.tradeInfo("file_line = [" + file_line + "]") if file_line == "": continue line_list = file_line.split('|') cadbnk_where_dict = {} cadbnk_where_dict['CARDBIN'] = line_list[0][:12] tmp_cadbnk_dict = rccpsDBTrcc_cadbnk.selectu(cadbnk_where_dict) if tmp_cadbnk_dict == None: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","查询将登记卡BIN是否存在异常") cadbnk_dict = {} cadbnk_dict['CARDBIN'] = line_list[0][:12] cadbnk_dict['BANKBIN'] = line_list[1][:10] if len(tmp_cadbnk_dict) <= 0: #=====行名行号表中不存在此卡BIN,插入新卡BIN=================== ret = rccpsDBTrcc_cadbnk.insert(cadbnk_dict) if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","插入新卡BIN异常") else: #=====行名行号表中存在此卡BIN,更新卡BIN======================== ret = rccpsDBTrcc_cadbnk.update(cadbnk_dict,cadbnk_where_dict) if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","插入新卡BIN异常") AfaLoggerFunc.tradeInfo(">>>结束更新卡BIN与行号对照表") 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'] = '成功' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) AfaLoggerFunc.tradeInfo( '***来账.中心类操作(1.本地操作).公共数据通知报文接收[TRCC006_1122]退出***' ) 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('>>>进入汇总核对报文接收') #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_atrchk.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询汇总核对报文登记簿相同报文异常') elif len(record) > 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) #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #=====赋值开始登记登记簿==== atrchk_dict = { } if not rccpsMap1112CTradeContext2Datrchk_dict.map(atrchk_dict): return AfaFlowControl.ExitThisFlow('S999','字典赋值出错') if TradeContext.existVariable('CUR') and TradeContext.CUR == 'CNY': sel_dict['CUR'] = '01' #=====插入登记簿==== record = rccpsDBTrcc_atrchk.insert(sel_dict) if record <= 0: AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow("S999","登记汇兑核对报文登记簿异常") AfaDBFunc.CommitSql() #=====为通讯回执报文赋值==== 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) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).业务状态查询报文接收[RCC006_1107]进入***' ) #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") ztcbka_where_dict = {} ztcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO ztcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT ztcbka_where_dict['TRCNO'] = TradeContext.TRCNO ztcbka_dict = rccpsDBTrcc_ztcbka.selectu(ztcbka_where_dict) if ztcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") if len(ztcbka_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(">>>开始为业务状态查询查复登记簿字典赋值") AfaLoggerFunc.tradeInfo("业务类型[" + TradeContext.ROPRTPNO + "]") AfaLoggerFunc.tradeInfo("原发送行号[" + TradeContext.ORSNDBNK + "]") AfaLoggerFunc.tradeInfo("原委托日期[" + TradeContext.ORTRCDAT + "]") AfaLoggerFunc.tradeInfo("原交易流水号[" + TradeContext.ORTRCNO + "]") tran_dict = {} if TradeContext.ROPRTPNO == '20': 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['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 elif TradeContext.ROPRTPNO == '21': if not rccpsDBFunc.getTransBilAK(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['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 elif TradeContext.ROPRTPNO == '30': if not rccpsDBFunc.getTransWtrAK(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['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 else: #======为通讯回执报文赋值=================================================== 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 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_ISDO ztcbka_insert_dict = {} if not rccpsMap1107CTradeContext2Dztcbka.map(ztcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为业务状态查询查复登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为业务状态查询查复登记簿字典赋值") #==========登记业务状态查询查复登记簿====================================== AfaLoggerFunc.tradeInfo(">>>开始登记业务状态查询查复登记簿") ztcbka_insert_dict['BRSFLG'] = PL_BRSFLG_RCV #来账 if TradeContext.ORCUR == 'CNY': ztcbka_insert_dict['CUR'] = '01' #原币种 else: ztcbka_insert_dict['CUR'] = TradeContext.ORCUR #原币种 ztcbka_insert_dict['OCCAMT'] = TradeContext.OROCCAMT #原金额 ret = rccpsDBTrcc_ztcbka.insertCmt(ztcbka_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) #==将BJEDTE和BSPSQN赋到TradeContext中的BOJEDT和BOSPSQ中,为交易后处理做准备== TradeContext.BOJEDT = TradeContext.BJEDTE TradeContext.BOSPSQ = TradeContext.BSPSQN TradeContext.OQTSBNK = TradeContext.SNDBNKCO TradeContext.OQTDAT = TradeContext.BJEDTE TradeContext.OQTNO = TradeContext.TRCNO TradeContext.ORSNDBNK = TradeContext.SNDBNKCO TradeContext.ORRCVBNK = TradeContext.RCVBNKCO TradeContext.ORTRCDAT = TradeContext.TRCDAT TradeContext.ORTRCNO = TradeContext.TRCNO TradeContext.OQTDAT = TradeContext.TRCDAT TradeContext.OQTSBNK = TradeContext.SNDBNKCO TradeContext.OQTNO = TradeContext.TRCNO TradeContext.ORMFN = TradeContext.MSGFLGNO TradeContext.ROPRTPNO = TradeContext.OPRTYPNO TradeContext.RCVBNKCO = TradeContext.SNDBNKCO TradeContext.RCVBNKNM = TradeContext.SNDBNKNM if tran_dict.has_key('BCSTAT'): TradeContext.ORBCSTAT = tran_dict['BCSTAT'] if tran_dict.has_key('BDWFLG'): TradeContext.ORBDWFLG = tran_dict['BDWFLG'] AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).业务状态查询报文接收[RCC006_1107]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( "====开始汇兑来账接收处理====" ) #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_trcbka.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询汇兑业务登记簿相同报文异常') elif len(record) > 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) #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' #====开始向字典赋值==== trcbka_dict = {} if not rccpsMap1101CTradeContext2Dtrcbka_dict.map(trcbka_dict): return AfaFlowControl.ExitThisFlow('M999', '字典赋值出错') trcbka_dict['DCFLG'] = PL_DCFLG_CRE #借贷标识 trcbka_dict['OPRNO'] = '01' #业务属性 #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(trcbka_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('插入汇兑业务登记簿,COMMIT成功') #=====设置状态为收妥==== sstlog = {} sstlog['BSPSQN'] = TradeContext.BSPSQN sstlog['BJEDTE'] = TradeContext.BJEDTE sstlog['BCSTAT'] = PL_BCSTAT_BNKRCV sstlog['BDWFLG'] = PL_BDWFLG_SUCC #=====设置状态为 收妥-成功 ==== if not rccpsState.setTransState(sstlog): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') ##========================= START 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #初始化记挂账标识,记账.0,挂账.1,默认记账 accflag = 0 #接收机构暂存 TradeContext.BESBNOFIRST = TradeContext.BESBNO if accflag == 0: AfaLoggerFunc.tradeInfo(">>>开始校验密押") #=====开始调用密押服务器进行核押==== SNDBANKCO = TradeContext.SNDBNKCO RCVBANKCO = TradeContext.RCVBNKCO SNDBANKCO = SNDBANKCO.rjust(12,'0') RCVBANKCO = RCVBANKCO.rjust(12,'0') AMOUNT = TradeContext.OCCAMT.split('.')[0] + TradeContext.OCCAMT.split('.')[1] AMOUNT = AMOUNT.rjust(15,'0') AfaLoggerFunc.tradeDebug('AMOUNT=' + str(AMOUNT) ) AfaLoggerFunc.tradeDebug('SNDBANKCO=' + str(SNDBANKCO) ) AfaLoggerFunc.tradeDebug('RCVBANKCO=' + str(RCVBANKCO) ) ret = miya.DraftEncrypt(PL_SEAL_DEC,PL_TYPE_DZHD,TradeContext.TRCDAT,TradeContext.TRCNO,AMOUNT,SNDBANKCO,RCVBANKCO,'',TradeContext.SEAL) if ret != 0: #密押错,挂账 AfaLoggerFunc.tradeInfo("密押校验未通过,ret=[" + str(ret) + "]") accflag = 1 TradeContext.NOTE3 = "密押错,挂账!" else: #密押校验通过 AfaLoggerFunc.tradeInfo("密押校验通过") AfaLoggerFunc.tradeInfo(">>>结束校验密押") #校验账号是否非法 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号是否非法") if (len(TradeContext.PYEACC) != 23) and (len(TradeContext.PYEACC) != 19) : accflag = 1 TradeContext.NOTE3 = '此账号不是对公或对私账号,挂账!' AfaLoggerFunc.tradeInfo("结束校验账号是否非法") #调用主机接口查询账户信息 if accflag == 0: #调用8810查询账户信息 AfaLoggerFunc.tradeInfo("开始查询账户信息") TradeContext.ACCNO = TradeContext.PYEACC TradeContext.HostCode = '8810' rccpsHostFunc.CommHost( '8810' ) if TradeContext.errorCode != '0000': accflag = 1 TradeContext.NOTE3 = '查询收款人信息失败,挂账!' elif TradeContext.errorCode == '0000' and len(TradeContext.ACCSO) == 0 : accflag = 1 TradeContext.NOTE3 = '查询收款人开户机构失败,挂账!' AfaLoggerFunc.tradeInfo("结束查询账户信息") #校验账户状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验是否跨法人") if TradeContext.ACCSO[0:6] != TradeContext.BESBNO[0:6] : accflag = 1 TradeContext.NOTE3 = '接收行与账户开户行跨法人,挂账!' AfaLoggerFunc.tradeInfo("结束校验是否跨法人") #校验开户机构是否建立代理关系 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验接收行与开户机构是否为同一机构") if TradeContext.ACCSO != TradeContext.BESBNOFIRST: khjg = {} khjg['BESBNO'] = TradeContext.ACCSO khjg['BTOPSB'] = TradeContext.BESBNOFIRST khjg['SUBFLG'] = PL_SUBFLG_SUB rec = rccpsDBTrcc_subbra.selectu(khjg) if rec == None: accflag = 1 TradeContext.NOTE3 = '查询账户代理关系失败,挂账!' elif len(rec) <= 0: accflag = 1 TradeContext.NOTE3 = '账户未建立代理关系,挂账!' else: #接收机构与开户机构存在代理关系,设置机构号为开户机构号 TradeContext.BESBNO = TradeContext.ACCSO AfaLoggerFunc.tradeInfo("结束校验接收行与开户机构是否为同一机构") #校验账号状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号状态是否正常") if TradeContext.ACCST != '0' and TradeContext.ACCST != '2': accflag = 1 TradeContext.NOTE3 = '账户状态不正常,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验账号状态是否正常") #校验收款人户名是否一致 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验收款人户名是否一致") if TradeContext.ACCNM != TradeContext.PYENAM : accflag = 1 TradeContext.NOTE3 = '收款人户名不符,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验收款人户名是否一致") if (TradeContext.existVariable( "PYEACC" ) and len(TradeContext.PYEACC) != 0): #收款人名称 TradeContext.PYEACC = TradeContext.PYEACC else: TradeContext.PYEACC = '' if (TradeContext.existVariable( "PYENAM" ) and len(TradeContext.PYENAM) != 0): #收款人名称 TradeContext.OTNM = TradeContext.PYENAM else: TradeContext.OTNM = '' #汇兑往帐记帐字典赋值 input_dict = {} if (TradeContext.existVariable( "PYRNAM" ) and len(TradeContext.PYRNAM) != 0): #付款人户名 TradeContext.SBACACNM = TradeContext.PYRNAM input_dict['accflag'] = str(accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['PYEACC'] = TradeContext.PYEACC #收款人账号 input_dict['OTNM'] = TradeContext.OTNM #收款人名称 input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑记账接口 rccpsEntries.HDLZJZ(input_dict) TradeContext.accflag = accflag #代理标志 #=====开始调函数拼贷方账号第25位校验位==== TradeContext.HostCode = '8813' #调用8813主机接口 TradeContext.RCCSMCD = PL_RCCSMCD_HDLZ #主机摘要代码:汇兑来账 TradeContext.ACUR = '1' ##========================= END 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #=====新增sstlog表状态记录==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,TradeContext.BCSTAT,TradeContext.BDWFLG): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态['+TradeContext.BCSTAT+']['+TradeContext.BDWFLG+']失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo('>>>进入清算账户余额通知报文接收') #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_rekbal.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询清算账户余额通知登记簿相同报文异常') elif len(record) > 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) return True AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #=====向字典赋值==== rekbal = {} rekbal['BJEDTE'] = TradeContext.BJEDTE #交易日期 rekbal['BSPSQN'] = TradeContext.BSPSQN #报单序号 #rekbal['NCCWKDAT'] = TradeContext.NCCworkDate #中心日期 #关彬捷 20080924 中心日期赋值报文中的中心日期 rekbal['NCCWKDAT'] = TradeContext.NCCWKDAT #中心日期 rekbal['TRCCO'] = TradeContext.TRCCO #交易代码 rekbal['TRCDAT'] = TradeContext.TRCDAT #委托日期 rekbal['TRCNO'] = TradeContext.TRCNO #交易流水号 rekbal['SNDBNKCO'] = TradeContext.SNDBNKCO #发送行号 rekbal['RCVBNKCO'] = TradeContext.RCVBNKCO #接收行号 #=====币种转换==== if TradeContext.CUR == 'CNY': rekbal['CUR'] = '01' #币种 rekbal['LBDCFLG'] = TradeContext.LBDCFLG #上日余额借贷标志 rekbal['LSTDTBAL'] = TradeContext.LSTDTBAL #上日余额 rekbal['NTTDCFLG'] = TradeContext.NTTDCFLG #本日扎查额借贷标志 rekbal['NTTBAL'] = TradeContext.NTTBAL #本日扎查额 rekbal['BALDCFLG'] = TradeContext.BALDCFLG #本日余额借贷标志 rekbal['TODAYBAL'] = TradeContext.TODAYBAL #本日余额 rekbal['AVLBAL'] = TradeContext.AVLBAL #可用余额 rekbal['BRSFLG'] = PL_BRSFLG_RCV rekbal['SNDMBRCO'] = TradeContext.SNDMBRCO #发起成员行号 rekbal['RCVMBRCO'] = TradeContext.RCVMBRCO #接收成员行号 #=====登记清算账户余额通知登记簿==== out_context_dict = {} AfaLoggerFunc.tradeInfo('>>>开始登记清算账户余额通知登记簿') ret = rccpsDBTrcc_rekbal.insertCmt(rekbal) if ret <= 0: #=====发送回执字典赋值==== out_context_dict['PRCCO'] = 'RCCS1105' out_context_dict['STRINFO'] = '其它错误' else: out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' #=====发送通存回执==== 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['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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) return True
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('>>>主机记账后处理') #=====开始向字典赋值==== sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 sst_dict['SBAC'] = TradeContext.SBAC #借方账号 sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 if (TradeContext.existVariable( "NOTE3" ) and len(TradeContext.NOTE3) != 0): sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 sst_dict['MGID'] = TradeContext.errorCode #主机返回代码 sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 sst_dict['BETELR'] = TradeContext.BETELR #柜员号 #=====开始判断主机返回结果==== out_context_dict = {} if TradeContext.errorCode == '0000' : AfaLoggerFunc.tradeDebug('>>>主机通讯成功,更新表状态开始') trcbka_jgh = {} trcbka_where = {} trcbka_jgh['BESBNO'] = TradeContext.BESBNO trcbka_where['BSPSQN'] = TradeContext.BSPSQN trcbka_where['BJEDTE'] = TradeContext.BJEDTE if not rccpsDBTrcc_trcbka.updateCmt( trcbka_jgh,trcbka_where ): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '更新数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('更新登记簿,COMMIT成功') if (TradeContext.existVariable( "RBAC" ) and len(TradeContext.RBAC) != 0): sst_dict['RBAC'] = TradeContext.RBAC AfaLoggerFunc.tradeDebug('>>>test RBAC =['+TradeContext.RBAC +']') if (TradeContext.existVariable( "REAC" ) and len(TradeContext.REAC) != 0): sst_dict['REAC'] = TradeContext.REAC AfaLoggerFunc.tradeDebug('>>>test REAC =['+TradeContext.REAC +']') #自动挂账 if TradeContext.accflag == 1 : sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 AfaLoggerFunc.tradeDebug('>>>test BCSTAT=['+str(sst_dict['BCSTAT']) +']') #自动入账 elif TradeContext.accflag == 0 : sst_dict['BCSTAT'] = PL_BCSTAT_AUTO #自动入账 AfaLoggerFunc.tradeDebug('>>>test BCSTAT=['+str(sst_dict['BCSTAT']) +']') if (TradeContext.existVariable( "DASQ" ) and len(TradeContext.DASQ) != 0): sst_dict['DASQ'] = TradeContext.DASQ #销账序号 AfaLoggerFunc.tradeDebug('>>>test DASQ =['+TradeContext.DASQ +']') sst_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 AfaLoggerFunc.tradeDebug('>>>test BDWFLG=['+str(sst_dict['BDWFLG']) +']') sst_dict['TRDT'] = TradeContext.TRDT #主机日期 AfaLoggerFunc.tradeDebug('>>>test TRDT =['+TradeContext.TRDT +']') sst_dict['TLSQ'] = TradeContext.TLSQ #主机流水 AfaLoggerFunc.tradeDebug('>>>test TLSQ =['+TradeContext.TLSQ +']') AfaLoggerFunc.tradeDebug('>>>主机通讯成功,更新表状态结束') out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else : if TradeContext.accflag == 1 : sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 sst_dict['BDWFLG'] = PL_BDWFLG_FAIL #处理失败 out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '挂账失败,交易失败' elif TradeContext.accflag == 0 : #记账失败,挂代理机构账 TradeContext.BESBNO = TradeContext.BESBNOFIRST #汇兑来帐挂帐字典赋值 input_dict = {} input_dict['accflag'] = str(TradeContext.accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['BESBNO'] = TradeContext.BESBNOFIRST #调用汇兑记账接口 rccpsEntries.HDLZGZ(input_dict) rccpsHostFunc.CommHost( '8813' ) sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 AfaLoggerFunc.tradeDebug('>>>test BSPSQN=['+TradeContext.BSPSQN+']') sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 AfaLoggerFunc.tradeDebug('>>>test BJEDTE=['+TradeContext.BJEDTE+']') sst_dict['SBAC'] = TradeContext.SBAC #借方账号 AfaLoggerFunc.tradeDebug('>>>test SBAC=['+TradeContext.SBAC+']') sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 AfaLoggerFunc.tradeDebug('>>>test BESBNO=['+TradeContext.BESBNO+']') if (TradeContext.existVariable( "NOTE3" ) and len(TradeContext.NOTE3) != 0): sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 AfaLoggerFunc.tradeDebug('>>>test BJETIM=['+TradeContext.BJETIM+']') sst_dict['MGID'] = TradeContext.errorCode #主机返回代码 sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 sst_dict['BETELR'] = TradeContext.BETELR #柜员号 if TradeContext.errorCode == '0000': AfaLoggerFunc.tradeDebug(">>>SubModuleDoSnd--挂帐成功") sst_dict['BCSTAT'] = PL_BCSTAT_HANG sst_dict['BDWFLG'] = PL_BDWFLG_SUCC out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else: AfaLoggerFunc.tradeDebug(">>>SubModuleDoSnd--挂帐失败") sst_dict['BCSTAT'] = PL_BCSTAT_HANG sst_dict['BDWFLG'] = PL_BDWFLG_FAIL out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '挂账失败,交易失败' AfaLoggerFunc.tradeDebug('>>>当前业务状态[' + str(sst_dict['BCSTAT']) + ']') AfaLoggerFunc.tradeDebug('>>>当前流转标志[' + str(sst_dict['BDWFLG']) + ']') #=====设置状态为 记账/挂账-成功 ==== if not rccpsState.setTransState(sst_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>commit成功') #=====开始设置通讯回执报文信息==== AfaLoggerFunc.tradeInfo('>>>开始组织通讯回执报文') 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 rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) return True
def SubModuleDoFst(): time.sleep(10) AfaLoggerFunc.tradeInfo('>>>进入撤销应答接收') #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") trccan_where_dict = {} trccan_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO trccan_where_dict['TRCDAT'] = TradeContext.TRCDAT trccan_where_dict['TRCNO'] = TradeContext.TRCNO trc_dict = rccpsDBTrcc_trccan.selectu(trccan_where_dict) if trc_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") if len(trc_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) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #==========根据发送行号,委托日期,交易流水号查询原交易信息=========== AfaLoggerFunc.tradeInfo(">>>开始根据发送行号,委托日期,交易流水号查询交易信息") dict_where = {} dict_where['SNDBNKCO'] = TradeContext.OQTSBNK dict_where['TRCDAT'] = TradeContext.OCADAT dict_where['TRCNO'] = TradeContext.OCATNO dict = rccpsDBTrcc_trccan.selectu(dict_where) if dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") tran_dict_where = {} tran_dict_where['BJEDTE'] = dict['BOJEDT'] tran_dict_where['BSPSQN'] = dict['BOSPSQ'] tran_dict = rccpsDBTrcc_trcbka.selectu(tran_dict_where) if tran_dict <= 0: return AfaFlowControl.ExitThisFlow("S999","未找到原交易") AfaLoggerFunc.tradeInfo(">>>结束根据发送行号,委托日期,交易流水号查询交易信息") #=====从TradeContext向字典trccan_dict赋值==== TradeContext.BBSSRC = tran_dict['BBSSRC'] TradeContext.BOJEDT = dict['BJEDTE'] TradeContext.BOSPSQ = dict['BSPSQN'] TradeContext.ORTRCCO = dict['TRCCO'] TradeContext.CUR = '01' TradeContext.OCCAMT = str(dict['OCCAMT']) AfaLoggerFunc.tradeDebug('>>>资金来源['+TradeContext.BBSSRC+']') trccan_dict = {} if not rccpsMap1106CTradeContext2Dtrccan_dict.map(trccan_dict): return AfaFlowControl.ExitThisFlow('S999','赋值错误') #=====插入登记簿rcc_trccan==== AfaLoggerFunc.tradeDebug('>>>开始插入数据库') ret = rccpsDBTrcc_trccan.insertCmt(trccan_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow('S999','插入数据库撤销申请登记簿trccan错误,抛弃报文') #=====更新原撤销申请状态==== trc_update = {} trc_update_where = {} trc_update_where['BJEDTE'] = TradeContext.BOJEDT trc_update_where['BSPSQN'] = TradeContext.BSPSQN trc_update['CLRESPN']= TradeContext.CLRESPN ret = rccpsDBTrcc_trccan.updateCmt(trc_update,trc_update_where) if ret <= 0: return AfaFlowControl.ExitThisFlow('S999','修改撤销申请登记簿原记录状态错误,抛弃报文') #=====原汇兑交易流水号,8820抹账使用==== TradeContext.BOJEDT = tran_dict['BJEDTE'] TradeContext.BOSPSQ = tran_dict['BSPSQN'] #=====判断撤销应答标志是否允许撤销 0-允许撤销 1-不允许撤销 ==== if TradeContext.CLRESPN == '1': #=====发送接收正常回执==== AfaLoggerFunc.tradeDebug('>>>中心不允许撤销,发送成功回执') 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.tradeDebug('>>>中心允许撤销,向主机发起记账') #=====设置sstlog表中原记录状态为:抹账-处理中==== TradeContext.BCSTAT = PL_BCSTAT_HCAC TradeContext.BDWFLG = PL_BDWFLG_WAIT if not rccpsState.newTransState(dict['BOJEDT'],dict['BOSPSQ'],TradeContext.BCSTAT,TradeContext.BDWFLG): return AfaFlowControl.ExitThisFlow('S999','设置状态出错,抛弃此报文') #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>开始向主机接口赋值') #=====设置主机记账/抹账数据==== if TradeContext.BBSSRC == '3': #=====代销账要发起8813红蓝字记账==== TradeContext.HostCode = '8813' TradeContext.RCCSMCD = '614' #往撤销 TradeContext.DASQ = '' TradeContext.RVFG = '0' #红蓝字标志 0 #关彬捷 20080728 修改抹账挂账原因 #TradeContext.NOTE3 = '向主机发起红蓝字记账冲销' TradeContext.NOTE3 = '中心允许撤销,自动抹账' TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDXZ #贷方账号 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 #=====开始调函数拼贷方账号第25位校验位==== TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC, 25) TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC, 25) AfaLoggerFunc.tradeInfo( '贷方账号:' + TradeContext.RBAC ) AfaLoggerFunc.tradeInfo( '借方账号:' + TradeContext.SBAC ) else: TradeContext.HostCode = '8820' #关彬捷 20080728 修改抹账挂账原因 #TradeContext.NOTE3 = '向主机发起抹账' TradeContext.NOTE3 = '中心允许撤销,自动抹账' AfaLoggerFunc.tradeDebug('>>>更新sstlog表中原交易状态成功,开始更新交易状态') #=====设置sstlog标志状态为:抹账-处理中==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,TradeContext.BCSTAT,TradeContext.BDWFLG): return AfaFlowControl.ExitThisFlow('S999','设置状态出错,抛弃此报文') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>开始调用主机函数') AfaLoggerFunc.tradeDebug('>>>主机交易代码['+TradeContext.HostCode+']') #=====向主机发起抹账操作==== rccpsHostFunc.CommHost(TradeContext.HostCode) #=====判断主机返回结果设置状态==== sstlog_dict = {} sstlog_dict['BJEDTE'] = TradeContext.BJEDTE AfaLoggerFunc.tradeDebug('>>>交易日期['+TradeContext.BJEDTE+']') sstlog_dict['BSPSQN'] = TradeContext.BSPSQN AfaLoggerFunc.tradeDebug('>>>报单序号['+TradeContext.BSPSQN+']') sstlog_dict['BCSTAT'] = TradeContext.BCSTAT AfaLoggerFunc.tradeDebug('>>>业务状态['+TradeContext.BCSTAT+']') sstlog_dict['NOTE4'] = TradeContext.errorMsg AfaLoggerFunc.tradeDebug('>>>主机返回信息['+TradeContext.errorMsg+']') sstlog_dict['NOTE3'] = TradeContext.NOTE3 AfaLoggerFunc.tradeDebug('>>>NOTE3['+TradeContext.NOTE3+']') AfaLoggerFunc.tradeDebug('>>>errorCode['+TradeContext.errorCode+']') if TradeContext.existVariable('TRDT'): sstlog_dict['TRDT'] = TradeContext.TRDT AfaLoggerFunc.tradeDebug('>>>主机日期['+TradeContext.TRDT+']') if TradeContext.existVariable('TLSQ'): sstlog_dict['TLSQ'] = TradeContext.TLSQ AfaLoggerFunc.tradeDebug('>>>主机流水['+TradeContext.TLSQ+']') if TradeContext.errorCode == '0000': AfaLoggerFunc.tradeDebug('>>>测试') if TradeContext.HostCode == '8813': sstlog_dict['DASQ'] = TradeContext.DASQ AfaLoggerFunc.tradeDebug('>>>销账序号['+TradeContext.DASQ+']') sstlog_dict['SBAC'] = TradeContext.SBAC AfaLoggerFunc.tradeDebug('>>>借方账号['+TradeContext.SBAC+']') sstlog_dict['RBAC'] = TradeContext.RBAC AfaLoggerFunc.tradeDebug('>>>贷方账号['+TradeContext.RBAC+']') AfaLoggerFunc.tradeDebug('>>>测试2') sstlog_dict['BDWFLG'] = PL_BDWFLG_SUCC else: AfaLoggerFunc.tradeDebug('>>>测试1') sstlog_dict['BDWFLG'] = PL_BDWFLG_FAIL AfaLoggerFunc.tradeDebug('>>>主机返回信息') #=====设置原交易状态==== if not rccpsState.setTransState(sstlog_dict): return AfaFlowControl.ExitThisFlow('S999','更新主机返回信息出错,抛弃报文') #=====commit操作==== AfaDBFunc.CommitSql() #=====设置交易状态==== sstlog_dict['BJEDTE'] = TradeContext.BOJEDT sstlog_dict['BSPSQN'] = TradeContext.BOSPSQ if not rccpsState.setTransState(sstlog_dict): return AfaFlowControl.ExitThisFlow('S999','更新主机返回信息出错,抛弃报文') #=====commit操作==== AfaDBFunc.CommitSql() #=====发送回执,其它错误==== 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 SubModuleDoSnd(): #=====开始向字典赋值==== AfaLoggerFunc.tradeInfo('>>>主机记账后处理') sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 AfaLoggerFunc.tradeDebug('>>>test by lyl as BSPSQN=['+TradeContext.BSPSQN+']') sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 AfaLoggerFunc.tradeDebug('>>>test by lyl as BJEDTE=['+TradeContext.BJEDTE+']') sst_dict['SBAC'] = TradeContext.SBAC #借方账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as SBAC=['+TradeContext.SBAC+']') sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test by lyl as NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 AfaLoggerFunc.tradeDebug('>>>test by lyl as BJETIM=['+TradeContext.BJETIM+']') sst_dict['MGID'] = TradeContext.errorCode #主机返回信息 AfaLoggerFunc.tradeDebug('>>>test by lyl as MGID =['+str(sst_dict['MGID']) +']') sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 AfaLoggerFunc.tradeDebug('>>>test by lyl as STRINFO =['+str(sst_dict['STRINFO']) +']') sst_dict['BETELR'] = TradeContext.BETELR #柜员号 AfaLoggerFunc.tradeDebug('>>>test by lyl as BETELR=['+TradeContext.BETELR+']') sst_dict['RBAC'] = TradeContext.RBAC #贷方账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as RBAC =['+TradeContext.RBAC +']') sst_dict['BCSTAT'] = PL_BCSTAT_AUTO #自动入账成功 AfaLoggerFunc.tradeDebug('>>>test by lyl as BCSTAT=['+str(sst_dict['BCSTAT']) +']') sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 AfaLoggerFunc.tradeDebug('>>>test by lyl as BESBNO=['+TradeContext.BESBNO+']') #=====开始判断主机返回结果==== out_context_dict = {} if TradeContext.errorCode == '0000': if( TradeContext.existVariable('DASQ') and len(TradeContext.DASQ) != 0 ): sst_dict['DASQ'] = TradeContext.DASQ #销账序号 AfaLoggerFunc.tradeDebug('>>>test by lyl as DASQ =['+TradeContext.DASQ +']') sst_dict['RBAC'] = TradeContext.REAC #挂账账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as RBAC =['+TradeContext.RBAC +']') sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 71 AfaLoggerFunc.tradeDebug('>>>test by lyl as BCSTAT=['+str(sst_dict['BCSTAT']) +']') if len(sst_dict['NOTE3']) == 0: sst_dict['NOTE3'] = "主机方挂账" else: sst_dict['RBAC'] = TradeContext.RBAC #贷方账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as RBAC =['+TradeContext.RBAC +']') sst_dict['BCSTAT'] = PL_BCSTAT_AUTO #自动入账 70 AfaLoggerFunc.tradeDebug('>>>test by lyl as BCSTAT=['+str(sst_dict['BCSTAT']) +']') sst_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 AfaLoggerFunc.tradeDebug('>>>test by lyl as BDWFLG=['+str(sst_dict['BDWFLG']) +']') sst_dict['TRDT'] = TradeContext.TRDT #主机日期 AfaLoggerFunc.tradeDebug('>>>test by lyl as TRDT =['+TradeContext.TRDT +']') sst_dict['TLSQ'] = TradeContext.TLSQ #主机流水 AfaLoggerFunc.tradeDebug('>>>test by lyl as TLSQ =['+TradeContext.TLSQ +']') out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else: sst_dict['BDWFLG'] = PL_BDWFLG_FAIL #失败 out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '其它错误' AfaLoggerFunc.tradeDebug('>>>当前业务状态[' + str(sst_dict['BCSTAT']) + ']') AfaLoggerFunc.tradeDebug('>>>当前流转标志[' + str(sst_dict['BDWFLG']) + ']') #=====设置状态为 记账/挂账-成功 ==== if not rccpsState.setTransState(sst_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>commit成功') #=====开始设置通讯回执报文信息==== AfaLoggerFunc.tradeInfo('>>>开始组织通讯回执报文') 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 rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).业务状态查复报文接收[RCC00R6_1108]进入***' ) #==========判断是否重复报文,如果是重复报文,直接进入下一流程================= AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") ztcbka_where_dict = {} ztcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO ztcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT ztcbka_where_dict['TRCNO'] = TradeContext.TRCNO ztcbka_dict = rccpsDBTrcc_ztcbka.selectu(ztcbka_where_dict) if ztcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文失败") if len(ztcbka_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_ztcbka_where_dict = {} or_ztcbka_where_dict['SNDBNKCO'] = TradeContext.OQTSBNK or_ztcbka_where_dict['TRCDAT'] = TradeContext.OQTDAT or_ztcbka_where_dict['TRCNO'] = TradeContext.OQTNO or_ztcbka_dict = {} or_ztcbka_dict = rccpsDBTrcc_ztcbka.selectu(or_ztcbka_where_dict) if or_ztcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验原查询交易失败") if len(or_ztcbka_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(">>>开始为此业务状态登记簿字典赋值") if or_ztcbka_dict.has_key('BJEDTE'): TradeContext.BOJEDT = or_ztcbka_dict['BJEDTE'] if or_ztcbka_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = or_ztcbka_dict['BSPSQN'] if TradeContext.existVariable('TRCCO'): TradeContext.ORTRCCO = TradeContext.TRCCO TradeContext.ISDEAL = PL_ISDEAL_ISDO ztcbka_insert_dict = {} if not rccpsMap1108CTradeContext2Dztcbka.map(ztcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为查复业务字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为此业务状态登记簿字典赋值") #==========登记业务状态查复查复登记簿======================================= AfaLoggerFunc.tradeInfo(">>>开始登记此查复业务") ret = rccpsDBTrcc_ztcbka.insert(ztcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","登记状态查复登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记此查复业务") #======更新原查询交易信息=================================================== AfaLoggerFunc.tradeInfo(">>>开始更新原查询业务信息") or_ztcbka_update_dict = {} or_ztcbka_update_dict['NCCTRCST'] = TradeContext.NCCTRCST or_ztcbka_update_dict['MBRTRCST'] = TradeContext.MBRTRCST or_ztcbka_update_dict['ISDEAL'] = PL_ISDEAL_ISDO ret = rccpsDBTrcc_ztcbka.update(or_ztcbka_update_dict,or_ztcbka_where_dict) if (ret <= 0): 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) AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).业务状态查复报文接收[RCC00R6_1108]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( "====开始汇票解付接收处理====" ) #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_bilbka.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询汇兑业务登记簿相同报文异常') elif len(record) > 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) #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' TradeContext.DCFLG = '1' TradeContext.HPSTAT= PL_HPSTAT_PAYC #解付 02 TradeContext.OPRNO = PL_HPOPRNO_JF #=====插入数据库==== AfaLoggerFunc.tradeInfo(">>>开始记录数据库操作") bilbka_dict = {} if not rccpsMap1113CTradeContext2Dbilbka.map(bilbka_dict): return AfaFlowControl.ExitThisFlow("S999","为汇票业务登记簿赋值异常") if not rccpsDBFunc.insTransBil(bilbka_dict): return AfaFlowControl.ExitThisFlow('S999','登记汇票业务登记簿异常') AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo(">>>结束记录数据库操作") #=====设置状态为收妥==== sstlog = {} sstlog['BSPSQN'] = TradeContext.BSPSQN sstlog['BJEDTE'] = TradeContext.BJEDTE sstlog['BCSTAT'] = PL_BCSTAT_BNKRCV sstlog['BDWFLG'] = PL_BDWFLG_SUCC #=====设置状态为 收妥-成功 ==== if not rccpsState.setTransState(sstlog): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====设置汇票业务登记簿和信息登记簿状态==== #=====设置汇票状态为解付==== AfaLoggerFunc.tradeInfo(">>>开始设置汇票状态为解付") if not rccpsState.newBilState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_HPSTAT_PAYC): return AfaFlowControl.ExitThisFlow("S999","设置汇票状态异常") AfaLoggerFunc.tradeInfo(">>>结束设置汇票状态为解付") #=====commit操作==== AfaDBFunc.CommitSql() #=====设置汇票解付金额==== bil_dict = {} bil_dict['BILNO'] = TradeContext.BILNO bil_dict['BILVER'] = TradeContext.BILVER bil_dict['BILRS'] = TradeContext.BILRS bil_end = {} bil_end['OCCAMT'] = TradeContext.OCCAMT bil_end['RMNAMT'] = TradeContext.RMNAMT bil_end['PAYBNKCO']= TradeContext.SNDBNKCO bil_end['PAYBNKNM']= TradeContext.SNDBNKNM ret = rccpsDBTrcc_bilinf.update(bil_end,bil_dict) if (ret <= 0): return AfaFlowControl.ExitThisFlow("S999","更新汇票信息异常") AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') AfaLoggerFunc.tradeInfo(">>>开始判断是否存在多余款操作") if float(TradeContext.RMNAMT) != 0.00: AfaLoggerFunc.tradeInfo(">>>第二次记账赋值操作") TradeContext.ACUR = '2' #记账循环次数 TradeContext.TRFG = '9' #凭证处理标识' TradeContext.I2CETY = '' #凭证种类 TradeContext.I2TRAM = TradeContext.RMNAMT #结余金额 TradeContext.I2SMCD = PL_RCCSMCD_HPJF #摘要代码 TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_DYKJQ #贷方账号 TradeContext.I2SBAC = TradeContext.BESBNO + PL_ACC_HCHK #借方账号 TradeContext.I2REAC = TradeContext.BESBNO + PL_ACC_NXYDXZ #挂账账号 #=====生成账号校验位==== TradeContext.I2SBAC = rccpsHostFunc.CrtAcc(TradeContext.I2SBAC,25) TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2REAC = rccpsHostFunc.CrtAcc(TradeContext.I2REAC,25) AfaLoggerFunc.tradeInfo(">>>结束判断是否存在多余款操作") AfaLoggerFunc.tradeInfo(">>>开始组织报文上送主机记账操作") #=====组织报文发送主机记账==== TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSLZ #贷方账号 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_HCHK #借方账号 TradeContext.REAC = TradeContext.BESBNO + PL_ACC_NXYDXZ #挂账账号 #=====生成账号校验位==== TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.REAC = rccpsHostFunc.CrtAcc(TradeContext.REAC,25) TradeContext.HostCode = '8813' #关彬捷 20081007 #TradeContext.NOTE3 = '主机记账' TradeContext.NOTE3 = '' TradeContext.RCCSMCD = PL_RCCSMCD_HPJF #摘要代码 AfaLoggerFunc.tradeInfo(">>>结束组织报文上送主机记账操作") AfaLoggerFunc.tradeInfo(">>>开始更新登记簿状态") #关彬捷 20081007 改记账状态为自动入账 #TradeContext.BCSTAT = PL_BCSTAT_ACC #记账 TradeContext.BCSTAT = PL_BCSTAT_AUTO #自动入账 TradeContext.BDWFLG = PL_BDWFLG_WAIT #处理中 #=====新增sstlog表状态记录==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,TradeContext.BCSTAT,TradeContext.BDWFLG): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态['+TradeContext.BCSTAT+']['+TradeContext.BDWFLG+']失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo(">>>结束更新登记簿状态") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( ">>>开始汇兑来账接收处理" ) #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_trcbka.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询汇兑业务登记簿相同报文异常') elif len(record) > 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) #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' #====开始向字典赋值==== trcbka_dict = {} if not rccpsMap1101CTradeContext2Dtrcbka_dict.map(trcbka_dict): return AfaFlowControl.ExitThisFlow('M999', '字典赋值出错') trcbka_dict['DCFLG'] = PL_DCFLG_CRE #借贷标识.贷 trcbka_dict['OPRNO'] = '00' #业务属性 #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(trcbka_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('插入汇兑业务登记簿,COMMIT成功') #=====设置状态为收妥==== sstlog = {} sstlog['BSPSQN'] = TradeContext.BSPSQN sstlog['BJEDTE'] = TradeContext.BJEDTE sstlog['BCSTAT'] = PL_BCSTAT_BNKRCV sstlog['BDWFLG'] = PL_BDWFLG_SUCC #=====设置状态为 收妥-成功 ==== if not rccpsState.setTransState(sstlog): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') ##========================= START 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #初始化记挂账标识,记账.0,挂账.1,默认记账 accflag = 0 #接收机构暂存 TradeContext.BESBNOFIRST = TradeContext.BESBNO if accflag == 0: AfaLoggerFunc.tradeInfo(">>>开始校验密押") #=====开始调用密押服务器进行核押==== SNDBANKCO = TradeContext.SNDBNKCO RCVBANKCO = TradeContext.RCVBNKCO SNDBANKCO = SNDBANKCO.rjust(12,'0') RCVBANKCO = RCVBANKCO.rjust(12,'0') AMOUNT = TradeContext.OCCAMT.split('.')[0] + TradeContext.OCCAMT.split('.')[1] AMOUNT = AMOUNT.rjust(15,'0') INFO = ' ' INFO = INFO.rjust(60,' ') AfaLoggerFunc.tradeDebug('处理类型(0-编押 1-核押):' + str(PL_SEAL_DEC) ) AfaLoggerFunc.tradeDebug('业务种类(1-现金汇票 2-转账汇票 3-电子汇兑业务):' +str(PL_TYPE_DZHD) ) AfaLoggerFunc.tradeDebug('委托日期:' + TradeContext.TRCDAT ) AfaLoggerFunc.tradeDebug('交易流水号:' + TradeContext.TRCNO ) AfaLoggerFunc.tradeDebug('AMOUNT=' + str(AMOUNT) ) AfaLoggerFunc.tradeDebug('SNDBANKCO=' + str(SNDBANKCO) ) AfaLoggerFunc.tradeDebug('RCVBANKCO=' + str(RCVBANKCO) ) AfaLoggerFunc.tradeDebug('密押:' + TradeContext.SEAL ) AfaLoggerFunc.tradeDebug('OTHERINFO[' + str(INFO) + ']') ret = miya.DraftEncrypt(PL_SEAL_DEC,PL_TYPE_DZHD,TradeContext.TRCDAT,TradeContext.TRCNO,AMOUNT,SNDBANKCO,RCVBANKCO,'',TradeContext.SEAL) if ret != 0: #密押错,挂账 AfaLoggerFunc.tradeInfo("密押校验未通过,ret=[" + str(ret) + "]") accflag = 1 TradeContext.NOTE3 = "密押错,挂账!" else: #密押校验通过 AfaLoggerFunc.tradeInfo("密押校验通过") AfaLoggerFunc.tradeInfo(">>>结束校验密押") #校验账号是否非法 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号是否非法") if (len(TradeContext.PYEACC) != 23) and (len(TradeContext.PYEACC) != 19) : accflag = 1 TradeContext.NOTE3 = '此账号不是对公或对私账号,挂账!' AfaLoggerFunc.tradeInfo("结束校验账号是否非法") #调用主机接口查询账户信息 if accflag == 0: #调用8810查询账户信息 AfaLoggerFunc.tradeInfo("开始查询账户信息") TradeContext.ACCNO = TradeContext.PYEACC TradeContext.HostCode = '8810' rccpsHostFunc.CommHost( '8810' ) if TradeContext.errorCode != '0000': accflag = 1 TradeContext.NOTE3 = '查询收款人信息失败,挂账!' elif TradeContext.errorCode == '0000' and len(TradeContext.ACCSO) == 0 : accflag = 1 TradeContext.NOTE3 = '查询收款人开户机构失败,挂账!' AfaLoggerFunc.tradeInfo("结束查询账户信息") #校验账户状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验是否跨法人") if TradeContext.ACCSO[0:6] != TradeContext.BESBNO[0:6] : accflag = 1 TradeContext.NOTE3 = '接收行与账户开户行跨法人,挂账!' AfaLoggerFunc.tradeInfo("结束校验是否跨法人") #校验开户机构是否建立代理关系 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验接收行与开户机构是否为同一机构") if TradeContext.ACCSO != TradeContext.BESBNOFIRST: khjg = {} khjg['BESBNO'] = TradeContext.ACCSO khjg['BTOPSB'] = TradeContext.BESBNOFIRST khjg['SUBFLG'] = PL_SUBFLG_SUB rec = rccpsDBTrcc_subbra.selectu(khjg) if rec == None: accflag = 1 TradeContext.NOTE3 = '查询账户代理关系失败,挂账!' elif len(rec) <= 0: accflag = 1 TradeContext.NOTE3 = '账户未建立代理关系,挂账!' else: #接收机构与开户机构存在代理关系,设置机构号为开户机构号 TradeContext.BESBNO = TradeContext.ACCSO AfaLoggerFunc.tradeInfo("结束校验接收行与开户机构是否为同一机构") #校验账号状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号状态是否正常") if TradeContext.ACCST != '0' and TradeContext.ACCST != '2': accflag = 1 TradeContext.NOTE3 = '账户状态不正常,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验账号状态是否正常") #校验收款人户名是否一致 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验收款人户名是否一致") if TradeContext.ACCNM != TradeContext.PYENAM : accflag = 1 TradeContext.NOTE3 = '收款人户名不符,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验收款人户名是否一致") if (TradeContext.existVariable( "PYEACC" ) and len(TradeContext.PYEACC) != 0): #收款人名称 TradeContext.PYEACCNO = TradeContext.PYEACC else: TradeContext.PYEACCNO = '' if (TradeContext.existVariable( "PYENAM" ) and len(TradeContext.PYENAM) != 0): #收款人名称 TradeContext.OTNM = TradeContext.PYENAM else: TradeContext.OTNM = '' #汇兑往帐记帐字典赋值 TradeContext.SBACACNM = '' #借方户名 input_dict = {} if (TradeContext.existVariable( "PYRNAM" ) and len(TradeContext.PYRNAM) != 0): #付款人户名 TradeContext.SBACACNM = TradeContext.PYRNAM input_dict['accflag'] = str(accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['PYEACC'] = TradeContext.PYEACCNO #收款人账号 input_dict['OTNM'] = TradeContext.OTNM #收款人名称 input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑记账接口 rccpsEntries.HDLZJZ(input_dict) TradeContext.accflag = accflag #代理标志 #=====新增sstlog表状态记录==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,TradeContext.BCSTAT,TradeContext.BDWFLG): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态['+TradeContext.BCSTAT+']['+TradeContext.BDWFLG+']失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo("***农信银系统:来账.中心类操作(1.本地操作).汇票查询书接收[TRC006_1131]进入***") #================检查是否重复报文=========================================== AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hpcbka_where_dict = {} hpcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hpcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hpcbka_where_dict['TRCNO'] = TradeContext.TRCNO hpcbka_dict = rccpsDBTrcc_hpcbka.selectu(hpcbka_where_dict) if hpcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") if len(hpcbka_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(">>>开始为汇票查询查复登记簿赋值") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' TradeContext.ISDEAL = PL_ISDEAL_UNDO hpcbka_dict = {} if not rccpsMap1131CTradeContext2Dhpcbka.map(hpcbka_dict): return AfaFlowControl.ExitThisFlow("S999","为汇票查询查复登记簿赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇票查询查复登记簿赋值") #================登记查询查复登记簿========================================= AfaLoggerFunc.tradeInfo(">>>开始登记查询查复登记簿") ret = rccpsDBTrcc_hpcbka.insertCmt(hpcbka_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","登记汇票查询查复登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记查询查复登记簿") #================为通讯回执报文赋值========================================= 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.本地操作).汇票查询书接收[TRC006_1131]进入***") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( "====开始汇兑退汇来账接收处理====" ) #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_trcbka.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询汇兑业务登记簿相同报文异常') elif len(record) > 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) #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' #===================查询原交易信息========================================= AfaLoggerFunc.tradeInfo(">>>开始查询原交易信息") ortrc_dict = {} if not rccpsDBFunc.getTransTrcAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,ortrc_dict): AfaLoggerFunc.tradeInfo("未找到原交易信息") TradeContext.BOJEDT = "" TradeContext.BOSPSQ = "" else: TradeContext.BOJEDT = ortrc_dict['BJEDTE'] TradeContext.BOSPSQ = ortrc_dict['BSPSQN'] #=====刘雨龙 2008-09-17 增加业务类型==== TradeContext.OPRATTNO = ortrc_dict['OPRATTNO'] AfaLoggerFunc.tradeInfo(">>>结束查询原交易信息") #====开始向字典赋值==== trcbka_dict = {} if not rccpsMap1101CTradeContext2Dtrcbka_dict.map(trcbka_dict): return AfaFlowControl.ExitThisFlow('M999', '字典赋值出错') trcbka_dict['DCFLG'] = PL_DCFLG_CRE #借贷标识 trcbka_dict['OPRNO'] = '09' #业务属性 #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(trcbka_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('插入汇兑业务登记簿,COMMIT成功') ##========================= START 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #初始化记挂账标识,记账.0,挂账.1,默认记账 accflag = 0 #接收机构暂存 TradeContext.BESBNOFIRST = TradeContext.BESBNO #校验账号是否非法 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号是否非法") if (len(TradeContext.PYEACC) != 23) and (len(TradeContext.PYEACC) != 19) : accflag = 1 TradeContext.NOTE3 = '此账号不是对公或对私账号,挂账!' AfaLoggerFunc.tradeInfo("结束校验账号是否非法") #调用主机接口查询账户信息 if accflag == 0: #调用8810查询账户信息 AfaLoggerFunc.tradeInfo("开始查询账户信息") TradeContext.ACCNO = TradeContext.PYEACC TradeContext.HostCode = '8810' rccpsHostFunc.CommHost( '8810' ) if TradeContext.errorCode != '0000': accflag = 1 TradeContext.NOTE3 = '查询收款人信息失败,挂账!' elif TradeContext.errorCode == '0000' and len(TradeContext.ACCSO) == 0 : accflag = 1 TradeContext.NOTE3 = '查询收款人开户机构失败,挂账!' AfaLoggerFunc.tradeInfo("结束查询账户信息") #校验账户状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验是否跨法人") if TradeContext.ACCSO[0:6] != TradeContext.BESBNO[0:6] : accflag = 1 TradeContext.NOTE3 = '接收行与账户开户行跨法人,挂账!' AfaLoggerFunc.tradeInfo("结束校验是否跨法人") #校验开户机构是否建立代理关系 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验接收行与开户机构是否为同一机构") if TradeContext.ACCSO != TradeContext.BESBNOFIRST: khjg = {} khjg['BESBNO'] = TradeContext.ACCSO khjg['BTOPSB'] = TradeContext.BESBNOFIRST khjg['SUBFLG'] = PL_SUBFLG_SUB rec = rccpsDBTrcc_subbra.selectu(khjg) if rec == None: accflag = 1 TradeContext.NOTE3 = '查询账户代理关系失败,挂账!' elif len(rec) <= 0: accflag = 1 TradeContext.NOTE3 = '账户未建立代理关系,挂账!' else: #接收机构与开户机构存在代理关系,设置机构号为开户机构号 TradeContext.BESBNO = TradeContext.ACCSO AfaLoggerFunc.tradeInfo("结束校验接收行与开户机构是否为同一机构") #校验账号状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号状态是否正常") if TradeContext.ACCST != '0' and TradeContext.ACCST != '2': accflag = 1 TradeContext.NOTE3 = '账户状态不正常,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验账号状态是否正常") #校验收款人户名是否一致 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验收款人户名是否一致") if TradeContext.ACCNM != TradeContext.PYENAM : accflag = 1 TradeContext.NOTE3 = '收款人户名不符,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验收款人户名是否一致") if (TradeContext.existVariable( "PYEACC" ) and len(TradeContext.PYEACC) != 0): #收款人名称 TradeContext.PYEACC = TradeContext.PYEACC else: TradeContext.PYEACC = '' if (TradeContext.existVariable( "PYENAM" ) and len(TradeContext.PYENAM) != 0): #收款人名称 TradeContext.OTNM = TradeContext.PYENAM else: TradeContext.OTNM = '' #汇兑往帐记帐字典赋值 input_dict = {} input_dict['accflag'] = str(accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['PYEACC'] = TradeContext.PYEACC #收款人账号 input_dict['OTNM'] = TradeContext.OTNM #收款人名称 input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑记账接口 rccpsEntries.HDLZJZ(input_dict) TradeContext.accflag = accflag #代理标志 #=====开始调函数拼贷方账号第25位校验位==== TradeContext.HostCode = '8813' #调用8813主机接口 TradeContext.RCCSMCD = PL_RCCSMCD_HDLZ #主机摘要代码:汇兑来账 TradeContext.ACUR = '1' ##========================= END 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #=====设置状态为收妥==== sstlog = {} sstlog['BSPSQN'] = TradeContext.BSPSQN sstlog['BJEDTE'] = TradeContext.BJEDTE sstlog['BCSTAT'] = PL_BCSTAT_BNKRCV sstlog['BDWFLG'] = PL_BDWFLG_SUCC #=====设置状态为 收妥-成功 ==== if not rccpsState.setTransState(sstlog): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') 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