Suppress Serial Dialog Selection in Sales Order  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Suppress Serial Dialog Selection in Sales Order

Postby SBarnes » Sun Feb 19, 2017 8:47 am

Hi Guys,

I have a plugin in 7.175 that is similar to the move lines plugin, except that is does a number of other things as part of its processing. This plugin has been working fine and attaches to the creation of a sales order in the sales order form and brings a selection of lines across.

The problem now comes in bringing over lines where serial numbers are involved as immediately the serial dialog selection is shown when AddInventoryItem is called on the lines collection.

How can I suppress the form event from firing and stop showing the dialog, as the only idea I have at present to try is getting in at the Setup Before Handler and try using a flag to say certain code is being called and using a ClientCancelledException if this can be made to work?

I also am bringing the serials selected in the previous order over as well.

By the way this is all happening in memory so the user can still cancel everything by cancelling the new order so the way move lines works is completely different.

Thanks for any help.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Suppress Serial Dialog Selection in Sales Order  Topic is solved

Postby Mike.Sheen » Sun Feb 19, 2017 12:45 pm

Hi Stuart,

There is a property of the sales order line class - SalesOrderSerialStockSelectionType - you just need to set that to be e_SalesOrderSerialStockSelectionFIFO when appropriate. This will force serial selection to be FIFO based instead of prompting - and if you don't want it to select stock at all (say you've got your own logic for that), then just set the quantity delivered to 0 and it will return all the stock it did take, and you can then add the stock (linedetails) as desired.

Code: Select all
 public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
   if (JiwaForm is JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm)
   {
      var salesOrderForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm)JiwaForm;         
      salesOrderForm.SalesOrder.SalesOrderLines.Added += SalesOrderLines_Added;
      salesOrderForm.SalesOrder.SalesOrderLines.ReadEnd += SalesOrder_Read;
   }
}

public void SalesOrderLines_Added(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine salesOrderLine)
{
   salesOrderLine.SalesOrderSerialStockSelectionType = JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine.SalesOrderSerialStockSelectionTypes.e_SalesOrderSerialStockSelectionFIFO;
}

public void SalesOrder_Read(object sender, System.EventArgs e)
{
   var salesOrder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)sender;
   
   foreach(JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine salesOrderLine in salesOrder.SalesOrderLines)
   {
      salesOrderLine.SalesOrderSerialStockSelectionType = JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine.SalesOrderSerialStockSelectionTypes.e_SalesOrderSerialStockSelectionFIFO;
   }
}


Sample plugin attached.

Mike
Attachments
Plugin Sales Orders - Force FIFO.xml
Sample Plugin
(31.77 KiB) Downloaded 153 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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Suppress Serial Dialog Selection in Sales Order

Postby SBarnes » Mon Feb 20, 2017 7:08 am

Hi Mike

Firstly as always thanks for the quick and detailed reply.

The only change I needed to make was to declare a variable called ProcessingConsolidation and add the code below to each handler so that Jiwa would behave normally(show the serial selection dialog) except when the move/consolidation code was running.

Code: Select all
   if (!ProcessingConsolidation)
      {
         return;
      }



PS. Not that it really matters as I just check back after a post but the email notifications has stopped working again, I thought you would want to know after the time you spent fixing it previously but please don't spend any more time on it as I imagine you have plenty of other things to do and checking back is not a major issue.

Thanks again for the help.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1620
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests