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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

jacopoc
Author: jacopoc
Date: Tue Jul 11 21:26:53 2006
New Revision: 421114

URL: http://svn.apache.org/viewvc?rev=421114&view=rev
Log:
Misc temp fixes for the mkt pkg stuff; this should fix the bug reported by Leon Torres and Si Chen (error receiving inventory); I still have to complete the mkt pkg processes related to cancelling an order item.

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

Modified: incubator/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml?rev=421114&r1=421113&r2=421114&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original)
+++ incubator/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Tue Jul 11 21:26:53 2006
@@ -182,13 +182,13 @@
         <attribute name="createSerializedInventory" type="Boolean" mode="IN" optional="true"/>
     </service>
     <service name="checkDecomposeInventoryItem" engine="java"
-            location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="decomposeInventoryItem" auth="true">
+            location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="checkDecomposeInventoryItem" auth="true">
         <description>
             If the inventory item is for a 'marketing package' run the decomposeInventoryItem service.
             It is intended to be called as seca when a marketing package is received into warehouse (e.g. from a return).
         </description>
         <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/>
-        <attribute name="quantityAccepted" type="Double" mode="IN" optional="true"/>
+        <!--<attribute name="quantityAccepted" type="Double" mode="IN" optional="true"/>-->
     </service>
     <service name="decomposeInventoryItem" engine="java"
             location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="decomposeInventoryItem" auth="true">

Modified: incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=421114&r1=421113&r2=421114&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Tue Jul 11 21:26:53 2006
@@ -2216,12 +2216,20 @@
         Locale locale = (Locale) context.get("locale");
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         String inventoryItemId = (String)context.get("inventoryItemId");
+        /*
         Double quantity = (Double)context.get("quantityAccepted");
+        if (quantity != null && quantity.doubleValue() == 0) {
+            return ServiceUtil.returnSuccess();
+        }
+         */
         try {
             GenericValue inventoryItem = delegator.findByPrimaryKey("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId));
             if (inventoryItem == null) {
                 return ServiceUtil.returnError("Error: inventory item with id [" + inventoryItemId + "] not found.");
             }
+            if (inventoryItem.get("availableToPromiseTotal") != null && inventoryItem.getDouble("availableToPromiseTotal").doubleValue() <= 0) {
+                return ServiceUtil.returnSuccess();
+            }
             GenericValue product = inventoryItem.getRelatedOne("Product");
             if (product == null) {
                 return ServiceUtil.returnError("Error: product with id [" + inventoryItem.get("productId") + "] not found.");
@@ -2229,9 +2237,11 @@
             if ("MARKETING_PKG_AUTO".equals(product.getString("productTypeId"))) {
                 Map serviceContext = UtilMisc.toMap("inventoryItemId", inventoryItemId,
                                                     "userLogin", userLogin);
+                /*
                 if (quantity != null) {
                     serviceContext.put("quantity", quantity);
                 }
+                 */
                 dispatcher.runSync("decomposeInventoryItem", serviceContext);
             }
         } catch (Exception e) {
@@ -2278,7 +2288,10 @@
             }
             resultService = dispatcher.runSync("issueInventoryItemToWorkEffort", serviceContext);
             Double issuedQuantity = (Double)resultService.get("quantityIssued");
-            // TODO: get the package's unit cost
+            if (issuedQuantity.doubleValue() == 0) {
+                return ServiceUtil.returnError("Error decomposing inventory item: no marketing packages found in inventory item [" + inventoryItem.getString("inventoryItemId") + "].");
+            }
+            // get the package's unit cost
             serviceContext.clear();
             serviceContext = UtilMisc.toMap("productId", inventoryItem.getString("productId"),
                                  "currencyUomId", inventoryItem.getString("currencyUomId"),