ProcessSnapShotCreated  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

ProcessSnapShotCreated

Postby Ernst » Tue Jan 28, 2020 5:31 pm

Am trying to get to the snapshot created logic in Auto BO process. On JIWA721.

Found this code on the forum. But the AddHandler _boProcess.ProcessSnapShotCreated, says Process is not an event of JiwaBOProcess.StdFunctions, Can anybody help on how to find AddHandler _boProcess.ProcessSnapShotCreated

Thx

Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
_boProcess = TryCast(JiwaBusinessLogic, JiwaBOProcess.StdFunctions)
If _boProcess Is Nothing Then Return '

AddHandler _boProcess.ProcessSnapShotCreated, AddressOf BoProcess_SnapshotCreated

End Sub

Private Sub BoProcess_SnapshotCreated(InvoiceID As String, InvoiceHistoryID As String)
msgbox ("in BoProcess_SnapshotCreated")
End Sub
User avatar
Ernst
Kohai
Kohai
 
Posts: 216
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: ProcessSnapShotCreated  Topic is solved

Postby Mike.Sheen » Tue Jan 28, 2020 5:56 pm

The logic for processing backorders now lives in the sales order itself.

So, the sales order business logic has a method named BackorderProcess which is what gets invoked by the backorder processing form.

This BackorderProcess method raises an event, BackorderProcessStart and then proceeds to do its' thing - including, if necessary, making a new snapshot and raising the event CreatedNewSnapshot.

So, just add a handler for the BackorderProcessStart and in there add a handler for the CreatedNewSnapshot event.

Sample plugin doing this is attached.
Attachments
Plugin Auto BO Processs.xml
(27.06 KiB) Downloaded 44 times
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: ProcessSnapShotCreated

Postby Ernst » Tue Jan 28, 2020 6:41 pm

Worked great thx. Converted in good old fashioned stuff..

Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
If TypeOf JiwaBusinessLogic Is JiwaSales.SalesOrder.SalesOrder Then
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(JiwaBusinessLogic, JiwaSales.SalesOrder.SalesOrder)

AddHandler salesOrder.BackorderProcessStart, AddressOf SalesOrder_BackorderProcessStart
End If
End Sub
Private Sub SalesOrder_BackorderProcessStart(sender As Object,ByVal InvoiceLineID As String, ByVal QuantityToFulfill As Decimal)
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
AddHandler SalesOrder.CreatedNewSnapshot, AddressOf SalesOrder_CreatedNewSnapshot
End Sub
Private Sub SalesOrder_CreatedNewSnapshot(sender As Object, e As System.EventArgs)
Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
msgbox ("in Create new snapshot-Mike")
Dim SalesOrderH As JiwaSales.SalesOrder.SalesOrderHistory = salesOrder.SalesOrderHistorys(salesorder.CurrentHistoryNo)
' // If we Get here, Then it's because the backorder process ended up creating a new snapshot for the sales order
' // We don't get in here when a new snapshot is created manually because we only add a handler for the CreatedNewSnapshot event inside a BackorderProcessStart handler.
End Sub
User avatar
Ernst
Kohai
Kohai
 
Posts: 216
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: ProcessSnapShotCreated

Postby Mike.Sheen » Sat Feb 01, 2020 5:51 pm

Thanks for sharing the code converted to VB.NET - I'm sure it will help some people.

On that note, I think it's time you were educated on the Code tag which you can use in your posts to post code snippets so they are formatted correctly.

The toolbar above the post content area has a button labelled "Code":
CodeButton.PNG
CodeButton.PNG (5.38 KiB) Viewed 402 times


When you click that, it adds the [code] and [/code] BBCode tags. Text you place between those tags will be formatted as such:

Code: Select all
Public Sub Setup(ByVal JiwaBusinessLogic As JiwaApplication.IJiwaBusinessLogic, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaBusinessLogicPlugin.Setup
   If TypeOf JiwaBusinessLogic Is JiwaSales.SalesOrder.SalesOrder Then
      Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(JiwaBusinessLogic, JiwaSales.SalesOrder.SalesOrder)
      AddHandler salesOrder.BackorderProcessStart, AddressOf SalesOrder_BackorderProcessStart
   End If
End Sub

Private Sub SalesOrder_BackorderProcessStart(sender As Object,ByVal InvoiceLineID As String, ByVal QuantityToFulfill As Decimal)
   Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
   AddHandler SalesOrder.CreatedNewSnapshot, AddressOf SalesOrder_CreatedNewSnapshot
End Sub

Private Sub SalesOrder_CreatedNewSnapshot(sender As Object, e As System.EventArgs)
   Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
   msgbox ("in Create new snapshot-Mike")
   Dim SalesOrderH As JiwaSales.SalesOrder.SalesOrderHistory = salesOrder.SalesOrderHistorys(salesorder.CurrentHistoryNo)
   ' // If we Get here, Then it's because the backorder process ended up creating a new snapshot for the sales order
   ' // We don't get in here when a new snapshot is created manually because we only add a handler for the CreatedNewSnapshot event inside a BackorderProcessStart handler.
End Sub


It makes it more readable - which can only be a good thing!
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron