use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method print.
/**
* Method that generate a Pdf file for an operation order
*
* @param request
* @param response
* @return
* @throws BirtException
* @throws IOException
*/
public void print(ActionRequest request, ActionResponse response) {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
String operationOrderIds = "";
try {
@SuppressWarnings("unchecked") List<Integer> lstSelectedOperationOrder = (List<Integer>) request.getContext().get("_ids");
if (lstSelectedOperationOrder != null) {
for (Integer it : lstSelectedOperationOrder) {
operationOrderIds += it.toString() + ",";
}
}
if (!operationOrderIds.equals("")) {
operationOrderIds = operationOrderIds.substring(0, operationOrderIds.length() - 1);
operationOrder = Beans.get(OperationOrderRepository.class).find(new Long(lstSelectedOperationOrder.get(0)));
} else if (operationOrder.getId() != null) {
operationOrderIds = operationOrder.getId().toString();
}
if (!operationOrderIds.equals("")) {
String name = " ";
if (operationOrder.getName() != null) {
name += lstSelectedOperationOrder == null ? "Op " + operationOrder.getName() : "Ops";
}
String fileLink = ReportFactory.createReport(IReport.OPERATION_ORDER, name + "-${date}").addParam("Locale", ReportSettings.getPrintingLocale(null)).addParam("Timezone", getTimezone(operationOrder)).addParam("OperationOrderId", operationOrderIds).generate().getFileLink();
LOG.debug("Printing " + name);
response.setView(ActionView.define(name).add("html", fileLink).map());
} else {
response.setFlash(I18n.get(IExceptionMessage.OPERATION_ORDER_1));
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method setRealDates.
public void setRealDates(ActionRequest request, ActionResponse response) {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
LocalDateTime realStartDateT = operationOrder.getRealStartDateT();
LocalDateTime realEndDateT = operationOrder.getRealEndDateT();
operationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
Beans.get(OperationOrderWorkflowService.class).setRealDates(operationOrder, realStartDateT, realEndDateT);
}
use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method machineChange.
public void machineChange(ActionRequest request, ActionResponse response) {
try {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
OperationOrderRepository operationOrderRepo = Beans.get(OperationOrderRepository.class);
OperationOrderWorkflowService operationOrderWorkflowService = Beans.get(OperationOrderWorkflowService.class);
operationOrder = operationOrderRepo.find(operationOrder.getId());
if (operationOrder != null && operationOrder.getStatusSelect() == OperationOrderRepository.STATUS_PLANNED) {
operationOrder = operationOrderWorkflowService.replan(operationOrder);
List<OperationOrder> operationOrderList = operationOrderRepo.all().filter("self.manufOrder = ?1 AND self.priority >= ?2 AND self.statusSelect = 3 AND self.id != ?3", operationOrder.getManufOrder(), operationOrder.getPriority(), operationOrder.getId()).order("priority").order("plannedEndDateT").fetch();
for (OperationOrder operationOrderIt : operationOrderList) {
operationOrderWorkflowService.replan(operationOrderIt);
}
response.setReload(true);
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method resume.
public void resume(ActionRequest request, ActionResponse response) {
try {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
operationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
Beans.get(ManufOrderWorkflowService.class).resume(operationOrder.getManufOrder());
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method partialFinish.
public void partialFinish(ActionRequest request, ActionResponse response) {
try {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
operationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
Beans.get(OperationOrderStockMoveService.class).partialFinish(operationOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations