Example #1
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8591]通存通兑错帐处理标识维护进入***' )
    
    AfaLoggerFunc.tradeInfo('个性化处理(本地操作)')
    
    #=====判断接口变量是否存在====
    if not TradeContext.existVariable("SNDBNKCO"):
        return AfaFlowControl.ExitThisFlow('A099','发送行号不能为空' )
        
    if not TradeContext.existVariable("TRCDAT"):
        return AfaFlowControl.ExitThisFlow('A009','委托日期不能为空')
        
    if not TradeContext.existVariable("TRCNO"):
        return AfaFlowControl.ExitThisFlow('A009','交易流水号不能为空')
        
    if not TradeContext.existVariable("BJEDTE"):
        return AfaFlowControl.ExitThisFlow('A009','报单日期不能为空')
        
    if not TradeContext.existVariable("BSPSQN"):
        return AfaFlowControl.ExitThisFlow('A009','报单序号不能为空')
    
    AfaLoggerFunc.tradeInfo('个性化处理结束(本地操作)') 
    
    #=====得到nccwkdat====
    if not rccpsFunc.GetNCCDate( ) :                   #NCCworkDate
        raise AfaFlowControl.flowException( )
    
    #=====查询错账登记簿====
    where_dict = {}
    where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'SNDBNKCO':TradeContext.SNDBNKCO,'TRCDAT':TradeContext.TRCDAT,'TRCNO':TradeContext.TRCNO}
    tddzcz_record = rccpsDBTrcc_tddzcz.selectu(where_dict)
    if(tddzcz_record == None):
        return AfaFlowControl.ExitThisFlow('A009','查询错账登记簿失败')
        
    elif(len(tddzcz_record) == 0):
        return AfaFlowControl.ExitThisFlow('A009','查询错账登记簿为空')
        
    else:
        AfaLoggerFunc.tradeInfo("查询错账登记簿成功")
    
    #=====查询原业务的信息====
    AfaLoggerFunc.tradeInfo('查询原业务信息')
    where_dict = {}
    where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN}
    wtrbka_record = rccpsDBTrcc_wtrbka.selectu(where_dict)
    if(wtrbka_record == None):
        return AfaFlowControl.ExitThisFlow('A009','查询业务登记簿失败')
        
    elif(len(wtrbka_record) == 0):
        return AfaFlowControl.ExitThisFlow('A009','查询业务登记簿为空')   
        
    else:
        AfaLoggerFunc.tradeInfo('查询业务登记簿成功') 
        
    #=====查询业务的当前信息====
    wtr_dict = {}
    if not rccpsDBFunc.getTransWtr(TradeContext.BJEDTE,TradeContext.BSPSQN,wtr_dict):
        return AfaFlowControl.ExitThisFlow('A009','查询业务的当前信息失败')
        
    if(wtr_dict['BRSFLG'] == PL_BRSFLG_SND):
        sstlog_dict = {}
        if not rccpsState.getTransStateSet(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_ACC,PL_BDWFLG_SUCC,sstlog_dict):
            return AfaFlowControl.ExitThisFlow('A009','查询业务状态信息失败')
            
        wtr_dict['FEDT'] = sstlog_dict['FEDT']
        wtr_dict['RBSQ'] = sstlog_dict['RBSQ']
        
    TradeContext.CLDT = wtr_dict['FEDT']
    TradeContext.UNSQ = wtr_dict['RBSQ']
    if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :   #RBSQ
        return AfaFlowControl.ExitThisFlow('A099','产生前置流水号失败')
    TradeContext.FEDT=AfaUtilTools.GetHostDate( )    #FEDT
    
    #=====判断当前业务是否已经结转====
    if(wtr_dict['BCSTAT'] == PL_BCSTAT_TRAS and wtr_dict['BDWFLG'] == PL_BDWFLG_SUCC):
        return AfaFlowControl.ExitThisFlow('A009','该账务已经结转')
        
        
    #=====判断业务的往来标示====
    AfaLoggerFunc.tradeInfo('<<<<<<判断业务的往来标示')
    if(wtrbka_record['BRSFLG'] == PL_BRSFLG_SND):
        AfaLoggerFunc.tradeInfo('<<<<<<业务为往账')
        acc    = 0    
        hcac   = 0   
        canc   = 0
        cancel = 0
        
        #=====查询是否有记账成功的状态====
        sstlog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_ACC,PL_BDWFLG_SUCC,sstlog_list):
            acc = len(sstlog_list)
        #=====查询是否有抹账的状态====
        sstlog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_SUCC,sstlog_list):
            hcac = len(sstlog_list)
        #=====查询是否有冲销的状态====
        sstlog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANC,PL_BDWFLG_SUCC,sstlog_list):
            canc = len(sstlog_list)
        #=====查询是否有冲正的状态====
        ssltog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANCEL,PL_BDWFLG_SUCC,sstlog_list):
            cancel = len(sstlog_list)
        
        #=====判断是否需要清算状态调整====
        AfaLoggerFunc.tradeInfo('<<<<<<判断是否需要清算状态调整')
        if(acc - (hcac + canc + cancel) >= 0):
            AfaLoggerFunc.tradeInfo('<<<<<<需要进行清算状态调整')
                
            TradeContext.BETELR   = PL_BETELR_AUTO
            TradeContext.BRSFLG   = wtrbka_record['BRSFLG']    
            TradeContext.CHRGTYP  = wtrbka_record['CHRGTYP']
            TradeContext.BESBNO   = wtrbka_record['BESBNO'] 
            #=====卡折存现/本转异地====
            if(wtrbka_record['TRCCO'] in ('3000002','3000003','3000004','3000005')):
                AfaLoggerFunc.tradeInfo('卡折存现/本转异地')
                TradeContext.HostCode = '8813' 
                TradeContext.ACUR     = '1'
                TradeContext.RCCSMCD  = PL_RCCSMCD_DZBJ
                TradeContext.SBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSWZ          #借方账号
                TradeContext.SBAC     = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25)
                TradeContext.ACNM     = '农信银待清算往账'                                 #借方户名
                TradeContext.RBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYWZ             #贷方账号
                TradeContext.RBAC     = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
                TradeContext.OTNM     = '农信银往账'                                       #贷方户名
                TradeContext.OCCAMT   = str(wtrbka_record['OCCAMT'])                       #发生额
                TradeContext.PKFG     = 'W'
                TradeContext.CTFG     = '7'
                    
            #=====卡折取现/异地转本地====
            elif(wtrbka_record['TRCCO'] in ('3000102','3000103','3000104','3000105')): 
                AfaLoggerFunc.tradeInfo('卡折取现/异地转本地')
                if(wtrbka_record['CHRGTYP'] == '1'):    #转收           
                    AfaLoggerFunc.tradeInfo("<<<<<转收手续费")
                    TradeContext.HostCode = '8813' 
                    TradeContext.ACUR     = '1'
                    TradeContext.RCCSMCD  = PL_RCCSMCD_DZBJ
                    TradeContext.SBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYWZ    #借方账号
                    TradeContext.SBAC     = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) 
                    TradeContext.ACNM     = '农信银往账'
                    TradeContext.RBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSWZ #贷方账号 
                    TradeContext.RBAC     = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
                    TradeContext.OTNM     = '农信银待清算往账'
                    TradeContext.OCCAMT   = str(wtrbka_record['OCCAMT'] + wtrbka_record['CUSCHRG'])
                    TradeContext.PKFG     = 'W'
                    TradeContext.CTFG     = '9'
                    
                else:    #现收
                    AfaLoggerFunc.tradeInfo("<<<<<现收手续费,或不收")
                    TradeContext.HostCode = '8813' 
                    TradeContext.ACUR     = '1'
                    TradeContext.RCCSMCD  = PL_RCCSMCD_DZBJ
                    TradeContext.SBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYWZ    #借方账号
                    TradeContext.SBAC     = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) 
                    TradeContext.ACNM     = '农信银往账'
                    TradeContext.RBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSWZ #贷方账号 
                    TradeContext.RBAC     = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
                    TradeContext.OTNM     = '农信银待清算往账'
                    TradeContext.OCCAMT   = str(wtrbka_record['OCCAMT'])
                    TradeContext.PKFG     = 'W'
                    TradeContext.CTFG     = '9'
                
            else:
                return AfaFlowControl.ExitThisFlow('A099','原交易交易代码非法')
                
            #=====增加原交易的状态--结转====
            if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_TRAS,PL_BDWFLG_WAIT):
                AfaDBFunc.RollbackSql()
                return AfaFlowControl.ExitThisFlow('A099','增加原交易的状态--结转,失败')
            else:
                AfaDBFunc.CommitSql()  
                
            #=====调用主机交易====
            rccpsHostFunc.CommHost( TradeContext.HostCode )
            
            #=====判断主机交易是否成功====
            if(TradeContext.errorCode != '0000'):
                AfaLoggerFunc.tradeInfo("主机交易失败")
                #=====更改原交易状态====
                state_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCSTAT':PL_BCSTAT_TRAS,'BDWFLG':PL_BDWFLG_FAIL}
                state_dict['STRINFO'] = TradeContext.errorMsg
                if not rccpsState.setTransState(state_dict):
                    AfaDBFunc.RollbackSql()
                    return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败')
                else:
                    AfaDBFunc.CommitSql()   
                    
                return AfaFlowControl.ExitThisFlow('A099','主机记账失败')
                
            else:
                AfaLoggerFunc.tradeInfo('主机记账成功')
                #=====更改原交易状态====
                state_dict = {}
                state_dict['BJEDTE'] = TradeContext.BJEDTE
                state_dict['BSPSQN'] = TradeContext.BSPSQN
                state_dict['BCSTAT'] = PL_BCSTAT_TRAS
                state_dict['BDWFLG'] = PL_BDWFLG_SUCC
                if(TradeContext.existVariable("SBAC")):
                    state_dict['SBAC'] = TradeContext.SBAC
                if(TradeContext.existVariable("RBAC")):
                    state_dict['RBAC'] = TradeContext.RBAC
                state_dict['STRINFO'] = '主机成功'
                if(TradeContext.existVariable('TRDT')):
                    state_dict['TRDT'] = TradeContext.TRDT
                if(TradeContext.existVariable('TLSQ')):
                    state_dict['TLSQ'] = TradeContext.TLSQ
                if not rccpsState.setTransState(state_dict):
                    AfaDBFunc.RollbackSql()
                    return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败')
                else:
                    AfaDBFunc.CommitSql()   
                     
        else:
            return AfaFlowControl.ExitThisFlow('A009','原交易不能进行清算调整')
        
    else:
        AfaLoggerFunc.tradeInfo('<<<<<<业务为来账')
        autopay = 0    
        auto    = 0
        hcac    = 0   
        canc    = 0
        cancel  = 0
        #=====查询是否有记账成功的状态====
        sstlog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_AUTO,PL_BDWFLG_SUCC,sstlog_list):
            auto = len(sstlog_list)
        sstlog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_AUTOPAY,PL_BDWFLG_SUCC,sstlog_list):
            autopay = len(sstlog_list)      
        #=====查询是否有抹账的状态====
        sstlog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_SUCC,sstlog_list):
            hcac = len(sstlog_list)
        #=====查询是否有冲销的状态====
        sstlog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANC,PL_BDWFLG_SUCC,sstlog_list):
            canc = len(sstlog_list)
        #=====查询是否有冲正的状态====
        ssltog_list = []
        if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANCEL,PL_BDWFLG_SUCC,sstlog_list):
            cancel = len(sstlog_list)
            
        #=====判断原业务是否需要进行清算状态调整====
        AfaLoggerFunc.tradeInfo("判断原业务是否需要进行清算状态调整")
        if((auto + autopay) - (hcac + canc + cancel) >= 0):
            AfaLoggerFunc.tradeInfo("原业务需要进行清算状态调整")
            
            TradeContext.BETELR   = PL_BETELR_AUTO
            TradeContext.BRSFLG   = wtrbka_record['BRSFLG']    
            TradeContext.CHRGTYP  = wtrbka_record['CHRGTYP']
            TradeContext.BESBNO   = wtrbka_record['BESBNO']  
            #=====卡折存现/本转异地====
            if(wtrbka_record['TRCCO'] in ('3000002','3000003','3000004','3000005')):
                AfaLoggerFunc.tradeInfo('卡折存现/本转异地')
                TradeContext.HostCode = '8813' 
                TradeContext.ACUR     = '1'
                TradeContext.RCCSMCD  = PL_RCCSMCD_DZBJ
                TradeContext.SBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYLZ
                TradeContext.SBAC     = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) 
                TradeContext.ACNM     = '农信银来账'
                TradeContext.RBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSLZ 
                TradeContext.RBAC     = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
                TradeContext.OTNM     = '农信银待清算来账'
                TradeContext.OCCAMT   = str(wtrbka_record['OCCAMT'])
                TradeContext.PKFG     = 'W'
                TradeContext.CTFG     = '7'
            
            #=====卡折取现/异地转本地====    
            elif(wtrbka_record['TRCCO'] in ('3000102','3000103','3000104','3000105')):
                AfaLoggerFunc.tradeInfo('卡折存现/本转异地')
                TradeContext.HostCode = '8813'
                TradeContext.ACUR     = '1'
                TradeContext.RCCSMCD  = PL_RCCSMCD_DZBJ
                TradeContext.SBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSLZ 
                TradeContext.SBAC     = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) 
                TradeContext.ACNM     = '农信银待清算来账'
                TradeContext.RBAC     = wtrbka_record['BESBNO'] + PL_ACC_NXYLZ 
                TradeContext.RBAC     = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
                TradeContext.OTNM     = '农信银来账'
                TradeContext.OCCAMT   = str(wtrbka_record['OCCAMT'] + wtrbka_record['CUSCHRG'])
                TradeContext.PKFG     = 'W'
                TradeContext.CTFG     = '9'
                
            else:
                return AfaFlowControl.ExitThisFlow('A099','原交易交易代码非法')
                
            #=====增加原交易的状态--结转====
            if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_TRAS,PL_BDWFLG_WAIT):
                AfaDBFunc.RollbackSql()
                return AfaFlowControl.ExitThisFlow('A099','增加原交易的状态--结转,失败')
            else:
                AfaDBFunc.CommitSql()  
                
            #=====调用主机交易====
            rccpsHostFunc.CommHost( TradeContext.HostCode )
            
            #=====判断主机交易是否成功====
            if(TradeContext.errorCode != '0000'):
                AfaLoggerFunc.tradeInfo("主机交易失败")
                #=====更改原交易状态====
                state_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCSTAT':PL_BCSTAT_TRAS,'BDWFLG':PL_BDWFLG_FAIL}
                state_dict['STRINFO'] = TradeContext.errorMsg
                if not rccpsState.setTransState(state_dict):
                    AfaDBFunc.RollbackSql()
                    return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败')
                else:
                    AfaDBFunc.CommitSql()   
                    
                return AfaFlowControl.ExitThisFlow('A099','主机记账失败')
                
            else:
                AfaLoggerFunc.tradeInfo('主机记账成功')
                #=====更改原交易状态====
                state_dict = {}
                state_dict['BJEDTE'] = TradeContext.BJEDTE
                state_dict['BSPSQN'] = TradeContext.BSPSQN
                state_dict['BCSTAT'] = PL_BCSTAT_TRAS
                state_dict['BDWFLG'] = PL_BDWFLG_SUCC
                state_dict['STRINFO'] = '主机成功'
                if(TradeContext.existVariable("SBAC")):
                    state_dict['SBAC'] = TradeContext.SBAC
                if(TradeContext.existVariable("RBAC")):
                    state_dict['RBAC'] = TradeContext.RBAC
                if(TradeContext.existVariable('TRDT')):
                    state_dict['TRDT'] = TradeContext.TRDT
                if(TradeContext.existVariable('TLSQ')):
                    state_dict['TLSQ'] = TradeContext.TLSQ
                if not rccpsState.setTransState(state_dict):
                    AfaDBFunc.RollbackSql()
                    return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败')
                else:
                    AfaDBFunc.CommitSql()   
            
        else:
            return AfaFlowControl.ExitThisFlow('A009','原交易不能进行清算调整')
       
    #=====给修改字典赋值====
    update_dict = {}
    update_dict = {'ISDEAL':'1','NOTE3':'此笔错账已结转'}
    where_dict = {}               
    where_dict = {'SNDBNKCO':TradeContext.SNDBNKCO,'TRCDAT':TradeContext.TRCDAT,'TRCNO':TradeContext.TRCNO,\
                  'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN}                                               

    #=====修改数据库中的数据====
    AfaLoggerFunc.tradeInfo("通存通兑错帐处理标识修改")
    res = rccpsDBTrcc_tddzcz.updateCmt(update_dict,where_dict)
    if( res == -1 ):
        return AfaFlowControl.ExitThisFlow('A099','修改通存通兑错帐处理标识失败')
    elif( res == 0 ):
        return AfaFlowControl.ExitThisFlow('A099','交易记录不存在')
        
    #=====向下发的通知表中插入数据====
    AfaLoggerFunc.tradeInfo("<<<<<<向通知表中插入数据")
    insert_dict = {}
    insert_dict['NOTDAT']  = AfaUtilTools.GetHostDate( )
    insert_dict['BESBNO']  = wtrbka_record['BESBNO']
    if(wtrbka_record['BRSFLG'] == PL_BRSFLG_RCV):
        insert_dict['STRINFO'] = "此笔错账["+wtrbka_record['BSPSQN']+"]["+wtrbka_record['BJEDTE']+"]已做手工结转处理"
    else:
        insert_dict['STRINFO'] = "此笔错账["+wtrbka_record['BSPSQN']+"]["+wtrbka_record['BJEDTE']+"]已做手工结转处理 请用8522补打往账凭证"
    if not rccpsDBTrcc_notbka.insertCmt(insert_dict):
        return AfaFlowControl.ExitThisFlow('S999','向下发的通知表中插入数据失败')
    AfaLoggerFunc.tradeInfo("<<<<<<向通知表中插入数据成功")
    
    #=====给输出接口赋值====
    TradeContext.errorCode = "0000"
    TradeContext.errorMsg  = "修改通存通兑错帐处理标识成功"
    TradeContext.ISDEAL    = '1'
#    TradeContext.TLSQ      = TradeContext.TLSQ
#    TradeContext.RBSQ      = TradeContext.RBSQ
#    TradeContext.TRDT      = TradeContext.TRDT

    AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8591]通存通兑错帐处理标识维护退出***' )
    
    return True      
