From 1a06fcea9231ca54e1ffbce4f873b01ff63c299f Mon Sep 17 00:00:00 2001 From: Jacopo Cappellato Date: Tue, 3 Jun 2008 13:11:22 +0000 Subject: [PATCH] Small enhancements to the algorithm that computes start/end dates of production runs. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@662779 13f79535-47bb-0310-9956-ffa450edef68 --- .../servicedef/services_production_run.xml | 4 ++-- .../jobshopmgt/ProductionRunServices.java | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/applications/manufacturing/servicedef/services_production_run.xml b/applications/manufacturing/servicedef/services_production_run.xml index 3e2a517f8a..0dfb99a6f4 100644 --- a/applications/manufacturing/servicedef/services_production_run.xml +++ b/applications/manufacturing/servicedef/services_production_run.xml @@ -56,8 +56,8 @@ under the License. location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="updateProductionRun" auth="true"> Update a Production Run - - + + diff --git a/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java index f6040c0425..28ffa83f49 100644 --- a/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java +++ b/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java @@ -1067,13 +1067,7 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - /* TODO: security management and finishing cleaning (ex copy from PartyServices.java) - if (!security.hasEntityPermission(secEntity, secOperation, userLogin)) { - result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - result.put(ModelService.ERROR_MESSAGE, "You do not have permission to perform this operation for this party"); - return partyId; - } - */ + String productionRunId = (String) context.get("productionRunId"); String routingTaskId = (String) context.get("routingTaskId"); if (! UtilValidate.isEmpty(productionRunId) && ! UtilValidate.isEmpty(routingTaskId)) { @@ -1088,7 +1082,11 @@ public class ProductionRunServices { Timestamp estimatedStartDate = (Timestamp) context.get("estimatedStartDate"); Timestamp pRestimatedStartDate = productionRun.getEstimatedStartDate(); if (pRestimatedStartDate.after(estimatedStartDate)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); + try { + Map resultService = dispatcher.runSync("updateProductionRun", UtilMisc.toMap("productionRunId", productionRunId, "estimatedStartDate", estimatedStartDate, "userLogin", userLogin)); + } catch (GenericServiceException e) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); + } } Long priority = (Long) context.get("priority");