Stocktake - add line  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Stocktake - add line

Postby perry » Mon Sep 18, 2017 1:12 pm

Hi,
v7.0.157

Can you please advise if it is possible to add stock take lines from code?

I'm trying add new line to stock take by stocktake.StockTakeLines.Add(item as JiwaStockTake.StockTakeLine) method
However, I get stuck at initializing a new JiwaStockTake.StockTakeLine record, "InventoryID" property is read only

What I'm trying to do is to generate the stock take without zero SOH, then allow user to append additional lines (where SOH = 0 and count > 0).




Regards,
Perry Ma
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Stocktake - add line  Topic is solved

Postby SBarnes » Tue Sep 19, 2017 8:41 am

Hi Perry,

Have a look FindStock on the stock take it doesn't clear the collection and just add items based on the criteria, it actually sets the the InventoryID which is actually internal to the stock take dll, which makes it the equivalent of read only for what you are trying to do but gives the stock take access to setting it when FindStock is called.

Mike or Scott may be able to tell another way but I think this is what you need to do.

Code: Select all
public void FindStock(string FromPartNo, string ToPartNo, string FromBinLocation, string ToBinLocation, string FromCat1, string ToCat1, string FromCat2, string ToCat2, string FromClassification, string ToClassification, bool GetZeroSOH, int MaxRows)
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Stocktake - add line

Postby perry » Tue Sep 19, 2017 1:52 pm

Hi Stuart,

Thanks for your suggestion. I saw this method and assumed it would clear existing rows.

I tested with code below and it worked perfectly. It loaded 500 lines in less than 10 secs.

Code: Select all
For Each row As DataRow In dt.Rows
    'testing
      binLocation = If(IsDBNull(row("BinLocation")), "", row("BinLocation"))
      comment = If(IsDBNull(row("Comment")), "", row("Comment"))
      partno = If(IsDBNull(row("PartNo")), "", row("PartNo"))
      If Not String.IsNullOrEmpty(partno) Then
         stock.FindStock(partno, partno, binLocation, binLocation, "", "Z", "", "Z", "", "Z", True, 1)
      End If
      
Next
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron