ItEr60S04ValidacionEProbasFuncionaisItEr59S04 : It fixes the template screen.
Changes the statistics of the template. A order element is finished if its spread advance is 100%. If the order is not in the current scenario and the user clicks the button that shows the order planning, it will show a information message.
This commit is contained in:
parent
80a239417e
commit
1020df71dd
4 changed files with 48 additions and 3 deletions
|
|
@ -28,6 +28,7 @@ import org.navalplanner.business.orders.entities.OrderElement;
|
|||
import org.navalplanner.business.qualityforms.entities.QualityForm;
|
||||
import org.navalplanner.business.resources.entities.Criterion;
|
||||
import org.navalplanner.business.resources.entities.CriterionType;
|
||||
import org.navalplanner.business.scenarios.entities.Scenario;
|
||||
import org.navalplanner.business.templates.entities.OrderElementTemplate;
|
||||
import org.navalplanner.web.tree.EntitiesTree;
|
||||
|
||||
|
|
@ -65,4 +66,5 @@ public interface IOrderTemplatesModel {
|
|||
|
||||
Map<CriterionType, List<Criterion>> getMapCriterions();
|
||||
|
||||
Scenario getCurrentScenario();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import org.navalplanner.business.resources.daos.ICriterionTypeDAO;
|
|||
import org.navalplanner.business.resources.entities.Criterion;
|
||||
import org.navalplanner.business.resources.entities.CriterionType;
|
||||
import org.navalplanner.business.scenarios.IScenarioManager;
|
||||
import org.navalplanner.business.scenarios.entities.Scenario;
|
||||
import org.navalplanner.business.templates.daos.IOrderElementTemplateDAO;
|
||||
import org.navalplanner.business.templates.entities.OrderElementTemplate;
|
||||
import org.navalplanner.web.orders.QualityFormsOnConversation;
|
||||
|
|
@ -159,7 +160,7 @@ public class OrderTemplatesModel implements IOrderTemplatesModel {
|
|||
public void createTemplateFrom(OrderElement orderElement) {
|
||||
initializeAcompanyingObjectsOnConversation();
|
||||
Order order = orderElementDAO.loadOrderAvoidingProxyFor(orderElement);
|
||||
order.useSchedulingDataFor(scenarioManager.getCurrent());
|
||||
order.useSchedulingDataFor(getCurrentScenario());
|
||||
OrderElement orderElementOrigin = orderElementDAO
|
||||
.findExistingEntity(orderElement
|
||||
.getId());
|
||||
|
|
@ -168,6 +169,10 @@ public class OrderTemplatesModel implements IOrderTemplatesModel {
|
|||
treeModel = new TemplatesTree(template);
|
||||
}
|
||||
|
||||
public Scenario getCurrentScenario() {
|
||||
return scenarioManager.getCurrent();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void initEdit(OrderElementTemplate template) {
|
||||
|
|
|
|||
|
|
@ -20,18 +20,23 @@
|
|||
|
||||
package org.navalplanner.web.templates.historicalAssignment;
|
||||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.navalplanner.business.common.IAdHocTransactionService;
|
||||
import org.navalplanner.business.common.IOnTransaction;
|
||||
import org.navalplanner.business.orders.daos.IOrderDAO;
|
||||
import org.navalplanner.business.orders.daos.IOrderElementDAO;
|
||||
import org.navalplanner.business.orders.entities.Order;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.scenarios.entities.Scenario;
|
||||
import org.navalplanner.business.templates.entities.OrderElementTemplate;
|
||||
import org.navalplanner.web.planner.tabs.IGlobalViewEntryPoints;
|
||||
import org.navalplanner.web.templates.IOrderTemplatesModel;
|
||||
|
|
@ -40,6 +45,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.HtmlMacroComponent;
|
||||
import org.zkoss.zul.Messagebox;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
|
|
@ -60,11 +66,14 @@ public class OrderElementHistoricalAssignmentComponent extends HtmlMacroComponen
|
|||
|
||||
private IGlobalViewEntryPoints globalView;
|
||||
|
||||
private IOrderDAO orderDAO;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public void afterCompose() {
|
||||
super.afterCompose();
|
||||
this.adHocTransactionService = (IAdHocTransactionService) getBean("adHocTransactionService");
|
||||
this.orderElementDAO = (IOrderElementDAO) getBean("orderElementDAO");
|
||||
this.orderDAO = (IOrderDAO) getBean("orderDAO");
|
||||
}
|
||||
|
||||
public void useModel(IOrderTemplatesModel model,
|
||||
|
|
@ -121,7 +130,36 @@ public class OrderElementHistoricalAssignmentComponent extends HtmlMacroComponen
|
|||
public void view(final OrderElementHistoricAssignmentDTO dto) {
|
||||
OrderElement orderElement = dto.getOrderElement();
|
||||
Order order = dto.getOrder();
|
||||
globalView.goToOrderElementDetails(orderElement, order);
|
||||
if (model.getCurrentScenario().contains(order)) {
|
||||
globalView.goToOrderElementDetails(orderElement, order);
|
||||
} else {
|
||||
try {
|
||||
String scenarios = "";
|
||||
for (Scenario scene : getScenarios(order)) {
|
||||
scenarios = scenarios.concat(scene.getName() + "\n");
|
||||
}
|
||||
Messagebox
|
||||
.show(
|
||||
_("Its planning is not in the current scene.\nShould change to any of the following scenarios:\n"
|
||||
+ scenarios),
|
||||
_("Information"), Messagebox.OK,
|
||||
Messagebox.INFORMATION);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Set<Scenario> getScenarios(final Order order) {
|
||||
return this.adHocTransactionService
|
||||
.runOnReadOnlyTransaction(new IOnTransaction<Set<Scenario>>() {
|
||||
@Override
|
||||
public Set<Scenario> execute() {
|
||||
orderDAO.reattachUnmodifiedEntity(order);
|
||||
order.getScenarios().keySet().size();
|
||||
return order.getScenarios().keySet();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Object getBean(String classname) {
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public class OrderElementHistoricalStatisticsComponent extends
|
|||
private List<OrderElement> getFinishedApplications() {
|
||||
List<OrderElement> result = new ArrayList<OrderElement>();
|
||||
for (OrderElement orderElement : orderElements) {
|
||||
if (orderElement.isFinishPlanificationPointTask()) {
|
||||
if (orderElement.isFinishedAdvance()) {
|
||||
result.add(orderElement);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue