@@ -81,6 +81,8 @@ import com.axelor.apps.base.service.ProductMultipleQtyService;
|
|||||||
import com.axelor.apps.base.service.ProductMultipleQtyServiceImpl;
|
import com.axelor.apps.base.service.ProductMultipleQtyServiceImpl;
|
||||||
import com.axelor.apps.base.service.ProductService;
|
import com.axelor.apps.base.service.ProductService;
|
||||||
import com.axelor.apps.base.service.ProductServiceImpl;
|
import com.axelor.apps.base.service.ProductServiceImpl;
|
||||||
|
import com.axelor.apps.base.service.SophalService;
|
||||||
|
import com.axelor.apps.base.service.SophalServiceImpl;
|
||||||
import com.axelor.apps.base.service.TeamTaskService;
|
import com.axelor.apps.base.service.TeamTaskService;
|
||||||
import com.axelor.apps.base.service.TeamTaskServiceImpl;
|
import com.axelor.apps.base.service.TeamTaskServiceImpl;
|
||||||
import com.axelor.apps.base.service.TradingNameService;
|
import com.axelor.apps.base.service.TradingNameService;
|
||||||
@@ -127,9 +129,6 @@ import com.axelor.base.service.ical.ICalendarEventService;
|
|||||||
import com.axelor.base.service.ical.ICalendarEventServiceImpl;
|
import com.axelor.base.service.ical.ICalendarEventServiceImpl;
|
||||||
import com.axelor.team.db.repo.TeamTaskRepository;
|
import com.axelor.team.db.repo.TeamTaskRepository;
|
||||||
|
|
||||||
import com.axelor.apps.base.service.SophalService;
|
|
||||||
import com.axelor.apps.base.service.SophalServiceImpl;
|
|
||||||
|
|
||||||
public class BaseModule extends AxelorModule {
|
public class BaseModule extends AxelorModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,16 +18,8 @@
|
|||||||
package com.axelor.apps.base.service;
|
package com.axelor.apps.base.service;
|
||||||
|
|
||||||
import com.axelor.apps.base.db.Product;
|
import com.axelor.apps.base.db.Product;
|
||||||
import com.axelor.apps.base.db.ProductVariant;
|
|
||||||
import com.axelor.apps.base.db.ProductVariantConfig;
|
|
||||||
import com.axelor.apps.base.db.ProductVariantValue;
|
|
||||||
import com.axelor.exception.AxelorException;
|
|
||||||
import com.google.inject.persist.Transactional;
|
|
||||||
|
|
||||||
|
|
||||||
public interface SophalService {
|
public interface SophalService {
|
||||||
|
|
||||||
String GenerateCode(Product product);
|
String GenerateCode(Product product);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,42 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.base.service;
|
package com.axelor.apps.base.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.axelor.apps.base.db.Product;
|
import com.axelor.apps.base.db.Product;
|
||||||
import com.axelor.apps.base.db.repo.PartnerAddressRepository;
|
|
||||||
import com.axelor.apps.base.db.repo.PartnerRepository;
|
|
||||||
import com.axelor.apps.base.db.repo.SequenceRepository;
|
|
||||||
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
|
||||||
import com.axelor.apps.base.service.administration.SequenceService;
|
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
|
||||||
import com.axelor.apps.message.db.EmailAddress;
|
|
||||||
import com.axelor.common.StringUtils;
|
|
||||||
import com.axelor.db.JPA;
|
import com.axelor.db.JPA;
|
||||||
import com.axelor.exception.AxelorException;
|
|
||||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
|
||||||
import com.axelor.i18n.I18n;
|
|
||||||
import com.axelor.inject.Beans;
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import com.google.inject.persist.Transactional;
|
|
||||||
import java.lang.invoke.MethodHandles;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import com.google.inject.servlet.RequestScoped;
|
import com.google.inject.servlet.RequestScoped;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class SophalServiceImpl implements SophalService {
|
public class SophalServiceImpl implements SophalService {
|
||||||
@@ -66,34 +36,31 @@ public class SophalServiceImpl implements SophalService {
|
|||||||
String result;
|
String result;
|
||||||
String var;
|
String var;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (product.getUnitCodeSelect() != null) {
|
if (product.getUnitCodeSelect() != null) {
|
||||||
var=product.getFamilleProduit().getCode()+product.getSousFamilleProduit().getCode()+product.getUnitCodeSelect();
|
var =
|
||||||
|
product.getFamilleProduit().getCode()
|
||||||
|
+ product.getSousFamilleProduit().getCode()
|
||||||
|
+ product.getUnitCodeSelect();
|
||||||
} else {
|
} else {
|
||||||
var=product.getFamilleProduit().getCode()+product.getSousFamilleProduit().getCode()+"00";
|
var =
|
||||||
|
product.getFamilleProduit().getCode() + product.getSousFamilleProduit().getCode() + "00";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (product.getCode() == null) {
|
if (product.getCode() == null) {
|
||||||
Query q =
|
Query q =
|
||||||
JPA.em()
|
JPA.em()
|
||||||
.createQuery("select self.code FROM Product as self WHERE self.codeCreated = ?1 AND self.code LIKE ?2 ORDER BY self.code DESC",
|
.createQuery(
|
||||||
|
"select self.code FROM Product as self WHERE self.codeCreated = ?1 AND self.code LIKE ?2 ORDER BY self.code DESC",
|
||||||
String.class);
|
String.class);
|
||||||
q.setParameter(1, true);
|
q.setParameter(1, true);
|
||||||
q.setParameter(2, var + "%");
|
q.setParameter(2, var + "%");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (q.getResultList().size() == 0) {
|
if (q.getResultList().size() == 0) {
|
||||||
result = null;
|
result = null;
|
||||||
} else {
|
} else {
|
||||||
result = (String) q.getResultList().get(0);
|
result = (String) q.getResultList().get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|
||||||
String arr[] = result.split(var);
|
String arr[] = result.split(var);
|
||||||
@@ -103,23 +70,18 @@ public class SophalServiceImpl implements SophalService {
|
|||||||
nbrInt = nbrInt + 1;
|
nbrInt = nbrInt + 1;
|
||||||
num = Integer.toString(nbrInt);
|
num = Integer.toString(nbrInt);
|
||||||
|
|
||||||
|
|
||||||
String padding = "000".substring(num.length()) + num;
|
String padding = "000".substring(num.length()) + num;
|
||||||
result = var + padding;
|
result = var + padding;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
result = var + "001";
|
result = var + "001";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
result = product.getCode();
|
result = product.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,44 +17,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.axelor.apps.base.web;
|
package com.axelor.apps.base.web;
|
||||||
|
|
||||||
|
|
||||||
import com.axelor.apps.base.db.Product;
|
|
||||||
import com.axelor.apps.base.db.repo.ProductRepository;
|
|
||||||
import com.axelor.apps.base.exceptions.IExceptionMessage;
|
|
||||||
import com.axelor.apps.base.report.IReport;
|
|
||||||
import com.axelor.apps.base.service.ProductService;
|
|
||||||
import com.axelor.apps.base.service.app.AppBaseService;
|
|
||||||
import com.axelor.apps.base.service.user.UserService;
|
|
||||||
import com.axelor.apps.report.engine.ReportSettings;
|
|
||||||
import com.axelor.auth.db.User;
|
|
||||||
import com.axelor.exception.AxelorException;
|
|
||||||
import com.axelor.exception.db.repo.TraceBackRepository;
|
|
||||||
import com.axelor.exception.service.TraceBackService;
|
|
||||||
import com.axelor.i18n.I18n;
|
|
||||||
import com.axelor.inject.Beans;
|
|
||||||
import com.axelor.meta.schema.actions.ActionView;
|
|
||||||
import com.axelor.rpc.ActionRequest;
|
|
||||||
import com.axelor.rpc.ActionResponse;
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.inject.Singleton;
|
|
||||||
import java.lang.invoke.MethodHandles;
|
|
||||||
import java.util.List;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import com.google.inject.servlet.RequestScoped;
|
|
||||||
import com.axelor.apps.base.db.Product;
|
import com.axelor.apps.base.db.Product;
|
||||||
import com.axelor.apps.base.service.SophalService;
|
import com.axelor.apps.base.service.SophalService;
|
||||||
|
import com.axelor.rpc.ActionRequest;
|
||||||
|
import com.axelor.rpc.ActionResponse;
|
||||||
|
import com.google.inject.servlet.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.axelor.rpc.Response;
|
|
||||||
|
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class SophalController {
|
public class SophalController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Inject private SophalService service;
|
@Inject private SophalService service;
|
||||||
|
|
||||||
public void GenerateCode(ActionRequest request, ActionResponse response) {
|
public void GenerateCode(ActionRequest request, ActionResponse response) {
|
||||||
@@ -64,5 +36,4 @@ public class SophalController {
|
|||||||
|
|
||||||
response.setValue("code", Code);
|
response.setValue("code", Code);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ public class PurchaseOrderSupplierLineService {
|
|||||||
purchaseOrderLine.setExTaxTotal(
|
purchaseOrderLine.setExTaxTotal(
|
||||||
PurchaseOrderLineServiceImpl.computeAmount(
|
PurchaseOrderLineServiceImpl.computeAmount(
|
||||||
purchaseOrderLine.getQty(), purchaseOrderLine.getPrice()));
|
purchaseOrderLine.getQty(), purchaseOrderLine.getPrice()));
|
||||||
|
purchaseOrderLine.setPriceDiscounted(purchaseOrderSupplierLine.getPrice());//sophal
|
||||||
purchaseOrderSupplierLine.setStateSelect(PurchaseOrderSupplierLineRepository.STATE_ACCEPTED);
|
purchaseOrderSupplierLine.setStateSelect(PurchaseOrderSupplierLineRepository.STATE_ACCEPTED);
|
||||||
|
|
||||||
poSupplierLineRepo.save(purchaseOrderSupplierLine);
|
poSupplierLineRepo.save(purchaseOrderSupplierLine);
|
||||||
|
|||||||
Reference in New Issue
Block a user