Implemented association between sales order items and drop shipment purchase order items (thru OrderItemassociation).
git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@442536 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -3581,15 +3581,19 @@ public class OrderServices {
|
||||
while (items.hasNext()) {
|
||||
GenericValue item = (GenericValue)items.next();
|
||||
try {
|
||||
cart.addOrIncreaseItem(item.getString("productId"),
|
||||
null, // amount
|
||||
item.getDouble("quantity").doubleValue(),
|
||||
null, null, null, // reserv
|
||||
item.getTimestamp("shipBeforeDate"),
|
||||
item.getTimestamp("shipAfterDate"),
|
||||
null, null, null,
|
||||
null, null, null,
|
||||
dispatcher);
|
||||
int itemIndex = cart.addOrIncreaseItem(item.getString("productId"),
|
||||
null, // amount
|
||||
item.getDouble("quantity").doubleValue(),
|
||||
null, null, null, // reserv
|
||||
item.getTimestamp("shipBeforeDate"),
|
||||
item.getTimestamp("shipAfterDate"),
|
||||
null, null, null,
|
||||
null, null, null,
|
||||
dispatcher);
|
||||
ShoppingCartItem sci = cart.findCartItem(itemIndex);
|
||||
sci.setAssociatedOrderId(orderId);
|
||||
sci.setAssociatedOrderItemSeqId(item.getString("orderItemSeqId"));
|
||||
// TODO: we should consider also the ship group in the association between sales and purchase orders
|
||||
} catch(Exception e) {
|
||||
ServiceUtil.returnError("The following error occurred creating drop shipments for order [" + orderId + "]: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -3427,7 +3427,6 @@ public class ShoppingCart implements Serializable {
|
||||
while (itemIter.hasNext()) {
|
||||
ShoppingCartItem item = (ShoppingCartItem) itemIter.next();
|
||||
String requirementId = item.getRequirementId();
|
||||
|
||||
if (requirementId != null) {
|
||||
try {
|
||||
List commitments = getDelegator().findByAnd("OrderRequirementCommitment", UtilMisc.toMap("requirementId", requirementId));
|
||||
@@ -3444,6 +3443,13 @@ public class ShoppingCart implements Serializable {
|
||||
Debug.logError(e, "Unable to load OrderRequirementCommitment records for requirement ID : " + requirementId, module);
|
||||
}
|
||||
}
|
||||
if (item.getAssociatedOrderId() != null && item.getAssociatedOrderItemSeqId() != null) {
|
||||
GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssociation", null);
|
||||
orderItemAssociation.set("salesOrderId", item.getAssociatedOrderId());
|
||||
orderItemAssociation.set("soItemSeqId", item.getAssociatedOrderItemSeqId());
|
||||
orderItemAssociation.set("poItemSeqId", item.getOrderItemSeqId());
|
||||
allOrderItemAssociations.add(orderItemAssociation);
|
||||
}
|
||||
}
|
||||
}
|
||||
return allOrderItemAssociations;
|
||||
|
||||
@@ -112,6 +112,8 @@ public class ShoppingCartItem implements java.io.Serializable {
|
||||
private String requirementId = null;
|
||||
private String quoteId = null;
|
||||
private String quoteItemSeqId = null;
|
||||
private String associatedOrderId = null; // the order Id, if any, to which the given item is associated (typically a sales order item can be associated to a purchase order item, for example in drop shipments)
|
||||
private String associatedOrderItemSeqId = null; // the order item Id, if any, to which the given item is associated
|
||||
private String statusId = null;
|
||||
private Map orderItemAttributes = null;
|
||||
private Map attributes = null;
|
||||
@@ -566,6 +568,8 @@ public class ShoppingCartItem implements java.io.Serializable {
|
||||
this.requirementId = item.getRequirementId();
|
||||
this.quoteId = item.getQuoteId();
|
||||
this.quoteItemSeqId = item.getQuoteItemSeqId();
|
||||
this.associatedOrderId = item.getAssociatedOrderId();
|
||||
this.associatedOrderItemSeqId = item.getAssociatedOrderItemSeqId();
|
||||
this.isPromo = item.getIsPromo();
|
||||
this.promoQuantityUsed = item.promoQuantityUsed;
|
||||
this.locale = item.locale;
|
||||
@@ -1362,6 +1366,26 @@ public class ShoppingCartItem implements java.io.Serializable {
|
||||
return this.quoteItemSeqId;
|
||||
}
|
||||
|
||||
/** Sets the asociatedOrderId. */
|
||||
public void setAssociatedOrderId(String associatedOrderId) {
|
||||
this.associatedOrderId = associatedOrderId;
|
||||
}
|
||||
|
||||
/** Returns the associatedId. */
|
||||
public String getAssociatedOrderId() {
|
||||
return this.associatedOrderId;
|
||||
}
|
||||
|
||||
/** Sets the associatedOrderItemSeqId. */
|
||||
public void setAssociatedOrderItemSeqId(String associatedOrderItemSeqId) {
|
||||
this.associatedOrderItemSeqId = associatedOrderItemSeqId;
|
||||
}
|
||||
|
||||
/** Returns the associatedOrderItemSeqId. */
|
||||
public String getAssociatedOrderItemSeqId() {
|
||||
return this.associatedOrderItemSeqId;
|
||||
}
|
||||
|
||||
public String getStatusId() {
|
||||
return this.statusId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user