【问题标题】:Sending excel data to Tally将 Excel 数据发送到 Tally
【发布时间】:2020-05-17 08:06:04
【问题描述】:

我有一个启用宏的工作表,它将数据保存为 XML 格式。 我准备了将输出文件保存为 XML 格式的 excel 模板。然后我使用导入数据选项在 Tally 中手动导入 XML 文件。 现在我正在寻找一种解决方案,它可以使过程自动化,即一旦我将文件保存为 XML 格式,数据应该立即导入 Tally,而无需任何手动过程。 希望我正确解释了我的查询。 提前致谢。 最好的问候,

【问题讨论】:

  • 有什么问题吗?在这件事上您需要任何进一步的帮助吗?

标签: excel xml vba automation tally


【解决方案1】:

您可以使用请求将 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 文件加载为字符串。

确保您的 ODBC 服务器已在 Tally 上启用。将您的 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 上有很多关于这方面的帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-18
    • 2017-03-11
    • 2016-10-02
    • 2011-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多