I have a macro enabled worksheet which saves the data as XML format. I have prepared the excel template which saves the out put file in XML format. Then i import the XML file in Tally manually with import data option. Now i am looking for a solution which would make the process automatic i.e. once i save the file as XML format, immediately the data should get imported in Tally without any manual process. Hope i explained my query properly. Thanks in Advance. Best Regards,
问问题
608 次
1 回答
0
您可以使用请求将 xml 发送到计数。这是一个 C# 示例,您可以将其翻译成您喜欢的语言 -
private static string Connect(string host, string request)
{
string response = "";
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(host);
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = (long)request.Length;
StreamWriter writer = new StreamWriter(httpWebRequest.GetRequestStream());
writer.Write(request);
writer.Close();
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Stream receiveStream = httpResponse.GetResponseStream();
StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
response = reader.ReadToEnd();
reader.Close();
httpResponse.Close();
}
host 是您的计数服务器 ip - 通常是http://localhost:9000/并且 request 是您的 xml - 将您的 xml 文件作为字符串加载。
确保在 Tally 上启用了 ODBC 服务器。将您的 Tally 设置为服务器和客户端并选择您的端口 - https://help.tallysolutions.com/article/Tally.ERP9/sync/configuring_client_server.htm
您将收到来自 tally 的响应,该响应将具有以下 XML 标记之一 -
<CREATED>1</CREATED>
or
<ERROR> // some error </ERROR>
Tally 集成文档不是很好,但它仍然可以给你一个想法 - http://mirror.tallysolutions.com/tallyweb/tally/td9/Tally.ERP9_Integration_Capabilities.pdf
最后,为了在创建文件时自动上传到计数 - 您可以使用 FileSystemWatcher (C#) 或 Watchdog 库来观察文件何时在指定文件夹中创建/修改。在 stackoverflow 上有很多关于这方面的帮助。
于 2020-05-18T02:45:05.853 回答