===== 3. Standalone Script ===== 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. ====3.1. Database Connection==== **Necessary classes:** ^ Class ^ Reference ^ | TransactionScope | using System.Transactions; | | PmxDbConnection | using Produmex.Foundation.Data.Sbo; | **Steps:** * **1. Define the connection string:** Copy your connection string text from any config file of the Produmex WMS tools or Fat Client application. private static string CONNECTION_STRING = “”; * **2. Start a transaction:** using (TransactionScope scope = PmxDbConnection.GetNewTransactionScope()) * **3. Create the connection:** 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 }