def MatchData(): try: #=============获取当前系统时间========================== sLstTrxDay = AfaUtilTools.GetSysDate( ) sLstTrxTime = AfaUtilTools.GetSysTime( ) #=============获取前一天的日期========================================= #sLstTrxDay = (datetime.datetime(int(sLstTrxDay[:4]),int(sLstTrxDay[4:6]),int(sLstTrxDay[6:8]))-datetime.timedelta(days=1)).strftime("%Y%m%d") #查询对帐未成功日期 sqlStr = "select distinct WORKDATE from VOUH_MODIFY where chkflag != '0' and TRANSTATUS = '0'" records = AfaDBFunc.SelectSql( sqlStr ) VouhFunc.WrtLog('>>>' + sqlStr) if( records == None ): VouhFunc.WrtLog('>>>查询错误') elif( len( records ) == 0 ): VouhFunc.WrtLog('>>>已与主机对帐') else: for i in range(len(records)): print records[i][0] SendData(records[i][0]) #=============程序退出==================== except Exception, e: print str(e)
def UpdChkFlag(chkFlag,wrokDate): VouhFunc.WrtLog('>>>修改对帐标志') updSql = "UPDATE VOUH_MODIFY SET CHKFLAG ='" + chkFlag + "' WHERE WORKDATE = '" + wrokDate + "' \ and TRANSTATUS = '0'" VouhFunc.WrtLog(updSql) result = AfaDBFunc.UpdateSqlCmt( updSql ) if ( result <= 0 ): VouhFunc.WrtLog( AfaDBFunc.sqlErrMsg ) VouhFunc.WrtLog('>>>处理结果:修改对帐标志,数据库异常') return False VouhFunc.WrtLog('>>>修改对帐标志 ---> 成功') return True
def UpdStatus(sStatus): VouhFunc.WrtLog('>>>修改凭证状态') #'签到状态(0-签退 1-签到)'; updSql = "UPDATE VOUH_PARAMETER SET STATUS='" + str(sStatus) + "'" VouhFunc.WrtLog(updSql) result = AfaDBFunc.UpdateSqlCmt( updSql ) if ( result <= 0 ): VouhFunc.WrtLog( AfaDBFunc.sqlErrMsg ) VouhFunc.WrtLog('>>>处理结果:修改凭证状态,数据库异常') return False VouhFunc.WrtLog('>>>修改凭证状态 ---> 成功') return True
def main( ): AfaLoggerFunc.tradeInfo( '凭证柜员交接['+TradeContext.TemplateCode+']进入' ) #=============前台上送数据=================================== #TradeContext.sBesbNo 机构号 #TradeContext.sBesbSty 机构类型 #TradeContext.sCur 货币代码 #TradeContext.sTellerNo 柜员号 #TradeContext.sRivTeller 对方柜员 #TradeContext.sLstTrxDay 最后交易日期 #TradeContext.sLstTrxTime 最后交易时间 try: #=============获取柜员级别========================== HostContext.I1TELR = TradeContext.sTellerNo #柜员号 HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 if(not VouhHostFunc.CommHost('8809')): tradeExit(TradeContext.errorCode, TradeContext.errorMsg) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): TELLER = HostContext.O1TLRK AfaLoggerFunc.tradeInfo( TELLER ) #=============初始化返回报文变量======================== TradeContext.tradeResponse = [] TradeContext.sRivTeller = TradeContext.sInTellerNo #=============生成流水号======================== TradeContext.sVouhSerial = VouhFunc.GetVouhSerial( ) #=============获取当前系统时间========================== TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( ) TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) TradeContext.sTransType = '凭证柜员交接' #================判断对方柜员是否有凭证================================== if(len(TradeContext.sInTellerNo) == 0): VouhFunc.tradeExit('A005061', '对方柜员不能为空!') raise AfaFlowControl.flowException( ) #if(TELLER == '01' or TELLER == '02' or TELLER == '03'): # VouhFunc.tradeExit('A005061', '该柜员不能进行此操作!') # raise AfaFlowControl.flowException( ) sqlStr = "select * from VOUH_REGISTER where TELLERNO = '" + TradeContext.sInTellerNo + "' and VOUHSTATUS = '3'" records = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeDebug(sqlStr) if records==-1 : VouhFunc.tradeExit( 'A005057', '查询[凭证登记表]信息异常!' ) raise AfaFlowControl.flowException( ) elif len(records) > 0 : VouhFunc.tradeExit( 'A005058', '['+TradeContext.sInTellerNo+']柜员不能交接!' ) raise AfaFlowControl.flowException( ) #================判断柜员是否有凭证================================== #if((TradeContext.sTellerNo)[4:] == '01' or (TradeContext.sTellerNo)[4:] == '02' or (TradeContext.sTellerNo)[4:] == '03'): # VouhFunc.tradeExit('A005061', '该柜员不能进行此操作!') # raise AfaFlowControl.flowException( ) sqlStr = "select * from VOUH_REGISTER where TELLERNO = '" + TradeContext.sTellerNo + "' and VOUHSTATUS = '3'" records = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeDebug(sqlStr) if records==-1 : VouhFunc.tradeExit( 'A005057', '查询[凭证登记表]信息异常!' ) raise AfaFlowControl.flowException( ) elif records==0 : VouhFunc.tradeExit( 'A005058', '无凭证!' ) raise AfaFlowControl.flowException( ) #======================柜员交接===================================== sqlStr = "update VOUH_REGISTER set TELLERNO = '" + TradeContext.sInTellerNo + "' where TELLERNO = '" + TradeContext.sTellerNo + "' and VOUHSTATUS = '3'" records = AfaDBFunc.UpdateSqlCmt( sqlStr ) AfaLoggerFunc.tradeDebug(sqlStr) if records==-1 : VouhFunc.tradeExit( 'A005057', '更新[凭证登记表]信息异常!' ) raise AfaFlowControl.flowException( ) elif records==0 : VouhFunc.tradeExit( 'A005058', '修改[凭证登记表]基本信息失败!' ) raise AfaFlowControl.flowException( ) #更新凭证变更登记表 VouhFunc.VouhModify() #数据库提交 AfaDBFunc.CommitSql( ) #==================查询交接凭证明细================================== #=====李亚杰 20080812 修改凭证查询条件,增加凭证状态为'3'的情况==== #sqlStr = "select distinct t.VOUHTYPE,t1.VOUHNAME,t.STARTNO,t.ENDNO,t.VOUHNUM FROM VOUH_REGISTER t,VOUH_PARAMETER t1 \ # where t.VOUHTYPE = t1.VOUHTYPE AND substr(t.BESBNO,1,6) = substr(t1.BESBNO,1,6) \ # AND t.TELLERNO = '" + TradeContext.sInTellerNo + "'" sqlStr = "select distinct t.VOUHTYPE,t1.VOUHNAME,t.STARTNO,t.ENDNO,t.VOUHNUM FROM VOUH_REGISTER t,VOUH_PARAMETER t1 \ where t.VOUHTYPE = t1.VOUHTYPE AND substr(t.BESBNO,1,6) = substr(t1.BESBNO,1,6) \ AND t.VOUHSTATUS = '3' AND t.TELLERNO = '" + TradeContext.sInTellerNo + "'" AfaLoggerFunc.tradeDebug(sqlStr); #查询数据库并将返回的结果压至对应变量中 records = AfaDBFunc.SelectSql( sqlStr ) if( records == None ): VouhFunc.tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( records ) == 0 ): VouhFunc.tradeExit('A005068', '凭证不存在!' ) raise AfaFlowControl.flowException( ) else : record=AfaUtilTools.ListFilterNone( records ) total=len( records ) sVouhType = '' sVouhName = '' sStartNo = '' sEndNo = '' sVouhNum = '' for i in range( 0, total ): if( i <> 0): strSplit = '|' else: strSplit = '' sVouhType = sVouhType + strSplit + records[i][0] sVouhName = sVouhName + strSplit + records[i][1] sStartNo = sStartNo + strSplit + records[i][2] sEndNo = sEndNo + strSplit + records[i][3] sVouhNum = sVouhNum + strSplit + records[i][4] TradeContext.tradeResponse.append( ['sVouhType',sVouhType] ) TradeContext.tradeResponse.append( ['sVouhName',sVouhName] ) TradeContext.tradeResponse.append( ['sTellerNo',TradeContext.sTellerNo] ) TradeContext.tradeResponse.append( ['sInTellerNo',TradeContext.sInTellerNo] ) TradeContext.tradeResponse.append( ['sStartNo',sStartNo] ) TradeContext.tradeResponse.append( ['sEndNo',sEndNo] ) TradeContext.tradeResponse.append( ['sVouhNum',sVouhNum] ) TradeContext.tradeResponse.append( ['sNum',str(total)] ) TradeContext.tradeResponse.append( ['sVouhSerial',TradeContext.sVouhSerial] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) #自动打包 AfaFunc.autoPackData() #=============程序退出==================== AfaLoggerFunc.tradeInfo( '凭证柜员交接['+TradeContext.TemplateCode+']退出' ) except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( )
def main( ): AfaLoggerFunc.tradeInfo( '凭证作废撤销['+TradeContext.TemplateCode+']进入' ) #=============前台上送数据=================================== #TradeContext.sBesbNo 机构号 #TradeContext.sBesbSty 机构类型 #TradeContext.sCur 货币代码 #TradeContext.sTellerNo 柜员号 #TradeContext.sVouhType 凭证种类 #TradeContext.sStartNo 起始号码 #TradeContext.sEndNo 终止号码 #TradeContext.sRivTeller 对方柜员 #TradeContext.sVouhStatus 凭证状态 #TradeContext.sVouhNum 凭证数量 #TradeContext.sLstTrxDay 最后交易日期 #TradeContext.sLstTrxTime 最后交易时间 #TradeContext.sDepository 库箱标志 #TradeContext.sVouhName 凭证名称 try: #================拆包======================== TradeContext.sVouhType = VouhFunc.DelSpace(TradeContext.sVouhType.split("|")) TradeContext.sVouhName = VouhFunc.DelSpace(TradeContext.sVouhName.split("|")) TradeContext.sStartNo = VouhFunc.DelSpace(TradeContext.sStartNo.split("|")) TradeContext.sEndNo = VouhFunc.DelSpace(TradeContext.sEndNo.split("|")) TradeContext.sVouhNum = VouhFunc.DelSpace(TradeContext.sVouhNum.split("|")) TradeContext.sNum = len(TradeContext.sVouhType) #==================暂存================================== TradeContext.rVouhType = VouhFunc.AddSplit(TradeContext.sVouhType) TradeContext.rVouhName = VouhFunc.AddSplit(TradeContext.sVouhName) TradeContext.rStartNo = VouhFunc.AddSplit(TradeContext.sStartNo) TradeContext.rEndNo = VouhFunc.AddSplit(TradeContext.sEndNo) TradeContext.rVouhNum = VouhFunc.AddSplit(TradeContext.sVouhNum) #=============初始化返回报文变量======================== TradeContext.tradeResponse = [] #=============生成流水号======================== TradeContext.sVouhSerial = VouhFunc.GetVouhSerial( ) #=============获取当前系统时间========================== TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( ) TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) #begin凭证优化更改201109 #=============获取柜员尾箱号=============================== HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 HostContext.I1EDDT = TradeContext.sLstTrxDay #终止日期 HostContext.I1TELR = TradeContext.sTellerNo #柜员代号 if(not VouhHostFunc.CommHost('0104')): VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg ) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): TradeContext.sTellerTailNobak = HostContext.O2CABO TradeContext.sTellerTailNo = TradeContext.sTellerTailNobak[0] AfaLoggerFunc.tradeInfo( '交易柜员尾箱号:' + TradeContext.sTellerTailNo ) #end #=============置凭证操作状态及库箱标志==================== TradeContext.sDepository = '4' #库箱标志 1.分行管理库 2.支行管理库 3.网点管理库 4.柜员凭证箱 TradeContext.sExDepos = '4' #原库箱标志 TradeContext.sVouhStatus = '3' #状态 3.已领未用 6.已作废 TradeContext.sExStatus = '6' #原状态 TradeContext.sRivTeller = ' ' #对方柜员 TradeContext.sTransType = '凭证作废撤销' TradeContext.sInTellerTailNo = TradeContext.sTellerTailNo TradeContext.sInBesbNo = TradeContext.sBesbNo #交易公共部分 VouhFunc.VouhTrans() #更新凭证变更登记表 VouhFunc.VouhModify() #数据库提交 AfaDBFunc.CommitSql( ) #主机记账 AfaLoggerFunc.tradeInfo( '------------主机记账' ) TradeContext.sOperSty = '0' VouhHostFunc.VouhCommHost() TradeContext.sTranStatus = '0' AfaLoggerFunc.tradeInfo( '=======================12'+TradeContext.errorCode ) #TradeContext.errorCode = '0000' if(TradeContext.errorCode <> '0000'): tmpErrorCode= TradeContext.errorCode tmpErrorMsg = TradeContext.errorMsg #冲正 #=============置凭证操作状态及库箱标志==================== tmpDepos = TradeContext.sDepository TradeContext.sDepository = TradeContext.sExDepos TradeContext.sExDepos = tmpDepos tmpStatus = TradeContext.sVouhStatus TradeContext.sVouhStatus = TradeContext.sExStatus TradeContext.sExStatus = tmpStatus TradeContext.sRivTeller = ' ' #对方柜员 TradeContext.sTransType = '冲正' #交易公共部分 VouhFunc.VouhTrans() AfaDBFunc.CommitSql( ) TradeContext.sTranStatus = '1' if(not TradeContext.existVariable( "HostSerno" )): TradeContext.HostSerno = '' #更新流水表 VouhFunc.ModifyVouhModify() AfaLoggerFunc.tradeInfo( '============================自动冲正!' ) VouhFunc.tradeExit(tmpErrorCode, tmpErrorMsg) raise AfaFlowControl.flowException( ) #更新流水表 VouhFunc.ModifyVouhModify() TradeContext.tradeResponse.append( ['sVouhSerial',TradeContext.sVouhSerial] ) TradeContext.tradeResponse.append( ['sVouhType',TradeContext.rVouhType] ) TradeContext.tradeResponse.append( ['sVouhName',TradeContext.rVouhName] ) TradeContext.tradeResponse.append( ['sStartNo',TradeContext.rStartNo] ) TradeContext.tradeResponse.append( ['sEndNo',TradeContext.rEndNo] ) TradeContext.tradeResponse.append( ['sVouhNum',TradeContext.rVouhNum] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['sNum',str(TradeContext.sNum)] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) #自动打包 AfaFunc.autoPackData() #=============程序退出==================== AfaLoggerFunc.tradeInfo( '凭证作废撤销['+TradeContext.TemplateCode+']退出' ) except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( )
def main( ): AfaLoggerFunc.tradeInfo( '打印报表['+TradeContext.TemplateCode+']进入' ) #=============前台上送数据==================== #TradeContext.sTellerNo 柜员号 #TradeContext.sWorkDate 交易日期 #TrddeContext.sBesbNo 机构号 try: #=============获取机构类型========================== HostContext.I1OTSB = TradeContext.sBesbNo #机构号 HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 if(not VouhHostFunc.CommHost('2001')): tradeExit(TradeContext.errorCode, TradeContext.errorMsg) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): SBNO = HostContext.O1SBCH AfaLoggerFunc.tradeInfo( SBNO ) #=============获取柜员级别========================== HostContext.I1TELR = TradeContext.sTellerNo #柜员号 HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 if(not VouhHostFunc.CommHost('8809')): tradeExit(TradeContext.errorCode, TradeContext.errorMsg) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): TELLER = HostContext.O1TLRK AfaLoggerFunc.tradeInfo( TELLER ) #=============初始化返回报文变量================== TradeContext.tradeResponse = [] #=================获取机构名称============================== #begin 20100920 蔡永贵修改 避免机构不存在时查询结果为空而抛出错误 #TradeContext.sBesbName = VouhFunc.SelectBesbName(TradeContext.sBesbNo) if not VouhFunc.SelectBesbName(TradeContext.sBesbNo): raise AfaFlowControl.flowException( ) else: TradeContext.sBesbName = VouhFunc.SelectBesbName(TradeContext.sBesbNo) #end #=====================获取机构类型=============================== #TradeContext.sBesbSty = VouhFunc.SelectBesbSty(TradeContext.sBesbNo) #AfaLoggerFunc.tradeInfo('================='+TradeContext.sBesbSty) #=============获取当前系统时间==================== TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( ) TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) #begin凭证优化更改201109 #=============获取柜员尾箱号=============================== HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 HostContext.I1EDDT = TradeContext.sLstTrxDay #终止日期 HostContext.I1TELR = TradeContext.sTellerNo #柜员代号 if(not VouhHostFunc.CommHost('0104')): VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg ) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): TradeContext.sTellerTailNobak = HostContext.O2CABO TradeContext.sTellerTailNo = TradeContext.sTellerTailNobak[0] AfaLoggerFunc.tradeInfo( '交易柜员尾箱号:' + TradeContext.sTellerTailNo ) #end vouh = [] count1 = 0 count2 = 0 count3 = 0 AfaLoggerFunc.tradeInfo(TradeContext.sTellerTailNo) sqlStr = "select VOUHTYPE,VOUHNAME from VOUH_PARAMETER where substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' order by VOUHTYPE" AfaLoggerFunc.tradeInfo(sqlStr) records = AfaDBFunc.SelectSql( sqlStr ) if( records == None ): tradeExit('A005067', '查询[凭证参数表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( records ) == 0 ): tradeExit('A005068', '凭证不存在!' ) raise AfaFlowControl.flowException( ) else : for i in range(len(records)): num1 = 0 num2 = 0 num3 = 0 if(SBNO == '33' and TELLER == "10"): #查询凭证领用数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and TRANSTATUS = '0' \ and VOUHSTATUS = '0'" res1 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr) if( res1 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res1 ) == 0 ): num1 = 0 else : num1 = res1[0][0] if(num1 == None): num1 = 0 AfaLoggerFunc.tradeInfo(num1) #查询凭证付出数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and TRANSTATUS = '0' \ and VOUHSTATUS in ('1','2')" res2 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr) if( res2 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res2 ) == 0 ): num2 = 0 else : num2 = res2[0][0] if(num2 == None): num2 = 0 AfaLoggerFunc.tradeInfo(num2) #查询凭证余数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \ where VOUHTYPE = '" + records[i][0] + "' \ and TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and VOUHSTATUS = '0'" res3 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr) if( res3 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res3 ) == 0 ): num3 = 0 else : num3 = res3[0][0] if(num3 == None): num3 = 0 AfaLoggerFunc.tradeInfo(num3) elif(TELLER == "10"): #查询凭证领用数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and (TELLERNO = '" + TradeContext.sTellerTailNo + "' \ or RIVTELLER = '" + TradeContext.sTellerTailNo + "') \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and TRANSTATUS = '0' \ and VOUHSTATUS = '2'" res1 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr) if( res1 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res1 ) == 0 ): num1 = 0 else : num1 = res1[0][0] if(num1 == None): num1 = 0 #查询凭证付出数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and TRANSTATUS = '0' \ and EXSTATUS = '2' \ and VOUHSTATUS in ('0','3')" res2 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr) if( res2 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res2 ) == 0 ): num2 = 0 else : num2 = res2[0][0] if(num2 == None): num2 = 0 #查询凭证余数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \ where VOUHTYPE = '" + records[i][0] + "' \ and TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and VOUHSTATUS = '2'" res3 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr) if( res3 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res3 ) == 0 ): num3 = 0 else : num3 = res3[0][0] if(num3 == None): num3 = 0 elif(TELLER == "20"): #查询凭证领用数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and TRANSTATUS = '0' \ and VOUHSTATUS = '2'" res1 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr) if( res1 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res1 ) == 0 ): num1 = 0 else : num1 = res1[0][0] if(num1 == None): num1 = 0 #查询凭证付出数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and TRANSTATUS = '0' \ and EXSTATUS = '3' \ and VOUHSTATUS in ('2','4','5','6')" res2 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr) if( res2 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res2 ) == 0 ): num2 = 0 else : num2 = res2[0][0] if(num2 == None): num2 = 0 #查询凭证余数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \ where VOUHTYPE = '" + records[i][0] + "' \ and substr(BESBNO,1,6) = '" + (TradeContext.sBesbNo)[:6] + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and VOUHSTATUS in ('2','3')" res3 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr) if( res3 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res3 ) == 0 ): num3 = 0 else : num3 = res3[0][0] if(num3 == None): num3 = 0 else: #查询凭证领用数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and (TELLERNO = '" + TradeContext.sTellerTailNo + "' \ or RIVTELLER = '" + TradeContext.sTellerTailNo + "') \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and TRANSTATUS = '0' \ and VOUHSTATUS = '3'" res1 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql1 = '+sqlStr) if( res1 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res1 ) == 0 ): num1 = 0 else : num1 = res1[0][0] if(num1 == None): num1 = 0 #查询凭证付出数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_MODIFY \ where WORKDATE = '" + TradeContext.sWorkDate + "' \ and TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and VOUHTYPE = '" + records[i][0] + "' \ and TRANSTATUS = '0' \ and EXSTATUS = '3' \ and VOUHSTATUS in ('2','4','5','6')" res2 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql2 = '+sqlStr) if( res2 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res2 ) == 0 ): num2 = 0 else : num2 = res2[0][0] if(num2 == None): num2 = 0 #查询凭证余数 sqlStr = "select SUM(CAST(VOUHNUM AS DECIMAL(25))) from VOUH_REGISTER \ where VOUHTYPE = '" + records[i][0] + "' \ and TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and BESBNO = '" + TradeContext.sBesbNo + "' \ and VOUHSTATUS = '3'" res3 = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeInfo('sql3 = '+sqlStr) if( res3 == None ): tradeExit('A005067', '查询[凭证表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( res3 ) == 0 ): num3 = 0 else : num3 = res3[0][0] if(num3 == None): num3 = 0 vouh.append([records[i][0],records[i][1],str(num1),str(num2),str(num3)]) count1 = count1 + num1 count2 = count2 + num2 count3 = count3 + num3 rBankFile= os.environ['AFAP_HOME'] + '/data/vouh/vouhtmp.txt' #创建业务报表文件 bFp = open(rBankFile, "w") AfaLoggerFunc.tradeInfo('-----' + TradeContext.sBesbNo) AfaLoggerFunc.tradeInfo('-----' + TradeContext.sBesbName) AfaLoggerFunc.tradeInfo('-----' + TradeContext.sTellerTailNo) AfaLoggerFunc.tradeInfo('-----' + TradeContext.sWorkDate) #写入标题 bFp.write('\n **************** 代理业务凭证余额表 **************** \n\n') bFp.write(' 机构号码:' + TradeContext.sBesbNo + ' 机构名称: ' + TradeContext.sBesbName + '\n') bFp.write(' 柜员号码:' + TradeContext.sTellerTailNo + ' 日期:' + TradeContext.sWorkDate + '\n') bFp.write(' ------------------------------------------------------------------------------------------------------\n') bFp.write(' | 序号 | 凭证种类 | 凭证姓名 | 收方发生额 | 付方发生额 | 余额 |\n') bFp.write(' |----------|----------|------------------------------|---------------|---------------|---------------|\n') AfaLoggerFunc.tradeInfo('------------test5') for i in range( len( vouh ) ): wbuffer = ' |' wbuffer = wbuffer + str(i+1).ljust(10,' ') + '|' wbuffer = wbuffer +(vouh[i][0].strip()).ljust(10, ' ') + '|' wbuffer = wbuffer +(vouh[i][1].strip()).ljust(30, ' ') + '|' wbuffer = wbuffer +(vouh[i][2].strip()).rjust(15, ' ') + '|' wbuffer = wbuffer +(vouh[i][3].strip()).rjust(15, ' ') + '|' wbuffer = wbuffer +(vouh[i][4].strip()).rjust(15, ' ') + '|' #写入报表文件 bFp.write(wbuffer + '\n') bFp.write(' |----------|----------|------------------------------|---------------|---------------|---------------|\n') bFp.write(' | 合计 | | |' + str(count1).rjust(15,' ') + '|' + str(count2).rjust(15,' ') + '|' + str(count3).rjust(15,' ')+ '|\n') bFp.write(' ------------------------------------------------------------------------------------------------------\n') #关闭文件 bFp.close() TradeContext.tradeResponse.append( ['sBesbNo',TradeContext.sBesbNo] ) TradeContext.tradeResponse.append( ['sTellerTailNo',TradeContext.sTellerTailNo] ) TradeContext.tradeResponse.append( ['sTellerNo',TradeContext.sTellerNo] ) #凭证优化更改201109 TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['sFileName','vouhtmp.txt'] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) AfaFunc.autoPackData() #=============程序退出==================== AfaLoggerFunc.tradeInfo( '打印报表['+TradeContext.TemplateCode+']退出' ) except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( )
def main( ): AfaLoggerFunc.tradeInfo( '查询凭证结存交易['+TradeContext.TemplateCode+']进入' ) #=============前台上送数据==================== #TradeContext.sBESBNO 机构号 #TradeContext.sTellerNo 柜员号 #TradeContext.sVouhType 凭证种类 #TradeCoutext.sVouhStatus 凭证状态 #TradeCoutext.sStartDate 起始日期 #TradeCoutext.sEndDate 终止日期 #TradeContext.sStart 起始记录数 #TradeContext.arraySize 查询条数 try: #=============初始化返回报文变量================== TradeContext.tradeResponse = [] #=============获取当前系统时间==================== TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( ) TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) #begin凭证优化更改201109 #=============获取柜员尾箱号=============================== HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 HostContext.I1EDDT = TradeContext.sLstTrxDay #终止日期 HostContext.I1TELR = TradeContext.sTellerNo #柜员代号 if(not VouhHostFunc.CommHost('0104')): VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg ) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): TradeContext.sTellerTailNobak = HostContext.O2CABO TradeContext.sTellerTailNo = TradeContext.sTellerTailNobak[0] AfaLoggerFunc.tradeInfo( '交易柜员尾箱号:' + TradeContext.sTellerTailNo ) #end wheresql="substr(t1.BESBNO,1,6) = substr(t.BESBNO,1,6) AND t1.VOUHTYPE = t.VOUHTYPE AND t.VOUHSTATUS = '3'" #==============设机构号===================== if (TradeContext.existVariable("sSelBesbNo") and len(TradeContext.sSelBesbNo) <> 0 ): wheresql = wheresql + " and t.BESBNO = '" + TradeContext.sSelBesbNo + "'" #==============设凭证种类===================== if (TradeContext.existVariable("sVouhType") and len(TradeContext.sVouhType) <> 0 ): wheresql = wheresql + " and t.VOUHTYPE = '" + TradeContext.sVouhType+"'" #begin凭证优化更改201109 #==============设尾箱号===================== if (TradeContext.existVariable("sTellerTailNo") and len(TradeContext.sTellerTailNo) <> 0 ): wheresql = wheresql + " and t.TELLERNO = '" + TradeContext.sTellerTailNo + "'" #end sqlStr = "\ SELECT TELLERNO,VOUHTYPE,STARTNO,ENDNO,VOUHNUM,VOUHNAME \ FROM ( \ SELECT row_number() over() as rowid,t.TELLERNO,t.VOUHTYPE,t.STARTNO,t.ENDNO,t.VOUHNUM,t1.VOUHNAME \ FROM VOUH_REGISTER t,VOUH_PARAMETER t1 \ WHERE " + wheresql + " \ ) as tab1 \ where tab1.rowid >= " + str(TradeContext.sStart) AfaLoggerFunc.tradeDebug(sqlStr); #查询数据库并将返回的结果压至对应变量中 records = AfaDBFunc.SelectSql( sqlStr, int(TradeContext.arraySize)) if( records == None ): AfaLoggerFunc.tradeError(AfaDBFunc.sqlErrMsg) tradeExit('A005067', '查询[凭证登记表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( records ) == 0 ): tradeExit('A005068', '凭证不存在!' ) raise AfaFlowControl.flowException( ) else : record=AfaUtilTools.ListFilterNone( records ) total=len( records ) sTellerTailNo = '' sVouhType = '' sStartNo = '' sEndNo = '' sVouhNum = '' sVouhName = '' for i in range( 0, total ): if( i <> 0): strSplit = '|' else: strSplit = '' sTellerTailNo = sTellerTailNo + strSplit + records[i][0] sVouhType = sVouhType + strSplit + records[i][1] sStartNo = sStartNo + strSplit + records[i][2] sEndNo = sEndNo + strSplit + records[i][3] sVouhNum = sVouhNum + strSplit + records[i][4] sVouhName = sVouhName + strSplit + records[i][5] TradeContext.tradeResponse.append( ['sTellerTailNo',sTellerTailNo] ) TradeContext.tradeResponse.append( ['sTellerNo',TradeContext.sTellerNo] ) #凭证优化更改201109 TradeContext.tradeResponse.append( ['sVouhType',sVouhType] ) TradeContext.tradeResponse.append( ['sVouhName',sVouhName] ) TradeContext.tradeResponse.append( ['sStartNo',sStartNo] ) TradeContext.tradeResponse.append( ['sEndNo',sEndNo] ) TradeContext.tradeResponse.append( ['sVouhNum',sVouhNum] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['sNum',str(total)] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) AfaFunc.autoPackData() #=============程序退出==================== AfaLoggerFunc.tradeInfo( '查询凭证结存交易['+TradeContext.TemplateCode+']退出' ) except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( )
def vouh_Pro( ): try: #===========查询数据库中不符合规则的库箱标志和凭证状态组合============== sql = "" sql = "select distinct(BESBNO) from vouh_register where depository = '4' and vouhstatus='2'" AfaLoggerFunc.tradeInfo('查询语句'+ sql) records = AfaDBFunc.SelectSql( sql ) if records==None: TradeContext.errorCode,TradeContext.errorMsg = "0001" ,"查询数据库失败" raise AfaFlowControl.flowException( ) elif(len(records) < 1): TradeContext.errorCode,TradeContext.errorMsg = "0001","不存在满足条件的数据" return False else: record=AfaUtilTools.ListFilterNone( records ) total=len( records ) AfaLoggerFunc.tradeDebug("数据条数:" + str(total)) for i in range(0,total): AfaLoggerFunc.tradeInfo('机构号'+ records[i][0]) #=============获取机构类型========================== HostContext.I1OTSB = records[i][0] #机构代号 HostContext.I1SBNO = '3401010007' #机构号 HostContext.I1USID = '999996' #柜员号 #HostContext.I1WSNO = TradeContext.sWSNO #终端号 if(not VouhHostFunc.CommHost('2001')): tradeExit( TradeContext.errorCode, TradeContext.errorMsg ) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): SBNO = HostContext.O1SBCH AfaLoggerFunc.tradeInfo( SBNO ) if(SBNO=='33'): update_sql = "" update_sql = update_sql + "update vouh_register set depository = '1'" update_sql = update_sql + " where besbno = '" + records[i][0] + "'" update_sql = update_sql + " and depository = '4' and vouhstatus='2'" AfaLoggerFunc.tradeInfo('更新数据库语句1:'+ update_sql) #更新并提交数据 if AfaDBFunc.UpdateSqlCmt(update_sql)<0: return AfaFlowControl.ExitThisFlow("A999","更新失败") elif(SBNO=='31' or SBNO=='40' or SBNO=='32' or SBNO=='41'): update_sql = "" update_sql = "update vouh_register set depository = '2'" update_sql = update_sql + " where besbno = '" + records[i][0] + "'" update_sql = update_sql + " and depository = '4' and vouhstatus='2'" AfaLoggerFunc.tradeInfo('更新数据库语句2:'+ update_sql) if AfaDBFunc.UpdateSqlCmt(update_sql)<0: return AfaFlowControl.ExitThisFlow("A999","更新失败") elif(SBNO=='50'): update_sql = "" update_sql = "update vouh_register set depository = '3'" update_sql = update_sql + " where besbno = '" + records[i][0] + "'" update_sql = update_sql + " and depository = '4' and vouhstatus='2'" AfaLoggerFunc.tradeInfo('更新数据库语句3:'+ update_sql) if AfaDBFunc.UpdateSqlCmt(update_sql)<0: return AfaFlowControl.ExitThisFlow("A999","更新失败") else: VouhFunc.tradeExit('A005061', '该机构级别不在指定范围内') raise AfaFlowControl.flowException( ) tradeExit('0000', '更新成功') #=============程序退出========================================= except Exception, e: AfaLoggerFunc.tradeFatal( str(e) ) return False
def main(): AfaLoggerFunc.tradeInfo( '凭证中心参数维护['+TradeContext.TemplateCode+']进入' ) #=============前台上送数据=================================== #TradeContext.sBesbNo 机构号 #TradeContext.sTellerNo 柜员号 #TradeContext.opeType 操作类型 #TradeContext.sVouhType 凭证种类 #TradeContext.sVouhName 凭证名称 #TradeContext.sNum 重复次数 #=============获取当前系统时间========================== TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( ) TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) try: #=============获取机构类型========================== HostContext.I1OTSB = TradeContext.sBesbNo #机构号 HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 if(not VouhHostFunc.CommHost('2001')): VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg ) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): SBNO = HostContext.O1SBCH AfaLoggerFunc.tradeInfo( SBNO ) #begin凭证优化更改LLJ 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] #柜员尾箱号TradeContext.sTellerTailNo AfaLoggerFunc.tradeInfo( '柜员尾箱号:' + TradeContext.sTellerTailNo ) #end #=============初始化返回报文变量======================== TradeContext.tradeResponse = [] #================拆包======================== if(TradeContext.existVariable("sVouhType")): TradeContext.sVouhType = VouhFunc.DelSpace(TradeContext.sVouhType.split("|")) TradeContext.sNum = len(TradeContext.sVouhType) if(TradeContext.existVariable("sVouhName")): TradeContext.sVouhName = VouhFunc.DelSpace(TradeContext.sVouhName.split("|")) AfaLoggerFunc.tradeInfo( '=================='+str(TradeContext.sNum) ) #===========检查操作类型是否存在=========== # 1 新增,2 删除, 3 修改, 4 查询 if( not TradeContext.existVariable( "opeType" ) ): tradeExit( 'A005060', '操作类型[opeType]值不存在!' ) raise AfaFlowControl.flowException( ) if TradeContext.opeType == '1': #新增 if(SBNO <> '33' and SBNO <> '02' ): tradeExit( 'A0001', '该机构柜员不能进行此操作!' ) raise AfaFlowControl.flowException( ) n=0 for i in range(TradeContext.sNum): n=n+1 #==========检查该凭证种类信息是否已经存在============ sqlStr = "select VOUHTYPE from VOUH_PARAMETER \ where VOUHTYPE = '" + TradeContext.sVouhType[i] + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'" AfaLoggerFunc.tradeInfo( 'sql = ' + sqlStr ) records = AfaDBFunc.SelectSql( sqlStr ) if( records == None ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005052', '查询[凭证参数维护表]操作异常!' ) raise AfaFlowControl.flowException( ) elif( len( records )!=0 ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005053', '凭证种类已存在!' ) raise AfaFlowControl.flowException( ) #==========检查该凭证名称信息是否已经存在============ sqlStr = "select VOUHNAME from VOUH_PARAMETER \ where trim(VOUHNAME) = trim('" + TradeContext.sVouhName[i] + "')\ and BESBNO = '" + TradeContext.sBesbNo + "'" AfaLoggerFunc.tradeInfo( 'sql = ' + sqlStr ) records = AfaDBFunc.SelectSql( sqlStr ) if( records == None ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005052', '查询[凭证参数维护表]操作异常!' ) raise AfaFlowControl.flowException( ) elif( len( records )!=0 ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005053', '凭证名称已存在!' ) raise AfaFlowControl.flowException( ) #=============初始化返回报文变量==================== TradeContext.tradeResponse=[] sqlStr = "INSERT INTO VOUH_PARAMETER (BESBNO,VOUHTYPE,VOUHNAME,TELLERNO,ACTIVEDATE,STATUS) VALUES ('"+TradeContext.sBesbNo+"','"+\ TradeContext.sVouhType[i]+"','"+TradeContext.sVouhName[i]+"','"+TradeContext.sTellerTailNo+"','"+TradeContext.sLstTrxDay+"','1')" AfaLoggerFunc.tradeInfo( sqlStr ) records = AfaDBFunc.InsertSql( sqlStr ) if records < 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005054', '新增[凭证号码表]基本信息失败!' ) raise AfaFlowControl.flowException( ) #数据库提交 AfaLoggerFunc.tradeInfo( '------------数据库提交' ) AfaDBFunc.CommitSql( ) TradeContext.tradeResponse.append( ['sNum',str(TradeContext.sNum)] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) if TradeContext.opeType == '3': #删除 if(SBNO <> '33' and SBNO <> '02' ): tradeExit( 'A0001', '该机构柜员不能进行此操作!' ) raise AfaFlowControl.flowException( ) n = 0 for i in range(TradeContext.sNum): n=n+1 sqlStr = "select * from VOUH_REGISTER \ where VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and VOUHSTATUS <> '6' \ and BESBNO = '"+TradeContext.sBesbNo+"'" records = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeDebug(sqlStr) if( records == None ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005060', '查询[凭证登记表]操作异常!' ) raise AfaFlowControl.flowException( ) elif( len( records ) > 0 ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005061', '不能删除存在有效凭证的凭证参数!' ) raise AfaFlowControl.flowException( ) sqlStr = "DELETE FROM VOUH_PARAMETER WHERE VOUHTYPE = '" + TradeContext.sVouhType[i]+ "'\ and BESBNO = '" + TradeContext.sBesbNo+ "'" AfaLoggerFunc.tradeDebug(sqlStr) records = AfaDBFunc.DeleteSql( sqlStr ) if records == -1: AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005055', '删除[凭证参数维护表]操作异常!' ) raise AfaFlowControl.flowException( ) if records == 0: AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005056', '[凭证参数维护表]内无对应记录可被删除!' ) raise AfaFlowControl.flowException( ) #数据库提交 AfaLoggerFunc.tradeInfo( '------------数据库提交' ) AfaDBFunc.CommitSql( ) TradeContext.tradeResponse.append( ['sNum',str(TradeContext.sNum)] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) if TradeContext.opeType == '2':#修改 if(SBNO <> '33' and SBNO <> '02' ): tradeExit( 'A0001', '该机构柜员不能进行此操作!' ) raise AfaFlowControl.flowException( ) n=0 #==============修改凭证参数维护表===================== for i in range(TradeContext.sNum): n=n+1 #==========检查该凭证名称信息是否已经存在============ sqlStr = "select VOUHNAME from VOUH_PARAMETER \ where trim(VOUHNAME) = trim('" + TradeContext.sVouhName[i] + "')\ and BESBNO = '" + TradeContext.sBesbNo + "'" AfaLoggerFunc.tradeInfo( 'sql = ' + sqlStr ) records = AfaDBFunc.SelectSql( sqlStr ) if( records == None ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005052', '查询[凭证参数维护表]操作异常!' ) raise AfaFlowControl.flowException( ) elif( len( records )!=0 ): if(n>1): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005053', '凭证名称已存在!' ) raise AfaFlowControl.flowException( ) sqlStr = "UPDATE VOUH_PARAMETER set \ VOUHNAME = '"+ TradeContext.sVouhName[i] + "'" sqlStr = sqlStr +" WHERE VOUHTYPE = '" + TradeContext.sVouhType[i] + "'\ and BESBNO = '" + TradeContext.sBesbNo+ "'" records = AfaDBFunc.UpdateSql( sqlStr ) if records==-1 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005057', '更新[凭证参数维护表]信息异常!' ) raise AfaFlowControl.flowException( ) elif records==0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit( 'A005058', '修改[凭证参数维护表]基本信息失败!' ) raise AfaFlowControl.flowException( ) #数据库提交 AfaLoggerFunc.tradeInfo( '------------数据库提交' ) AfaDBFunc.CommitSql( ) TradeContext.tradeResponse.append( ['sNum',str(TradeContext.sNum)] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) if TradeContext.opeType == '4':#查询 TradeContext.tradeResponse=[] sqlStr = "SELECT VOUHTYPE,VOUHNAME,BESBNO FROM VOUH_PARAMETER WHERE (SUBSTR(BESBNO,1,6) = '"+ (TradeContext.sBesbNo)[:6] +"' \ or BESBNO ='3400008887')" if (len(TradeContext.sVouhType)!=0 and len(TradeContext.sVouhType[0])!=0): sqlStr = sqlStr + " AND VOUHTYPE = '" + TradeContext.sVouhType[0] + "' AND STATUS = '1'" 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 ) sTotal=len( records ) sVouhType = '' sVouhName = '' sBESBNO = '' for i in range( 0, len( records ) ): if( i <> 0): strSplit = '|' else: strSplit = '' sVouhType = sVouhType + strSplit + records[i][0] sVouhName = sVouhName + strSplit + records[i][1] sBESBNO = sBESBNO + strSplit + records[i][2] TradeContext.tradeResponse.append( ['sVouhType',sVouhType] ) TradeContext.tradeResponse.append( ['sVouhName',sVouhName] ) TradeContext.tradeResponse.append( ['sBESBNO',sBESBNO] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['sTotal',str(sTotal)] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','查询成功'] ) tradeExit('0000', '查询成功') #自动打包 AfaFunc.autoPackData() #=============程序退出========================================= AfaLoggerFunc.tradeInfo( '凭证中心参数维护['+TradeContext.TemplateCode+']退出' ) except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( )
def SendData(sLstTrxDay): #查询对帐信息 sqlStr = "select WORKDATE,HOSTDATE,VOUHSERIAL,HOSTSERIAL,char(sum(int(VOUHNUM))) \ from VOUH_MODIFY \ where WORKDATE = '" + sLstTrxDay + "' \ and TRANSTATUS = '0'\ group by WORKDATE,HOSTDATE,VOUHSERIAL,HOSTSERIAL \ order by int(VOUHSERIAL)" records = AfaDBFunc.SelectSql( sqlStr ) print sqlStr AfaLoggerFunc.tradeInfo(sqlStr) if( records == None ): print "查询错误" raise AfaFlowControl.flowException( ) elif( len( records ) == 0 ): print "查询为空" raise AfaFlowControl.flowException( ) rBankFile= os.environ['AFAP_HOME'] + '/data/vouh/vh'+ sLstTrxDay #创建业务报表文件 bFp = open(rBankFile, "w") records=AfaUtilTools.ListFilterNone( records ) total = len(records) for i in range( len( records ) ): wbuffer = '' wbuffer = wbuffer +(records[i][0].strip()).ljust(8,' ') + "|" wbuffer = wbuffer +(records[i][1].strip()).ljust(8,' ') + "|" wbuffer = wbuffer +(records[i][2].strip()).ljust(8,' ') + "|" wbuffer = wbuffer +(records[i][3].strip()).ljust(10,' ') + "|" wbuffer = wbuffer +(records[i][4].strip()).ljust(10,' ') + "|" #写入报表文件 bFp.write(wbuffer + '\n') #关闭文件 bFp.close() sFileName = "vh" + sLstTrxDay dFileName = "TPCZFILE.TP" + sLstTrxDay if not VouhFunc.FormatFile("1",sFileName,dFileName): TradeContext.errorCode, TradeContext.errorMsg= "S999","转换主机对账文件编码异常" raise Exception,TradeContext.errorMsg #上传文件 AfaLoggerFunc.tradeInfo("上传文件") print ">>>上传文件" VouhFunc.putHost("TPCZFILE.TP" + sLstTrxDay) #主机对帐 HostContext.I1SBNO = '3400008889' HostContext.I1USID = '999986' HostContext.I1WSNO = '1234567890' HostContext.I1FINA = "TP" + sLstTrxDay HostContext.I1COUT = total print ">>>主机对帐" if not VouhHostFunc.CommHost('8828'): print ">>>[" + TradeContext.errorCode + "]" + TradeContext.errorMsg print ">>>[" + TradeContext.errorCode + "]" + TradeContext.errorMsg #修改对帐标志 if not UpdChkFlag('0',sLstTrxDay): return Flase return True
VouhFunc.WrtLog('>>>处理结果:修改对帐标志,数据库异常') return False VouhFunc.WrtLog('>>>修改对帐标志 ---> 成功') return True ###########################################主函数########################################### if __name__=='__main__': print('**********中间业务凭证管理操作开始**********') sProcType = sys.argv[1] if ( sProcType == '01' ): VouhFunc.WrtLog('>>>签到') if not UpdStatus(1): sys.exit(-1) elif ( sProcType == '02' ): VouhFunc.WrtLog('>>>签退') if not UpdStatus(0): sys.exit(-1) elif ( sProcType == '03' ): VouhFunc.WrtLog('>>>强行签退') if not UpdStatus(0): sys.exit(-1)
def main( ): AfaLoggerFunc.tradeInfo( '凭证调配['+TradeContext.TemplateCode+']进入' ) #=============前台上送数据=================================== #TradeContext.sBesbNo 机构号 #TradeContext.sBesbSty 机构类型 #TradeContext.sCur 货币代码 #TradeContext.sTellerNo 柜员号 #TradeContext.sVouhType 凭证种类 #TradeContext.sInBesbNo 领用机构号 #TradeContext.sInBesbSty 领用机构类型 #TradeContext.sInTellerNo 领用柜员号 #TradeContext.sStartNo 起始号码 #TradeContext.sEndNo 终止号码 #TradeContext.sRivTeller 对方柜员 #TradeContext.sVouhStatus 凭证状态 #TradeContext.sVouhNum 凭证数量 #TradeContext.sLstTrxDay 最后交易日期 #TradeContext.sLstTrxTime 最后交易时间 #TradeContext.sDepository 库箱标志 try: #=============获取当前系统时间========================== TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( ) TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) #=============获取机构类型========================== HostContext.I1OTSB = TradeContext.sBesbNo #机构号 HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 if(not VouhHostFunc.CommHost('2001')): tradeExit(TradeContext.errorCode, TradeContext.errorMsg) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): SBNO = HostContext.O1SBCH AfaLoggerFunc.tradeInfo( '交易机构类型' ) AfaLoggerFunc.tradeInfo( SBNO ) #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 #=============获取领用机构类型========================== HostContext.I1OTSB = TradeContext.sInBesbNo #领用机构号 HostContext.I1SBNO = TradeContext.sInBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 if(not VouhHostFunc.CommHost('2001')): return VouhFunc.ExitThisFlow( TradeContext.errorCode, TradeContext.errorMsg ) if(TradeContext.errorCode == '0000'): INSBNO = HostContext.O1SBCH AfaLoggerFunc.tradeInfo( '领用机构类型' ) AfaLoggerFunc.tradeInfo( INSBNO ) #begin凭证优化更改201109 #=============获取领用柜员尾箱号=============================== HostContext.I1SBNO = TradeContext.sBesbNo #机构号 机构号送交易机构号 #HostContext.I1USID = TradeContext.sInTellerNo #柜员号 HostContext.I1USID = '999996' #柜员号 柜员号送自动柜员 HostContext.I1WSNO = TradeContext.sWSNO #终端号 HostContext.I1EDDT = TradeContext.sLstTrxDay #终止日期 HostContext.I1TELR = TradeContext.sInTellerNo #柜员代号 if(not VouhHostFunc.CommHost('0104')): VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg ) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): TradeContext.sInTellerTailNobak = HostContext.O2CABO TradeContext.sInTellerTailNo = TradeContext.sInTellerTailNobak[0] AfaLoggerFunc.tradeInfo( '领用柜员尾箱号:' + TradeContext.sInTellerTailNo ) #end #================拆包======================== 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.sRivTeller = TradeContext.sInTellerTailNo #=============生成流水号======================== TradeContext.sVouhSerial = VouhFunc.GetVouhSerial( ) #=============定义变量============================================================= #31联社清算中心 32联社营业部 33联社财务部 40信用社/支行 50分社/分理处/储蓄所 #1.分行管理库 2.支行管理库 3.网点管理库 4.柜员凭证箱 if(SBNO=='33'): TradeContext.sExDepos = '1' #原库箱标志 elif(SBNO=='31' or SBNO=='40' or SBNO=='32' or SBNO=='41'): TradeContext.sExDepos = '2' #原库箱标志 elif(SBNO=='50'): TradeContext.sExDepos = '3' #原库箱标志 else: VouhFunc.tradeExit('A005061', '该机构柜员不能进行此操作!') raise AfaFlowControl.flowException( ) if(INSBNO=='33'): TradeContext.sDepository = '1' #库箱标志 elif(INSBNO=='31' or INSBNO=='40' or INSBNO=='32' or INSBNO=='41'): TradeContext.sDepository = '2' #库箱标志 elif(INSBNO=='50'): TradeContext.sDepository = '3' #库箱标志 else: VouhFunc.tradeExit('A005061', '该机构柜员不能进行此操作!') raise AfaFlowControl.flowException( ) if(INSBNO=='33'): TradeContext.sVouhStatus = '0' #状态 0.已入未发 2.已发未领 TradeContext.sExStatus = '2' #原状态 elif(SBNO=='33'): TradeContext.sVouhStatus = '2' #状态 0.已入未发 2.已发未领 TradeContext.sExStatus = '0' #原状态 else: TradeContext.sVouhStatus = '2' #状态 0.已入未发 2.已发未领 TradeContext.sExStatus = '2' #原状态 TradeContext.sTransType = '凭证调配' #================判断是否隔级机构调配=================================================== if((SBNO =='33' and INSBNO=='50') or (SBNO =='50' and INSBNO=='33') or (SBNO =='31' and INSBNO=='50') or (SBNO =='50' and INSBNO=='31') or (SBNO =='50' and INSBNO=='50') or (SBNO =='32' and INSBNO=='32') or (SBNO =='31' and INSBNO=='31') or (SBNO =='41' and INSBNO=='41') or (SBNO =='40' and INSBNO=='40')): VouhFunc.tradeExit('A005061', '该机构柜员不能进行此操作!') raise AfaFlowControl.flowException( ) #================判断是否同级机构=================================================== if((SBNO =='31' and INSBNO=='40') or (SBNO =='40' and INSBNO=='31') or (SBNO =='31' and INSBNO=='32') or (SBNO =='32' and INSBNO=='31') or (SBNO =='40' and INSBNO=='32') or (SBNO =='32' and INSBNO=='40') or (SBNO =='41' and INSBNO=='32') or (SBNO =='41' and INSBNO=='31') or (SBNO =='32' and INSBNO=='41') or (SBNO =='31' and INSBNO=='41')): VouhFunc.tradeExit('A005061', '该机构柜员不能进行此操作!') raise AfaFlowControl.flowException( ) #================判断领用机构的清算上级是否是调拨凭证的机构号========================= if((SBNO =='40' and INSBNO=='50') or (SBNO =='32' and INSBNO=='50') or (SBNO =='41' and INSBNO=='50')): if(TradeContext.sBesbNo <> VouhFunc.SelectSBTPAC(TradeContext.sInBesbNo)): VouhFunc.tradeExit('A005061', '该机构柜员不能进行此操作!') raise AfaFlowControl.flowException( ) #================机构号的清算上级是否是领用机构号===================================== if((SBNO =='50' and INSBNO=='40') or (SBNO =='50' and INSBNO=='32') or (SBNO =='50' and INSBNO=='41')): if(TradeContext.sInBesbNo <> VouhFunc.SelectSBTPAC(TradeContext.sBesbNo)): VouhFunc.tradeExit('A005061', '该机构柜员不能进行此操作!') raise AfaFlowControl.flowException( ) if((TradeContext.sBesbNo)[:6] <> (TradeContext.sInBesbNo)[:6]): VouhFunc.tradeExit('A005061', '该机构柜员不能进行此操作!') raise AfaFlowControl.flowException( ) #交易公共部分 AfaLoggerFunc.tradeInfo( TradeContext.sExDepos ) VouhFunc.VouhTrans() #更新凭证变更登记薄 VouhFunc.VouhModify() #数据库提交 AfaDBFunc.CommitSql( ) #主机记账 AfaLoggerFunc.tradeInfo( '------------主机记账' ) TradeContext.sOperSty = '2' VouhHostFunc.VouhCommHost() TradeContext.sTranStatus = '0' AfaLoggerFunc.tradeInfo( '=======================12'+TradeContext.errorCode ) if(TradeContext.errorCode <> '0000'): tmpErrorCode= TradeContext.errorCode tmpErrorMsg = TradeContext.errorMsg #冲正 #=============置凭证操作状态及库箱标志==================== tmpDepos = TradeContext.sDepository TradeContext.sDepository = TradeContext.sExDepos TradeContext.sExDepos = tmpDepos tmpStatus = TradeContext.sVouhStatus TradeContext.sVouhStatus = TradeContext.sExStatus TradeContext.sExStatus = tmpStatus TradeContext.sRivTeller = ' ' #对方柜员 TradeContext.sTransType = '冲正' tmpTeller = TradeContext.sInTellerTailNo TradeContext.sInTellerTailNo = TradeContext.sTellerTailNo TradeContext.sTellerTailNo = tmpTeller tmpBesbNo = TradeContext.sInBesbNo TradeContext.sInBesbNo = TradeContext.sBesbNo TradeContext.sBesbNo = tmpBesbNo #交易公共部分 VouhFunc.VouhTrans() AfaDBFunc.CommitSql( ) TradeContext.sTranStatus = '1' if(not TradeContext.existVariable( "HostSerno" )): TradeContext.HostSerno = '' #更新流水表 VouhFunc.ModifyVouhModify() AfaLoggerFunc.tradeInfo( '============================自动冲正!' ) VouhFunc.tradeExit(tmpErrorCode, tmpErrorMsg) raise AfaFlowControl.flowException( ) #更新流水表 VouhFunc.ModifyVouhModify() TradeContext.tradeResponse.append( ['sVouhSerial',TradeContext.sVouhSerial] ) TradeContext.tradeResponse.append( ['sVouhType',TradeContext.rVouhType] ) TradeContext.tradeResponse.append( ['sVouhName',TradeContext.rVouhName] ) TradeContext.tradeResponse.append( ['sStartNo',TradeContext.rStartNo] ) TradeContext.tradeResponse.append( ['sEndNo',TradeContext.rEndNo] ) TradeContext.tradeResponse.append( ['sVouhNum',TradeContext.rVouhNum] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['sNum',str(TradeContext.sNum)] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) #自动打包 AfaFunc.autoPackData() #=============程序退出========================================= AfaLoggerFunc.tradeInfo( '凭证调配['+TradeContext.TemplateCode+']退出' ) except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( )
def main( ): AfaLoggerFunc.tradeInfo( '凭证使用查询['+TradeContext.TemplateCode+']进入' ) #=============前台上送数据=================================== #TradeContext.sVouhNo 凭证号码 #TradeContext.sVouhType 凭证种类 #TradeContext.sBESBNO 机构号 #TradeContext.sTellerNo 柜员号 #TradeContext.sStartNo 起始号码 #TradeContext.sEndNo 终止号码 #TradeContext.sRivTeller 对方柜员 #TradeContext.sVouhStatus 凭证状态 #TradeContext.sVouhNum 凭证数量 #TradeContext.sLstTrxDay 最后交易日期 #TradeContext.sLstTrxTime 最后交易时间 #TradeContext.sDepository 库箱标志 #TradeContext.sVouhName 凭证名称 try: #=============初始化返回报文变量======================== TradeContext.tradeResponse = [] #=============获取当前系统时间========================== TradeContext.sLstTrxDay = AfaUtilTools.GetSysDate( ) TradeContext.sLstTrxTime = AfaUtilTools.GetSysTime( ) #begin凭证优化更改201109 #=============获取柜员尾箱号=============================== HostContext.I1SBNO = TradeContext.sBesbNo #机构号 HostContext.I1USID = TradeContext.sTellerNo #柜员号 HostContext.I1WSNO = TradeContext.sWSNO #终端号 HostContext.I1EDDT = TradeContext.sLstTrxDay #终止日期 HostContext.I1TELR = TradeContext.sTellerNo #柜员代号 if(not VouhHostFunc.CommHost('0104')): VouhFunc.tradeExit( TradeContext.errorCode, TradeContext.errorMsg ) raise AfaFlowControl.flowException( ) if(TradeContext.errorCode == '0000'): TradeContext.sTellerTailNobak = HostContext.O2CABO TradeContext.sTellerTailNo = TradeContext.sTellerTailNobak[0] AfaLoggerFunc.tradeInfo( '交易柜员尾箱号:' + TradeContext.sTellerTailNo ) #end #==============判断凭证状态=========================================== sqlStr = "SELECT VOUHTYPE,VOUHNAME,BESBNO FROM VOUH_PARAMETER WHERE (SUBSTR(BESBNO,1,6) = '"+ (TradeContext.sBesbNo)[:6] +"' \ or BESBNO ='3400008887')" if (len(TradeContext.sVouhType)!=0 and len(TradeContext.sVouhType)!=0): sqlStr = sqlStr + " AND VOUHTYPE = '" + TradeContext.sVouhType + "' AND STATUS = '1'" 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( ) #===================判断是否为连续号段======================================= sqlStr = "select STARTNO,ENDNO,LSTTRXDAY,LSTTRXTIME,RIVTELLER,TELLERNO \ from VOUH_REGISTER \ where VOUHTYPE = '" + TradeContext.sVouhType+ "' \ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '3' \ and ( ENDNO >= '" + TradeContext.sEndNo + "' and STARTNO <= '" + TradeContext.sStartNo + "' )" records = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeDebug(sqlStr) if( records == None ): #查询凭证登记表异常 tradeExit('A005061', '查询[凭证登记表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( records ) == 0 ): #如果凭证登记表中无对应记录 tradeExit('A005067', '凭证操作失败,凭证库中不存在本次操作的凭证!') raise AfaFlowControl.flowException( ) TradeContext.sVouhNo=TradeContext.sStartNo sqlStr = "select STARTNO,ENDNO from VOUH_REGISTER \ where TELLERNO = '" + TradeContext.sTellerTailNo + "' \ and BESBNO = '" + TradeContext.sBesbNo + "'\ and VOUHTYPE = '" + TradeContext.sVouhType + "'\ and VOUHSTATUS = '3' \ and STARTNO = '" + TradeContext.sVouhNo + "'" records = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeDebug(sqlStr) if( records == None ): #查询凭证登记表异常 tradeExit('A005061', '查询[凭证登记表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( records ) == 0 ): #如果凭证登记表中无对应记录 tradeExit('A005067', '凭证操作失败,凭证库中不存在本次操作的凭证!') sStatus = '1' #raise AfaFlowControl.flowException( ) else : vouhNos = [] for i in range(len(records)): vouhNos.append(int(records[i][0])) if(int(TradeContext.sVouhNo)== min(vouhNos)): tradeExit('0000', '凭证号码确认无误!') sStatus = '0' else: tradeExit('A005061', '凭证号码错误!!') sStatus = '1' #raise AfaFlowControl.flowException( ) TradeContext.tradeResponse.append( ['sVouhType',TradeContext.sVouhType] ) TradeContext.tradeResponse.append( ['sVouhName',''] ) TradeContext.tradeResponse.append( ['sStartNo',TradeContext.sVouhNo] ) TradeContext.tradeResponse.append( ['sEndNo',TradeContext.sVouhNo] ) TradeContext.tradeResponse.append( ['sVouhNum','1'] ) TradeContext.tradeResponse.append( ['sStatus',sStatus] ) TradeContext.tradeResponse.append( ['sLstTrxDay',TradeContext.sLstTrxDay] ) TradeContext.tradeResponse.append( ['sLstTrxTime',TradeContext.sLstTrxTime] ) TradeContext.tradeResponse.append( ['sNum','1'] ) TradeContext.tradeResponse.append( ['errorCode','0000'] ) TradeContext.tradeResponse.append( ['errorMsg','交易成功'] ) #自动打包 AfaFunc.autoPackData() #=============程序退出========================================= AfaLoggerFunc.tradeInfo( '凭证使用查询['+TradeContext.TemplateCode+']退出' ) except AfaFlowControl.flowException, e: AfaFlowControl.exitMainFlow( )
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( )