Ejemplo n.º 1
0
def Update():
    AfaLoggerFunc.tradeInfo( '********************修改数据表开始*******************' )
    try:
        if( TradeContext.existVariable( "busiNo" ) and len(TradeContext.busiNo)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[单位编码]:不能为空')
        if( TradeContext.existVariable( "hostIp" ) and len(TradeContext.hostIp)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[财政地址]:不能为空')
        if( TradeContext.existVariable( "upUser" ) and len(TradeContext.upUser)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[上传用户]:不能为空')
        if( TradeContext.existVariable( "upPwd" ) and len(TradeContext.upPwd)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[上传密码]:不能为空')
        if( TradeContext.existVariable( "downUser" ) and len(TradeContext.downUser)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[下载用户]:不能为空')
        if( TradeContext.existVariable( "downPwd" ) and len(TradeContext.downPwd)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[下载密码]:不能为空')
        if( TradeContext.existVariable( "accDate" ) and len(TradeContext.accDate)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[开户余额]:不能为空')
        if( TradeContext.existVariable( "remain" ) and len(TradeContext.remain)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[开户日期]:不能为空')
        sqlstr="UPDATE fs_businoconf SET "
        sqlstr1=   sqlstr
        sqlstr1=sqlstr1+"hostIp='"+ TradeContext.hostIp+"',"
        sqlstr1=sqlstr1+"upUser='******',"
        sqlstr1=sqlstr1+"upPasswd='"+ TradeContext.upPwd+"',"
        sqlstr1=sqlstr1+"downUser='******',"
        sqlstr1=sqlstr1+"downPasswd='"+ TradeContext.downPwd+"'"
        sqlstr1=sqlstr1+" WHERE "
        sqlstr1=sqlstr1+"busiNo = '"+ TradeContext.busiNo+"'"
                
        AfaLoggerFunc.tradeInfo(sqlstr1)
        records = AfaDBFunc.UpdateSqlCmt(sqlstr1)
                 
        if( records <=0  ):
            AfaLoggerFunc.tradeFatal(sqlstr1)
            return AfaFlowControl.ExitThisFlow( 'A0027', '未发现信息:'+AfaDBFunc.sqlErrMsg )
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sqlstr1)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        
        
        sqlstr="UPDATE fs_remain SET "
        sqlstr2=   sqlstr
        sqlstr2=sqlstr2+"date='"+ TradeContext.accDate+"',"
        sqlstr2=sqlstr2+"this='"+ TradeContext.remain+"'"
        sqlstr2=sqlstr2+" WHERE "
        sqlstr2=sqlstr2+"busiNo = '"+ TradeContext.busiNo+"'"
        
        AfaLoggerFunc.tradeInfo(sqlstr2)
        records = AfaDBFunc.UpdateSqlCmt(sqlstr2)
        
        if( records == None or records <=0  ):
            AfaLoggerFunc.tradeFatal(sqlstr2)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        AfaLoggerFunc.tradeInfo( '********************修改数据表结束*******************' )
        return True
        
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Ejemplo n.º 2
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))
Ejemplo n.º 3
0
def UpdateUserPass():

    sql = "SELECT PASSWORD FROM ABDT_USERINFO WHERE STATUS='1' AND USERNO = '" + TradeContext.USERNO + "'"

    AfaLoggerFunc.tradeInfo(sql)
        
    records =  AfaDBFunc.SelectSql( sql )

    if (records == None or len(records)==0) :
        return ExitSubTrade( '9000', '不存在用户信息' )

    if (records[0][0] != TradeContext.OLDPASSWD):
        return ExitSubTrade( '9000', '旧密码不符' )

    sql = "UPDATE ABDT_USERINFO SET PASSWORD='******'"

    sql = sql + " WHERE "

    sql = sql + "USERNO="  + "'" + TradeContext.USERNO  + "'"              #用户号

    AfaLoggerFunc.tradeInfo(sql)

    ret = AfaDBFunc.UpdateSqlCmt( sql )
    if (ret < 0):
        return ExitSubTrade('9000', '修改用户密码失败')

    return True
Ejemplo n.º 4
0
def ADBUpdateQueDtl( ):
    sqlupdate = ""
    AfaLoggerFunc.tradeInfo( '>>>>>>>新报试算更新原交易流水<<<<<<<')
    sqlupdate = sqlupdate + "update afa_adbinfo set "
    sqlupdate = sqlupdate + " note8 = '"+TradeContext.errorMsg.strip()+"' "
    if( TradeContext.errorCode.strip() == "0000"):
        sqlupdate = sqlupdate + ", dtlstatus = '0' "
        sqlupdate = sqlupdate + ", amount = '"+TradeContext.PaymentAmt.strip()+"' "
    #太保业务员号码
    if( TradeContext.existVariable( "CpicTeller" ) and len(TradeContext.CpicTeller.strip()) > 0):
        sqlupdate = sqlupdate + ", CpicTeller = '"+TradeContext.CpicTeller.strip()+"'"
    #被保人姓名
    if( TradeContext.existVariable( "FullNameB" ) and len(TradeContext.FullNameB.strip()) > 0):
        sqlupdate = sqlupdate + ", UserNameB = '"+TradeContext.FullNameB.strip()+"'"
    #被保人证件号码
    if( TradeContext.existVariable( "GovtIDB" ) and len(TradeContext.GovtIDB.strip()) > 0):
        sqlupdate = sqlupdate + ", IdCodeB = '"+TradeContext.GovtIDB.strip()+"'"
    sqlupdate = sqlupdate + " where sysid = '"+TradeContext.sysId+"' and agentserialno = '"+TradeContext.agentSerialno+"'"
    AfaLoggerFunc.tradeInfo( 'sqlupdate = ' + str(sqlupdate))
    record=AfaDBFunc.UpdateSqlCmt( sqlupdate )
    if( record > 0 ):
        AfaLoggerFunc.tradeInfo( '>>>>>>>更新新报试算原交易流水成功<<<<<<<')
        return True
    if( record == 0 ):
        AfaLoggerFunc.tradeInfo( '>>>>>>>更新新报试算原交易流水失败<<<<<<<')
        TradeContext.errorCode,TradeContext.errorMsg='A0100','未发现原始交易'
        return False
    else :
        AfaLoggerFunc.tradeInfo( '>>>>>>>更新新报试算原交易流水失败<<<<<<<')
        TradeContext.errorCode, TradeContext.errorMsg='A0100', '更新原交易状态失败' + AfaDBFunc.sqlErrMsg
        return False
Ejemplo n.º 5
0
def ADBUpdateTransdtlRev( ):
    sqlupdate = ""
   
    AfaLoggerFunc.tradeInfo( '>>>>>>>开始更新原冲正交易结果信息<<<<<<<')
   
    sqlupdate = sqlupdate + "update afa_maintransdtl set "
    sqlupdate = sqlupdate + " corpcode = '"+TradeContext.errorCode.strip()+"' "
    sqlupdate = sqlupdate + ", errorMsg = '"+TradeContext.errorMsg.strip()+"' "
    sqlupdate = sqlupdate + " where sysid = '"+TradeContext.sysId+"' and agentserialno = '"+TradeContext.agentSerialno+"'"
   
    AfaLoggerFunc.tradeInfo( 'sqlupdate = ' + str(sqlupdate))
   
    record=AfaDBFunc.UpdateSqlCmt( sqlupdate )
   
    if( record > 0 ):
        AfaLoggerFunc.tradeInfo( '>>>>>>>更新原冲正交易结果信息成功<<<<<<<')
        return True
    if( record == 0 ):
        AfaLoggerFunc.tradeInfo( '>>>>>>>更新原冲正交易结果信息失败<<<<<<<')
        TradeContext.errorCode,TradeContext.errorMsg='A0100','未发现原始交易'
        return False
    else :
        AfaLoggerFunc.tradeInfo( '>>>>>>>更新原冲正交易结果信息失败<<<<<<<')
        TradeContext.errorCode, TradeContext.errorMsg='A0100', '更新原交易状态失败' + AfaDBFunc.sqlErrMsg
        return False
Ejemplo n.º 6
0
def start():
    try:
        AfaLoggerFunc.tradeInfo('RunSign='+TradeContext.RunSign+' 启用调度')
        if( TradeContext.existVariable( "BackRunTime" ) and len(TradeContext.BackRunTime)<=0 ):
            return TipsFunc.ExitThisFlow( 'A0001', '[BackRunTime]值不存在!' )
        
        year=(TradeContext.BackRunTime)[0:4]
        month=(TradeContext.BackRunTime)[4:6]
        day=(TradeContext.BackRunTime)[6:8]
        hour=(TradeContext.BackRunTime)[8:10]
        minute=(TradeContext.BackRunTime)[10:12]
            
        sql="UPDATE AFA_CRONADM              "
        sql=sql+" SET YEAR = '"+year+"',     "
        sql=sql+"     MONTH = '"+month+"',   "
        sql=sql+"     DAY = '"+day+"',       "
        sql=sql+"     HOUR = '"+hour+"',     "
        sql=sql+"     MINUTE = '"+minute+"', "
        sql=sql+"     STATUS = '1'           "
        sql=sql+" WHERE TASKID = '00050'     "
            
        AfaLoggerFunc.tradeInfo(sql)
        
        records = AfaDBFunc.UpdateSqlCmt(sql)
        if( records <=0  ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0027', '未发现调度信息:'+AfaDBFunc.sqlErrMsg )
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
      
        return True
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))         
Ejemplo n.º 7
0
def CreCpicLjFile(logger):
    logger.info( "开始生成安贷宝联机交易回执文件" )
    TradeContext.table = 'AFA_MAINTRANSDTL'
    splitStr = "|"
    emptyStr = " "
    psFilePath = os.environ['HOME']+"/afa/data/cpic/cpic/"+TradeContext.fileName
    try:
        f = file( psFilePath,"w")
    except:
        logger.info( "生成文件"+TradeContext.fileName+"失败" )
        return -1
    
    sqlUpdate = "UPDATE "+TradeContext.table+" SET corpchkflag ='0' WHERE sysId ='"+TradeContext.sysId+"' and unitno = '" + TradeContext.unitno + "' "
    sqlUpdate = sqlUpdate + "AND workdate = '"+TradeContext.corpDate+"' AND chkflag = '0' and revtranf = '0' and bankstatus = '0'"
    #print sqlUpdate
    logger.info("更新chkflag>>>>>>"+str(sqlUpdate))
    records = AfaDBFunc.UpdateSqlCmt( sqlUpdate )
    #print 'records = '+str(records)
    if(records < 0):
        return -2
    '''用户编号,金额,流水号'''
    sql = "SELECT workdate,brno,agentserialno,note5,amount "
    sql = sql + "FROM "+TradeContext.table+" WHERE sysId ='"+TradeContext.sysId+"'"
    sql = sql + "AND workdate = '"+TradeContext.corpDate+"' AND chkflag = '0' and revtranf = '0' and bankstatus = '0'"
    #print sql
    logger.info("查询数据>>>>>>"+str(sql))
    records = AfaDBFunc.SelectSql( sql )
    print "-------------< [生成通安贷宝联机回执文件:共 " + str(len(records)) + "条成功记录] >------------"
    logger.info( "< [生成通安贷宝联机回执文件:共 " + str(len(records)) + "条成功记录] >")
    if ( len(records) > 0 ):
        for i in range(0,len(records)):
            tmpStr = ""
            #银行编码
            tmpStr = tmpStr + "01" +splitStr
            #交易日期
            tmpStr = tmpStr + records[i][0].strip() +splitStr
            #银行区域代码
            tmpStr = tmpStr + "ANHNX00001" +splitStr
            #储蓄所代码
            tmpStr = tmpStr + records[i][1].strip()  +splitStr
            #交易码
            tmpStr = tmpStr + "6000113" +splitStr
            #银行流水号
            tmpStr = tmpStr + records[i][2].strip()  +splitStr
            #保单号
            tmpStr = tmpStr + records[i][3].strip()  +splitStr
            #金额
            tmpStr = tmpStr + records[i][4].strip()  +splitStr
            #销售渠道
            tmpStr = tmpStr + "01|\n"
            f.write( tmpStr )
        f.close()
    else:
        logger.info( "结束生成安贷宝联机回执文件(无记录)" )
        f.close()
    f.close()
    logger.info( "结束生成安贷宝联机回执文件" )
    return 0
Ejemplo n.º 8
0
def SubTransDtlProc( action ):

    AfaLoggerFunc.tradeInfo( '>>>增加交易流水从表信息' )

    #新增
    if ( action == '1' ):
        sql = "INSERT INTO AFA_SUBTRANSDTL(AGENTSERIALNO,WORKDATE,RECSEQNO,DATA1,DATA2) VALUES("    
        sql = sql + "'"  +  TradeContext.agentSerialno  + "'"
        sql = sql + ",'" +  TradeContext.workDate       + "'"
        sql = sql + ",'" +  '1'                         + "'"

        if( TradeContext.existVariable( "appendData1" ) ):
            sql = sql + ",'" +  TradeContext.appendData1   + "'"
        else:
            sql = sql + ",'" + ""                          + "'"

        if( TradeContext.existVariable( "appendData2" ) ):
            sql = sql + ",'" +  TradeContext.appendData2   + "'"
        else:
            sql = sql + ",'" + ""                          + "'"

        sql = sql + ")"

        AfaLoggerFunc.tradeInfo( sql )
    
        subresult = AfaDBFunc.InsertSqlCmt( sql )

        if( subresult < 1 ):
            TradeContext.errorCode, TradeContext.errorMsg='A0044', '插入流水从表失败'+AfaDBFunc.sqlErrMsg
            return False


    #修改
    if ( action == '2' ):
        sql = "UPDATE AFA_SUBTRANSDTL SET "

        if( TradeContext.existVariable( "afe_appendData1" ) ):
            sql = sql + "DATA1='"  +  TradeContext.afe_appendData1   + "'"

        if( TradeContext.existVariable( "afe_appendData2" ) ):
            sql = sql + ",DATA2='" +  TradeContext.afe_appendData2   + "'"

        sql = sql + " WHERE "

        sql = sql + "AGENTSERIALNO='" +  TradeContext.agentSerialno + "' AND "
        sql = sql + "WORKDATE='"      +  TradeContext.workDate      + "'"

        AfaLoggerFunc.tradeInfo( sql )

        subresult = AfaDBFunc.UpdateSqlCmt( sql )

        if( subresult < 1 ):
            TradeContext.errorCode, TradeContext.errorMsg='A0044', '插入流水从表失败'+AfaDBFunc.sqlErrMsg
            return False

    return True
Ejemplo n.º 9
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))    
Ejemplo n.º 10
0
def UpdateBatchInfo(pBatchNo, pStatus, pMessage,pInfo=0):
    AfaLoggerFunc.tradeInfo('>>>修改批次状态:[' + pStatus + ']' + pMessage)

    try:
        #-----1,将错误信息更新到ahxnb_file表的PROCMSG中
        sql = ""
        sql = "UPDATE AHNX_FILE SET "
        sql = sql + "STATUS="   +  "'" + pStatus     + "',"     #状态
        sql = sql + "PROCMSG="  +  "'" + pMessage    + "'"      #原因
        sql = sql + " WHERE BATCHNO = '" + pBatchNo  + "'"      #委托号"

        AfaLoggerFunc.tradeInfo(sql)
        result = AfaDBFunc.UpdateSqlCmt( sql )
        
        if ( result <= 0 ):
            AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '修改批次的状态失败')
            
        #-----1.1,批量签约的错误信息文件名为上传文件。
        sql = ""
        sql = sql + "select FILETYPE,FILENAME from AHNX_FILE"
        sql = sql + " where BATCHNO = '"+ pBatchNo +"'"
        
        AfaLoggerFunc.tradeInfo(sql)
        record = AfaDBFunc.SelectSql( sql )
        
        if record==None:
            return ExitSubTrade("D0001" ,"查询AHNX_FILE失败")
        elif(len(record) == 0):
            return ExitSubTrade("D0001" ,"无此信息")
        else:
            TradeContext.procFileType = record[0][0].strip()
            TradeContext.procFileName = record[0][1].strip()
        
        if( TradeContext.procFileType == '4' ):     #批量签约
            if pInfo:
                path_procmsg = os.environ['AFAP_HOME'] + '/data/ahxnb/procmsg/AHXNB_PROCMSG' + TradeContext.procFileName
                fp_procmsg = open(path_procmsg,"a")
                fp_procmsg.write(pInfo + "\n")
                fp_procmsg.close()
            
        else:
            #-----2,把错误信息写入到错误文件中
            if pInfo:
                path_procmsg = os.environ['AFAP_HOME'] + '/data/ahxnb/procmsg/AHXNB_PROCMSG' + pBatchNo + '.TXT'
                fp_procmsg = open(path_procmsg,"a")
                fp_procmsg.write(pInfo + "\n")
                fp_procmsg.close()

        return True

    except Exception, e:
        AfaLoggerFunc.tradeInfo( str(e) )
        return ExitSubTrade( '9999', '修改批次的状态异常')
Ejemplo n.º 11
0
def DeleteUserInfo():
    
    sql = "DELETE FROM ABDT_USERINFO WHERE USERNO=" + "'" + TradeContext.USERNO + "'"

    AfaLoggerFunc.tradeInfo(sql)

    ret = AfaDBFunc.UpdateSqlCmt( sql )
    if (ret <= 0):
        return ExitSubTrade( '9000', '删除用户信息失败' )
        
    return True
Ejemplo n.º 12
0
def ModifyVouhModify():
    if(not TradeContext.existVariable( "HostDate" )):
                TradeContext.HostDate = '' 

    #更新流水表
    sqlUpdate = "update VOUH_MODIFY SET TRANSTATUS = '" + TradeContext.sTranStatus + "',\
                HOSTDATE = '" + TradeContext.HostDate + "',\
                HOSTSERIAL = '" + TradeContext.HostSerno + "' where VOUHSERIAL = '" + TradeContext.sVouhSerial + "'"
    record = AfaDBFunc.UpdateSqlCmt( sqlUpdate )
    if record == -1 or record == 0 :
        tradeExit('A005062', '更新流水表失败!')
        raise AfaFlowControl.flowException( )
Ejemplo n.º 13
0
def upDate_ahjf_lawcode( ):
    try:
        selectSql = "select * from ahjf_lawcode "
        whereSql  = " where  OFFICECODE='" + TradeContext.OFFICECODE    + "'"
        whereSql  = whereSql + " and LAWACTIONCODE='" + TradeContext.LAWACTIONCODE + "'"
        
        selectSql = selectSql + whereSql
        AfaLoggerFunc.tradeInfo( '基础数据查询sql:' + selectSql)
        selectRecord = AfaDBFunc.SelectSql( selectSql )
        
        if selectRecord == None:
            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
            return False
        if len(selectRecord) > 0:
            AfaLoggerFunc.tradeInfo('>>>数据已存在,做更新操作')
            
            updateSql = "update ahjf_lawcode set "
            updateSql = updateSql + "DESCRIBE     ='" + TradeContext.DESCRIBE     + "',"
            updateSql = updateSql + "MR_AMOUNT    ='" + TradeContext.MR_AMOUNT    + "',"
            updateSql = updateSql + "LOWER_AMOUNT ='" + TradeContext.LOWER_AMOUNT + "',"
            updateSql = updateSql + "TOP_AMOUNT   ='" + TradeContext.TOP_AMOUNT   + "'"
            
            updateSql = updateSql + whereSql
            AfaLoggerFunc.tradeInfo( '基础数据更新sql:' + updateSql)
            updateRecord = AfaDBFunc.UpdateSqlCmt( updateSql )
            if updateRecord <  0:
                AfaLoggerFunc.tradeInfo( "更新基础数据失败" )
                return False
        else:
            AfaLoggerFunc.tradeInfo('>>>数据不存在,登记新的数据')
            
            insertSql = "insert into ahjf_lawcode(OFFICECODE,LAWACTIONCODE,DESCRIBE,MR_AMOUNT,LOWER_AMOUNT,TOP_AMOUNT,note1,note2,note3,note4) values("
            insertSql = insertSql + "'" + TradeContext.OFFICECODE    + "',"      #采集机关代码 
            insertSql = insertSql + "'" + TradeContext.LAWACTIONCODE + "',"      #违法行为代码 
            insertSql = insertSql + "'" + TradeContext.DESCRIBE      + "',"      #违法行为描述 
            insertSql = insertSql + "'" + TradeContext.MR_AMOUNT     + "',"      #默认罚款金额 
            insertSql = insertSql + "'" + TradeContext.LOWER_AMOUNT  + "',"      #罚款金额下限 
            insertSql = insertSql + "'" + TradeContext.TOP_AMOUNT    + "',"      #罚款金额上限 
            insertSql = insertSql + "'',"                                        #备用1
            insertSql = insertSql + "'',"                                        #备用2
            insertSql = insertSql + "'',"                                        #备用3
            insertSql = insertSql + "'')"                                        #备用4
            
            AfaLoggerFunc.tradeInfo( '基础数据登记sql:' + insertSql)
            insertRecord = AfaDBFunc.InsertSqlCmt( insertSql )
            
            if insertRecord < 0:
                AfaLoggerFunc.tradeInfo( '>>>登记基础更新数据失败数据失败' )
                return False
            return True
    except Exception, e:
        AfaLoggerFunc.tradeInfo( str(e) )
        return False
Ejemplo n.º 14
0
def UpdateBatchAdm(status,errorCode,errMsg):
    AfaLoggerFunc.tradeInfo('>>>更新批次状态['+status+']'+errorCode+errMsg)
    sqlStr = "UPDATE TIPS_CHECKADM SET DEALSTATUS='"+status+"',errorcode='"+errorCode+"',ERRORMSG='"+errMsg+"'"
    sqlStr =sqlStr +" WHERE  workDate  = '" + TradeContext.chkDate         + "'"
    sqlStr =sqlStr +" AND BATCHNO = '"      + TradeContext.chkAcctOrd      + "'"
    sqlStr =sqlStr +" AND PAYBKCODE ='"     + TradeContext.payBkCode.strip()  + "'"
    sqlStr =sqlStr +" AND PAYEEBANKNO ='"   + TradeContext.payeeBankNo.strip()    + "'"   
    AfaLoggerFunc.tradeInfo(sqlStr )
    records=AfaDBFunc.UpdateSqlCmt( sqlStr )
    if( records <0 ):
        return TipsFunc.ExitThisFlow( 'A0027', '数据库错误' )
    return True
Ejemplo n.º 15
0
def Update():
    try:
        if( TradeContext.existVariable( "BRNO" ) and len(TradeContext.BRNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[分行行号]:不能为空')
        if( TradeContext.existVariable( "PAYBKCODE" ) and len(TradeContext.PAYBKCODE)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[清算行行号]:不能为空')
        if( TradeContext.existVariable( "STATUS" ) and len(TradeContext.STATUS)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[是否为清算行]:不能为空')
        if( TradeContext.existVariable( "ACCNO" ) and len(TradeContext.ACCNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[待结算财税库款]:不能为空')
        if( TradeContext.existVariable( "PAYEEBANKNO" ) and len(TradeContext.PAYEEBANKNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[清算国库支付系统行号]:不能为空')

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

            
        sql="UPDATE TIPS_BRANCH_ADM SET "
        sql=sql+"PAYBKCODE='"+ TradeContext.PAYBKCODE+"',"
        sql=sql+"BANKNO='"+ TradeContext.BANKNO+"',"
        sql=sql+"BANKACCT='"+ TradeContext.BANKACCT+"',"
        sql=sql+"BANKNAME='"+ TradeContext.BANKNAME+"',"
        sql=sql+"PAYEEBANKNO='"+ TradeContext.PAYEEBANKNO+"',"
        sql=sql+"STATUS='"+ TradeContext.STATUS+"',"
        sql=sql+"ACCNO='"+ TradeContext.ACCNO+"',"
        sql=sql+"NOTE3='"+ TradeContext.ACCNAME+"',"
        sql=sql+"BRNO='"+ TradeContext.BRNO+"' "
        sql=sql+"WHERE "
        sql=sql+"BRNO = '"+ TradeContext.BRNO+"'"
                
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.UpdateSqlCmt(sql)
                 
        if( records <=0  ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0027', '未发现信息:'+AfaDBFunc.sqlErrMsg )
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        return True
        
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Ejemplo n.º 16
0
def DelHostFile(curBatchNo, HostFileName, Flag):

    AbdtManager.WrtLog('删除主机文件:[' + HostFileName + ']')

    try:
        HostBatchNo  = curBatchNo[4:16]

        #通讯区打包
        HostContext.I1TRCD = '8819'                     #交易码
        HostContext.I1SBNO = TradeContext.BRNO          #交易机构号
        HostContext.I1USID = '999986'                   #交易柜员号
        HostContext.I1AUUS = ""                         #授权柜员
        HostContext.I1AUPS = ""                         #授权柜员密码
        HostContext.I1WSNO = ""                         #终端号
        HostContext.I1NBBH = TradeContext.APPNO         #代理业务标识
        HostContext.I1CLDT = TradeContext.BATCHDATE     #原批量日期
        HostContext.I1UNSQ = HostBatchNo                #原批量委托号
        HostContext.I1FILE = HostFileName               #删除文件名
        HostContext.I1OPFG = Flag                       #操作标志(0-查询 1-删除上传文件 2-删除下传文件)

        HostTradeCode = "8819".ljust(10,' ')
        HostComm.callHostTrade( os.environ['AFAP_HOME'] + '/conf/hostconf/AH8819.map', HostTradeCode, "0002" )
        if( HostContext.host_Error ):
            AbdtManager.WrtLog('>>>处理结果=[' + str(HostContext.host_ErrorType) + ']:' +  HostContext.host_ErrorMsg)
            return -1

        if ( HostContext.O1MGID == "AAAAAAA" ):
            AbdtManager.WrtLog('>>>处理结果=[' + HostContext.O1MGID + ']交易成功')

        else:
            AbdtManager.WrtLog('>>>处理结果=[' + HostContext.O1MGID + ']' + HostContext.O1INFO)

        #删除批量表中的数据
        sql = ""
        sql = sql + "UPDATE ABDT_BATCHINFO SET STATUS='**' WHERE "
        sql = sql + "APPNO='"   + TradeContext.APPNO     + "'" + " AND "
        sql = sql + "BUSINO='"  + TradeContext.BUSINO    + "'" + " AND "
        sql = sql + "BATCHNO='" + TradeContext.BATCHNO   + "'"

        retcode = AfaDBFunc.UpdateSqlCmt( sql )
        if (retcode==None or retcode <= 0):
            return -1
        else:
            return 0

    except Exception, e:
        AbdtManager.WrtLog( str(e) )
        AbdtManager.WrtLog('删除主机文件异常')
        return -1
Ejemplo n.º 17
0
def UpdUnitDayendStatus(flag):
    AfaLoggerFunc.tradeInfo('修改商户日终状态' )
    GetUnitStatus()
    if(TradeContext.__busiMode__!='2'):
        sql="UPDATE AFA_UNITADM SET DAYENDSTATUS='"+flag+"',dayendtime='"+TradeContext.workTime+\
            "' WHERE SYSID='"+TradeContext.sysId+"'and UNITNO='"+TradeContext.unitno+"'"
    else:
        sql="UPDATE AFA_SUBUNITADM SET DAYENDSTATUS='"+flag+"' , dayendtime='"+TradeContext.workTime+\
            "' WHERE SYSID='"+TradeContext.sysId+"' AND UNITNO='"+TradeContext.unitno+"' AND "\
            "SUBUNITNO='"+TradeContext.subUnitno+"'"
    AfaLoggerFunc.tradeInfo(sql )
    records=AfaDBFunc.UpdateSqlCmt( sql )
    if( records <0 ):
        AfaLoggerFunc.tradeFatal( sql )
        return AfaFlowControl.ExitThisFlow( 'A0025', '数据库错误,商户信息表操作异常:'+AfaDBFunc.sqlErrMsg )
    return True
Ejemplo n.º 18
0
def Ahdx_Login():

    try:
        sqlStr = "SELECT STATUS FROM ABDT_UNITINFO WHERE"
        
        #begin 20100528 蔡永贵修改
        #sqlStr = sqlStr + " APPNO = '"      + 'AG2008'  + "'"
        sqlStr = sqlStr + " APPNO in ('AG2008','AG2012')"
        #end
        
        sqlStr = sqlStr + " AND AGENTTYPE IN ('1','2')"

        #AfaLoggerFunc.tradeInfo(sqlStr)

        records = AfaDBFunc.SelectSql( sqlStr )
        if (records==None or len(records) < 0):
            AfaLoggerFunc.tradeInfo('>>>处理结果:签到失败,数据库异常')
            TradeContext.errorCode,TradeContext.errorMsg    =   "0001","签到失败,数据库异常"
            sys.exit(1)

        elif ( len(records) == 0 ):
            AfaLoggerFunc.tradeInfo('>>>处理结果:没有发现该单位信息,不能签到')
            TradeContext.errorCode,TradeContext.errorMsg    =   "0001","没有发现该单位信息,不能签到"
            sys.exit(1)


        sqlStr = "UPDATE ABDT_UNITINFO SET STATUS='1' WHERE"
        
        #begin 20100528 蔡永贵修改
        #sqlStr = sqlStr + " APPNO = '"      + 'AG2008'  + "'"
        sqlStr = sqlStr + " APPNO in ('AG2008','AG2012')"
        #end
        
        sqlStr = sqlStr + " AND AGENTTYPE IN ('1','2')"

        retcode = AfaDBFunc.UpdateSqlCmt( sqlStr )
        if (retcode==None or retcode <= 0):
            AfaLoggerFunc.tradeInfo('>>>处理结果:签到失败,数据库异常')
            TradeContext.errorCode,TradeContext.errorMsg    =   "0001","签到失败,数据库异常"
            sys.exit(1)

        AfaLoggerFunc.tradeInfo('>>>处理结果:签到成功')

    except Exception, e:
        AfaLoggerFunc.tradeInfo(str(e))
        TradeContext.errorCode,TradeContext.errorMsg    =   "0001",str(e)
        sys.exit(1)
Ejemplo n.º 19
0
def UpdSysStatus(sysId, sysStatus):

    WrtLog('>>>修改系统状态')

    updSql = "UPDATE AFA_SYSTEM SET STATUS='" + sysStatus + "' WHERE SYSID='" + sysId + "'"

    WrtLog(updSql)

    result = AfaDBFunc.UpdateSqlCmt( updSql )
    if ( result <= 0 ):
        WrtLog( AfaDBFunc.sqlErrMsg )
        WrtLog('>>>处理结果:修改系统状态,数据库异常')
        return False

    WrtLog('>>>修改系统状态 ---> 成功')

    return True
Ejemplo n.º 20
0
def UpdChkFlag(chkFlag,wrokDate):
    VouhFunc.WrtLog('>>>修改对帐标志')
    
    updSql = "UPDATE VOUH_MODIFY SET CHKFLAG ='" + chkFlag + "' WHERE WORKDATE = '" + wrokDate + "' \
                and TRANSTATUS = '0'"
    
    VouhFunc.WrtLog(updSql)
    
    result = AfaDBFunc.UpdateSqlCmt( updSql )
    if ( result <= 0 ):
        VouhFunc.WrtLog( AfaDBFunc.sqlErrMsg )
        VouhFunc.WrtLog('>>>处理结果:修改对帐标志,数据库异常')
        return False

    VouhFunc.WrtLog('>>>修改对帐标志 ---> 成功')

    return True
Ejemplo n.º 21
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))
Ejemplo n.º 22
0
def GetFtpFile(RemoteFileName):

    TradeContext.sysId          = "FTP"
    TradeContext.hostip         = TradeContext.CROP_HOSTIP
    TradeContext.user           = TradeContext.CROP_USERNO
    TradeContext.pwd            = TradeContext.CROP_PASSWD
    TradeContext.localpath      = TradeContext.CROP_LDIR
    #TradeContext.localfilename  = LocalFileName
    TradeContext.remotefilename = RemoteFileName
    TradeContext.remotepath     = TradeContext.CROP_RDIR
    TradeContext.TransCode      = "8889"
    TradeContext.TemplateCode   = "3001"

    #=============与第三方通讯通讯====================
    TradeContext.__respFlag__='0'

    AfaAfeFunc.CommAfe()

    flag  = -1

    if( TradeContext.errorCode != '0000' ):
        AfaLoggerFunc.tradeInfo("文件[" + TradeContext.localpath + "/" + RemoteFileName + "]下载失败")
        flag = -1

    else:
        AfaLoggerFunc.tradeInfo("文件[" + TradeContext.localpath + "/" + RemoteFileName + "]下载成功")
        flag = 0

    #下载完成之后把下载日志记录到数据库中
    sql = ""
    sql = sql + "insert into fs_ftpreturn(busino,hostip,succflag,ftpflag,workdate,worktime,filename,note1,note2) values(  "
    sql = sql + "'" + TradeContext.busiNo         + "',"        #单位编号
    sql = sql + "'" + TradeContext.hostip         + "',"        #主机地址
    sql = sql + "'" + str(flag)                   + "',"        #成功失败标志(0-成功,-1-失败)
    sql = sql + "'" + "1"                         + "',"        #上传下载标志(0-上传,1-下载)
    sql = sql + "'" + TradeContext.WORKDATE       + "',"        #操作日期
    sql = sql + "'" + AfaUtilTools.GetSysTime( )  + "',"        #操作时间
    sql = sql + "'" + RemoteFileName              + "',"        #下载文件名
    sql = sql + "'',"                                           #备注1
    sql = sql + "'')"                                           #备注2

    AfaLoggerFunc.tradeInfo( ">>>>登记下载记录:" + sql )

    AfaDBFunc.UpdateSqlCmt( sql )

    return flag
Ejemplo n.º 23
0
def UpdatePreDtl( action ):

    AfaLoggerFunc.tradeInfo( '>>>更新原交易流水信息' )
        
    sqlstr="UPDATE AFA_MAINTRANSDTL SET "
    
    if( action == 'BANK' ):
        sqlstr=sqlstr+" BANKSTATUS='3' "

    elif( action == 'CORP' ):
        sqlstr=sqlstr+" CORPSTATUS='3' "

    elif( action == 'TRADE' ):
        sqlstr=sqlstr+" BANKSTATUS='3',CORPSTATUS='3'"
        
    else:
        TradeContext.errorCode, TradeContext.errorMsg='A0041', '入口参数条件不符,没有这种类型的操作'
        return False
        
        
    sqlstr = sqlstr + " WHERE "

    #原交易流水号
    if(TradeContext.existVariable( "preAgentSerno" )) :
        sqlstr=sqlstr + " AGENTSERIALNO='"+TradeContext.preAgentSerno+"' AND "
        
    #原渠道流水号
    if(TradeContext.existVariable( "preChannelSerno" )) :
        sqlstr=sqlstr + " CHANNELSERNO='"+TradeContext.preChannelSerno+"' AND "
        
    sqlstr = sqlstr + " WORKDATE='" + TradeContext.workDate + "' AND REVTRANF='0'"

    AfaLoggerFunc.tradeInfo( sqlstr )

    ret=AfaDBFunc.UpdateSqlCmt( sqlstr )
    if( ret > 0 ):
        return True

    if( ret == 0 ):
        TradeContext.errorCode,TradeContext.errorMsg='A0100','未发现原始交易'
        return False

    else :
        TradeContext.errorCode, TradeContext.errorMsg='A0100', '更新原交易状态失败' + AfaDBFunc.sqlErrMsg    
        return False
Ejemplo n.º 24
0
def upDate_ahjf_officecode( ):
    try:
        selectSql = "select * from ahjf_officecode "
        whereSql  = " where  OFFICECODE='" + TradeContext.OFFICECODE    + "'"
        
        selectSql = selectSql + whereSql
        AfaLoggerFunc.tradeInfo( '基础数据查询sql:' + selectSql)
        selectRecord = AfaDBFunc.SelectSql( selectSql )
        
        if selectRecord == None:
            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
            return False
        if len(selectRecord) > 0:
            AfaLoggerFunc.tradeInfo('>>>数据已存在,做更新操作')
            
            updateSql = "update ahjf_officecode set "
            updateSql = updateSql + "OFFICENAME     ='" + TradeContext.OFFICENAME     + "'"
        
            updateSql = updateSql + whereSql
            AfaLoggerFunc.tradeInfo( '基础数据更新sql:' + updateSql)
            updateRecord = AfaDBFunc.UpdateSqlCmt( updateSql )
            if updateRecord <  0:
                AfaLoggerFunc.tradeInfo( "更新基础数据失败" )
                return False
        else:
            AfaLoggerFunc.tradeInfo('>>>数据不存在,登记新的数据')
            
            insertSql = "insert into ahjf_officecode(OFFICECODE,OFFICENAME,NOTE1,NOTE2) values("
            insertSql = insertSql + "'" + TradeContext.OFFICECODE    + "',"      #采集机关代码
            insertSql = insertSql + "'" + TradeContext.OFFICENAME + "',"         #采集机关名称
            insertSql = insertSql + "'',"                                        #备用1
            insertSql = insertSql + "'')"                                        #备用2
            
            AfaLoggerFunc.tradeInfo( '基础数据登记sql:' + insertSql)
            insertRecord = AfaDBFunc.InsertSqlCmt( insertSql )
            
            if insertRecord < 0:
                AfaLoggerFunc.tradeInfo( '>>>登记基础更新数据失败数据失败' )
                return False
            return True
    except Exception, e:
        AfaLoggerFunc.tradeInfo( str(e) )
        return False
Ejemplo n.º 25
0
def UpdStatus(sStatus):

    VouhFunc.WrtLog('>>>修改凭证状态')
    
    #'签到状态(0-签退 1-签到)';

    updSql = "UPDATE VOUH_PARAMETER SET STATUS='" + str(sStatus) + "'"

    VouhFunc.WrtLog(updSql)

    result = AfaDBFunc.UpdateSqlCmt( updSql )
    if ( result <= 0 ):
        VouhFunc.WrtLog( AfaDBFunc.sqlErrMsg )
        VouhFunc.WrtLog('>>>处理结果:修改凭证状态,数据库异常')
        return False

    VouhFunc.WrtLog('>>>修改凭证状态 ---> 成功')

    return True
Ejemplo n.º 26
0
def UpdateAfaDetail(logger):
    #if(TradeContext.hostErrCode == "0000"): #主机返回对账信息,"0"表示成功,"1"表示失败
    #    chkflag = "0"
    #else:
    #    chkflag = "1"
    try:
        sql = "UPDATE AFA_MAINTRANSDTL SET bankcode = '0000',chkflag = '0'"
        sql = sql + " where agentserialno = '"+TradeContext.hostAgentSeriano+"'"
        logger.info( "更新中间业务流水表 " + str(sql) )
        retCode = AfaDBFunc.UpdateSqlCmt(sql)
        #print 'retCode = '+str(retCode)
        if(retCode < 1):
            logger.info("fail")
            return -2
        else:
            return 0
    except Exception , e:
        logger.info(sql+"\n\n"+str(e))
        return -1
Ejemplo n.º 27
0
def UpdUnitWorkDate():
    AfaLoggerFunc.tradeInfo('修改商户当前工作日期' )
    curworkdate=TradeContext.workDate
    if(  TradeContext.existVariable( "nextWorkDate" ) ):
        curworkdate=TradeContext.nextWorkDate
    GetUnitStatus()
    if(TradeContext.__busiMode__!='2'):
        sql="UPDATE AFA_UNITADM SET  PREWORKDATE=WORKDATE,WORKDATE='"+curworkdate+"'"+\
            " WHERE SYSID='"+TradeContext.sysId+"' AND UNITNO='"+TradeContext.unitno+"'"
    else:
        sql="UPDATE AFA_SUBUNITADM SET PREWORKDATE=WORKDATE,WORKDATE='"+curworkdate+"' "+\
            " WHERE SYSID='"+TradeContext.sysId+"' AND UNITNO='"+TradeContext.unitno+"' AND "\
            "SUBUNITNO='"+TradeContext.subUnitno+"'"
    AfaLoggerFunc.tradeInfo(sql )
    records=AfaDBFunc.UpdateSqlCmt( sql )
    if( records <0 ):
        AfaLoggerFunc.tradeFatal( sql )
        return AfaFlowControl.ExitThisFlow( 'A0025', '数据库错误,商户信息表操作异常:'+AfaDBFunc.sqlErrMsg )
    return True
Ejemplo n.º 28
0
def UpdateUserInfo():

    sql = "UPDATE ABDT_USERINFO SET "
    sql = sql + "ZONENO='"   + TradeContext.ZONENO      + "',"                    #地区号
    sql = sql + "BRNO='"     + TradeContext.BRNO        + "',"                    #网点
    sql = sql + "USERNAME='******',"                    #用户名
    sql = sql + "DUTYNO='"   + TradeContext.DUTYNO      + "',"                    #岗位编码
    sql = sql + "ADDRESS='"  + TradeContext.ADDRESS     + "',"                    #地址
    sql = sql + "TEL='"      + TradeContext.TEL         + "'"                     #电话
    sql = sql + " WHERE "

    sql = sql + "USERNO="  + "'" + TradeContext.USERNO  + "'"                     #用户号

    AfaLoggerFunc.tradeInfo(sql)

    ret = AfaDBFunc.UpdateSqlCmt( sql )
    if (ret <= 0):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return ExitSubTrade( '9000', '修改用户信息失败' )

    return True
Ejemplo n.º 29
0
def InitData(sysId,unitNo,trxDate):

    WrtLog('>>>初始化流水标志')

    updSql =  "UPDATE AFA_MAINTRANSDTL SET CHKFLAG='*' WHERE SYSID='" + sysId + "' AND WORKDATE='" + trxDate + "' AND UNITNO='" + unitNo + "'"

    WrtLog(updSql)

    result = AfaDBFunc.UpdateSqlCmt( updSql )
    if ( result < 0 ):
        WrtLog( AfaDBFunc.sqlErrMsg )
        WrtLog('>>>处理结果:初始化流水标志,数据库异常')
        return False

    if ( result == 0 ):
        WrtLog('>>>处理结果:该系统没有任何流水信息')
        return False

    WrtLog('>>>初始化流水标志 ---> 成功')

    return True
Ejemplo n.º 30
0
def Ahdx_Logout():
    try:
        sqlStr = "SELECT STATUS FROM ABDT_UNITINFO WHERE"
        sqlStr = sqlStr + " APPNO = '"      + TradeContext.appNo  + "'"
        sqlStr = sqlStr + " AND BUSINO = '" + TradeContext.busiNo + "'"
        sqlStr = sqlStr + " AND AGENTTYPE IN ('1','2')"

        #AfaLoggerFunc.tradeInfo(sqlStr)

        records = AfaDBFunc.SelectSql( sqlStr )
        if (records==None or len(records) < 0):
            AfaLoggerFunc.tradeInfo('>>>处理结果:签退失败,数据库异常')
            TradeContext.errorCode,TradeContext.errorMsg    =   "0001","签到失败,数据库异常"
            return False

        elif ( len(records) == 0 ):
            AfaLoggerFunc.tradeInfo('>>>处理结果:没有发现该单位信息,不能签退')
            TradeContext.errorCode,TradeContext.errorMsg    =   "0001","没有发现该单位信息,不能签退"
            return False

        sqlStr = "UPDATE ABDT_UNITINFO SET STATUS='2' WHERE"
        sqlStr = sqlStr + " APPNO = '"      + TradeContext.appNo  + "'"
        sqlStr = sqlStr + " AND BUSINO = '" + TradeContext.busiNo + "'"
        sqlStr = sqlStr + " AND AGENTTYPE IN ('1','2')"

        retcode = AfaDBFunc.UpdateSqlCmt( sqlStr )
        if (retcode==None or retcode <= 0):
            AfaLoggerFunc.tradeInfo('>>>处理结果:签退失败,数据库异常')
            TradeContext.errorCode,TradeContext.errorMsg    =   "0001","签退失败,数据库异常"
            return False

        AfaLoggerFunc.tradeInfo('>>>处理结果:签退成功')

        return True

    except Exception, e:
        AfaLoggerFunc.tradeInfo(str(e))
        TradeContext.errorCode,TradeContext.errorMsg    =   "0001",str(e)
        return False