Example #1
0
def Query():
    try:
        if( TradeContext.existVariable( "BRNO" ) and len(TradeContext.BRNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[分行行号]:不能为空')
        sql="SELECT BRNO,PAYBKCODE,BANKNO,BANKACCT,BANKNAME,PAYEEBANKNO,STATUS,ACCNO,NOTE1,NOTE2,NOTE3,NOTE4,NOTE5 "
        sql=sql+" FROM TIPS_BRANCH_ADM WHERE 1=1 "
        sql=sql+"AND BRNO='"+ TradeContext.BRNO+"'"
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.SelectSql(sql)
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        elif( len( records )==0 ):
            return AfaFlowControl.ExitThisFlow( 'A0027', '未定义信息' )
        elif( len( records )>1 ):
            return AfaFlowControl.ExitThisFlow( 'A0027', 'TIPS_BRANCH_ADM表配置错误' )
        else:
            #if records[0][5]=='0':
               # return AfaFlowControl.ExitThisFlow( 'A0027', '业务已停止' )
          #  if records[0][5]=='2':
           #     return AfaFlowControl.ExitThisFlow( 'A0027', '业务已暂停' )
            TradeContext.BRNO        = records[0][0]
            TradeContext.PAYBKCODE   = records[0][1]
            TradeContext.BANKNO      = records[0][2]
            TradeContext.BANKACCT    = records[0][3]
            TradeContext.BANKNAME    = records[0][4]
            TradeContext.PAYEEBANKNO = records[0][5]
            TradeContext.STATUS      = records[0][6]
            TradeContext.ACCNO       = records[0][7]
            TradeContext.ACCNAME     = records[0][10]
            
        return True
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Example #2
0
def SubModuleDoFst( ):
     
    AfaLoggerFunc.tradeInfo( '反交易变量值的有效性校验' )
   
    #交易代码
    TradeContext.tradeCode = TradeContext.TransCode
    
    if( not TradeContext.existVariable( "PreSerialno" ) ):
        return AfaFlowControl.ExitThisFlow( 'A0001', '原交易流水号[PreSerialno]值不存在!' )
   
    if( not TradeContext.existVariable( "channelCode" ) ):
        return AfaFlowControl.ExitThisFlow( 'A0001', '渠道代码[channelCode]值不存在!' )
    
    if( TradeContext.channelCode == '005' ):
        
        if( not TradeContext.existVariable( "tellerno" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '柜员号[tellerno]值不存在!' )
        
        if( not TradeContext.existVariable( "brno" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '网点号[brno]值不存在!' )
        
        if( not TradeContext.existVariable( "termid" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '柜员号[termid]值不存在!' )
    
    return True
Example #3
0
def Delete():
    try:
        if( TradeContext.existVariable( "busiNo" ) and len(TradeContext.busiNo)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[单位编码]:不能为空')
        
        sql="DELETE "
        sqlstr1=sql+" FROM fs_businoconf WHERE 1=1 "
        sqlstr1=sqlstr1+"AND busiNo='"+ TradeContext.busiNo+"'"
        
        AfaLoggerFunc.tradeInfo(sqlstr1)
        records = AfaDBFunc.DeleteSqlCmt(sqlstr1)
        if( records == None or records <=0 ):
            AfaLoggerFunc.tradeFatal(sqlstr1)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            
        
        sql="DELETE "
        sqlstr2=sql+" FROM fs_remain WHERE 1=1 "
        sqlstr2=sqlstr2+"AND busiNo='"+ TradeContext.busiNo+"'"
        
        AfaLoggerFunc.tradeInfo(sqlstr2)
        records = AfaDBFunc.DeleteSqlCmt(sqlstr2)
        if( records == None or records <=0 ):
            AfaLoggerFunc.tradeFatal(sqlstr2)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        return True
        
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Example #4
0
def getTransStateSetm(BJEDTE,BSPSQN,BCSTAT,BDWFLG,stat_list):
    AfaLoggerFunc.tradeInfo(">>>进入getTransStateSetm")
    
    #==========获取sstlog对应状态及信息=========================================
    sstlog_where_sql = "BJEDTE LIKE '" + BJEDTE + "' and BSPSQN LIKE '" + BSPSQN + "' and BCSTAT LIKE '" + BCSTAT + "' and BDWFLG LIKE '" + BDWFLG + "'"
    
    sstlog_order_sql = 'order by BCURSQ desc'
    
    sstlog_list = rccpsDBTrcc_sstlog.selectm(1,0,sstlog_where_sql,sstlog_order_sql)
    
    if sstlog_list == None:
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        AfaLoggerFunc.tradeFatal("获取交易[" + BJEDTE + "][" + BSPSQN + "]指定状态详细信息异常")
        return AfaFlowControl.ExitThisFlow( 'S999', '获取交易指定状态详细信息异常' )
        
    if len(sstlog_list) <= 0:
        AfaLoggerFunc.tradeFatal("流水状态登记簿中无此交易" + BJEDTE + "][" + BSPSQN + "]指定状态[" + BCSTAT + "][" + BDWFLG + "]详细信息")
        return AfaFlowControl.ExitThisFlow( 'S999', '流水状态登记簿中无此交易指定状态详细信息' )
        
    for i in xrange(0,len(sstlog_list)):
        stat_dict = {}
        if not rccpsMap0000Dsstlog2Dstat_dict.map(sstlog_list[i],stat_dict):
            AfaLoggerFunc.tradeFatal("将查询出的业务状态详细信息赋值到输出字典异常")
            return AfaFlowControl.ExitThisFlow( 'S999', '将查询出的业务状态详细信息赋值到输出字典异常' )
        stat_list.append(stat_dict)
    
    AfaLoggerFunc.tradeInfo(">>>结束getTransStateSetm")
    return True
Example #5
0
def GetRBSQ( BRSFLG, seqName="RCCPS_SEQ" ):

    AfaLoggerFunc.tradeDebug( '>>>获取前置流水号' )
    #=====是否为往账业务====
    if BRSFLG == PL_BRSFLG_SND:
        #=====判断机构号是否存在====
        if( not TradeContext.existVariable( "BESBNO" ) ):
            raise AfaFlowControl.ExitThisFlow('M999','无机构号,处理失败' )

    #=====往账机构号取第3-6位====
    TradeContext.Serialno = TradeContext.BESBNO[2:6]

    AfaLoggerFunc.tradeDebug('>>>开始判断交易代码')
    #====判断交易代码是否存在(中心7位代码)====
    if( not TradeContext.existVariable( "TRCCO" ) ):
        raise AfaFlowControl.ExitThisFlow('M999','交易代码[TRCCO]字段值不存在' )
    #=====判断业务类型,根据交易取不同类型====
    AfaLoggerFunc.tradeDebug('>>>开始判断业务类型')
    if not GetTRCCO():
        raise AfaFlowControl.ExitThisFlow('M999','取业务类型失败' )
    #=====生成流水号====
    AfaLoggerFunc.tradeInfo('>>>开始生成前置流水号')
    sqlStr = "SELECT NEXTVAL FOR " + seqName + " FROM SYSIBM.SYSDUMMY1"
    records = AfaDBFunc.SelectSql( sqlStr )
    if records == None :
        raise AfaFlowControl.ExitThisFlow('A0025', AfaDBFun.sqlErrMsg )
    #左补"0"(6位)
    #=====流水号规则:4位机构号+1位业务类型+1位往来账标志+6位顺序号
    TradeContext.RBSQ=TradeContext.Serialno+BRSFLG+str(records[0][0]).rjust(6,'0' )

    AfaLoggerFunc.tradeInfo( '>>>前置流水号' + TradeContext.RBSQ )

    return str( records[0][0] )
Example #6
0
def start():
    try:
        AfaLoggerFunc.tradeInfo('RunSign='+TradeContext.RunSign+' 启用调度')
        if( TradeContext.existVariable( "BackRunTime" ) and len(TradeContext.BackRunTime)<=0 ):
            return TipsFunc.ExitThisFlow( 'A0001', '[BackRunTime]值不存在!' )
        
        year=(TradeContext.BackRunTime)[0:4]
        month=(TradeContext.BackRunTime)[4:6]
        day=(TradeContext.BackRunTime)[6:8]
        hour=(TradeContext.BackRunTime)[8:10]
        minute=(TradeContext.BackRunTime)[10:12]
            
        sql="UPDATE AFA_CRONADM              "
        sql=sql+" SET YEAR = '"+year+"',     "
        sql=sql+"     MONTH = '"+month+"',   "
        sql=sql+"     DAY = '"+day+"',       "
        sql=sql+"     HOUR = '"+hour+"',     "
        sql=sql+"     MINUTE = '"+minute+"', "
        sql=sql+"     STATUS = '1'           "
        sql=sql+" WHERE TASKID = '00050'     "
            
        AfaLoggerFunc.tradeInfo(sql)
        
        records = AfaDBFunc.UpdateSqlCmt(sql)
        if( records <=0  ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0027', '未发现调度信息:'+AfaDBFunc.sqlErrMsg )
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
      
        return True
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))         
Example #7
0
def Delete():
    try:
        if( TradeContext.existVariable( "BRNO" ) and len(TradeContext.BRNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[分行行号]:不能为空')

        sql="SELECT BRNO,PAYBKCODE,BANKNO,BANKACCT,BANKNAME,PAYEEBANKNO,STATUS,ACCNO,NOTE1,NOTE2,NOTE3,NOTE4,NOTE5 "
        sql=sql+" FROM TIPS_BRANCH_ADM WHERE 1=1 "
        sql=sql+"AND BRNO='"+ TradeContext.BRNO+"'"
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.SelectSql(sql)
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        elif( len( records ) == 0 ):
            return AfaFlowControl.ExitThisFlow( 'A0027', '不存在此上线行信息' )

            
        sql="DELETE "
        sql=sql+" FROM TIPS_BRANCH_ADM WHERE 1=1 "
        if( TradeContext.existVariable( "BRNO" ) and len(TradeContext.BRNO)>0):
            sql=sql+"AND BRNO='"+ TradeContext.BRNO+"'"
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.DeleteSqlCmt(sql)
        if( records == None or records <=0 ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        return True
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Example #8
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('交易后处理')
    
    AfaLoggerFunc.tradeInfo('errorCode:' + TradeContext.errorCode)
    AfaLoggerFunc.tradeInfo('errorMsg:' + TradeContext.errorMsg)
    
    #=====判断AFE是否发送成功====
    if TradeContext.errorCode != '0000':
        #=====更改中心返回码,和附言====
        AfaLoggerFunc.tradeInfo("开始更新错帐控制解控登记簿")
        update_dict = {'PRCCO':'RCCS1105','STRINFO':'AFE发送失败'}                 #返回码,返回码对应的信息描述
        where_dict = {'TRCDAT':TradeContext.TRCDAT,'BSPSQN':TradeContext.BSPSQN}   #系统日期,平台流水号(报文编号)
        res = rccpsDBTrcc_acckj.updateCmt(update_dict,where_dict)
        if( res == -1 ):
            return AfaFlowControl.ExitThisFlow('A009','更新错帐控制解控登记簿失败')
           
        return AfaFlowControl.ExitThisFlow(TradeContext.errorCode,'向中心发送错帐控制解控请求报文失败')
    
    else:
        AfaLoggerFunc.tradeInfo('发送成功')
        
        update_dict = {'PRCCO':'RCCS1000','STRINFO':'AFE发送成功'}   #返回码,返回码对应的信息描述               
        where_dict = {'TRCDAT':TradeContext.TRCDAT,'BSPSQN':TradeContext.BSPSQN} #系统日期,平台流水号(报文编号) 
        res = rccpsDBTrcc_acckj.updateCmt(update_dict,where_dict)                                                
        if( res == -1 ):                                                                                         
            return AfaFlowControl.ExitThisFlow('A009','更新错帐控制解控登记簿失败')                              
                                                                                                                 
        AfaLoggerFunc.tradeInfo('交易后处理 结束')
    
        AfaLoggerFunc.tradeInfo("'***农信银系统:通存通兑往账交易.错帐控制解控[8595] 退出")
    
        return True
Example #9
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('交易后处理')
    
    AfaLoggerFunc.tradeInfo('errorCode:' + TradeContext.errorCode)
    AfaLoggerFunc.tradeInfo('errorMsg:' + TradeContext.errorMsg)
    
    #=====判断AFE是否发送成功====
    if TradeContext.errorCode != '0000':
        #=====更改中心返回码,和附言====
        AfaLoggerFunc.tradeInfo("开始更新余额查询登记簿")
        update_dict = {'PRCCO':'RCCS1105','STRINFO':'AFE发送失败'}
        where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN}
        res = rccpsDBTrcc_balbka.updateCmt(update_dict,where_dict)
        if( res == -1 ):
            return AfaFlowControl.ExitThisFlow('A009','更新余额查询登记簿失败')
           
        return AfaFlowControl.ExitThisFlow(TradeContext.errorCode,'向中心发送余额查询请求报文失败')
    
    else:
        AfaLoggerFunc.tradeInfo('发送成功')
        
        TradeContext.errorCode = '0000'
        TradeContext.errorMsg  = '交易成功'
        
    AfaLoggerFunc.tradeInfo('交易后处理 结束')
    
    AfaLoggerFunc.tradeInfo("'***农信银系统:通存通兑往账交易.余额查询[8560] 退出")
    
    return True
    
Example #10
0
def insTransTrc(trc_dict):
    
    AfaLoggerFunc.tradeInfo( ">>>开始登记汇兑业务登记簿[" + trc_dict["BJEDTE"] + "][" + trc_dict["BSPSQN"] + "]交易信息及相关状态" )
    
    if not trc_dict.has_key("BJEDTE"):
        return AfaFlowControl.ExitThisFlow( 'S999',"登记汇兑业务登记簿,BJEDTE不能为空")
        
    if not trc_dict.has_key("BSPSQN"):
        return AfaFlowControl.ExitThisFlow( 'S999',"登记汇兑业务登记簿,BSPSQN不能为空")
        
    
    #==========将输入字典赋值到汇兑业务登记簿字典==============================
    trcbka_dict = {}
    
    if not rccpsMap0000Dtrc_dict2Dtrcbka.map(trc_dict,trcbka_dict):
        return AfaFlowControl.ExitThisFlow( 'S999', '将输入字典赋值到汇兑业务登记簿字典异常' )
        
    #==========登记信息到汇兑登记簿============================================
    ret = rccpsDBTrcc_trcbka.insert(trcbka_dict)
    
    if ret <= 0:
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow( 'S999', '登记汇兑业务详细信息到汇兑业务登记簿异常' )
        
    AfaLoggerFunc.tradeInfo("插入成功")
    #==========登记初始状态====================================================
    if not rccpsState.newTransState(trc_dict["BJEDTE"],trc_dict["BSPSQN"],PL_BCSTAT_INIT,PL_BDWFLG_SUCC):
        return False
    
    AfaLoggerFunc.tradeInfo( ">>>结束登记汇兑业务登记簿[" + trc_dict["BJEDTE"] + "][" + trc_dict["BSPSQN"] + "]交易信息及相关状态" )
    return True
Example #11
0
def SubModuleDoFst( ):
    
    AfaLoggerFunc.tradeInfo( '初始化汇总查询交易变量' )
    
    if( not (TradeContext.existVariable( "insuid" ) ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '机构号[insuid]值不存在!' )

    if( not (TradeContext.existVariable( "productid" ) ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '险种[productid]值不存在!' )

    if( not (TradeContext.existVariable( "instno" ) ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '机构号[instno]值不存在!' )

    if( not (TradeContext.existVariable( "salerno" ) ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '销售员工工号[salerno]值不存在!' )

    if( not (TradeContext.existVariable( "startdate" ) and TradeContext.startdate != '00000000') ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '起始日期[startdate]值不存在!' )

    if( not (TradeContext.existVariable( "enddate" ) and TradeContext.enddate != '00000000' ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '截止日期[enddate]值不存在!' )

    if( not TradeContext.existVariable( "channelCode" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '渠道代码[channelCode]值不存在!' )

    if( TradeContext.channelCode == '005' ):
        
        if( not TradeContext.existVariable( "tellerno" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '柜员号[tellerno]值不存在!' )
        if( not TradeContext.existVariable( "brno" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '网点号[brno]值不存在!' )
        if( not TradeContext.existVariable( "termid" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '柜员号[termid]值不存在!' )
   
    return True
Example #12
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作)交易[TRC001_8558]进入***' )
    
    #=====判断对账日期是否存在====
    if not TradeContext.existVariable('CHKDAT'):
       return AfaFlowControl.ExitThisFlow('S999','对账日期[CHKDAT]不存在')

    #=====进入查询rekbal====
    rek_sel = {}
    rek_sel['NCCWKDAT']  =  TradeContext.CHKDAT

    record = rccpsDBTrcc_rekbal.selectu(rek_sel)
    if record == None:
        return AfaFlowControl.ExitThisFlow('S999','查询清算账户余额通知登记簿异常')
    elif len(record) <= 0:
        return AfaFlowControl.ExitThisFlow('S999','查询清算账户余额通知登记簿无记录')
    else:
        TradeContext.CHKRST = record['CHKRST']              #对账结果
        TradeContext.OCCAMT = str(record['TODAYBAL'])       #行内余额

    TradeContext.errorCode = '0000'
    TradeContext.errorMsg  = '成功'
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作)交易[TRC001_8558]退出***' )
    return True
Example #13
0
def getTransStateSet(BJEDTE,BSPSQN,BCSTAT,BDWFLG,stat_dict):
    AfaLoggerFunc.tradeInfo(">>>进入getTransStateSet")
    
    #==========获取sstlog对应状态及信息=========================================
    sstlog_where_dict = {}
    sstlog_where_dict["BJEDTE"] = BJEDTE
    sstlog_where_dict["BSPSQN"] = BSPSQN
    sstlog_where_dict["BCSTAT"] = BCSTAT
    sstlog_where_dict["BDWFLG"] = BDWFLG
    
    sstlog_dict = rccpsDBTrcc_sstlog.selectu(sstlog_where_dict)
    
    if sstlog_dict == None:
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        AfaLoggerFunc.tradeFatal("获取交易[" + BJEDTE + "][" + BSPSQN + "]指定状态详细信息异常")
        return AfaFlowControl.ExitThisFlow( 'S999', '获取交易指定状态详细信息异常' )
        
    if len(sstlog_dict) <= 0:
        AfaLoggerFunc.tradeFatal("流水状态登记簿中无此交易" + BJEDTE + "][" + BSPSQN + "]指定状态[" + BCSTAT + "][" + BDWFLG + "]详细信息")
        return AfaFlowControl.ExitThisFlow( 'S999', '流水状态登记簿中无此交易指定状态详细信息' )
        
    if not rccpsMap0000Dsstlog2Dstat_dict.map(sstlog_dict,stat_dict):
        AfaLoggerFunc.tradeFatal("将查询出的业务状态详细信息赋值到输出字典异常")
        return AfaFlowControl.ExitThisFlow( 'S999', '将查询出的业务状态详细信息赋值到输出字典异常' )
    
    AfaLoggerFunc.tradeInfo(">>>结束getTransStateSet")
    return True
Example #14
0
def getTransStateAll(BJEDTE,BSPSQN,stat_list):
    AfaLoggerFunc.tradeInfo(">>>进入getTransStateAll")
    #===========获取sstlog所有状态及相关信息====================================
    sstlog_where_sql = "BJEDTE = '" + BJEDTE + "' and BSPSQN = '" + BSPSQN + "'"
    sstlog_order_sql = " order by BCURSQ desc "
    
    sstlog_list = rccpsDBTrcc_sstlog.selectm(1,0,sstlog_where_sql,sstlog_order_sql)
    
    if sstlog_list == None:
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        AfaLoggerFunc.tradeFatal("获取交易[" + BJEDTE + "][" + BSPSQN + "]所有状态详细信息异常")
        return AfaFlowControl.ExitThisFlow( 'S999', '获取交易所有状态详细信息异常' )
        
    if len(sstlog_list) <= 0:
        AfaLoggerFunc.tradeFatal("流水状态登记簿中无此交易[" + BJEDTE + "][" + BSPSQN + "]状态详细信息")
        return AfaFlowControl.ExitThisFlow( 'S999', '流水状态登记簿中无此交易状态详细信息' )
    
    
    for i in xrange(0,len(sstlog_list)):
        stat_dict = {}
        if not rccpsMap0000Dsstlog2Dstat_dict.map(sstlog_list[i],stat_dict):
            AfaLoggerFunc.tradeFatal("将查询出的业务状态详细信息赋值到输出字典异常")
            return AfaFlowControl.ExitThisFlow( 'S999', '将查询出的业务状态详细信息赋值到输出字典异常' )
        stat_list.append(stat_dict)
    
    AfaLoggerFunc.tradeInfo(">>>结束getTransStateAll")
    return True
Example #15
0
def SubModuleDoFst():
    
    #====begin 蔡永贵 20110215 增加====
    #新票据号是16位,需要取后8位,版本号为02,同时要兼容老票据号8位,版本号为01
    if len(TradeContext.BILNO) == 16:
        TradeContext.TMP_BILNO = TradeContext.BILNO[-8:]
    else:
        TradeContext.TMP_BILNO = TradeContext.BILNO
    #============end============
    
    #=================查询原交易信息============================================
    
    if not TradeContext.existVariable('BJEDTE'):
        return AfaFlowControl.ExitThisFlow("S999", "查询日期不能为空")
    
    if not TradeContext.existVariable('RCVBNKCO'):
        return AfaFlowControl.ExitThisFlow("S999", "接收行行号不能为空")
        
    #=================登记查询书信息============================================
    AfaLoggerFunc.tradeInfo(">>>开始登记票据业务查询书信息")
    
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.ISDEAL   = PL_ISDEAL_UNDO            #查复标识为未查复
    
    pjcbka_insert_dict = {}
    if not rccpsMap8514CTradeContext2Dpjcbka.map(pjcbka_insert_dict):
        return AfaFlowControl.ExitThisFlow("S999", "为票据业务查询查复登记簿赋值异常")
        
    ret = rccpsDBTrcc_pjcbka.insertCmt(pjcbka_insert_dict)
    
    if ret <= 0:
        return AfaFlowControl.ExitThisFlow("S999", "登记票据业务查询书信息异常")
    
    AfaLoggerFunc.tradeInfo(">>>结束登记票据业务查询书信息")
    
    #=================为票据查询书报文赋值======================================
    AfaLoggerFunc.tradeInfo(">>>开始为票据查询书报文赋值")
    
    TradeContext.MSGTYPCO   = 'SET008'
    TradeContext.SNDBRHCO   = TradeContext.BESBNO
    TradeContext.SNDCLKNO   = TradeContext.BETELR
    TradeContext.SNDTRDAT   = TradeContext.BJEDTE
    TradeContext.SNDTRTIM   = TradeContext.BJETIM
    TradeContext.MSGFLGNO   = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
    TradeContext.NCCWKDAT   = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO   = '99'
    TradeContext.ROPRTPNO   = '20'
    TradeContext.TRANTYP    = '0'
    #TradeContext.TRCDAT     = TradeContext.BJEDTE
    TradeContext.TRCNO      = TradeContext.SerialNo
    #TradeContext.BILPNAM    = TradeContext.PYENAM
    #TradeContext.BILAMT   = str(TradeContext.BILAMT)
    
    AfaLoggerFunc.tradeInfo(">>>结束为票据查询书报文赋值")
    
    
    return True
Example #16
0
def SubModuleDoFst():

    AfaLoggerFunc.tradeInfo( '退付开始' )


    #=====刘雨龙  20080811  新增查找fa15表中财政区划内码,条件为单位内码====
    #sql = "select AAA010 from fs_fa15 where AFA050='" + TradeContext.busiNo + "'"
    sql = "select AAA010 from fs_fa22 where busino='" + TradeContext.busiNo + "'"
    
    #begin 20100629 蔡永贵增加查询条件
    sql = sql + " and AFA101 = '" + TradeContext.bankbm + "'"
    AfaLoggerFunc.tradeInfo( sql )
    #end

    ret = AfaDBFunc.SelectSql( sql )
    if ret == None:
        return AfaFlowControl.ExitThisFlow('0001','通过单位内码查找财政区划内码失败')
    elif len(ret) <= 0:
        return AfaFlowControl.ExitThisFlow('0001','通过单位内码查找财政区划内码无满足条件记录')
    else:
        TradeContext.AAA010  =  ret[0][0]


    TradeContext.__agentEigen__ = '0'   #从表标志

    #将字段转化为退付交易所使用的字段
    TradeContext.AFC060         =   TradeContext.userNo
    TradeContext.AFA050         =   TradeContext.note1
    TradeContext.AFC064         =   TradeContext.amount
    TradeContext.AFC063         =   TradeContext.accno

    #=====刘雨龙  20080811  新增条件财政区划内码====
    #sqlstr                      =   "select flag from fs_fc75 where afc060='" + TradeContext.AFC060 + "'"
    sqlstr                      =   "select flag from fs_fc75 where afc060='" + TradeContext.AFC060 + "'"

    sqlstr = sqlstr + " and AAA010 = '" + TradeContext.AAA010 + "'"

    #===条件增加银行编码字段,张恒修改===
    sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'"

    records                     =   AfaDBFunc.SelectSql( sqlstr )

    AfaLoggerFunc.tradeInfo( '退付查询' + sqlstr )

    if ( len(records) > 0 ):
        if records[0][0]   ==  '0':
            TradeContext.errorCode,TradeContext.errorMsg  =   '0001','已经查找到了退付编号,不能再次退付'
            AfaLoggerFunc.tradeInfo( TradeContext.errorMsg )
            return False


        elif records[0][0] != '1':
            TradeContext.errorCode,TradeContext.errorMsg  =   '0002',"缴款书状态位异常"
            AfaLoggerFunc.tradeInfo( TradeContext.errorMsg )
            return False

    return True
Example #17
0
def newBilState(BJEDTE,BSPSQN,HPSTAT):
    AfaLoggerFunc.tradeInfo(">>>进入newBilState")
    #===========检查表bilbka中是否存在此业务====================================
    bilbka_where_dict = {}
    bilbka_where_dict["BJEDTE"] = BJEDTE
    bilbka_where_dict["BSPSQN"] = BSPSQN
        
    bilbka_dict = rccpsDBTrcc_bilbka.selectu(bilbka_where_dict)
    
    if bilbka_dict == None:
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        AfaLoggerFunc.tradeFatal("获取汇票业务登记簿中交易[" + BJEDTE + "][" + BSPSQN + "]详细信息异常")
        return AfaFlowControl.ExitThisFlow( 'S999', '获取汇票业务登记簿中交易详细信息异常' )
        
    elif len(bilbka_dict) <= 0:
        AfaLoggerFunc.tradeFatal("汇票业务登记簿中无此交易[" + BJEDTE + "][" + BSPSQN + "]详细信息")
        return AfaFlowControl.ExitThisFlow( 'S999', '汇票业务登记簿中无此交易详细信息' )
        
    else:
        MaxHPCUSQ = int(bilbka_dict["HPCUSQ"]) + 1
    
    #===========更新表bilbka中业务对应汇票状态===================================
    bilbka_update_dict = {}
    bilbka_update_dict["HPCUSQ"] = MaxHPCUSQ
    bilbka_update_dict["HPSTAT"] = HPSTAT
    
    bilbka_where_dict = {}
    bilbka_where_dict["BJEDTE"] = BJEDTE
    bilbka_where_dict["BSPSQN"] = BSPSQN
    
    ret = rccpsDBTrcc_bilbka.update(bilbka_update_dict,bilbka_where_dict)
    if ret <= 0:
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        AfaLoggerFunc.tradeFatal("登记汇票业务登记簿中交易[" + BJEDTE + "][" + BSPSQN + "]对应当前汇票状态[" + HPSTAT + "]异常")
        return AfaFlowControl.ExitThisFlow( 'S999', '登记汇票业务登记簿中当前汇票状态异常' )
    
    #===========更新表bilinf中汇票对应状态========================================
    bilinf_update_dict = {}
    bilinf_update_dict["HPCUSQ"] = MaxHPCUSQ
    bilinf_update_dict["HPSTAT"] = HPSTAT
    
    bilinf_where_dict = {}
    bilinf_where_dict["BILVER"] = bilbka_dict["BILVER"]
    bilinf_where_dict["BILNO"] = bilbka_dict["BILNO"]
    bilinf_where_dict["BILRS"] = bilbka_dict["BILRS"]
    
    ret = rccpsDBTrcc_bilinf.update(bilinf_update_dict,bilinf_where_dict)
    if ret <= 0:
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        AfaLoggerFunc.tradeFatal("登记汇票业务登记簿中当前汇票[" + bilbka_dict['BILVER'] + "][" + bilbka_dict['BILVER'] + "]状态[" + HPSTAT + "]异常")
        return AfaFlowControl.ExitThisFlow( 'S999', '登记汇票信息登记簿中当前汇票状态异常' )
    
    AfaLoggerFunc.tradeInfo(">>>结束newBilState")
    return True
Example #18
0
def SubModuleDoFst():
    #=================汇兑自由格式书检查============================================
    
    if not TradeContext.existVariable('BOJEDT'):
        return AfaFlowControl.ExitThisFlow("S999", "日期不能为空")
    
    if not TradeContext.existVariable('RCVBNKCO'):
        return AfaFlowControl.ExitThisFlow("S999", "接收行行号不能为空")
        
    #=================登记汇兑自由格式书信息============================================
    AfaLoggerFunc.tradeInfo(">>>开始登记汇兑业务查询书信息")
    
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    #=====刘雨龙 20080701 增加汇兑业务查询查复登记簿信息====
    TradeContext.TRCNO    = TradeContext.SerialNo        #交易流水号
    
    hdcbka_insert_dict = {}
    if not rccpsMap8513CTradeContext2Dhdcbka.map(hdcbka_insert_dict):
        return AfaFlowControl.ExitThisFlow("S999", "为汇兑业务查询查复登记簿赋值异常")
    
    #AfaLoggerFunc.tradeInfo(hdcbka_insert_dict)  
    ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict)
    
    if ret <= 0:
        return AfaFlowControl.ExitThisFlow("S999", "登记汇兑业务自由格式信息异常")
    
    AfaLoggerFunc.tradeInfo(">>>结束登记汇兑业务查询书信息")
    
    
    #=================为汇兑查询书报文赋值======================================
    AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询书报文赋值")
    
    TradeContext.TRCCO      = '9900513'
    TradeContext.MSGTYPCO   = 'SET008'
    TradeContext.SNDBRHCO   = TradeContext.BESBNO
    TradeContext.SNDCLKNO   = TradeContext.BETELR
    TradeContext.SNDTRDAT   = TradeContext.BJEDTE
    TradeContext.SNDTRTIM   = TradeContext.BJETIM
    #TradeContext.MSGFLGNO   = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo
    TradeContext.ORMFN      = hdcbka_insert_dict['SNDMBRCO'] + hdcbka_insert_dict['TRCDAT'] + hdcbka_insert_dict['TRCNO']
    TradeContext.NCCWKDAT   = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO   = '99'
    TradeContext.ROPRTPNO   = '20'
    TradeContext.TRANTYP    = '0'
    #TradeContext.TRCDAT     = TradeContext.BOJEDT
    TradeContext.TRCNO      = TradeContext.SerialNo
    
    
    AfaLoggerFunc.tradeInfo(">>>结束为汇兑自由格式书报文赋值")
    AfaLoggerFunc.tradeInfo('发起行交易日期:'+TradeContext.SNDTRDAT)
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).汇兑自由格式书发送[TRC003_8513]退出***' )
    
    return True
Example #19
0
def Update():
    try:
        if( TradeContext.existVariable( "BRNO" ) and len(TradeContext.BRNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[分行行号]:不能为空')
        if( TradeContext.existVariable( "PAYBKCODE" ) and len(TradeContext.PAYBKCODE)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[清算行行号]:不能为空')
        if( TradeContext.existVariable( "STATUS" ) and len(TradeContext.STATUS)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[是否为清算行]:不能为空')
        if( TradeContext.existVariable( "ACCNO" ) and len(TradeContext.ACCNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[待结算财税库款]:不能为空')
        if( TradeContext.existVariable( "PAYEEBANKNO" ) and len(TradeContext.PAYEEBANKNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[清算国库支付系统行号]:不能为空')

        sql="SELECT BRNO,PAYBKCODE,BANKNO,BANKACCT,BANKNAME,PAYEEBANKNO,STATUS,ACCNO,NOTE1,NOTE2,NOTE3,NOTE4,NOTE5 "
        sql=sql+" FROM TIPS_BRANCH_ADM WHERE 1=1 "
        sql=sql+"AND BRNO='"+ TradeContext.BRNO+"'"
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.SelectSql(sql)
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        elif( len( records ) == 0 ):
            return AfaFlowControl.ExitThisFlow( 'A0027', '不存在此上线行信息' )

            
        sql="UPDATE TIPS_BRANCH_ADM SET "
        sql=sql+"PAYBKCODE='"+ TradeContext.PAYBKCODE+"',"
        sql=sql+"BANKNO='"+ TradeContext.BANKNO+"',"
        sql=sql+"BANKACCT='"+ TradeContext.BANKACCT+"',"
        sql=sql+"BANKNAME='"+ TradeContext.BANKNAME+"',"
        sql=sql+"PAYEEBANKNO='"+ TradeContext.PAYEEBANKNO+"',"
        sql=sql+"STATUS='"+ TradeContext.STATUS+"',"
        sql=sql+"ACCNO='"+ TradeContext.ACCNO+"',"
        sql=sql+"NOTE3='"+ TradeContext.ACCNAME+"',"
        sql=sql+"BRNO='"+ TradeContext.BRNO+"' "
        sql=sql+"WHERE "
        sql=sql+"BRNO = '"+ TradeContext.BRNO+"'"
                
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.UpdateSqlCmt(sql)
                 
        if( records <=0  ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0027', '未发现信息:'+AfaDBFunc.sqlErrMsg )
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        return True
        
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Example #20
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(2.中心操作).汇票解付[TRCC003_8502]进入***' )
    
    #=================判断afe是否发送成功=======================================
    if TradeContext.errorCode != '0000':
        #=============AFE发送失败,设置状态为发送失败============================
        AfaLoggerFunc.tradeInfo('>>>AFE发送失败,开始设置状态为发送失败')
        
        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_FAIL
        stat_dict['PRCCO']   = TradeContext.errorCode
        stat_dict['STRINFO'] = TradeContext.errorMsg
        
        if not rccpsState.setTransState(stat_dict):
            return AfaFlowControl.ExitThisFlow('S999','设置状态为发送失败异常')
            
        AfaLoggerFunc.tradeInfo('>>>结束设置状态为发送失败')
    else:
        #=============AFE发送成功,设置状态为发送成功============================
        AfaLoggerFunc.tradeInfo('>>>AFE发送成功,开始设置状态为发送成功')
        
        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
        
        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(">>>Commit成功")
    
    TradeContext.errorCode = '0000'
    TradeContext.errorMsg  = '发送农信银中心成功'
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(2.中心操作).汇票解付[TRCC003_8502]结束***' )
    
    return True
Example #21
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeDebug('>>>开始处理AFE返回结果')
    status = {}
    status['BSPSQN']  = TradeContext.BSPSQN       #报单序号
    status['BJEDTE']  = TradeContext.BJEDTE       #交易日期
    status['BCSTAT']  = PL_BCSTAT_SND             #发送
    status['STRINFO'] = TradeContext.errorMsg
    #=====开始判断afe返回结果====
    if TradeContext.errorCode != '0000':
        status['BDWFLG']       = PL_BDWFLG_FAIL       #失败
    else:
        status['BDWFLG']       = PL_BDWFLG_SUCC       #成功

    #=====修改退汇记录的状态====
    if not rccpsState.setTransState(status):
        #=====RollBack操作====
        AfaDBFunc.RollbackSql()
        return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg)
    else:
        #=====commit操作====
        AfaDBFunc.CommitSql()

    AfaLoggerFunc.tradeDebug('>>>通讯回执处理成功')
    
    #=====发送退汇报文2000004====
    TradeContext.sysType  = 'rccpst'
    TradeContext.TRCCO    = '2000004'
    TradeContext.MSGTYPCO = 'SET005'
    TradeContext.OPRTYPNO =  '20'   #汇兑
    TradeContext.STRINFO  = '收到紧急止付,系统自动退汇' 
   
    #=====接收行号与发送行号互换====
    TradeContext.TEMP     = TradeContext.RCVBNKCO
    TradeContext.RCVBNKCO = TradeContext.SNDBNKCO
    TradeContext.SNDBNKCO = TradeContext.TEMP

    #=====接收行名与发送行名互换====
    TradeContext.NAME     = TradeContext.RCVBNKNM
    TradeContext.RCVBNKNM = TradeContext.SNDBNKNM
    TradeContext.SNDBNKNM = TradeContext.NAME

    #=====发送afe====
    AfaAfeFunc.CommAfe()

    #=====开始判断afe返回结果====
    if TradeContext.errorCode != '0000':
        return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg)
    else:
        AfaLoggerFunc.tradeDebug('>>>发送退汇成功')

    return True
Example #22
0
def SubModuleDoFst():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).资金调拨申请[TRCC003_8544]进入***' )
    
    #=================必要性检查================================================
    AfaLoggerFunc.tradeInfo(">>>开始必要性检查")
    
    if TradeContext.BESBNO != PL_BESBNO_BCLRSB:
        return AfaFlowControl.ExitThisFlow('S999','本机构无此交易权限')
        
    AfaLoggerFunc.tradeInfo(">>>结束必要性检查")
    
    #=================登记资金调拨申请登记簿====================================
    AfaLoggerFunc.tradeInfo(">>>开始登记资金调拨申请登记簿")
    
    TradeContext.TRCCO    = "9900525"
    TradeContext.TRCDAT   = TradeContext.BJEDTE
    TradeContext.TRCNO    = TradeContext.SerialNo
    TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN
    TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN
    #TradeContext.RCVMBRCO = "1000000000"
    
    mrqtbl_dict = {}
    if not rccpsMap8544CTradeContext2Dmrqtbl.map(mrqtbl_dict):
        return AfaFlowControl.ExitThisFlow('S999','为资金调拨申请登记簿报文赋值异常')
        
    ret = rccpsDBTrcc_mrqtbl.insertCmt(mrqtbl_dict)
    if ret <= 0:
        return AfaFlowControl.ExitThisFlow('S999','登记资金调拨申请登记薄异常')
    
    AfaLoggerFunc.tradeInfo(">>>结束登记资金调拨申请登记簿")
    
    #=================为资金调拨申请报文赋值====================================
    AfaLoggerFunc.tradeInfo(">>>开始为资金调拨申请报文赋值")
    
    TradeContext.MSGTYPCO = "SET008"
    TradeContext.SNDBRHCO = TradeContext.BESBNO
    TradeContext.SNDCLKNO = TradeContext.BETELR
    TradeContext.SNDTRDAT = TradeContext.BJEDTE
    TradeContext.SNDTRTIM = TradeContext.BJETIM
    TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.TRCNO
    TradeContext.NCCWKDAT = TradeContext.NCCworkDate
    TradeContext.OPRTYPNO = "99"
    TradeContext.ROPRTPNO = ""
    TradeContext.TRANTYP  = "0"
    TradeContext.ORTRCCO  = ""
    
    AfaLoggerFunc.tradeInfo(">>>结束为资金调拨申请报文赋值")
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).资金调拨申请[TRCC003_8544]进入***' )
    return True
Example #23
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(2.中心操作).汇票撤销[TRCC003_8503]进入***' )
    
    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(">>>发送农信银总中心成功")
        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(">>>发送农信银总中心失败")
        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(">>>结束设置业务状态为发送失败")
    
    #COMMIT
    if not AfaDBFunc.CommitSql( ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return AfaFlowControl.ExitThisFlow("S999","Commit异常")
    AfaLoggerFunc.tradeInfo(">>>Commit成功")
    
    AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(2.中心操作).汇票撤销[TRCC003_8503]退出***' )
    
    return True
Example #24
0
def SubModuleDoFst( ):
    AfaLoggerFunc.tradeInfo( '初始化交易变量' )
    AfaLoggerFunc.tradeInfo( '缴费信息查询变量值的有效性校验' )
    if( not TradeContext.existVariable( "CpicNo" ) ):
        return AfaFlowControl.ExitThisFlow( 'A0001', '保险单号[CpicNo]值不存在!' )
    if( not TradeContext.existVariable( "channelCode" ) ):
        return AfaFlowControl.ExitThisFlow( 'A0001', '渠道代码[channelCode]值不存在!' )
    if( TradeContext.channelCode == '005' ):
        if( not TradeContext.existVariable( "tellerno" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '柜员号[tellerno]值不存在!' )
        if( not TradeContext.existVariable( "brno" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '网点号[brno]值不存在!' )
        if( not TradeContext.existVariable( "termid" ) ):
            return AfaFlowControl.ExitThisFlow( 'A0001', '柜员号[termid]值不存在!' )
    return True
Example #25
0
def SubModuleDoSnd():

    AfaLoggerFunc.tradeInfo( '>>>开始判断主机返回结果' )
    status_dict = {}
    status_dict['BSPSQN']  = TradeContext.BSPSQN       #报单序号
    status_dict['BJEDTE']  = TradeContext.BJEDTE       #交易日期
    status_dict['BCSTAT']  = PL_BCSTAT_ACC             #记账

    #=====判断主机返回结果====
    if TradeContext.errorCode != '0000':
        status_dict['BDWFLG']  = PL_BDWFLG_FAIL        #失败
        status_dict['STRINFO'] = TradeContext.errorMsg
        #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg)
    else:
        status_dict['BDWFLG']  = PL_BDWFLG_SUCC        #成功
        status_dict['TRDT']    = TradeContext.TRDT     #主机日期
        status_dict['TLSQ']    = TradeContext.TLSQ     #主机流水号
        status_dict['MGID']    = TradeContext.MGID     #主机返回信息
        status_dict['DASQ']    = TradeContext.DASQ     #销账序号

    #=====修改退汇记录的状态====
    if not rccpsState.setTransState(status_dict):
        #=====RollBack操作====
        AfaDBFunc.RollbackSql()
        return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg)
    else:
        #=====commit操作====
        AfaDBFunc.CommitSql()
        AfaLoggerFunc.tradeInfo('>>>commit成功')

    #=====判断主机返回结果,是否继续流程====
    if TradeContext.errorCode != '0000':
        return AfaFlowControl.ExitThisFlow('D011', '该笔业务已入账,不允许退汇')
        #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg)

    #=====新增记录的状态为:发送-处理中====
    if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_SND,PL_BDWFLG_WAIT):
        #=====RollBack操作====
        AfaDBFunc.RollbackSql()
        return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚')
    else:
        #=====commit操作====
        AfaDBFunc.CommitSql()

    #=====发送中心====
    TradeContext.ROPRTPNO  =  '20'

    return True
Example #26
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeDebug('>>>开始处理AFE返回结果')
    #=====开始判断afe返回结果====
    if TradeContext.errorCode != '0000':
         return AfaFlowControl.ExitThisFlow('M999','发送农信银中心失败')
    
    return True
Example #27
0
def InsertOnOffDTL():
    sql="insert into afa_UnitOnOffDTL(SYSID,UNITNO,SUBUNITNO,STATUS,OPERFLAG,STOPTIME,STARTTIME,NOTE1,NOTE2)"
    sql=sql+" values"
    sql=sql+"('"+TradeContext.sysId       +"'"
    sql=sql+",'"+TradeContext.unitno      +"'"
    sql=sql+",'"+TradeContext.TaxOrgName     +"'"
    sql=sql+",'"+'1'                         +"'"
    sql=sql+",'"+TradeContext.operFlag      +"'"
    sql=sql+",'"+TradeContext.stopTime      +"'"
    sql=sql+",'"+TradeContext.startTime      +"'"
    sql=sql+",'"+TradeContext.NOTE1           +"'"
    sql=sql+",'"+TradeContext.NOTE2           +"'"
    sql=sql+")"
    if( AfaDBFunc.InsertSqlCmt(sql) == -1 ):
        AfaLoggerFunc.tradeFatal(sql)
        return AfaFlowControl.ExitThisFlow( 'A0025', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
    return True


#获取商户参数
#def GetUnitStatus():
#    AfaLoggerFunc.tradeInfo('获取商户参数' )
#    #============系统标识============
#    sqlStr = "SELECT * FROM AFA_UNITADM WHERE SYSID = '" + TradeContext.sysId + "' AND "
#    #============商户代码============
#    sqlStr = sqlStr+"UNITNO = '" + TradeContext.unitno + "' "
#    AfaLoggerFunc.tradeInfo( sqlStr )
#    records = AfaDBFunc.SelectSql( sqlStr )
#    if( records == None ):
#        AfaLoggerFunc.tradeFatal( sqlStr )
#        return AfaFlowControl.ExitThisFlow( 'A0025', '数据库错误,商户信息表操作异常:'+AfaDBFunc.sqlErrMsg )
#    elif( len( records )!=0 ):
#        AfaUtilTools.ListFilterNone( records )
#        TradeContext.__busiMode__ = records[0][6]   #=============业务模式=============
Example #28
0
def SubModuleDoSnd():

    AfaLoggerFunc.tradeDebug('>>>结束发送农信银中心')
    AfaLoggerFunc.tradeDebug('>>>开始状态变更')

    sstlog = {}

    sstlog['BJEDTE'] = TradeContext.BJEDTE
    sstlog['BSPSQN'] = TradeContext.BSPSQN
    sstlog['BCSTAT'] = PL_BCSTAT_SND
    sstlog['NOTE3']  = TradeContext.errorMsg

    if TradeContext.errorCode == '0000':
        sstlog['BDWFLG'] = PL_BDWFLG_SUCC
    else:
        sstlog['BDWFLG'] = PL_BDWFLG_FAIL

    #=====修改sstlog表中数据====
    if not rccpsState.setTransState(sstlog):
        return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg)
    else:
        #=====commit操作====
        AfaDBFunc.CommitSql()

    AfaLoggerFunc.tradeDebug('>>>结束状态变更')

    
    return True
Example #29
0
def chkTDBESAuth(BESBNO):
    AfaLoggerFunc.tradeInfo(">>>开始检查机构[" + BESBNO + "]是否有通存通兑业务权限")
    
    where_sql = "BPATPE = '3' and BPARAD = '" + BESBNO + "'"
    
    ret = rccpsDBTrcc_pamtbl.count(where_sql)
    
    if ret < 0:
        return AfaFlowControl.ExitThisFlow("S999","查询机构[" + BESBNO + "]通存通兑业务权限异常")
        
    if ret > 0:
        return AfaFlowControl.ExitThisFlow("S999","机构[" + BESBNO + "]无通存通兑业务权限")
    
    AfaLoggerFunc.tradeInfo(">>>结束检查机构[" + BESBNO + "]是否有通存通兑业务权限")
    
    return True
Example #30
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('进入单证重打交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通信后处理' )
    
    try:
        names = Party3Context.getNames( )
       
        for name in names:
            value = getattr( Party3Context, name )
            if ( not name.startswith( '__' ) and type(value) is StringType or type(value) is ListType) :
                setattr( TradeContext, name, value )
            
        if(TradeContext.errorCode=='0000'):
            #第三方返回成功后更新原保单印刷号
            update_sql = "update afa_maintransdtl set "                                             
            update_sql = update_sql + " userno            = '" + TradeContext.userno1     + "'"       #user1新保单印刷号
            update_sql = update_sql + " where userno      = '" + TradeContext.userno      + "'"       #user原保单印刷号 
            update_sql = update_sql + " and workdate      = '" + TradeContext.workDate    + "'"       #日期  
            update_sql = update_sql + " and agentserialno = '" + TradeContext.PreSerialno + "'"       #缴费成功的中间业务流水号
            
            #更新并提交数据
            if  AfaDBFunc.UpdateSqlCmt(update_sql)<0:
                return AfaFlowControl.ExitThisFlow("A999","更新投保单号失败")
                
            #第三方返回成功后生成现金价值文件
            if not YbtFunc.createFile( ):
                return False

        AfaLoggerFunc.tradeInfo('退出单证重打[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )
        return True
    
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))