Esempio n. 1
0
def SubModuleDoTrd():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(3.中心记账).个人现金通存[TRCC002_8561]进入***' )
    
    #=================设置业务状态为发送成功或失败,若发送失败则自动抹账========
    
    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_SND
    stat_dict['BDWFLG']  = PL_BDWFLG_SUCC
    stat_dict['PRCCO']   = TradeContext.errorCode
    stat_dict['STRINFO'] = TradeContext.errorMsg
    
    AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]")
    
    if TradeContext.errorCode == '0000':
        AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为发送成功")
        
        stat_dict['BCSTAT']  = PL_BCSTAT_SND
        stat_dict['BDWFLG']  = PL_BDWFLG_SUCC
        
        if not rccpsState.setTransState(stat_dict):
            return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为发送成功异常")
        
        AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为发送成功")
        
    else:
        AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为发送失败")
        
        stat_dict['BCSTAT']  = PL_BCSTAT_SND
        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(">>>开始设置业务状态为抹账处理中")
        
        #=====特殊处理  关彬捷 20081127 调8813抹账,需产生新的前置流水号进行记账====
        if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :
            return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常")
        
        
        #为抹账会计分录赋值
        TradeContext.HostCode='8813'
        
        TradeContext.PKFG = 'T'                                         #通存通兑标识
        TradeContext.RVFG = '2'                                         #红蓝字标志 2
        TradeContext.CATR = '0'                                         #现转标识:0-现金
        TradeContext.RCCSMCD = PL_RCCSMCD_XJTCWZ                        #主机摘要码:现金通存往账
        TradeContext.SBAC = ''
        TradeContext.ACNM = ''
        TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ       #贷方账号
        TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
        TradeContext.OTNM = "农信银待清算往账"
        TradeContext.CTFG = '7'                                         #结转标识:结转-0
        
        AfaLoggerFunc.tradeInfo("借方账号1:[" + TradeContext.SBAC + "]")
        AfaLoggerFunc.tradeInfo("贷方账号1:[" + TradeContext.RBAC + "]")
        
        if TradeContext.CHRGTYP == '0':
            #现金收取手续费
            TradeContext.ACUR   = '2'                                       #重复次数
            
            TradeContext.I2PKFG = 'T'                                       #通存通兑标识
            TradeContext.I2RVFG = '2'                                       #红蓝字标志 2
            TradeContext.I2CATR = '0'                                       #现转标识:0-现金
            TradeContext.I2TRAM = TradeContext.LOCCUSCHRG                   #手续费金额
            TradeContext.I2SMCD = PL_RCCSMCD_SXF                            #主机摘要码:手续费
            TradeContext.I2SBAC = ''
            TradeContext.I2ACNM = ''
            TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF      #贷方账号:通存通兑手续费
            TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25)
            TradeContext.I2OTNM = "农信银手续费"
            TradeContext.I2CTFG = '8'                                       #结转标识:不结转-1
        
        
        #====设置业务状态为抹账处理中====
        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异常")
        
    TradeContext.errorCode = '0000'
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(3.中心记账).个人现金通存[TRCC002_8561]退出***' )
    return True
