Hans,

I think this change may have broken the ordermgr orderview page for purchase orders. I'm getting an undefined error with this new OrderReadHelper method. Would you mind trying it out?

Si
--- Begin Message ---
Author: hansbak
Date: Mon Mar 12 21:18:14 2007
New Revision: 517520

URL: http://svn.apache.org/viewvc?view=rev&rev=517520
Log:
show quantity picked on orderView screen to indicate quantity  modifications to 
the order could cause problems.

Modified:
    ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl
    
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl

Modified: ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties?view=diff&rev=517520&r1=517519&r2=517520
==============================================================================
--- ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties 
(original)
+++ ofbiz/trunk/applications/ecommerce/config/EcommerceUiLabels.properties Mon 
Mar 12 21:18:14 2007
@@ -412,6 +412,7 @@
 OrderPurchaseOrderNumber=Purchase Order Number
 OrderQtyCanceled=Qty Cancelled
 OrderQtyOrdered=Qty Ordered
+OrderQtyPicked=Qty Picked
 OrderQtyShipped=Qty Shipped
 OrderQuote=Quote
 OrderReason=Reason

Modified: 
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl?view=diff&rev=517520&r1=517519&r2=517520
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl 
(original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/orderitems.ftl 
Mon Mar 12 21:18:14 2007
@@ -36,6 +36,7 @@
             <td width="35%" align="left"><span 
class="tableheadtext"><b>${uiLabelMap.EcommerceProduct}</b></span></td>         
      
             <#if maySelectItems?default("N") == "Y">
               <td width="10%" align="right"><span 
class="tableheadtext"><b>${uiLabelMap.OrderQtyOrdered}</b></span></td>
+              <td width="10%" align="right"><span 
class="tableheadtext"><b>${uiLabelMap.OrderQtyPicked}</b></span></td>
               <td width="10%" align="right"><span 
class="tableheadtext"><b>${uiLabelMap.OrderQtyShipped}</b></span></td>
               <td width="10%" align="right"><span 
class="tableheadtext"><b>${uiLabelMap.OrderQtyCanceled}</b></span></td>
             <#else>
@@ -135,6 +136,11 @@
                 </td>
                 <#if maySelectItems?default("N") == "Y">
                 <td align="right" valign="top">
+                  <#assign pickedQty = 
localOrderReadHelper.getItemPickedQuantityBd(orderItem)>
+                  <div class="tabletext"><#if pickedQty gt 0 && 
orderHeader.statusId == "ORDER_APPROVED"><font 
color="red">${pickedQty?default(0)?string.number}</font><#else>${pickedQty?default(0)?string.number}</#if>
+                  </div>
+                </td>
+                <td align="right" valign="top">
                   <#assign shippedQty = 
localOrderReadHelper.getItemShippedQuantity(orderItem)>
                   <div 
class="tabletext">${shippedQty?default(0)?string.number}</div>
                 </td>
@@ -158,7 +164,7 @@
                 </td>                    
                 <#if maySelectItems?default("N") == "Y">
                   <td>&nbsp;</td>
-                  <#if (orderHeader.statusId != "ORDER_SENT" && 
orderItem.statusId != "ITEM_COMPLETED" && orderItem.statusId != 
"ITEM_CANCELLED")>
+                  <#if (orderHeader.statusId != "ORDER_SENT" && 
orderItem.statusId != "ITEM_COMPLETED" && orderItem.statusId != 
"ITEM_CANCELLED" && pickedQty == 0)>
                     <td><a 
href="<@ofbizUrl>cancelOrderItem?orderId=${orderItem.orderId}&amp;orderItemSeqId=${orderItem.orderItemSeqId}</@ofbizUrl>"
 class="buttontext">${uiLabelMap.CommonCancel}</a></td>
                   <#else>
                     <td>&nbsp;</td>

Modified: 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?view=diff&rev=517520&r1=517519&r2=517520
==============================================================================
--- 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java 
(original)
+++ 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java 
Mon Mar 12 21:18:14 2007
@@ -1989,6 +1989,35 @@
         return getOrderBackorderQuantityBd().doubleValue();
     }
 
+    public BigDecimal getItemPickedQuantityBd(GenericValue orderItem) {
+        BigDecimal quantityPicked = ZERO;
+        EntityConditionList pickedConditions = new 
EntityConditionList(UtilMisc.toList(
+                new EntityExpr("orderId", EntityOperator.EQUALS, 
orderItem.get("orderId")),
+                new EntityExpr("orderItemSeqId", EntityOperator.EQUALS, 
orderItem.getString("orderItemSeqId")),
+                new EntityExpr("statusId", EntityOperator.NOT_EQUAL, 
"PICKLIST_CANCELLED")),
+                EntityOperator.AND);
+        
+        List picked = null;
+        try {
+               picked = 
orderHeader.getDelegator().findByCondition("PicklistAndBinAndItem", 
pickedConditions, null, null);
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+            this.orderHeader = null;
+        }
+
+        if (picked != null) {
+            Iterator i = picked.iterator();
+            while (i.hasNext()) {
+                GenericValue pickedItem = (GenericValue) i.next();
+                BigDecimal issueQty = pickedItem.getBigDecimal("quantity");
+                if (issueQty != null) {
+                    quantityPicked = 
quantityPicked.add(issueQty).setScale(scale, rounding);
+                }
+            }
+        }
+        return quantityPicked.setScale(scale, rounding);
+    }
+
     public BigDecimal getItemShippedQuantityBd(GenericValue orderItem) {
         BigDecimal quantityShipped = ZERO;
         List issuance = getOrderItemIssuances(orderItem);

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?view=diff&rev=517520&r1=517519&r2=517520
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl 
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Mon Mar 
12 21:18:14 2007
@@ -58,6 +58,7 @@
             <#list orderItemList as orderItem>
               <#assign orderItemContentWrapper = 
Static["org.ofbiz.order.order.OrderContentWrapper"].makeOrderContentWrapper(orderItem,
 request)>
               <#assign orderItemShipGrpInvResList = 
orderReadHelper.getOrderItemShipGrpInvResList(orderItem)>
+              <#assign pickedQty = 
orderReadHelper.getItemPickedQuantityBd(orderItem)>
               <tr><td colspan="8"><hr class="sepbar"/></td></tr>
               <tr>
                 <#assign orderItemType = 
orderItem.getRelatedOne("OrderItemType")?if_exists>
@@ -171,6 +172,7 @@
                         <td>
                           <div class="tabletext">${uiLabelMap.OrderShipRequest}
                           
:&nbsp;${orderReadHelper.getItemReservedQuantity(orderItem)}&nbsp;&nbsp;</div>
+                          <div class="tabletext"><#if pickedQty gt 0 && 
orderHeader.statusId == "ORDER_APPROVED"><font 
color="red">${uiLabelMap.OrderQtyPicked}:&nbsp;${pickedQty?default(0)?string.number}</font><#else>${uiLabelMap.OrderQtyPicked}:&nbsp;${pickedQty?default(0)?string.number}</#if>&nbsp;&nbsp;</div>
                           <div 
class="tabletext">${uiLabelMap.OrderQtyShipped}:&nbsp;${shippedQuantity}&nbsp;&nbsp;</div>
                           <div 
class="tabletext">${uiLabelMap.OrderOutstanding}:&nbsp;
                           <#-- Make sure digital goods without shipments don't 
always remainn "outstanding": if item is completed, it must have no outstanding 
quantity.  -->



--- End Message ---

Reply via email to