Exemplo n.º 1
0
 
 AfaLoggerFunc.tradeInfo(">>>开始设置汇票状态")
 
 if not rccpsState.newBilState(hpdzcz_list[i]['BJEDTE'],hpdzcz_list[i]['BSPSQN'],HPSTAT):
     rccpsCronFunc.cronExit('S999', '设置汇票状态异常')
 
 AfaLoggerFunc.tradeInfo(">>>结束设置汇票状态")
 
 AfaLoggerFunc.tradeInfo(">>>开始设置短款成功状态")
 
 tmp_stat = {}
 tmp_stat['BJEDTE'] = hpdzcz_list[i]['BJEDTE']
 tmp_stat['BSPSQN'] = hpdzcz_list[i]['BSPSQN']
 
 tmptrc_dict = {}
 if not rccpsDBFunc.getTransBil(hpdzcz_list[i]['BJEDTE'],hpdzcz_list[i]['BSPSQN'],tmptrc_dict):
     rccpsCronFunc.cronExit('S999', '查询汇票交易业务信息异常')
 
 if not rccpsDBFunc.getInfoBil(tmptrc_dict['BILVER'],tmptrc_dict['BILNO'],tmptrc_dict['BILRS'],tmptrc_dict):
     rccpsCronFunc.cronExit('S999', '查询汇票信息异常')
     
 TradeContext.SBAC     = TradeContext.BESBNO + PL_ACC_NXYDQSWZ  #借农信银待清算往账
 TradeContext.ACNM     = "农信银待清算往账"
 TradeContext.RBAC     = tmptrc_dict['PYHACC']                     #贷持票人账号
 TradeContext.OTNM     = tmptrc_dict['PYHNAM']
 
 #=====开始调函数拼贷方账号第25位校验位====
 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC, 25)
 
 tmp_stat['BCSTAT'] = PL_BCSTAT_SHORT
 tmp_stat['BDWFLG'] = PL_BDWFLG_SUCC