Example #2
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲销应答报文接收[TRC004_1162]进入***' )
    
    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)
    
    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)
    
    #查询冲正登记簿中是否有对此冲销交易的冲正
    AfaLoggerFunc.tradeInfo(">>>开始检查此冲销交易是否已被冲正")
    
    where_sql = "ORMFN = '" + TradeContext.ORMFN + "'"
    
    ret = rccpsDBTrcc_atcbka.count(where_sql)
    
    if ret < 0:
        return AfaFlowControl.ExitThisFlow("S999","查询冲正登记簿异常,退出主流程")
        
    if ret > 0:
        return AfaFlowControl.ExitThisFlow("S999","冲正登记簿中存在对此冲销交易的冲正,退出主流程")
        
    AfaLoggerFunc.tradeInfo(">>>结束检查此冲销交易是否已被冲正")
    
    #=====更改柜员号和机构号为发起柜员号、发起机构号====
    AfaLoggerFunc.tradeInfo("<<<<<<开始更改柜员号,机构号")
    
    #=====查找冲销交易的信息=====
    mpcbka_where_dict = {}
    mpcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN
    
    mpcbka_record = rccpsDBTrcc_mpcbka.selectu(mpcbka_where_dict)
    
    if(mpcbka_record == None):
        return AfaFlowControl.ExitThisFlow("S999","查询原冲销交易信息异常")
        
    if(len(mpcbka_record) <= 0):
        return AfaFlowControl.ExitThisFlow("S999","未找到原冲销交易信息,丢弃报文")
        
    #=====给机构号和柜员号赋值====
    TradeContext.BETELR = mpcbka_record['BETELR']
    TradeContext.BESBNO = mpcbka_record['BESBNO']
    
    AfaLoggerFunc.tradeInfo("<<<<<<更改柜员号,机构号结束")
    
        
    #更新冲销登记簿中心返回信息
    AfaLoggerFunc.tradeInfo(">>>开始更新冲销登记簿中心返回信息")
    
    mpcbka_update_dict = {}
    mpcbka_update_dict['PRCCO'] = TradeContext.PRCCO
    mpcbka_update_dict['STRINFO'] = TradeContext.STRINFO
    
    ret = rccpsDBTrcc_mpcbka.update(mpcbka_update_dict,mpcbka_where_dict)
    
    if ret <= 0:
        return AfaFlowControl.ExitThisFlow("S999","更新冲销登记簿异常")
    
    AfaLoggerFunc.tradeInfo(">>>结束更新冲销登记簿中心返回信息")
    
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        
    #=====查询被冲销交易信息====
    AfaLoggerFunc.tradeInfo("<<<<<<开始查询被冲销的交易的信息")
    
    wtrbka_record = {}
    
    if not rccpsDBFunc.getTransWtr(mpcbka_record['BOJEDT'],mpcbka_record['BOSPSQ'],wtrbka_record):
        return AfaFlowControl.ExitThisFlow("S999","查询被冲销原交易详细信息异常")
        
    AfaLoggerFunc.tradeInfo("<<<<<<结束查询被冲销的交易的信息")
    
    #====为终端号和往来标识赋值====
    TradeContext.TERMID = wtrbka_record['TERMID']
    TradeContext.BRSFLG = wtrbka_record['BRSFLG']
    
    #=====判断对方行冲销是否成功=====
    AfaLoggerFunc.tradeInfo("<<<<<<判断对方行冲销是否成功PRCCO=[" + TradeContext.PRCCO + "]")
    if(TradeContext.PRCCO == 'RCCI0000' or TradeContext.PRCCO == 'RCCO1106'):
        AfaLoggerFunc.tradeInfo("<<<<<<对方行冲销成功")
        
        #=====发起主机记账====
        AfaLoggerFunc.tradeInfo("<<<<<<开始发起主机记账")
        
        #=====取最后一个记账成功状态的前置日期和前置流水号====
        stat_list = []
        
        if rccpsState.getTransStateSetm(wtrbka_record['BJEDTE'],wtrbka_record['BSPSQN'],PL_BCSTAT_ACC,PL_BDWFLG_SUCC,stat_list):
            
            entries_dict = {}
            entries_dict['FEDT']     = stat_list[0]['FEDT']
            entries_dict['RBSQ']     = stat_list[0]['RBSQ']
            entries_dict['PYRACC']   = wtrbka_record['PYRACC']
            entries_dict['PYRNAM']   = wtrbka_record['PYRNAM']
            entries_dict['PYEACC']   = wtrbka_record['PYEACC']
            entries_dict['PYENAM']   = wtrbka_record['PYENAM']
            entries_dict['OCCAMT']   = wtrbka_record['OCCAMT']
            entries_dict['CHRGTYP']  = wtrbka_record['CHRGTYP']
            entries_dict['CUSCHRG']  = wtrbka_record['CUSCHRG']
            entries_dict['RCCSMCD']  = PL_RCCSMCD_CX
            TradeContext.BRSFLG      = wtrbka_record['BRSFLG']
            
            #卡折通存往账抹账会计分录赋值
            if wtrbka_record['TRCCO'] == '3000002' or wtrbka_record['TRCCO'] == '3000004':
                rccpsEntries.KZTCWZMZ(entries_dict)
            
            #卡折本转异往账抹账会计分录赋值
            if wtrbka_record['TRCCO'] == '3000003' or wtrbka_record['TRCCO'] == '3000005':
                rccpsEntries.KZBZYWZMZ(entries_dict)
                
            #卡折通兑往账抹账会计分录赋值
            if wtrbka_record['TRCCO'] == '3000102' or wtrbka_record['TRCCO'] == '3000104':
                rccpsEntries.KZTDWZMZ(entries_dict)
            
            #卡折异转本往账抹账会计分录赋值
            if wtrbka_record['TRCCO'] == '3000103' or wtrbka_record['TRCCO'] == '3000105':
                rccpsEntries.KZYZBWZMZ(entries_dict)
            
            
            #=====生成新的前置日期和前置流水号,并且更新到数据库中====
            if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :
                return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常")
            
            #设置原交易状态为冲销处理中
            AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲销处理中')
            if not rccpsState.newTransState(mpcbka_record['BOJEDT'],mpcbka_record['BOSPSQ'],PL_BCSTAT_CANC,PL_BDWFLG_WAIT):
                return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲销处理中异常")
            
            if not AfaDBFunc.CommitSql( ):
                AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                return AfaFlowControl.ExitThisFlow("S999","Commit异常")
                
            AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲销处理中')
            
            #=====调用主机接口函数=====
            rccpsHostFunc.CommHost( TradeContext.HostCode )
            
            AfaLoggerFunc.tradeInfo("<<<<<<发起主机抹账结束")
            
        else:
            AfaLoggerFunc.tradeInfo(">>>原交易未记账,冲销不抹账")
            
            #设置原交易状态为冲销处理中
            AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲销处理中')
            if not rccpsState.newTransState(mpcbka_record['BOJEDT'],mpcbka_record['BOSPSQ'],PL_BCSTAT_CANC,PL_BDWFLG_WAIT):
                return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲销处理中异常")
            
            if not AfaDBFunc.CommitSql( ):
                AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                return AfaFlowControl.ExitThisFlow("S999","Commit异常")
                
            AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲销处理中')
            
            TradeContext.errorCode = '0000'
            TradeContext.errorMsg  = '原交易未记账,冲销不抹账'
            
            
        #根据主机返回信息,设置交易状态
        
        stat_dict = {}
        stat_dict['BJEDTE'] = wtrbka_record['BJEDTE']
        stat_dict['BSPSQN'] = wtrbka_record['BSPSQN']
        stat_dict['MGID']   = TradeContext.errorCode
        stat_dict['STRINFO']= TradeContext.errorMsg
        
        AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]")
        if(TradeContext.errorCode == '0000'):
            #=====设置原交易状态为冲销成功====
            AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲销成功")
            
            stat_dict['BCSTAT'] = PL_BCSTAT_CANC
            stat_dict['BDWFLG'] = PL_BDWFLG_SUCC
            if TradeContext.existVariable('TRDT'):
                stat_dict['TRDT']   = TradeContext.TRDT
            if TradeContext.existVariable('TLSQ'):
                stat_dict['TLSQ']   = TradeContext.TLSQ
            
            if not rccpsState.setTransState(stat_dict):
                return AfaFlowControl.ExitThisFlow('S999','设置业务状态冲销成功异常')
            
            AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲销成功")
            
        else:
            #=====设置原交易状态为冲销失败====
            AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲销失败")
            
            stat_dict['BCSTAT'] = PL_BCSTAT_CANC
            stat_dict['BDWFLG'] = PL_BDWFLG_FAIL
            
            if not rccpsState.setTransState(stat_dict):
                return AfaFlowControl.ExitThisFlow('S999','设置业务状态冲销失败异常')
                
            AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲销失败")
            
    else:
        AfaLoggerFunc.tradeInfo("<<<<<<对方行冲销拒绝应答,不设置原交易状态")
        
        ##设置原交易状态为冲销处理中
        #AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲销处理中')
        #
        #if not rccpsState.newTransState(wtrbka_record['BJEDTE'],wtrbka_record['BSPSQN'],PL_BCSTAT_CANC,PL_BDWFLG_WAIT):
        #    return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲销处理中异常")
        #
        #AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲销处理中')
        #
        #if not AfaDBFunc.CommitSql( ):
        #    AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        #    return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        #    
        ##=====设置原交易状态为冲销失败====
        #AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲销失败")
        #
        #stat_dict = {}
        #stat_dict['BJEDTE'] = wtrbka_record['BJEDTE']
        #stat_dict['BSPSQN'] = wtrbka_record['BSPSQN']
        #stat_dict['PRCCO']  = TradeContext.PRCCO
        #stat_dict['STRINFO']= TradeContext.STRINFO
        #stat_dict['BCSTAT'] = PL_BCSTAT_CANC
        #stat_dict['BDWFLG'] = PL_BDWFLG_FAIL
        #
        #if not rccpsState.setTransState(stat_dict):
        #    return AfaFlowControl.ExitThisFlow('S999','设置业务状态冲销失败异常')
        #    
        #AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲销失败")
        
    
                
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲销应答报文接收[TRC004_1162]退出***' )
    
    return True
