gestita esportazione dei documenti di acquisto
This commit is contained in:
@@ -3180,32 +3180,38 @@ public class PvmService {
|
|||||||
entityProcessor.processEntity(dtbDoct, multiDBTransactionManager);
|
entityProcessor.processEntity(dtbDoct, multiDBTransactionManager);
|
||||||
result.add(dtbDoct);
|
result.add(dtbDoct);
|
||||||
|
|
||||||
String exportType = "";
|
String exportType = "", whereCondAnag = "";
|
||||||
gestione = dtbDoct.getGestione();
|
gestione = dtbDoct.getGestione();
|
||||||
|
|
||||||
if ("V".equals(gestione)) {
|
if ("V".equals(gestione)) {
|
||||||
exportType = "DOCUMENTI VENDITA";
|
exportType = "DOCUMENTI VENDITA";
|
||||||
|
whereCondAnag = " wtb_clie.cod_anag = " + UtilityDB.valueToString(dtbDoct.getCodAnag());
|
||||||
} else if ("L".equals(gestione)) {
|
} else if ("L".equals(gestione)) {
|
||||||
exportType = "DOCUMENTI LAVORAZIONE";
|
exportType = "DOCUMENTI LAVORAZIONE";
|
||||||
|
whereCondAnag = " wtb_forn.cod_anag = " + UtilityDB.valueToString(dtbDoct.getCodAnag());
|
||||||
} else if ("A".equals(gestione)) {
|
} else if ("A".equals(gestione)) {
|
||||||
exportType = "DOCUMENTI ACQUISTO";
|
exportType = "DOCUMENTI ACQUISTO";
|
||||||
|
whereCondAnag = " wtb_forn.cod_anag = " + UtilityDB.valueToString(dtbDoct.getCodAnag());
|
||||||
}
|
}
|
||||||
|
|
||||||
query =
|
|
||||||
"SELECT wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) " +
|
|
||||||
" FROM wtb_users, wtb_users_info, wtb_clie " +
|
|
||||||
" WHERE wtb_users.User_name = wtb_users_info.user_name and " +
|
|
||||||
" wtb_users_info.User_name = wtb_clie.user_name and " +
|
|
||||||
" wtb_clie.cod_anag = " + UtilityDB.valueToString(dtbDoct.getCodAnag()) + " AND " +
|
|
||||||
" wtb_users_info.flag_state = 'S' and " +
|
|
||||||
" wtb_users_info.export_type = " + UtilityDB.valueToString(exportType);
|
|
||||||
|
|
||||||
PreparedStatement psExport = multiDBTransactionManager.prepareStatement(query);
|
query =
|
||||||
ResultSet rsExport = psExport.executeQuery();
|
"SELECT wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) as count_export" +
|
||||||
if (rsExport.next()) {
|
" FROM wtb_users " +
|
||||||
String userNameExport = rsExport.getString(1);
|
"INNER JOIN wtb_users_info ON wtb_users.User_name = wtb_users_info.user_name " +
|
||||||
String passwordExport = rsExport.getString(2);
|
"LEFT OUTER JOIN wtb_clie ON wtb_users.User_name = wtb_clie.user_name AND wtb_users_info.export_type = 'DOCUMENTI VENDITA' " +
|
||||||
String formatExport = rsExport.getString(3);
|
"LEFT OUTER JOIN wtb_forn ON wtb_users.User_name = wtb_forn.user_name AND wtb_users_info.export_type <> 'DOCUMENTI VENDITA'" +
|
||||||
Integer countExport = rsExport.getInt(4);
|
" WHERE wtb_users_info.flag_state = 'S' and " +
|
||||||
|
" wtb_users_info.export_type = " + UtilityDB.valueToString(exportType);
|
||||||
|
|
||||||
|
query = UtilityDB.addwhereCond(query, whereCondAnag, true);
|
||||||
|
HashMap<String, Object> datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
|
|
||||||
|
if (UtilityHashMap.isPresent(datiExport)) {
|
||||||
|
String userNameExport = UtilityHashMap.getValueIfExists(datiExport, "user_name");
|
||||||
|
String passwordExport = UtilityHashMap.getValueIfExists(datiExport, "password");
|
||||||
|
String formatExport = UtilityHashMap.getValueIfExists(datiExport, "format_file");
|
||||||
|
Integer countExport = UtilityHashMap.getValueIfExists(datiExport, "count_export");
|
||||||
|
|
||||||
if (countExport == 1) {
|
if (countExport == 1) {
|
||||||
requestDataDTO.setUsername(userNameExport);
|
requestDataDTO.setUsername(userNameExport);
|
||||||
@@ -3225,8 +3231,6 @@ public class PvmService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
rsExport.close();
|
|
||||||
psExport.close();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
multiDBTransactionManager.rollbackAll();
|
multiDBTransactionManager.rollbackAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user