First commit waiting for Budget Alert
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
apply plugin: "com.axelor.app-module"
|
||||
|
||||
apply from: "../version.gradle"
|
||||
|
||||
apply {
|
||||
version = openSuiteVersion
|
||||
}
|
||||
|
||||
axelor {
|
||||
title "Axelor Business Production"
|
||||
description "Axelor Business Production Module"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(":modules:axelor-business-project")
|
||||
compile project(":modules:axelor-production")
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.db.repo;
|
||||
|
||||
import com.axelor.apps.production.db.ManufOrder;
|
||||
import com.axelor.apps.production.db.repo.ManufOrderManagementRepository;
|
||||
|
||||
public class ManufOrderBusinessProductionManagementRepository
|
||||
extends ManufOrderManagementRepository {
|
||||
|
||||
@Override
|
||||
public ManufOrder copy(ManufOrder entity, boolean deep) {
|
||||
entity = super.copy(entity, deep);
|
||||
entity.setTimesheetLine(null);
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.exception;
|
||||
|
||||
public interface IExceptionMessage {
|
||||
|
||||
String OPERATION_ORDER_TIMESHEET_WAITING_VALIDATION = /*$$(*/
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?" /*)*/;
|
||||
String MANUF_ORDER_TIMESHEET_WAITING_VALIDATION = /*$$(*/
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?" /*)*/;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.module;
|
||||
|
||||
import com.axelor.app.AxelorModule;
|
||||
import com.axelor.apps.businessproduction.db.repo.ManufOrderBusinessProductionManagementRepository;
|
||||
import com.axelor.apps.businessproduction.service.CostSheetServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.InvoicingProjectServiceBusinessProdImpl;
|
||||
import com.axelor.apps.businessproduction.service.ManufOrderServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.ManufOrderValidateBusinessService;
|
||||
import com.axelor.apps.businessproduction.service.ManufOrderValidateBusinessServiceImpl;
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderTimesheetService;
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderTimesheetServiceImpl;
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderValidateBusinessService;
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderValidateBusinessServiceImpl;
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderWorkflowServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.ProductionOrderSaleOrderServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.ProductionOrderServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.ProductionOrderWizardServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.TimesheetBusinessProductionServiceImpl;
|
||||
import com.axelor.apps.businessproject.service.InvoicingProjectService;
|
||||
import com.axelor.apps.businessproject.service.TimesheetProjectServiceImpl;
|
||||
import com.axelor.apps.production.db.repo.ManufOrderManagementRepository;
|
||||
import com.axelor.apps.production.service.costsheet.CostSheetServiceImpl;
|
||||
import com.axelor.apps.production.service.manuforder.ManufOrderServiceImpl;
|
||||
import com.axelor.apps.production.service.operationorder.OperationOrderServiceImpl;
|
||||
import com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderSaleOrderServiceImpl;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderServiceImpl;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderWizardServiceImpl;
|
||||
|
||||
public class BusinessProductionModule extends AxelorModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ProductionOrderServiceImpl.class).to(ProductionOrderServiceBusinessImpl.class);
|
||||
bind(CostSheetServiceImpl.class).to(CostSheetServiceBusinessImpl.class);
|
||||
bind(ManufOrderServiceImpl.class).to(ManufOrderServiceBusinessImpl.class);
|
||||
bind(OperationOrderServiceImpl.class).to(OperationOrderServiceBusinessImpl.class);
|
||||
bind(ProductionOrderServiceImpl.class).to(ProductionOrderServiceBusinessImpl.class);
|
||||
bind(ProductionOrderWizardServiceImpl.class).to(ProductionOrderWizardServiceBusinessImpl.class);
|
||||
bind(ProductionOrderSaleOrderServiceImpl.class)
|
||||
.to(ProductionOrderSaleOrderServiceBusinessImpl.class);
|
||||
bind(InvoicingProjectService.class).to(InvoicingProjectServiceBusinessProdImpl.class);
|
||||
bind(OperationOrderWorkflowService.class).to(OperationOrderWorkflowServiceBusinessImpl.class);
|
||||
bind(ManufOrderValidateBusinessService.class).to(ManufOrderValidateBusinessServiceImpl.class);
|
||||
bind(OperationOrderValidateBusinessService.class)
|
||||
.to(OperationOrderValidateBusinessServiceImpl.class);
|
||||
bind(TimesheetProjectServiceImpl.class).to(TimesheetBusinessProductionServiceImpl.class);
|
||||
bind(OperationOrderTimesheetService.class).to(OperationOrderTimesheetServiceImpl.class);
|
||||
bind(ManufOrderManagementRepository.class)
|
||||
.to(ManufOrderBusinessProductionManagementRepository.class);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.base.service.UnitConversionService;
|
||||
import com.axelor.apps.hr.db.Employee;
|
||||
import com.axelor.apps.production.db.CostSheetLine;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import com.axelor.apps.production.db.ProdHumanResource;
|
||||
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
||||
import com.axelor.apps.production.db.repo.CostSheetRepository;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.apps.production.service.costsheet.CostSheetLineService;
|
||||
import com.axelor.apps.production.service.costsheet.CostSheetServiceImpl;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.google.inject.Inject;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CostSheetServiceBusinessImpl extends CostSheetServiceImpl {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
@Inject
|
||||
public CostSheetServiceBusinessImpl(
|
||||
AppProductionService appProductionService,
|
||||
UnitConversionService unitConversionService,
|
||||
CostSheetLineService costSheetLineService,
|
||||
BillOfMaterialRepository billOfMaterialRepo) {
|
||||
|
||||
super(appProductionService, unitConversionService, costSheetLineService, billOfMaterialRepo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _computeHumanResourceCost(
|
||||
ProdHumanResource prodHumanResource,
|
||||
int priority,
|
||||
int bomLevel,
|
||||
CostSheetLine parentCostSheetLine)
|
||||
throws AxelorException {
|
||||
|
||||
Employee employee = prodHumanResource.getEmployee();
|
||||
|
||||
if (employee != null) {
|
||||
|
||||
BigDecimal durationHours =
|
||||
new BigDecimal(prodHumanResource.getDuration())
|
||||
.divide(
|
||||
BigDecimal.valueOf(3600),
|
||||
appProductionService.getNbDecimalDigitForUnitPrice(),
|
||||
BigDecimal.ROUND_HALF_EVEN);
|
||||
|
||||
costSheet.addCostSheetLineListItem(
|
||||
costSheetLineService.createWorkCenterHRCostSheetLine(
|
||||
prodHumanResource.getWorkCenter(),
|
||||
prodHumanResource,
|
||||
priority,
|
||||
bomLevel,
|
||||
parentCostSheetLine,
|
||||
durationHours,
|
||||
employee.getHourlyRate().multiply(durationHours),
|
||||
hourUnit));
|
||||
|
||||
} else {
|
||||
|
||||
super._computeHumanResourceCost(prodHumanResource, priority, bomLevel, parentCostSheetLine);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void computeRealHumanResourceCost(
|
||||
OperationOrder operationOrder,
|
||||
int priority,
|
||||
int bomLevel,
|
||||
CostSheetLine parentCostSheetLine,
|
||||
LocalDate previousCostSheetDate)
|
||||
throws AxelorException {
|
||||
if (operationOrder.getTimesheetLineList() != null) {
|
||||
Long duration = 0L;
|
||||
if (parentCostSheetLine.getCostSheet().getCalculationTypeSelect()
|
||||
== CostSheetRepository.CALCULATION_END_OF_PRODUCTION
|
||||
|| parentCostSheetLine.getCostSheet().getCalculationTypeSelect()
|
||||
== CostSheetRepository.CALCULATION_PARTIAL_END_OF_PRODUCTION) {
|
||||
Period period =
|
||||
previousCostSheetDate != null
|
||||
? Period.between(
|
||||
parentCostSheetLine.getCostSheet().getCalculationDate(), previousCostSheetDate)
|
||||
: null;
|
||||
duration =
|
||||
period != null ? Long.valueOf(period.getDays() * 24) : operationOrder.getRealDuration();
|
||||
} else if (parentCostSheetLine.getCostSheet().getCalculationTypeSelect()
|
||||
== CostSheetRepository.CALCULATION_WORK_IN_PROGRESS) {
|
||||
|
||||
duration =
|
||||
operationOrder.getRealDuration()
|
||||
- (operationOrder.getPlannedDuration()
|
||||
* costSheet.getManufOrderProducedRatio().longValue());
|
||||
}
|
||||
|
||||
// TODO get the timesheet Line done when we run the calculation.
|
||||
|
||||
this.computeRealHumanResourceCost(
|
||||
null, operationOrder.getWorkCenter(), priority, bomLevel, parentCostSheetLine, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.businessproject.db.InvoicingProject;
|
||||
import com.axelor.apps.businessproject.service.InvoicingProjectService;
|
||||
import com.axelor.apps.production.db.ManufOrder;
|
||||
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||
import com.axelor.apps.project.db.Project;
|
||||
import com.axelor.apps.project.db.repo.ProjectRepository;
|
||||
import com.axelor.apps.project.service.ProjectServiceImpl;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.google.inject.persist.Transactional;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class InvoicingProjectServiceBusinessProdImpl extends InvoicingProjectService {
|
||||
|
||||
@Override
|
||||
public void setLines(InvoicingProject invoicingProject, Project project, int counter) {
|
||||
|
||||
if (counter > ProjectServiceImpl.MAX_LEVEL_OF_PROJECT) {
|
||||
return;
|
||||
}
|
||||
counter++;
|
||||
|
||||
this.fillLines(invoicingProject, project);
|
||||
List<Project> projectChildrenList =
|
||||
Beans.get(ProjectRepository.class).all().filter("self.parentProject = ?1", project).fetch();
|
||||
|
||||
for (Project projectChild : projectChildrenList) {
|
||||
this.setLines(invoicingProject, projectChild, counter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillLines(InvoicingProject invoicingProject, Project project) {
|
||||
super.fillLines(invoicingProject, project);
|
||||
if (invoicingProject.getManufOrderSet() == null) {
|
||||
invoicingProject.setManufOrderSet(new HashSet<ManufOrder>());
|
||||
}
|
||||
|
||||
if (invoicingProject.getDeadlineDate() != null) {
|
||||
LocalDateTime deadlineDateToDateTime = invoicingProject.getDeadlineDate().atStartOfDay();
|
||||
invoicingProject
|
||||
.getManufOrderSet()
|
||||
.addAll(
|
||||
Beans.get(ManufOrderRepository.class)
|
||||
.all()
|
||||
.filter(
|
||||
"self.productionOrder.project = ?1 AND (self.realStartDateT < ?2)",
|
||||
project,
|
||||
deadlineDateToDateTime)
|
||||
.fetch());
|
||||
} else {
|
||||
invoicingProject
|
||||
.getManufOrderSet()
|
||||
.addAll(
|
||||
Beans.get(ManufOrderRepository.class)
|
||||
.all()
|
||||
.filter("self.productionOrder.project = ?1", project)
|
||||
.fetch());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLines(InvoicingProject invoicingProject) {
|
||||
|
||||
super.clearLines(invoicingProject);
|
||||
invoicingProject.setManufOrderSet(new HashSet<ManufOrder>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countToInvoice(Project project) {
|
||||
|
||||
int toInvoiceCount = super.countToInvoice(project);
|
||||
|
||||
int productionOrderCount =
|
||||
(int)
|
||||
Beans.get(ManufOrderRepository.class)
|
||||
.all()
|
||||
.filter("self.productionOrder.project = ?1", project)
|
||||
.count();
|
||||
toInvoiceCount += productionOrderCount;
|
||||
|
||||
return toInvoiceCount;
|
||||
}
|
||||
|
||||
@Transactional(rollbackOn = {AxelorException.class, Exception.class})
|
||||
@Override
|
||||
public InvoicingProject generateInvoicingProject(Project project) {
|
||||
|
||||
InvoicingProject invoicingProject = super.generateInvoicingProject(project);
|
||||
|
||||
if (invoicingProject != null
|
||||
&& invoicingProject.getId() == null
|
||||
&& !invoicingProject.getManufOrderSet().isEmpty()) {
|
||||
return invoicingProjectRepo.save(invoicingProject);
|
||||
}
|
||||
|
||||
return invoicingProject;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.base.db.Company;
|
||||
import com.axelor.apps.base.db.Product;
|
||||
import com.axelor.apps.base.service.ProductVariantService;
|
||||
import com.axelor.apps.base.service.administration.SequenceService;
|
||||
import com.axelor.apps.production.db.BillOfMaterial;
|
||||
import com.axelor.apps.production.db.ManufOrder;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||
import com.axelor.apps.production.db.repo.ProdProductRepository;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.apps.production.service.manuforder.ManufOrderServiceImpl;
|
||||
import com.axelor.apps.production.service.manuforder.ManufOrderWorkflowService;
|
||||
import com.axelor.apps.production.service.operationorder.OperationOrderService;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.persist.Transactional;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ManufOrderServiceBusinessImpl extends ManufOrderServiceImpl {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
protected OperationOrderServiceBusinessImpl operationOrderServiceBusinessImpl;
|
||||
|
||||
@Inject
|
||||
public ManufOrderServiceBusinessImpl(
|
||||
SequenceService sequenceService,
|
||||
OperationOrderService operationOrderService,
|
||||
ManufOrderWorkflowService manufOrderWorkflowService,
|
||||
ProductVariantService productVariantService,
|
||||
AppProductionService appProductionService,
|
||||
ManufOrderRepository manufOrderRepo,
|
||||
ProdProductRepository prodProductRepo,
|
||||
OperationOrderServiceBusinessImpl operationOrderServiceBusinessImpl) {
|
||||
super(
|
||||
sequenceService,
|
||||
operationOrderService,
|
||||
manufOrderWorkflowService,
|
||||
productVariantService,
|
||||
appProductionService,
|
||||
manufOrderRepo,
|
||||
prodProductRepo);
|
||||
this.operationOrderServiceBusinessImpl = operationOrderServiceBusinessImpl;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void propagateIsToInvoice(ManufOrder manufOrder) {
|
||||
|
||||
logger.debug(
|
||||
"{} is to invoice ? {}", manufOrder.getManufOrderSeq(), manufOrder.getIsToInvoice());
|
||||
|
||||
boolean isToInvoice = manufOrder.getIsToInvoice();
|
||||
|
||||
if (manufOrder.getOperationOrderList() != null) {
|
||||
for (OperationOrder operationOrder : manufOrder.getOperationOrderList()) {
|
||||
|
||||
operationOrder.setIsToInvoice(isToInvoice);
|
||||
}
|
||||
}
|
||||
|
||||
manufOrderRepo.save(manufOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManufOrder createManufOrder(
|
||||
Product product,
|
||||
BigDecimal qty,
|
||||
int priority,
|
||||
boolean isToInvoice,
|
||||
Company company,
|
||||
BillOfMaterial billOfMaterial,
|
||||
LocalDateTime plannedStartDateT,
|
||||
LocalDateTime plannedEndDateT)
|
||||
throws AxelorException {
|
||||
|
||||
ManufOrder manufOrder =
|
||||
super.createManufOrder(
|
||||
product,
|
||||
qty,
|
||||
priority,
|
||||
isToInvoice,
|
||||
company,
|
||||
billOfMaterial,
|
||||
plannedStartDateT,
|
||||
plannedEndDateT);
|
||||
|
||||
manufOrder.setIsToInvoice(isToInvoice);
|
||||
|
||||
return manufOrder;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.production.db.ManufOrder;
|
||||
|
||||
public interface ManufOrderValidateBusinessService {
|
||||
|
||||
/**
|
||||
* Check timesheet lines on manuf order.
|
||||
*
|
||||
* @param manufOrder
|
||||
* @return the number of timesheets waiting validation linked to the operation order.
|
||||
*/
|
||||
long checkTimesheet(ManufOrder manufOrder);
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.production.db.ManufOrder;
|
||||
import com.axelor.inject.Beans;
|
||||
|
||||
public class ManufOrderValidateBusinessServiceImpl implements ManufOrderValidateBusinessService {
|
||||
|
||||
@Override
|
||||
public long checkTimesheet(ManufOrder manufOrder) {
|
||||
OperationOrderValidateBusinessService operationOrderValidService =
|
||||
Beans.get(OperationOrderValidateBusinessService.class);
|
||||
return manufOrder
|
||||
.getOperationOrderList()
|
||||
.stream()
|
||||
.mapToLong(operationOrderValidService::checkTimesheet)
|
||||
.sum();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.production.db.ManufOrder;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import com.axelor.apps.production.db.ProdHumanResource;
|
||||
import com.axelor.apps.production.db.ProdProcessLine;
|
||||
import com.axelor.apps.production.db.WorkCenter;
|
||||
import com.axelor.apps.production.db.repo.OperationOrderRepository;
|
||||
import com.axelor.apps.production.service.operationorder.OperationOrderServiceImpl;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.google.inject.persist.Transactional;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OperationOrderServiceBusinessImpl extends OperationOrderServiceImpl {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public OperationOrder createOperationOrder(ManufOrder manufOrder, ProdProcessLine prodProcessLine)
|
||||
throws AxelorException {
|
||||
|
||||
OperationOrder operationOrder =
|
||||
this.createOperationOrder(
|
||||
manufOrder,
|
||||
prodProcessLine.getPriority(),
|
||||
manufOrder.getIsToInvoice(),
|
||||
prodProcessLine.getWorkCenter(),
|
||||
prodProcessLine.getWorkCenter(),
|
||||
prodProcessLine);
|
||||
|
||||
return Beans.get(OperationOrderRepository.class).save(operationOrder);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public OperationOrder createOperationOrder(
|
||||
ManufOrder manufOrder,
|
||||
int priority,
|
||||
boolean isToInvoice,
|
||||
WorkCenter workCenter,
|
||||
WorkCenter machineWorkCenter,
|
||||
ProdProcessLine prodProcessLine) {
|
||||
|
||||
logger.debug(
|
||||
"Création d'une opération {} pour l'OF {}", priority, manufOrder.getManufOrderSeq());
|
||||
|
||||
String operationName = prodProcessLine.getName();
|
||||
|
||||
OperationOrder operationOrder =
|
||||
new OperationOrder(
|
||||
priority,
|
||||
this.computeName(manufOrder, priority, operationName),
|
||||
operationName,
|
||||
manufOrder,
|
||||
workCenter,
|
||||
machineWorkCenter,
|
||||
OperationOrderRepository.STATUS_DRAFT,
|
||||
prodProcessLine);
|
||||
|
||||
operationOrder.setIsToInvoice(isToInvoice);
|
||||
|
||||
this._createHumanResourceList(operationOrder, machineWorkCenter);
|
||||
|
||||
return Beans.get(OperationOrderRepository.class).save(operationOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProdHumanResource copyProdHumanResource(ProdHumanResource prodHumanResource) {
|
||||
|
||||
ProdHumanResource prodHumanResourceCopy =
|
||||
new ProdHumanResource(prodHumanResource.getProduct(), prodHumanResource.getDuration());
|
||||
prodHumanResourceCopy.setEmployee(prodHumanResource.getEmployee());
|
||||
return prodHumanResourceCopy;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.hr.db.Timesheet;
|
||||
import com.axelor.apps.hr.db.TimesheetLine;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import java.util.List;
|
||||
|
||||
public interface OperationOrderTimesheetService {
|
||||
|
||||
/**
|
||||
* Given an unsaved timesheet line, update the related orders by taking the unsaved timesheet line
|
||||
* and the timesheet line in db.
|
||||
*
|
||||
* @param operationOrder
|
||||
* @param oldTimesheetLineList
|
||||
* @param newTimesheetLineList
|
||||
*/
|
||||
void updateOperationOrder(
|
||||
OperationOrder operationOrder,
|
||||
List<TimesheetLine> oldTimesheetLineList,
|
||||
List<TimesheetLine> newTimesheetLineList);
|
||||
|
||||
/**
|
||||
* Given an unsaved timesheet, update the related orders by taking all timesheet lines and
|
||||
* timesheet lines in db.
|
||||
*
|
||||
* @param timesheet an unsaved timesheet.
|
||||
*/
|
||||
void updateOperationOrders(Timesheet timesheet) throws AxelorException;
|
||||
|
||||
/**
|
||||
* Compute real duration of operation orders related to a timesheet line list.
|
||||
*
|
||||
* @param timesheetLineList a list of timesheet lines linked to operation orders.
|
||||
*/
|
||||
void updateAllRealDuration(List<TimesheetLine> timesheetLineList);
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.hr.db.Timesheet;
|
||||
import com.axelor.apps.hr.db.TimesheetLine;
|
||||
import com.axelor.apps.hr.db.repo.TimesheetLineRepository;
|
||||
import com.axelor.apps.hr.service.timesheet.TimesheetLineService;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService;
|
||||
import com.axelor.apps.tool.date.DurationTool;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.google.inject.persist.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class OperationOrderTimesheetServiceImpl implements OperationOrderTimesheetService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateOperationOrder(
|
||||
OperationOrder operationOrder,
|
||||
List<TimesheetLine> oldTimesheetLineList,
|
||||
List<TimesheetLine> newTimesheetLineList) {
|
||||
List<TimesheetLine> operationOrderTsLineList =
|
||||
new ArrayList<>(operationOrder.getTimesheetLineList());
|
||||
|
||||
operationOrderTsLineList.removeAll(oldTimesheetLineList);
|
||||
operationOrderTsLineList.addAll(
|
||||
newTimesheetLineList
|
||||
.stream()
|
||||
.filter(timesheetLine -> operationOrder.equals(timesheetLine.getOperationOrder()))
|
||||
.collect(Collectors.toList()));
|
||||
long durationLong =
|
||||
DurationTool.getSecondsDuration(
|
||||
Beans.get(TimesheetLineService.class).computeTotalDuration(operationOrderTsLineList));
|
||||
operationOrder.setRealDuration(durationLong);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public void updateOperationOrders(Timesheet timesheet) throws AxelorException {
|
||||
if (timesheet.getTimesheetLineList() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ensure that correct hoursDuration is filled
|
||||
TimesheetLineService timesheetLineService = Beans.get(TimesheetLineService.class);
|
||||
for (TimesheetLine timesheetLine : timesheet.getTimesheetLineList()) {
|
||||
BigDecimal hoursDuration =
|
||||
timesheetLineService.computeHoursDuration(timesheet, timesheetLine.getDuration(), true);
|
||||
timesheetLine.setHoursDuration(hoursDuration);
|
||||
}
|
||||
|
||||
if (!Beans.get(AppProductionService.class)
|
||||
.getAppProduction()
|
||||
.getEnableTimesheetOnManufOrder()) {
|
||||
return;
|
||||
}
|
||||
List<TimesheetLine> oldTimesheetLineList =
|
||||
Beans.get(TimesheetLineRepository.class)
|
||||
.all()
|
||||
.filter("self.timesheet.id = :timesheetId")
|
||||
.bind("timesheetId", timesheet.getId())
|
||||
.fetch();
|
||||
List<TimesheetLine> newTimesheetLineList = timesheet.getTimesheetLineList();
|
||||
|
||||
List<TimesheetLine> allTimesheetLineList = new ArrayList<>(oldTimesheetLineList);
|
||||
allTimesheetLineList.addAll(newTimesheetLineList);
|
||||
|
||||
List<OperationOrder> operationOrdersToUpdate =
|
||||
allTimesheetLineList
|
||||
.stream()
|
||||
.map(TimesheetLine::getOperationOrder)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
operationOrdersToUpdate.forEach(
|
||||
operationOrder ->
|
||||
updateOperationOrder(operationOrder, oldTimesheetLineList, newTimesheetLineList));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllRealDuration(List<TimesheetLine> timesheetLineList) {
|
||||
if (timesheetLineList == null) {
|
||||
return;
|
||||
}
|
||||
List<OperationOrder> operationOrderList =
|
||||
timesheetLineList
|
||||
.stream()
|
||||
.map(TimesheetLine::getOperationOrder)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
OperationOrderWorkflowService operationOrderWorkflowService =
|
||||
Beans.get(OperationOrderWorkflowService.class);
|
||||
operationOrderList.forEach(operationOrderWorkflowService::updateRealDuration);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
|
||||
public interface OperationOrderValidateBusinessService {
|
||||
|
||||
/**
|
||||
* Check timesheet lines on operation order.
|
||||
*
|
||||
* @param operationOrder
|
||||
* @return the number of timesheets waiting validation linked to the operation order.
|
||||
*/
|
||||
long checkTimesheet(OperationOrder operationOrder);
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.hr.db.TimesheetLine;
|
||||
import com.axelor.apps.hr.db.repo.TimesheetRepository;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import java.util.Objects;
|
||||
|
||||
public class OperationOrderValidateBusinessServiceImpl
|
||||
implements OperationOrderValidateBusinessService {
|
||||
|
||||
@Override
|
||||
public long checkTimesheet(OperationOrder operationOrder) {
|
||||
return operationOrder
|
||||
.getTimesheetLineList()
|
||||
.stream()
|
||||
.map(TimesheetLine::getTimesheet)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(timesheet -> timesheet.getStatusSelect() == TimesheetRepository.STATUS_CONFIRMED)
|
||||
.count();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.hr.db.TimesheetLine;
|
||||
import com.axelor.apps.hr.service.timesheet.TimesheetLineService;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import com.axelor.apps.production.db.OperationOrderDuration;
|
||||
import com.axelor.apps.production.db.repo.OperationOrderDurationRepository;
|
||||
import com.axelor.apps.production.db.repo.OperationOrderRepository;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.apps.production.service.operationorder.OperationOrderStockMoveService;
|
||||
import com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.google.inject.Inject;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
public class OperationOrderWorkflowServiceBusinessImpl extends OperationOrderWorkflowService {
|
||||
|
||||
@Inject
|
||||
public OperationOrderWorkflowServiceBusinessImpl(
|
||||
OperationOrderStockMoveService operationOrderStockMoveService,
|
||||
OperationOrderRepository operationOrderRepo,
|
||||
OperationOrderDurationRepository operationOrderDurationRepo,
|
||||
AppProductionService appProductionService) {
|
||||
super(
|
||||
operationOrderStockMoveService,
|
||||
operationOrderRepo,
|
||||
operationOrderDurationRepo,
|
||||
appProductionService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the duration of all the {@link OperationOrderDuration} of {@code operationOrder} If we
|
||||
* manage timesheet with manuf order, we get the duration with the timesheet lines.
|
||||
*
|
||||
* @param operationOrder An operation order
|
||||
* @return Real duration of {@code operationOrder}
|
||||
*/
|
||||
@Override
|
||||
public Duration computeRealDuration(OperationOrder operationOrder) {
|
||||
if (appProductionService.getAppProduction().getEnableTimesheetOnManufOrder()) {
|
||||
List<TimesheetLine> timesheetLineList = operationOrder.getTimesheetLineList();
|
||||
return Beans.get(TimesheetLineService.class).computeTotalDuration(timesheetLineList);
|
||||
} else {
|
||||
return super.computeRealDuration(operationOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.base.service.UnitConversionService;
|
||||
import com.axelor.apps.production.db.ProductionOrder;
|
||||
import com.axelor.apps.production.db.repo.ProductionOrderRepository;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderSaleOrderServiceImpl;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderService;
|
||||
import com.axelor.apps.project.db.Project;
|
||||
import com.axelor.apps.sale.db.SaleOrder;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.persist.Transactional;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ProductionOrderSaleOrderServiceBusinessImpl
|
||||
extends ProductionOrderSaleOrderServiceImpl {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
protected ProductionOrderServiceBusinessImpl productionOrderServiceBusinessImpl;
|
||||
|
||||
@Inject
|
||||
public ProductionOrderSaleOrderServiceBusinessImpl(
|
||||
UnitConversionService unitConversionService,
|
||||
ProductionOrderService productionOrderService,
|
||||
ProductionOrderRepository productionOrderRepo,
|
||||
ProductionOrderServiceBusinessImpl productionOrderServiceBusinessImpl,
|
||||
AppProductionService appProductionService) {
|
||||
super(unitConversionService, productionOrderService, productionOrderRepo, appProductionService);
|
||||
|
||||
this.productionOrderServiceBusinessImpl = productionOrderServiceBusinessImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProductionOrder createProductionOrder(SaleOrder saleOrder) throws AxelorException {
|
||||
|
||||
ProductionOrder productionOrder = super.createProductionOrder(saleOrder);
|
||||
productionOrder.setProject(saleOrder.getProject());
|
||||
return productionOrder;
|
||||
}
|
||||
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public void createSaleOrder(ProductionOrder productionOrder) throws AxelorException {
|
||||
|
||||
logger.debug(
|
||||
"Création d'un devis client pour l'ordre de production : {}",
|
||||
new Object[] {productionOrder.getProductionOrderSeq()});
|
||||
|
||||
Project project = productionOrder.getProject();
|
||||
|
||||
project.getClientPartner();
|
||||
|
||||
// if(businessFolder.getCompany() != null) {
|
||||
//
|
||||
// SaleOrder saleOrder = saleOrderServiceStockImpl.createSaleOrder(
|
||||
// businessFolder,
|
||||
// user,
|
||||
// businessFolder.getCompany(),
|
||||
// null,
|
||||
// partner.getCurrency(),
|
||||
// null,
|
||||
// null,
|
||||
// null,
|
||||
// saleOrderServiceStockImpl.getLocation(businessProject.getCompany()),
|
||||
// today,
|
||||
// Beans.get(PriceListRepository.class).all().filter("self.partner = ?1 AND self.typeSelect
|
||||
// = 1", partner).fetchOne(),
|
||||
// partner);
|
||||
//
|
||||
// Beans.get(SaleOrderRepository.class).save(saleOrder);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //TODO
|
||||
//
|
||||
// for(SaleOrderLine saleOrderLine : saleOrderLineList) {
|
||||
//
|
||||
//
|
||||
// purchaseOrder.addPurchaseOrderLineListItem(purchaseOrderLineService.createPurchaseOrderLine(purchaseOrder, saleOrderLine));
|
||||
//
|
||||
// }
|
||||
//
|
||||
// purchaseOrderService.computePurchaseOrder(purchaseOrder);
|
||||
//
|
||||
// purchaseOrder.save();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.base.db.Product;
|
||||
import com.axelor.apps.base.service.administration.SequenceService;
|
||||
import com.axelor.apps.production.db.BillOfMaterial;
|
||||
import com.axelor.apps.production.db.ProductionOrder;
|
||||
import com.axelor.apps.production.db.repo.ProductionOrderRepository;
|
||||
import com.axelor.apps.production.service.manuforder.ManufOrderService;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderServiceImpl;
|
||||
import com.axelor.apps.project.db.Project;
|
||||
import com.axelor.apps.sale.db.SaleOrder;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.persist.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class ProductionOrderServiceBusinessImpl extends ProductionOrderServiceImpl {
|
||||
|
||||
@Inject
|
||||
public ProductionOrderServiceBusinessImpl(
|
||||
ManufOrderService manufOrderService,
|
||||
SequenceService sequenceService,
|
||||
ProductionOrderRepository productionOrderRepo) {
|
||||
super(manufOrderService, sequenceService, productionOrderRepo);
|
||||
}
|
||||
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public ProductionOrder generateProductionOrder(
|
||||
Product product,
|
||||
BillOfMaterial billOfMaterial,
|
||||
BigDecimal qtyRequested,
|
||||
Project project,
|
||||
LocalDateTime startDate,
|
||||
LocalDateTime endDate,
|
||||
SaleOrder saleOrder)
|
||||
throws AxelorException {
|
||||
|
||||
ProductionOrder productionOrder = this.createProductionOrder(saleOrder);
|
||||
productionOrder.setProject(project);
|
||||
|
||||
this.addManufOrder(
|
||||
productionOrder,
|
||||
product,
|
||||
billOfMaterial,
|
||||
qtyRequested,
|
||||
startDate,
|
||||
endDate,
|
||||
saleOrder,
|
||||
ManufOrderService.ORIGIN_TYPE_OTHER);
|
||||
|
||||
return productionOrderRepo.save(productionOrder);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.base.db.Product;
|
||||
import com.axelor.apps.base.db.repo.ProductRepository;
|
||||
import com.axelor.apps.production.db.BillOfMaterial;
|
||||
import com.axelor.apps.production.db.ProductionOrder;
|
||||
import com.axelor.apps.production.db.repo.BillOfMaterialRepository;
|
||||
import com.axelor.apps.production.exceptions.IExceptionMessage;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderService;
|
||||
import com.axelor.apps.production.service.productionorder.ProductionOrderWizardServiceImpl;
|
||||
import com.axelor.apps.project.db.Project;
|
||||
import com.axelor.apps.project.db.repo.ProjectRepository;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
||||
import com.axelor.i18n.I18n;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.Context;
|
||||
import com.google.inject.Inject;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ProductionOrderWizardServiceBusinessImpl extends ProductionOrderWizardServiceImpl {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
protected ProductionOrderServiceBusinessImpl productionOrderServiceBusinessImpl;
|
||||
|
||||
@Inject
|
||||
public ProductionOrderWizardServiceBusinessImpl(
|
||||
ProductionOrderService productionOrderService,
|
||||
BillOfMaterialRepository billOfMaterialRepo,
|
||||
ProductRepository productRepo,
|
||||
AppProductionService appProductionService,
|
||||
ProductionOrderServiceBusinessImpl productionOrderServiceBusinessImpl) {
|
||||
super(productionOrderService, billOfMaterialRepo, productRepo, appProductionService);
|
||||
this.productionOrderServiceBusinessImpl = productionOrderServiceBusinessImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Long validate(Context context) throws AxelorException {
|
||||
|
||||
Map<String, Object> bomContext = (Map<String, Object>) context.get("billOfMaterial");
|
||||
BillOfMaterial billOfMaterial =
|
||||
billOfMaterialRepo.find(((Integer) bomContext.get("id")).longValue());
|
||||
|
||||
BigDecimal qty = new BigDecimal((String) context.get("qty"));
|
||||
|
||||
Product product = null;
|
||||
|
||||
if (context.get("product") != null) {
|
||||
Map<String, Object> productContext = (Map<String, Object>) context.get("product");
|
||||
product = productRepo.find(((Integer) productContext.get("id")).longValue());
|
||||
} else {
|
||||
product = billOfMaterial.getProduct();
|
||||
}
|
||||
|
||||
ZonedDateTime startDateT, endDateT = null;
|
||||
if (context.containsKey("_startDate") && context.get("_startDate") != null) {
|
||||
startDateT =
|
||||
ZonedDateTime.parse(
|
||||
context.get("_startDate").toString(),
|
||||
DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.systemDefault()));
|
||||
} else {
|
||||
startDateT = appProductionService.getTodayDateTime();
|
||||
}
|
||||
|
||||
if (context.containsKey("_endDate") && context.get("_endDate") != null) {
|
||||
endDateT =
|
||||
ZonedDateTime.parse(
|
||||
context.get("_endDate").toString(),
|
||||
DateTimeFormatter.ISO_INSTANT.withZone(ZoneId.systemDefault()));
|
||||
}
|
||||
|
||||
Project project = null;
|
||||
if (context.get("business_id") != null) {
|
||||
project =
|
||||
Beans.get(ProjectRepository.class)
|
||||
.find(((Integer) context.get("business_id")).longValue());
|
||||
}
|
||||
|
||||
ProductionOrder productionOrder =
|
||||
productionOrderServiceBusinessImpl.generateProductionOrder(
|
||||
product,
|
||||
billOfMaterial,
|
||||
qty,
|
||||
project,
|
||||
startDateT.toLocalDateTime(),
|
||||
endDateT != null ? endDateT.toLocalDateTime() : null,
|
||||
null);
|
||||
|
||||
if (productionOrder != null) {
|
||||
return productionOrder.getId();
|
||||
} else {
|
||||
throw new AxelorException(
|
||||
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
||||
I18n.get(IExceptionMessage.PRODUCTION_ORDER_2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.service;
|
||||
|
||||
import com.axelor.apps.base.service.PriceListService;
|
||||
import com.axelor.apps.businessproject.service.TimesheetProjectServiceImpl;
|
||||
import com.axelor.apps.hr.db.Timesheet;
|
||||
import com.axelor.apps.hr.service.app.AppHumanResourceService;
|
||||
import com.axelor.apps.hr.service.config.HRConfigService;
|
||||
import com.axelor.apps.hr.service.timesheet.TimesheetLineService;
|
||||
import com.axelor.apps.hr.service.user.UserHrService;
|
||||
import com.axelor.apps.message.service.TemplateMessageService;
|
||||
import com.axelor.apps.project.db.repo.ProjectPlanningTimeRepository;
|
||||
import com.axelor.apps.project.db.repo.ProjectRepository;
|
||||
import com.axelor.auth.db.repo.UserRepository;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.team.db.repo.TeamTaskRepository;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.persist.Transactional;
|
||||
|
||||
public class TimesheetBusinessProductionServiceImpl extends TimesheetProjectServiceImpl {
|
||||
|
||||
@Inject
|
||||
public TimesheetBusinessProductionServiceImpl(
|
||||
PriceListService priceListService,
|
||||
AppHumanResourceService appHumanResourceService,
|
||||
HRConfigService hrConfigService,
|
||||
TemplateMessageService templateMessageService,
|
||||
ProjectRepository projectRepo,
|
||||
UserRepository userRepo,
|
||||
UserHrService userHrService,
|
||||
TimesheetLineService timesheetLineService,
|
||||
ProjectPlanningTimeRepository projectPlanningTimeRepository,
|
||||
TeamTaskRepository teamTaskRepository) {
|
||||
super(
|
||||
priceListService,
|
||||
appHumanResourceService,
|
||||
hrConfigService,
|
||||
templateMessageService,
|
||||
projectRepo,
|
||||
userRepo,
|
||||
userHrService,
|
||||
timesheetLineService,
|
||||
projectPlanningTimeRepository,
|
||||
teamTaskRepository);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackOn = {Exception.class})
|
||||
public void confirm(Timesheet timesheet) throws AxelorException {
|
||||
super.confirm(timesheet);
|
||||
Beans.get(OperationOrderTimesheetServiceImpl.class)
|
||||
.updateAllRealDuration(timesheet.getTimesheetLineList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void validate(Timesheet timesheet) {
|
||||
super.validate(timesheet);
|
||||
Beans.get(OperationOrderTimesheetServiceImpl.class)
|
||||
.updateAllRealDuration(timesheet.getTimesheetLineList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void refuse(Timesheet timesheet) {
|
||||
super.refuse(timesheet);
|
||||
Beans.get(OperationOrderTimesheetServiceImpl.class)
|
||||
.updateAllRealDuration(timesheet.getTimesheetLineList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void cancel(Timesheet timesheet) {
|
||||
super.cancel(timesheet);
|
||||
Beans.get(OperationOrderTimesheetServiceImpl.class)
|
||||
.updateAllRealDuration(timesheet.getTimesheetLineList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void draft(Timesheet timesheet) {
|
||||
super.draft(timesheet);
|
||||
Beans.get(OperationOrderTimesheetServiceImpl.class)
|
||||
.updateAllRealDuration(timesheet.getTimesheetLineList());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.web;
|
||||
|
||||
import com.axelor.apps.businessproduction.exception.IExceptionMessage;
|
||||
import com.axelor.apps.businessproduction.service.ManufOrderServiceBusinessImpl;
|
||||
import com.axelor.apps.businessproduction.service.ManufOrderValidateBusinessService;
|
||||
import com.axelor.apps.production.db.ManufOrder;
|
||||
import com.axelor.apps.production.db.repo.ManufOrderRepository;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.exception.service.TraceBackService;
|
||||
import com.axelor.i18n.I18n;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
import com.google.inject.Singleton;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class ManufOrderBusinessController {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
public void propagateIsToInvoice(ActionRequest request, ActionResponse response) {
|
||||
|
||||
ManufOrderServiceBusinessImpl manufOrderService =
|
||||
Beans.get(ManufOrderServiceBusinessImpl.class);
|
||||
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
|
||||
|
||||
manufOrderService.propagateIsToInvoice(
|
||||
Beans.get(ManufOrderRepository.class).find(manufOrder.getId()));
|
||||
|
||||
response.setReload(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from operation order view before finish. Alert the user if we will use timesheet waiting
|
||||
* validation for the real duration of the operation order.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
public void alertNonValidatedTimesheet(ActionRequest request, ActionResponse response) {
|
||||
try {
|
||||
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
|
||||
if (Beans.get(AppProductionService.class).getAppProduction().getEnableTimesheetOnManufOrder()
|
||||
&& Beans.get(ManufOrderValidateBusinessService.class).checkTimesheet(manufOrder) > 0) {
|
||||
response.setAlert(I18n.get(IExceptionMessage.MANUF_ORDER_TIMESHEET_WAITING_VALIDATION));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
TraceBackService.trace(response, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.web;
|
||||
|
||||
import com.axelor.apps.businessproduction.exception.IExceptionMessage;
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderValidateBusinessService;
|
||||
import com.axelor.apps.production.db.OperationOrder;
|
||||
import com.axelor.apps.production.service.app.AppProductionService;
|
||||
import com.axelor.exception.service.TraceBackService;
|
||||
import com.axelor.i18n.I18n;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
|
||||
public class OperationOrderBusinessController {
|
||||
|
||||
/**
|
||||
* Called from operation order view before finish. Alert the user if we will use timesheet waiting
|
||||
* validation for the real duration of the operation order.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
public void alertNonValidatedTimesheet(ActionRequest request, ActionResponse response) {
|
||||
try {
|
||||
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
|
||||
if (Beans.get(AppProductionService.class).getAppProduction().getEnableTimesheetOnManufOrder()
|
||||
&& Beans.get(OperationOrderValidateBusinessService.class).checkTimesheet(operationOrder)
|
||||
> 0) {
|
||||
response.setAlert(I18n.get(IExceptionMessage.OPERATION_ORDER_TIMESHEET_WAITING_VALIDATION));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
TraceBackService.trace(response, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.web;
|
||||
|
||||
import com.axelor.apps.businessproduction.service.ProductionOrderSaleOrderServiceBusinessImpl;
|
||||
import com.axelor.apps.production.db.ProductionOrder;
|
||||
import com.axelor.apps.production.db.repo.ProductionOrderRepository;
|
||||
import com.axelor.exception.AxelorException;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class ProductionOrderBusinessController {
|
||||
|
||||
public void generateSaleOrder(ActionRequest request, ActionResponse response)
|
||||
throws AxelorException {
|
||||
|
||||
ProductionOrder productionOrder = request.getContext().asType(ProductionOrder.class);
|
||||
|
||||
Beans.get(ProductionOrderSaleOrderServiceBusinessImpl.class)
|
||||
.createSaleOrder(Beans.get(ProductionOrderRepository.class).find(productionOrder.getId()));
|
||||
|
||||
response.setReload(true);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.web;
|
||||
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderTimesheetService;
|
||||
import com.axelor.apps.hr.db.Timesheet;
|
||||
import com.axelor.exception.service.TraceBackService;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
import java.util.List;
|
||||
|
||||
public class TimesheetController {
|
||||
|
||||
/**
|
||||
* Called from timesheet form view, on save. <br>
|
||||
* Call {@link OperationOrderTimesheetService#updateAllRealDuration(List)}.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
public void updateOperationOrders(ActionRequest request, ActionResponse response) {
|
||||
try {
|
||||
Timesheet timesheet = request.getContext().asType(Timesheet.class);
|
||||
Beans.get(OperationOrderTimesheetService.class).updateOperationOrders(timesheet);
|
||||
} catch (Exception e) {
|
||||
TraceBackService.trace(response, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Axelor Business Solutions
|
||||
*
|
||||
* Copyright (C) 2019 Axelor (<http://axelor.com>).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.axelor.apps.businessproduction.web;
|
||||
|
||||
import com.axelor.apps.businessproduction.service.OperationOrderTimesheetService;
|
||||
import com.axelor.apps.hr.db.Timesheet;
|
||||
import com.axelor.apps.hr.db.TimesheetLine;
|
||||
import com.axelor.exception.service.TraceBackService;
|
||||
import com.axelor.inject.Beans;
|
||||
import com.axelor.rpc.ActionRequest;
|
||||
import com.axelor.rpc.ActionResponse;
|
||||
|
||||
public class TimesheetLineController {
|
||||
|
||||
/**
|
||||
* Called from timesheet line form view, on save. <br>
|
||||
* Call {@link OperationOrderTimesheetService#updateOperationOrders(Timesheet)}.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
public void updateOperationOrder(ActionRequest request, ActionResponse response) {
|
||||
try {
|
||||
TimesheetLine timesheetLine = request.getContext().asType(TimesheetLine.class);
|
||||
Timesheet timesheet = timesheetLine.getTimesheet();
|
||||
if (timesheet == null && request.getContext().getParent() != null) {
|
||||
timesheet = request.getContext().getParent().asType(Timesheet.class);
|
||||
}
|
||||
|
||||
if (timesheet != null) {
|
||||
Beans.get(OperationOrderTimesheetService.class).updateOperationOrders(timesheet);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
TraceBackService.trace(response, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
"code";"showProductionOrderRelatedToProject"
|
||||
"production";"true"
|
||||
|
@ -0,0 +1,2 @@
|
||||
"code";"showProductionOrderRelatedToProject"
|
||||
"production";"true"
|
||||
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<csv-inputs xmlns="http://axelor.com/xml/ns/data-import"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/data-import http://axelor.com/xml/ns/data-import/data-import_5.2.xsd">
|
||||
|
||||
<input file="base_appProduction.csv" separator=";" type="com.axelor.apps.base.db.AppProduction" search="self.code = :code" update="true" />
|
||||
|
||||
</csv-inputs>
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="base" package="com.axelor.apps.base.db"/>
|
||||
|
||||
<entity name="AppProduction" lang="java" extends="App">
|
||||
|
||||
<boolean name="manageBusinessProduction" title="Manage business production" />
|
||||
<boolean name="enableTimesheetOnManufOrder" title="Enable timesheet on manuf order" default="false"/>
|
||||
|
||||
<track>
|
||||
<field name="manageBusinessProduction" on="UPDATE"/>
|
||||
<field name="enableTimesheetOnManufOrder" on="UPDATE"/>
|
||||
</track>
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" ?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="human-resource" package="com.axelor.apps.hr.db"/>
|
||||
|
||||
<entity name="Employee" cacheable="true">
|
||||
<integer name="timesheetImputationSelect" title="Timesheet imputed on" selection="business.production.employee.timesheet.imputation.select" default="1"/>
|
||||
|
||||
<extra-code>
|
||||
<![CDATA[
|
||||
public static final int TIMESHEET_PROJECT = 1;
|
||||
public static final int TIMESHEET_MANUF_ORDER = 2;
|
||||
]]>
|
||||
</extra-code>
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" ?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="business-project" package="com.axelor.apps.businessproject.db"/>
|
||||
|
||||
<entity name="InvoicingProject" cacheable="true">
|
||||
|
||||
|
||||
<many-to-many name="manufOrderSet" ref="com.axelor.apps.production.db.ManufOrder" title="Manuf. Orders Selection"/>
|
||||
|
||||
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="production" package="com.axelor.apps.production.db"/>
|
||||
|
||||
<entity name="ManufOrder" lang="java">
|
||||
|
||||
<boolean name="invoiced" readonly="true"/>
|
||||
<boolean name="isToInvoice" title="To Invoice"/>
|
||||
<one-to-many name="timesheetLine" ref="com.axelor.apps.hr.db.TimesheetLine" mappedBy="manufOrder"/>
|
||||
|
||||
</entity>
|
||||
</domain-models>
|
||||
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="production" package="com.axelor.apps.production.db"/>
|
||||
|
||||
<entity name="OperationOrder" lang="java">
|
||||
|
||||
<boolean name="isToInvoice" title="To invoice"/>
|
||||
|
||||
<one-to-many name="timesheetLineList" ref="com.axelor.apps.hr.db.TimesheetLine" mappedBy="operationOrder" title="Timesheet lines"/>
|
||||
|
||||
|
||||
</entity>
|
||||
</domain-models>
|
||||
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="production" package="com.axelor.apps.production.db"/>
|
||||
|
||||
<entity name="ProdHumanResource" lang="java">
|
||||
|
||||
<many-to-one name="employee" ref="com.axelor.apps.hr.db.Employee" title="Employee"/>
|
||||
|
||||
</entity>
|
||||
</domain-models>
|
||||
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="production" package="com.axelor.apps.production.db"/>
|
||||
|
||||
<entity name="ProductionOrder" lang="java">
|
||||
|
||||
<many-to-one name="project" ref="com.axelor.apps.project.db.Project" title="Project"/>
|
||||
|
||||
|
||||
</entity>
|
||||
</domain-models>
|
||||
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" ?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="project" package="com.axelor.apps.project.db"/>
|
||||
|
||||
<entity name="Project" cacheable="true">
|
||||
|
||||
<one-to-many name="productionOrderList" ref="com.axelor.apps.production.db.ProductionOrder" title="Production orders" mappedBy="project"/>
|
||||
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">
|
||||
|
||||
<module name="human-resource" package="com.axelor.apps.hr.db"/>
|
||||
|
||||
<entity name="TimesheetLine" lang="java">
|
||||
|
||||
<many-to-one name="operationOrder" ref="com.axelor.apps.production.db.OperationOrder" title="Operation order"/>
|
||||
<many-to-one name="manufOrder" ref="com.axelor.apps.production.db.ManufOrder" title="Manuf order"/>
|
||||
|
||||
</entity>
|
||||
|
||||
</domain-models>
|
||||
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee",,,
|
||||
"Enable timesheet on manuf order",,,
|
||||
"Invoiced",,,
|
||||
"Manage business production",,,
|
||||
"Manuf order",,,
|
||||
"Manuf. Orders Selection",,,
|
||||
"Operation order",,,
|
||||
"Overview",,,
|
||||
"Production orders",,,
|
||||
"Project",,,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?",,,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?",,,
|
||||
"Timesheet Line",,,
|
||||
"Timesheet Lines",,,
|
||||
"Timesheet imputed on",,,
|
||||
"Timesheet imputed on manufacturing order",,,
|
||||
"Timesheet imputed on project",,,
|
||||
"Timesheet line",,,
|
||||
"Timesheet lines",,,
|
||||
"To Invoice",,,
|
||||
"To invoice",,,
|
||||
"Warning, this manuforder is from another company.",,,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Mitarbeiter",,
|
||||
"Enable timesheet on manuf order","Zeiterfassung für den Fertigungsauftrag aktivieren",,
|
||||
"Invoiced","Rechnungsstellung",,
|
||||
"Manage business production","Verwalten der Unternehmensproduktion",,
|
||||
"Manuf order","Fertigungsauftrag",,
|
||||
"Manuf. Orders Selection","Hersteller. Auftragsauswahl",,
|
||||
"Operation order","Vorgangsreihenfolge",,
|
||||
"Overview","Übersicht",,
|
||||
"Production orders","Fertigungsaufträge",,
|
||||
"Project","Projekt",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Es gibt noch eine Zeiterfassungsprüfung für diesen Fertigungsauftrag, wollen Sie trotzdem fortfahren?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Es gibt noch eine Zeiterfassungsprüfung für diesen Arbeitsauftrag, wollen Sie trotzdem fortfahren?",,
|
||||
"Timesheet Line","Stundenzettel Linie",,
|
||||
"Timesheet Lines","Stundenzettel Zeilen",,
|
||||
"Timesheet imputed on","Stundenzettel, berechnet auf",,
|
||||
"Timesheet imputed on manufacturing order","Arbeitszeitblatt, das auf den Fertigungsauftrag angerechnet wird.",,
|
||||
"Timesheet imputed on project","Zeiterfassung für das Projekt",,
|
||||
"Timesheet line","Stundenzettelzeile",,
|
||||
"Timesheet lines","Zeiterfassungslinien",,
|
||||
"To Invoice","Zur Rechnung",,
|
||||
"To invoice","Zur Rechnung",,
|
||||
"Warning, this manuforder is from another company.","Achtung, dieser Hersteller ist von einer anderen Firma.",,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee",,,
|
||||
"Enable timesheet on manuf order",,,
|
||||
"Invoiced",,,
|
||||
"Manage business production",,,
|
||||
"Manuf order",,,
|
||||
"Manuf. Orders Selection",,,
|
||||
"Operation order",,,
|
||||
"Overview",,,
|
||||
"Production orders",,,
|
||||
"Project",,,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?",,,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?",,,
|
||||
"Timesheet Line",,,
|
||||
"Timesheet Lines",,,
|
||||
"Timesheet imputed on",,,
|
||||
"Timesheet imputed on manufacturing order",,,
|
||||
"Timesheet imputed on project",,,
|
||||
"Timesheet line",,,
|
||||
"Timesheet lines",,,
|
||||
"To Invoice",,,
|
||||
"To invoice",,,
|
||||
"Warning, this manuforder is from another company.",,,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Empleado",,
|
||||
"Enable timesheet on manuf order","Habilitar la hoja de horas en el pedido del fabricante",,
|
||||
"Invoiced","Facturado",,
|
||||
"Manage business production","Gestionar la producción empresarial",,
|
||||
"Manuf order","Orden de fabricación",,
|
||||
"Manuf. Orders Selection","Fabricante Selección de pedidos",,
|
||||
"Operation order","Orden de operación",,
|
||||
"Overview","Panorama general",,
|
||||
"Production orders","Órdenes de fabricación",,
|
||||
"Project","Proyecto",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Hay una hoja de horas que aún está en espera de validación en este pedido de fabricación, ¿quieres continuar de todos modos?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Hay una hoja de horas que aún está esperando la validación de esta orden de operación, ¿quieres continuar de todos modos?",,
|
||||
"Timesheet Line","Línea de la hoja de horas",,
|
||||
"Timesheet Lines","Líneas de la hoja de horas",,
|
||||
"Timesheet imputed on","Hoja de horas imputada en",,
|
||||
"Timesheet imputed on manufacturing order","Hoja de horas imputada en la orden de producción",,
|
||||
"Timesheet imputed on project","Hoja de horas imputada en el proyecto",,
|
||||
"Timesheet line","Línea de la hoja de horas",,
|
||||
"Timesheet lines","Líneas de la hoja de horas",,
|
||||
"To Invoice","Para Facturar",,
|
||||
"To invoice","Para facturar",,
|
||||
"Warning, this manuforder is from another company.","Advertencia, este fabricante es de otra compañía.",,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Employé",,
|
||||
"Enable timesheet on manuf order","Activer les feuilles de temps pour les OFs",,
|
||||
"Invoiced","Facturé",,
|
||||
"Manage business production",,,
|
||||
"Manuf order","Ordre de fabrication",,
|
||||
"Manuf. Orders Selection","Sélection ordres de fabrication",,
|
||||
"Operation order","Opération de fabrication",,
|
||||
"Overview",,,
|
||||
"Production orders","Ordres de production",,
|
||||
"Project","Projet",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Il y a des feuilles de temps en attente de validation sur cet OF, voulez vous quand même continuer ?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Il y a des feuilles de temps en attente de validation sur cet opération, voulez vous quand même continuer ?",,
|
||||
"Timesheet Line","Ligne de feuille de temps",,
|
||||
"Timesheet Lines","Lignes de feuille de temps",,
|
||||
"Timesheet imputed on","Feuilles de temps imputées sur",,
|
||||
"Timesheet imputed on manufacturing order","Feuilles de temps imputées sur O.F.",,
|
||||
"Timesheet imputed on project","Feuilles de temps imputées sur projet",,
|
||||
"Timesheet line","Ligne de feuille de temps",,
|
||||
"Timesheet lines","Lignes de feuille de temps",,
|
||||
"To Invoice","A facturer",,
|
||||
"To invoice","A facturer",,
|
||||
"Warning, this manuforder is from another company.","Attention, cet OF appartient à une autre société.",,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Dipendente",,
|
||||
"Enable timesheet on manuf order","Attivare il timesheet su ordine del produttore",,
|
||||
"Invoiced","Fatturato",,
|
||||
"Manage business production","Gestire la produzione aziendale",,
|
||||
"Manuf order","Ordine Manuf",,
|
||||
"Manuf. Orders Selection","Manuf. Selezione ordini",,
|
||||
"Operation order","Ordine di funzionamento",,
|
||||
"Overview","Panoramica",,
|
||||
"Production orders","Ordini di produzione",,
|
||||
"Project","Il progetto",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Ci sono ancora tempi di validazione in attesa su questo ordine di produzione, vuoi continuare comunque?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Ci sono ancora dei tempi di validazione in attesa di questa operazione, vuoi continuare comunque?",,
|
||||
"Timesheet Line","Linea Timesheet",,
|
||||
"Timesheet Lines","Linee Timesheet",,
|
||||
"Timesheet imputed on","Foglio orario imputato su",,
|
||||
"Timesheet imputed on manufacturing order","Foglio tempi imputato alla commessa di produzione",,
|
||||
"Timesheet imputed on project","Calendario imputato al progetto",,
|
||||
"Timesheet line","Linea Timesheet",,
|
||||
"Timesheet lines","Linee dei fogli di lavoro",,
|
||||
"To Invoice","Alla Fattura",,
|
||||
"To invoice","Alla fattura",,
|
||||
"Warning, this manuforder is from another company.","Attenzione, questo produttore è di un'altra azienda.",,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Werknemer",,
|
||||
"Enable timesheet on manuf order","Inschakelbare urenstaat op manuf order",,
|
||||
"Invoiced","Gefactureerd",,
|
||||
"Manage business production","Beheer bedrijfsproductie",,
|
||||
"Manuf order","Manuf order",,
|
||||
"Manuf. Orders Selection","Manuf. Bestellingen selecteren",,
|
||||
"Operation order","Verrichtingsorde",,
|
||||
"Overview","Overzicht",,
|
||||
"Production orders","Productieorders",,
|
||||
"Project","Project",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Er zijn nog steeds urenstaten in afwachting van validatie op deze manuf order, wilt u toch doorgaan?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Er zijn nog steeds urenstaten in afwachting van de validatie van deze werkingsvolgorde, wilt u toch doorgaan?",,
|
||||
"Timesheet Line","Timesheet Lijn",,
|
||||
"Timesheet Lines","Timesheet Lijnen",,
|
||||
"Timesheet imputed on","Timesheet toegerekend op",,
|
||||
"Timesheet imputed on manufacturing order","Timesheet toegerekend op productieorder",,
|
||||
"Timesheet imputed on project","Timesheet toegeschreven aan het project",,
|
||||
"Timesheet line","Timesheet lijn",,
|
||||
"Timesheet lines","Timesheet lijnen",,
|
||||
"To Invoice","Naar factuur",,
|
||||
"To invoice","Om te factureren",,
|
||||
"Warning, this manuforder is from another company.","Waarschuwing, deze manuforder is van een ander bedrijf.",,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Pracownik",,
|
||||
"Enable timesheet on manuf order","Włączyć arkusz czasu na zamówieniu manufaktury",,
|
||||
"Invoiced","Zafakturowany",,
|
||||
"Manage business production","Zarządzaj produkcją biznesową",,
|
||||
"Manuf order","Zamówienie Manufaktura",,
|
||||
"Manuf. Orders Selection","Manuf. Wybór zleceń",,
|
||||
"Operation order","Kolejność operacji",,
|
||||
"Overview","Przegląd",,
|
||||
"Production orders","Zamówienia produkcyjne",,
|
||||
"Project","Projekt",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Na tym zamówieniu manufaktury czekają jeszcze na walidację arkusze czasu, czy i tak chcesz kontynuować ?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Czy chcesz kontynuować tę operację, czy i tak chcesz ją kontynuować ?",,
|
||||
"Timesheet Line","Arkusz Czasu Linia",,
|
||||
"Timesheet Lines","Arkusz ćwiczeniowy Linie",,
|
||||
"Timesheet imputed on","Arkusz czasu przypisany na",,
|
||||
"Timesheet imputed on manufacturing order","Arkusz czasu przypisany na zlecenie produkcyjne",,
|
||||
"Timesheet imputed on project","Arkusz czasu przypisany do projektu",,
|
||||
"Timesheet line","Linia timesheetu",,
|
||||
"Timesheet lines","Linie timesheetów",,
|
||||
"To Invoice","Do faktury",,
|
||||
"To invoice","Aby wystawić fakturę",,
|
||||
"Warning, this manuforder is from another company.","Ostrzeżenie, ten manuforder pochodzi od innej firmy.",,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Empregado",,
|
||||
"Enable timesheet on manuf order","Habilitar a folha de tempos no pedido do fabricante",,
|
||||
"Invoiced","Faturação",,
|
||||
"Manage business production","Gerir a produção do negócio",,
|
||||
"Manuf order","Pedido de fabricação",,
|
||||
"Manuf. Orders Selection","Manuf. Seleção de ordens",,
|
||||
"Operation order","Ordem de operação",,
|
||||
"Overview","Visão Geral",,
|
||||
"Production orders","Ordens de produção",,
|
||||
"Project","Projeto",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Há uma folha de tempos ainda à espera de validação nesta ordem manuf, queres continuar de qualquer maneira?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Há uma folha de tempos ainda à espera da validação desta ordem de operação. Queres continuar na mesma?",,
|
||||
"Timesheet Line","Linha Timesheet",,
|
||||
"Timesheet Lines","Linhas de Folha de Ponto",,
|
||||
"Timesheet imputed on","Folha de horas de trabalho imputada a",,
|
||||
"Timesheet imputed on manufacturing order","Folha de horas de trabalho imputada à ordem de produção",,
|
||||
"Timesheet imputed on project","Folha de horas de trabalho imputada ao projecto",,
|
||||
"Timesheet line","Linha da folha de horas de trabalho",,
|
||||
"Timesheet lines","Linhas da folha de tempos",,
|
||||
"To Invoice","Para fatura",,
|
||||
"To invoice","Para fatura",,
|
||||
"Warning, this manuforder is from another company.","Aviso, este fabricante é de outra empresa.",,
|
||||
|
@ -0,0 +1,23 @@
|
||||
"key","message","comment","context"
|
||||
"Employee","Сотрудник",,
|
||||
"Enable timesheet on manuf order","Разрешить ведение табеля учета рабочего времени по заказу мануфактуры",,
|
||||
"Invoiced","Счета",,
|
||||
"Manage business production","Управление производством бизнеса",,
|
||||
"Manuf order","Производственный заказ",,
|
||||
"Manuf. Orders Selection","Производство Выбор заказов",,
|
||||
"Operation order","Порядок эксплуатации",,
|
||||
"Overview","Обзор",,
|
||||
"Production orders","Производственные заказы",,
|
||||
"Project","Проект",,
|
||||
"There are timesheet still waiting validation on this manuf order, do you want to continue anyway ?","Есть табель учета рабочего времени, который еще ждет подтверждения заказа на мануфактуру, вы все равно хотите продолжить?",,
|
||||
"There are timesheet still waiting validation on this operation order, do you want to continue anyway ?","Есть табель учета рабочего времени, который еще ждет подтверждения заказа, вы хотите продолжить?",,
|
||||
"Timesheet Line","Тайм-аут Линия",,
|
||||
"Timesheet Lines","Линии табелей учета рабочего времени",,
|
||||
"Timesheet imputed on","Вмененный табель учёта рабочего времени на",,
|
||||
"Timesheet imputed on manufacturing order","Табель учета рабочего времени, вменяемый в производственный заказ",,
|
||||
"Timesheet imputed on project","Вмененный табель учета рабочего времени по проекту",,
|
||||
"Timesheet line","Строка табеля учета рабочего времени",,
|
||||
"Timesheet lines","Строки табеля учета рабочего времени",,
|
||||
"To Invoice","К счету-фактуре",,
|
||||
"To invoice","Для выставления счета",,
|
||||
"Warning, this manuforder is from another company.","Предупреждение, эта мануфактура из другой компании.",,
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<object-views xmlns="http://axelor.com/xml/ns/object-views"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
|
||||
|
||||
<action-method name="action-businessproduction-manuf-order-method-check-timesheet">
|
||||
<call class="com.axelor.apps.businessproduction.web.ManufOrderBusinessController" method="alertNonValidatedTimesheet"/>
|
||||
</action-method>
|
||||
|
||||
</object-views>
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<object-views xmlns="http://axelor.com/xml/ns/object-views"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
|
||||
|
||||
<action-group name="action-operation-order-group-finish"
|
||||
id="action-business-production-operation-order-group-finish">
|
||||
<action name="action-operation-order-business-production-method-alert-timesheet"/>
|
||||
<action name="action-operation-order-method-finish"/>
|
||||
<action name="action-operation-order-method-compute-duration"/>
|
||||
</action-group>
|
||||
|
||||
<action-method name="action-operation-order-business-production-method-alert-timesheet">
|
||||
<call class="com.axelor.apps.businessproduction.web.OperationOrderBusinessController"
|
||||
method="alertNonValidatedTimesheet"/>
|
||||
</action-method>
|
||||
|
||||
</object-views>
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<object-views xmlns="http://axelor.com/xml/ns/object-views"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
|
||||
|
||||
<action-method name="action-production-order-method-generate-sale-order">
|
||||
<call class="com.axelor.apps.businessproduction.web.ProductionOrderBusinessController" method="generateSaleOrder"/>
|
||||
</action-method>
|
||||
|
||||
</object-views>
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<object-views xmlns="http://axelor.com/xml/ns/object-views"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
|
||||
|
||||
<selection name="business.production.employee.timesheet.imputation.select">
|
||||
<option value="1">Timesheet imputed on project</option>
|
||||
<option value="2">Timesheet imputed on manufacturing order</option>
|
||||
</selection>
|
||||
</object-views>
|
||||
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<object-views xmlns="http://axelor.com/xml/ns/object-views"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
|
||||
|
||||
<action-method name="action-timesheet-method-update-operation-order">
|
||||
<call class="com.axelor.apps.businessproduction.web.TimesheetController"
|
||||
method="updateOperationOrders"/>
|
||||
</action-method>
|
||||
|
||||
</object-views>
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<object-views xmlns="http://axelor.com/xml/ns/object-views" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
|
||||
|
||||
<grid name="timesheet-line-timesheet-manuf-order-grid" title="Timesheet Lines" model="com.axelor.apps.hr.db.TimesheetLine" editable="true"
|
||||
onNew="action-hr-default-timesheet-line-timesheet" orderBy="date" >
|
||||
<field name="date" width="100" onChange="action-timesheet-line-validate-date"/>
|
||||
<field name="manufOrder" width="200" onChange="action-timesheet-line-group-manuf-order-onchange" form-view="manuf-order-form" grid-view="manuf-order-grid" canEdit="false" canView="false"/>
|
||||
<field name="operationOrder" width="200" domain="self.manufOrder = :manufOrder" form-view="operation-order-form" grid-view="operation-order-grid" canEdit="false" canView="false"/>
|
||||
<field name="duration" width="100" onChange="action-timesheet-line-method-set-stored-duration" aggregate="sum" min="0.01"/>
|
||||
<field name="hoursDuration" hidden="true" />
|
||||
<field name="toInvoice" width="100" if-module="axelor-business-project" if="__config__.app.isApp('business-project')" />
|
||||
<field name="enableEditor" hidden="true" />
|
||||
<field name="comments" width="400"/>
|
||||
<field name="user" form-view="user-form" grid-view="user-grid" hidden="true" canEdit="false" canView="false"/>
|
||||
</grid>
|
||||
|
||||
<grid name="timesheet-line-timesheet-operation-order-grid" title="Timesheet Lines" model="com.axelor.apps.hr.db.TimesheetLine" editable="true"
|
||||
onNew="action-hr-default-timesheet-line-timesheet" orderBy="date" >
|
||||
<hilite if="$get('timesheet.statusSelect') == 5" color="danger" />
|
||||
<field name="date" width="100" onChange="action-timesheet-line-validate-date"/>
|
||||
<field name="user" form-view="user-form" grid-view="user-grid" canEdit="false" canView="false"/>
|
||||
<field name="duration" width="100" onChange="action-timesheet-line-method-set-stored-duration" aggregate="sum" min="0.01"/>
|
||||
<field name="hoursDuration" hidden="true" />
|
||||
<field name="toInvoice" width="100" if-module="axelor-business-project" if="__config__.app.isApp('business-project')" />
|
||||
<field name="enableEditor" hidden="true" />
|
||||
<field name="comments" width="400"/>
|
||||
<field name="timesheet.statusSelect"/>
|
||||
</grid>
|
||||
|
||||
<grid name="timesheet-line-timesheet-readonly-manuf-order-grid" title="Timesheet Lines" model="com.axelor.apps.hr.db.TimesheetLine"
|
||||
onNew="action-hr-default-timesheet-line-timesheet" orderBy="date">
|
||||
<field name="date" width="100" onChange="action-timesheet-line-validate-date"/>
|
||||
<field name="manufOrder" width="200" onChange="action-timesheet-line-group-manuf-order-onchange" form-view="manuf-order-form" grid-view="manuf-order-grid" canEdit="false" canView="false"/>
|
||||
<field name="operationOrder" width="200" domain="self.manufOrder = :manufOrder" form-view="operation-order-form" grid-view="operation-order-grid" canEdit="false" canView="false"/>
|
||||
<field name="duration" width="100" onChange="action-timesheet-line-method-set-stored-duration" aggregate="sum" min="0.01"/>
|
||||
<field name="hoursDuration" hidden="true" />
|
||||
<field name="toInvoice" width="100" if-module="axelor-business-project" if="__config__.app.isApp('business-project')" />
|
||||
<field name="enableEditor" hidden="true" />
|
||||
<field name="comments" width="400"/>
|
||||
<field name="user" form-view="user-form" grid-view="user-grid" hidden="true" canEdit="false" canView="false"/>
|
||||
<field name="timesheet.statusSelect"/>
|
||||
</grid>
|
||||
|
||||
<form name="timesheet-line-timesheet-manuf-order-form" title="Timesheet Line" model="com.axelor.apps.hr.db.TimesheetLine"
|
||||
onNew="action-hr-default-timesheet-line-timesheet,action-timesheet-line-attrs-set-duration-label,action-timesheet-line-attrs-title-project"
|
||||
onLoad="action-timesheet-line-attrs-set-duration-label,action-timesheet-line-attrs-set-visible-duration-title,action-timesheet-line-attrs-title-project" width="large">
|
||||
<panel name="overviewPanel" title="Overview">
|
||||
<field name="date" onChange="action-timesheet-line-validate-date"/>
|
||||
<field name="manufOrder" width="200" onChange="action-timesheet-line-group-manuf-order-onchange" form-view="manuf-order-form" grid-view="manuf-order-grid" canEdit="false" canView="false"/>
|
||||
<field name="operationOrder" domain="self.manufOrder = :manufOrder" form-view="operation-order-form" grid-view="operation-order-grid" canEdit="false" canView="false"/>
|
||||
<field name="duration" width="62%" colSpan="3" onChange="action-timesheet-line-method-set-stored-duration" min="0.01"/>
|
||||
<label name="durationLabel" colSpan="1"/>
|
||||
<field name="hoursDuration" hidden="true" />
|
||||
<field name="toInvoice"/>
|
||||
<field name="enableEditor" />
|
||||
<field name="comments" />
|
||||
<field name="user" form-view="user-form" grid-view="user-grid" hidden="true" canEdit="false" canView="false"/>
|
||||
</panel>
|
||||
</form>
|
||||
|
||||
<action-group name="action-timesheet-line-group-manuf-order-onchange">
|
||||
<action name="action-timesheet-line-validate-manuf-order-onchange"/>
|
||||
<action name="action-timesheet-line-record-manuf-order-onchange"/>
|
||||
</action-group>
|
||||
|
||||
<action-validate name="action-timesheet-line-validate-manuf-order-onchange">
|
||||
<alert message="Warning, this manuforder is from another company." if="manufOrder && manufOrder?.company != __parent__.company"/>
|
||||
</action-validate>
|
||||
|
||||
<action-record name="action-timesheet-line-record-manuf-order-onchange" model="com.axelor.apps.hr.db.TimesheetLine">
|
||||
<field name="operationOrder" expr="eval: null"/>
|
||||
</action-record>
|
||||
|
||||
<action-method name="action-timesheet-line-method-update-operation-order">
|
||||
<call class="com.axelor.apps.businessproduction.web.TimesheetLineController"
|
||||
method="updateOperationOrder"/>
|
||||
</action-method>
|
||||
|
||||
</object-views>
|
||||
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
||||
<persistence-unit name="testUnit" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
|
||||
<properties>
|
||||
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
|
||||
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
|
||||
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/axelor-test" />
|
||||
|
||||
<property name="javax.persistence.jdbc.user" value="axelor" />
|
||||
<property name="javax.persistence.jdbc.password" value="" />
|
||||
|
||||
<!--
|
||||
value="create" to build a new database on each run;
|
||||
value="update" to modify an existing database;
|
||||
value="create-drop" means the same as "create" but also drops tables when Hibernate closes;
|
||||
value="validate" makes no changes to the database
|
||||
-->
|
||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
||||
|
||||
<!--
|
||||
<property name="hibernate.show_sql" value="true"/>
|
||||
-->
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
Reference in New Issue
Block a user