svn commit: r775128 - in /ofbiz/trunk/applications/product: config/ entitydef/ servicedef/ src/org/ofbiz/shipment/packing/ webapp/facility/WEB-INF/ webapp/facility/WEB-INF/actions/shipment/ webapp/facility/shipment/ widget/facility/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r775128 - in /ofbiz/trunk/applications/product: config/ entitydef/ servicedef/ src/org/ofbiz/shipment/packing/ webapp/facility/WEB-INF/ webapp/facility/WEB-INF/actions/shipment/ webapp/facility/shipment/ widget/facility/

mor-2
Author: mor
Date: Fri May 15 13:20:56 2009
New Revision: 775128

URL: http://svn.apache.org/viewvc?rev=775128&view=rev
Log:
Functionality for "Weight Packages Only" option on pack order screen.
Applied patch from Akash Jain, part of OFBIZ-2407 (https://issues.apache.org/jira/browse/OFBIZ-2407).
Note: Excluding only framework/common/config/CommonUiLabels.xml, as this need framework rights.


Modified:
    ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml
    ofbiz/trunk/applications/product/config/shipment.properties
    ofbiz/trunk/applications/product/entitydef/entitymodel.xml
    ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
    ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
    ofbiz/trunk/applications/product/widget/facility/CommonScreens.xml

Modified: ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml Fri May 15 13:20:56 2009
@@ -57,6 +57,15 @@
     <property key="ProductErrorAllOrderItemsAreNotVerified">
         <value xml:lang="en">ERROR: All order items are not verified</value>
     </property>
+    <property key="ProductErrorEnteredBothDimensionAndPackageInputBoxField">
+        <value xml:lang="en">ERROR: Entered Dimension and Package input box, both the fields cannot be processed together (should enter one of them)</value>
+    </property>
+    <property key="ProductErrorNoItemsCurrentlySetToBeShippedCannotComplete">
+        <value xml:lang="en">ERROR: No items currently set to be shipped cannot complete</value>
+    </property>
+    <property key="ProductErrorNotEnteredAllFieldsInDimension">
+        <value xml:lang="en">ERROR: Not entered all fields (length, width and height) in Dimension</value>
+    </property>
     <property key="ProductErrorInventoryItemLabelIdNotFound">
         <value xml:lang="en">Error Inventory Item Label Id Not Found</value>
         <value xml:lang="it">Errore riga etichetta inventario non trovata</value>

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Fri May 15 13:20:56 2009
@@ -73,6 +73,9 @@
     <property key="FacilityGroupName">
         <value xml:lang="en">Group Name</value>
     </property>
+    <property key="FacilityHoldShipment">
+        <value xml:lang="en">Hold Shipment</value>
+    </property>
     <property key="FacilityInventory">
         <value xml:lang="de">Inventar</value>
         <value xml:lang="en">Inventory</value>
@@ -129,6 +132,9 @@
     <property key="FacilitySelectOptionsToGroupBy">
         <value xml:lang="en">Select Options To Group</value>
     </property>
+    <property key="FacilityShip">
+        <value xml:lang="en">Ship</value>
+    </property>
     <property key="FacilityShipAvailable">
         <value xml:lang="de">Bitte liefern Sie meine bestellten Artikel sobald sie verfügbar sind (Sie dürfen zusätzliche Lieferungskosten  erheben).</value>
         <value xml:lang="en">Please ship items I ordered as they become available (you may incur additional shipping charges).</value>
@@ -142,6 +148,9 @@
         <value xml:lang="zh">当我订的明细有货时请送货 (你可能要支付额外的运费)。</value>
         <value xml:lang="zh_CN">当所订商品个别项可用时即刻发货(不是一起发货,你可能需要另付发货费用)。</value>
     </property>
+    <property key="FacilityShipmentCreatedAndMarkedAsPacked">
+        <value xml:lang="en">Shipment #${shipmentId} created and marked as packed</value>
+    </property>
     <property key="FacilityShipOnceOrAvailable">
         <value xml:lang="de">Alles zusammen liefern oder 'sobald etwas verfügbar'?</value>
         <value xml:lang="en">Ship all at once, or 'as available'?</value>
@@ -220,6 +229,9 @@
         <value xml:lang="zh">请等待整个订单都有货时再送货。</value>
         <value xml:lang="zh_CN">等待直到整个订单完成后发货。</value>
     </property>
+    <property key="FacilityWarningMessageThereIsMuchDifferenceInShippingCharges">
+        <value xml:lang="en">There is much difference in shipping charges</value>
+    </property>
     <property key="FormFieldTitle_abbrev">
         <value xml:lang="de">Abkürzung</value>
         <value xml:lang="en">Abbrev</value>
@@ -14266,6 +14278,9 @@
         <value xml:lang="th">แพคเกจ</value>
         <value xml:lang="zh">包装</value>
     </property>
+    <property key="ProductPackageInputBox">
+        <value xml:lang="en">Package input box</value>
+    </property>
     <property key="ProductPackageQty">
         <value xml:lang="de">Anzahl Pakete</value>
         <value xml:lang="en">Package Qty</value>
@@ -18026,6 +18041,9 @@
         <value xml:lang="th">รหัสประเภทการขนส่ง</value>
         <value xml:lang="zh">货运类型标识</value>
     </property>
+    <property key="ProductShipmentUomAbbreviation_LEN_in">
+        <value xml:lang="en">in</value>
+    </property>
     <property key="ProductShipmentUomAbbreviation_WT_kg">
         <value xml:lang="de">kg</value>
         <value xml:lang="en">kg</value>
@@ -20009,6 +20027,9 @@
         <value xml:lang="ru">Весовой порог</value>
         <value xml:lang="th">รหัสน้ำหนักที่เปิดเผย</value>
     </property>
+    <property key="ProductWeightPackageOnly">
+        <value xml:lang="en">Weight Package Only</value>
+    </property>
     <property key="ProductWeightTitle1">
         <value xml:lang="en">Weight charge</value>
         <value xml:lang="fr">Frais lié au poids</value>

Modified: ofbiz/trunk/applications/product/config/shipment.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/shipment.properties?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/shipment.properties (original)
+++ ofbiz/trunk/applications/product/config/shipment.properties Fri May 15 13:20:56 2009
@@ -34,6 +34,8 @@
 shipment.default.dimension.uom=LEN_in
 shipment.default.weight.value=1
 
+shipment.default.cost_actual_over_estimated_percent_allowed=10
+
 ############################################
 # UPS XPCI Configuration
 ############################################

Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Fri May 15 13:20:56 2009
@@ -956,6 +956,7 @@
         <field name="openedDate" type="date-time"></field>
         <field name="closedDate" type="date-time"></field>
         <field name="description" type="description"></field>
+        <field name="defaultDimensionUomId" type="id"><description>This field store the unit of measurement of dimension (length, width and height)</description></field>
         <field name="defaultWeightUomId" type="id"></field>
         <field name="geoPointId" type="id"></field>
         <prim-key field="facilityId"/>
@@ -974,7 +975,10 @@
         <relation type="one" fk-name="FAC_INVITM_TYPE" title="Default" rel-entity-name="InventoryItemType">
             <key-map field-name="defaultInventoryItemTypeId" rel-field-name="inventoryItemTypeId"/>
         </relation>
-        <relation type="one" fk-name="FAC_DEF_UOM" rel-entity-name="Uom">
+        <relation type="one" fk-name="FAC_DEF_DUOM" title="Dimension" rel-entity-name="Uom">
+            <key-map field-name="defaultDimensionUomId" rel-field-name="uomId"/>
+        </relation>
+        <relation type="one" fk-name="FAC_DEF_WUOM" title="Weight" rel-entity-name="Uom">
             <key-map field-name="defaultWeightUomId" rel-field-name="uomId"/>
         </relation>
         <relation type="one-nofk" rel-entity-name="ProductStore">

Modified: ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml Fri May 15 13:20:56 2009
@@ -1019,6 +1019,10 @@
       <field name="shipmentPackageSeqId" type="id-ne"></field>
       <field name="shipmentBoxTypeId" type="id"></field>
       <field name="dateCreated" type="date-time"></field>
+      <field name="length" type="fixed-point"><description>This field store the length of package</description></field>
+      <field name="height" type="fixed-point"><description>This field store the height of package</description></field>
+      <field name="width" type="fixed-point"><description>This field store the width of package</description></field>
+      <field name="dimensionUomId" type="id"><description>This field store the unit of measurement of dimension (length, width and height)</description></field>
       <field name="weight" type="fixed-point"></field>
       <field name="weightUomId" type="id"></field>
       <field name="insuredValue" type="currency-amount"></field>
@@ -1033,6 +1037,9 @@
       <relation type="many" rel-entity-name="CarrierShipmentBoxType">
         <key-map field-name="shipmentBoxTypeId"/>
       </relation>
+      <relation type="one" fk-name="SHPKG_DUOM" title="Dimension" rel-entity-name="Uom">
+        <key-map field-name="dimensionUomId" rel-field-name="uomId"/>
+      </relation>
       <relation type="one" fk-name="SHPKG_WUOM" title="Weight" rel-entity-name="Uom">
         <key-map field-name="weightUomId" rel-field-name="uomId"/>
       </relation>

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Fri May 15 13:20:56 2009
@@ -558,6 +558,51 @@
         <attribute name="packageSeqId" type="Integer" mode="IN" optional="false"/>
     </service>
 
+    <service name="weightPackage" engine="java"
+            location="org.ofbiz.shipment.packing.PackingServices" invoke="weightPackage" auth="true">
+        <description>Set the dimension and weight of packages in the ShipmentPackage entity</description>
+        <attribute name="packingSession" type="org.ofbiz.shipment.packing.PackingSession" mode="IN" optional="false"/>
+        <attribute name="packageWeight" type="String" mode="IN" optional="true"/>
+        <attribute name="packageLength" type="String" mode="IN" optional="true"/>
+        <attribute name="packageWidth" type="String" mode="IN" optional="true"/>
+        <attribute name="packageHeight" type="String" mode="IN" optional="true"/>
+        <attribute name="packageSeqId" type="String" mode="IN" optional="true"/>
+        <attribute name="shipmentBoxTypeId" type="String" mode="IN" optional="true"/>
+        <attribute name="weightPackageSeqId" type="String" mode="IN" optional="true"/>
+        <attribute name="dimensionSavedInSession" type="Boolean" mode="OUT" optional="true"/>
+    </service>
+
+    <service name="completePackage" engine="java"
+            location="org.ofbiz.shipment.packing.PackingServices" invoke="completePackage" auth="true">
+        <description>Complete the packging and set the shipment to packed</description>
+        <attribute name="packingSession" type="org.ofbiz.shipment.packing.PackingSession" mode="IN" optional="false"/>
+        <attribute name="packageWeights" type="Map" string-map-prefix="packageWeight_" mode="IN" optional="true"/>
+        <attribute name="orderId" type="String" mode="IN" optional="true"/>
+        <attribute name="invoiceId" type="String" mode="IN" optional="true"/>
+        <attribute name="dimensionUomId" type="String" mode="IN" optional="true"/>
+        <attribute name="weightUomId" type="String" mode="IN" optional="true"/>
+        <attribute name="shippingContactMechId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentMethodTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="carrierPartyId" type="String" mode="IN" optional="false"/>
+        <attribute name="carrierRoleTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="productStoreId" type="String" mode="IN" optional="false"/>
+        <attribute name="shipmentCostEstimateForShipGroup" type="String" mode="IN" optional="true"/>
+        <attribute name="pickerPartyId" type="String" mode="IN" optional="true"/>
+        <attribute name="forceComplete" type="Boolean" mode="IN" optional="true"/>
+        <attribute name="shipmentId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="showWarningForm" type="Boolean" mode="OUT" optional="true"/>
+    </service>
+
+    <service name="holdShipment" engine="java"
+            location="org.ofbiz.shipment.packing.PackingServices" invoke="holdShipment" auth="true">
+        <description>Shipment will remains in PICKED sataus and dimension and weight will save in the ShipmentPackage entity</description>
+        <attribute name="packingSession" type="org.ofbiz.shipment.packing.PackingSession" mode="IN" optional="false"/>
+        <attribute name="facilityId" type="String" mode="IN" optional="true"/>
+        <attribute name="shipmentId" type="String" mode="IN" optional="false"/>
+        <attribute name="dimensionUomId" type="String" mode="IN" optional="true"/>
+        <attribute name="weightUomId" type="String" mode="IN" optional="true"/>
+    </service>
+
     <service name="completePack" engine="java"
             location="org.ofbiz.shipment.packing.PackingServices" invoke="completePack" auth="true">
         <description>Complete the packaging set the shipment to PACKED</description>
@@ -570,6 +615,7 @@
         <attribute name="additionalShippingCharge" type="BigDecimal" mode="IN" optional="true"/>
         <attribute name="forceComplete" type="Boolean" mode="IN" optional="true"/>
         <attribute name="packageWeights" type="Map" string-map-prefix="packageWeight_" mode="IN" optional="true"/>
+        <attribute name="dimensionUomId" type="String" mode="IN" optional="true"/>
         <attribute name="weightUomId" type="String" mode="IN" optional="true"/>
         <attribute name="shipmentId" type="String" mode="OUT" optional="false"/>
     </service>

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java Fri May 15 13:20:56 2009
@@ -24,11 +24,13 @@
 import java.util.Map;
 
 import javolution.util.FastList;
+import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilNumber;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericDelegator;
@@ -41,6 +43,7 @@
 
     public static final String module = PackingServices.class.getName();
     private static BigDecimal ZERO = BigDecimal.ZERO;
+    private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
 
     public static Map<String, Object> addPackLine(DispatchContext dctx, Map<String, ? extends Object> context) {
         GenericDelegator delegator = dctx.getDelegator();
@@ -317,6 +320,135 @@
         return result;
     }
 
+    public static Map<String, Object> weightPackage(DispatchContext dctx, Map<String, ? extends Object> context) {
+        PackingSession session = (PackingSession) context.get("packingSession");
+        Locale locale = (Locale) context.get("locale");
+        String packageLength = (String) context.get("packageLength");
+        String packageWidth = (String) context.get("packageWidth");
+        String packageHeight = (String) context.get("packageHeight");
+        String packageSeqId = (String) context.get("packageSeqId");
+        String packageWeight = (String) context.get("packageWeight");
+        String shipmentBoxTypeId = (String) context.get("shipmentBoxTypeId");
+        String weightPackageSeqId = (String) context.get("weightPackageSeqId");
+
+        // User can either enter all the dimensions or shipment box type, but not both
+        if (UtilValidate.isNotEmpty(packageLength) || UtilValidate.isNotEmpty(packageWidth) || UtilValidate.isNotEmpty(packageHeight)) { // Check if user entered any dimensions
+            if (UtilValidate.isNotEmpty(shipmentBoxTypeId)) { // check also if user entered shipment box type
+                session.setDimensionAndShipmentBoxType(packageSeqId);
+                return ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorEnteredBothDimensionAndPackageInputBoxField", locale));
+            } else if (!(UtilValidate.isNotEmpty(packageLength) && UtilValidate.isNotEmpty(packageWidth) && UtilValidate.isNotEmpty(packageHeight))) { // check if user does not enter all the dimensions
+                session.setDimensionAndShipmentBoxType(packageSeqId);
+                return ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNotEnteredAllFieldsInDimension", locale));
+            }
+        }
+
+        BigDecimal shippableWeight = ZERO;
+        Map<String, Object> response = FastMap.newInstance();
+
+        session.setPackageLength(packageSeqId, packageLength);
+        session.setPackageWidth(packageSeqId, packageWidth);
+        session.setPackageHeight(packageSeqId, packageHeight);
+        session.setShipmentBoxTypeId(packageSeqId, shipmentBoxTypeId);
+
+        if (UtilValidate.isNotEmpty(packageWeight)) {
+            BigDecimal packWeight = new BigDecimal(packageWeight);
+            session.setPackageWeight(Integer.parseInt(packageSeqId), packWeight);
+            shippableWeight = shippableWeight.add(packWeight);
+        } else {
+            session.setPackageWeight(Integer.parseInt(packageSeqId), null);
+        }
+        session.setWeightPackageSeqId(packageSeqId, weightPackageSeqId);
+        response.put("dimensionSavedInSession", true);
+        return response;
+    }
+
+    public static Map<String, Object> holdShipment(DispatchContext dctx, Map<String, ? extends Object> context) {
+        PackingSession session = (PackingSession) context.get("packingSession");
+        String shipmentId = (String) context.get("shipmentId");
+        String dimensionUomId = (String) context.get("dimensionUomId");
+        String weightUomId = (String) context.get("weightUomId");
+        try {
+            session.setDimensionUomId(dimensionUomId);
+            session.setWeightUomId(weightUomId);
+            session.createPackages(shipmentId);
+            session.clearAllLines();
+        } catch (GeneralException e) {
+            return ServiceUtil.returnError(e.getMessage(), e.getMessageList());
+        }
+        return ServiceUtil.returnSuccess();
+    }
+
+    public static Map<String, Object> completePackage(DispatchContext dctx, Map<String, ? extends Object> context) {
+        GenericDelegator delegator = dctx.getDelegator();
+        PackingSession session = (PackingSession) context.get("packingSession");
+        Locale locale = (Locale) context.get("locale");
+        Map<String, String> packageWeights = UtilGenerics.checkMap(context.get("packageWeights"));
+
+        String orderId = (String) context.get("orderId");
+        String shipmentId = (String) context.get("shipmentId");
+        String invoiceId = (String) context.get("invoiceId");
+        String productStoreId = (String) context.get("productStoreId");
+        String pickerPartyId = (String) context.get("pickerPartyId");
+        String carrierPartyId = (String) context.get("carrierPartyId");
+        String carrierRoleTypeId = (String) context.get("carrierRoleTypeId");
+        String shippingContactMechId = (String) context.get("shippingContactMechId");
+        String shipmentMethodTypeId = (String) context.get("shipmentMethodTypeId");
+        String dimensionUomId = (String) context.get("dimensionUomId");
+        String weightUomId = (String) context.get("weightUomId");
+        Boolean forceComplete = (Boolean) context.get("forceComplete");
+
+        String shipmentCostEstimateForShipGroup = (String) context.get("shipmentCostEstimateForShipGroup");
+        BigDecimal estimatedShipCost = new BigDecimal(shipmentCostEstimateForShipGroup);
+
+        BigDecimal doEstimates = new BigDecimal(UtilProperties.getPropertyValue("shipment.properties", "shipment.default.cost.actual_over_estimated_percent_allowed", "10"));
+
+        Map<String, Object> response = FastMap.newInstance();
+        BigDecimal diffInShipCostInPerc = ZERO;
+
+        BigDecimal shippableWeight = setSessionPackageWeights(session, packageWeights);
+        BigDecimal newEstimatedShipCost = session.getShipmentCostEstimate(shippingContactMechId, shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId, productStoreId, null, null, shippableWeight, null);
+
+        session.setAdditionalShippingCharge(newEstimatedShipCost);
+        session.setDimensionUomId(dimensionUomId);
+        session.setWeightUomId(weightUomId);
+        session.setPickerPartyId(pickerPartyId);
+        session.setShipmentId(shipmentId);
+        session.setInvoiceId(invoiceId);
+
+        try {
+            session.checkPackedQty(orderId, locale);
+            FastList<GenericValue> shipments = (FastList) delegator.findByAnd("Shipment", UtilMisc.toMap("primaryOrderId", orderId, "statusId", "SHIPMENT_PACKED"));
+            for (GenericValue shipment : shipments) {
+                BigDecimal additionalShippingCharge = shipment.getBigDecimal("additionalShippingCharge");
+                if (UtilValidate.isNotEmpty(additionalShippingCharge)) {
+                    newEstimatedShipCost = newEstimatedShipCost.add(shipment.getBigDecimal("additionalShippingCharge"));
+                }
+            }
+            diffInShipCostInPerc = (((newEstimatedShipCost.subtract(estimatedShipCost)).divide(estimatedShipCost, 2, rounding)).multiply(new BigDecimal(100))).abs();
+            if (doEstimates.compareTo(diffInShipCostInPerc) == -1) {
+                response.put("showWarningForm", true);
+            } else {
+                if (forceComplete == null) {
+                    forceComplete = Boolean.FALSE;
+                }
+                try {
+                    shipmentId = session.complete(forceComplete, orderId, locale);
+                } catch (GeneralException e) {
+                    return ServiceUtil.returnError(e.getMessage(), e.getMessageList());
+                }
+                if (UtilValidate.isEmpty(shipmentId)) {
+                    response = ServiceUtil.returnError(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNoItemsCurrentlySetToBeShippedCannotComplete", locale));
+                } else {
+                    response = ServiceUtil.returnSuccess(UtilProperties.getMessage("ProductUiLabels", "FacilityShipmentCreatedAndMarkedAsPacked", UtilMisc.toMap("shipmentId", shipmentId), locale));
+                }
+                response.put("shipmentId", shipmentId);
+                response.put("showWarningForm", false);
+            }
+        } catch (GeneralException e) {
+            return ServiceUtil.returnError(e.getMessage(), e.getMessageList());
+        }
+        return response;
+    }
 
     public static Map<String, Object> completePack(DispatchContext dctx, Map<String, ? extends Object> context) {
         PackingSession session = (PackingSession) context.get("packingSession");
@@ -330,12 +462,14 @@
         String pickerPartyId = (String) context.get("pickerPartyId");
         BigDecimal additionalShippingCharge = (BigDecimal) context.get("additionalShippingCharge");
         Map<String, String> packageWeights = UtilGenerics.checkMap(context.get("packageWeights"));
+        String dimensionUomId = (String) context.get("dimensionUomId");
         String weightUomId = (String) context.get("weightUomId");
         session.setShipmentId(shipmentId);
         session.setInvoiceId(invoiceId);
         session.setHandlingInstructions(instructions);
         session.setPickerPartyId(pickerPartyId);
         session.setAdditionalShippingCharge(additionalShippingCharge);
+        session.setDimensionUomId(dimensionUomId);
         session.setWeightUomId(weightUomId);
         setSessionPackageWeights(session, packageWeights);
 

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Fri May 15 13:20:56 2009
@@ -61,6 +61,7 @@
     protected String facilityId = null;
     protected String shipmentId = null;
     protected String instructions = null;
+    protected String dimensionUomId = null;
     protected String weightUomId = null;
     protected String invoiceId = null;
     protected BigDecimal additionalShippingCharge = null;
@@ -387,6 +388,16 @@
         return this.packLines;
     }
 
+    public PackingSessionLine getLine(int packageSeqId) {
+        PackingSessionLine packLine = null;
+        for (PackingSessionLine line : this.getLines()) {
+            if ((line.getPackageSeq()) == packageSeqId) {
+                packLine = line;
+            }
+        }
+        return packLine;
+    }
+
     public int nextPackageSeq() {
         return ++packageSeq;
     }
@@ -623,6 +634,7 @@
         this.primaryShipGrp = null;
         this.additionalShippingCharge = null;
         if (this.packageWeights != null) this.packageWeights.clear();
+        this.dimensionUomId = null;
         this.weightUomId = null;
         this.packageSeq = 1;
         this.status = 1;
@@ -817,12 +829,17 @@
 
     protected void createPackages() throws GeneralException {
         for (int i = 0; i < packageSeq; i++) {
+            PackingSessionLine line = this.getLine(i+1);
             String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i+1, 5);
 
             Map<String, Object> pkgCtx = FastMap.newInstance();
             pkgCtx.put("shipmentId", shipmentId);
             pkgCtx.put("shipmentPackageSeqId", shipmentPackageSeqId);
-            //pkgCtx.put("shipmentBoxTypeId", "");
+            pkgCtx.put("length", line.getLength());
+            pkgCtx.put("width", line.getWidth());
+            pkgCtx.put("height", line.getHeight());
+            pkgCtx.put("dimensionUomId", getDimensionUomId());
+            pkgCtx.put("shipmentBoxTypeId", line.getShipmentBoxTypeId());
             pkgCtx.put("weight", getPackageWeight(i+1));
             pkgCtx.put("weightUomId", getWeightUomId());
             pkgCtx.put("userLogin", userLogin);
@@ -977,6 +994,14 @@
         this.weightUomId = weightUomId;
     }
 
+    public String getDimensionUomId() {
+        return dimensionUomId;
+    }
+
+    public void setDimensionUomId(String dimensionUomId) {
+        this.dimensionUomId = dimensionUomId;
+    }
+
     public List<Integer> getPackageSeqIds() {
         Set<Integer> packageSeqIds = new TreeSet<Integer>();
         if (! UtilValidate.isEmpty(this.getLines())) {
@@ -1012,6 +1037,140 @@
         setPackageWeight(packageSeqId, newPackageWeight);
     }
 
+    public void setPackageLength(String packageSeqId, String packageLength) {
+        if (UtilValidate.isNotEmpty(packageSeqId)) {
+            PackingSessionLine packLine = this.getLine(Integer.parseInt(packageSeqId));
+            if (UtilValidate.isNotEmpty(packageLength)) {
+                packLine.setLength(new BigDecimal(packageLength));
+            }
+        }
+    }
+
+    public BigDecimal getPackageLength(int packageSeqId) {
+        BigDecimal packageLength = null;
+        PackingSessionLine packLine = this.getLine(packageSeqId);
+        if (UtilValidate.isNotEmpty(packLine)) {
+            packageLength = packLine.getLength();
+        }
+        return packageLength;
+    }
+
+    public void setPackageWidth(String packageSeqId, String packageWidth) {
+        if (UtilValidate.isNotEmpty(packageSeqId)) {
+            PackingSessionLine packLine = this.getLine(Integer.parseInt(packageSeqId));
+            if (UtilValidate.isNotEmpty(packageWidth)) {
+                packLine.setWidth(new BigDecimal(packageWidth));
+            }
+        }
+    }
+
+    public BigDecimal getPackageWidth(int packageSeqId) {
+        BigDecimal packageWidth = null;
+        PackingSessionLine packLine = this.getLine(packageSeqId);
+        if (UtilValidate.isNotEmpty(packLine)) {
+            packageWidth = packLine.getWidth();
+        }
+        return packageWidth;
+    }
+
+    public void setPackageHeight(String packageSeqId, String packageHeight) {
+        if (UtilValidate.isNotEmpty(packageSeqId)) {
+            PackingSessionLine packLine = this.getLine(Integer.parseInt(packageSeqId));
+            if (UtilValidate.isNotEmpty(packageHeight)) {
+                packLine.setHeight(new BigDecimal(packageHeight));
+            }
+        }
+    }
+
+    public BigDecimal getPackageHeight(int packageSeqId) {
+        BigDecimal packageHeight = null;
+        PackingSessionLine packLine = this.getLine(packageSeqId);
+        if (UtilValidate.isNotEmpty(packLine)) {
+            packageHeight = packLine.getHeight();
+        }
+        return packageHeight;
+    }
+
+    public void setShipmentBoxTypeId(String packageSeqId, String shipmentBoxTypeId) {
+        if (UtilValidate.isNotEmpty(packageSeqId)) {
+            PackingSessionLine packLine = this.getLine(Integer.parseInt(packageSeqId));
+            if (UtilValidate.isNotEmpty(shipmentBoxTypeId)) {
+                packLine.setShipmentBoxTypeId(shipmentBoxTypeId);
+            }
+        }
+    }
+
+    public String getShipmentBoxTypeId(int packageSeqId) {
+        String shipmentBoxTypeId = null;
+        PackingSessionLine packLine = this.getLine(packageSeqId);
+        if (UtilValidate.isNotEmpty(packLine)) {
+            shipmentBoxTypeId = packLine.getShipmentBoxTypeId();
+        }
+        return shipmentBoxTypeId;
+    }
+
+    public void setWeightPackageSeqId(String packageSeqId, String weightPackageSeqId) {
+        if (UtilValidate.isNotEmpty(packageSeqId)) {
+            PackingSessionLine packLine = this.getLine(Integer.parseInt(packageSeqId));
+            if (UtilValidate.isNotEmpty(weightPackageSeqId)) {
+                packLine.setWeightPackageSeqId(weightPackageSeqId);
+            }
+        }
+    }
+
+    public int getWeightPackageSeqId(int packageSeqId) {
+        int weightPackageSeqId = -1;
+        if (UtilValidate.isNotEmpty(this.getLine(packageSeqId))) {
+            if (UtilValidate.isNotEmpty(this.getLine(packageSeqId).getWeightPackageSeqId()))
+                weightPackageSeqId = Integer.parseInt(this.getLine(packageSeqId).getWeightPackageSeqId());
+        }
+        return weightPackageSeqId;
+    }
+
+    protected void createPackages(String shipmentId) throws GeneralException {
+        List<GenericValue> shipmentPackageRouteSegs = this.getDelegator().findByAnd("ShipmentPackageRouteSeg", UtilMisc.toMap("shipmentId", shipmentId));
+        if (UtilValidate.isNotEmpty(shipmentPackageRouteSegs)) {
+            for (GenericValue shipmentPackageRouteSeg : shipmentPackageRouteSegs) {
+                shipmentPackageRouteSeg.remove();
+            }
+        }
+        List<GenericValue> shipmentPackages = this.getDelegator().findByAnd("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId));
+        if (UtilValidate.isNotEmpty(shipmentPackages)) {
+            for (GenericValue shipmentPackage : shipmentPackages) {
+                shipmentPackage.remove();
+            }
+        }
+        for (int i = 0; i < packageSeq; i++) {
+            PackingSessionLine line = this.getLine(i+1);
+            String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i+1, 5);
+            Map<String, Object> shipmentPackageCtx = FastMap.newInstance();
+            shipmentPackageCtx.put("shipmentId", shipmentId);
+            shipmentPackageCtx.put("shipmentPackageSeqId", shipmentPackageSeqId);
+            shipmentPackageCtx.put("length", line.getLength());
+            shipmentPackageCtx.put("width", line.getWidth());
+            shipmentPackageCtx.put("height", line.getHeight());
+            shipmentPackageCtx.put("dimensionUomId", getDimensionUomId());
+            shipmentPackageCtx.put("shipmentBoxTypeId", line.getShipmentBoxTypeId());
+            shipmentPackageCtx.put("weight", getPackageWeight(i+1));
+            shipmentPackageCtx.put("weightUomId", getWeightUomId());
+            shipmentPackageCtx.put("userLogin", userLogin);
+            Map<String, Object> shipmentPackageResult = this.getDispatcher().runSync("createShipmentPackage", shipmentPackageCtx);
+            if (ServiceUtil.isError(shipmentPackageResult)) {
+                throw new GeneralException(ServiceUtil.getErrorMessage(shipmentPackageResult));
+            }
+        }
+    }
+
+    public void setDimensionAndShipmentBoxType(String packageSeqId) {
+        if (UtilValidate.isNotEmpty(packageSeqId)) {
+            PackingSessionLine packLine = this.getLine(Integer.parseInt(packageSeqId));
+            packLine.setLength(null);
+            packLine.setWidth(null);
+            packLine.setHeight(null);
+            packLine.setShipmentBoxTypeId(null);
+        }
+    }
+
     class ItemDisplay extends AbstractMap {
 
         public GenericValue orderItem;

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java Fri May 15 13:20:56 2009
@@ -43,6 +43,11 @@
     protected String shipmentItemSeqId = null;
     protected BigDecimal quantity = BigDecimal.ZERO;
     protected BigDecimal weight = BigDecimal.ZERO;
+    protected BigDecimal height = null;
+    protected BigDecimal width = null;
+    protected BigDecimal length = null;
+    protected String shipmentBoxTypeId = null;
+    protected String weightPackageSeqId = null;
     protected int packageSeq = 0;
 
     public PackingSessionLine(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId, BigDecimal quantity, BigDecimal weight, int packageSeq) {
@@ -53,6 +58,11 @@
         this.productId = productId;
         this.quantity = quantity;
         this.weight = weight;
+        this.height = null;
+        this.width = null;
+        this.length = null;
+        this.shipmentBoxTypeId = null;
+        this.weightPackageSeqId = null;
         this.packageSeq = packageSeq;
     }
 
@@ -112,6 +122,46 @@
         return this.packageSeq;
     }
 
+    public BigDecimal getLength() {
+        return this.length;
+    }
+
+    public void setLength(BigDecimal length) {
+        this.length = length;
+    }
+
+    public BigDecimal getWidth() {
+        return this.width;
+    }
+
+    public void setWidth(BigDecimal width) {
+        this.width = width;
+    }
+
+    public BigDecimal getHeight() {
+        return this.height;
+    }
+
+    public void setHeight(BigDecimal height) {
+        this.height = height;
+    }
+
+    public String getShipmentBoxTypeId() {
+        return this.shipmentBoxTypeId;
+    }
+
+    public void setShipmentBoxTypeId(String shipmentBoxTypeId) {
+        this.shipmentBoxTypeId = shipmentBoxTypeId;
+    }
+
+    public String getWeightPackageSeqId() {
+        return this.weightPackageSeqId;
+    }
+
+    public void setWeightPackageSeqId(String weightPackageSeqId) {
+        this.weightPackageSeqId = weightPackageSeqId;
+    }
+
     public boolean isSameItem(PackingSessionLine line) {
         if (this.getInventoryItemId().equals(line.getInventoryItemId())) {
             if (this.getOrderItemSeqId().equals(line.getOrderItemSeqId())) {

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy Fri May 15 13:20:56 2009
@@ -86,6 +86,50 @@
 }
 packSession.clearItemInfos();
 
+showWarningForm = parameters.showWarningForm;
+if (!showWarningForm) {
+    showWarningForm = false;
+}
+context.showWarningForm = showWarningForm;
+
+currentIndex = parameters.currentIndex;
+if (!currentIndex) {
+    currentIndex = "0";
+}
+dimensionSavedInSession = parameters.dimensionSavedInSession;
+if (!dimensionSavedInSession) {
+    if ("0" != currentIndex) {
+        currentIndex = Integer.toString((Integer.parseInt(currentIndex) - 1));
+    }
+}
+context.currentIndex = currentIndex;
+
+if (packSession) {
+    packageSeqIds = packSession.getPackageSeqIds();
+    index = Integer.parseInt(currentIndex);
+    if (packageSeqIds && (packageSeqIds.size() > index)) {
+        packageSequenceId = packageSeqIds.get(index);
+        context.packageSequenceId = packageSequenceId;
+    } else {
+        context.packageSequenceId = "0";
+    }
+}
+
+packageSeqIds = packSession.getPackageSeqIds();
+if (packageSeqIds) {
+    weightPackageSeqIds = [];
+    packageSeqIds.each { packageSeqId ->
+        weightPackageSeqId = packSession.getWeightPackageSeqId(packageSeqId);
+        if (weightPackageSeqId > -1) {
+            weightPackageSeqIds.add(weightPackageSeqId);
+        }
+    }
+    context.weightPackageSeqIds = weightPackageSeqIds;
+}
+
+shipmentBoxTypes = delegator.findList("ShipmentBoxType", null, null, ["description"], null, true);
+context.shipmentBoxTypes = shipmentBoxTypes;
+
 // picklist based packing information
 picklistBinId = parameters.picklistBinId;
 // see if the bin ID is already set
@@ -171,6 +215,15 @@
     }
 }
 
+defaultDimensionUomId = null;
+if (facility) {
+    defaultDimensionUomId = facility.defaultDimensionUomId;
+}
+if (!defaultDimensionUomId) {
+    defaultDimensionUomId = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.dimension.uom", "LEN_in");
+}
+context.defaultDimensionUomId = defaultDimensionUomId;
+
 // Try to get the defaultWeightUomId first from the facility, then from the shipment properties, and finally defaulting to kilos
 defaultWeightUomId = null;
 if (facility) {

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml Fri May 15 13:20:56 2009
@@ -731,6 +731,34 @@
         <response name="success" type="view" value="PackOrder"/>
         <response name="error" type="view" value="PackOrder"/>
     </request-map>
+    <request-map uri="WeightPackgeOnly">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="PackOrder"/>
+    </request-map>
+    <request-map uri="weightPackage">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="weightPackage"/>
+        <response name="success" type="view" value="PackOrder"/>
+        <response name="error" type="view" value="PackOrder"/>
+    </request-map>
+    <request-map uri="completePackage">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="completePackage"/>
+        <response name="success" type="view" value="PackOrder"/>
+        <response name="error" type="view" value="PackOrder"/>
+    </request-map>
+    <request-map uri="shipNow">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="completePack"/>
+        <response name="success" type="view" value="PackOrder"/>
+        <response name="error" type="view" value="PackOrder"/>
+    </request-map>
+    <request-map uri="holdShipment">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="holdShipment"/>
+        <response name="success" type="view" value="PackOrder"/>
+        <response name="error" type="view" value="PackOrder"/>
+    </request-map>
     <request-map uri="CompletePack">
         <security https="true" auth="true"/>
         <event type="service" invoke="completePack"/>

Modified: ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/facility/shipment/PackOrder.ftl Fri May 15 13:20:56 2009
@@ -29,15 +29,17 @@
         document.clearPackLineForm.submit();
     }
 </script>
-
 <#if security.hasEntityPermission("FACILITY", "_VIEW", session)>
-    <#assign showInput = requestParameters.showInput?default("Y")>
-    <#assign hideGrid = requestParameters.hideGrid?default("N")>
+    <#assign showInput = requestParameters.showInput?default("Y")/>
+    <#assign hideGrid = requestParameters.hideGrid?default("N")/>
+    <#assign showWeightPackageForm = requestParameters.showWeightPackageForm?default("N")/>
+    <#assign showCompletePackForm = requestParameters.showCompletePackForm?default("Y")/>
 
     <#if (requestParameters.forceComplete?has_content && !invoiceIds?has_content)>
         <#assign forceComplete = "true">
         <#assign showInput = "Y">
     </#if>
+    <#if !(showWarningForm)>
     <div class="screenlet">
         <div class="screenlet-title-bar">
             <ul>
@@ -126,12 +128,25 @@
                 <input type="hidden" name="shipGroupSeqId"/>
                 <input type="hidden" name="inventoryItemId"/>
                 <input type="hidden" name="packageSeqId"/>
+                <input type="hidden" name="showWeightPackageForm" value="${requestParameters.showWeightPackageForm?default("N")}"/>
+                <input type="hidden" name="showCompletePackForm" value="${requestParameters.showCompletePackForm?default("Y")}"/>
+                <input type="hidden" name="currentIndex" value="${currentIndex?default("0")}"/>
             </form>
             <form name="incPkgSeq" method="post" action="<@ofbizUrl>SetNextPackageSeq</@ofbizUrl>">
                 <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
                 <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
                 <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
             </form>
+            <form name="weightPackageOnlyForm" method="post" action="<@ofbizUrl>WeightPackgeOnly</@ofbizUrl>">
+              <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
+              <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
+              <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
+              <#assign packageSeqIds = packingSession.getPackageSeqIds()/>
+              <#if packageSeqIds?has_content>
+                <input type="hidden" name="showWeightPackageForm" value="Y"/>
+                <input type="hidden" name="showCompletePackForm" value="N"/>
+              </#if>
+            </form>
         </div>
     </div>
 
@@ -340,9 +355,11 @@
                                 <tr><td colspan="10">&nbsp;</td></tr>
                                 <tr>
                                     <td colspan="12" align="right">
-                                        <input type="submit" value="${uiLabelMap.ProductPackItem}">
+                                        <a href="javascript:document.multiPackForm.submit()" class="buttontext">${uiLabelMap.ProductPackItem}</a>
                                         &nbsp;
-                                        <input type="button" value="${uiLabelMap.CommonClear} (${uiLabelMap.CommonAll})" onclick="javascript:document.clearPackForm.submit();"/>
+                                        <a href="javascript:document.weightPackageOnlyForm.submit()" class="buttontext">${uiLabelMap.ProductWeightPackageOnly}</a>
+                                        &nbsp;
+                                        <a href="javascript:document.clearPackForm.submit()" class="buttontext">${uiLabelMap.CommonClear} (${uiLabelMap.CommonAll})</a>
                                     </td>
                                 </tr>
                             </table>
@@ -350,10 +367,165 @@
                         <br/>
                     </#if>
 
+                    <!-- weight package form -->
+                    <#if showInput != "N">
+                      <#if weightPackageSeqIds?exists && weightPackageSeqIds?has_content && "Y" == showWeightPackageForm>
+                        <table class="basic-table" cellpadding="2" cellspacing='0'>
+                          <hr>
+                          <tr>
+                            <th>
+                              ${uiLabelMap.ProductPackedWeight} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval}):
+                            </th>
+                            <th>
+                              ${uiLabelMap.CommonDimension} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultDimensionUomId)?eval}):
+                            </th>
+                            <th>
+                              ${uiLabelMap.ProductPackageInputBox}:
+                            </th>
+                          </tr>
+                          <#list weightPackageSeqIds as weightPackageSeqId>
+                            <#if weightPackageSeqId != -1>
+                              <form name="weightPackageForm_${weightPackageSeqId}" method="post" action="<@ofbizUrl>weightPackage</@ofbizUrl>">
+                                <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
+                                <input type="hidden" name="facilityId" value ="${facilityId?if_exists}"/>
+                                <input type="hidden" name="orderId" value ="${orderId?if_exists}"/>
+                                <input type="hidden" name="showCompletePackForm" value="N"/>
+                                <input type="hidden" name="showWeightPackageForm" value="Y"/>
+                                <input type="hidden" name="currentIndex" value="${currentIndex?default("0")}"/>
+                                <tr>
+                                  <td>
+                                    <span class="label">
+                                      ${uiLabelMap.ProductPackage} ${weightPackageSeqId}
+                                      <input type="text" size="7" name="packageWeight" value="${packingSession.getPackageWeight(weightPackageSeqId?int)?if_exists}">
+                                    </span>
+                                  </td>
+                                  <td>
+                                    <span class="label">${uiLabelMap.CommonLength}<input type="text" name="packageLength" value="${packingSession.getPackageLength(weightPackageSeqId?int)?if_exists}" size="5"/></span>
+                                    <span class="label">${uiLabelMap.ProductWidth}<input type="text" name="packageWidth" value="${packingSession.getPackageWidth(weightPackageSeqId?int)?if_exists}" size="5"/></span>
+                                    <span class="label">${uiLabelMap.PartyHeight}<input type="text" name="packageHeight" value="${packingSession.getPackageHeight(weightPackageSeqId?int)?if_exists}" size="5"/></span>
+                                  </td>
+                                  <td>
+                                    <select name="shipmentBoxTypeId">
+                                      <#if shipmentBoxTypes?has_content>
+                                        <#assign shipmentBoxTypeId = "${packingSession.getShipmentBoxTypeId(weightPackageSeqId?int)?if_exists}"/>
+                                        <#list shipmentBoxTypes as shipmentBoxType>
+                                          <#if shipmentBoxTypeId == "${shipmentBoxType.shipmentBoxTypeId}">
+                                            <option value="${shipmentBoxType.shipmentBoxTypeId}">${shipmentBoxType.description}</option>
+                                          </#if>
+                                        </#list>
+                                        <option value=""></option>
+                                        <#list shipmentBoxTypes as shipmentBoxType>
+                                          <option value="${shipmentBoxType.shipmentBoxTypeId}">${shipmentBoxType.description}</option>
+                                        </#list>
+                                      </#if>
+                                    </select>
+                                  </td>
+                                  <input type="hidden" name="packageSeqId" value="${weightPackageSeqId}" size="5"/>
+                                  <td align="right"><a href="javascript:document.weightPackageForm_${weightPackageSeqId}.submit()" class="buttontext">${uiLabelMap.CommonUpdate}</a></td>
+                                </tr>
+                              </form>
+                            </#if>
+                          </#list>
+                        </table>
+                      </#if>
+                      <table class="basic-table" cellpadding="2" cellspacing='0'>
+                        <#assign packageSeqIds = packingSession.getPackageSeqIds()/>
+                        <#if packageSeqIds?has_content>
+                          <form name="weightPackageForm" method ="post" action="<@ofbizUrl>weightPackage</@ofbizUrl>">
+                            <input type="hidden" name = "shipGroupSeqId" value = "${shipGroupSeqId?if_exists}"/>
+                            <input type="hidden" name = "facilityId" value = "${facilityId?if_exists}"/>
+                            <input type="hidden" name = "orderId" value = "${orderId?if_exists}"/>
+                            <input type="hidden" name = "showWeightPackageForm" value = "Y"/>
+                            <input type="hidden" name = "showCompletePackForm" value = "N"/>
+                            <#assign currentPackageSeqId = Static["java.lang.Integer"].parseInt("${packageSequenceId}")/>
+                            <#if "Y" == showWeightPackageForm && weightPackageSeqIds.size() != packageSeqIds.size()>
+                              <hr>
+                              <tr>
+                                <#list packageSeqIds as packageSeqId>
+                                  <#if packageSeqId == currentPackageSeqId>
+                                    <td>
+                                      <span class="label">${uiLabelMap.ProductPackedWeight} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultWeightUomId)?eval}):
+                                        <br/>
+                                        ${uiLabelMap.ProductPackage} ${packageSeqId}
+                                        <input type="text" size="7" name="packageWeight" value="${packingSession.getPackageWeight(packageSeqId?int)?if_exists}"/>
+                                      </span>
+                                    </td>
+                                    <td>
+                                      <span class="label">${uiLabelMap.CommonDimension} (${("uiLabelMap.ProductShipmentUomAbbreviation_" + defaultDimensionUomId)?eval}):</span>
+                                      <br/>
+                                      <span class="label">${uiLabelMap.CommonLength}<input type="text" name="packageLength" value="${packingSession.getPackageLength(packageSeqId?int)?if_exists}" size="5"/></span>
+                                      <span class="label">${uiLabelMap.ProductWidth}<input type="text" name="packageWidth" value="${packingSession.getPackageWidth(packageSeqId?int)?if_exists}" size="5"/></span>
+                                      <span class="label">${uiLabelMap.PartyHeight}<input type="text" name="packageHeight" value="${packingSession.getPackageHeight(packageSeqId?int)?if_exists}" size="5"/></span>
+                                    </td>
+                                    <td>
+                                      <span class="label">${uiLabelMap.ProductPackageInputBox}:</span>
+                                      <br/>
+                                      <select name="shipmentBoxTypeId">
+                                        <#if shipmentBoxTypes?has_content>
+                                          <option value=""></option>
+                                          <#list shipmentBoxTypes as shipmentBoxType>
+                                            <option value="${shipmentBoxType.shipmentBoxTypeId}">${shipmentBoxType.description}</option>
+                                          </#list>
+                                        </#if>
+                                      </select>
+                                    </td>
+                                    <input type="hidden" name="packageSeqId" value="${packageSeqId}" size="5"/>
+                                    <td align="right"><a href="javascript:document.weightPackageForm.submit()" class="buttontext">${uiLabelMap.ProductNextPackage}</a></td>
+                                  </#if>
+                                </#list>
+                              </tr>
+                            </#if>
+                            <#assign currentIndex = Static["java.lang.Integer"].parseInt(currentIndex?default("0"))/>
+                            <input type="hidden" name="currentIndex" value="${(currentIndex + 1)}"/>
+                            <input type="hidden" name="weightPackageSeqId" value="${currentPackageSeqId}"/>
+                            <#if weightPackageSeqIds.size() == packageSeqIds.size()>
+                              <hr>
+                              <div align="right">
+                                <#assign buttonName = "${uiLabelMap.ProductComplete}"/>
+                                <#if "true" == forceComplete?default("false")>
+                                  <#assign buttonName = "${uiLabelMap.ProductCompleteForce}"/>
+                                </#if>
+                                <a href="javascript:document.completePackageForm.submit()" class="buttontext">${buttonName}</a>
+                              </div>
+                            </#if>
+                          </form>
+                        </table>
+                      </#if>
+                    </#if>
+                    <form name="completePackageForm" method="post" action="<@ofbizUrl>completePackage</@ofbizUrl>">
+                      <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
+                      <input type="hidden" name="showWeightPackageForm" value="Y"/>
+                      <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
+                      <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
+                      <input type="hidden" name="forceComplete" value="${forceComplete?default('false')}"/>
+                      <input type="hidden" name="dimensionUomId" value="${defaultDimensionUomId}"/>
+                      <input type="hidden" name="weightUomId" value="${defaultWeightUomId}"/>
+                      <input type="hidden" name="shipmentId" value="${(shipment.shipmentId)?default("")}"/>
+                      <input type="hidden" name="invoiceId" value="${(invoice.invoiceId)?default("")}"/>
+                      <input type="hidden" name="showInput" value="N"/>
+                      <#if orderItemShipGroup?has_content>
+                        <input type="hidden" name="shippingContactMechId" value="${orderItemShipGroup.contactMechId?if_exists}"/>
+                        <input type="hidden" name="shipmentMethodTypeId" value="${orderItemShipGroup.shipmentMethodTypeId?if_exists}"/>
+                        <input type="hidden" name="carrierPartyId" value="${orderItemShipGroup.carrierPartyId?if_exists}"/>
+                        <input type="hidden" name="carrierRoleTypeId" value="${orderItemShipGroup.carrierRoleTypeId?if_exists}"/>
+                        <input type="hidden" name="productStoreId" value="${productStoreId?if_exists}"/>
+                      </#if>
+                      <#if packageSeqIds?has_content>
+                        <#list packageSeqIds as packageSeqId>
+                          <input type="hidden" size="7" name="packageWeight_${packageSeqId}" value="${packingSession.getPackageWeight(packageSeqId?int)?if_exists}"/>
+                        </#list>
+                      </#if>
+                      <#if shipmentCostEstimateForShipGroup?exists>
+                        <input type="hidden" name="shipmentCostEstimateForShipGroup" value="${shipmentCostEstimateForShipGroup?if_exists}"/>
+                      </#if>
+                    </form>
+
                     <!-- complete form -->
                     <#if showInput != "N">
