use of com.axelor.apps.production.db.ProdProcess in project axelor-open-suite by axelor.
the class ProdProcessController method print.
public void print(ActionRequest request, ActionResponse response) {
try {
ProdProcess prodProcess = request.getContext().asType(ProdProcess.class);
String fileLink = Beans.get(ProdProcessService.class).print(prodProcess);
response.setView(ActionView.define(prodProcess.getName()).add("html", fileLink).map());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.ProdProcess in project axelor-open-suite by axelor.
the class ManufOrderServiceImpl method createManufOrder.
@Override
public ManufOrder createManufOrder(Product product, BigDecimal qty, int priority, boolean isToInvoice, Company company, BillOfMaterial billOfMaterial, LocalDateTime plannedStartDateT, LocalDateTime plannedEndDateT) throws AxelorException {
logger.debug("Création d'un OF {}", priority);
ProdProcess prodProcess = billOfMaterial.getProdProcess();
ManufOrder manufOrder = new ManufOrder(qty, company, null, priority, this.isManagedConsumedProduct(billOfMaterial), billOfMaterial, product, prodProcess, plannedStartDateT, plannedEndDateT, ManufOrderRepository.STATUS_DRAFT, prodProcess.getOutsourcing());
manufOrder = manufOrderRepo.save(manufOrder);
if (appProductionService.getAppProduction().getManageWorkshop()) {
manufOrder.setWorkshopStockLocation(billOfMaterial.getWorkshopStockLocation());
}
if (prodProcess != null && prodProcess.getProdProcessLineList() != null) {
for (ProdProcessLine prodProcessLine : this._sortProdProcessLineByPriority(prodProcess.getProdProcessLineList())) {
manufOrder.addOperationOrderListItem(operationOrderService.createOperationOrder(manufOrder, prodProcessLine));
}
}
return manufOrder;
}
use of com.axelor.apps.production.db.ProdProcess in project axelor-open-suite by axelor.
the class ManufOrderServiceImpl method preFillOperations.
@Override
@Transactional(rollbackOn = { Exception.class })
public void preFillOperations(ManufOrder manufOrder) throws AxelorException {
BillOfMaterial billOfMaterial = manufOrder.getBillOfMaterial();
if (manufOrder.getProdProcess() == null) {
manufOrder.setProdProcess(billOfMaterial.getProdProcess());
}
ProdProcess prodProcess = manufOrder.getProdProcess();
if (manufOrder.getPlannedStartDateT() == null) {
manufOrder.setPlannedStartDateT(appProductionService.getTodayDateTime().toLocalDateTime());
}
if (prodProcess != null && prodProcess.getProdProcessLineList() != null) {
for (ProdProcessLine prodProcessLine : this._sortProdProcessLineByPriority(prodProcess.getProdProcessLineList())) {
manufOrder.addOperationOrderListItem(operationOrderService.createOperationOrder(manufOrder, prodProcessLine));
}
}
manufOrderRepo.save(manufOrder);
manufOrder.setPlannedEndDateT(manufOrderWorkflowService.computePlannedEndDateT(manufOrder));
manufOrderRepo.save(manufOrder);
}
use of com.axelor.apps.production.db.ProdProcess in project axelor-open-suite by axelor.
the class ConfiguratorProdProcessServiceImpl method createProdProcessHeader.
/**
* Instantiate a new prod process and set the right attributes.
*/
protected ProdProcess createProdProcessHeader(ConfiguratorProdProcess confProdProcess, String code, StockLocation stockLocation, StockLocation producedProductStockLocation, StockLocation workshopStockLocation, Product product) {
ProdProcess prodProcess = new ProdProcess();
prodProcess.setName(confProdProcess.getName());
prodProcess.setCompany(confProdProcess.getCompany());
prodProcess.setStatusSelect(confProdProcess.getStatusSelect());
prodProcess.setCode(code);
prodProcess.setStockLocation(stockLocation);
prodProcess.setProducedProductStockLocation(producedProductStockLocation);
prodProcess.setWorkshopStockLocation(workshopStockLocation);
prodProcess.setProduct(product);
return prodProcessRepository.save(prodProcess);
}
use of com.axelor.apps.production.db.ProdProcess in project axelor-open-suite by axelor.
the class ConfiguratorProdProcessServiceImpl method generateProdProcessService.
@Override
public ProdProcess generateProdProcessService(ConfiguratorProdProcess confProdProcess, JsonContext attributes, Product product) throws AxelorException {
if (confProdProcess == null) {
return null;
}
String code;
StockLocation stockLocation;
StockLocation producedProductStockLocation;
StockLocation workshopStockLocation;
if (confProdProcess.getDefCodeAsFormula()) {
code = String.valueOf(configuratorService.computeFormula(confProdProcess.getCodeFormula(), attributes));
} else {
code = confProdProcess.getCode();
}
if (confProdProcess.getDefStockLocationAsFormula()) {
stockLocation = (StockLocation) configuratorService.computeFormula(confProdProcess.getStockLocationFormula(), attributes);
} else {
stockLocation = confProdProcess.getStockLocation();
}
if (confProdProcess.getDefProducedProductStockLocationAsFormula()) {
producedProductStockLocation = (StockLocation) configuratorService.computeFormula(confProdProcess.getProducedProductStockLocationFormula(), attributes);
} else {
producedProductStockLocation = confProdProcess.getProducedProductStockLocation();
}
if (confProdProcess.getDefWorkshopStockLocationAsFormula()) {
workshopStockLocation = (StockLocation) configuratorService.computeFormula(confProdProcess.getWorkshopStockLocationFormula(), attributes);
} else {
workshopStockLocation = confProdProcess.getWorkshopStockLocation();
}
ProdProcess prodProcess = createProdProcessHeader(confProdProcess, code, stockLocation, producedProductStockLocation, workshopStockLocation, product);
List<ConfiguratorProdProcessLine> confLines = confProdProcess.getConfiguratorProdProcessLineList();
if (confLines != null) {
for (ConfiguratorProdProcessLine confLine : confLines) {
prodProcess.addProdProcessLineListItem(confProdProcessLineService.generateProdProcessLine(confLine, attributes));
}
}
return prodProcess;
}
Aggregations