Example #3
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).通存通兑查复书发送[TRC003_8584]进入***' )
    
    #=================查询原查复信息============================================  
    if not TradeContext.existVariable('ORQYDAT'):
        return AfaFlowControl.ExitThisFlow("S999", "原查询日期不能为空")
    
    if not TradeContext.existVariable('OQTNO'):
        return AfaFlowControl.ExitThisFlow("S999", "原查询号不能为空")
        
    AfaLoggerFunc.tradeInfo(">>>开始查询原查询书信息")
    
    hdcbka_dict = {}
    hdcbka_where_dict = {'BJEDTE':TradeContext.ORQYDAT,'BSPSQN':TradeContext.OQTNO}
    hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict)
    if hdcbka_dict == None:
        return AfaFlowControl.ExitThisFlow("S999","数据库操作失败")
    if len(hdcbka_dict) > 0:
        if hdcbka_dict['ISDEAL']  == PL_ISDEAL_ISDO:        #PL_ISDEAL_ISDO  已查复或已处理
            return AfaFlowControl.ExitThisFlow("S999","该查询已被查复")
    
    AfaLoggerFunc.tradeInfo(">>>开始查询通存通兑原交易信息")
    wtrbka_dict = {}
    ret = rccpsDBFunc.getTransWtr(hdcbka_dict['BOJEDT'],hdcbka_dict['BOSPSQ'],wtrbka_dict)
    
    if not ret:
        return False
    
    AfaLoggerFunc.tradeInfo(">>>结束查询数据库信息")
    #=================登记查复书信息============================================
    AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务查复书信息")
    
#    RCVBNKCO=TradeContext.RCVBNKCO 
    
#    TradeContext.RCVBNKCO = hdcbka_dict['SNDBNKCO']
#    TradeContext.RCVBNKNM = hdcbka_dict['SNDBNKNM']    注释于0724 by pgt
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.ISDEAL   = PL_ISDEAL_ISDO            #查复标识为已处理
    TradeContext.BOJEDT   = TradeContext.ORQYDAT      #原交易日期
    TradeContext.BOSPSQ   = TradeContext.OQTNO        #原报单序号
    TradeContext.ORTRCCO  = hdcbka_dict['TRCCO']      #原交易码
    TradeContext.CUR      = hdcbka_dict['CUR']        #币种
    TradeContext.OCCAMT   = str(wtrbka_dict['OCCAMT']) #交易金额
    TradeContext.PYRACC   = wtrbka_dict['PYRACC']     #付款人账号
    TradeContext.PYEACC   = wtrbka_dict['PYEACC']     #收款人账号
    TradeContext.NOTE1    = hdcbka_dict['NOTE1']
    TradeContext.NOTE2    = hdcbka_dict['NOTE2']
    TradeContext.NOTE3    = hdcbka_dict['NOTE3']
    TradeContext.NOTE4    = hdcbka_dict['NOTE4']
    
    TradeContext.PRT_OROCCAMT = wtrbka_dict['OCCAMT']
    
    hdcbka_insert_dict = {}
    if not rccpsMap8512CTradeContext2Dhdcbka.map(hdcbka_insert_dict):
        return AfaFlowControl.ExitThisFlow("S999", "为汇兑业务查询查复登记簿赋值异常")
        
    ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict)
    
    if ret <= 0:
        return AfaFlowControl.ExitThisFlow("S999", "登记汇兑业务查复书信息异常")
    
    AfaLoggerFunc.tradeInfo(">>>结束登记汇兑业务查复书信息")
    
    
    
    #=================为汇兑查询书报文赋值======================================
    AfaLoggerFunc.tradeInfo(">>>开始为汇兑查复书报文赋值")
    
    TradeContext.TRCCO      = '9900512'
    TradeContext.MSGTYPCO   = 'SET008'
    TradeContext.SNDBRHCO   = TradeContext.BESBNO
    TradeContext.SNDCLKNO   = TradeContext.BETELR
    TradeContext.SNDTRDAT   = TradeContext.BJEDTE
    TradeContext.SNDTRTIM   = TradeContext.BJETIM
    TradeContext.MSGFLGNO   = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
    TradeContext.ORMFN      = TradeContext.RCVSTLBIN + hdcbka_dict['TRCDAT'] + hdcbka_dict['TRCNO']
    TradeContext.NCCWKDAT   = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO   = '99'
    TradeContext.ROPRTPNO   = '99'
    TradeContext.TRANTYP    = '0'
    TradeContext.TRCDAT     = TradeContext.TRCDAT
    TradeContext.TRCNO      = TradeContext.SerialNo
    TradeContext.ORTRCDAT   = wtrbka_dict['TRCDAT']
    TradeContext.ORTRCNO    = wtrbka_dict['TRCNO']
    TradeContext.ORSNDBNK   = wtrbka_dict['SNDBNKCO']
    TradeContext.ORRCVBNK   = wtrbka_dict['RCVBNKCO']
    TradeContext.ORTRCCO    = hdcbka_dict['TRCCO']
    TradeContext.ORCUR      = TradeContext.CUR
    TradeContext.OROCCAMT   = str(hdcbka_dict['OCCAMT'])
    TradeContext.ORQYDAT    = hdcbka_dict['TRCDAT']
    TradeContext.OQTSBNK    = hdcbka_dict['SNDBNKCO']
    TradeContext.OQTNO      = hdcbka_dict['TRCNO']
    
    AfaLoggerFunc.tradeInfo(">>>结束为汇兑查复书报文赋值")
    
    return True