Exemplo n.º 2
0
def SubModuleDoFst():

    AfaLoggerFunc.tradeInfo('>>>进入汇票挂失/解挂操作')
    
    #====begin 蔡永贵 20110215 增加====
    #新票据号是16位,需要取后8位,版本号为02,同时要兼容老票据号8位,版本号为01
    if TradeContext.BILVER == '02':
        TradeContext.TMP_BILNO = TradeContext.BILNO[-8:]
    else:
        TradeContext.TMP_BILNO = TradeContext.BILNO
    #============end============
 
    #=====开始查询汇票信息====
    AfaLoggerFunc.tradeDebug('>>>开始查询汇票信息')
    bil_dict = {}
    if not rccpsDBFunc.getInfoBil(TradeContext.BILVER,TradeContext.BILNO,TradeContext.BILRS,bil_dict):
        return AfaFlowControl.ExitThisFlow('S999','查询汇票信息出错')

    AfaLoggerFunc.tradeDebug('>>>结束查询汇票信息')

    #=====判断现金或者转账汇票,只有现金汇票可以进行挂失====
    #if bil_dict['PAYWAY'] != '0':
    #    return AfaFlowControl.ExitThisFlow('S999','转账汇票不允许挂失/解挂')
        
    AfaLoggerFunc.tradeDebug('>>>判断汇票是否允许挂失')
    
    if bil_dict['REMBNKCO'] != TradeContext.SNDBNKCO:
        return AfaFlowControl.ExitThisFlow('S999','只能由签发行进行挂失操作')
    
    AfaLoggerFunc.tradeDebug('>>>判断签发行和挂失行是否一致')

    if bil_dict['SEAL'] == '':
        return AfaFlowControl.ExitThisFlow('S999','密押空错误')
    else:
        TradeContext.SEAL = bil_dict['SEAL']

    AfaLoggerFunc.tradeDebug('>>>结束密押判断')
    
    #=====查询数据库====
    records = {}
    ret = rccpsDBFunc.getTransBil(bil_dict['NOTE1'],bil_dict['NOTE2'],records)
    if( ret == False):
        return AfaFlowControl.ExitThisFlow('A099', '无此数据')

    if str(bil_dict['BILAMT']) == '':
        return AfaFlowControl.ExitThisFlow('S999','金额空错误')
    else:
        TradeContext.OCCAMT = str(bil_dict['BILAMT'])

    TradeContext.PYRACC  =  bil_dict['PYRACC']
    TradeContext.PYRNAM  =  bil_dict['PYRNAM']
    TradeContext.PYRADDR =  bil_dict['PYRADDR']
    TradeContext.PYEACC  =  bil_dict['PYEACC']
    TradeContext.PYENAM  =  bil_dict['PYENAM']
    TradeContext.PYEADDR =  bil_dict['PYEADDR']
    TradeContext.BILDAT  =  bil_dict['BILDAT']
    TradeContext.RCVBNKCO  =  bil_dict['PAYBNKCO']
    TradeContext.RCVBNKNM  =  bil_dict['PAYBNKNM']
    
    TradeContext.BBSSRC  =  records['BBSSRC']
    TradeContext.OPRNO   =  records['OPRNO']
    
        
    AfaLoggerFunc.tradeDebug('>>>开始判断汇票操作类型')

    #=====判断TRCCO汇票操作类型====
    if TradeContext.TRCCO == '2100102':
        #=====汇票挂失====
        if TradeContext.SNDBNKCO != bil_dict['REMBNKCO']:
            return AfaFlowControl.ExitThisFlow('S999','汇票必须由签发行进行挂失')
        #=====判断汇票状态是否 签发 或者 解挂 状态====
        if not (bil_dict['HPSTAT'] == PL_HPSTAT_SIGN or bil_dict['HPSTAT'] == PL_HPSTAT_DEHG):
            return AfaFlowControl.ExitThisFlow('S999','汇票当前状态[' + bil_dict['HPSTAT'] + ']不允许进行挂失')
        
        #=====添加OPRNO  PL_HPOPRNO_GS 挂失====
        TradeContext.OPRNO   =  PL_HPOPRNO_GS
    elif TradeContext.TRCCO == '2100104':
        #=====汇票解挂====
        if TradeContext.SNDBNKCO != bil_dict['REMBNKCO']:
            return AfaFlowControl.ExitThisFlow('S999','汇票必须由挂失行进行解挂')
        #=====判断汇票状态是否 挂失 状态====
        if not bil_dict['HPSTAT'] == PL_HPSTAT_HANG:
            return AfaFlowControl.ExitThisFlow('S999','汇票当前状态[' + bil_dict['HPSTAT'] + ']不允许进行解挂')
            
        #=====添加OPRNO  PL_HPOPRNO_JG 解挂====
        TradeContext.OPRNO   =  PL_HPOPRNO_JG
    else:
        return AfaFlowControl.ExitThisFlow('S999','汇票操作类型错误')

    AfaLoggerFunc.tradeDebug('>>>结束判断汇票操作类型')

    #=====PL_BILTYP_CASH  0  现金====
    if bil_dict['BILTYP'] == PL_BILTYP_CASH:
        #=====现金汇票====
        TradeContext.ROPRTPNO  =  ''
    else:
        #=====转账汇票====
        TradeContext.ROPRTPNO  =  '21'

    AfaLoggerFunc.tradeDebug('>>>结束判断汇票类型')
    
    #=====字典赋值====
    TradeContext.DCFLG = PL_DCFLG_DEB

    bilbka_dict = {}
    if not rccpsMap8505CTradeContext2Dbilbka_dict.map(bilbka_dict):
        return AfaFlowControl.ExitThisFlow('S999','字典赋值出错')

    AfaLoggerFunc.tradeDebug('>>>结束字典赋值')
    AfaLoggerFunc.tradeDebug('>>>开始登记汇票业务信息登记簿')

    #=====登记汇票业务信息登记簿====
    if not rccpsDBFunc.insTransBil(bilbka_dict):
        return AfaFlowControl.ExitThisFlow('S999','登记汇票业务信息登记簿出错')

    AfaDBFunc.CommitSql()
    
    AfaLoggerFunc.tradeDebug('>>>结束登记汇票业务信息登记簿')
    AfaLoggerFunc.tradeDebug('>>>开始发送农信银中心')

    TradeContext.TRANTYP   = '0'                #传输类型
    TradeContext.OPRTYPNO  = PL_TRCCO_HP        #业务属性 PL_TRCCO_HP 21 汇票
    
    #begin 20110614 曾照泰 修改 送往农信银中心的票号为8位
    TradeContext.BILNO = TradeContext.BILNO[-8:]
    #end
    
    return True
Exemplo n.º 3
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8521]进入***' )

    #=====判断输入接口值是否存在====
    if(not TradeContext.existVariable("OPRTYPNO")):
        return AfaFlowControl.ExitThisFlow('A099', '业务种类[OPRTYPNO]不存在')
    if(not TradeContext.existVariable("PRTFLG")):
        return AfaFlowControl.ExitThisFlow('A099', '打印标志[PRTFLG]不存在')
    if(not TradeContext.existVariable("BJEDTE")):
        return AfaFlowControl.ExitThisFlow('A099', '交易日期[BJEDTE]不存在')
    if(not TradeContext.existVariable("BSPSQN")):
        return AfaFlowControl.ExitThisFlow('A099', '报单序号[BSPSQN]不存在')

    #=====PL_TRCCO_HP 21 汇票====    
    if(TradeContext.OPRTYPNO==PL_TRCCO_HP):
        AfaLoggerFunc.tradeInfo("进入汇票处理")
        
        #=====查询数据库====
        records = {}
        ret = rccpsDBFunc.getTransBil(TradeContext.BJEDTE,TradeContext.BSPSQN,records)
        if( ret == False):
            return AfaFlowControl.ExitThisFlow('A099', '无此数据')
        
        AfaLoggerFunc.tradeInfo("结束数据库查询")
        
        #=====判断是否为签发机构====
        AfaLoggerFunc.tradeInfo("开始判断当前机构是否为交易机构")
        if( records['BESBNO'] != TradeContext.BESBNO ):
            return AfaFlowControl.ExitThisFlow('S999', '未查找到数据')
            
        AfaLoggerFunc.tradeInfo("结束判断当前机构是否为交易机构")
               
        #=====判断当前业务是否为来帐====
        AfaLoggerFunc.tradeInfo("开始判断当前业务是否为来帐")
        if( records['BRSFLG'] == PL_BRSFLG_SND ):
            return AfaFlowControl.ExitThisFlow('S999', '该笔业务为往账业务,请使用[8522 往账凭证补打]交易打印')
        
        AfaLoggerFunc.tradeInfo("结束判断当前业务是否为来帐")
        
        #=====判断当前状态====
        AfaLoggerFunc.tradeInfo("开始判断当前状态")
