コード例 #1
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('进入查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )
    try:
        Party3Context.unitno      = TradeContext.unitno
        Party3Context.ProCode = TradeContext.ProCode
        names = Party3Context.getNames( )
        for name in names:
            value = getattr( Party3Context, name )
            setattr( TradeContext, name, value )
            #AfaLoggerFunc.tradeInfo("字段名称  ["+str(name)+"] =  "+str(value))
        if( TradeContext.errorCode == '0000' ):
        #    if( TradeContext.existVariable( "ProCodeStr" ) ):
        #        if (TradeContext.ProCodeStr == "EL5601"):            
        #            TradeContext.ProCode = "0"                      #安贷宝A
        #        elif (TradeContext.ProCodeStr == "EL5602"):
        #            TradeContext.ProCode = "1"                      #安贷宝B
        #        elif (TradeContext.ProCodeStr == "211610"):
        #            TradeContext.ProCode = "2"                      #华夏借款人意外伤害保险
            if not AfaAhAdb.AdbInsertQueDtl( ):
                raise AfaFlowControl.accException()
        AfaLoggerFunc.tradeInfo('退出查询交易与第三方通讯后处理' )
        return True
        
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #2
0
ファイル: TYBT001_8614.py プロジェクト: bianhezhen/AFA1.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))
コード例 #3
0
ファイル: T001000_8623.py プロジェクト: bianhezhen/AFA1.0
def ChkUnitLimit( ):

    try:
        AfaLoggerFunc.tradeInfo('>>>判断该单位是否有批量签约的权限')
        sql = ""
        sql = "SELECT FLAG FROM ABDT_QYFLAG WHERE "
        sql = sql + " SYSID = '" + TradeContext.sysId + "'" 
        sql = sql + " AND STATUS = '1'"
        
        records = AfaDBFunc.SelectSql( sql )
        AfaLoggerFunc.tradeInfo('查询数据库 sql: ' +sql)
        
        if(records==None):
            TradeContext.errorCode,TradeContext.errorMsg = "9999" , "查询ABDT_QYFLAG数据库异常!"
            raise AfaFlowControl.flowException( ) 
                      
        elif(len(records)==0):
            TradeContext.errorCode,TradeContext.errorMsg = "9999" , "无该单位签约权限信息!"
            raise AfaFlowControl.flowException( ) 

        else:
            if (records[0][0]=='0'):
                TradeContext.errorCode,TradeContext.errorMsg = "9999" , "该单位无签约权限!"
                raise AfaFlowControl.flowException( ) 
                
            if (records[0][0]=='1'):
                AfaLoggerFunc.tradeInfo('>>>该单位有签约权限')
                return True 
                         
        return True
        
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #4
0
ファイル: TYBT001_8612.py プロジェクト: bianhezhen/AFA1.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) :
                setattr( TradeContext, name, value )
          
        if(TradeContext.errorCode=='0000'):
            TradeContext.errorMsg="续期查询成功"
        
        
        #TradeContext.syr_name1 = ''
        #syr_name = []
        #if TradeContext.existVariable('syr_name1'):
        #    syr_name.append('xiaozhang')
        #    syr_name.append('xig')
        TradeContext.O1ACUR = '1'
        #    TradeContext.syr_name = syr_name 
     
        AfaLoggerFunc.tradeInfo('退出续期查询交易与第三方通讯后处理' )    
        return True
        
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #5
0
def SubModuleMainFst( ):
    try:
        
        AfaLoggerFunc.tradeInfo( '进入变更开户行行号[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
        
        #检查原开户行行号是否与数据库中登记的开户行行号一致
        sqlStr = ""
        sqlStr = sqlStr + "SELECT PAYOPBKCODE FROM TIPS_CUSTINFO WHERE TAXORGCODE = '" + TradeContext.taxOrgCode + "'" 
        sqlStr = sqlStr + " AND PAYACCT ='" + TradeContext.payAcct + "'"
        #sqlStr = sqlStr + " AND PAYOPBKCODE ='" + TradeContext.payBkCode+ "'"
        sqlStr = sqlStr + " AND PROTOCOLNO ='" +TradeContext.protocolNo+"'"
        
        AfaLoggerFunc.tradeInfo(sqlStr)
        
        records = AfaDBFunc.SelectSql( sqlStr )
        
        if( records == None ):
            
            return TipsFunc.ExitThisFlow( 'A0027', '表操作异常:'+AfaDBFunc.sqlErrMsg )
                
        elif( len( records )==0 ):
                
            return TipsFunc.ExitThisFlow( 'A0027', '没有满足条件的数据记录!' )
            
        else: 
            AfaLoggerFunc.tradeDebug("原开户行行号为:" +records[0][0])
                
        if(records[0][0] !=TradeContext.payBkCode):
            TradeContext.errorCode,TradeContext.errorMsg = "A0001","原开户行行号不正确!"
            return False
                
        
        #====================更新开户行行号====================
        AfaLoggerFunc.tradeInfo(">>>更改开户行行号")
        update_sql = ""
        update_sql = "UPDATE TIPS_CUSTINFO SET PAYOPBKCODE = '" + TradeContext.payBkCode1 + "'"
        update_sql = update_sql + "WHERE TAXORGCODE = '" + TradeContext.taxOrgCode + "'"
        update_sql = update_sql + " AND PAYACCT ='" + TradeContext.payAcct + "'"
        update_sql = update_sql + " AND PAYOPBKCODE ='" + TradeContext.payBkCode+ "'"
        update_sql = update_sql + " AND PROTOCOLNO ='" +TradeContext.protocolNo+"'" 
        
        AfaLoggerFunc.tradeInfo(update_sql)
        
        if  AfaDBFunc.UpdateSqlCmt(update_sql)<0:
                return AfaFlowControl.ExitThisFlow("A0027","更新开户行行号失败!")
        
        TradeContext.errorCode,TradeContext.errorMsg = "0000","交易成功"

        AfaLoggerFunc.tradeInfo( '退出变更开户行行号[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
    
        return True 
    
    except Exception, e:             

        AfaFlowControl.exitMainFlow(str(e))    
コード例 #6
0
ファイル: T5204_8439.py プロジェクト: bianhezhen/AFA1.0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('缴费信息查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
    try:
        sql = "select agentserialno,"
        sql = sql + "userno,username,idcode,amount,usernameb,idcodeb,loandate,loanenddate,crevouno,crebarno,procode,cpicteller,note1 "
        sql = sql + " from afa_adbinfo where userno = '" + TradeContext.CpicNo.strip() + "' and note3 = '" + TradeContext.unitno.strip() + "'"
        sql = sql + " and workdate = '"+TradeContext.workDate + "'"
        sql = sql + " and tellerno = '"+TradeContext.tellerno + "'"
        sql = sql + " and dtlstatus = '0' "
        sql = sql + " order by agentserialno desc"
        AfaLoggerFunc.tradeInfo('缴费信息查询语句'+ sql)
        records = AfaDBFunc.SelectSql( sql )
        if(len(records) < 1):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","无此投保信息"
            return False
        else:
            #用户编号(保险单号)
            TradeContext.CpicNo = records[0][1]
            #投保人名称
            TradeContext.UserName = records[0][2]
            #投保人身份证号码
            TradeContext.GovtID = records[0][3]
            #金额
            TradeContext.PaymentAmt = records[0][4]
            #被保人姓名
            TradeContext.UserNameB = records[0][5]
            #被保人身份证号码
            TradeContext.GovtIDB = records[0][6]
            #借款日期
            TradeContext.LoanDate = records[0][7]
            #借款到期日
            TradeContext.LoanEndDate = records[0][8]
            #借款凭证编号
            TradeContext.CreVouNo = records[0][9]
            #贷款合同编号
            TradeContext.CreBarNo = records[0][10]
            #保险种类
            TradeContext.ProCode = records[0][11]
            #太保业务员代码
            TradeContext.CpicTeller = records[0][12]
            #保单号
            TradeContext.CpciPNo = records[0][13]
            #交易返回码
            TradeContext.errorCode = '0000'
        AfaLoggerFunc.tradeInfo('退出缴费信息查询交易' )
        return True
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #7
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('进入查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )
    try:
        if( TradeContext.errorCode == '0000' ):
            TradeContext.errorMsg = '交易成功'
        else:
            if( long(TradeContext.errorCode) < 0 ):
                TradeContext.errorMsg = '与第三方通讯失败'
                return False
            else:
                #响应码转换
                #return (AfaFunc.GetRespMsg( TradeContext.errorCode,TradeContext.sysId ))
                return True
        AfaLoggerFunc.tradeInfo('退出查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )
        return True
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #8
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('进入查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )
    try:
        
        Party3Context.agentSerialno = TradeContext.agentserialno
        Party3Context.workDate      = TradeContext.workDate
        Party3Context.workTime      = TradeContext.workTime
        Party3Context.amount        = TradeContext.amount
        Party3Context.hostserialno  = TradeContext.hostserialno
        Party3Context.CreBarNo      = TradeContext.CreBarNo  
        Party3Context.CreVouNo      = TradeContext.CreVouNo  
        Party3Context.LoanDate      = TradeContext.LoanDate
        Party3Context.LoanEndDate   = TradeContext.LoanEndDate
        Party3Context.ProCode       = TradeContext.ProCode
        Party3Context.ProCodeStr    = TradeContext.ProCodeStr
        Party3Context.PlanName      = TradeContext.PlanName  
        Party3Context.AccType       = TradeContext.AccType   
        
        names = Party3Context.getNames( )
        for name in names:
            value = getattr( Party3Context, name )
            setattr( TradeContext, name, value )
            #AfaLoggerFunc.tradeInfo("字段名称  ["+str(name)+"] =  "+str(value))
        if( TradeContext.errorCode == '0000' ):
            #if( TradeContext.existVariable( "ProCodeStr" ) ):
            #    if (TradeContext.ProCodeStr == "EL5602"):
            #        TradeContext.ProCode == "1"
            #    else:
            #        TradeContext.ProCode == "0"
            #责任起始日期日期
            if ( TradeContext.existVariable( "EffDate" )):
                if ( len(str(TradeContext.EffDate)) == 14 ):
                    TradeContext.EffDate = TradeContext.EffDate[0:4]+TradeContext.EffDate[6:8]+TradeContext.EffDate[10:12]
            if ( TradeContext.existVariable( "TermDate" )):
                if ( len(str(TradeContext.TermDate)) == 14 ):
                    TradeContext.TermDate = TradeContext.TermDate[0:4]+TradeContext.TermDate[6:8]+TradeContext.TermDate[10:12]
            update_sql = "update afa_maintransdtl set "
            update_sql = update_sql + " userno = '" + TradeContext.NCpicNo + "'"
            update_sql = update_sql + " where userno = '" + TradeContext.OCpicNo + "'"
            if not AfaDBFunc.UpdateSqlCmt(update_sql):
                return AfaFlowControl.exitThisFlow("A999","更新投保单号失败")

        AfaLoggerFunc.tradeInfo('退出查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )
        return True
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #9
0
ファイル: AbdtQyIn.py プロジェクト: bianhezhen/AFA1.0
def FalseMsg():

    AfaLoggerFunc.tradeInfo('>>>存放导入错误信息...') 
    
    try:
        
        errorFile = '/home/maps/afa/data/batch/down/' + TradeContext.sysId + TradeContext.busiNo[6:] + TradeContext.workDate + TradeContext.prefileName[-7:-4]+ "_WF.TXT"
        
        mfp = open( errorFile, 'a' ) 
        AfaLoggerFunc.tradeInfo("错误信息的文件为:"  + errorFile) 
        TradeContext.errorFile = TradeContext.errorMsg                                                           
        mfp = open( errorFile, 'a' )                
        mfp.write( TradeContext.errorFile + "\n")
        mfp.close()  
        
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #10
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) :
                setattr( TradeContext, name, value )
                #AfaLoggerFunc.tradeInfo("name:" + str(name) + "     value:" + str(value))
            
        if( TradeContext.errorCode == '0000' ):
            if not AfaYbtdb.AdbSelectQueDtl( ):                             #根据投保单号和日期查询YBT_INFO表,有记录更新,无记录插入
                raise AfaFlowControl.flowException()
        
        AfaLoggerFunc.tradeInfo('退出查询交易与第三方通讯后处理' )
        return True
        
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #11
0
def main( ):
    AfaLoggerFunc.tradeInfo('***农信银系统: ECHO操作模板['+TradeContext.TemplateCode+']进入***')
    try:
        #=====================初始化返回报文变量================================
        #TradeContext.tradeResponse=[]

        TradeContext.sysId = 'RCC01'
        TradeContext.TRCCO = '9900517'
 
        #=====================与中心通讯(回执)==================================
        AfaAfeFunc.CommAfe()

        #=====================退出模板==========================================
        AfaLoggerFunc.tradeInfo('***农信银系统: ECHO操作模板['+TradeContext.TemplateCode+']退出***')


    except AfaFlowControl.flowException, e:
        #流程异常
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #12
0
ファイル: T001000_8623.py プロジェクト: bianhezhen/AFA1.0
def CrtBatchNo( ):

    AfaLoggerFunc.tradeInfo('>>>生成批次委托号')

    try:
        sqlStr = "SELECT NEXTVAL FOR ABDT_ONLINE_SEQ FROM SYSIBM.SYSDUMMY1"

        records = AfaDBFunc.SelectSql( sqlStr )
        if records == None :
            TradeContext.errorCode, TradeContext.errorMsg='E8623', "生成委托号异常"
            raise AfaFlowControl.flowException( )

        #批次号
        TradeContext.BATCHNO = TradeContext.TranDate + str(records[0][0]).rjust(8, '0')

        return True

    except Exception, e:
        AfaFlowControl.exitMainFlow( str(e) )  
コード例 #13
0
def main( ):

    AfaLoggerFunc.tradeInfo('******代收代付.通用轧帐模板[' + TradeContext.TemplateCode + ']进入******' )

    try:

        #=====================初始化返回报文变量================================
        TradeContext.tradeResponse=[]

        #=====================获取当前系统时间==================================
        TradeContext.workDate=AfaUtilTools.GetSysDate( )
        TradeContext.workTime=AfaUtilTools.GetSysTime( )

        #=====================判断应用系统状态==================================
        #if not AfaFunc.ChkSysStatus( ) :
        #    raise AfaFlowControl.flowException( )
                
        #=====================校验公共节点的有效性==============================
        if( not TradeContext.existVariable( "statType" ) ):
            raise AfaFlowControl.flowException( 'A0001', '轧帐类型[statType]值不存在,不能进行轧帐' )

        if( not TradeContext.existVariable( "TransType" ) ):
            raise AfaFlowControl.flowException( 'A0001', '传输类型[TransType]值不存在,不能进行轧帐' )

        AfaLoggerFunc.tradeInfo( '>>>statType  = ' + TradeContext.statType )
        AfaLoggerFunc.tradeInfo( '>>>TransType = ' + TradeContext.TransType)

        #=====================轧帐操作==========================================
        if not StatAccountInfo( TradeContext.statType ) :
            raise AfaFlowControl.flowException( )

        #=====================自动打包==========================================
        TradeContext.tradeResponse.append( ['errorCode',     '0000'] )
        TradeContext.tradeResponse.append( ['errorMsg',      '交易成功'] )

        AfaFunc.autoPackData()

        #=====================退出模板==========================================
        AfaLoggerFunc.tradeInfo( '******代收代付.通用轧帐模板[' + TradeContext.TemplateCode + ']退出******' )

    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #14
0
def SelectBesbName( sBesbNo):
    #=============前台上送数据====================
    #TradeContext.sBESBNO           机构号
    #TradeContext.sBesbSty          机构类型
    
    try:
        
        sqlStr = "SELECT SBSBNM FROM VOUH_FRONT_CRSBA WHERE SBSBNO ='" + sBesbNo + "'"
     
        records = AfaDBFunc.SelectSql( sqlStr)
        if( records == None ):
            tradeExit('A005067', '查询[机构表]操作异常!')
            raise AfaFlowControl.flowException( )
        elif( len( records ) == 0 ):
            tradeExit('A005068', '机构不存在!' )
            raise AfaFlowControl.flowException( )

        return str(records[0][0])
            
            
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( )
コード例 #15
0
ファイル: Tvmenu_admin.py プロジェクト: bianhezhen/AFA1.0
def main( ):

    AfaLoggerFunc.tradeInfo('******柜面对账['+TradeContext.TemplateCode+']进入******')

    try:

        #=====================初始化返回报文变量================================
        TradeContext.tradeResponse=[]
        
        #=====================获取当前系统时间==================================
        TradeContext.workDate=AfaUtilTools.GetSysDate( )
        TradeContext.workTime=AfaUtilTools.GetSysTime( )
        #=====================柜面对账处理======================================
        admin()
        #=============自动打包====================
        AfaFunc.autoPackData()

        #=====================退出模板==========================================
        AfaLoggerFunc.tradeInfo('******柜面对账['+TradeContext.TemplateCode+']退出******')

    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #16
0
def SubModuleDoSnd( ):
    AfaLoggerFunc.tradeInfo('进入缴费反交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )
    try:
        
        Party3Context.preAgentSerno = TradeContext.preAgentSerno
        Party3Context.Amount        = TradeContext.amount        
        Party3Context.workDate      = TradeContext.workDate      

        names = Party3Context.getNames( )
        for name in names:
            value = getattr( Party3Context, name )
            setattr( TradeContext, name, value )
            #AfaLoggerFunc.tradeInfo("字段名称  ["+str(name)+"] =  "+str(value))

        if( TradeContext.errorCode != '0000' ):
            AfaLoggerFunc.tradeInfo("太保返回错误代码 ["+TradeContext.errorCode+"]")
            AfaLoggerFunc.tradeInfo("太保返回错误信息 ["+TradeContext.errorMsg+"]")
            #第三方交易失败后记录错误码和错误信息
            if not AfaAhAdb.ADBUpdateTransdtlRev( ):
                raise AfaFlowControl.accException()
        return True
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #17
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) :
                setattr( TradeContext, name, value )
           
        if( TradeContext.errorCode != '0000' ):
            
            AfaLoggerFunc.tradeInfo("银保通返回错误代码 ["+TradeContext.errorCode+"]")
            AfaLoggerFunc.tradeInfo("银保通返回错误信息 ["+TradeContext.errorMsg+"]")
            
            #第三方交易失败后记录错误码和错误信息
            if not AfaYbtdb.ADBUpdateTransdtlRev( ):
                raise AfaFlowControl.accException()
       
        return True
    
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #18
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) :
                setattr( TradeContext, name, value )
          
        if(TradeContext.errorCode=='0000'):
            TradeContext.errorMsg="手工录入处罚决定书查询交易成功"
        
        AfaLoggerFunc.tradeInfo('安徽手工录入处罚决定书查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']与第三方通讯后处理' )    
        return True
        
    except Exception, e:
        AfaLoggerFunc.tradeInfo( str(e) )
        return AfaFlowControl.exitMainFlow( "E0001",str(e) )
コード例 #19
0
def TrxMain( ):
    
    try:
    
        AfaLoggerFunc.tradeInfo('客户签约信息查询[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']进入' )
        
        #业务编号
        if ( not (TradeContext.existVariable( "Appno" ) and len(TradeContext.Appno.strip()) > 0) ):
            TradeContext.errorCode,TradeContext.errorMsg = '0001', "不存在业务编号"
            raise AfaFlowControl.flowException( )
            
        #单位编号
        if ( not (TradeContext.existVariable( "Busino" ) and len(TradeContext.Busino.strip()) > 0) ):
            TradeContext.errorCode,TradeContext.errorMsg = '0001', "不存在单位编号"
            raise AfaFlowControl.flowException( )
            
        #社保编号
        if ( not (TradeContext.existVariable( "sbno" ) and len(TradeContext.sbno.strip()) > 0) ):
            TradeContext.errorCode,TradeContext.errorMsg = '0001', "不存在社保编号"
            raise AfaFlowControl.flowException( )
        
        #判断单位协议是否有效
        TradeContext.I1APPNO =TradeContext.Appno
        TradeContext.I1BUSINO=TradeContext.Busino
        if ( not AhXnbFunc.ChkUnitInfo( ) ):
            return False
        
        sql = ""
        sql = sql + "select USERNAME,IDCODE,ACCNO,VOUHTYPE,PROTOCOLNO,BRNO,CONTRACTDATE from abdt_custinfo where "
        sql = sql + " APPNO ='" + TradeContext.Appno + "'"
        sql = sql + " and BUSINO ='" + TradeContext.Busino+ "'"
        sql = sql + " and BUSIUSERNO ='" +TradeContext.sbno+"'" 
        
        AfaLoggerFunc.tradeInfo("客户签约查询sql="+sql)
        records = AfaDBFunc.SelectSql( sql )
        
        if(records == None):
            AfaLoggerFunc.tradeInfo("查询数据库异常")
            TradeContext.errorCode,TradeContext.errorMsg = "0001","查询数据库异常"
            
        elif(len(records)==0):
            AfaLoggerFunc.tradeInfo("没有查询到相关签约信息")
            TradeContext.errorCode,TradeContext.errorMsg = "0001","没有查询到相关签约信息"
            
        elif(len(records)>1):
            AfaLoggerFunc.tradeInfo("客户签约信息不唯一")
            TradeContext.errorCode,TradeContext.errorMsg = "0001","客户签约信息不唯一"
            
        else:
            TradeContext.name        = records[0][0].strip()     #客户姓名
            TradeContext.idcode      = records[0][1].strip()     #证件号码
            TradeContext.accno       = records[0][2].strip()     #账号
            TradeContext.vouhtype    = records[0][3].strip()     #凭证类型
            TradeContext.protocolno  = records[0][4].strip()     #协议编号
            TradeContext.brno        = records[0][5].strip()     #签约机构
            TradeContext.contract_date = records[0][6].strip()   #签约日期
            
            
            TradeContext.errorCode  = "0000"
            TradeContext.errorMsg   = "交易成功"
            return True
        AfaLoggerFunc.tradeInfo('客户签约查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']退出' )
        
    
    except Exception, e:                   
        AfaFlowControl.exitMainFlow(str(e))
コード例 #20
0
ファイル: T5201_8434.py プロジェクト: simonliuyl/AFA1.0
def SubModuleDoFst( ):

    #begin  20091120  蔡永贵  增加
    #校验保险公司代码和凭证种类是否合法
    if not AfaAhAdb.ADBCheckCert( ):
        return False
    #end

    AfaLoggerFunc.tradeInfo( '初始化交易变量' )
    #交易代码
    TradeContext.tradeCode = TradeContext.TransCode
    #险种
    if( TradeContext.existVariable( "ProCode" ) ):
        if ( TradeContext.ProCode == "1" ):
            TradeContext.ProCodeStr = "EL5612"
            TradeContext.PlanName   = "安贷宝"
            TradeContext.OCpicType  = "002"
        elif ( TradeContext.ProCode == "2" ):
            TradeContext.ProCodeStr = "211610"
            TradeContext.PlanName   = "华夏借款人意外伤害保险"

    try:
        #查询保单号
        sql = ""
        sql = "select note5,note4,note2,note8,amount,bankserno,acctype,agentserialno from afa_maintransdtl where agentserialno = '"+TradeContext.PreSerialno+"'"
        sql = sql + " and userno = '"+TradeContext.OCpicNo+"'"
        sql = sql + " and bankstatus = '0' and corpstatus = '0' and revtranf = '0'"
        AfaLoggerFunc.tradeInfo('当日单证重打查询语句'+ sql)
        records = AfaDBFunc.SelectSql( sql )
        if(len(records) < 1):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","无此交易"
            return False
        else:
            AfaLoggerFunc.tradeDebug("records=" + str(records))
            TradeContext.PolNumber = records[0][0]
            #note1 : "贷款合同编号"+"|"+"贷款凭证编号"
            arrayList = ""
            arrayList = (records[0][1]).split("|")
            TradeContext.CreBarNo = arrayList[0].strip()
            TradeContext.CreVouNo = arrayList[1].strip()
            #note2 : "借款日期"+"|"+"借款到期日"
            arrayList = ""
            arrayList = (records[0][2]).split("|")
            TradeContext.LoanDate    = arrayList[0].strip()
            TradeContext.LoanEndDate = arrayList[1].strip()
            #note8 : "投保份数"+"|"+"险种代码"+"|"+"险种名称"
            arrayList = ""
            arrayList = (records[0][3]).split("|")
            TradeContext.IntialNum    = arrayList[0].strip()
            TradeContext.ProCodeStr   = arrayList[1].strip()
            TradeContext.PlanName     = arrayList[2].strip()
            #amount : "缴费金额"
            TradeContext.amount      = records[0][4].strip()
            #bankserno : "主机柜员流水号"
            TradeContext.hostserialno = records[0][5].strip()
            #acctype : "账户类型"
            if records[0][6].strip() == '000':
                TradeContext.AccType = "0"
            else:
                TradeContext.AccType = "4"
            #agentSerialno: "中间业务流水号"
            TradeContext.agentserialno = records[0][7].strip()
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #21
0
ファイル: TYBT001_8614.py プロジェクト: simonliuyl/AFA1.0
def SubModuleDoFst( ):

    #校验保险公司代码和凭证种类是否合法
    if not AfaAhAdb.ADBCheckCert( ):
        return False
    
    AfaLoggerFunc.tradeInfo( '初始化单证重打交易变量' )
    #交易代码
    TradeContext.tradeCode = TradeContext.TransCode
    
    try:
        #查询原缴费记录是否存在
        sql = ""
        sql = "select note9,amount,bankserno,agentserialno,tellerno,brno,draccno from afa_maintransdtl where agentserialno = '"+TradeContext.PreSerialno+"'"
        sql = sql + " and userno = '" + TradeContext.userno + "' and workdate = '" + TradeContext.workDate + "'"
        sql = sql + " and bankstatus = '0' and corpstatus = '0' and revtranf = '0'"
        
        AfaLoggerFunc.tradeInfo('当日单证重打查询语句'+ sql)
        
        records = AfaDBFunc.SelectSql( sql )
         
        if records==None:
            TradeContext.errorCode,TradeContext.errorMsg = "0001" ,"查询银保通数据库失败"
            raise AfaFlowControl.flowException( )
        
        elif(len(records) < 1):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","无此交易,不能重打印"
            return False
        
        else:
            AfaLoggerFunc.tradeDebug("records=" + str(records))
            
        if(records[0][4] != TradeContext.tellerno):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","原交易非本柜员所做,不能做此交易"
            return False
        
        if(records[0][5] != TradeContext.brno):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","原交易非本网点所做,不能做此交易"
            return False
              
        if (TradeContext.policy!=records[0][0].split('|')[2].strip()):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","保险单号不符,请重新输入"
            return False
            
        if (TradeContext.premium!=records[0][1].strip()):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","交易金额不符,请重新输入"
            return False
        #投保单号
        TradeContext.applno = records[0][0].split('|')[1].strip()    
        #amount : "缴费金额"
        TradeContext.amount  = records[0][1].strip()
        
        #bankserno : "主机柜员流水号"
        TradeContext.hostserialno = records[0][2].strip()
        
        #agentSerialno: "中间业务流水号"
        TradeContext.agentserialno = records[0][3].strip()
        
        #draccno : 转账账号
        TradeContext.payacc = records[0][6].strip()
    
        return True        
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #22
0
ファイル: Tvouh024.py プロジェクト: bianhezhen/AFA1.0
def main( ):
    
    AfaLoggerFunc.tradeInfo( '打印报表['+TradeContext.TemplateCode+']进入' )
    
    #=============前台上送数据====================
    #TradeContext.sTellerNo          柜员号 
    #TradeContext.sWorkDate          交易日期
    #TrddeContext.sBesbNo            机构号

    
    
    try:
        #=============获取机构类型==========================
        HostContext.I1OTSB = TradeContext.sBesbNo         #机构号
        HostContext.I1SBNO = TradeContext.sBesbNo         #机构号
        HostContext.I1USID = TradeContext.sTellerNo       #柜员号
        HostContext.I1WSNO = TradeContext.sWSNO           #终端号
        if(not VouhHostFunc.CommHost('2001')):
            tradeExit(TradeContext.errorCode, TradeContext.errorMsg)
            raise AfaFlowControl.flowException( )
        if(TradeContext.errorCode == '0000'):
            SBNO = HostContext.O1SBCH
            AfaLoggerFunc.tradeInfo( SBNO )
        
        #=============获取柜员级别==========================
        HostContext.I1TELR = TradeContext.sTellerNo       #柜员号
        HostContext.I1SBNO = TradeContext.sBesbNo         #机构号
        HostContext.I1USID = TradeContext.sTellerNo       #柜员号
        HostContext.I1WSNO = TradeContext.sWSNO           #终端号
        if(not VouhHostFunc.CommHost('8809')):
            tradeExit(TradeContext.errorCode, TradeContext.errorMsg)
            raise AfaFlowControl.flowException( )
        if(TradeContext.errorCode == '0000'):
            TELLER = HostContext.O1TLRK
            AfaLoggerFunc.tradeInfo( TELLER )
        
        #=============初始化返回报文变量==================
        TradeContext.tradeResponse = []
        
        #=================获取机构名称==============================
        #begin 20100920 蔡永贵修改 避免机构不存在时查询结果为空而抛出错误
        #TradeContext.sBesbName = VouhFunc.SelectBesbName(TradeContext.sBesbNo)
        if not VouhFunc.SelectBesbName(TradeContext.sBesbNo):
            raise AfaFlowControl.flowException( )
        else:
            TradeContext.sBesbName = VouhFunc.SelectBesbName(TradeContext.sBesbNo)
        #end

        #=====================获取机构类型===============================
        #TradeContext.sBesbSty = VouhFunc.SelectBesbSty(TradeContext.sBesbNo)
        #AfaLoggerFunc.tradeInfo('================='+TradeContext.sBesbSty)

        #=============获取当前系统时间====================
        TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( )
        TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) 
        
        #begin凭证优化更改201109  
        #=============获取柜员尾箱号===============================
        HostContext.I1SBNO = TradeContext.sBesbNo         #机构号
        HostContext.I1USID = TradeContext.sTellerNo       #柜员号
        HostContext.I1WSNO = TradeContext.sWSNO           #终端号
        HostContext.I1EDDT = TradeContext.sLstTrxDay      #终止日期
        HostContext.I1TELR = TradeContext.sTellerNo       #柜员代号
        
        if(not VouhHostFunc.CommHost('0104')):
            VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg )
            raise AfaFlowControl.flowException( )
        if(TradeContext.errorCode == '0000'):
            TradeContext.sTellerTailNobak = HostContext.O2CABO
            TradeContext.sTellerTailNo    = TradeContext.sTellerTailNobak[0]                 
            AfaLoggerFunc.tradeInfo( '交易柜员尾箱号:' + TradeContext.sTellerTailNo ) 
        #end   
        
        vouh = []
        count1 = 0
        count2 = 0
        count3 = 0
        AfaLoggerFunc.tradeInfo(TradeContext.sTellerTailNo)
        sqlStr = "select VOUHTYPE,VOUHNAME from VOUH_PARAMETER where substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' order by VOUHTYPE"
        AfaLoggerFunc.tradeInfo(sqlStr)
        records = AfaDBFunc.SelectSql( sqlStr )
        if( records == None ):
            tradeExit('A005067', '查询[凭证参数表]操作异常!')
            raise AfaFlowControl.flowException( )
        elif( len( records ) == 0 ):
            tradeExit('A005068', '凭证不存在!' )
            raise AfaFlowControl.flowException( )
        else :
            for i in range(len(records)):
                num1 = 0
                num2 = 0
                num3 = 0
                if(SBNO == '33' and TELLER == "10"):
                    
                    #查询凭证领用数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and TRANSTATUS = '0' \
                            and VOUHSTATUS = '0'"
                    res1 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr)
                    if( res1 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res1 ) == 0 ):
                        num1 = 0
                    else :
                        num1 = res1[0][0]
                        if(num1 == None):
                            num1 = 0
                        AfaLoggerFunc.tradeInfo(num1)  
                          
                    #查询凭证付出数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and TRANSTATUS = '0' \
                            and VOUHSTATUS in ('1','2')"
                    res2 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr)
                    if( res2 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res2 ) == 0 ):
                        num2 = 0
                    else :
                        num2 = res2[0][0]
                        if(num2 == None):
                            num2 = 0
                        AfaLoggerFunc.tradeInfo(num2)  
                         
                    #查询凭证余数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \
                            where VOUHTYPE = '" + records[i][0] + "' \
                            and TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and VOUHSTATUS = '0'"
                    res3 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr)
                    if( res3 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res3 ) == 0 ):
                        num3 = 0
                    else :
                        num3 = res3[0][0]
                        if(num3 == None):
                            num3 = 0
                        AfaLoggerFunc.tradeInfo(num3)  
                          
                elif(TELLER == "10"):
                    
                    #查询凭证领用数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and (TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            or RIVTELLER = '" + TradeContext.sTellerTailNo + "') \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and TRANSTATUS = '0' \
                            and VOUHSTATUS = '2'"
                    res1 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr)
                    if( res1 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res1 ) == 0 ):
                        num1 = 0
                    else :
                        num1 = res1[0][0]
                        if(num1 == None):
                            num1 = 0
                            
                    #查询凭证付出数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and TRANSTATUS = '0' \
                            and EXSTATUS = '2' \
                            and VOUHSTATUS in ('0','3')"
                    res2 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr)
                    if( res2 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res2 ) == 0 ):
                        num2 = 0
                    else :
                        num2 = res2[0][0]
                        if(num2 == None):
                            num2 = 0
                            
                    #查询凭证余数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \
                            where VOUHTYPE = '" + records[i][0] + "' \
                            and TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and VOUHSTATUS = '2'"
                    res3 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr)
                    if( res3 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res3 ) == 0 ):
                        num3 = 0
                    else :
                        num3 = res3[0][0]
                        if(num3 == None):
                            num3 = 0
                            
                elif(TELLER == "20"):
                    
                    #查询凭证领用数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and TRANSTATUS = '0' \
                            and VOUHSTATUS = '2'"
                    res1 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr)
                    if( res1 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res1 ) == 0 ):
                        num1 = 0
                    else :
                        num1 = res1[0][0]
                        if(num1 == None):
                            num1 = 0
                            
                    #查询凭证付出数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and TRANSTATUS = '0' \
                            and EXSTATUS = '3' \
                            and VOUHSTATUS in ('2','4','5','6')"
                    res2 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr)
                    if( res2 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res2 ) == 0 ):
                        num2 = 0
                    else :
                        num2 = res2[0][0]
                        if(num2 == None):
                            num2 = 0
                            
                    #查询凭证余数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \
                            where VOUHTYPE = '" + records[i][0] + "' \
                            and substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and VOUHSTATUS in ('2','3')"
                    res3 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr)
                    if( res3 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res3 ) == 0 ):
                        num3 = 0
                    else :
                        num3 = res3[0][0]
                        if(num3 == None):
                            num3 = 0
                            
                else:
                    
                    #查询凭证领用数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and (TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            or RIVTELLER = '" + TradeContext.sTellerTailNo + "') \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and TRANSTATUS = '0' \
                            and VOUHSTATUS = '3'"
                    res1 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr)
                    if( res1 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res1 ) == 0 ):
                        num1 = 0
                    else :
                        num1 = res1[0][0]
                        if(num1 == None):
                            num1 = 0
                            
                    #查询凭证付出数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \
                            where WORKDATE = '" + TradeContext.sWorkDate + "' \
                            and TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and VOUHTYPE = '" + records[i][0] + "' \
                            and TRANSTATUS = '0' \
                            and EXSTATUS = '3' \
                            and VOUHSTATUS in ('2','4','5','6')"
                    res2 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr)
                    if( res2 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res2 ) == 0 ):
                        num2 = 0
                    else :
                        num2 = res2[0][0]
                        if(num2 == None):
                            num2 = 0
                            
                    #查询凭证余数
                    sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \
                            where VOUHTYPE = '" + records[i][0] + "' \
                            and TELLERNO = '" + TradeContext.sTellerTailNo + "' \
                            and BESBNO = '" + TradeContext.sBesbNo + "' \
                            and VOUHSTATUS = '3'"
                    res3 = AfaDBFunc.SelectSql( sqlStr )
                    AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr)
                    if( res3 == None ):
                        tradeExit('A005067', '查询[凭证表]操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif( len( res3 ) == 0 ):
                        num3 = 0
                    else :
                        num3 = res3[0][0]
                        if(num3 == None):
                            num3 = 0
                    
                vouh.append([records[i][0],records[i][1],str(num1),str(num2),str(num3)])
                
                count1 = count1 + num1
                count2 = count2 + num2
                count3 = count3 + num3

        
        rBankFile= os.environ['AFAP_HOME'] + '/data/vouh/vouhtmp.txt'
      

        #创建业务报表文件
        bFp = open(rBankFile, "w")
        AfaLoggerFunc.tradeInfo('-----' + TradeContext.sBesbNo)
        AfaLoggerFunc.tradeInfo('-----' + TradeContext.sBesbName)
        AfaLoggerFunc.tradeInfo('-----' + TradeContext.sTellerTailNo)
        AfaLoggerFunc.tradeInfo('-----' + TradeContext.sWorkDate)
        
        #写入标题
        bFp.write('\n                          **************** 代理业务凭证余额表 ****************                         \n\n')
        bFp.write('              机构号码:' + TradeContext.sBesbNo + '        机构名称: ' + TradeContext.sBesbName +  '\n')
        bFp.write('              柜员号码:' + TradeContext.sTellerTailNo +  '            日期:' + TradeContext.sWorkDate +  '\n')
        bFp.write('    ------------------------------------------------------------------------------------------------------\n')
        bFp.write('    |   序号   | 凭证种类 |          凭证姓名            |   收方发生额  |   付方发生额  |      余额     |\n')
        bFp.write('    |----------|----------|------------------------------|---------------|---------------|---------------|\n')
            
        AfaLoggerFunc.tradeInfo('------------test5')
        for i in range( len( vouh ) ):

            wbuffer = '    |'
            wbuffer = wbuffer + str(i+1).ljust(10,' ') + '|'
            wbuffer = wbuffer +(vouh[i][0].strip()).ljust(10, ' ') + '|'
            wbuffer = wbuffer +(vouh[i][1].strip()).ljust(30, ' ') + '|'
            wbuffer = wbuffer +(vouh[i][2].strip()).rjust(15, ' ') + '|'
            wbuffer = wbuffer +(vouh[i][3].strip()).rjust(15, ' ') + '|'
            wbuffer = wbuffer +(vouh[i][4].strip()).rjust(15, ' ') + '|'

            #写入报表文件
            bFp.write(wbuffer + '\n')
            bFp.write('    |----------|----------|------------------------------|---------------|---------------|---------------|\n')
        
        bFp.write('    |   合计   |          |                              |' + str(count1).rjust(15,' ') + '|' + str(count2).rjust(15,' ') + '|' + str(count3).rjust(15,' ')+ '|\n')
        bFp.write('    ------------------------------------------------------------------------------------------------------\n')
        #关闭文件
        bFp.close()
        
        TradeContext.tradeResponse.append( ['sBesbNo',TradeContext.sBesbNo] )
        TradeContext.tradeResponse.append( ['sTellerTailNo',TradeContext.sTellerTailNo] )
        TradeContext.tradeResponse.append( ['sTellerNo',TradeContext.sTellerNo] )             #凭证优化更改201109 
        TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] )
        TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] )
        TradeContext.tradeResponse.append( ['sFileName','vouhtmp.txt'] )
        TradeContext.tradeResponse.append( ['errorCode','0000'] )
        TradeContext.tradeResponse.append( ['errorMsg','交易成功'] )
        AfaFunc.autoPackData()
        #=============程序退出====================
        AfaLoggerFunc.tradeInfo( '打印报表['+TradeContext.TemplateCode+']退出' )
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( )
コード例 #23
0
ファイル: T003101.py プロジェクト: bianhezhen/AFA1.0
def main( ):

    sernoFlag = 0
    
    AfaLoggerFunc.tradeInfo( '******代收代付.查询明细模板['+TradeContext.TemplateCode+']进入******' )

    try:
        #=====================初始化返回报文变量================================
        TradeContext.tradeResponse=[]


        #=====================获取当前系统时间==================================
        TradeContext.workDate=AfaUtilTools.GetSysDate( )
        TradeContext.workTime=AfaUtilTools.GetSysTime( )

        #=====================判断应用系统状态==================================
        if not AfaFunc.ChkSysStatus( ) :
            raise AfaFlowControl.flowException( )

        #=====================校验公共节点的有效性==============================
        if( not TradeContext.existVariable( "zoneno" ) ):
            TradeFunc.exitOnError( 'A0001', '地区号[zoneno]值不存在,不能进行查询操作' )


        if( not TradeContext.existVariable( "brno" ) ):
            TradeFunc.exitOnError( 'A0001', '网点号[brno]值不存在,不能进行查询操作' )


        if( not TradeContext.existVariable( "tellerno" ) ):
            TradeFunc.exitOnError( 'A0001', '网点号[tellerno]值不存在,不能进行查询操作' )


        if( not TradeContext.existVariable( "transStatus" ) ):
            TradeFunc.exitOnError( 'A0001', '交易状态[transStatus]值不存在,不能进行查询操作' )


        if( not TradeContext.existVariable( "queryMode" ) ):
            TradeFunc.exitOnError( 'A0001', '查询方式[queryMode]值不存在,不能进行查询操作' )


        if( not TradeContext.existVariable( "orderMode" ) ):
            TradeFunc.exitOnError( 'A0001', '排序方式[orderMode]值不存在,不能进行查询操作' )


        if( not TradeContext.existVariable( "queryCount" ) ):
            TradeFunc.exitOnError( 'A0001', '查询条数[queryCount]值不存在,不能进行查询操作' )


        if( not TradeContext.existVariable( "TransType" ) ):
            TradeFunc.exitOnError( 'A0001', '传输类型[TransType]值不存在,不能进行查询操作' )


        AfaLoggerFunc.tradeInfo('>>>transStatus   = ' + TradeContext.transStatus)
        AfaLoggerFunc.tradeInfo('>>>queryMode     = ' + TradeContext.queryMode)
        AfaLoggerFunc.tradeInfo('>>>orderMode     = ' + TradeContext.orderMode)
        AfaLoggerFunc.tradeInfo('>>>queryCount    = ' + TradeContext.queryCount)
        AfaLoggerFunc.tradeInfo('>>>TransType     = ' + TradeContext.TransType)
        AfaLoggerFunc.tradeInfo('>>>tradeDate     = ' + TradeContext.tradeDate)


        #=====================定义每次返回的数据的记录数========================
        queryCount = int( TradeContext.queryCount )


        #=====================数据打包时使用list================================
        names=['agentSerialno', 'sysId', 'unitno', 'subUnitno', 'workDate', 'workTime','agentFlag', 'transCode', 'zoneno', 'brno', 'tellerno', \
        'channelCode', 'accType', 'drAccno', 'crAccno', 'userno', 'subuserno', 'username', 'vouhType', 'vouhno', \
        'vouhDate', 'amount', 'subAmount', 'bankStatus', 'bankSerno', 'corpStatus', 'errormsg', 'note1', \
        'note2', 'note3', 'note4', 'note5', 'note6', 'note7', 'note8', 'note9', 'note10']


        # =====================查询字段与数据打包的list一一对应=================
        SqlStr = "SELECT AGENTSERIALNO,SYSID,UNITNO,SUBUNITNO,WORKDATE,WORKTIME,AGENTFLAG,TRXCODE,ZONENO,BRNO,TELLERNO,"
        SqlStr = SqlStr + "CHANNELCODE,ACCTYPE,DRACCNO,CRACCNO,USERNO,SUBUSERNO,USERNAME,VOUHTYPE,VOUHNO,"
        SqlStr = SqlStr + "VOUHDATE,AMOUNT,SUBAMOUNT,BANKSTATUS,BANKSERNO,CORPSTATUS,ERRORMSG,NOTE1,"
        SqlStr = SqlStr + "NOTE2,NOTE3,NOTE4,NOTE5,NOTE6,NOTE7,NOTE8,NOTE9,NOTE10 FROM AFA_MAINTRANSDTL "


        #=====================统计总笔数和总金额================================
        sql_count = "SELECT COUNT(*),SUM(CAST(AMOUNT AS DECIMAL(17,2))) FROM AFA_MAINTRANSDTL"

        sql = ''
        if ( int( TradeContext.queryMode ) == 4 ):              #自由查询方式
            if( not TradeContext.existVariable( "whereClause" ) ):
                TradeFunc.exitOnError( 'A0001', '查询条件[whereClause]值不存在,不能进行查询操作' )

            sql= sql + TradeContext.whereClause + " AND REVTRANF='0' "

            AfaLoggerFunc.tradeInfo('>>>whereClause   = ' + TradeContext.whereClause)

        else:
            if( not TradeContext.existVariable( "tradeDate" ) ):
                TradeFunc.exitOnError( 'A0001', '交易日期[tradeDate]值不存在,不能进行查询操作' )

            if( not TradeContext.existVariable( "channelCode" ) ):
                TradeFunc.exitOnError( 'A0001', '渠道代码[channelCode]值不存在,不能进行查询操作' )

            #日期
            sql = sql + " WHERE WORKDATE='"     + TradeContext.tradeDate        + "'"

            #地区号
            sql = sql + " AND CHANNELCODE='"    + TradeContext.channelCode      + "'"

            #地区号
            sql = sql + " AND ZONENO='"         + TradeContext.zoneno           + "'"

            #网点号
            sql = sql + " AND BRNO='"           + TradeContext.brno             + "'"

            #柜员
            sql = sql + " AND TELLERNO='"       + TradeContext.tellerno         + "'"

            #柜员
            sql = sql + " AND REVTRANF='"       + "0"                           + "'"
            
            #用户
            if( TradeContext.existVariable( "userno" ) and len(TradeContext.userno)>0 ):
                sql = sql + " AND USERNO='"     + TradeContext.userno           + "'"

            #金额
            if( TradeContext.existVariable( "amount" ) and int(float(TradeContext.amount)*100)!=0 ):
                sAmount="0.00";
                for i in range(0, len(TradeContext.amount)):
                    if TradeContext.amount[i] == '0':
                        continue
                    sAmount = TradeContext.amount[i:]
                    break

                sql = sql + " AND AMOUNT='"     + sAmount           + "'"

            #用户名
            if( TradeContext.existVariable( "username" ) and len(TradeContext.username)>0 ):
                sql = sql + " AND USERNAME='******'"

            #帐号
            if( TradeContext.existVariable( "accno" ) and len(TradeContext.accno)>0 ):
                sql = sql + " AND (DRACCNO='"   + TradeContext.accno + "' OR CRACCNO='" + TradeContext.accno + "')"

        #transStatus:交易状态(1-正常, 2-未知, 3-全部)
        if( int( TradeContext.transStatus )   == 1 ):

            #查询正常交易
            sql = sql + " AND BANKSTATUS='0' AND CORPSTATUS='0'"

        elif( int( TradeContext.transStatus ) == 2 ):

            #查询未知交易
            sql = sql + " AND (AGENTFLAG IN ('01','03') AND (BANKSTATUS='2' OR (BANKSTATUS='0' AND CORPSTATUS IN ('1', '2','3')))) OR"
            sql = sql + " (AGENTFLAG IN ('02','04') AND (CORPSTATUS='2' OR (CORPSTATUS='0' AND BANKSTATUS IN ('1', '2','3')))) "

        elif( int( TradeContext.transStatus ) != 3 ):
            TradeContext.errorCode, TradeContext.errorMsg='A0041', "入口参数条件不符[交易状态]:"+str( TradeContext.transStatus )
            raise AfaFlowControl.flowException( )


        #queryMode:查询方式(1-按流水号查询, 2-按系统代码查询, 3-查询全部正交易, 4-自由查询方式)
        if( int( TradeContext.queryMode ) == 1 ):

            #按流水号查询
            if( not TradeContext.existVariable( "agentSerialno" ) ):
                TradeFunc.exitOnError( 'A0001', '流水号[agentSerialno]值不存在!' )

            sql = sql + " AND AGENTSERIALNO='"+TradeContext.agentSerialno + "'"
            sernoFlag = 1
            
        elif( int( TradeContext.queryMode ) == 2 ):

            #按系统代码查询
            if( not TradeContext.existVariable( "sysId" ) ):
                TradeFunc.exitOnError( 'A0001', '系统代码[sysId]值不存在!' )

            #系统代码
            sql = sql + " AND SYSID='"       + TradeContext.sysId     + "'"


            #按流水号查询
            if( TradeContext.existVariable( "agentSerialno" ) and len(TradeContext.agentSerialno)>0 ):
                sql = sql + " AND AGENTSERIALNO='"+TradeContext.agentSerialno + "'"
                sernoFlag = 1

            #业务方式
            if( TradeContext.existVariable( "agentFlag" ) and len(TradeContext.agentFlag)>0 ):
                sql=sql + " AND AGENTFLAG='" + TradeContext.agentFlag + "'"


            #单位代码
            if( TradeContext.existVariable( "unitno" ) and len(TradeContext.unitno)>0 ):
                sql=sql + " AND UNITNO='"    + TradeContext.unitno    + "'"


            #子单位代码
            if( TradeContext.existVariable( "subUnitno" ) and len(TradeContext.subUnitno)>0 ):
                sql=sql + " AND SUBUNITNO='" + TradeContext.subUnitno + "'"


        elif( int( TradeContext.queryMode ) != 3 and int( TradeContext.queryMode ) != 4 ):
            TradeContext.errorCode, TradeContext.errorMsg='A0041', "入口参数条件不符[查询方式]:"+str( TradeContext.queryMode )
            raise AfaFlowControl.flowException( )

        sql_count = sql_count + sql


        #按流水查询应该是单结果集的,没有排序的必要
        if( int( TradeContext.queryMode ) != 1  and sernoFlag==0):

            #orderMode:排序方式:1-正序 2-逆序
            if( int( TradeContext.orderMode ) == 1 ):

                #正序
                if( (not TradeContext.existVariable( "agentSerialno" )) or TradeContext.agentSerialno=='' ):
                    TradeContext.agentSerialno='0'

                sql = sql + " AND AGENTSERIALNO>'" + TradeContext.agentSerialno + "' ORDER BY AGENTSERIALNO ASC"

            else:

                #逆序
                if( (not TradeContext.existVariable( "agentSerialno" )) or TradeContext.agentSerialno=='' ):
                    TradeContext.agentSerialno='99999999'

                sql = sql + " AND AGENTSERIALNO<'"+TradeContext.agentSerialno + "' ORDER BY AGENTSERIALNO DESC"


        #查询数据库
        SqlStr = SqlStr + sql

        AfaLoggerFunc.tradeInfo( '>>>查询明细' )

        AfaLoggerFunc.tradeInfo( SqlStr )

        records=AfaDBFunc.SelectSql( SqlStr, queryCount )

        if( records == None ):
            #None 查询失败
            TradeContext.errorCode, TradeContext.errorMsg='A0025', "数据库操作错误"
            raise AfaFlowControl.flowException( )


        elif( len( records ) == 0 ):
            #无记录
            TradeContext.errorCode, TradeContext.errorMsg='A0025', "没有满足条件的记录"
            raise AfaFlowControl.flowException( )


        AfaLoggerFunc.tradeInfo( '>>>统计总数' )


        #统计总数
        AfaLoggerFunc.tradeInfo( sql_count )


        records_count=AfaDBFunc.SelectSql( sql_count )

        if( records_count == None ):
            TradeContext.errorCode, TradeContext.errorMsg='A0025', "数据库操作错误"
            raise AfaFlowControl.flowException( )

        # 过滤records中的所有None数据
        records=AfaUtilTools.ListFilterNone( records )

        #总共的返回记录数
        total=len( records )
        AfaLoggerFunc.tradeInfo( '返回记录数:[' + str(total) + ']' )

        #公共部分拼包
        TradeContext.tradeResponse=[]
        TradeContext.tradeResponse.append( ['errorCode',     '0000'] )
        TradeContext.tradeResponse.append( ['errorMsg',      '交易成功'] )
        TradeContext.tradeResponse.append( ['retCount',      str( total )] )
        TradeContext.tradeResponse.append( ['retTotalCount', str( records_count[0][0] )])
        TradeContext.tradeResponse.append( ['retTotalAmount',str( records_count[0][1] )])


        if ( TradeContext.TransType == '0' ):
            #按照变量名打包
            for i in range( 0, total ):
                k=0
                for name in names:
                    if( int( TradeContext.orderMode ) == 1 ):
                        TradeContext.tradeResponse.append( [name, records[i][k]] )
                    else:
                        TradeContext.tradeResponse.append( [name, records[total-i-1][k]] )
                    k=k+1
        else:
            MxFileName = os.environ['AFAP_HOME'] + '/tmp/MX' + TradeContext.zoneno + TradeContext.brno + TradeContext.tellerno + '.TXT'
            AfaLoggerFunc.tradeInfo('明细文件:['+MxFileName+']')

            if (os.path.exists(MxFileName) and os.path.isfile(MxFileName)):
                #文件存在,先删除-再创建
                os.system("rm " + MxFileName)

            #创建明细文件
            sfp = open(MxFileName, "w")

            #将每条记录打包成以竖线分隔的格式
            TradeContext.tradeResponse.append(['filename',  'MX' + TradeContext.zoneno + TradeContext.brno + TradeContext.tellerno + '.TXT'])

            for i in range( 0, total ):
                tmpBuffer = ""
                tmpBuffer = tmpBuffer + str(records[i][0]).strip()   + "|"         #AGENTSERIALNO
                tmpBuffer = tmpBuffer + str(records[i][1]).strip()   + "|"         #SYSID
                tmpBuffer = tmpBuffer + str(records[i][2]).strip()   + "|"         #UNITNO
                tmpBuffer = tmpBuffer + str(records[i][3]).strip()   + "|"         #SUBUNITNO
                tmpBuffer = tmpBuffer + str(records[i][4]).strip()   + "|"         #WORKDATE
                tmpBuffer = tmpBuffer + str(records[i][5]).strip()   + "|"         #WORKTIME
                tmpBuffer = tmpBuffer + str(records[i][6]).strip()   + "|"         #AGENTFLAG
                tmpBuffer = tmpBuffer + str(records[i][7]).strip()   + "|"         #TRXCODE
                tmpBuffer = tmpBuffer + str(records[i][8]).strip()   + "|"         #ZONENO
                tmpBuffer = tmpBuffer + str(records[i][9]).strip()   + "|"         #BRNO
                tmpBuffer = tmpBuffer + str(records[i][10]).strip()  + "|"         #TELLERNO
                tmpBuffer = tmpBuffer + str(records[i][11]).strip()  + "|"         #CHANNELCODE
                tmpBuffer = tmpBuffer + str(records[i][12]).strip()  + "|"         #ACCTYPE
                tmpBuffer = tmpBuffer + str(records[i][13]).strip()  + "|"         #DRACCNO
                tmpBuffer = tmpBuffer + str(records[i][14]).strip()  + "|"         #CRACCNO
                tmpBuffer = tmpBuffer + str(records[i][15]).strip()  + "|"         #USERNO
                tmpBuffer = tmpBuffer + str(records[i][16]).strip()  + "|"         #SUBUSERNO
                tmpBuffer = tmpBuffer + str(records[i][17]).strip()  + "|"         #USERNAME
                tmpBuffer = tmpBuffer + str(records[i][18]).strip()  + "|"         #VOUHTYPE
                tmpBuffer = tmpBuffer + str(records[i][19]).strip()  + "|"         #VOUHNO
                tmpBuffer = tmpBuffer + str(records[i][20]).strip()  + "|"         #VOUHDATE
                tmpBuffer = tmpBuffer + str(records[i][21]).strip()  + "|"         #AMOUNT
                tmpBuffer = tmpBuffer + str(records[i][22]).strip()  + "|"         #SUBAMOUNT
                tmpBuffer = tmpBuffer + str(records[i][23]).strip()  + "|"         #BANKSTATUS
                tmpBuffer = tmpBuffer + str(records[i][24]).strip()  + "|"         #BANKSERNO
                tmpBuffer = tmpBuffer + str(records[i][25]).strip()  + "|"         #CORPSTATUS
                tmpBuffer = tmpBuffer + str(records[i][26]).strip()  + "|"         #ERRORMSG
                tmpBuffer = tmpBuffer + str(records[i][27]).strip()  + "|"         #NOTE1
                tmpBuffer = tmpBuffer + str(records[i][28]).strip()  + "|"         #NOTE2
                tmpBuffer = tmpBuffer + str(records[i][29]).strip()  + "|"         #NOTE3
                tmpBuffer = tmpBuffer + str(records[i][30]).strip()  + "|"         #NOTE4
                tmpBuffer = tmpBuffer + str(records[i][31]).strip()  + "|"         #NOTE5
                tmpBuffer = tmpBuffer + str(records[i][32]).strip()  + "|"         #NOTE6
                tmpBuffer = tmpBuffer + str(records[i][33]).strip()  + "|"         #NOTE7
                tmpBuffer = tmpBuffer + str(records[i][34]).strip()  + "|"         #NOTE8
                tmpBuffer = tmpBuffer + str(records[i][35]).strip()  + "|"         #NOTE9
                tmpBuffer = tmpBuffer + str(records[i][36]).strip()  + "|"         #NOTE10

                sfp.write(tmpBuffer + '\n')
                    
            sfp.close()

        #=====================自动打包==========================================
        AfaFunc.autoPackData()

        #=====================退出模板==========================================
        AfaLoggerFunc.tradeInfo( '******代收代付.查询明细模板['+TradeContext.TemplateCode+']退出******' )

    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #24