Example #4
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲正应答报文接收[TRC004_1161]进入***' )
    
    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)
    
    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)
    
    #查询原冲正交易信息
    atcbka_dict = {}
    
    atcbka_where_dict = {}
    atcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN
    
    atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where_dict)
    
    if atcbka_dict == None:
        return AfaFlowControl.ExitThisFlow("S999","查询原冲正交易信息异常")
        
    if len(atcbka_dict) <= 0:
        return AfaFlowControl.ExitThisFlow("S999","未找到原冲正交易信息,丢弃报文")
        
    #查询原被冲正交易是否已开始被冲销
    mpcbka_dict = {}
    
    mpcbka_where_dict = {}
    mpcbka_where_dict['ORMFN'] = atcbka_dict['ORMFN']
    
    mpcbka_dict = rccpsDBTrcc_mpcbka.selectu(mpcbka_where_dict)
    
    if mpcbka_dict == None:
        return AfaFlowControl.ExitThisFlow("S999","查询原冲正交易信息异常")
        
    if len(mpcbka_dict) > 0:
        return AfaFlowControl.ExitThisFlow("S999","原交易已开始冲销,停止处理本冲正应答")
        
    #=====给机构号和柜员号赋值====
    TradeContext.BETELR = atcbka_dict['BETELR']
    TradeContext.BESBNO = atcbka_dict['BESBNO']
    
    #更新冲正登记簿中心返回信息
    AfaLoggerFunc.tradeInfo(">>>开始更新冲正登记簿中心返回信息")
    
    atcbka_update_dict = {}
    atcbka_update_dict['PRCCO'] = TradeContext.PRCCO
    atcbka_update_dict['STRINFO'] = TradeContext.STRINFO
    
    ret = rccpsDBTrcc_atcbka.update(atcbka_update_dict,atcbka_where_dict)
    
    if ret <= 0:
        return AfaFlowControl.ExitThisFlow("S999","更新冲正登记簿异常")
    
    AfaLoggerFunc.tradeInfo(">>>结束更新冲正登记簿中心返回信息")
    
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
    
    if atcbka_dict['ORTRCCO'] != '3000504':
        AfaLoggerFunc.tradeInfo(">>>原被冲正交易为通存或通兑账务类交易")
        
        #查询原被冲正交易信息
        wtr_dict = {}
        
        if not rccpsDBFunc.getTransWtr(atcbka_dict['BOJEDT'],atcbka_dict['BOSPSQ'],wtr_dict):
            return AfaFlowControl.ExitThisFlow("S999","查询原被冲正交易信息异常")
        
        #如果原被冲正交易当前状态已为冲正,表示已收到冲正应答,停止处理
        if wtr_dict['BCSTAT'] == PL_BCSTAT_CANCEL:
            return AfaFlowControl.ExitThisFlow("S999","已收到冲正应答,丢弃报文")
        
        TradeContext.TERMID = wtr_dict['TERMID']
        TradeContext.BRSFLG = wtr_dict['BRSFLG']
        
        
        
        #若原被冲正交易为通存类交易,应抹账
        if wtr_dict['TRCCO'] in ('3000002','3000003','3000004','3000005'):
            
            AfaLoggerFunc.tradeInfo(">>>开始发起主机抹账")
            
            #为抹账赋值会计分录
            entries_dict = {}
            entries_dict['FEDT']     = wtr_dict['BJEDTE']
            entries_dict['RBSQ']     = wtr_dict['BSPSQN']
            entries_dict['PYRACC']   = wtr_dict['PYRACC']
            entries_dict['PYRNAM']   = wtr_dict['PYRNAM']
            entries_dict['PYEACC']   = wtr_dict['PYEACC']
            entries_dict['PYENAM']   = wtr_dict['PYENAM']
            entries_dict['OCCAMT']   = wtr_dict['OCCAMT']
            entries_dict['CHRGTYP']  = wtr_dict['CHRGTYP']
            entries_dict['CUSCHRG']  = wtr_dict['CUSCHRG']
            entries_dict['RCCSMCD']  = PL_RCCSMCD_CX
            TradeContext.BRSFLG      = wtr_dict['BRSFLG']
            
            if TradeContext.ORTRCCO == '3000002' or TradeContext.ORTRCCO == '3000004':
                rccpsEntries.KZTCWZMZ(entries_dict)
            
            if TradeContext.ORTRCCO == '3000003' or TradeContext.ORTRCCO == '3000005':
                rccpsEntries.KZBZYWZMZ(entries_dict)
                
            #=====生成新的前置日期和前置流水号====
            if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :
                return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常")
            
            #设置原交易状态为冲正处理中
            AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲正处理中')
                
            if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_CANCEL,PL_BDWFLG_WAIT):
                return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲正处理中异常")
            
            if not AfaDBFunc.CommitSql( ):
                AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            
            AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲正处理中')
            
            #=====调起主机接口=====
            rccpsHostFunc.CommHost( TradeContext.HostCode )
            
            AfaLoggerFunc.tradeInfo(">>>结束发起主机记账")
            
        else:
            AfaLoggerFunc.tradeInfo(">>>原交易未记账,冲正不抹账")
            
            #设置原交易状态为冲正处理中
            AfaLoggerFunc.tradeInfo('>>>开始设置原交易状态为冲正处理中')
                
            if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_CANCEL,PL_BDWFLG_WAIT):
                return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为冲正处理中异常")
            
            if not AfaDBFunc.CommitSql( ):
                AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            
            AfaLoggerFunc.tradeInfo('>>>结束设置原交易状态为冲正处理中')
            
            TradeContext.errorCode = "0000"
            TradeContext.errorMsg  = "冲正前未记账,冲正不抹账"
           
        #根据主机返回信息,设置交易状态 
        stat_dict = {}
        
        stat_dict['BJEDTE']  = wtr_dict['BJEDTE']
        stat_dict['BSPSQN']  = wtr_dict['BSPSQN']
        stat_dict['MGID']    = TradeContext.errorCode
        stat_dict['STRINFO'] = TradeContext.errorMsg
        
        AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]")
        if TradeContext.errorCode == '0000':
            #设置原交易状态为冲正成功
            AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲正成功")
            
            stat_dict['BCSTAT'] = PL_BCSTAT_CANCEL
            stat_dict['BDWFLG'] = PL_BDWFLG_SUCC
            if TradeContext.existVariable('TRDT'):
                stat_dict['TRDT']   = TradeContext.TRDT
            if TradeContext.existVariable('TLSQ'):
                stat_dict['TLSQ']   = TradeContext.TLSQ
            
            if not rccpsState.setTransState(stat_dict):
                return AfaFlowControl.ExitThisFlow('S999','设置业务状态为冲正成功异常')
            
            AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲正成功")
        else:
            #设置原交易状态为冲正失败
            AfaLoggerFunc.tradeInfo("<<<<<<<开始更改原交易状态为冲正失败")
            
            stat_dict['BCSTAT'] = PL_BCSTAT_CANCEL
            stat_dict['BDWFLG'] = PL_BDWFLG_FAIL
            
            if not rccpsState.setTransState(stat_dict):
                return AfaFlowControl.ExitThisFlow('S999','设置业务状态为冲正失败异常')
            
            AfaLoggerFunc.tradeInfo("<<<<<<<结束更改原交易状态为冲正成功")
            
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            
    else:
        AfaLoggerFunc.tradeInfo(">>>原被冲正交易为冲销交易")
        
        #查询原冲销交易详细信息
        AfaLoggerFunc.tradeInfo(">>>冲销交易报单日期[" + atcbka_dict['BOJEDT'] + "]报单序号[" + atcbka_dict['BOSPSQ'] + "]")
        
        AfaLoggerFunc.tradeInfo(">>>开始查询原冲销交易详细信息")
        
        mpc_dict = {}
        
        if not rccpsDBFunc.getTransMpc(atcbka_dict['BOJEDT'],atcbka_dict['BOSPSQ'],mpc_dict):
            return AfaFlowControl.ExitThisFlow("S999","查询原冲销交易详细信息异常")
            
        AfaLoggerFunc.tradeInfo(">>>结束查询原冲销交易详细信息")
        
        #查询原被冲销交易详细信息
        AfaLoggerFunc.tradeInfo(">>>被冲销交易报单日期[" + mpc_dict['BOJEDT'] + "]报单序号[" + mpc_dict['BOSPSQ'] + "]")
        
        AfaLoggerFunc.tradeInfo(">>>开始查询原被冲销交易详细信息")
        
        wtr_dict = {}
        
        if not rccpsDBFunc.getTransWtr(mpc_dict['BOJEDT'],mpc_dict['BOSPSQ'],wtr_dict):
            return AfaFlowControl.ExitThisFlow("S999","查询原被冲销交易详细信息异常")
            
        AfaLoggerFunc.tradeInfo(">>>结束查询原被冲销交易详细信息")
        
        #更新冲销登记簿
        AfaLoggerFunc.tradeInfo(">>>开始更新冲销登记簿")
        
        mpcbka_update_dict = {}
        mpcbka_update_dict['PRCCO'] = "RCCI1000"
        mpcbka_update_dict['STRINFO'] = "冲销交易被成功冲正"
        
        mpcbka_where_dict = {}
        mpcbka_where_dict['BJEDTE'] = mpc_dict['BJEDTE']
        mpcbka_where_dict['BSPSQN'] = mpc_dict['BSPSQN']
        
        ret = rccpsDBTrcc_mpcbka.update(mpcbka_update_dict,mpcbka_where_dict)
        
        if ret <= 0:
            return AfaFlowControl.ExitThisFlow("更新冲销登记簿返回码和返回信息异常")
        
        AfaLoggerFunc.tradeInfo(">>>结束更新冲销登记簿")
        
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑冲正应答报文接收[TRC004_1161]退出***' )
    
    return True
