Misc fixes to the way routings are retrived by the MRP.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@523700 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato
2007-03-29 13:32:28 +00:00
parent b89df63143
commit 31ff833f32
3 changed files with 28 additions and 3 deletions
@@ -119,5 +119,14 @@ under the License.
<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>
@@ -51,6 +51,12 @@ under the License.
<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>
@@ -108,6 +108,7 @@ public class ProposedOrder {
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 @@ public class ProposedOrder {
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 @@ public class ProposedOrder {
*/
}
}
} else {
// routing is null
Debug.logError("No routing found for product = "+ product.getString("productId"), module);