+                    <#if "Y" == showCompletePackForm>
                         <form name="completePackForm" method="post" action="<@ofbizUrl>CompletePack</@ofbizUrl>">
                             <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
+                            <input type="hidden" name="showCompletePackForm" value="Y"/>
                             <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
                             <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
                             <input type="hidden" name="forceComplete" value="${forceComplete?default('false')}"/>
@@ -411,6 +583,7 @@
                             <br/>
                         </form>
                     </#if>
+                    </#if>
                 </div>
             </div>
 
@@ -510,6 +683,44 @@
             </#if>
         </#if>
     </#if>
+    <#else>
+      <div class="screenlet">
+        <div class="screenlet-title-bar">
+          <ul>
+            <li class="h3">${uiLabelMap.WebtoolsWarningLogLevel}:</li>
+          </ul>
+          <br class="clear"/>
+        </div>
+        <div class="screenlet-body">
+          <div>
+           <h3>${uiLabelMap.FacilityWarningMessageThereIsMuchDifferenceInShippingCharges}</h3>
+          </div>
+          <form name="shipNowForm" method="post" action="<@ofbizUrl>shipNow</@ofbizUrl>">
+            <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
+            <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
+            <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
+            <input type="hidden" name="dimensionUomId" value="${defaultDimensionUomId}"/>
+            <input type="hidden" name="weightUomId" value="${defaultWeightUomId}"/>
+            <input type="hidden" name="shipmentId" value="${(shipment.shipmentId)?default("")}"/>
+            <input type="hidden" name="invoiceId" value="${(invoice.invoiceId)?default("")}"/>
+            <input type="hidden" name="showInput" value="N"/>
+          </form>
+          <form name="holdShipmentForm" method="post" action="<@ofbizUrl>holdShipment</@ofbizUrl>">
+            <input type="hidden" name="orderId" value="${orderId?if_exists}"/>
+            <input type="hidden" name="shipGroupSeqId" value="${shipGroupSeqId?if_exists}"/>
+            <input type="hidden" name="facilityId" value="${facilityId?if_exists}"/>
+            <input type="hidden" name="shipmentId" value="${shipmentId?if_exists}"/>
+            <input type="hidden" name="dimensionUomId" value="${defaultDimensionUomId}"/>
+            <input type="hidden" name="weightUomId" value="${defaultWeightUomId}"/>
+          </form>
+          <div>
+            <a href="javascript:document.shipNowForm.submit()" class="buttontext">${uiLabelMap.FacilityShip} ${uiLabelMap.CommonNow}</a>
+            &nbsp;
+            <a href="javascript:document.holdShipmentForm.submit()" class="buttontext">${uiLabelMap.FacilityHoldShipment}</a>
+          </div>
+        </div>
+      </div>
+    </#if>
 
     <#if orderId?has_content>
         <script language="javascript">

Modified: ofbiz/trunk/applications/product/widget/facility/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/CommonScreens.xml?rev=775128&r1=775127&r2=775128&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/facility/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/facility/CommonScreens.xml Fri May 15 13:20:56 2009
@@ -29,6 +29,7 @@
                 <property-map resource="PartyUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
 
                 <set field="layoutSettings.companyName" from-field="uiLabelMap.FacilityCompanyName" global="true"/>
                 <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.FacilityCompanySubtitle" global="true"/>