Example #5
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).自动冲正[TRCC003_8582]进入***' )
    
    #=====校验变量的合法性====
    if not TradeContext.existVariable("BOJEDT"):
        return AfaFlowControl.ExitThisFlow('A099','原交易日期不能为空')  
        
    if not TradeContext.existVariable("BOSPSQ"):
        return AfaFlowControl.ExitThisFlow('A099','原报单序号不能为空')
        
    #if not TradeContext.existVariable("RESNNM"):
    #    return AfaFlowControl.ExitThisFlow('A099','冲正原因不能为空')
    
    #查询原交易信息
    trc_dict = {}
    
    if rccpsDBFunc.getTransWtr(TradeContext.BOJEDT,TradeContext.BOSPSQ,trc_dict):
        AfaLoggerFunc.tradeInfo(">>>通存通兑登记簿中找到原交易")
        
    elif rccpsDBFunc.getTransMpc(TradeContext.BOJEDT,TradeContext.BOSPSQ,trc_dict):
        AfaLoggerFunc.tradeInfo(">>>冲销登记簿中找到原交易")
        
    else:
        return AfaFlowControl.ExitThisFlow("S999","无此交易")
        
    #判断原交易是否为往账
    if( trc_dict['BRSFLG'] != PL_BRSFLG_SND):
        return AfaFlowControl.ExitThisFlow('A099','此交易非往账,禁止冲正')
        
    #判断被冲销交易的日期是否为当日
    if( trc_dict['NCCWKDAT'] != TradeContext.NCCworkDate ):
        return AfaFlowControl.ExitThisFlow('A099','此交易非当日交易,禁止冲正')
        
    #判断当前机构是否为原交易机构
    if( trc_dict['BESBNO'] != TradeContext.BESBNO ):
        return AfaFlowControl.ExitThisFlow('A099','当前机构非原交易机构,禁止冲正')
    
    #判断当前柜员是否为原交易柜员
    if( trc_dict['BETELR'] != TradeContext.BETELR ):
        return AfaFlowControl.ExitThisFlow('A099','当前柜员非原交易柜员,禁止冲正')
        
    if trc_dict['TRCCO'] in('3000002','3000003','3000004','3000005','3000102','3000103','3000104','3000105','3000505'):
        AfaLoggerFunc.tradeInfo(">>>原交易为通存或通兑账务类交易")
        
        #判断原交易当前状态是否可以冲正
        #原交易当前状态为:发送处理中,发送成功,记账失败,允许冲正
        if not ((trc_dict['BCSTAT'] == PL_BCSTAT_SND and (trc_dict['BDWFLG'] == PL_BDWFLG_WAIT or trc_dict['BDWFLG'] == PL_BDWFLG_SUCC)) or (trc_dict['BCSTAT'] == PL_BCSTAT_ACC) and trc_dict['BDWFLG'] == PL_BDWFLG_FAIL):
            return AfaFlowControl.ExitThisFlow("S999","此交易当前状态为[" + trc_dict['BCSTAT'] + "][" + trc_dict['BDWFLG'] + "],禁止冲正")
        
        #登记冲正登记簿
        AfaLoggerFunc.tradeInfo(">>>开始登记冲正登记簿")
        
        TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN
        TradeContext.RCVMBRCO = trc_dict['RCVMBRCO']
        TradeContext.ORTRCDAT = trc_dict['TRCDAT']
        TradeContext.OPRNO    = PL_TDOPRNO_CZ
        TradeContext.NCCWKDAT = TradeContext.NCCworkDate
        TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.NCCworkDate + TradeContext.SerialNo
        TradeContext.ORMFN    = trc_dict['MSGFLGNO']
        TradeContext.TRCCO    = "3000506" 
        TradeContext.TRCNO    = TradeContext.SerialNo
        TradeContext.ORTRCCO  = trc_dict['TRCCO']
        TradeContext.ORTRCNO  = trc_dict['TRCNO']
        TradeContext.SNDBNKCO = trc_dict['SNDBNKCO']
        TradeContext.SNDBNKNM = trc_dict['SNDBNKNM']
        TradeContext.RCVBNKCO = trc_dict['RCVBNKCO']
        TradeContext.RCVBNKNM = trc_dict['RCVBNKNM']
        
        insert_dict = {}
        
        rccpsMap8582CTradeContext2Datcbka_dict.map(insert_dict)
        
        ret = rccpsDBTrcc_atcbka.insertCmt(insert_dict)
        
        if( ret <= 0 ):
            return AfaFlowControl.ExitThisFlow('S999','登记自动冲正登记簿失败')
        
        AfaLoggerFunc.tradeInfo(">>>结束登记冲正登记簿")
        
        #若原交易当前状态非冲正处理中,则设置原交易状态为冲正处理中
        #if not (trc_dict['BCSTAT'] == PL_BCSTAT_CANCEL and trc_dict['BDWFLG'] == PL_BDWFLG_WAIT):
        #    AfaLoggerFunc.tradeInfo(">>>开始设置原交易状态为冲正处理中")
        #    
        #    if not rccpsState.newTransState(trc_dict['BJEDTE'],trc_dict['BSPSQN'],PL_BCSTAT_CANCEL,PL_BDWFLG_WAIT):
        #        return AfaFlowControl.ExitThisFlow("S999","设置原交易当前状态为冲正处理中异常")
        #
        #    AfaLoggerFunc.tradeInfo(">>>结束设置原交易状态为冲正处理中")
        #    
        #if not AfaDBFunc.CommitSql( ):
        #    AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        #    return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            
        #为冲正报文做准备
        #=====报文头====
        TradeContext.MSGTYPCO = 'SET009'
        TradeContext.RCVSTLBIN= trc_dict['RCVMBRCO']
        #TradeContext.SNDBRHCO = TradeContext.BESBNO
        #TradeContext.SNDCLKNO = TradeContext.BETELR
        #TradeContext.SNDTRDAT = TradeContext.BJEDTE
        #TradeContext.SNDTRTIM = TradeContext.BJETIM
        #TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
        #TradeContext.ORMFN    = wtr_dict['MSGFLGNO']
        #TradeContext.NCCWKDAT = TradeContext.NCCworkDate
        TradeContext.OPRTYPNO = "30"
        TradeContext.ROPRTPNO = "30"
        TradeContext.TRANTYP  = "0"
        #=====业务要素集====
        TradeContext.CUR      = trc_dict['CUR']
        TradeContext.OCCAMT   = str(trc_dict['OCCAMT'])
        
        #手续费处理
        if trc_dict['TRCCO'] == '3000002' or trc_dict['TRCCO'] == '3000003' or trc_dict['TRCCO'] == '3000004' or trc_dict['TRCCO'] == '3000005':
            TradeContext.CUSCHRG  = "0.00"
        elif trc_dict['TRCCO'] == '3000102' or trc_dict['TRCCO'] == '3000103' or trc_dict['TRCCO'] == '3000104' or trc_dict['TRCCO'] == '3000105':
            if trc_dict['CHRGTYP'] == '1':
                TradeContext.CUSCHRG = str(trc_dict['CUSCHRG'])
            else:
                TradeContext.CUSCHRG = '0.00'
                
        TradeContext.PYRACC   = trc_dict['PYRACC']
        TradeContext.PYRNAM   = trc_dict['PYRNAM']
        TradeContext.PYEACC   = trc_dict['PYEACC']
        TradeContext.PYENAM   = trc_dict['PYENAM']
        TradeContext.CURPIN   = ""
        TradeContext.STRINFO  = ""
        TradeContext.PRCCO    = ""
        #=====扩展要素集====
        TradeContext.RESNCO = TradeContext.RESNNM  
        
        
    elif trc_dict['TRCCO'] == '3000504':
        AfaLoggerFunc.tradeInfo(">>>原交易为冲销交易")
        
        if trc_dict['PRCCO'].lstrip() != "":
            return AfaFlowControl.ExitThisFlow("S999","已收到冲销应答,禁止冲正此冲销交易")
        
        wtr_dict = {}
        
        if not rccpsDBFunc.getTransWtr(trc_dict['BOJEDT'],trc_dict['BOSPSQ'],wtr_dict):
            return AfaFlowControl.ExitThisFlow("S999","通存通兑登记簿中未找到原被冲销交易")
            
        #若原被冲销交易当前状态为冲销,禁止冲正此冲销交易
        if wtr_dict['BCSTAT'] == PL_BCSTAT_CANC:
            return AfaFlowControl.ExitThisFlow("S999","原被冲销交易已被冲销成功或失败,禁止冲正此冲销交易")
            
        #登记冲正登记簿
        AfaLoggerFunc.tradeInfo(">>>开始登记冲正登记簿")
        
        TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN
        TradeContext.RCVMBRCO = trc_dict['RCVMBRCO']
        TradeContext.ORTRCDAT = trc_dict['TRCDAT']
        TradeContext.OPRNO    = PL_TDOPRNO_CZ
        TradeContext.NCCWKDAT = TradeContext.NCCworkDate
        TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.NCCworkDate + TradeContext.SerialNo
        TradeContext.ORMFN    = trc_dict['MSGFLGNO']
        TradeContext.TRCCO    = "3000506"
        TradeContext.TRCNO    = TradeContext.SerialNo
        TradeContext.ORTRCCO  = trc_dict['TRCCO']
        TradeContext.ORTRCNO  = trc_dict['TRCNO']
        TradeContext.SNDBNKCO = trc_dict['SNDBNKCO']
        TradeContext.SNDBNKNM = trc_dict['SNDBNKNM']
        TradeContext.RCVBNKCO = trc_dict['RCVBNKCO']
        TradeContext.RCVBNKNM = trc_dict['RCVBNKNM']
        
        insert_dict = {}
        
        rccpsMap8582CTradeContext2Datcbka_dict.map(insert_dict)
        
        ret = rccpsDBTrcc_atcbka.insertCmt(insert_dict)
        
        if( ret <= 0 ):
            return AfaFlowControl.ExitThisFlow('S999','登记自动冲正登记簿失败')
        
        AfaLoggerFunc.tradeInfo(">>>结束登记冲正登记簿")
        
        #为冲正报文做准备
        #=====报文头====
        TradeContext.MSGTYPCO = 'SET009'
        TradeContext.RCVSTLBIN= trc_dict['RCVMBRCO']
        #TradeContext.SNDBRHCO = TradeContext.BESBNO
        #TradeContext.SNDCLKNO = TradeContext.BETELR
        #TradeContext.SNDTRDAT = TradeContext.BJEDTE
        #TradeContext.SNDTRTIM = TradeContext.BJETIM
        #TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
        #TradeContext.ORMFN    = wtr_dict['MSGFLGNO']
        #TradeContext.NCCWKDAT = TradeContext.NCCworkDate
        TradeContext.OPRTYPNO = "30"
        TradeContext.ROPRTPNO = "30"
        TradeContext.TRANTYP  = "0"
        #=====业务要素集====
        TradeContext.CUR      = wtr_dict['CUR']
        TradeContext.OCCAMT   = str(wtr_dict['OCCAMT'])
        
        #手续费处理
        if wtr_dict['TRCCO'] == '3000002' or wtr_dict['TRCCO'] == '3000003' or wtr_dict['TRCCO'] == '3000004' or wtr_dict['TRCCO'] == '3000005':
            TradeContext.CUSCHRG  = "0.00"
        elif wtr_dict['TRCCO'] == '3000102' or wtr_dict['TRCCO'] == '3000103' or wtr_dict['TRCCO'] == '3000104' or wtr_dict['TRCCO'] == '3000105':
            if wtr_dict['CHRGTYP'] == '1':
                TradeContext.CUSCHRG = str(wtr_dict['CUSCHRG'])
            else:
                TradeContext.CUSCHRG = '0.00'
                
        TradeContext.PYRACC   = wtr_dict['PYRACC']
        TradeContext.PYRNAM   = wtr_dict['PYRNAM']
        TradeContext.PYEACC   = wtr_dict['PYEACC']
        TradeContext.PYENAM   = wtr_dict['PYENAM']
        TradeContext.CURPIN   = ""
        TradeContext.STRINFO  = ""
        TradeContext.PRCCO    = ""
        #=====扩展要素集====
        TradeContext.RESNCO = TradeContext.RESNNM  
        
    else:
        return AfaFlowControl.ExitThisFlow("S999","原交易非通存或通兑账务类交易或冲销交易,禁止冲正")
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).自动冲正[TRCC003_8582]进入***' )
    
    return True
