Solved

Serial Numbers for Inventory Receipts

  • 7 October 2022
  • 6 replies
  • 404 views

Userlevel 4
Badge

Hi,

What is the simplest way to programatically create and allocate Lot numbers to an Inventory receipt?

I have a customisation that creates an inventory receipt, but it won’t release:

Reason for this I believe is that when you go into Line Details you see:

If I add the lot number here and click OK, the receipt will release.  What I have ascertained so far is that this process touches a lot more tables than you might think, so there is a bit going on.

 

After adding the serial number and clicking OK in the “Line Details” dialog box running

exec SearchAllTables @searchStr='77789'

on the SQL database indicates that there are six tables involved:

INItemLotSerial
INItemPlan
INLotSerialStatus
INSiteLotSerial
INTran
INTranSplit
 

I’m pretty sure that adding data into this tables directly via the customization isn’t the right way to go. 

I have tried to use the inspect cusomisation feature to understand what gets called when the OK button is pressed, but because “Line Details” is a modal dialog box this doesn’t work.  My question is where does the Method that gets called when the OK button gets click live?

For reference, I have a custom form that provides a tally sheet.  When the tally sheet is release I then create an inventory receipt.  The code I’m using to generate the inventory receipt is pretty simple shown below:

Then, inside CreateLines there is a command to generate INTran records for the lines:

And, in these are the fields being populated in the InTran record:

 

Note, that the same Production Tally form is being used to generate either Receipts or Adjustments which is why there is the conditional cast from the graph supplied to the CreateReceipt method.  

The signature of the CreateLines method is:

 

Elsewhere in the code there is a CreateAdjustment method:

 

Any help greatly appreciated,

Thanks,

John.

 

icon

Best answer by JWS539 10 October 2022, 00:43

View original

6 replies

Userlevel 4
Badge +2

There is some built in functionality to generate sequential serial numbers. If these items are coming from a manufacturing process as opposed to a purchasing process I would explore that option. In this case getting the serial numbers to use this sequential generation would be a process of automating the generation on Save or Release depending on the best use case.

If coming from purchasing how are you automating the creation of the serial numbers to match your product coming from the vendor?

Userlevel 4
Badge

Hi Troy,

Thanks for your comment.  Is helpful.  The use case is that I have a client who wants to use Acumatica for inventory control, but keep their existing manufacturing system. They are a wood manufacturer with real time optimisation around how to cut logs in the mill to minimize waste and maximize return.  So inventory comes out with an Id and lot number not generated by acumatica.

After thinking about the point you raised, I think one option would be to turn on manufacturing and create and release production orders with  a customisation.  This is a bit further than we want to go at present. We just want to create and release an inventory receipt with a specified lot number.

I have run some more testing and can distill this down to a specific technical question:

In the UI keying a new lot number into IN301000 and tabbing off the field (yellow highlight below) appears to generate the Lot serial number data

If you subsequently look in Line details you can see the new lot# and the Receipt can be released. I’m guessing the FieldUpdated event or similar might create the lot# data in the required tables

So, how do you achieve the same thing programatically ie. fire off the relevant event.  At the moment I have:

The above adds the records but doesn’t create and assign the lot number. Is it possible to trigger the same code to run that runs when the user tabs out of the LotSerialNumber field in the UI? 

Or, is it necessary to manually add records into all of the below?

INItemLotSerial
INItemPlan
INLotSerialStatus
INSiteLotSerial
INTranSplit

As far as I can tell these are all the tables that get affected.  The add records to table approach doesn’t feel right as most of acumatica customisation is about leveraging what is already there in the right way.

 

Thanks

 

Userlevel 4
Badge

Hi,  still researching.  I think this might be part of the solution maybe?

 

Looks like I need to do something with LSINTrans?  Possibly not necessary to override?

 

Userlevel 4
Badge

So,  I have spent a few more hours on this.  Couldn’t get the custom LSINTran to work.  The overrided GenerateLotNumbers method was being invoked so it was hooked in, but I don’t know what to do next to get it to apply my predefined lot numbers. Calling the function was definately doing something as <Split> got added to the INTran line.

 

Have also tried a few other things:

Attempting to get SetValueExt to fire at an appropriate time by extending INReceiptEntry to trigger the methods that occur when a user keys a Lot# into the UI.  Had a little success with this.

The only SetValueExt that produced the desired affect was FieldUpdating on INTran.qty (Test A). This doesn’t solve the issue though, but seems to suggest this type of solution might work.

So my question is how to you call SetValueExt on a field on the InTran Line from the header?  Is this possible?  I also tried the below without success:

 

In all my tests (A to D) the value of the InTran.lotSerialNbr was updated, but only the SetValueExt call from TestA was the only one that appeared to trigger FieldUpdating, FieldVerifying and FieldUpdated events.

Any ideas?

 

 

Userlevel 4
Badge

Hi,

Finally figured out a solution.  Not 100% sure this is technically the right way to achieve the result but it works.

I extended INReceiptEntry and added the code in below.  Calling this after the INTran records are created and persisted creates the Line Details and allows the Receipt to be released.  This is the case even though the below is calling a SetValueExt to update the field with the exact same lot number. 

 

Also spent some time trying to get this to work without having to persist the graph twice (once after INTran lines added, and a second time after SetValueExt on the Lot Number in the code above).  Couldn’t get this single persist approach to work so will go with what I have.

Userlevel 7
Badge

Thank you for sharing your solution with the community @JWS539 !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved