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
This commit is contained in:
Jacopo Cappellato
2008-06-03 13:11:22 +00:00
parent a98d00adae
commit 1a06fcea92
2 changed files with 8 additions and 10 deletions
@@ -56,8 +56,8 @@ under the License.
location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="updateProductionRun" auth="true">
<description>Update a Production Run</description>
<attribute name="productionRunId" type="String" mode="IN" optional="false"/>
<attribute name="quantity" type="Double" mode="IN"/>
<attribute name="estimatedStartDate" type="Timestamp" mode="IN"/>
<attribute name="quantity" type="Double" mode="IN" optional="true"/>
<attribute name="estimatedStartDate" type="Timestamp" mode="IN" optional="true"/>
<attribute name="workEffortName" type="String" mode="IN" optional="true"/>
<attribute name="description" type="String" mode="IN" optional="true"/>
<attribute name="facilityId" type="String" mode="IN" optional="true"/>
@@ -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");