Thank you, Vikas :-)
Regards -- Akash Jain [hidden email] wrote: > Author: mor > Date: Thu Jun 25 08:21:18 2009 > New Revision: 788290 > > URL: http://svn.apache.org/viewvc?rev=788290&view=rev > Log: > User cannot verify order items (Facility > Verify Pick) if there is insufficient inventory in the system. Patch from Akash Jain. > > Modified: > ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml > ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml > ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java > > Modified: ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml?rev=788290&r1=788289&r2=788290&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml (original) > +++ ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml Thu Jun 25 08:21:18 2009 > @@ -337,6 +337,9 @@ > <property key="OrderErrorAllItemsOfOrderAreAlreadyVerified"> > <value xml:lang="en">ERROR: All items of order #${orderId} are already verified</value> > </property> > + <property key="OrderErrorAttemptToVerifyOrderFailed"> > + <value xml:lang="en">ERROR: Attempt to verify order #${orderId} failed</value> > + </property> > <property key="OrderErrorCallingCountProductQuantityOrderedService"> > <value xml:lang="en">Error calling countProductQuantityOrdered service : </value> > <value xml:lang="es">Error al llamar al servicio countProductQuantityOrdered:</value> > > Modified: ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml?rev=788290&r1=788289&r2=788290&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml (original) > +++ ofbiz/trunk/applications/product/config/ProductErrorUiLabels.xml Thu Jun 25 08:21:18 2009 > @@ -91,6 +91,9 @@ > <property key="ProductErrorPackageWeightCannotBeNullOrZero"> > <value xml:lang="en">ERROR: Package weight cannot be null/zero, it should be greater than zero</value> > </property> > + <property key="ProductErrorVerifiedQtyDoesNotMatchTheReservedQtyForItem"> > + <value xml:lang="en">ERROR: Verified quantity does not match the reserved quantity for item #${productId} [verified qty = ${verifiedQty} / reserved qty = ${reservedQty}]</value> > + </property> > <property key="ProductFeatureTypeIdMustContainsLettersAndDigits"> > <value xml:lang="de">Die Produktmerkmal Typ ID darf nur Buchstaben, Zahlen und _ enthalten. Bitte erneut eingeben.</value> > <value xml:lang="en">The Product Feature TypeId must contains only letters, underscore and digits. Please re-enter</value> > > Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=788290&r1=788289&r2=788290&view=diff > ============================================================================== > --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java (original) > +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java Thu Jun 25 08:21:18 2009 > @@ -27,11 +27,13 @@ > 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.UtilMisc; > import org.ofbiz.base.util.UtilProperties; > import org.ofbiz.base.util.UtilValidate; > import org.ofbiz.entity.GenericDelegator; > +import org.ofbiz.entity.GenericEntityException; > import org.ofbiz.entity.GenericValue; > import org.ofbiz.entity.util.EntityUtil; > import org.ofbiz.service.GenericDispatcher; > @@ -40,6 +42,8 @@ > > public class VerifyPickSession implements Serializable { > > + public static final String module = VerifyPickSession.class.getName(); > + > protected GenericValue userLogin = null; > protected String dispatcherName = null; > protected String delegatorName = null; > @@ -296,6 +300,8 @@ > String invoiceId = null; > String invoiceItemSeqId = null; > this.checkVerifiedQty(orderId, locale); > + // check reserved quantity, it should be equal to verified quantity > + this.checkReservedQty(orderId, locale); > String shipmentId = this.createShipment((this.getPickRows(orderId)).get(0)); > this.issueItemsToShipment(shipmentId, locale); > invoiceId = this.createInvoice(orderId); > @@ -306,6 +312,32 @@ > return shipmentId; > } > > + protected void checkReservedQty(String orderId, Locale locale) throws GeneralException { > + List<String> errorList = FastList.newInstance(); > + for (VerifyPickSessionRow pickRow : this.getPickRows(orderId)) { > + BigDecimal reservedQty = this.getReservedQty(pickRow.getOrderId(), pickRow.getOrderItemSeqId(), pickRow.getShipGroupSeqId()); > + BigDecimal verifiedQty = pickRow.getReadyToVerifyQty(); > + if (verifiedQty.compareTo(reservedQty) != 0) { > + errorList.add(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorVerifiedQtyDoesNotMatchTheReservedQtyForItem", UtilMisc.toMap("productId", pickRow.getProductId(), "verifiedQty", pickRow.getReadyToVerifyQty(), "reservedQty", reservedQty), locale)); > + } > + } > + > + if (errorList.size() > 0) { > + throw new GeneralException(UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorAttemptToVerifyOrderFailed", UtilMisc.toMap("orderId", orderId), locale), errorList); > + } > + } > + > + public BigDecimal getReservedQty(String orderId, String orderItemSeqId, String shipGroupSeqId) { > + BigDecimal reservedQty = ZERO; > + try { > + GenericValue reservation = EntityUtil.getFirst(this.getDelegator().findByAnd("OrderItemAndShipGrpInvResAndItemSum", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "shipGroupSeqId", shipGroupSeqId))); > + reservedQty = reservation.getBigDecimal("totQuantityAvailable"); > + } catch (GenericEntityException e) { > + Debug.logError(e, module); > + } > + return reservedQty; > + } > + > protected void checkVerifiedQty(String orderId, Locale locale) throws GeneralException { > > BigDecimal verifiedQty = ZERO; > > > > |
Free forum by Nabble | Edit this page |