#        if( records['BCSTAT'] != PL_MBRTRCST_ACSUC and records['BCSTAT'] != PL_BCSTAT_AUTO ):
#            return AfaFlowControl.ExitThisFlow('A099', "当前状态["+records['BCSTAT']+"]不允许打印")
        #=====pgt 0925 将记账成功改为自动挂账,来帐没有记账,增加判断交易成功的判断====
#        if( records['BCSTAT'] != PL_BCSTAT_HANG and records['BCSTAT'] != PL_BCSTAT_AUTO and records['BDWFLG'] != PL_BDWFLG_SUCC ):
#            return AfaFlowControl.ExitThisFlow('A099', "当前状态["+records['BCSTAT']+"]不允许打印")
        if not ((records['BCSTAT'] == PL_BCSTAT_HANG and records['BDWFLG'] == PL_BDWFLG_SUCC) or (records['BCSTAT'] == PL_BCSTAT_AUTO and records['BDWFLG'] == PL_BDWFLG_SUCC)):
            return AfaFlowControl.ExitThisFlow('A099', "当前状态["+records['BCSTAT']+"]["+records['BDWFLG']+"]不允许打印")
            
        AfaLoggerFunc.tradeInfo("结束判断当前状态")
        
        #=====判断打印状态====
        AfaLoggerFunc.tradeInfo("开始判断当前业务的打印状态")
        if(TradeContext.PRTFLG == "0" and int(records['PRTCNT']) > 0):   #打印,打印次数大于0
            return AfaFlowControl.ExitThisFlow('A099','打印次数大于1,请选择补打' )
        
        if(TradeContext.PRTFLG == "1" and int(records['PRTCNT']) == 0):  #补打,打印次数为0
            return AfaFlowControl.ExitThisFlow('A099','打印次数为0,请选择打印' ) 
            
        AfaLoggerFunc.tradeInfo("结束判断当前业务的打印状态")
        
        #=====查询汇票信息登记簿====
        AfaLoggerFunc.tradeInfo("开始查询汇票信息登记簿")
        bilinf_record = {}
        ret = rccpsDBFunc.getInfoBil(records['BILVER'],records['BILNO'],records['BILRS'],bilinf_record)
        if( ret == False ):
            return AfaFlowControl.ExitThisFlow('S999','查询汇票信息登记簿失败' ) 
        AfaLoggerFunc.tradeInfo("结束查询汇票信息登记簿")
        
        #=====输出接口====
        AfaLoggerFunc.tradeInfo("开始向输出接口赋值")
        TradeContext.PRTDAT     = AfaUtilTools.GetHostDate()     #打印日期
        TradeContext.PRTTIM     = AfaUtilTools.GetSysTime()      #打印时间
        TradeContext.BJEDTE     = records['BJEDTE']              #交易日期
        TradeContext.BSPSQN     = records['BSPSQN']              #报单序号
        TradeContext.BJETIM     = records['BJETIM']              #交易时间
        TradeContext.TRCCO      = records['TRCCO']               #交易代码
        TradeContext.OPRATTNO   = records['OPRATTNO']            #业务熟悉
        TradeContext.TRCDAT     = records['TRCDAT']              #委托日期
        TradeContext.TRCNO      = records['TRCNO']               #交易流水号          
        TradeContext.OCCAMT     = str(bilinf_record['BILAMT'])	 #交易金额        
        TradeContext.BILNO      = records['BILNO']               #汇票号码            
        TradeContext.PYRACC     = bilinf_record['PYRACC']        #付款人账号  
        TradeContext.PYRNAM     = bilinf_record['PYRNAM']        #付款人名称      
        TradeContext.PYRADDR    = bilinf_record['PYRADDR']       #付款人地址      
        TradeContext.PYEACC     = bilinf_record['PYEACC']        #收款人账号      
        TradeContext.PYENAM     = bilinf_record['PYENAM']        #收款人名称      
        TradeContext.PYEADDR    = bilinf_record['PYEADDR']       #收款人地址  
        TradeContext.SEAL       = bilinf_record['SEAL']          #汇票密压            
        TradeContext.TRDT       = records['TRDT']                #主机日期
        TradeContext.TLSQ       = records['TLSQ']                #主机流水号
        TradeContext.ACC1       = records['SBAC']                #借方账号
        TradeContext.ACC2       = records['RBAC']                #贷方账号
        TradeContext.ACC3       = ""                             #备用账号
        TradeContext.DASQ       = records['DASQ']                #销账序号
        TradeContext.SNDBNKCO   = records['SNDBNKCO']            #发送行号
        TradeContext.SNDBNKNM   = records['SNDBNKNM']            #发送行名
        TradeContext.RCVBNKCO   = records['RCVBNKCO']            #接收行号
        TradeContext.RCVBNKNM   = records['RCVBNKNM']            #接收行名
        TradeContext.USE        = bilinf_record['USE']           #用途
        TradeContext.REMARK     = bilinf_record['REMARK']        #备注
        TradeContext.PRTCNT     = str(int(records['PRTCNT'])+1)  #打印次数
        TradeContext.CUR        = bilinf_record['CUR']           #币种
        TradeContext.OPRNO      = records['OPRNO']               #业务类型
        TradeContext.RMNAMT     = str(bilinf_record['RMNAMT'])   #结余余额
        TradeContext.OCCAMT1    = str(bilinf_record['OCCAMT'])   #实际结算金额
        TradeContext.PAYBNKCO   = bilinf_record['PAYBNKCO']      #代理兑付行行号
        TradeContext.PAYBNKNM   = bilinf_record['PAYBNKNM']      #代理兑付行行名
        
        AfaLoggerFunc.tradeInfo("结束向输出结构赋值")
        
        #=====更新打印标志====
        AfaLoggerFunc.tradeInfo("开始更新打印标志")
        
        update_dict={'PRTCNT':records['PRTCNT']+1} 
        where_dict={'BJEDTE':records['BJEDTE'],'BSPSQN':records['BSPSQN'],'BCSTAT':records['BCSTAT']}
        
        rownum=rccpsDBTrcc_sstlog.update(update_dict,where_dict)
        if(rownum<=0):
            AfaDBFunc.RollbackSql()
            return AfaFlowControl.ExitThisFlow('A099','更新打印次数失败' )        	
        
        AfaDBFunc.CommitSql()
        
        AfaLoggerFunc.tradeInfo("结束更新打印标志")         
        AfaLoggerFunc.tradeInfo("结束汇票处理")
        
    #=====PL_TRCCO_HD 20 汇兑====
    elif(TradeContext.OPRTYPNO==PL_TRCCO_HD):
        AfaLoggerFunc.tradeInfo("进入汇兑处理")
        
        #=====查询数据库====
        records = {}
        ret = rccpsDBFunc.getTransTrc(TradeContext.BJEDTE,TradeContext.BSPSQN,records)
        if(ret==False):
            return AfaFlowControl.ExitThisFlow('A099','无此数据' )
            
        #=====判断是否为签发机构====
        AfaLoggerFunc.tradeInfo("开始判断当前机构是否为交易机构")
        if( records['BESBNO'] != TradeContext.BESBNO ):
            return AfaFlowControl.ExitThisFlow('S999', '为查找到数据')
            
        AfaLoggerFunc.tradeInfo("结束判断当前机构是否为交易机构")
        
        #=====刘雨龙 20080702 判断当前业务是否为来账业务====
        if records['BRSFLG'] == PL_BRSFLG_SND:
            return AfaFlowControl.ExitThisFlow('S999','报单序号['+TradeContext.BSPSQN+']该笔业务为往账业务,不允许打印')
        
        #=====判断当前状态====
        #=====pgt 0925 增加判断交易成功的判断====
