我将Asp.NET应用程序与Acumatica集成,需要在Acumatica中提供时更新送货信息(跟踪#,运营商等)。在创建货件时,有没有办法让Acumatica在我的Asp.NET应用程序上调用端点?我搜索了很多文档(可用here),但我还没有发现任何可以发送 OUT 信息的信息。 Acumatica到另一个网络服务。
理想情况下,此传出呼叫会在有效负载中发送货件对象。
答案 0 :(得分:1)
在我的回答中,我想你知道如何从C#代码中调用一些外部服务,并且对于如何从Acumatica发送通知是一个挑战。 我建议你在每个Acumatica图中扩展每个Persist方法,当对象在db中持久化时,你希望从中发送通知。恕我直言,最好的选择是覆盖方法持久化(顺便说一句,它覆盖持久化方法在T300中有详细描述)。在扩展类的代码中,您可以执行以下操作:
public void Persist(PersistDelegate baseMethod)
{
baseMethod(); // calling this method will preserve your changes in db
//here should go your code, that will send push/pop/delete etc web request into your asp.net application. Or in other words your web hook.
}
答案 1 :(得分:0)
当您问问题时此功能不可用,但推送通知似乎正是您要查找的内容:
帮助-https://help.acumatica.com/(W(9))/Main?ScreenId=ShowWiki&pageid=d8d2835f-5450-4b83-852e-dbadd76a5af8
演示-https://adn.acumatica.com/content/uploads/2018/05/Push-Notifications.pdf
答案 2 :(得分:0)
如果没有Acumatica 2017R2,则必须创建自己的扩展项目,然后才能从Acumatica代码中调用它:
import javax.swing.JOptionPane;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.Scanner;
import java.io.FileNotFoundException;
import java.util.Date;
public class Corpus03
{
public static void main(String arg[])
throws FileNotFoundException
{
Scanner inputFile = new Scanner(new FileReader("input.txt"));
PrintWriter outFile = new PrintWriter("TEACHERNAME.out");
//INPUT
name = JOptionPane.showInputDialog("Enter your name: ");
ID = JOptionPane.showInputDialog("Enter your ID: ");
str = JOptionPane.showInputDialog("Enter your Annual Salary");
annualSalary = Double.parseDouble(str);
//CALCULATIONS
grossPayPerCheck = annualSalary / 24;
actualDayWorked = annualSalary / 174;
perWeek = (annualSalary / 50);
perHour = perWeek / 40;
ssTax = grossPayPerCheck * SS_TAX;
medTax = grossPayPerCheck * MED_TAX;
fedTax = grossPayPerCheck * FED_TAX;
stateTax = grossPayPerCheck * STATE_TAX;
unitedWay = 20;
healthIns = 125;
totalDeductions = ssTax + medTax + fedTax + stateTax + healthIns + unitedWay;
netPay = (grossPayPerCheck - totalDeductions);
Date now = new Date();
//OUTPUT
outputStr = "Name: " + name
+ "\r\n" + "Employee ID: " + ID
+ "\r\n" + "Annual Salary: " + String.format("%.2f", annualSalary)
+ "\r\n" + "Gross Pay per Check: $"
+ String.format("%.2f", grossPayPerCheck)
+ "\r\n" + "$" + String.format("%.2f", actualDayWorked) + " per actual day worked"
+ "\r\n" + "$" + String.format("%.2f", perHour) + " per hour"
+ "\r\n\r\n" + "===================="
+ "\r\n" + "DEDUCTIONS PER CHECK"
+ "\r\n" + "===================="
+ "\r\n" + "Social Security Tax: $"
+ String.format("%.2f", ssTax)
+ "\r\n" + "Medicare Tax: $"
+ String.format("%.2f", medTax)
+ "\r\n" + "Federal Income: $"
+ String.format("%.2f", fedTax)
+ "\r\n" + "State Income Tax: $"
+ String.format("%.2f", stateTax)
+ "\r\n" + "Health Insurance: $125.00"
+ "\r\n" + "United Way Contribution: $20.00"
+ "\r\n\r\n" + "Total Deductions: $"
+ String.format("%.2f", totalDeductions)
+ "\r\n\r\n" + "Net Pay per check: $"
+ String.format("%.2f", netPay);
JOptionPane.showMessageDialog(null, outputStr,
"Teacher Pay Information",
JOptionPane.INFORMATION_MESSAGE);
outFile.printf("City School Dstric, 111 First Stree, Anytown, OK 12345");
outFile.println();
outFile.println();
outFile.printf("%-40s%-10s\r\n\n", name, ID);
outFile.close();
inputFile.close();
System.exit(0);
}
}
然后您可以这样称呼它:
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
namespace MyApp
{
public static class Utility
{
private static WebRequest CreateRequest(string url, Dictionary headers)
{
if (Uri.IsWellFormedUriString(url, UriKind.Absolute))
{
WebRequest req = WebRequest.Create(url);
if (headers != null)
{
foreach (var header in headers)
{
if (!WebHeaderCollection.IsRestricted(header.Key))
{
req.Headers.Add(header.Key, header.Value);
}
}
}
return req;
}
else
{
throw(new ArgumentException("Invalid URL provided.", "url"));
}
}
public static string MakeRequest(string url, Dictionary headers = null)
{
WebResponse resp = CreateRequest(url, headers).GetResponse();
StreamReader reader = new StreamReader(resp.GetResponseStream());
string response = reader.ReadToEnd();
reader.Close();
resp.Close();
return response;
}
public static byte[] MakeRequestInBytes(string url, Dictionary headers = null)
{
byte[] rb = null;
WebResponse resp = CreateRequest(url, headers).GetResponse();
using (BinaryReader br = new BinaryReader(resp.GetResponseStream()))
{
rb = br.ReadBytes((int)resp.ContentLength);
br.Close();
}
resp.Close();
return rb;
}
}
}