Finish Rossogargano_ricambi
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomer;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20241115114016 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
String value = null;
|
||||||
|
if (isCustomer(IntegryCustomer.RossoGargano))
|
||||||
|
value = "T";
|
||||||
|
|
||||||
|
createSetup("PVM", "SETUP", "COD_MGRP_RICAMBI", value, "Codice gruppo articoli di ricambio", "COD_MGRP");
|
||||||
|
|
||||||
|
if (isCustomer(IntegryCustomer.RossoGargano)) {
|
||||||
|
createOrUpdateFunction("f_suggestCodeCodMartRicambi", "\n" +
|
||||||
|
"CREATE FUNCTION [dbo].[f_suggestCodeCodMartRicambi](@codMgrp VARCHAR(5), @codMsgr VARCHAR(5), @codMsfa VARCHAR(5))\n" +
|
||||||
|
" RETURNS VARCHAR(20)\n" +
|
||||||
|
" WITH INLINE = OFF\n" +
|
||||||
|
" AS\n" +
|
||||||
|
" BEGIN\n" +
|
||||||
|
"\n" +
|
||||||
|
" DECLARE @codMart VARCHAR(20);\n" +
|
||||||
|
" DECLARE @maxCodMart INTEGER;\n" +
|
||||||
|
"\n" +
|
||||||
|
" SET @codMgrp = ISNULL(@codMgrp, 'T');\n" +
|
||||||
|
" SET @codMsgr = ISNULL(@codMsgr, CONCAT(@codMgrp, '0'));\n" +
|
||||||
|
" SET @codMsfa = ISNULL(@codMsfa, CONCAT(@codMsgr, '00'));\n" +
|
||||||
|
"\n" +
|
||||||
|
" WITH ricambi AS (SELECT TOP 1 CAST(REPLACE(cod_mart, @codMsfa, '') AS INTEGER) + 1 AS maxCodMart\n" +
|
||||||
|
" FROM mtb_aart\n" +
|
||||||
|
" WHERE cod_mart LIKE CONCAT(@codMsfa, '%')\n" +
|
||||||
|
" AND cod_mart NOT LIKE CONCAT(@codMsfa, '%[^0-9]%')\n" +
|
||||||
|
" ORDER BY 1 DESC)\n" +
|
||||||
|
" SELECT @maxCodMart = ISNULL(maxCodMart, 1)\n" +
|
||||||
|
" FROM ricambi\n" +
|
||||||
|
"\n" +
|
||||||
|
" SET @codMart = CONCAT(@codMsfa, FORMAT(ISNULL(@maxCodMart, 1), REPLICATE('0', 4)))\n" +
|
||||||
|
"\n" +
|
||||||
|
" RETURN @codMart\n" +
|
||||||
|
"\n" +
|
||||||
|
" END");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
createOrUpdateFunction("f_suggestCodeCodMartRicambi", "CREATE FUNCTION [dbo].[f_suggestCodeCodMartRicambi](@codMgrp VARCHAR(5), @codMsgr VARCHAR(5), @codMsfa VARCHAR(5))\n" +
|
||||||
|
" RETURNS VARCHAR(20)\n" +
|
||||||
|
" WITH INLINE = OFF\n" +
|
||||||
|
"AS\n" +
|
||||||
|
"BEGIN\n" +
|
||||||
|
" DECLARE @partialCode VARCHAR(15);\n" +
|
||||||
|
" SET @partialCode = CONCAT(@codMgrp, @codMsgr, @codMgrp);\n" +
|
||||||
|
" RETURN f_suggestCodeCodMart(@partialCode);\n" +
|
||||||
|
"END\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
package it.integry.ems_model.entity;
|
package it.integry.ems_model.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
import it.integry.ems_model.annotation.*;
|
import it.integry.ems_model.annotation.*;
|
||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||||
|
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.kie.api.definition.type.PropertyReactive;
|
import org.kie.api.definition.type.PropertyReactive;
|
||||||
@@ -41,7 +43,7 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
|||||||
private String criterioVal;
|
private String criterioVal;
|
||||||
|
|
||||||
@SqlField(value = "tipo_mgrp", maxLength = 3)
|
@SqlField(value = "tipo_mgrp", maxLength = 3)
|
||||||
private String tipoMgrp;
|
private TipoGruppo tipoMgrp;
|
||||||
|
|
||||||
@SqlField(value = "flag_attivo", nullable = false, defaultObjectValue = "1")
|
@SqlField(value = "flag_attivo", nullable = false, defaultObjectValue = "1")
|
||||||
private Boolean flagAttivo;
|
private Boolean flagAttivo;
|
||||||
@@ -104,11 +106,11 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTipoMgrp() {
|
public TipoGruppo getTipoMgrp() {
|
||||||
return tipoMgrp;
|
return tipoMgrp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MtbGrup setTipoMgrp(String tipoMgrp) {
|
public MtbGrup setTipoMgrp(TipoGruppo tipoMgrp) {
|
||||||
this.tipoMgrp = tipoMgrp;
|
this.tipoMgrp = tipoMgrp;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -184,4 +186,47 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(getCodMgrp(), getDescrizione(), getFlagValMag(), getLogoWeb(), getCriterioVal(), getTipoMgrp(), getFlagAttivo(), getFlagTracciabilita());
|
return Objects.hash(getCodMgrp(), getDescrizione(), getFlagValMag(), getLogoWeb(), getCriterioVal(), getTipoMgrp(), getFlagAttivo(), getFlagTracciabilita());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum TipoGruppo implements IBaseEnum<MtbGrup.TipoGruppo> {
|
||||||
|
|
||||||
|
ACCONTI_SCONTI("ACS"),
|
||||||
|
FITTIZIO("FTT"),
|
||||||
|
IMBALLAGGI("IMB"),
|
||||||
|
MATERIALE_ACCESSORI("ACC"),
|
||||||
|
MATERIE_PRIME("MP"),
|
||||||
|
PRODOTTI_FINITI("PF"),
|
||||||
|
SEMILAVORATI("SL"),
|
||||||
|
RICAMBI("RIC")
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
TipoGruppo(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MtbGrup.TipoGruppo from(Object value) {
|
||||||
|
String castValue = String.valueOf(value);
|
||||||
|
for (MtbGrup.TipoGruppo b : MtbGrup.TipoGruppo.values()) {
|
||||||
|
if (b.value.equalsIgnoreCase(castValue))
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object get() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MtbGrup.TipoGruppo fromInternal(Object val) {
|
||||||
|
return from(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,4 +83,14 @@ public class WMSArticoloController {
|
|||||||
return ServiceRestResponse.createPositiveResponse();
|
return ServiceRestResponse.createPositiveResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "saveArticolo", method = RequestMethod.POST)
|
||||||
|
public @ResponseBody
|
||||||
|
ServiceRestResponse saveArticolo(@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||||
|
@RequestBody SaveArticoloDTO saveArticoloDTO) throws Exception {
|
||||||
|
|
||||||
|
return ServiceRestResponse.createPositiveResponse(wmsArticoloService.saveArticolo(saveArticoloDTO));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,277 @@
|
|||||||
|
package it.integry.ems.retail.wms.generic.dto;
|
||||||
|
|
||||||
|
import it.integry.ems_model.annotation.MapToTable;
|
||||||
|
import it.integry.ems_model.entity.MtbAart;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class SaveArticoloDTO {
|
||||||
|
private String codMart;
|
||||||
|
private String descrizione;
|
||||||
|
private String untMis;
|
||||||
|
private String barCode;
|
||||||
|
private BigDecimal qtaCnf;
|
||||||
|
private String codAliq;
|
||||||
|
private String articoloComposto;
|
||||||
|
private String descrizioneEstesa;
|
||||||
|
private String note;
|
||||||
|
private String posizione;
|
||||||
|
private String codMgrp;
|
||||||
|
private String codMsfa;
|
||||||
|
private String codMsgr;
|
||||||
|
private String codMstp;
|
||||||
|
private String codMtip;
|
||||||
|
private Boolean flagStato;
|
||||||
|
private String codBarreImb;
|
||||||
|
private String diacod;
|
||||||
|
private Boolean flagQtaCnfFissa;
|
||||||
|
private String idArtEqui;
|
||||||
|
private Boolean flagKit;
|
||||||
|
private String precode;
|
||||||
|
|
||||||
|
public MtbAart getMtbAart(){
|
||||||
|
MtbAart articolo = new MtbAart();
|
||||||
|
articolo
|
||||||
|
.setCodMart(codMart)
|
||||||
|
.setDescrizione(descrizione)
|
||||||
|
.setUntMis(untMis)
|
||||||
|
.setBarCode(barCode)
|
||||||
|
.setQtaCnf(qtaCnf)
|
||||||
|
.setCodAliq(codAliq)
|
||||||
|
.setArticoloComposto(articoloComposto)
|
||||||
|
.setDescrizioneEstesa(descrizioneEstesa)
|
||||||
|
.setNote(note)
|
||||||
|
.setPosizione(posizione)
|
||||||
|
.setCodMgrp(codMgrp)
|
||||||
|
.setCodMsfa(codMsfa)
|
||||||
|
.setCodMsgr(codMsgr)
|
||||||
|
.setCodMstp(codMstp)
|
||||||
|
.setCodMtip(codMtip)
|
||||||
|
.setFlagStato(flagStato ? "A" : "I")
|
||||||
|
.setCodBarreImb(codBarreImb)
|
||||||
|
.setDiacod(diacod)
|
||||||
|
.setFlagQtaCnfFissa(flagQtaCnfFissa ? "S" : "N")
|
||||||
|
.setIdArtEqui(idArtEqui)
|
||||||
|
.setFlagKit(flagKit ? "S" : "N");
|
||||||
|
|
||||||
|
return articolo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getCodMart() {
|
||||||
|
return codMart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodMart(String codMart) {
|
||||||
|
this.codMart = codMart;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizione() {
|
||||||
|
return descrizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setDescrizione(String descrizione) {
|
||||||
|
this.descrizione = descrizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUntMis() {
|
||||||
|
return untMis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setUntMis(String untMis) {
|
||||||
|
this.untMis = untMis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBarCode() {
|
||||||
|
return barCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setBarCode(String barCode) {
|
||||||
|
this.barCode = barCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQtaCnf() {
|
||||||
|
return qtaCnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setQtaCnf(BigDecimal qtaCnf) {
|
||||||
|
this.qtaCnf = qtaCnf;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodAliq() {
|
||||||
|
return codAliq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodAliq(String codAliq) {
|
||||||
|
this.codAliq = codAliq;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArticoloComposto() {
|
||||||
|
return articoloComposto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setArticoloComposto(String articoloComposto) {
|
||||||
|
this.articoloComposto = articoloComposto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescrizioneEstesa() {
|
||||||
|
return descrizioneEstesa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setDescrizioneEstesa(String descrizioneEstesa) {
|
||||||
|
this.descrizioneEstesa = descrizioneEstesa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNote() {
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setNote(String note) {
|
||||||
|
this.note = note;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPosizione() {
|
||||||
|
return posizione;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setPosizione(String posizione) {
|
||||||
|
this.posizione = posizione;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMgrp() {
|
||||||
|
return codMgrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodMgrp(String codMgrp) {
|
||||||
|
this.codMgrp = codMgrp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMsfa() {
|
||||||
|
return codMsfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodMsfa(String codMsfa) {
|
||||||
|
this.codMsfa = codMsfa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMsgr() {
|
||||||
|
return codMsgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodMsgr(String codMsgr) {
|
||||||
|
this.codMsgr = codMsgr;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMstp() {
|
||||||
|
return codMstp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodMstp(String codMstp) {
|
||||||
|
this.codMstp = codMstp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodMtip() {
|
||||||
|
return codMtip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodMtip(String codMtip) {
|
||||||
|
this.codMtip = codMtip;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getFlagStato() {
|
||||||
|
return flagStato;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setFlagStato(Boolean flagStato) {
|
||||||
|
this.flagStato = flagStato;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setFlagStato(String flagStato) {
|
||||||
|
this.flagStato = flagStato.equalsIgnoreCase("A");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCodBarreImb() {
|
||||||
|
return codBarreImb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setCodBarreImb(String codBarreImb) {
|
||||||
|
this.codBarreImb = codBarreImb;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDiacod() {
|
||||||
|
return diacod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setDiacod(String diacod) {
|
||||||
|
this.diacod = diacod;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getFlagQtaCnfFissa() {
|
||||||
|
return flagQtaCnfFissa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setFlagQtaCnfFissa(Boolean flagQtaCnfFissa) {
|
||||||
|
this.flagQtaCnfFissa = flagQtaCnfFissa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setFlagQtaCnfFissa(String flagQtaCnfFissa) {
|
||||||
|
this.flagQtaCnfFissa = flagQtaCnfFissa.equalsIgnoreCase("S");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdArtEqui() {
|
||||||
|
return idArtEqui;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setIdArtEqui(String idArtEqui) {
|
||||||
|
this.idArtEqui = idArtEqui;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getFlagKit() {
|
||||||
|
return flagKit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setFlagKit(Boolean flagKit) {
|
||||||
|
this.flagKit = flagKit;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setFlagKit(String flagKit) {
|
||||||
|
this.flagKit = flagKit.equalsIgnoreCase("S");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrecode() {
|
||||||
|
return precode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO setPrecode(String precode) {
|
||||||
|
this.precode = precode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package it.integry.ems.retail.wms.generic.service;
|
package it.integry.ems.retail.wms.generic.service;
|
||||||
|
|
||||||
|
import it.integry.ems.exception.MissingDataException;
|
||||||
import it.integry.ems.product.importaz.service.ProductServices;
|
import it.integry.ems.product.importaz.service.ProductServices;
|
||||||
|
import it.integry.ems.retail.wms.generic.dto.SaveArticoloDTO;
|
||||||
import it.integry.ems.retail.wms.generic.dto.SearchArticoloByBarcodeOrCodMartResponseDTO;
|
import it.integry.ems.retail.wms.generic.dto.SearchArticoloByBarcodeOrCodMartResponseDTO;
|
||||||
import it.integry.ems.retail.wms.generic.dto.SearchArticoloByCodArtFornOrDescrizioneRequestDTO;
|
import it.integry.ems.retail.wms.generic.dto.SearchArticoloByCodArtFornOrDescrizioneRequestDTO;
|
||||||
import it.integry.ems.retail.wms.generic.dto.SearchArticoloByCodArtFornOrDescrizioneResponseDTO;
|
import it.integry.ems.retail.wms.generic.dto.SearchArticoloByCodArtFornOrDescrizioneResponseDTO;
|
||||||
@@ -8,7 +10,9 @@ import it.integry.ems.service.EntityProcessor;
|
|||||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||||
import it.integry.ems_model.entity.MtbAart;
|
import it.integry.ems_model.entity.MtbAart;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
|
import it.integry.ems_model.utility.Query;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
|
import it.integry.ems_model.utility.UtilityString;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -88,4 +92,33 @@ public class WMSArticoloService {
|
|||||||
entityProcessor.processEntity(mtbAart, multiDBTransactionManager);
|
entityProcessor.processEntity(mtbAart, multiDBTransactionManager);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SaveArticoloDTO saveArticolo(SaveArticoloDTO saveArticoloDTO)throws Exception {
|
||||||
|
if (saveArticoloDTO == null)
|
||||||
|
throw new MissingDataException("saveArticolo");
|
||||||
|
|
||||||
|
MtbAart articolo = saveArticoloDTO.getMtbAart();
|
||||||
|
articolo.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
|
if (UtilityString.isNullOrEmpty(articolo.getCodMart())){
|
||||||
|
articolo.setCodMart(suggestCodMart(articolo, saveArticoloDTO.getPrecode()));
|
||||||
|
}
|
||||||
|
entityProcessor.processEntity(articolo,true,multiDBTransactionManager);
|
||||||
|
return saveArticoloDTO;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String suggestCodMartRicambi(String codMgrp, String codMsgr, String codMsfa) throws Exception {
|
||||||
|
String sql = Query.format("select dbo.f_suggestCodeCodMartRicambi(%s,%s,%s) ", codMgrp,codMsgr,codMsfa);
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(),sql);
|
||||||
|
}
|
||||||
|
private String suggestCodMart(MtbAart mtbAart, String precode) throws Exception {
|
||||||
|
|
||||||
|
String sql = Query.format("select dbo.f_suggestCodeCodMart(%s) ", precode);
|
||||||
|
if (mtbAart.getCodMgrp().equalsIgnoreCase("T")){
|
||||||
|
sql = Query.format("select dbo.f_suggestCodeCodMartRicambi(%s,%s,%s) ", mtbAart.getCodMgrp(),mtbAart.getCodMsgr(),mtbAart.getCodMsfa());
|
||||||
|
}
|
||||||
|
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(),sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user