You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/08/28 21:34:03 UTC

svn commit: r1518336 - in /ofbiz/trunk/applications/manufacturing: servicedef/services_production_run.xml src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java

Author: jleroux
Date: Wed Aug 28 19:34:02 2013
New Revision: 1518336

URL: http://svn.apache.org/r1518336
Log:
A patch from Pierre Smits for "ProductionRunServices doens't set UoM of goods in inventoryItems" https://issues.apache.org/jira/browse/OFBIZ-5300

When releasing a good to inventory from a production run (both declare and return material) the uom of the good returned isn't set in the inventory item.


Modified:
    ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
    ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java

Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml?rev=1518336&r1=1518335&r2=1518336&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original)
+++ ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Wed Aug 28 19:34:02 2013
@@ -230,6 +230,7 @@ under the License.
         <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
         <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/>
         <attribute name="quantity" type="BigDecimal" mode="INOUT" optional="true"/>
+        <attribute name="quantityUomId" type="String" mode="IN" optional="true"/>
         <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="lotId" type="String" mode="IN" optional="true"/>
         <attribute name="createLotIfNeeded" type="Boolean" mode="IN" optional="true"/>
@@ -243,6 +244,7 @@ under the License.
         <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
         <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/>
         <attribute name="quantity" type="BigDecimal" mode="INOUT" optional="false"/>
+        <attribute name="quantityUomId" type="String" mode="IN" optional="true"/>
         <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="lotId" type="String" mode="IN" optional="true"/>
         <attribute name="createLotIfNeeded" type="Boolean" mode="IN" optional="true"/>

Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1518336&r1=1518335&r2=1518336&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Wed Aug 28 19:34:02 2013
@@ -1546,6 +1546,7 @@ public class ProductionRunServices {
         BigDecimal quantity = (BigDecimal) context.get("quantity");
         String inventoryItemTypeId = (String)context.get("inventoryItemTypeId");
         String lotId = (String)context.get("lotId");
+        String uomId = (String) context.get("quantityUomId");
         Boolean createLotIfNeeded = (Boolean)context.get("createLotIfNeeded");
         Boolean autoCreateLot = (Boolean)context.get("autoCreateLot");
 
@@ -1667,6 +1668,7 @@ public class ProductionRunServices {
                     }
                     //serviceContext.put("serialNumber", productionRunId);
                     serviceContext.put("lotId", lotId);
+                    serviceContext.put("uomId",uomId);
                     serviceContext.put("userLogin", userLogin);
                     Map<String, Object> resultService = dispatcher.runSync("createInventoryItem", serviceContext);
                     String inventoryItemId = (String)resultService.get("inventoryItemId");
@@ -1701,6 +1703,7 @@ public class ProductionRunServices {
                 serviceContext.put("datetimeManufactured", UtilDateTime.nowTimestamp());
                 serviceContext.put("comments", "Created by production run " + productionRunId);
                 serviceContext.put("lotId", lotId);
+                serviceContext.put("uomId",uomId);
                 if (unitCost.compareTo(ZERO) != 0) {
                     serviceContext.put("unitCost", unitCost);
                 }
@@ -1835,6 +1838,7 @@ public class ProductionRunServices {
         BigDecimal unitCost = (BigDecimal)context.get("unitCost");
         String inventoryItemTypeId = (String)context.get("inventoryItemTypeId");
         String lotId = (String)context.get("lotId");
+        String uomId = (String) context.get("quantityUomId");
         String isReturned = (String)context.get("isReturned");
 
         // The default is non-serialized inventory item
@@ -1863,7 +1867,8 @@ public class ProductionRunServices {
                         serviceContext.put("unitCost", unitCost);
                         serviceContext.put("currencyUomId", currencyUomId);
                     }
-                    serviceContext.put("lotId",    lotId);
+                    serviceContext.put("lotId", lotId);
+                    serviceContext.put("uomId", uomId);
                     serviceContext.put("userLogin", userLogin);
                     serviceContext.put("isReturned", isReturned);
                     Map<String, Object> resultService = dispatcher.runSync("createInventoryItem", serviceContext);
@@ -1903,6 +1908,7 @@ public class ProductionRunServices {
                     serviceContext.put("currencyUomId", currencyUomId);
                 }
                 serviceContext.put("lotId", lotId);
+                serviceContext.put("uomId",uomId);
                 serviceContext.put("userLogin", userLogin);
                 serviceContext.put("isReturned", isReturned);
                 Map<String, Object> resultService = dispatcher.runSync("createInventoryItem", serviceContext);
@@ -1944,6 +1950,7 @@ public class ProductionRunServices {
         // Optional input fields
         BigDecimal quantity = (BigDecimal)context.get("quantity");
         String lotId = (String)context.get("lotId");
+        String uomId = (String) context.get("quantityUomId");
         Locale locale = (Locale) context.get("locale");
         if (quantity == null || quantity.compareTo(ZERO) == 0) {
             return ServiceUtil.returnSuccess();
@@ -1984,7 +1991,7 @@ public class ProductionRunServices {
         try {
             Map<String, Object> inventoryResult = dispatcher.runSync("productionRunTaskProduce", 
                     UtilMisc.<String, Object>toMap("workEffortId", productionRunTaskId,
-                            "productId", productId, "quantity", quantity, "lotId", lotId, "isReturned", "Y",
+                            "productId", productId, "quantity", quantity, "lotId", lotId, "uomId", uomId, "isReturned", "Y",
                             "inventoryItemTypeId", inventoryItemTypeId, "userLogin", userLogin));
             if (ServiceUtil.isError(inventoryResult)) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskProduceError" + ServiceUtil.getErrorMessage(inventoryResult), locale));