农⾏银企直连接⼝之查询账户交易明细与ERP对接
跟据农⾏提供的接⼝⽂档。(仍然以你⼿中的接⼝⽂档为准哦)送给老师的贺卡图片
本⼈做的是跟据交易明细表与ERP对接⽣成收款单(这⾥主要说报⽂提交与读取)
这⾥⼩抱怨⼀下,农⾏提供的这个接⼝⽂档简直让⼈⾮常⽆语。没有demo不说,返回码的⽰意不全不准。⼀句话烂到爆。。。
#region农⾏接⼝通讯⽅法
private static Socket ConnectSocket(string server, int port)
关于吃饭快的成语{
Socket s = null;
IPEndPoint ipe = new IPEndPoint(IPAddress.Parse(server), port);
Socket tempSocket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
tempSocket.Connect(ipe);
音的部首if (tempSocket.Connected)
护肤品都有什么牌子的{
s = tempSocket;
}
return s;
}
/// <summary>
/// 通讯发送报⽂
/// </summary>
/// <param name="server">服务ip 这⾥是连接农⾏客户端所以ip默认应该是127.0.0.1</param>
/// <param name="port">端⼝这⾥是连接农⾏客户端,客户端登录后系统设置⾥会设置端⼝</param>
/
// <param name="DbAccNo">查询的账户银⾏账号</param>
/// <param name="startTime">末笔时间戳(⽂档有说明,通过这个查过的数据就不再过滤出来)</param>
/// <param name="StarDate">查询的起始⽇期</param>
/// <param name="EndDate">查询的截⽌⽇期</param>
/// <returns></returns>
private string SocketSendReceive(string server, int port, string DbAccNo,string startTime,DateTime StarDate,DateTime EndDate)
{
string _head = "<ap><CCTransCode>CQRA10</CCTransCode><ProductID>ICC</ProductID><ChannelType>ERP</ChannelType><CorpNo></CorpNo><OpNo></OpNo><AuthNo></AuthNo><ReqSeqNo></ReqSeqNo><ReqDate> string request = _head + "<CCTransCode>CQRA10</CCTransCode><Corp><StartDate>" + StarDate.ToString("yyyyMMdd") +
"</StartDate><EndDate>" + EndDate.ToString("yyyyMMdd") + "</EndDate></Corp><Channel><LastJrnNo>< Byte[] byl = Encoding.Default.GetBytes(request);
string _len = "1" + byl.Length.ToString().PadRight(6, '');//根据⽂档说明报⽂前⾯要有7位数字,第⼀位是加密否标⽰,后⾯6位是报⽂的长度
Byte[] bytesSent = Encoding.Default.GetBytes(_len + request);
Byte[] bytesReceived = new Byte[256];
// Create a socket connection with the specified server and port.
Socket s = ConnectSocket(server, port);
if (s == null)
throw new Exception("Error:通讯连接失败!请检查农⾏客户端是否登录!");
// Send request to the server.
s.Send(bytesSent, bytesSent.Length, 0);
// Receive the server home page content.
int bytes = 0;
string page = "";
// The following will block until te page is transmitted.
do
{
bytes = s.Receive(bytesReceived, bytesReceived.Length, 0);
page = page + Encoding.Default.GetString(bytesReceived, 0, bytes);
}
while (bytes > 0);
return page;
}
#endregion
string result = SocketSendReceive(host, port, idcode, strattime, _starDate, _endDate);
XmlDocument _xml = new XmlDocument();
_xml.LoadXml(result.Substring(6));
XmlNode _RespSource = _xml.SelectSingleNode("//RespSource");
if (_RespSource.InnerText != "0")
{
XmlNode _RespInfo = _xml.SelectSingleNode("//RespInfo");//返回的提⽰信息
XmlNode _RxtInfo = _xml.SelectSingleNode("//RxtInfo");//返回的提⽰信息
//////报错信息记录///
}
else
{
XmlNode _xnfilename = _xml.SelectSingleNode("//BatchFileName");//返回数据以⽂件形式保存
string _data = System.IO.File.ReadAllText("C:/Program Files (x86)/中国农业银⾏/中国农业银⾏银企通平台/detail/" + _xnfilename.InnerText, Encoding.Default);//银⾏客户端的⽂件路径
string[] _strdata = _data.Split('\n');
foreach (string _da in _strdata)南京大屠杀时间是哪一年
{
if (!string.IsNullOrEmpty(_da))
{
string[] _strfi = _da.Split('|');
decimal _amtn = Convert.ToDecimal(_strfi[18].ToString());
if (_amtn > 0)//只取收款
{
string _codeno = _strfi[11].ToString();//对⽅银⾏账户
string _compname = _strfi[13].ToString();//对⽅户名
//查询客户账户资料
DataSet _dscust = _query.DoSQLString("select CUS_NO from cust where NAME='" + _compname + "'");//_query 为底层查数据⽅法
if (_dscust.Tables[0].Rows.Count > 0)
{
string _lastTime = _strfi[4].ToString(); ;//末笔时间戳;
string _rem = _strfi[31].ToString();//摘要
///////////////保存收款单///////////////////////
///////////////记录末笔时间戳///////////////////////
}
else
{
//////报错信息记录///
}
}
}
}
}
看懂了吗,,不懂最好就直接农⾏的技术⼈员吧。。也可以加kopania (不能保证能解答);
>亡口月羊凡念什么
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论