Exemplo n.º 1
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作).异转本_卡应答[TRCC004_1158]进入***' )

    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)

    #=====根据参考报文标识号查找原交易====
    TradeContext.ORSNDBNKCO = TradeContext.ORMFN[:10]                #原发送行号
    TradeContext.BOJEDT     = TradeContext.ORMFN[10:18]              #原交易日期
    TradeContext.ORTRCNO    = TradeContext.ORMFN[18:]                #原交易流水号

    wtr_dict = {}
    if not rccpsDBFunc.getTransWtrAK(TradeContext.ORSNDBNKCO,TradeContext.BOJEDT,TradeContext.ORTRCNO,wtr_dict):
        #=====查询原交易失败,等待前台超时发起冲正,抛弃此报文====       
        return AfaFlowControl.ExitThisFlow('S999','等待前台发起冲正,抛弃报文') 

    AfaLoggerFunc.tradeInfo( '>>>查询原交易结束' )

    #=================若应答报文回复拒绝,则设置状态为拒绝,停止处理=============
    if TradeContext.PRCCO != 'RCCI0000':
        AfaLoggerFunc.tradeInfo(">>>对方返回拒绝应答")
        
        #=============设置业务状态为拒绝处理中=================================
        
        if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT):
            return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝成功异常")
        
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            
        #=============设置业务状态为拒绝成功===================================
        stat_dict = {}
        stat_dict['BJEDTE']  = wtr_dict['BJEDTE']
        stat_dict['BSPSQN']  = wtr_dict['BSPSQN']
        stat_dict['BCSTAT']  = PL_BCSTAT_MFERFE
        stat_dict['BDWFLG']  = PL_BDWFLG_SUCC
        stat_dict['PRCCO']   = TradeContext.PRCCO
        stat_dict['STRINFO'] = TradeContext.STRINFO
        
        if not rccpsState.setTransState(stat_dict):
            return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为拒绝成功异常")
        
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            
        return AfaFlowControl.ExitThisFlow('S999',"对方拒绝,交易终止")
            
    #====查找自动冲正登记簿是否存在本交易的冲正====
    #====查找自动冲正登记簿是否存在本交易的冲正====
    wheresql = ''
    wheresql = wheresql + "BOJEDT = '" + wtr_dict['BJEDTE'] + "'"                #报单日期
    wheresql = wheresql + "AND BOSPSQ = '" + wtr_dict['BSPSQN'] + "'"                #报单序号
    
    ret = rccpsDBTrcc_atcbka.count(wheresql)
    if ret == -1:
        return AfaFlowControl.ExitThisFlow('S999','查找自动冲正登记簿异常') 
    elif ret > 0:
        #=====原交易已自动冲正,抛弃报文====
        return AfaFlowControl.ExitThisFlow('S999','原交易已冲正,抛弃报文') 

    AfaLoggerFunc.tradeInfo( '>>>查询冲正登记簿结束' )

    #=====主机记账前处理====
    TradeContext.BESBNO  =  wtr_dict['BESBNO']      #机构号
    TradeContext.BETELR  =  wtr_dict['BETELR']      #柜员号
    TradeContext.BEAUUS  =  wtr_dict['BEAUUS']      #授权柜员
    TradeContext.BEAUPS  =  wtr_dict['BEAUPS']      #授权密码
    TradeContext.TERMID  =  wtr_dict['TERMID']      #终端号
    TradeContext.BJEDTE  =  wtr_dict['BJEDTE']      #交易日期
    TradeContext.BSPSQN  =  wtr_dict['BSPSQN']      #报单序号
    TradeContext.BRSFLG  =  wtr_dict['BRSFLG']      #往来账标志
    TradeContext.HostCode=  '8813'                  #主机交易码

    AfaLoggerFunc.tradeInfo( '>>>主机前处理赋值结束' )

    #=====开始更新原交易,新增状态记账-处理中====
    if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_ACC,PL_BDWFLG_WAIT):
        #=====RollBack操作====
        AfaDBFunc.RollbackSql()
        return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚')
    else:
        #=====commit操作====
        AfaDBFunc.CommitSql()
    
    AfaLoggerFunc.tradeInfo( '>>>设置状态记账-处理中结束' )
    
    #=====根据原记录中的手续费收取方式,判断账务处理模式====
    if wtr_dict['CHRGTYP'] == '1':
        #=====转账====
        TradeContext.ACUR    =  '3'                                     #记账次数
        #=========交易金额+手续费===================
        TradeContext.RCCSMCD =  PL_RCCSMCD_YZBWZ                              #摘要代码  PL_RCCSMCD_YZBWZ 异转本
        TradeContext.SBAC    =  TradeContext.BESBNO + PL_ACC_NXYDQSWZ         #借方账号
        TradeContext.SBAC    =  rccpsHostFunc.CrtAcc(TradeContext.SBAC,25)
        TradeContext.ACNM    =  '农信银往账'                                  #借方户名
        TradeContext.RBAC    =  TradeContext.BESBNO + PL_ACC_NXYDJLS           #贷方账号
        TradeContext.RBAC    =  rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
        TradeContext.OTNM    =  '应解汇款'                                    #贷方户名
        TradeContext.OCCAMT  =  str(wtr_dict['OCCAMT'] + wtr_dict['CUSCHRG']) #发生额
        TradeContext.PKFG    = 'T'
        TradeContext.CTFG    = '9'
        TradeContext.WARNTNO = ''
        TradeContext.CERTTYPE = ''
        TradeContext.CERTNO = ''
        AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:借方账号' + TradeContext.SBAC )
        AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:贷方账号' + TradeContext.RBAC )
        #=========交易金额============
        TradeContext.I2SMCD  =  PL_RCCSMCD_YZBWZ                              #摘要代码
        TradeContext.I2SBAC  =  TradeContext.BESBNO + PL_ACC_NXYDJLS          #借方账号
        TradeContext.I2SBAC  =  rccpsHostFunc.CrtAcc(TradeContext.I2SBAC,25)
        TradeContext.I2ACNM  =  '应解汇款'                                    #借方户名
        TradeContext.I2RBAC  =  TradeContext.PYEACC                           #贷方账号
        TradeContext.I2OTNM  =  TradeContext.PYENAM                           #贷方户名
        TradeContext.I2TRAM  =  str(wtr_dict['OCCAMT'])                       #发生额
        TradeContext.I2CTFG  = '7'
        TradeContext.I2PKFG  = 'T'
        #TradeContext.I2WARNTNO = ''
        #TradeContext.I2CERTTYPE = ''
        #TradeContext.I2CERTNO = ''
        AfaLoggerFunc.tradeInfo( '>>>交易金额:借方账号' + TradeContext.I2SBAC )
        AfaLoggerFunc.tradeInfo( '>>>交易金额:贷方账号' + TradeContext.I2RBAC )
        #=========结算手续费收入户===========
        TradeContext.I3SMCD  =  PL_RCCSMCD_SXF                                #摘要代码
        TradeContext.I3SBAC  =  TradeContext.BESBNO + PL_ACC_NXYDJLS          #借方账号
        TradeContext.I3SBAC  =  rccpsHostFunc.CrtAcc(TradeContext.I3SBAC,25)
        TradeContext.I3ACNM  =  '应解汇款'                                    #借方户名
        TradeContext.I3RBAC  =  TradeContext.BESBNO + PL_ACC_TCTDSXF          #贷方账号
        TradeContext.I3RBAC  =  rccpsHostFunc.CrtAcc(TradeContext.I3RBAC,25)
        TradeContext.I3OTNM  =  '结算手续费'                                  #贷方户名
        TradeContext.I3TRAM  =  str(wtr_dict['CUSCHRG'])                      #发生额
        TradeContext.I3CTFG  = '8'
        TradeContext.I3PKFG  = 'T'
        AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:借方账号' + TradeContext.I3SBAC )
        AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:贷方账号' + TradeContext.I3RBAC )

    elif wtr_dict['CHRGTYP'] == '0':
        #=====本金====
        TradeContext.ACUR    =  '2'                                           #记账次数
        TradeContext.RCCSMCD =  PL_RCCSMCD_YZBWZ                              #摘要代码
        TradeContext.SBAC    =  TradeContext.BESBNO + PL_ACC_NXYDQSWZ         #借方账号
        TradeContext.SBAC    = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25)
        TradeContext.ACNM    =  '农信银往账'                                  #借方户名
        TradeContext.RBAC    =  TradeContext.PYEACC                           #贷方账号
        TradeContext.OTNM    =  TradeContext.PYENAM                           #贷方户名
        TradeContext.OCCAMT  =  str(wtr_dict['OCCAMT'])                       #金额
        TradeContext.CTFG  = '7'
        TradeContext.PKFG  = 'T'
        TradeContext.WARNTNO = ''
        TradeContext.CERTTYPE = ''
        TradeContext.CERTNO = ''
        
        #=====手续费记账赋值====
        TradeContext.I2SMCD  =  PL_RCCSMCD_SXF                                #摘要代码
        TradeContext.I2SBAC  =  ''                                            #借方账号
        TradeContext.I2RBAC  =  TradeContext.BESBNO + PL_ACC_TCTDSXF          #贷方账号
        TradeContext.I2RBAC  =  rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25)
        TradeContext.I2OTNM  =  '手续费科目'                                  #贷方户名
        TradeContext.I2TRAM  =  str(wtr_dict['CUSCHRG'])                      #金额
        TradeContext.I2CTFG  =  '8'
        TradeContext.I2PKFG  =  'T'
        TradeContext.I2CATR  =  '0'                                           #现转标志
    elif wtr_dict['CHRGTYP'] == '2':
        #=====不收费====
        TradeContext.ACUR    =  '1'                                           #记账次数
        TradeContext.RCCSMCD =  PL_RCCSMCD_YZBWZ                                #摘要代码
        TradeContext.SBAC    =  TradeContext.BESBNO + PL_ACC_NXYDQSWZ         #借方账号
        TradeContext.SBAC    =  rccpsHostFunc.CrtAcc(TradeContext.SBAC,25)
        TradeContext.RBAC    =  TradeContext.PYEACC                           #贷方账号
        TradeContext.OTNM    =  TradeContext.PYENAM                           #贷方户名
        TradeContext.OCCAMT  =  str(wtr_dict['OCCAMT'])                       #金额
        TradeContext.CTFG    =  '7'
        TradeContext.PKFG    =  'T'
        TradeContext.WARNTNO = ''
        TradeContext.CERTTYPE = ''
        TradeContext.CERTNO = ''
    else:
        #=====出错====
        return AfaFlowControl.ExitThisFlow('S999','手续费收费方式错,抛弃报文') 
    
    AfaLoggerFunc.tradeInfo( '>>>根据手续费收取方式记账赋值处理结束' )
    
    #=====主机记账处理====
    rccpsHostFunc.CommHost(TradeContext.HostCode)
    
    #=====主机后处理====
    set_dict = {}
    set_dict['BSPSQN']  =  TradeContext.BSPSQN
    set_dict['BJEDTE']  =  TradeContext.BJEDTE
    set_dict['BCSTAT']  =  PL_BCSTAT_ACC
    set_dict["SBAC"]    =  TradeContext.SBAC          #借方账号
    set_dict["RBAC"]    =  TradeContext.RBAC          #贷方账号
    set_dict["OTNM"]    =  TradeContext.OTNM          #贷方户名
    set_dict['MGID']    =  TradeContext.errorCode     #主机返回码
    set_dict["STRINFO"]= TradeContext.errorMsg        #主机返回信息
    if TradeContext.errorCode == '0000':
        #=====主机记账成功====
        set_dict['BDWFLG'] = PL_BDWFLG_SUCC
        set_dict['TRDT']   = TradeContext.TRDT
        set_dict['TLSQ']   = TradeContext.TLSQ
    else:
        set_dict['BDWFLG'] = PL_BDWFLG_FAIL
    
    if not rccpsState.setTransState(set_dict):
        return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg)
    else:
        #=====commit操作====
        AfaDBFunc.CommitSql()
    AfaLoggerFunc.tradeInfo('>>>设置主机返回状态成功') 
    
    if TradeContext.errorCode == '0000':
        #=====开始更新原交易,新增状态清算成功====
        if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_MFESTL,PL_BDWFLG_SUCC):
            #=====RollBack操作====
            AfaDBFunc.RollbackSql()
            return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚')
        else:
            #=====commit操作====
            AfaDBFunc.CommitSql()
        
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作).异转本_卡应答[TRCC004_1158]退出***' )
    
    return True
