Table of Contents

Class AstralERP

Namespace
OrnithonAPI
Assembly
OrnithonAPI.dll

The AstralERP class is a web service that provides methods for posting data to an ERP system and retrieving data from it. It includes methods for processing different types of XML input, such as purchase orders, customer and supplier master data, item master data, and more. The class also includes methods for retrieving balance information, ERP records, flock information, and KPI monthly reports. The class uses a clsSQL object to interact with the database and includes error handling to log any issues that arise during processing. The web service is designed to be consumed by external systems, such as the Astral API, to facilitate integration with the ERP system.

[ScriptService]
[WebService(Namespace = "http://OrnithonAPI/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class AstralERP
Inheritance
AstralERP
Inherited Members

Constructors

AstralERP()

public AstralERP()

Methods

GetBalance(string, string)

The GetBalance method is a web method that retrieves balance information from the ERP system. It first checks if the request method is GET and then verifies the provided username and password for authentication. If authentication is successful, it executes a stored procedure to retrieve the balance data, which is returned as an XML string. The method also includes error handling to manage connection issues, authentication failures, and other exceptions that may occur during the process. The result of the operation is logged in the database for tracking purposes.

[WebMethod]
public string GetBalance(string UserName, string Password)

Parameters

UserName string

API Username

Password string

API Password

Returns

string

XML string containing the balance data or an error message

GetData(string, string)

The GetData method is a web method that retrieves ERP record data from the database. It first checks if the request method is GET and then verifies the provided username and password for authentication. If authentication is successful, it executes a SQL query to retrieve the ERP records that have not been sent yet, returning the data as an XML string. The method also updates the SendDate for the retrieved records to indicate that they have been sent. Error handling is included to manage connection issues, authentication failures, and other exceptions that may occur during the process. The result of the operation is logged in the database for tracking purposes.

[WebMethod]
public string GetData(string UserName, string Password)

Parameters

UserName string

API Username

Password string

API Password

Returns

string

XML string containing the ERP record data or an error message

GetFlocks(string, string)

The GetFlocks method is a web method that retrieves flock information from the ERP system. It first checks if the request method is GET and then verifies the provided username and password for authentication. If authentication is successful, it executes a stored procedure to retrieve the flock data, which is returned as an XML string. The method also updates the LastERPDate and LastERPStatus for each flock based on the retrieved data. Error handling is included to manage connection issues, authentication failures, and other exceptions that may occur during the process. The result of the operation is logged in the database for tracking purposes.

[WebMethod]
public string GetFlocks(string UserName, string Password)

Parameters

UserName string

API Username

Password string

API Password

Returns

string

XML string containing the flock data or an error message

GetKPIMonthly(string, string)

The GetKPIMonthly method is a web method that retrieves monthly KPI data from the ERP system. It first checks if the request method is GET and then verifies the provided username and password for authentication. If authentication is successful, it executes SQL queries to retrieve the KPI data that has not been sent yet, returning the data as an XML string. The method also updates the SendDate for the retrieved KPI records to indicate that they have been sent. Error handling is included to manage connection issues, authentication failures, and other exceptions that may occur during the process. The result of the operation is logged in the database for tracking purposes.

[WebMethod]
public string GetKPIMonthly(string UserName, string Password)

Parameters

UserName string

API Username

Password string

API Password

Returns

string

XML string containing the KPI data or an error message

PostData(string)

The PostData method is a web method that accepts XML input as a string, processes it based on its content, and returns a result as a string. The method first checks if the request method is POST and then attempts to decode the input from Base64 if it is not in test mode. It then determines the type of XML file based on specific tags and calls the appropriate processing function for that file type. The result of the processing is stored in the database along with debug information such as file type, company ID, farm ID, site ID, item ID, item group ID, and quantity. If any errors occur during processing, they are logged in the database and returned as part of the result. This method is designed to handle various types of XML files related to ERP data integration, such as purchase orders, customer and supplier master data, item master data, and more.

[WebMethod]
public string PostData(string XMLInput)

Parameters

XMLInput string

The XML input as a string, which can be Base64 encoded.

Returns

string

A string indicating the result of the processing.