use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class SequenceScript method computeFullname.
public Object computeFullname(Object bean, Map<String, Object> values) {
assert bean instanceof Sequence;
Sequence sequence = ((Sequence) bean);
sequence.setFullName(Beans.get(SequenceService.class).computeFullName(sequence));
return sequence;
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class ABCAnalysisServiceImpl method setSequence.
@Override
public void setSequence(ABCAnalysis abcAnalysis) {
String abcAnalysisSequence = abcAnalysis.getAbcAnalysisSeq();
if (abcAnalysisSequence != null && !abcAnalysisSequence.isEmpty()) {
return;
}
Sequence sequence = sequenceService.getSequence(abcAnalysisSequenceCode, abcAnalysis.getCompany());
if (sequence == null) {
return;
}
abcAnalysis.setAbcAnalysisSeq(sequenceService.getSequenceNumber(sequence));
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class ManufOrderServiceImpl method getManufOrderSeq.
@Override
public String getManufOrderSeq(ManufOrder manufOrder) throws AxelorException {
ProductionConfigService productionConfigService = Beans.get(ProductionConfigService.class);
ProductionConfig productionConfig = productionConfigService.getProductionConfig(manufOrder.getCompany());
Sequence sequence = productionConfigService.getManufOrderSequence(productionConfig, manufOrder.getWorkshopStockLocation());
String seq = sequenceService.getSequenceNumber(sequence);
if (seq == null) {
throw new AxelorException(TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.MANUF_ORDER_SEQ));
}
return seq;
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class ProductionConfigService method getManufOrderSequence.
/**
* Find the configured sequence for a manufacturing order.
*
* <p>A company can have a different sequence per workshop. If no sequence is found per workshop,
* then return {@link ProductionConfig#manufOrderSequence}.
*
* @param productionConfig the config corresponding to the company.
* @param workshop the workshop of the manufacturing order.
* @return the found sequence.
* @throws AxelorException if no sequence is found for the given workshop, and if no default
* sequence is filled.
*/
public Sequence getManufOrderSequence(ProductionConfig productionConfig, StockLocation workshop) throws AxelorException {
Sequence sequence = null;
AppProductionService appProductionService = Beans.get(AppProductionService.class);
if (appProductionService.isApp("production")) {
if (productionConfig.getWorkshopSequenceConfigLineList() != null && appProductionService.getAppProduction().getManageWorkshop()) {
sequence = productionConfig.getWorkshopSequenceConfigLineList().stream().filter(workshopSequenceConfigLine -> workshopSequenceConfigLine.getWorkshopStockLocation().equals(workshop)).map(WorkshopSequenceConfigLine::getSequence).findFirst().orElseGet(productionConfig::getManufOrderSequence);
} else {
sequence = productionConfig.getManufOrderSequence();
}
}
if (sequence == null) {
throw new AxelorException(productionConfig, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.PRODUCTION_CONFIG_MISSING_MANUF_ORDER_SEQ), productionConfig.getCompany().getName());
}
return sequence;
}
use of com.axelor.apps.base.db.Sequence in project axelor-open-suite by axelor.
the class VentilateState method setInvoiceId.
/**
* Détermine le numéro de facture
*
* @throws AxelorException
*/
protected void setInvoiceId() throws AxelorException {
if (!sequenceService.isEmptyOrDraftSequenceNumber(invoice.getInvoiceId())) {
return;
}
Sequence sequence = this.getSequence();
if (!InvoiceToolService.isPurchase(invoice)) {
this.checkInvoiceDate(sequence);
}
invoice.setInvoiceId(sequenceService.getSequenceNumber(sequence, invoice.getInvoiceDate()));
if (invoice.getInvoiceId() != null) {
return;
}
throw new AxelorException(invoice, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.VENTILATE_STATE_4), invoice.getCompany().getName());
}
Aggregations