aggiunta regola che riporta il vettore sull'ordine quando viene agganciato un viaggio
This commit is contained in:
@@ -477,4 +477,24 @@ public class OrderRules extends QueryRules {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void setCodVvetIdViaggio(Connection conn, DtbOrdt dtbOrdt) throws SQLException {
|
||||
if ( dtbOrdt.getDtbOrdr() != null && dtbOrdt.getDtbOrdr().size() > 0 ){
|
||||
List<String> listaIdViaggio = dtbOrdt.getDtbOrdr().stream()
|
||||
.filter(x->x.getIdViaggio() != null)
|
||||
.map(
|
||||
DtbOrdr::getIdViaggio
|
||||
).distinct().collect(Collectors.toList());
|
||||
|
||||
String sql =
|
||||
String.format(
|
||||
"SELECT TOP 1 cod_vvet FROM vtb_viaggi WHERE id_viaggio in (%s) ORDER BY data_ora_iniz_trasp DESC",
|
||||
UtilityDB.listValueToString(listaIdViaggio));
|
||||
|
||||
String codVvet = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if ( !UtilityString.isNullOrEmpty(codVvet)){
|
||||
dtbOrdt.setCodVvet(codVvet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,9 @@ then
|
||||
}
|
||||
CommonRules.completePosRigaEntity(conn, $testata);
|
||||
OrdWebRules.completeIdArtOrd(conn, $testata);
|
||||
if ($testata.getGestione().equalsIgnoreCase("V")) {
|
||||
OrderRules.setCodVvetIdViaggio(conn, $testata);
|
||||
}
|
||||
if ($testata.getExecuteRecalc() ) {
|
||||
DocOrdCalTotaliRules.calcTotali(conn, $testata);
|
||||
OrderRules.sospendiOrdine(conn, $testata);
|
||||
|
||||
Reference in New Issue
Block a user