def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo( '>>>开始判断主机返回结果' ) status_dict = {} status_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 status_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 status_dict['BCSTAT'] = PL_BCSTAT_ACC #记账 #=====判断主机返回结果==== if TradeContext.errorCode != '0000': status_dict['BDWFLG'] = PL_BDWFLG_FAIL #失败 status_dict['STRINFO'] = TradeContext.errorMsg #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: status_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 status_dict['TRDT'] = TradeContext.TRDT #主机日期 status_dict['TLSQ'] = TradeContext.TLSQ #主机流水号 status_dict['MGID'] = TradeContext.MGID #主机返回信息 status_dict['DASQ'] = TradeContext.DASQ #销账序号 #=====修改退汇记录的状态==== if not rccpsState.setTransState(status_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====判断主机返回结果,是否继续流程==== if TradeContext.errorCode != '0000': return AfaFlowControl.ExitThisFlow('D011', '该笔业务已入账,不允许退汇') #return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) #=====新增记录的状态为:发送-处理中==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_SND,PL_BDWFLG_WAIT): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() #=====发送中心==== TradeContext.ROPRTPNO = '20' return True
def SubModuledoSnd(): #在退付信息写到本地数据库里面 sqlstr = "insert into FS_FC75(AAA010,AFC060,AFC041,AFA050,AFC061,AFC062,AFC063,AFC064,FBLRQ,AFA101,BUSINO,TELLER,BRNO,FLAG,DATE,TIME) values(" FLAG = '0' sqlstr = sqlstr + "'" + TradeContext.AAA010 + "'," sqlstr = sqlstr + "'" + TradeContext.AFC060 + "'," sqlstr = sqlstr + "'" + TradeContext.AFC041 + "'," sqlstr = sqlstr + "'" + TradeContext.AFA050 + "'," sqlstr = sqlstr + "'" + TradeContext.AFC061 + "'," sqlstr = sqlstr + "'" + TradeContext.AFC062 + "'," sqlstr = sqlstr + "'" + TradeContext.AFC063 + "'," sqlstr = sqlstr + "'" + TradeContext.AFC064 + "'," sqlstr = sqlstr + "'" + TradeContext.FBLRQ + "'," sqlstr = sqlstr + "'" + TradeContext.bankbm + "'," sqlstr = sqlstr + "'" + TradeContext.busiNo + "'," sqlstr = sqlstr + "'" + TradeContext.teller + "'," sqlstr = sqlstr + "'" + TradeContext.brno + "'," sqlstr = sqlstr + "'" + FLAG + "'," sqlstr = sqlstr + "'" + TradeContext.workDate + "'," sqlstr = sqlstr + "'" + TradeContext.workTime + "')" TradeContext.errorCode = "0000" TradeContext.errorMsg = "退付成功" if( AfaDBFunc.InsertSql( sqlstr ) < 1 ): AfaDBFunc.RollbackSql( ) AfaLoggerFunc.tradeInfo( '插入退付信息表失败' + sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) TradeContext.errorCode = "0001" TradeContext.errorMsg = "退付失败" return False AfaDBFunc.CommitSql( ) AfaLoggerFunc.tradeInfo( '插入退付信息表结束' ) #本模块主要是为了填写发票数据 if (TradeContext.channelCode =='001' ): #柜面交易不计发票 TradeContext.__billSaveCtl__ = '0' else: TradeContext.__billSaveCtl__ = '1' bill = [] bill.append('1') bill.append('') bill.append('') bill.append('') bill.append('') bill.append('') bill.append('') bill.append('') return bill
def SubModuleDoTrd(): AfaLoggerFunc.tradeDebug('>>>开始处理AFE返回结果') status = {} status['BSPSQN'] = TradeContext.BSPSQN #报单序号 status['BJEDTE'] = TradeContext.BJEDTE #交易日期 status['BCSTAT'] = PL_BCSTAT_SND #发送 #=====开始判断afe返回结果==== if TradeContext.errorCode != '0000': status['BDWFLG'] = PL_BDWFLG_FAIL #失败 #==== 张恒增于20091216 退汇业务发送MFE失败更新原业务状态===== #===========退汇业务,更新原交易挂账代销账序号============== AfaLoggerFunc.tradeInfo(">>>开始更新原交易挂账代销账序号(8509)") orstat_dict = {} orstat_dict['BJEDTE'] = TradeContext.BOJEDT orstat_dict['BSPSQN'] = TradeContext.BOSPSQ orstat_dict['BCSTAT'] = PL_BCSTAT_HANG orstat_dict['BDWFLG'] = PL_BDWFLG_FAIL if TradeContext.existVariable('DASQ'): orstat_dict['DASQ'] = TradeContext.DASQ if not rccpsState.setTransState(orstat_dict): return False AfaLoggerFunc.tradeInfo(">>>结束更新原交易挂账代销账序号(8509)") else: status['BDWFLG'] = PL_BDWFLG_SUCC #成功 #=====修改退汇记录的状态==== if not rccpsState.setTransState(status): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #关彬捷 2008-07-23 #此处不更改原交易状态为退汇,在清算回执中修改 ##=====设置原记录状态为:退汇-成功==== #if not rccpsState.newTransState(TradeContext.BOJEDT,TradeContext.BOSPSQ,PL_BCSTAT_QTR,PL_BDWFLG_SUCC): # #=====RollBack操作==== # AfaDBFunc.RollbackSql() # return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') #else: # #=====commit操作==== # AfaDBFunc.CommitSql() return True
def SubModuleDoSnd(): AfaLoggerFunc.tradeDebug('>>>开始处理AFE返回结果') status = {} status['BSPSQN'] = TradeContext.BSPSQN #报单序号 status['BJEDTE'] = TradeContext.BJEDTE #交易日期 status['BCSTAT'] = PL_BCSTAT_SND #发送 status['STRINFO'] = TradeContext.errorMsg #=====开始判断afe返回结果==== if TradeContext.errorCode != '0000': status['BDWFLG'] = PL_BDWFLG_FAIL #失败 else: status['BDWFLG'] = PL_BDWFLG_SUCC #成功 #=====修改退汇记录的状态==== if not rccpsState.setTransState(status): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>通讯回执处理成功') #=====发送退汇报文2000004==== TradeContext.sysType = 'rccpst' TradeContext.TRCCO = '2000004' TradeContext.MSGTYPCO = 'SET005' TradeContext.OPRTYPNO = '20' #汇兑 TradeContext.STRINFO = '收到紧急止付,系统自动退汇' #=====接收行号与发送行号互换==== TradeContext.TEMP = TradeContext.RCVBNKCO TradeContext.RCVBNKCO = TradeContext.SNDBNKCO TradeContext.SNDBNKCO = TradeContext.TEMP #=====接收行名与发送行名互换==== TradeContext.NAME = TradeContext.RCVBNKNM TradeContext.RCVBNKNM = TradeContext.SNDBNKNM TradeContext.SNDBNKNM = TradeContext.NAME #=====发送afe==== AfaAfeFunc.CommAfe() #=====开始判断afe返回结果==== if TradeContext.errorCode != '0000': return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: AfaLoggerFunc.tradeDebug('>>>发送退汇成功') return True
def InsertDB(record): tradeLogger.info(HostContext.O1ACBL) #=====向8446表中插入数据==== tradeLogger.info("进入InsertDB,向8446表中插入数据") #TradeContext.serDate = AfaAdminFunc.getTimeFromNow(int(-1)) #TradeContext.serDate ='20091231' insertsql = "insert into FS_8446_REMAIN(BUSINO,DATE,THIS,ACCNO,BANKNO) VALUES('"+ \ record[0] + "','" + TradeContext.serDate + "','" + str(float(HostContext.O1ACBL)) + "','" + record[1] + "','" + record[3] + "')" tradeLogger.info(insertsql) res = AfaDBFunc.InsertSql(insertsql) if(res < -1): AfaDBFunc.RollbackSql( ) tradeLogger.info('BUSINO>>>'+record[0]) tradeLogger.info("插入8446余额表失败") return False AfaDBFunc.CommitSql( ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( "====开始汇兑退汇来账接收处理====" ) #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_trcbka.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' #===================查询原交易信息========================================= AfaLoggerFunc.tradeInfo(">>>开始查询原交易信息") ortrc_dict = {} if not rccpsDBFunc.getTransTrcAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,ortrc_dict): AfaLoggerFunc.tradeInfo("未找到原交易信息") TradeContext.BOJEDT = "" TradeContext.BOSPSQ = "" else: TradeContext.BOJEDT = ortrc_dict['BJEDTE'] TradeContext.BOSPSQ = ortrc_dict['BSPSQN'] #=====刘雨龙 2008-09-17 增加业务类型==== TradeContext.OPRATTNO = ortrc_dict['OPRATTNO'] AfaLoggerFunc.tradeInfo(">>>结束查询原交易信息") #====开始向字典赋值==== trcbka_dict = {} if not rccpsMap1101CTradeContext2Dtrcbka_dict.map(trcbka_dict): return AfaFlowControl.ExitThisFlow('M999', '字典赋值出错') trcbka_dict['DCFLG'] = PL_DCFLG_CRE #借贷标识 trcbka_dict['OPRNO'] = '09' #业务属性 #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(trcbka_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('插入汇兑业务登记簿,COMMIT成功') ##========================= START 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #初始化记挂账标识,记账.0,挂账.1,默认记账 accflag = 0 #接收机构暂存 TradeContext.BESBNOFIRST = TradeContext.BESBNO #校验账号是否非法 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号是否非法") if (len(TradeContext.PYEACC) != 23) and (len(TradeContext.PYEACC) != 19) : accflag = 1 TradeContext.NOTE3 = '此账号不是对公或对私账号,挂账!' AfaLoggerFunc.tradeInfo("结束校验账号是否非法") #调用主机接口查询账户信息 if accflag == 0: #调用8810查询账户信息 AfaLoggerFunc.tradeInfo("开始查询账户信息") TradeContext.ACCNO = TradeContext.PYEACC TradeContext.HostCode = '8810' rccpsHostFunc.CommHost( '8810' ) if TradeContext.errorCode != '0000': accflag = 1 TradeContext.NOTE3 = '查询收款人信息失败,挂账!' elif TradeContext.errorCode == '0000' and len(TradeContext.ACCSO) == 0 : accflag = 1 TradeContext.NOTE3 = '查询收款人开户机构失败,挂账!' AfaLoggerFunc.tradeInfo("结束查询账户信息") #校验账户状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验是否跨法人") if TradeContext.ACCSO[0:6] != TradeContext.BESBNO[0:6] : accflag = 1 TradeContext.NOTE3 = '接收行与账户开户行跨法人,挂账!' AfaLoggerFunc.tradeInfo("结束校验是否跨法人") #校验开户机构是否建立代理关系 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验接收行与开户机构是否为同一机构") if TradeContext.ACCSO != TradeContext.BESBNOFIRST: khjg = {} khjg['BESBNO'] = TradeContext.ACCSO khjg['BTOPSB'] = TradeContext.BESBNOFIRST khjg['SUBFLG'] = PL_SUBFLG_SUB rec = rccpsDBTrcc_subbra.selectu(khjg) if rec == None: accflag = 1 TradeContext.NOTE3 = '查询账户代理关系失败,挂账!' elif len(rec) <= 0: accflag = 1 TradeContext.NOTE3 = '账户未建立代理关系,挂账!' else: #接收机构与开户机构存在代理关系,设置机构号为开户机构号 TradeContext.BESBNO = TradeContext.ACCSO AfaLoggerFunc.tradeInfo("结束校验接收行与开户机构是否为同一机构") #校验账号状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号状态是否正常") if TradeContext.ACCST != '0' and TradeContext.ACCST != '2': accflag = 1 TradeContext.NOTE3 = '账户状态不正常,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验账号状态是否正常") #校验收款人户名是否一致 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验收款人户名是否一致") if TradeContext.ACCNM != TradeContext.PYENAM : accflag = 1 TradeContext.NOTE3 = '收款人户名不符,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验收款人户名是否一致") if (TradeContext.existVariable( "PYEACC" ) and len(TradeContext.PYEACC) != 0): #收款人名称 TradeContext.PYEACC = TradeContext.PYEACC else: TradeContext.PYEACC = '' if (TradeContext.existVariable( "PYENAM" ) and len(TradeContext.PYENAM) != 0): #收款人名称 TradeContext.OTNM = TradeContext.PYENAM else: TradeContext.OTNM = '' #汇兑往帐记帐字典赋值 input_dict = {} input_dict['accflag'] = str(accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['PYEACC'] = TradeContext.PYEACC #收款人账号 input_dict['OTNM'] = TradeContext.OTNM #收款人名称 input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑记账接口 rccpsEntries.HDLZJZ(input_dict) TradeContext.accflag = accflag #代理标志 #=====开始调函数拼贷方账号第25位校验位==== TradeContext.HostCode = '8813' #调用8813主机接口 TradeContext.RCCSMCD = PL_RCCSMCD_HDLZ #主机摘要代码:汇兑来账 TradeContext.ACUR = '1' ##========================= END 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #=====设置状态为收妥==== 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成功') return True
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo('>>>主机记账后处理') #=====开始向字典赋值==== sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 sst_dict['SBAC'] = TradeContext.SBAC #借方账号 sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 if (TradeContext.existVariable( "NOTE3" ) and len(TradeContext.NOTE3) != 0): sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 sst_dict['MGID'] = TradeContext.errorCode #主机返回代码 sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 sst_dict['BETELR'] = TradeContext.BETELR #柜员号 #=====开始判断主机返回结果==== out_context_dict = {} if TradeContext.errorCode == '0000' : AfaLoggerFunc.tradeDebug('>>>主机通讯成功,更新表状态开始') trcbka_jgh = {} trcbka_where = {} trcbka_jgh['BESBNO'] = TradeContext.BESBNO trcbka_where['BSPSQN'] = TradeContext.BSPSQN trcbka_where['BJEDTE'] = TradeContext.BJEDTE if not rccpsDBTrcc_trcbka.updateCmt( trcbka_jgh,trcbka_where ): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '更新数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('更新登记簿,COMMIT成功') if (TradeContext.existVariable( "RBAC" ) and len(TradeContext.RBAC) != 0): sst_dict['RBAC'] = TradeContext.RBAC AfaLoggerFunc.tradeDebug('>>>test RBAC =['+TradeContext.RBAC +']') if (TradeContext.existVariable( "REAC" ) and len(TradeContext.REAC) != 0): sst_dict['REAC'] = TradeContext.REAC AfaLoggerFunc.tradeDebug('>>>test REAC =['+TradeContext.REAC +']') #自动挂账 if TradeContext.accflag == 1 : sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 AfaLoggerFunc.tradeDebug('>>>test BCSTAT=['+str(sst_dict['BCSTAT']) +']') #自动入账 elif TradeContext.accflag == 0 : sst_dict['BCSTAT'] = PL_BCSTAT_AUTO #自动入账 AfaLoggerFunc.tradeDebug('>>>test BCSTAT=['+str(sst_dict['BCSTAT']) +']') if (TradeContext.existVariable( "DASQ" ) and len(TradeContext.DASQ) != 0): sst_dict['DASQ'] = TradeContext.DASQ #销账序号 AfaLoggerFunc.tradeDebug('>>>test DASQ =['+TradeContext.DASQ +']') sst_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 AfaLoggerFunc.tradeDebug('>>>test BDWFLG=['+str(sst_dict['BDWFLG']) +']') sst_dict['TRDT'] = TradeContext.TRDT #主机日期 AfaLoggerFunc.tradeDebug('>>>test TRDT =['+TradeContext.TRDT +']') sst_dict['TLSQ'] = TradeContext.TLSQ #主机流水 AfaLoggerFunc.tradeDebug('>>>test TLSQ =['+TradeContext.TLSQ +']') AfaLoggerFunc.tradeDebug('>>>主机通讯成功,更新表状态结束') out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else : if TradeContext.accflag == 1 : sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 sst_dict['BDWFLG'] = PL_BDWFLG_FAIL #处理失败 out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '挂账失败,交易失败' elif TradeContext.accflag == 0 : #记账失败,挂代理机构账 TradeContext.BESBNO = TradeContext.BESBNOFIRST #汇兑来帐挂帐字典赋值 input_dict = {} input_dict['accflag'] = str(TradeContext.accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['BESBNO'] = TradeContext.BESBNOFIRST #调用汇兑记账接口 rccpsEntries.HDLZGZ(input_dict) rccpsHostFunc.CommHost( '8813' ) sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 AfaLoggerFunc.tradeDebug('>>>test BSPSQN=['+TradeContext.BSPSQN+']') sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 AfaLoggerFunc.tradeDebug('>>>test BJEDTE=['+TradeContext.BJEDTE+']') sst_dict['SBAC'] = TradeContext.SBAC #借方账号 AfaLoggerFunc.tradeDebug('>>>test SBAC=['+TradeContext.SBAC+']') sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 AfaLoggerFunc.tradeDebug('>>>test BESBNO=['+TradeContext.BESBNO+']') if (TradeContext.existVariable( "NOTE3" ) and len(TradeContext.NOTE3) != 0): sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 AfaLoggerFunc.tradeDebug('>>>test BJETIM=['+TradeContext.BJETIM+']') sst_dict['MGID'] = TradeContext.errorCode #主机返回代码 sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 sst_dict['BETELR'] = TradeContext.BETELR #柜员号 if TradeContext.errorCode == '0000': AfaLoggerFunc.tradeDebug(">>>SubModuleDoSnd--挂帐成功") sst_dict['BCSTAT'] = PL_BCSTAT_HANG sst_dict['BDWFLG'] = PL_BDWFLG_SUCC out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else: AfaLoggerFunc.tradeDebug(">>>SubModuleDoSnd--挂帐失败") sst_dict['BCSTAT'] = PL_BCSTAT_HANG sst_dict['BDWFLG'] = PL_BDWFLG_FAIL out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '挂账失败,交易失败' AfaLoggerFunc.tradeDebug('>>>当前业务状态[' + str(sst_dict['BCSTAT']) + ']') AfaLoggerFunc.tradeDebug('>>>当前流转标志[' + str(sst_dict['BDWFLG']) + ']') #=====设置状态为 记账/挂账-成功 ==== if not rccpsState.setTransState(sst_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>commit成功') # 关彬捷 20080730 更新原交易状态为退汇成功 if TradeContext.BOJEDT != "" and TradeContext.BOSPSQ != "": AfaLoggerFunc(">>>开始修改原交易状态为退汇成功") if not rccpsState.newTransState(TradeContext.BOJEDT,TradeContext.BOSPSQ,PL_BCSTAT_QTR,PL_BDWFLG_SUCC): #return False return AfaFlowControl.ExitThisFlow('S999','设置状态出错') AfaLoggerFunc(">>>开始修改原交易状态为退汇成功") #=====开始设置通讯回执报文信息==== AfaLoggerFunc.tradeInfo('>>>开始组织通讯回执报文') 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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 rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) return True
def SubModuleDoFst(): #time.sleep(60) AfaLoggerFunc.tradeInfo("农信银系统:来账.中心类操作(1.本地操作).柜台冲销来账接收[TRCC006_1145]进入") #=====判断是否为重复交易==== AfaLoggerFunc.tradeInfo(">>>判断是否为重复交易") where_dict = {} where_dict = {'TRCDAT':TradeContext.TRCDAT,'TRCNO':TradeContext.TRCNO,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_mpcbka.selectu(where_dict) if( record == None ): AfaLoggerFunc.tradeDebug(">>>查找冲销登记簿异常,抛弃报文,等待中心发送自动冲正报文") return AfaFlowControl.ExitThisFlow('A099',"查找冲销登记簿异常") elif( len(record) > 0 ): #重复交易 AfaLoggerFunc.tradeDebug(">>>冲销交易重复") else: AfaLoggerFunc.tradeDebug(">>>非重复交易") #=====开始登记柜台冲销登记簿==== AfaLoggerFunc.tradeDebug(">>>开始登记冲销登记簿") #TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.ORTRCDAT = TradeContext.TRCDAT mpcbka_insert_dict = {} if not rccpsMap1145CTradeContext2Dmpcbka_dict.map(mpcbka_insert_dict): AfaLoggerFunc.tradeDebug("为冲销登记簿字典赋值失败") return AfaFlowControl.ExitThisFlow('S999','为字典赋值失败,抛弃报文,等待中心自动冲正') res = rccpsDBTrcc_mpcbka.insertCmt(mpcbka_insert_dict) if( res == -1): AfaLoggerFunc.tradeDebug(">>>登记冲销登记簿失败") return AfaFlowControl.ExitThisFlow('S999','插入数据库失败,抛弃报文,等待中心自动冲正') #=====commit数据==== AfaDBFunc.CommitSql() #=====查找自动冲正登记簿是否存在记录==== AfaLoggerFunc.tradeDebug(">>>判断是否存在自动冲正报文") atcbka_where = {'ORMFN':TradeContext.MSGFLGNO} atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where) if( len(atcbka_dict) > 0 ): #=====冲销业务存在自动冲正报文,更新表数据为冲销失败,回复冲销失败报文==== AfaLoggerFunc.tradeDebug('>>>已存在自动冲正报文,拒绝冲销,回复拒绝报文') #=====为返回冲销成功发送拒绝回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.PRCCO = 'NN1IA999' #中心返回码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 TradeContext.STRINFO = '原交易已自动冲正,不允许再次冲销' #附言 return True else: AfaLoggerFunc.tradeDebug('>>>未查找到针对冲销报文的自动冲正报文,流程继续') #=====查找原交易是否存在==== AfaLoggerFunc.tradeDebug(">>>查找原交易是否存在") where_dict = {'TRCDAT':TradeContext.ORMFN[10:18],'TRCNO':TradeContext.ORTRCNO,'SNDBNKCO':TradeContext.SNDBNKCO} wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(where_dict) if( wtrbka_dict == -1 ): AfaLoggerFunc.tradeInfo(">>>查找原交易失败,原业务中心流水号["+str(TradeContext.ORTRCNO)+"]") return AfaFlowControl.ExitThisFlow('A099',"查找原交易失败,抛弃报文,等待中心自动冲正") if( len(wtrbka_dict) == 0 ): #=====未查找到原交易==== AfaLoggerFunc.tradeDebug(">>>查找原交易失败,未收到原交易,直接回复拒绝报文") #=====为返回冲销成功发送成功回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 #关彬捷 20081222 修改:如果未找到原业务,则返回拒绝应答 TradeContext.PRCCO = 'NN1IA999' #中心返回码 TradeContext.STRINFO = '无此交易' #附言 return True else: #=====查找原交易成功==== AfaLoggerFunc.tradeInfo(">>>查找原交易成功") #=====将原报单序号 原交易日期更新到冲销登记簿中==== AfaLoggerFunc.tradeInfo('>>>更新原报单序号\原交易日期') mpcbka_where={} mpcbka_where['BSPSQN'] = TradeContext.BSPSQN #报单序号 mpcbka_where['BJEDTE'] = TradeContext.BJEDTE #交易日期 mpcbka_dict ={} mpcbka_dict['BOJEDT'] = wtrbka_dict['BJEDTE'] #原交易日期 mpcbka_dict['BOSPSQ'] = wtrbka_dict['BSPSQN'] #原报单序号 mpcbka_dict['BESBNO'] = wtrbka_dict['BESBNO'] #原机构号 mpcbka_dict['STRINFO'] = TradeContext.STRINFO #附言 mpcbka_dict['OPRNO'] = PL_TDOPRNO_CX #业务类型 ret = rccpsDBTrcc_mpcbka.update(mpcbka_dict,mpcbka_where) if ret <= 0: AfaDBFunc.RollBackSql( ) return AfaFlowControl.ExitThisFlow('S999', "更新冲销登记簿原报单序号和原交易日期异常,抛弃报文") else: AfaDBFunc.CommitSql( ) AfaLoggerFunc.tradeInfo(">>>结束更新冲销登记簿原交易日期和原报单序号") #=====查找原来账业务业务状态==== AfaLoggerFunc.tradeInfo(">>>查找原业务状态") spbsta_where = {'BJEDTE':wtrbka_dict['BJEDTE'],'BSPSQN':wtrbka_dict['BSPSQN']} spbsta_dict = rccpsDBTrcc_spbsta.selectu(spbsta_where) if( spbsta_dict == None ): AfaLoggerFunc.tradeDebug(">>>查找原业务状态失败,发送中心失败报文") #=====为返回冲销成功发送拒绝回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.PRCCO = 'RCCO1006' #中心返回码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 TradeContext.STRINFO = '开户行处理失败' #附言 return True #关彬捷 20081226 新增查询交易当前状态详细信息 #查询交易当前状态详细信息 sstlog_where = {'BJEDTE':wtrbka_dict['BJEDTE'],'BSPSQN':wtrbka_dict['BSPSQN'],'BCURSQ':spbsta_dict['BCURSQ']} spbsta_dict = rccpsDBTrcc_sstlog.selectu(sstlog_where) if( spbsta_dict == None ): AfaLoggerFunc.tradeDebug(">>>查找原业务状态失败,发送中心失败报文") #=====为返回冲销成功发送拒绝回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.PRCCO = 'RCCO1006' #中心返回码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 TradeContext.STRINFO = '开户行处理失败' #附言 return True #关彬捷 20081226 新增若交易当前状态为自动扣款,自动入账,冲销,冲正处理中状态,则直接拒绝此冲销 if (spbsta_dict['BCSTAT'] == PL_BCSTAT_AUTO or spbsta_dict['BCSTAT'] == PL_BCSTAT_AUTOPAY or spbsta_dict['BCSTAT'] == PL_BCSTAT_CANC or spbsta_dict['BCSTAT'] == PL_BCSTAT_CANCEL) and spbsta_dict['BDWFLG'] == PL_BDWFLG_WAIT: #=====为返回冲销成功发送拒绝回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.PRCCO = 'RCCO1006' #中心返回码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 TradeContext.STRINFO = '原交易账务状态未知' #附言 return True #关彬捷 20081226 新增若交易当前状态为自动扣款,自动入账,冲销,冲正失败状态,则调用8816查询账务状态 if (spbsta_dict['BCSTAT'] == PL_BCSTAT_AUTO or spbsta_dict['BCSTAT'] == PL_BCSTAT_AUTOPAY or spbsta_dict['BCSTAT'] == PL_BCSTAT_CANC or spbsta_dict['BCSTAT'] == PL_BCSTAT_CANCEL) and spbsta_dict['BDWFLG'] == PL_BDWFLG_FAIL: AfaLoggerFunc.tradeDebug('>>>调用8816查找该业务[' + wtrbka_dict['BSPSQN'] + ']状态') TradeContext.HostCode = '8816' #主机交易码 TradeContext.OPFG = '1' #查询类型 TradeContext.NBBH = 'RCC' #代理业务标识 TradeContext.FEDT = spbsta_dict['FEDT'] #原前置日期 TradeContext.RBSQ = spbsta_dict['RBSQ'] #原前置流水号 TradeContext.DAFG = '1' #抹/记账标志 1:记 2:抹 TradeContext.BESBNO = spbsta_dict['BESBNO'] #机构号 TradeContext.BETELR = spbsta_dict['BETELR'] #柜员号 rccpsHostFunc.CommHost( TradeContext.HostCode ) #=====分析主机返回==== if TradeContext.errorCode == '0000': #此账务已成功记主机账,修改原交易状态为记账成功 AfaLoggerFunc.tradeInfo("此账务已成功记主机账,修改原交易状态为记账成功") stat_dict = {} stat_dict['BJEDTE'] = spbsta_dict['BJEDTE'] stat_dict['BSPSQN'] = spbsta_dict['BSPSQN'] stat_dict['BCSTAT'] = spbsta_dict['BCSTAT'] stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['TRDT'] = HostContext.O1DADT #主机日期 stat_dict['TLSQ'] = HostContext.O1AMTL #主机流水 stat_dict['MGID'] = '0000' stat_dict['STRINFO']= '主机成功' if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置原交易业务状态为记账成功异常') if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #更新查询出交易状态 spbsta_dict['BDWFLG'] = PL_BDWFLG_SUCC spbsta_dict['TRDT'] = HostContext.O1DADT spbsta_dict['TLSQ'] = HostContext.O1AMTL elif TradeContext.errorCode == 'XCR0001': AfaLoggerFunc.tradeInfo(">>>主机返回原交易记账失败,继续冲销") else: AfaLoggerFunc.tradeInfo(">>>查询原交易账务状态异常,返回拒绝应答") #=====为返回冲销成功发送拒绝回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.PRCCO = 'RCCO1006' #中心返回码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 TradeContext.STRINFO = '原交易账务状态未知' #附言 return True #=====根据来往帐标识进行冲销状态判断==== if( wtrbka_dict['BRSFLG'] == PL_BRSFLG_RCV ): #=====来账业务==== AfaLoggerFunc.tradeDebug(">>>来账业务") #=====PL_BCSTAT_AUTOPAY 自动扣款==== #=====PL_BCSTAT_AUTO 自动入账==== #=====PL_BCSTAT_CONFPAY 确认付款==== #=====PL_BCSTAT_CONFACC 确认入账==== #=====PL_BCSTAT_MFERFE 拒绝==== #=====PL_BCSTAT_CANC 冲销==== #=====PL_BCSTAT_CANCEL 冲正==== if( ((spbsta_dict['BCSTAT']==PL_BCSTAT_AUTO or spbsta_dict['BCSTAT']==PL_BCSTAT_AUTOPAY) and spbsta_dict['BDWFLG']==PL_BDWFLG_FAIL) \ or (spbsta_dict['BCSTAT'] == PL_BCSTAT_MFERFE and spbsta_dict['BDWFLG'] == PL_BDWFLG_SUCC) \ or (spbsta_dict['BCSTAT'] == PL_BCSTAT_CANC and spbsta_dict['BDWFLG'] == PL_BDWFLG_SUCC) \ or (spbsta_dict['BCSTAT'] == PL_BCSTAT_CANCEL and spbsta_dict['BDWFLG'] == PL_BDWFLG_SUCC) \ or (spbsta_dict['BCSTAT'] == PL_BCSTAT_CONFPAY and spbsta_dict['BDWFLG'] == PL_BDWFLG_SUCC) \ or (spbsta_dict['BCSTAT'] == PL_BCSTAT_CONFACC and spbsta_dict['BDWFLG'] == PL_BDWFLG_SUCC)): #=====不允许冲销==== AfaLoggerFunc.tradeDebug(">>>原业务["+str(spbsta_dict['BSPSQN'])+"]记账失败或被拒绝,发送成功报文") #=====根据交易状态新增冲销-成功状态==== if spbsta_dict['BCSTAT'] not in (PL_BCSTAT_MFERFE,PL_BCSTAT_CANC,PL_BCSTAT_CANCEL): #=====新增原业务状态为冲销-成功==== AfaLoggerFunc.tradeDebug('>>>新增原业务状态为冲销-成功') if not rccpsState.newTransState(spbsta_dict['BJEDTE'],spbsta_dict['BSPSQN'],PL_BCSTAT_CANC,PL_BDWFLG_SUCC): AfaDBFunc.RollBackSql() return AfaFlowControl.ExitThisFlow('S999','设置业务状态为冲销-成功异常') else: AfaDBFunc.CommitSql() else: AfaLoggerFunc.tradeDebug('>>>原业务状态为[拒绝/冲销/冲正],不需要新增状态') #=====为返回冲销成功发送拒绝回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.PRCCO = 'RCCI0000' #中心返回码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 TradeContext.STRINFO = '原业务冲销成功' #附言 return True else: #=====直接调用8820冲销原业务==== status={} if not rccpsState.getTransStateCur(spbsta_dict['BJEDTE'],spbsta_dict['BSPSQN'],status): return AfaFlowControl.ExitThisFlow('S999','取原业务主机流水号和日期失败,抛弃报文') TradeContext.BOSPSQ = status['RBSQ'] #原报单序号 TradeContext.BOJEDT = status['FEDT'] #原交易日期 TradeContext.HostCode = '8820' #主机交易码 #=====新增原业务状态为冲销-处理中==== AfaLoggerFunc.tradeDebug('>>>新增原业务状态为冲销-处理中') if not rccpsState.newTransState(spbsta_dict['BJEDTE'],spbsta_dict['BSPSQN'],PL_BCSTAT_CANC,PL_BDWFLG_WAIT): AfaDBFunc.RollBackSql() return AfaFlowControl.ExitThisFlow('S999','设置业务状态为冲销-处理中异常') else: AfaDBFunc.CommitSql() #=====向主机发起8820抹账处理==== AfaLoggerFunc.tradeDebug('>>>向主机发起8820抹账处理') rccpsHostFunc.CommHost( TradeContext.HostCode ) #=====判断主机返回==== sstlog_dict={} sstlog_dict['BJEDTE'] = spbsta_dict['BJEDTE'] sstlog_dict['BSPSQN'] = spbsta_dict['BSPSQN'] sstlog_dict['BCSTAT'] = PL_BCSTAT_CANC sstlog_dict['MGID'] = TradeContext.errorCode #主机返回码 if TradeContext.existVariable('BOJEDT'): #前置日期 sstlog_dict['FEDT'] = TradeContext.BOJEDT if TradeContext.existVariable('BOSPSQ'): #前置流水号 sstlog_dict['RBSQ'] = TradeContext.BOSPSQ if TradeContext.existVariable('TRDT'): #主机日期 sstlog_dict['TRDT'] = TradeContext.TRDT if TradeContext.existVariable('TLSQ'): #主机流水号 sstlog_dict['TLSQ'] = TradeContext.TLSQ #关彬捷 20090219 增加冲销成功的主机错误码判断:SXR0010(此笔交易已被冲正) if TradeContext.errorCode in ('0000','SXR0010'): #=====更改状态==== sstlog_dict['BDWFLG'] = PL_BDWFLG_SUCC #流转标识 PL_BDWFLG_SUCC 成功 sstlog_dict['STRINFO'] = '来账冲销成功' #附言 TradeContext.PRCCO = 'RCCI0000' TradeContext.STRINFO = '原业务冲销成功' else: sstlog_dict['BDWFLG'] = PL_BDWFLG_FAIL #流转标识 PL_BDWFLG_FAIL 失败 sstlog_dict['MGID'] = TradeContext.errorCode #主机返回码 sstlog_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 TradeContext.PRCCO = 'NN1IA999' TradeContext.STRINFO = '原业务冲销失败 ' + TradeContext.errorMsg #=====修改原业务状态==== AfaLoggerFunc.tradeDebug('>>>修改原业务状态') res = rccpsState.setTransState(sstlog_dict) if( res == False ): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099', '更改被冲正的交易状态失败') AfaDBFunc.CommitSql( ) #关彬捷 20081226 修改如果冲销失败则回滚冲销前状态 if TradeContext.errorCode not in ('0000','SXR0010'): #冲销失败,回滚状态为冲销前状态 if not rccpsState.newTransState(spbsta_dict['BJEDTE'],spbsta_dict['BSPSQN'],spbsta_dict['BCSTAT'],spbsta_dict['BDWFLG']): AfaDBFunc.RollBackSql() return AfaFlowControl.ExitThisFlow('S999','回滚状态为冲销前状态异常') else: AfaDBFunc.CommitSql() sstlog_dict = {} sstlog_dict['BJEDTE'] = spbsta_dict['BJEDTE'] sstlog_dict['BSPSQN'] = spbsta_dict['BSPSQN'] sstlog_dict['BCSTAT'] = spbsta_dict['BCSTAT'] sstlog_dict['BDWFLG'] = spbsta_dict['BDWFLG'] sstlog_dict['NOTE3'] = '原业务冲销失败,回滚为冲销前状态' if spbsta_dict.has_key('FEDT'): #前置日期 sstlog_dict['FEDT'] = spbsta_dict['FEDT'] if spbsta_dict.has_key('RBSQ'): #前置流水号 sstlog_dict['RBSQ'] = spbsta_dict['RBSQ'] if spbsta_dict.has_key('TRDT'): #主机日期 sstlog_dict['TRDT'] = spbsta_dict['TRDT'] if spbsta_dict.has_key('TLSQ'): #主机流水号 sstlog_dict['TLSQ'] = spbsta_dict['TLSQ'] sstlog_dict['MGID'] = spbsta_dict['MGID'] #主机返回码 sstlog_dict['STRINFO'] = spbsta_dict['STRINFO'] #主机返回信息 if not rccpsState.setTransState(sstlog_dict): return AfaFlowControl.ExitThisFlow('S999','回滚状态为冲销前状态详细信息异常') else: AfaDBFunc.CommitSql() #=====发送回执==== AfaLoggerFunc.tradeDebug('>>>发送成功回执到对方行') #=====为返回冲销成功发送成功回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 #TradeContext.PRCCO = 'RCCI0000' #中心返回码 #TradeContext.STRINFO = '原业务冲销成功' #附言 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 else: #=====往帐业务==== AfaLoggerFunc.tradeDebug(">>>往帐业务") #=====发送回执==== AfaLoggerFunc.tradeDebug('>>>发送成功回执到对方行') #=====为返回冲销成功发送成功回执==== TradeContext.MSGTYPCO = 'SET010' #报文类代码 TradeContext.PRCCO = 'RCCO1006' #中心返回码 TradeContext.ORMFN = TradeContext.MSGFLGNO #参考报文标示号 TradeContext.SNDSTLBIN= TradeContext.RCVMBRCO #发送成员行号 TradeContext.RCVSTLBIN= TradeContext.SNDMBRCO #接收成员行号 TradeContext.STRINFO = '往帐业务只能受理方冲销' #附言 AfaLoggerFunc.tradeInfo("农信银系统:来账.中心类操作(1.本地操作).柜台冲销来账接收[TRCC006_1145]退出") return True
from types import * from rccpsConst import * import rccpsCronFunc if __name__ == '__main__': try: rccpsCronFunc.WrtLog("***农信银系统: 系统调度类.模板[template]进入***") rccpsCronFunc.WrtLog("***农信银系统: 系统调度类.模板[template]退出***") except Exception, e: #所有异常 if not AfaDBFunc.RollbackSql( ): rccpsCronFunc.WrtLog( AfaDBFunc.sqlErrMsg ) rccpsCronFunc.WrtLog(">>>Rollback异常") rccpsCronFunc.WrtLog(">>>Rollback成功") if( not TradeContext.existVariable( "errorCode" ) or str(e) ): TradeContext.errorCode = 'A9999' TradeContext.errorMsg = '系统错误['+ str(e) +']' if TradeContext.errorCode != '0000' : rccpsCronFunc.WrtLog( 'errorCode=['+TradeContext.errorCode+']' ) rccpsCronFunc.WrtLog( 'errorMsg=['+TradeContext.errorMsg+']' ) rccpsCronFunc.WrtLog('rccpsHDDZGetFile交易中断') sys.exit(-1)
def SubModuleDoFst(): #====开始取流水号对应信息==== trcbka_dict = {} dict = rccpsDBFunc.getTransTrc(TradeContext.BOJEDT,TradeContext.BOSPSQ,trcbka_dict) if dict == False: return AfaFlowControl.ExitThisFlow('M999','取交易信息失败') #=====判断撤销信息==== if TradeContext.BESBNO != trcbka_dict["BESBNO"]: return AfaFlowControl.ExitThisFlow('M999','不允许跨机构撤销') if TradeContext.BETELR != trcbka_dict["BETELR"]: return AfaFlowControl.ExitThisFlow('M999','不允许换柜员操作') if TradeContext.BJEDTE != trcbka_dict["BJEDTE"]: return AfaFlowControl.ExitThisFlow('M999','不允许隔日撤销') if trcbka_dict["BCSTAT"] != PL_BCSTAT_MFEQUE: #41 排队状态 1 成功 return AfaFlowControl.ExitThisFlow('M999','当前业务状态为['+trcbka_dict["BCSTAT"]+']不允许撤销' ) if trcbka_dict["BRSFLG"] != PL_BRSFLG_SND: #往帐 return AfaFlowControl.ExitThisFlow('M999','当前业务状态为来账业务不允许撤销' ) #=====开始插入数据库==== trccan_dict = {} if not rccpsMap8507Dtrcbka_dict2Dtrccan_dict.map(trcbka_dict,trccan_dict): return AfaFlowControl.ExitThisFlow('M999','字典赋值错误') trccan_dict["CONT"] = TradeContext.CONT trccan_dict["TRCCO"] = TradeContext.TRCCO trccan_dict["BJEDTE"] = TradeContext.BJEDTE trccan_dict["BSPSQN"] = TradeContext.BSPSQN trccan_dict['CLRESPN'] = PL_ISDEAL_UNDO trccan_dict['RCVBNKCO'] = PL_RCV_CENTER trccan_dict['RCVBNKNM'] = PL_RCV_CENNAM trccan_dict['RCVMBRCO'] = PL_RCV_CENTER trccan_dict['SNDMBRCO'] = TradeContext.SNDSTLBIN trccan_dict['TRCNO'] = TradeContext.SerialNo AfaLoggerFunc.tradeInfo( '字典trccan_dict:' + str(trccan_dict) ) #=====开始插入撤销业务登记簿==== ret = rccpsDBTrcc_trccan.insert(trccan_dict) if ret <= 0: #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D011','数据库ROLLBAKC失败') #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit succ') #=====从字典向TradeContext赋值==== if not rccpsMap8507Dtrccan_dict2CTradeContext.map(trccan_dict): return AfaFlowControl.ExitThisFlow('M999','字典赋值错误') #====手工赋值一些字段==== TradeContext.OROCCAMT = str(TradeContext.OCCAMT) #原交易金额 AfaLoggerFunc.tradeDebug('>>>原交易金额' + str(TradeContext.OROCCAMT)) TradeContext.ROPRTPNO = trcbka_dict['TRCCO'][:2] #参考业务类型 AfaLoggerFunc.tradeDebug('>>>参考业务类型' + TradeContext.ROPRTPNO) TradeContext.OPRTYPNO = '99' AfaLoggerFunc.tradeDebug('>>>业务类型' + TradeContext.OPRTYPNO) TradeContext.ORMFN = str(trcbka_dict['SNDMBRCO']) + str(trcbka_dict['TRCDAT']) + str(trcbka_dict['TRCNO']) #参考报文标识号 AfaLoggerFunc.tradeDebug('>>>参考类型' + TradeContext.ORMFN) TradeContext.ORRCVBNK = trcbka_dict['RCVBNKCO'] TradeContext.RCVBNKCO = PL_RCV_CENTER TradeContext.RCVBNKNM = PL_RCV_CENNAM TradeContext.RCVSTLBIN = PL_RCV_CENTER TradeContext.ORTRCNO = trcbka_dict['TRCNO'] TradeContext.ORSNDBNKCO=trccan_dict['SNDBNKCO'] AfaLoggerFunc.tradeInfo("TradeContext.ORSNDBNKCO:"+TradeContext.ORSNDBNKCO) AfaLoggerFunc.tradeInfo("TradeContext.BOSPSQ:"+TradeContext.BOSPSQ) return True
def SubModuleDoTrd(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(3.中心记账).往账发送[TRCC002_8506]进入***' ) AfaLoggerFunc.tradeInfo( '>>>判断发送农信银中心返回结果' ) #=====设置记账函数接口==== sstlog_dict = {} sstlog_dict["BJEDTE"] = TradeContext.BJEDTE #交易日期 sstlog_dict["BSPSQN"] = TradeContext.BSPSQN #报单序号 #=====判断第三方返回值,返回成功时==== if TradeContext.errorCode == '0000': sstlog_dict['BCSTAT'] = PL_BCSTAT_SND sstlog_dict['BDWFLG'] = PL_BDWFLG_SUCC #=====设置状态为发送成功==== if not rccpsState.setTransState(sstlog_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() TradeContext.errorCode = '0000' TradeContext.errorMsg = '发送农信银中心成功' #=====判断第三方返回值,返回失败时==== else: sstlog_dict['BCSTAT'] = PL_BCSTAT_SND sstlog_dict['BDWFLG'] = PL_BDWFLG_FAIL #=====设置状态为发送失败==== if not rccpsState.setTransState(sstlog_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug( '>>>commit send succ' ) #=====调用主机函数进行抹账==== AfaLoggerFunc.tradeInfo('>>>开始抹账处理') #=====设置sstlog表中状态为:抹账-处理中==== TradeContext.BOSPSQ = TradeContext.BSPSQN TradeContext.BOJEDT = TradeContext.BJEDTE TradeContext.BCSTAT = PL_BCSTAT_HCAC TradeContext.BDWFLG = PL_BDWFLG_WAIT if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,TradeContext.BCSTAT,TradeContext.BDWFLG): #=====RollBack操作==== if not AfaDBFunc.RollbackSql(): return AfaFlowControl.ExitThisFlow('M999', '发送农信银中心失败,设置状态失败,系统自动回滚') else: #=====commit操作==== if not AfaDBFunc.CommitSql(): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '发送农信银中心失败,设置状态失败,系统自动回滚') #=====字典赋值==== sstlog_new = {} sstlog_new["BJEDTE"] = TradeContext.BJEDTE #交易日期 sstlog_new["BSPSQN"] = TradeContext.BSPSQN #报单序号 #汇兑往帐抹帐字典赋值 input_dict = {} input_dict['BJEDTE'] = TradeContext.BJEDTE input_dict['BSPSQN'] = TradeContext.BSPSQN input_dict['PYRACC'] = TradeContext.PYRACC #付款人账号 input_dict['OCCAMT'] = str(TradeContext.OCCAMT) input_dict['BBSSRC'] = TradeContext.BBSSRC input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑往帐抹帐 rccpsEntries.HDWZMZ(input_dict) #=====设置记账函数接口==== rccpsHostFunc.CommHost( TradeContext.HostCode ) if TradeContext.errorCode == '0000': sstlog_new['DASQ'] = TradeContext.DASQ sstlog_new['PRTCNT'] = 1 #打印次数 sstlog_new['BCSTAT'] = PL_BCSTAT_HCAC sstlog_new['BDWFLG'] = PL_BDWFLG_SUCC sstlog_new['SBAC'] = TradeContext.SBAC sstlog_new['RBAC'] = TradeContext.RBAC sstlog_new["MGID"] = TradeContext.errorCode #主机返回码 sstlog_new["STRINFO"]= TradeContext.errorMsg #主机返回信息 sstlog_new["TRDT"] = TradeContext.TRDT #主机日期 sstlog_new["TLSQ"] = TradeContext.TLSQ #主机流水号 TradeContext.errorCode = 'D011' #赋值返回错误 TradeContext.errorMsg = '发送农信银中心失败,系统自动冲正成功' else: sstlog_new['BCSTAT'] = PL_BCSTAT_HCAC sstlog_new['BDWFLG'] = PL_BDWFLG_FAIL TradeContext.errorCode = 'D011' #赋值返回错误 TradeContext.errorMsg = '发送农信银中心失败,系统自动冲正失败' #=====修改sstlog表中记录状态为:抹账-成功/失败==== if not rccpsState.setTransState(sstlog_new): return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(3.中心记账).往账发送[TRCC002_8506]退出***' ) return True
def SubModuleDoSnd(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(2.主机记账).往账发送[TRCC002_8506]进入***' ) AfaLoggerFunc.tradeInfo( '>>>开始更新主机返回结果信息' ) #=====从主机返回信息取借贷方账号和主机返回信息==== sstlog = {} sstlog["BJEDTE"] = TradeContext.BJEDTE #交易日期 sstlog["BSPSQN"] = TradeContext.BSPSQN #报单序号 sstlog["SBAC"] = TradeContext.SBAC #借方账号 sstlog["ACNM"] = TradeContext.PYRNAM #借方户名 sstlog["RBAC"] = TradeContext.RBAC #贷方账号 sstlog["OTNM"] = '0651科目' #贷方户名 #=====判断主机返回结果==== if TradeContext.errorCode != '0000': sstlog['BCSTAT'] = PL_BCSTAT_ACC sstlog['BDWFLG'] = PL_BDWFLG_FAIL sstlog["MGID"] = TradeContext.errorCode #主机返回码 sstlog["STRINFO"] = TradeContext.errorMsg #主机返回信息 elif TradeContext.errorCode == '0000': sstlog['BCSTAT'] = PL_BCSTAT_ACC sstlog['BDWFLG'] = PL_BDWFLG_SUCC sstlog["TRDT"] = TradeContext.TRDT #主机日期 sstlog["TLSQ"] = TradeContext.TLSQ #主机流水号 sstlog["MGID"] = TradeContext.MGID #主机返回信息 sstlog["DASQ"] = TradeContext.DASQ #销账序号 #测试用 AfaLoggerFunc.tradeInfo( 'TradeContext.__status__ ='+TradeContext.__status__) if TradeContext.__status__=='2': #异常情况 #====需要触发主机抹账交易=== #汇兑往帐抹帐字典赋值 input_dict = {} input_dict['BJEDTE'] = TradeContext.BJEDTE input_dict['BSPSQN'] = TradeContext.BSPSQN input_dict['PYRACC'] = TradeContext.PYRACC #付款人账号 input_dict['OCCAMT'] = str(TradeContext.OCCAMT) input_dict['BBSSRC'] = TradeContext.BBSSRC input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑往帐抹帐 rccpsEntries.HDWZMZ(input_dict) #=====调用主机函数进行抹账 rccpsHostFunc.CommHost( TradeContext.HostCode ) #=====判断主机返回值==== if TradeContext.errorCode == '0000': sstlog['BCSTAT'] = PL_BCSTAT_ACC sstlog['BDWFLG'] = PL_BDWFLG_FAIL TradeContext.errorCode = 'D011' #赋值返回错误 TradeContext.errorMsg = '记账失败,系统自动冲正成功' else: sstlog['BCSTAT'] = PL_BCSTAT_ACC sstlog['BDWFLG'] = PL_BDWFLG_WAIT TradeContext.errorCode = 'D011' #赋值返回错误 TradeContext.errorMsg = '记账失败,系统自动冲正失败' #=====修改sstlog表中数据==== AfaLoggerFunc.tradeInfo( '字典:' + str(sstlog) ) if not rccpsState.setTransState(sstlog): return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====判断主机返回,不成功返回错误到前台==== if TradeContext.errorCode != '0000': return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) #=====赋值农信银中心需要字段==== TradeContext.TRANTYP = '0' #传输类型 TradeContext.OPRTYPNO = '20' #业务属性 #TradeContext.BJEDTE = TradeContext.NCCworkDate #TradeContext.TRCDAT = TradeContext.NCCworkDate #=====设置sstlog表中状态为:抹账-处理中==== TradeContext.BCSTAT = PL_BCSTAT_SND TradeContext.BDWFLG = PL_BDWFLG_WAIT if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,TradeContext.BCSTAT,TradeContext.BDWFLG): #=====RollBack操作==== if not AfaDBFunc.RollbackSql(): return AfaFlowControl.ExitThisFlow('M999', '发送农信银中心失败,设置状态失败,系统自动回滚') else: #=====commit操作==== if not AfaDBFunc.CommitSql(): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '发送农信银中心失败,设置状态失败,系统自动回滚') AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(2.主机记账).往账发送[TRCC002_8506]退出***' ) return True
def SubModuleDoFst(): #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(hdcbka_dict) > 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #==========判断是否存在原查询交易=========================================== AfaLoggerFunc.tradeInfo(">>>开始检查是否存在原查询交易") or_hdcbka_where_dict = {} or_hdcbka_where_dict['SNDBNKCO'] = TradeContext.OQTSBNK or_hdcbka_where_dict['TRCDAT'] = TradeContext.ORQYDAT or_hdcbka_where_dict['TRCNO'] = TradeContext.OQTNO AfaLoggerFunc.tradeInfo(">>>" + str(or_hdcbka_where_dict)) or_hdcbka_dict = {} or_hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(or_hdcbka_where_dict) if or_hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验原查询交易失败") if len(or_hdcbka_dict) <= 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) return True AfaLoggerFunc.tradeInfo(">>>结束检查是否存在原查询交易") #==========为汇兑查询查复自由格式登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询查复自由格式登记簿字典赋值") TradeContext.BRSFLG = '1' if or_hdcbka_dict.has_key('BJEDTE'): TradeContext.BOJEDT = or_hdcbka_dict['BJEDTE'] if or_hdcbka_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = or_hdcbka_dict['BSPSQN'] if TradeContext.existVariable('TRCCO'): TradeContext.ORTRCCO = TradeContext.TRCCO TradeContext.ISDEAL = PL_ISDEAL_ISDO #=====张恒 20091010 新增 将机构落到原交易机构 ==== if or_hdcbka_dict.has_key('BSPSQN'): TradeContext.BESBNO = or_hdcbka_dict['BESBNO'] #接收机构号 hdcbka_insert_dict = {} if not rccpsMap1119CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") #=====刘雨龙 20080710 ==== #=====币种转换==== if TradeContext.ORCUR == 'CNY': hdcbka_insert_dict['CUR'] = '01' else: hdcbka_insert_dict['CUR'] = TradeContext.ORCUR hdcbka_insert_dict['OCCAMT'] = TradeContext.OROCCAMT AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") #==========登记会对查询查复自由格式登记簿======================================= AfaLoggerFunc.tradeInfo(">>>开始登记此查复业务") ret = rccpsDBTrcc_hdcbka.insert(hdcbka_insert_dict) if ret <= 0: if not AfaDBFunc.RollbackSql(): AfaFlowControl.ExitThisFlow("S999","Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","登记汇兑查询查复自由格式登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记此查复业务") #======更新原查询交易信息=================================================== AfaLoggerFunc.tradeInfo(">>>开始更新原查询业务信息") or_hdcbka_update_dict = {} or_hdcbka_update_dict['ISDEAL'] = PL_ISDEAL_ISDO ret = rccpsDBTrcc_hdcbka.update(or_hdcbka_update_dict,or_hdcbka_where_dict) if (ret <= 0): if not AfaDBFunc.RollbackSql(): AfaFlowControl.ExitThisFlow("S999","Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","更新原查询业务信息异常") if not AfaDBFunc.CommitSql(): AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>Commit成功") 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) return True
def SubModuleDoSnd(): #=================判断afe是否发送成功======================================= if TradeContext.errorCode != '0000': AfaLoggerFunc.tradeInfo('>>>AFE发送失败') return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) AfaLoggerFunc.tradeInfo('>>>发送成功') update_wdict = {'BJEDTE':TradeContext.BOJEDT,'BSPSQN':TradeContext.BOSPSQ} update_dict = {'ISDEAL':PL_ISDEAL_ISDO} #已查复 ret = rccpsDBTrcc_hdcbka.update(update_dict,update_wdict) if (ret <= 0): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow("S999","更新原查询业务信息异常") AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo(">>>Commit成功") #=====查询机构名==== subbra_dict={'BESBNO':TradeContext.BESBNO} sub=rccpsDBTrcc_subbra.selectu(subbra_dict) if(sub==None): return AfaFlowControl.ExitThisFlow('A099','查询机构名失败' ) if(len(sub)==0): return AfaFlowControl.ExitThisFlow('A099','没有相应的机构名' ) #=====生成打印文本==== AfaLoggerFunc.tradeInfo("开始生成打印文本") txt = """\ %(BESBNM)s通存通兑查复书 |-----------------------------------------------------------------------------| | 查复日期: | %(BJEDTE)s | |-----------------------------------------------------------------------------| | 查复书号: | %(BSPSQN)s | |-----------------------------------------------------------------------------| | 接收行行号: | %(RCVBNKCO)s | |-----------------------------------------------------------------------------| | 原查询日期: | %(BOJEDT)s | |-----------------------------------------------------------------------------| | 原查询书号: | %(BOSPSQ)s | |-----------------------------------------------------------------------------| | 原金额: | %(OROCCAMT)-15.2f | |-----------------------------------------------------------------------------| | 原币种: | 人民币 | |-----------------------------------------------------------------------------| | 查复内容: | | |-----------------------------------------------------------------------------| | | | %(CONT1)s | | | | %(CONT2)s | | | | %(CONT3)s | | | | %(CONT4)s | | | |-----------------------------------------------------------------------------| 打印日期: %(BJEDTE)s 授权: 记账: """ file_name = 'rccps_' + TradeContext.BJEDTE + '_' + TradeContext.BSPSQN + '_' + '_8512' out_file = open(os.environ['AFAP_HOME'] + '/tmp/' + file_name,"wb") if out_file == None: return AfaFlowControl.ExitThisFlow("S999", "生成打印文件异常") print >> out_file,txt % {'BESBNM':(sub['BESBNM']).ljust(10,' '),\ 'BJEDTE':(TradeContext.BJEDTE).ljust(8,' '),\ 'BSPSQN':(TradeContext.BSPSQN).ljust(12,' '),\ 'RCVBNKCO':(TradeContext.RCVBNKCO).ljust(10,' '),\ 'BOJEDT':(TradeContext.BOJEDT).ljust(8,' '),\ 'BOSPSQ':(TradeContext.BOSPSQ).ljust(12,' '),\ 'OROCCAMT':(TradeContext.PRT_OROCCAMT),\ 'CONT1':(TradeContext.CONT[:68]).ljust(68,' '),\ 'CONT2':(TradeContext.CONT[68:138]).ljust(70,' '),\ 'CONT3':(TradeContext.CONT[138:208]).ljust(70,' '),\ 'CONT4':(TradeContext.CONT[208:]).ljust(70,' ')} out_file.close() TradeContext.PBDAFILE = file_name AfaLoggerFunc.tradeInfo("结束生成打印文本") return True
def Ahdx_DzSend(): totalnum = 0 totalamt = 0 try: sqlStr = "SELECT STATUS FROM ABDT_UNITINFO WHERE" sqlStr = sqlStr + " APPNO = '" + TradeContext.appNo + "'" sqlStr = sqlStr + " AND BUSINO = '" + TradeContext.busiNo + "'" sqlStr = sqlStr + " AND AGENTTYPE IN ('1','2')" #AfaLoggerFunc.tradeInfo(sqlStr) records = AfaDBFunc.SelectSql( sqlStr ) if (records==None or len(records) < 0): AfaLoggerFunc.tradeInfo('>>>处理结果:对帐处理失败,数据库异常') TradeContext.errorCode,TradeContext.errorMsg = "0001","对帐处理失败,数据库异常" return False elif ( len(records) == 0 ): AfaLoggerFunc.tradeInfo('>>>处理结果:没有发现该单位信息,不能对帐处理') TradeContext.errorCode,TradeContext.errorMsg = "0001","没有发现该单位信息,不能对帐处理" return False #=====对非当日账不需要签退==== if ( records[0][0] != '2' and (TradeContext.WORKDATE == TradeContext.workDate)): AfaLoggerFunc.tradeInfo('>>>处理结果:必须先签退才能进行对帐处理') TradeContext.errorCode,TradeContext.errorMsg = "0001","必须先签退才能进行对帐处理" return False sFileName = TradeContext.HOST_LDIR + '/' + TradeContext.appNo + '_' + TradeContext.WORKDATE + '_2' if ( not (os.path.exists(sFileName) and os.path.isfile(sFileName)) ): AfaLoggerFunc.tradeInfo("对帐文件不存在,必须先日终处理才能进行对帐处理") TradeContext.errorCode,TradeContext.errorMsg = "0001","对帐文件不存在,必须先日终处理才能进行对帐处理" return False hpTmp = open( sFileName,"r" ) if not hpTmp.read() : AfaLoggerFunc.tradeInfo("当天没有正常收入交易") #begin 20100716 蔡永贵修改 由于此处并没有抛出异常终止程序,故此处errorCode还是应该置为0000 #TradeContext.errorCode,TradeContext.errorMsg = "0001","当天没有交易" TradeContext.errorCode,TradeContext.errorMsg = "0000","当天没有交易" #end #return False #对帐初始化 sqlstr = "UPDATE FS_MAINTRANSDTL SET CHKFLAG='" + '*' + "' WHERE " sqlstr = sqlstr + " APPNO='" + TradeContext.appNo + "'" sqlstr = sqlstr + " AND BUSINO='" + TradeContext.busiNo + "'" sqlstr = sqlstr + " AND WORKDATE='" + TradeContext.WORKDATE + "'" AfaLoggerFunc.tradeInfo(sqlstr) retcode = AfaDBFunc.UpdateSqlCmt( sqlstr ) if (retcode==None or retcode <= 0): AfaLoggerFunc.tradeInfo('没有任何交易数据') #打开主机下载文件 hFp = open(sFileName, "r") #读取一行 linebuf = hFp.readline() while ( len(linebuf) > 0 ): if ( len(linebuf) < 996 ): AfaLoggerFunc.tradeInfo('该批次下载文件格式错误(长度),请检查') hFp.close() return False swapbuf = linebuf[0:996].split('<fld>') # if ( len(swapbuf) != 55 ): # AfaLoggerFunc.tradeInfo('该批次下载文件格式错误(域数),请检查') # hFp.close() # return False #显示记录信息 #PrtRecInfo(swapbuf) linebuf = hFp.readline() if ( swapbuf[0].strip() != TradeContext.appNo or \ swapbuf[3].strip() != TradeContext.WORKDATE or \ swapbuf[5].strip() != TradeContext.WORKDATE ): continue #先查询数据库中记录是否存在 sqlstr = "SELECT BRNO,TELLERNO,REVTRANF,AMOUNT,BANKSTATUS,CORPSTATUS FROM FS_MAINTRANSDTL WHERE" sqlstr = sqlstr + " APPNO='" + TradeContext.appNo + "'" sqlstr = sqlstr + " AND BUSINO='" + TradeContext.busiNo + "'" sqlstr = sqlstr + " AND WORKDATE='" + TradeContext.WORKDATE + "'" sqlstr = sqlstr + " AND SERIALNO='" + swapbuf[4].strip() + "'" AfaLoggerFunc.tradeInfo(sqlstr) ChkFlag = '*' records = AfaDBFunc.SelectSql( sqlstr ) if ( records==None or len(records) == 0 ): AfaLoggerFunc.tradeInfo('数据库中记录匹配失败(表中无记录)') AfaLoggerFunc.tradeInfo(sqlstr) continue else: h_tradeamt = (long)((float)(swapbuf[32].strip())*100 + 0.1) m_tradeamt = (long)((float)(records[0][3].strip())*100 + 0.1) if ( swapbuf[9].strip() != records[0][0] ): AfaLoggerFunc.tradeInfo('数据库中记录匹配失败(机构号不符):' + swapbuf[9].strip() + '|' + records[0][0] + '|') #PrtRecInfo(swapbuf) ChkFlag = '2' elif ( swapbuf[10].strip() != records[0][1] ): AfaLoggerFunc.tradeInfo('数据库中记录匹配失败(柜员号不符):' + swapbuf[10].strip() + '|' + records[0][1] + '|') #PrtRecInfo(swapbuf) ChkFlag = '3' elif ( h_tradeamt != m_tradeamt ): AfaLoggerFunc.tradeInfo('数据库中记录匹配失败(发生额不符):' + str(h_tradeamt) + '|' + str(m_tradeamt) + '|') #PrtRecInfo(swapbuf) ChkFlag = '4' elif ( swapbuf[50].strip() == '1' ): ChkFlag = '1' else: ChkFlag = '0' #再修改与数据库进行匹配 sqlstr = "UPDATE FS_MAINTRANSDTL SET CHKFLAG='" + ChkFlag + "' WHERE " sqlstr = sqlstr + " APPNO='" + TradeContext.appNo + "'" sqlstr = sqlstr + " AND BUSINO='" + TradeContext.busiNo + "'" sqlstr = sqlstr + " AND WORKDATE='" + TradeContext.WORKDATE + "'" sqlstr = sqlstr + " AND SERIALNO='" + swapbuf[4].strip() + "'" #AfaLoggerFunc.tradeInfo(sqlstr) retcode = AfaDBFunc.UpdateSqlCmt( sqlstr ) if (retcode==None or retcode <= 0): AfaLoggerFunc.tradeInfo('修改记录对帐状态,数据库异常') hFp.close() TradeContext.errorCode,TradeContext.errorMsg = "0001","修改记录对帐状态,数据库异常" return False totalnum = totalnum + 1 totalamt = totalamt + m_tradeamt hFp.close() #每天只能做一次对账 sqlstr = "select this,date from fs_remain where busino='" + TradeContext.busiNo + "'" sqlstr = sqlstr + " and bankno = '" + TradeContext.bankbm + "'" + "order by date desc" AfaLoggerFunc.tradeInfo(sqlstr) records = AfaDBFunc.SelectSql( sqlstr ) if( records == None ): TradeContext.errorCode = "9999" TradeContext.errorMsg = "非税余额表异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if( len(records)==0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "非税余额表异常(没有单位信息)" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #取出昨天的余额 sqlstr = "select this from fs_remain where busino='" + TradeContext.busiNo + "' and date='" + TradeContext.wyesterdate + "'" sqlstr = sqlstr + " and bankno = '" + TradeContext.bankbm + "'" + " order by date desc" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) if( records == None ): TradeContext.errorCode = "9999" TradeContext.errorMsg = "非税余额表异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if( len(records)==0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "非税余额表异常(没有对账日期前一天的信息)" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False TradeContext.lastRemain = records[0][0] #上期余额 TradeContext.banlance = records[0][0] #统计余额变化 #如果当天没有余额信息则插入一条 #TradeContext.remain="44676653.13" sqlstr = "insert into fs_remain(busino,date,this,bankno) values('" + TradeContext.busiNo + "','" + TradeContext.WORKDATE + "','" + TradeContext.remain + "','" + TradeContext.bankbm + "')" 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( ) #生成对帐文件,从主交易表中取出数据 sqlStr = "SELECT bankserno,USERNO,NOTE1,USERNAME,NOTE2,AMOUNT FROM FS_MAINTRANSDTL WHERE " sqlStr = sqlStr + " APPNO='" + TradeContext.appNo + "'" sqlStr = sqlStr + " AND BUSINO='" + TradeContext.busiNo + "'" sqlStr = sqlStr + " AND WORKDATE='" + TradeContext.WORKDATE + "'" sqlStr = sqlStr + " AND CHKFLAG='0' AND NOTE2='1' AND BANKSTATUS='0' and REVTRANF='0' order by userno" AfaLoggerFunc.tradeInfo( sqlStr ) records = AfaDBFunc.SelectSql( sqlStr ) if (records==None ): AfaLoggerFunc.tradeInfo('查询主要交易失败,数据库异常') TradeContext.errorCode,TradeContext.errorMsg = "0001","生成对帐处理失败,数据库异常" return False normalNum = 0 #正常笔数 tuifuNum = 0 #退付笔数 normalAmt = 0 #正常金额合计 tuifuAmt = 0 #退付金额合计 ##############################王军江添加于2007-10-16########################################################### fileName = TradeContext.busiNo + "duizhang" + ".txt" dzFileName = os.environ['AFAP_HOME'] + "/data/ahfs/" + fileName dzfp= open(dzFileName, "w") lineWidth = 144 #报表列表宽度 WidthList = [10,10,20,40,32,14,14,14] dzfp.write('对账单'.center(lineWidth)) dzfp.write('\n') dzfp.write('\n') dzfp.write(' 机构名称:' + TradeContext.I1SBNM + '\t' ) # dzfp.write(' 制表日期:' + TradeContext.workDate + '\t\t\t\t\n' ) dzfp.write(' 制表日期:' + TradeContext.WORKDATE + '\t\t\t\t\n' ) #将制表日期改为所对账务那天的日期 dzfp.write(' 对公帐户:' + TradeContext.busiAccno + '\t\t\t\t' ) dzfp.write(' 上期余额:' + TradeContext.lastRemain + '\n' ) dzfp.write(' ┌─────┬─────┬──────────┬────────────────────┬────────────────┬───────┬───────┬───────┐'+'\n') dzfp.write(' │银行流水号│缴款书编号│ 执收单位编号 │ 缴款人 │正常 待查 退付 上缴国库 上缴专户│ 贷方 │ 借方 │ 合计 │'+'\n') banlance = float(TradeContext.lastRemain) #上期余额 normalNum = 0 tuifuNum = 0 AfaLoggerFunc.tradeInfo( '当前流水缴费数:' + str( len(records) ) ) i = 0 while ( i < len(records) ): rowLine = ' │' lineList = list(records[i]) if lineList[4] == '1': #正常收入 lineList[4] = '正常收入' lineList.append('') banlance = banlance + float(lineList[5]) lineList.append( str(banlance) ) normalNum = normalNum + 1 elif lineList[4] == '2' : #退付收入 lineList[4] = '退付收入' lineList.insert(len(lineList)-1,'') banlance = banlance - float(lineList[6]) lineList.append( str(banlance) ) tuifuNum = tuifuNum + 1 else: AfaLoggerFunc.tradeInfo('资金性质错误') return False dzfp.write(' ├─────┼─────┼──────────┼────────────────────┼────────────────┼───────┼───────┼───────┤'+'\n') dzfp.write(' │') for j in range( len(WidthList) ): if j == 4: dzfp.write( lineList[j].center(WidthList[j]) ) else: dzfp.write( lineList[j].ljust(WidthList[j]) ) dzfp.write('│') else: dzfp.write('\n') i=i+1 ################################################################################################################ #统计待查收入 流水号、缴款书编号、交款人、收费金额 #sqlstr = "select afc401,afc001,afc006,afc011 from fs_fc74 where date='" + TradeContext.WORKDATE + "'and busino='" + TradeContext.busiNo + "' and afc016='" + TradeContext.brno + "' and flag != '*'" dateTmp = TradeContext.WORKDATE[0:4] + '-' + TradeContext.WORKDATE[4:6] + '-' + TradeContext.WORKDATE[6:8] sqlstr = "select afc401,afc001,afc006,afc011 from fs_fc74 where afc015='" + dateTmp + "'and busino='" + TradeContext.busiNo + "' and afc016='" + TradeContext.brno + "' and flag != '*' and afa101 = '" + TradeContext.bankbm + "'" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) if (records==None) : TradeContext.errorCode,TradeContext.errorMsg = "0001","获取待查数据失败,数据库异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( sqlstr + AfaDBFunc.sqlErrMsg ) return False i = 0 AfaLoggerFunc.tradeInfo( '当前待查数目:' + str( len(records) ) ) daichaNum = 0 #待查笔数 while ( i < len(records) ): lineList = list(records[i]) lineList[1] = '' lineList.insert(2,'') #执收单位编码 lineList.insert(4,'待查') #资金性质 banlance = banlance + float(lineList[len(lineList)-1]) lineList.append('') #贷方 lineList.append( str(banlance) ) daichaNum = daichaNum + 1 dzfp.write(' ├─────┼─────┼──────────┼────────────────────┼────────────────┼───────┼───────┼───────┤'+'\n') dzfp.write(' │') for j in range( len(WidthList) ): if j == 4: dzfp.write( lineList[j].center(WidthList[j]) ) else: dzfp.write( lineList[j].ljust(WidthList[j]) ) dzfp.write('│') else: dzfp.write('\n') i=i+1 #---------------------统计退付-------------- sqlStr = "SELECT bankserno,USERNO,NOTE1,USERNAME,NOTE2,AMOUNT FROM FS_MAINTRANSDTL WHERE " sqlStr = sqlStr + " APPNO='" + TradeContext.appNo + "'" sqlStr = sqlStr + " AND BUSINO='" + TradeContext.busiNo + "'" sqlStr = sqlStr + " AND WORKDATE='" + TradeContext.WORKDATE + "'" sqlStr = sqlStr + " AND CHKFLAG='0' AND NOTE2='2' AND BANKSTATUS='0' and REVTRANF='0' order by userno" AfaLoggerFunc.tradeInfo( sqlStr ) records = AfaDBFunc.SelectSql( sqlStr ) if (records==None ): AfaLoggerFunc.tradeInfo('查询主要交易失败,数据库异常') TradeContext.errorCode,TradeContext.errorMsg = "0001","生成对帐处理失败,数据库异常" return False i = 0 while ( i < len(records) ): rowLine = ' │' lineList = list(records[i]) if lineList[4] == '1': #正常收入 lineList[4] = '正常收入' lineList.append('') banlance = banlance + float(lineList[5]) lineList.append( str(banlance) ) normalNum = normalNum + 1 elif lineList[4] == '2' : #退付收入 lineList[4] = '退付收入' lineList.insert(len(lineList)-1,'') #资金性质贷方为空 banlance = banlance - float(lineList[6]) lineList.append( str(banlance) ) tuifuNum = tuifuNum + 1 else: AfaLoggerFunc.tradeInfo('资金性质错误') return False dzfp.write(' ├─────┼─────┼──────────┼────────────────────┼────────────────┼───────┼───────┼───────┤'+'\n') dzfp.write(' │') for j in range( len(WidthList) ): if j == 4: dzfp.write( lineList[j].center(WidthList[j]) ) else: dzfp.write( lineList[j].ljust(WidthList[j]) ) dzfp.write('│') else: dzfp.write('\n') i=i+1 else: dzfp.write(' └─────┴─────┴──────────┴────────────────────┴────────────────┴───────┴───────┴───────┘'+'\n' ) normalAmt = 0 tuifuAmt = 0 daichaAmt = 0 sqlStr = "SELECT sum(double(AMOUNT)) FROM FS_MAINTRANSDTL WHERE " sqlStr = sqlStr + " APPNO='" + TradeContext.appNo + "'" sqlStr = sqlStr + " AND BUSINO='" + TradeContext.busiNo + "'" sqlStr = sqlStr + " AND WORKDATE='" + TradeContext.WORKDATE + "'" sqlStr = sqlStr + " AND CHKFLAG='0' AND NOTE2='1' AND BANKSTATUS='0' and REVTRANF='0'" AfaLoggerFunc.tradeInfo( sqlStr ) records = AfaDBFunc.SelectSql( sqlStr ) normalAmt = records[0][0] if (normalAmt==None) : normalAmt = 0 sqlStr = "SELECT sum(double(AMOUNT)) FROM FS_MAINTRANSDTL WHERE " sqlStr = sqlStr + " APPNO='" + TradeContext.appNo + "'" sqlStr = sqlStr + " AND BUSINO='" + TradeContext.busiNo + "'" sqlStr = sqlStr + " AND WORKDATE='" + TradeContext.WORKDATE + "'" sqlStr = sqlStr + " AND CHKFLAG='0' AND NOTE2='2' AND BANKSTATUS='0' and REVTRANF='0'" AfaLoggerFunc.tradeInfo( sqlStr ) records = AfaDBFunc.SelectSql( sqlStr ) tuifuAmt = records[0][0] if (tuifuAmt==None) : tuifuAmt = 0 dateTmp = TradeContext.WORKDATE[0:4] + '-' + TradeContext.WORKDATE[4:6] + '-' + TradeContext.WORKDATE[6:8] sqlstr = "select sum(double(AFC011)) from fs_fc74 where AFC015='" + dateTmp + "'and busino='" + TradeContext.busiNo + "' and afc016='" + TradeContext.brno + "' and flag != '*'" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) daichaAmt = records[0][0] if (daichaAmt==None) : daichaAmt = 0 sLastLine = " 总笔数:" + str(daichaNum+normalNum+tuifuNum)+ "\t\t正常笔数:" + str(normalNum) + "\t\t待查笔数:" + str(daichaNum) + "\t\t退付笔数:" + str(tuifuNum) + "\t\t制表人:" dzfp.write(sLastLine + "\n") sLastLine = " 正常收入合计:" + str(normalAmt)+ "\t\t退付合计:" + str(tuifuAmt) + "\t\t待查合计:" + str(daichaAmt) dzfp.write(sLastLine + "\n") dzfp.write(" 本期余额:"+ TradeContext.remain ) dzfp.close() #文件长度 TradeContext.DZFILESIZE = str(os.path.getsize(dzFileName)) #对帐文件名 TradeContext.DZFILENAME = fileName except Exception, e: AfaLoggerFunc.tradeInfo(str(e)) AfaLoggerFunc.tradeInfo('对帐处理异常') TradeContext.errorCode,TradeContext.errorMsg = "0001","对帐处理异常" dzfp.close() return False
def SubModuleMainFst(): TradeContext.__agentEigen__ = '0' #从表标志 #如果不是主办行,不能做此交易 AfaLoggerFunc.tradeInfo('检验是否是主办行') 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 #首先从库表中查询缴款书编号,如果查找到则返回已经缴费的错误 AfaLoggerFunc.tradeInfo('缴款书是否已经缴费') sqlstr = "select flag from fs_fc76 where afc001='" + TradeContext.AFC001 + "'" #===条件增加银行编码字段,张恒修改=== sqlstr = sqlstr + " and afc153 = '" + TradeContext.bankbm + "'" records = AfaDBFunc.SelectSql( sqlstr ) if ( len(records) == 0 ): AfaLoggerFunc.tradeInfo( "没有查找到缴款书编号可以缴费"+sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) else: if records[0][0] == '0': TradeContext.errorCode,TradeContext.errorMsg = '0001','已经查找到了交款书编号,不能再缴费' AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False elif records[0][0] == '1': TradeContext.errorCode,TradeContext.errorMsg = '0002',"缴款书已冲正,可缴费" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) else: TradeContext.errorCode,TradeContext.errorMsg = '0003',"缴款书状态位异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #查询缴款书标号,还有对应流水是否已经补录过 AfaLoggerFunc.tradeInfo('是否已经补录过') for serNo in TradeContext.AFC401.split(':') : sqlstr = "select * from fs_fc84 where afc001='" + TradeContext.AFC001 + "' and afc401 like '%" + serNo + "%'" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) if( len( records) > 0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "该缴款书已经补录,不能再次补录" return False AfaLoggerFunc.tradeInfo( '********************插入补录数据表开始*******************' ) #-----------------------根据单位编码配置获取财政信息---------------------------- sqlstr = "select aaa010,bankno from fs_businoinfo where busino='" + TradeContext.busiNo + "'" sqlstr = sqlstr + " and bankno = '" + TradeContext.bankbm + "'" records = AfaDBFunc.SelectSql( sqlstr ) if records == None or len(records)==0 : TradeContext.errorCode,TradeContext.errorMsg = "0001","查找单位信息表异常" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( sqlstr ) sys.exit(1) elif len(records) > 1: TradeContext.errorCode,TradeContext.errorMsg = "0001","单位信息表异常:一个单位编号对应了多个财政信息" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) AfaLoggerFunc.tradeInfo( sqlstr ) sys.exit(1) TradeContext.AAA010 = records[0][0].strip() TradeContext.AFA101 = records[0][1].strip() #TradeContext.AAA010 = "0000000000" TradeContext.AAA011 = "" TradeContext.AFC016 = TradeContext.brno # ----------------------------开始票据信息校验------------------------------- #是否串票的校验 piaoNo = TradeContext.AFC001[0:9] aaz010 = TradeContext.AAA010 #财政区划内码 sqlstr = "select * from fs_dpz_gl where fczqhnm='" + aaz010 + "'" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql(sqlstr) #=====add by pgt 20090423 根据前台传上来的校验标志来判断是否进行校验==== if (len(records) > 0 and (TradeContext.CKMD == "1")): #大厅模式 if (TradeContext.existVariable('AFA091' ) and len(TradeContext.AFA091)>0): AfaLoggerFunc.tradeInfo( "串票校验--大厅模式" ) sqlstr = "select afa090 from fs_fa20 where afa091='" + TradeContext.AFA091 + "' and BUSINO='" + TradeContext.busiNo + "'" records = AfaDBFunc.SelectSql( sqlstr ) if( records == None or len(records)==0 ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "数据库异常,FS_FA20表" AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) return False afa090 = records[0][0] #大厅内码 sqlstr = "select count(*) from fs_dpz_gl where fdwdm='" + afa090 + "' and fqshm<='" + piaoNo + "' and fqzhm>='" + piaoNo + "'" records = AfaDBFunc.SelectSql( sqlstr ) if( records == None ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "串票校验异常" AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) return False if int(records[0][0]) == 0 : TradeContext.errorCode = "0001" TradeContext.errorMsg = "非本大厅票据,请检查票号" return False else: #非大厅模式 AfaLoggerFunc.tradeInfo( "串票校验--非大厅模式" ) sqlstr = "select count(*) from (select distinct b.AFA051 from FS_DPZ_GL a,fs_fa15 b where a.fdwdm=b.AFA050 and a.FQSHM<='" + piaoNo + "' and a.FQZHM>='" + piaoNo + "'" + \ " union all select distinct c.AFA051 from FS_DPZ_GL a,fs_fa21 b,fs_fa15 c where a.FQSHM<='" + piaoNo + "' and a.FQZHM>='" + piaoNo + "' and a.fdwdm=b.AFA050 and b.AFA050=c.AFA050) a where locate(a.afa051, '" + TradeContext.AFA051 + "')=1" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) if( records == None ): TradeContext.errorCode = "0001" TradeContext.errorMsg = "串票校验异常" AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) return False if int(records[0][0]) == 0 : TradeContext.errorCode = "0001" TradeContext.errorMsg = "非本执收单位票据,请检查票号" return False AfaLoggerFunc.tradeInfo("单位在此开票日期内是否有权收取此项目") #单位日期是否合法 sql = "select aaz006,aaz007,afa050,AAZ002 from fs_fa15 where afa051='" + TradeContext.AFA051 + "' and BUSINO='" + TradeContext.busiNo + "'" sql = sql + " and aaa010='" + TradeContext.AAA010 + "' order by aaz002 desc" AfaLoggerFunc.tradeInfo(sql) records = AfaDBFunc.SelectSql( sql ) if ( records == None ): AfaLoggerFunc.tradeInfo(sql) TradeContext.errorCode,TradeContext.errorMsg = "0001","数据库异常:查询单位信息表" AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False if ( len(records) == 0 ): TradeContext.errorCode,TradeContext.errorMsg = "0001","没有此单位" AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False else: iFlag=0 if (records[0][3]!='1'): TradeContext.errorCode,TradeContext.errorMsg = "0001","单位不是末级" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if (records[0][0] <= TradeContext.AFC005 ) and (len(records[0][1])==0 or records[0][1] >= TradeContext.AFC005) : iFlag=1 if iFlag==0 : TradeContext.errorCode,TradeContext.errorMsg = "0001","单位已经无效" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #保存单位内码 afa050 = records[0][2] AfaLoggerFunc.tradeInfo( afa050 ) for afa031 in TradeContext.AFA031.split( "^" ): #项目日期是否合法 sql = "select aaz006,aaz007,AFA030,AAZ002 from fs_fa13 where afa031='" + afa031 + "' and BUSINO='" + TradeContext.busiNo + "' order by aaz006 desc" AfaLoggerFunc.tradeInfo(sql) records = AfaDBFunc.SelectSql( sql ) if ( records == None ): AfaLoggerFunc.tradeInfo(sql) TradeContext.errorCode,TradeContext.errorMsg = "0001","数据库异常:查询项目信息表" AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False if ( len(records) == 0 ): TradeContext.errorCode,TradeContext.errorMsg = "0001","没有此项目%s" %afa031 AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False else: iFlag=0 if (records[0][0] <= TradeContext.AFC005 ) and (len(records[0][1])==0 or records[0][1] >= TradeContext.AFC005) : iFlag=1 if iFlag==0 : TradeContext.errorCode,TradeContext.errorMsg = "0001","项目%s已经无效" %afa031 AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #保存收费内码 afa030 = records[0][2] AfaLoggerFunc.tradeInfo( afa030 ) #单位在此开票日期内是否有权收取此项目 sql = "select aaz006,aaz007 from fs_fa16 where afa030='" + afa030 + "' and afa050='" + afa050 + "' and BUSINO='" + TradeContext.busiNo + "'" AfaLoggerFunc.tradeInfo(sql) records = AfaDBFunc.SelectSql( sql ) if ( records == None ): AfaLoggerFunc.tradeInfo(sql) TradeContext.errorCode,TradeContext.errorMsg = "0001","数据库异常:查询单位项目关系信息表" AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False if ( len(records) == 0 ): TradeContext.errorCode,TradeContext.errorMsg = "0001","没有此单位项目%s关系" %afa031 AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False else: iFlag=0 for i in range( len(records) ) : if (records[0][0] <= TradeContext.AFC005 ) and (len(records[0][1])==0 or records[i][1] >= TradeContext.AFC005) : iFlag=1 if iFlag==0 : TradeContext.errorCode,TradeContext.errorMsg = "0001","单位项目%s关系已经无效" %afa031 AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #如果为大厅模式,则应将大厅编码录入到系统中,并校验当前开票日期内,此单位项目是否属于此大厅 if (TradeContext.existVariable('AFA091' ) and len(TradeContext.AFA091)>0): #征收大厅与单位项目对照表 sql = "select aaz006,aaz007 from fs_fa21,fs_fa20 where fs_fa21.AFA090=fs_fa20.AFA090 and fs_fa20.AFA091='" + TradeContext.AFA091 + "' and fs_fa21.afa030='" + afa030 + "' and fs_fa21.afa050='" + afa050 + "'" AfaLoggerFunc.tradeInfo(sql) records = AfaDBFunc.SelectSql( sql ) if ( records == None ): AfaLoggerFunc.tradeInfo(sql) TradeContext.errorCode,TradeContext.errorMsg = "0001","数据库异常:查询征收大厅与单位项目对照表" AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False if ( len(records) == 0 ): TradeContext.errorCode,TradeContext.errorMsg = "0001","没有此征收大厅与单位项目对照关系" AfaLoggerFunc.tradeInfo(TradeContext.errorMsg) return False else: iFlag=0 for i in range( len(records) ) : if (records[0][0] <= TradeContext.AFC005 ) and (len(records[0][1])==0 or records[0][1] >= TradeContext.AFC005) : iFlag=1 if iFlag==0 : TradeContext.errorCode,TradeContext.errorMsg = "0001","征收大厅与单位项目关系已经无效" AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False #-------------------------检验金额----------------------------------------------- AfaLoggerFunc.tradeInfo("检验金额") AfaLoggerFunc.tradeInfo("特殊标志AFC187:"+TradeContext.AFC187) #减征 :减免为100 if (TradeContext.AFC187=="100"): AfaLoggerFunc.tradeInfo("减征") for afa031 in TradeContext.AFA031.split( "^" ): i = TradeContext.AFA031.split( "^" ).index(afa031) sqlstr = "select afa038,afa039,AFA041 from fs_fa13 where afa031='" + afa031 + "' and BUSINO='" + TradeContext.busiNo + "' order by aaz006 desc" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) if ( records == None ): TradeContext.errorCode,TradeContext.errorMsg = "0001","数据库异常:查找收费项目表" AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if len(records) == 0 : TradeContext.errorCode,TradeContext.errorMsg = "0001","没有此收费项目信息" AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False else: #1 金额<数量*标准下限 if records[0][0].strip() == '0' and records[0][1].strip() == '0' : pass else: inputAmt = float( (TradeContext.AFC011.split("^"))[i] ) #输入金额 maxAmt = float( records[0][0] ) * float( (TradeContext.AFC010.split("^"))[i] ) #最大金额 minAmt = float( records[0][1] ) * float( (TradeContext.AFC010.split("^"))[i] ) #最小金额 AfaLoggerFunc.tradeInfo("当前项目上限:" + str(maxAmt)) AfaLoggerFunc.tradeInfo("当前项目下限:" + str(minAmt)) AfaLoggerFunc.tradeInfo("收入金额:" + str(inputAmt)) #=====根据前台传来的校验标示判断是否进行金额判断pgt 20090423==== if TradeContext.CKMD == '1': if minAmt <= inputAmt : TradeContext.errorCode,TradeContext.errorMsg = '0001','项目%s输入金额错误' %afa031 return False #2 减免金额必须小于等于本级分成金额 #3 缴款书缴费时限 d1 = datetime.datetime(int(TradeContext.workDate[0:4]),int( TradeContext.workDate[4:6]), int(TradeContext.workDate[6:8])) d2 = datetime.datetime(int(TradeContext.AFC005[0:4]), int(TradeContext.AFC005[5:7]), int(TradeContext.AFC005[8:10])) AfaLoggerFunc.tradeInfo(str((d1 - d2).days)) if (d1 - d2).days >5 or (d1 - d2).days >records[0][2]: #缴款书本身缴费时限为5天 TradeContext.errorCode,TradeContext.errorMsg = '0001','已经超过缴费时限:项目%s' %afa031 return False #4 当项目表(FA13)中有多条项目信息时,需根据缴款书的开票日期在项目表中找在开票日期有效的那条项目信息 #集中汇缴:集中汇缴200 #因为无法确定其数量,所以不校验其金额。 #如果为大厅模式,则应将大厅编码录入到系统中,并校验当前开票日期内,此单位项目是否属于此大厅。 elif (TradeContext.AFC187=="200"): AfaLoggerFunc.tradeInfo("集中汇缴") #直接缴库默认300 else: for afa031 in TradeContext.AFA031.split( "^" ): i = TradeContext.AFA031.split( "^" ).index(afa031) sqlstr = "select afa038,afa039 from fs_fa13 where afa031='" + afa031 + "' and BUSINO='" + TradeContext.busiNo + "' order by aaz006 desc" AfaLoggerFunc.tradeInfo( sqlstr ) records = AfaDBFunc.SelectSql( sqlstr ) if ( records == None ): TradeContext.errorCode,TradeContext.errorMsg = "0001","数据库异常:查找收费项目表" AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False if len(records) == 0 : TradeContext.errorCode,TradeContext.errorMsg = "0001","没有此收费项目信息" AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeInfo( TradeContext.errorMsg ) return False else: if records[0][0].strip() == '0' and records[0][1].strip() == '0' : pass else: inputAmt = float( (TradeContext.AFC011.split("^"))[i] ) #输入金额 maxAmt = float( records[0][0] ) * float( (TradeContext.AFC010.split("^"))[i] ) #最大金额 minAmt = float( records[0][1] ) * float( (TradeContext.AFC010.split("^"))[i] ) #最小金额 AfaLoggerFunc.tradeInfo("当前项目上限:" + str(maxAmt)) AfaLoggerFunc.tradeInfo("当前项目下限:" + str(minAmt)) AfaLoggerFunc.tradeInfo("收入金额:" + str(inputAmt)) #=====根据前台传上来的校验标志判断是否进行金额校验 pgt 20090414==== if TradeContext.CKMD == '1': if minAmt > inputAmt or inputAmt > maxAmt : TradeContext.errorCode,TradeContext.errorMsg = '0001','项目%s输入金额错误' %afa031 return False #AfaLoggerFunc.tradeInfo("输入金额:" + TradeContext.AFC011 ) #不能当天补录 for serno in TradeContext.AFC401.split(":"): sqlstr = "select date from fs_fc74 where afc401='" + serno + "' and afc015='" + TradeContext.AFC015 + "'" records = AfaDBFunc.SelectSql( sqlstr ) if ( records == None or len(records) == 0 ): AfaLoggerFunc.tradeInfo( sqlstr ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) TradeContext.errorCode = "0001" TradeContext.errorMsg = "查找补录日期失败" return False if records[0][0] == TradeContext.workDate : TradeContext.errorCode = "0001" TradeContext.errorMsg = "不能当天补录,请次日补录" return False #------------------计算总金额----------------- amount = 0.0 for fee in TradeContext.AFC011.split('^'): amount = amount + float(fee) TradeContext.payAmount = str( amount ) AfaLoggerFunc.tradeInfo( '总金额:' + TradeContext.payAmount ) sqlstr = "insert into FS_FC84(AFC401,AAA010,AFC001,AFA031,AFA051,AFA101,AAA011,AFC002,AFC003,AFC004, \ AFC005,AFC006,AFC007,AFC008,AFC009,AFC010,AFC011,AMOUNT,AFC012,AFC013,AFC015,AFC016,TELLER,BUSINO,AFC187,AFA091,FLAG,DATE,TIME) values(" for j in range( len( (TradeContext.AFA031).split("^") ) ) : sqlstr1 = sqlstr sqlstr1 = sqlstr1 + "'" + TradeContext.AFC401 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AAA010 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC001 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFA031.split("^")[j] + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFA051 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFA101 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AAA011 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC002 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC003 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC004 + "'," #=====刘雨龙 20080902 修改日期格式==== sqlstr1 = sqlstr1 + "'" + TradeContext.AFC005[:4] + '-' + TradeContext.AFC005[4:6] + '-' + TradeContext.AFC005[6:]+ "'," #sqlstr1 = sqlstr1 + "'" + TradeContext.AFC005 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC006 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC007 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC008 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC009.split("^")[j] + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC010.split("^")[j] + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC011.split("^")[j] + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.payAmount + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC012 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC013.split("^")[j] + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC015 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC016 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.teller + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.busiNo + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFC187 + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.AFA091 + "'," sqlstr1 = sqlstr1 + "'" + '0' + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.workDate + "'," sqlstr1 = sqlstr1 + "'" + TradeContext.workTime + "')" if( AfaDBFunc.InsertSql( sqlstr1 ) < 0 ): AfaDBFunc.RollbackSql( ) AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeInfo( '插入补录数据失败' + sqlstr1 ) TradeContext.errorCode,TradeContext.errorMsg = "0001","插入补录数据失败" return False AfaDBFunc.CommitSql( ) AfaLoggerFunc.tradeInfo( '********************插入补录数据表结束*******************' ) TradeContext.errorCode,TradeContext.errorMsg = "0000","插入补录数据成功" return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8521]进入***' ) #=====判断输入接口值是否存在==== if(not TradeContext.existVariable("OPRTYPNO")): return AfaFlowControl.ExitThisFlow('A099', '业务种类[OPRTYPNO]不存在') if(not TradeContext.existVariable("PRTFLG")): return AfaFlowControl.ExitThisFlow('A099', '打印标志[PRTFLG]不存在') if(not TradeContext.existVariable("BJEDTE")): return AfaFlowControl.ExitThisFlow('A099', '交易日期[BJEDTE]不存在') if(not TradeContext.existVariable("BSPSQN")): return AfaFlowControl.ExitThisFlow('A099', '报单序号[BSPSQN]不存在') #=====PL_TRCCO_HP 21 汇票==== if(TradeContext.OPRTYPNO==PL_TRCCO_HP): AfaLoggerFunc.tradeInfo("进入汇票处理") #=====查询数据库==== records = {} ret = rccpsDBFunc.getTransBil(TradeContext.BJEDTE,TradeContext.BSPSQN,records) if( ret == False): return AfaFlowControl.ExitThisFlow('A099', '无此数据') AfaLoggerFunc.tradeInfo("结束数据库查询") #=====判断是否为签发机构==== AfaLoggerFunc.tradeInfo("开始判断当前机构是否为交易机构") if( records['BESBNO'] != TradeContext.BESBNO ): return AfaFlowControl.ExitThisFlow('S999', '未查找到数据') AfaLoggerFunc.tradeInfo("结束判断当前机构是否为交易机构") #=====判断当前业务是否为来帐==== AfaLoggerFunc.tradeInfo("开始判断当前业务是否为来帐") if( records['BRSFLG'] == PL_BRSFLG_SND ): return AfaFlowControl.ExitThisFlow('S999', '该笔业务为往账业务,请使用[8522 往账凭证补打]交易打印') AfaLoggerFunc.tradeInfo("结束判断当前业务是否为来帐") #=====判断当前状态==== AfaLoggerFunc.tradeInfo("开始判断当前状态") # if( records['BCSTAT'] != PL_MBRTRCST_ACSUC and records['BCSTAT'] != PL_BCSTAT_AUTO ): # return AfaFlowControl.ExitThisFlow('A099', "当前状态["+records['BCSTAT']+"]不允许打印") #=====pgt 0925 将记账成功改为自动挂账,来帐没有记账,增加判断交易成功的判断==== # if( records['BCSTAT'] != PL_BCSTAT_HANG and records['BCSTAT'] != PL_BCSTAT_AUTO and records['BDWFLG'] != PL_BDWFLG_SUCC ): # return AfaFlowControl.ExitThisFlow('A099', "当前状态["+records['BCSTAT']+"]不允许打印") if not ((records['BCSTAT'] == PL_BCSTAT_HANG and records['BDWFLG'] == PL_BDWFLG_SUCC) or (records['BCSTAT'] == PL_BCSTAT_AUTO and records['BDWFLG'] == PL_BDWFLG_SUCC)): return AfaFlowControl.ExitThisFlow('A099', "当前状态["+records['BCSTAT']+"]["+records['BDWFLG']+"]不允许打印") AfaLoggerFunc.tradeInfo("结束判断当前状态") #=====判断打印状态==== AfaLoggerFunc.tradeInfo("开始判断当前业务的打印状态") if(TradeContext.PRTFLG == "0" and int(records['PRTCNT']) > 0): #打印,打印次数大于0 return AfaFlowControl.ExitThisFlow('A099','打印次数大于1,请选择补打' ) if(TradeContext.PRTFLG == "1" and int(records['PRTCNT']) == 0): #补打,打印次数为0 return AfaFlowControl.ExitThisFlow('A099','打印次数为0,请选择打印' ) AfaLoggerFunc.tradeInfo("结束判断当前业务的打印状态") #=====查询汇票信息登记簿==== AfaLoggerFunc.tradeInfo("开始查询汇票信息登记簿") bilinf_record = {} ret = rccpsDBFunc.getInfoBil(records['BILVER'],records['BILNO'],records['BILRS'],bilinf_record) if( ret == False ): return AfaFlowControl.ExitThisFlow('S999','查询汇票信息登记簿失败' ) AfaLoggerFunc.tradeInfo("结束查询汇票信息登记簿") #=====输出接口==== AfaLoggerFunc.tradeInfo("开始向输出接口赋值") TradeContext.PRTDAT = AfaUtilTools.GetHostDate() #打印日期 TradeContext.PRTTIM = AfaUtilTools.GetSysTime() #打印时间 TradeContext.BJEDTE = records['BJEDTE'] #交易日期 TradeContext.BSPSQN = records['BSPSQN'] #报单序号 TradeContext.BJETIM = records['BJETIM'] #交易时间 TradeContext.TRCCO = records['TRCCO'] #交易代码 TradeContext.OPRATTNO = records['OPRATTNO'] #业务熟悉 TradeContext.TRCDAT = records['TRCDAT'] #委托日期 TradeContext.TRCNO = records['TRCNO'] #交易流水号 TradeContext.OCCAMT = str(bilinf_record['BILAMT']) #交易金额 TradeContext.BILNO = records['BILNO'] #汇票号码 TradeContext.PYRACC = bilinf_record['PYRACC'] #付款人账号 TradeContext.PYRNAM = bilinf_record['PYRNAM'] #付款人名称 TradeContext.PYRADDR = bilinf_record['PYRADDR'] #付款人地址 TradeContext.PYEACC = bilinf_record['PYEACC'] #收款人账号 TradeContext.PYENAM = bilinf_record['PYENAM'] #收款人名称 TradeContext.PYEADDR = bilinf_record['PYEADDR'] #收款人地址 TradeContext.SEAL = bilinf_record['SEAL'] #汇票密压 TradeContext.TRDT = records['TRDT'] #主机日期 TradeContext.TLSQ = records['TLSQ'] #主机流水号 TradeContext.ACC1 = records['SBAC'] #借方账号 TradeContext.ACC2 = records['RBAC'] #贷方账号 TradeContext.ACC3 = "" #备用账号 TradeContext.DASQ = records['DASQ'] #销账序号 TradeContext.SNDBNKCO = records['SNDBNKCO'] #发送行号 TradeContext.SNDBNKNM = records['SNDBNKNM'] #发送行名 TradeContext.RCVBNKCO = records['RCVBNKCO'] #接收行号 TradeContext.RCVBNKNM = records['RCVBNKNM'] #接收行名 TradeContext.USE = bilinf_record['USE'] #用途 TradeContext.REMARK = bilinf_record['REMARK'] #备注 TradeContext.PRTCNT = str(int(records['PRTCNT'])+1) #打印次数 TradeContext.CUR = bilinf_record['CUR'] #币种 TradeContext.OPRNO = records['OPRNO'] #业务类型 TradeContext.RMNAMT = str(bilinf_record['RMNAMT']) #结余余额 TradeContext.OCCAMT1 = str(bilinf_record['OCCAMT']) #实际结算金额 TradeContext.PAYBNKCO = bilinf_record['PAYBNKCO'] #代理兑付行行号 TradeContext.PAYBNKNM = bilinf_record['PAYBNKNM'] #代理兑付行行名 AfaLoggerFunc.tradeInfo("结束向输出结构赋值") #=====更新打印标志==== AfaLoggerFunc.tradeInfo("开始更新打印标志") update_dict={'PRTCNT':records['PRTCNT']+1} where_dict={'BJEDTE':records['BJEDTE'],'BSPSQN':records['BSPSQN'],'BCSTAT':records['BCSTAT']} rownum=rccpsDBTrcc_sstlog.update(update_dict,where_dict) if(rownum<=0): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','更新打印次数失败' ) AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo("结束更新打印标志") AfaLoggerFunc.tradeInfo("结束汇票处理") #=====PL_TRCCO_HD 20 汇兑==== elif(TradeContext.OPRTYPNO==PL_TRCCO_HD): AfaLoggerFunc.tradeInfo("进入汇兑处理") #=====查询数据库==== records = {} ret = rccpsDBFunc.getTransTrc(TradeContext.BJEDTE,TradeContext.BSPSQN,records) if(ret==False): return AfaFlowControl.ExitThisFlow('A099','无此数据' ) #=====判断是否为签发机构==== AfaLoggerFunc.tradeInfo("开始判断当前机构是否为交易机构") if( records['BESBNO'] != TradeContext.BESBNO ): return AfaFlowControl.ExitThisFlow('S999', '为查找到数据') AfaLoggerFunc.tradeInfo("结束判断当前机构是否为交易机构") #=====刘雨龙 20080702 判断当前业务是否为来账业务==== if records['BRSFLG'] == PL_BRSFLG_SND: return AfaFlowControl.ExitThisFlow('S999','报单序号['+TradeContext.BSPSQN+']该笔业务为往账业务,不允许打印') #=====判断当前状态==== #=====pgt 0925 增加判断交易成功的判断==== # if records['BCSTAT'] != PL_BCSTAT_HANG and records['BCSTAT'] != PL_BCSTAT_AUTO and records['BCSTAT'] != PL_BCSTAT_QTR and records['BDWFLG'] != PL_BDWFLG_SUCC : # return AfaFlowControl.ExitThisFlow('A099',"当前状态[" + records['BCSTAT'] + "]不允许打印") if not ((records['BCSTAT'] == PL_BCSTAT_HANG and records['BDWFLG'] == PL_BDWFLG_SUCC) or (records['BCSTAT'] == PL_BCSTAT_AUTO and records['BDWFLG'] == PL_BDWFLG_SUCC) or (records['BCSTAT'] == PL_BCSTAT_QTR and records['BDWFLG'] == PL_BDWFLG_SUCC)): return AfaFlowControl.ExitThisFlow('A099',"当前状态[" + records['BCSTAT'] + "]["+records['BDWFLG']+"]不允许打印") if(TradeContext.PRTFLG == "0" and int(records['PRTCNT']) > 0): #打印,打印次数大于0 return AfaFlowControl.ExitThisFlow('A099','打印次数大于1,请选择补打' ) if(TradeContext.PRTFLG == "1" and int(records['PRTCNT']) == 0): #补打,打印次数为0 return AfaFlowControl.ExitThisFlow('A099','打印次数未0,请选择打印' ) AfaLoggerFunc.tradeInfo("判断打印标志结束") #=====输出接口==== TradeContext.PRTDAT = AfaUtilTools.GetHostDate() #打印日期 TradeContext.PRTTIM = AfaUtilTools.GetSysTime() #打印时间 TradeContext.BJEDTE = records['BJEDTE'] #交易日期 TradeContext.BSPSQN = records['BSPSQN'] #交易序号 TradeContext.BJETIM = records['BJETIM'] #交易时间 TradeContext.TRCCO = records['TRCCO'] #业务类型 TradeContext.OPRATTNO = records['OPRATTNO'] #业务属性 TradeContext.TRCDAT = records['TRCDAT'] #委托日期 TradeContext.TRCNO = records['TRCNO'] #交易流水号 TradeContext.OCCAMT = str(records['OCCAMT']) #交易金额 TradeContext.BILNO = records['BILNO'] #汇票号码 TradeContext.PYRACC = records['PYRACC'] #付款人账号 TradeContext.PYRNAM = records['PYRNAM'] #付款人名称 TradeContext.PYRADDR = records['PYRADDR'] #付款人地址 TradeContext.PYEACC = records['PYEACC'] #收款人账号 TradeContext.PYENAM = records['PYENAM'] #收款人名称 TradeContext.PYEADDR = records['PYEADDR'] #收款人地址 TradeContext.SEAL = records['SEAL'] #汇票密压 #=====PL_BCSTAT_QTR 80 退汇==== if records['BCSTAT'] == PL_BCSTAT_QTR: #=====退汇业务,返回挂账状态的状态详细信息==== stat_dict = {} if not rccpsState.getTransStateSet(records['BJEDTE'],records['BSPSQN'],PL_BCSTAT_HANG,PL_BDWFLG_SUCC,stat_dict): return AfaFlowControl.ExitThisFlow('A099','查询交易自动挂账状态异常' ) TradeContext.TRDT = stat_dict['TRDT'] #主机日期 TradeContext.TLSQ = stat_dict['TLSQ'] #主机流水号 TradeContext.ACC1 = stat_dict['SBAC'] #借方账号 TradeContext.ACC2 = stat_dict['RBAC'] #贷方账号 TradeContext.ACC3 = "" #备用账号 TradeContext.DASQ = stat_dict['DASQ'] #销账序号 else: #=====非退汇业务,返回当前状态的状态详细信息==== TradeContext.TRDT = records['TRDT'] #主机日期 TradeContext.TLSQ = records['TLSQ'] #主机流水号 TradeContext.ACC1 = records['SBAC'] #借方账号 TradeContext.ACC2 = records['RBAC'] #贷方账号 TradeContext.ACC3 = "" #备用账号 TradeContext.DASQ = records['DASQ'] #销账序号 TradeContext.SNDBNKCO = records['SNDBNKCO'] #发送行号 TradeContext.SNDBNKNM = records['SNDBNKNM'] #发送行名 TradeContext.RCVBNKCO = records['RCVBNKCO'] #接收行号 TradeContext.RCVBNKNM = records['RCVBNKNM'] #接收行名 TradeContext.USE = records['USE'] #用途 TradeContext.REMARK = records['REMARK'] #备注 TradeContext.PRTCNT = str(int(records['PRTCNT'])+1) #打印次数 TradeContext.OPRNO = records['OPRNO'] #业务类型 TradeContext.CUR = records['CUR'] #币种 TradeContext.OCCAMT = str(records['OCCAMT']) #业务属性 #=====更新打印标志==== AfaLoggerFunc.tradeInfo("开始更新打印标志") update_dict={'PRTCNT':records['PRTCNT']+1} where_dict={'BJEDTE':records['BJEDTE'],'BSPSQN':records['BSPSQN'],'BCSTAT':records['BCSTAT']} rownum=rccpsDBTrcc_sstlog.update(update_dict,where_dict) if(rownum<=0): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','更新打印次数失败' ) AfaDBFunc.CommitSql() else: return AfaFlowControl.ExitThisFlow('A099','业务类型错') TradeContext.errorCode="0000" TradeContext.errorMsg="查询成功" AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8521]退出***' ) 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 SubModuleDoSnd(): #=====开始向字典赋值==== AfaLoggerFunc.tradeInfo('>>>主机记账后处理') sst_dict = {} sst_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 AfaLoggerFunc.tradeDebug('>>>test by lyl as BSPSQN=['+TradeContext.BSPSQN+']') sst_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 AfaLoggerFunc.tradeDebug('>>>test by lyl as BJEDTE=['+TradeContext.BJEDTE+']') sst_dict['SBAC'] = TradeContext.SBAC #借方账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as SBAC=['+TradeContext.SBAC+']') sst_dict['NOTE3'] = TradeContext.NOTE3 #备注3 AfaLoggerFunc.tradeDebug('>>>test by lyl as NOTE3 =['+TradeContext.NOTE3 +']') sst_dict['BJETIM'] = TradeContext.BJETIM #交易时间 AfaLoggerFunc.tradeDebug('>>>test by lyl as BJETIM=['+TradeContext.BJETIM+']') sst_dict['MGID'] = TradeContext.errorCode #主机返回信息 AfaLoggerFunc.tradeDebug('>>>test by lyl as MGID =['+str(sst_dict['MGID']) +']') sst_dict['STRINFO'] = TradeContext.errorMsg #主机返回信息 AfaLoggerFunc.tradeDebug('>>>test by lyl as STRINFO =['+str(sst_dict['STRINFO']) +']') sst_dict['BETELR'] = TradeContext.BETELR #柜员号 AfaLoggerFunc.tradeDebug('>>>test by lyl as BETELR=['+TradeContext.BETELR+']') sst_dict['RBAC'] = TradeContext.RBAC #贷方账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as RBAC =['+TradeContext.RBAC +']') sst_dict['BCSTAT'] = PL_BCSTAT_AUTO #自动入账成功 AfaLoggerFunc.tradeDebug('>>>test by lyl as BCSTAT=['+str(sst_dict['BCSTAT']) +']') sst_dict['BESBNO'] = TradeContext.BESBNO #机构号 AfaLoggerFunc.tradeDebug('>>>test by lyl as BESBNO=['+TradeContext.BESBNO+']') #=====开始判断主机返回结果==== out_context_dict = {} if TradeContext.errorCode == '0000': if( TradeContext.existVariable('DASQ') and len(TradeContext.DASQ) != 0 ): sst_dict['DASQ'] = TradeContext.DASQ #销账序号 AfaLoggerFunc.tradeDebug('>>>test by lyl as DASQ =['+TradeContext.DASQ +']') sst_dict['RBAC'] = TradeContext.REAC #挂账账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as RBAC =['+TradeContext.RBAC +']') sst_dict['BCSTAT'] = PL_BCSTAT_HANG #自动挂账 71 AfaLoggerFunc.tradeDebug('>>>test by lyl as BCSTAT=['+str(sst_dict['BCSTAT']) +']') if len(sst_dict['NOTE3']) == 0: sst_dict['NOTE3'] = "主机方挂账" else: sst_dict['RBAC'] = TradeContext.RBAC #贷方账号 AfaLoggerFunc.tradeDebug('>>>test by lyl as RBAC =['+TradeContext.RBAC +']') sst_dict['BCSTAT'] = PL_BCSTAT_AUTO #自动入账 70 AfaLoggerFunc.tradeDebug('>>>test by lyl as BCSTAT=['+str(sst_dict['BCSTAT']) +']') sst_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 AfaLoggerFunc.tradeDebug('>>>test by lyl as BDWFLG=['+str(sst_dict['BDWFLG']) +']') sst_dict['TRDT'] = TradeContext.TRDT #主机日期 AfaLoggerFunc.tradeDebug('>>>test by lyl as TRDT =['+TradeContext.TRDT +']') sst_dict['TLSQ'] = TradeContext.TLSQ #主机流水 AfaLoggerFunc.tradeDebug('>>>test by lyl as TLSQ =['+TradeContext.TLSQ +']') out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' else: sst_dict['BDWFLG'] = PL_BDWFLG_FAIL #失败 out_context_dict['PRCCO'] = 'RCCI1056' out_context_dict['STRINFO'] = '其它错误' AfaLoggerFunc.tradeDebug('>>>当前业务状态[' + str(sst_dict['BCSTAT']) + ']') AfaLoggerFunc.tradeDebug('>>>当前流转标志[' + str(sst_dict['BDWFLG']) + ']') #=====设置状态为 记账/挂账-成功 ==== if not rccpsState.setTransState(sst_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeDebug('>>>commit成功') #=====开始设置通讯回执报文信息==== AfaLoggerFunc.tradeInfo('>>>开始组织通讯回执报文') 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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 rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) return True
def VouhModify( ): #判断报文变量是否存在,若存在则赋值到内部变量,用于插入数据库 if( TradeContext.existVariable( "sLstTrxDay" ) ): _sWorkDate_ = TradeContext.sLstTrxDay #工作日期 else: _sWorkDate_ = '' if( TradeContext.existVariable( "sLstTrxTime" ) ): _sWorkTime_ = TradeContext.sLstTrxTime #工作时间 else: _sWorkTime_ = '' if( TradeContext.existVariable( "sBesbNo" ) ): _sBESBNO_ = TradeContext.sBesbNo #机构号 else: _sBESBNO_ = '' if( TradeContext.existVariable( "sCur" ) ): _sCur_ = TradeContext.sCur #货币代号 else: _sCur_ = '' if( TradeContext.existVariable( "sTellerTailNo" ) ): _sTellerTailNo_ = TradeContext.sTellerTailNo #交易柜员尾箱号 else: _sTellerNo_ = '' if( TradeContext.existVariable( "sVouhSerial" ) ): _sVouhSerial_ = TradeContext.sVouhSerial #操作流水号 else: _sVouhSerial_ = GetVouhSerial( ) if( TradeContext.existVariable( "sRivTeller" ) ): _sRivTeller_ = TradeContext.sRivTeller #对方柜员尾箱号 else: _sRivTeller_ = '' if( TradeContext.existVariable( "sDepository" ) ): _sDepository_ = TradeContext.sDepository #库箱标志 else: _sDepository_ = '' if( TradeContext.existVariable( "sExDepos" ) ): _sExDepos_ = TradeContext.sExDepos #原库箱标志 else: _sExDepos_ = '' if( TradeContext.existVariable( "sVouhStatus" ) ): _sVouhStatus_ = TradeContext.sVouhStatus #状态 else: _sVouhStatus_ = '' if( TradeContext.existVariable( "sExStatus" ) ): _sExStatus_ = TradeContext.sExStatus #原状态 else: _sExStatus_ = '' if( TradeContext.existVariable( "sAuthTeller" ) ): _sAuthTeller_ = TradeContext.sAuthTeller #授权柜员 else: _sAuthTeller_ = '' if( TradeContext.existVariable( "sTransType" ) ): _sTransType_ = TradeContext.sTransType #凭证状态 else: _sTransType_ = '' if(not TradeContext.existVariable( "sNum" ) ): TradeContext.sNum = 1 #重复次数 for i in range(TradeContext.sNum): if( TradeContext.existVariable( "sVouhType" ) ): _sVouhType_ = TradeContext.sVouhType[i] #凭证种类 else: _sVouhType_ = '' if( TradeContext.existVariable( "sStartNo" ) ): _sStartNo_ = TradeContext.sStartNo[i] #起始号码 else: _sStartNo_ = '' if( TradeContext.existVariable( "sEndNo" ) ): _sEndNo_ = TradeContext.sEndNo[i] #终止号码 else: _sEndNo_ = '' if( TradeContext.existVariable( "sVouhNum" ) ): _sVouhNum_ = TradeContext.sVouhNum[i] #凭证数量 else: _sVouhNum_ = '' #用内部变量拼插入数据库SQL sqlStrInsert = "insert into VOUH_MODIFY ( VOUHSERIAL, WORKDATE, WORKTIME,VOUHNUM, BESBNO, TELLERNO, CUR ,\ VOUHTYPE, STARTNO, ENDNO, RIVTELLER, DEPOSITORY, EXDEPOS, VOUHSTATUS, EXSTATUS,TRANSTYPE) \ VALUES ('" + _sVouhSerial_ + "','" + _sWorkDate_ + "','" + _sWorkTime_ + "','"+ _sVouhNum_ + "','" + _sBESBNO_ + "','" \ + _sTellerTailNo_ + "','" + _sCur_+ "','" + _sVouhType_+"','" \ + _sStartNo_ + "','" + _sEndNo_ + "','" + _sRivTeller_ + "','" + _sDepository_ + "','" \ + _sExDepos_ + "','" + _sVouhStatus_ + "','" + _sExStatus_ + "','" + _sTransType_ + "')" AfaLoggerFunc.tradeInfo( sqlStrInsert ) records = AfaDBFunc.InsertSql( sqlStrInsert ) if records == -1 : AfaLoggerFunc.tradeInfo( '数据库回滚' ) record = AfaDBFunc.RollbackSql( ) tradeExit('A005061', '插入[凭证流水表]操作异常!') raise AfaFlowControl.flowException( ) return -1 return 0
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
def SubModuleDoFst(): #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO hdcbka_dict = rccpsDBTrcc_hdcbka.selectu(hdcbka_where_dict) if hdcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") return True if len(hdcbka_dict) > 0: AfaLoggerFunc.tradeInfo("汇兑查询查复自由格式登记簿中存在相同查复交易,此报文为重复报文,进入下一流程,发送表示成功的通讯回执") #======为通讯回执报文赋值=============================================== out_context_dict = {} 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #==========为汇兑查询查复自由格式登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询查复自由格式登记簿字典赋值") TradeContext.BRSFLG = PL_BRSFLG_RCV #TradeContext.ISDEAL = PL_ISDEAL_ISDO hdcbka_insert_dict = {} if not rccpsMap1120CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") #==========登记汇兑查询查复自由格式登记簿======================================= AfaLoggerFunc.tradeInfo(">>>开始登记此自由格式书") ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict) if ret <= 0: if not AfaDBFunc.RollbackSql(): AfaFlowControl.ExitThisFlow("S999","Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","登记汇兑查询查复自由格式登记簿异常") 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).往账发送[TRCC002_8506]进入***' ) #====begin 蔡永贵 20110215 增加==== #新票据号是16位,需要取后8位,版本号为02,同时要兼容老票据号8位,版本号为01 if len(TradeContext.BILNO) == 16: TradeContext.TMP_BILNO = TradeContext.BILNO[-8:] else: TradeContext.TMP_BILNO = TradeContext.BILNO #============end============ AfaLoggerFunc.tradeInfo('>>>RCVSTLBIN: '+TradeContext.RCVSTLBIN) AfaLoggerFunc.tradeInfo('>>>SNDSTLBIN: '+TradeContext.SNDSTLBIN) #=====判断是否为同一成员行内==== if TradeContext.RCVSTLBIN == TradeContext.SNDSTLBIN: return AfaFlowControl.ExitThisFlow('M999','同一成员行内禁止做此业务') ##===== 张恒 增加条件,如网银支付则不校验重复次数. 将手续费标志及金额字段赋值 20091109 ========## if (TradeContext.existVariable( "CHSHTP" ) and len(TradeContext.CHSHTP) != 0): #手续费收取方式 TradeContext.CHRGTYP = TradeContext.CHSHTP else: TradeContext.CHRGTYP = '2' #默认为不收 if (TradeContext.existVariable( "CUSCHRG" ) and len(TradeContext.CUSCHRG) != 0): #手续费金额 TradeContext.LOCCUSCHRG = TradeContext.CUSCHRG else : TradeContext.LOCCUSCHRG = '0.00' #默认为0.00 TradeContext.CUSCHRG = '0.00' #异地手续费清0 if str(TradeContext.OPRATTNO) != '12': #网银支付 ##=====END=====================================================================================## #=====检查数据库是否有相同交易==== sql = "BJEDTE = '" + TradeContext.BJEDTE + "'" #日期 sql = sql + " and BESBNO ='" + TradeContext.BESBNO + "'" #机构号 if (TradeContext.existVariable( "PYRACC" ) and len(TradeContext.PYRACC) != 0): #付款人账号 sql = sql + " and PYRACC ='" + TradeContext.PYRACC + "'" if (TradeContext.existVariable( "RCVBNKCO" ) and len(TradeContext.RCVBNKCO) != 0): #收款行行号 sql = sql + " and RCVBNKCO = '" + TradeContext.RCVBNKCO + "'" if (TradeContext.existVariable( "PYEACC" ) and len(TradeContext.PYEACC) != 0): #收款人账号 sql = sql + " and PYEACC ='" + TradeContext.PYEACC + "'" if (TradeContext.existVariable( "OCCAMT" ) and len(TradeContext.OCCAMT) != 0): #金额 sql = sql + " and OCCAMT =" + TradeContext.OCCAMT + "" if (TradeContext.existVariable( "OPRNO" ) and len(TradeContext.OPRNO) != 0): #业务种类 sql = sql + " and OPRNO ='" + TradeContext.OPRNO + "'" if (TradeContext.existVariable( "OPRATTNO" ) and len(TradeContext.OPRATTNO) != 0): #业务属性 sql = sql + " and OPRATTNO ='" + TradeContext.OPRATTNO + "'" if (TradeContext.existVariable( "BBSSRC" ) and len(TradeContext.BBSSRC) != 0): #资金来源 sql = sql + " and BBSSRC ='" + TradeContext.BBSSRC + "'" if (TradeContext.existVariable( "DASQ" ) and len(TradeContext.DASQ) != 0): #销账序号 sql = sql + " and DASQ ='" + TradeContext.DASQ + "'" if (TradeContext.existVariable( "BILTYP" ) and len(TradeContext.BILTYP) != 0): #票据种类 sql = sql + " and BILTYP = '" + TradeContext.BILTYP + "'" if (TradeContext.existVariable( "BILDAT" ) and len(TradeContext.BILDAT) != 0): #票据日期 sql = sql + " and BILDAT = '" + TradeContext.BILDAT + "'" if (TradeContext.existVariable( "BILNO" ) and len(TradeContext.BILNO) != 0): #票据号码 sql = sql + " and BILNO = '" + TradeContext.BILNO + "'" if (TradeContext.existVariable( "NOTE1" ) and len(TradeContext.NOTE1) != 0): #备注1 sql = sql + " and NOTE1 = '" + TradeContext.NOTE1 + "'" #=====调用函数进行多笔查询==== AfaLoggerFunc.tradeInfo( '>>>判断必要的字段是否重复,重复返回错误') record = rccpsDBTrcc_trcbka.selectm(1,10,sql,"") if record == None: return AfaFlowControl.ExitThisFlow('D000','数据库操作失败') if len(record) > 0: #====判断必要的字段是否重复,重复返回错误==== for next in range(0, len(record)): spbsta = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':record[next]['BSPSQN']} rep = rccpsDBTrcc_spbsta.selectu(spbsta) if rep == None: return AfaFlowControl.ExitThisFlow('D000', '数据库操作错误') elif len(rep) <= 0: return AfaFlowControl.ExitThisFlow('D001', '数据库查询相同业务错误') else: if rep['BDWFLG'] != PL_BDWFLG_FAIL: return AfaFlowControl.ExitThisFlow('S000', '相同业务已录入,不允许重复提交') AfaLoggerFunc.tradeInfo( '>>>开始处理此笔业务' ) #=====资金来源为1-个人结算户时,需要调用8811校验支付条件==== if TradeContext.BBSSRC == '1': TradeContext.HostCode = '8811' TradeContext.ACCNO = TradeContext.PYRACC #付款人账户 rccpsHostFunc.CommHost( '8811' ) if TradeContext.errorCode != '0000': return AfaFlowControl.ExitThisFlow('S999','查询凭证信息出错') else: if TradeContext.PAYTYP != TradeContext.HPAYTYP: return AfaFlowControl.ExitThisFlow('S999','支付条件错误') #=====开始调用密押服务器==== SEAL = ' ' SNDBANKCO = TradeContext.SNDBNKCO RCVBANKCO = TradeContext.RCVBNKCO SNDBANKCO = SNDBANKCO.rjust(12,'0') RCVBANKCO = RCVBANKCO.rjust(12,'0') AMOUNT = TradeContext.OCCAMT.split('.')[0] + TradeContext.OCCAMT.split('.')[1] AMOUNT = AMOUNT.rjust(15,'0') AfaLoggerFunc.tradeDebug('AMOUNT=' + str(AMOUNT) ) AfaLoggerFunc.tradeDebug('SNDBANKCO=' + str(SNDBANKCO) ) AfaLoggerFunc.tradeDebug('RCVBANKCO=' + str(RCVBANKCO) ) AfaLoggerFunc.tradeDebug('类型:' + str(PL_SEAL_ENC) ) AfaLoggerFunc.tradeDebug('业务类型:' + str(PL_TYPE_DZHD) ) AfaLoggerFunc.tradeDebug('日期' + TradeContext.TRCDAT ) AfaLoggerFunc.tradeDebug('流水' + TradeContext.SerialNo ) AfaLoggerFunc.tradeDebug('密押o[' + SEAL + ']') ret = miya.DraftEncrypt(PL_SEAL_ENC,PL_TYPE_DZHD,TradeContext.TRCDAT,TradeContext.SerialNo,AMOUNT,SNDBANKCO,RCVBANKCO,'',SEAL) AfaLoggerFunc.tradeDebug("ret[" + str(ret) + "]") AfaLoggerFunc.tradeDebug('密押[' + SEAL + ']') if ret != 0: return AfaFlowControl.ExitThisFlow('M9999','调用密押服务器失败') else: TradeContext.SEAL = SEAL AfaLoggerFunc.tradeDebug('密押new[' + TradeContext.SEAL + ']') #=====开始向字典赋值==== TradeContext.DCFLG = PL_DCFLG_CRE dict = {} if not rccpsMap8506CTradeContext2Ddict.map(dict): return AfaFlowControl.ExitThisFlow('M999', '字典赋值出错') #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') #=====commit操作==== if not AfaDBFunc.CommitSql(): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D011', '数据库Commit失败') else: AfaLoggerFunc.tradeDebug('COMMIT成功') #====送往主机字段增加收款人名称字段 === if (TradeContext.existVariable( "PYRNAM" ) and len(TradeContext.PYRNAM) != 0): #付款人名称 TradeContext.ACNM = TradeContext.PYRNAM else: TradeContext.ACNM = '' if (TradeContext.existVariable( "PYENAM" ) and len(TradeContext.PYENAM) != 0): #收款人名称 TradeContext.OTNM = TradeContext.PYENAM else: TradeContext.OTNM = '' #汇兑往帐记帐字典赋值 input_dict = {} input_dict['CHRGTYP'] = TradeContext.CHRGTYP #手续费收取方式 input_dict['LOCCUSCHRG'] = TradeContext.LOCCUSCHRG #手续费金额 input_dict['PYRACC'] = TradeContext.PYRACC #付款人账号 input_dict['BBSSRC'] = TradeContext.BBSSRC #资金来源 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['ACNM'] = TradeContext.ACNM #付款人名称 input_dict['OTNM'] = TradeContext.OTNM #收款人名称 input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑记账接口 rccpsEntries.HDWZJZ(input_dict) AfaLoggerFunc.tradeInfo( '***农信银系统:往账.主机类操作(1.本地操作).往账发送[TRCC002_8506]退出***' ) return True
def SubModuleDoFst(): #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_existp.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'] = trc_dict['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(">>>开始根据发送行号,委托日期,交易流水号查询交易信息") trc_dict = {} if not rccpsDBFunc.getTransTrcPK(TradeContext.SNDMBRCO,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,trc_dict): return AfaFlowControl.ExitThisFlow('S999','汇兑业务登记簿中无此交易,抛弃报文') AfaLoggerFunc.tradeInfo(">>>结束根据发送行号,委托日期,交易流水号查询交易信息") #=====需要插入紧急止付业务登记簿existp==== existp = {} if not rccpsMap1130CTradeContext2Dexistp.map(existp): return AfaFlowControl.ExitThisFlow('S999','字典赋值出错,抛弃报文') existp['BOJEDT'] = trc_dict['BJEDTE'] existp['BOSPSQ'] = trc_dict['BSPSQN'] existp['CUR'] = '01' #=====张恒 20091203 新增 将机构落到原交易机构 ==== existp['BESBNO'] = trc_dict['BESBNO'] ret = rccpsDBTrcc_existp.insertCmt(existp) if ret < 0: return AfaFlowControl.ExitThisflow('S999','插入止付业务登记簿出错,抛弃报文') #======检查原业务状态是否为自动挂账-成功==== #if not (trc_dict['BCSTAT'] != PL_BCSTAT_HANG and trc_dict['BDWFLG'] != PL_BDWFLG_SUCC ): if (trc_dict['BCSTAT'] != PL_BCSTAT_HANG or trc_dict['TRCCO'][:2] != '20' or trc_dict['TRCCO'] == '2000009'): 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'] = trc_dict['TRCCO'] out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '该笔业务已入账,不允许退汇' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','重复报文,退出处理流程') TradeContext.BOSPSQ = trc_dict['BSPSQN'] TradeContext.BOJEDT = trc_dict['BJEDTE'] TradeContext.ORPYRACC = trc_dict['PYRACC'] TradeContext.ORPYRNAM = trc_dict['PYRNAM'] TradeContext.ORPYEACC = trc_dict['PYEACC'] TradeContext.ORPYENAM = trc_dict['PYENAM'] TradeContext.ORTRCCO = trc_dict['TRCCO'] #=====汇兑业务登记簿trcbka赋值新增一条记录==== trc_dict['BOJEDT'] = trc_dict['BJEDTE'] trc_dict['BOSPSQ'] = trc_dict['BSPSQN'] trc_dict['ORTRCDAT']= trc_dict['TRCDAT'] trc_dict['ORTRCNO'] = trc_dict['TRCNO'] trc_dict['ORTRCCO'] = trc_dict['TRCCO'] trc_dict['TRCCO'] = '2000004' trc_dict['OPRNO'] = '09' trc_dict['DCFLG'] = PL_DCFLG_CRE trc_dict['BJEDTE'] = TradeContext.BJEDTE trc_dict['BSPSQN'] = TradeContext.BSPSQN trc_dict['TRCDAT'] = TradeContext.TRCDAT trc_dict['TRCNO'] = TradeContext.SerialNo trc_dict['BRSFLG'] = PL_BRSFLG_SND #往账 trc_dict['BBSSRC'] = '3' #待销账 #=====接收成员行号与发送成员行号互换==== TradeContext.temp = trc_dict['SNDMBRCO'] trc_dict['SNDMBRCO']= trc_dict['RCVMBRCO'] trc_dict['RCVMBRCO']= TradeContext.temp #=====接收行号与发送行号互换==== TradeContext.temp = trc_dict['SNDBNKCO'] trc_dict['SNDBNKCO']= trc_dict['RCVBNKCO'] trc_dict['RCVBNKCO']= TradeContext.temp #=====接收行名与发送行名互换==== TradeContext.temp = trc_dict['SNDBNKNM'] trc_dict['SNDBNKNM']= trc_dict['RCVBNKNM'] trc_dict['RCVBNKNM']= TradeContext.temp #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(trc_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('插入汇兑业务登记簿,COMMIT成功') #=====设置状态为记账-处理中==== sstlog = {} sstlog['BSPSQN'] = TradeContext.BSPSQN sstlog['BJEDTE'] = TradeContext.BJEDTE sstlog['BCSTAT'] = PL_BCSTAT_ACC sstlog['BDWFLG'] = PL_BDWFLG_WAIT if not rccpsState.setTransState(sstlog): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====开始拼借贷方账号==== TradeContext.DASQ = trc_dict['DASQ'] TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ TradeContext.OCCAMT= TradeContext.OROCCAMT TradeContext.HostCode = '8813' #=====开始调函数拼贷方账号第25位校验位==== TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC, 25) AfaLoggerFunc.tradeInfo( '贷方账号:' + TradeContext.RBAC ) rccpsHostFunc.CommHost(TradeContext.HostCode) AfaLoggerFunc.tradeInfo( '>>>开始判断主机返回结果' ) status_dict = {} status_dict['BSPSQN'] = TradeContext.BSPSQN #报单序号 status_dict['BJEDTE'] = TradeContext.BJEDTE #交易日期 status_dict['BCSTAT'] = PL_BCSTAT_ACC #记账 #=====判断主机返回结果==== if TradeContext.errorCode != '0000': status_dict['BDWFLG'] = PL_BDWFLG_FAIL #失败 else: status_dict['BDWFLG'] = PL_BDWFLG_SUCC #成功 status_dict['TRDT'] = TradeContext.TRDT #主机日期 status_dict['TLSQ'] = TradeContext.TLSQ #主机流水号 status_dict['MGID'] = TradeContext.MGID #主机返回信息 status_dict['DASQ'] = TradeContext.DASQ #销账序号 #=====修改退汇记录的状态==== if not rccpsState.setTransState(status_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>commit成功') #=====判断主机返回结果,是否继续流程==== if TradeContext.errorCode != '0000': 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.TRCDAT 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.ORTRCCO out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '该笔业务已入账,不允许退汇' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 #=====发送afe==== AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','该笔业务已被主机处理,不允许退汇') #=====新增记录的状态为:发送-处理中==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_SND,PL_BDWFLG_WAIT): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() 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.TRCDAT 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.ORTRCCO out_context_dict['PRCCO'] = 'RCCI0000' out_context_dict['STRINFO'] = '成功' rccpsMap0000Dout_context2CTradeContext.map(out_context_dict) TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO #发起成员行号 return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC004_1163]进入***' ) #=====判断是否存在自动冲正报文==== AfaLoggerFunc.tradeDebug('>>>判断是否存在自动冲正报文') atcbka_where={'ORMFN':TradeContext.MSGFLGNO} atcbka_dict = rccpsDBTrcc_atcbka.selectu(atcbka_where) if( len(atcbka_dict) > 0 ): #=====冲销业务存在自动冲正报文,更新表数据为冲销失败,回复冲销失败报文==== AfaLoggerFunc.tradeDebug('>>>已存在自动冲正报文,抛弃报文') return AfaFlowControl.ExitThisFlow('S999','存在自动冲正报文,抛弃报文') else: AfaLoggerFunc.tradeDebug('>>>未查找到针对补正报文的自动冲正报文,流程继续') #=====判断原补正交易是否存在==== AfaLoggerFunc.tradeDebug('>>>判断是否存在原补正报文') wtrbka_where={'MSGFLGNO':TradeContext.ORMFN} wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(wtrbka_where) wtrbka_temp_dict = wtrbka_dict if len(wtrbka_dict) <= 0: AfaLoggerFunc.tradeDebug('>>>未找到原补正报文,抛弃报文,不做任何处理') return AfaFlowControl.ExitThisFlow('S999','未找到原补正报文,抛弃报文,不做任何处理') else: AfaLoggerFunc.tradeDebug('>>>找到原补正报文,继续流程处理') #=====查找原业务==== AfaLoggerFunc.tradeDebug('>>>查询原业务') wtrbka_where={'BJEDTE':wtrbka_dict['NOTE1'],'BSPSQN':wtrbka_dict['NOTE2']} wtrbka_dict = rccpsDBTrcc_wtrbka.selectu(wtrbka_where) if len(wtrbka_dict) <= 0: AfaLoggerFunc.tradeDebug('>>>未找到原业务,抛弃报文,不做任何处理') return AfaFlowControl.ExitThisFlow('S999','未找到原业务,抛弃报文,不做任何处理') else: AfaLoggerFunc.tradeDebug('>>>找到原业务,继续流程处理') #=====查找原业务状态==== AfaLoggerFunc.tradeDebug('>>>查找原业务状态') spb_where = {'BJEDTE':wtrbka_dict['BJEDTE'],'BSPSQN':wtrbka_dict['BSPSQN']} spb_dict = rccpsDBTrcc_spbsta.selectu(spb_where) if len(spb_dict) <= 0: AfaLoggerFunc.tradeDebug('>>>查找原业务状态失败,抛弃报文,不做任何处理') return AfaFlowControl.ExitThisFlow('S999','查找原业务状态失败,抛弃报文,不做任何处理') else: AfaLoggerFunc.tradeDebug('>>>查找原业务状态成功,继续流程处理') #=====判断原业务状态是否允许进行补正账务补录==== if spb_dict['BCSTAT'] != PL_BCSTAT_CANC and spb_dict['BDWFLG'] != PL_BDWFLG_SUCC: AfaLoggerFunc.tradeDebug('>>>原业务状态['+str(spbsta_dict['BCSTAT'])+'不允许补正,抛弃报文,不做任何处理') return AfaFlowControl.ExitThisFlow('S999','原业务不允许补正,抛弃报文,不做任何处理') else: AfaLoggerFunc.tradeDebug('>>>原业务进入补正账务流程处理') #=================若应答报文回复拒绝,则设置状态为拒绝,停止处理============= if TradeContext.PRCCO != 'RCCI0000': AfaLoggerFunc.tradeInfo(">>>对方返回拒绝应答") #=============设置业务状态为拒绝处理中================================= if not rccpsState.newTransState(wtrbka_temp_dict['BJEDTE'],wtrbka_temp_dict['BSPSQN'],PL_BCSTAT_MFERFE,PL_BDWFLG_SUCC): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝处理中异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") return AfaFlowControl.ExitThisFlow("S999","对方拒绝,停止处理") else: AfaLoggerFunc.tradeInfo(">>>对方返回成功应答") #=====记账接口8813I1赋值操作==== TradeContext.HostCode = '8813' TradeContext.BESBNO = wtrbka_dict['BESBNO'] #机构号 TradeContext.BETELR = wtrbka_dict['BETELR'] #柜员号 TradeContext.TERMID = wtrbka_dict['TERMID'] #终端号 TradeContext.BJEDTE = wtrbka_dict['BJEDTE'] #交易日期 TradeContext.BSPSQN = wtrbka_dict['BSPSQN'] #报单序号 #=====判断交易代码,进行账务补正==== if TradeContext.ORTRCCO in ('3000002','3000004'): #=====通存==== AfaLoggerFunc.tradeDebug('>>>通存业务补正') elif TradeContext.ORTRCCO in ('3000102','3000104'): #=====通兑==== AfaLoggerFunc.tradeDebug('>>>通兑业务补正') if( wtrbka_dict['CHRGTYP'] != '1'): TradeContext.RCCSMCD = PL_RCCSMCD_XJTDWZ #主机摘要代码 TradeContext.RBAC = '' #借方账户:付款人账户 TradeContext.RBNM = '现金' #借方户名 付款人户名 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #贷方账户:农信银待清算来账 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC, 25) TradeContext.ACNM = '农信银待清算来账' #贷方户名: TradeContext.CTFG = '7' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.PKFG = 'T' #通存通兑标识 TradeContext.CATR = '0' #现金 AfaLoggerFunc.tradeInfo( '借方账号:' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '贷方账号:' + TradeContext.RBAC ) else: #=====转账==== TradeContext.ACUR = '3' #记账次数 TradeContext.I3TRAM = str(TradeContext.CUSCHRG) #发生额 TradeContext.I2TRAM = str(TradeContext.OCCAMT) #发生额 TradeContext.OCCAMT = rccpsUtilTools.AddDot(TradeContext.OCCAMT,TradeContext.CUSCHRG) #发生额 #=========交易金额+手续费=================== TradeContext.RCCSMCD = PL_RCCSMCD_XJTDWZ #摘要代码 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '待解临时款项' #借方户名 TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '农信银来账' #贷方户名 TradeContext.CTFG = '9' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.PKFG = 'T' #通存通兑标识 AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:借方账号' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:贷方账号' + TradeContext.RBAC ) #=========交易金额============ TradeContext.I2SMCD = PL_RCCSMCD_XJTDWZ #摘要代码 TradeContext.I2RBAC = '' #借方账号 TradeContext.I2ACNM = TradeContext.PYRNAM #借方户名 TradeContext.I2SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #贷方账号 TradeContext.I2SBAC = rccpsHostFunc.CrtAcc(TradeContext.I2SBAC,25) TradeContext.I2CTFG = '7' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.I2PKFG = 'T' #通存通兑标识 TradeContext.I2CATR = '0' #现金 AfaLoggerFunc.tradeInfo( '>>>交易金额:借方账号' + TradeContext.I2SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额:贷方账号' + TradeContext.I2RBAC ) #=========结算手续费收入户=========== TradeContext.I3SMCD = PL_RCCSMCD_SXF #摘要代码 TradeContext.I3SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I3ACNM = TradeContext.PYRNAM #借方户名 TradeContext.I3RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号 TradeContext.I3RBAC = rccpsHostFunc.CrtAcc(TradeContext.I3RBAC,25) TradeContext.I3SBAC = rccpsHostFunc.CrtAcc(TradeContext.I3SBAC,25) TradeContext.I3OTNM = '待解临时款项' #贷方户名 TradeContext.I3CTFG = '8' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.I3PKFG = 'T' #通存通兑标识 AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:借方账号' + TradeContext.I3SBAC ) AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:贷方账号' + TradeContext.I3RBAC ) elif TradeContext.ORTRCCO in ('3000003','3000005'): #=====本转异==== AfaLoggerFunc.tradeDebug('>>>本转异业务补正') elif TradeContext.ORTRCCO in ('3000103','3000105'): #=====异转本==== AfaLoggerFunc.tradeDebug('>>>异转本业务补正') #=====判断手续费收取方式==== if wtrbka_dict['CHRGTYP'] == '1': #=====转账==== TradeContext.ACUR = '3' #记账次数 TradeContext.I3TRAM = str(TradeContext.CUSCHRG) #发生额 手续费 TradeContext.I2TRAM = str(TradeContext.OCCAMT) #发生额 本金 TradeContext.OCCAMT = str(float(TradeContext.OCCAMT) + float(TradeContext.CUSCHRG)) #发生额 #=========交易金额+手续费=================== TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 PL_RCCSMCD_YZBWZ 异转本 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银往账' #借方户名 TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '应解汇款' #贷方户名 TradeContext.CTFG = '9' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.PKFG = 'T' #通存通兑标识 AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:借方账号' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:贷方账号' + TradeContext.RBAC ) #=========交易金额============ TradeContext.I2SMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.I2SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I2SBAC = rccpsHostFunc.CrtAcc(TradeContext.I2SBAC,25) TradeContext.I2ACNM = '应解汇款' #借方户名 TradeContext.I2RBAC = TradeContext.PYEACC #贷方账号 TradeContext.I2OTNM = TradeContext.PYENAM #贷方户名 TradeContext.I2CTFG = '7' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.I2PKFG = 'T' #通存通兑标识 AfaLoggerFunc.tradeInfo( '>>>交易金额:借方账号' + TradeContext.I2SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额:贷方账号' + TradeContext.I2RBAC ) #=========结算手续费收入户=========== TradeContext.I3SMCD = PL_RCCSMCD_SXF #摘要代码 TradeContext.I3SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I3SBAC = rccpsHostFunc.CrtAcc(TradeContext.I3SBAC,25) TradeContext.I3ACNM = '应解汇款' #借方户名 TradeContext.I3RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号 TradeContext.I3RBAC = rccpsHostFunc.CrtAcc(TradeContext.I3RBAC,25) TradeContext.I3OTNM = '结算手续费' #贷方户名 TradeContext.I3CTFG = '8' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.I3PKFG = 'T' #通存通兑标识 else: #=====不收费或者现金==== TradeContext.ACUR = '1' #记账次数 TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.RBAC = TradeContext.PYEACC #贷方账号 TradeContext.OTNM = TradeContext.PYENAM #贷方户名 TradeContext.CTFG = '7' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.PKFG = 'T' #通存通兑标识 else: #=====原交易代码错,抛弃报文==== AfaLoggerFunc.tradeDebug('>>>原交易代码错,抛弃报文') return AfaFlowControl.ExitThisFlow('S999','原交易代码错,抛弃报文') #=====重新生成前置流水号==== if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 : return AfaFlowControl.ExitThisFlow('S999','重新生成前置流水号失败,抛弃报文') #=====modify by pgt 12-8==== if wtrbka_temp_dict['DCFLG'] == PL_DCFLG_DEB: # if TradeContext.ORTRCCO in ('3000102','3000104','3000103','3000105'): #=====通兑、异转本==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_AUTOPAY,PL_BDWFLG_WAIT): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('S999','新增自动扣款-处理中失败,抛弃报文') else: AfaDBFunc.CommitSql() #=====向主机发起记账==== rccpsHostFunc.CommHost( TradeContext.HostCode ) #=====判断主机返回==== sstlog_dict={} sstlog_dict['BJEDTE'] = TradeContext.BJEDTE sstlog_dict['BSPSQN'] = TradeContext.BSPSQN sstlog_dict['BCSTAT'] = PL_BCSTAT_AUTOPAY if TradeContext.errorCode == '0000': sstlog_dict['BDWFLG'] = PL_BDWFLG_SUCC sstlog_dict['RBSQ'] = TradeContext.RBSQ sstlog_dict['TLSQ'] = TradeContext.TLSQ sstlog_dict['TRDT'] = TradeContext.TRDT sstlog_dict['MGID'] = TradeContext.errorCode sstlog_dict['STRINFO']= '主机补正记账成功' AfaLoggerFunc.tradeInfo('>>>补正记账成功') else: sstlog_dict['BDWFLG'] = PL_BDWFLG_FAIL sstlog_dict['MGID'] = TradeContext.errorCode sstlog_dict['STRINFO']= TradeContext.errorMsg AfaLoggerFunc.tradeInfo('>>>补正记账失败') if not rccpsState.setTransState(sstlog_dict): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('S999','修改自动扣款-成功中失败,抛弃报文') else: AfaDBFunc.CommitSql() else: #====通存、本转异==== AfaLoggerFunc.tradeDebug('>>>新增确认付款-处理中') if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CONFACC,PL_BDWFLG_SUCC): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('S999','新增确认付款-处理中失败,抛弃报文') else: AfaDBFunc.CommitSql() #=================为存款确认请求报文做准备================================= AfaLoggerFunc.tradeInfo(">>>开始为存款确认请求报文做准备") #=====================获取中心流水号==================================== if rccpsGetFunc.GetRccSerialno( ) == -1 : raise AfaFlowControl.flowException( ) TradeContext.MSGTYPCO = 'SET009' TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR TradeContext.ORMFN = TradeContext.ORMFN TradeContext.OPRTYPNO = '30' TradeContext.ROPRTPNO = '30' TradeContext.TRANTYP = '0' TradeContext.ORTRCCO = '3000505' TradeContext.ORTRCNO = TradeContext.TRCNO TradeContext.TRCCO = '3000503' TradeContext.TRCNO = TradeContext.SerialNo TradeContext.CURPIN = "" TradeContext.STRINFO = '收到补正应答,自动发送存款确认' AfaLoggerFunc.tradeInfo(">>>交易代码["+str(TradeContext.TRCCO)+"]") AfaLoggerFunc.tradeInfo(">>>结束为存款确认请求报文做准备") #=====更新原记录的存款确认字段==== #=====modify by pgt 12-8==== wtr_up_where = {'BJEDTE':wtrbka_temp_dict['BJEDTE'],'BSPSQN':wtrbka_temp_dict['BSPSQN']} # wtr_up_where = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} wtr_end_dict = {} wtr_end_dict['COTRCDAT'] = TradeContext.TRCDAT wtr_end_dict['COTRCNO'] = TradeContext.TRCNO wtr_end_dict['TRCNO'] = TradeContext.ORTRCNO wtr_end_dict['COMSGFLGNO']= TradeContext.SNDBNKCO+TradeContext.TRCDAT+TradeContext.TRCNO wtr_end_dict['MSGFLGNO'] = TradeContext.MSGFLGNO rccpsDBTrcc_wtrbka.update(wtr_end_dict,wtr_up_where) AfaDBFunc.CommitSql() AfaAfeFunc.CommAfe() if TradeContext.errorCode == '0000': AfaLoggerFunc.tradeInfo('>>>发送成功') else: AfaLoggerFunc.tradeInfo('>>>发送失败') return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).系统状态变更报文接收[RCC00R6_1121]进入***' ) #=================查询本地相关业务状态的系统状态============================ mbrifa_where_dict = {} mbrifa_where_dict['OPRTYPNO'] = TradeContext.RELOPRTYPNO mbrifa_dict = rccpsDBTrcc_mbrifa.selectu(mbrifa_where_dict) if mbrifa_dict == None: return AfaFlowControl.ExitThisFlow("S999","查询本地系统状态信息异常") if len(mbrifa_dict) <= 0: return AfaFlowControl.ExitThisFlow("S999","无相关业务类型本地系统状态信息") #=================校验报文新工作日期============================================ if int(TradeContext.NWWKDAT) < int(mbrifa_dict['NWWKDAT']): AfaLoggerFunc.tradeInfo("报文新工作日期[" + TradeContext.NWWKDAT + "]在本地新工作日期[" + mbrifa_dict['NWWKDAT'] + "]之前,丢弃此报文,进入下一流程,发送表示成功的通讯回执") #======为通讯回执报文赋值=================================================== 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) return True elif int(TradeContext.NWWKDAT) == int(mbrifa_dict['NWWKDAT']): #============报文新工作日期与本地新工作日期相同,校验报文新工作状态====== if int(TradeContext.NWSYSST) <= int(mbrifa_dict['NWSYSST']): AfaLoggerFunc.tradeInfo("报文新工作状态[" + TradeContext.NWSYSST + "]不在本地新工作状态[" + mbrifa_dict['NWSYSST'] + "]之后,丢弃此报文,进入下一流程,发送表示成功的通讯回执") #======为通讯回执报文赋值=================================================== 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) return True #增加日切报文后发先至情况的处理 #通存通兑顺序10-20-30-10 if TradeContext.RELOPRTYPNO == "30": if mbrifa_dict['NWSYSST'] == '10' and TradeContext.NWSYSST != '20': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为日间开始[10],但日切报文中变更状态非业务截止准备[20],停止处理") if mbrifa_dict['NWSYSST'] == '20' and TradeContext.NWSYSST != '30': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为业务截止准备[20],但日切报文中变更状态非业务截止[30],停止处理") if mbrifa_dict['NWSYSST'] == '30' and TradeContext.NWSYSST != '10': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为业务截止[30],但日切报文中变更状态非日间开始[10],停止处理") #汇兑汇票顺序10-30-10 else: if mbrifa_dict['NWSYSST'] == '10' and TradeContext.NWSYSST != '30': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为日间开始[10],但日切报文中变更状态非业务截止[30],停止处理") if mbrifa_dict['NWSYSST'] == '30' and TradeContext.NWSYSST != '10': return AfaFlowControl.ExitThisFlow("S999","[" + TradeContext.RELOPRTYPNO + "]业务当前业务状态为业务截止[30],但日切报文中变更状态非日间开始[10],停止处理") mbrifa_update_dict = {} mbrifa_update_dict['ORWKDAT'] = mbrifa_dict['NWWKDAT'] mbrifa_update_dict['ORSYSST'] = mbrifa_dict['NWSYSST'] mbrifa_update_dict['NWWKDAT'] = TradeContext.NWWKDAT mbrifa_update_dict['NWSYSST'] = TradeContext.NWSYSST mbrifa_update_dict['HOLFLG'] = TradeContext.HOLFLG mbrifa_update_dict['NOTE1'] = mbrifa_dict['NWWKDAT'] ret = rccpsDBTrcc_mbrifa.update(mbrifa_update_dict,mbrifa_where_dict) if ret <= 0: if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","更新系统状态异常") #======若新系统状态为业务截止,则打开对账系统调度============================ if TradeContext.NWSYSST == '30' and TradeContext.HOLFLG == '2': if TradeContext.RELOPRTYPNO == '20': #====打开汇兑对账系统调度======================================= AfaLoggerFunc.tradeInfo(">>>开始打开汇兑对账系统调度") if not rccpsCronFunc.openCron("00031"): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","打开汇兑对账系统调度异常") AfaLoggerFunc.tradeInfo(">>>结束打开汇兑对账系统调度") #====打开汇票对账系统调度======================================= AfaLoggerFunc.tradeInfo(">>>开始打开汇票对账系统调度") if not rccpsCronFunc.openCron("00041"): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","打开汇票对账系统调度异常") AfaLoggerFunc.tradeInfo(">>>结束打开汇票对账系统调度") elif TradeContext.RELOPRTYPNO == '30': #====打开通存通兑对账系统调度=================================== AfaLoggerFunc.tradeInfo(">>>开始打开通存通兑对账系统调度") if not rccpsCronFunc.openCron("00061"): if not AfaDBFunc.RollbackSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) AfaLoggerFunc.tradeError(">>>Rollback异常") AfaLoggerFunc.tradeInfo(">>>Rollback成功") return AfaFlowControl.ExitThisFlow("S999","打开通存通兑对账系统调度异常") AfaLoggerFunc.tradeInfo(">>>结束打开通存通兑对账系统调度") #====打开信息类业务量统计系统调度====================== AfaLoggerFunc.tradeInfo(">>>开始打开信息类业务量统计系统调度") # if not rccpsCronFunc.openCron("00067"): # if not AfaDBFunc.RollbackSql( ): # AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) # AfaLoggerFunc.tradeError(">>>Rollback异常") # AfaLoggerFunc.tradeInfo(">>>Rollback成功") # return AfaFlowControl.ExitThisFlow("S999","打开信息类业务量统计系统调度异常") # AfaLoggerFunc.tradeInfo(">>>结束打开信息类业务量统计系统调度") #======若通存通兑新系统状态为日间开始,则打开行名行号生效系统调度=================== if TradeContext.NWSYSST == '10' and TradeContext.RELOPRTYPNO == '30': #====开始打开行名行号生效系统调度======================================= AfaLoggerFunc.tradeInfo(">>>开始打开行名行号生效系统调度") if not rccpsCronFunc.openCron("00050"): 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成功") #======为通讯回执报文赋值=================================================== 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['MSGFLGNO'] = out_context_dict['SNDMBRCO'] + TradeContext.BJEDTE + TradeContext.SerialNo out_context_dict['ORMFN'] = TradeContext.MSGFLGNO 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) AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).系统状态变更报文接收[RCC00R6_1121]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8591]通存通兑错帐处理标识维护进入***' ) AfaLoggerFunc.tradeInfo('个性化处理(本地操作)') #=====判断接口变量是否存在==== if not TradeContext.existVariable("SNDBNKCO"): return AfaFlowControl.ExitThisFlow('A099','发送行号不能为空' ) if not TradeContext.existVariable("TRCDAT"): return AfaFlowControl.ExitThisFlow('A009','委托日期不能为空') if not TradeContext.existVariable("TRCNO"): return AfaFlowControl.ExitThisFlow('A009','交易流水号不能为空') if not TradeContext.existVariable("BJEDTE"): return AfaFlowControl.ExitThisFlow('A009','报单日期不能为空') if not TradeContext.existVariable("BSPSQN"): return AfaFlowControl.ExitThisFlow('A009','报单序号不能为空') AfaLoggerFunc.tradeInfo('个性化处理结束(本地操作)') #=====得到nccwkdat==== if not rccpsFunc.GetNCCDate( ) : #NCCworkDate raise AfaFlowControl.flowException( ) #=====查询错账登记簿==== where_dict = {} where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'SNDBNKCO':TradeContext.SNDBNKCO,'TRCDAT':TradeContext.TRCDAT,'TRCNO':TradeContext.TRCNO} tddzcz_record = rccpsDBTrcc_tddzcz.selectu(where_dict) if(tddzcz_record == None): return AfaFlowControl.ExitThisFlow('A009','查询错账登记簿失败') elif(len(tddzcz_record) == 0): return AfaFlowControl.ExitThisFlow('A009','查询错账登记簿为空') else: AfaLoggerFunc.tradeInfo("查询错账登记簿成功") #=====查询原业务的信息==== AfaLoggerFunc.tradeInfo('查询原业务信息') where_dict = {} where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} wtrbka_record = rccpsDBTrcc_wtrbka.selectu(where_dict) if(wtrbka_record == None): return AfaFlowControl.ExitThisFlow('A009','查询业务登记簿失败') elif(len(wtrbka_record) == 0): return AfaFlowControl.ExitThisFlow('A009','查询业务登记簿为空') else: AfaLoggerFunc.tradeInfo('查询业务登记簿成功') #=====查询业务的当前信息==== wtr_dict = {} if not rccpsDBFunc.getTransWtr(TradeContext.BJEDTE,TradeContext.BSPSQN,wtr_dict): return AfaFlowControl.ExitThisFlow('A009','查询业务的当前信息失败') if(wtr_dict['BRSFLG'] == PL_BRSFLG_SND): sstlog_dict = {} if not rccpsState.getTransStateSet(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_ACC,PL_BDWFLG_SUCC,sstlog_dict): return AfaFlowControl.ExitThisFlow('A009','查询业务状态信息失败') wtr_dict['FEDT'] = sstlog_dict['FEDT'] wtr_dict['RBSQ'] = sstlog_dict['RBSQ'] TradeContext.CLDT = wtr_dict['FEDT'] TradeContext.UNSQ = wtr_dict['RBSQ'] if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 : #RBSQ return AfaFlowControl.ExitThisFlow('A099','产生前置流水号失败') TradeContext.FEDT=AfaUtilTools.GetHostDate( ) #FEDT #=====判断当前业务是否已经结转==== if(wtr_dict['BCSTAT'] == PL_BCSTAT_TRAS and wtr_dict['BDWFLG'] == PL_BDWFLG_SUCC): return AfaFlowControl.ExitThisFlow('A009','该账务已经结转') #=====判断业务的往来标示==== AfaLoggerFunc.tradeInfo('<<<<<<判断业务的往来标示') if(wtrbka_record['BRSFLG'] == PL_BRSFLG_SND): AfaLoggerFunc.tradeInfo('<<<<<<业务为往账') acc = 0 hcac = 0 canc = 0 cancel = 0 #=====查询是否有记账成功的状态==== sstlog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_ACC,PL_BDWFLG_SUCC,sstlog_list): acc = len(sstlog_list) #=====查询是否有抹账的状态==== sstlog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_SUCC,sstlog_list): hcac = len(sstlog_list) #=====查询是否有冲销的状态==== sstlog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANC,PL_BDWFLG_SUCC,sstlog_list): canc = len(sstlog_list) #=====查询是否有冲正的状态==== ssltog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANCEL,PL_BDWFLG_SUCC,sstlog_list): cancel = len(sstlog_list) #=====判断是否需要清算状态调整==== AfaLoggerFunc.tradeInfo('<<<<<<判断是否需要清算状态调整') if(acc - (hcac + canc + cancel) >= 0): AfaLoggerFunc.tradeInfo('<<<<<<需要进行清算状态调整') TradeContext.BETELR = PL_BETELR_AUTO TradeContext.BRSFLG = wtrbka_record['BRSFLG'] TradeContext.CHRGTYP = wtrbka_record['CHRGTYP'] TradeContext.BESBNO = wtrbka_record['BESBNO'] #=====卡折存现/本转异地==== if(wtrbka_record['TRCCO'] in ('3000002','3000003','3000004','3000005')): AfaLoggerFunc.tradeInfo('卡折存现/本转异地') TradeContext.HostCode = '8813' TradeContext.ACUR = '1' TradeContext.RCCSMCD = PL_RCCSMCD_DZBJ TradeContext.SBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银待清算往账' #借方户名 TradeContext.RBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYWZ #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '农信银往账' #贷方户名 TradeContext.OCCAMT = str(wtrbka_record['OCCAMT']) #发生额 TradeContext.PKFG = 'W' TradeContext.CTFG = '7' #=====卡折取现/异地转本地==== elif(wtrbka_record['TRCCO'] in ('3000102','3000103','3000104','3000105')): AfaLoggerFunc.tradeInfo('卡折取现/异地转本地') if(wtrbka_record['CHRGTYP'] == '1'): #转收 AfaLoggerFunc.tradeInfo("<<<<<转收手续费") TradeContext.HostCode = '8813' TradeContext.ACUR = '1' TradeContext.RCCSMCD = PL_RCCSMCD_DZBJ TradeContext.SBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银往账' TradeContext.RBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSWZ #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '农信银待清算往账' TradeContext.OCCAMT = str(wtrbka_record['OCCAMT'] + wtrbka_record['CUSCHRG']) TradeContext.PKFG = 'W' TradeContext.CTFG = '9' else: #现收 AfaLoggerFunc.tradeInfo("<<<<<现收手续费,或不收") TradeContext.HostCode = '8813' TradeContext.ACUR = '1' TradeContext.RCCSMCD = PL_RCCSMCD_DZBJ TradeContext.SBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银往账' TradeContext.RBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSWZ #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '农信银待清算往账' TradeContext.OCCAMT = str(wtrbka_record['OCCAMT']) TradeContext.PKFG = 'W' TradeContext.CTFG = '9' else: return AfaFlowControl.ExitThisFlow('A099','原交易交易代码非法') #=====增加原交易的状态--结转==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_TRAS,PL_BDWFLG_WAIT): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','增加原交易的状态--结转,失败') else: AfaDBFunc.CommitSql() #=====调用主机交易==== rccpsHostFunc.CommHost( TradeContext.HostCode ) #=====判断主机交易是否成功==== if(TradeContext.errorCode != '0000'): AfaLoggerFunc.tradeInfo("主机交易失败") #=====更改原交易状态==== state_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCSTAT':PL_BCSTAT_TRAS,'BDWFLG':PL_BDWFLG_FAIL} state_dict['STRINFO'] = TradeContext.errorMsg if not rccpsState.setTransState(state_dict): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败') else: AfaDBFunc.CommitSql() return AfaFlowControl.ExitThisFlow('A099','主机记账失败') else: AfaLoggerFunc.tradeInfo('主机记账成功') #=====更改原交易状态==== state_dict = {} state_dict['BJEDTE'] = TradeContext.BJEDTE state_dict['BSPSQN'] = TradeContext.BSPSQN state_dict['BCSTAT'] = PL_BCSTAT_TRAS state_dict['BDWFLG'] = PL_BDWFLG_SUCC if(TradeContext.existVariable("SBAC")): state_dict['SBAC'] = TradeContext.SBAC if(TradeContext.existVariable("RBAC")): state_dict['RBAC'] = TradeContext.RBAC state_dict['STRINFO'] = '主机成功' if(TradeContext.existVariable('TRDT')): state_dict['TRDT'] = TradeContext.TRDT if(TradeContext.existVariable('TLSQ')): state_dict['TLSQ'] = TradeContext.TLSQ if not rccpsState.setTransState(state_dict): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败') else: AfaDBFunc.CommitSql() else: return AfaFlowControl.ExitThisFlow('A009','原交易不能进行清算调整') else: AfaLoggerFunc.tradeInfo('<<<<<<业务为来账') autopay = 0 auto = 0 hcac = 0 canc = 0 cancel = 0 #=====查询是否有记账成功的状态==== sstlog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_AUTO,PL_BDWFLG_SUCC,sstlog_list): auto = len(sstlog_list) sstlog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_AUTOPAY,PL_BDWFLG_SUCC,sstlog_list): autopay = len(sstlog_list) #=====查询是否有抹账的状态==== sstlog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_SUCC,sstlog_list): hcac = len(sstlog_list) #=====查询是否有冲销的状态==== sstlog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANC,PL_BDWFLG_SUCC,sstlog_list): canc = len(sstlog_list) #=====查询是否有冲正的状态==== ssltog_list = [] if rccpsState.getTransStateSetm(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CANCEL,PL_BDWFLG_SUCC,sstlog_list): cancel = len(sstlog_list) #=====判断原业务是否需要进行清算状态调整==== AfaLoggerFunc.tradeInfo("判断原业务是否需要进行清算状态调整") if((auto + autopay) - (hcac + canc + cancel) >= 0): AfaLoggerFunc.tradeInfo("原业务需要进行清算状态调整") TradeContext.BETELR = PL_BETELR_AUTO TradeContext.BRSFLG = wtrbka_record['BRSFLG'] TradeContext.CHRGTYP = wtrbka_record['CHRGTYP'] TradeContext.BESBNO = wtrbka_record['BESBNO'] #=====卡折存现/本转异地==== if(wtrbka_record['TRCCO'] in ('3000002','3000003','3000004','3000005')): AfaLoggerFunc.tradeInfo('卡折存现/本转异地') TradeContext.HostCode = '8813' TradeContext.ACUR = '1' TradeContext.RCCSMCD = PL_RCCSMCD_DZBJ TradeContext.SBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYLZ TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银来账' TradeContext.RBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSLZ TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '农信银待清算来账' TradeContext.OCCAMT = str(wtrbka_record['OCCAMT']) TradeContext.PKFG = 'W' TradeContext.CTFG = '7' #=====卡折取现/异地转本地==== elif(wtrbka_record['TRCCO'] in ('3000102','3000103','3000104','3000105')): AfaLoggerFunc.tradeInfo('卡折存现/本转异地') TradeContext.HostCode = '8813' TradeContext.ACUR = '1' TradeContext.RCCSMCD = PL_RCCSMCD_DZBJ TradeContext.SBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYDQSLZ TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银待清算来账' TradeContext.RBAC = wtrbka_record['BESBNO'] + PL_ACC_NXYLZ TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '农信银来账' TradeContext.OCCAMT = str(wtrbka_record['OCCAMT'] + wtrbka_record['CUSCHRG']) TradeContext.PKFG = 'W' TradeContext.CTFG = '9' else: return AfaFlowControl.ExitThisFlow('A099','原交易交易代码非法') #=====增加原交易的状态--结转==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_TRAS,PL_BDWFLG_WAIT): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','增加原交易的状态--结转,失败') else: AfaDBFunc.CommitSql() #=====调用主机交易==== rccpsHostFunc.CommHost( TradeContext.HostCode ) #=====判断主机交易是否成功==== if(TradeContext.errorCode != '0000'): AfaLoggerFunc.tradeInfo("主机交易失败") #=====更改原交易状态==== state_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN,'BCSTAT':PL_BCSTAT_TRAS,'BDWFLG':PL_BDWFLG_FAIL} state_dict['STRINFO'] = TradeContext.errorMsg if not rccpsState.setTransState(state_dict): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败') else: AfaDBFunc.CommitSql() return AfaFlowControl.ExitThisFlow('A099','主机记账失败') else: AfaLoggerFunc.tradeInfo('主机记账成功') #=====更改原交易状态==== state_dict = {} state_dict['BJEDTE'] = TradeContext.BJEDTE state_dict['BSPSQN'] = TradeContext.BSPSQN state_dict['BCSTAT'] = PL_BCSTAT_TRAS state_dict['BDWFLG'] = PL_BDWFLG_SUCC state_dict['STRINFO'] = '主机成功' if(TradeContext.existVariable("SBAC")): state_dict['SBAC'] = TradeContext.SBAC if(TradeContext.existVariable("RBAC")): state_dict['RBAC'] = TradeContext.RBAC if(TradeContext.existVariable('TRDT')): state_dict['TRDT'] = TradeContext.TRDT if(TradeContext.existVariable('TLSQ')): state_dict['TLSQ'] = TradeContext.TLSQ if not rccpsState.setTransState(state_dict): AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('A099','更改原交易状态失败') else: AfaDBFunc.CommitSql() else: return AfaFlowControl.ExitThisFlow('A009','原交易不能进行清算调整') #=====给修改字典赋值==== update_dict = {} update_dict = {'ISDEAL':'1','NOTE3':'此笔错账已结转'} where_dict = {} where_dict = {'SNDBNKCO':TradeContext.SNDBNKCO,'TRCDAT':TradeContext.TRCDAT,'TRCNO':TradeContext.TRCNO,\ 'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} #=====修改数据库中的数据==== AfaLoggerFunc.tradeInfo("通存通兑错帐处理标识修改") res = rccpsDBTrcc_tddzcz.updateCmt(update_dict,where_dict) if( res == -1 ): return AfaFlowControl.ExitThisFlow('A099','修改通存通兑错帐处理标识失败') elif( res == 0 ): return AfaFlowControl.ExitThisFlow('A099','交易记录不存在') #=====向下发的通知表中插入数据==== AfaLoggerFunc.tradeInfo("<<<<<<向通知表中插入数据") insert_dict = {} insert_dict['NOTDAT'] = AfaUtilTools.GetHostDate( ) insert_dict['BESBNO'] = wtrbka_record['BESBNO'] if(wtrbka_record['BRSFLG'] == PL_BRSFLG_RCV): insert_dict['STRINFO'] = "此笔错账["+wtrbka_record['BSPSQN']+"]["+wtrbka_record['BJEDTE']+"]已做手工结转处理" else: insert_dict['STRINFO'] = "此笔错账["+wtrbka_record['BSPSQN']+"]["+wtrbka_record['BJEDTE']+"]已做手工结转处理 请用8522补打往账凭证" if not rccpsDBTrcc_notbka.insertCmt(insert_dict): return AfaFlowControl.ExitThisFlow('S999','向下发的通知表中插入数据失败') AfaLoggerFunc.tradeInfo("<<<<<<向通知表中插入数据成功") #=====给输出接口赋值==== TradeContext.errorCode = "0000" TradeContext.errorMsg = "修改通存通兑错帐处理标识成功" TradeContext.ISDEAL = '1' # TradeContext.TLSQ = TradeContext.TLSQ # TradeContext.RBSQ = TradeContext.RBSQ # TradeContext.TRDT = TradeContext.TRDT AfaLoggerFunc.tradeInfo( '***农信银系统: 往账.本地类操作交易[RCC001_8591]通存通兑错帐处理标识维护退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( ">>>开始汇兑来账接收处理" ) #=====判断是否重复交易==== sel_dict = {'TRCNO':TradeContext.TRCNO,'TRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_trcbka.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' #====开始向字典赋值==== trcbka_dict = {} if not rccpsMap1101CTradeContext2Dtrcbka_dict.map(trcbka_dict): return AfaFlowControl.ExitThisFlow('M999', '字典赋值出错') trcbka_dict['DCFLG'] = PL_DCFLG_CRE #借贷标识.贷 trcbka_dict['OPRNO'] = '00' #业务属性 #=====开始插入数据库==== if not rccpsDBFunc.insTransTrc(trcbka_dict): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('D002', '插入数据库出错,RollBack成功') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('插入汇兑业务登记簿,COMMIT成功') #=====设置状态为收妥==== 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成功') ##========================= START 张恒 增加于20091011 来帐落机构及入帐挂账处理 =====================## #初始化记挂账标识,记账.0,挂账.1,默认记账 accflag = 0 #接收机构暂存 TradeContext.BESBNOFIRST = TradeContext.BESBNO if accflag == 0: AfaLoggerFunc.tradeInfo(">>>开始校验密押") #=====开始调用密押服务器进行核押==== SNDBANKCO = TradeContext.SNDBNKCO RCVBANKCO = TradeContext.RCVBNKCO SNDBANKCO = SNDBANKCO.rjust(12,'0') RCVBANKCO = RCVBANKCO.rjust(12,'0') AMOUNT = TradeContext.OCCAMT.split('.')[0] + TradeContext.OCCAMT.split('.')[1] AMOUNT = AMOUNT.rjust(15,'0') INFO = ' ' INFO = INFO.rjust(60,' ') AfaLoggerFunc.tradeDebug('处理类型(0-编押 1-核押):' + str(PL_SEAL_DEC) ) AfaLoggerFunc.tradeDebug('业务种类(1-现金汇票 2-转账汇票 3-电子汇兑业务):' +str(PL_TYPE_DZHD) ) AfaLoggerFunc.tradeDebug('委托日期:' + TradeContext.TRCDAT ) AfaLoggerFunc.tradeDebug('交易流水号:' + TradeContext.TRCNO ) AfaLoggerFunc.tradeDebug('AMOUNT=' + str(AMOUNT) ) AfaLoggerFunc.tradeDebug('SNDBANKCO=' + str(SNDBANKCO) ) AfaLoggerFunc.tradeDebug('RCVBANKCO=' + str(RCVBANKCO) ) AfaLoggerFunc.tradeDebug('密押:' + TradeContext.SEAL ) AfaLoggerFunc.tradeDebug('OTHERINFO[' + str(INFO) + ']') ret = miya.DraftEncrypt(PL_SEAL_DEC,PL_TYPE_DZHD,TradeContext.TRCDAT,TradeContext.TRCNO,AMOUNT,SNDBANKCO,RCVBANKCO,'',TradeContext.SEAL) if ret != 0: #密押错,挂账 AfaLoggerFunc.tradeInfo("密押校验未通过,ret=[" + str(ret) + "]") accflag = 1 TradeContext.NOTE3 = "密押错,挂账!" else: #密押校验通过 AfaLoggerFunc.tradeInfo("密押校验通过") AfaLoggerFunc.tradeInfo(">>>结束校验密押") #校验账号是否非法 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号是否非法") if (len(TradeContext.PYEACC) != 23) and (len(TradeContext.PYEACC) != 19) : accflag = 1 TradeContext.NOTE3 = '此账号不是对公或对私账号,挂账!' AfaLoggerFunc.tradeInfo("结束校验账号是否非法") #调用主机接口查询账户信息 if accflag == 0: #调用8810查询账户信息 AfaLoggerFunc.tradeInfo("开始查询账户信息") TradeContext.ACCNO = TradeContext.PYEACC TradeContext.HostCode = '8810' rccpsHostFunc.CommHost( '8810' ) if TradeContext.errorCode != '0000': accflag = 1 TradeContext.NOTE3 = '查询收款人信息失败,挂账!' elif TradeContext.errorCode == '0000' and len(TradeContext.ACCSO) == 0 : accflag = 1 TradeContext.NOTE3 = '查询收款人开户机构失败,挂账!' AfaLoggerFunc.tradeInfo("结束查询账户信息") #校验账户状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验是否跨法人") if TradeContext.ACCSO[0:6] != TradeContext.BESBNO[0:6] : accflag = 1 TradeContext.NOTE3 = '接收行与账户开户行跨法人,挂账!' AfaLoggerFunc.tradeInfo("结束校验是否跨法人") #校验开户机构是否建立代理关系 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验接收行与开户机构是否为同一机构") if TradeContext.ACCSO != TradeContext.BESBNOFIRST: khjg = {} khjg['BESBNO'] = TradeContext.ACCSO khjg['BTOPSB'] = TradeContext.BESBNOFIRST khjg['SUBFLG'] = PL_SUBFLG_SUB rec = rccpsDBTrcc_subbra.selectu(khjg) if rec == None: accflag = 1 TradeContext.NOTE3 = '查询账户代理关系失败,挂账!' elif len(rec) <= 0: accflag = 1 TradeContext.NOTE3 = '账户未建立代理关系,挂账!' else: #接收机构与开户机构存在代理关系,设置机构号为开户机构号 TradeContext.BESBNO = TradeContext.ACCSO AfaLoggerFunc.tradeInfo("结束校验接收行与开户机构是否为同一机构") #校验账号状态是否正常 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验账号状态是否正常") if TradeContext.ACCST != '0' and TradeContext.ACCST != '2': accflag = 1 TradeContext.NOTE3 = '账户状态不正常,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验账号状态是否正常") #校验收款人户名是否一致 if accflag == 0: AfaLoggerFunc.tradeInfo("开始校验收款人户名是否一致") if TradeContext.ACCNM != TradeContext.PYENAM : accflag = 1 TradeContext.NOTE3 = '收款人户名不符,挂账!' #在建立代理关系的情况下,账户状态不正常,同样挂账 TradeContext.BESBNO = TradeContext.BESBNOFIRST AfaLoggerFunc.tradeInfo("结束校验收款人户名是否一致") if (TradeContext.existVariable( "PYEACC" ) and len(TradeContext.PYEACC) != 0): #收款人名称 TradeContext.PYEACCNO = TradeContext.PYEACC else: TradeContext.PYEACCNO = '' if (TradeContext.existVariable( "PYENAM" ) and len(TradeContext.PYENAM) != 0): #收款人名称 TradeContext.OTNM = TradeContext.PYENAM else: TradeContext.OTNM = '' #汇兑往帐记帐字典赋值 TradeContext.SBACACNM = '' #借方户名 input_dict = {} if (TradeContext.existVariable( "PYRNAM" ) and len(TradeContext.PYRNAM) != 0): #付款人户名 TradeContext.SBACACNM = TradeContext.PYRNAM input_dict['accflag'] = str(accflag) #记挂标志 input_dict['OCCAMT'] = TradeContext.OCCAMT #交易金额 input_dict['PYEACC'] = TradeContext.PYEACCNO #收款人账号 input_dict['OTNM'] = TradeContext.OTNM #收款人名称 input_dict['BESBNO'] = TradeContext.BESBNO #调用汇兑记账接口 rccpsEntries.HDLZJZ(input_dict) TradeContext.accflag = accflag #代理标志 #=====新增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() return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作).异转本_卡应答[TRCC004_1158]进入***' ) #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=====根据参考报文标识号查找原交易==== TradeContext.ORSNDBNKCO = TradeContext.ORMFN[:10] #原发送行号 TradeContext.BOJEDT = TradeContext.ORMFN[10:18] #原交易日期 TradeContext.ORTRCNO = TradeContext.ORMFN[18:] #原交易流水号 wtr_dict = {} if not rccpsDBFunc.getTransWtrAK(TradeContext.ORSNDBNKCO,TradeContext.BOJEDT,TradeContext.ORTRCNO,wtr_dict): #=====查询原交易失败,等待前台超时发起冲正,抛弃此报文==== return AfaFlowControl.ExitThisFlow('S999','等待前台发起冲正,抛弃报文') AfaLoggerFunc.tradeInfo( '>>>查询原交易结束' ) #=================若应答报文回复拒绝,则设置状态为拒绝,停止处理============= if TradeContext.PRCCO != 'RCCI0000': AfaLoggerFunc.tradeInfo(">>>对方返回拒绝应答") #=============设置业务状态为拒绝处理中================================= if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_MFERFE,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为拒绝成功异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=============设置业务状态为拒绝成功=================================== stat_dict = {} stat_dict['BJEDTE'] = wtr_dict['BJEDTE'] stat_dict['BSPSQN'] = wtr_dict['BSPSQN'] stat_dict['BCSTAT'] = PL_BCSTAT_MFERFE stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['PRCCO'] = TradeContext.PRCCO stat_dict['STRINFO'] = TradeContext.STRINFO if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为拒绝成功异常") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") return AfaFlowControl.ExitThisFlow('S999',"对方拒绝,交易终止") #====查找自动冲正登记簿是否存在本交易的冲正==== #====查找自动冲正登记簿是否存在本交易的冲正==== wheresql = '' wheresql = wheresql + "BOJEDT = '" + wtr_dict['BJEDTE'] + "'" #报单日期 wheresql = wheresql + "AND BOSPSQ = '" + wtr_dict['BSPSQN'] + "'" #报单序号 ret = rccpsDBTrcc_atcbka.count(wheresql) if ret == -1: return AfaFlowControl.ExitThisFlow('S999','查找自动冲正登记簿异常') elif ret > 0: #=====原交易已自动冲正,抛弃报文==== return AfaFlowControl.ExitThisFlow('S999','原交易已冲正,抛弃报文') AfaLoggerFunc.tradeInfo( '>>>查询冲正登记簿结束' ) #=====主机记账前处理==== TradeContext.BESBNO = wtr_dict['BESBNO'] #机构号 TradeContext.BETELR = wtr_dict['BETELR'] #柜员号 TradeContext.BEAUUS = wtr_dict['BEAUUS'] #授权柜员 TradeContext.BEAUPS = wtr_dict['BEAUPS'] #授权密码 TradeContext.TERMID = wtr_dict['TERMID'] #终端号 TradeContext.BJEDTE = wtr_dict['BJEDTE'] #交易日期 TradeContext.BSPSQN = wtr_dict['BSPSQN'] #报单序号 TradeContext.BRSFLG = wtr_dict['BRSFLG'] #往来账标志 TradeContext.HostCode= '8813' #主机交易码 AfaLoggerFunc.tradeInfo( '>>>主机前处理赋值结束' ) #=====开始更新原交易,新增状态记账-处理中==== if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_ACC,PL_BDWFLG_WAIT): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo( '>>>设置状态记账-处理中结束' ) #=====根据原记录中的手续费收取方式,判断账务处理模式==== if wtr_dict['CHRGTYP'] == '1': #=====转账==== TradeContext.ACUR = '3' #记账次数 #=========交易金额+手续费=================== TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 PL_RCCSMCD_YZBWZ 异转本 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银往账' #借方户名 TradeContext.RBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #贷方账号 TradeContext.RBAC = rccpsHostFunc.CrtAcc(TradeContext.RBAC,25) TradeContext.OTNM = '应解汇款' #贷方户名 TradeContext.OCCAMT = str(wtr_dict['OCCAMT'] + wtr_dict['CUSCHRG']) #发生额 TradeContext.PKFG = 'T' TradeContext.CTFG = '9' TradeContext.WARNTNO = '' TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:借方账号' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额+手续费:贷方账号' + TradeContext.RBAC ) #=========交易金额============ TradeContext.I2SMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.I2SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I2SBAC = rccpsHostFunc.CrtAcc(TradeContext.I2SBAC,25) TradeContext.I2ACNM = '应解汇款' #借方户名 TradeContext.I2RBAC = TradeContext.PYEACC #贷方账号 TradeContext.I2OTNM = TradeContext.PYENAM #贷方户名 TradeContext.I2TRAM = str(wtr_dict['OCCAMT']) #发生额 TradeContext.I2CTFG = '7' TradeContext.I2PKFG = 'T' #TradeContext.I2WARNTNO = '' #TradeContext.I2CERTTYPE = '' #TradeContext.I2CERTNO = '' AfaLoggerFunc.tradeInfo( '>>>交易金额:借方账号' + TradeContext.I2SBAC ) AfaLoggerFunc.tradeInfo( '>>>交易金额:贷方账号' + TradeContext.I2RBAC ) #=========结算手续费收入户=========== TradeContext.I3SMCD = PL_RCCSMCD_SXF #摘要代码 TradeContext.I3SBAC = TradeContext.BESBNO + PL_ACC_NXYDJLS #借方账号 TradeContext.I3SBAC = rccpsHostFunc.CrtAcc(TradeContext.I3SBAC,25) TradeContext.I3ACNM = '应解汇款' #借方户名 TradeContext.I3RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号 TradeContext.I3RBAC = rccpsHostFunc.CrtAcc(TradeContext.I3RBAC,25) TradeContext.I3OTNM = '结算手续费' #贷方户名 TradeContext.I3TRAM = str(wtr_dict['CUSCHRG']) #发生额 TradeContext.I3CTFG = '8' TradeContext.I3PKFG = 'T' AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:借方账号' + TradeContext.I3SBAC ) AfaLoggerFunc.tradeInfo( '>>>结算手续费收入户:贷方账号' + TradeContext.I3RBAC ) elif wtr_dict['CHRGTYP'] == '0': #=====本金==== TradeContext.ACUR = '2' #记账次数 TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.ACNM = '农信银往账' #借方户名 TradeContext.RBAC = TradeContext.PYEACC #贷方账号 TradeContext.OTNM = TradeContext.PYENAM #贷方户名 TradeContext.OCCAMT = str(wtr_dict['OCCAMT']) #金额 TradeContext.CTFG = '7' TradeContext.PKFG = 'T' TradeContext.WARNTNO = '' TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' #=====手续费记账赋值==== TradeContext.I2SMCD = PL_RCCSMCD_SXF #摘要代码 TradeContext.I2SBAC = '' #借方账号 TradeContext.I2RBAC = TradeContext.BESBNO + PL_ACC_TCTDSXF #贷方账号 TradeContext.I2RBAC = rccpsHostFunc.CrtAcc(TradeContext.I2RBAC,25) TradeContext.I2OTNM = '手续费科目' #贷方户名 TradeContext.I2TRAM = str(wtr_dict['CUSCHRG']) #金额 TradeContext.I2CTFG = '8' TradeContext.I2PKFG = 'T' TradeContext.I2CATR = '0' #现转标志 elif wtr_dict['CHRGTYP'] == '2': #=====不收费==== TradeContext.ACUR = '1' #记账次数 TradeContext.RCCSMCD = PL_RCCSMCD_YZBWZ #摘要代码 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSWZ #借方账号 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC,25) TradeContext.RBAC = TradeContext.PYEACC #贷方账号 TradeContext.OTNM = TradeContext.PYENAM #贷方户名 TradeContext.OCCAMT = str(wtr_dict['OCCAMT']) #金额 TradeContext.CTFG = '7' TradeContext.PKFG = 'T' TradeContext.WARNTNO = '' TradeContext.CERTTYPE = '' TradeContext.CERTNO = '' else: #=====出错==== return AfaFlowControl.ExitThisFlow('S999','手续费收费方式错,抛弃报文') AfaLoggerFunc.tradeInfo( '>>>根据手续费收取方式记账赋值处理结束' ) #=====主机记账处理==== rccpsHostFunc.CommHost(TradeContext.HostCode) #=====主机后处理==== set_dict = {} set_dict['BSPSQN'] = TradeContext.BSPSQN set_dict['BJEDTE'] = TradeContext.BJEDTE set_dict['BCSTAT'] = PL_BCSTAT_ACC set_dict["SBAC"] = TradeContext.SBAC #借方账号 set_dict["RBAC"] = TradeContext.RBAC #贷方账号 set_dict["OTNM"] = TradeContext.OTNM #贷方户名 set_dict['MGID'] = TradeContext.errorCode #主机返回码 set_dict["STRINFO"]= TradeContext.errorMsg #主机返回信息 if TradeContext.errorCode == '0000': #=====主机记账成功==== set_dict['BDWFLG'] = PL_BDWFLG_SUCC set_dict['TRDT'] = TradeContext.TRDT set_dict['TLSQ'] = TradeContext.TLSQ else: set_dict['BDWFLG'] = PL_BDWFLG_FAIL if not rccpsState.setTransState(set_dict): return AfaFlowControl.ExitThisFlow(TradeContext.errorCode, TradeContext.errorMsg) else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo('>>>设置主机返回状态成功') if TradeContext.errorCode == '0000': #=====开始更新原交易,新增状态清算成功==== if not rccpsState.newTransState(wtr_dict['BJEDTE'],wtr_dict['BSPSQN'],PL_BCSTAT_MFESTL,PL_BDWFLG_SUCC): #=====RollBack操作==== AfaDBFunc.RollbackSql() return AfaFlowControl.ExitThisFlow('M999', '设置状态失败,系统自动回滚') else: #=====commit操作==== AfaDBFunc.CommitSql() AfaLoggerFunc.tradeInfo( '***农信银系统:往账.本地类操作(1.本地操作).异转本_卡应答[TRCC004_1158]退出***' ) return True
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