You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Ray Barlow (JIRA)" <ji...@apache.org> on 2007/07/03 14:38:06 UTC

[jira] Closed: (OFBIZ-1070) Packing PDF calculates wrong value for requested count with when handling multiple issuances

     [ https://issues.apache.org/jira/browse/OFBIZ-1070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ray Barlow closed OFBIZ-1070.
-----------------------------

       Resolution: Fixed
    Fix Version/s: SVN trunk

Committed rev: 552809

> Packing PDF calculates wrong value for requested count with when handling multiple issuances
> --------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1070
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1070
>             Project: OFBiz
>          Issue Type: Bug
>          Components: product
>    Affects Versions: SVN trunk
>         Environment: N/A
>            Reporter: Ray Barlow
>             Fix For: SVN trunk
>
>         Attachments: packslip.patch, packslip.patch
>
>
> If the data hangs around on the test site see order : WSCO10000  The original quantity requested was 18 for "GZ-8544 - Big Gizmo" and the packing slip shows 36 requested and 18 shipped.
> To reproduce this you just need to create an order with a product that will be allocated against more than one inventory issuance. For the WSCO10000 test order the total QOH on the product before ordering was 18 split across two inventory items one with 15 and one with 3, so I asked for a quantity 18 in the order and then once created just approved and quick shipped the whole order. View the packing slip PDF and you can see the problem.
> This is the problem code segment : PackingSlip.bsh  line 49
> ......
> // next scan the order items (via issuances) to count the quantity of each product requested
> quantityRequestedByProduct = FastMap.newInstance();
> issuances = shipment.getRelated("ItemIssuance");
> for (iter = issuances.iterator(); iter.hasNext(); ) {
>     issuance = iter.next();
>     orderItem = issuance.getRelatedOne("OrderItem");
>     productId = orderItem.get("productId");
>     requested = quantityRequestedByProduct.get(productId);
>     if (requested == null) requested = new Double(0);
>     cancelQuantity = orderItem.getDouble("cancelQuantity");
>     quantity = orderItem.getDouble("quantity");
>     requested += quantity.doubleValue() - (cancelQuantity != null ? cancelQuantity.doubleValue() : 0);
>     quantityRequestedByProduct.put(productId, requested);
> }
> ......
> I can suggest a fix easily enough: (formatting aside!)
> ...
>     requested = quantityRequestedByProduct.get(productId);
>     if (requested == null) {
>       requested = new Double(0);
>       cancelQuantity = orderItem.getDouble("cancelQuantity");
>       quantity = orderItem.getDouble("quantity");
>       requested += quantity.doubleValue() - (cancelQuantity != null ? cancelQuantity.doubleValue() : 0);
>       quantityRequestedByProduct.put(productId, requested);
>     }
> ...
> basically wrap the code block after the if in to the whole condition as I can't see a reason you'd want to recount the same product.
> I'd appreciate comment for side effects because it looks like whoever coded it in the first place kind of expected the productId to appear more than once otherwise why call "get"? Is the above fix OK or is there another scenario I'm not thinking of?
> Ray

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.