def newBilState(BJEDTE,BSPSQN,HPSTAT): AfaLoggerFunc.tradeInfo(">>>进入newBilState") #===========检查表bilbka中是否存在此业务==================================== bilbka_where_dict = {} bilbka_where_dict["BJEDTE"] = BJEDTE bilbka_where_dict["BSPSQN"] = BSPSQN bilbka_dict = rccpsDBTrcc_bilbka.selectu(bilbka_where_dict) if bilbka_dict == None: AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeFatal("获取汇票业务登记簿中交易[" + BJEDTE + "][" + BSPSQN + "]详细信息异常") return AfaFlowControl.ExitThisFlow( 'S999', '获取汇票业务登记簿中交易详细信息异常' ) elif len(bilbka_dict) <= 0: AfaLoggerFunc.tradeFatal("汇票业务登记簿中无此交易[" + BJEDTE + "][" + BSPSQN + "]详细信息") return AfaFlowControl.ExitThisFlow( 'S999', '汇票业务登记簿中无此交易详细信息' ) else: MaxHPCUSQ = int(bilbka_dict["HPCUSQ"]) + 1 #===========更新表bilbka中业务对应汇票状态=================================== bilbka_update_dict = {} bilbka_update_dict["HPCUSQ"] = MaxHPCUSQ bilbka_update_dict["HPSTAT"] = HPSTAT bilbka_where_dict = {} bilbka_where_dict["BJEDTE"] = BJEDTE bilbka_where_dict["BSPSQN"] = BSPSQN ret = rccpsDBTrcc_bilbka.update(bilbka_update_dict,bilbka_where_dict) if ret <= 0: AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeFatal("登记汇票业务登记簿中交易[" + BJEDTE + "][" + BSPSQN + "]对应当前汇票状态[" + HPSTAT + "]异常") return AfaFlowControl.ExitThisFlow( 'S999', '登记汇票业务登记簿中当前汇票状态异常' ) #===========更新表bilinf中汇票对应状态======================================== bilinf_update_dict = {} bilinf_update_dict["HPCUSQ"] = MaxHPCUSQ bilinf_update_dict["HPSTAT"] = HPSTAT bilinf_where_dict = {} bilinf_where_dict["BILVER"] = bilbka_dict["BILVER"] bilinf_where_dict["BILNO"] = bilbka_dict["BILNO"] bilinf_where_dict["BILRS"] = bilbka_dict["BILRS"] ret = rccpsDBTrcc_bilinf.update(bilinf_update_dict,bilinf_where_dict) if ret <= 0: AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeFatal("登记汇票业务登记簿中当前汇票[" + bilbka_dict['BILVER'] + "][" + bilbka_dict['BILVER'] + "]状态[" + HPSTAT + "]异常") return AfaFlowControl.ExitThisFlow( 'S999', '登记汇票信息登记簿中当前汇票状态异常' ) AfaLoggerFunc.tradeInfo(">>>结束newBilState") return True
def getTransBilAK(SNDBNKCO,TRCDAT,TRCNO,bil_dict): AfaLoggerFunc.tradeInfo( ">>>开始查询汇票业务登记簿[" + SNDBNKCO + "][" + TRCDAT + "][" + TRCNO + "]交易信息" ) #==========组织查询条件===================================================== bilbka_where_dict = {'SNDBNKCO':SNDBNKCO,'TRCDAT':TRCDAT,'TRCNO':TRCNO} #==========查询汇票业务登记簿相关业务信息=================================== bilbka_dict = rccpsDBTrcc_bilbka.selectu(bilbka_where_dict) if bilbka_dict == None: AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow( 'S999', '获取汇票业务详细信息异常' ) if len(bilbka_dict) <= 0: return AfaFlowControl.ExitThisFlow( 'S999', '汇票业务登记簿中无此汇票业务详细信息' ) AfaLoggerFunc.tradeInfo( ">>>结束查询汇票业务登记簿[" + SNDBNKCO + "][" + TRCDAT + "][" + TRCNO + "]交易信息" ) #==========将查询出的汇票业务登记簿相关业务信息赋值到输出字典=============== if not rccpsMap0000Dbilbka2Dbil_dict.map(bilbka_dict,bil_dict): return AfaFlowControl.ExitThisFlow( 'S999', '将查询出的汇票业务登记簿相关业务信息赋值到输出字典异常' ) BJEDTE = bilbka_dict["BJEDTE"] BSPSQN = bilbka_dict["BSPSQN"] #==========查询当前业务状态================================================= AfaLoggerFunc.tradeInfo( ">>>开始查询交易[" + BJEDTE + "][" + BSPSQN + "]当前业务状态" ) stat_dict = {} if not rccpsState.getTransStateCur(BJEDTE,BSPSQN,stat_dict): return False AfaLoggerFunc.tradeInfo( ">>>结束查询交易[" + BJEDTE + "][" + BSPSQN + "]当前业务状态" ) #==========将查询出的业务状态详细信息赋值到输出字典========================= if not rccpsMap0000Dstat_dict2Dbil_dict.map(stat_dict,bil_dict): return AfaFlowControl.ExitThisFlow( 'S999', '将查询出的业务状态详细信息赋值到输出字典异常' ) AfaLoggerFunc.tradeInfo( ">>>结束查询汇票业务登记簿[" + BJEDTE + "][" + BSPSQN + "]交易信息" ) return True
def getTransBil(BJEDTE,BSPSQN,bil_dict): AfaLoggerFunc.tradeInfo( ">>>开始查询汇票业务登记簿[" + BJEDTE + "][" + BSPSQN + "]交易信息" ) #==========组织查询条件===================================================== bilbka_where_dict = {'BJEDTE':BJEDTE,'BSPSQN':BSPSQN} #==========查询汇票业务登记簿相关业务信息=================================== bilbka_dict = rccpsDBTrcc_bilbka.selectu(bilbka_where_dict) if bilbka_dict == None: AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow( 'S999', '获取汇票业务登记簿详细信息异常' ) if len(bilbka_dict) <= 0: return AfaFlowControl.ExitThisFlow( 'S999', '汇兑业务登记簿中无此交易详细信息' ) AfaLoggerFunc.tradeInfo( ">>>结束查询汇票业务登记簿[" + BJEDTE + "][" + BSPSQN + "]交易信息" ) #==========将查询出的汇票业务登记簿相关业务信息赋值到输出字典=============== if not rccpsMap0000Dbilbka2Dbil_dict.map(bilbka_dict,bil_dict): return AfaFlowControl.ExitThisFlow( 'S999', '将查询出的汇票业务登记簿相关业务信息赋值到输出字典异常' ) #==========查询当前业务状态================================================= AfaLoggerFunc.tradeInfo( ">>>开始查询交易[" + BJEDTE + "][" + BSPSQN + "]当前业务状态" ) stat_dict = {} if not rccpsState.getTransStateCur(BJEDTE,BSPSQN,stat_dict): return False AfaLoggerFunc.tradeInfo( ">>>结束查询交易[" + BJEDTE + "][" + BSPSQN + "]当前业务状态" ) #==========将查询出的业务状态详细信息赋值到输出字典========================= if not rccpsMap0000Dstat_dict2Dbil_dict.map(stat_dict,bil_dict): return AfaFlowControl.ExitThisFlow( 'S999', '将查询出的业务状态详细信息赋值到输出字典异常' ) AfaLoggerFunc.tradeInfo( ">>>结束查询汇票业务登记簿[" + BJEDTE + "][" + BSPSQN + "]交易信息" ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).汇票撤销[TRCC003_8503]进入***' ) #====begin 蔡永贵 20110215 增加==== #新票据号是16位,需要取后8位,版本号为02,同时要兼容老票据号8位,版本号为01 if TradeContext.BILVER == '02': TradeContext.TMP_BILNO = TradeContext.BILNO[-8:] else: TradeContext.TMP_BILNO = TradeContext.BILNO #============end============ #校验当前汇票状态是否为签发或解挂 AfaLoggerFunc.tradeInfo(">>>开始校验当前汇票状态是否为签发或解挂") bilinf_dict = {} if not rccpsDBFunc.getInfoBil(TradeContext.BILVER,TradeContext.BILNO,PL_BILRS_INN,bilinf_dict): return AfaFlowControl.ExitThisFlow("S999","查询汇票信息异常") if bilinf_dict['REMBNKCO'] != TradeContext.SNDBNKCO: return AfaFlowControl.ExitThisFlow("S999","本行非此汇票出票行,禁止提交") if bilinf_dict['BILDAT'] != TradeContext.BJEDTE: return AfaFlowControl.ExitThisFlow("S999","非今日签发的汇票,禁止提交") if bilinf_dict['HPSTAT'] != PL_HPSTAT_SIGN and bilinf_dict['HPSTAT'] != PL_HPSTAT_DEHG and bilinf_dict['HPSTAT'] != PL_HPSTAT_HANG: return AfaFlowControl.ExitThisFlow("S999","此汇票当前状态非[签发,挂失,解挂],禁止提交") #=====通过日期+报单序号查询汇票业务登记簿rcc_bilbka,取“资金来源”==== #=====潘广通来负责完成==== bilbka_where_dict = {'BJEDTE':bilinf_dict['NOTE1'],'BSPSQN':bilinf_dict['NOTE2']} bilbka_dict = rccpsDBTrcc_bilbka.selectu(bilbka_where_dict) if( bilbka_dict == None ): return AfaFlowControl.ExitThisFlow("S999","查询汇票业务登记簿异常") if( len(bilbka_dict) <= 0 ): return AfaFlowControl.ExitThisFlow("S999","查询汇票业务登记簿为空") #=====潘广通 0916 判断柜员和机构是否为签发柜员和机构==== if( bilbka_dict['BETELR'] != TradeContext.BETELR ): return AfaFlowControl.ExitThisFlow("S999","此柜员不是录入柜员") #if( bilbka_dict['BESBNO'] != TradeContext.BESBNO): # return AfaFlowControl.ExitThisFlow("S999","此机构不是录入机构") #将签发交易的资金来源赋值到上下文 TradeContext.BBSSRC = bilbka_dict['BBSSRC'] #将汇票信息映射到TradeContext中 if not rccpsMap8503Dbilinf2CTradeContext.map(bilinf_dict): return False AfaLoggerFunc.tradeInfo(">>>结束校验当前汇票状态是否为签发或解挂") #汇票类交易接收成员行为总中心 TradeContext.RCVSTLBIN = PL_RCV_CENTER #接收行为签发时的代理付款行 TradeContext.RCVBNKCO = TradeContext.PAYBNKCO TradeContext.RCVBNKNM = TradeContext.PAYBNKNM #登记汇票业务登记簿 AfaLoggerFunc.tradeInfo(">>>开始登记汇票业务登记簿") TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN TradeContext.RCVMBRCO = TradeContext.RCVSTLBIN TradeContext.TRCNO = TradeContext.SerialNo TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRNO = PL_HPOPRNO_CX #业务种类:撤销 TradeContext.DCFLG = PL_DCFLG_DEB #借贷标识:借记 TradeContext.BRSFLG = PL_BRSFLG_SND #往来标识:往账 TradeContext.TRCCO = '2100101' #交易代码:2100101汇票撤销 bilbka_dict = {} if not rccpsMap8503CTradeContext2Dbilbka.map(bilbka_dict): return False if not rccpsDBFunc.insTransBil(bilbka_dict): return AfaFlowControl.ExitThisFlow('S999','登记汇票业务登记簿异常') AfaLoggerFunc.tradeInfo(">>>结束登记汇票业务登记簿") #设置业务状态为发送处理中 AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为发送处理中") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BCSTAT'] = PL_BCSTAT_SND stat_dict['BDWFLG'] = PL_BDWFLG_WAIT if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置状态为发送处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为发送处理中") #COMMIT if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") #为发送农信银中心做准备 AfaLoggerFunc.tradeInfo(">>>开始为发送农信银中心做准备") TradeContext.MSGTYPCO = 'SET001' TradeContext.TRCCO = '2100101' TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR TradeContext.SNDTRDAT = TradeContext.BJEDTE TradeContext.SNDTRTIM = TradeContext.BJETIM TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.BJEDTE + TradeContext.TRCNO TradeContext.ORMFN = "" TradeContext.OPRTYPNO = '21' TradeContext.ROPRTPNO = '' TradeContext.TRANTYP = '0' TradeContext.OCCAMT = str(TradeContext.BILAMT) TradeContext.BILAMT = str(TradeContext.BILAMT) #begin 20110614 曾照泰 修改 送往农信银中心的票号为8位 TradeContext.BILNO = TradeContext.BILNO[-8:] #end AfaLoggerFunc.tradeInfo(">>>结束为发送农信银中心做准备") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.中心类操作(1.本地操作).汇票撤销[TRCC003_8503]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( "====开始汇票解付接收处理====" ) #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_bilbka.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复报文,查询汇兑业务登记簿相同报文异常') elif len(record) > 0: AfaLoggerFunc.tradeInfo('汇票业务登记簿中存在相同数据,重复报文,进入下一流程') #=====为通讯回执报文赋值==== out_context_dict = {} out_context_dict['sysType'] = 'rccpst' out_context_dict['TRCCO'] = '9900503' out_context_dict['MSGTYPCO'] = 'SET008' out_context_dict['RCVMBRCO'] = TradeContext.SNDMBRCO out_context_dict['SNDMBRCO'] = TradeContext.RCVMBRCO out_context_dict['SNDBRHCO'] = TradeContext.BESBNO out_context_dict['SNDCLKNO'] = TradeContext.BETELR out_context_dict['SNDTRDAT'] = TradeContext.BJEDTE out_context_dict['SNDTRTIM'] = TradeContext.BJETIM out_context_dict['ORMFN'] = TradeContext.MSGFLGNO out_context_dict['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['NCCWKDAT'] = TradeContext.NCCworkDate out_context_dict['OPRTYPNO'] = '99' out_context_dict['ROPRTPNO'] = TradeContext.OPRTYPNO out_context_dict['TRANTYP'] = '0' out_context_dict['ORTRCCO'] = TradeContext.TRCCO out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '重复报文' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') AfaLoggerFunc.tradeInfo(">>>结束判断是否重复报文") #=====币种转换==== if TradeContext.CUR == 'CNY': TradeContext.CUR = '01' TradeContext.DCFLG = '1' TradeContext.HPSTAT= PL_HPSTAT_PAYC #解付 02 TradeContext.OPRNO = PL_HPOPRNO_JF #=====插入数据库==== AfaLoggerFunc.tradeInfo(">>>开始记录数据库操作") bilbka_dict = {} if not rccpsMap1113CTradeContext2Dbilbka.map(bilbka_dict): return AfaFlowControl.ExitThisFlow("S999","为汇票业务登记簿赋值异常") if not rccpsDBFunc.insTransBil(bilbka_dict): return AfaFlowControl.ExitThisFlow('S999','登记汇票业务登记簿异常') AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo(">>>结束记录数据库操作") #=====设置状态为收妥==== sstlog = {} sstlog['BSPSQN'] = TradeContext.BSPSQN sstlog['BJEDTE'] = TradeContext.BJEDTE sstlog['BCSTAT'] = PL_BCSTAT_BNKRCV sstlog['BDWFLG'] = PL_BDWFLG_SUCC #=====设置状态为 收妥-成功 ==== if not rccpsState.setTransState(sstlog): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====设置汇票业务登记簿和信息登记簿状态==== #=====设置汇票状态为解付==== AfaLoggerFunc.tradeInfo(">>>开始设置汇票状态为解付") if not rccpsState.newBilState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_HPSTAT_PAYC): return AfaFlowControl.ExitThisFlow("S999","设置汇票状态异常") AfaLoggerFunc.tradeInfo(">>>结束设置汇票状态为解付") #=====commit操作==== AfaDBFunc.CommitSql() #=====设置汇票解付金额==== bil_dict = {} bil_dict['BILNO'] = TradeContext.BILNO bil_dict['BILVER'] = TradeContext.BILVER bil_dict['BILRS'] = TradeContext.BILRS bil_end = {} bil_end['OCCAMT'] = TradeContext.OCCAMT bil_end['RMNAMT'] = TradeContext.RMNAMT bil_end['PAYBNKCO']= TradeContext.SNDBNKCO bil_end['PAYBNKNM']= TradeContext.SNDBNKNM ret = rccpsDBTrcc_bilinf.update(bil_end,bil_dict) if (ret <= 0): return AfaFlowControl.ExitThisFlow("S999","更新汇票信息异常") AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') AfaLoggerFunc.tradeInfo(">>>开始判断是否存在多余款操作") if float(TradeContext.RMNAMT) != 0.00: AfaLoggerFunc.tradeInfo(">>>第二次记账赋值操作") TradeContext.ACUR = '2' #记账循环次数 TradeContext.TRFG = '9' #凭证处理标识' TradeContext.I2CETY = '' #凭证种类 TradeContext.I2TRAM = TradeContext.RMNAMT #结余金额 TradeContext.I2SMCD = PL_RCCSMCD_HPJF #摘要代码 TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_DYKJQ #贷方账号 TradeContext.I2SBAC = TradeContext.BESBNO + PL_ACC_HCHK #借方账号 TradeContext.I2REAC = TradeContext.BESBNO + PL_ACC_NXYDXZ #挂账账号 #=====生成账号校验位==== TradeContext.I2SBAC = rccpsHostFunc.CrtAcc(TradeContext.I2SBAC,25) TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2REAC = rccpsHostFunc.CrtAcc(TradeContext.I2REAC,25) AfaLoggerFunc.tradeInfo(">>>结束判断是否存在多余款操作") AfaLoggerFunc.tradeInfo(">>>开始组织报文上送主机记账操作") #=====组织报文发送主机记账==== TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSLZ #贷方账号 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_HCHK #借方账号 TradeContext.REAC = TradeContext.BESBNO + PL_ACC_NXYDXZ #挂账账号 #=====生成账号校验位==== TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.REAC = rccpsHostFunc.CrtAcc(TradeContext.REAC,25) TradeContext.HostCode = '8813' #关彬捷 20081007 #TradeContext.NOTE3 = '主机记账' TradeContext.NOTE3 = '' TradeContext.RCCSMCD = PL_RCCSMCD_HPJF #摘要代码 AfaLoggerFunc.tradeInfo(">>>结束组织报文上送主机记账操作") AfaLoggerFunc.tradeInfo(">>>开始更新登记簿状态") #关彬捷 20081007 改记账状态为自动入账 #TradeContext.BCSTAT = PL_BCSTAT_ACC #记账 TradeContext.BCSTAT = PL_BCSTAT_AUTO #自动入账 TradeContext.BDWFLG = PL_BDWFLG_WAIT #处理中 #=====新增sstlog表状态记录==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,TradeContext.BCSTAT,TradeContext.BDWFLG): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态['+TradeContext.BCSTAT+']['+TradeContext.BDWFLG+']失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo(">>>结束更新登记簿状态") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作)对账差错登记簿查询[TRC001_8542]进入***' ) #=====判断输入接口值是否存在==== if( not TradeContext.existVariable( "STRDAT" ) ): return AfaFlowControl.ExitThisFlow('A099', '起始日期[STRDAT]不存在') if( not TradeContext.existVariable( "ENDDAT" ) ): return AfaFlowControl.ExitThisFlow('A099', '终止日期[ENDDAT]不存在') if( not TradeContext.existVariable( "OPRTYPNO" ) ): return AfaFlowControl.ExitThisFlow('A099', '交易类型[OPRTYPNO]不存在') if( not TradeContext.existVariable( "RECSTRNO" ) ): return AfaFlowControl.ExitThisFlow('A099', '起始笔数[RECSTRNO]不存在') #=====组织sql语句==== wheresql="" wheresql=wheresql+"BJEDTE>='"+TradeContext.STRDAT+"'" wheresql=wheresql+" AND BJEDTE<='"+TradeContext.ENDDAT+"'" ordersql = " order by NCCWKDAT DESC" start_no=TradeContext.RECSTRNO #起始笔数 sel_size=10 #查询笔数 #=====20 汇兑==== if TradeContext.OPRTYPNO == '20': #=====查询总笔数==== allcount=rccpsDBTrcc_hddzcz.count(wheresql) if(allcount == -1): return AfaFlowControl.ExitThisFlow('S999', '查询总记录数异常') #=====查询明细==== records=rccpsDBTrcc_hddzcz.selectm(start_no,sel_size,wheresql,ordersql) if(records == None): return AfaFlowControl.ExitThisFlow('S999', '查询汇兑错账登记簿异常') if(len(records) <= 0): return AfaFlowControl.ExitThisFlow('S999', '汇兑错账登记簿中无对应信息') #=====21 汇票==== if TradeContext.OPRTYPNO == '21': #=====查询总笔数==== allcount=rccpsDBTrcc_hpdzcz.count(wheresql) if(allcount == -1): return AfaFlowControl.ExitThisFlow('S999', '查询总记录数异常') #=====查询明细==== records=rccpsDBTrcc_hpdzcz.selectm(start_no,sel_size,wheresql,ordersql) if(records == None): return AfaFlowControl.ExitThisFlow('S999', '查询汇票错账登记簿异常') if(len(records) <= 0): return AfaFlowControl.ExitThisFlow('S999', '汇票错账登记簿中无对应信息') #=====30 通存通兑(刘振东 20081024 添加)==== if TradeContext.OPRTYPNO == '30': #=====查询总笔数==== allcount=rccpsDBTrcc_tddzcz.count(wheresql) if(allcount == -1): return AfaFlowControl.ExitThisFlow('S999', '查询总记录数异常') #=====查询明细==== records=rccpsDBTrcc_tddzcz.selectm(start_no,sel_size,wheresql,ordersql) if(records == None): return AfaFlowControl.ExitThisFlow('S999', '查询汇票错账登记簿异常') if(len(records) <= 0): return AfaFlowControl.ExitThisFlow('S999', '汇票错账登记簿中无对应信息') #=====生成文件==== AfaLoggerFunc.tradeInfo( "生成文件") filename="rccps_"+TradeContext.BETELR+"_"+AfaUtilTools.GetSysDate()+"_"+TradeContext.TransCode try: pub_path = os.environ["AFAP_HOME"] pub_path = pub_path + "/tmp/" f=open(pub_path+filename,"w") except IOError: return AfaLoggerFunc.ExitThisFlow('S099','打开文件失败') #=====写文件操作==== try: filecontext="" for i in range(0,len(records)): #=====生成文件内容==== filecontext=records[i]['NCCWKDAT'] + "|" \ +records[i]['BJEDTE'] + "|" \ +records[i]['BSPSQN'] + "|" \ +records[i]['SNDBNKCO'] + "|" \ +records[i]['TRCDAT'] + "|" \ +records[i]['TRCNO'] + "|" \ +records[i]['EACTYP'] + "|" \ +records[i]['EACINF'] + "|" \ +records[i]['ISDEAL'] + "|" \ #曾照泰20120614添加明细文件中增加接收行号 filecontext1="" #=====20 汇兑==== if(TradeContext.OPRTYPNO == '20'): trcbka_sql = {} trcbka_sql = {'BJEDTE':records[i]['BJEDTE'],'BSPSQN':records[i]['BSPSQN']} result=rccpsDBTrcc_trcbka.selectu(trcbka_sql) if(result == None): return AfaFlowControl.ExitThisFlow('S999', '查询汇兑业务登记簿异常') if(len(result) <= 0): filecontext1=" " + "|" else: filecontext1= result['RCVBNKCO']+ "|" #=====21 汇票==== elif TradeContext.OPRTYPNO == '21': bilbka_sql = {} bilbka_sql = {'BJEDTE':records[i]['BJEDTE'],'BSPSQN':records[i]['BSPSQN']} result=rccpsDBTrcc_bilbka.selectu(bilbka_sql) AfaLoggerFunc.tradeInfo(result) if(result == None): return AfaFlowControl.ExitThisFlow('S999', '查询汇票业务登记簿异常') if(len(result) <= 0): filecontext1=" " + "|" else: filecontext1= result['RCVBNKCO']+ "|" else: filecontext1= records[i]['RCVBNKCO'] + "|" filecontext=filecontext+filecontext1 #end f.write(filecontext+"\n") except Exception,e: f.close() return AfaFlowControl.ExitThisFlow('S099','写文件失败')
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).汇票解付[TRCC003_8502]进入***' ) #====begin 蔡永贵 20110215 增加==== #新票据号是16位,需要取后8位,版本号为02,同时要兼容老票据号8位,版本号为01 if TradeContext.BILVER == '02': TradeContext.TMP_BILNO = TradeContext.BILNO[-8:] else: TradeContext.TMP_BILNO = TradeContext.BILNO #============end============ #置代理付款行为本机构行号 TradeContext.PAYBNKCO = TradeContext.SNDBNKCO TradeContext.PAYBNKNM = TradeContext.SNDBNKNM if TradeContext.BILTYP == PL_BILTYP_CASH: #=================现金汇票置持票人账号为2431账号科目======================== TradeContext.PYHACC = TradeContext.BESBNO + PL_ACC_NXYDXZ TradeContext.PYHACC = rccpsHostFunc.CrtAcc(TradeContext.PYHACC,25) AfaLoggerFunc.tradeInfo("TradeContext.PYHACC=" + TradeContext.PYHACC) AfaLoggerFunc.tradeInfo("TradeContext.PYHNAM=" + TradeContext.PYHNAM) #=================交易必要性检查============================================ AfaLoggerFunc.tradeInfo(">>>开始交易必要性检查") if abs(float(TradeContext.BILAMT) - float(TradeContext.OCCAMT) - float(TradeContext.RMNAMT)) >= 0.001: return AfaFlowControl.ExitThisFlow("S999","多余金额非出票金额与实际结算金额之差") AfaLoggerFunc.tradeInfo(">>>结束交易必要性检查") #=================检验是否重复交易========================================== AfaLoggerFunc.tradeInfo(">>>开始校验重复交易") bilbka_where_dict = {} bilbka_where_dict['BILRS'] = PL_BILRS_OUT bilbka_where_dict['BILVER'] = TradeContext.BILVER bilbka_where_dict['BILNO'] = TradeContext.BILNO bilbka_where_dict['HPSTAT'] = PL_HPSTAT_PAYC bilbka_dict = rccpsDBTrcc_bilbka.selectu(bilbka_where_dict) if bilbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","查询原汇票信息异常,校验重复交易失败") if len(bilbka_dict) > 0: return AfaFlowControl.ExitThisFlow("S999","此汇票已被解付,重复交易,禁止提交") AfaLoggerFunc.tradeInfo(">>>结束校验重复交易") if TradeContext.BILTYP != PL_BILTYP_CASH: #=================校验入账账号户名====================================== AfaLoggerFunc.tradeInfo(">>>开始校验入账账号户名") TradeContext.HostCode = '8810' TradeContext.ACCNO = TradeContext.PYHACC AfaLoggerFunc.tradeDebug("gbj test :" + TradeContext.ACCNO) rccpsHostFunc.CommHost( TradeContext.HostCode ) if TradeContext.errorCode != '0000': return AfaFlowControl.ExitThisFlow(TradeContext.errorCode,TradeContext.errorMsg) AfaLoggerFunc.tradeDebug("gbj test :" + TradeContext.ACCNM) if TradeContext.ACCNM != TradeContext.PYHNAM: return AfaFlowControl.ExitThisFlow('S999',"账号户名不符") if TradeContext.ACCST != '0' and TradeContext.ACCST != '2': return AfaFlowControl.ExitThisFlow('S999','入账账号状态不正常') AfaLoggerFunc.tradeInfo(">>>结束校验入账账号户名") #=================校验汇票密押============================================== AfaLoggerFunc.tradeInfo(">>>开始校验汇票密押") if TradeContext.BILTYP == PL_BILTYP_CASH: TYPE = PL_TYPE_XJHP elif TradeContext.BILTYP == PL_BILTYP_TRAN: TYPE = PL_TYPE_ZZHP else: return AfaFlowControl.ExitThisFlow("S999","汇票类型非法") AfaLoggerFunc.tradeDebug('TradeContext密押:' + TradeContext.SEAL ) MIYA = TradeContext.SEAL TRCDAT = TradeContext.BILDAT TRCNO = TradeContext.BILNO REMBNKCO = TradeContext.REMBNKCO #签发行 PAYBNKCO = TradeContext.PAYBNKCO #代理付款行 REMBNKCO = REMBNKCO.rjust(12,'0') PAYBNKCO = PAYBNKCO.rjust(12,'0') AMOUNT = str(TradeContext.BILAMT).split('.')[0] + str(TradeContext.BILAMT).split('.')[1] AMOUNT = AMOUNT.rjust(15,'0') INFO = "" AfaLoggerFunc.tradeDebug('处理类型(0-编押 1-核押):' + str(PL_SEAL_DEC) ) AfaLoggerFunc.tradeDebug('业务种类(1-现金汇票 2-转账汇票 3-电子汇兑业务):' + TYPE ) AfaLoggerFunc.tradeDebug('出票日期:' + TRCDAT ) AfaLoggerFunc.tradeDebug('汇票号码:' + TRCNO ) AfaLoggerFunc.tradeDebug('出票金额:' + str(AMOUNT) ) AfaLoggerFunc.tradeDebug('出票行号:' + str(REMBNKCO) ) AfaLoggerFunc.tradeDebug('代理付款行号:' + str(PAYBNKCO) ) AfaLoggerFunc.tradeDebug('汇票密押:' + MIYA ) AfaLoggerFunc.tradeDebug('OTHERINFO[' + str(INFO) + ']') AfaLoggerFunc.tradeDebug('TradeContext密押:' + TradeContext.SEAL ) #====begin 蔡永贵 20110215 修改==== #ret = miya.DraftEncrypt(PL_SEAL_DEC,TYPE,TRCDAT,TRCNO,AMOUNT,REMBNKCO,PAYBNKCO,INFO,MIYA) ret = miya.DraftEncrypt(PL_SEAL_DEC,TYPE,TRCDAT,TradeContext.TMP_BILNO,AMOUNT,REMBNKCO,PAYBNKCO,INFO,MIYA) #============end============ AfaLoggerFunc.tradeDebug('TradeContext密押:' + TradeContext.SEAL ) AfaLoggerFunc.tradeDebug( 'ret=' + str(ret) ) if ret == 9005: return AfaFlowControl.ExitThisFlow('S999','密押错,请检查业务要素和密押') elif ret > 0: return AfaFlowControl.ExitThisFlow('S999','调用密押服务器失败') AfaLoggerFunc.tradeInfo(">>>结束校验汇票密押") #=================登记汇票登记簿======================================== AfaLoggerFunc.tradeInfo(">>>开始登记汇票登记簿") #=================为汇票业务登记簿赋值================================== TradeContext.OPRNO = PL_HPOPRNO_JF #业务类型解付 TradeContext.DCFLG = PL_DCFLG_CRE TradeContext.BILRS = PL_BILRS_OUT TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.TRCNO = TradeContext.SerialNo TradeContext.SNDMBRCO = TradeContext.SNDSTLBIN TradeContext.RCVMBRCO = '1000000000' bilbka_dict = {} if not rccpsMap8502CTradeContext2Dbilbka.map(bilbka_dict): return AfaFlowControl.ExitThisFlow('S999','为汇票业务登记簿赋值异常') #=================登记汇票业务登记簿==================================== if not rccpsDBFunc.insTransBil(bilbka_dict): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow('S999','登记汇票业务登记簿异常') #=================为汇票信息登记簿赋值================================== bilinf_dict = {} if not rccpsMap8502CTradeContext2Dbilinf.map(bilinf_dict): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow('S999','为汇票信息登记簿赋值异常') bilinf_dict['NOTE3'] = TradeContext.BESBNO #将交易机构赋值到汇票信息登记簿中note3字段 #=================登记汇票信息登记簿==================================== if not rccpsDBFunc.insInfoBil(bilinf_dict): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow('S999','登记汇票信息登记簿异常') AfaLoggerFunc.tradeInfo(">>>结束登记汇票登记簿") #=================设置状态为发送处理中====================================== AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为发送处理中") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BCSTAT'] = PL_BCSTAT_SND stat_dict['BDWFLG'] = PL_BDWFLG_WAIT if not rccpsState.setTransState(stat_dict): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow('S999','设置状态为发送处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为发送处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).汇票解付[TRCC003_8502]结束***' ) #=================为汇票解付报文赋值======================================== AfaLoggerFunc.tradeInfo(">>>开始为解付报文赋值") TradeContext.MSGTYPCO = "SET008" TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR TradeContext.SNDTRDAT = TradeContext.BJEDTE TradeContext.SNDTRTIM = TradeContext.BJETIM TradeContext.MSGFLGNO = TradeContext.SNDSTLBIN + TradeContext.TRCDAT + TradeContext.SerialNo TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRTYPNO = "21" TradeContext.ROPRTPNO = "" TradeContext.TRANTYP = "0" TradeContext.ORTRCCO = "" TradeContext.TRCCO = '2100100' TradeContext.TRCNO = TradeContext.SerialNo TradeContext.RCVSTLBIN = TradeContext.RCVMBRCO TradeContext.OPRATTNO = "" AfaLoggerFunc.tradeInfo(">>>结束为解付报文赋值") return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8522]进入***' ) #=====判断接口是否存在==== if( not TradeContext.existVariable( "BJEDTE" ) ): return AfaFlowControl.ExitThisFlow('A099', '交易日期[BJEDTE]不存在') if( not TradeContext.existVariable( "BSPSQN" ) ): return AfaFlowControl.ExitThisFlow('A099', '报单序号[BSPSQN]不存在') if( not TradeContext.existVariable( "OPRTYPNO" ) ): return AfaFlowControl.ExitThisFlow('A099', '业务种类[OPRTYPNO]不存在') if( not TradeContext.existVariable( "BCURSQ" ) ): return AfaFlowControl.ExitThisFlow('A099', '当前处理编号[BCURSQ]不存在') #=====查询历史状态表得到主机日期和主机流水号==== where_sql={'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCURSQ':TradeContext.BCURSQ} ret=rccpsDBTrcc_sstlog.selectu(where_sql) if(ret==None): return AfaFlowControl.ExitThisFlow('A099', '查询历史状态表失败') if(len(ret)==0): return AfaFlowControl.ExitThisFlow('A099', '查询历史状态表结果为空') if(ret['TRDT']=="" or ret['TLSQ']==""): return AfaFlowControl.ExitThisFlow('A099', '此序号状态非成功的账务状态') #=====PL_TRCCO_HP 21 汇票==== if(TradeContext.OPRTYPNO==PL_TRCCO_HP): AfaLoggerFunc.tradeInfo("进入汇票处理") records1={} #=====查询汇票业务登记簿==== bilbka_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} res_bilbka = rccpsDBTrcc_bilbka.selectu(bilbka_where_dict) if( res_bilbka == None): return AfaFlowControl.ExitThisFlow('S999', '查询汇票交易登记簿失败') if( len(res_bilbka) == 0 ): return AfaFlowControl.ExitThisFlow('S999', '查询汇票交易登记簿结果为空') #=====查询状态明细表==== sstlog_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCURSQ':TradeContext.BCURSQ} res_sstlog = rccpsDBTrcc_sstlog.selectu(sstlog_where_dict) if( res_sstlog == None): return AfaFlowControl.ExitThisFlow('S999', '查询历史状态登记簿失败') if( len(res_sstlog) == 0): return AfaFlowControl.ExitThisFlow('S999', '查询历史状态登记簿结果为空') #=====给resords1赋值,字典相加赋值到新的字典==== records1.update(res_bilbka) records1.update(res_sstlog) #=====判断是否为签发机构==== AfaLoggerFunc.tradeInfo("开始判断当前机构是否为交易机构") if( records1['BESBNO'] != TradeContext.BESBNO ): return AfaFlowControl.ExitThisFlow('S999', '为查找到数据') AfaLoggerFunc.tradeInfo("结束判断当前机构是否为交易机构") #=====判断是否为往账业务==== if records1['BRSFLG'] != PL_BRSFLG_SND: return AfaFlowControl.ExitThisFlow('S999','报单序号['+TradeContext.BSPSQN+']该笔业务为来账业务,不允许打印') # #=====判断汇票状态,如果是撤销则不让打印==== # if(records1['HPSTAT'] == PL_HPSTAT_CANC ): # return AfaFlowControl.ExitThisFlow('S999','此汇票为撤销状态,不允许打印') #=====判断当前状态==== #=====PL_BCSTAT_ACC 20 记账==== #=====PL_BCSTAT_HCAC 21 抹账==== if(records1['BCSTAT']!=PL_BCSTAT_ACC and records1['BCSTAT']!=PL_BCSTAT_HCAC): return AfaFlowControl.ExitThisFlow('A009',"当前状态[" + records1['BCSTAT'] + "]不允许打印") records2={} #=====查询汇票信息登记簿==== res=rccpsDBFunc.getInfoBil(records1['BILVER'],records1['BILNO'],records1['BILRS'],records2) if(res==False): return AfaFlowControl.ExitThisFlow('D003','汇票信息登记簿中无记录') #=====输出接口==== rccpsMap8522DTrans2CTradeContext.map(records1) rccpsMap8522DInfo2CTradeContext.map(records2) TradeContext.PRTDAT = AfaUtilTools.GetHostDate() #打印日期 TradeContext.PRTTIM = AfaUtilTools.GetSysTime() #打印时间 TradeContext.PRTCNT = str(int(TradeContext.PRTCNT)+1) #打印次数 TradeContext.BCSTAT = ret['BCSTAT'] #当前状态 TradeContext.BDWFLG = ret['BDWFLG'] #流转处理标识 TradeContext.TRDT = ret['TRDT'] #主机日期 TradeContext.TLSQ = ret['TLSQ'] #主机流水 TradeContext.OCCAMT = str(TradeContext.OCCAMT) #交易金额 TradeContext.BILAMT = str(TradeContext.BILAMT) #出票金额 TradeContext.RMNAMT = str(TradeContext.RMNAMT) #结余金额 #=====更新打印标志==== AfaLoggerFunc.tradeInfo("开始更新打印标志") update_dict={'PRTCNT':TradeContext.PRTCNT} where_dict={'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCSTAT':TradeContext.BCSTAT} rownum=rccpsDBTrcc_sstlog.update(update_dict,where_dict) if(rownum<=0): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('S999','修改数据库打印次数失败') else: AfaLoggerFunc.tradeDebug('>>>commit 成功') AfaDBFunc.CommitSql() TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" #=====PL_TRCCO_HD 20 汇兑==== elif(TradeContext.OPRTYPNO==PL_TRCCO_HD): AfaLoggerFunc.tradeInfo("进入汇兑处理") records={} #=====查询汇兑登记簿==== trcbka_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} res_trcbka = rccpsDBTrcc_trcbka.selectu(trcbka_where_dict) if( res_trcbka == None ): return AfaFlowControl.ExitThisFlow('S999', '查询汇兑登记簿异常') if( len(res_trcbka) == 0 ): return AfaFlowControl.ExitThisFlow('S999', '查询汇兑登记簿结果为空') #=====查询历史状态表==== sstlog_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCURSQ':TradeContext.BCURSQ} res_sstlog = rccpsDBTrcc_sstlog.selectu(sstlog_where_dict) if( res_sstlog == None): return AfaFlowControl.ExitThisFlow('S999', '查询历史状态登记簿失败') if( len(res_sstlog) == 0): return AfaFlowControl.ExitThisFlow('S999', '查询历史状态登记簿结果为空') #=====给records赋值,字典相加赋值到新的字典==== records.update(res_trcbka) records.update(res_sstlog) #=====判断是否为签发机构==== AfaLoggerFunc.tradeInfo("开始判断当前机构是否为交易机构") if( records['BESBNO'] != TradeContext.BESBNO ): return AfaFlowControl.ExitThisFlow('S999', '非签发机构') AfaLoggerFunc.tradeInfo("结束判断当前机构是否为交易机构") #=====判断是否为往账业务==== if records['BRSFLG'] != PL_BRSFLG_SND: return AfaFlowControl.ExitThisFlow('S999','报单序号['+TradeContext.BSPSQN+']该笔业务为来账业务,不允许打印') #=====判断当前状态==== #=====PL_BCSTAT_ACC 20 记账==== #=====PL_BCSTAT_HCAC 21 抹账==== if not (records['BCSTAT']==PL_BCSTAT_ACC or records['BCSTAT'] == PL_BCSTAT_HCAC): return AfaFlowControl.ExitThisFlow('A009',"当前状态[" + records1['BCSTAT'] + "]不允许打印") rccpsMap8522DTransTrc2CTradeContext.map(records) #=====输出接口==== TradeContext.PRTDAT = AfaUtilTools.GetHostDate() #打印日期 TradeContext.PRTTIM = AfaUtilTools.GetSysTime() #打印时间 TradeContext.PRTCNT = str(int(TradeContext.PRTCNT)+1) #打印次数 TradeContext.OCCAMT = str(TradeContext.OCCAMT) #交易金额 TradeContext.BILAMT = str(TradeContext.COMAMT) #出票金额 TradeContext.BCSTAT = ret['BCSTAT'] #当前状态 TradeContext.BDWFLG = ret['BDWFLG'] #流转处理标识 TradeContext.TRDT = ret['TRDT'] #主机日期 TradeContext.TLSQ = ret['TLSQ'] #主机流水号 #=====更新打印标志==== AfaLoggerFunc.tradeInfo("开始更新打印标志") update_dict={'PRTCNT':TradeContext.PRTCNT} where_dict={'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCSTAT':TradeContext.BCSTAT} rownum=rccpsDBTrcc_sstlog.update(update_dict,where_dict) if(rownum<=0): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('S999','修改数据库打印次数失败') AfaDBFunc.CommitSql() TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" #=====30 通存通兑==== elif( TradeContext.OPRTYPNO == PL_TRCCO_TCTD ): AfaLoggerFunc.tradeInfo("进入通存通兑处理") records = {} #=====查询交易信息==== AfaLoggerFunc.tradeInfo("查询交易信息") wtrbka_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} res_wtrbka = rccpsDBTrcc_wtrbka.selectu(wtrbka_where_dict) if( len(res_wtrbka) == 0 ): return AfaFlowControl.ExitThisFlow('A009','查询交易信息结果为空') if( res_wtrbka == None ): return AfaFlowControl.ExitThisFlow('A009','查询交易信息失败') #=====查询交易的历史状态==== AfaLoggerFunc.tradeInfo("查询交易的历史状态") sstlog_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCURSQ':TradeContext.BCURSQ} res_sstlog = rccpsDBTrcc_sstlog.selectu(sstlog_where_dict) if( len(res_sstlog) == 0 ): return AfaFlowControl.ExitThisFlow('A009','查询交易历史状态结果为空') if( res_sstlog == None ): return AfaFlowControl.ExitThisFlow('A009','查询交易历史状态失败') #=====给records字典赋值,字典相加,赋值到新的字典==== records.update(res_wtrbka) records.update(res_sstlog) #=====判断是否为签发机构==== AfaLoggerFunc.tradeInfo("判断是否为签发机构") if( records['BESBNO'] != TradeContext.BESBNO ): return AfaFlowControl.ExitThisFlow('A009','此机构不是签发机构') #=====判断此交易是否为往账==== AfaLoggerFunc.tradeInfo("判断此交易是否为往账") if( records['BRSFLG'] != PL_BRSFLG_SND ): return AfaFlowControl.ExitThisFlow('A009','此交易不是往账交易') #=====判断交易状态==== AfaLoggerFunc.tradeInfo("判断此交易状态") if not ( records['BCSTAT'] == PL_BCSTAT_ACC or records['BCSTAT'] == PL_BCSTAT_HCAC or records['BCSTAT'] == PL_BCSTAT_CANCEL or records['BCSTAT'] == PL_BCSTAT_CANC): return AfaFlowControl.ExitThisFlow('A009','此状态不允许打印') if(records['BCSTAT'] == PL_BCSTAT_CANCEL or records['BCSTAT'] == PL_BCSTAT_CANC): if(records['TRDT'] == "" or records['TLSQ'] == ""): return AfaFlowControl.ExitThisFlow('A009','此笔业务没有产生产生账务') rccpsMap8522Drecords2CTradeContext.map(records) #=====输出接口==== AfaLoggerFunc.tradeInfo("给输出接口赋值") TradeContext.PRTDAT = AfaUtilTools.GetHostDate() TradeContext.PRTTIM = AfaUtilTools.GetSysTime() TradeContext.PRTCNT = str(int(records['PRTCNT'])+1) TradeContext.USE = "" TradeContext.BILAMT = str(records['OCCAMT']) TradeContext.BCSTAT = ret['BCSTAT'] #当前状态 TradeContext.BDWFLG = ret['BDWFLG'] #流转处理标识 TradeContext.TRDT = ret['TRDT'] #主机日期 TradeContext.TLSQ = ret['TLSQ'] #主机流水号 TradeContext.REMARK = "" TradeContext.DASQ = records['DASQ'] #销账序号 TradeContext.BNKBKNO = records['BNKBKNO'] #存折号码 TradeContext.CHSHTP = records['CHRGTYP'] #手续费收取方式 if(records['TRCCO'] in ('3000002','30000102')): #卡折标志 TradeContext.PYITYP = records['PYETYP'] else: TradeContext.PYITYP = records['PYRTYP'] #=====更新打印标志==== AfaLoggerFunc.tradeInfo("开始更新打印标志") update_dict={'PRTCNT':str(int(records['PRTCNT'])+1)} where_dict={'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCURSQ':TradeContext.BCURSQ} rownum=rccpsDBTrcc_sstlog.update(update_dict,where_dict) if(rownum<=0): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('S999','修改数据库打印次数失败') AfaDBFunc.CommitSql() TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" else: return AfaFlowControl.ExitThisFlow('A009','业务种类非法') AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8522]退出***' ) return True