Example #6
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).柜台冲销[TRCC003_8565]进入***' )
    
    #=====校验变量的合法性====
    if not TradeContext.existVariable("BOJEDT"):
        return AfaFlowControl.ExitThisFlow('A099','原交易日期不能为空')  
        
    if not TradeContext.existVariable("BOSPSQ"):
        return AfaFlowControl.ExitThisFlow('A099','原报单序号不能为空')
        
    if not TradeContext.existVariable("RESNNM"):
        return AfaFlowControl.ExitThisFlow('A099','冲销原因不能为空')
    
    #查询原交易信息
    wtr_dict = {}
    
    if not rccpsDBFunc.getTransWtr(TradeContext.BOJEDT,TradeContext.BOSPSQ,wtr_dict):
        return AfaFlowControl.ExitThisFlow("S999","无此交易")
       
    #判断原交易是否为往账
    if( wtr_dict['BRSFLG'] != PL_BRSFLG_SND):
        return AfaFlowControl.ExitThisFlow('A099','此交易非往账,禁止冲销')
        
    #判断被冲销交易的日期是否为当日
    if( wtr_dict['NCCWKDAT'] != TradeContext.NCCworkDate ):
        return AfaFlowControl.ExitThisFlow('A099','此交易非当日交易,禁止冲销')
        
    #判断当前机构是否为原交易机构
    if( wtr_dict['BESBNO'] != TradeContext.BESBNO ):
        return AfaFlowControl.ExitThisFlow('A099','当前机构非原交易机构,禁止冲销')
    
    #判断当前柜员是否为原交易柜员
    if( wtr_dict['BETELR'] != TradeContext.BETELR ):
        return AfaFlowControl.ExitThisFlow('A099','当前柜员非原交易柜员,禁止冲销')
    
    #判断原交易状态是否允许冲销
    AfaLoggerFunc.tradeInfo("开始判断原交易信息是否允许冲销")
    
    #=====add by pgt 12-9=====
    #able_to_cancel = 1    #允许冲销的标示,1为不允许,0为允许
    #
    #if wtr_dict['TRCCO'] in ('3000002','3000003','3000004','3000005'):    #通存或者本转异
    #    #状态为:确认付款,清算,发送处理中,发送成功,允许冲销
    #    if(wtr_dict['BCSTAT'] == PL_BCSTAT_CONFPAY or wtr_dict['BCSTAT'] == PL_BCSTAT_MFESTL or (wtr_dict['BCSTAT'] == PL_BCSTAT_SND and (wtr_dict['BDWFLG'] == PL_BDWFLG_WAIT or wtr_dict['BDWFLG'] == PL_BDWFLG_SUCC))):
    #        able_to_cancel = 0
    #        
    #elif wtr_dict['TRCCO'] in ('3000102','3000103','3000104','3000105'):    #通兑或者异转本
    #    #状态为:记账,清算,发送处理中,发送成功,允许冲销
    #    if(wtr_dict['BCSTAT'] == PL_BCSTAT_ACC or wtr_dict['BCSTAT'] == PL_BCSTAT_MFESTL or (wtr_dict['BCSTAT'] == PL_BCSTAT_SND and (wtr_dict['BDWFLG'] == PL_BDWFLG_WAIT or wtr_dict['BDWFLG'] == PL_BDWFLG_SUCC))):
    #        able_to_cancel = 0
    #        
    #else:
    #    return AfaFlowControl.ExitThisFlow("S999","本交易非通存或通兑账务类交易,禁止冲销")
    #
    ##冲销失败允许冲销
    #if(wtr_dict['BCSTAT'] == PL_BCSTAT_CANC and wtr_dict['BDWFLG'] == PL_BDWFLG_FAIL):   
    #    able_to_cancel = 0
    #     
    #if(able_to_cancel == 1):
    #    return AfaFlowControl.ExitThisFlow("S999","此交易当前状态为[" + wtr_dict['BCSTAT'] + "][" + wtr_dict['BDWFLG'] + "],禁止冲销")
    #    
    #else:
    #    AfaLoggerFunc.tradeDebug('>>>>>>此交易当前状态允许冲销')
        
    if wtr_dict['TRCCO'] in ('3000002','3000003','3000004','3000005'):    #通存或者本转异
        #状态为:确认付款,清算,发送处理中,发送成功,允许冲销
    	if not (wtr_dict['BCSTAT'] == PL_BCSTAT_CONFPAY or wtr_dict['BCSTAT'] == PL_BCSTAT_MFESTL or (wtr_dict['BCSTAT'] == PL_BCSTAT_SND and (wtr_dict['BDWFLG'] == PL_BDWFLG_WAIT or wtr_dict['BDWFLG'] == PL_BDWFLG_SUCC))):
    	    return AfaFlowControl.ExitThisFlow("S999","此交易当前状态为[" + wtr_dict['BCSTAT'] + "[" + wtr_dict['BDWFLG'] + "],禁止冲销")
    
    elif wtr_dict['TRCCO'] in ('3000102','3000103','3000104','3000105'):    #通兑或者异转本
        #状态为:记账,清算,发送处理中,发送成功,允许冲销
    	if not (wtr_dict['BCSTAT'] == PL_BCSTAT_ACC or wtr_dict['BCSTAT'] == PL_BCSTAT_MFESTL or (wtr_dict['BCSTAT'] == PL_BCSTAT_SND and (wtr_dict['BDWFLG'] == PL_BDWFLG_WAIT or wtr_dict['BDWFLG'] == PL_BDWFLG_SUCC))):
    		return AfaFlowControl.ExitThisFlow("S999","此交易当前状态为[" + wtr_dict['BCSTAT'] + "][" + wtr_dict['BDWFLG'] + "],禁止冲销")
    else:
        return AfaFlowControl.ExitThisFlow("S999","本交易非通存或通兑账务类交易,禁止冲销")
        
    if wtr_dict['BCSTAT'] == PL_BCSTAT_ACC and wtr_dict['BDWFLG'] != PL_BDWFLG_SUCC:
        #原交易当前状态为记账,且流转处理标识非成功,则调用8816查询此笔业务主机账务状态
        
        AfaLoggerFunc.tradeDebug('>>>调用8816查找该业务[' + wtr_dict['BSPSQN'] + '状态')

        TradeContext.HostCode = '8816'                   #主机交易码
        TradeContext.OPFG     = '1'                      #查询类型
        TradeContext.NBBH     = 'RCC'                    #代理业务标识
        TradeContext.FEDT     = wtr_dict['FEDT']         #原前置日期
        TradeContext.RBSQ     = wtr_dict['RBSQ']         #原前置流水号
        TradeContext.DAFG     = '1'                      #抹/记账标志  1:记  2:抹
        TradeContext.BESBNO   = wtr_dict['BESBNO']       #机构号
        TradeContext.BETELR   = wtr_dict['BETELR']       #柜员号

        rccpsHostFunc.CommHost( TradeContext.HostCode )

        #=====分析主机返回====
        if TradeContext.errorCode == '0000':
            if HostContext.O1STCD == '0':
                #此账务已成功记主机账,修改原交易状态为记账成功
                stat_dict = {}
                stat_dict['BJEDTE'] = TradeContext.BOJEDT
                stat_dict['BOSPSQ'] = tradeContext.BOSPSQ
                stat_dict['BCSTAT'] = PL_BCSTAT_ACC
                stat_dict['BDWFLG'] = PL_BDWFLG_SUCC
                stat_dict['TRDT']   = HostContext.O1DADT           #主机日期
                stat_dict['TLSQ']   = HostContext.O1AMTL           #主机流水
                stat_dict['MGID']   = '0000'
                stat_dict['STRINFO']= '主机成功'
                
                if not rccpsState.setTransState(stat_dict):
                    return AfaFlowControl.ExitThisFlow('S999','设置原交易业务状态为记账成功异常') 
                
                if not AfaDBFunc.CommitSql( ):
                    AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                    return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            else:
                return AfaFlowControl.ExitThisFlow('S999','原交易主机账务状态与中台不符,禁止提交')
        
        elif TradeContext.errorCode == 'XCR0001':
            AfaLoggerFunc.tradeInfo(">>>主机返回原交易记账失败,继续冲销")
            
        else:
            return AfaFlowControl.ExitThisFlow('S999','查询主机账务异常,请稍后再冲销')
            
    
    AfaLoggerFunc.tradeInfo("结束判断原交易信息是否允许冲销")
    		
    #登记柜台冲销登记簿
    AfaLoggerFunc.tradeInfo("开始登记柜台冲销登记簿")
    
    TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN
    TradeContext.RCVMBRCO = wtr_dict['RCVMBRCO']
    TradeContext.ORTRCDAT = wtr_dict['TRCDAT']
    TradeContext.OPRNO    = PL_TDOPRNO_CX
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.NCCworkDate + TradeContext.SerialNo
    TradeContext.ORMFN    = wtr_dict['MSGFLGNO']
    TradeContext.TRCCO    = "3000504" 
    TradeContext.TRCNO    = TradeContext.SerialNo
    TradeContext.ORTRCCO  = wtr_dict['TRCCO']
    TradeContext.ORTRCNO  = wtr_dict['TRCNO']
    TradeContext.SNDBNKCO = wtr_dict['SNDBNKCO']
    TradeContext.SNDBNKNM = wtr_dict['SNDBNKNM']
    TradeContext.RCVBNKCO = wtr_dict['RCVBNKCO']
    TradeContext.RCVBNKNM = wtr_dict['RCVBNKNM']
    
    insert_dict = {}
    
    if not rccpsMap8565CTradeContext2Dmpcbka.map(insert_dict):
        return AfaFlowControl.ExitThisFlow('S999','登记柜台冲销登记簿失败')
    
    AfaLoggerFunc.tradeInfo('>>>开始登记柜台冲销登记簿')
    res = rccpsDBTrcc_mpcbka.insertCmt(insert_dict)
    if( res <= 0 ):
        return AfaFlowControl.ExitThisFlow('S999','登记柜台冲销登记簿失败')
        
    AfaLoggerFunc.tradeInfo('>>>结束登记柜台冲销登记簿')
    
    #为发送柜面冲销报文做准备
    #=====报文头====
    TradeContext.MSGTYPCO = 'SET009'
    TradeContext.RCVSTLBIN= wtr_dict['RCVMBRCO']
    #TradeContext.SNDBRHCO = TradeContext.BESBNO
    #TradeContext.SNDCLKNO = TradeContext.BETELR
    #TradeContext.SNDTRDAT = TradeContext.BJEDTE
    #TradeContext.SNDTRTIM = TradeContext.BJETIM
    #TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
    #TradeContext.ORMFN    = wtr_dict['MSGFLGNO']
    #TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO = "30"
    TradeContext.ROPRTPNO = "30"
    TradeContext.TRANTYP  = "0"
    #=====业务要素集====
    TradeContext.CUR      = wtr_dict['CUR']
    TradeContext.OCCAMT   = str(wtr_dict['OCCAMT'])
    
    #手续费处理
    if wtr_dict['TRCCO'] == '3000002' or wtr_dict['TRCCO'] == '3000003' or wtr_dict['TRCCO'] == '3000004' or wtr_dict['TRCCO'] == '3000005':
        TradeContext.CUSCHRG  = "0.00"
    elif wtr_dict['TRCCO'] == '3000102' or wtr_dict['TRCCO'] == '3000103' or wtr_dict['TRCCO'] == '3000104' or wtr_dict['TRCCO'] == '3000105':
        if wtr_dict['CHRGTYP'] == '1':
            TradeContext.CUSCHRG = str(wtr_dict['CUSCHRG'])
        else:
            TradeContext.CUSCHRG = '0.00'
            
    TradeContext.PYRACC   = wtr_dict['PYRACC']
    TradeContext.PYRNAM   = wtr_dict['PYRNAM']
    TradeContext.PYEACC   = wtr_dict['PYEACC']
    TradeContext.PYENAM   = wtr_dict['PYENAM']
    TradeContext.CURPIN   = ""
    TradeContext.STRINFO  = ""
    TradeContext.PRCCO    = ""
    #=====扩展要素集====
    TradeContext.RESNCO = TradeContext.RESNNM  
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).柜台冲销[TRCC003_8565]退出***' )
    return True