Esempio 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
Esempio n. 3
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
Esempio n. 4
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
Esempio n. 5
0
def SubModuleDoTrd():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(3.中心记账).行内账户转异地[TRCC002_8563]进入***' )
    
    #=================设置业务状态为发送成功或失败,若发送失败则自动抹账========
    
    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_SND
    stat_dict['BDWFLG']  = PL_BDWFLG_SUCC
    stat_dict['PRCCO']   = TradeContext.errorCode
    stat_dict['STRINFO'] = TradeContext.errorMsg
    
    AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]")
    
    if TradeContext.errorCode == '0000':
        AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为发送成功")
        
        stat_dict['BCSTAT']  = PL_BCSTAT_SND
        stat_dict['BDWFLG']  = PL_BDWFLG_SUCC
        
        if not rccpsState.setTransState(stat_dict):
            return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为发送成功异常")
        
        AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为发送成功")
        
    else:
        AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为发送失败")
        
        stat_dict['BCSTAT']  = PL_BCSTAT_SND
        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(">>>开始设置业务状态为抹账处理中")
        
        #=====特殊处理  关彬捷 20081127 调8813抹账,需产生新的前置流水号进行记账====
        if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :
            return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常")
        
        #为抹账会计分录赋值
        if TradeContext.CHRGTYP == '0':
            #现金收取
            AfaLoggerFunc.tradeInfo(">>>现金收取手续费")
            
            TradeContext.HostComm = '8813'
            
            TradeContext.ACUR = '2'                                         #重复次数
            
            TradeContext.PKFG = 'T'                                         #通存通兑标识
            TradeContext.OCCAMT = "-" + str(TradeContext.OCCAMT)            #出票金额
            TradeContext.RCCSMCD = PL_RCCSMCD_BZYWZ                         #主机摘要码:本转异往账
            TradeContext.SBAC = TradeContext.PYRACC                         #借方账号:客户账
            TradeContext.ACNM = TradeContext.PYRNAM                         #借方户名
            TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ       #贷方账号:汇出汇款
            TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25)
            TradeContext.OTNM = "农信银待清算往账"
            TradeContext.PASSWD = TradeContext.PASSWD                       #付款人密码
            if TradeContext.PYRTYP == '0':
                TradeContext.WARNTNO = TradeContext.SBAC[6:18]
            TradeContext.CERTTYPE = TradeContext.CERTTYPE                   #证件类型
            TradeContext.CERTNO   = TradeContext.CERTNO                     #证件号码
            TradeContext.CTFG = '7'                                         #本金标识:本金-1
            
            AfaLoggerFunc.tradeInfo("借方账号1:[" + TradeContext.SBAC + "]")
            AfaLoggerFunc.tradeInfo("贷方账号1:[" + TradeContext.RBAC + "]")
            AfaLoggerFunc.tradeInfo("凭证号码1:[" + TradeContext.WARNTNO + "]")
            
            TradeContext.I2PKFG = 'T'                                       #通存通兑标识
            TradeContext.I2RVFG = '2'                                       #红蓝字标志 2
            TradeContext.I2CATR = '0'                                       #现转标识:0-现金
            TradeContext.I2TRAM = str(TradeContext.LOCCUSCHRG)              #手续费金额
            TradeContext.I2SMCD = PL_RCCSMCD_SXF                            #主机摘要码:手续费
            TradeContext.I2SBAC = ""                                        #借方账号:柜员尾箱
            TradeContext.I2ACNM = ""                                        
            TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF      #贷方账号:通存通兑手续费
            TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25)
            TradeContext.I2OTNM = "手续费"
            TradeContext.I2CTFG = '8'                                       #本金标识:手续费-0
            
            AfaLoggerFunc.tradeInfo("借方账号2:[" + TradeContext.I2SBAC + "]")
            AfaLoggerFunc.tradeInfo("贷方账号2:[" + TradeContext.I2RBAC + "]")
        else:
            TradeContext.HostCode='8820'
            TradeContext.BOJEDT = TradeContext.BJEDTE
            TradeContext.BOSPSQ = TradeContext.BSPSQN
        
        #====设置业务状态为抹账处理中====
        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异常")
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(3.中心记账).行内账户转异地[TRCC002_8563]退出***' )
    return True