0
ファイル: T5204_8438.py プロジェクト: simonliuyl/AFA1.0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('进入反查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
    try:
        sql = "select userno,username,amount,draccno,tellerno,craccno,subuserno,note8,note9,note10,note1,unitno,note7 "
        sql = sql + "from afa_maintransdtl where agentserialno = '"+TradeContext.PreSerialno+"'"
        sql = sql + "and workdate = '"+TradeContext.workDate+"'"
        sql = sql + " and revtranf = '0' and bankstatus = '0' and corpstatus = '0' and chkflag = '9'"
        AfaLoggerFunc.tradeInfo('反交易查询语句'+ sql)
        records = AfaDBFunc.SelectSql( sql )
        if(len(records) < 1):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","无此交易"
            return False
        else:
            #if(records[0][4] != TradeContext.tellerno):
            #    TradeContext.errorCode,TradeContext.errorMsg = "0001","原交易非本柜员所做,不能做此交易"
            #    return False
            #用户编号(保险单号)
            TradeContext.CpicNo = records[0][0]
            AfaLoggerFunc.tradeInfo("保险单号"+str(TradeContext.CpicNo))
            #用户名称
            #TradeContext.UserName = records[0][1]
            #金额
            TradeContext.Amount = records[0][2]
            AfaLoggerFunc.tradeInfo("金额"+str(TradeContext.Amount))
            #缴费类型(反款类型)/帐号
            if(type(records[0][3]) is str):
                TradeContext.Accno = records[0][3]
                #TradeContext.backtype = "1"
            else:
                TradeContext.Accno = ""
                #TradeContext.backtype = "0"
            #贷方帐号
            TradeContext.crAccno = records[0][5]
            #投保身份证
            #TradeContext.GovtID = records[0][6]
            #投保份数|保险类型
            arrayList = ""
            arrayList = (records[0][7]).split("|")
            TradeContext.IntialNum = arrayList[0].strip()
            TradeContext.ProCodeStr = arrayList[1].strip()
            #投保人姓名|投保人身份证号码
            arrayList = ""
            arrayList = (records[0][8]).split("|")
            TradeContext.UserName = arrayList[0].strip()
            TradeContext.GovtID   = arrayList[1].strip()
            AfaLoggerFunc.tradeInfo("投保人姓名"+str(TradeContext.UserName))
            #被保人名称|被保人身份证
            arrayList = ""
            arrayList = (records[0][9]).split("|")
            TradeContext.FullName = arrayList[1].strip()
            TradeContext.GovtIDF  = arrayList[2].strip()
            AfaLoggerFunc.tradeInfo("被保人名称"+str(TradeContext.FullName))
            #保单号
            TradeContext.CpciPNo  = records[0][10].strip()
            #单位编码
            TradeContext.unitno  = records[0][11].strip()
            #险种
            TradeContext.ProCode = records[0][12].strip()
            #交易返回码
            TradeContext.errorCode = '0000'
        AfaLoggerFunc.tradeInfo('退出反查询交易' )
        return True
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #25
0
def SubModuleDoSnd():
    AfaLoggerFunc.tradeInfo('单证重打子查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']进入' )
    
    try:
        sql = "select unitno,amount,userno,note4,note5,note8,note9,note10,craccno,note7 from afa_maintransdtl"
        sql = sql + " where agentserialno = '" + TradeContext.transrno.strip() + "'"
        sql = sql + " and   workdate      = '" + TradeContext.workDate.strip() + "'"
        sql = sql + " and   bankstatus    = '0' and corpstatus = '0' and revtranf = '0'"
        
        AfaLoggerFunc.tradeInfo('单证重打信息查询语句'+ sql)
        
        records = AfaDBFunc.SelectSql( sql )
        
        if records == None:
            TradeContext.errorCode,TradeContext.errorMsg = "0001" ,"查询银保通数据库失败"
            raise AfaFlowControl.flowException( )
        
        if(len(records) < 1):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","无此缴费信息"
            return False
        
        else:
            if(records[0][0]!=TradeContext.unitno):
                TradeContext.errorCode,TradeContext.errorMsg='E9999',"单位编号不符"
                return False
            
            if(records[0][1].split()!=TradeContext.amount.split()):
                TradeContext.errorCode,TradeContext.errorMsg='E9999',"与原交易金额不符"
                return False
            
            if(records[0][2]!=TradeContext.userno):
                TradeContext.errorCode,TradeContext.errorMsg='E9999',"与原保单印刷号不符"
                return False
           
            note9=records[0][6].split('|')
            AfaLoggerFunc.tradeInfo(note9[2] + "||"+TradeContext.policy)
            if(note9[2]!=TradeContext.policy):
                TradeContext.errorCode,TradeContext.errorMsg='E9999',"与原保险单号不符"  
                return False
            
            #note9保险单号
            TradeContext.policy=note9[2]
            
            #note8主险险种和附加险种      
            note8= records[0][5].split('|') 
            TradeContext.productid=note8[0]
            TradeContext.productid1=note8[2] 
            
            #note4:投保人姓名|投保人证件号码|与投保人关系        
            note4= records[0][3].split('|') 
            TradeContext.tbr_name=note4[0]
            TradeContext.tbr_idno=note4[1]
            TradeContext.tbr_bbr_rela=note4[2] 
          
            #note5:被保人姓名|被保人证件号码|与被保险人关系 
            note5= records[0][4].split('|') 
            TradeContext.bbr_name=note5[0]
            TradeContext.bbr_idno=note5[1]
            TradeContext.syr_bbr_rela=note5[2] 
            TradeContext.payacc=records[0][8] 

            #note7:交费方式|缴费期次|交费期间
            TradeContext.paymethod = records[0][9].split('|')[0]
            
        #查询受益人信息
        sql = "select syr_info1,syr_info2,syr_info3,syr_info4,syr_info5 from ybt_info"
        sql = sql + " where submino  = '" + note9[1]                    + "'"            #投保单号
        sql = sql + " and   cpicno   = '" + TradeContext.unitno         + "'"            #保险公司代码
        sql = sql + " and   workdate = '" + TradeContext.workDate       + "'"            #交易日期
        sql = sql + " and   tellerno = '" + TradeContext.tellerno       + "'"            #交易柜员
        
        AfaLoggerFunc.tradeInfo('查询受益人信息:'+ sql)
        
        results = AfaDBFunc.SelectSql( sql )
        
        if results == None:
            TradeContext.errorCode,TradeContext.errorMsg = "0001" ,"查询受益人信息异常"
            return False
        
        if(len(results) < 1):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","没有找到相关的受益人信息"
            return False
            
        else:
            TradeContext.syr_1 = results[0][0]                        #受益人1信息
            TradeContext.syr_2 = results[0][1]                        #受益人2信息
            TradeContext.syr_3 = results[0][2]                        #受益人3信息
            TradeContext.syr_4 = results[0][3]                        #受益人4信息
            TradeContext.syr_5 = results[0][4]                        #受益人5信息
            
        TradeContext.errorCode = '0000'
        AfaLoggerFunc.tradeInfo('单证重打子查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']退出' )
        return True
    
    except Exception, e:
        AfaFlowControl.exitMainFlow(str(e))
コード例 #26
0
ファイル: AbdtQyOut.py プロジェクト: simonliuyl/AFA1.0
def AbdtQyOut():

    AfaLoggerFunc.tradeInfo('**********批量签约定时调度导出 进入**********')
                 
    try: 
                       
        AfaLoggerFunc.tradeInfo('**********批量签约导出开始**********' )                                                  
        AfaLoggerFunc.tradeInfo('**********导出批量文件**********')  
                               
        sql = ""       
        sql = "SELECT FILENAME,APPNO,BUSINO,WORKDATE,TELLERNO,BATCHNO FROM AHNX_FILE WHERE "
        sql = sql + "FILETYPE="    + "'7'" + " AND "        #7-批量签约
        sql = sql + "STATUS="   + "'1'"                     #已处理
       
        AfaLoggerFunc.tradeInfo(sql)

        records = AfaDBFunc.SelectSql(sql)
        if records == None:
            return ExitSubTrade("E9999" ,"查询AHNX_FILE数据库异常")
             
        elif(len(records)==0):
            return ExitSubTrade("E9999" ,"数据库AHNX_FILE中没有要读取的文件!")
            
        else:            
            for i in range(0,len(records)):
            
                TradeContext.prefileName = records[i][0]
                TradeContext.sysId       = records[i][1]
                TradeContext.busiNo      = records[i][2]
                TradeContext.workDate    = records[i][3]
                TradeContext.tellerno    = records[i][4]
                TradeContext.batchno     = records[i][5]
                
                #导出签约成功记录
                sql = ""
                sql = sql + " select  BUSIUSERNO,IDCODE,USERNAME,ACCNO,VOUHTYPE  FROM ABDT_CUSTINFO "
                sql = sql + " where BUSINO = '" + TradeContext.busiNo + "' " 
                sql = sql + " and   APPNO  = '" + TradeContext.sysId  + "' "
                sql = sql + " and status = '1'"      
                
                                  
                AfaLoggerFunc.tradeInfo( sql )
                
                rec = AfaDBFunc.SelectSql( sql )
                if rec == None :
                    return ExitSubTrade("E9999" ,"查询数据库异常")
                    
                elif len(rec) == 0:
                    TradeContext.errorCode, TradeContext.errorMsg = 'E8623', '数据库中无相应签约信息'
                    continue
                    
                else:
                    #导出成功数据记录
                    
                    outFileName = os.environ['AFAP_HOME'] + '/data/batch/down/' + TradeContext.sysId + TradeContext.busiNo[6:] + TradeContext.workDate + "_RF.TXT"
                    AfaLoggerFunc.tradeInfo('文件名=' + outFileName)
                    
                    if os.path.exists(outFileName):
                        os.system("rm -f " + outFileName)
                    
                    dfp = open( outFileName, 'w' )
                    
                    #把数据导出到指定文件
                    for i in range(0,len(rec)):
                        linebuf = ""
                        linebuf = linebuf + str(rec[i][0]).strip()   + "|"        #学生学号
                        linebuf = linebuf + str(rec[i][1]).strip()   + "|"        #身份证号
                        linebuf = linebuf + str(rec[i][2]).strip()   + "|"        #姓名
                        linebuf = linebuf + str(rec[i][3]).strip()   + "|"        #帐号
                        linebuf = linebuf + str(rec[i][4]).strip()   + "|"        #凭证种类
                        linebuf = linebuf + '签约成功'               + "\n"       #成功标记
                        
                        dfp.write( linebuf)
                    
                    dfp.close()
                    if not (os.path.exists(outFileName)):                                                    
                        TradeContext.errorCode, TradeContext.errorMsg='E8623', "导出成功签约数据文件失败"    
                        continue                         
               
                    sqlupdate = "update ahnx_file set status='2' ,procmsg='数据已导出' where batchno='"+TradeContext.batchno+"'"                   
            
                    AfaLoggerFunc.tradeInfo("更新AHNX_FILE语句:"+str(sqlupdate))
                    retcode = AfaDBFunc.UpdateSqlCmt( sqlupdate )
    
                    if (retcode < 0):
                    #失败则continue跳出转化下一个文件
                        continue 
                    continue
            AfaLoggerFunc.tradeInfo('**********批量签约导出结束**********' )   
            
            return True   
        return True            
                
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #27
0
ファイル: TZZ001.py プロジェクト: bianhezhen/AFA1.0
def main( ):
    
    AfaLoggerFunc.tradeInfo('=======自助业务自由模板开始=======')

    try:
        #=============初始化返回报文变量====================
        TradeContext.tradeResponse=[]
        
        #=============获取当前系统时间====================
        TradeContext.workDate=AfaUtilTools.GetSysDate( )
        TradeContext.workTime=AfaUtilTools.GetSysTime( )

        
        HostContext.I1SBNO = TradeContext.PDSBNO
        #HostContext.I1USID = TradeContext.PDUSID
        HostContext.I1AUUS = TradeContext.PDAUUS
        HostContext.I1AUPS = TradeContext.PDAUPS
        HostContext.I1WSNO = TradeContext.PDWSNO
        HostContext.I1ACCN = TradeContext.JXACCT
        AfaLoggerFunc.tradeInfo(HostContext.I1ACCN)
        #HostContext.I1CCNO = TradeContext.ccno
       
        
        #与主机交换
        zzywHostFunc.CommHost()
        AfaLoggerFunc.tradeInfo('主机通讯结束')

        if( HostContext.O1MGID !='AAAAAAA'):
            AfaLoggerFunc.tradeInfo('-----test1-------------')
            TradeContext.bodyl=''
            TradeContext.errorCode = HostContext.O1MGID
            TradeContext.errorMsg  = HostContext.O1INFO
            AfaLoggerFunc.tradeInfo(TradeContext.errorCode)
            AfaLoggerFunc.tradeInfo(TradeContext.errorMsg)
            
            TradeContext.bodyl    ='243'
            TradeContext.CICS     =''                  
            TradeContext.INFCOD   ='E'                 
            TradeContext.Appcode  =''                  
            TradeContext.RETNO    ='0000'              
            TradeContext.PDTRCD   ='831030'            
            TradeContext.PDTRSQ   =''                  
            TradeContext.PDWSNO   =''                  
            TradeContext.JXACCT   =''                  
            TradeContext.JXCESQ   =''                  
            TradeContext.INFPAD0  =''                  
            TradeContext.INFPAD1  =''                  
            TradeContext.INFPAD2  =''                  
            TradeContext.PDTRDT  =''
            TradeContext.PDTRTM   =''                  
            TradeContext.PDTLSQ   =''
            TradeContext.PAMGID   =TradeContext.errorCode
            TradeContext.BEERTX   =HostContext.O1INFO                 
            AfaLoggerFunc.tradeInfo(HostContext.O1INFO)
            TradeContext.RecNum   =''  
            TradeContext.JXCKFG   =''
            TradeContext.JXTRCU   =''
        else:    
            AfaLoggerFunc.tradeInfo('-----test2-------------')
            TradeContext.JXTRCU   = HostContext.O1NXLN
            TradeContext.JXCKFG   = HostContext.O1MGNO
            AfaLoggerFunc.tradeInfo(HostContext.O1MGNO)
            TradeContext.CICS     =''
            TradeContext.INFCOD   ='N'
            TradeContext.Appcode  =''
            TradeContext.RETNO    ='0000'
            TradeContext.PDTRCD   ='831030'
            TradeContext.PDTRSQ   =''
            TradeContext.PDWSNO   =''
            TradeContext.JXACCT   =''
            TradeContext.JXCESQ   =''
            TradeContext.INFPAD0  =''
            TradeContext.INFPAD1  =''
            TradeContext.INFPAD2  =''
            TradeContext.PDTRTM   =''
            TradeContext.BEERTX   =''
            TradeContext.RecNum   = HostContext.O1ACUR
            
            
            TradeContext.bodyl   =str(int(TradeContext.RecNum)*51+243)
            AfaLoggerFunc.tradeInfo(TradeContext.bodyl) 
            
            if( HostContext.O1ACUR == '00' and HostContext.O1MGNO != '1' ):
                TradeContext.errorCode = '0001'
                TradeContext.errorMsg = "无补登数据"
                AfaLoggerFunc.tradeInfo(TradeContext.errorCode)
                AfaLoggerFunc.tradeInfo(TradeContext.errorMsg)
                TradeContext.PAMGID   =TradeContext.errorCode

            else:
                TradeContext.JXSGDT  = HostContext.O2ORDT 
                #TradeContext.JXCATP  = HostContext.O2SMCD
                
                #转换摘要代码为汉字
                TMP_O2SMCD = []
                for i in xrange(0,len(HostContext.O2SMCD)):
                    sum_sql = "select text from craba where smcd = '" + HostContext.O2SMCD[i] + "'"
                    sum_record = AfaDBFunc.SelectSql(sum_sql)
                    if sum_record == None:
                        TMP_O2SMCD.append("未知")
                    elif len(sum_record) <= 0:
                        TMP_O2SMCD.append("未知")
                    else:
                        TMP_O2SMCD.append(sum_record[0][0])
                TradeContext.JXCATP  = TMP_O2SMCD

                TradeContext.JXBDST  = HostContext.O2AMCD
                TradeContext.JXTRAM  = HostContext.O2TRAM
                TradeContext.JXACBL  = HostContext.O2ACBL
                TradeContext.JXCAUS  = HostContext.O2USID
                AfaLoggerFunc.tradeInfo(TradeContext.JXSGDT)
                AfaLoggerFunc.tradeInfo(TradeContext.JXCATP)
                AfaLoggerFunc.tradeInfo(TradeContext.JXBDST)
                AfaLoggerFunc.tradeInfo(TradeContext.JXTRAM)
                AfaLoggerFunc.tradeInfo(TradeContext.JXACBL)
                AfaLoggerFunc.tradeInfo(TradeContext.JXCAUS)
                
                # TradeContext.ordt  = HostContext.O2SBSQ
                # TradeContext.ordt  = HostContext.O2VLDT
                # TradeContext.ordt  = HostContext.O2PERD
                # TradeContext.ordt  = HostContext.O2ITCD
                # TradeContext.ordt  = HostContext.O2CYNO
                # TradeContext.ordt  = HostContext.O2INRT
                                  
                                  
        #=============自动打包====================
        AfaFunc.autoPackData()
                              
        AfaLoggerFunc.tradeInfo('=======自助业务自由模板结束=======')
                              
    except AfaFlowControl.flowException, e:
        #流程异常             
        AfaFlowControl.exitMainFlow( )
コード例 #28
0
ファイル: TYBT004_8622.py プロジェクト: bianhezhen/AFA1.0
def SubModuleDoSnd( ):
   
    AfaLoggerFunc.tradeInfo('进入反查询交易[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' ) 
    
    try:
        sql = "select note1,note2,note3,note4,note5,note7,note8,note9,draccno,brno,tellerno,note6,unitno,amount,note9 from afa_maintransdtl "
        sql = sql + " where agentserialno = '"+TradeContext.PreSerialno+"' and workdate = '"+TradeContext.workDate+"'"
        sql = sql + " and revtranf = '0' and bankstatus = '0'  and chkflag = '9'"
        
        AfaLoggerFunc.tradeInfo('撤销子查询语句'+ sql)
        
        records = AfaDBFunc.SelectSql( sql )
        
        AfaLoggerFunc.tradeInfo('撤销子查询语句记录'+str(records))
        
        if records==None:
            TradeContext.errorCode,TradeContext.errorMsg = "0001" ,"查询银保通数据库失败"
            raise AfaFlowControl.flowException( )
        
        elif(len(records) < 1):
            TradeContext.errorCode,TradeContext.errorMsg = "0001","无此交易"
            return False
      
        else:
        
            if(records[0][10] != TradeContext.tellerno):
                TradeContext.errorCode,TradeContext.errorMsg = "0001","原交易非本柜员所做,不能做此交易"
                return False
        
            if(records[0][9] != TradeContext.brno):
                TradeContext.errorCode,TradeContext.errorMsg = "0001","原交易非本网点所做,不能做此交易"
                return False
            
            if(records[0][12].strip() != TradeContext.insuid):
                TradeContext.errorCode,TradeContext.errorMsg = "0001","保险公司选择有误"
                return False
            
            if(records[0][13].strip() != TradeContext.amount.strip()):
                TradeContext.errorCode,TradeContext.errorMsg = "0001","输入金额与原金额不符,请检查金额录入项"
                return False
            
            if(records[0][14].split('|')[2] != TradeContext.policy.strip()):
                TradeContext.errorCode,TradeContext.errorMsg = "0001","与原保单号不符,请检查保单号录入项"
                return False
            
            #投保人姓名
            TradeContext.tbr_name=records[0][3].split('|')[0]
            
            #投保人证件号
            TradeContext.tbr_idno=records[0][3].split('|')[1]
            
            #被保险人姓名
            TradeContext.bbr_name=records[0][4].split('|')[0]
            
            #被保险人证件号
            TradeContext.bbr_idno=records[0][4].split('|')[1]
            
            #主险险种
            TradeContext.productid=records[0][6].split('|')[0]
            
            #附加险险种
            TradeContext.productid1=records[0][6].split('|')[2]
            
            #投保份数
            TradeContext.amt_unit =records[0][7].split('|')[0]
            
            #账号
            TradeContext.payacc=records[0][8]
            
            #退款方式
            TradeContext.paymethod1=records[0][11].split('|')[1]
            
            #缴费年限
            TradeContext.paytimelimit=records[0][5].split('|')[2]
            
            #缴费方式
            TradeContext.paymethod=records[0][5].split('|')[0]
            
            #缴费期次
            TradeContext.rev_frequ=records[0][5].split('|')[1]
            
            #受益人1信息
            TradeContext.syr_1=""
            #受益人2信息
            TradeContext.syr_2=""
            #受益人3信息
            TradeContext.syr_3=""
            #受益人4信息
            TradeContext.syr_4=""
            #受益人5信息
            TradeContext.syr_5=""
            
            TradeContext.errorCode= "0000" 
            
            AfaLoggerFunc.tradeInfo('退出反查询交易' )
            return True                               
    except Exception, e:                          
        AfaFlowControl.exitMainFlow(str(e))       
コード例 #29
0
def main( ):
    AfaLoggerFunc.tradeInfo( '凭证作废撤销['+TradeContext.TemplateCode+']进入' )

    #=============前台上送数据===================================
    #TradeContext.sBesbNo                                 机构号
    #TradeContext.sBesbSty                                机构类型
    #TradeContext.sCur                                    货币代码
    #TradeContext.sTellerNo                               柜员号
    #TradeContext.sVouhType                               凭证种类
    #TradeContext.sStartNo                                起始号码
    #TradeContext.sEndNo                                  终止号码
    #TradeContext.sRivTeller                              对方柜员
    #TradeContext.sVouhStatus                             凭证状态
    #TradeContext.sVouhNum                                凭证数量
    #TradeContext.sLstTrxDay                              最后交易日期
    #TradeContext.sLstTrxTime                             最后交易时间
    #TradeContext.sDepository                             库箱标志
    #TradeContext.sVouhName                               凭证名称

    try:
        #================拆包========================
        TradeContext.sVouhType = VouhFunc.DelSpace(TradeContext.sVouhType.split("|"))
        TradeContext.sVouhName = VouhFunc.DelSpace(TradeContext.sVouhName.split("|"))
        TradeContext.sStartNo  = VouhFunc.DelSpace(TradeContext.sStartNo.split("|"))
        TradeContext.sEndNo    = VouhFunc.DelSpace(TradeContext.sEndNo.split("|"))
        TradeContext.sVouhNum  = VouhFunc.DelSpace(TradeContext.sVouhNum.split("|"))
        TradeContext.sNum      = len(TradeContext.sVouhType)
        
        #==================暂存==================================
        TradeContext.rVouhType = VouhFunc.AddSplit(TradeContext.sVouhType)
        TradeContext.rVouhName = VouhFunc.AddSplit(TradeContext.sVouhName)
        TradeContext.rStartNo  = VouhFunc.AddSplit(TradeContext.sStartNo)
        TradeContext.rEndNo    = VouhFunc.AddSplit(TradeContext.sEndNo)
        TradeContext.rVouhNum  = VouhFunc.AddSplit(TradeContext.sVouhNum)
    
        #=============初始化返回报文变量========================
        TradeContext.tradeResponse = []
        
        #=============生成流水号========================
        TradeContext.sVouhSerial = VouhFunc.GetVouhSerial( )

        #=============获取当前系统时间==========================
        TradeContext.sLstTrxDay  = AfaUtilTools.GetSysDate( )
        TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( )
        
        #begin凭证优化更改201109  
        #=============获取柜员尾箱号===============================
        HostContext.I1SBNO = TradeContext.sBesbNo         #机构号
        HostContext.I1USID = TradeContext.sTellerNo       #柜员号
        HostContext.I1WSNO = TradeContext.sWSNO           #终端号
        HostContext.I1EDDT = TradeContext.sLstTrxDay      #终止日期
        HostContext.I1TELR = TradeContext.sTellerNo       #柜员代号
        
        if(not VouhHostFunc.CommHost('0104')):
            VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg )
            raise AfaFlowControl.flowException( )
        if(TradeContext.errorCode == '0000'):
            TradeContext.sTellerTailNobak = HostContext.O2CABO
            TradeContext.sTellerTailNo    = TradeContext.sTellerTailNobak[0]                 
            AfaLoggerFunc.tradeInfo( '交易柜员尾箱号:' + TradeContext.sTellerTailNo ) 
        #end   

        #=============置凭证操作状态及库箱标志====================
        TradeContext.sDepository  = '4' #库箱标志   1.分行管理库 2.支行管理库 3.网点管理库 4.柜员凭证箱
        TradeContext.sExDepos     = '4' #原库箱标志
        TradeContext.sVouhStatus  = '3' #状态       3.已领未用 6.已作废
        TradeContext.sExStatus    = '6' #原状态
        TradeContext.sRivTeller   = '   '     #对方柜员
        TradeContext.sTransType    = '凭证作废撤销'
        TradeContext.sInTellerTailNo  = TradeContext.sTellerTailNo
        TradeContext.sInBesbNo    = TradeContext.sBesbNo
        

        #交易公共部分    
        VouhFunc.VouhTrans()

        #更新凭证变更登记表
        VouhFunc.VouhModify()
        
        #数据库提交
        AfaDBFunc.CommitSql( )
        
        #主机记账
        AfaLoggerFunc.tradeInfo( '------------主机记账' )
        TradeContext.sOperSty = '0'
        VouhHostFunc.VouhCommHost()
        TradeContext.sTranStatus = '0'
        AfaLoggerFunc.tradeInfo( '=======================12'+TradeContext.errorCode )
        #TradeContext.errorCode = '0000'
        if(TradeContext.errorCode <> '0000'):
            tmpErrorCode= TradeContext.errorCode
            tmpErrorMsg = TradeContext.errorMsg
        
            #冲正
            
            #=============置凭证操作状态及库箱标志====================
            tmpDepos = TradeContext.sDepository
            TradeContext.sDepository = TradeContext.sExDepos
            TradeContext.sExDepos = tmpDepos

            tmpStatus = TradeContext.sVouhStatus
            TradeContext.sVouhStatus = TradeContext.sExStatus
            TradeContext.sExStatus = tmpStatus

            TradeContext.sRivTeller   = '   '     #对方柜员
            TradeContext.sTransType    = '冲正'
            

            #交易公共部分    
            VouhFunc.VouhTrans()
            AfaDBFunc.CommitSql( )
            
            TradeContext.sTranStatus = '1'
            if(not TradeContext.existVariable( "HostSerno" )):
                TradeContext.HostSerno = ''    
            
            #更新流水表
            VouhFunc.ModifyVouhModify()
            
            AfaLoggerFunc.tradeInfo( '============================自动冲正!' )

            
            VouhFunc.tradeExit(tmpErrorCode, tmpErrorMsg)
            raise AfaFlowControl.flowException( )
        
        #更新流水表
        VouhFunc.ModifyVouhModify()  
        
        TradeContext.tradeResponse.append( ['sVouhSerial',TradeContext.sVouhSerial] )
        TradeContext.tradeResponse.append( ['sVouhType',TradeContext.rVouhType] )
        TradeContext.tradeResponse.append( ['sVouhName',TradeContext.rVouhName] )
        TradeContext.tradeResponse.append( ['sStartNo',TradeContext.rStartNo] )
        TradeContext.tradeResponse.append( ['sEndNo',TradeContext.rEndNo] )
        TradeContext.tradeResponse.append( ['sVouhNum',TradeContext.rVouhNum] )
        TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] )
        TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] )
        TradeContext.tradeResponse.append( ['sNum',str(TradeContext.sNum)] )
        TradeContext.tradeResponse.append( ['errorCode','0000'] )
        TradeContext.tradeResponse.append( ['errorMsg','交易成功'] )

        #自动打包
        AfaFunc.autoPackData()

        #=============程序退出====================
        AfaLoggerFunc.tradeInfo( '凭证作废撤销['+TradeContext.TemplateCode+']退出' )
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( )
コード例 #30
0
ファイル: T004102.py プロジェクト: bianhezhen/AFA1.0
            raise AfaFlowControl.flowException( )


        #=====================外调接口(后处理)==================================
        if subModuleExistFlag==1 :
            if not subModuleHandle.SubModuleDoSnd():
                raise AfaFlowControl.flowException( )


        #=====================发票信息处理======================================
        if TradeContext.errorCode=='0000' and TradeContext.existVariable( "billData" ):
            if not ( TransBillFunc.InsertBill( TradeContext.billData ) ) :
                raise AfaFlowControl.flowException( )


        #=====================自动打包==========================================
        AfaFunc.autoPackData()

        #=====================退出模板==========================================
        AfaLoggerFunc.tradeInfo('******代收代付.模板1.缴费模板['+TradeContext.TemplateCode+']退出******')


    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( str(e) )
        
    except AfaFlowControl.accException:
        AfaFlowControl.exitMainFlow( )
        
    except Exception, e:
        AfaFlowControl.exitMainFlow( str(e) )