Exemplo n.º 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
Exemplo n.º 3
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.回执操作).存款确认应答报文接收[TRCC004_1160]进入 ")
    
    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)
    
    #=================匹配原交易信息===========================================
    AfaLoggerFunc.tradeInfo(">>>开始匹配原请求交易信息")
    
    wtr_dict = {}
    if not rccpsDBFunc.getTransWtrCK(TradeContext.SNDBNKCO,TradeContext.TRCDAT,TradeContext.TRCNO,wtr_dict):
        return AfaFlowControl.ExitThisFlow('S999', "匹配原请求交易信息异常")
    
    TradeContext.BJEDTE = wtr_dict['BJEDTE']
    TradeContext.BSPSQN = wtr_dict['BSPSQN']
    
    AfaLoggerFunc.tradeInfo(">>>结束匹配原请求交易信息")
    
    #=================必要性检查===============================================
    AfaLoggerFunc.tradeInfo(">>>开始进行必要性检查")
    
    #=================如果此交易已被冲正或冲销,则停止处理============================
    
    where_sql = "ORMFN = '" + wtr_dict['MSGFLGNO'] + "'"
    
    AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲正")
    
    ret = rccpsDBTrcc_atcbka.count(where_sql)
    
    if ret < 0:
        return AfaFlowControl.ExitThisFlow("S999","查询冲正登记簿异常,退出主流程")
        
    if ret > 0:
        return AfaFlowControl.ExitThisFlow("S999","冲正登记簿中存在对此交易的冲正,退出主流程")
        
    AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲正")
    
    AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲销")
    
    ret = rccpsDBTrcc_mpcbka.count(where_sql)
    
    if ret < 0:
        return AfaFlowControl.ExitThisFlow("S999","查询冲销登记簿异常,退出主流程")
        
    if ret > 0:
        return AfaFlowControl.ExitThisFlow("S999","冲销登记簿中存在对此交易的冲销,退出主流程")
        
    AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲销")
    
    AfaLoggerFunc.tradeInfo(">>>结束进行必要性检查")
    
    #=================设置业务状态为清算=======================================
    AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为清算处理中")
    
    if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFESTL,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']  = TradeContext.BJEDTE
    stat_dict['BSPSQN']  = TradeContext.BSPSQN
    stat_dict['BESBNO']  = TradeContext.BESBNO
    stat_dict['BETELR']  = TradeContext.BETELR
    stat_dict['BCSTAT']  = PL_BCSTAT_MFESTL
    stat_dict['BDWFLG']  = PL_BDWFLG_SUCC
    stat_dict['PRCCO']   = TradeContext.PRCCO
    stat_dict['STRINFO'] = TradeContext.STRINFO
    
    if not rccpsState.setTransState(stat_dict):
        return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为清算成功异常")
    
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
    
    AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为清算成功")
    
    AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.回执操作).存款确认应答报文接收[TRCC004_1160]退出 ")
    
    return True
