use of com.axelor.apps.production.service.manuforder.ManufOrderService in project axelor-open-suite by axelor.
the class ManufOrderWorkFlowMaintenanceService method plan.
@Transactional(rollbackOn = { Exception.class })
@Override
public ManufOrder plan(ManufOrder manufOrder) throws AxelorException {
if (manufOrder.getTypeSelect() != ManufOrderRepository.TYPE_MAINTENANCE) {
return super.plan(manufOrder);
}
ManufOrderService manufOrderService = Beans.get(ManufOrderService.class);
if (Beans.get(SequenceService.class).isEmptyOrDraftSequenceNumber(manufOrder.getManufOrderSeq())) {
manufOrder.setManufOrderSeq(manufOrderService.getManufOrderSeq(manufOrder));
}
if (CollectionUtils.isEmpty(manufOrder.getOperationOrderList())) {
manufOrderService.preFillOperations(manufOrder);
}
if (!manufOrder.getIsConsProOnOperation() && CollectionUtils.isEmpty(manufOrder.getToConsumeProdProductList())) {
manufOrderService.createToConsumeProdProductList(manufOrder);
}
if (CollectionUtils.isEmpty(manufOrder.getToProduceProdProductList())) {
manufOrderService.createToProduceProdProductList(manufOrder);
}
if (manufOrder.getPlannedStartDateT() == null) {
manufOrder.setPlannedStartDateT(Beans.get(AppProductionService.class).getTodayDateTime().toLocalDateTime());
}
for (OperationOrder operationOrder : getSortedOperationOrderList(manufOrder)) {
operationOrderWorkflowService.plan(operationOrder, null);
}
manufOrder.setPlannedEndDateT(this.computePlannedEndDateT(manufOrder));
if (manufOrder.getBillOfMaterial() != null) {
manufOrder.setUnit(manufOrder.getBillOfMaterial().getUnit());
}
manufOrder.setStatusSelect(ManufOrderRepository.STATUS_PLANNED);
manufOrder.setCancelReason(null);
manufOrder.setCancelReasonStr(null);
return manufOrderRepo.save(manufOrder);
}
use of com.axelor.apps.production.service.manuforder.ManufOrderService in project axelor-open-suite by axelor.
the class ManufOrderController method updateRealQty.
/**
* Called from manuf order wizard view. Call {@link ManufOrderService#updateRealQty(ManufOrder,
* BigDecimal)}
*
* @param request
* @param response
*/
public void updateRealQty(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
BigDecimal qtyToUpdate = new BigDecimal(request.getContext().get("qtyToUpdate").toString());
Beans.get(ManufOrderService.class).updateRealQty(manufOrder, qtyToUpdate);
response.setReload(true);
response.setCanClose(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.service.manuforder.ManufOrderService in project axelor-open-suite by axelor.
the class ManufOrderController method updateProducedStockMoveFromManufOrder.
/**
* Called from manuf order form, on produced stock move line change. Call {@link
* ManufOrderService#updateProducedStockMoveFromManufOrder(ManufOrder)}.
*
* @param request
* @param response
*/
public void updateProducedStockMoveFromManufOrder(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
Beans.get(ManufOrderService.class).updateProducedStockMoveFromManufOrder(manufOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.service.manuforder.ManufOrderService in project axelor-open-suite by axelor.
the class ManufOrderController method checkProducedStockMoveLineList.
/**
* Called from manuf order form, on produced stock move line change. Call {@link
* ManufOrderService#checkProducedStockMoveLineList(ManufOrder, ManufOrder)}.
*
* @param request
* @param response
*/
public void checkProducedStockMoveLineList(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
ManufOrder oldManufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
Beans.get(ManufOrderService.class).checkProducedStockMoveLineList(manufOrder, oldManufOrder);
} catch (Exception e) {
TraceBackService.trace(response, e);
response.setReload(true);
}
}
use of com.axelor.apps.production.service.manuforder.ManufOrderService in project axelor-open-suite by axelor.
the class ManufOrderController method updateConsumedStockMoveFromManufOrder.
/**
* Called from manuf order form, on consumed stock move line change. Call {@link
* ManufOrderService#updateConsumedStockMoveFromManufOrder(ManufOrder)}.
*
* @param request
* @param response
*/
public void updateConsumedStockMoveFromManufOrder(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
Beans.get(ManufOrderService.class).updateConsumedStockMoveFromManufOrder(manufOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations