def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作)交易[TRC001_8558]进入***' ) #=====判断对账日期是否存在==== if not TradeContext.existVariable('CHKDAT'): return AfaFlowControl.ExitThisFlow('S999','对账日期[CHKDAT]不存在') #=====进入查询rekbal==== rek_sel = {} rek_sel['NCCWKDAT'] = TradeContext.CHKDAT record = rccpsDBTrcc_rekbal.selectu(rek_sel) if record == None: return AfaFlowControl.ExitThisFlow('S999','查询清算账户余额通知登记簿异常') elif len(record) <= 0: return AfaFlowControl.ExitThisFlow('S999','查询清算账户余额通知登记簿无记录') else: TradeContext.CHKRST = record['CHKRST'] #对账结果 TradeContext.OCCAMT = str(record['TODAYBAL']) #行内余额 TradeContext.errorCode = '0000' TradeContext.errorMsg = '成功' AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作)交易[TRC001_8558]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo('>>>开始清算账户余额回执发送交易') #=====判断字段值是否存在==== if not TradeContext.existVariable('CHKDAT'): return AfaFlowControl.ExitThisFlow('S999','对账日期不可为空') if not TradeContext.existVariable('OCCAMT'): return AfaFlowControl.ExitThisFlow('S999','本日余额不可为空') if not TradeContext.existVariable('CHKRST'): return AfaFlowControl.ExitThisFlow('S999','对账结果不可为空') #=====进入查询rekbal==== rek_sel = {} rek_sel['NCCWKDAT'] = TradeContext.CHKDAT rek_sel['BRSFLG'] = PL_BRSFLG_RCV record = rccpsDBTrcc_rekbal.selectu(rek_sel) if record == None: return AfaFlowControl.ExitThisFlow('S999','查询清算账户余额通知登记簿异常') elif len(record) <= 0: return AfaFlowControl.ExitThisFlow('S999','查询清算账户余额通知登记簿无记录') else: TradeContext.BOJEDT = record['BJEDTE'] TradeContext.BOSPSQ = record['BSPSQN'] TradeContext.TODAYBAL= record['TODAYBAL'] TradeContext.LSTDTBAL= record['LSTDTBAL'] TradeContext.LBDCFLG = record['LBDCFLG'] TradeContext.NTTDCFLG= record['NTTDCFLG'] TradeContext.NTTBAL = record['NTTBAL'] TradeContext.BALDCFLG= record['BALDCFLG'] TradeContext.AVLBAL = record['AVLBAL'] #=====TradeContext向字典赋值==== TradeContext.NTODAYBAL = TradeContext.OCCAMT TradeContext.SNDMBRCO = record['RCVMBRCO'] TradeContext.RCVMBRCO = record['SNDMBRCO'] rekbal_dict = {} if not rccpsMap8557CTradeContext2Drekbal_dict.map(rekbal_dict): return AfaFlowControl.ExitThisFlow('S999','字典赋值错误') ret = rccpsDBTrcc_rekbal.insertCmt(rekbal_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow('S999','登记清算账户余额通知登记簿异常') #=====赋值发送农信银中心==== TradeContext.ORTRCDAT = record['TRCDAT'] TradeContext.ORTRCNO = record['TRCNO'] TradeContext.TODAYBAL = TradeContext.OCCAMT TradeContext.OPRTYPNO = '99' TradeContext.ROPRTPNO = '99' TradeContext.ORMFN = record['SNDMBRCO'] + TradeContext.ORTRCDAT + TradeContext.ORTRCNO 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 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