Sales line items On Demand issue  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Sales line items On Demand issue

Postby Riyaz » Fri Jan 17, 2020 11:28 am

Hi There

Have a scenario which I'm trying to understand,

Here's an example, we have a PO with just one item ABCD for a quanity of 216, our custom program processes the EDI purchase orders and jiwa automatically allocates a serial number say 1234 for the line item created for ABCD.

This then gets sent to the warehouse, and warehouse provides us back with a confirmation file, which can change the batch serial number of the inventory based on the stock on hand then, or pallet size as the pallet can only hold a certain quantity. At times what happens is that, the warehouse file, will split the quantity into two batches say 144 and 72 (with two diff serial numbers) , our program then updates the SO accordingly.

What happens now, is that when we update the SO, since the quantity is split, we then add the Line Details as accordingly, in this case two line details needs added.

What happens in Jiwa is that, it puts one of the split quantity into OnDemand, pls see attached screenshot. Can you pls advise on how do we rectify this.
Attachments
2020-01-17 11_29_32-Window.png
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Sales line items On Demand issue

Postby Mike.Sheen » Fri Jan 17, 2020 11:47 am

Riyaz wrote:s that when we update the SO, since the quantity is split, we then add the Line Details as accordingly, in this case two line details needs added.

What happens in Jiwa is that, it puts one of the split quantity into OnDemand


You'll need to show how you're updating the SO / adding the line details.

Also - is the sales order processed and are you working with multiple snapshots?
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Sales line items On Demand issue

Postby Riyaz » Fri Jan 17, 2020 11:59 am

Have attached the code snippet, couldnt put this in the code tag, kept saying 403 error
Attachments
code.txt
(9.34 KiB) Downloaded 51 times
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Sales line items On Demand issue

Postby Mike.Sheen » Fri Jan 17, 2020 4:15 pm

The 403 error is caused by the 2 occurances of this line in the code:

EmailStockShortage.png
EmailStockShortage.png (2.5 KiB) Viewed 731 times


Not related to your problem, but the forum software for some reason will 403 when that line appears in the post text, even in code block or a quote block.

EDIT: it's the keyword Alert followed by parenthesis which it has the problem which causes the 403 - probably overly cautious about avoiding Javascript embedded in the post.
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Sales line items On Demand issue

Postby Riyaz » Fri Jan 17, 2020 4:26 pm

No worries, thanks for letting me know
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Sales line items On Demand issue

Postby Riyaz » Mon Jan 20, 2020 11:31 am

Pls do let me know if you have any advise on this issue, thanks
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Sales line items On Demand issue

Postby Riyaz » Tue Jan 21, 2020 1:15 pm

Hi There

I think I might know the issue here, here's the scenario again.

Initially when the SO is created, the sales order line has only one line details record. But when we receive the warehouse confirmation, at times the batch number gets split between two batches. Hence we update the SalesOrderlines.LineDetails with each LinkID of the inventory, the first part of the below code does that, after this we use the below code to update the quantity this delivery, second part of the below code does that, here the SalesOrder.SalesOrderLines(i).LineDetails.Count returns 1 instead of 2. Can you pls advise why?

With SalesOrder
For Each SOHRow As DataRow In dsSOH.Tables("IN_SOH").Rows
Dim Quantity As Double = Math.Min(CType(SOHRow("QuantityLeft"), Double), (PickedQty - AllocQty))

If Math.Round(Quantity, 2) > 0 Then

.SalesOrderLines(i).LineDetails(.SalesOrderLines(i).LineDetails.Count).SOHID = SOHRow("LinkID").ToString
.SalesOrderLines(i).LineDetails(.SalesOrderLines(i).LineDetails.Count).DateIn = CType(SOHRow("DateIn"), DateTime)
.SalesOrderLines(i).LineDetails(.SalesOrderLines(i).LineDetails.Count).Cost = CType(SOHRow("LCostIn"), Decimal)
.SalesOrderLines(i).LineDetails(.SalesOrderLines(i).LineDetails.Count).Quantity = CDec(Quantity)
.SalesOrderLines(i).LineDetails(.SalesOrderLines(i).LineDetails.Count).ExpiryDate = CType(SOHRow("ExpiryDate"), DateTime)
.SalesOrderLines(i).LineDetails(.SalesOrderLines(i).LineDetails.Count).SerialNo = SOHRow("SerialNo").ToString
AllocQty += Quantity
.SalesOrderLines(i).Picked = True

If Math.Round(AllocQty, 2) >= Math.Round(PickedQty, 2) Then
Exit For
End If
End If
Next


For i = 1 To .SalesOrderLines.Count
Dim TotalQty As Double = 0

For j = 1 To .SalesOrderLines(i).LineDetails.Count
TotalQty += .SalesOrderLines(i).LineDetails(j).Quantity
Next

.SalesOrderLines(i).QuantityThisDelivery = CDec(TotalQty)
Next

.Save()

End With
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Sales line items On Demand issue  Topic is solved

Postby Mike.Sheen » Tue Jan 21, 2020 3:20 pm

Riyaz wrote:.SalesOrderLines(i).QuantityThisDelivery = CDec(TotalQty)


Don't set the QuantityThisDelivery property if you are setting the line details.

Doing so may cause a FIFO stock allocation, discarding your line details and populating with new ones.

If you want to manually set the Line details, when you're done call the ReAdjustDelivered method of the sales order line 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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Sales line items On Demand issue

Postby Riyaz » Tue Jan 21, 2020 3:25 pm

Thanks Mike, I'm now trying to zero the current line details and add two new line details, and I think that probably will work. Doing some testing at the moment
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest