details:   https://code.openbravo.com/erp/devel/pi/rev/f2c228f99597
changeset: 20263:f2c228f99597
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Thu May 02 15:42:24 2013 +0200
summary:   Fixed bug 22800 set quantityorder value in pending good receipt
Set quantityorder value in pending good receipt when is used
alternate UOMs.

details:   https://code.openbravo.com/erp/devel/pi/rev/3a0d159eac4d
changeset: 20264:3a0d159eac4d
user:      David Miguelez <david.miguelez <at> openbravo.com>
date:      Fri May 03 11:17:38 2013 +0200
summary:   Related to 22800: Code Review.

diffstat:

 src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java |  27 
++++++++-
 1 files changed, 24 insertions(+), 3 deletions(-)

diffs (68 lines):

diff -r 56f2487fee9b -r 3a0d159eac4d 
src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java
--- a/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java  Tue Apr 
30 16:37:54 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java  Fri May 
03 11:17:38 2013 +0200
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.math.BigDecimal;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.List;
@@ -31,9 +32,11 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.filter.IsIDFilter;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.businessUtility.Tree;
 import org.openbravo.erpCommon.businessUtility.WindowTabs;
@@ -52,6 +55,9 @@
 import org.openbravo.model.common.enterprise.Organization;
 import org.openbravo.model.common.enterprise.Warehouse;
 import org.openbravo.model.common.order.OrderLine;
+import org.openbravo.model.common.plm.ProductUOM;
+import org.openbravo.model.common.uom.UOM;
+import org.openbravo.model.common.uom.UOMConversion;
 import org.openbravo.utils.Replace;
 import org.openbravo.xmlEngine.XmlDocument;
 
@@ -356,16 +362,31 @@
           strLastOrgId = data[0].adOrgId;
           String strQtyordered = vars.getNumericParameter("inpQtyordered" + 
strOrderlineId);
           String strSequenceLine = SequenceIdData.getUUID();
+          String qtyorder = null;
           MaterialReceiptPendingLinesData[] dataLine = 
MaterialReceiptPendingLinesData.select(this,
               strOrderlineId);
+          if (dataLine[0].quantityorder != "") {
+            OBCriteria<UOMConversion> conversion = 
OBDal.getInstance().createCriteria(
+                UOMConversion.class);
+            conversion.add(Restrictions.eq(UOMConversion.PROPERTY_UOM,
+                OBDal.getInstance().get(UOM.class, dataLine[0].cUomId)));
+            conversion.add(Restrictions.eq(UOMConversion.PROPERTY_TOUOM,
+                OBDal.getInstance().get(ProductUOM.class, 
dataLine[0].mProductUomId).getUOM()));
+
+            for (UOMConversion conv : conversion.list()) {
+              qtyorder = new 
BigDecimal(strQtyordered).multiply(conv.getMultipleRateBy())
+                  .toString();
+            }
+
+          }
           try {
             MaterialReceiptPendingLinesData.insert(conn, this, 
strSequenceLine, vars.getClient(),
                 dataLine[0].adOrgId, "Y", vars.getUser(), vars.getUser(), 
String.valueOf(line),
                 dataLine[0].description, strmInoutId, strOrderlineId, 
strLocator,
                 dataLine[0].mProductId, dataLine[0].cUomId, strQtyordered, "N",
-                dataLine[0].mAttributesetinstanceId, "N", 
dataLine[0].quantityorder,
-                dataLine[0].mProductUomId, dataLine[0].cProjectId, 
dataLine[0].user1Id,
-                dataLine[0].user2Id, dataLine[0].cCostcenterId, 
dataLine[0].aAssetId);
+                dataLine[0].mAttributesetinstanceId, "N", qtyorder, 
dataLine[0].mProductUomId,
+                dataLine[0].cProjectId, dataLine[0].user1Id, 
dataLine[0].user2Id,
+                dataLine[0].cCostcenterId, dataLine[0].aAssetId);
           } catch (ServletException ex) {
             myMessage = Utility.translateError(this, vars, vars.getLanguage(), 
ex.getMessage());
             releaseRollbackConnection(conn);

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to