Migliorato servizio di salvataggio documenti diretti: iniziata implementazione per cancellazione trasferimenti
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:
@@ -41,24 +41,34 @@ import static java.util.stream.Collectors.groupingBy;
|
|||||||
@Service
|
@Service
|
||||||
@Scope("request")
|
@Scope("request")
|
||||||
public class DocumentiDirettiService {
|
public class DocumentiDirettiService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EntityProcessor entityProcessor;
|
private EntityProcessor entityProcessor;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MultiDBTransactionManager multiDBTransactionManager;
|
private MultiDBTransactionManager multiDBTransactionManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RequestDataDTO requestDataDTO;
|
private RequestDataDTO requestDataDTO;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SetupGest setupGest;
|
private SetupGest setupGest;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DocumentService documentService;
|
private DocumentService documentService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSAccettazioneService wmsAccettazioneService;
|
private WMSAccettazioneService wmsAccettazioneService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSSpedizioneService wmsSpedizioneService;
|
private WMSSpedizioneService wmsSpedizioneService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSLavorazioneService wmsLavorazioneService;
|
private WMSLavorazioneService wmsLavorazioneService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WMSGenericService wmsGenericService;
|
private WMSGenericService wmsGenericService;
|
||||||
|
|
||||||
@@ -150,18 +160,47 @@ public class DocumentiDirettiService {
|
|||||||
|
|
||||||
if (UtilityList.isNullOrEmpty(dtbDoct.getMtbColt())) return null;
|
if (UtilityList.isNullOrEmpty(dtbDoct.getMtbColt())) return null;
|
||||||
|
|
||||||
//<editor-fold desc="Prendo tutti i colli, con le quantità associate che devono essere trasferite">
|
List<MtbColt> ulsToAddToTransfer = dtbDoct.getMtbColt().stream()
|
||||||
|
.filter(x -> (x.getOperation() == null || x.getOperation() != OperationType.DELETE))
|
||||||
List<MtbColt> ulsToTransfer = dtbDoct.getMtbColt().stream()
|
|
||||||
.filter(x -> x.getOperation() == null || !x.getOperation().equals(OperationType.DELETE))
|
|
||||||
.map(x -> (MtbColt) x.clone())
|
.map(x -> (MtbColt) x.clone())
|
||||||
.peek(x -> x.setOperation(OperationType.SELECT_OBJECT))
|
.peek(x -> x.setOperation(OperationType.SELECT_OBJECT))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (UtilityList.isNullOrEmpty(ulsToTransfer)) return null;
|
if (!UtilityList.isNullOrEmpty(ulsToAddToTransfer)) {
|
||||||
|
entityProcessor.processEntityList(ulsToAddToTransfer, multiDBTransactionManager, true);
|
||||||
|
|
||||||
entityProcessor.processEntityList(ulsToTransfer, multiDBTransactionManager, true);
|
ulsToAddToTransfer = ulsToAddToTransfer.stream()
|
||||||
|
.filter(x -> !x.getCodMdep().equalsIgnoreCase(dtbDoct.getCodMdep()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!UtilityList.isNullOrEmpty(ulsToAddToTransfer))
|
||||||
|
addUlIntoTransfer(multiDBTransactionManager, ulsToAddToTransfer, dtbDoct.getCodMdep());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<MtbColt> ulsToRemoveTransfer = dtbDoct.getMtbColt().stream()
|
||||||
|
.filter(x -> x.getOperation() == OperationType.DELETE)
|
||||||
|
.map(x -> (MtbColt) x.clone())
|
||||||
|
.peek(x -> x.setOperation(OperationType.SELECT_OBJECT))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!UtilityList.isNullOrEmpty(ulsToRemoveTransfer)) {
|
||||||
|
entityProcessor.processEntityList(ulsToRemoveTransfer, multiDBTransactionManager, true);
|
||||||
|
|
||||||
|
// ulsToRemoveTransfer = ulsToRemoveTransfer.stream()
|
||||||
|
// .filter(x -> !x.getCodMdep().equalsIgnoreCase(dtbDoct.getCodMdep()))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!UtilityList.isNullOrEmpty(ulsToRemoveTransfer))
|
||||||
|
removeUlFromTransfer(multiDBTransactionManager, ulsToRemoveTransfer, dtbDoct.getCodMdep());
|
||||||
|
}
|
||||||
|
|
||||||
|
// throw new RuntimeException("TEST");
|
||||||
|
|
||||||
|
return dtbDoct.getMtbColt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addUlIntoTransfer(MultiDBTransactionManager multiDBTransactionManager, List<MtbColt> ulsToTransfer, String documentCodMdep) throws Exception {
|
||||||
String selectMtbColrs = "SELECT * FROM " + MtbColr.ENTITY + " " +
|
String selectMtbColrs = "SELECT * FROM " + MtbColr.ENTITY + " " +
|
||||||
"WHERE " + UtilityQuery.concatFieldListInWhereCond(ulsToTransfer.stream()
|
"WHERE " + UtilityQuery.concatFieldListInWhereCond(ulsToTransfer.stream()
|
||||||
.map(x -> new HashMap<String, Object>() {{
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
@@ -181,17 +220,16 @@ public class DocumentiDirettiService {
|
|||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
});
|
});
|
||||||
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
List<String> depositiPartenza = ulsToTransfer.stream()
|
List<String> depositiPartenza = ulsToTransfer.stream()
|
||||||
.map(MtbColt::getCodMdep)
|
.map(MtbColt::getCodMdep)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (String codMdep : depositiPartenza) {
|
for (String codMdepPartenza : depositiPartenza) {
|
||||||
|
|
||||||
List<MtbColr> mtbColrsGroupedByDepoToTransfer = mtbColrsToTransfer.stream()
|
List<MtbColr> mtbColrsGroupedByDepoToTransfer = mtbColrsToTransfer.stream()
|
||||||
.filter(x -> x.getCodMdepOut().equals(codMdep))
|
.filter(x -> x.getCodMdepOut().equals(codMdepPartenza))
|
||||||
.peek(x -> x.setNumCollo(null)
|
.peek(x -> x.setNumCollo(null)
|
||||||
.setDataCollo(null)
|
.setDataCollo(null)
|
||||||
.setSerCollo(null)
|
.setSerCollo(null)
|
||||||
@@ -199,16 +237,18 @@ public class DocumentiDirettiService {
|
|||||||
.setRiga(null)
|
.setRiga(null)
|
||||||
.setBarcodeUlIn(x.getBarcodeUlOut())
|
.setBarcodeUlIn(x.getBarcodeUlOut())
|
||||||
.setPosizioneIn(null)
|
.setPosizioneIn(null)
|
||||||
.setCodMdepIn(dtbDoct.getCodMdep())
|
.setCodMdepIn(documentCodMdep)
|
||||||
.setGestioneRif(null)
|
.setGestioneRif(null)
|
||||||
.setDataColloRif(null)
|
.setDataColloRif(null)
|
||||||
.setNumColloRif(null)
|
.setNumColloRif(null)
|
||||||
.setSerColloRif(null)
|
.setSerColloRif(null)
|
||||||
|
.setNumOrd(null)
|
||||||
|
.setDataOrd(null)
|
||||||
|
.setRigaOrd(null)
|
||||||
.setOperation(OperationType.INSERT))
|
.setOperation(OperationType.INSERT))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
//<editor-fold desc="DA CONTROLLARE!!">
|
String codMdepArrivo = documentCodMdep;
|
||||||
String codMdepArrivo = dtbDoct.getCodMdep();
|
|
||||||
String codDtipToUse = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "LOGISTICA", "COD_DTIP_DOC_TRASF_INTERNI", codMdepArrivo);
|
String codDtipToUse = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "LOGISTICA", "COD_DTIP_DOC_TRASF_INTERNI", codMdepArrivo);
|
||||||
|
|
||||||
if (UtilityString.isNullOrEmpty(codDtipToUse))
|
if (UtilityString.isNullOrEmpty(codDtipToUse))
|
||||||
@@ -221,24 +261,32 @@ public class DocumentiDirettiService {
|
|||||||
|
|
||||||
short segno = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
short segno = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||||
String codMdepDoc;
|
String codMdepDoc;
|
||||||
|
String codAnag;
|
||||||
|
String codVdes;
|
||||||
|
|
||||||
if (segno > 0) {
|
if (segno > 0) {
|
||||||
codMdepDoc = codMdepArrivo;
|
codMdepDoc = codMdepArrivo;
|
||||||
|
|
||||||
MtbDepo mtbDepoPartenza = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),
|
MtbDepo mtbDepoPartenza = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),
|
||||||
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdep), MtbDepo.class);
|
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdepPartenza), MtbDepo.class);
|
||||||
|
|
||||||
|
codAnag = mtbDepoPartenza.getCodAnag();
|
||||||
|
codVdes = mtbDepoPartenza.getCodVdes();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
codMdepDoc = codMdep;
|
codMdepDoc = codMdepPartenza;
|
||||||
|
|
||||||
MtbDepo mtbDepoArrivo = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),
|
MtbDepo mtbDepoArrivo = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),
|
||||||
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdepArrivo), MtbDepo.class);
|
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdepArrivo), MtbDepo.class);
|
||||||
|
|
||||||
|
codAnag = mtbDepoArrivo.getCodAnag();
|
||||||
|
codVdes = mtbDepoArrivo.getCodVdes();
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
|
|
||||||
MtbColt internalMovement = WMSUtility.createInternalMovement(multiDBTransactionManager.getPrimaryConnection(), codMdepDoc, requestDataDTO.getUsername());
|
MtbColt internalMovement = WMSUtility.createInternalMovement(multiDBTransactionManager.getPrimaryConnection(), codMdepDoc, requestDataDTO.getUsername());
|
||||||
|
internalMovement.setCodAnag(codAnag);
|
||||||
|
internalMovement.setCodVdes(codVdes);
|
||||||
internalMovement.setBarcodeUl(EmsRestConstants.NULL);
|
internalMovement.setBarcodeUl(EmsRestConstants.NULL);
|
||||||
internalMovement.setMtbColr(mtbColrsGroupedByDepoToTransfer);
|
internalMovement.setMtbColr(mtbColrsGroupedByDepoToTransfer);
|
||||||
|
|
||||||
@@ -246,22 +294,22 @@ public class DocumentiDirettiService {
|
|||||||
|
|
||||||
DtbDoct transferDocument =
|
DtbDoct transferDocument =
|
||||||
WMSUtility.createTransferDocumentAndAttachToMovement(multiDBTransactionManager, setupGest,
|
WMSUtility.createTransferDocumentAndAttachToMovement(multiDBTransactionManager, setupGest,
|
||||||
internalMovement, null, codMdep, dtbDoct.getCodMdep(), null,
|
internalMovement, null, codMdepPartenza, documentCodMdep, null,
|
||||||
requestDataDTO.getUsername(), false, SpostaUlRequestDTO.TransferGroupPolicy.NONE);
|
requestDataDTO.getUsername(), false, SpostaUlRequestDTO.TransferGroupPolicy.NONE);
|
||||||
|
|
||||||
|
|
||||||
entityProcessor.processEntity(transferDocument, multiDBTransactionManager);
|
entityProcessor.processEntity(transferDocument, multiDBTransactionManager);
|
||||||
|
|
||||||
List<MtbColt> udsGroupedByDepo = ulsToTransfer.stream()
|
List<MtbColt> udsGroupedByDepo = ulsToTransfer.stream()
|
||||||
.filter(x -> x.getCodMdep().equals(codMdep))
|
.filter(x -> x.getCodMdep().equals(codMdepPartenza))
|
||||||
.peek(x -> {
|
.peek(x -> {
|
||||||
x.setCodMdep(dtbDoct.getCodMdep());
|
x.setCodMdep(documentCodMdep);
|
||||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||||
x.getMtbColr().forEach(mtbColr -> {
|
x.getMtbColr().forEach(mtbColr -> {
|
||||||
mtbColr.setOperation(OperationType.UPDATE);
|
mtbColr.setOperation(OperationType.UPDATE);
|
||||||
mtbColr
|
mtbColr
|
||||||
.setCodMdepIn(EmsRestConstants.NULL)
|
.setCodMdepIn(EmsRestConstants.NULL)
|
||||||
.setCodMdepOut(dtbDoct.getCodMdep())
|
.setCodMdepOut(documentCodMdep)
|
||||||
.setPosizioneOut(EmsRestConstants.NULL)
|
.setPosizioneOut(EmsRestConstants.NULL)
|
||||||
.setGestioneRif(null)
|
.setGestioneRif(null)
|
||||||
.setDataColloRif(null)
|
.setDataColloRif(null)
|
||||||
@@ -275,11 +323,63 @@ public class DocumentiDirettiService {
|
|||||||
|
|
||||||
UtilityEntity.throwEntitiesException(udsGroupedByDepo);
|
UtilityEntity.throwEntitiesException(udsGroupedByDepo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return dtbDoct.getMtbColt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeUlFromTransfer(MultiDBTransactionManager multiDBTransactionManager, List<MtbColt> ulsToRemoveTransfer, String documentCodMdep) throws Exception {
|
||||||
|
String selectMtbColrs = "SELECT * FROM " + MtbColr.ENTITY + " " +
|
||||||
|
"WHERE " + UtilityQuery.concatFieldListInWhereCond(ulsToRemoveTransfer.stream()
|
||||||
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
|
put("gestione", x.getGestione());
|
||||||
|
put("ser_collo", x.getSerCollo());
|
||||||
|
put("data_collo", x.getDataCollo());
|
||||||
|
put("num_collo", x.getNumCollo());
|
||||||
|
}})
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
|
final List<MtbColr> mtbColrsToTransfer = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), selectMtbColrs, MtbColr.class);
|
||||||
|
|
||||||
|
ulsToRemoveTransfer.forEach(mtbColt -> {
|
||||||
|
mtbColt.setMtbColr(mtbColrsToTransfer.stream()
|
||||||
|
.filter(mtbColr -> mtbColt.getKey().equals(mtbColr.getKey()))
|
||||||
|
.map(x -> (MtbColr) x.clone())
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
});
|
||||||
|
|
||||||
|
//Cerco i trasferimenti L generati in automatico precedentemente.
|
||||||
|
//Si riconoscono perchè hanno:
|
||||||
|
// - barcode_ul_in = barcode_ul_out
|
||||||
|
// - cod_mdep_in = deposito del documento
|
||||||
|
// - cod_mdep_out <> cod_mdep_in
|
||||||
|
// - datetime_row del collo L = datetime_row del collo V
|
||||||
|
// - cod_mart del collo L = cod_mart del collo V
|
||||||
|
// - partita_mag del collo L = partita_mag del collo V
|
||||||
|
// - cod_jcom del collo L = cod_jcom del collo V
|
||||||
|
// - qta_col del collo L = qta_col del collo V
|
||||||
|
// - num_cnf del collo L = num_cnf del collo V
|
||||||
|
|
||||||
|
String selectTransferMtbColrs = "SELECT * FROM " + MtbColr.ENTITY + " " +
|
||||||
|
"WHERE barcode_ul_in = barcode_ul_out AND " +
|
||||||
|
" cod_mdep_in <> cod_mdep_out AND " +
|
||||||
|
UtilityQuery.concatFieldListInWhereCond(mtbColrsToTransfer.stream()
|
||||||
|
.map(x -> new HashMap<String, Object>() {{
|
||||||
|
put("gestione", "L");
|
||||||
|
put("barcode_ul_in", x.getBarcodeUlOut());
|
||||||
|
put("cod_mdep_in", documentCodMdep);
|
||||||
|
put("datetime_row", x.getDatetimeRow());
|
||||||
|
put("cod_mart", x.getCodMart());
|
||||||
|
put("partita_mag", x.getPartitaMag());
|
||||||
|
put("cod_jcom", x.getCodJcom());
|
||||||
|
put("qta_col", x.getQtaCol());
|
||||||
|
put("num_cnf", x.getNumCnf());
|
||||||
|
}})
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
|
||||||
|
final List<MtbColr> transferMtbColr = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), selectTransferMtbColrs, MtbColr.class);
|
||||||
|
String tmp = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private HashMap<String, Object> getOldPkDoc(DtbDoct dtbDoct) throws IOException {
|
private HashMap<String, Object> getOldPkDoc(DtbDoct dtbDoct) throws IOException {
|
||||||
String codAnag = dtbDoct.getCodAnag();
|
String codAnag = dtbDoct.getCodAnag();
|
||||||
String codDtip = dtbDoct.getCodDtip();
|
String codDtip = dtbDoct.getCodDtip();
|
||||||
@@ -758,13 +858,10 @@ public class DocumentiDirettiService {
|
|||||||
createUDSRequestOrderDTO = createUDSFromDocuments.getUlRows().stream()
|
createUDSRequestOrderDTO = createUDSFromDocuments.getUlRows().stream()
|
||||||
.filter(x -> x.getNumOrd() != null && x.getDataOrd() != null)
|
.filter(x -> x.getNumOrd() != null && x.getDataOrd() != null)
|
||||||
.map(
|
.map(
|
||||||
x -> {
|
x -> new CreateUDSRequestOrderDTO()
|
||||||
CreateUDSRequestOrderDTO ord = new CreateUDSRequestOrderDTO()
|
.setDataOrd(x.getDataOrd())
|
||||||
.setDataOrd(x.getDataOrd())
|
.setNumOrd(x.getNumOrd())
|
||||||
.setNumOrd(x.getNumOrd())
|
.setGestione(createUDSFromDocuments.getGestione())
|
||||||
.setGestione(createUDSFromDocuments.getGestione());
|
|
||||||
return ord;
|
|
||||||
}
|
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -785,7 +882,7 @@ public class DocumentiDirettiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLavorazione) {
|
if (isLavorazione) {
|
||||||
uds = wmsLavorazioneService.createUDS(
|
uds = wmsLavorazioneService.createUDSMovement(
|
||||||
new CreateUDSRequestDTO()
|
new CreateUDSRequestDTO()
|
||||||
.setCodAnag(createUDSFromDocuments.getCodAnag())
|
.setCodAnag(createUDSFromDocuments.getCodAnag())
|
||||||
.setCodMdep(createUDSFromDocuments.getCodMdep())
|
.setCodMdep(createUDSFromDocuments.getCodMdep())
|
||||||
@@ -793,7 +890,7 @@ public class DocumentiDirettiService {
|
|||||||
.setCausaleCollo(CreateUDSRequestDTO.Causale.SCARICO)
|
.setCausaleCollo(CreateUDSRequestDTO.Causale.SCARICO)
|
||||||
.setOrders(createUDSRequestOrderDTO));
|
.setOrders(createUDSRequestOrderDTO));
|
||||||
} else {
|
} else {
|
||||||
uds = wmsSpedizioneService.createUDS(
|
uds = wmsSpedizioneService.createUDSMovement(
|
||||||
new CreateUDSRequestDTO()
|
new CreateUDSRequestDTO()
|
||||||
.setCodAnag(createUDSFromDocuments.getCodAnag())
|
.setCodAnag(createUDSFromDocuments.getCodAnag())
|
||||||
.setCodMdep(codMdep)
|
.setCodMdep(codMdep)
|
||||||
@@ -801,7 +898,6 @@ public class DocumentiDirettiService {
|
|||||||
.setOrders(createUDSRequestOrderDTO));
|
.setOrders(createUDSRequestOrderDTO));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uds.getMtbCols().forEach(x -> x.setOperation(OperationType.NO_OP));
|
|
||||||
|
|
||||||
List<MvwSitArtUdcDetInventarioDTO> mvwSitArtUdcDetInventarioDTOS =
|
List<MvwSitArtUdcDetInventarioDTO> mvwSitArtUdcDetInventarioDTOS =
|
||||||
wmsGiacenzaULService.retrieveArtsInGiacenzaByArticolo(multiDBTransactionManager.getPrimaryConnection(), new RetrieveArtsInGiacenzaByArtRequestDTO()
|
wmsGiacenzaULService.retrieveArtsInGiacenzaByArticolo(multiDBTransactionManager.getPrimaryConnection(), new RetrieveArtsInGiacenzaByArtRequestDTO()
|
||||||
@@ -822,7 +918,7 @@ public class DocumentiDirettiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLavorazione) {
|
if (isLavorazione) {
|
||||||
wmsLavorazioneService.insertUDSRow(
|
wmsLavorazioneService.insertUDSRowMovement(
|
||||||
new InsertUDSRowRequestDTO()
|
new InsertUDSRowRequestDTO()
|
||||||
.setCodMart(ulRowDTO.getCodMart())
|
.setCodMart(ulRowDTO.getCodMart())
|
||||||
.setPartitaMag(ulRowDTO.getPartitaMag())
|
.setPartitaMag(ulRowDTO.getPartitaMag())
|
||||||
@@ -831,11 +927,10 @@ public class DocumentiDirettiService {
|
|||||||
.setNumOrd(ulRowDTO.getNumOrd())
|
.setNumOrd(ulRowDTO.getNumOrd())
|
||||||
.setRigaOrd(ulRowDTO.getRigaOrd())
|
.setRigaOrd(ulRowDTO.getRigaOrd())
|
||||||
.setTargetMtbColt(uds)
|
.setTargetMtbColt(uds)
|
||||||
.setSourceMtbColr(sourceMtbColr)
|
.setSourceMtbColr(sourceMtbColr));
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wmsSpedizioneService.insertUDSRow(
|
wmsSpedizioneService.insertUDSRowMovement(
|
||||||
new InsertUDSRowRequestDTO()
|
new InsertUDSRowRequestDTO()
|
||||||
.setCodMart(ulRowDTO.getCodMart())
|
.setCodMart(ulRowDTO.getCodMart())
|
||||||
.setPartitaMag(ulRowDTO.getPartitaMag())
|
.setPartitaMag(ulRowDTO.getPartitaMag())
|
||||||
@@ -844,11 +939,12 @@ public class DocumentiDirettiService {
|
|||||||
.setNumOrd(ulRowDTO.getNumOrd())
|
.setNumOrd(ulRowDTO.getNumOrd())
|
||||||
.setRigaOrd(ulRowDTO.getRigaOrd())
|
.setRigaOrd(ulRowDTO.getRigaOrd())
|
||||||
.setTargetMtbColt(uds)
|
.setTargetMtbColt(uds)
|
||||||
.setSourceMtbColr(sourceMtbColr)
|
.setSourceMtbColr(sourceMtbColr));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!createUDSFromDocuments.isMonoUl()) {
|
if (!createUDSFromDocuments.isMonoUl()) {
|
||||||
|
entityProcessor.processEntity(uds, true, multiDBTransactionManager);
|
||||||
|
|
||||||
if (isLavorazione) {
|
if (isLavorazione) {
|
||||||
CloseUDSLavorazioneRequestDTO closeUDSLavorazioneRequestDTO =
|
CloseUDSLavorazioneRequestDTO closeUDSLavorazioneRequestDTO =
|
||||||
new CloseUDSLavorazioneRequestDTO();
|
new CloseUDSLavorazioneRequestDTO();
|
||||||
@@ -864,6 +960,8 @@ public class DocumentiDirettiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (createUDSFromDocuments.isMonoUl()) {
|
if (createUDSFromDocuments.isMonoUl()) {
|
||||||
|
entityProcessor.processEntity(uds, true, multiDBTransactionManager);
|
||||||
|
|
||||||
if (isLavorazione) {
|
if (isLavorazione) {
|
||||||
CloseUDSLavorazioneRequestDTO closeUDSLavorazioneRequestDTO =
|
CloseUDSLavorazioneRequestDTO closeUDSLavorazioneRequestDTO =
|
||||||
new CloseUDSLavorazioneRequestDTO();
|
new CloseUDSLavorazioneRequestDTO();
|
||||||
|
|||||||
@@ -594,43 +594,15 @@ public class WMSUtility {
|
|||||||
if (UtilityString.isNullOrEmpty(codDtipToUse))
|
if (UtilityString.isNullOrEmpty(codDtipToUse))
|
||||||
throw new Exception("La configurazione della setup gest non è completa per gestire gli spostamenti tra depositi");
|
throw new Exception("La configurazione della setup gest non è completa per gestire gli spostamenti tra depositi");
|
||||||
|
|
||||||
String sql = Query.format(
|
|
||||||
"SELECT segno_qta_car - segno_qta_scar FROM dtb_tipi WHERE cod_dtip = %s",
|
|
||||||
codDtipToUse
|
|
||||||
);
|
|
||||||
|
|
||||||
short segno = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
|
||||||
String codMdepDoc;
|
|
||||||
String codAnag;
|
|
||||||
String codVdes;
|
|
||||||
|
|
||||||
if (segno > 0) {
|
|
||||||
codMdepDoc = codMdepArrivo;
|
|
||||||
|
|
||||||
MtbDepo mtbDepoPartenza = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(connection,
|
|
||||||
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdepPartenza), MtbDepo.class);
|
|
||||||
|
|
||||||
codAnag = mtbDepoPartenza.getCodAnag();
|
|
||||||
codVdes = mtbDepoPartenza.getCodVdes();
|
|
||||||
} else {
|
|
||||||
codMdepDoc = codMdepPartenza;
|
|
||||||
|
|
||||||
MtbDepo mtbDepoArrivo = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(connection,
|
|
||||||
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdepArrivo), MtbDepo.class);
|
|
||||||
|
|
||||||
codAnag = mtbDepoArrivo.getCodAnag();
|
|
||||||
codVdes = mtbDepoArrivo.getCodVdes();
|
|
||||||
}
|
|
||||||
|
|
||||||
LocalDate dataDoc = UtilityLocalDate.isNull(dataTrasf, UtilityLocalDate.getNow());
|
LocalDate dataDoc = UtilityLocalDate.isNull(dataTrasf, UtilityLocalDate.getNow());
|
||||||
|
|
||||||
LoadColliDTO docTrasfRequest = new LoadColliDTO();
|
LoadColliDTO docTrasfRequest = new LoadColliDTO();
|
||||||
docTrasfRequest
|
docTrasfRequest
|
||||||
.setDataDoc(UtilityLocalDate.localDateToDate(dataDoc))
|
.setDataDoc(UtilityLocalDate.localDateToDate(dataDoc))
|
||||||
.setCodDtip(codDtipToUse)
|
.setCodDtip(codDtipToUse)
|
||||||
.setCodMdep(codMdepDoc)
|
.setCodMdep(movementToAttach.getCodMdep())
|
||||||
.setCodAnag(codAnag)
|
.setCodAnag(movementToAttach.getCodAnag())
|
||||||
.setCodVdes(codVdes)
|
.setCodVdes(movementToAttach.getCodVdes())
|
||||||
.setNote(annotazioni);
|
.setNote(annotazioni);
|
||||||
|
|
||||||
if (groupDailyTransfer) {
|
if (groupDailyTransfer) {
|
||||||
@@ -640,7 +612,7 @@ public class WMSUtility {
|
|||||||
" and data_doc = {}\n" +
|
" and data_doc = {}\n" +
|
||||||
" and cod_mdep = {}\n" +
|
" and cod_mdep = {}\n" +
|
||||||
" and cod_anag = {}\n" +
|
" and cod_anag = {}\n" +
|
||||||
" and cod_vdes = {}", codDtipToUse, dataDoc, codMdepDoc, codAnag, codVdes);
|
" and cod_vdes = {}", codDtipToUse, dataDoc, movementToAttach.getCodMdep(), movementToAttach.getCodAnag(), movementToAttach.getCodVdes());
|
||||||
switch (groupingPolicy) {
|
switch (groupingPolicy) {
|
||||||
case BY_USER:
|
case BY_USER:
|
||||||
queryDoc = UtilityDB.addwhereCond(queryDoc, Query.format("user_name = {}", username), true);
|
queryDoc = UtilityDB.addwhereCond(queryDoc, Query.format("user_name = {}", username), true);
|
||||||
|
|||||||
@@ -2113,16 +2113,8 @@ public class WMSGenericService {
|
|||||||
|
|
||||||
if (segno > 0) {
|
if (segno > 0) {
|
||||||
codMdepDoc = codMdepArrivo;
|
codMdepDoc = codMdepArrivo;
|
||||||
|
|
||||||
MtbDepo mtbDepoPartenza = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),
|
|
||||||
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdepPartenza), MtbDepo.class);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
codMdepDoc = codMdepPartenza;
|
codMdepDoc = codMdepPartenza;
|
||||||
|
|
||||||
MtbDepo mtbDepoArrivo = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),
|
|
||||||
Query.format("SELECT * FROM mtb_depo WHERE cod_mdep = {}", codMdepArrivo), MtbDepo.class);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import it.integry.ems.user.UserSession;
|
|||||||
import it.integry.ems.utility.UtilityEntity;
|
import it.integry.ems.utility.UtilityEntity;
|
||||||
import it.integry.ems_model.entity.*;
|
import it.integry.ems_model.entity.*;
|
||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
|
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.*;
|
import it.integry.ems_model.utility.*;
|
||||||
@@ -74,6 +75,9 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AziendaService aziendaService;
|
private AziendaService aziendaService;
|
||||||
|
@Autowired
|
||||||
|
private DroolsDataCompleting droolsDataCompleting;
|
||||||
|
|
||||||
|
|
||||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
MtbColt generatedMtbColt = createUDSMovement(createUDSRequestDTO);
|
MtbColt generatedMtbColt = createUDSMovement(createUDSRequestDTO);
|
||||||
@@ -87,10 +91,7 @@ public class WMSLavorazioneService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MtbColt createUDSMovement(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
public MtbColt createUDSMovement(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
userSession.checkUser();
|
||||||
if (!userSession.isAttivo()) {
|
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<DtbOrdt> foundDtbOrdts = new ArrayList<>();
|
List<DtbOrdt> foundDtbOrdts = new ArrayList<>();
|
||||||
|
|
||||||
@@ -121,6 +122,7 @@ public class WMSLavorazioneService {
|
|||||||
.setCodVdes(createUDSRequestDTO.getCodVdes())
|
.setCodVdes(createUDSRequestDTO.getCodVdes())
|
||||||
.setCodTcol(createUDSRequestDTO.getCodTcol())
|
.setCodTcol(createUDSRequestDTO.getCodTcol())
|
||||||
.setIdLotto(createUDSRequestDTO.getIdLotto());
|
.setIdLotto(createUDSRequestDTO.getIdLotto());
|
||||||
|
udsMtbColt.setOperation(OperationType.INSERT);
|
||||||
|
|
||||||
switch (createUDSRequestDTO.getCausaleCollo()) {
|
switch (createUDSRequestDTO.getCausaleCollo()) {
|
||||||
case SCARICO:
|
case SCARICO:
|
||||||
@@ -146,21 +148,6 @@ public class WMSLavorazioneService {
|
|||||||
createUDSRequestDTO.getCodMdep()));
|
createUDSRequestDTO.getCodMdep()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (udsMtbColt.getNumCollo() == null) {
|
|
||||||
int numCollo = PackagesRules.completeNumCollo(multiDBTransactionManager.getPrimaryConnection(),
|
|
||||||
udsMtbColt.getSerCollo(),
|
|
||||||
udsMtbColt.getDataCollo(),
|
|
||||||
udsMtbColt.getGestione());
|
|
||||||
udsMtbColt.setNumCollo(numCollo);
|
|
||||||
}
|
|
||||||
|
|
||||||
String barcodeUl = PackagesRules.completeBarcodeUl(multiDBTransactionManager.getPrimaryConnection(),
|
|
||||||
udsMtbColt.getGestione(),
|
|
||||||
udsMtbColt.getDataCollo(),
|
|
||||||
udsMtbColt.getSerCollo(),
|
|
||||||
udsMtbColt.getNumCollo(), udsMtbColt.getCodJfas());
|
|
||||||
udsMtbColt.setBarcodeUl(barcodeUl);
|
|
||||||
|
|
||||||
if (foundDtbOrdts.size() == 1) {
|
if (foundDtbOrdts.size() == 1) {
|
||||||
DtbOrdt foundDtbOrdt = foundDtbOrdts.get(0);
|
DtbOrdt foundDtbOrdt = foundDtbOrdts.get(0);
|
||||||
|
|
||||||
@@ -216,13 +203,13 @@ public class WMSLavorazioneService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
droolsDataCompleting.complete(udsMtbColt, multiDBTransactionManager.getPrimaryConnection(), requestDataDTO.getUsername());
|
||||||
|
|
||||||
return udsMtbColt;
|
return udsMtbColt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloseUDSLavorazioneResponseDTO closeUDS(CloseUDSLavorazioneRequestDTO closeUDSRequestDTO) throws Exception {
|
public CloseUDSLavorazioneResponseDTO closeUDS(CloseUDSLavorazioneRequestDTO closeUDSRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
userSession.checkUser();
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconosciuto!");
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseUDSLavorazioneResponseDTO response = new CloseUDSLavorazioneResponseDTO();
|
CloseUDSLavorazioneResponseDTO response = new CloseUDSLavorazioneResponseDTO();
|
||||||
|
|
||||||
@@ -279,17 +266,33 @@ public class WMSLavorazioneService {
|
|||||||
|
|
||||||
|
|
||||||
public InsertUDSRowResponseDTO insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
public InsertUDSRowResponseDTO insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
userSession.checkUser();
|
|
||||||
|
|
||||||
//Prendo solo la chiave
|
|
||||||
MtbColt targetMtbColt = new MtbColt()
|
MtbColt targetMtbColt = new MtbColt()
|
||||||
.setNumCollo(insertUDSRowRequestDTO.getTargetMtbColt().getNumCollo())
|
.setNumCollo(insertUDSRowRequestDTO.getTargetMtbColt().getNumCollo())
|
||||||
.setDataCollo(insertUDSRowRequestDTO.getTargetMtbColt().getDataCollo())
|
.setDataCollo(insertUDSRowRequestDTO.getTargetMtbColt().getDataCollo())
|
||||||
.setSerCollo(insertUDSRowRequestDTO.getTargetMtbColt().getSerCollo())
|
.setSerCollo(insertUDSRowRequestDTO.getTargetMtbColt().getSerCollo())
|
||||||
.setGestione(insertUDSRowRequestDTO.getTargetMtbColt().getGestione());
|
.setGestione(insertUDSRowRequestDTO.getTargetMtbColt().getGestione());
|
||||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||||
|
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||||
|
|
||||||
|
insertUDSRowRequestDTO.setTargetMtbColt(targetMtbColt);
|
||||||
|
|
||||||
|
InsertUDSRowResponseDTO generatedMovement = insertUDSRowMovement(insertUDSRowRequestDTO);
|
||||||
|
|
||||||
|
targetMtbColt.setOperation(OperationType.UPDATE);
|
||||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||||
|
|
||||||
|
targetMtbColt.getMtbColr().forEach(x -> x.setOperation(OperationType.SELECT_OBJECT));
|
||||||
|
targetMtbColt.setMtbCols(new ArrayList<>())
|
||||||
|
.setOnlyPkMaster(false);
|
||||||
|
|
||||||
|
return generatedMovement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InsertUDSRowResponseDTO insertUDSRowMovement(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
|
userSession.checkUser();
|
||||||
|
|
||||||
|
//Prendo solo la chiave
|
||||||
|
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
||||||
|
|
||||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||||
if (mtbAart == null)
|
if (mtbAart == null)
|
||||||
@@ -366,11 +369,8 @@ public class WMSLavorazioneService {
|
|||||||
.setCodMdepIn(targetMtbColt.getCodMdep());
|
.setCodMdepIn(targetMtbColt.getCodMdep());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
droolsDataCompleting.complete(targetMtbColt, multiDBTransactionManager.getPrimaryConnection(), requestDataDTO.getUsername());
|
||||||
|
|
||||||
targetMtbColt.setOperation(OperationType.UPDATE);
|
|
||||||
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
|
||||||
|
|
||||||
targetMtbColr.setOperation(OperationType.SELECT_OBJECT);
|
|
||||||
return new InsertUDSRowResponseDTO()
|
return new InsertUDSRowResponseDTO()
|
||||||
.setSavedMtbColr(targetMtbColr);
|
.setSavedMtbColr(targetMtbColr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import it.integry.ems_model.entity.MtbAart;
|
|||||||
import it.integry.ems_model.entity.MtbColr;
|
import it.integry.ems_model.entity.MtbColr;
|
||||||
import it.integry.ems_model.entity.MtbColt;
|
import it.integry.ems_model.entity.MtbColt;
|
||||||
import it.integry.ems_model.entity._enum.GestioneEnum;
|
import it.integry.ems_model.entity._enum.GestioneEnum;
|
||||||
|
import it.integry.ems_model.rulescompleting.DroolsDataCompleting;
|
||||||
import it.integry.ems_model.service.SetupGest;
|
import it.integry.ems_model.service.SetupGest;
|
||||||
import it.integry.ems_model.types.OperationType;
|
import it.integry.ems_model.types.OperationType;
|
||||||
import it.integry.ems_model.utility.*;
|
import it.integry.ems_model.utility.*;
|
||||||
@@ -70,8 +71,22 @@ public class WMSSpedizioneService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PvmServiceSave pvmServiceSave;
|
private PvmServiceSave pvmServiceSave;
|
||||||
|
@Autowired
|
||||||
|
private DroolsDataCompleting droolsDataCompleting;
|
||||||
|
|
||||||
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
public MtbColt createUDS(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
|
MtbColt generatedMtbColt = createUDSMovement(createUDSRequestDTO);
|
||||||
|
|
||||||
|
entityProcessor.processEntity(generatedMtbColt, true, multiDBTransactionManager);
|
||||||
|
|
||||||
|
generatedMtbColt
|
||||||
|
.setMtbCols(new ArrayList<>())
|
||||||
|
.setOnlyPkMaster(false);
|
||||||
|
|
||||||
|
return generatedMtbColt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MtbColt createUDSMovement(CreateUDSRequestDTO createUDSRequestDTO) throws Exception {
|
||||||
userSession.checkUser();
|
userSession.checkUser();
|
||||||
|
|
||||||
MtbColt udsMtbColt = new MtbColt()
|
MtbColt udsMtbColt = new MtbColt()
|
||||||
@@ -86,6 +101,7 @@ public class WMSSpedizioneService {
|
|||||||
.setCodAnag(createUDSRequestDTO.getCodAnag())
|
.setCodAnag(createUDSRequestDTO.getCodAnag())
|
||||||
.setCodVdes(createUDSRequestDTO.getCodVdes())
|
.setCodVdes(createUDSRequestDTO.getCodVdes())
|
||||||
.setCodTcol(createUDSRequestDTO.getCodTcol());
|
.setCodTcol(createUDSRequestDTO.getCodTcol());
|
||||||
|
udsMtbColt.setOperation(OperationType.INSERT);
|
||||||
|
|
||||||
|
|
||||||
//udsMtbColt.setCodAnag(wmsGenericService.retrieveInternalCodAnagCliente());
|
//udsMtbColt.setCodAnag(wmsGenericService.retrieveInternalCodAnagCliente());
|
||||||
@@ -149,12 +165,7 @@ public class WMSSpedizioneService {
|
|||||||
udsMtbColt.setFiltroOrdini(filtroOrdini);
|
udsMtbColt.setFiltroOrdini(filtroOrdini);
|
||||||
}
|
}
|
||||||
|
|
||||||
udsMtbColt.setOperation(OperationType.INSERT);
|
droolsDataCompleting.complete(udsMtbColt, multiDBTransactionManager.getPrimaryConnection(), requestDataDTO.getUsername());
|
||||||
entityProcessor.processEntity(udsMtbColt, multiDBTransactionManager);
|
|
||||||
|
|
||||||
udsMtbColt
|
|
||||||
.setMtbCols(new ArrayList<>())
|
|
||||||
.setOnlyPkMaster(false);
|
|
||||||
|
|
||||||
return udsMtbColt;
|
return udsMtbColt;
|
||||||
}
|
}
|
||||||
@@ -192,7 +203,7 @@ public class WMSSpedizioneService {
|
|||||||
.setSerCollo(mtbColtToClose.getSerCollo())
|
.setSerCollo(mtbColtToClose.getSerCollo())
|
||||||
.setGestione(mtbColtToClose.getGestione())
|
.setGestione(mtbColtToClose.getGestione())
|
||||||
.setNumCollo(mtbColtToClose.getNumCollo())
|
.setNumCollo(mtbColtToClose.getNumCollo())
|
||||||
.setCriterioDistribuzione(criterioDistribuzione.getText()), false);
|
.setCriterioDistribuzione(criterioDistribuzione.getText()), true);
|
||||||
|
|
||||||
boolean generaDoc = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SPEDIZIONE", "GENERA_DOC");
|
boolean generaDoc = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PICKING", "SPEDIZIONE", "GENERA_DOC");
|
||||||
|
|
||||||
@@ -228,11 +239,6 @@ public class WMSSpedizioneService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InsertUDSRowResponseDTO insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
public InsertUDSRowResponseDTO insertUDSRow(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
if (!userSession.isAttivo()) {
|
|
||||||
throw new UsernameNotFoundException("Utente " + userSession.getUsername() + " non riconoscuto!");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Prendo solo la chiave
|
|
||||||
MtbColt targetMtbColt = new MtbColt()
|
MtbColt targetMtbColt = new MtbColt()
|
||||||
.setNumCollo(insertUDSRowRequestDTO.getTargetMtbColt().getNumCollo())
|
.setNumCollo(insertUDSRowRequestDTO.getTargetMtbColt().getNumCollo())
|
||||||
.setDataCollo(insertUDSRowRequestDTO.getTargetMtbColt().getDataCollo())
|
.setDataCollo(insertUDSRowRequestDTO.getTargetMtbColt().getDataCollo())
|
||||||
@@ -241,6 +247,26 @@ public class WMSSpedizioneService {
|
|||||||
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
|
||||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
||||||
|
|
||||||
|
insertUDSRowRequestDTO.setTargetMtbColt(targetMtbColt);
|
||||||
|
|
||||||
|
InsertUDSRowResponseDTO generatedMovement = insertUDSRowMovement(insertUDSRowRequestDTO);
|
||||||
|
|
||||||
|
targetMtbColt.setOperation(OperationType.UPDATE);
|
||||||
|
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
|
||||||
|
|
||||||
|
targetMtbColt.getMtbColr().forEach(x -> x.setOperation(OperationType.SELECT_OBJECT));
|
||||||
|
targetMtbColt.setMtbCols(new ArrayList<>())
|
||||||
|
.setOnlyPkMaster(false);
|
||||||
|
|
||||||
|
return generatedMovement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InsertUDSRowResponseDTO insertUDSRowMovement(InsertUDSRowRequestDTO insertUDSRowRequestDTO) throws Exception {
|
||||||
|
userSession.checkUser();
|
||||||
|
|
||||||
|
//Prendo solo la chiave
|
||||||
|
MtbColt targetMtbColt = insertUDSRowRequestDTO.getTargetMtbColt();
|
||||||
|
|
||||||
|
|
||||||
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
MtbAart mtbAart = WMSUtility.getArticoloByCodMart(insertUDSRowRequestDTO.getCodMart(), multiDBTransactionManager.getPrimaryConnection());
|
||||||
if (mtbAart == null)
|
if (mtbAart == null)
|
||||||
@@ -317,11 +343,8 @@ public class WMSSpedizioneService {
|
|||||||
.setIdRigaDoc(insertUDSRowRequestDTO.getDocumentReso().getIdRiga());
|
.setIdRigaDoc(insertUDSRowRequestDTO.getDocumentReso().getIdRiga());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
droolsDataCompleting.complete(targetMtbColt, multiDBTransactionManager.getPrimaryConnection(), requestDataDTO.getUsername());
|
||||||
|
|
||||||
targetMtbColt.setOperation(OperationType.UPDATE);
|
|
||||||
entityProcessor.processEntity(targetMtbColt, multiDBTransactionManager);
|
|
||||||
|
|
||||||
targetMtbColr.setOperation(OperationType.SELECT_OBJECT);
|
|
||||||
return new InsertUDSRowResponseDTO()
|
return new InsertUDSRowResponseDTO()
|
||||||
.setSavedMtbColr(targetMtbColr);
|
.setSavedMtbColr(targetMtbColr);
|
||||||
}
|
}
|
||||||
@@ -476,7 +499,7 @@ public class WMSSpedizioneService {
|
|||||||
|
|
||||||
final MtbColr originalMtbColrRow = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColr.class);
|
final MtbColr originalMtbColrRow = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColr.class);
|
||||||
|
|
||||||
if(originalMtbColrRow != null &&
|
if (originalMtbColrRow != null &&
|
||||||
UtilityBigDecimal.equalsTo(originalMtbColrRow.getQtaCol(), mtbColrToDelete.getQtaCol()) &&
|
UtilityBigDecimal.equalsTo(originalMtbColrRow.getQtaCol(), mtbColrToDelete.getQtaCol()) &&
|
||||||
UtilityBigDecimal.equalsTo(originalMtbColrRow.getNumCnf(), mtbColrToDelete.getNumCnf())) {
|
UtilityBigDecimal.equalsTo(originalMtbColrRow.getNumCnf(), mtbColrToDelete.getNumCnf())) {
|
||||||
mtbColrToDelete.setOperation(OperationType.DELETE);
|
mtbColrToDelete.setOperation(OperationType.DELETE);
|
||||||
|
|||||||
Reference in New Issue
Block a user