if there are partyassignments to the routingTask, valid date records will

be copied over to the productionTask.


git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@423836 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2006-07-20 08:56:18 +00:00
parent 09bc12d84b
commit 283de868bc
@@ -331,6 +331,35 @@ public class ProductionRunServices {
} catch (GenericServiceException e) {
Debug.logError(e, "Problem calling the createWorkEffortAssoc service", module);
}
// copy date valid WorkEffortPartyAssignments from the routing task to the run task
List workEffortPartyAssignments = null;
try {
workEffortPartyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment",
UtilMisc.toMap("workEffortId", routingTaskAssoc.getString("workEffortIdTo"))));
} catch (GenericEntityException e) {
Debug.logError(e.getMessage(), module);
}
if (workEffortPartyAssignments != null) {
Iterator i = workEffortPartyAssignments.iterator();
while(i.hasNext()) {
GenericValue workEffortPartyAssignment = (GenericValue) i.next();
Map partyToWorkEffort = UtilMisc.toMap(
"workEffortId", productionRunTaskId,
"partyId", workEffortPartyAssignment.getString("partyId"),
"roleTypeId", workEffortPartyAssignment.getString("roleTypeId"),
"fromDate", workEffortPartyAssignment.getTimestamp("fromDate"),
"statusId", workEffortPartyAssignment.getString("statusId"),
"userLogin", userLogin
);
try {
resultService = dispatcher.runSync("assignPartyToWorkEffort", partyToWorkEffort);
} catch (GenericServiceException e) {
Debug.logError(e, "Problem calling the assignPartyToWorkEffort service", module);
}
if (Debug.infoOn()) Debug.logInfo("ProductionRunPartyassigment for party: " + workEffortPartyAssignment.get("partyId") + " created", module);
}
}
// Now we iterate thru the components returned by the getManufacturingComponents service
// TODO: if in the BOM a routingWorkEffortId is specified, but the task is not in the routing
// the component is not added to the production run.
@@ -1162,6 +1191,34 @@ public class ProductionRunServices {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingAddProductionRunRoutingTaskNotCreated", locale));
}
// copy date valid WorkEffortPartyAssignments from the routing task to the run task
List workEffortPartyAssignments = null;
try {
workEffortPartyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", UtilMisc.toMap("workEffortId", routingTaskId)));
} catch (GenericEntityException e) {
Debug.logError(e.getMessage(), module);
}
if (workEffortPartyAssignments != null) {
Iterator i = workEffortPartyAssignments.iterator();
while(i.hasNext()) {
GenericValue workEffortPartyAssignment = (GenericValue) i.next();
Map partyToWorkEffort = UtilMisc.toMap(
"workEffortId", productionRunTaskId,
"partyId", workEffortPartyAssignment.getString("partyId"),
"roleTypeId", workEffortPartyAssignment.getString("roleTypeId"),
"fromDate", workEffortPartyAssignment.getTimestamp("fromDate"),
"statusId", workEffortPartyAssignment.getString("statusId"),
"userLogin", userLogin
);
try {
resultService = dispatcher.runSync("assignPartyToWorkEffort", partyToWorkEffort);
} catch (GenericServiceException e) {
Debug.logError(e, "Problem calling the assignPartyToWorkEffort service", module);
}
if (Debug.infoOn()) Debug.logInfo("ProductionRunPartyassigment for party: " + workEffortPartyAssignment.get("partyId") + " created", module);
}
}
result.put("routingTaskId", productionRunTaskId);
result.put("estimatedStartDate", estimatedStartDate);
result.put("estimatedCompletionDate", estimatedCompletionDate);