示例#1
0
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
示例#2
0
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