Exemplo n.º 4
0
def SubModuleDoFst():    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作).冲正\冲销登记簿查询[TRC001_8566]进入***' )
        
    #=====必要性检查====
    AfaLoggerFunc.tradeInfo(">>>开始必要性检查")
    
    if( not TradeContext.existVariable( "STRDAT" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '起始日期[STRDAT]不存在')
    
    if( not TradeContext.existVariable( "ENDDAT" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '终止日期[ENDDAT]不存在')
    
    if( not TradeContext.existVariable( "TRCCO" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '交易代码[TRCCO]不存在')
    
    if( not TradeContext.existVariable( "BRSFLG" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '往来标志[BRSFLG]不存在')
        
    if( not TradeContext.existVariable( "BESBNO" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '机构号[BESBNO]不存在')
    
    if( not TradeContext.existVariable( "RECSTRNO" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '起始笔数[RECSTRNO]不存在')
        
    AfaLoggerFunc.tradeInfo(">>>必要性检查结束")
    
    #=====组织sql语句====
    AfaLoggerFunc.tradeInfo(">>>开始组织查询sql语句")
    
    wheresql=""
    wheresql=wheresql+"BESBNO='"+TradeContext.BESBNO+"'"
    wheresql=wheresql+" AND BJEDTE>='"+TradeContext.STRDAT+"'"
    wheresql=wheresql+" AND BJEDTE<='"+TradeContext.ENDDAT+"'"
    
    ordersql = " order by BJEDTE DESC,BSPSQN DESC "
    
    start_no=TradeContext.RECSTRNO          #起始笔数
    sel_size=10                             #查询笔数
    
    #=====判断交易代码是否为空====
    if(TradeContext.TRCCO != ""):
        wheresql = wheresql + " AND TRCCO='" + TradeContext.TRCCO + "'"    
    
    #=====判断原交易代码是否为空====
    if(TradeContext.ORTRCCO != ""):
        wheresql = wheresql + " AND ORTRCCO='" + TradeContext.ORTRCCO + "'" 
        
    #=====判断报单序号是否为空====
    if(TradeContext.BSPSQN != ""):
        wheresql = wheresql + " AND BSPSQN='" + TradeContext.BSPSQN + "'"
    
    #=====判断原报单序号是否为空====
    if(TradeContext.BOSPSQ != ""):
        wheresql = wheresql + " AND BOSPSQ='" + TradeContext.BOSPSQ + "'"
            
    #=====判断往来标志是否为空====
    if(TradeContext.BRSFLG != ""):
        wheresql = wheresql +" AND BRSFLG='" + TradeContext.BRSFLG + "'"
        
    AfaLoggerFunc.tradeDebug(">>>结束组织查询sql语句")
    AfaLoggerFunc.tradeDebug(">>>sql="+str(wheresql) )
    
    #=====3000506 自动冲正登记簿查询====
    if TradeContext.TRCCO == '3000506':
        #=====查询总笔数====
        allcount=rccpsDBTrcc_atcbka.count(wheresql)
        if(allcount == -1):
            return AfaFlowControl.ExitThisFlow('S999','查询总记录数异常')
            
        #=====查询明细====
        AfaLoggerFunc.tradeInfo("wheresql=" + wheresql)
        records=rccpsDBTrcc_atcbka.selectm(start_no,sel_size,wheresql,ordersql)
        if(records == None):
            return AfaFlowControl.ExitThisFlow('S999', '查询冲正登记簿异常')
        if(len(records) <= 0):
            return AfaFlowControl.ExitThisFlow('S999', '冲正登记簿中无此对应信息')
    
    #=====3000504 手工冲销登记簿查询====
    elif TradeContext.TRCCO == '3000504':
        #=====查询总笔数====
        allcount=rccpsDBTrcc_mpcbka.count(wheresql)
        if(allcount == -1):
            return AfaFlowControl.ExitThisFlow('S999','查询总记录数异常')
            
        #=====查询明细====
        AfaLoggerFunc.tradeInfo("wheresql=" + wheresql)
        records=rccpsDBTrcc_mpcbka.selectm(start_no,sel_size,wheresql,ordersql)
        if(records == None):
            return AfaFlowControl.ExitThisFlow('S999', '查询冲销登记簿异常')
        if(len(records) <= 0):
            return AfaFlowControl.ExitThisFlow('S999', '冲销登记簿中无此对应信息')
    else:
        return AfaFlowControl.ExitThisFlow('S999','交易码非法' )      
    
    #=====生成文件====
    try:
        filename="rccps_"+TradeContext.BETELR+"_"+AfaUtilTools.GetHostDate()+"_"+TradeContext.TransCode
        fpath=os.environ["AFAP_HOME"]+"/tmp/"
        f=open(fpath+filename,"w")
    except IOError:
        return AfaFlowControl.ExitThisFlow('S099','打开文件失败')
              
    #=====写文件操作====
    AfaLoggerFunc.tradeInfo("记录数:" + str(len(records)))
    try:
        filecontext=""
        for i in range(0,len(records)):
            #AfaLoggerFunc.tradeDebug("写入第"+str(i)+"笔记录开始")
            filecontext= records[i]['BJEDTE']        + "|" \
                       + records[i]['BSPSQN']        + "|" \
                       + records[i]['BRSFLG']        + "|" \
                       + records[i]['BESBNO']        + "|" \
                       + records[i]['BETELR']        + "|" \
                       + records[i]['BEAUUS']        + "|" \
                       + records[i]['NCCWKDAT']      + "|" \
                       + records[i]['TRCCO']         + "|" \
                       + records[i]['TRCDAT']        + "|" \
                       + records[i]['TRCNO']         + "|" \
                       + records[i]['ORTRCDAT']      + "|" \
                       + records[i]['ORTRCNO']       + "|" \
                       + records[i]['SNDMBRCO']      + "|" \
                       + records[i]['RCVMBRCO']      + "|" \
                       + records[i]['SNDBNKCO']      + "|" \
                       + records[i]['SNDBNKNM']      + "|" \
                       + records[i]['RCVBNKCO']      + "|" \
                       + records[i]['RCVBNKNM']      + "|" \
                       + records[i]['BOJEDT']        + "|" \
                       + records[i]['BOSPSQ']        + "|" \
                       + records[i]['RESNCO']        + "|" \
                       + records[i]['PRCCO']         + "|" \
                       + records[i]['STRINFO']       + "|" 
                           
            f.write(filecontext+"\n")
            #AfaLoggerFunc.tradeDebug("写入第"+str(i)+"笔记录结束")
    except Exception,e:     
        f.close()
        return AfaFlowControl.ExitThisFlow('S099','写文件失败')
Exemplo n.º 5
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.本地操作).折本转异应答报文接收[TRCC006_1155]进入 ")

    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)

    #=================必要性检查===============================================
    AfaLoggerFunc.tradeInfo(">>>开始必要性检查")
    #=================若交易已被冲正或冲销,则停止处理================================
    
    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(">>>开始检查此交易是否已被冲销")
    
    ret = rccpsDBTrcc_mpcbka.count(where_sql)
    
    if ret < 0:
        return AfaFlowControl.ExitThisFlow("S999","查询冲销登记簿异常,退出主流程")
        
    if ret > 0:
        return AfaFlowControl.ExitThisFlow("S999","冲销登记簿中存在对此交易的冲销,退出主流程")
        
    AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲销")
        
    AfaLoggerFunc.tradeInfo(">>>结束必要性检查")
    
    #=================匹配原交易信息===========================================
    AfaLoggerFunc.tradeInfo(">>>开始匹配原交易")
    
    wtr_dict = {}
    
    if not rccpsDBFunc.getTransWtrAK(TradeContext.SNDBNKCO,TradeContext.TRCDAT,TradeContext.TRCNO,wtr_dict):
        return AfaFlowControl.ExitThisFlow('S999', "未找到原存款请求交易,停止处理")
    
    TradeContext.BJEDTE  = wtr_dict['BJEDTE']
    TradeContext.BSPSQN  = wtr_dict['BSPSQN']
    TradeContext.TRCCO   = wtr_dict['TRCCO']
    TradeContext.BESBNO  = wtr_dict['BESBNO']
    TradeContext.BETELR  = wtr_dict['BETELR']
    TradeContext.OCCAMT  = str(wtr_dict['OCCAMT'])
    TradeContext.CHRGTYP = wtr_dict['CHRGTYP']
    TradeContext.LOCCUSCHRG = str(wtr_dict['CUSCHRG'])
    TradeContext.PYRTYP  = wtr_dict['PYRTYP']
    TradeContext.PYRACC  = wtr_dict['PYRACC']
    TradeContext.PYRNAM  = wtr_dict['PYRNAM']
    TradeContext.CERTTYPE = wtr_dict['CERTTYPE']
    TradeContext.CERTNO  = wtr_dict['CERTNO']
    TradeContext.TERMID  = wtr_dict['TERMID']
    TradeContext.WARNTNO = wtr_dict['BNKBKNO']
    
    AfaLoggerFunc.tradeInfo(">>>结束匹配原交易")
    
    #=================若应答报文回复拒绝,则设置状态为拒绝,停止处理=============
    if TradeContext.PRCCO != 'RCCI0000':
        AfaLoggerFunc.tradeInfo(">>>对方返回拒绝应答")
        #=============设置业务状态为拒绝处理中=================================
        
        if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT):
            return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝处理中异常")
        
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        
        stat_dict = {}
        stat_dict['BJEDTE']  = TradeContext.BJEDTE
        stat_dict['BSPSQN']  = TradeContext.BSPSQN
        stat_dict['BESBNO']  = TradeContext.BESBNO
        stat_dict['BETELR']  = TradeContext.BETELR
        stat_dict['BCSTAT']  = PL_BCSTAT_MFERFE
        stat_dict['BDWFLG']  = PL_BDWFLG_SUCC
        stat_dict['PRCCO']   = TradeContext.PRCCO
        stat_dict['STRINFO'] = TradeContext.STRINFO
        
        if not rccpsState.setTransState(stat_dict):
            return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为拒绝成功异常")
        
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        
        #=============发起主机抹账=============================================
        AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账处理中")
        
        
        #=====特殊处理  关彬捷 20081127 调8813抹账,需产生新的前置流水号进行记账====
        if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :
            return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常")
              
        
        #为抹账赋值会计分录
        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_CZ
        TradeContext.BRSFLG      = PL_BRSFLG_SND
        
        rccpsEntries.KZBZYWZMZ(entries_dict)
          
        #====设置业务状态为抹账处理中====        
        if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_WAIT):
            return AfaFlowControl.ExitThisFlow('S999','设置业务状态为抹账处理中异常')
        
        AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账处理中")
        
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        
        #====自动抹账====
        AfaLoggerFunc.tradeInfo(">>>开始发起主机抹账")
        
        #=====调起抹账主机接口====
        rccpsHostFunc.CommHost( TradeContext.HostCode )
        
        AfaLoggerFunc.tradeInfo(">>>结束发起主机抹账")
        
        stat_dict = {}
        
        stat_dict['BJEDTE']  = TradeContext.BJEDTE
        stat_dict['BSPSQN']  = TradeContext.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_HCAC
            stat_dict['BDWFLG'] = PL_BDWFLG_SUCC
            stat_dict['TRDT']   = TradeContext.TRDT
            stat_dict['TLSQ']   = TradeContext.TLSQ
            stat_dict['PRTCNT'] = 1
            
            if not rccpsState.setTransState(stat_dict):
                return AfaFlowControl.ExitThisFlow('S999','设置业务状态抹账成功异常')
            
            AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账成功")
            
        else:
            AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账失败")
            
            stat_dict['BCSTAT'] = PL_BCSTAT_HCAC
            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异常")
            
        return AfaFlowControl.ExitThisFlow("S999","对方拒绝,停止处理")
    
    else:
        AfaLoggerFunc.tradeInfo(">>>对方返回成功应答")

    #=================设置业务状态为确认付款处理中=============================
    AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为确认付款处理中")
    
    if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CONFPAY,PL_BDWFLG_WAIT):
        return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为确认付款处理中异常")
    
    AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为确认付款处理中")
    
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
    
    #=================更新存款确认委托日期和交易流水号=========================
    AfaLoggerFunc.tradeInfo(">>>开始更新存款确认委托日期和交易流水号")
    
    wtrbka_update_dict = {}
    wtrbka_update_dict['COTRCDAT'] = TradeContext.TRCDAT
    wtrbka_update_dict['COTRCNO']  = TradeContext.SerialNo
    wtrbka_update_dict['COMSGFLGNO'] = TradeContext.RCVMBRCO + TradeContext.TRCDAT + TradeContext.SerialNo
    
    wtrbka_where_dict = {}
    wtrbka_where_dict['BJEDTE'] = TradeContext.BJEDTE
    wtrbka_where_dict['BSPSQN'] = TradeContext.BSPSQN
    
    ret = rccpsDBTrcc_wtrbka.update(wtrbka_update_dict,wtrbka_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(">>>开始为存款确认请求报文做准备")
    
    TradeContext.MSGTYPCO = 'SET009'
    TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO
    TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO
    TradeContext.SNDBRHCO = TradeContext.BESBNO
    TradeContext.SNDCLKNO = TradeContext.BETELR
    #TradeContext.SNDTRDAT = TradeContext.BJEDTE
    #TradeContext.SNDTRTIM = TradeContext.BJETIM
    #TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.BJEDTE + TradeContext.TRCNO
    TradeContext.ORMFN    = TradeContext.ORMFN
    TradeContext.OPRTYPNO = '30'
    TradeContext.ROPRTPNO = '30'
    TradeContext.TRANTYP  = '0'
    
    TradeContext.ORTRCCO  = TradeContext.TRCCO
    TradeContext.ORTRCNO  = TradeContext.TRCNO
    TradeContext.TRCCO    = '3000503'
    TradeContext.TRCNO    = TradeContext.SerialNo
    TradeContext.CURPIN   = ""
    TradeContext.STRINFO  = '收到存款应答,自动发送存款确认'
    
    AfaLoggerFunc.tradeInfo(">>>结束为存款确认请求报文做准备")
    
    AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.本地操作).卡本转异应答报文接收[TRCC006_1155]退出 ")
    return True