def update( update_dict,where_dict ): if not chk(update_dict): return -1 if not chk(where_dict): return -1 updatesql = "" for update_item in update_dict.keys(): if table_dict[update_item] == 'S': updatesql = updatesql + update_item + " = '" + update_dict[update_item] + "'," else: updatesql = updatesql + update_item + " = " + str(update_dict[update_item]) + "," wheresql = "" for where_item in where_dict.keys(): if table_dict[where_item] == 'S': #begin 20110215 蔡永贵修改 #wheresql = wheresql + where_item + " LIKE '" + where_dict[where_item] + "' and " wheresql = wheresql + where_item + " LIKE '%" + where_dict[where_item] + "' and " #end else: wheresql = wheresql + where_item + " = " + str(where_dict[where_item]) + " and " sql = "UPDATE rcc_bilinf SET " + updatesql[0:-1] + " WHERE " + wheresql[0:-5] AfaLoggerFunc.tradeInfo(sql) return AfaDBFunc.UpdateSql( sql )
def UpdatePreDtl( action ): AfaLoggerFunc.tradeInfo( '更新原交易流水' ) sql="UPDATE FS_MAINTRANSDTL SET " if( action == 'BANK' ): sql=sql+" BANKSTATUS='3' " elif( action == 'CORP' ): sql=sql+" CORPSTATUS='3' " elif( action == 'TRADE' ): sql=sql+" BANKSTATUS='3' ,CORPSTATUS='3'" else: TradeContext.errorCode, TradeContext.errorMsg='A0041', '入口参数条件不符,没有这种类型的操作' return False sql=sql+" WHERE SERIALNO='"+TradeContext.preAgentSerno+ \ "' AND WORKDATE='"+TradeContext.workDate+"' AND REVTRANF='0'" ret=AfaDBFunc.UpdateSql( sql ) if( ret >0 ): return True AfaLoggerFunc.tradeFatal( sql ) if( ret == 0 ): TradeContext.errorCode, TradeContext.errorMsg='A0100', '未发现原始交易' else : TradeContext.errorCode, TradeContext.errorMsg='A0100', '更新流水主表原交易记录失败'+AfaDBFunc.sqlErrMsg return False
def closeCron(taskid): #======================查询系统调度信息================================ sql = "SELECT * FROM AFA_CRONADM WHERE TASKID = '" + taskid + "'" records = AfaDBFunc.SelectSql(sql) if records == None: rccpsCronFunc.WrtLog( AfaDBFunc.sqlErrMsg ) WrtLog("获取系统调度[" + taskid + "]信息异常") return False if len(records) <= 0: WrtLog("系统调度表中无此调度信息[" + taskid + "]") return False #======================修改系统调度状态为0============================= sql = "UPDATE AFA_CRONADM SET STATUS = '0' WHERE TASKID = '" + taskid + "'" if not AfaDBFunc.UpdateSql(sql): rccpsCronFunc.WrtLog( AfaDBFunc.sqlErrMsg ) WrtLog("关闭系统调度[" + taskid + "]异常") return False WrtLog("关闭系统调度[" + taskid + "]成功") return True
def VouhTrans( ): #===定义变量-输入的凭证号码与库表中状态为‘1’(已出未入)的凭证号码的连续标志====== #sFlagContinue:continue:前后连续; #sFlagContinue:FrontContinue:前连续; #sFlagContinue:BackContinue:后连续; sFlagContinue = '' #=============进入凭证出库交易========================== #1.查询需要出库的凭证起止号码是否在库表中已入未发的凭证号码范围内 #2.如果需要出库的凭证起止号码在库表中可出库的凭证号码范围内,那么需要 # 判断库表中满足凭证状态为已发未领,地区号与签到柜员所在地区一致这几个条件的记录 #与输入的凭证号码是否有连续关系 #3.如果无连续关系,那么需要判断输入的凭证起止号码与库表中相应的凭证号码区间的关系 # 1)输入的起始号码与区间的起始号码相同. 2)输入的终止号码与区间的结束号码相同 # 3)输入的起始号码和终止号码与区间起始和结束号码都相同. 4)输入的起止号码完全在区间之内 #4.如果有连续关系,那么需要判断输入的凭证起止号码与库表中凭证状态为已发未领的 #凭证号码之间的关系 1) 前连续 2)后连续 3)前后连续 for i in range(TradeContext.sNum): #begin凭证优化201202 李利君 Len='' Len = int(len(TradeContext.sStartNo[i])) #=============计算输入的凭证数量========================== sStartNoMulti = str(int( TradeContext.sStartNo[i] ) - 1).rjust(Len,'0') sEndNoAdd = str(int( TradeContext.sEndNo[i] ) + 1).rjust(Len,'0') #end #查询数据库[凭证登记表],确认是否输入的凭证起始号码,终止号码在该柜员登陆分行 #登记未出状态的凭证号码段内 sqlStr = "select STARTNO,ENDNO,LSTTRXDAY,LSTTRXTIME,RIVTELLER,TELLERNO \ from VOUH_REGISTER \ where VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and CUR = '" + TradeContext.sCur + "'\ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and ( ENDNO >= '" + TradeContext.sEndNo[i] + "' and STARTNO <= '" + TradeContext.sStartNo[i] + "' )" records = AfaDBFunc.SelectSql( sqlStr ) AfaLoggerFunc.tradeDebug(sqlStr) if( records == None ): #查询凭证登记表异常 if( i > 0 ): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit('A005061', '查询[凭证登记表]操作异常!') raise AfaFlowControl.flowException( ) elif( len( records ) == 0 ): #如果凭证登记表中无对应记录 if( i > 0 ): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit('A005067', '凭证操作失败,凭证库中不存在本次操作的凭证!') raise AfaFlowControl.flowException( ) else : records = AfaUtilTools.ListFilterNone( records ) sTempStartNo = records[0][0] #保存输入的凭证号码所在的区间起始凭证号码 sTempEndNo = records[0][1] #保存输入的凭证号码所在的区间终止凭证号码 sTempLstTrxDay = records[0][2] #保存输入的凭证号码所在的区间最后交易日期 sTempLstTrxTime = records[0][3] #保存输入的凭证号码所在的区间最后交易时间 sTempRivTeller = records[0][4] #保存输入的凭证号码所在的区间对方柜员 sTempTellerNo = records[0][5] #保存输入的凭证号码所在的区间对方柜员 #当输入的凭证起止号码为合法号码时,查询库表中满足状态为已发未领, #柜员号地区号与签到柜员所在地区一致的条件的记录与输入的凭证号码是否有连续关系 sqlStr = "select STARTNO,ENDNO from VOUH_REGISTER \ where VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and BESBNO = '" + TradeContext.sInBesbNo + "'\ and TELLERNO = '" + TradeContext.sInTellerTailNo + "'\ and CUR = '" + TradeContext.sCur + "'\ and DEPOSITORY = '" + TradeContext.sDepository + "'\ and VOUHSTATUS = '"+ TradeContext.sVouhStatus+ "' \ and ( ENDNO = '" + sStartNoMulti + "' \ OR STARTNO = '" + sEndNoAdd + "' )" AfaLoggerFunc.tradeDebug(sqlStr) records = AfaDBFunc.SelectSql( sqlStr ) records = AfaUtilTools.ListFilterNone( records ) if( records == None ): #查询凭证登记表异常 if( i > 0 ): AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit('A005061', '查询[凭证登记表]操作异常!') raise AfaFlowControl.flowException( ) #输入的凭证号码与库中已存在的状态为登记未出的凭证号码无连续关系 elif( len( records ) == 0 ): #输入的起始号码和终止号码与区间起始和结束号码都相同 if ( int( TradeContext.sEndNo[i] ) == int( sTempEndNo ) \ and int( TradeContext.sStartNo[i] ) == int( sTempStartNo ) ): #直接更新对应记录 sqlStr = "update VOUH_REGISTER set \ DEPOSITORY = '"+TradeContext.sDepository+"',\ VOUHSTATUS = '"+ TradeContext.sVouhStatus+ "',\ BESBNO = '" + TradeContext.sInBesbNo + "', \ TELLERNO = '" + TradeContext.sInTellerTailNo + "', \ RIVTELLER = '" + TradeContext.sTellerTailNo + "', \ LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\ LSTTRXTIME = '" + TradeContext.sLstTrxTime + "'" sqlStr = sqlStr + " where STARTNO = '" + TradeContext.sStartNo[i] + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR = '"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug('1'+sqlStr) records = AfaDBFunc.UpdateSql( sqlStr ) if records == -1 or records == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: tradeExit('0000', TradeContext.sTransType+'成功') #输入的终止号码与区间的结束号码相同 elif ( int( TradeContext.sEndNo[i] ) == int( sTempEndNo ) ): #更新数据库中已存记录,更新成功后再新增出库记录 sqlStr = "update VOUH_REGISTER set \ VOUHNUM = '"+ ( str( int( TradeContext.sStartNo[i] ) - int( sTempStartNo ) ) )+ "',\ ENDNO = '" + sStartNoMulti + "'" sqlStr = sqlStr + " where STARTNO = '" + sTempStartNo + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug('2'+sqlStr) records = AfaDBFunc.UpdateSql( sqlStr ) if records == -1 or records == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: #更新成功后再新增出库记录 sqlStr = "insert into VOUH_REGISTER \ (BESBNO,TELLERNO,DEPOSITORY,CUR,VOUHTYPE,STARTNO,ENDNO,RIVTELLER,\ VOUHSTATUS,VOUHNUM,LSTTRXDAY,LSTTRXTIME) \ values \ ('" + TradeContext.sInBesbNo + "',\ '" + TradeContext.sInTellerTailNo + "','"+TradeContext.sDepository+"','"+ TradeContext.sCur+"',\ '"+ TradeContext.sVouhType[i] + "',\ '" + TradeContext.sStartNo[i] + "','" + sTempEndNo + "',\ '" + TradeContext.sTellerTailNo +"','"+ TradeContext.sVouhStatus+ "',\ '" + TradeContext.sVouhNum[i] + "',\ '" + TradeContext.sLstTrxDay + "','" + TradeContext.sLstTrxTime + "')" record = AfaDBFunc.InsertSql( sqlStr ) if record == -1 or record == 0: AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: #调配成功 tradeExit('0000', TradeContext.sTransType+'成功') #输入的起始号码与区间的起始号码相同 elif ( int( TradeContext.sStartNo[i] ) == int( sTempStartNo ) ): #更新数据库中已存记录,更新成功后再新增出库记录 sqlStr = "update VOUH_REGISTER set \ VOUHNUM = '" + str( int( sTempEndNo ) - int ( TradeContext.sEndNo[i] ) )+ "',\ STARTNO = '" + sEndNoAdd + "'" sqlStr = sqlStr + " where ENDNO = '" + sTempEndNo + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug('3'+sqlStr) records = AfaDBFunc.UpdateSql( sqlStr ) if records == -1 or records == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: #更新成功后再新增出库记录 sqlStr = "insert into VOUH_REGISTER \ (BESBNO,TELLERNO,DEPOSITORY,CUR,VOUHTYPE,STARTNO,ENDNO,RIVTELLER,\ VOUHSTATUS,VOUHNUM,LSTTRXDAY,LSTTRXTIME) \ values \ ('" + TradeContext.sInBesbNo + "',\ '" + TradeContext.sInTellerTailNo + "','"+TradeContext.sDepository+"',\ '" + TradeContext.sCur+"',\ '" + TradeContext.sVouhType[i]+"',\ '" + sTempStartNo + "',\ '" + TradeContext.sEndNo[i] + "','"+TradeContext.sTellerTailNo+"',\ '" + TradeContext.sVouhStatus+ "','" + TradeContext.sVouhNum[i] + "',\ '" + TradeContext.sLstTrxDay + "',\ '" + TradeContext.sLstTrxTime + "')" AfaLoggerFunc.tradeDebug('1'+sqlStr) record = AfaDBFunc.InsertSql( sqlStr ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: #调配成功 tradeExit('0000', TradeContext.sTransType+'成功') #输入的起止号码完全包含在区间之内 else: #1更新数据库中已存记录,更新成功后再新增出库记录和相应登记未出状态记录 sqlStr = "update VOUH_REGISTER set \ VOUHNUM = '" + str( int( TradeContext.sStartNo[i] ) - int( sTempStartNo ) ) + "',\ ENDNO = '" + sStartNoMulti + "'" sqlStr = sqlStr + " where STARTNO = '" + sTempStartNo + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug('4'+sqlStr) records = AfaDBFunc.UpdateSql( sqlStr ) if records == -1 or records == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', '新增[凭证登记表]基本信息失败!') raise AfaFlowControl.flowException( ) #2##############更新成功后再新增出库记录########################################### sqlStr = "insert into VOUH_REGISTER \ (BESBNO,TELLERNO,DEPOSITORY,CUR,VOUHTYPE,STARTNO,ENDNO,RIVTELLER,\ VOUHSTATUS,VOUHNUM,LSTTRXDAY,LSTTRXTIME) \ values \ ('" + TradeContext.sInBesbNo + "',\ '" + TradeContext.sInTellerTailNo + "','"+TradeContext.sDepository+"',\ '" + TradeContext.sCur+"',\ '" + TradeContext.sVouhType[i]+"',\ '" + TradeContext.sStartNo[i] + "',\ '" + TradeContext.sEndNo[i] + "','"+TradeContext.sTellerTailNo+"',\ '" + TradeContext.sVouhStatus+ "','" + TradeContext.sVouhNum[i] + "',\ '" + TradeContext.sLstTrxDay + "',\ '" + TradeContext.sLstTrxTime + "')" AfaLoggerFunc.tradeDebug('2'+sqlStr) record = AfaDBFunc.InsertSql( sqlStr ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) #3新增新增出库记录成功后,新增相应登记未出状态记录 sqlStr = "insert into VOUH_REGISTER \ (BESBNO,TELLERNO,DEPOSITORY,CUR,VOUHTYPE,STARTNO,ENDNO,RIVTELLER,\ VOUHSTATUS,VOUHNUM,LSTTRXDAY,LSTTRXTIME) \ values \ ('" + TradeContext.sBesbNo + "',\ '" + sTempTellerNo + "','"+TradeContext.sExDepos+ "','"+TradeContext.sCur+"',\ '" + TradeContext.sVouhType[i]+"',\ '" + sEndNoAdd + "',\ '" + sTempEndNo + "','"+sTempRivTeller+"',\ '"+ TradeContext.sExStatus+ "',\ '" + str( int( sTempEndNo ) - int ( TradeContext.sEndNo[i] ) )+ "',\ '" + sTempLstTrxDay + "',\ '" + sTempLstTrxTime + "')" AfaLoggerFunc.tradeDebug('3'+sqlStr) record = AfaDBFunc.InsertSql( sqlStr ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) #新增成功 tradeExit('0000', '操作成功') else: #判断前后连续关系 #continue:前后连续标识; #FrontContinue:前连续标识; #BackContinue:后连续标识; for x in range( len(records) ): if ( ( int( TradeContext.sStartNo[i] ) - 1 ) == int( records[x][1] ) ): #前连续 sTempStart = records[x][0] #records[x][0]:数据库中满足查询条件的凭证起始号码 if ( sFlagContinue == 'BackContinue' ): sFlagContinue = 'Continue' else: sFlagContinue = 'FrontContinue' if ( (int( TradeContext.sEndNo[i]) + 1 ) == int( records[x][0] ) ): #后连续 sTempEnd = records[x][1] #records[x][1]:数据库中满足查询条件的凭证终止号码 if ( sFlagContinue == 'FrontContinue' ): sFlagContinue = 'Continue' else: sFlagContinue = 'BackContinue' #输入的凭证号码与库表中同凭证状态为登记未出的记录存在后连续关系, #则与相应的记录进行向后归并 if ( sFlagContinue == 'BackContinue' ): #1后连续:更新相应数据库中[凭证登记表]相应记录 sqlStr = "update VOUH_REGISTER set \ VOUHNUM = '" + str( int( sTempEnd ) - int( TradeContext.sStartNo[i] ) + 1 ) + "',\ LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\ LSTTRXTIME = '" + TradeContext.sLstTrxTime + "',\ STARTNO = '" + TradeContext.sStartNo[i] + "'" sqlStr = sqlStr + " where STARTNO = '" + sEndNoAdd + "'\ and TELLERNO = '" + TradeContext.sInTellerTailNo + "' \ and BESBNO = '" + TradeContext.sInBesbNo + "'\ and CUR = '" + TradeContext.sCur + "'\ and DEPOSITORY = '" + TradeContext.sDepository + "'\ and VOUHSTATUS = '"+ TradeContext.sVouhStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "'" AfaLoggerFunc.tradeDebug('5'+sqlStr) records = AfaDBFunc.UpdateSql( sqlStr ) if records == -1 or records == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) #2更新成功后,删除起始号码为sTempStartNo的原记录,输入凭证数量为1 if ( int( sTempStartNo ) == int( TradeContext.sStartNo[i] ) ) : sqlDel = "delete from VOUH_REGISTER \ where STARTNO = '" + sTempStartNo + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug(sqlDel) record = AfaDBFunc.DeleteSql( sqlDel ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: tradeExit('0000', TradeContext.sTransType+'成功') else: #更新成功后,更新终止号码为TradeContext.sEndNo的原记录,输入凭证数量大于1 sqlStr = "update VOUH_REGISTER set \ VOUHNUM = '" + str( int( TradeContext.sStartNo[i] ) - int( sTempStartNo ) )+ "',\ LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\ LSTTRXTIME = '" + TradeContext.sLstTrxTime + "',\ ENDNO = '" + sStartNoMulti + "'" sqlStr = sqlStr + " where ENDNO = '" + TradeContext.sEndNo[i] + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug('6'+sqlStr) record = AfaDBFunc.UpdateSql( sqlStr ) if record == -1 or record == 0: AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) #回滚 tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: tradeExit('0000', '操作成功') #输入的凭证号码与库表中同凭证状态为登记未出存在前连续关系, #则与相应的记录进行向前归并 elif ( sFlagContinue == 'FrontContinue' ): #前连续:更新相应数据库中[凭证登记表]相应记录 sqlStr = "update VOUH_REGISTER set \ VOUHNUM = '" + str( int( TradeContext.sEndNo[i] ) - int( sTempStart ) + 1 ) + "',\ LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\ LSTTRXTIME = '" + TradeContext.sLstTrxTime + "',\ ENDNO = '" + ( TradeContext.sEndNo[i] ) + "'" sqlStr = sqlStr + " where ENDNO = '" + sStartNoMulti + "'\ and TELLERNO = '" + TradeContext.sInTellerTailNo + "' \ and BESBNO = '" + TradeContext.sInBesbNo + "'\ and CUR = '" + TradeContext.sCur + "'\ and DEPOSITORY = '" + TradeContext.sDepository + "'\ and VOUHSTATUS = '"+ TradeContext.sVouhStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "'" AfaLoggerFunc.tradeDebug('7'+sqlStr) records = AfaDBFunc.UpdateSql( sqlStr ) if records == -1 or records == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) AfaDBFunc.RollbackSql( ) #回滚 tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) #2更新成功后,删除起始号码为sTempStartNo的原记录,输入凭证数量为1 if ( int( sTempEndNo ) == int( TradeContext.sEndNo[i] ) ) : sqlDel = "delete from VOUH_REGISTER \ where STARTNO = '" + sTempStartNo + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug(sqlDel) record = AfaDBFunc.DeleteSql( sqlDel ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: #更新成功 tradeExit('0000', '操作成功') else: #更新成功后,更新起始号码为TradeContext.sStartNo的原记录,输入凭证数量大于1 sqlStr = "update VOUH_REGISTER set \ VOUHNUM = '" + str( int( sTempEndNo ) - int( TradeContext.sEndNo[i] ) ) + "',\ LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\ LSTTRXTIME = '" + TradeContext.sLstTrxTime + "',\ STARTNO = '" + sEndNoAdd + "'" sqlStr = sqlStr + " where STARTNO = '" + TradeContext.sStartNo[i] + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug('8'+sqlStr) record = AfaDBFunc.UpdateSql( sqlStr ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) else: #更新成功 tradeExit('0000', '操作成功') #输入的凭证号码与库表中同凭证状态为登记未出存在前后连续关系, #则与相应的记录进行前后归并 elif ( sFlagContinue == 'Continue' ): sTemVouhNum = str( int(sTempEnd) - int(sTempStart) + 1 ) #更新数据库表[凭证登记表]内相应记录 sqlStr = "update VOUH_REGISTER set \ ENDNO = '" + sTempEnd + "', \ VOUHNUM = '" + sTemVouhNum + "',\ LSTTRXDAY = '" + TradeContext.sLstTrxDay + "',\ LSTTRXTIME = '" + TradeContext.sLstTrxTime + "'" sqlStr = sqlStr + " where STARTNO = '" + sTempStart + "' \ and TELLERNO = '" + TradeContext.sInTellerTailNo + "' \ and BESBNO = '" + TradeContext.sInBesbNo + "'\ and CUR = '" + TradeContext.sCur + "'\ and DEPOSITORY = '" + TradeContext.sDepository + "'\ and VOUHSTATUS = '"+ TradeContext.sVouhStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "'" AfaLoggerFunc.tradeDebug('9'+sqlStr) records = AfaDBFunc.UpdateSql( sqlStr ) if records == -1 or records == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) #2归并成功后,删除归并后其余一条 sqlDel = "delete from VOUH_REGISTER \ where STARTNO = '" + TradeContext.sStartNo[i] + "' \ and DEPOSITORY = '" + TradeContext.sExDepos + "'\ and BESBNO = '" + TradeContext.sBesbNo + "'\ and TELLERNO = '" + TradeContext.sTellerTailNo + "'\ and VOUHSTATUS = '" + TradeContext.sExStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "' \ and CUR ='"+ TradeContext.sCur+"'" AfaLoggerFunc.tradeDebug(sqlDel) record = AfaDBFunc.DeleteSql( sqlDel ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) # 3 sqlDel = "delete from VOUH_REGISTER \ where STARTNO = '" + sEndNoAdd + "' \ and TELLERNO = '" + TradeContext.sInTellerTailNo + "' \ and BESBNO = '" + TradeContext.sInBesbNo + "'\ and CUR = '" + TradeContext.sCur + "'\ and DEPOSITORY = '" + TradeContext.sDepository + "'\ and VOUHSTATUS = '"+ TradeContext.sVouhStatus+ "' \ and VOUHTYPE = '" + TradeContext.sVouhType[i]+ "'" AfaLoggerFunc.tradeDebug(sqlDel) record = AfaDBFunc.DeleteSql( sqlDel ) if record == -1 or record == 0 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005062', TradeContext.sTransType+'失败!') raise AfaFlowControl.flowException( ) tradeExit('0000', '操作成功') return True
#sys.exit(-1) continue else: if( record[0][0].strip() != '2' and record[0][0].strip() != '0' and record[0][0].strip() != '1' ): try: sql = "" sql = sql + "update ahnx_file set" sql = sql + " STATUS = '2'," sql = sql + " PROCMSG = '批量已撤销,原因为"+ records[i][3][0:32] +"'" sql = sql + " where APPNO = '"+ records[i][1] +"'" #业务编号 sql = sql + " and BUSINO = '"+ records[i][2] +"'" #单位编号 sql = sql + " and BATCHNO = '"+ records[i][0] +"'" #批次号 AfaLoggerFunc.tradeInfo(sql) result = AfaDBFunc.UpdateSql( sql ) if( result <0 ): AfaLoggerFunc.tradeInfo('更新ahnx_file表失败,批次号为:'+records[i][0]) continue sql = "" sql = sql + "update abdt_batchInfo set" sql = sql + " note5 = '1'" sql = sql + " where APPNO = '"+ records[i][1] +"'" #业务编号 sql = sql + " and BUSINO = '"+ records[i][2] +"'" #单位编号 sql = sql + " and BATCHNO = '"+ records[i][0] +"'" #批次号 AfaLoggerFunc.tradeInfo(sql) result = AfaDBFunc.UpdateSql( sql )
def SubModuleMainFst( ): TradeContext.__agentEigen__ = '0' #从表标志 AfaLoggerFunc.tradeInfo( "中台单位编码信息维护开始" ) #判断操作类型 if TradeContext.opType == '1': AfaLoggerFunc.tradeInfo( "新增" ) sqlstr = "select * from fs_businoinfo where busino='" + TradeContext.busiNo + "'" sqlstr = sqlstr + " and bankno = '" + TradeContext.bankbm + "'" AfaLoggerFunc.tradeInfo('>>>sql=' + sqlstr) records = AfaDBFunc.SelectSql( sqlstr ) if records == None : TradeContext.errorCode = "0001" TradeContext.errorMsg = "查找单位编码信息异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if len(records) >=1 : TradeContext.errorCode = "0001" TradeContext.errorMsg = "已经查找到单位编码信息,不能再次新建" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #首先校验输入账户和名称是否正确 #张恒修改AG2012 sqlstr = "select accno,businame from abdt_unitinfo where appno ='" + TradeContext.appNo + "' and busino='" + TradeContext.busiNo + "'" AfaLoggerFunc.tradeInfo('>>>sql=' + sqlstr) records = AfaDBFunc.SelectSql( sqlstr ) if( records == None or len( records)==0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "没有查找到单位编码账户信息" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False else: if records[0][0].strip() != TradeContext.accno or records[0][1].strip() and records[0][1].strip() != TradeContext.name : TradeContext.errorCode = "0001" TradeContext.errorMsg = "单位编码账户信息不符" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #校验输入银行编码和银行名称是否正确 sqlstr = "select afa102 from fs_fa22 where afa101='" + TradeContext.bankNo + "'" AfaLoggerFunc.tradeInfo('>>>sql=' + sqlstr) records = AfaDBFunc.SelectSql( sqlstr ) if( records == None ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "查找到单位编码账户信息异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if len(records) == 0: TradeContext.errorCode = "0001" TradeContext.errorMsg = "银行编码不存在" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False else: #=====刘雨龙 20080815 新增关于处理银行编码相同多条记录的处理==== for i in range(0,len(records)): if records[i][0].strip() != TradeContext.bankName : TradeContext.errorCode = '0011' TradeContext.errorMsg = '银行编码与银行名称不符' AfaLoggerFunc.tradeInfo('>>>银行名称['+str(records[i][0])+']与柜员上送银行名称['+TradeContext.bankName+']不符') if int(len(records)-1) == i: return False else: AfaLoggerFunc.tradeInfo('>>>银行名称['+str(records[i][0])+']与柜员上送银行名称['+TradeContext.bankName+']相符') break #if records[0][0].strip() != TradeContext.bankName : # TradeContext.errorCode = "0001" # TradeContext.errorMsg = "银行编码与银行名字不符" # AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) # return False #校验财政区划信息 sqlstr = "select aaa012 from fs_aa11 where aaa010='" + TradeContext.AAA010 + "'" AfaLoggerFunc.tradeInfo('>>>sql=' + sqlstr) records = AfaDBFunc.SelectSql( sqlstr ) AfaLoggerFunc.tradeInfo(str(records)) if( records == None ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "查找到单位编码财政区划信息异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if len(records) == 0: TradeContext.errorCode = "0001" TradeContext.errorMsg = "财政区划内码不存在" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False else: if records[0][0].strip() != TradeContext.AAA012 : TradeContext.errorCode = "0001" TradeContext.errorMsg = "财政区划内码与财政区划名称不符" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( records[0][0].strip() ) return False #通过校验,插入到数据库中 sqlstr = "insert into fs_businoinfo ( BUSINO,ACCNO,NAME,AAA010,AAA012,BANKNO,BANKNAME,BANKBRNO,BRNO,TELLER,DATE,TIME,CTRYBANKNO,CTRYBANKNAME ) values(" sqlstr = sqlstr + "'" + TradeContext.busiNo + "'," sqlstr = sqlstr + "'" + TradeContext.accno + "'," sqlstr = sqlstr + "'" + TradeContext.name + "'," sqlstr = sqlstr + "'" + TradeContext.AAA010 + "'," sqlstr = sqlstr + "'" + TradeContext.AAA012 + "'," sqlstr = sqlstr + "'" + TradeContext.bankNo + "'," sqlstr = sqlstr + "'" + TradeContext.bankName + "'," sqlstr = sqlstr + "'" + TradeContext.busiNo[0:10]+ "'," sqlstr = sqlstr + "'" + TradeContext.brno + "'," sqlstr = sqlstr + "'" + TradeContext.teller + "'," sqlstr = sqlstr + "'" + TradeContext.workDate + "'," sqlstr = sqlstr + "'" + TradeContext.workTime + "'," sqlstr = sqlstr + "''," sqlstr = sqlstr + "'')" AfaLoggerFunc.tradeInfo('>>>sql=' + sqlstr) if( AfaDBFunc.InsertSql( sqlstr ) < 1 ): AfaDBFunc.RollbackSql( ) TradeContext.errorCode,TradeContext.errorMsg = "0001",'插入单位编码信息表失败' + sqlstr AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) return False AfaDBFunc.CommitSql( ) #修改 elif TradeContext.opType == '2': AfaLoggerFunc.tradeInfo( "修改" ) sqlstr = "update fs_businoinfo set accno='" + TradeContext.accno + "',name='" + TradeContext.name + "'," + \ "aaa010='" + TradeContext.AAA010 + "',aaa012='" + TradeContext.AAA012 + "',date='" + TradeContext.workDate + "'," + \ "time='" + TradeContext.workTime + "',brno='" + TradeContext.brno + "',teller='" + TradeContext.teller + "'," + \ "bankno = '" + TradeContext.bankNo + "' where busino='" + TradeContext.busiNo + "'" #=====刘雨龙 20080821 新增修改参数==== AfaLoggerFunc.tradeInfo('>>>sql=' + sqlstr) if( AfaDBFunc.UpdateSql( sqlstr ) < 1 ): AfaDBFunc.RollbackSql( ) TradeContext.errorCode,TradeContext.errorMsg = "0001",'更新单位编码信息表失败' + sqlstr AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) return False AfaDBFunc.CommitSql( ) #删除 elif TradeContext.opType == '3': AfaLoggerFunc.tradeInfo( "删除" ) sqlstr = "delete from fs_businoinfo where busino='" + TradeContext.busiNo + "'" AfaLoggerFunc.tradeInfo('>>>sql=' + sqlstr) if( AfaDBFunc.DeleteSql( sqlstr ) < 1 ): AfaDBFunc.RollbackSql( ) TradeContext.errorCode,TradeContext.errorMsg = "0001",'删除单位编码信息表失败' + sqlstr AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) return False AfaDBFunc.CommitSql( ) TradeContext.errorCode,TradeContext.errorMsg = "0000",'操作单位编码信息表成功' AfaLoggerFunc.tradeInfo( "********************中台单位编码信息维护结束***************" ) return True
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 SubModuleMainFst( ): TradeContext.__agentEigen__ = '0' #从表标志 #------------------------数据格式转化-------------- tmpDataList = [k for k in TradeContext.AFC001.split(':') if k] #将前台上送字段AFC001,可能为 1::::2::::3这样的结构,这两行代码将空的去掉,最终变成1:2:3这样的结构 TradeContext.AFC001 = ':'.join(tmpDataList) tmpDataList = [k.strip() for k in TradeContext.NOFEE.split(':') if ( k.strip() != '0.00' and k.strip() != '' )] #将前台上送字段AFC001,可能为 1::::2::::3这样的结构,这两行代码将空的去掉,最终变成1:2:3这样的结构 TradeContext.NOFEE = ':'.join(tmpDataList) tmpDataList = [k for k in TradeContext.AFC401.split(':') if k] #将前台上送字段AFC001,可能为 1::::2::::3这样的结构,这两行代码将空的去掉,最终变成1:2:3这样的结构 TradeContext.AFC401 = ':'.join(tmpDataList) tmpDataList = [k.strip() for k in TradeContext.AFC011.split(':') if ( k.strip() != '0.00' and k.strip() != '' )] #将前台上送字段AFC001,可能为 1::::2::::3这样的结构,这两行代码将空的去掉,最终变成1:2:3这样的结构 TradeContext.AFC011 = ':'.join(tmpDataList) AfaLoggerFunc.tradeInfo( '缴款书编号:' + TradeContext.AFC001 ) AfaLoggerFunc.tradeInfo( '缴款书金额:' + TradeContext.NOFEE ) AfaLoggerFunc.tradeInfo( '流水号码:' + TradeContext.AFC401 ) AfaLoggerFunc.tradeInfo( '流水金额:' + TradeContext.AFC011 ) #如果不是主办行,不能做此交易 sqlstr = "select brno from abdt_unitinfo where appno='" + TradeContext.appNo + "' and busino='" + TradeContext.busiNo + "' and brno='" + TradeContext.brno + "'" AfaLoggerFunc.tradeInfo(sqlstr) records = AfaDBFunc.SelectSql( sqlstr ) if records == None: TradeContext.errorCode = "0001" TradeContext.errorMsg = "操作数据库异常" AfaLoggerFunc.tradeInfo(sqlstr+AfaDBFunc.sqlErrMsg) return False if( len( records)==0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "不是主办行,不能做此交易" AfaLoggerFunc.tradeInfo(sqlstr+AfaDBFunc.sqlErrMsg) return False #if ( not TradeContext.AFC401 ): # TradeContext.errorCode,TradeContext.errorMsg = "0002","流水号码不能空" # return False AfaLoggerFunc.tradeInfo( "********************中台勾对开始***************" ) #---------------------------勾对之前确定是否清分过,如果没有清分过不允许做勾对交易 for item in TradeContext.AFC401.split(":"): sqlstr = "select * from fs_fc74 where afc401 like '%" + item + "%' and flag ='*' and afc015='" + TradeContext.AFC015 + "' and BUSINO='" + TradeContext.busiNo + "'" #===条件增加银行编码字段,张恒修改=== sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'" records = AfaDBFunc.SelectSql( sqlstr ) if records == None: TradeContext.errorCode = "0001" TradeContext.errorMsg = "操作数据库异常" AfaLoggerFunc.tradeInfo(sqlstr+AfaDBFunc.sqlErrMsg) return False if( len( records)>0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "流水号%s没有做清分不能勾对" %item AfaLoggerFunc.tradeInfo(sqlstr+AfaDBFunc.sqlErrMsg) return False #----------------------------勾对之前确定是否缴过费,如果缴过费不允许勾对-------------------- AfaLoggerFunc.tradeInfo( '判断缴款书编号是否缴过费' ) for item in TradeContext.AFC001.split(":"): sqlstr = "select flag from fs_fc76 where afc001='" + item + "'" #===条件增加银行编码字段,张恒修改=== sqlstr = sqlstr + " and afc153 = '" + TradeContext.bankbm + "'" records = AfaDBFunc.SelectSql( sqlstr ) if ( len(records) == 0 ): AfaLoggerFunc.tradeInfo( "缴款书编号没有缴费%s可以勾对" %item ) AfaLoggerFunc.tradeInfo( sqlstr ) else: if records[0][0] == '0': TradeContext.errorCode,TradeContext.errorMsg = '0001','交款书编号%s已经缴费不能勾对' %item AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #------------------------------如果操作类型是新建,首先检验是否勾对过,添加到数据库中--------------------- if TradeContext.opType == '1': for item in TradeContext.AFC401.split(":"): #-----------------检测流水号码是否勾对过-------------------- sqlstr = "select afc001 from fs_fc74 where afc401 = '" + item + "' and afc015='" + TradeContext.AFC015 + "' and BUSINO='" + TradeContext.busiNo + "' and length(afc001)=0 and flag!='*'" #===条件增加银行编码字段,张恒修改=== sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'" records = AfaDBFunc.SelectSql( sqlstr ) if( records == None ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "数据库异常:待查表" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if( len( records)==0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "流水号码%s已经勾对过" %item AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( sqlstr ) return False for payNo in TradeContext.AFC001.split(':'): #------------------检测缴款书编号是否勾对过-------------------- sqlstr = "select afc001 from fs_fc74 where afc001 like '%" + payNo + "%' and flag!='*' and BUSINO='" + TradeContext.busiNo + "'" #===条件增加银行编码字段,张恒修改=== sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'" records = AfaDBFunc.SelectSql( sqlstr ) if( records == None ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "数据库异常:待查表" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if( len( records)>0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "缴款书编号%s已经勾对过" %payNo AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #-------------------将数据添加到数据库中------------------------------------ for item in TradeContext.AFC401.split(":"): sqlstr = "update fs_fc74 set afc001='" + TradeContext.AFC001 + "',nofee='" + TradeContext.NOFEE + "',flag='0' where afc401='" + item + "' and afc015='" + TradeContext.AFC015 + "' and BUSINO='" + TradeContext.busiNo + "'" #===条件增加银行编码字段,张恒修改=== sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'" AfaLoggerFunc.tradeInfo( sqlstr ) if( AfaDBFunc.UpdateSql( sqlstr ) < 1 ) : AfaDBFunc.RollbackSql() TradeContext.errorCode, TradeContext.errorMsg='0001', '更新待查数据表失败' AfaLoggerFunc.tradeInfo( sqlstr+AfaDBFunc.sqlErrMsg ) return False AfaDBFunc.CommitSql( ) #-------------操作类型是删除---------------- elif TradeContext.opType == '2': #------------------------------删除待查表中的数据--------------------------- for item in TradeContext.AFC401.split(":"): sqlstr = "update fs_fc74 set afc001='',nofee='',flag='1' where afc401='" + item + "' and afc015='" + TradeContext.AFC015 + "'" #===条件增加银行编码字段,张恒修改=== sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'" AfaLoggerFunc.tradeInfo( sqlstr ) if( AfaDBFunc.UpdateSql( sqlstr ) < 1 ) : AfaDBFunc.RollbackSql() TradeContext.errorCode, TradeContext.errorMsg='0001', '更新待查数据表失败' AfaLoggerFunc.tradeInfo( sqlstr+AfaDBFunc.sqlErrMsg ) return False AfaDBFunc.CommitSql( ) #-----------------------开始删除补录表中的数据------------------------------- sqlstr = "select afc401,date from fs_fc84 where afc001='" for payNo in TradeContext.AFC001.split(':'): sqlstr = "select afc401,date from fs_fc84 where" condition = " afc001='" + payNo + "'" for serNo in TradeContext.AFC401.split(':'): condition = condition + " and afc401 like '%" + serNo + "%'" #begin 20100625 蔡永贵增加查询条件 condition = condition + " and afa101 = '" + TradeContext.bankbm + "'" #end sqlstr = sqlstr + condition #===条件增加银行编码字段,张恒修改=== #sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) AfaLoggerFunc.tradeInfo( '数据库长度:' + str( len(records) ) ) if len(records) == 0: AfaLoggerFunc.tradeInfo( '没有查找到补录信息不用删除' ) continue #---------------------------不能删除以前已经上传的补录数据--------------------------- if records[0][1].strip() < TradeContext.workDate : TradeContext.errorCode,TradeContext.errorMsg = '0001','该数据已经上传不能删除' return False #查找到了补录信息则删除流水号 if( len( records) == 1 ): sqlstr = "delete from fs_fc84 where " + condition #===条件增加银行编码字段,张恒修改=== #sqlstr = sqlstr + " and afa101 = '" + TradeContext.bankbm + "'" AfaLoggerFunc.tradeInfo( sqlstr ) if( AfaDBFunc.DeleteSql( sqlstr ) < 1 ) : AfaDBFunc.RollbackSql() TradeContext.errorCode, TradeContext.errorMsg='0001', '删除补录数据失败' AfaLoggerFunc.tradeInfo( sqlstr+AfaDBFunc.sqlErrMsg ) return False AfaDBFunc.CommitSql( ) AfaLoggerFunc.tradeInfo( '删除补录数据成功,该缴款书编号:%s' %payNo ) #如果查找出来的记录条数大于1,则说明补录数据错误 elif len( records) > 1 : AfaLoggerFunc.tradeInfo( '补录数据错误,缴款书编号,流水号码对应了两条以上记录' ) AfaLoggerFunc.tradeInfo( '缴款书编号' + payNo ) AfaLoggerFunc.tradeInfo( '流水号码' + TradeContext.AFC401 ) TradeContext.errorCode, TradeContext.errorMsg='0000', '勾对删除失败' return False else: TradeContext.errorCode, TradeContext.errorMsg='0001', '操作类型异常' AfaLoggerFunc.tradeInfo( sqlstr+AfaDBFunc.sqlErrMsg ) return False TradeContext.errorCode, TradeContext.errorMsg='0000', '勾对数据成功' AfaLoggerFunc.tradeInfo( "********************中台勾对结束***************" ) return True
def SubModuleMainFst( ): AfaLoggerFunc.tradeInfo( '进入三方协议验证/撤消[T'+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' ) try: #=============获取当前系统时间==================== #TradeContext.workDate=UtilTools.GetSysDate( ) TradeContext.workTime=UtilTools.GetSysTime( ) ##====获取工作日期======= #if not TipsFunc.GetUnitWorkdate( ): # return False #============校验公共节点的有效性================== # 完整性检查 if( not TradeContext.existVariable( "VCSign" ) ): return TipsFunc.ExitThisFlow( 'A0001', '标识[VCSign]值不存在!' ) if( not TradeContext.existVariable( "zoneno" ) ): return TipsFunc.ExitThisFlow( 'A0001', '分行号[zoneno]值不存在!' ) if( not TradeContext.existVariable( "channelCode" ) ): return TipsFunc.ExitThisFlow( 'A0001', '渠道代码[channelCode]值不存在!' ) if( not TradeContext.existVariable( "brno" ) ): return TipsFunc.ExitThisFlow( 'A0001', '行所号[brno]值不存在!' ) if( not TradeContext.existVariable( "teller" ) ): return TipsFunc.ExitThisFlow( 'A0001', '柜员号[teller]值不存在!' ) if( not TradeContext.existVariable( "accno" ) ): return TipsFunc.ExitThisFlow( 'A0001', '帐号[accno]值不存在!' ) if( not TradeContext.existVariable( "taxPayCode" ) ): return TipsFunc.ExitThisFlow( 'A0001', '纳税人编码[taxPayCode]值不存在!' ) if( not TradeContext.existVariable( "taxPayName" ) ): return TipsFunc.ExitThisFlow( 'A0001', '纳税人名称[taxPayName]值不存在!' ) if( not TradeContext.existVariable( "passWDFlag" ) ): return TipsFunc.ExitThisFlow( 'A0001', '密码验证标志[passWDFlag]值不存在!' ) if( not TradeContext.existVariable( "payBkCode" ) ): return TipsFunc.ExitThisFlow( 'A0001', '清算行行号[payBkCode]值不存在!' ) TradeContext.note1 = TradeContext.payBkCode if(TradeContext.passWDFlag == '0'): #验证密码 TradeContext.sBrNo = TradeContext.brno #交易机构 TradeContext.sTeller = TradeContext.teller #交易柜员 TradeContext.sTermId = TradeContext.termId #终端号 HostContext.I1ACNO = TradeContext.accno #付款帐户 HostContext.I1CYNO = '01' accnoLen = len(TradeContext.accno) if(accnoLen == 23): HostContext.I1CFFG = 'A' elif(accnoLen == 19): HostContext.I1CFFG = '0' HostContext.I1CETY = (TradeContext.accno)[6:8] HostContext.I1CCSQ = (TradeContext.accno)[8:19] else: return TipsFunc.ExitThisFlow( 'A0001', '帐号错误!' ) HostContext.I1PSWD = TradeContext.passWD if(not TipsHostFunc.CommHost('8810')): return TipsFunc.ExitThisFlow( TradeContext.errorCode, TradeContext.errorMsg ) if(TradeContext.errorCode == '0000'): if(HostContext.O1CFFG == '1'): return TipsFunc.ExitThisFlow( 'A0001', '密码错误!' ) #=============判断应用状态==================== if not TipsFunc.ChkAppStatus( ) : raise TipsFunc.flowException( ) #=============判断机构是否开通此应用=============== #if not TipsFunc.ChkBranchStatus( ) : # raise TipsFunc.flowException( ) #=============获取平台流水号==================== if TipsFunc.GetSerialno( ) == -1 : raise TipsFunc.flowException( ) #签约 if TradeContext.VCSign=='0': #=============判断状态==================== sql="SELECT STATUS FROM TIPS_CUSTINFO WHERE " sql=sql+" TAXORGCODE ='"+TradeContext.taxOrgCode +"'" sql=sql+" AND TAXPAYCODE='"+TradeContext.taxPayCode+"'" sql=sql+" AND PROTOCOLNO='"+TradeContext.protocolNo+"'" sql=sql+" AND PAYACCT='"+TradeContext.accno+"'" records = AfaDBFunc.SelectSql(sql) AfaLoggerFunc.tradeFatal(sql) if( records == None or records <0): #AfaLoggerFunc.tradeFatal(sql) return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg ) elif( len( records )==0 ): AfaLoggerFunc.tradeInfo( "该客户尚未签约,可正常处理" ) else: AfaLoggerFunc.tradeFatal(sql) AfaLoggerFunc.tradeInfo(records[0][0]) UtilTools.ListFilterNone( records ) AfaLoggerFunc.tradeInfo( "==================1" ) #0-注销 1-正常(双方都已验证) 2-临时状态(银行方柜面已验证)3-临时状态(银行方柜面已撤销) if (records[0][0]=="1" or records[0][0]=="2" ): #已有该客户记录,状态为"已启用",不允许签约 return TipsFunc.ExitThisFlow( 'A0002', '客户编号或帐号已经签约,不能重复签约') AfaLoggerFunc.tradeInfo( "==================2" ) TradeContext.status = '2' #TradeContext.revTranF ='0' #正交易 #TradeContext.tradeType ='S' #签约类交易 #TradeContext.amount ='0' # #TradeContext.__agentAccno__ ='' #借方帐号置空 ##记录签约流水 #if not TipsFunc.InsertDtl( ) : # return False #=============与第三方通讯==================== #AfaAfeFunc.CommAfe() TradeContext.__status__='0' TradeContext.errorCode='0000' TradeContext.errorMsg='交易成功' ##=============更新流水表==================== #if( not TipsFunc.UpdateDtl( 'TRADE' ) ): # return False AfaLoggerFunc.tradeInfo( "==================3" ) if TradeContext.errorCode!='0000': return TipsFunc.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) if ( len( records )!=0 ): sql="update TIPS_CUSTINFO set " sql=sql+" PAYACCT ='"+TradeContext.accno +"'" sql=sql+",STATUS ='"+'2' +"'" sql=sql+",TAXPAYNAME ='"+TradeContext.taxPayName +"'" sql=sql+",HANDORGNAME ='"+TradeContext.handOrgName +"'" sql=sql+",STARTDATE ='"+TradeContext.workDate +"'" sql=sql+",ZONENO ='"+TradeContext.zoneno +"'" sql=sql+",BRNO ='"+TradeContext.brno +"'" sql=sql+",TELLERNO ='"+TradeContext.teller +"'" if( TradeContext.existVariable( "NOTE1" ) ): sql=sql+",NOTE1 ='"+TradeContext.note1 +"'" if( TradeContext.existVariable( "NOTE2" ) ): sql=sql+",NOTE2 ='"+TradeContext.note2 +"'" if( TradeContext.existVariable( "NOTE3" ) ): sql=sql+",NOTE3 ='"+TradeContext.note3 +"'" if( TradeContext.existVariable( "NOTE4" ) ): sql=sql+",NOTE4 ='"+TradeContext.note4 +"'" if( TradeContext.existVariable( "NOTE5" ) ): sql=sql+",NOTE5 ='"+TradeContext.note5 +"'" sql=sql+" WHERE TAXORGCODE ='"+TradeContext.taxOrgCode +"'" sql=sql+" AND TAXPAYCODE ='"+TradeContext.taxPayCode +"'" AfaLoggerFunc.tradeInfo(sql) if( AfaDBFunc.UpdateSql(sql) == -1 ): AfaLoggerFunc.tradeFatal(sql) return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg ) else: sql="insert into TIPS_CUSTINFO(TAXPAYCODE,TAXORGCODE,PROTOCOLNO,PAYACCT,IDTYPE,IDCODE,TAXPAYNAME,STATUS," sql=sql+"HANDORGNAME,STARTDATE,ENDDATE,ZONENO,BRNO,TELLERNO,WORKDATE,PAYOPBKCODE," sql=sql+"NOTE1,NOTE2,NOTE3,NOTE4,NOTE5)" sql=sql+" values" sql=sql+"('"+TradeContext.taxPayCode +"'" sql=sql+",'"+TradeContext.taxOrgCode +"'" sql=sql+",'"+TradeContext.protocolNo+"'" sql=sql+",'"+TradeContext.accno +"'" sql=sql+",'',''" sql=sql+",'"+TradeContext.taxPayName +"'" sql=sql+",'2'" #临时状态,待第三方验证后改为1 if( TradeContext.existVariable( "handOrgName" ) ): sql=sql+",'"+TradeContext.handOrgName +"'" else: sql=sql+",''" #if( TradeContext.existVariable( "custAdd" ) ): # sql=sql+",'"+TradeContext.custAdd +"'" #else: # sql=sql+",''" #if( TradeContext.existVariable( "zipCode" ) ): # sql=sql+",'"+TradeContext.zipCode +"'" #else: # sql=sql+",''" #if( TradeContext.existVariable( "email" ) ): # sql=sql+",'"+TradeContext.email +"'" #else: # sql=sql+",''" sql=sql+",'"+TradeContext.workDate +"'" sql=sql+",''" sql=sql+",'"+TradeContext.zoneno +"'" sql=sql+",'"+TradeContext.brno +"'" sql=sql+",'"+TradeContext.teller +"'" sql=sql+",'"+TradeContext.workDate +"'" sql=sql+",'"+TradeContext.payOpBkCode +"'" if( TradeContext.existVariable( "note1" ) ): sql=sql+",'"+TradeContext.note1 +"'" else: sql=sql+",''" if( TradeContext.existVariable( "note2" ) ): sql=sql+",'"+TradeContext.note2 +"'" else: sql=sql+",''" if( TradeContext.existVariable( "note3" ) ): sql=sql+",'"+TradeContext.note3 +"'" else: sql=sql+",''" if( TradeContext.existVariable( "note4" ) ): sql=sql+",'"+TradeContext.note4 +"'" else: sql=sql+",''" if( TradeContext.existVariable( "note5" ) ): sql=sql+",'"+TradeContext.note5 +"'" else: sql=sql+",''" sql=sql+")" AfaLoggerFunc.tradeInfo(sql) records=AfaDBFunc.InsertSqlCmt(sql) if( records == 0 ): return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg ) if( records == -1 ): return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeInfo('***************') elif TradeContext.VCSign=='1': #=============判断状态==================== sql="SELECT STATUS" sql=sql+" FROM TIPS_CUSTINFO 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) 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', '该客户三方协议尚未验证,无法撤消' ) 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', '三方协议状态为已撤消,不能重复撤消' ) TradeContext.status = '3' #TradeContext.revTranF ='0' #正交易 #TradeContext.tradeType ='U' #解约类交易 #TradeContext.amount ='0' # #TradeContext.__agentAccno__ ='' #借方帐号置空 ##记录签约流水 #if not TipsFunc.InsertDtl( ) : # return False #=============与第三方通讯通讯==================== #AfaAfeFunc.CommAfe() #TradeContext.__status__='0' #TradeContext.errorCode='0000' #TradeContext.errorMsg='交易成功' ##=============更新流水表==================== #if( not TipsFunc.UpdateDtl( 'TRADE' ) ): # return False #if TradeContext.errorCode!='0000': # return TipsFunc.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) #if TradeContext.errorCode=='0000': 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.UpdateSql(sql) == -1 ): AfaLoggerFunc.tradeFatal(sql) return TipsFunc.ExitThisFlow( 'A0002', '数据库操作异常:'+AfaDBFunc.sqlErrMsg ) #=============自动打包==================== TradeContext.errorCode='0000' TradeContext.errorMsg='交易成功' #=============程序退出==================== AfaLoggerFunc.tradeInfo( '退出三方协议验证/撤消['+TradeContext.TemplateCode+'_'+TradeContext.TransCode+']' ) return True except TipsFunc.flowException, e: return False
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( )