def CommHost( result = '8844' ): AfaLoggerFunc.tradeInfo('>>>主机通讯函数[CommHost]') #根据正反交易标志TradeContext.revTranF判断具体选择哪个map文件和主机接口方式 if (result == '8844'): AfaLoggerFunc.tradeInfo('>>>核心记帐') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8844.map' TradeContext.HostCode = '8844' else: TradeContext.errorCode = 'A9999' TradeContext.errorMsg = '主机代码错误' return False AfaLoggerFunc.tradeInfo( '=======================7' ) #此处交易代码要求10位,右补空格 HostComm.callHostTrade( mapfile, UtilTools.Rfill(TradeContext.HostCode,10,' ') ,'0002' ) AfaLoggerFunc.tradeInfo( '=======================8' ) if HostContext.host_Error: AfaLoggerFunc.tradeFatal( 'host_Error:'+str( HostContext.host_ErrorType )+':'+HostContext.host_ErrorMsg ) if HostContext.host_ErrorType != 5 : TradeContext.__status__='1' TradeContext.errorCode='A0101' TradeContext.errorMsg=HostContext.host_ErrorMsg else : TradeContext.__status__='2' TradeContext.errorCode='A0102' TradeContext.errorMsg=HostContext.host_ErrorMsg return False AfaLoggerFunc.tradeInfo( '=======================9' ) #================分析主机返回包==================== return HostParseRet(result )
def CommHost( result = '8830' ): AfaLoggerFunc.tradeInfo('>>>主机通讯函数[CommHost]') if(not InitHostReq()): return False #根据正反交易标志TradeContext.revTranF判断具体选择哪个map文件和主机接口方式 if (result == '8830'): AfaLoggerFunc.tradeInfo('>>>批量上传') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8830.map' TradeContext.HostCode = '8830' elif(result == '8831'): AfaLoggerFunc.tradeInfo('>>>批量记账申请') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8831.map' TradeContext.HostCode = '8831' elif(result == '8833'): AfaLoggerFunc.tradeInfo('>>>批量回盘文件生成申请') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8833.map' TradeContext.HostCode = '8833' elif(result == '8834'): AfaLoggerFunc.tradeInfo('>>>查询批量记账结果') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8834.map' TradeContext.HostCode = '8834' elif(result == '8810'): AfaLoggerFunc.tradeInfo('>>>查询单个账户信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8810.map' TradeContext.HostCode = '8810' elif(result == '8835'): AfaLoggerFunc.tradeInfo('>>>凭证消号') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8835.map' TradeContext.HostCode = '8835' else: TradeContext.errorCode = 'A9999' TradeContext.errorMsg = '主机代码错误' return False #此处交易代码要求10位,右补空格 HostComm.callHostTrade( mapfile, UtilTools.Rfill(TradeContext.HostCode,10,' ') ,'0002' ) if HostContext.host_Error: AfaLoggerFunc.tradeFatal( 'host_Error:'+str( HostContext.host_ErrorType )+':'+HostContext.host_ErrorMsg ) if HostContext.host_ErrorType != 5 : TradeContext.__status__='1' TradeContext.errorCode='A0101' TradeContext.errorMsg=HostContext.host_ErrorMsg else : TradeContext.__status__='2' TradeContext.errorCode='A0102' TradeContext.errorMsg=HostContext.host_ErrorMsg return False #================分析主机返回包==================== return HostParseRet(result )
def ZJJY(record): #=====调用主机8810交易==== tradeLogger.info("调用主机8810交易") HostContext.I1TRCD = '8810' HostContext.I1ACNO = record[1] HostContext.I1SBNO = record[0][0:10] HostContext.I1USID = "999986" HostContext.I1WSNO = "10.12.5.187" # HostContext.I1CFFG = "1" HostComm.callHostTrade( os.environ['AFAP_HOME'] + '/conf/hostconf/AH8810.map', \ UtilTools.Rfill('8810',10,' ') ,'0002' ) if HostContext.host_Error: tradeLogger.info( 'host_Error:'+str( HostContext.host_ErrorType )+':'+HostContext.host_ErrorMsg ) if HostContext.host_ErrorType != 5 : TradeContext.__status__='1' TradeContext.errorCode='A0101' TradeContext.errorMsg=HostContext.host_ErrorMsg else : TradeContext.__status__='2' TradeContext.errorCode='A0102' TradeContext.errorMsg=HostContext.host_ErrorMsg return False #=====分析主机返回文件==== if (HostContext.host_Error == True): #主机通讯错误 tradeLogger.info("主机通讯错") return False if( HostContext.O1MGID != 'AAAAAAA' ): #失败 tradeLogger.info('I1ACNO>>>>' + record[1]) tradeLogger.info('I1SBNO>>>>' + record[0][0:10]) tradeLogger.info(HostContext.O1MGID+" "+HostContext.O1INFO) return False else: #成功 TradeContext.__status__='0' tradeLogger.info("主机成功") return True
def CommHost( result = '' ): AfaLoggerFunc.tradeInfo('>>>主机通讯函数[CommHost]') #根据正反交易标志TradeContext.BRSFLG判断具体选择哪个map文件和主机接口方式 #===================初始化======================= if not InitHostReq(result) : TradeContext.__status__='1' return False if (result == '8813'): AfaLoggerFunc.tradeInfo('>>>单笔记帐') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8813.map' elif (result == '8820' ): AfaLoggerFunc.tradeInfo('>>>单笔抹帐') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8820.map' TradeContext.HostCode = '8820' elif (result == '8810'): AfaLoggerFunc.tradeInfo('>>>查询帐户信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8810.map' TradeContext.HostCode = '8810' #关彬捷 20081105 将8810主机输入接口初始化程序从InitGLHostReq函数移动至InitHostReq函数中 #InitGLHostReq() elif (result == '8811'): AfaLoggerFunc.tradeInfo('>>>查询凭证信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8811.map' TradeContext.HostCode = '8811' InitGLHostReq() elif (result == '8812'): AfaLoggerFunc.tradeInfo('>>>外联关联帐户登记交易') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8812.map' TradeContext.HostCode = '8812' InitGLHostReq() elif (result == '8814'): AfaLoggerFunc.tradeInfo('>>>批量申请') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8814.map' TradeContext.HostCode = '8814' InitGLHostReq() elif (result == '8815'): AfaLoggerFunc.tradeInfo('>>>批量查询') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8815.map' TradeContext.HostCode = '8815' InitGLHostReq() #=====刘雨龙 20081129 新增查询主机账务信息==== elif (result == '8816'): AfaLoggerFunc.tradeInfo('>>>查询主机账务信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8816.map' TradeContext.HostCode = '8816' InitGLHostReq() #=====刘雨龙 20081129 新增查询主机账务信息==== elif (result == '8825'): AfaLoggerFunc.tradeInfo('>>>查询主机账务信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8825.map' TradeContext.HostCode = '8825' InitGLHostReq() elif (result == '8818'): AfaLoggerFunc.tradeInfo('>>>对帐明细申请') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8818.map' TradeContext.HostCode = '8818' InitGLHostReq() elif (result == '8819'): AfaLoggerFunc.tradeInfo('>>>检查文件是否生成') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8819.map' TradeContext.HostCode = '8819' InitGLHostReq() elif (result == '8847'): AfaLoggerFunc.tradeInfo('>>>对公帐号流水明细查询') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8847.map' TradeContext.HostCode = '8847' InitGLHostReq() elif (result == '8826'): AfaLoggerFunc.tradeInfo('>>>对账请求') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8826.map' TradeContext.HostCode = '8826' InitGLHostReq() #关彬捷 20081215 新增0652校验磁道信息接口 elif (result == '0652' ): AfaLoggerFunc.tradeInfo('>>>校验磁道信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH0652.map' TradeContext.HostCode = '0652' #=====刘雨龙 20081128 新增8823关于农信银手续费接口==== elif (result == '8823'): AfaLoggerFunc.tradeInfo('>>>手续费清单文件上传') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8823.map' TradeContext.HostCode = '8823' InitGLHostReq() #曾照泰20110520 新增0061 错帐控制解控交易 elif (result == '0061'): AfaLoggerFunc.tradeInfo('>>>错帐控制解控') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH0061.map' TradeContext.HostCode = '0061' InitGLHostReq() else: TradeContext.errorCode = 'A9999' TradeContext.errorMsg = '主机代码错误' return False #此处交易代码要求10位,右补空格 HostComm.callHostTrade( mapfile, UtilTools.Rfill(TradeContext.HostCode,10,' ') ,'0002' ) AfaLoggerFunc.tradeInfo( 'host_Error:'+str( HostContext.host_ErrorType )+':'+HostContext.host_ErrorMsg ) if HostContext.host_Error: AfaLoggerFunc.tradeFatal( 'host_Error:'+str( HostContext.host_ErrorType )+':'+HostContext.host_ErrorMsg ) AfaLoggerFunc.tradeInfo('5') if HostContext.host_ErrorType != 5 : TradeContext.__status__='1' TradeContext.errorCode='A0101' TradeContext.errorMsg=HostContext.host_ErrorMsg else : TradeContext.__status__='2' TradeContext.errorCode='A0102' TradeContext.errorMsg=HostContext.host_ErrorMsg return False #================分析主机返回包==================== return HostParseRet(result )
def CommHost( result = None ): AfaLoggerFunc.tradeInfo('>>>主机通讯函数[CommHost]') TradeContext.errorCode = 'H999' TradeContext.errorMsg = '系统异常(与主机通讯)' if (result == '8813'): AfaLoggerFunc.tradeInfo('>>>单笔记帐') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8813.map' TradeContext.HostCode = '8813' InitGLHostReq() elif (result == '8860'): AfaLoggerFunc.tradeInfo('>>>查询帐户信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8860.map' TradeContext.HostCode = '8860' InitGLHostReq() elif (result == '8800'): AfaLoggerFunc.tradeInfo('>>>短信平台查询') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8800.map' TradeContext.HostCode = '8800' InitGLHostReq() elif (result == '8861'): AfaLoggerFunc.tradeInfo('>>>校验密码') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8861.map' TradeContext.HostCode = '8861' InitGLHostReq() elif (result == '8862'): AfaLoggerFunc.tradeInfo('>>>密码修改或重置') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8862.map' TradeContext.HostCode = '8862' InitGLHostReq() elif (result == '8863'): AfaLoggerFunc.tradeInfo('>>>重要凭证挂失') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8863.map' TradeContext.HostCode = '8863' InitGLHostReq() elif (result == '8864'): AfaLoggerFunc.tradeInfo('>>>查询账户明细') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8864.map' TradeContext.HostCode = '8864' InitGLHostReq() elif(result == '8865'): AfaLoggerFunc.tradeInfo('>>>查询客户信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8865.map' TradeContext.HostCode = '8865' InitGLHostReq() elif(result == '8866'): AfaLoggerFunc.tradeInfo('>>>证件号查询账户明细') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8866.map' TradeContext.HostCode = '8866' InitGLHostReq() else: TradeContext.errorCode = 'A9999' TradeContext.errorMsg = '主机代码错误' return False #此处交易代码要求10位,右补空格 HostComm.callHostTrade( mapfile, UtilTools.Rfill(TradeContext.HostCode,10,' ') ,'0002' ) if HostContext.host_Error: AfaLoggerFunc.tradeFatal( 'host_Error:'+str( HostContext.host_ErrorType )+':'+HostContext.host_ErrorMsg ) if HostContext.host_ErrorType != 5 : TradeContext.__status__='1' TradeContext.errorCode='A0101' TradeContext.errorMsg=HostContext.host_ErrorMsg else : TradeContext.__status__='2' TradeContext.errorCode='A0102' TradeContext.errorMsg=HostContext.host_ErrorMsg return False #================分析主机返回包==================== return HostParseRet(result )
def CommHost( result = None ): AfaLoggerFunc.tradeInfo('>>>主机通讯函数[CommHost]') TradeContext.errorCode = 'H999' TradeContext.errorMsg = '系统异常(与主机通讯)' #根据正反交易标志TradeContext.revTranF判断具体选择哪个map文件和主机接口方式 if not result: result=TradeContext.revTranF #===================初始化======================= if not InitHostReq(result) : TradeContext.__status__='1' return False if (result == '0'): AfaLoggerFunc.tradeInfo('>>>单笔记帐') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8813.map' TradeContext.HostCode = '8813' elif (result == '1' or result == '2' ): AfaLoggerFunc.tradeInfo('>>>单笔抹帐') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8820.map' TradeContext.HostCode = '8820' elif (result == '8808'): AfaLoggerFunc.tradeInfo('>>>查询主机日期') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8808.map' TradeContext.HostCode = '8808' InitGLHostReq() elif (result == '8810'): AfaLoggerFunc.tradeInfo('>>>查询帐户信息') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8810.map' TradeContext.HostCode = '8810' InitGLHostReq() elif (result == '8812'): AfaLoggerFunc.tradeInfo('>>>外联关联帐户登记交易') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8812.map' TradeContext.HostCode = '8812' InitGLHostReq() elif (result == '8814'): AfaLoggerFunc.tradeInfo('>>>批量申请') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8814.map' TradeContext.HostCode = '8814' InitGLHostReq() elif (result == '8815'): AfaLoggerFunc.tradeInfo('>>>批量查询') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8815.map' TradeContext.HostCode = '8815' InitGLHostReq() elif (result == '8818'): AfaLoggerFunc.tradeInfo('>>>对帐明细申请') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8818.map' TradeContext.HostCode = '8818' InitGLHostReq() elif (result == '8819'): AfaLoggerFunc.tradeInfo('>>>检查文件是否生成') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8819.map' TradeContext.HostCode = '8819' InitGLHostReq() elif (result == '8847'): AfaLoggerFunc.tradeInfo('>>>对公帐号流水明细查询') mapfile=os.environ['AFAP_HOME'] + '/conf/hostconf/AH8847.map' TradeContext.HostCode = '8847' InitGLHostReq() else: TradeContext.errorCode = 'A9999' TradeContext.errorMsg = '主机代码错误' return False #此处交易代码要求10位,右补空格 HostComm.callHostTrade( mapfile, UtilTools.Rfill(TradeContext.HostCode,10,' ') ,'0002' ) if HostContext.host_Error: AfaLoggerFunc.tradeFatal( 'host_Error:'+str( HostContext.host_ErrorType )+':'+HostContext.host_ErrorMsg ) if HostContext.host_ErrorType != 5 : TradeContext.__status__='1' TradeContext.errorCode='A0101' TradeContext.errorMsg=HostContext.host_ErrorMsg else : TradeContext.__status__='2' TradeContext.errorCode='A0102' TradeContext.errorMsg=HostContext.host_ErrorMsg return False #================分析主机返回包==================== return HostParseRet(result )