Author: mor
Date: Thu Dec 29 20:24:28 2011 New Revision: 1225639 URL: http://svn.apache.org/viewvc?rev=1225639&view=rev Log: Added support to associate ship groups of sales and drop ship purchase orders. Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1225639&r1=1225638&r2=1225639&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Dec 29 20:24:28 2011 @@ -4964,7 +4964,6 @@ public class OrderServices { sci.setAssociatedOrderId(orderId); sci.setAssociatedOrderItemSeqId(item.getString("orderItemSeqId")); sci.setOrderItemAssocTypeId("DROP_SHIPMENT"); - // TODO: we should consider also the ship group in the association between sales and purchase orders } catch (Exception e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "OrderOrderCreatingDropShipmentsError", @@ -4980,11 +4979,12 @@ public class OrderServices { cart.setDefaultCheckoutOptions(dispatcher); // the shipping address is the one of the customer cart.setShippingContactMechId(shipGroup.getString("contactMechId")); + // associate ship groups of sales and purchase orders + ShoppingCart.CartShipInfo cartShipInfo = cart.getShipGroups().get(0); + cartShipInfo.setAssociatedShipGroupSeqId(shipGroup.getString("shipGroupSeqId")); // create the order CheckOutHelper coh = new CheckOutHelper(dispatcher, delegator, cart); coh.createOrder(userLogin); - - // TODO: associate the new purchase order with the sales order (ship group) } else { // if there are no items to drop ship, then clear out the supplier partyId Debug.logWarning("No drop ship items found for order [" + shipGroup.getString("orderId") + "] and ship group [" + shipGroup.getString("shipGroupSeqId") + "] and supplier party [" + shipGroup.getString("supplierPartyId") + "]. Supplier party information will be cleared for this ship group", module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1225639&r1=1225638&r2=1225639&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Thu Dec 29 20:24:28 2011 @@ -4044,7 +4044,9 @@ public class ShoppingCart implements Ite public List<GenericValue> makeAllOrderItemAssociations() { List<GenericValue> allOrderItemAssociations = new LinkedList<GenericValue>(); - for (ShoppingCartItem item : cartLines) { + for (CartShipInfo csi : shipInfo) { + Set<ShoppingCartItem> items = csi.getShipItems(); + for (ShoppingCartItem item : items) { String requirementId = item.getRequirementId(); if (requirementId != null) { try { @@ -4069,13 +4071,14 @@ public class ShoppingCart implements Ite GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssoc"); orderItemAssociation.set("orderId", item.getAssociatedOrderId()); orderItemAssociation.set("orderItemSeqId", item.getAssociatedOrderItemSeqId()); - orderItemAssociation.set("shipGroupSeqId", "_NA_"); + orderItemAssociation.set("shipGroupSeqId", csi.getAssociatedShipGroupSeqId() != null ? csi.getAssociatedShipGroupSeqId() : "_NA_"); orderItemAssociation.set("toOrderItemSeqId", item.getOrderItemSeqId()); - orderItemAssociation.set("toShipGroupSeqId", "_NA_"); + orderItemAssociation.set("toShipGroupSeqId", csi.getShipGroupSeqId() != null ? csi.getShipGroupSeqId() : "_NA_"); orderItemAssociation.set("orderItemAssocTypeId", item.getOrderItemAssocTypeId()); allOrderItemAssociations.add(orderItemAssociation); } } + } return allOrderItemAssociations; } @@ -4446,6 +4449,7 @@ public class ShoppingCart implements Ite public Timestamp shipBeforeDate = null; public Timestamp shipAfterDate = null; private String shipGroupSeqId = null; + private String associatedShipGroupSeqId = null; public String vendorPartyId = null; public String productStoreShipMethId = null; public Map<String, Object> attributes = FastMap.newInstance(); @@ -4480,6 +4484,11 @@ public class ShoppingCart implements Ite this.shipGroupSeqId = shipGroupSeqId; } + public String getAssociatedShipGroupSeqId() { return associatedShipGroupSeqId; } + public void setAssociatedShipGroupSeqId(String shipGroupSeqId) { + this.associatedShipGroupSeqId = shipGroupSeqId; + } + public String getFacilityId() { return facilityId; } public void setFacilityId(String facilityId) { this.facilityId = facilityId; |
Free forum by Nabble | Edit this page |