#        if records['BCSTAT'] != PL_BCSTAT_HANG and records['BCSTAT'] != PL_BCSTAT_AUTO and records['BCSTAT'] != PL_BCSTAT_QTR and records['BDWFLG'] != PL_BDWFLG_SUCC :
#            return AfaFlowControl.ExitThisFlow('A099',"当前状态[" + records['BCSTAT'] + "]不允许打印")
        if not ((records['BCSTAT'] == PL_BCSTAT_HANG and records['BDWFLG'] == PL_BDWFLG_SUCC) or (records['BCSTAT'] == PL_BCSTAT_AUTO and records['BDWFLG'] == PL_BDWFLG_SUCC) or (records['BCSTAT'] == PL_BCSTAT_QTR and records['BDWFLG'] == PL_BDWFLG_SUCC)):
            return AfaFlowControl.ExitThisFlow('A099',"当前状态[" + records['BCSTAT'] + "]["+records['BDWFLG']+"]不允许打印")
                
        if(TradeContext.PRTFLG == "0" and int(records['PRTCNT']) > 0):   #打印,打印次数大于0
            return AfaFlowControl.ExitThisFlow('A099','打印次数大于1,请选择补打' )
        
        if(TradeContext.PRTFLG == "1" and int(records['PRTCNT']) == 0):  #补打,打印次数为0
            return AfaFlowControl.ExitThisFlow('A099','打印次数未0,请选择打印' )
        
        AfaLoggerFunc.tradeInfo("判断打印标志结束")
        
        #=====输出接口====
        TradeContext.PRTDAT   =  AfaUtilTools.GetHostDate()     #打印日期
        TradeContext.PRTTIM   =  AfaUtilTools.GetSysTime()      #打印时间
        TradeContext.BJEDTE   =  records['BJEDTE']              #交易日期
        TradeContext.BSPSQN   =  records['BSPSQN']              #交易序号
        TradeContext.BJETIM   =  records['BJETIM']              #交易时间
        TradeContext.TRCCO    =  records['TRCCO']               #业务类型
        TradeContext.OPRATTNO =  records['OPRATTNO']            #业务属性
        TradeContext.TRCDAT   =  records['TRCDAT']              #委托日期
        TradeContext.TRCNO    =  records['TRCNO']               #交易流水号
        TradeContext.OCCAMT   =  str(records['OCCAMT'])         #交易金额
        TradeContext.BILNO    =  records['BILNO']               #汇票号码
        TradeContext.PYRACC   =  records['PYRACC']              #付款人账号
        TradeContext.PYRNAM   =  records['PYRNAM']              #付款人名称
        TradeContext.PYRADDR  =  records['PYRADDR']             #付款人地址
        TradeContext.PYEACC   =  records['PYEACC']              #收款人账号
        TradeContext.PYENAM   =  records['PYENAM']              #收款人名称
        TradeContext.PYEADDR  =  records['PYEADDR']             #收款人地址
        TradeContext.SEAL     =  records['SEAL']                #汇票密压
        
        #=====PL_BCSTAT_QTR  80 退汇====
        if records['BCSTAT'] == PL_BCSTAT_QTR:
            #=====退汇业务,返回挂账状态的状态详细信息====
            stat_dict = {}
            if not rccpsState.getTransStateSet(records['BJEDTE'],records['BSPSQN'],PL_BCSTAT_HANG,PL_BDWFLG_SUCC,stat_dict):
                return AfaFlowControl.ExitThisFlow('A099','查询交易自动挂账状态异常' )
            
            TradeContext.TRDT = stat_dict['TRDT']               #主机日期
            TradeContext.TLSQ = stat_dict['TLSQ']               #主机流水号
            TradeContext.ACC1 = stat_dict['SBAC']               #借方账号
            TradeContext.ACC2 = stat_dict['RBAC']               #贷方账号
            TradeContext.ACC3 = ""                              #备用账号
            TradeContext.DASQ = stat_dict['DASQ']               #销账序号
        else:
            #=====非退汇业务,返回当前状态的状态详细信息====
            TradeContext.TRDT = records['TRDT']	                #主机日期
            TradeContext.TLSQ = records['TLSQ']	                #主机流水号
            TradeContext.ACC1 = records['SBAC']                 #借方账号
            TradeContext.ACC2 = records['RBAC']                 #贷方账号
            TradeContext.ACC3 = ""                              #备用账号
            TradeContext.DASQ = records['DASQ']                 #销账序号
            
        TradeContext.SNDBNKCO = records['SNDBNKCO']             #发送行号
        TradeContext.SNDBNKNM = records['SNDBNKNM']             #发送行名
        TradeContext.RCVBNKCO = records['RCVBNKCO']             #接收行号
        TradeContext.RCVBNKNM = records['RCVBNKNM']             #接收行名
        TradeContext.USE      = records['USE']                  #用途
        TradeContext.REMARK   = records['REMARK']               #备注
        TradeContext.PRTCNT   = str(int(records['PRTCNT'])+1)   #打印次数
        TradeContext.OPRNO    = records['OPRNO']                #业务类型
        TradeContext.CUR      = records['CUR']                  #币种
        TradeContext.OCCAMT   = str(records['OCCAMT'])          #业务属性
        
        #=====更新打印标志====
        AfaLoggerFunc.tradeInfo("开始更新打印标志")
        
        update_dict={'PRTCNT':records['PRTCNT']+1}        
        where_dict={'BJEDTE':records['BJEDTE'],'BSPSQN':records['BSPSQN'],'BCSTAT':records['BCSTAT']}
        
        rownum=rccpsDBTrcc_sstlog.update(update_dict,where_dict)
        if(rownum<=0):
            AfaDBFunc.RollbackSql()
            return AfaFlowControl.ExitThisFlow('A099','更新打印次数失败' )        	
        
        AfaDBFunc.CommitSql()
    else:
        return AfaFlowControl.ExitThisFlow('A099','业务类型错')
        
    TradeContext.errorCode="0000"
    TradeContext.errorMsg="查询成功"
    
    AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8521]退出***' )

    return True
