Exemplo n.º 1
0
def Delete():
    try:
        if( TradeContext.existVariable( "busiNo" ) and len(TradeContext.busiNo)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[单位编码]:不能为空')
        
        sql="DELETE "
        sqlstr1=sql+" FROM fs_businoconf WHERE 1=1 "
        sqlstr1=sqlstr1+"AND busiNo='"+ TradeContext.busiNo+"'"
        
        AfaLoggerFunc.tradeInfo(sqlstr1)
        records = AfaDBFunc.DeleteSqlCmt(sqlstr1)
        if( records == None or records <=0 ):
            AfaLoggerFunc.tradeFatal(sqlstr1)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            
        
        sql="DELETE "
        sqlstr2=sql+" FROM fs_remain WHERE 1=1 "
        sqlstr2=sqlstr2+"AND busiNo='"+ TradeContext.busiNo+"'"
        
        AfaLoggerFunc.tradeInfo(sqlstr2)
        records = AfaDBFunc.DeleteSqlCmt(sqlstr2)
        if( records == None or records <=0 ):
            AfaLoggerFunc.tradeFatal(sqlstr2)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        return True
        
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Exemplo n.º 2
0
def Delete():
    try:
        if( TradeContext.existVariable( "BRNO" ) and len(TradeContext.BRNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[分行行号]:不能为空')

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

            
        sql="DELETE "
        sql=sql+" FROM TIPS_BRANCH_ADM WHERE 1=1 "
        if( TradeContext.existVariable( "BRNO" ) and len(TradeContext.BRNO)>0):
            sql=sql+"AND BRNO='"+ TradeContext.BRNO+"'"
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.DeleteSqlCmt(sql)
        if( records == None or records <=0 ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        return True
    except Exception, e:
        AfaLoggerFunc.tradeInfo(e)
        return AfaFlowControl.ExitThisFlow('9999', '程序处理异常'+str(e))
Exemplo n.º 3
0
def deleteCmt( where_dict ):
    if not chk(where_dict):
        return -1

    wheresql = ""
    for where_item in where_dict.keys():
        if table_dict[where_item] == 'S':
            wheresql = wheresql + where_item + " LIKE '" + where_dict[where_item] + "' and  "
        else:
            wheresql = wheresql + where_item + " = " + str(where_dict[where_item]) + " and "

    sql = "DELETE FROM rcc_ztcbka WHERE " + wheresql[0:-5]
    AfaLoggerFunc.tradeInfo(sql)
    return AfaDBFunc.DeleteSqlCmt( sql )
Exemplo n.º 4
0
def DeleteCustInfo( ):
    AfaLoggerFunc.tradeInfo(">>>注销客户信息(本地)")

    try:
        AfaLoggerFunc.tradeInfo(">>>把需要企业信息记录移到企业信息历史表中")

        sql = ""
        sql = "INSERT INTO ABDT_HIS_CUSTINFO SELECT * FROM ABDT_CUSTINFO WHERE "
        sql = sql + "APPNO="       + "'" + TradeContext.Appno      + "'" + " AND "        #业务编码
        sql = sql + "BUSINO="      + "'" + TradeContext.PayeeUnitno+ "'" + " AND "        #单位编码
        sql = sql + "PROTOCOLNO="  + "'" + TradeContext.Protocolno + "'"                  #协议编码

        AfaLoggerFunc.tradeInfo( sql )

        result = AfaDBFunc.InsertSqlCmt( sql )
        if( result <= 0 ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '注销企业协议信息失败(移动)')

        AfaLoggerFunc.tradeInfo(">>>总共移动[" + str(result) + "]条记录")

        AfaLoggerFunc.tradeInfo(">>>删除在企业信息表中被注销企业信息记录")
        
        sql = ""
        sql = "DELETE FROM ABDT_CUSTINFO WHERE "
        sql = sql + "APPNO="       + "'" + TradeContext.Appno      + "'" + " AND "        #业务编码
        sql = sql + "BUSINO="      + "'" + TradeContext.PayeeUnitno+ "'" + " AND "        #单位编码
        sql = sql + "PROTOCOLNO="  + "'" + TradeContext.Protocolno + "'"                  #协议编码

        AfaLoggerFunc.tradeInfo( sql )

        result = AfaDBFunc.DeleteSqlCmt( sql )
        if( result <= 0 ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '注销企业协议信息失败(删除)')

        AfaLoggerFunc.tradeInfo(">>>总共删除[" + str(result) + "]条记录")

        #TradeContext.tradeResponse.append(['O1USERNAME',     TradeContext.USERNAME])       #用户名称
        #TradeContext.tradeResponse.append(['O1IDTYPE',       TradeContext.IDTYPE])         #证件类型
        #TradeContext.tradeResponse.append(['O1IDCODE',       TradeContext.IDCODE])         #证件号码

        return True

    except Exception, e:
        AfaLoggerFunc.tradeFatal( str(e) )
        return ExitSubTrade( '9999', '注销企业协议信息异常')
Exemplo n.º 5
0
def Delete():
    try:
        if( TradeContext.existVariable( "PAYEEBANKNO" ) and len(TradeContext.PAYEEBANKNO)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[清算国库支付系统行号]:不能为空')
        if( TradeContext.existVariable( "PAYBKCODE" ) and len(TradeContext.PAYBKCODE)<=0):
            return AfaFlowControl.ExitThisFlow( 'A0027', '[国库关联行行号]:不能为空')
            
        sql="SELECT PAYEEBANKNO,TRECODE,TRENAME,PAYEEACCT,PAYEEACCTNAME,PAYBKCODE,PAYBKNAME,LIQUIDATEMODE,STATUS,BRNO,TELLERNO,NOTE1,NOTE2,NOTE3,NOTE4,NOTE5 "
        sql=sql+" FROM TIPS_LIQUIDATE_ADM WHERE 1=1 "
        sql=sql+"AND PAYEEBANKNO='"+ TradeContext.PAYEEBANKNO+"'"
        sql=sql+"AND PAYBKCODE='"+ TradeContext.PAYBKCODE+"'"
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.SelectSql(sql)
        if( records == None ):
            AfaLoggerFunc.tradeFatal(sql)
            return AfaFlowControl.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
        elif( len(records) == 0 ):
            return AfaFlowControl.ExitThisFlow( 'A0027', '不存在此清算信息' )

        sql="DELETE "
        sql=sql+" FROM TIPS_LIQUIDATE_ADM WHERE 1=1 "
        sql=sql+"AND PAYEEBANKNO='"+ TradeContext.PAYEEBANKNO+"'"
        sql=sql+"AND PAYBKCODE='"+ TradeContext.PAYBKCODE+"'"
        AfaLoggerFunc.tradeInfo(sql)
        records = AfaDBFunc.DeleteSqlCmt(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))
Exemplo n.º 6
0
def main( ):
    AfaLoggerFunc.tradeInfo( '凭证入库['+TradeContext.TemplateCode+']进入' )

    #=============前台上送数据===================================
    #TradeContext.sBesbNo                                 机构号
    #TradeContext.sCur                                    货币代码
    #TradeContext.sTellerNo                               柜员号
    #TradeContext.sVouhType                               凭证种类
    #TradeContext.sVouhName                               凭证名称
    #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( )

        #=============置凭证操作状态及库箱标志====================
        TradeContext.sDepository  = '1' #库箱标志   1.分行管理库 2.支行管理库 3.网点管理库 4.柜员凭证箱
        TradeContext.sExDepos     = ' ' #原库箱标志
        TradeContext.sVouhStatus  = '0' #状态       0.已入未发 
        TradeContext.sExStatus    = ' ' #原状态
        TradeContext.sRivTeller   = '   '     #对方柜员
        TradeContext.sTransType    = '凭证入库'
        
        #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   
            
        #判断是否回滚
        n=0
        
        for i in range(TradeContext.sNum):

            #=============定义变量==========================
            sFlagBack   = '0'     #入库凭证终止号码与库中凭证的起始号码是否存在连续关系,'1':是;'0':否
            sFlagFront  = '0'     #入库凭证起始号码与库中凭证的终止号码是否存在连续关系,'1':是;'0':否

            n=n+1
        
            #============= 判断入库的起始号码是否小于等于终止号码============================
            if(int(TradeContext.sStartNo[i]) > int(TradeContext.sEndNo[i]) ):
                tradeExit('A005066', '入库起始号码不能大于终止号码!')
                raise AfaFlowControl.flowException( )
            
            #凭证优化更改201108
            #============= 查询分行凭证库中的凭证号段============================
            #sqlStr = "select STARTNO,ENDNO,VOUHSTATUS from VOUH_REGISTER WHERE VOUHTYPE = '"\
            #+ TradeContext.sVouhType[i] + "' and BESBNO = '" + TradeContext.sBesbNo + "' and CUR = '" + TradeContext.sCur+"'"
            sqlStr = "select STARTNO,ENDNO ,VOUHSTATUS from VOUH_REGISTER where VOUHTYPE ='" + TradeContext.sVouhType[i] + "'" 
            sqlStr = sqlStr + " and VOUHSTATUS != '1' and BESBNO = '" + TradeContext.sBesbNo + "' and CUR = '" + TradeContext.sCur+"'"
            #end
             
            AfaLoggerFunc.tradeDebug(sqlStr)
            records = AfaDBFunc.SelectSql( sqlStr )
            AfaLoggerFunc.tradeInfo(records)
            
            if( records == None ):
                tradeExit('A005061', '查询[凭证登记表]操作异常!')
                raise AfaFlowControl.flowException( )
            elif( len( records ) == 0 ):    #如果数据库中无对应记录则直接插入
                sqlStr = "insert into VOUH_REGISTER \
                (BESBNO,TELLERNO,DEPOSITORY,CUR,VOUHTYPE,STARTNO,ENDNO,RIVTELLER,VOUHSTATUS,\
                VOUHNUM,LSTTRXDAY,LSTTRXTIME) \
                values \
                ('"+TradeContext.sBesbNo+"','"+TradeContext.sTellerTailNo+"',\
                '"+TradeContext.sDepository+"','"+TradeContext.sCur+"','"+TradeContext.sVouhType[i]+"',\
                '"+TradeContext.sStartNo[i]+"','"+TradeContext.sEndNo[i]+"','"+TradeContext.sRivTeller+"',\
                '"+TradeContext.sVouhStatus+"','"+TradeContext.sVouhNum[i]+"',\
                '"+TradeContext.sLstTrxDay+"','"+TradeContext.sLstTrxTime+"')"
                AfaLoggerFunc.tradeDebug(sqlStr)
                records = AfaDBFunc.InsertSql( sqlStr )
                if records == -1 :
                    AfaLoggerFunc.tradeInfo( '数据库回滚' )
                    AfaDBFunc.RollbackSql( )
                    tradeExit('A005062', '凭证入库失败,凭证数据库操作失败!')
                    raise AfaFlowControl.flowException( )
                else:
                    tradeExit('0000', '凭证入库成功')       
            else :
                #判断入库的凭证起止号码与已入库的凭证号码是否有交集,其中records[x][0]
                #为已入库的终止号码;records[x][1]为已入库的起始号码,判断为有交集的情况为:
                #1.入库的终止号码大于等于已入库的起始号码,并且小于等于已入库的终止号码;
                #2.入库的起始号码大于等于已入库的起始号码,并且小于等于已入库的终止号码;
                #3.入库的终止号码大于等于已入库的终止号码,并且入库的起始号码小于等于已入库的起始号码
                for x in range( len(records) ):
                    sTmpStartNo  = records[x][0]
                    sTmpEndNo    = records[x][1]
                    sTmpVouhStat = records[x][2]
                    if ((int(TradeContext.sEndNo[i])<=int(sTmpEndNo) and int(TradeContext.sEndNo[i])>=int(sTmpStartNo)) \
                    or (int(TradeContext.sStartNo[i])>=int(sTmpStartNo) and int(TradeContext.sStartNo[i])<=int(sTmpEndNo)) \
                    or ( int(TradeContext.sEndNo[i])>=int(sTmpEndNo) and int(TradeContext.sStartNo[i])<=int(sTmpStartNo))):
                        if( n > 1 ):
                            AfaLoggerFunc.tradeInfo( '数据库回滚' )
                            AfaDBFunc.RollbackSql( )
                        tradeExit('A005063', '凭证入库失败,凭证库中存在本次入库的凭证!')
                        raise AfaFlowControl.flowException( )
                    elif ((int(TradeContext.sEndNo[i]) == (int(sTmpStartNo)-1)) and sTmpVouhStat == '0'):
                        sFlagBack = '1'          #无交集且后连续,置后连续标识
                        sOperDelNo = records[x][0]
                        sOperEndNo = records[x][1]
                    elif ((int(TradeContext.sStartNo[i]) == (int(sTmpEndNo)+1)) and sTmpVouhStat == '0'):
                        sFlagFront = '1'         #无交集且前连续,置前连续标识
                        sOperStartNo = records[x][0]
                #输入的凭证号码与库中同类型凭证存在后连续关系,则与相应的记录进行归并
                if (  sFlagBack == '1' and sFlagFront == '0'):
                    sTmpVouhNum = str( int(sTmpEndNo) - int(TradeContext.sStartNo[i]) + 1 )
                    sqlStr = "update VOUH_REGISTER set \
                    STARTNO = '" + TradeContext.sStartNo[i] + "', \
                    VOUHNUM = '"+ sTmpVouhNum + "',\
                    TELLERNO = '" + TradeContext.sTellerTailNo + "',\
                    LSTTRXDAY = '"+ TradeContext.sLstTrxDay + "',\
                    LSTTRXTIME = '" + TradeContext.sLstTrxTime + "'\
                    where ENDNO = '" + sOperEndNo + "' AND VOUHSTATUS = '"+TradeContext.sVouhStatus+"' \
                    AND VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' AND BESBNO = '" + TradeContext.sBesbNo+ "' \
                    AND CUR = '" + TradeContext.sCur+"'"
                    
                    AfaLoggerFunc.tradeDebug(sqlStr)
                    records = AfaDBFunc.UpdateSql( sqlStr )
                    if records == -1 :
                        AfaLoggerFunc.tradeInfo( '数据库回滚' )
                        #回滚
                        AfaDBFunc.RollbackSql( )
                        tradeExit('A005064', '凭证入库失败,凭证数据库操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif records == 0 :
                        AfaLoggerFunc.tradeInfo( '数据库回滚' )
                        #回滚
                        AfaDBFunc.RollbackSql( )
                        tradeExit('A005062', '凭证入库失败,凭证数据库操作失败!')
                        raise AfaFlowControl.flowException( )
                    else:
                        tradeExit('0000', '凭证入库成功')
            
                #输入的凭证号码与库中同类型凭证存在前连续关系,则与相应的记录进行归并
                elif (  sFlagFront == '1' and sFlagBack == '0' ):
                    sTmpVouhNum = str( int(TradeContext.sEndNo[i]) - int(sOperStartNo) + 1 )
                    sqlStr = "update VOUH_REGISTER set \
                    ENDNO = '" + TradeContext.sEndNo[i] + "', \
                    VOUHNUM = '" + sTmpVouhNum + "',\
                    TELLERNO = '" + TradeContext.sTellerTailNo+ "',\
                    LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\
                    LSTTRXTIME = '" + TradeContext.sLstTrxTime + "'\
                    where STARTNO = '" + sOperStartNo + "' AND VOUHSTATUS = '"+TradeContext.sVouhStatus+"' \
                    AND VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' AND BESBNO = '" + TradeContext.sBesbNo + "' \
                    AND CUR ='"+ TradeContext.sCur+"'"
                    AfaLoggerFunc.tradeDebug(sqlStr)
                    records = AfaDBFunc.UpdateSql( sqlStr )
                    if records == -1 :
                        AfaLoggerFunc.tradeInfo( '数据库回滚' )
                        #回滚
                        AfaDBFunc.RollbackSql( )
                        tradeExit('A005064', '凭证入库失败,凭证数据库操作异常!')
                        raise AfaFlowControl.flowException( )
                    elif records == 0 :
                        AfaLoggerFunc.tradeInfo( '数据库回滚' )
                        #回滚
                        AfaDBFunc.RollbackSql( )
                        tradeExit('A005062', '凭证入库失败,凭证数据库操作失败!')
                        raise AfaFlowControl.flowException( )
                    else:
                        tradeExit('0000', '凭证入库成功')
            
                #输入的凭证号码与库中同类型凭证存在前/后连续关系,则与相应的记录进行归并
                elif (  sFlagBack == '1' and sFlagFront == '1' ):
                    sTmpVouhNum = str( int(sOperEndNo) - int(sOperStartNo) + 1 )
                    sqlStr = "update VOUH_REGISTER set \
                    ENDNO = '" + sOperEndNo + "', VOUHNUM = '" + sTmpVouhNum + "',\
                    TELLERNO = '" + TradeContext.sTellerTailNo + "',\
                    LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\
                    LSTTRXTIME = '" + TradeContext.sLstTrxTime + "'\
                    where STARTNO = '" + sOperStartNo + "' AND VOUHSTATUS = '"+TradeContext.sVouhStatus+"' \
                    AND VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' AND BESBNO = '" + TradeContext.sBesbNo + "' \
                    AND CUR = '"+ TradeContext.sCur+"'"
                    AfaLoggerFunc.tradeDebug(sqlStr)
                    records = AfaDBFunc.UpdateSql( sqlStr )
                    if records == -1 or records == 0 :
                        AfaLoggerFunc.tradeInfo( '数据库回滚' )
                        #回滚
                        AfaDBFunc.RollbackSql( )
                        tradeExit('A005062', '凭证入库失败,凭证数据库操作失败!')
                        raise AfaFlowControl.flowException( )
                    else:      #归并成功后,删除归并后其余一条
                        sqlDel = "delete from VOUH_REGISTER \
                        where STARTNO = '" + sOperDelNo + "' AND VOUHSTATUS = '"+TradeContext.sVouhStatus+"' \
                        AND VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' AND BESBNO ='"+ TradeContext.sBesbNo+"' \
                        AND CUR = '"+ TradeContext.sCur+"'"
                        AfaLoggerFunc.tradeDebug(sqlDel)
                        record = AfaDBFunc.DeleteSql( sqlDel )
                        if record == -1 or record == 0 :
                            AfaLoggerFunc.tradeInfo( '数据库回滚' )
                            record = AfaDBFunc.RollbackSql( )
                            tradeExit('A005062', '凭证入库失败,凭证数据库操作失败!')
                            raise AfaFlowControl.flowException( )
                        else:
                            tradeExit('0000', '凭证入库成功')
            
                #输入的凭证号码与库中同类型凭证不存在任何连续关系,则直接插入
                else:
                    sqlStr = "insert into VOUH_REGISTER \
                    (BESBNO,TELLERNO,DEPOSITORY,CUR,VOUHTYPE,STARTNO,ENDNO,RIVTELLER,VOUHSTATUS,\
                    VOUHNUM,LSTTRXDAY,LSTTRXTIME) \
                    values \
                    ('" + TradeContext.sBesbNo + "','" + TradeContext.sTellerTailNo + "',\
                    '"+TradeContext.sDepository+ "','" + TradeContext.sCur+"','"+ TradeContext.sVouhType[i]+"',\
                    '" + TradeContext.sStartNo[i] + "','" + TradeContext.sEndNo[i] + "','" + TradeContext.sRivTeller +"',\
                    '"+TradeContext.sVouhStatus+"','" + TradeContext.sVouhNum[i] + "',\
                    '" + TradeContext.sLstTrxDay + "','" + TradeContext.sLstTrxTime + "')"
                    AfaLoggerFunc.tradeDebug(sqlStr)
                    records = AfaDBFunc.InsertSql( sqlStr )
                    if records == -1 :
                        AfaLoggerFunc.tradeInfo( '数据库回滚' )
                        AfaDBFunc.RollbackSql( )
                        tradeExit('A005062', '凭证入库失败,凭证数据库操作失败!')
                        raise AfaFlowControl.flowException( )
                    else:
                        tradeExit('0000', '凭证入库成功')
    

        AfaLoggerFunc.tradeInfo( '------------更新凭证变更登记表' )
        #更新凭证变更登记表
        VouhFunc.VouhModify()
        
        #数据库提交
        AfaLoggerFunc.tradeInfo( '------------数据库提交' )
        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
        
            #冲正
            
            #=============置凭证操作状态及库箱标志====================
            TradeContext.sDepository  = '1' #库箱标志   1.分行管理库 2.支行管理库 3.网点管理库 4.柜员凭证箱
            TradeContext.sExDepos     = '1' #原库箱标志
            TradeContext.sVouhStatus  = '9' #状态       0.已入未发 9.欲出库
            TradeContext.sExStatus    = '0' #原状态
            TradeContext.sRivTeller   = '   '     #对方柜员
            TradeContext.sTransType    = '冲正'
            TradeContext.sInTellerTailNo  = TradeContext.sTellerTailNo
            TradeContext.sInBesbNo    = TradeContext.sBesbNo

            #交易公共部分    
            VouhFunc.VouhTrans()
            AfaDBFunc.CommitSql( )
            
            sqlDel = "delete from VOUH_REGISTER where VOUHSTATUS = '9'"
            AfaLoggerFunc.tradeDebug(sqlDel)
            record = AfaDBFunc.DeleteSqlCmt( sqlDel )
            if record == -1 or record == 0 :
                tradeExit('A005062', '冲正失败,凭证数据库操作失败!')
                raise AfaFlowControl.flowException( )
            else:
                AfaLoggerFunc.tradeInfo( '============================自动冲正!' )
                
            TradeContext.sTranStatus = '1'
            if(not TradeContext.existVariable( "HostSerno" )):
                TradeContext.HostSerno = ''    
            
            #更新流水表
            VouhFunc.ModifyVouhModify()
            
            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:
        AfaLoggerFunc.tradeInfo( '数据库回滚' )
        AfaDBFunc.RollbackSql( )
        AfaFlowControl.exitMainFlow( )
Exemplo n.º 7
0
import sys, AfaDBFunc,AfaLoggerFunc,AfaAdminFunc

from types import *

if __name__ == '__main__':
    
    AfaLoggerFunc.tradeInfo( '-------------------安徽省新农保数据清理操作开始-------------------' )
    
    if ( len(sys.argv) != 2 ):
        print ( '用法:python procName offsetDays' )
        sys.exit( -1 )
    offsetDays = sys.argv[1]
    DelDate = AfaAdminFunc.getTimeFromNow( int(offsetDays) )
    
    #删除指定日期前的临时数据
    sql = "delete from ahxnb_swap where workdate <= '" + DelDate + "'"
    
    AfaLoggerFunc.tradeInfo( '定时清理sql:' + sql )
    
    ret = AfaDBFunc.DeleteSqlCmt( sql )
    
    if ret < 0:
        AfaLoggerFunc.tradeInfo( '定时清理数据失败' )
        sys.exit( -1 )
    AfaLoggerFunc.tradeInfo( '总共清理【' + str(ret) + "】条记录" )
    
    AfaLoggerFunc.tradeInfo( '-------------------安徽省新农保数据清理操作结束-------------------' )
    
    sys.exit( 0 )
Exemplo n.º 8
0
def SubModuleMainFst( ):
    AfaLoggerFunc.tradeInfo('财税库行_批量请求交易_前处理[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
    try:
    
        #begin 20101130 蔡永贵增加 缓存收款国库名称,用于后面登记流水
        TradeContext.note10 = TradeContext.payeeName
        #end
        
        #begin  蔡永贵增加 缓存下列各值,避免后续操作把原值覆盖而取不到所需数据
        TradeContext.tmp_projectId     = TradeContext.projectId
        TradeContext.tmp_taxTypeName   = TradeContext.taxTypeName
        TradeContext.tmp_taxStartDate  = TradeContext.taxStartDate
        TradeContext.tmp_taxEndDate    = TradeContext.taxEndDate
        TradeContext.tmp_taxTypeAmt    = TradeContext.taxTypeAmt
        #end
        
        AfaLoggerFunc.tradeInfo('>>>日期:' + TradeContext.corpTime + "  " + TradeContext.workDate)
        #=============判断应用状态====================
        if not TipsFunc.ChkAppStatus( ) :
            return False
        #====获取清算信息=======
        if not TipsFunc.ChkLiquidStatus():
            return False

        #============变量值的有效性校验============
        AfaLoggerFunc.tradeInfo('>>>变量值的有效性校验')
        if( not TradeContext.existVariable( "taxOrgCode" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '[taxOrgCode]值不存在!' )
        if( not TradeContext.existVariable( "packNo" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '[packNo]值不存在!' )
        if( not TradeContext.existVariable( "entrustDate" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '[entrustDate]值不存在!' )
        if( not TradeContext.existVariable( "corpTime" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '[corpTime]值不存在!' )

        #检查批次是否过期
        AfaLoggerFunc.tradeInfo('>>>检查批次是否过期')
        AfaLoggerFunc.tradeInfo('>>>日期:' + TradeContext.corpTime + "  " + TradeContext.workDate)
        if (TradeContext.corpTime!=TradeContext.workDate ):
            TradeContext.tradeResponse.append(['errorCode','24020'])
            TradeContext.tradeResponse.append(['errorMsg','已过期,作废'])
            AfaLoggerFunc.tradeInfo('已过期,批次作废。报文工作日期:'+TradeContext.corpTime+'系统工作日期:'+TradeContext.workDate)
            return True
        #查询是否重复批次
        AfaLoggerFunc.tradeInfo('>>>查询是否重复批次')
        sqlStr = "SELECT Dealstatus,errorcode,errormsg FROM TIPS_BATCHADM WHERE "
        sqlStr =sqlStr +" WorkDate  = '" + TradeContext.corpTime + "'"
        sqlStr =sqlStr +"and Batchno   = '" + TradeContext.packNo      + "'"
        sqlStr =sqlStr +"and TAXORGCODE= '" + TradeContext.taxOrgCode  + "'"

        Records = AfaDBFunc.SelectSql( sqlStr )
        AfaLoggerFunc.tradeInfo(sqlStr)
        if( Records == None ):
            AfaLoggerFunc.tradeFatal('批量管理表操作异常:'+AfaDBFunc.sqlErrMsg)
            return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量管理表操作异常' )
        elif(len(Records)>0):
            AfaLoggerFunc.tradeInfo('批次已存在。批次状态:'+Records[0][0]+'处理状态:'+Records[0][1])
            if (Records[0][0]=='0'): #重复包,且批次已成功
                AfaLoggerFunc.tradeInfo('>>>重复包,且批次已完成记账处理')
                TradeContext.tradeResponse.append(['dealFlag','0'])
                TradeContext.tradeResponse.append(['errorCode','0000'])
                TradeContext.tradeResponse.append(['errorMsg','交易成功'])
                return True
            elif (Records[0][0]=='1'): #重复包,且批次已失败
                AfaLoggerFunc.tradeInfo('>>>重复包,且批次已完成记账处理')
                TradeContext.tradeResponse.append(['errorCode',Records[0][1]])
                TradeContext.tradeResponse.append(['errorMsg',Records[0][2]])
                return True
            #elif  ( Records[0][0]=='9'): #尚未处理
            #    None
            #    #认为是新的批次,重新接收
            #    #else:
            #    #    if int(TradeContext.pageSerno.strip())!=int(Records[0][2].strip())+1:
            #    #        #页序号错误
            #    #        TradeContext.tradeResponse.append(['errorCode','A0002'])
            #    #        TradeContext.tradeResponse.append(['errorMsg','页序号错误'])
            #    #        return True
            else:
                AfaLoggerFunc.tradeInfo('>>>重复包,且批次已提交处理,拒绝本次请求')
                TradeContext.tradeResponse.append(['errorCode','94052'])
                TradeContext.tradeResponse.append(['errorMsg','包重复'])
                return True
        if int(TradeContext.pageSerno.strip())==1:
            AfaLoggerFunc.tradeInfo('>>>尚未处理的重复批次,按新批次处理,删掉旧数据')
            #尚未处理的重复批次,按新批次处理,删掉旧数据
            sqlStr_d_t = "DELETE FROM  TIPS_BATCHDATA WHERE "
            sqlStr_d_t =sqlStr_d_t +" WORKDATE = '"         + TradeContext.corpTime + "'"
            sqlStr_d_t =sqlStr_d_t +"and BATCHNO = '"       + TradeContext.packNo      + "'"
            sqlStr_d_t =sqlStr_d_t +"and TAXORGCODE = '"    + TradeContext.taxOrgCode  + "'"
            AfaLoggerFunc.tradeInfo(sqlStr_d_t )
            if( AfaDBFunc.DeleteSqlCmt( sqlStr_d_t ) <0 ):
                return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量明细表操作异常' )
            sqlStr_d_b = "DELETE FROM TIPS_BATCHADM WHERE "
            sqlStr_d_b =sqlStr_d_b +" workDate  = '" + TradeContext.corpTime + "'"
            sqlStr_d_b =sqlStr_d_b +"and Batchno   = '" + TradeContext.packNo      + "'"
            sqlStr_d_b =sqlStr_d_b +"and TAXORGCODE = '"    + TradeContext.taxOrgCode  + "'"
            AfaLoggerFunc.tradeInfo(sqlStr_d_b )
            if( AfaDBFunc.DeleteSqlCmt( sqlStr_d_b ) <0 ):
                return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量管理表操作异常' )

        #新的批次或页,批量明细入库
        AfaLoggerFunc.tradeInfo('>>>新的批次或页,批量明细入库')
        recNum=int(TradeContext.pageNum)
        AfaLoggerFunc.tradeInfo(str(recNum))
        
        #beging  蔡永贵增加
        localtion = 0                   #偏移量
        #end
        
        for i in range( 0, recNum ):
            TradeContext.agentSerialno = ''
            #=============获取平台流水号====================
            if TipsFunc.GetSerialno( ) == -1 :
                AfaLoggerFunc.tradeInfo('>>>处理结果:获取平台流水号异常' )
                return TipsFunc.ExitThisFlow( 'A0027', '获取流水号失败' )

            AfaLoggerFunc.tradeInfo('>>>获取平台流水号结束')
            sql="insert into TIPS_BATCHDATA(WORKDATE,BATCHNO,TAXORGCODE,CORPSERIALNO,SERIALNO,ACCNO,TAXPAYCODE,AMOUNT,"
            sql=sql+"STATUS,ERRORCODE,ERRORMSG,NOTE1,NOTE2,NOTE3,NOTE4,NOTE5,NOTE6,NOTE7,NOTE8,NOTE9,NOTE10)"
            sql=sql+" values"

            #初始化变量
            sStatus    = '9'                              #处理状态
            sErrorCode = '99090'                          #错误码
            sErrorMsg  = '尚未处理'                       #错误信息
            TradeContext.teller         = TIPS_TELLERNO_AUTO #自动柜员
            TradeContext.catrFlag       = '1'             #现金转账标志
            TradeContext.__agentEigen__ = '0'             #从表标志
            TradeContext.revTranF       = '0'
            TradeContext.tradeType      = '8'             #交易类型
            TradeContext.errorCode      = '0000'

            if recNum==1:
                TradeContext.corpSerno  = TradeContext.tNo        #第三方流水号
                TradeContext.accno      = TradeContext.acc        #付款帐号
                TradeContext.protocolNo = TradeContext.ptlN       #协议书号
                TradeContext.taxVouNo   = TradeContext.vNo
                TradeContext.taxPayName = TradeContext.tPN
                TradeContext.amount     = TradeContext.amt
                TradeContext.brno       = TradeContext.opBk       #付款开户行

                #====检查是否签约户=======
                TipsFunc.ChkCustSign()
                AfaLoggerFunc.tradeInfo(TradeContext.errorCode)
                if(TradeContext.errorCode == '24009'):
                    sStatus    = '1'             #处理状态
                    sErrorCode = '24009'         #错误码
                    sErrorMsg  = '账户未签约'      #错误信息
                else:

                    AfaLoggerFunc.tradeInfo(TradeContext.BDt)
                    billData = (TradeContext.BDt).split('|')
                    
                    #begin 20100902 蔡永贵注释掉改部分,变量的拼接直接交给afe完成
                    #TradeContext.taxTypeNum = billData[9]
                    TradeContext.taxTypeNum = TradeContext.TaxTypeNum
                    #
                    #TradeContext.projectId     = []
                    #TradeContext.taxTypeName   = []
                    #TradeContext.taxStartDate  = []
                    #TradeContext.taxEndDate    = []
                    #TradeContext.taxTypeAmt    = []
                    #j = 1
                    #AfaLoggerFunc.tradeInfo('数据长度:' + str(len(billData[9:])))
                    #while(j < len(billData[9:])):
                    #    TradeContext.projectId.append(billData[j+9])
                    #    TradeContext.taxTypeName.append(billData[j+10])
                    #    TradeContext.taxStartDate.append(billData[j+11])
                    #    TradeContext.taxEndDate.append(billData[j+12])
                    #    TradeContext.taxTypeAmt.append(billData[j+13])
                    #    j = j + 5
                    #    i = i + 1
                    #end
                    
                sql=sql+"('"+TradeContext.corpTime          +"'"
                sql=sql+",'"+TradeContext.packNo            +"'"
                sql=sql+",'"+TradeContext.taxOrgCode        +"'"
                sql=sql+",'"+TradeContext.tNo               +"'"
                sql=sql+",'"+TradeContext.agentSerialno     +"'"
                sql=sql+",'"+TradeContext.acc               +"'"
                sql=sql+",'"+TradeContext.vNo               +"'"
                sql=sql+",'"+TradeContext.amt               +"'"
                sql=sql+",'"+sStatus                        +"'"
                sql=sql+",'"+sErrorCode                     +"'"
                sql=sql+",'"+sErrorMsg                      +"'"
                sql=sql+",'"+TradeContext.taxOrgCode        +"'"
                sql=sql+",'"+TradeContext.payeeBankNo       +"'"
                sql=sql+",'"+TradeContext.payeeOrgCode      +"'"
                sql=sql+",'"+TradeContext.payeeAcct         +"'"
                sql=sql+",'"+TradeContext.payeeName         +"'"
                sql=sql+",'"+TradeContext.payBkCode         +"'"
                sql=sql+",'"+TradeContext.opBk              +"'"
                sql=sql+",'"+TradeContext.ptlN              +"'"
                sql=sql+",'"+TradeContext.hON               +"'"
                sql=sql+",'"+TradeContext.tPN               +"'"
                #sql=sql+",'"+TradeContext.bDt               +"'"




            else:
                TradeContext.corpSerno  = TradeContext.tNo[i]        #第三方流水号
                TradeContext.accno      = TradeContext.acc[i]        #付款帐号
                TradeContext.protocolNo = TradeContext.ptlN[i]       #协议书号
                TradeContext.taxVouNo   = TradeContext.vNo[i]
                TradeContext.taxPayName = TradeContext.tPN[i]
                TradeContext.amount     = TradeContext.amt[i]
                TradeContext.brno       = TradeContext.opBk[i]       #付款开户行

                #====检查是否签约户=======
                TipsFunc.ChkCustSign()
                AfaLoggerFunc.tradeInfo(TradeContext.errorCode)
                if(TradeContext.errorCode == '24009'):
                    sStatus    = '1'             #处理状态
                    sErrorCode = '24009'         #错误码
                    sErrorMsg  = '账户未签约'    #错误信息
                    
                    #begin 蔡永贵增加
                    localtion = localtion + int(TradeContext.TaxTypeNum[i])
                    #end
                else:
                    billData = (TradeContext.BDt[i]).split('|')
                    
                    #begin 20100902 蔡永贵注释掉改部分,变量的拼接直接交给afe完成
                    #TradeContext.taxTypeNum = billData[9]
                    TradeContext.taxTypeNum = TradeContext.TaxTypeNum[i]
                    #
                    #TradeContext.projectId     = []
                    #TradeContext.taxTypeName   = []
                    #TradeContext.taxStartDate  = []
                    #TradeContext.taxEndDate    = []
                    #TradeContext.taxTypeAmt    = []
                    #
                    #j = 1
                    #while(j < len(billData[9:])):
                    #    TradeContext.projectId.append(billData[j+9])
                    #    TradeContext.taxTypeName.append(billData[j+10])
                    #    TradeContext.taxStartDate.append(billData[j+11])
                    #    TradeContext.taxEndDate.append(billData[j+12])
                    #    TradeContext.taxTypeAmt.append(billData[j+13])
                    #    j=j+ 5
                    #end
                    
                    #begin  蔡永贵增加
                    TradeContext.projectId     = TradeContext.tmp_projectId[localtion:localtion+int(TradeContext.taxTypeNum)]
                    TradeContext.taxTypeName   = TradeContext.tmp_taxTypeName[localtion:localtion+int(TradeContext.taxTypeNum)]
                    TradeContext.taxStartDate  = TradeContext.tmp_taxStartDate[localtion:localtion+int(TradeContext.taxTypeNum)]
                    TradeContext.taxEndDate    = TradeContext.tmp_taxEndDate[localtion:localtion+int(TradeContext.taxTypeNum)]
                    TradeContext.taxTypeAmt    = TradeContext.tmp_taxTypeAmt[localtion:localtion+int(TradeContext.taxTypeNum)]
                    #AfaLoggerFunc.tradeInfo( "当前偏移:" + str(localtion) )
                    #AfaLoggerFunc.tradeInfo( "当前税种条数:" + TradeContext.taxTypeNum )
                    #AfaLoggerFunc.tradeInfo( TradeContext.projectId)
                    #AfaLoggerFunc.tradeInfo( TradeContext.tmp_projectId )
                    
                    localtion = localtion + int(TradeContext.taxTypeNum)
                    #end


                sql=sql+"('"+TradeContext.corpTime       +"'"
                sql=sql+",'"+TradeContext.packNo            +"'"
                sql=sql+",'"+TradeContext.taxOrgCode        +"'"
                #AfaLoggerFunc.tradeInfo( TradeContext.tNo )
                sql=sql+",'"+TradeContext.tNo[i]            +"'"
                sql=sql+",'"+TradeContext.agentSerialno     +"'"
                sql=sql+",'"+TradeContext.acc[i]            +"'"
                sql=sql+",'"+TradeContext.vNo[i]            +"'"
                sql=sql+",'"+TradeContext.amt[i]            +"'"
                sql=sql+",'"+sStatus                        +"'"
                sql=sql+",'"+sErrorCode                     +"'"
                sql=sql+",'"+sErrorMsg                      +"'"
                sql=sql+",'"+TradeContext.taxOrgCode        +"'"
                sql=sql+",'"+TradeContext.payeeBankNo       +"'"
                sql=sql+",'"+TradeContext.payeeOrgCode      +"'"
                sql=sql+",'"+TradeContext.payeeAcct         +"'"
                sql=sql+",'"+TradeContext.payeeName         +"'"
                sql=sql+",'"+TradeContext.payBkCode         +"'"
                sql=sql+",'"+TradeContext.opBk[i]           +"'"
                sql=sql+",'"+TradeContext.ptlN[i]           +"'"
                sql=sql+",'"+TradeContext.hON[i]            +"'"
                sql=sql+",'"+TradeContext.tPN[i]            +"'"
                #sql=sql+",'"+TradeContext.bDt[i]            +"'"
            sql=sql+")"
            AfaLoggerFunc.tradeInfo(sql)
            if( AfaDBFunc.InsertSqlCmt(sql) == -1 ):
                AfaLoggerFunc.tradeFatal(sql)
                return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            AfaLoggerFunc.tradeInfo('写入一条批量明细')

            AfaLoggerFunc.tradeInfo('errorCode = ' + TradeContext.errorCode)

            #guanbj 20091110 账户未签约则不登记主流水表
            if TradeContext.errorCode == '0000':
                #====查询收款帐号=======  20090917 wqs
                if not TipsFunc.SelectAcc():
                    return TipsFunc.ExitThisFlow( 'A0027', '查询收款账号失败' )

                #=============插入流水表====================
                if not TipsFunc.InsertDtl( ):
                    return TipsFunc.ExitThisFlow( 'A0027', '插入流水表失败' )

        if TradeContext.nextFlag=='0':

            #批量管理表写入
            sqlStr1 = "insert into TIPS_BATCHADM(WORKDATE,WORKTIME,BATCHNO,TAXORGCODE,DEALSTATUS,ERRORCODE,ERRORMSG,PAYEEBANKNO,PAYEEACCT,PAYEENAME"
            sqlStr1 = sqlStr1 + ",PAYBKCODE,RETURNTERM,TOTALNUM,TOTALAMT,SUCCNUM,SUCCAMT,"

            #===张恒 增加NOTE4字段 存放批量请求报文中的委托日期字段 START 20100412===
            sqlStr1 = sqlStr1 + "NOTE1,NOTE3,"
            sqlStr1 = sqlStr1 + "NOTE4)"
            #===张恒 增加NOTE4字段 存放批量请求报文中的委托日期字段 END  ===

            sqlStr1 = sqlStr1 + " values"
            sqlStr1 = sqlStr1 + "('"+TradeContext.corpTime          +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.workTime          +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.packNo            +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.taxOrgCode        +"'"
            sqlStr1 = sqlStr1 + ",'"+'9'                            +"'"
            sqlStr1 = sqlStr1 + ",'"+'99090'                        +"'"
            sqlStr1 = sqlStr1 + ",'"+'尚未处理'                     +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.payeeBankNo       +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.payeeAcct         +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.payeeName         +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.payBkCode         +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.returnTerm        +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.allNum            +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.allAmt            +"'"
            sqlStr1 = sqlStr1 + ",'"+'0'                            +"'"
            sqlStr1 = sqlStr1 + ",'"+'0.00'                            +"'"
            sqlStr1 = sqlStr1 + ",'"+TradeContext.pageSerno       +"'"  #页序号(AFE与AFA传递数据包大小有限制,将包拆分,多次传递)
            sqlStr1 = sqlStr1 + ",'"+TradeContext.MsgRef          +"'"  #报文参考号

            #===张恒 增加NOTE4字段 存放批量请求报文中的委托日期字段  START ===
            sqlStr1 = sqlStr1 + ",'"+TradeContext.entrustDate     +"'"  #委托日期
            #===张恒 增加NOTE4字段 存放批量请求报文中的委托日期字段 END  ===

            sqlStr1 = sqlStr1 + ")"
            AfaLoggerFunc.tradeInfo(sqlStr1)
            if( AfaDBFunc.InsertSqlCmt(sqlStr1) == -1 ):
                AfaLoggerFunc.tradeFatal(sqlStr1)
                return TipsFunc.ExitThisFlow( 'A0027', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            #批次数据检查
            AfaLoggerFunc.tradeInfo('>>>批次数据检查')
            sqlStr_dt = "select count(*),sum(cast(amount as decimal(17,2))) FROM  TIPS_BATCHDATA WHERE "
            sqlStr_dt =sqlStr_dt +" workDate = '" + TradeContext.corpTime + "'"
            sqlStr_dt =sqlStr_dt +"and Batchno = '" + TradeContext.packNo      + "'"
            sqlStr_dt =sqlStr_dt +"and TAXORGCODE = '" + TradeContext.taxOrgCode  + "'"
            AfaLoggerFunc.tradeInfo(sqlStr_dt )
            records_dt = AfaDBFunc.SelectSql( sqlStr_dt )
            if records_dt == None :
                return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量管理表操作异常')
            if long(TradeContext.allNum)!=long(records_dt[0][0]):
                AfaLoggerFunc.tradeInfo('明细和汇总校验不符;实际明细汇总笔数:'+str(records_dt[0][0])+'  总比数:'+TradeContext.allNum)
                return TipsFunc.ExitThisFlow( '24020', '明细和汇总校验不符' )
            if float(TradeContext.allAmt)!=float(records_dt[0][1]):
                AfaLoggerFunc.tradeInfo('明细和汇总校验不符;实际明细汇总金额:'+str(records_dt[0][1])+'  总金额:'+TradeContext.allAmt)
                return TipsFunc.ExitThisFlow( '24020', '明细和汇总校验不符' )
        TradeContext.tradeResponse.append(['dealFlag','1'])
        TradeContext.tradeResponse.append(['errorCode','0000'])
        TradeContext.tradeResponse.append(['errorMsg','交易成功'])

        AfaLoggerFunc.tradeInfo('财税库行_批量请求交易_前处理结束[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
        return True
    except Exception, e:
        TipsFunc.exitMainFlow(str(e))
Exemplo n.º 9
0
def SubModuleDealSnd():

    AfaLoggerFunc.tradeInfo( "********************开始冲正******************" )

    #首先将缴款书信息置为无效,再将上传补录数据置为无效,删除掉勾兑表中的关系

    sqlstr =   "select * from FS_FC76 where AFC001='" + TradeContext.userNo + "'"

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

    records = AfaDBFunc.SelectSql( sqlstr )
    
    if( records and len( records)>0 ):
        sqlstr  =   ""
        #begin 20100716 蔡永贵修改 由原来的更新改为删除
        #sqlstr  =   "update fs_fc76 set flag='1' where afc001='" + TradeContext.userNo + "'"
        sqlstr = " delete from fs_fc76 where afc001='" + TradeContext.userNo + "'"

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

        #if( AfaDBFunc.UpdateSqlCmt( sqlstr ) < 1 ):
        if( AfaDBFunc.DeleteSqlCmt( sqlstr ) < 1 ):
        #end
            TradeContext.errorCode, TradeContext.errorMsg='0001', '将缴款书信息置为无效失败,冲正失败'
            AfaLoggerFunc.tradeInfo( TradeContext.errorMsg + AfaDBFunc.sqlErrMsg )
            return False

    #首先查找是否有补录数据,有则将数据置为无效,没有则不要操作
    AfaLoggerFunc.tradeInfo("将补录数据置为无效")

    sqlstr =   "select * from FS_FC84 where AFC001='" + TradeContext.userNo + "'"

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

    records = AfaDBFunc.SelectSql( sqlstr )
    if( records and len( records)>0 ):
        sqlstr  =   ""
        sqlstr  =   "update fs_fc84 set flag='1' where afc001='" + TradeContext.userNo + "'"

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

        if( AfaDBFunc.UpdateSqlCmt( sqlstr ) < 1 ):
            TradeContext.errorCode, TradeContext.errorMsg='0002', '将上传补录数据置为无效失败,冲正失败'
            AfaLoggerFunc.tradeInfo( TradeContext.errorMsg  )
            AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg )
            return False

    AfaLoggerFunc.tradeInfo("将勾兑数据置为无效")
    sqlstr =   "select * from FS_FC74 where AFC001='" + TradeContext.userNo + " ' "

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

    records = AfaDBFunc.SelectSql( sqlstr )
    if( records and len( records)>0 ):
        sqlstr  =   ""
        sqlstr  =   "update fs_fc74 set flag='*' where afc001='" + TradeContext.userNo + "'"

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

        if( AfaDBFunc.UpdateSqlCmt( sqlstr ) < 1 ):
            TradeContext.errorCode, TradeContext.errorMsg='0002', '删除勾兑关系失败,冲正失败'
            AfaLoggerFunc.tradeInfo( TradeContext.errorMsg + AfaDBFunc.sqlErrMsg )
            return False

    return True
Exemplo n.º 10
0
def SubModuleMainFst( ):
    AfaLoggerFunc.tradeInfo('财税库行_TIPS发起明细对账_前处理[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
    try:
        #============变量值的有效性校验============
        if( not TradeContext.existVariable( "chkAcctOrd" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '[chkAcctOrd]值不存在!' )
        if( not TradeContext.existVariable( "chkDate" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '[chkDate]值不存在!' )
        
        #====判断应用状态=======
        if not TipsFunc.ChkAppStatus():
            return False
                   
        #查询是否重复批次
        AfaLoggerFunc.tradeInfo( '>>>查询是否重复批次' )
        sqlStr = "SELECT DEALSTATUS,WORKDATE,BATCHNO,PAYBKCODE,PAYEEBANKNO,ERRORCODE,ERRORMSG,NOTE2 FROM TIPS_CHECKADM WHERE "
        sqlStr =sqlStr +"  WORKDATE  = '"       + TradeContext.chkDate.strip()         + "'"
        sqlStr =sqlStr +"and BATCHNO   = '"     + TradeContext.chkAcctOrd.strip()      + "'"
        sqlStr =sqlStr +"and PAYEEBANKNO   = '" + TradeContext.payeeBankNo.strip()      + "'"
        sqlStr =sqlStr +"and PAYBKCODE   = '"   + TradeContext.payBkCode.strip()      + "'"
        sqlStr =sqlStr +"and NOTE3   = '"   + TradeContext.CurPackNo.strip()      + "'"
        
        Records = AfaDBFunc.SelectSql( sqlStr )
        AfaLoggerFunc.tradeInfo(sqlStr)
        if( Records == None ):
            AfaLoggerFunc.tradeFatal('批量管理表操作异常:'+AfaDBFunc.sqlErrMsg)
            return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量管理表操作异常' )
        elif(len(Records)>0):
            if Records[0][0]=='2': #重复包,且正在处理
                AfaLoggerFunc.tradeInfo( '>>>重复包,且正在处理,直接返回94052' )
                TradeContext.tradeResponse.append(['errorCode','94052'])
                TradeContext.tradeResponse.append(['errorMsg','包重复'])
                return True
            elif Records[0][0]=='0' : #已处理完成,成功或者失败,直接回执
                #发起扣税回执交易
                AfaLoggerFunc.tradeInfo( '>>>已处理完成,成功或者失败,直接回执2111' )
                TradeContext.OriChkDate    =Records[0][1]
                TradeContext.OriChkAcctOrd =Records[0][2]
                TradeContext.OriPayBankNo  =Records[0][3]
                TradeContext.OriPayeeBankNo=Records[0][4]
                TradeContext.Result        =Records[0][5]
                TradeContext.AddWord       =Records[0][6]
                subModuleName = 'TTPS001_032111'       
                subModuleHandle=__import__( subModuleName )
                AfaLoggerFunc.tradeInfo( '执行['+subModuleName+']模块' )
                if not subModuleHandle.SubModuleMainFst( ) :
                    return TipsFunc.flowException( )
                TradeContext.tradeResponse.append(['errorCode','94052'])
                TradeContext.tradeResponse.append(['errorMsg','批次已处理完成'])
                return True
            else: #重复包,重新对账
                AfaLoggerFunc.tradeInfo( '>>>重复包,重新对账' )
                if int(TradeContext.pageSerno.strip())==1:
                    #尚未处理的重复批次,按新批次处理,删掉旧数据
                    sqlStr_d_t = "DELETE FROM  TIPS_CHECKDATA WHERE "
                    sqlStr_d_t = sqlStr_d_t +"  workDate  = '"      + TradeContext.chkDate              + "'"
                    sqlStr_d_t = sqlStr_d_t +" and Batchno   = '"   + TradeContext.chkAcctOrd           + "'"
                    sqlStr_d_t = sqlStr_d_t +" AND PAYEEBANKNO ='"  + TradeContext.payeeBankNo.strip()    + "'"   
                    sqlStr_d_t = sqlStr_d_t +" AND PAYBKCODE   ='"  + TradeContext.payBkCode.strip()  + "'"
                    sqlStr_d_t = sqlStr_d_t +" AND NOTE3   = '"     + TradeContext.CurPackNo.strip()  + "'"
                    AfaLoggerFunc.tradeInfo(sqlStr_d_t )
                    if( AfaDBFunc.DeleteSqlCmt( sqlStr_d_t ) <0 ):
                        return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量管理表操作异常' )
                    sqlStr_d_b = "DELETE FROM  TIPS_CHECKADM WHERE "
                    sqlStr_d_b =sqlStr_d_b +" WORKDATE  = '"        + TradeContext.chkDate.strip()     + "'"
                    sqlStr_d_b =sqlStr_d_b +"and BATCHNO   = '"     + TradeContext.chkAcctOrd.strip()  + "'"
                    sqlStr_d_b =sqlStr_d_b +"and PAYEEBANKNO   = '" + TradeContext.payeeBankNo.strip() + "'"
                    sqlStr_d_b =sqlStr_d_b +"and PAYBKCODE     = '" + TradeContext.payBkCode.strip()   + "'"
                    sqlStr_d_b =sqlStr_d_b +"and NOTE3     = '"     + TradeContext.CurPackNo.strip()   + "'"
                    AfaLoggerFunc.tradeInfo(sqlStr_d_b )
                    if( AfaDBFunc.DeleteSqlCmt( sqlStr_d_b ) <0 ):
                        return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量管理表操作异常' )
                else:
                    if int(TradeContext.pageSerno.strip())!=int(Records[0][7].strip())+1:
                        #页序号错误
                        TradeContext.tradeResponse.append(['errorCode','A0002'])
                        TradeContext.tradeResponse.append(['errorMsg','页序号错误'])
                        return True
            
        #新的批次,对账明细入库
        AfaLoggerFunc.tradeInfo( '>>>新的批次,对账明细入库' )
        recNum=int(TradeContext.pageNum)
        AfaLoggerFunc.tradeInfo(str(recNum))
        for i in range( 0, recNum ):
            sql="insert into TIPS_CHECKDATA(WORKDATE,BATCHNO,CORPSERIALNO,PAYEEBANKNO,PAYBKCODE,TAXVOUNO,ACCNO,AMOUNT,"
            sql=sql+"STATUS,NOTE3)"
            sql=sql+" values"
            if recNum==1:
                sql=sql+"('"+TradeContext.chkDate           +"'"
                sql=sql+",'"+TradeContext.chkAcctOrd            +"'"
                sql=sql+",'"+TradeContext.cNo            +"'"
                sql=sql+",'"+TradeContext.payeeBankNo       +"'"
                sql=sql+",'"+TradeContext.payBkCode         +"'"
                sql=sql+",'"+TradeContext.vNo          +"'"
                sql=sql+",'"+TradeContext.acc           +"'"
                sql=sql+",'"+TradeContext.amt            +"'"
                sql=sql+",'"+'9'                            +"'"
                sql=sql+",'"+TradeContext.CurPackNo         +"'"
            else:
                sql=sql+"('"+TradeContext.chkDate       +"'"
                sql=sql+",'"+TradeContext.chkAcctOrd            +"'"
                sql=sql+",'"+TradeContext.cNo[i]            +"'"
                sql=sql+",'"+TradeContext.payeeBankNo       +"'"
                sql=sql+",'"+TradeContext.payBkCode         +"'"
                sql=sql+",'"+TradeContext.vNo[i]          +"'"
                sql=sql+",'"+TradeContext.acc[i]           +"'"
                sql=sql+",'"+TradeContext.amt[i]            +"'"
                sql=sql+",'"+'9'                            +"'"
                sql=sql+",'"+TradeContext.CurPackNo         +"'"
            sql=sql+")"
            AfaLoggerFunc.tradeInfo(sql)
            if( AfaDBFunc.InsertSqlCmt(sql) == -1 ):
                AfaLoggerFunc.tradeFatal(sql)
                TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
                raise TipsFunc.flowException( ) 
        #批量管理表写入    
        if (len(Records)>0 and Records[0][0]>0  and int(TradeContext.pageSerno.strip())!=1):
            #批量管理表更新
            sqlStr1 = "UPDATE TIPS_CHECKADM SET NOTE2=char(bigint(NOTE2)+1) WHERE "
            sqlStr1 =sqlStr1 +" WORKDATE  = '"      + TradeContext.chkDate.strip()         + "'"
            sqlStr1 =sqlStr1 +"and BATCHNO   = '"   + TradeContext.chkAcctOrd.strip()      + "'"
            sqlStr1 =sqlStr1 +"and PAYEEBANKNO = '" + TradeContext.payeeBankNo.strip()     + "'"
            sqlStr1 =sqlStr1 +"and PAYBKCODE   = '" + TradeContext.payBkCode.strip()       + "'"
            sqlStr1 =sqlStr1 +"and NOTE3   = '" + TradeContext.CurPackNo.strip()       + "'"
            AfaLoggerFunc.tradeInfo(sqlStr1 )
            records1=AfaDBFunc.UpdateSqlCmt( sqlStr1 )
            if( records1 <0 ):
                return TipsFunc.ExitThisFlow( 'A0027', '数据库错,批量管理表操作异常' )
        else:    
            sqlStr1="insert into TIPS_CHECKADM(WORKDATE,WORKTIME,BATCHNO,PAYEEBANKNO,PAYBKCODE,CHKACCTTYPE,DEALSTATUS,TOTALNUM,TOTALAMT,SUCCNUM,SUCCAMT,"
            sqlStr1=sqlStr1+"NOTE1,NOTE2,NOTE3)"
            sqlStr1=sqlStr1+" values"
            sqlStr1=sqlStr1+"('"+TradeContext.chkDate           +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.workTime          +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.chkAcctOrd        +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.payeeBankNo       +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.payBkCode         +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.chkAcctType       +"'"
            sqlStr1=sqlStr1+",'"+'9'                            +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.allNum            +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.allAmt            +"'"
            sqlStr1=sqlStr1+",'0'"
            sqlStr1=sqlStr1+",'0'"
            sqlStr1=sqlStr1+",'"+TradeContext.priorChkAcctOrd   +"'"
            sqlStr1=sqlStr1+",'"+TradeContext.pageSerno         +"'"  #页序号(AFE与AFA传递数据包大小有限制,将包拆分,多次传递)
            sqlStr1=sqlStr1+",'"+TradeContext.CurPackNo         +"'"  #包序号(TIPS传递数据包大小有限制,将包拆分,多次传递)
            sqlStr1=sqlStr1+")"
            AfaLoggerFunc.tradeInfo(sqlStr1)
            if( AfaDBFunc.InsertSqlCmt(sqlStr1) == -1 ):
                AfaLoggerFunc.tradeFatal(sqlStr1)
                return TipsFunc.ExitThisFlow( 'A0027', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            
        TradeContext.tradeResponse.append(['errorCode','0000'])
        TradeContext.tradeResponse.append(['errorMsg','交易成功'])
        
        #20100113  关彬捷  增加  判断CHECKDATA登记簿中记录条数与报文中交易数是否相等,若相等则允许进行下一步对账操作
        sqlstr = "select count(*) from TIPS_CHECKDATA where "
        sqlstr = sqlstr + ""
        sqlstr = sqlstr +" WORKDATE  = '"        + TradeContext.chkDate.strip()     + "'"
        sqlstr = sqlstr +"and BATCHNO   = '"     + TradeContext.chkAcctOrd.strip()  + "'"
        sqlstr = sqlstr +"and PAYEEBANKNO   = '" + TradeContext.payeeBankNo.strip() + "'"
        sqlstr = sqlstr +"and PAYBKCODE     = '" + TradeContext.payBkCode.strip()   + "'"
        AfaLoggerFunc.tradeInfo(sqlstr)
        records = AfaDBFunc.SelectSql(sqlstr)
        if records == None:
            AfaLoggerFunc.tradeFatal(sqlstr)
            return TipsFunc.ExitThisFlow( 'A0027','数据库操作异常:' + AfaDBFunc.sqlErrMsg)
        else:
            AfaLoggerFunc.tradeInfo(">>>allNum=[" + TradeContext.allNum + "],COUNT=[" + str(records[0][0]) + "]")
            #如果TIPS_CHECKDATA记录条数与allNum相符,则允许进入下一对账流程
            if (int(TradeContext.allNum) == records[0][0]):
                TradeContext.tradeResponse.append(['nextStep','1'])  #对账流程标识:1-允许进入下一流程;2-禁止进入下一流程
                AfaLoggerFunc.tradeDebug(">>>所有包数据登记结束,进入下一对账流程")
            else:
                TradeContext.tradeResponse.append(['nextStep','2'])  #对账流程标识:1-允许进入下一流程;2-禁止进入下一流程
                AfaLoggerFunc.tradeDebug(">>>包数据未登记结束,不进入下一对账流程")
        #20100113  关彬捷  修改结束

        AfaLoggerFunc.tradeInfo('财税库行_TIPS发起明细对账_前处理结束[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
        return True
    except Exception, e:
        TipsFunc.exitMainFlow(str(e))
Exemplo n.º 11
0
def DeleteCustInfo( ):

    AfaLoggerFunc.tradeInfo(">>>注销客户信息(本地)")

    try:

        AfaLoggerFunc.tradeInfo(">>>修改注销日期和时间")

        sql = "UPDATE ABDT_CUSTINFO SET NOTE3='" + TradeContext.TranDate+TradeContext.TranTime + "'"

        sql = sql + " WHERE "

        sql = sql + "APPNO="      + "'" + TradeContext.I1APPNO      + "'" + " AND "        #业务编码
        sql = sql + "BUSINO="     + "'" + TradeContext.I1BUSINO     + "'" + " AND "        #单位编码
        sql = sql + "PROTOCOLNO=" + "'" + TradeContext.I1PROTOCOLNO + "'"                  #协议编码

        AfaLoggerFunc.tradeInfo( sql )

        result = AfaDBFunc.UpdateSqlCmt( sql )
        if( result <= 0 ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '修改注销日期和时间失败')
        
        AfaLoggerFunc.tradeInfo(">>>把需要个人信息记录移到个人信息历史表中")

        sql = ""
        sql = "INSERT INTO ABDT_HIS_CUSTINFO SELECT * FROM ABDT_CUSTINFO WHERE "
        sql = sql + "APPNO="       + "'" + TradeContext.I1APPNO      + "'" + " AND "        #业务编码
        sql = sql + "BUSINO="      + "'" + TradeContext.I1BUSINO     + "'" + " AND "        #单位编码
        sql = sql + "PROTOCOLNO="  + "'" + TradeContext.I1PROTOCOLNO + "'"                  #协议编码

        AfaLoggerFunc.tradeInfo( sql )

        result = AfaDBFunc.InsertSqlCmt( sql )
        if( result <= 0 ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '注销个人协议信息失败(移动)')

        AfaLoggerFunc.tradeInfo(">>>总共移动[" + str(result) + "]条记录")


        AfaLoggerFunc.tradeInfo(">>>删除在个人信息表中被注销个人信息记录")
        sql = ""
        sql = "DELETE FROM ABDT_CUSTINFO WHERE "
        sql = sql + "APPNO="      + "'" + TradeContext.I1APPNO      + "'" + " AND "        #业务编码
        sql = sql + "BUSINO="     + "'" + TradeContext.I1BUSINO     + "'" + " AND "        #单位编码
        sql = sql + "PROTOCOLNO=" + "'" + TradeContext.I1PROTOCOLNO + "'"                  #协议编码

        AfaLoggerFunc.tradeInfo( sql )

        result = AfaDBFunc.DeleteSqlCmt( sql )
        if( result <= 0 ):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '注销个人协议信息失败(删除)')


        AfaLoggerFunc.tradeInfo(">>>总共删除[" + str(result) + "]条记录")


        TradeContext.tradeResponse.append(['O1USERNAME',     TradeContext.USERNAME])       #用户名称
        TradeContext.tradeResponse.append(['O1IDTYPE',       TradeContext.IDTYPE])         #证件类型
        TradeContext.tradeResponse.append(['O1IDCODE',       TradeContext.IDCODE])         #证件号码

        return True


    except Exception, e:
        AfaLoggerFunc.tradeFatal( str(e) )
        return ExitSubTrade( '9999', '注销个人协议信息异常')
Exemplo n.º 12
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( )
Exemplo n.º 13
0
def TrxMain():


    AfaLoggerFunc.tradeInfo('**********维护单位信息(8403)开始**********')


    TradeContext.tradeResponse.append(['O1AFAPDATE', TradeContext.TranDate])    #工作日期
    TradeContext.tradeResponse.append(['O1AFAPTIME', TradeContext.TranTime])    #工作时间


    #判断单位是否发生业务
    sql = "SELECT BATCHNO FROM ABDT_BATCHINFO WHERE "
    sql = sql + "APPNO="  + "'" + TradeContext.I1APPNO   + "'" + " AND "                   #业务编码
    sql = sql + "BUSINO=" + "'" + TradeContext.I1BUSINO  + "'" + " AND "                   #单位编码
    sql = sql + "ZONENO=" + "'" + TradeContext.I1ZONENO  + "'" + " AND "                   #地区代码
    sql = sql + "BRNO="   + "'" + TradeContext.I1SBNO    + "'" + " AND "                   #机构代码
    sql = sql + "STATUS NOT IN ('40','88','**')"                                           #状态(撤销)


    AfaLoggerFunc.tradeInfo( sql )


    records = AfaDBFunc.SelectSql( sql )
    if ( records==None ):
        AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
        return ExitSubTrade( '9000', '判断单位是否发生业务异常' )

    if ( len(records) > 0 ):
        return ExitSubTrade( '9000', '该单位已经发生业务,不能任何操作')


    #对单位信息进行维护操作
    if (TradeContext.I1PROCTYPE == '0'):
        #修改
        if ( TradeContext.I1OLDACCNO != TradeContext.I1ACCNO ):
            return ExitSubTrade( '9000', '新账号不能与原来账号相同')
                
        else:

            sql = "UPDATE ABDT_UNITINFO SET "
#           sql = sql + "APPNO='"         + TradeContext.I1APPNO         + "',"                    #业务编号
#           sql = sql + "BUSINO='"        + TradeContext.I1BUSINO        + "',"                    #单位编号
            sql = sql + "AGENTTYPE='"     + TradeContext.I1AGENTTYPE     + "',"                    #委托方式
            sql = sql + "AGENTMODE='"     + TradeContext.I1AGENTMODE     + "',"                    #代理范围
            sql = sql + "VOUHTYPE='"      + TradeContext.I1VOUHTYPE      + "',"                    #凭证类型
            sql = sql + "VOUHNO='"        + TradeContext.I1VOUHNO        + "',"                    #凭证号码
            sql = sql + "ACCNO='"         + TradeContext.I1ACCNO         + "',"                    #银行账户(对公帐户)
            sql = sql + "SUBACCNO='"      + TradeContext.I1SUBACCNO      + "',"                    #子帐户代码
            sql = sql + "SIGNUPMODE='"    + TradeContext.I1SIGNUPMODE    + "',"                    #签约方式
            sql = sql + "GETUSERNOMODE='" + TradeContext.I1GETUSERNOMODE + "',"                    #单位客户编号获取方式
            sql = sql + "PROTNO='"        + TradeContext.I1PROTNO        + "',"                    #协议号
#           sql = sql + "APPNAME='"       + TradeContext.I1APPNAME       + "',"                    #业务名称
            sql = sql + "BUSINAME='"      + TradeContext.I1BUSINAME      + "',"                    #单位名称
            sql = sql + "ADDRESS='"       + TradeContext.I1ADDRESS       + "',"                    #联系地址
            sql = sql + "TEL='"           + TradeContext.I1TEL           + "',"                    #联系电话
            sql = sql + "USERNAME='******',"                    #联系人员
#           sql = sql + "WORKDATE='"      + TradeContext.I1WORKDATE      + "',"                    #工作日期
#           sql = sql + "BATCHNO='"       + TradeContext.I1BATCHNO       + "',"                    #批次号
            sql = sql + "STARTDATE='"     + TradeContext.I1STARTDATE     + "',"                    #生效日期
            sql = sql + "ENDDATE='"       + TradeContext.I1ENDDATE       + "',"                    #失效日期
            sql = sql + "STARTTIME='"     + TradeContext.I1STARTTIME     + "',"                    #服务开始时间
            sql = sql + "ENDTIME='"       + TradeContext.I1ENDTIME       + "',"                    #服务终止时间
#           sql = sql + "ZONENO='"        + TradeContext.I1ZONENO        + "',"                    #地区代码
#           sql = sql + "BRNO='"          + TradeContext.I1BRNO          + "',"                    #机构代码
#           sql = sql + "TELLERNO='"      + TradeContext.I1TELLERNO      + "',"                    #柜员代码
#           sql = sql + "REGDATE='"       + TradeContext.I1REGDATE       + "',"                    #注册日期
#           sql = sql + "REGTIME='"       + TradeContext.I1REGTIME       + "',"                    #注册时间
#           sql = sql + "STATUS='"        + TradeContext.I1STATUS        + "',"                    #状态
#           sql = sql + "CHKDATE='"       + TradeContext.I1CHKDATE       + "',"                    #对账日期
#           sql = sql + "CHKTIME='"       + TradeContext.I1CHKTIME       + "',"                    #对账时间
#           sql = sql + "CHKFLAG='"       + TradeContext.I1CHKFLAG       + "',"                    #对账标志
            sql = sql + "NOTE1='"         + TradeContext.I1USID          + "',"                    #备注1(修改柜员号)
            sql = sql + "NOTE2='"         + TradeContext.TranDate+TradeContext.TranTime + "',"     #备注2(修改日期时间)
            sql = sql + "NOTE3='"         + TradeContext.I1NOTE3         + "',"                    #备注3
            sql = sql + "NOTE4='"         + TradeContext.I1NOTE4         + "',"                    #备注4
            sql = sql + "NOTE5='"         + TradeContext.I1NOTE5         + "'"                     #备注5

            sql = sql + " WHERE "

            sql = sql + "APPNO="  + "'" + TradeContext.I1APPNO   + "'" + " AND "                   #业务编码
            sql = sql + "BUSINO=" + "'" + TradeContext.I1BUSINO  + "'" + " AND "                   #单位编码
            sql = sql + "ZONENO=" + "'" + TradeContext.I1ZONENO  + "'" + " AND "                   #地区代码
            sql = sql + "BRNO="   + "'" + TradeContext.I1SBNO    + "'"                             #机构代码
#           sql = sql + "STATUS='1'"                                                               #状态(0-注销 1-正常)

            AfaLoggerFunc.tradeInfo( sql )

            result = AfaDBFunc.UpdateSqlCmt( sql )
                
            if( result <= 0 ):
                AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                return ExitSubTrade( '9000', '修改单位信息失败')
    else:
        #注销

        AfaLoggerFunc.tradeInfo(">>>把需要单位信息记录移到单位信息历史表中")

        sql = ""
        sql = "INSERT INTO ABDT_HIS_UNITINFO SELECT * FROM ABDT_UNITINFO WHERE "
        sql = sql + "APPNO="    + "'" + TradeContext.I1APPNO   + "'" + " AND "        #业务编码
        sql = sql + "BUSINO="   + "'" + TradeContext.I1BUSINO  + "'" + " AND "        #单位编码
        sql = sql + "ZONENO="   + "'" + TradeContext.I1ZONENO  + "'" + " AND "        #地区代码
        sql = sql + "BRNO="     + "'" + TradeContext.I1SBNO    + "'"                  #机构代码
#       sql = sql + "STATUS='1'"                                                      #状态(0-注销 1-正常)

        AfaLoggerFunc.tradeInfo( sql )

        result = AfaDBFunc.InsertSqlCmt( sql )
        if (result <= 0):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '注销单位信息失败')


        AfaLoggerFunc.tradeInfo(">>>删除在单位信息表中被注销单位信息记录")

        sql = ""
        sql = "DELETE FROM ABDT_UNITINFO WHERE "
        sql = sql + "APPNO="    + "'" + TradeContext.I1APPNO   + "'" + " AND "        #业务编码
        sql = sql + "BUSINO="   + "'" + TradeContext.I1BUSINO  + "'" + " AND "        #单位编码
        sql = sql + "ZONENO="   + "'" + TradeContext.I1ZONENO  + "'" + " AND "        #地区代码
        sql = sql + "BRNO="     + "'" + TradeContext.I1SBNO    + "'"                  #机构代码
#       sql = sql + "STATUS='1'"                                                      #状态(0-注销 1-正常)

        AfaLoggerFunc.tradeInfo( sql )

        result = AfaDBFunc.DeleteSqlCmt( sql )
        if (result <= 0):
            AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
            return ExitSubTrade( '9000', '注销客户信息失败')


        AfaLoggerFunc.tradeInfo(">>>总共注销[" + str(result) + "]条记录")


    AfaLoggerFunc.tradeInfo('**********维护单位信息(8403)结束**********')


    #返回
    TradeContext.tradeResponse.append(['errorCode', '0000'])
    TradeContext.tradeResponse.append(['errorMsg',  '交易成功'])
    return True
Exemplo n.º 14
0
def DataToDB(file,ibegin):
    AfaLoggerFunc.tradeInfo( 'table:'+file )
    try :

        #首先建立表名和字段的映射,然后在下载的数据中都加入日期和时间字段
        #map =   {"AA11":"AAA010,AAA011,AAA012, AAA014,AAZ001,BUSINO,DATE,TIME",\
        #         "FA15":"AAA010,AFA050,AAZ006,AFA051,AFA052,AAZ007,AFA062,AAZ002,BUSINO,DATE,TIME",\
        #         "FA16":"AFA050,AFA030,AAZ006,AAZ007,BUSINO,DATE,TIME",\
        #         "FA13":"AFA030,AAZ006,AAZ007,AFA031,AFA032,AAZ002,AFA038,AFA039,AFA040,AFA041,AFA042,AFA020,BUSINO,DATE,TIME",\
        #         "FA20":"AAA010,AFA090,AFA091,AFA092,AFA096,BUSINO,DATE,TIME",\
        #         "FA21":"AFA090,AFA050,AFA030,AAZ006,AAZ007,BUSINO,DATE,TIME",\
        #         "DPZ_GL":"FPZDM,FQSHM,FQZHM,FDWDM,FCZQHNM,BUSINO,DATE,TIME",\
        #         "FA22":"AAA010,AFA106,AAZ006,AFA100,AFA101,AFA102,AFA103,BUSINO,DATE,TIME" }

        #begin 20100604 蔡永贵修改 除了FA22外,所有映射中在BUSINO前加上BANKNO字段
        
        map =   {"AA11":"AAA010,AAA011,AAA012, AAA014,AAZ001,BANKNO,BUSINO,DATE,TIME",\
                 "FA15":"AAA010,AFA050,AAZ006,AFA051,AFA052,AAZ007,AFA062,AAZ002,BANKNO,BUSINO,DATE,TIME",\
                 "FA16":"AFA050,AFA030,AAZ006,AAZ007,BANKNO,BUSINO,DATE,TIME",\
                 "FA13":"AFA030,AAZ006,AAZ007,AFA031,AFA032,AAZ002,AFA038,AFA039,AFA040,AFA041,AFA042,AFA020,BANKNO,BUSINO,DATE,TIME",\
                 "FA20":"AAA010,AFA090,AFA091,AFA092,AFA096,BANKNO,BUSINO,DATE,TIME",\
                 "FA21":"AFA090,AFA050,AFA030,AAZ006,AAZ007,BANKNO,BUSINO,DATE,TIME",\
                 "DPZ_GL":"FPZDM,FQSHM,FQZHM,FDWDM,FCZQHNM,BANKNO,BUSINO,DATE,TIME",\
                 "FA22":"AAA010,AFA106,AAZ006,AFA100,AFA101,AFA102,AFA103,BUSINO,DATE,TIME" }
        
        #将文件中的记录加入到数据库中
        #fileName    =   TradeContext.CROP_LDIR + "/" + file + '_' + TradeContext.busiNo + ".txt"


        if file == 'FA22':
            fileName = TradeContext.CROP_LDIR + "/" + TradeContext.bankbm+file+".txt"
        else:
            fileName = TradeContext.CROP_LDIR + "/" + file + ".txt"
        #end



        print '====' + fileName

        if ( os.path.exists(fileName) and os.path.isfile(fileName) ):
            fp      =   open(fileName,"rb")

            #将所有的数据读取到sALl中
            sAll    =   fp.read()
            fp.close()
            #rec是每一条记录
            AfaLoggerFunc.tradeInfo(ibegin)
            AfaLoggerFunc.tradeInfo(len(sAll.split(chr(12))))
            for i in range(ibegin,len(sAll.split(chr(12)))):
                AfaLoggerFunc.tradeInfo(i)
                AfaLoggerFunc.tradeInfo(sAll.split(chr(12))[i])
                rec = sAll.split(chr(12))[i]
                #print   rec + "\n"
                AfaLoggerFunc.tradeInfo(len(rec))
                if len(rec)>0:
                    if file=='AA11':
                        AfaLoggerFunc.tradeInfo('AA11')
                        AfaLoggerFunc.tradeInfo(rec.split(chr(31))[0])
                        sqlstr=''
                        sqlstr = "select count(*) from FS_AA11 where AAA010='" + rec.split(chr(31))[0] + "' and BUSINO='" + TradeContext.busiNo + "'"
                        sqlstr = sqlstr + " and bankno ='" + TradeContext.bankbm + "'"

                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            print '>>>查询数据库异常'
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常AA11')
                            return -1

                        if records[0][0]==1:

                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增
                            strStr_del = "DELETE FROM FS_AA11 where AAA010='" + rec.split(chr(31))[0] + "' and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = strStr_del + " and bankno ='" + TradeContext.bankbm + "'"

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1


                    elif file=='FA15':
                        sqlstr=''
                        sqlstr = "select count(*) from FS_FA15 where AFA050='" + rec.split(chr(31))[1] + "' and AAZ006='" + rec.split(chr(31))[2] + "' and BUSINO='" + TradeContext.busiNo + "'"
                        sqlstr = sqlstr + " and bankno ='" + TradeContext.bankbm + "'"

                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            print '>>>查询数据库异常'
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
                            return -1

                        if records[0][0]==1:

                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增
                            strStr_del = "DELETE FROM FS_FA15 where AFA050='" + rec.split(chr(31))[1] + "' and AAZ006='" + rec.split(chr(31))[2] + "' and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = strStr_del + " and bankno ='" + TradeContext.bankbm + "'"

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1

                    elif file=='FA16':
                        sqlstr=''
                        sqlstr = "select count(*) from FS_FA16 where AFA050='" + rec.split(chr(31))[0] + "' and AFA030='" + rec.split(chr(31))[1] + "'and AAZ006='" + rec.split(chr(31))[2] + "' and BUSINO='" + TradeContext.busiNo + "'"
                        sqlstr = sqlstr + " and bankno ='" + TradeContext.bankbm + "'"

                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
                            return -1

                        if records[0][0]==1:

                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增
                            strStr_del = "DELETE FROM FS_FA16 where AFA050='" + rec.split(chr(31))[0] + "' and AFA030='" + rec.split(chr(31))[1] + "'and AAZ006='" + rec.split(chr(31))[2] + "' and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = strStr_del + " and bankno ='" + TradeContext.bankbm + "'"

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1


                    elif file=='FA13':
                        sqlstr=''
                        sqlstr = "select count(*) from FS_FA13 where AFA030='" + rec.split(chr(31))[0] + "' and AAZ006='" + rec.split(chr(31))[1] + "' and BUSINO='" + TradeContext.busiNo + "'"
                        sqlstr = sqlstr + " and bankno ='" + TradeContext.bankbm + "'"

                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
                            return -1

                        if records[0][0]==1:
                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增
                            strStr_del = "DELETE FROM FS_FA13 where AFA030='" + rec.split(chr(31))[0] + "' and AAZ006='" + rec.split(chr(31))[1] + "' and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = strStr_del + " and bankno ='" + TradeContext.bankbm + "'"

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1

                    elif file=='FA20':
                        sqlstr=''
                        sqlstr = "select count(*) from FS_FA20 where AAA010='" + rec.split(chr(31))[0] + "' and AFA090='" + rec.split(chr(31))[1] + "' and BUSINO='" + TradeContext.busiNo + "'"
                        sqlstr = sqlstr + " and bankno ='" + TradeContext.bankbm + "'"

                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
                            return -1

                        if records[0][0]==1:

                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增
                            strStr_del = "DELETE FROM FS_FA20 where AAA010='" + rec.split(chr(31))[0] + "' and AFA090='" + rec.split(chr(31))[1] + "' and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = strStr_del + " and bankno ='" + TradeContext.bankbm + "'"

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1

                    elif file=='FA21':
                        sqlstr=''
                        #sqlstr = "select count(*) from FS_FA21 where AFA090='" + rec.split(chr(31))[0] + "' and AFA050='" + rec.split(chr(31))[1] + "'and AFA030='" + rec.split(chr(31))[2] + "'and AAZ006='" + rec.split(chr(31))[3] + "' and BUSINO='" + TradeContext.busiNo + "'"

                        sqlstr = "select count(*) from FS_FA21 where AFA090='" + rec.split(chr(31))[0] + "' and AFA050='" + rec.split(chr(31))[1] + "'and AFA030='" + rec.split(chr(31))[2] + "'and BUSINO='" + TradeContext.busiNo + "'"
                        sqlstr = sqlstr + " and bankno ='" + TradeContext.bankbm + "'"
                        
                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
                            return -1

                        if records[0][0]==1:

                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增
                            strStr_del = "DELETE FROM FS_FA21 where AFA090='" + rec.split(chr(31))[0] + "' and AFA050='" + rec.split(chr(31))[1] + "'and AFA030='" + rec.split(chr(31))[2] + "'and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = strStr_del + " and bankno ='" + TradeContext.bankbm + "'"

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1

                    elif file=='DPZ_GL':
                        sqlstr=''
                        sqlstr = "select count(*) from FS_DPZ_GL where FPZDM='" + rec.split(chr(31))[0] + "' and FQSHM='" + rec.split(chr(31))[1] + "'and FQZHM='" + rec.split(chr(31))[2] + "'and FDWDM='" + rec.split(chr(31))[3] + "'and FCZQHNM='" + rec.split(chr(31))[4].strip() + "' and BUSINO='" + TradeContext.busiNo + "'"
                        sqlstr = sqlstr + " and bankno ='" + TradeContext.bankbm + "'"

                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
                            return -1

                        if records[0][0]==1:

                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增
                            strStr_del = "DELETE FROM FS_DPZ_GL where FPZDM='" + rec.split(chr(31))[0] + "' and FQSHM='" + rec.split(chr(31))[1] + "'and FQZHM='" + rec.split(chr(31))[2] + "'and FDWDM='" + rec.split(chr(31))[3] + "'and FCZQHNM='" + rec.split(chr(31))[4].strip() + "' and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = strStr_del + " and bankno ='" + TradeContext.bankbm + "'"

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1

                    elif file=='FA22':
                        sqlstr = ''
                        sqlstr = "select count(*) from FS_FA22 where AAA010='" + rec.split(chr(31))[0] + "' and AAZ006='" + rec.split(chr(31))[2] + "'and AFA100='" + rec.split(chr(31))[3] + "' and BUSINO='" + TradeContext.busiNo + "'" + " and AFA101='" + rec.split(chr(31))[4] + "'"

                        AfaLoggerFunc.tradeInfo( sqlstr )

                        records = AfaDBFunc.SelectSql( sqlstr )
                        if (records==None or len(records) <= 0):
                            AfaLoggerFunc.tradeInfo('>>>查询数据库异常')
                            return -1

                        if records[0][0]==1:

                            AfaLoggerFunc.tradeInfo( '重复记录,更新处理' )

                            #如果记录存在,必须先删除,再新增

                            #begin 20100527 蔡永贵修改 增加AFA101(单位编码)作为sql的查询条件
                            #strStr_del = "DELETE FROM FS_FA22 where AAA010='" + rec.split(chr(31))[0] + "' and AAZ006='" + rec.split(chr(31))[2] + "'and AFA100='" + rec.split(chr(31))[3] + "' and BUSINO='" + TradeContext.busiNo + "'"
                            strStr_del = "DELETE FROM FS_FA22 where AAA010='" + rec.split(chr(31))[0] + "' and AAZ006='" + rec.split(chr(31))[2] + "'and AFA100='" + rec.split(chr(31))[3] + "' and BUSINO='" + TradeContext.busiNo + "'" + " and AFA101='" + rec.split(chr(31))[4] + "'"
                            #end

                            AfaLoggerFunc.tradeInfo( strStr_del )

                            result = AfaDBFunc.DeleteSqlCmt( strStr_del )
                            if result < 1 :
                                AfaLoggerFunc.tradeInfo('>>>删除数据失败:' + AfaDBFunc.sqlErrMsg)
                                return -1

                    sqlstr  =   ""
                    sqlstr  =   "insert into " + "FS_" + file + " (" + map[file] + " ) " + "  values ("

                    for item in rec.split(chr(31)):
                        sqlstr  =  sqlstr   +   "'"
                        sqlstr  =  sqlstr   +   item.strip() + "',"
                        
                    #begin 20100629 蔡永贵增加银行编码
                    if file != 'FA22':
                        sqlstr      =   sqlstr  + "'" + TradeContext.bankbm   + "',"
                    #end

                    sqlstr      =   sqlstr  + "'" + TradeContext.busiNo   + "',"
                    sqlstr      =   sqlstr  + "'" + TradeContext.WORKDATE + "',"
                    sqlstr      =   sqlstr  + "'" + TradeContext.WORKTIME + "')"

                    AfaLoggerFunc.tradeInfo( sqlstr )

                    ret = AfaDBFunc.InsertSqlCmt( sqlstr )
                    if(  ret< 1 ):
                        AfaLoggerFunc.tradeInfo( "插入记录异常:" + AfaDBFunc.sqlErrMsg )
                        continue

        else:
            AfaLoggerFunc.tradeInfo( "文件" + fileName + "不存在" )

        return 0



    except Exception, e:
        fp.close()
        AfaLoggerFunc.tradeInfo( e )
        return -1
Exemplo n.º 15
0
def SubModuleMainFst( ):

    AfaLoggerFunc.tradeInfo( '进入客户签约查询[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' )
    try:
        #=============获取当前系统时间====================
        TradeContext.workDate=UtilTools.GetSysDate( )
        TradeContext.workTime=UtilTools.GetSysTime( )

          #============校验公共节点的有效性==================
        # 完整性检查
        if( not TradeContext.existVariable( "channelCode" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '渠道代码[channelCode]值不存在!' )
        if( not TradeContext.existVariable( "zoneno" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '分行号[zoneno]值不存在!' )
        if( not TradeContext.existVariable( "brno" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '行所号[brno]值不存在!' )
        if( not TradeContext.existVariable( "opType" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '操作类型[opType]值不存在!' )
        if( not TradeContext.existVariable( "taxOrgCode" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '征收机关代码[taxOrgCode]值不存在!' )
        if( not TradeContext.existVariable( "taxPayCode" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '纳税人编码[taxPayCode]值不存在!' )
        if( not TradeContext.existVariable( "accno" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '付款账户[accno]值不存在!' )
        if( not TradeContext.existVariable( "protocolNo" ) ):
            return TipsFunc.ExitThisFlow( 'A0001', '协议书号[protocolNo]值不存在!' )

        if TradeContext.opType=='0':
            AfaLoggerFunc.tradeInfo('>>>查询')
            #=============判断状态====================
            sql="SELECT STATUS,TAXPAYCODE,PROTOCOLNO,PAYACCT,IDTYPE,IDCODE,TAXPAYNAME,"
            sql=sql+"TAXORGCODE,HANDORGNAME,STARTDATE,ENDDATE,ZONENO,BRNO,TELLERNO,WORKDATE,"
            sql=sql+"NOTE1,NOTE2,NOTE3,NOTE4,NOTE5"
            sql=sql+" FROM TIPS_CUSTINFO WHERE 1=1 "
            sql=sql+" and TAXORGCODE     ='"+TradeContext.taxOrgCode  +"'"
            
            if( len(TradeContext.taxPayCode) != 0 ):
            	AfaLoggerFunc.tradeInfo('>>>' + TradeContext.taxPayCode)
            	sql=sql+" AND TAXPAYCODE ='"+TradeContext.taxPayCode +"'"
            if( len(TradeContext.accno) != 0 ):
            	sql=sql+" and PAYACCT     ='"+TradeContext.accno  +"'"
            if( len(TradeContext.protocolNo) != 0 ):
            	sql=sql+" and PROTOCOLNO     ='"+TradeContext.protocolNo  +"'"
            
            AfaLoggerFunc.tradeInfo(sql)
            records = AfaDBFunc.SelectSql(sql)
            if( records == None ):
                AfaLoggerFunc.tradeFatal(sql)
                return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            elif( len( records )==0 ):
                return TipsFunc.ExitThisFlow( 'A0027', '该客户尚未签约' )
            elif( len( records )>1 ):
                return TipsFunc.ExitThisFlow( 'A0027', '存在多条签约记录' )
            else:
                AfaLoggerFunc.tradeFatal(sql)
                AfaLoggerFunc.tradeInfo(records[0][0])
                UtilTools.ListFilterNone( records )
                if (records[0][0]=='1'):
                    TradeContext.status='协议已验证,可正常使用'
                elif (records[0][0]=='2'):
                    TradeContext.status='银行端已签约,等待征收机关验证协议'
                elif (records[0][0]=='3'):
                    TradeContext.status='银行端已解约,等待征收机关撤销协议'
                else:
                    TradeContext.status='协议已撤消'
                TradeContext.taxPayCode =records[0][1]
                TradeContext.protocolNo =records[0][2]
                TradeContext.accno      =records[0][3]
                TradeContext.idType     =records[0][4]
                TradeContext.idCode     =records[0][5]
                TradeContext.taxPayName =records[0][6]
                TradeContext.taxOrgCode =records[0][7]
                TradeContext.handOrgName =records[0][8]
                TradeContext.workDate = records[0][14]
                TradeContext.note2      =records[0][16]
                
                TipsFunc.GetTaxOrg(TradeContext.taxOrgCode)
        elif TradeContext.opType=='1':
            AfaLoggerFunc.tradeInfo('>>>删除')
            #=============判断状态====================
            sql="SELECT STATUS,TAXPAYCODE,PROTOCOLNO,PAYACCT,IDTYPE,IDCODE,TAXPAYNAME,"
            sql=sql+"TAXORGCODE,HANDORGNAME,STARTDATE,ENDDATE,ZONENO,BRNO,TELLERNO,WORKDATE,"
            sql=sql+"NOTE1,NOTE2,NOTE3,NOTE4,NOTE5"
            sql=sql+" FROM TIPS_CUSTINFO WHERE TAXORGCODE  ='"+TradeContext.taxOrgCode +"'"
            
            if( len(TradeContext.taxPayCode) != 0 ):
            	AfaLoggerFunc.tradeInfo('>>>' + TradeContext.taxPayCode)
            	sql=sql+" AND TAXPAYCODE ='"+TradeContext.taxPayCode +"'"
            if( len(TradeContext.accno) != 0 ):
            	sql=sql+" and PAYACCT     ='"+TradeContext.accno  +"'"
            if( len(TradeContext.protocolNo) != 0 ):
            	sql=sql+" and PROTOCOLNO     ='"+TradeContext.protocolNo  +"'"

            AfaLoggerFunc.tradeInfo(sql)
            records = AfaDBFunc.SelectSql(sql)
            if( records == None or  records <0):
                AfaLoggerFunc.tradeFatal(sql)
                return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            elif( len( records )==0 ):
                #return TipsFunc.ExitThisFlow( 'A0027', '该客户三方协议尚未签约,无法撤消' )
                return TipsFunc.ExitThisFlow( 'A0027', '该客户三方协议尚未签约,无法删除' )
            elif( len( records )>1 ):
                return TipsFunc.ExitThisFlow( 'A0027', '存在多条验证记录' )
            else:
                AfaLoggerFunc.tradeFatal(sql)
                AfaLoggerFunc.tradeInfo(records[0][0])
                UtilTools.ListFilterNone( records )
                #if (records[0][0]=='0' or records[0][0]=='3'):
                #    return TipsFunc.ExitThisFlow( 'A0027', '三方协议状态为已撤消,不能重复撤消' )
                if (records[0][0]=='1'):
                    #return TipsFunc.ExitThisFlow( 'A0027', '三方协议状态为已验证,不能撤消' )
                    return TipsFunc.ExitThisFlow( 'A0027', '三方协议状态为已验证,不能删除,请做解约交易' )
            TradeContext.taxPayCode =records[0][1]
            TradeContext.protocolNo =records[0][2]
            TradeContext.accno      =records[0][3]
            TradeContext.idType     =records[0][4]
            TradeContext.idCode     =records[0][5]
            TradeContext.taxPayName =records[0][6]
            TradeContext.taxOrgCode =records[0][7]
            TradeContext.handOrgName =records[0][8]
            TradeContext.workDate = records[0][14]
            TradeContext.note2      =records[0][16]
            TipsFunc.GetTaxOrg(TradeContext.taxOrgCode)
            TradeContext.status = '删除成功'

            #sql="update TIPS_CUSTINFO set "
            #sql=sql+" STATUS     ='"+'3'                     +"'"
            #sql=sql+",ENDDATE      ='"+TradeContext.workDate   +"'"
            #sql=sql+",ZONENO     ='"+TradeContext.zoneno     +"'"
            #sql=sql+",BRNO       ='"+TradeContext.brno       +"'"
            #sql=sql+",TELLERNO   ='"+TradeContext.teller   +"'"
            #sql=sql+" WHERE TAXPAYCODE ='"  +TradeContext.taxPayCode   +"'"
            #sql=sql+" AND PAYACCT ='"       +TradeContext.accno        +"'"
            #sql=sql+" AND PROTOCOLNO  ='"   +TradeContext.protocolNo   +"'"
            #sql=sql+" AND TAXORGCODE  ='"   +TradeContext.taxOrgCode   +"'"
            #AfaLoggerFunc.tradeInfo(sql)
            #if( AfaDBFunc.UpdateSqlCmt(sql) == -1 ):
            #    AfaLoggerFunc.tradeFatal(sql)
            #    return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            sql="delete "
            sql="DELETE FROM TIPS_CUSTINFO WHERE TAXORGCODE  ='"+TradeContext.taxOrgCode +"'"
            
            if( len(TradeContext.taxPayCode) != 0 ):
            	AfaLoggerFunc.tradeInfo('>>>' + TradeContext.taxPayCode)
            	sql=sql+" AND TAXPAYCODE ='"+TradeContext.taxPayCode +"'"
            if( len(TradeContext.accno) != 0 ):
            	sql=sql+" and PAYACCT     ='"+TradeContext.accno  +"'"
            if( len(TradeContext.protocolNo) != 0 ):
            	sql=sql+" and PROTOCOLNO     ='"+TradeContext.protocolNo  +"'"

            AfaLoggerFunc.tradeInfo(sql)
            rec=AfaDBFunc.DeleteSqlCmt(sql)
            if rec<0:
                return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg )
            
        else:
            return TipsFunc.ExitThisFlow('0001', '未定义该操作类型')
            
        #=============自动打包==================== 
        TradeContext.errorCode='0000'
        TradeContext.errorMsg='交易成功'
        #=============程序退出====================
        AfaLoggerFunc.tradeInfo( '退出客户信息维护模板['+TradeContext.TemplateCode+']\n' )
        return True
    except TipsFunc.flowException, e:
        TipsFunc.exitMainFlow( )
Exemplo n.º 16
0
def insertXnbMac( ):

    sql = ""
    sql = sql + " select SBNO,NAME,IDENTITYNO,XZQHNAME,XZQHNO,ACCNO"
    sql = sql + " from AHXNB_MAC "
    sql = sql + " where SBNO = '" + TradeContext.SBNO  + "'" #社保编号
    
    #AfaLoggerFunc.tradeInfo( '批量开户校验sql:' + sql )
    result = AfaDBFunc.SelectSql( sql )
    
    if result == None:
        return ExitSubTrade('D0001', "校验批量开户失败,数据库异常")
    elif len(result) > 0:
        
        #胡友 20111116 start   先判断查询结果再处理
        #20110620 曾照泰 修改  如果该客户已经在ahxnb_mac表中登记直接返回True
        #return True
        #return ExitSubTrade('D0001', "该客户已经登记过,跳过此条记录")
        
        flag = ( len(result[0][5].strip()) == 0 )
        
        #账号为空,删除原记录,插入新纪录
        if( flag ):
            sql2 = ""
            sql2 = sql2 + "delete"
            sql2 = sql2 + " from ahxnb_mac"
            sql2 = sql2 + " where sbno = '" + TradeContext.SBNO + "'"
            
            #AfaLoggerFunc.tradeInfo( '删除系统占用社保编号sql2:' + sql2 )
            result2 = AfaDBFunc.DeleteSqlCmt( sql2 )
            
            if( result2 <= 0 ):
                #AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg )
                return ExitSubTrade( '9000', '删除系统占用社保编号失败')
            
        #账号不为空跳出
        else:
            return True
        #end
        
        
    sql = ""
    sql = sql + "insert into AHXNB_MAC("
    sql = sql + "SBNO,"
    sql = sql + "NAME,"
    sql = sql + "IDENTITYNO,"
    sql = sql + "XZQHNO,"
    sql = sql + "XZQHNAME,"
    sql = sql + "ACCNO,"
    sql = sql + "STATUS,"
    sql = sql + "WORKDATE,"
    sql = sql + "BRNO,"
    sql = sql + "NOTE1,"
    sql = sql + "NOTE2,"
    sql = sql + "NOTE3,"
    sql = sql + "NOTE4)"
    sql = sql + " values("
    sql = sql + "'" + TradeContext.SBNO       + "',"             #社保编号
    sql = sql + "'" + TradeContext.NAME       + "',"             #姓名
    sql = sql + "'" + TradeContext.IDENTITYNO + "',"             #身份证
    sql = sql + "'" + TradeContext.XZQHNO     + "',"             #行政区划代码
    sql = sql + "'" + TradeContext.XZQHNAME   + "',"             #行政区划名称
    sql = sql + "'',"                                            #银行账号
    sql = sql + "'1',"                                           #状态(0-已开户,1-未开户,2-已注销)
    sql = sql + "'',"                                            #开户日期
    sql = sql + "'',"                                            #开户机构
    sql = sql + "'',"                                            #备用1
    sql = sql + "'',"                                            #备用2
    sql = sql + "'',"                                            #备用3
    sql = sql + "'')"                                            #备用4
    
    #AfaLoggerFunc.tradeInfo( "批量开户登记:" + sql )
    
    ret = AfaDBFunc.InsertSqlCmt(sql)
    
    if ret < 0:
        
        return ExitSubTrade('D0001', "插入数据失败")
        
    return True
Exemplo n.º 17
0
 mbrifa_where_dict = {}
 mbrifa_where_dict['OPRTYPNO'] = "30"
 
 mbrifa_dict = rccpsDBTrcc_mbrifa.selectu(mbrifa_where_dict)
 
 if mbrifa_dict == None:
     AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg )
     rccpsCronFunc.cronExit("S999","查询当前中心日期异常")
     
 NCCWKDAT  = mbrifa_dict['NOTE1'][:8]                  #对账日期
 NCCWKDAT_LIST = mbrifa_dict['NOTE3'].split(',')       #需要对账的中心日期(包括本清算工作日和之前的非清算工作日)
 
 #==========删除记账明细簿数据=================================================
 AfaLoggerFunc.tradeInfo(">>>删除记账明细簿数据")
 delsql = "delete from rcc_tdzjmx"
 res = AfaDBFunc.DeleteSqlCmt(delsql)
 if(  res==None or res == -1 ):
     AfaLoggerFunc.tradeDebug(">>>记账明细簿插入数据失败,数据库会滚,抛弃报文")
     AfaDBFunc.RollbackSql()
     rccpsCronFunc.cronExit( '9000', '记账明细簿插入数据失败,数据库会滚,抛弃报文' )  
 else:
     AfaDBFunc.CommitSql()
 
 #==========记账明细簿导入数据=================================================
 AfaLoggerFunc.tradeInfo(">>>记账明细簿导入数据")
 file_name = 'rccpsdz' + NCCWKDAT
 file_path = os.environ['AFAP_HOME'] + "/data/rccps/host/"
 rb = open(file_path + file_name , 'r')
 #读取一行
 lineBuf = rb.readline()
 iLine=0