Standalone Script is used for starting a logic individually from Produmex WMS by the WMS robot tool. It can be scheduled in the Windows Scheduler. This can be for example a very complex replenishment order generation.
Necessary classes:
| Class | Reference |
|---|---|
| TransactionScope | using System.Transactions; |
| PmxDbConnection | using Produmex.Foundation.Data.Sbo; |
Steps:
Copy your connection string text from any config file of the Produmex WMS tools or Fat Client application.
private static string CONNECTION_STRING = “”;
using (TransactionScope scope = PmxDbConnection.GetNewTransactionScope())
using (PmxDbConnectionDirect conn = PmxDbConnectionMgr.GetDirectConnection(SboConnectionString.ParseStringToObject(CONNECTION_STRING)))
Example:
using ( TransactionScope scope =
PmxDbConnection.GetNewTransactionScope())
{
using (PmxDbConnectionDirect conn = PmxDbConnectionMgr.GetDirectConnection(SboConnectionString.ParseStringToObject(CONNECTION_STRING)))
{
conn.Open();
Console.WriteLine("Connection is open");
string query = @"SELECT TOP 1 DocEntry FROM PMX_PLHE WHERE DocStatus = 'O' ORDER BY DocEntry ";
using (ISboRecordset rs1 = SboRecordsetHelper.RunQuery(s_log, query, conn))
{
while (!rs1.EoF)
{
… Do Something …
rs1.MoveNext();
}
}
}
scope.Complete(); //Complete transaction
}