result.put("productionRunId", productionRunId);
Iterator options = config.getSelectedOptions().iterator();
HashMap components = new HashMap();
while (options.hasNext()) {
ConfigOption co = (ConfigOption)options.next();
//components.addAll(co.getComponents());
Iterator selComponents = co.getComponents().iterator();
while (selComponents.hasNext()) {
BigDecimal componentQuantity = null;
GenericValue selComponent = (GenericValue)selComponents.next();
if (selComponent.get("quantity") != null) {
componentQuantity = selComponent.getBigDecimal("quantity");
}
if (componentQuantity == null) {
componentQuantity = BigDecimal.ONE;
}
String componentProductId = selComponent.getString("productId");
if (co.isVirtualComponent(selComponent)) {
Map componentOptions = co.getComponentOptions();
if (UtilValidate.isNotEmpty(componentOptions) && UtilValidate.isNotEmpty(componentOptions.get(componentProductId))) {
componentProductId = (String)componentOptions.get(componentProductId);
}
}
componentQuantity = quantity.multiply(componentQuantity);
if (components.containsKey(componentProductId)) {
BigDecimal totalQuantity = (BigDecimal)components.get(componentProductId);
componentQuantity = totalQuantity.add(componentQuantity);
}
components.put(componentProductId, componentQuantity);
// create production run notes from comments
String comments = co.getComments();
if (UtilValidate.isNotEmpty(comments)) {
resultService.clear();
serviceContext.clear();
serviceContext.put("workEffortId", productionRunId);
serviceContext.put("internalNote", "Y");
serviceContext.put("noteInfo", comments);
serviceContext.put("noteName", co.getDescription());
serviceContext.put("userLogin", userLogin);
serviceContext.put("noteParty", userLogin.getString("partyId"));
try {
resultService = dispatcher.runSync("createWorkEffortNote", serviceContext);
} catch (GenericServiceException e) {