Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| internal:proship:velocity:ils-event [2026/07/14 09:45] – created lseadmin | internal:proship:velocity:ils-event [2026/07/14 10:12] (current) – removed lseadmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | **Velocity PSS function to send request to ILS:** | ||
| - | < | ||
| - | Sub Ils_RunEvent(IlsEvent) | ||
| - | Dim IlsRq | ||
| - | Dim IlsEvXPath | ||
| - | |||
| - | Select Case IlsEvent | ||
| - | Case " | ||
| - | Set IlsRq = Sys | ||
| - | IlsEvXPath = "/ | ||
| - | Case Else | ||
| - | Set IlsRq = Shipment | ||
| - | IlsEvXPath = "/ | ||
| - | End Select | ||
| - | IlsRq.DeleteElement IlsEvXPath | ||
| - | IlsRq.E(IlsEvXPath & "/ | ||
| - | |||
| - | DMsgBox " | ||
| - | Dim ilsRsTxt | ||
| - | ilsRsTxt = TcpSend(Machine.ServerName, | ||
| - | If Right(ilsRsTxt, | ||
| - | ilsRsTxt = Left(ilsRsTxt, | ||
| - | End If | ||
| - | |||
| - | DMsgBox " | ||
| - | Dim IlsRs | ||
| - | Set IlsRs = CreateProcReq() | ||
| - | IlsRs.Xml = ilsRsTxt | ||
| - | ' | ||
| - | |||
| - | DMsgBox IlsRs.E(IlsEvXPath & "/ | ||
| - | If (CInt(" | ||
| - | IlsRs.DeleteElement IlsEvXPath | ||
| - | Select Case IlsEvent | ||
| - | Case " | ||
| - | ' | ||
| - | Case Else | ||
| - | Shipment.Xml = IlsRs.Xml | ||
| - | End Select | ||
| - | End If | ||
| - | End Sub | ||
| - | |||
| - | </ | ||
| - | |||
| - | |||
| - | **Call the function like this within Velocity events:** | ||
| - | < | ||
| - | Function PreShipShipment() | ||
| - | Ils_RunEvent " | ||
| - | End Function | ||
| - | </ | ||
| - | |||
| - | ** PSV.psi: ILS code that handles incoming requests from PSS Ils_RunEvent: | ||
| - | < | ||
| - | |||
| - | internal class PSV : VelocityEvents | ||
| - | { | ||
| - | public PSV() : base(IlsConfiguration.Logger) { } | ||
| - | |||
| - | public override string StartClient(ref CpiXml SysClient) | ||
| - | { | ||
| - | LogInfo(String.Format(" | ||
| - | |||
| - | return ""; | ||
| - | } | ||
| - | |||
| - | public override void LoadShipment(ref CpiXml Shipment) | ||
| - | { | ||
| - | LogInfo(String.Format(" | ||
| - | LogDebug(Shipment.Xml); | ||
| - | |||
| - | try | ||
| - | { | ||
| - | var shipRef = Shipment["/ | ||
| - | |||
| - | try | ||
| - | { | ||
| - | var JOrder = dolibarr.GetOrder(shipRef); | ||
| - | |||
| - | Shipment["/ | ||
| - | Shipment["/ | ||
| - | Shipment["/ | ||
| - | Shipment["/ | ||
| - | Shipment["/ | ||
| - | Shipment["/ | ||
| - | Shipment["/ | ||
| - | Shipment["/ | ||
| - | |||
| - | Shipment["/ | ||
| - | |||
| - | Shipment["/ | ||
| - | } | ||
| - | catch (Exception ex) | ||
| - | { | ||
| - | LogError(ex.ToString()); | ||
| - | Shipment["/ | ||
| - | } | ||
| - | } | ||
| - | catch (Exception ex) | ||
| - | { | ||
| - | LogError(" | ||
| - | Shipment["/ | ||
| - | } | ||
| - | |||
| - | End_LoadShipment: | ||
| - | LogInfo(String.Format(" | ||
| - | LogDebug(Shipment.Xml); | ||
| - | } | ||
| - | |||
| - | public override string PostShip(ref CpiXml Shipment) | ||
| - | { | ||
| - | LogInfo(String.Format(" | ||
| - | LogDebug(Shipment.Xml); | ||
| - | |||
| - | var custId = Shipment["/ | ||
| - | |||
| - | using (OdbcConnection db = new OdbcConnection(" | ||
| - | { | ||
| - | db.Open(); | ||
| - | |||
| - | using (OdbcCommand queryCmd = new OdbcCommand(null, | ||
| - | { | ||
| - | queryCmd.CommandText = | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | |||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | queryCmd.Parameters.AddWithValue(" | ||
| - | LogDebug(queryCmd.CommandText.ToString()); | ||
| - | |||
| - | LogDebug(String.Format(" | ||
| - | } | ||
| - | } | ||
| - | |||
| - | var shippedNote = String.Format(" | ||
| - | dolibarr.UpdateNote(Shipment["/ | ||
| - | |||
| - | End_PostShip: | ||
| - | LogInfo(String.Format(" | ||
| - | LogDebug(Shipment.Xml); | ||
| - | return base.PostShip(ref Shipment); | ||
| - | } | ||
| - | } | ||
| - | </ | ||