svn commit: r429008 - 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: r429008 - in /incubator/ofbiz/trunk/applications/manufacturing: servicedef/services_production_run.xml src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java

jacopoc
Author: jacopoc
Date: Sat Aug  5 08:36:12 2006
New Revision: 429008

URL: http://svn.apache.org/viewvc?rev=429008&view=rev
Log:
the decompose mkt pkg packages service now returns the list of inventory item ids created for the components.
Also, now the decompose task is no more a "production run" and it's status is set to COMPLETED.

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=429008&r1=429007&r2=429008&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original)
+++ incubator/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Sat Aug  5 08:36:12 2006
@@ -170,6 +170,7 @@
         <attribute name="unitCost" type="Double" mode="IN" optional="true"/>
         <attribute name="currencyUomId" type="String" mode="IN" optional="true"/>
         <attribute name="createSerializedInventory" type="Boolean" mode="IN" optional="true"/>
+        <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/>
     </service>
     <service name="productionRunTaskReturnMaterial" engine="java"
             location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="productionRunTaskReturnMaterial" auth="true">
@@ -199,6 +200,7 @@
         </description>
         <attribute name="inventoryItemId" type="String" mode="IN" optional="false"/>
         <attribute name="quantity" type="Double" mode="IN" optional="true"/>
+        <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/>
     </service>
     <service name="updateProductionRunTask" engine="java"
             location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="updateProductionRunTask" 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=429008&r1=429007&r2=429008&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 Sat Aug  5 08:36:12 2006
@@ -1457,7 +1457,7 @@
             ProductionRun productionRun = new ProductionRun(productionRunTaskId, delegator, dispatcher);
             facilityId = productionRun.getGenericValue().getString("facilityId");
         }
-
+        List inventoryItemIds = new ArrayList();
         if (createSerializedInventory.booleanValue()) {
             try {
                 int numOfItems = quantity.intValue();
@@ -1484,6 +1484,7 @@
                     serviceContext.put("quantityOnHandDiff", new Double(1));
                     serviceContext.put("userLogin", userLogin);
                     resultService = dispatcher.runSync("createInventoryItemDetail", serviceContext);
+                    inventoryItemIds.add(inventoryItemId);
                     // Recompute reservations
                     serviceContext = new HashMap();
                     serviceContext.put("inventoryItemId", inventoryItemId);
@@ -1518,6 +1519,7 @@
                 serviceContext.put("quantityOnHandDiff", quantity);
                 serviceContext.put("userLogin", userLogin);
                 resultService = dispatcher.runSync("createInventoryItemDetail", serviceContext);
+                inventoryItemIds.add(inventoryItemId);
                 // Recompute reservations
                 serviceContext = new HashMap();
                 serviceContext.put("inventoryItemId", inventoryItemId);
@@ -1527,6 +1529,7 @@
                 return ServiceUtil.returnError(exc.getMessage());
             }
         }
+        result.put("inventoryItemIds", inventoryItemIds);
         return result;
     }
 
@@ -2319,17 +2322,17 @@
         // Mandatory input fields
         String inventoryItemId = (String)context.get("inventoryItemId");
         Double quantity = (Double)context.get("quantity");
-
+        List inventoryItemIds = new ArrayList();
         try {
             GenericValue inventoryItem = delegator.findByPrimaryKey("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId));
             if (inventoryItem == null) {
                 return ServiceUtil.returnError("Error decomposing inventory item: inventory item with id [" + inventoryItemId + "] not found.");
             }
             // the work effort (disassemble order) is created
-            Map serviceContext = UtilMisc.toMap("workEffortTypeId", "PROD_ORDER_HEADER",
+            Map serviceContext = UtilMisc.toMap("workEffortTypeId", "TASK",
                                  "workEffortPurposeTypeId", "WEPT_PRODUCTION_RUN",
-                                 "currentStatusId", "PRUN_CREATED");
-            serviceContext.put("workEffortName", "Decompose inventory item [" + inventoryItem.getString("inventoryItemId") + "]");
+                                 "currentStatusId", "CAL_COMPLETED");
+            serviceContext.put("workEffortName", "Decomposing product [" + inventoryItem.getString("productId") + "] inventory item [" + inventoryItem.getString("inventoryItemId") + "]");
             serviceContext.put("facilityId", inventoryItem.getString("facilityId"));
             serviceContext.put("estimatedStartDate", now);
             serviceContext.put("userLogin", userLogin);
@@ -2365,7 +2368,6 @@
                 inventoryItemCost = new Double(1.0);
             }
             Double costCoefficient = new Double(inventoryItemCost.doubleValue() / packageCost.doubleValue());
-            
             // the components are retrieved
             serviceContext.clear();
             serviceContext = UtilMisc.toMap("productId", inventoryItem.getString("productId"),
@@ -2398,6 +2400,8 @@
                                      "userLogin", userLogin);
                 serviceContext.put("workEffortId", workEffortId);
                 resultService = dispatcher.runSync("productionRunTaskProduce", serviceContext);
+                List newInventoryItemIds = (List)resultService.get("inventoryItemIds");
+                inventoryItemIds.addAll(newInventoryItemIds);
             }
             // the components are put in warehouse
         } catch (GenericEntityException e) {
@@ -2407,6 +2411,7 @@
             Debug.logError(e, "Problem calling the createWorkEffort service", module);
             return ServiceUtil.returnError(e.getMessage());
         }
+        result.put("inventoryItemIds", inventoryItemIds);
         return result;
     }
 }