From abdf709ccaadd44aead2fb7dfed1cd1931ec0ece Mon Sep 17 00:00:00 2001 From: Jacopo Cappellato Date: Sun, 15 Oct 2006 15:53:54 +0000 Subject: [PATCH] Applied patch that allows to override the default routing when a manual production run is created. Thanks to Scott Gray for the patch (OFBIZ-190). git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@464217 13f79535-47bb-0310-9956-ffa450edef68 --- .../manufacturing/routing/RoutingServices.xml | 111 +++++++++++------- .../servicedef/services_routing.xml | 2 + .../jobshopmgt/ProductionRunServices.java | 50 ++++---- 3 files changed, 98 insertions(+), 65 deletions(-) diff --git a/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml b/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml index 97dbd1d91e..b8d37ef977 100644 --- a/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml +++ b/applications/manufacturing/script/org/ofbiz/manufacturing/routing/RoutingServices.xml @@ -22,59 +22,90 @@ under the License. - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + + - - - - + + - - - - - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/manufacturing/servicedef/services_routing.xml b/applications/manufacturing/servicedef/services_routing.xml index 3ee2b92e25..3943487b8e 100644 --- a/applications/manufacturing/servicedef/services_routing.xml +++ b/applications/manufacturing/servicedef/services_routing.xml @@ -43,6 +43,8 @@ under the License. location="org/ofbiz/manufacturing/routing/RoutingServices.xml" invoke="getProductRouting"> Get the product's routing and routing tasks + + diff --git a/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java index cdc12fdafe..d9be207d36 100644 --- a/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java +++ b/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java @@ -191,7 +191,30 @@ public class ProductionRunServices { Debug.logWarning(e.getMessage(), module); return ServiceUtil.returnError(e.getMessage()); } - + + // ------------------- + // Routing and routing tasks + // ------------------- + // Select the product's routing + try { + Map routingInMap = UtilMisc.toMap("productId", productId, "applicableDate", startDate, "userLogin", userLogin); + if (workEffortId != null) { + routingInMap.put("workEffortId", workEffortId); + } + Map routingOutMap = dispatcher.runSync("getProductRouting", routingInMap); + routing = (GenericValue)routingOutMap.get("routing"); + routingTaskAssocs = (List)routingOutMap.get("tasks"); + } catch(GenericServiceException gse) { + Debug.logWarning(gse.getMessage(), module); + } + // ================================= + if (routing == null) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductRoutingNotExist", locale)); + } + if (routingTaskAssocs == null || routingTaskAssocs.size()==0) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingHasNoRoutingTask", locale)); + } + // ------------------- // Components // ------------------- @@ -206,34 +229,11 @@ public class ProductionRunServices { try { resultService = dispatcher.runSync("getManufacturingComponents", serviceContext); components = (List)resultService.get("components"); // a list of objects representing the product's components - if (workEffortId == null) { - workEffortId = (String)resultService.get("workEffortId"); // the product routing id - } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the getManufacturingComponents service", module); return ServiceUtil.returnError(e.getMessage()); } - - // ------------------- - // Routing and routing tasks - // ------------------- - // Select the product's routing - try { - Map routingInMap = UtilMisc.toMap("productId", productId, "userLogin", userLogin); - Map routingOutMap = dispatcher.runSync("getProductRouting", routingInMap); - routing = (GenericValue)routingOutMap.get("routing"); - routingTaskAssocs = (List)routingOutMap.get("tasks"); - } catch(GenericServiceException gse) { - Debug.logWarning(gse.getMessage(), module); - } - // ================================= - if (routing == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductRoutingNotExist", locale)); - } - if (routingTaskAssocs == null || routingTaskAssocs.size()==0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingHasNoRoutingTask", locale)); - } - + // ProductionRun header creation, if (workEffortName == null) { String prdName = UtilValidate.isNotEmpty(product.getString("productName"))? product.getString("productName"): product.getString("productId");