Checking for serial uniqueness  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Checking for serial uniqueness

Postby DannyC » Thu May 23, 2024 2:28 pm

If I want to write a plugin to check for the uniqueness of a serial number, it doesn't look I can just check
Code: Select all
inventory.SOHCollection.Added


Do I need to write a separate code block for GRN activation, shipment book-in activation, transfer activation, inventory transaction import, sales order credits, and every other event that writes to IN_SOH?

I could write a trigger on the database on INSERT, but I'd always thought SQL triggers are somewhat frowned upon.

For version 7.2.1
User avatar
DannyC
Senpai
Senpai
 
Posts: 641
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Checking for serial uniqueness

Postby Mike.Sheen » Thu May 23, 2024 4:15 pm

DannyC wrote:Do I need to write a separate code block for GRN activation, shipment book-in activation, transfer activation, inventory transaction import, sales order credits, and every other event that writes to IN_SOH?


Yep.

DannyC wrote:I could write a trigger on the database on INSERT, but I'd always thought SQL triggers are somewhat frowned upon.


We dislike them because where sites are poorly documented, these types of things get forgotten about. Use them at your own peril... if it is documented well it shouldn't be a problem.

We recommend sites have their own Confluence (free for up to 10 users) to document their business specific workflows with Jiwa, and within that a page for "Upgrade Checklist and Prerequsites" which, if there are triggers, should have a step to disable triggers before upgrade, and another to enable them afterwards.
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: 2452
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 758

Re: Checking for serial uniqueness  Topic is solved

Postby DannyC » Fri May 24, 2024 3:33 pm

Righto.

In that case, I've knocked up a solution based on a trigger on IN_SOH.

In my testing it seems to work well. For example, activate a GRN with a serialised item and the serialno already exists, it pops up an error generated from the trigger and the GRN remains unactivated.
Have also tried with a stock transfer and it also popped up the same error.
User avatar
DannyC
Senpai
Senpai
 
Posts: 641
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 75 guests

cron