[WMS] Aggiunta commessa ordine durante il recupero dei materiali versati
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:
@@ -53,6 +53,9 @@ public class HistoryVersamentoULDTO {
|
||||
@SqlField("cod_jcom")
|
||||
private String codJcom;
|
||||
|
||||
@SqlField("cod_jcom_ord")
|
||||
private String codJcomOrd;
|
||||
|
||||
@SqlField("datetime_row")
|
||||
private LocalDateTime datetimeRow;
|
||||
|
||||
@@ -232,6 +235,15 @@ public class HistoryVersamentoULDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcomOrd() {
|
||||
return codJcomOrd;
|
||||
}
|
||||
|
||||
public HistoryVersamentoULDTO setCodJcomOrd(String codJcomOrd) {
|
||||
this.codJcomOrd = codJcomOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDatetimeRow() {
|
||||
return datetimeRow;
|
||||
}
|
||||
|
||||
@@ -152,6 +152,7 @@ public class RecuperaMaterialiRequestDTO {
|
||||
private BigDecimal qtaCol;
|
||||
private BigDecimal numCnf;
|
||||
private Integer percentageHr;
|
||||
private String codJcom;
|
||||
|
||||
public Integer getNumero() {
|
||||
return numero;
|
||||
@@ -215,5 +216,14 @@ public class RecuperaMaterialiRequestDTO {
|
||||
this.percentageHr = percentageHr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodJcom() {
|
||||
return codJcom;
|
||||
}
|
||||
|
||||
public Ordine setCodJcom(String codJcom) {
|
||||
this.codJcom = codJcom;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -26,6 +27,7 @@ import javax.annotation.Nullable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -238,7 +240,8 @@ public class WMSMaterialiService {
|
||||
" ISNULL(mtb_aart.descrizione_estesa, mtb_aart.descrizione) AS descrizione_art,\n" +
|
||||
" mtb_aart.unt_mis,\n" +
|
||||
" jtb_fasi.cod_jfas,\n" +
|
||||
" jtb_fasi.descrizione AS descrizione_fase\n" +
|
||||
" jtb_fasi.descrizione AS descrizione_fase,\n" +
|
||||
" dtb_ordt.cod_jcom AS cod_jcom_ord\n" +
|
||||
"FROM max_ul\n" +
|
||||
"LEFT OUTER JOIN ul_list ON ISNULL(max_ul.gestione, '') = ISNULL(ul_list.gestione, '') AND\n" +
|
||||
" ISNULL(max_ul.cod_mart, '') = ISNULL(ul_list.cod_mart, '') AND\n" +
|
||||
@@ -256,7 +259,10 @@ public class WMSMaterialiService {
|
||||
" ISNULL(max_ul.hr, '') = ISNULL(ul_list.hr, '') AND\n" +
|
||||
" max_ul.max_datetime_row = ul_list.datetime_row\n" +
|
||||
"INNER JOIN mtb_aart ON max_ul.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN jtb_fasi ON max_ul.cod_jfas = jtb_fasi.cod_jfas";
|
||||
" INNER JOIN jtb_fasi ON max_ul.cod_jfas = jtb_fasi.cod_jfas\n" +
|
||||
" LEFT OUTER JOIN dtb_ordt ON max_ul.num_ord = dtb_ordt.num_ord AND\n" +
|
||||
" max_ul.data_ord = dtb_ordt.data_ord AND\n" +
|
||||
" max_ul.gestione_ord = dtb_ordt.gestione";
|
||||
|
||||
|
||||
return UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, HistoryVersamentoULDTO.class);
|
||||
@@ -389,6 +395,20 @@ public class WMSMaterialiService {
|
||||
|
||||
mtbColrScarico.setOperation(OperationType.INSERT);
|
||||
movementScarico.getMtbColr().add(mtbColrScarico);
|
||||
|
||||
if (movementScarico.hasDocument()) {
|
||||
final DtbDoct dtbDoctScaricoToUpdate = revertQuantityInDocument(movementScarico.getCodAnag(),
|
||||
movementScarico.getCodDtip(),
|
||||
movementScarico.getDataDoc(),
|
||||
movementScarico.getNumDoc(),
|
||||
movementScarico.getSerDoc(),
|
||||
request.getCodMart(),
|
||||
request.getPartitaMag(),
|
||||
ordine.getCodJcom(),
|
||||
qtaCol, numCnf, inputQtaCnf);
|
||||
|
||||
entitiesToSave.add(dtbDoctScaricoToUpdate);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final MtbColr mtbColrScarico = new MtbColr()
|
||||
@@ -410,6 +430,20 @@ public class WMSMaterialiService {
|
||||
|
||||
mtbColrScarico.setOperation(OperationType.INSERT);
|
||||
movementScarico.getMtbColr().add(mtbColrScarico);
|
||||
|
||||
if (movementScarico.hasDocument()) {
|
||||
final DtbDoct dtbDoctScaricoToUpdate = revertQuantityInDocument(movementScarico.getCodAnag(),
|
||||
movementScarico.getCodDtip(),
|
||||
movementScarico.getDataDoc(),
|
||||
movementScarico.getNumDoc(),
|
||||
movementScarico.getSerDoc(),
|
||||
request.getCodMart(),
|
||||
request.getPartitaMag(),
|
||||
null,
|
||||
qtaColToSave, numCnfToSave, inputQtaCnf);
|
||||
|
||||
entitiesToSave.add(dtbDoctScaricoToUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,27 +503,6 @@ public class WMSMaterialiService {
|
||||
|
||||
}
|
||||
|
||||
if (movementScarico.hasDocument()) {
|
||||
DtbDoct dtbDoctScaricoToUpdate = new DtbDoct(movementScarico.getCodAnag(),
|
||||
movementScarico.getCodDtip(),
|
||||
movementScarico.getDataDoc(),
|
||||
movementScarico.getNumDoc(),
|
||||
movementScarico.getSerDoc());
|
||||
dtbDoctScaricoToUpdate.setOperation(OperationType.NO_OP);
|
||||
|
||||
|
||||
DtbDocr dtbDocrScarico = new DtbDocr()
|
||||
.setCodMart(request.getCodMart())
|
||||
.setPartitaMag(request.getPartitaMag())
|
||||
.setQta(UtilityBigDecimal.multiply(inputQtaTot, BigDecimal.valueOf(-1)))
|
||||
.setNumCnf(UtilityBigDecimal.multiply(inputNumCnf, BigDecimal.valueOf(-1)))
|
||||
.setQtaCnf(request.getQtaCnf());
|
||||
|
||||
dtbDocrScarico.setOperation(OperationType.INSERT);
|
||||
dtbDoctScaricoToUpdate.getDtbDocr().add(dtbDocrScarico);
|
||||
|
||||
entitiesToSave.add(dtbDoctScaricoToUpdate);
|
||||
}
|
||||
|
||||
|
||||
final List<EntityBase> savedEntities = entityProcessor.processEntityList(entitiesToSave, true);
|
||||
@@ -498,5 +511,30 @@ public class WMSMaterialiService {
|
||||
return new RecuperaMaterialiResponseDTO(null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static DtbDoct revertQuantityInDocument(String codAnag, String codDtip, Date dataDoc, int numDoc, String serDoc,
|
||||
String codMart, String partitaMag, String codJcom,
|
||||
BigDecimal inputQtaTot, BigDecimal inputNumCnf, BigDecimal inputQtaCnf) {
|
||||
DtbDoct dtbDoctScaricoToUpdate = new DtbDoct(codAnag,
|
||||
codDtip,
|
||||
dataDoc,
|
||||
numDoc,
|
||||
serDoc);
|
||||
dtbDoctScaricoToUpdate.setOperation(OperationType.NO_OP);
|
||||
|
||||
|
||||
DtbDocr dtbDocrScarico = new DtbDocr()
|
||||
.setCodMart(codMart)
|
||||
.setPartitaMag(partitaMag)
|
||||
.setQta(inputQtaTot)
|
||||
.setNumCnf(inputNumCnf)
|
||||
.setQtaCnf(inputQtaCnf)
|
||||
.setCodJcom(codJcom);
|
||||
|
||||
dtbDocrScarico.setOperation(OperationType.INSERT);
|
||||
dtbDoctScaricoToUpdate.getDtbDocr().add(dtbDocrScarico);
|
||||
return dtbDoctScaricoToUpdate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user