Esempio n. 6
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑业务回执报文接收[TRC004_1147]进入***' )
    #=================初始化返回信息============================================
    if AfaUtilTools.trim(TradeContext.STRINFO) == "":
        TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO)
        
    AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO)
    
    #=================匹配原交易信息===========================================
    wtrbka_where_dict = {}
    wtrbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN
    
    wtrbka_dict = {}
    wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(wtrbka_where_dict)
    if wtrbka_dict == None:
        return AfaFlowControl.ExitThisFlow('S999', "查询通存通兑业务信息登记簿异常")
    
    if len(wtrbka_dict) > 0:
        TradeContext.BJEDTE  = wtrbka_dict['BJEDTE']
        TradeContext.BSPSQN  = wtrbka_dict['BSPSQN']
        TradeContext.TRCCO   = wtrbka_dict['TRCCO']
        TradeContext.BESBNO  = wtrbka_dict['BESBNO']
        TradeContext.BETELR  = wtrbka_dict['BETELR']
        TradeContext.OCCAMT  = str(wtrbka_dict['OCCAMT'])
        TradeContext.CHRGTYP = wtrbka_dict['CHRGTYP']
        TradeContext.LOCCUSCHRG = str(wtrbka_dict['CUSCHRG'])
        TradeContext.PYETYP  = wtrbka_dict['PYETYP']
        TradeContext.PYEACC  = wtrbka_dict['PYEACC']
        TradeContext.PYENAM  = wtrbka_dict['PYENAM']
        TradeContext.PYRTYP  = wtrbka_dict['PYRTYP']
        TradeContext.PYRACC  = wtrbka_dict['PYRACC']
        TradeContext.PYRNAM  = wtrbka_dict['PYRNAM']
        TradeContext.CERTTYPE = wtrbka_dict['CERTTYPE']
        TradeContext.CERTNO  = wtrbka_dict['CERTNO']
        TradeContext.TERMID  = wtrbka_dict['TERMID']
        TradeContext.WARNTNO = wtrbka_dict['BNKBKNO']
        
        #============设置原交易状态为拒绝======================================
        AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为拒绝处理中")
        
        if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT):
            return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝处理中异常")
        
        AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝处理中")
        
        if not AfaDBFunc.CommitSql( ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return AfaFlowControl.ExitThisFlow("S999","Commit异常")
        AfaLoggerFunc.tradeInfo(">>>Commit成功")
        
        AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为拒绝成功")
        
        stat_dict = {}
        stat_dict['BJEDTE']  = TradeContext.BJEDTE
        stat_dict['BSPSQN']  = TradeContext.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', "设置业务状态为拒绝成功异常")
        
        AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝成功")
        
    else:
        AfaLoggerFunc.tradeInfo(">>>通存通兑业务登记簿中未找到原请求交易信息,开始查询原存款确认信息")
        wtrbka_where_dict = {}
        wtrbka_where_dict['COMSGFLGNO'] = TradeContext.ORMFN
        
        wtrbka_dict = {}
        wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(wtrbka_where_dict)
        
        if wtrbka_dict == None:
            return AfaFlowControl.ExitThisFlow('S999', "查询通存通兑业务信息登记簿异常")
        
        if len(wtrbka_dict) > 0:
            TradeContext.BJEDTE  = wtrbka_dict['BJEDTE']
            TradeContext.BSPSQN  = wtrbka_dict['BSPSQN']
            TradeContext.TRCCO   = wtrbka_dict['TRCCO']
            TradeContext.BESBNO  = wtrbka_dict['BESBNO']
            TradeContext.BETELR  = wtrbka_dict['BETELR']
            TradeContext.OCCAMT  = str(wtrbka_dict['OCCAMT'])
            TradeContext.CHRGTYP = wtrbka_dict['CHRGTYP']
            TradeContext.LOCCUSCHRG = str(wtrbka_dict['CUSCHRG'])
            TradeContext.PYETYP  = wtrbka_dict['PYETYP']
            TradeContext.PYEACC  = wtrbka_dict['PYEACC']
            TradeContext.PYENAM  = wtrbka_dict['PYENAM']
            TradeContext.PYRTYP  = wtrbka_dict['PYRTYP']
            TradeContext.PYRACC  = wtrbka_dict['PYRACC']
            TradeContext.PYRNAM  = wtrbka_dict['PYRNAM']
            TradeContext.CERTTYPE = wtrbka_dict['CERTTYPE']
            TradeContext.CERTNO  = wtrbka_dict['CERTNO']
            TradeContext.TERMID  = wtrbka_dict['TERMID']
            TradeContext.WARNTNO = wtrbka_dict['BNKBKNO']
            
            #============设置原交易状态为拒绝======================================
            AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为拒绝处理中")
            
            if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT):
                return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝处理中异常")
            
            AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝处理中")
            
            if not AfaDBFunc.CommitSql( ):
                AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                return AfaFlowControl.ExitThisFlow("S999","Commit异常")
            AfaLoggerFunc.tradeInfo(">>>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_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', "设置业务状态为拒绝成功异常")
            
            AfaLoggerFunc.tradeInfo(">>>结束设置原交易业务状态为拒绝成功")
            
        else:
            AfaLoggerFunc.tradeInfo(">>>通存通兑业务登记簿中未找到原存款确认信息,开始查询余额查询登记簿")
            balbka_where_dict = {}
            balbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN
            
            balbka_dict = {}
            balbka_dict = rccpsDBTrcc_balbka.selectu(balbka_where_dict)
            
            if balbka_dict == None:
                return AfaFlowControl.ExitThisFlow('S999', "查询余额查询登记簿异常")
                
            if len(balbka_dict) > 0:
                TradeContext.TRCCO = balbka_dict['TRCCO']
                
                #=====更新原余额查询交易返回码=================================
                AfaLoggerFunc.tradeInfo(">>>开始更新原余额查询交易返回码")
                
                balbka_update_dict = {}
                balbka_update_dict['PRCCO']   = TradeContext.PRCCO
                balbka_update_dict['STRINFO'] = TradeContext.STRINFO
                
                ret = rccpsDBTrcc_balbka.update(balbka_update_dict,balbka_where_dict)
                
                if ret <= 0:
                    return AfaFlowControl.ExitThisFlow('S999', "更新原余额查询交易返回码异常")
                
                AfaLoggerFunc.tradeInfo(">>>结束更新原余额查询交易返回码")
            else:
                AfaLoggerFunc.tradeInfo(">>>余额查询登记簿中未找到原交易信息,开始查询自动冲正登记簿")
                atcbka_where_dict = {}
                atcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN
                
                atcbka_dict = {}
                atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where_dict)
                
                if atcbka_dict == None:
                    return AfaFlowControl.ExitThisFlow('S999', "查询自动冲正登记簿异常")
                    
                if len(atcbka_dict) > 0:
                    TradeContext.BOJEDT = atcbka_dict['BOJEDT']
                    TradeContext.BOSPSQ = atcbka_dict['BOSPSQ']
                    TradeContext.TRCCO  = atcbka_dict['TRCCO']
                    
                    #====更新自动冲正交易返回码================================
                    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(">>>结束更新原自动冲正交易返回码")
                    
                    #====设置原被冲正交易业务状态为冲正失败================
                    #AfaLoggerFunc.tradeInfo(">>>开始设置原被冲正交易业务状态为冲正失败")
                    #
                    #stat_dict = {}
                    #stat_dict['BJEDTE']  = TradeContext.BOJEDT
                    #stat_dict['BSPSQN']  = TradeContext.BOSPSQ
                    #stat_dict['BCSTAT']  = PL_BCSTAT_CANC
                    #stat_dict['BDWFLG']  = PL_BDWFLG_FAIL
                    #stat_dict['PRCCO']   = TradeContext.PRCCO
                    #stat_dict['STRINFO'] = TradeContext.STRINFO
                    #
                    #if not rccpsState.setTransState(stat_dict):
                    #    return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为冲正失败异常")
                    #
                    #AfaLoggerFunc.tradeInfo(">>>结束设置原被冲正交易业务状态为冲正失败")
                else:
                    AfaLoggerFunc.tradeInfo(">>>自动冲正登记簿中未找到原交易信息,开始查询柜面冲销登记簿")
                    mpcbka_where_dict = {}
                    mpcbka_where_dict['MSGFLGNO'] = TradeContext.ORMFN
                    
                    mpcbka_dict = {}
                    mpcbka_dict = rccpsDBTrcc_mpcbka.selectu(mpcbka_where_dict)
                    
                    if mpcbka_dict == None:
                        return AfaFlowControl.ExitThisFlow('S999', "查询柜面冲销登记簿异常")
                        
                    if len(mpcbka_dict) > 0:
                        TradeContext.BOJEDT  = mpcbka_dict['BOJEDT']
                        TradeContext.BOSPSQ  = mpcbka_dict['BOSPSQ']
                        TradeContext.TRCCO   = mpcbka_dict['TRCCO']
                        TradeContext.ORTRCCO = mpcbka_dict['ORTRCCO']
                        TradeContext.BESBNO  = mpcbka_dict['BESBNO']
                        TradeContext.BETELR  = mpcbka_dict['BETELR']
                        TradeContext.TERMID  = mpcbka_dict['TERMID']
                        
                        #====更新柜台冲销交易返回码================================
                        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(">>>结束更新原柜面冲销交易返回码")
                        
                        #====设置原被冲销交易业务状态为冲销失败================
                        #AfaLoggerFunc.tradeInfo(">>>开始设置原被冲销交易业务状态为冲销处理中")
                        #
                        #if not rccpsState.newTransState(TradeContext.BOJEDT,TradeContext.BOSPSQ,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(">>>Commit成功")
                        #
                        #AfaLoggerFunc.tradeInfo(">>>开始设置原被冲销交易业务状态为冲销失败")
                        #
                        #stat_dict = {}
                        #
                        #stat_dict['BJEDTE']  = TradeContext.BJEDTE
                        #stat_dict['BSPSQN']  = TradeContext.BSPSQN
                        #stat_dict['PRCCO']   = TradeContext.PRCCO
                        #stat_dict['STRINFO'] = TradeContext.STRINFO
                        #stat_dict['BCSTAT']  = PL_BCSTAT_CANC
                        #stat_dict['BDWFLG']  = PL_BDWFLG_FAIL
                        #
                        #AfaLoggerFunc.tradeInfo(">>>结束设置原被冲销交易业务状态为冲销失败")
                    
                    else:
                        return AfaFlowControl.ExitThisFlow('S999', "未找到原交易信息,丢弃报文")
        
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
    AfaLoggerFunc.tradeInfo(">>>Commit成功")
    
    #=================若原交易为通存交易,开始自动抹账==========================
    if TradeContext.TRCCO == '3000002' or TradeContext.TRCCO == '3000003' or TradeContext.TRCCO == '3000004' or TradeContext.TRCCO == '3000005':
        
        #=====特殊处理  关彬捷 20081127 调8813抹账,需产生新的前置流水号进行记账====
        if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 :
            return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常")
        else:
            AfaLoggerFunc.tradeInfo(">>>成功产生新的前置流水号")
        
        #为抹账赋值会计分录
        entries_dict = {}
        entries_dict['FEDT']     = TradeContext.BJEDTE
        entries_dict['RBSQ']     = TradeContext.BSPSQN
        entries_dict['PYRACC']   = TradeContext.PYRACC
        entries_dict['PYRNAM']   = TradeContext.PYRNAM
        entries_dict['PYEACC']   = TradeContext.PYEACC
        entries_dict['PYENAM']   = TradeContext.PYENAM
        entries_dict['OCCAMT']   = TradeContext.OCCAMT
        entries_dict['CHRGTYP']  = TradeContext.CHRGTYP
        entries_dict['CUSCHRG']  = TradeContext.LOCCUSCHRG
        entries_dict['RCCSMCD']  = PL_RCCSMCD_CX
        TradeContext.BRSFLG      = PL_BRSFLG_SND
        
        if TradeContext.TRCCO == '3000002' or TradeContext.TRCCO == '3000004':
            rccpsEntries.KZTCWZMZ(entries_dict)
        
        if TradeContext.TRCCO == '3000003' or TradeContext.TRCCO == '3000005':
            rccpsEntries.KZBZYWZMZ(entries_dict)
        
        #=============设置原交易业务状态为抹账处理中===========================
        AfaLoggerFunc.tradeInfo(">>>开始设置原交易业务状态为抹账处理中")
        
        #====设置业务状态为抹账处理中====
        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(">>>结束主机抹账")
        
        AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]")
        
        stat_dict = {}
        
        stat_dict['BJEDTE']  = TradeContext.BJEDTE
        stat_dict['BSPSQN']  = TradeContext.BSPSQN
        stat_dict['MGID']    = TradeContext.errorCode
        stat_dict['STRINFO'] = TradeContext.errorMsg
        
        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异常")
        
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.回执类操作(1.回执操作).通存通兑业务回执报文接收[TRC004_1147]退出***' )
    
    return True