Creating/importing a Stock Transfer from Excel  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Creating/importing a Stock Transfer from Excel

Postby DannyC » Tue Mar 30, 2021 6:12 pm

Hi,

Just about finished a plugin which will import a stock transfer from an Excel sheet.

The source sheet simply looks like this:
From PartNoTo PartNoQuantity
ExternalGHQ1235
8_FGTR4External3
PART56External10


It works pretty much OK except I need to programmatically replicate how the GUI finds the IN_SOH record to get the Available Quantity and allow me to populate the transfer quantity.
When I populate the line with transfer quantity it populates with 0 and available quantity is also 0.

In the Jiwa code I can see
Code: Select all
internal void GetInventoryDetails
& I'm assuming I need to call it? How? Or how could I populate the available quantity?
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Creating/importing a Stock Transfer from Excel

Postby Mike.Sheen » Tue Mar 30, 2021 6:33 pm

If you call the AddLine method of the Lines, it calls GetInventoryDetails for you in that.

If you're not using AddLine already, try that instead of however you're currently adding lines to the transfer.
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: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Creating/importing a Stock Transfer from Excel

Postby DannyC » Tue Mar 30, 2021 6:44 pm

OK.
I'm already using AddLine.

Should I be passing in an FromPartInventorySOHID?

EDIT: I think I have an answer. It seems I need to find a valid SOHID and pass that in to the AddLine. If I pass in an empty string it doesn't work.
What happens if there isn't enough stock on the IN_SOH record I'm using, but other records added up meet the quantity required?
Last edited by DannyC on Tue Mar 30, 2021 6:53 pm, edited 1 time in total.
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Creating/importing a Stock Transfer from Excel

Postby Mike.Sheen » Tue Mar 30, 2021 6:52 pm

Right, so you must not be providing the SOH ID to that method then.

I need to programmatically replicate how the GUI finds the IN_SOH


So the way we do that (if transferring from SOH to External) is we show a search window and get the user to select SOH records, and then call AddLine, passing in the SOH ID along with other parameters.

If your sheet you are importing doesn't have the ID's, then you could query the database and get stock using a FIFO method, and call AddLine repeatedly with the various ID's and quantities.

Are you talking about transferring from SOH to External?
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: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Creating/importing a Stock Transfer from Excel  Topic is solved

Postby DannyC » Tue Mar 30, 2021 6:58 pm

Are you talking about transferring from SOH to External?


Yep. Doing it the other direction is fine.

you could query the database and get stock using a FIFO method

Doing that now to get a valid LinkID.

call AddLine repeatedly

So to answer my last question, if I need to transfer 25 units, and IN_SOH has 3 records of 15, 7 and 3, then I need to AddLine one by one and set the Transfer quantity to match the SOH quantity until I reach my desired transfer quantity?
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Creating/importing a Stock Transfer from Excel

Postby DannyC » Wed Mar 31, 2021 11:15 am

Just to wrap this up for those playing at home, yes I needed to do another AddLine until I exhausted the available SOH records to meet my transfer quantity.

All good. Nice little plugin!
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Creating/importing a Stock Transfer from Excel

Postby Mike.Sheen » Wed Mar 31, 2021 11:48 am

If someone responds to a post of yours, I don't think it's a good idea to edit your original post (beyond minor spelling errors) - otherwise a lot of continuity gets lost - I responded to this post:

OK.
I'm already using AddLine.


And then after responding it changed to:

OK.
I'm already using AddLine.

Should I be passing in an FromPartInventorySOHID?


And then changed again to (this time at least annotated with an EDIT footnote):

OK.
I'm already using AddLine.

Should I be passing in an FromPartInventorySOHID?

EDIT: I think I have an answer. It seems I need to find a valid SOHID and pass that in to the AddLine. If I pass in an empty string it doesn't work.
What happens if there isn't enough stock on the IN_SOH record I'm using, but other records added up meet the quantity required?


Confused the hell outta me!
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: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Creating/importing a Stock Transfer from Excel

Postby DannyC » Wed Mar 31, 2021 4:56 pm

I don't think it's a good idea to edit your original post

You're assuming it was edited after you answered. Wrong.

It was edited before you answered but by the time I had hit submit/save then your reply appeared. So we must've been typing at the same time & your reply happened to hit the thread before my edit.

Let's not get our knickers in a knot, I'm not so stupid to edit a post after a response.
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
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 2 guests