Merge remote-tracking branch 'origin/feature/RefactoringGestioneColli' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -189,6 +189,7 @@ public class MtbColr extends EntityBase implements EquatableEntityInterface<MtbC
|
||||
private Date dataScadPartita;
|
||||
|
||||
@JsonProperty
|
||||
@MapToTable("descrizione")
|
||||
private String descrizione;
|
||||
|
||||
@JsonProperty
|
||||
|
||||
@@ -591,7 +591,7 @@ end
|
||||
rule "completeFlagSetNumProtDtbTipi"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$dTip : DtbTipi((gestione == "V" || codCcau != null) && flagSetNumProt)
|
||||
$dTip : DtbTipi((gestione == "V" || codCcau != null) && (flagSetNumProt == null || flagSetNumProt))
|
||||
then
|
||||
modify ( $dTip ) { setFlagSetNumProt(false) }
|
||||
end
|
||||
|
||||
@@ -1238,13 +1238,18 @@ public class DocumentiDirettiService {
|
||||
CloseUDSLavorazioneRequestDTO closeUDSLavorazioneRequestDTO =
|
||||
new CloseUDSLavorazioneRequestDTO();
|
||||
closeUDSLavorazioneRequestDTO.setMtbColt(uds);
|
||||
|
||||
if (createUDSFromDocuments.getCriterioDistribuzione() != null)
|
||||
closeUDSLavorazioneRequestDTO.setCriterioDistribuzione(createUDSFromDocuments.getCriterioDistribuzione());
|
||||
|
||||
wmsLavorazioneService.closeUDS(closeUDSLavorazioneRequestDTO);
|
||||
|
||||
} else {
|
||||
CloseUDSRequestDTO closeUDSRequestDTO = new CloseUDSRequestDTO().setMtbColt(uds);
|
||||
|
||||
if (createUDSFromDocuments.getCriterioDistribuzione() != null)
|
||||
closeUDSRequestDTO.setCriterioDistribuzione(createUDSFromDocuments.getCriterioDistribuzione());
|
||||
|
||||
wmsSpedizioneService.closeUDS(closeUDSRequestDTO);
|
||||
}
|
||||
|
||||
|
||||
@@ -1583,44 +1583,9 @@ public class PvmService {
|
||||
mtbColtToReturn.getDataCollo(),
|
||||
mtbColtToReturn.getNumCollo());
|
||||
|
||||
final List<HashMap<String, Object>> mtbColrValues = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), mtbColrsSql);
|
||||
|
||||
List<MtbColr> rows = new ArrayList<MtbColr>();
|
||||
|
||||
for (HashMap<String, Object> mapRow : mtbColrValues) {
|
||||
MtbColr row = new MtbColr();
|
||||
|
||||
row.setGestione(UtilityHashMap.getValueIfExists(mapRow, "gestione"));
|
||||
row.setDataCollo(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_collo")));
|
||||
row.setSerCollo(UtilityHashMap.getValueIfExists(mapRow, "ser_collo"));
|
||||
row.setNumCollo(UtilityHashMap.getValueIfExists(mapRow, "num_collo"));
|
||||
row.setCodMart(UtilityHashMap.getValueIfExists(mapRow, "cod_mart"));
|
||||
row.setPartitaMag(UtilityHashMap.getValueIfExists(mapRow, "partita_mag"));
|
||||
row.setQtaCol(UtilityHashMap.getValueIfExists(mapRow, "qta_col"));
|
||||
row.setQtaCnf(UtilityHashMap.getValueIfExists(mapRow, "qta_cnf"));
|
||||
row.setNumCnf(UtilityHashMap.getValueIfExists(mapRow, "num_cnf"));
|
||||
row.setRiga(UtilityHashMap.getValueIfExists(mapRow, "riga"));
|
||||
row.setRigaOrd(UtilityHashMap.getValueIfExists(mapRow, "riga_ord"));
|
||||
row.setDataOrd(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_ord")));
|
||||
row.setNumOrd(UtilityHashMap.getValueIfExists(mapRow, "num_ord"));
|
||||
row.setNumEtich(UtilityHashMap.getValueIfExists(mapRow, "num_etich"));
|
||||
row.setDatetimeRow(UtilityLocalDate.localDateTimeFromDate(UtilityHashMap.<Timestamp>getValueIfExists(mapRow, "datetime_row")));
|
||||
row.setCodJcom(UtilityHashMap.getValueIfExists(mapRow, "cod_jcom"));
|
||||
row.setDescrizione(UtilityHashMap.getValueIfExists(mapRow, "descrizione"));
|
||||
row.setGestioneRif(UtilityHashMap.getValueIfExists(mapRow, "gestione_rif"));
|
||||
row.setDataColloRif(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_collo_rif")));
|
||||
row.setNumColloRif(UtilityHashMap.getValueIfExists(mapRow, "num_collo_rif"));
|
||||
row.setSerColloRif(UtilityHashMap.getValueIfExists(mapRow, "ser_collo_rif"));
|
||||
row.setBarcodeUlIn(UtilityHashMap.getValueIfExists(mapRow, "barcode_ul_in"));
|
||||
row.setCodMdepIn(UtilityHashMap.getValueIfExists(mapRow, "cod_mdep_in"));
|
||||
row.setPosizioneIn(UtilityHashMap.getValueIfExists(mapRow, "posizione_in"));
|
||||
row.setOperation(OperationType.SELECT_OBJECT);
|
||||
row.setOnlyPkMaster(false);
|
||||
|
||||
rows.add(row);
|
||||
}
|
||||
|
||||
mtbColtToReturn.setMtbColr(rows);
|
||||
mtbColtToReturn.setMtbColr(
|
||||
UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), mtbColrsSql, MtbColr.class)
|
||||
);
|
||||
} else {
|
||||
|
||||
final List<MvwSitArtUdcDetInventarioDTO> giacenzaList = wmsGiacenzaULService.retrieveArtsInGiacenzaByBarcodeUl(multiDBTransactionManager.getPrimaryConnection(), barcodeUl);
|
||||
@@ -2055,11 +2020,11 @@ public class PvmService {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!flagResoTec ) {
|
||||
if (!flagResoTec) {
|
||||
BigDecimal qtaCnf = UtilityHashMap.getValueIfExists(lotto, "qta_cnf");
|
||||
BigDecimal qtaCol = UtilityHashMap.getValueIfExists(lotto, "qta_col");
|
||||
BigDecimal numCnf = qtaCol.divide(qtaCnf,5, RoundingMode.HALF_UP);
|
||||
if (!UtilityBigDecimal.equalsTo(numCnf, new BigDecimal(numCnf.intValue()))){
|
||||
BigDecimal numCnf = qtaCol.divide(qtaCnf, 5, RoundingMode.HALF_UP);
|
||||
if (!UtilityBigDecimal.equalsTo(numCnf, new BigDecimal(numCnf.intValue()))) {
|
||||
anomalieResiDTO.add(setAnomalia(anomalieResiDTO, codMart, dataScad,
|
||||
"Per l'articolo bisogna rendere un cartone intero."));
|
||||
continue;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.annimon.stream.Optional;
|
||||
import com.annimon.stream.Stream;
|
||||
import groovy.lang.Tuple2;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.exception.MissingDataException;
|
||||
import it.integry.ems.javabeans.RequestDataDTO;
|
||||
import it.integry.ems.retail.wms.dto.*;
|
||||
@@ -320,18 +321,23 @@ public class WMSUtility {
|
||||
if (insertUDSRowRequestDTO.getSourceMtbColr() != null) {
|
||||
MtbColr sourceMtbColr = insertUDSRowRequestDTO.getSourceMtbColr();
|
||||
|
||||
//Commentato perchè ritenuno non utile (o comunque non corretto qui in insertUdsRow)
|
||||
// MtbColt sourceMtbColt = new MtbColt(
|
||||
// sourceMtbColr.getGestione(),
|
||||
// sourceMtbColr.getDataCollo(),
|
||||
// sourceMtbColr.getNumCollo(),
|
||||
// sourceMtbColr.getSerCollo());
|
||||
// sourceMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
//
|
||||
// entityProcessor.processEntity(sourceMtbColt, true, multiDBTransactionManager);
|
||||
//
|
||||
// if (UtilityString.isNullOrEmpty(targetMtbColt.getCodTcol()) && !UtilityString.isNullOrEmpty(sourceMtbColt.getCodTcol()))
|
||||
// targetMtbColt.setCodTcol(sourceMtbColt.getCodTcol());
|
||||
String sqlCodTcol = Query.format("SELECT cod_tcol\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
"WHERE gestione = {}\n" +
|
||||
" AND data_collo = {}\n" +
|
||||
" AND num_collo = {}\n" +
|
||||
" AND ser_collo = {}",
|
||||
sourceMtbColr.getGestione(),
|
||||
sourceMtbColr.getDataCollo(),
|
||||
sourceMtbColr.getNumCollo(),
|
||||
sourceMtbColr.getSerCollo());
|
||||
|
||||
final String sourceCodTcol = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sqlCodTcol);
|
||||
|
||||
if (UtilityString.isNullOrEmpty(targetMtbColt.getCodTcol()) && !UtilityString.isNullOrEmpty(sourceCodTcol)) {
|
||||
targetMtbColt.setCodTcol(sourceCodTcol);
|
||||
targetMtbColt.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
|
||||
targetMtbColr
|
||||
// .setCodJcom(UtilityString.emptyStr2Null(sourceMtbColr.getCodJcom()))
|
||||
@@ -640,7 +646,7 @@ public class WMSUtility {
|
||||
|
||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||
|
||||
targetMtbColt.setOperation(OperationType.NO_OP);
|
||||
|
||||
final MtbColr targetMtbColr = new MtbColr()
|
||||
.setCausale(MtbColr.Causale.DEFAULT)
|
||||
@@ -728,13 +734,18 @@ public class WMSUtility {
|
||||
public static List<MtbAart> getArticoliByCodMarts(List<String> codMarts, Connection connection) throws Exception {
|
||||
if (codMarts == null || codMarts.isEmpty()) return null;
|
||||
|
||||
String query =
|
||||
"SELECT DISTINCT mtb_aart.*"
|
||||
+ " FROM mtb_aart "
|
||||
+ " WHERE cod_mart IN (" + UtilityQuery.concatStringFieldsWithSeparator(codMarts, ",") + ")";
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbAart> listMtbAart = entityCacheComponent.getCachedEntitiesList(
|
||||
connection.getIntegryCustomerDB(), MtbAart.ENTITY, x -> codMarts.contains(x.getCodMart()));
|
||||
|
||||
List<MtbAart> listMtbAart = UtilityDB.executeSimpleQueryDTO(connection, query, MtbAart.class);
|
||||
// String query =
|
||||
// "SELECT DISTINCT mtb_aart.*"
|
||||
// + " FROM mtb_aart "
|
||||
// + " WHERE cod_mart IN (" + UtilityQuery.concatStringFieldsWithSeparator(codMarts, ",") + ")";
|
||||
//
|
||||
//
|
||||
// List<MtbAart> listMtbAart = UtilityDB.executeSimpleQueryDTO(connection, query, MtbAart.class);
|
||||
|
||||
List<MtbAartBarCode> barCodeFromCod = getAlternativeMtbAartBarCodes(codMarts, connection);
|
||||
|
||||
@@ -776,14 +787,19 @@ public class WMSUtility {
|
||||
.collect(Collectors.toMap(MtbAart::getCodMart, a -> a, (a, b) -> a, HashMap::new));
|
||||
}
|
||||
|
||||
public static List<MtbUntMis> getUntMisFromCod(List<String> untMisCods, Connection connection) throws Exception {
|
||||
List<String> untMisStrings = Stream.of(untMisCods)
|
||||
.withoutNulls()
|
||||
public static List<MtbUntMis> getUntMisFromCod(List<String> untMisCods, Connection connection) {
|
||||
List<String> untMisStrings = untMisCods.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<MtbUntMis> mtbUntMis = entityCacheComponent.getCachedEntitiesList(
|
||||
connection.getIntegryCustomerDB(),
|
||||
MtbUntMis.ENTITY,
|
||||
x -> untMisCods.contains(x.getUntMis()));
|
||||
|
||||
String queryUntMis = "SELECT * FROM mtb_unt_mis WHERE unt_mis IN (" + UtilityQuery.concatStringFieldsWithSeparator(untMisStrings, ",") + ")";
|
||||
final List<MtbUntMis> mtbUntMis = UtilityDB.executeSimpleQueryDTO(connection, queryUntMis, MtbUntMis.class);
|
||||
return mtbUntMis != null ? mtbUntMis : new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -793,12 +809,18 @@ public class WMSUtility {
|
||||
" FROM mtb_colt WHERE barcode_ul = " + UtilityDB.valueToString(barcodeUl));
|
||||
}
|
||||
|
||||
public static List<MtbAartBarCode> getAlternativeMtbAartBarCodes(List<String> codMarts, Connection conn) throws Exception {
|
||||
public static List<MtbAartBarCode> getAlternativeMtbAartBarCodes(List<String> codMarts, Connection conn) {
|
||||
codMarts = codMarts.stream()
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
String sql = "SELECT * FROM mtb_aart_bar_code WHERE cod_mart IN (" + UtilityQuery.concatStringFieldsWithSeparator(codMarts, ",") + ")";
|
||||
final List<MtbAartBarCode> barCodeList = UtilityDB.executeSimpleQueryDTO(conn, sql, MtbAartBarCode.class);
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<String> finalCodMarts = codMarts;
|
||||
List<MtbAartBarCode> barCodeList = entityCacheComponent.getCachedEntitiesList(
|
||||
conn.getIntegryCustomerDB(),
|
||||
MtbAartBarCode.ENTITY,
|
||||
x -> finalCodMarts.contains(x.getCodMart()));
|
||||
|
||||
return barCodeList != null ? barCodeList : new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -294,6 +294,7 @@ public class WMSAccettazioneService {
|
||||
MtbColt targetMtbColt = inputData.getTargetMtbColt();
|
||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||
targetMtbColt.setOperation(OperationType.NO_OP);
|
||||
|
||||
for (InsertUDCRowRequestDTO insertUDCRowRequestDTO : inputData.getRows()) {
|
||||
|
||||
|
||||
@@ -159,6 +159,8 @@ public class WMSLavorazioneService {
|
||||
.setSerCollo(insertUDSRowRequestDTO.getTargetMtbColt().getSerCollo())
|
||||
.setGestione(insertUDSRowRequestDTO.getTargetMtbColt().getGestione());
|
||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||
targetMtbColt.setOperation(OperationType.NO_OP);
|
||||
|
||||
insertUDSRowRequestDTO.setTargetMtbColt(targetMtbColt);
|
||||
|
||||
@@ -194,7 +196,7 @@ public class WMSLavorazioneService {
|
||||
.setGestione(inputData.getTargetMtbColt().getGestione());
|
||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||
|
||||
targetMtbColt.setOperation(OperationType.NO_OP);
|
||||
|
||||
for (InsertUDSRowRequestDTO row : inputData.getRows()) {
|
||||
|
||||
|
||||
@@ -247,6 +247,7 @@ public class WMSSpedizioneService {
|
||||
.setGestione(insertUDSRowRequestDTO.getTargetMtbColt().getGestione());
|
||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||
targetMtbColt.setOperation(OperationType.NO_OP);
|
||||
|
||||
insertUDSRowRequestDTO.setTargetMtbColt(targetMtbColt);
|
||||
|
||||
@@ -293,17 +294,27 @@ public class WMSSpedizioneService {
|
||||
if (insertUDSRowRequestDTO.getSourceMtbColr() != null) {
|
||||
MtbColr sourceMtbColr = insertUDSRowRequestDTO.getSourceMtbColr();
|
||||
|
||||
MtbColt sourceMtbColt = new MtbColt(
|
||||
String sqlCodTcol = Query.format("SELECT cod_tcol\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
"WHERE gestione = {}\n" +
|
||||
" AND data_collo = {}\n" +
|
||||
" AND num_collo = {}\n" +
|
||||
" AND ser_collo = {}",
|
||||
sourceMtbColr.getGestione(),
|
||||
sourceMtbColr.getDataCollo(),
|
||||
sourceMtbColr.getNumCollo(),
|
||||
sourceMtbColr.getSerCollo());
|
||||
sourceMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
entityProcessor.processEntity(sourceMtbColt, multiDBTransactionManager);
|
||||
final String sourceCodTcol = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sqlCodTcol);
|
||||
|
||||
if (UtilityString.isNullOrEmpty(targetMtbColt.getCodTcol()) && !UtilityString.isNullOrEmpty(sourceMtbColt.getCodTcol()))
|
||||
targetMtbColt.setCodTcol(sourceMtbColt.getCodTcol());
|
||||
if (UtilityString.isNullOrEmpty(targetMtbColt.getCodTcol()) && !UtilityString.isNullOrEmpty(sourceCodTcol)) {
|
||||
targetMtbColt.setCodTcol(sourceCodTcol);
|
||||
|
||||
if (targetMtbColt.getOperation() == OperationType.SELECT_OBJECT ||
|
||||
targetMtbColt.getOperation() == OperationType.SELECT ||
|
||||
targetMtbColt.getOperation() == OperationType.NO_OP)
|
||||
targetMtbColt.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
|
||||
targetMtbColr
|
||||
.setCodJcom(UtilityString.emptyStr2Null(sourceMtbColr.getCodJcom()))
|
||||
@@ -603,7 +614,7 @@ public class WMSSpedizioneService {
|
||||
|
||||
MtbColt uds = this.createUDSMovement(data);
|
||||
|
||||
for (InsertUDSRowRequestDTO row : data.getUdsRows()){
|
||||
for (InsertUDSRowRequestDTO row : data.getUdsRows()) {
|
||||
row.setTargetMtbColt(uds);
|
||||
insertUDSRowMovement(row);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user