Author: jacopoc
Date: Thu Mar 29 06:32:28 2007 New Revision: 523700 URL: http://svn.apache.org/viewvc?view=rev&rev=523700 Log: Misc fixes to the way routings are retrived by the MRP. Modified: ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java Modified: ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml?view=diff&rev=523700&r1=523699&r2=523700 ============================================================================== --- ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml (original) +++ ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml Thu Mar 29 06:32:28 2007 @@ -119,5 +119,14 @@ <field-to-result field-name="routing"/> <field-to-result field-name="tasks"/> </simple-method> + <simple-method method-name="getRoutingTaskAssocs" short-description="Get the routing task assocs of a given routing"> + <set from-field="workEffortId" field="lookupTasks.workEffortIdFrom"/> + <string-to-list string="sequenceNum" list-name="tasksOrder"/> + <set value="ROUTING_COMPONENT" field="lookupTasks.workEffortAssocTypeId"/> + <find-by-and entity-name="WorkEffortAssoc" list-name="routingTaskAssocs" map-name="lookupTasks" order-by-list-name="tasksOrder"/> + <filter-list-by-date list-name="routingTaskAssocs"/> + <field-to-result field-name="routingTaskAssocs"/> + </simple-method> + </simple-methods> Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml?view=diff&rev=523700&r1=523699&r2=523700 ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_routing.xml Thu Mar 29 06:32:28 2007 @@ -51,6 +51,12 @@ <attribute mode="OUT" name="routing" type="GenericValue" optional="true"/> <attribute mode="OUT" name="tasks" type="java.util.List" optional="true"/> </service> + <service name="getRoutingTaskAssocs" engine="simple" auth="true" + location="org/ofbiz/manufacturing/routing/RoutingServices.xml" invoke="getRoutingTaskAssocs"> + <description>Get the routing task assocs of a given routing</description> + <attribute mode="IN" name="workEffortId" optional="false" type="String"/> + <attribute mode="OUT" name="routingTaskAssocs" type="java.util.List" optional="true"/> + </service> <service name="getEstimatedTaskTime" engine="java" auth="true" location="org.ofbiz.manufacturing.routing.RoutingServices" invoke="getEstimatedTaskTime"> <description>Computes the estimated time needed to perform the task</description> Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java?view=diff&rev=523700&r1=523699&r2=523700 ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java Thu Mar 29 06:32:28 2007 @@ -108,6 +108,7 @@ Map routingInMap = UtilMisc.toMap("productId", product.getString("productId"), "ignoreDefaultRouting", "Y", "userLogin", userLogin); Map routingOutMap = dispatcher.runSync("getProductRouting", routingInMap); routing = (GenericValue)routingOutMap.get("routing"); + listRoutingTaskAssoc = (List)routingOutMap.get("tasks"); if (routing == null) { // try to find a routing linked to the virtual product BOMTree tree = null; @@ -127,14 +128,24 @@ routing = (GenericValue)routingOutMap.get("routing"); } } - listRoutingTaskAssoc = (List)routingOutMap.get("tasks"); } catch(GenericServiceException gse) { Debug.logWarning(gse.getMessage(), module); } } - if (routing != null && listRoutingTaskAssoc != null) { + if (routing != null) { result = new HashMap(); //Looks for all the routingTask (ordered by inversed (begin from the end) sequence number) + if (listRoutingTaskAssoc == null) { + try { + Map routingTasksInMap = UtilMisc.toMap("workEffortId", routing.getString("workEffortId"), "userLogin", userLogin); + Map routingTasksOutMap = dispatcher.runSync("getRoutingTaskAssocs", routingTasksInMap); + listRoutingTaskAssoc = (List)routingTasksOutMap.get("routingTaskAssocs"); + } catch(GenericServiceException gse) { + Debug.logWarning(gse.getMessage(), module); + } + } + } + if (listRoutingTaskAssoc != null) { for (int i = 1; i <= listRoutingTaskAssoc.size(); i++) { GenericValue routingTaskAssoc = (GenericValue) listRoutingTaskAssoc.get(listRoutingTaskAssoc.size() - i); if (EntityUtil.isValueActive(routingTaskAssoc, endDate)) { @@ -164,7 +175,6 @@ */ } } - } else { // routing is null Debug.logError("No routing found for product = "+ product.getString("productId"), module); |
Free forum by Nabble | Edit this page |