Example #7
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).柜台补正[TRCC003_8587]进入***' )

    #=====检验变量合法性====
    if not TradeContext.existVariable("BOJEDT"):
        return AfaFlowControl.ExitThisFlow('A099','原报单日期不能为空')  
        
    if not TradeContext.existVariable("BOSPSQ"):
        return AfaFlowControl.ExitThisFlow('A099','原报单序号不能为空')

    #=====查询原交易信息====
    wtr_dict = {}
    
    if rccpsDBFunc.getTransWtr(TradeContext.BOJEDT,TradeContext.BOSPSQ,wtr_dict):
        AfaLoggerFunc.tradeInfo(">>>通存通兑登记簿中找到原交易")
    else:
        return AfaFlowControl.ExitThisFlow('S0999','查找原交易信息失败')
    
    swtr_dict = wtr_dict
    
    #=====判断原交易是否为往账====
    if( wtr_dict['BRSFLG'] != PL_BRSFLG_SND):
        return AfaFlowControl.ExitThisFlow('A099','此交易非往账,禁止补正')
    
    #====判断账户卡折类型====
    if TradeContext.DCFLG == '0':
        TradeContext.CBFLG = TradeContext.PYITYP
    else:
        TradeContext.CBFLG = TradeContext.PYOTYP
        
    #====判断原交易状态====
    AfaLoggerFunc.tradeInfo("开始判断原交易信息是否允许补正")
    
    if (wtr_dict['BCSTAT'] != PL_BCSTAT_CANC and wtr_dict['BDWFLG'] != PL_BDWFLG_SUCC):
        return AfaFlowControl.ExitThisFlow("S999","交易状态["+str(wtr_dict['BCSTAT'])+"],禁止补正")
        
    AfaLoggerFunc.tradeInfo("结束判断原交易信息是否允许补正")
    
    #=================登记通存通兑业务登记簿===================================
    AfaLoggerFunc.tradeInfo(">>>开始登记通存通兑业务登记簿")

    #=====================获取中心流水号====================================
    if rccpsGetFunc.GetRccSerialno( ) == -1 :
        raise AfaFlowControl.flowException( )
    
    TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN      #发送成员行号
    TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN      #接收成员行号
    TradeContext.TRCNO    = TradeContext.SerialNo       #交易流水号
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate    #中心工作日期
    TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.TRCDAT + TradeContext.SerialNo  #报文标识号
    TradeContext.OPRNO    = PL_TDOPRNO_BZ               #业务种类:个人现金通存
    TradeContext.BRSFLG   = PL_BRSFLG_SND               #往来标识:往账
    TradeContext.PYRMBRCO = TradeContext.SNDSTLBIN
    TradeContext.PYEMBRCO = TradeContext.RCVSTLBIN
    TradeContext.NOTE1    = TradeContext.BOJEDT
    TradeContext.NOTE2    = TradeContext.BOSPSQ
    TradeContext.TRCCO    = '3000505'
    
    wtrbka_dict = {}
    if not rccpsMap8563CTradeContext2Dwtrbka_dict.map(wtrbka_dict):
        return AfaFlowContorl.ExitThisFlow("S999","为通存通兑业务登记簿赋值异常")
        
    if(TradeContext.DCFLG == '0'):
        wtrbka_dict['DCFLG'] = '1'
    elif(TradeContext.DCFLG == '1'):
        wtrbka_dict['DCFLG'] = '2'
    else:
        return AfaFlowControl.ExitThisFlow('S999','非法借贷标示')
        
    if not rccpsDBFunc.insTransWtr(wtrbka_dict):
        return AfaFlowControl.ExitThisFlow('S999','登记通存通兑业务登记簿异常')
    
    AfaLoggerFunc.tradeInfo(">>>结束登记通存通兑业务登记簿")
    
    #=====判断原交易是否为异转本或通兑====
    if swtr_dict['TRCCO'] in ('3000102','3000103','3000104','3000105') and swtr_dict['CHRGTYP'] == '1':
        TradeContext.CUSCHRG = str(swtr_dict['CUSCHRG'])
    else:
        TradeContext.CUSCHRG = "0.00"
        
    #=====发送农信银中心,为发送柜面报文做准备====
    #=====报文头====
    TradeContext.MSGTYPCO = 'SET009'   
    TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
    TradeContext.ORMFN    = swtr_dict['MSGFLGNO']
    TradeContext.TRCCO    = "3000505"
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO = "30"
    TradeContext.ROPRTPNO = "30"
    TradeContext.TRANTYP  = "0"
    #=====业务要素集====
    TradeContext.CUR      = "CNY"
    TradeContext.OCCAMT   = str(TradeContext.OCCAMT)
    #TradeContext.OCCAMT   = str(wtr_dict['OCCAMT'])
    TradeContext.CUSCHRG  = str(TradeContext.CUSCHRG)
    TradeContext.ORTRCCO  = str(swtr_dict['TRCCO'])
    TradeContext.ORTRCNO  = str(swtr_dict['TRCNO'])

    if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_SND,PL_BDWFLG_WAIT):
        return AfaFlowControl.ExitThisFlow("S999","设置原交易当前状态为发送-处理中异常")
        
    AfaLoggerFunc.tradeInfo(">>>结束设置原交易状态为发送-处理中")
        
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        
    return True
Example #8
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo("'***农信银系统:通存通兑往账交易.通存通兑查询书发送[8582] 进入")
    
    AfaLoggerFunc.tradeInfo("交易前处理(本地操作,中心前处理)")
    
    #=====查询原交易信息====
    AfaLoggerFunc.tradeInfo("查询原交易信息")
    if not TradeContext.existVariable('BOSPSQ'):
        return AfaFlowControl.ExitThisFlow('A099','没有原报单序号')
        
    if not TradeContext.existVariable('BOJEDT'):
        return AfaFlowControl.ExitThisFlow("A099", "没有原报单日期")
    
    #=====开始查询通存通兑业务登记簿====
    AfaLoggerFunc.tradeInfo("开始查询通存通兑业务登记簿")
    wtrbka_record = {}
    res = rccpsDBFunc.getTransWtr(TradeContext.BOJEDT,TradeContext.BOSPSQ,wtrbka_record)
    if( res == False ):
        return AfaFlowControl.ExitThisFlow('A099','查询原交易信息失败')
        
    #=====登记查询查复自由格式登记簿====
    AfaLoggerFunc.tradeInfo("登记查询查复登自由格式记簿")
    TradeContext.BRSFLG   = PL_BRSFLG_SND 
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.TRCCO    = '9900511'
#    TradeContext.TRCDAT   = ''
    TradeContext.TRCNO    = TradeContext.SerialNo
#    TradeContext.SNDBNKCO = 
#    TradeContext.SNDBNKNM = 
#    TradeContext.RCVBNKCO = 
#    TradeContext.RCVBNKNM = 
#    TradeContext.BOJEDT   = 
#    TradeContext.BOSPSQ   = 
    TradeContext.ORTRCCO  = wtrbka_record['TRCCO']
    TradeContext.CUR      = wtrbka_record['CUR']
    TradeContext.OCCAMT   = str(wtrbka_record['OCCAMT'])
#    TradeContext.CONT     = 
    TradeContext.PYRACC   = wtrbka_record['PYRACC']
    TradeContext.PYEACC   = wtrbka_record['PYEACC']
    TradeContext.ISDEAL   = PL_ISDEAL_UNDO
#    TradeContext.PRCCO    = 

    #=====给插入字典赋值====
    AfaLoggerFunc.tradeInfo("给插入字典赋值")
    hdcbka_insert_dict = {}
    if not rccpsMap8583CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict):
        return AfaFlowControl.ExitThisFlow('A099','给插入字典赋值失败') 
    
    #=====登记数据库====
    AfaLoggerFunc.tradeInfo("登记数据库")
    res = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict)
    if( res == -1 ):
        return AfaFlowControl.ExitThisFlow('A099','给插入字典赋值失败') 
    
    #=====开始给查询书报文赋值====
    AfaLoggerFunc.tradeInfo("开始给查询书报文赋值")
    #====报文头====
    TradeContext.MSGTYPCO = 'SET008'
    TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN
    TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN
    TradeContext.SNDBRHCO = TradeContext.BESBNO
    TradeContext.SNDCLKNO = TradeContext.BETELR
    TradeContext.SNDTRDAT = TradeContext.BJEDTE
    TradeContext.SNDTRTIM = TradeContext.BJETIM
    TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
    TradeContext.ORMFN    = wtrbka_record['SNDMBRCO'] + wtrbka_record['TRCDAT'] + wtrbka_record['TRCNO']
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO = "99"
    TradeContext.ROPRTPNO = "30"
    TradeContext.TRANTYP  = "0"
    #=====业务要素集====
    TradeContext.TRCCO    = "9900511"
#    TradeContext.SNDBNKCO = ""
#    TradeContext.SNDBNKNM = ""
#    TradeContext.RCVBNKCO = ""
#    TradeContext.RCVBNKNM = ""
#    TradeContext.TRCDAT   = ""
#    TradeContext.TRCNO    = ""
    TradeContext.ORTRCCO  = wtrbka_record['TRCCO']
    TradeContext.ORTRCDAT = wtrbka_record['TRCDAT']
    TradeContext.ORTRCNO  = wtrbka_record['TRCNO']
    TradeContext.ORSNDBNK = wtrbka_record['SNDBNKCO']
    TradeContext.ORRCVBNK = wtrbka_record['RCVBNKCO']
    if( wtrbka_record['CUR'] == '01' ):
        TradeContext.ORCUR = 'CNY'
    else:
        TradeContext.ORCUR = wtrbka_record['CUR']
    TradeContext.OROCCAMT = str(wtrbka_record['OCCAMT'])
#    TradeContext.CONT     = ""

    AfaLoggerFunc.tradeInfo("交易前处理(本地操作,中心前处理) 退出")
    
    return True