Exemplo n.º 4
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( "进入查询 ")
    #=====判断接口是否存在====
    if( not TradeContext.existVariable( "BOJEDT" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '无报单日期,处理失败')
    if( not TradeContext.existVariable( "BOSPSQ" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '无交易序号,处理失败')
    if( not TradeContext.existVariable( "CONT" ) ):
        return AfaFlowControl.ExitThisFlow('A099', '无查询内容,处理失败')
    
    #=====判断业务类型=====
    AfaLoggerFunc.tradeInfo("开始判断业务类型")
    
    if( TradeContext.OPRTYPNO == '20' ):    #汇兑
        AfaLoggerFunc.tradeInfo("进入汇兑处理")
            
        #=====查询数据库====
        trcbka_dict = {}
        res=rccpsDBFunc.getTransTrc(TradeContext.BOJEDT,TradeContext.BOSPSQ,trcbka_dict)
        if(res==False):
            return AfaFlowControl.ExitThisFlow('S999','数据库中无记录') 
        
        #=====刘雨龙 2008-07-21 新增往来账标志判断====
        if trcbka_dict['BRSFLG']  ==  PL_BRSFLG_RCV:
            return AfaFlowControl.ExitThisFlow('S999','非往帐业务不允许此操作')
        
        ztcbka_dict={}
        #=====设置插入字典====
        if not rccpsMap8529Dtrcbka_dict2Dztcbka_dict.map(trcbka_dict,ztcbka_dict):
            return AfaFlowControl.ExitThisFlow('M999','字典赋值错误')
 
        ztcbka_dict['CONT']=TradeContext.CONT   #手工添加的字段
        #=====刘雨龙 20080702 修改交易日期和报单序号====
        ztcbka_dict['BJEDTE']   =  TradeContext.BJEDTE
        ztcbka_dict['BSPSQN']   =  TradeContext.BSPSQN
        ztcbka_dict['ORTRCCO']  =  ztcbka_dict['TRCCO']
        ztcbka_dict['NCCWKDAT'] =  TradeContext.NCCworkDate
        ztcbka_dict['TRCCO']    =  "9900506"             #9900506 止付业务状态查询
        ztcbka_dict['TRCNO']    =  TradeContext.SerialNo
        ztcbka_dict['SNDMBRCO'] =  TradeContext.SNDSTLBIN
        ztcbka_dict['RCVMBRCO'] =  TradeContext.RCVSTLBIN
        ztcbka_dict['ISDEAL']   =  PL_ISDEAL_UNDO
        ztcbka_dict['BOJEDT']   =  TradeContext.BOJEDT
        ztcbka_dict['BOSPSQ']   =  TradeContext.BOSPSQ
    
        AfaLoggerFunc.tradeInfo("ztcbka_dict:"+str(ztcbka_dict))
        
        #=====插入数据库====
        AfaLoggerFunc.tradeInfo("开始插入数据库")
        #=====刘雨龙 20080702 修改insert_dict为ztcbka_dict====
        rowcount=rccpsDBTrcc_ztcbka.insertCmt(ztcbka_dict)
        if(rowcount==-1):
            return AfaFlowControl.ExitThisFlow('A099','插入数据库失败' )
    
        #=====刘雨龙 20080702 新增发送农信银中心字段====
        TradeContext.ORTRCCO  = ztcbka_dict['ORTRCCO']
        TradeContext.ORTRCDAT = ztcbka_dict['TRCDAT']
        TradeContext.ORTRCNO  = ztcbka_dict['TRCNO']
        TradeContext.ORSNDBNK = ztcbka_dict['SNDBNKCO']
        TradeContext.ORRCVBNK = ztcbka_dict['RCVBNKCO']
        TradeContext.OROCCAMT = str(ztcbka_dict['OCCAMT'])
        #TradeContext.OPRTYPNO = TradeContext.OPRTYPNO[0:2]
        TradeContext.OPRTYPNO = '99'
        TradeContext.ROPRTPNO = TradeContext.ORTRCCO[0:2]
        
        
    elif( TradeContext.OPRTYPNO == '21' ):    #汇票
        AfaLoggerFunc.tradeInfo("进入汇票处理")
        
        #=====查询数据库====
        bilbka_dict = {}
        res = rccpsDBFunc.getTransBil(TradeContext.BOJEDT,TradeContext.BOSPSQ,bilbka_dict)
        if( res == False ):
            return AfaFlowControl.ExitThisFlow('S999','数据库中无记录')
            
        #=====判断往来标志====
        if( bilbka_dict['BRSFLG'] == PL_BRSFLG_RCV ):
            return AfaFlowControl.ExitThisFlow('S999','非往帐业务不允许此操作')
        
        #=====查询汇票信息登记簿====
        bilinf_dict = {}
        ret = rccpsDBFunc.getInfoBil(bilbka_dict['BILVER'],bilbka_dict['BILNO'],bilbka_dict['BILRS'],bilinf_dict)
        if( ret == False ):
            return AfaFlowControl.ExitThisFlow('S999','汇票信息登记簿中无记录')
        
        #=====给插入字典赋值====
#        ztcbka_dict={}
#        if not rccpsMap8529Dbilbka2Dztcbka.map(bilbka_dict,ztcbka_dict):
#            return AfaFlowControl.ExitThisFlow('M999','字典赋值错误')
        AfaLoggerFunc.tradeInfo("开始给插入字典赋值")
        ztcbka_dict = {}
        
        ztcbka_dict['BJEDTE']   = TradeContext.BJEDTE
        ztcbka_dict['BSPSQN']   = TradeContext.BSPSQN
        ztcbka_dict['BRSFLG']   = PL_BRSFLG_SND
        ztcbka_dict['BESBNO']   = TradeContext.BESBNO
        ztcbka_dict['BEACSB']   = ""
        ztcbka_dict['BETELR']   = TradeContext.BETELR
        ztcbka_dict['BEAUUS']   = ""
        ztcbka_dict['NCCWKDAT'] = TradeContext.NCCworkDate
        ztcbka_dict['TRCCO']    = '9900506'
        ztcbka_dict['TRCDAT']   = TradeContext.TRCDAT
        ztcbka_dict['TRCNO']    = TradeContext.SerialNo
        ztcbka_dict['SNDMBRCO'] = bilbka_dict['SNDMBRCO']
        ztcbka_dict['RCVMBRCO'] = bilbka_dict['RCVMBRCO']
        ztcbka_dict['SNDBNKCO'] = TradeContext.SNDBNKCO
        ztcbka_dict['SNDBNKNM'] = TradeContext.SNDBNKNM
        ztcbka_dict['RCVBNKCO'] = bilbka_dict['RCVBNKCO']
        ztcbka_dict['RCVBNKNM'] = bilbka_dict['RCVBNKNM']
        ztcbka_dict['BOJEDT']   = bilbka_dict['BJEDTE']
        ztcbka_dict['BOSPSQ']   = bilbka_dict['BSPSQN']
        ztcbka_dict['ORTRCCO']  = bilbka_dict['TRCCO']
        ztcbka_dict['CUR']      = bilinf_dict['CUR']
        #=====判断业务状态====
        if( bilbka_dict['HPSTAT'] == PL_HPSTAT_PAYC ):  #解付
            ztcbka_dict['OCCAMT'] = bilinf_dict['OCCAMT']
        else:
            ztcbka_dict['OCCAMT'] = bilinf_dict['BILAMT']
        ztcbka_dict['CONT']     = TradeContext.CONT
        ztcbka_dict['NCCTRCST'] = ""
        ztcbka_dict['MBRTRCST'] = ""
        ztcbka_dict['ISDEAL']   = PL_ISDEAL_UNDO
        ztcbka_dict['PRCCO']    = ""
        ztcbka_dict['STRINFO']  = ""
        ztcbka_dict['NOTE1']    = bilbka_dict['NOTE1']
        ztcbka_dict['NOTE2']    = bilbka_dict['NOTE2']
        ztcbka_dict['NOTE3']    = bilbka_dict['NOTE3']
        ztcbka_dict['NOTE4']    = bilbka_dict['NOTE4']
        
        AfaLoggerFunc.tradeInfo("OCCAMT="+str(bilinf_dict['OCCAMT']))
        
        #=====登记业务状态查询查复登记簿====
        AfaLoggerFunc.tradeInfo("开始插入业务状态查询查复登记簿")
        rowcount=rccpsDBTrcc_ztcbka.insertCmt(ztcbka_dict)
        if(rowcount==-1):
            return AfaFlowControl.ExitThisFlow('A099','插入数据库失败' )
            
        #=====给业务状态查询报文赋值====
        AfaLoggerFunc.tradeInfo("开始给业务状态查询报文赋值")
        #=====报文头====
        TradeContext.NCCWKDAT = TradeContext.NCCworkDate
        TradeContext.RCVMBRCO = bilbka_dict['RCVMBRCO']
        TradeContext.RCVSTLBIN = bilbka_dict['RCVMBRCO']
        TradeContext.SNDSTLBIN = TradeContext.SNDSTLBIN
        TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN
        TradeContext.SNDBRHCO = TradeContext.BESBNO
        TradeContext.SNDCLKNO = TradeContext.BETELR
#        TradeContext.SNDTRDAT = TradeContext.BJEDTE
#        TradeContext.SNDTRTIM = TradeContext.BJETIM
        TradeContext.ORMFN    = TradeContext.RCVSTLBIN+TradeContext.BJEDTE+TradeContext.SerialNo
        TradeContext.OPRTYPNO = '99'
        TradeContext.ROPRTPNO = '21'
        TradeContext.TRANTYP  = '0'
        #=====业务要素集====
        TradeContext.TRCCO    = '9900506'
#        TradeContext.SNDBNKCO = 
#        TradeContext.SNDBNKNM = 
        TradeContext.RCVBNKCO = bilbka_dict['RCVBNKCO']
        TradeContext.RCVBNKNM = bilbka_dict['RCVBNKNM']
        TradeContext.TRCDAT   = TradeContext.BJEDTE
        TradeContext.TRCNO    = TradeContext.SerialNo
        TradeContext.ORTRCCO  = bilbka_dict['TRCCO']
        TradeContext.ORTRCDAT = bilbka_dict['TRCDAT']
        TradeContext.ORTRCNO  = bilbka_dict['TRCNO']
        TradeContext.ORSNDBNK = bilbka_dict['SNDBNKCO']
        TradeContext.ORRCVBNK = bilbka_dict['RCVBNKCO']
        TradeContext.ORCUR    = bilinf_dict['CUR']        #11
        TradeContext.OROCCAMT = str(bilinf_dict['OCCAMT'])
        
        AfaLoggerFunc.tradeInfo("支付业务状态查询,汇票处理结束")
        
    #=====通存通兑=====
    elif( TradeContext.OPRTYPNO == '30' ):
        AfaLoggerFunc.tradeInfo("开始通存通兑处理")
        
        #=====判断要查询的交易是否为当日交易====
        if( TradeContext.BOJEDT != TradeContext.BJEDTE ):
            return AfaFlowControl.ExitThisFlow('A009','原交易不是当日交易')
        
        #=====查询通存通兑业务登记簿====
        AfaLoggerFunc.tradeInfo("查询通存通兑业务登记簿")
        where_dict = {'BJEDTE':TradeContext.BOJEDT,'BSPSQN':TradeContext.BOSPSQ}
        wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(where_dict)
        if( wtrbka_dict == None ):
            return AfaFlowControl.ExitThisFlow('A009','查询通存通兑业务登记簿失败')
            
        if( len(wtrbka_dict) == 0 ):
            return AfaFlowControl.ExitThisFlow('A009','查询通存通兑业务登记簿结果为空') 
            
        #=====判断要查询的交易是否是本机构发起的====
        AfaLoggerFunc.tradeInfo("判断要查询的交易是否是本机构发起的")
        if( wtrbka_dict['BESBNO'] != TradeContext.BESBNO ):
            return AfaFlowControl.ExitThisFlow('A009','要查询的交易不是本机构发起的') 
            
        #=====登记业务状态查询查复登记簿====
        AfaLoggerFunc.tradeInfo("登记业务状态查询查复登记簿")
        
        #=====给插入字典赋值====
        AfaLoggerFunc.tradeInfo("给插入字典赋值")
        ztcbka_dict = {}
        ztcbka_dict['BJEDTE']   = TradeContext.BJEDTE
        ztcbka_dict['BSPSQN']   = TradeContext.BSPSQN
        ztcbka_dict['BRSFLG']   = PL_BRSFLG_SND
        ztcbka_dict['BESBNO']   = TradeContext.BESBNO
        ztcbka_dict['BEACSB']   = ""
        ztcbka_dict['BETELR']   = TradeContext.BETELR
        ztcbka_dict['BEAUUS']   = ""
        ztcbka_dict['NCCWKDAT'] = TradeContext.NCCworkDate
        ztcbka_dict['TRCCO']    = '9900506'
        ztcbka_dict['TRCDAT']   = TradeContext.TRCDAT
        ztcbka_dict['TRCNO']    = TradeContext.SerialNo
        ztcbka_dict['SNDMBRCO'] = wtrbka_dict['SNDMBRCO']
        ztcbka_dict['RCVMBRCO'] = wtrbka_dict['RCVMBRCO']
        ztcbka_dict['SNDBNKCO'] = TradeContext.SNDBNKCO
        ztcbka_dict['SNDBNKNM'] = TradeContext.SNDBNKNM
        ztcbka_dict['RCVBNKCO'] = wtrbka_dict['RCVBNKCO']
        ztcbka_dict['RCVBNKNM'] = wtrbka_dict['RCVBNKNM']
        ztcbka_dict['BOJEDT']   = wtrbka_dict['BJEDTE']
        ztcbka_dict['BOSPSQ']   = wtrbka_dict['BSPSQN']
        ztcbka_dict['ORTRCCO']  = wtrbka_dict['TRCCO']
        ztcbka_dict['CUR']      = wtrbka_dict['CUR']
        ztcbka_dict['OCCAMT']   = wtrbka_dict['OCCAMT']
        ztcbka_dict['CONT']     = TradeContext.CONT
        ztcbka_dict['NCCTRCST'] = ""
        ztcbka_dict['MBRTRCST'] = ""
        ztcbka_dict['ISDEAL']   = PL_ISDEAL_UNDO
        ztcbka_dict['PRCCO']    = ""
        ztcbka_dict['STRINFO']  = ""
        ztcbka_dict['NOTE1']    = wtrbka_dict['NOTE1']
        ztcbka_dict['NOTE2']    = wtrbka_dict['NOTE2']
        ztcbka_dict['NOTE3']    = wtrbka_dict['NOTE3']
        ztcbka_dict['NOTE4']    = wtrbka_dict['NOTE4']
        
        AfaLoggerFunc.tradeInfo("开始插入业务状态查询查复登记簿")
        rowcount=rccpsDBTrcc_ztcbka.insertCmt(ztcbka_dict)
        if(rowcount==-1):
            return AfaFlowControl.ExitThisFlow('A099','插入数据库失败' )
        
        #=====开始给也务状态查询报文赋值====
        #=====报文头====
        TradeContext.MSGTYPCO  = "SET008"
        TradeContext.NCCWKDAT  = TradeContext.NCCworkDate
        TradeContext.RCVMBRCO  = wtrbka_dict['RCVMBRCO']
        TradeContext.RCVSTLBIN = wtrbka_dict['RCVMBRCO']
        TradeContext.SNDSTLBIN = TradeContext.SNDSTLBIN
        TradeContext.SNDMBRCO  = TradeContext.SNDSTLBIN
        TradeContext.SNDBRHCO  = TradeContext.BESBNO
        TradeContext.SNDCLKNO  = TradeContext.BETELR
#        TradeContext.SNDTRDAT  = TradeContext.BJEDTE
#        TradeContext.SNDTRTIM  = TradeContext.BJETIM
        TradeContext.ORMFN     = wtrbka_dict['MSGFLGNO']
        TradeContext.OPRTYPNO  = '99'
        TradeContext.ROPRTPNO  = '30'
        TradeContext.TRANTYP   = '0'
        #=====业务要素集====
        TradeContext.TRCCO    = '9900506'
#        TradeContext.SNDBNKCO = 
#        TradeContext.SNDBNKNM = 
        TradeContext.RCVBNKCO = wtrbka_dict['RCVBNKCO']
        TradeContext.RCVBNKNM = wtrbka_dict['RCVBNKNM']
#        TradeContext.TRCDAT   = TradeContext.BJEDTE
        TradeContext.TRCNO    = TradeContext.SerialNo
        TradeContext.ORTRCCO  = wtrbka_dict['TRCCO']
        TradeContext.ORTRCDAT = wtrbka_dict['TRCDAT']
        TradeContext.ORTRCNO  = wtrbka_dict['TRCNO']
        TradeContext.ORSNDBNK = wtrbka_dict['SNDBNKCO']
        TradeContext.ORRCVBNK = wtrbka_dict['RCVBNKCO']
        TradeContext.ORCUR    = wtrbka_dict['CUR']        #11
        TradeContext.OROCCAMT = str(wtrbka_dict['OCCAMT'])
#        TradeContext.CONT     = 
    else:
        return AfaFlowControl.ExitThisFlow('S999','业务类型错误')
        
        
    return True