Compare commits
2 Commits
mehdi-dev
...
f369e97915
| Author | SHA1 | Date | |
|---|---|---|---|
| f369e97915 | |||
| 0a9e03261b |
@ -149,10 +149,6 @@
|
|||||||
|
|
||||||
<boolean name="isDangerousProduct" title="Is dangerous" />
|
<boolean name="isDangerousProduct" title="Is dangerous" />
|
||||||
|
|
||||||
<boolean name="needDt1Validation" title="DT1 validation required" massUpdate="true"/>
|
|
||||||
<boolean name="needDt2Validation" title="DT2 validation required" massUpdate="true"/>
|
|
||||||
<boolean name="needQaQc1Validation" title="QAQC1 validation required" massUpdate="true"/>
|
|
||||||
<boolean name="needQaQc2Validation" title="QAQC2 validation required" massUpdate="true"/>
|
|
||||||
|
|
||||||
<many-to-one name="coaSpec" ref="com.axelor.meta.db.MetaFile" />
|
<many-to-one name="coaSpec" ref="com.axelor.meta.db.MetaFile" />
|
||||||
|
|
||||||
@ -213,10 +209,6 @@
|
|||||||
<field name="shp" />
|
<field name="shp" />
|
||||||
<field name="stklim" />
|
<field name="stklim" />
|
||||||
<field name="ug" />
|
<field name="ug" />
|
||||||
<field name="needDt1Validation" />
|
|
||||||
<field name="needDt2Validation" />
|
|
||||||
<field name="needQaQc1Validation" />
|
|
||||||
<field name="needQaQc2Validation" />
|
|
||||||
<message if="true" on="UPDATE">Product updated</message>
|
<message if="true" on="UPDATE">Product updated</message>
|
||||||
</track>
|
</track>
|
||||||
</entity>
|
</entity>
|
||||||
|
|||||||
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.message.job;
|
|
||||||
|
|
||||||
import com.axelor.apps.message.db.Message;
|
|
||||||
import com.axelor.apps.message.db.repo.MessageRepository;
|
|
||||||
import com.axelor.apps.message.service.MessageService;
|
|
||||||
import com.axelor.exception.service.TraceBackService;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.mail.MessagingException;
|
|
||||||
import com.axelor.exception.AxelorException;
|
|
||||||
import org.quartz.Job;
|
|
||||||
import org.quartz.JobExecutionContext;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/** An example {@link Job} class that prints a some messages to the stderr. */
|
|
||||||
public class SendEmailJob implements Job {
|
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(SendEmailJob.class);
|
|
||||||
|
|
||||||
@Inject private MessageService messageService;
|
|
||||||
|
|
||||||
@Inject private MessageRepository messageRepository;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(JobExecutionContext context) {
|
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
|
||||||
LocalDateTime startOfDay = today.atStartOfDay();
|
|
||||||
|
|
||||||
List<Message> draftMessages = messageRepository
|
|
||||||
.all()
|
|
||||||
.filter("self.statusSelect = 1 AND self.createdOn >= :startOfDay")
|
|
||||||
.bind("startOfDay", startOfDay)
|
|
||||||
.fetch();
|
|
||||||
|
|
||||||
log.debug("Total of draft messages : {}", draftMessages.size());
|
|
||||||
for (Message message : draftMessages) {
|
|
||||||
try {
|
|
||||||
Message m = messageService.sendMessage(message);
|
|
||||||
} catch (AxelorException e) {
|
|
||||||
TraceBackService.trace(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Message> inProgressMessages = messageRepository
|
|
||||||
.all()
|
|
||||||
.filter("self.statusSelect = 2 AND self.createdOn >= :startOfDay")
|
|
||||||
.bind("startOfDay", startOfDay)
|
|
||||||
.fetch();
|
|
||||||
|
|
||||||
log.debug("Total of in progress messages : {}", inProgressMessages.size());
|
|
||||||
for (Message message : inProgressMessages) {
|
|
||||||
try {
|
|
||||||
Message m = messageService.sendMessage(message);
|
|
||||||
} catch (AxelorException e) {
|
|
||||||
TraceBackService.trace(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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.qvm.exception;
|
||||||
|
|
||||||
|
/** Interface of Exceptions. Enum all exception of axelor-human-resource. */
|
||||||
|
public interface IExceptionMessage {
|
||||||
|
|
||||||
|
static final String ORIGIN_ALREDY_USED = /*$$(*/
|
||||||
|
"origin alredy used : %s" /*)*/;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.axelor.apps.qvm.job;
|
||||||
|
|
||||||
|
import com.axelor.exception.service.TraceBackService;
|
||||||
|
import com.axelor.inject.Beans;
|
||||||
|
import java.util.List;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
|
import com.axelor.apps.qvm.service.QvmOperationService;
|
||||||
|
import com.axelor.apps.qvm.service.QvmOperationServiceImpl;
|
||||||
|
public class CalculateCountdownJob implements Job {
|
||||||
|
private final Logger log = LoggerFactory.getLogger(CalculateCountdownJob.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException{
|
||||||
|
|
||||||
|
if (isRunning(context)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
log.debug("Calculating operation countdown ...");
|
||||||
|
Beans.get(QvmOperationServiceImpl.class).updateAllCountdowns();
|
||||||
|
}catch(Exception e){
|
||||||
|
log.error("Error while operation countdown");
|
||||||
|
TraceBackService.trace(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isRunning(JobExecutionContext context) {
|
||||||
|
try {
|
||||||
|
return context
|
||||||
|
.getScheduler()
|
||||||
|
.getCurrentlyExecutingJobs()
|
||||||
|
.stream()
|
||||||
|
.anyMatch(
|
||||||
|
j ->
|
||||||
|
j.getTrigger().equals(context.getTrigger())
|
||||||
|
&& !j.getFireInstanceId().equals(context.getFireInstanceId()));
|
||||||
|
} catch (SchedulerException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -39,4 +39,7 @@ public interface QvmOperationService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public QvmOperation createNextOperation(QvmOperation operation, Long userId)
|
public QvmOperation createNextOperation(QvmOperation operation, Long userId)
|
||||||
throws AxelorException;
|
throws AxelorException;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateAllCountdowns()throws AxelorException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,10 +29,20 @@ import com.axelor.inject.Beans;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.persist.Transactional;
|
import com.google.inject.persist.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import com.axelor.apps.qvm.exception.IExceptionMessage;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
|
||||||
public class QvmOperationServiceImpl implements QvmOperationService {
|
public class QvmOperationServiceImpl implements QvmOperationService {
|
||||||
|
|
||||||
|
private final Logger log = LoggerFactory.getLogger(QvmOperationServiceImpl.class);
|
||||||
@Inject protected SequenceService sequenceService;
|
@Inject protected SequenceService sequenceService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private QvmOperationRepository qvmOperationRepo;
|
||||||
@Transactional
|
@Transactional
|
||||||
public QvmOperation createCalibrationSeq(Company company) throws AxelorException {
|
public QvmOperation createCalibrationSeq(Company company) throws AxelorException {
|
||||||
|
|
||||||
@ -103,9 +113,16 @@ public class QvmOperationServiceImpl implements QvmOperationService {
|
|||||||
return calibration;
|
return calibration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QvmOperation createNextOperation(QvmOperation operation, Long userId) {
|
public QvmOperation createNextOperation(QvmOperation operation, Long userId) throws AxelorException{
|
||||||
QvmOperation nextOperation = Beans.get(QvmOperationRepository.class).copy(operation, true);
|
QvmOperation nextOperation = Beans.get(QvmOperationRepository.class).copy(operation, true);
|
||||||
if (operation != null) {
|
if (operation != null) {
|
||||||
|
List<QvmOperation> operations = qvmOperationRepo.all()
|
||||||
|
.filter("self.operationOrigin = :serialNumber")
|
||||||
|
.bind("serialNumber", operation.getSerialNumber())
|
||||||
|
.fetch();
|
||||||
|
int size = operations.size();
|
||||||
|
if (size == 0){
|
||||||
|
log.debug("Creating next operation");
|
||||||
try{
|
try{
|
||||||
nextOperation.setStatusSelect(1);
|
nextOperation.setStatusSelect(1);
|
||||||
nextOperation.setOperationOrigin(operation.getSerialNumber());
|
nextOperation.setOperationOrigin(operation.getSerialNumber());
|
||||||
@ -114,25 +131,51 @@ public class QvmOperationServiceImpl implements QvmOperationService {
|
|||||||
nextOperation.setOperationDate(operation.getOperationDueDate());
|
nextOperation.setOperationDate(operation.getOperationDueDate());
|
||||||
if (operation.getOperationFrequency() == 1){
|
if (operation.getOperationFrequency() == 1){
|
||||||
nextOperation.setOperationDueDate(operation.getOperationDueDate().plusYears(1));
|
nextOperation.setOperationDueDate(operation.getOperationDueDate().plusYears(1));
|
||||||
nextOperation.setCountdown(364);
|
nextOperation.setCountdown(364);}
|
||||||
}
|
|
||||||
if (operation.getOperationFrequency() == 2){
|
if (operation.getOperationFrequency() == 2){
|
||||||
nextOperation.setOperationDueDate(operation.getOperationDueDate().plusMonths(1));
|
nextOperation.setOperationDueDate(operation.getOperationDueDate().plusMonths(1));
|
||||||
nextOperation.setCountdown(31);
|
nextOperation.setCountdown(31);}
|
||||||
}
|
|
||||||
if (operation.getOperationFrequency() == 3){
|
if (operation.getOperationFrequency() == 3){
|
||||||
nextOperation.setOperationDueDate(operation.getOperationDueDate().plusMonths(6));
|
nextOperation.setOperationDueDate(operation.getOperationDueDate().plusMonths(6));
|
||||||
nextOperation.setCountdown(183);
|
nextOperation.setCountdown(183);}
|
||||||
}
|
|
||||||
System.out.println(
|
|
||||||
"operation.getOperationFrequency : " + operation.getOperationFrequency());
|
|
||||||
nextOperation.setSerialNumber(null);
|
nextOperation.setSerialNumber(null);
|
||||||
nextOperation.setCreationType(2);
|
nextOperation.setCreationType(2);
|
||||||
} catch (Exception exception) {
|
}
|
||||||
|
catch (Exception exception){
|
||||||
|
log.error("Error while creating next operation");
|
||||||
System.out.println(exception);
|
System.out.println(exception);
|
||||||
|
}}else{
|
||||||
|
log.debug("Origin alredy used");
|
||||||
|
throw new AxelorException(
|
||||||
|
TraceBackRepository.CATEGORY_NO_UNIQUE_KEY,
|
||||||
|
I18n.get(IExceptionMessage.ORIGIN_ALREDY_USED),
|
||||||
|
operation.getSerialNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Beans.get(QvmOperationRepository.class).save(nextOperation);
|
System.out.println("Create next operation : "+nextOperation);
|
||||||
return nextOperation;
|
return nextOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void updateCountdown(QvmOperation operation, LocalDate today) {
|
||||||
|
if (operation.getOperationDate() != null) {
|
||||||
|
|
||||||
|
LocalDate operationDate = operation.getOperationDate();
|
||||||
|
int daysBetween = (int) ChronoUnit.DAYS.between(today, operationDate);
|
||||||
|
operation.setCountdown(daysBetween);
|
||||||
|
qvmOperationRepo.save(operation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAllCountdowns() {
|
||||||
|
List<QvmOperation> operations = qvmOperationRepo.all()
|
||||||
|
.filter("self.operationDate IS NOT NULL AND self.statusSelect = :status")
|
||||||
|
.bind("status", 2)
|
||||||
|
.fetch();
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
for (QvmOperation operation : operations){
|
||||||
|
System.out.println("operation : "+operation);
|
||||||
|
updateCountdown(operation,today);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,4 +165,14 @@ public class QvmOperationController {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateCountdowns(ActionRequest request, ActionResponse response) {
|
||||||
|
try {
|
||||||
|
Beans.get(QvmOperationService.class).updateAllCountdowns();
|
||||||
|
} catch (AxelorException e) {
|
||||||
|
TraceBackService.trace(e);
|
||||||
|
response.setError(e.getMessage());
|
||||||
|
}
|
||||||
|
response.setFlash("Countdowns updated successfully");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -418,59 +418,22 @@ public class StockMoveServiceImpl implements StockMoveService {
|
|||||||
String newStockSeq = null;
|
String newStockSeq = null;
|
||||||
stockMoveLineService.checkTrackingNumber(stockMove);
|
stockMoveLineService.checkTrackingNumber(stockMove);
|
||||||
stockMoveLineService.checkConformitySelection(stockMove);
|
stockMoveLineService.checkConformitySelection(stockMove);
|
||||||
|
System.out.println("Checking oooo...................");
|
||||||
|
|
||||||
System.out.println("----------------------------------------------------");
|
// checking .....
|
||||||
System.out.println("stockMove.getTypeSelect() : " + stockMove.getTypeSelect());
|
if (stockMove.getFromStockLocation().getTypeSelect() != StockLocationRepository.TYPE_VIRTUAL)
|
||||||
System.out.println("----------------------------------------------------");
|
{
|
||||||
|
List<Long> listOfIds = Arrays.asList(10L, 11L, 13L, 14L, 15L, 16L, 13L, 12L, 54L, 55L, 58L,50L);
|
||||||
|
System.out.println("Checking...................");
|
||||||
|
System.out.println(listOfIds.contains(stockMove.getToStockLocation().getId()));
|
||||||
|
System.out.println("Checking...................");
|
||||||
|
|
||||||
|
if(listOfIds.contains(stockMove.getToStockLocation().getId())){
|
||||||
if (stockMove.getTypeSelect() == StockMoveRepository.TYPE_INTERNAL){
|
checkIfQuarantine(stockMove);
|
||||||
System.out.println("INTERNAL MOVE");
|
|
||||||
StockConfig stockConfig = stockMove.getCompany().getStockConfig();
|
|
||||||
StockLocation parentwasteStockLocation = stockConfig.getWasteStockLocationParent();
|
|
||||||
|
|
||||||
if(Boolean.TRUE.equals(stockMove.getToStockLocation().getNeedCheckInVerification())){
|
|
||||||
System.out.println("Check-in required for this stock location...");
|
|
||||||
checkIfConforme(stockMove);
|
|
||||||
checkIfNonConformityTag(stockMove);
|
|
||||||
|
|
||||||
} else if (parentwasteStockLocation.equals(stockMove.getToStockLocation().getParentStockLocation())){
|
|
||||||
System.out.println("**************************** Child of Waste Parent ******************************");
|
|
||||||
CheckIfNotNotconforme(stockMove);
|
|
||||||
checkIfNonConformityTag(stockMove);
|
checkIfNonConformityTag(stockMove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (stockMove.getTypeSelect() == StockMoveRepository.TYPE_OUTGOING
|
|
||||||
&& stockMove.getPartner().getId() != 853
|
|
||||||
&& stockMove.getIsReversion() == false){
|
|
||||||
|
|
||||||
System.out.println("Livraison Client.");
|
|
||||||
checkIfConforme(stockMove);
|
|
||||||
checkIfNonConformityTag(stockMove);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (stockMove.getTypeSelect() == StockMoveRepository.TYPE_OUTGOING
|
|
||||||
&& stockMove.getPartner().getId() == 853
|
|
||||||
&& stockMove.getIsReversion() == false){
|
|
||||||
|
|
||||||
System.out.println("Sortie.");
|
|
||||||
StockConfig stockConfig = stockMove.getCompany().getStockConfig();
|
|
||||||
StockLocation nonCoreStockLocationParent = stockConfig.getNonCoreStockLocation();
|
|
||||||
StockLocation parentwasteStockLocation = stockConfig.getWasteStockLocationParent();
|
|
||||||
|
|
||||||
if (parentwasteStockLocation.equals(stockMove.getToStockLocation().getParentStockLocation())){
|
|
||||||
System.out.println("**************************** Child of Waste Parent ******************************");
|
|
||||||
CheckIfNotNotconforme(stockMove);
|
|
||||||
checkIfNonConformityTag(stockMove);
|
|
||||||
} else if (!nonCoreStockLocationParent.equals(stockMove.getToStockLocation().getParentStockLocation())) {
|
|
||||||
checkIfConforme(stockMove);
|
|
||||||
checkIfNonConformityTag(stockMove);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
checkExpirationDates(stockMove);
|
checkExpirationDates(stockMove);
|
||||||
|
|
||||||
if (stockMove.getTypeSelect() == StockMoveRepository.TYPE_INCOMING) {
|
if (stockMove.getTypeSelect() == StockMoveRepository.TYPE_INCOMING) {
|
||||||
@ -1629,75 +1592,47 @@ public class StockMoveServiceImpl implements StockMoveService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void checkIfConforme(StockMove stockMove)
|
public void checkIfQuarantine(StockMove stockMove)
|
||||||
throws AxelorException {
|
throws AxelorException {
|
||||||
|
|
||||||
Query sql =
|
Query sql =
|
||||||
JPA.em()
|
JPA.em()
|
||||||
.createNativeQuery(
|
.createNativeQuery(
|
||||||
"SELECT LINE.ID"+
|
"SELECT LINE.ID"+
|
||||||
" FROM STOCK_STOCK_MOVE_LINE LINE LEFT JOIN STOCK_STOCK_LOCATION_LINE LOCATION_LINE ON LINE.TRACKING_NUMBER = LOCATION_LINE.TRACKING_NUMBER and LINE.product = LOCATION_LINE.product"+
|
" FROM STOCK_STOCK_MOVE_LINE LINE LEFT JOIN STOCK_STOCK_LOCATION_LINE LOCATION_LINE ON LINE.TRACKING_NUMBER = LOCATION_LINE.TRACKING_NUMBER and LINE.INTERNAL_TRACKING_NUMBER = LOCATION_LINE.INTERNAL_TRACKING_NUMBER and LINE.product = LOCATION_LINE.product"+
|
||||||
" where LOCATION_LINE.DETAILS_STOCK_LOCATION = ?1 AND LOCATION_LINE.CONFORMITY_SELECT != 2 AND LINE.STOCK_MOVE = ?2");
|
" where LOCATION_LINE.DETAILS_STOCK_LOCATION = ?1 AND LOCATION_LINE.CONFORMITY_SELECT != 2 AND LOCATION_LINE.CONFORMITY_SELECT != 5 AND LINE.STOCK_MOVE = ?2");
|
||||||
sql.setParameter(1, stockMove.getFromStockLocation().getId());
|
sql.setParameter(1, stockMove.getFromStockLocation().getId());
|
||||||
sql.setParameter(2, stockMove.getId());
|
sql.setParameter(2, stockMove.getId());
|
||||||
|
|
||||||
System.out.println("*****************checkIfConforme******************");
|
System.out.println("*****************checkIfQuarantine******************");
|
||||||
System.out.println(sql.getResultList().size() > 0);
|
System.out.println(sql.getResultList().size() > 0);
|
||||||
System.out.println("******************checkIfConforme*****************");
|
System.out.println("******************checkIfQuarantine*****************");
|
||||||
if (sql.getResultList().size() > 0) {
|
if (sql.getResultList().size() > 0) {
|
||||||
throw new AxelorException(
|
throw new AxelorException(
|
||||||
stockMove,
|
stockMove,
|
||||||
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
||||||
"Certaines lignes ne sont pas conformes (état différent de 'Conforme').");
|
"Vous avez une ligne en etat qurantaine");
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CheckIfNotNotconforme(StockMove stockMove)
|
|
||||||
throws AxelorException {
|
|
||||||
|
|
||||||
Query sql =
|
|
||||||
JPA.em()
|
|
||||||
.createNativeQuery(
|
|
||||||
"SELECT LINE.ID"+
|
|
||||||
" FROM STOCK_STOCK_MOVE_LINE LINE LEFT JOIN STOCK_STOCK_LOCATION_LINE LOCATION_LINE ON LINE.TRACKING_NUMBER = LOCATION_LINE.TRACKING_NUMBER and LINE.product = LOCATION_LINE.product"+
|
|
||||||
" where LOCATION_LINE.DETAILS_STOCK_LOCATION = ?1 AND LOCATION_LINE.CONFORMITY_SELECT != 3 AND LINE.STOCK_MOVE = ?2");
|
|
||||||
sql.setParameter(1, stockMove.getFromStockLocation().getId());
|
|
||||||
sql.setParameter(2, stockMove.getId());
|
|
||||||
|
|
||||||
System.out.println("*****************CheckIfNotNotconforme******************");
|
|
||||||
System.out.println(sql.getResultList().size() > 0);
|
|
||||||
System.out.println("******************CheckIfNotNotconforme*****************");
|
|
||||||
if (sql.getResultList().size() > 0) {
|
|
||||||
throw new AxelorException(
|
|
||||||
stockMove,
|
|
||||||
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
|
||||||
"Toutes les lignes doivent être en état 'Non conforme'.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkIfNonConformityTag(StockMove stockMove)
|
public void checkIfNonConformityTag(StockMove stockMove)
|
||||||
throws AxelorException {
|
throws AxelorException {
|
||||||
|
|
||||||
Query sql = JPA.em()
|
Query sql =
|
||||||
|
JPA.em()
|
||||||
.createNativeQuery(
|
.createNativeQuery(
|
||||||
"SELECT LINE.ID" +
|
"SELECT LINE.ID" +
|
||||||
" FROM STOCK_STOCK_MOVE_LINE LINE" +
|
" FROM STOCK_STOCK_MOVE_LINE LINE LEFT JOIN STOCK_STOCK_LOCATION_LINE LOCATION_LINE ON LINE.TRACKING_NUMBER = LOCATION_LINE.TRACKING_NUMBER and LINE.INTERNAL_TRACKING_NUMBER = LOCATION_LINE.INTERNAL_TRACKING_NUMBER and LINE.product = LOCATION_LINE.product" +
|
||||||
" LEFT JOIN STOCK_STOCK_LOCATION_LINE LOCATION_LINE" +
|
" where LOCATION_LINE.DETAILS_STOCK_LOCATION = :location AND LOCATION_LINE.is_conform_tag is not true AND LINE.STOCK_MOVE = :move");
|
||||||
" ON LINE.TRACKING_NUMBER = LOCATION_LINE.TRACKING_NUMBER" +
|
|
||||||
" AND LINE.PRODUCT = LOCATION_LINE.PRODUCT" +
|
|
||||||
" WHERE LOCATION_LINE.DETAILS_STOCK_LOCATION = :location" +
|
|
||||||
" AND (LOCATION_LINE.IS_CONFORM_TAG IS NULL OR LOCATION_LINE.IS_CONFORM_TAG = FALSE)" +
|
|
||||||
" AND LINE.STOCK_MOVE = :move");
|
|
||||||
|
|
||||||
sql.setParameter("location", stockMove.getFromStockLocation().getId());
|
sql.setParameter("location", stockMove.getFromStockLocation().getId());
|
||||||
sql.setParameter("move", stockMove.getId());
|
sql.setParameter("move", stockMove.getId());
|
||||||
|
|
||||||
System.out.println("*****************checkIfNonConformityTag*****************");
|
System.out.println("*****************checkIfNonConformityTag*****************");
|
||||||
boolean hasNonTags = !sql.getResultList().isEmpty();
|
System.out.println(sql.getResultList().size() > 0);
|
||||||
System.out.println("Has non conform tag: " + hasNonTags);
|
|
||||||
System.out.println("*****************checkIfNonConformityTag****************");
|
System.out.println("*****************checkIfNonConformityTag****************");
|
||||||
|
|
||||||
if (hasNonTags) {
|
if (sql.getResultList().size() > 0) {
|
||||||
throw new AxelorException(
|
throw new AxelorException(
|
||||||
stockMove,
|
stockMove,
|
||||||
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
||||||
|
|||||||
@ -18,9 +18,6 @@
|
|||||||
<many-to-one name="supplierVirtualStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Supplier virtual stock location"/>
|
<many-to-one name="supplierVirtualStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Supplier virtual stock location"/>
|
||||||
<many-to-one name="inventoryVirtualStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Inventory virtual stock location"/>
|
<many-to-one name="inventoryVirtualStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Inventory virtual stock location"/>
|
||||||
|
|
||||||
<many-to-one name="nonCoreStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Non-core stock location"/>
|
|
||||||
<many-to-one name="wasteStockLocationParent" ref="com.axelor.apps.stock.db.StockLocation" title="Parent waste stock location"/>
|
|
||||||
|
|
||||||
<many-to-one name="customsMassUnit" ref="com.axelor.apps.base.db.Unit" title="Unit of mass"/>
|
<many-to-one name="customsMassUnit" ref="com.axelor.apps.base.db.Unit" title="Unit of mass"/>
|
||||||
|
|
||||||
<boolean name="realizeStockMovesUponParcelPalletCollection" title="Realize stock moves upon parcel/pallet collection" />
|
<boolean name="realizeStockMovesUponParcelPalletCollection" title="Realize stock moves upon parcel/pallet collection" />
|
||||||
@ -105,9 +102,6 @@
|
|||||||
|
|
||||||
<field name="displayTrackNbrOnCertificateOfConformityPrinting" on="UPDATE"/>
|
<field name="displayTrackNbrOnCertificateOfConformityPrinting" on="UPDATE"/>
|
||||||
<field name="displayExtRefOnCertificateOfConformityPrinting" on="UPDATE"/>
|
<field name="displayExtRefOnCertificateOfConformityPrinting" on="UPDATE"/>
|
||||||
|
|
||||||
<field name="nonCoreStockLocation" on="UPDATE"/>
|
|
||||||
<field name="wasteStockLocationParent" on="UPDATE"/>
|
|
||||||
</track>
|
</track>
|
||||||
</entity>
|
</entity>
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,6 @@
|
|||||||
<many-to-many name="stockLocationList" ref="com.axelor.apps.stock.db.StockLocation" title="Stock locations"/>
|
<many-to-many name="stockLocationList" ref="com.axelor.apps.stock.db.StockLocation" title="Stock locations"/>
|
||||||
<many-to-one name="picture" ref="com.axelor.meta.db.MetaFile" title="Photo" index="false"/>
|
<many-to-one name="picture" ref="com.axelor.meta.db.MetaFile" title="Photo" index="false"/>
|
||||||
|
|
||||||
<boolean name="needCheckInVerification" title="Check-in verification required" default="false" massUpdate="true"/>
|
|
||||||
|
|
||||||
<finder-method name="findByCompany" using="company"/>
|
<finder-method name="findByCompany" using="company"/>
|
||||||
<finder-method name="findByPartner" using="partner"/>
|
<finder-method name="findByPartner" using="partner"/>
|
||||||
|
|
||||||
@ -44,10 +42,5 @@
|
|||||||
|
|
||||||
]]></extra-code>
|
]]></extra-code>
|
||||||
|
|
||||||
|
|
||||||
<track on="UPDATE">
|
|
||||||
<field name="needCheckInVerification" />
|
|
||||||
</track>
|
|
||||||
|
|
||||||
</entity>
|
</entity>
|
||||||
</domain-models>
|
</domain-models>
|
||||||
|
|||||||
Reference in New Issue
Block a user