コード例 #31
0
def main( ):
    AfaLoggerFunc.tradeInfo( '凭证柜员交接['+TradeContext.TemplateCode+']进入' )

    #=============前台上送数据===================================
    #TradeContext.sBesbNo                                 机构号
    #TradeContext.sBesbSty                                机构类型
    #TradeContext.sCur                                    货币代码
    #TradeContext.sTellerNo                               柜员号
    #TradeContext.sRivTeller                              对方柜员
    #TradeContext.sLstTrxDay                              最后交易日期
    #TradeContext.sLstTrxTime                             最后交易时间
    
    try: 
        #=============获取柜员级别==========================
        HostContext.I1TELR = TradeContext.sTellerNo       #柜员号
        HostContext.I1SBNO = TradeContext.sBesbNo         #机构号
        HostContext.I1USID = TradeContext.sTellerNo       #柜员号
        HostContext.I1WSNO = TradeContext.sWSNO           #终端号
        if(not VouhHostFunc.CommHost('8809')):
            tradeExit(TradeContext.errorCode, TradeContext.errorMsg)
            raise AfaFlowControl.flowException( )
        if(TradeContext.errorCode == '0000'):
            TELLER = HostContext.O1TLRK
            AfaLoggerFunc.tradeInfo( TELLER )
        
        #=============初始化返回报文变量========================
        TradeContext.tradeResponse = []
        TradeContext.sRivTeller = TradeContext.sInTellerNo
        
        #=============生成流水号========================
        TradeContext.sVouhSerial = VouhFunc.GetVouhSerial( )

        #=============获取当前系统时间==========================
        TradeContext.sLstTrxDay  = AfaUtilTools.GetSysDate( )
        TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( )

        TradeContext.sTransType    = '凭证柜员交接'
        
        #================判断对方柜员是否有凭证==================================
        if(len(TradeContext.sInTellerNo) == 0):
            VouhFunc.tradeExit('A005061', '对方柜员不能为空!')
            raise AfaFlowControl.flowException( )
        
        #if(TELLER == '01' or TELLER == '02' or TELLER == '03'):
        #    VouhFunc.tradeExit('A005061', '该柜员不能进行此操作!')
        #    raise AfaFlowControl.flowException( )
            
        sqlStr = "select * from VOUH_REGISTER where TELLERNO = '" + TradeContext.sInTellerNo + "' and VOUHSTATUS = '3'"
        
        records = AfaDBFunc.SelectSql( sqlStr )
        AfaLoggerFunc.tradeDebug(sqlStr)
        if records==-1 :
            VouhFunc.tradeExit( 'A005057', '查询[凭证登记表]信息异常!' )
            raise AfaFlowControl.flowException( )
        elif len(records) > 0 :
            VouhFunc.tradeExit( 'A005058', '['+TradeContext.sInTellerNo+']柜员不能交接!' )
            raise AfaFlowControl.flowException( )
        
        #================判断柜员是否有凭证==================================
        
        #if((TradeContext.sTellerNo)[4:] == '01' or (TradeContext.sTellerNo)[4:] == '02' or (TradeContext.sTellerNo)[4:] == '03'):
        #    VouhFunc.tradeExit('A005061', '该柜员不能进行此操作!')
        #    raise AfaFlowControl.flowException( )
            
        sqlStr = "select * from VOUH_REGISTER where TELLERNO = '" + TradeContext.sTellerNo + "' and VOUHSTATUS = '3'"
        
        records = AfaDBFunc.SelectSql( sqlStr )
        AfaLoggerFunc.tradeDebug(sqlStr)
        if records==-1 :
            VouhFunc.tradeExit( 'A005057', '查询[凭证登记表]信息异常!' )
            raise AfaFlowControl.flowException( )
        elif records==0 :
            VouhFunc.tradeExit( 'A005058', '无凭证!' )
            raise AfaFlowControl.flowException( )
        
        #======================柜员交接=====================================
        sqlStr = "update VOUH_REGISTER set TELLERNO = '" + TradeContext.sInTellerNo + "' where TELLERNO = '" + TradeContext.sTellerNo + "' and VOUHSTATUS = '3'"
        
        records = AfaDBFunc.UpdateSqlCmt( sqlStr )
        AfaLoggerFunc.tradeDebug(sqlStr)
        if records==-1 :
            VouhFunc.tradeExit( 'A005057', '更新[凭证登记表]信息异常!' )
            raise AfaFlowControl.flowException( )
        elif records==0 :
            VouhFunc.tradeExit( 'A005058', '修改[凭证登记表]基本信息失败!' )
            raise AfaFlowControl.flowException( )

        #更新凭证变更登记表
        VouhFunc.VouhModify()
        #数据库提交
        AfaDBFunc.CommitSql( )
        
        #==================查询交接凭证明细==================================
	#=====李亚杰  20080812  修改凭证查询条件,增加凭证状态为'3'的情况====
        #sqlStr = "select distinct t.VOUHTYPE,t1.VOUHNAME,t.STARTNO,t.ENDNO,t.VOUHNUM FROM VOUH_REGISTER t,VOUH_PARAMETER t1 \
        #         where t.VOUHTYPE = t1.VOUHTYPE AND substr(t.BESBNO,1,6) = substr(t1.BESBNO,1,6) \
        #         AND t.TELLERNO = '" + TradeContext.sInTellerNo + "'"

        sqlStr = "select distinct t.VOUHTYPE,t1.VOUHNAME,t.STARTNO,t.ENDNO,t.VOUHNUM FROM VOUH_REGISTER t,VOUH_PARAMETER t1 \
                 where t.VOUHTYPE = t1.VOUHTYPE AND substr(t.BESBNO,1,6) = substr(t1.BESBNO,1,6) \
                 AND t.VOUHSTATUS = '3' AND t.TELLERNO = '" + TradeContext.sInTellerNo + "'"

        AfaLoggerFunc.tradeDebug(sqlStr);
        #查询数据库并将返回的结果压至对应变量中
        records = AfaDBFunc.SelectSql( sqlStr )
        if( records == None ):
            VouhFunc.tradeExit('A005067', '查询[凭证表]操作异常!')
            raise AfaFlowControl.flowException( )
        elif( len( records ) == 0 ):
            VouhFunc.tradeExit('A005068', '凭证不存在!' )
            raise AfaFlowControl.flowException( )
        else :
            record=AfaUtilTools.ListFilterNone( records )
            total=len( records )
            
            sVouhType = ''
            sVouhName = ''
            sStartNo = ''
            sEndNo = ''
            sVouhNum = ''
            
            for i in range( 0, total ):
                if( i <> 0):
                    strSplit = '|'
                else:
                    strSplit = ''
                sVouhType = sVouhType + strSplit + records[i][0]
                sVouhName = sVouhName + strSplit + records[i][1]
                sStartNo = sStartNo + strSplit + records[i][2]
                sEndNo = sEndNo + strSplit + records[i][3]
                sVouhNum = sVouhNum + strSplit + records[i][4]
                
        TradeContext.tradeResponse.append( ['sVouhType',sVouhType] )
        TradeContext.tradeResponse.append( ['sVouhName',sVouhName] )
        TradeContext.tradeResponse.append( ['sTellerNo',TradeContext.sTellerNo] )
        TradeContext.tradeResponse.append( ['sInTellerNo',TradeContext.sInTellerNo] )
        TradeContext.tradeResponse.append( ['sStartNo',sStartNo] )
        TradeContext.tradeResponse.append( ['sEndNo',sEndNo] )
        TradeContext.tradeResponse.append( ['sVouhNum',sVouhNum] )
        TradeContext.tradeResponse.append( ['sNum',str(total)] )
        TradeContext.tradeResponse.append( ['sVouhSerial',TradeContext.sVouhSerial] )
        TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] )
        TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] )
        TradeContext.tradeResponse.append( ['errorCode','0000'] )
        TradeContext.tradeResponse.append( ['errorMsg','交易成功'] )

        #自动打包
        AfaFunc.autoPackData()

        #=============程序退出====================
        AfaLoggerFunc.tradeInfo( '凭证柜员交接['+TradeContext.TemplateCode+']退出' )
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( )
コード例 #32
0
ファイル: Tvouh014.py プロジェクト: bianhezhen/AFA1.0
def main( ):
    
    AfaLoggerFunc.tradeInfo( '查询凭证结存交易['+TradeContext.TemplateCode+']进入' )
    
    #=============前台上送数据====================
    #TradeContext.sBESBNO           机构号
    #TradeContext.sTellerNo         柜员号
    #TradeContext.sVouhType         凭证种类
    #TradeCoutext.sVouhStatus       凭证状态
    #TradeCoutext.sStartDate        起始日期
    #TradeCoutext.sEndDate          终止日期
    #TradeContext.sStart          起始记录数
    #TradeContext.arraySize         查询条数
    
    try:
        #=============初始化返回报文变量==================
        TradeContext.tradeResponse = []

        #=============获取当前系统时间====================
        TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( )
        TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) 
        
        #begin凭证优化更改201109  
        #=============获取柜员尾箱号===============================
        HostContext.I1SBNO = TradeContext.sBesbNo         #机构号
        HostContext.I1USID = TradeContext.sTellerNo       #柜员号
        HostContext.I1WSNO = TradeContext.sWSNO           #终端号
        HostContext.I1EDDT = TradeContext.sLstTrxDay      #终止日期
        HostContext.I1TELR = TradeContext.sTellerNo       #柜员代号
        
        if(not VouhHostFunc.CommHost('0104')):
            VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg )
            raise AfaFlowControl.flowException( )
        if(TradeContext.errorCode == '0000'):
            TradeContext.sTellerTailNobak = HostContext.O2CABO
            TradeContext.sTellerTailNo    = TradeContext.sTellerTailNobak[0]                 
            AfaLoggerFunc.tradeInfo( '交易柜员尾箱号:' + TradeContext.sTellerTailNo ) 
        #end   
        
        wheresql="substr(t1.BESBNO,1,6) = substr(t.BESBNO,1,6) AND t1.VOUHTYPE = t.VOUHTYPE AND t.VOUHSTATUS = '3'"
        
        #==============设机构号=====================
        if (TradeContext.existVariable("sSelBesbNo") and len(TradeContext.sSelBesbNo) <> 0 ):
            wheresql = wheresql + " and t.BESBNO = '" + TradeContext.sSelBesbNo + "'"
        
        #==============设凭证种类=====================
        if (TradeContext.existVariable("sVouhType") and len(TradeContext.sVouhType) <> 0 ):
            wheresql = wheresql + " and t.VOUHTYPE = '" + TradeContext.sVouhType+"'"
         
        #begin凭证优化更改201109    
        #==============设尾箱号=====================
        if (TradeContext.existVariable("sTellerTailNo") and len(TradeContext.sTellerTailNo) <> 0 ):
            wheresql = wheresql + " and t.TELLERNO = '" + TradeContext.sTellerTailNo + "'"
        #end
        
        sqlStr = "\
                SELECT TELLERNO,VOUHTYPE,STARTNO,ENDNO,VOUHNUM,VOUHNAME \
                FROM ( \
                SELECT row_number() over() as rowid,t.TELLERNO,t.VOUHTYPE,t.STARTNO,t.ENDNO,t.VOUHNUM,t1.VOUHNAME \
                FROM VOUH_REGISTER t,VOUH_PARAMETER t1 \
                WHERE " + wheresql + " \
                ) as tab1 \
                where tab1.rowid >= " + str(TradeContext.sStart)
        
        AfaLoggerFunc.tradeDebug(sqlStr);
        #查询数据库并将返回的结果压至对应变量中
        records = AfaDBFunc.SelectSql( sqlStr, int(TradeContext.arraySize))
        if( records == None ):
            AfaLoggerFunc.tradeError(AfaDBFunc.sqlErrMsg)
            tradeExit('A005067', '查询[凭证登记表]操作异常!')
            raise AfaFlowControl.flowException( )
        elif( len( records ) == 0 ):
            tradeExit('A005068', '凭证不存在!' )
            raise AfaFlowControl.flowException( )
        else :
            record=AfaUtilTools.ListFilterNone( records )
            total=len( records )

            sTellerTailNo = ''
            sVouhType = ''
            sStartNo = ''
            sEndNo = ''
            sVouhNum = ''
            sVouhName = ''
            
            for i in range( 0, total ):
                if( i <> 0):
                    strSplit = '|'
                else:
                    strSplit = ''
                sTellerTailNo = sTellerTailNo + strSplit + records[i][0]
                sVouhType = sVouhType + strSplit + records[i][1]
                sStartNo = sStartNo + strSplit + records[i][2]
                sEndNo = sEndNo + strSplit + records[i][3]
                sVouhNum = sVouhNum + strSplit + records[i][4]
                sVouhName = sVouhName + strSplit + records[i][5]
           
        TradeContext.tradeResponse.append( ['sTellerTailNo',sTellerTailNo] )    
        TradeContext.tradeResponse.append( ['sTellerNo',TradeContext.sTellerNo] )              #凭证优化更改201109 
        TradeContext.tradeResponse.append( ['sVouhType',sVouhType] )
        TradeContext.tradeResponse.append( ['sVouhName',sVouhName] )
        TradeContext.tradeResponse.append( ['sStartNo',sStartNo] )
        TradeContext.tradeResponse.append( ['sEndNo',sEndNo] )
        TradeContext.tradeResponse.append( ['sVouhNum',sVouhNum] )
        TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] )
        TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] )
        TradeContext.tradeResponse.append( ['sNum',str(total)] )
        TradeContext.tradeResponse.append( ['errorCode','0000'] )
        TradeContext.tradeResponse.append( ['errorMsg','交易成功'] )

        AfaFunc.autoPackData()
        #=============程序退出====================
        AfaLoggerFunc.tradeInfo( '查询凭证结存交易['+TradeContext.TemplateCode+']退出' )
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( )
コード例 #33
0
def SubModuleMainFst( ):
    try:
        
        AfaLoggerFunc.tradeInfo( '进入差错明细查询['+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']'  )
        
        #明细写入文件
        #begin李利君优化20120611
        #mx_file_name = os.environ['AFAP_HOME'] + '/data/batch/tips/' + 'AH_ERROR_' + TradeContext.teller + '_'+TradeContext.workDate+'.txt'
        mx_file_name = os.environ['AFAP_HOME'] + '/tmp/' + 'AH_ERROR_' + TradeContext.teller + '_'+TradeContext.workDate+'.txt'
        #end
        
        TradeContext.tradeResponse.append(['fileName',  'AH_ERROR_' + TradeContext.teller +'_'+TradeContext.workDate+'.txt'])
        
        if (os.path.exists(mx_file_name) and os.path.isfile(mx_file_name)):
            #文件存在,先删除-再创建
            os.system("rm " + mx_file_name)
        
        #====获取清算信息=======   
        if not ChkLiquidStatus( ):
            return False
        
        
        #查询对账失败的交易明细
        sqlStr=''
        sqlStr=sqlStr + "SELECT BRNO,SERIALNO,DRACCNO,CRACCNO,TRADETYPE,TAXPAYNAME,AMOUNT,BANKSTATUS,CORPSTATUS,CHKFLAG,CORPCHKFLAG,REVTRANF,NOTE10 FROM TIPS_MAINTRANSDTL "
        sqlStr=sqlStr + " WHERE NOTE3 = '" + TradeContext.payBkCode.strip() + "' and WORKDATE = '" + TradeContext.date + "'"
        sqlStr=sqlStr + "and ((REVTRANF = '0' and BANKSTATUS = '0' and CORPSTATUS = '0' and ((CHKFLAG ='9' and CORPCHKFLAG ='9')or(CHKFLAG ='9' and CORPCHKFLAG ='0')or(CHKFLAG ='0' and CORPCHKFLAG ='9'))) "
        sqlStr=sqlStr + " or ( REVTRANF = '1' and BANKSTATUS != '0'))"
          
        AfaLoggerFunc.tradeInfo(sqlStr) 
           
        Records = AfaDBFunc.SelectSql( sqlStr )
           
        if( Records == None ):
            
            return TipsFunc.ExitThisFlow( 'A0027', '表操作异常:'+AfaDBFunc.sqlErrMsg )
            
        elif( len( Records )==0 ):
            
            return TipsFunc.ExitThisFlow( 'A0027', '没有满足条件的数据' )
        else:
            sfp = open(mx_file_name, "w")
            AfaLoggerFunc.tradeInfo('明细文件=['+mx_file_name+']')
            for i in range(0,len(Records)):
                A0 = str(Records[i][0]).strip()           #机构号
                A1 = str(Records[i][1]).strip()           #平台流水号     
                A2 = str(Records[i][2]).strip()           #借方账号   
                A3 = str(Records[i][3]).strip()           #贷方账号
                A4 = str(Records[i][4]).strip()           #交易类型
                A5 = str(Records[i][5]).strip()           #纳税人名称
                A6 = str(Records[i][6]).strip()           #交易金额
                A7 = str(Records[i][7]).strip()           #主机状态
                A8 = str(Records[i][8]).strip()           #企业状态
                A9 = str(Records[i][9]).strip()           #主机对账标志
                A10 = str(Records[i][10]).strip()         #企业对账标志
                A11 = str(Records[i][11]).strip()         #正反交易标志
                A12 = str(Records[i][12]).strip()         #清算金库名      
       
                sfp.write(A0 + '|' + A1 + '|' + A2 + '|' + A3 + '|' + A4 + '|' + A5 + '|' + A6 + '|' + A7 + '|' + A8 + '|' + A9 + '|' + A10 + '|' + A11 + '|' + A12 + '\n')
                
            sfp.close()                
        
        TradeContext.tradeResponse.append(['errorCode','0000'])
        TradeContext.tradeResponse.append(['errorMsg','交易成功'])
       
        AfaLoggerFunc.tradeInfo( '退出差错明细查询[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
    
        return True 
    
    except Exception, e:                  

        AfaFlowControl.exitMainFlow(str(e))      
コード例 #34
0
def main():
    AfaLoggerFunc.tradeInfo( '凭证中心参数维护['+TradeContext.TemplateCode+']进入' )
    #AfaLoggerFunc.afa_InitComp('Tvouh008','凭证中心参数维护')

    try:
        #===========检查操作类型是否存在===========
        # 1 新增,2 查询, 3 修改, 4 删除
        if( not TradeContext.existVariable( "opeType" ) ):
            tradeExit( 'A005060', '操作类型[opeType]值不存在!' )
            raise AfaFlowControl.flowException( )

        if TradeContext.opeType == '1': #新增
            #==========检查该凭证种类信息是否已经存在============
            sqlStr = "select VOUHTYPE from VOUH_PARAMETER \
                 where VOUHTYPE = '" + TradeContext.sVouhType+ "'\
                 and ZONENO = '" + TradeContext.sZoneNo+ "'"
            records = AfaDBFunc.SelectSql( sqlStr )
            if( records == None ):
                tradeExit( 'A005052', '查询[凭证参数维护表]操作异常!' )
                raise AfaFlowControl.flowException( )
            elif( len( records )!=0 ):
                tradeExit( 'A005053', '凭证种类已存在!' )
                raise AfaFlowControl.flowException( )

            #=============初始化返回报文变量====================
            TradeContext.tradeResponse=[]
            sqlStr = "INSERT INTO VOUH_PARAMETER (ZONENO,VOUHTYPE,VOUHNAME,CTRLFLG,COUNTFLG,COUNTUNIT,PAYFLG,\
            MOVFLG,SALEFLG,PRICE,HEADLEN,VOUHLEN,ACTIVEDATE) VALUES ('"+TradeContext.sZoneNo+"','"+\
            TradeContext.sVouhType+"','"+TradeContext.sVouhName+"','2','0','0','0','0','0','0','"+\
            TradeContext.sHeadLen+"','"+TradeContext.sVouhLen+"','0')"

            records = AfaDBFunc.InsertSqlCmt( sqlStr )
            if records==-1 :
                tradeExit( 'A005054', '新增[凭证号码表]基本信息失败!' )
                raise AfaFlowControl.flowException( )
            tradeExit('0000', '新建成功')

        if TradeContext.opeType == '4':  #删除
            sqlStr = "select * from VOUH_REGISTER \
                 where VOUHTYPE = '" + TradeContext.sVouhType+ "'\
                 and VOUHSTATUS != '8'"
            records = AfaDBFunc.SelectSql( sqlStr )
            AfaLoggerFunc.tradeDebug(sqlStr)
            if( records == None ):
                tradeExit( 'A005060', '查询[凭证登记表]操作异常!'  )
                raise AfaFlowControl.flowException( )
            elif( len( records ) > 0 ):
                tradeExit( 'A005061', '不能删除存在有效凭证的凭证参数!' )
                raise AfaFlowControl.flowException( )
            sqlStr = "DELETE  FROM  VOUH_PARAMETER WHERE VOUHTYPE = '" + TradeContext.sVouhType+ "'\
                 and ZONENO = '" + TradeContext.sZoneNo+ "'"

            AfaLoggerFunc.tradeDebug(sqlStr)
            records = AfaDBFunc.DeleteSqlCmt( sqlStr )
            if records == -1:
                tradeExit( 'A005055', '删除[凭证参数维护表]操作异常!' )
                raise AfaFlowControl.flowException( )
            if records == 0:
                tradeExit( 'A005056', '[凭证参数维护表]内无对应记录可被删除!' )
                raise AfaFlowControl.flowException( )
            tradeExit('0000', '删除成功')

        if TradeContext.opeType == '3':#修改
            #==============修改凭证参数维护表=====================

            sqlStr = "select * from VOUH_REGISTER \
                 where VOUHTYPE = '" + TradeContext.sVouhType+ "'\
                 and VOUHSTATUS != '8' and length(headstr) = " + TradeContext.sOldHeadLen
            records = AfaDBFunc.SelectSql( sqlStr )
            AfaLoggerFunc.tradeDebug(sqlStr)
            if( records == None ):
                tradeExit( 'A005060', '查询[凭证登记表]操作异常!'  )
                raise AfaFlowControl.flowException( )
            elif( len( records ) > 0 ):
                tradeExit( 'A005061', '不能修改存在有效凭证的凭证参数!' )
                raise AfaFlowControl.flowException( )


            sqlStr = "UPDATE VOUH_PARAMETER set \
              VOUHNAME = '"+ TradeContext.sVouhName + "',VOUHLEN = '"+ TradeContext.sVouhLen+ "',\
              HEADLEN = '"+ TradeContext.sHeadLen+ "'"
            sqlStr = sqlStr +" WHERE VOUHTYPE = '" + TradeContext.oldVOUHTYPE + "'\
            and ZONENO = '" + TradeContext.sZoneNo+ "'"

            records = AfaDBFunc.UpdateSqlCmt( sqlStr )
            if records==-1 :
                tradeExit( 'A005057', '更新[凭证参数维护表]信息异常!' )
                raise AfaFlowControl.flowException( )
            elif records==0 :
                tradeExit( 'A005058', '修改[凭证参数维护表]基本信息失败!' )
                raise AfaFlowControl.flowException( )
            tradeExit('0000', '修改成功')

        if TradeContext.opeType == '2':#查询
            #=============初始化返回报文变量====================
            TradeContext.tradeResponse=[]
            sqlStr = "SELECT VOUHTYPE,VOUHNAME,VOUHLEN,HEADLEN,ZONENO FROM VOUH_PARAMETER WHERE ZONENO = '"+ TradeContext.sZoneNo +"'"
            if (len(TradeContext.sVouhType)!=0):
                sqlStr = sqlStr + " AND VOUHTYPE = '" + TradeContext.sVouhType + "'"
            if (len(TradeContext.sVouhName)!=0):
                sqlStr = sqlStr + " AND VOUHNAME = '" + TradeContext.sVouhName + "'"
            if (len(TradeContext.sVouhType)==0 and len(TradeContext.sVouhName)==0 ):
                sqlStr = sqlStr
                
            #sqlStr="SELECT VOUHTYPE,VOUHNAME,VOUHLEN,HEADLEN,ZONENO FROM VOUH_PARAMETER WHERE ZONENO ='000000' AND VOUHTYPE = '0000002343' AND VOUHNAME = 'adfsadf'"
            AfaLoggerFunc.tradeInfo( 'sqlStr = ' + sqlStr )
            records = AfaDBFunc.SelectSql( sqlStr )
            if( records == None ):
                TradeContext.tradeResponse.append( ['retCount','0'] )
                tradeExit( 'A005052', '查询[凭证参数维护表]操作异常!'  )
                raise AfaFlowControl.flowException( )
            elif( len( records )==0 ):
                TradeContext.tradeResponse.append( ['retCount','0'] )
                tradeExit( 'A005059', '查询[凭证参数维护表]基本信息不存在!' )
                raise AfaFlowControl.flowException( )
            else:
                records=AfaUtilTools.ListFilterNone( records )
                baseInfoNames=['sVouhType','sVouhName','sVouhLen','sHeadLen','sZoneNo']
                total=len( records )
                for i in range( 0, len( records ) ):
                    j=0
                    for name in baseInfoNames:
                       TradeContext.tradeResponse.append( [name, records[i][j]] )
                       j=j+1
                TradeContext.tradeResponse.append( ['retCount', str( total )] )
                TradeContext.tradeResponse.append( ['errorCode', '0000'] )
                TradeContext.tradeResponse.append( ['errorMsg', '查询成功'] )
                tradeExit('0000', '查询成功')

        #自动打包
        AfaFunc.autoPackData()

        #=============程序退出=========================================
       # AfaLoggerFunc.afa_SuccQuit(__name__,'凭证中心参数维护交易')
    except AfaFlowControl.flowException, e:
        AfaFlowControl.exitMainFlow( )