Example #1
0
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
Example #2
0
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
Example #3
0
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
Example #4
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo("进入汇票查复书录入 1.本地操作 ")
    
    #=====查询汇票查询查复登记簿====
    where_dict_hpcbka = {'BJEDTE':TradeContext.BOJEDT,'BSPSQN':TradeContext.BOSPSQ}
    res_hpcbka = rccpsDBTrcc_hpcbka.selectu(where_dict_hpcbka)
    if( res_hpcbka == None ):
        return AfaFlowControl.ExitThisFlow("S999", "查询汇票查询查复登记簿失败")
        
    if( len(res_hpcbka) == 0 ):
        return AfaFlowControl.ExitThisFlow("S999", "查询汇票查询查复登记簿结果为空")
        
    if( res_hpcbka['ISDEAL'] == PL_ISDEAL_ISDO ):
        return AfaFlowControl.ExitThisFlow("S999", "此笔查询已被查复过了")
    
#    #=====查询汇票业务登记簿====
#    where_dict_bilbka = {'BJEDTE':TradeContext.BOJEDT,'BSPSQN':TradeContext.BOSPSQ}
#    res_bilbka = rccpsDBTrcc_bilbka.selectu(where_dict_bilbka)
#    if( res_bilbka == None ):
#        return AfaFlowControl.ExitThisFlow("S999", "查询汇票业务失败")
#        
#    if( len(res_bilbka) == 0 ):
#        return AfaFlowControl.ExitThisFlow("S999", "查询汇票业务结果为空")
#        
#    #=====查询汇票信息登记簿====
#    where_dict_bilinf = {'BILVER':res_bilbka['BILVER'],'BILNO':res_bilbka['BILNO'],'BILRS':res_bilbka['BILRS']}
#    res_bilinf = rccpsDBTrcc_bilinf.selectu(where_dict_bilinf)
#    if( res_bilinf == None ):
#        return AfaFlowControl.ExitThisFlow("S999", "查询汇票信息失败")
#        
#    if( len(res_bilinf) == 0 ):
#        return AfaFlowControl.ExitThisFlow("S999", "查询汇票信息结果为空")
        
#    AfaLoggerFunc.tradeInfo("RCVSTLBIN="+TradeContext.RCVSTLBIN)
#    AfaLoggerFunc.tradeInfo("RCVBNKCO="+TradeContext.RCVBNKCO)
    AfaLoggerFunc.tradeInfo("RCVBNKNM="+TradeContext.RCVBNKNM)
    
    #=====登记汇票查复书信息====
    TradeContext.BRSFLG   = PL_BRSFLG_SND
#    TradeContext.BESBNO   = res_hpcbka['BESBNO']
#    TradeContext.BETELR   = res_hpcbka['BETELR']
#    TradeContext.BEAUUS   = res_hpcbka['BEAUUS']
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.TRCCO    = '9900527'
    TradeContext.TRCDAT   = TradeContext.BJEDTE
    TradeContext.TRCNO    = TradeContext.SerialNo
#    TradeContext.SNDBNKCO = 
#    TradeContext.SNDBNKNM = 
    TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN
    TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN
#    TradeContext.RCVBNKCO = res_hpcbka['SNDBNKCO']
#    TradeContext.RCVBNKNM = res_hpcbka['SNDBNKNM']
    TradeContext.ORTRCCO  = '9900526'
    TradeContext.BILVER   = res_hpcbka['BILVER']
    TradeContext.BILNO    = res_hpcbka['BILNO']
    TradeContext.BILDAT   = res_hpcbka['BILDAT']
    TradeContext.PAYWAY   = res_hpcbka['PAYWAY']
    TradeContext.CUR      = res_hpcbka['CUR']
    TradeContext.BILAMT   = str(res_hpcbka['BILAMT'])
    TradeContext.PYRACC   = res_hpcbka['PYRACC']
    TradeContext.PYRNAM   = res_hpcbka['PYRNAM']
    TradeContext.PYEACC   = res_hpcbka['PYEACC']
    TradeContext.PYENAM   = res_hpcbka['PYENAM']
#    TradeContext.CONT     = res_hpcbka['CONT']
    TradeContext.ISDEAL   = PL_ISDEAL_ISDO
    TradeContext.PRCCO    = ""
    TradeContext.BILENDDT = ""
    
    TradeContext.PRT_BILAMT = res_hpcbka['BILAMT']
    
    #====begin 蔡永贵 20110215 增加====
    #新票据号是16位,需要取后8位,版本号为02,同时要兼容老票据号8位,版本号为01
    if len(TradeContext.BILNO) == 16:
        TradeContext.TMP_BILNO = TradeContext.BILNO[-8:]
    else:
        TradeContext.TMP_BILNO = TradeContext.BILNO
    #============end============

    hpcbka_insert_dict = {}
    if not rccpsMap8517CTradeContext2Dhpcbka_dict.map(hpcbka_insert_dict):
        return AfaFlowControl.ExitThisFlow("S999", "为汇票查询查复登记薄赋值失败")
        
    ret = rccpsDBTrcc_hpcbka.insertCmt(hpcbka_insert_dict)
    if( ret <= 0 ):
        return AfaFlowControl.ExitThisFlow("S999", "为汇票查询查复登记薄赋值异常")
    
    AfaLoggerFunc.tradeInfo("结束登记查询书信息")
    
    #=====给查复报文赋值====
    AfaLoggerFunc.tradeInfo("开始为汇票查复书报文赋值")
    #=====报文头====
    TradeContext.MSGTYPCO = 'SET008'
    TradeContext.SNDBRHCO = TradeContext.BESBNO
    TradeContext.SNDCLKNO = TradeContext.BETELR
    TradeContext.SNDTRDAT = TradeContext.BJEDTE
    TradeContext.SNDTRTIM = TradeContext.BJETIM
    TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO = '99'
    TradeContext.ROPRTPNO = '21'
    TradeContext.TRANTYP  = '0'
    #=====扩展数据====
#    TradeContext.TRCCO    = 
#    TradeContext.SNDBNKCO = 
#    TradeContext.SNDBNKNM = 
#    TradeContext.RCVBNKCO = 
#    TradeContext.RCVBNKNM = 
#    TradeContext.TRCDAT   = 
#    TradeContext.TRCNO    = 
#    TradeContext.BILDAT   = 
#    TradeContext.BILNO    = 
#    TradeContext.BILVER   = 
#    TradeContext.PAYWAY   = 
#    TradeContext.CUR      = 
#    TradeContext.BILAMT   = 
#    TradeContext.PYRACC   = 
#    TradeContext.PYRNAM   = 
#    TradeContext.PYEACC   = 
#    TradeContext.PYENAM   = 
#    TradeContext.CONT     = 
    TradeContext.ORQYDAT  = TradeContext.BOJEDT
    TradeContext.OQTSBNK  = res_hpcbka['SNDBNKCO']
    TradeContext.OQTNO    = res_hpcbka['TRCNO']
    
    AfaLoggerFunc.tradeInfo("结束为汇票查询书报文赋值")
    
    return True