Example #9
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo("'***农信银系统:通存通兑往账交易.差错补记抹账[8573] 进入")
    
    AfaLoggerFunc.tradeInfo("<<<<<<<个性化处理(本地操作) 进入")
    
    #=====校验变量的合法性====
    AfaLoggerFunc.tradeInfo("<<<<<<<开始校验变量的合法性")
    if not TradeContext.existVariable("SNDBNKCO"):
        return AfaFlowControl.ExitThisFlow('A099','没有原发送行号')
        
    if not TradeContext.existVariable("TRCNO"):
        return AfaFlowControl.ExitThisFlow('A099','没有交易流水号')
        
    if not TradeContext.existVariable("TRCDAT"):
        return AfaFlowControl.ExitThisFlow('A099','没有委托日期')
        
    AfaLoggerFunc.tradeInfo("<<<<<<<结束校验变量的合法性")
    
    #=====产生RBSQ,NCCWKDAT,FEDT====
    if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :
        return AfaFlowControl.ExitThisFlow('A099','产生前置流水号失败')
        
    if not rccpsFunc.GetNCCDate( ) :            #NCCworkDate
        raise AfaFlowControl.flowException( )

    TradeContext.FEDT = AfaUtilTools.GetHostDate( )
    
    #=====查询错账登记簿====
    where_dict = {}
    where_dict={'TRCNO':TradeContext.TRCNO,'SNDBNKCO':TradeContext.SNDBNKCO,'TRCDAT':TradeContext.TRCDAT}
    tddzcz_record_dict = rccpsDBTrcc_tddzcz.selectu(where_dict)
    if(tddzcz_record_dict == None):
        return AfaFlowControl.ExitThisFlow('A099','查询错账登记簿异常')
        
    elif(len(tddzcz_record_dict) == 0):
        return AfaFlowControl.ExitThisFlow('A099','查询错账登记簿结果为空')
        
    else:
        AfaLoggerFunc.tradeInfo("查询错账登记簿成功")
        
    #=======判断原交易是否已被补记==
    AfaLoggerFunc.tradeInfo("<<<<<<判断原交易是否已被补记")
    if(tddzcz_record_dict['ISDEAL'] == PL_ISDEAL_UNDO):
        return AfaFlowControl.ExitThisFlow('A099','原交易尚未被补记')
        
    else:
        AfaLoggerFunc.tradeInfo("<<<<<<原交易已被补记")
        
    #=====查询原交易信息====
    AfaLoggerFunc.tradeInfo("<<<<<<查询通存通兑业务登记簿")
    wtrbka_record_dict = {}
    if not rccpsDBFunc.getTransWtr(tddzcz_record_dict['BJEDTE'],tddzcz_record_dict['BSPSQN'],wtrbka_record_dict):
        return AfaFlowControl.ExitThisFlow('A099','查询原交易信息失败')
        
    #=====判断被抹账务的日期是否是当日====
    if(wtrbka_record_dict['FEDT'] != AfaUtilTools.GetHostDate( )):
        return AfaFlowControl.ExitThisFlow('A099','要抹掉的交易非当日记账')
        
    #=====开始行内抹账====
    AfaLoggerFunc.tradeInfo("<<<<<<开始行内抹账")
    #=====给主机函数参数赋值====
    TradeContext.BOSPSQ   = wtrbka_record_dict['RBSQ']
    TradeContext.BOJEDT   = wtrbka_record_dict['FEDT']
    TradeContext.HostCode = '8820'   
        
    #=====设置原交易状态为抹账处理中====
    AfaLoggerFunc.tradeInfo("<<<<<<设置原交易状态为抹账处理中")
    if not rccpsState.newTransState(wtrbka_record_dict['BJEDTE'],wtrbka_record_dict['BSPSQN'],PL_BCSTAT_HCAC,PL_BDWFLG_WAIT):
        AfaDBFunc.RollBackSql()
        return AfaFlowControl.ExitThisFlow('S999','设置业务状态为抹账处理中异常')
    else:
        AfaDBFunc.CommitSql()
        
    #=====开始调用主机交易====
    AfaLoggerFunc.tradeInfo("<<<<<<开始调用主机交易")
    rccpsHostFunc.CommHost( TradeContext.HostCode )
    AfaLoggerFunc.tradeInfo("<<<<<<结束调用主机交易")
    
    AfaLoggerFunc.tradeInfo("<<<<<<结束行内抹账")
    
    #=====给状态字典赋值====
    state_dict = {}
    state_dict['BJEDTE'] = wtrbka_record_dict['BJEDTE']
    state_dict['BSPSQN'] = wtrbka_record_dict['BSPSQN']
    state_dict['BCSTAT'] = PL_BCSTAT_HCAC
    state_dict['MGID']   = TradeContext.errorCode
    if TradeContext.existVariable('TRDT'):
        state_dict['TRDT']   = TradeContext.TRDT
    if TradeContext.existVariable('TLSQ'):
        state_dict['TLSQ']   = TradeContext.TLSQ
    if TradeContext.existVariable('RBSQ'): 
        state_dict['RBSQ'] = TradeContext.RBSQ
    if TradeContext.existVariable('FEDT'):
        state_dict['FEDT'] = TradeContext.FEDT
    
    #=====判断主机抹账是否成功====
    AfaLoggerFunc.tradeInfo("<<<<<<判断主机抹账是否成功")
    AfaLoggerFunc.tradeDebug("<<<<<<errorCode=" + TradeContext.errorCode)
    if(TradeContext.errorCode != '0000'):
        AfaLoggerFunc.tradeDebug("主机抹账失败")
        #=====更改原交易状态为抹账失败====
        AfaLoggerFunc.tradeInfo("<<<<<<更改原交易状态为抹账失败")
        state_dict['BDWFLG'] = PL_BDWFLG_FAIL
        state_dict['STRINFO'] = TradeContext.errorMsg
        if not rccpsState.setTransState(state_dict):
            AfaDBFunc.RollBackSql()
            return AfaFlowControl.ExitThisFlow('S999','设置业务状态为抹账成功异常')
        else:
            AfaDBFunc.CommitSql()
       
        return AfaFlowControl.ExitThisFlow('S999','主机抹账失败')
        
    else:
        AfaLoggerFunc.tradeInfo("<<<<<<主机抹账成功")
        
    #=====更改原交易状态=====
    AfaLoggerFunc.tradeInfo("<<<<<<更改原交易状态为抹账成功")
    state_dict['BDWFLG'] = PL_BDWFLG_SUCC
    state_dict['STRINFO'] = '主机成功'
    if not rccpsState.setTransState(state_dict):
        AfaDBFunc.RollBackSql()
        return AfaFlowControl.ExitThisFlow('S999','设置业务状态为抹账成功异常')
    else:
        AfaDBFunc.CommitSql()
        
    #=====更改错账登记簿中的处理标示====
    AfaLoggerFunc.tradeInfo("<<<<<<更改错账登记簿中的处理标示")
    where_dict = {}
    where_dict = {'BJEDTE':tddzcz_record_dict['BJEDTE'],'BSPSQN':tddzcz_record_dict['BSPSQN']}
    update_dict = {}
    update_dict['ISDEAL'] = PL_ISDEAL_UNDO
    update_dict['NOTE3']  = '此笔补记已经被抹账'
    res = rccpsDBTrcc_tddzcz.updateCmt(update_dict,where_dict)
    if(res == -1):
        return AfaFlowControl.ExitThisFlow('S999','更新处理标示失败')
        
    else:
        AfaLoggerFunc.tradeInfo("<<<<<<更改错账登记簿中的处理标示成功")
    
    #=====给输出接口赋值=====
    AfaLoggerFunc.tradeInfo("<<<<<<开始给输出接口赋值")
    TradeContext.BOSPSQ     = wtrbka_record_dict['BSPSQN']
    TradeContext.BOJEDT     = wtrbka_record_dict['BJEDTE']
    TradeContext.BRSFLG     = wtrbka_record_dict['BRSFLG']
    TradeContext.TRCCO      = wtrbka_record_dict['TRCCO']
    TradeContext.BEACSB     = wtrbka_record_dict['BESBNO']
    TradeContext.OROCCAMT   = str(wtrbka_record_dict['OCCAMT'])
    TradeContext.ORCUR      = wtrbka_record_dict['CUR']
    TradeContext.ORSNDBNK   = wtrbka_record_dict['SNDBNKCO']
    TradeContext.ORSNDBNKNM = wtrbka_record_dict['SNDBNKNM']
    TradeContext.ORRCVBNK   = wtrbka_record_dict['RCVBNKCO']
    TradeContext.ORRCVBNKNM = wtrbka_record_dict['RCVBNKNM']
    TradeContext.ORPYRACC   = wtrbka_record_dict['PYRACC']
    TradeContext.ORPYRNAM   = wtrbka_record_dict['PYRNAM']
    TradeContext.ORPYEACC   = wtrbka_record_dict['PYEACC']
    TradeContext.ORPYENAM   = wtrbka_record_dict['PYENAM']
#    TradeContext.SBAC       = 
#    TradeContext.RBAC       = 

    AfaLoggerFunc.tradeDebug("<<<<<<OROCCAMT="+str(TradeContext.OROCCAMT))
    AfaLoggerFunc.tradeInfo("<<<<<<结束给输出接口赋值")    
        
    AfaLoggerFunc.tradeInfo("<<<<<<<个性化处理(本地操作) 退出")
    
    AfaLoggerFunc.tradeInfo("'***农信银系统:通存通兑往账交易.差错补记抹账[8573] 退出")
    
    return True
Example #10
0
 
 fp = open(file_path,"wb")
 
 if fp == None:
     rccpsCronFunc.cronExit("S999","打开通存通兑对账(主机)明细文件异常")
     
 file_line = ""
 
 if len(tddzmx_list) <= 0:
     AfaLoggerFunc.tradeInfo(">>>通存通兑对账明细登记簿中无对应记录")
 else:
     for i in xrange(len(tddzmx_list)):
         
         
         trc_dict = {}
         if not rccpsDBFunc.getTransWtr(tddzmx_list[i]['BJEDTE'],tddzmx_list[i]['BSPSQN'],trc_dict):
             rccpsCronFunc.cronExit("S999","查询交易信息异常")
         
         
         
         #=======根据往来标识获取借贷方信息================================
         if trc_dict['BRSFLG'] == PL_BRSFLG_SND:
             #===往账查询记账状态信息中的借贷方账号信息==================
             stat_dict = {}
             if not rccpsState.getTransStateSet(tddzmx_list[i]['BJEDTE'],tddzmx_list[i]['BSPSQN'],PL_BCSTAT_ACC,PL_BDWFLG_SUCC,stat_dict):
                 rccpsCronFunc.cronExit("S999","查询记账状态异常")
                 
             file_line = file_line + "RCC".ljust(8,' ')                 + '|' #代理业务号
             file_line = file_line + stat_dict['FEDT'].ljust(8,' ')     + '|' #前置日期
             file_line = file_line + stat_dict['RBSQ'].ljust(12,' ')    + '|' #前置流水号
             file_line = file_line + tddzmx_list[i]['SNDBNKCO'].ljust(12,' ') + '|' #发起行号