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
tddzmx_insert_dict['PYEACC'] = line_list[25][:32] tddzmx_insert_dict['ORTRCCO'] = line_list[26][:7] tddzmx_insert_dict['ORTRCNO'] = line_list[27][:8] tddzmx_insert_dict['DCFLG'] = line_list[28][:1] tddzmx_insert_dict['CBFLG'] = line_list[29][:1] tddzmx_insert_dict['CONFFLG'] = line_list[30][:1] tddzmx_insert_dict['CANCFLG'] = line_list[31][:1] tddzmx_insert_dict['STRINFO'] = line_list[32][:60] tddzmx_insert_dict['NOTE1'] = NCCWKDAT #将对账日期赋值到对账明细表NOTE1字段 #通存通兑对账文件中存款确认和冲销交易不导入对账明细表中 if tddzmx_insert_dict['TRCCO'] == '3000503' or tddzmx_insert_dict['TRCCO'] == '3000504': continue wtr_dict = {} if not rccpsDBFunc.getTransWtrAK(tddzmx_insert_dict['SNDBNKCO'],tddzmx_insert_dict['TRCDAT'],tddzmx_insert_dict['TRCNO'],wtr_dict): if AfaDBFunc.sqlErrMsg != "": AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg ) rccpsCronFunc.cronExit("S999","查询对账明细行内信息异常") else: tddzmx_insert_dict['BJEDTE'] = "" tddzmx_insert_dict['BSPSQN'] = "" else: tddzmx_insert_dict['BJEDTE'] = wtr_dict['BJEDTE'] tddzmx_insert_dict['BSPSQN'] = wtr_dict['BSPSQN'] ret = rccpsDBTrcc_tddzmx.insert(tddzmx_insert_dict) if ret <= 0: AfaLoggerFunc.tradeInfo( AfaDBFunc.sqlErrMsg )
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.本地操作).折本转异应答报文接收[TRCC006_1155]进入 ") #=================初始化返回信息============================================ if AfaUtilTools.trim(TradeContext.STRINFO) == "": TradeContext.STRINFO = rccpsDBFunc.getErrInfo(TradeContext.PRCCO) AfaLoggerFunc.tradeDebug("TradeContext.STRINFO=" + TradeContext.STRINFO) #=================必要性检查=============================================== AfaLoggerFunc.tradeInfo(">>>开始必要性检查") #=================若交易已被冲正或冲销,则停止处理================================ AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲正") where_sql = "ORMFN = '" + TradeContext.ORMFN + "'" ret = rccpsDBTrcc_atcbka.count(where_sql) if ret < 0: return AfaFlowControl.ExitThisFlow("S999","查询冲正登记簿异常,退出主流程") if ret > 0: return AfaFlowControl.ExitThisFlow("S999","冲正登记簿中存在对此交易的冲正,退出主流程") AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲正") AfaLoggerFunc.tradeInfo(">>>开始检查此交易是否已被冲销") ret = rccpsDBTrcc_mpcbka.count(where_sql) if ret < 0: return AfaFlowControl.ExitThisFlow("S999","查询冲销登记簿异常,退出主流程") if ret > 0: return AfaFlowControl.ExitThisFlow("S999","冲销登记簿中存在对此交易的冲销,退出主流程") AfaLoggerFunc.tradeInfo(">>>结束检查此交易是否已被冲销") AfaLoggerFunc.tradeInfo(">>>结束必要性检查") #=================匹配原交易信息=========================================== AfaLoggerFunc.tradeInfo(">>>开始匹配原交易") wtr_dict = {} if not rccpsDBFunc.getTransWtrAK(TradeContext.SNDBNKCO,TradeContext.TRCDAT,TradeContext.TRCNO,wtr_dict): return AfaFlowControl.ExitThisFlow('S999', "未找到原存款请求交易,停止处理") TradeContext.BJEDTE = wtr_dict['BJEDTE'] TradeContext.BSPSQN = wtr_dict['BSPSQN'] TradeContext.TRCCO = wtr_dict['TRCCO'] TradeContext.BESBNO = wtr_dict['BESBNO'] TradeContext.BETELR = wtr_dict['BETELR'] TradeContext.OCCAMT = str(wtr_dict['OCCAMT']) TradeContext.CHRGTYP = wtr_dict['CHRGTYP'] TradeContext.LOCCUSCHRG = str(wtr_dict['CUSCHRG']) TradeContext.PYRTYP = wtr_dict['PYRTYP'] TradeContext.PYRACC = wtr_dict['PYRACC'] TradeContext.PYRNAM = wtr_dict['PYRNAM'] TradeContext.CERTTYPE = wtr_dict['CERTTYPE'] TradeContext.CERTNO = wtr_dict['CERTNO'] TradeContext.TERMID = wtr_dict['TERMID'] TradeContext.WARNTNO = wtr_dict['BNKBKNO'] AfaLoggerFunc.tradeInfo(">>>结束匹配原交易") #=================若应答报文回复拒绝,则设置状态为拒绝,停止处理============= if TradeContext.PRCCO != 'RCCI0000': AfaLoggerFunc.tradeInfo(">>>对方返回拒绝应答") #=============设置业务状态为拒绝处理中================================= if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.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'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BESBNO'] = TradeContext.BESBNO stat_dict['BETELR'] = TradeContext.BETELR 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异常") #=============发起主机抹账============================================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账处理中") #=====特殊处理 关彬捷 20081127 调8813抹账,需产生新的前置流水号进行记账==== if rccpsGetFunc.GetRBSQ(PL_BRSFLG_SND) == -1 : return AfaFlowControl.ExisThisFlow('S999',"产生新的前置流水号异常") #为抹账赋值会计分录 entries_dict = {} entries_dict['FEDT'] = wtr_dict['BJEDTE'] entries_dict['RBSQ'] = wtr_dict['BSPSQN'] entries_dict['PYRACC'] = wtr_dict['PYRACC'] entries_dict['PYRNAM'] = wtr_dict['PYRNAM'] entries_dict['PYEACC'] = wtr_dict['PYEACC'] entries_dict['PYENAM'] = wtr_dict['PYENAM'] entries_dict['OCCAMT'] = wtr_dict['OCCAMT'] entries_dict['CHRGTYP'] = wtr_dict['CHRGTYP'] entries_dict['CUSCHRG'] = wtr_dict['CUSCHRG'] entries_dict['RCCSMCD'] = PL_RCCSMCD_CZ TradeContext.BRSFLG = PL_BRSFLG_SND rccpsEntries.KZBZYWZMZ(entries_dict) #====设置业务状态为抹账处理中==== if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_HCAC,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999','设置业务状态为抹账处理中异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #====自动抹账==== AfaLoggerFunc.tradeInfo(">>>开始发起主机抹账") #=====调起抹账主机接口==== rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束发起主机抹账") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['MGID'] = TradeContext.errorCode stat_dict['STRINFO'] = TradeContext.errorMsg AfaLoggerFunc.tradeInfo("TradeContext.errorCode = [" + TradeContext.errorCode + "]") if TradeContext.errorCode == '0000': AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账成功") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_SUCC stat_dict['TRDT'] = TradeContext.TRDT stat_dict['TLSQ'] = TradeContext.TLSQ stat_dict['PRTCNT'] = 1 if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态抹账成功异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账成功") else: AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为抹账失败") stat_dict['BCSTAT'] = PL_BCSTAT_HCAC stat_dict['BDWFLG'] = PL_BDWFLG_FAIL if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999','设置业务状态抹账成功异常') AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为抹账失败") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") return AfaFlowControl.ExitThisFlow("S999","对方拒绝,停止处理") else: AfaLoggerFunc.tradeInfo(">>>对方返回成功应答") #=================设置业务状态为确认付款处理中============================= AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为确认付款处理中") if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CONFPAY,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999',"设置业务状态为确认付款处理中异常") AfaLoggerFunc.tradeInfo(">>>结束设置业务状态为确认付款处理中") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=================更新存款确认委托日期和交易流水号========================= AfaLoggerFunc.tradeInfo(">>>开始更新存款确认委托日期和交易流水号") wtrbka_update_dict = {} wtrbka_update_dict['COTRCDAT'] = TradeContext.TRCDAT wtrbka_update_dict['COTRCNO'] = TradeContext.SerialNo wtrbka_update_dict['COMSGFLGNO'] = TradeContext.RCVMBRCO + TradeContext.TRCDAT + TradeContext.SerialNo wtrbka_where_dict = {} wtrbka_where_dict['BJEDTE'] = TradeContext.BJEDTE wtrbka_where_dict['BSPSQN'] = TradeContext.BSPSQN ret = rccpsDBTrcc_wtrbka.update(wtrbka_update_dict,wtrbka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow('S999', "更新存款确认委托日期和交易流水号异常") AfaLoggerFunc.tradeInfo(">>>结束更新存款确认委托日期和交易流水号") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #=================为存款确认请求报文做准备================================= AfaLoggerFunc.tradeInfo(">>>开始为存款确认请求报文做准备") TradeContext.MSGTYPCO = 'SET009' TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR #TradeContext.SNDTRDAT = TradeContext.BJEDTE #TradeContext.SNDTRTIM = TradeContext.BJETIM #TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.BJEDTE + TradeContext.TRCNO TradeContext.ORMFN = TradeContext.ORMFN TradeContext.OPRTYPNO = '30' TradeContext.ROPRTPNO = '30' TradeContext.TRANTYP = '0' TradeContext.ORTRCCO = TradeContext.TRCCO TradeContext.ORTRCNO = TradeContext.TRCNO TradeContext.TRCCO = '3000503' TradeContext.TRCNO = TradeContext.SerialNo TradeContext.CURPIN = "" TradeContext.STRINFO = '收到存款应答,自动发送存款确认' AfaLoggerFunc.tradeInfo(">>>结束为存款确认请求报文做准备") AfaLoggerFunc.tradeInfo(" 农信银系统:来账.中心类操作(1.本地操作).卡本转异应答报文接收[TRCC006_1155]退出 ") return True
def SubModuleDoFst(): #=====得到来账查询书的参考业务类型==== ROPRTPNO = TradeContext.ROPRTPNO #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") hdcbka_where_dict = {} hdcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO hdcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT hdcbka_where_dict['TRCNO'] = TradeContext.TRCNO #hdcbka_where_dict['TRCNO'] = TradeContext.ORTRCNO 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['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) AfaAfeFunc.CommAfe() return True AfaLoggerFunc.tradeInfo(">>>结束检查是否重复报文") #=====判断交易类型==== if( TradeContext.ROPRTPNO == '20' ): #汇兑 AfaLoggerFunc.tradeInfo("进入汇兑处理") #==========为汇兑查询查复自由格式登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询查复自由格式登记簿字典赋值") tran_dict = {} #if not rccpsDBFunc.getTransTrcPK(TradeContext.ORMFN[:10],TradeContext.ORMFN[10:18],TradeContext.ORMFN[18:26],tran_dict): if not rccpsDBFunc.getTransTrcAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,tran_dict): #======为通讯回执报文赋值=================================================== 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) AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','无原交易,丢弃此报文') if tran_dict.has_key('BJEDTE'): TradeContext.BOJEDT = tran_dict['BJEDTE'] if tran_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = tran_dict['BSPSQN'] TradeContext.ISDEAL = PL_ISDEAL_UNDO TradeContext.PYRACC = tran_dict['PYRACC'] #付款人账号 TradeContext.PYEACC = tran_dict['PYEACC'] #收款人账号 #=====张恒 20091010 新增 将机构落到原交易机构 ==== TradeContext.BESBNO = tran_dict['BESBNO'] #接收机构号 hdcbka_insert_dict = {} if not rccpsMap1118CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") elif( TradeContext.ROPRTPNO == '30' ): #通存通兑 AfaLoggerFunc.tradeInfo("进入通存通兑处理") #==========为汇兑查询查复自由格式登记簿字典赋值================================ AfaLoggerFunc.tradeInfo(">>>开始为汇兑查询查复自由格式登记簿字典赋值") wtrbka_dict = {} if not rccpsDBFunc.getTransWtrAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,wtrbka_dict): #======为通讯回执报文赋值=================================================== 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) AfaAfeFunc.CommAfe() return AfaFlowControl.ExitThisFlow('S999','无原交易,丢弃此报文') if wtrbka_dict.has_key('BJEDTE'): TradeContext.BOJEDT = wtrbka_dict['BJEDTE'] if wtrbka_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = wtrbka_dict['BSPSQN'] TradeContext.ISDEAL = PL_ISDEAL_UNDO TradeContext.PYRACC = wtrbka_dict['PYRACC'] #付款人账号 TradeContext.PYEACC = wtrbka_dict['PYEACC'] #收款人账号 hdcbka_insert_dict = {} if not rccpsMap1118CTradeContext2Dhdcbka_dict.map(hdcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为汇兑查询查复自由格式登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为汇兑查询查复自由格式登记簿字典赋值") else: return AfaFlowControl.ExitThisFlow("S999","没有此交易类型") #==========登记汇兑查询查复自由格式登记簿====================================== AfaLoggerFunc.tradeInfo(">>>开始登记汇兑查询查复自由格式登记簿") hdcbka_insert_dict['BRSFLG'] = PL_BRSFLG_RCV #来账 if TradeContext.ORCUR == 'CNY': hdcbka_insert_dict['CUR'] = '01' #原币种 else: hdcbka_insert_dict['CUR'] = TradeContext.ORCUR #原币种 hdcbka_insert_dict['OCCAMT'] = TradeContext.OROCCAMT #原金额 ret = rccpsDBTrcc_hdcbka.insertCmt(hdcbka_insert_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow("S999","登记汇兑查询查复自由格式登记簿异常") AfaLoggerFunc.tradeInfo(">>>结束登记汇兑查询查复自由格式登记簿") #======为通讯回执报文赋值===================================================回执前置里只要三个字段.1.2.末 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.本地操作).业务状态查询报文接收[RCC006_1107]进入***' ) #==========判断是否重复报文,如果是重复报文,直接进入下一流程================ AfaLoggerFunc.tradeInfo(">>>开始检查是否重复报文") ztcbka_where_dict = {} ztcbka_where_dict['SNDBNKCO'] = TradeContext.SNDBNKCO ztcbka_where_dict['TRCDAT'] = TradeContext.TRCDAT ztcbka_where_dict['TRCNO'] = TradeContext.TRCNO ztcbka_dict = rccpsDBTrcc_ztcbka.selectu(ztcbka_where_dict) if ztcbka_dict == None: return AfaFlowControl.ExitThisFlow("S999","校验重复报文异常") if len(ztcbka_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(">>>开始为业务状态查询查复登记簿字典赋值") AfaLoggerFunc.tradeInfo("业务类型[" + TradeContext.ROPRTPNO + "]") AfaLoggerFunc.tradeInfo("原发送行号[" + TradeContext.ORSNDBNK + "]") AfaLoggerFunc.tradeInfo("原委托日期[" + TradeContext.ORTRCDAT + "]") AfaLoggerFunc.tradeInfo("原交易流水号[" + TradeContext.ORTRCNO + "]") tran_dict = {} if TradeContext.ROPRTPNO == '20': if not rccpsDBFunc.getTransTrcAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,tran_dict): #======为通讯回执报文赋值=================================================== 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 TradeContext.ROPRTPNO == '21': if not rccpsDBFunc.getTransBilAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,tran_dict): #======为通讯回执报文赋值=================================================== 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 TradeContext.ROPRTPNO == '30': if not rccpsDBFunc.getTransWtrAK(TradeContext.ORSNDBNK,TradeContext.ORTRCDAT,TradeContext.ORTRCNO,tran_dict): #======为通讯回执报文赋值=================================================== 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 else: #======为通讯回执报文赋值=================================================== 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 if tran_dict.has_key('BJEDTE'): TradeContext.BOJEDT = tran_dict['BJEDTE'] if tran_dict.has_key('BSPSQN'): TradeContext.BOSPSQ = tran_dict['BSPSQN'] TradeContext.ISDEAL = PL_ISDEAL_ISDO ztcbka_insert_dict = {} if not rccpsMap1107CTradeContext2Dztcbka.map(ztcbka_insert_dict): return AfaFlowControl.ExitThisFlow("S999","为业务状态查询查复登记簿字典赋值异常") AfaLoggerFunc.tradeInfo(">>>结束为业务状态查询查复登记簿字典赋值") #==========登记业务状态查询查复登记簿====================================== AfaLoggerFunc.tradeInfo(">>>开始登记业务状态查询查复登记簿") ztcbka_insert_dict['BRSFLG'] = PL_BRSFLG_RCV #来账 if TradeContext.ORCUR == 'CNY': ztcbka_insert_dict['CUR'] = '01' #原币种 else: ztcbka_insert_dict['CUR'] = TradeContext.ORCUR #原币种 ztcbka_insert_dict['OCCAMT'] = TradeContext.OROCCAMT #原金额 ret = rccpsDBTrcc_ztcbka.insertCmt(ztcbka_insert_dict) if ret <= 0: 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) #==将BJEDTE和BSPSQN赋到TradeContext中的BOJEDT和BOSPSQ中,为交易后处理做准备== TradeContext.BOJEDT = TradeContext.BJEDTE TradeContext.BOSPSQ = TradeContext.BSPSQN TradeContext.OQTSBNK = TradeContext.SNDBNKCO TradeContext.OQTDAT = TradeContext.BJEDTE TradeContext.OQTNO = TradeContext.TRCNO TradeContext.ORSNDBNK = TradeContext.SNDBNKCO TradeContext.ORRCVBNK = TradeContext.RCVBNKCO TradeContext.ORTRCDAT = TradeContext.TRCDAT TradeContext.ORTRCNO = TradeContext.TRCNO TradeContext.OQTDAT = TradeContext.TRCDAT TradeContext.OQTSBNK = TradeContext.SNDBNKCO TradeContext.OQTNO = TradeContext.TRCNO TradeContext.ORMFN = TradeContext.MSGFLGNO TradeContext.ROPRTPNO = TradeContext.OPRTYPNO TradeContext.RCVBNKCO = TradeContext.SNDBNKCO TradeContext.RCVBNKNM = TradeContext.SNDBNKNM if tran_dict.has_key('BCSTAT'): TradeContext.ORBCSTAT = tran_dict['BCSTAT'] if tran_dict.has_key('BDWFLG'): TradeContext.ORBDWFLG = tran_dict['BDWFLG'] AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).业务状态查询报文接收[RCC006_1107]退出***' ) return True
def SubModuleDoFst(): AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).存款确认请求报文接收[TRCC006_1143]进入***' ) #判断是否重复报文 AfaLoggerFunc.tradeInfo(">>>开始判断是否重复报文") sel_dict = {'COTRCNO':TradeContext.TRCNO,'COTRCDAT':TradeContext.TRCDAT,'SNDBNKCO':TradeContext.SNDBNKCO} record = rccpsDBTrcc_wtrbka.selectu(sel_dict) if record == None: return AfaFlowControl.ExitThisFlow('S999','判断是否重复存款确认报文,查询通存通兑业务登记簿相同报文异常') elif len(record) > 0: AfaLoggerFunc.tradeInfo('通存通兑业务登记簿中存在相同数据,重复报文,返回应答报文') TradeContext.STRINFO = "重复报文" else: #查询原存款交易信息 AfaLoggerFunc.tradeInfo(">>>非重复报文,开始查询原存款交易信息") wtrbka_dict = {} if not rccpsDBFunc.getTransWtrAK(TradeContext.SNDBNKCO,TradeContext.TRCDAT,TradeContext.ORTRCNO,wtrbka_dict): AfaFlowControl.ExitThisFlow('S999',"查询原存款交易信息异常") TradeContext.BJEDTE = wtrbka_dict['BJEDTE'] TradeContext.BSPSQN = wtrbka_dict['BSPSQN'] TradeContext.PYEACC = wtrbka_dict['PYEACC'] TradeContext.PYENAM = wtrbka_dict['PYENAM'] TradeContext.OCCAMT = wtrbka_dict['OCCAMT'] TradeContext.BESBNO = wtrbka_dict['BESBNO'] AfaLoggerFunc.tradeInfo(">>>结束查询原存款交易信息") #检查交易当前状态是否为确认入账成功,非此状态则丢弃报文 AfaLoggerFunc.tradeInfo(">>>开始判断交易当前状态是否为确认入账成功") stat_dict = {} if not rccpsState.getTransStateCur(TradeContext.BJEDTE,TradeContext.BSPSQN,stat_dict): return AfaFlowControl.ExitThisFlow('S999',"获取原存款交易当前状态异常") #if not (stat_dict['BCSTAT'] == PL_BCSTAT_CONFACC and stat_dict['BDWFLG'] == PL_BDWFLG_SUCC): # return AfaFlowControl.ExitThisFlow('S999',"原存款交易当前状态非确认入账成功,丢弃报文") AfaLoggerFunc.tradeInfo(">>>结束判断交易当前状态是否为确认入账成功") #更新通存通兑登记簿存款确认相关信息 AfaLoggerFunc.tradeInfo(">>>开始更新通存通兑登记簿存款确认相关信息") wtrbka_where_dict = {} wtrbka_where_dict = {'BJEDTE':TradeContext.BJEDTE,'BSPSQN':TradeContext.BSPSQN} wtrbka_update_dict = {} wtrbka_update_dict = {'COTRCDAT':TradeContext.TRCDAT,'COTRCNO':TradeContext.TRCNO,'COMSGFLGNO':TradeContext.MSGFLGNO} ret = rccpsDBTrcc_wtrbka.update(wtrbka_update_dict,wtrbka_where_dict) if ret <= 0: return AfaFlowControl.ExitThisFlow('S999',"更新通存通兑登记簿存款确认相关信息异常") AfaLoggerFunc.tradeInfo(">>>结束更新通存通兑登记簿存款确认相关信息") #设置业务状态为自动入账处理中 AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为自动入账处理中") if not rccpsState.newTransState(TradeContext.BJEDTE,TradeContext.BSPSQN,PL_BCSTAT_CONFACC,PL_BDWFLG_WAIT): return AfaFlowControl.ExitThisFlow('S999','设置业务状态为自动入账处理中异常') if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") AfaLoggerFunc.tradeInfo(">>>开始设置业务状态为自动入账处理中") #发起主机记账 AfaLoggerFunc.tradeInfo(">>>开始发起主机记账") TradeContext.HostCode = '8813' #调用8813主机接口 TradeContext.RCCSMCD = PL_RCCSMCD_HDLZ #主机摘要代码:汇兑来账 TradeContext.SBAC = TradeContext.BESBNO + PL_ACC_NXYDQSLZ #借方账户:农信银待清算来账 TradeContext.SBNM = "农信银待清算来账" TradeContext.RBAC = TradeContext.PYEACC #贷方账户:收款人账户 TradeContext.RBNM = TradeContext.PYENAM #贷方户名:收款人户名 TradeContext.OCCAMT = str(TradeContext.OCCAMT) #=====add by pgt 12-5==== TradeContext.CTFG = '7' #本金 手续费标识 7 本金 8手续费 9 本金+手续费 TradeContext.PKFG = 'T' #通存通兑标识 TradeContext.SBAC = rccpsHostFunc.CrtAcc(TradeContext.SBAC, 25) AfaLoggerFunc.tradeInfo( '借方账号:' + TradeContext.SBAC ) AfaLoggerFunc.tradeInfo( '贷方账号:' + TradeContext.RBAC ) rccpsHostFunc.CommHost( TradeContext.HostCode ) AfaLoggerFunc.tradeInfo(">>>结束发起主机记账") #根据主机返回码,设置业务状态为自动入账成功或失败 AfaLoggerFunc.tradeInfo(">>>开始根据主机返回码,设置业务状态为自动入账成功或失败") stat_dict = {} stat_dict['BJEDTE'] = TradeContext.BJEDTE stat_dict['BJETIM'] = TradeContext.BJETIM stat_dict['BSPSQN'] = TradeContext.BSPSQN stat_dict['BESBNO'] = TradeContext.BESBNO stat_dict['BETELR'] = TradeContext.BETELR stat_dict['SBAC'] = TradeContext.SBAC stat_dict['ACNM'] = TradeContext.SBNM stat_dict['RBAC'] = TradeContext.RBAC stat_dict['OTNM'] = TradeContext.RBNM stat_dict['PRCCO'] = TradeContext.errorCode stat_dict['STRINFO'] = TradeContext.errorMsg AfaLoggerFunc.tradeInfo("主机返回码[" + TradeContext.errorCode + "],主机返回信息[" + TradeContext.errorMsg +"]") if TradeContext.errorCode == '0000': #=====发送农信银成功,设置状态为自动入账成功==== stat_dict['TRDT'] = TradeContext.TRDT stat_dict['TLSQ'] = TradeContext.TLSQ stat_dict['BCSTAT'] = PL_BCSTAT_AUTO stat_dict['BDWFLG'] = PL_BDWFLG_SUCC TradeContext.STRINFO = '成功' if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为自动入账成功异常") AfaLoggerFunc.tradeInfo(">>>设置业务状态为自动入账成功完成") else: #=====发送农信银失败,设置状态为自动入账失败==== stat_dict['BCSTAT'] = PL_BCSTAT_AUTO stat_dict['BDWFLG'] = PL_BDWFLG_FAIL TradeContext.STRINFO = '行内自动入账失败' if not rccpsState.setTransState(stat_dict): return AfaFlowControl.ExitThisFlow('S999', "设置业务状态为自动入账失败异常") AfaLoggerFunc.tradeInfo(">>>设置业务状态为自动入账失败完成") if not AfaDBFunc.CommitSql( ): AfaLoggerFunc.tradeFatal( AfaDBFunc.sqlErrMsg ) return AfaFlowControl.ExitThisFlow("S999","Commit异常") #为存款确认应答报文赋值 TradeContext.sysType = 'rccpst' TradeContext.MSGTYPCO = 'SET010' TradeContext.RCVSTLBIN = TradeContext.SNDMBRCO TradeContext.SNDSTLBIN = TradeContext.RCVMBRCO TradeContext.SNDBRHCO = TradeContext.BESBNO TradeContext.SNDCLKNO = TradeContext.BETELR #TradeContext.SNDTRDAT = TradeContext.BJEDTE #TradeContext.SNDTRTIM = TradeContext.BJETIM TradeContext.ORMFN = TradeContext.MSGFLGNO #TradeContext.MSGFLGNO = TradeContext.SNDMBRCO + TradeContext.BJEDTE + TradeContext.SerialNo #TradeContext.NCCWKDAT = TradeContext.NCCworkDate TradeContext.OPRTYPNO = '30' TradeContext.ROPRTPNO = TradeContext.OPRTYPNO TradeContext.TRANTYP = '0' TradeContext.CUR = 'CNY' TradeContext.PRCCO = 'RCCI0000' AfaLoggerFunc.tradeInfo( '***农信银系统:来账.中心类操作(1.本地操作).存款确认请求报文接收[TRCC006_1143]退出***' ) return True