4740 lines
198 KiB
Groovy
4740 lines
198 KiB
Groovy
// --------------------------------------------------------------------------------------------------------
|
||
// ValueSets_Common.groovy
|
||
// --------------------------------------------------------------------------------------------------------
|
||
//
|
||
// Grrovy Wertemengen
|
||
//
|
||
// --------------------------------------------------------------------------------------------------------
|
||
//
|
||
// Historie:
|
||
// 26.06.2017 phoer/dvelop Erste Version zur Umstellung der dynamischen Wertemengen und Übersetzung
|
||
//
|
||
// --------------------------------------------------------------------------------------------------------
|
||
|
||
// dynamische Wertemenge für das Attribut "Akte", Ermittlung über die administrativen Akten, Übersetzung in der ValueSetsTranslation.groovy
|
||
|
||
import com.dvelop.d3.server.Entrypoint;
|
||
import com.dvelop.d3.server.core.D3Interface;
|
||
import com.dvelop.d3.server.Document;
|
||
import com.dvelop.d3.server.User;
|
||
import com.dvelop.d3.server.DocumentType;
|
||
import com.dvelop.d3.server.RepositoryField;
|
||
import com.dvelop.d3.server.UserOrUserGroup;
|
||
import com.dvelop.d3.server.ValueSet;
|
||
import com.dvelop.d3.server.Validation;
|
||
import com.dvelop.d3.server.ValueSetTranslation;
|
||
import com.dvelop.d3.server.Translation;
|
||
import com.dvelop.d3.server.DocumentTypeAttribute;
|
||
import com.dvelop.d3.server.*;
|
||
|
||
// zusätzliche Imports für oData Zugriff 21.01.2019
|
||
import java.io.InputStreamReader;
|
||
import java.io.Reader;
|
||
import java.net.URL;
|
||
import java.net.URLConnection;
|
||
import javax.net.ssl.HostnameVerifier;
|
||
import javax.net.ssl.HttpsURLConnection;
|
||
import javax.net.ssl.SSLContext;
|
||
import javax.net.ssl.SSLSession;
|
||
import javax.net.ssl.TrustManager;
|
||
import javax.net.ssl.X509TrustManager;
|
||
import java.security.cert.X509Certificate;
|
||
import org.json.JSONArray;
|
||
import org.json.JSONObject;
|
||
import org.apache.commons.io.IOUtils;
|
||
import groovy.sql.GroovyRowResult;
|
||
|
||
|
||
|
||
class ValueSets_Common {
|
||
|
||
@ValueSet(entrypoint="CustomerNameValues")
|
||
def getCustomerNameValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
def val1 = "";
|
||
def val2 = "";
|
||
if( Integer.valueOf(repoField.getId()) == SystemSpecificConst.gEndkundennameID ) {
|
||
val1 = doc.field[Const.gDDF_ENDKUNDENAM].toString() + "%"
|
||
val2 = "%" + doc.field[Const.gDDF_ENDKUNDENAM].toString() + "%"
|
||
} else {
|
||
val1 = doc.field[Const.gDDF_KNAME].toString() + "%"
|
||
val2 = "%" + doc.field[Const.gDDF_KNAME].toString() + "%"
|
||
}
|
||
|
||
// d3.log.error("Validierung CustomerNameValues: START");
|
||
// Abfrage Kundenname
|
||
def resultset
|
||
def length
|
||
|
||
// 31.07.2017 fachlich explizit gewünscht, diese Funktion kann wegen der vielen LIKES zu Performanceeinbußen führen
|
||
// 31.07.2017 @dmrowcount abfragen, wenn > 10.000 Meldung ausgeben
|
||
|
||
length = val1.length();
|
||
// d3.log.error("length: " + length.toString());
|
||
// d3.log.error("val1: " + val1.toString());
|
||
|
||
if( val1 != null && !val1.equals("null%") && val1.length() > 3 ) {
|
||
if( validate == 1 ) {
|
||
// d3.log.error("Validate - Validierung CustomerNameValues: START " + val1.toString());
|
||
String sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_KNAME},'') as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd WHERE fs.kue_dokuart = '${Const.gDTS_AKUND}' " +
|
||
"AND ( fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_ANNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTLAND} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTORT} like ? ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
|
||
// resultset = d3.sql.executeAndGet(sql,[val1, val2, val1, val2, val1, val1, val1]);
|
||
// d3.log.error("Validate - Validierung CustomerNameValues: resultset");
|
||
// repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
// d3.log.error("Validate - Validierung CustomerNameValues: ENDE");
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val1,
|
||
val1
|
||
]);
|
||
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
return 0;
|
||
}
|
||
} else {
|
||
String sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_KNR},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_KNAME},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_ANNAME},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_KDAKTLAND},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_KDAKTORT},'') as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd WHERE fs.kue_dokuart = '${Const.gDTS_AKUND}' " +
|
||
"AND ( fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_ANNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTLAND} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTORT} like ? ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val1,
|
||
val1
|
||
]);
|
||
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
return 0;
|
||
}
|
||
}
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens drei Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
|
||
}
|
||
|
||
@ValueSet(entrypoint="CustomerNumberValues")
|
||
def getCustomerNumberValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
|
||
// Abfrage Kundennummer
|
||
def resultset
|
||
def length
|
||
def val1 = ""
|
||
def val2 = ""
|
||
// 31.07.2017 fachlich explizit gewünscht, diese Funktion kann wegen der vielen LIKES zu Performanceeinbußen führen
|
||
// 31.07.2017 @dmrowcount abfragen, wenn > 10.000 Meldung ausgeben
|
||
|
||
length = val1.length();
|
||
|
||
if( repoField.getPreferedFieldNumber() == Const.gDDF_WEITKDNR ) {
|
||
if( doc.field[Const.gDDF_WEITKDNR].getAt(row_no) )
|
||
{
|
||
val1 = doc.field[Const.gDDF_WEITKDNR].getAt(row_no).toString() + "%"
|
||
if ( val1.length() > 3 )
|
||
val2 = "%" + val1 + "%";
|
||
}
|
||
} else if( Integer.valueOf(repoField.getId()) == SystemSpecificConst.gEndkundennrID ) {
|
||
// Ergänzung für Endkunden
|
||
val1 = doc.field[Const.gDDF_ENDKUNDENNR].toString() + "%"
|
||
if ( val1.length() > 3 )
|
||
val2 = "%" + val1 + "%";
|
||
} else {
|
||
if( doc.field[Const.gDDF_KNR] )
|
||
{
|
||
val1 = doc.field[Const.gDDF_KNR].toString() + "%"
|
||
if ( val1.length() > 3 )
|
||
val2 = "%" + val1 + "%";
|
||
}
|
||
}
|
||
|
||
if( val1 != null && !val1.equals("null%") && val1.length() > 3 ) {
|
||
if( validate == 1 ) {
|
||
// d3.log.error("Validierung CustomerNumberValues: " + val1.toString());
|
||
|
||
String sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_KNR},'') as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd WHERE fs.kue_dokuart = '${Const.gDTS_AKUND}' " +
|
||
"AND ( fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_ANNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTLAND} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTORT} like ? ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val1,
|
||
val1
|
||
]);
|
||
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
return 0;
|
||
}
|
||
} else {
|
||
String sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_KNR},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_KNAME},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_ANNAME},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_KDAKTLAND},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_KDAKTORT},'') as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd WHERE fs.kue_dokuart = '${Const.gDTS_AKUND}' " +
|
||
"AND ( fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KNR} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_ANNAME} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTLAND} like ? " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KDAKTORT} like ? ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val2,
|
||
val1,
|
||
val1,
|
||
val1
|
||
]);
|
||
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
return 0;
|
||
}
|
||
}
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens drei Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ProjNrValues")
|
||
def getProjNrValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für die Org. Projektnr.
|
||
// d3.log.error("ProjNrValues");
|
||
def resultset
|
||
if( validate == 1 ) {
|
||
// Rohwerte
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_PROJNR} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"ORDER BY dok_dat_feld_${Const.gDDF_PROJNR} DESC";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_PROJNR} + '|' + dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"ORDER BY dok_dat_feld_${Const.gDDF_PROJNR} DESC";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ProjVerknValues")
|
||
def getProjVerknValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Org.Hauptprojekt
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für die Projektverknüpfung
|
||
// d3.log.error("ProjVerknValues");
|
||
def resultset
|
||
def ProjInput = doc.field[Const.gDDF_PROJNR].toString();
|
||
String Projectnumber
|
||
|
||
if( validate == 1 ) {
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_PROJNR} + '|' + f.dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_PROJNR} LIKE ? " +
|
||
"ORDER BY f.dok_dat_feld_${Const.gDDF_PROJNR} DESC";
|
||
resultset = d3.sql.executeAndGet(sql,[ProjInput]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
// Split, falls Projektnummer zusammengesetzt
|
||
if( ProjInput.indexOf('|') >= 1 && ProjInput.length() > 3 && doc.field[Const.gDDF_PROJNR] != "" && doc.field[Const.gDDF_PROJNR] != null ) {
|
||
String[] str;
|
||
str = ProjInput.split('\\|');
|
||
Projectnumber = str[0];
|
||
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_PROJNR} + '|' + f.dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_PROJNR} LIKE ? " +
|
||
"ORDER BY f.dok_dat_feld_${Const.gDDF_PROJNR} DESC";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[Projectnumber]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else if( ProjInput.length() > 3 && doc.field[Const.gDDF_PROJNR] != "" && doc.field[Const.gDDF_PROJNR] != null ) {
|
||
// Hier wird mit einer bereits gesplitteten Projektnummer gearbeitet
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_PROJNR} + '|' + f.dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_PROJNR} LIKE ? " +
|
||
"ORDER BY f.dok_dat_feld_${Const.gDDF_PROJNR} DESC";
|
||
resultset = d3.sql.executeAndGet(sql,[ProjInput]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
// // Falls die Org.Projekt_Nr. leer ist, Fehlermeldung
|
||
// List<String> ErrResultset = ["Bitte füllen Sie zuerst die Org.Projekt_Nr."]
|
||
// repoField.provideValuesForValueSet(ErrResultset)
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_PROJNR} + '|' + f.dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"ORDER BY f.dok_dat_feld_${Const.gDDF_PROJNR} DESC";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ProjTitleValues")
|
||
def getProjTitleValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für den Org.Projekt_Name
|
||
// 31.07.2017 Anpassung, dass die Suchhilfe die Vorfilterung übernimmt. Es werden immer alle Orgaprojekte abgefragt
|
||
def resultset
|
||
def length
|
||
String[] ResRows
|
||
|
||
if( validate == 1 ) {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
ResRows = resultset.collect{it.get("val")};
|
||
length = ResRows.length
|
||
|
||
if( length > 10000 ) {
|
||
d3.log.error("Funktion entrypoint='ProjTitleValues' muss angepasst werden, es sind mehr als 10.000 Orgaprojekte in der Auswahl");
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="DepartmentValues")
|
||
def getDepartmentValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage aller vorhandenen Abteilungen aus dem Benutzerstamm
|
||
// 14.08.2017 nicht getestet, da nicht mehr im Einsatz (DDF 7 - Projektverantw. Abteilung)
|
||
def resultset
|
||
String sql = "SELECT distinct(abteilung) as val " +
|
||
"FROM benutzer " +
|
||
"WHERE abteilung <> ''";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
}
|
||
|
||
@ValueSet(entrypoint="MilestoneValues")
|
||
def getMilestoneValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage aller Meilensteine zu allen eingegebenen Projekten (Anpassung phoer 20170105: Anpassung nach Redesign Orga Projekte)
|
||
def resultset
|
||
if( doc.field[Const.gDDF_PROJNR] != "" && doc.field[Const.gDDF_PROJNR] != null ) {
|
||
def length
|
||
length = doc.field[Const.gDDF_PROJNR].length();
|
||
if( length >= 14 ) {
|
||
def val1 = doc.field[Const.gDDF_PROJNR].toString().substring(0,14);
|
||
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_MSAPS} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AMEIS}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND dok_dat_feld_${Const.gDDF_PROJNR} = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[val1]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte füllen Sie zuerst die Org.Projekt_Nr."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte füllen Sie zuerst die Org.Projekt_Nr."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="DokumentgruppeValues")
|
||
def getDokumentgruppeValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage der Dokumentkategorie abhängig von der ausgewählten Dokumentgruppe
|
||
// 15.08.2017 Die Dokumentkategorie existiert nur noch für die Marketingtooldokumente und kann daher als "einfache" SQL Abfrage übernommen werden.
|
||
def resultset
|
||
def val1 = doc.getType().getId();
|
||
|
||
// Inhalt Attributfeld Dokumentgruppe
|
||
if( doc.field[Const.gDDF_DOKGROUP] == "" || doc.field[Const.gDDF_DOKGROUP] == null || doc.field[Const.gDDF_ERGEBNISDOK] == "Ja" ){
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_CLASS} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[val1]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="DokumentuntergruppeValues")
|
||
def getDokumentuntergruppeValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
|
||
// Abfrage der Dokumentgruppen abhängig von der ausgewählten Dokumentkategorie
|
||
def resultset
|
||
def lProcessType
|
||
def lTargetDocType
|
||
def lSubject
|
||
def fieldLanguage
|
||
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
fieldLanguage = "1"
|
||
} else {
|
||
fieldLanguage = "2"
|
||
}
|
||
|
||
// Anpassung 2017-08-14/spet: Sonderbehandlung der Dokumentgruppe für 90 Vorlagen
|
||
if( doc.getType().getId() == "${Const.gDTS_DVORL}" ) {
|
||
|
||
lTargetDocType = doc.field[Const.gDDF_ZIELDTS]
|
||
lProcessType = doc.field[Const.gDDF_PROZESS]
|
||
|
||
if ( lTargetDocType == "TMPL" ) {
|
||
List<String> ErrResultset = [""]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
} else if ( lTargetDocType != "" && lTargetDocType != null ) {
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? ";
|
||
|
||
if ( lProcessType != "" && lProcessType != null ) {
|
||
if ( lProcessType == "020301" || lProcessType == "020302" ) {
|
||
lProcessType = "0203";
|
||
}
|
||
sql = sql + "AND ( fs1.dok_dat_feld_${Const.gDDF_PROZESS} = ? OR fs1.dok_dat_feld_${Const.gDDF_PROZESS} IS NULL OR fs1.dok_dat_feld_${Const.gDDF_PROZESS} = '' )"
|
||
sql = sql +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
resultset = d3.sql.executeAndGet(sql,[lTargetDocType, lProcessType]);
|
||
} else {
|
||
sql = sql +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
resultset = d3.sql.executeAndGet(sql,[lTargetDocType]);
|
||
}
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie ein Dokumentartkürzel ein."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
|
||
} else if( doc.getType().getId() == "${Const.gDTS_DKUKO}" ) {
|
||
// Anpassung 2016-11-15/dkle: Dokumentgruppe für Kundenkontaktdokumente
|
||
// Unterscheidung ob "02.01 Opportunity" oder "02.02 Maschinenprojekt"
|
||
|
||
// Dokumentgruppen für Kundenkontaktdokumente
|
||
// Unterschied zwischen Maschinenprojekt und Opportunity
|
||
// Prozessart (DDF5) = Opportunity oder Maschinenprojekt
|
||
// Anwendungsfall (DDF45) = Dokumentart
|
||
// Wenn Opportunity Nummer leer dann Maschinenprojekt
|
||
|
||
if( doc.field[Const.gDDF_OPPNUMMER] == "" || doc.field[Const.gDDF_OPPNUMMER] == null ) {
|
||
lProcessType = "0202"
|
||
} else {
|
||
lProcessType = "0201"
|
||
}
|
||
|
||
// 24.02.2020 imue - Sortierung
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_PROZESS} = ? " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
|
||
|
||
"ORDER BY 2 ";
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
doc.getType().getId(),
|
||
lProcessType
|
||
]);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
|
||
} else if (( doc.getType().getId() == "${Const.gDTS_DMDOK}" || doc.getType().getId() == "${Const.gDTS_DMSPE}" || doc.getType().getId() == "${Const.gDTS_DMAUF}" || doc.getType().getId() == "${Const.gDTS_DERZD}" || doc.getType().getId() == "${Const.gDTS_DLIMA}" || doc.getType().getId() == "${Const.gDTS_DKUMA}" ) && doc.field[Const.gDDF_SUBJECT] != "" && doc.field[Const.gDDF_SUBJECT] != null ) {
|
||
// nur Dokumentengruppen zur ausgewählten Akte ermitteln für Maschinenprojektdokumente
|
||
lSubject = doc.field[Const.gDDF_SUBJECT]
|
||
|
||
// Alle Werte für Maschinenprojekt
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_SUBJECT} = ? " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"AND (fs1.dok_dat_feld_${Const.gDDF_PROZESS} != '0204' OR fs1.dok_dat_feld_${Const.gDDF_PROZESS} IS NULL ) " +
|
||
"ORDER BY 2 ";
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
doc.getType().getId(),
|
||
lSubject
|
||
]);
|
||
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
|
||
// Ergänzung für Primärentwicklung
|
||
if(doc.getType() != null && doc.getType().getId().equals(Const.gDTS_DMAUF) && doc.field[Const.gDDF_AUFTRNR] != null && doc.field[Const.gDDF_AUFTRNR].startsWith("EN")){
|
||
String sqlPrimaer = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_SUBJECT} = ? " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_PROZESS} = '0204' " +
|
||
"ORDER BY 2 ";
|
||
def resultsetPrimaer = d3.sql.executeAndGet(sqlPrimaer,[
|
||
doc.getType().getId(),
|
||
lSubject
|
||
]);
|
||
List<String> ResRowsPrimaer = resultsetPrimaer.collect{it.get("val")};
|
||
|
||
for(String s : ResRowsPrimaer) {
|
||
ResRows.add(s);
|
||
}
|
||
}
|
||
|
||
ResRows.add("DG074"); // Medien
|
||
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
|
||
} else if ( doc.getType().getId() == "${Const.gDTS_DPRST}" ) {
|
||
|
||
//Wenn die Auftragsnummer gefüllt ist und der Betreff auch, ...
|
||
if ( doc.field[Const.gDDF_AUFTRNR] != "" && doc.field[Const.gDDF_AUFTRNR] != null && doc.field[Const.gDDF_SUBJECT] != "" && doc.field[Const.gDDF_SUBJECT] != null )
|
||
{
|
||
// ... hole alle Dokumentgruppen die in den adminstrative folders für die Projektsteuerung,
|
||
// die Prozessart "02.02 Maschinenprojekt und für den Betreff zur Verfügung stehen
|
||
lSubject = doc.field[Const.gDDF_SUBJECT]
|
||
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_SUBJECT} = ? " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_PROZESS} = '0202' " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
doc.getType().getId(),
|
||
lSubject
|
||
]);
|
||
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else if ( doc.field[Const.gDDF_AUFTRNR] != "" && doc.field[Const.gDDF_AUFTRNR] != null && ( doc.field[Const.gDDF_SUBJECT] == "" || doc.field[Const.gDDF_SUBJECT] == null )) {
|
||
//Wenn der Betreff leer ist, ...
|
||
// hole nur die Dokumentgruppen die für die Projektsteuerung und das Maschinenprojekt angelegt sind
|
||
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_PROZESS} = '0202' " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
resultset = d3.sql.executeAndGet(sql,[doc.getType().getId()]);
|
||
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else if ( doc.field[Const.gDDF_OPPNUMMER] != "" && doc.field[Const.gDDF_OPPNUMMER] != null ) {
|
||
// Ist anstelle der Auftragsnummer die Opportunitynummer gefüllt, ....
|
||
// nimm nur Dokumentgruppen, die für die Opportunity in der Projektsteuerung zur Verfügung stehen
|
||
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_PROZESS} = '0201' " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[doc.getType().getId()]);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
|
||
} else if ( doc.getType().getId() == "${Const.gDTS_DBAUD}" || doc.getType().getId() == "${Const.gDTS_DBAAU}" || doc.getType().getId() == "${Const.gDTS_DBAAS}" || doc.getType().getId() == "${Const.gDTS_DBABE}" || doc.getType().getId() == "${Const.gDTS_DBAGE}" ) {
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_REGISTER} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? ";
|
||
|
||
//WhereClause Baudokumente
|
||
if ( doc.getType().getId() == "${Const.gDTS_DBAUD}" && doc.field[Const.gDDF_BAUAKTE] != "" && doc.field[Const.gDDF_BAUAKTE] != null )
|
||
{
|
||
sql = sql + "AND dok_dat_feld_${Const.gDDF_CLASS} = ? ";
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
doc.getType().getId(),
|
||
doc.field[Const.gDDF_BAUAKTE]
|
||
]);
|
||
} else if ( doc.getType().getId() == "${Const.gDTS_DBAUD}" && (doc.field[Const.gDDF_BAUAKTE] == "" || doc.field[Const.gDDF_BAUAKTE] == null ) ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte füllen Sie zuerst das Feld Bauakte"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
} else {
|
||
resultset = d3.sql.executeAndGet(sql,[doc.getType().getId()]);
|
||
}
|
||
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else if ( doc.getType().getId() == "${Const.gDTS_AREME}" || doc.getType().getId() == "${Const.gDTS_AVODA}" || doc.getType().getId() == "${Const.gDTS_DABTE}" ) {
|
||
|
||
//jleu - 28.09.2017 - Dokumentgruppe für Abteilungsvorgänge und Dokumente aus den administrativen Akten laden
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_REGISTER} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${Const.gDTS_DABTE}' ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else if( doc.getType().getId().equals(Const.gDTS_DSEBE) || doc.getType().getId().equals(Const.gDTS_DSERE) ) {
|
||
|
||
def belegTypTemp = doc.field[Const.gDDF_BELEGTYP];
|
||
def belegNrTemp = doc.field[Const.gDDF_BELEGNUMMER];
|
||
|
||
if( doc.getType().getId().equals(Const.gDTS_DSEBE) && belegTypTemp != null && !belegTypTemp.equals("") ) {
|
||
|
||
// 24.02.2020 imue - Sortierung
|
||
String sql = "SELECT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_45 = '${Const.gDTS_DSEBE}' " +
|
||
"AND ( fs1.dok_dat_feld_${Const.gDDF_BELEGART} LIKE '%${doc.field[Const.gDDF_BELEGTYP]}%' " +
|
||
" OR fs1.dok_dat_feld_${Const.gDDF_BELEGART} IS NULL ) " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else if( doc.getType().getId().equals(Const.gDTS_DSEBE) && belegTypTemp == null ) {
|
||
|
||
// 24.02.2020 imue - Sortierung
|
||
String sql = "SELECT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${Const.gDTS_DSEBE}' ";
|
||
|
||
// 19.02.2020 imue - Beim Import ist ggf. der Belegtyp noch nicht gesplittet, daher prüfen
|
||
if( doc.field[Const.gDDF_BELEGNUMMER] != null ) {
|
||
|
||
def belegNr = doc.field[Const.gDDF_BELEGNUMMER]
|
||
String[] splittedString = doc.field[Const.gDDF_BELEGNUMMER].split("\\s+");
|
||
if( splittedString.size() > 1) {
|
||
belegNr = splittedString[0];
|
||
}
|
||
|
||
if ( belegNr != null && !belegNr.equals("") ) {
|
||
String sqlGetBelegTyp = "SELECT TOP 1 dok_dat_feld_${Const.gDDF_BELEGTYP} as belegTyp" +
|
||
" FROM firmen_spezifisch " +
|
||
" WHERE kue_dokuart = '${Const.gDTS_ASEBE}' " +
|
||
" AND dok_dat_feld_${Const.gDDF_BELEGNUMMER} = '" + belegNr +"'";
|
||
|
||
def results = d3.sql.executeAndGet(sqlGetBelegTyp);
|
||
List<String> resultRows = results.collect{it.get("belegTyp")};
|
||
def belegTyp = resultRows[0];
|
||
|
||
if ( belegTyp != null && !belegTyp.equals("") ) {
|
||
sql += "AND ( fs1.dok_dat_feld_${Const.gDDF_BELEGART} IS NULL OR fs1.dok_dat_feld_${Const.gDDF_BELEGART} LIKE '%${belegTyp}%' ) ";
|
||
}
|
||
}
|
||
}
|
||
|
||
sql = sql + " AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else if( doc.getType().getId().equals(Const.gDTS_DSERE) ) {
|
||
|
||
// 24.02.2020 imue - Sortierung
|
||
String sql = "SELECT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${Const.gDTS_DSERE}' " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
|
||
} else if( doc.getType().getId().equals(Const.gDTS_DEINK) ) {
|
||
|
||
def belegTypTemp = doc.field[Const.gDDF_BELEGTYP];
|
||
def belegNrTemp = doc.field[Const.gDDF_BELEGNUMMER];
|
||
|
||
if( belegTypTemp != null && !belegTypTemp.equals("") ) {
|
||
|
||
String sql = "SELECT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_45 = '${Const.gDTS_DEINK}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_BELEGART} LIKE '%${doc.field[Const.gDDF_BELEGTYP]}%' " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else if( belegTypTemp == null ) {
|
||
|
||
String sql = "SELECT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${Const.gDTS_DEINK}' ";
|
||
|
||
// 19.02.2020 imue - Beim Import ist ggf. der Belegtyp noch nicht hinzuvalidiert, daher prüfen
|
||
if( doc.field[Const.gDDF_BELEGNUMMER] != null ) {
|
||
|
||
def belegNr = doc.field[Const.gDDF_BELEGNUMMER]
|
||
if ( belegNr != null && !belegNr.equals("") ) {
|
||
String sqlGetBelegTyp = "SELECT TOP 1 dok_dat_feld_${Const.gDDF_BELEGTYP} as belegTyp" +
|
||
" FROM firmen_spezifisch " +
|
||
" WHERE kue_dokuart = '${Const.gDTS_AEIBE}' " +
|
||
" AND dok_dat_feld_${Const.gDDF_BELEGNUMMER} = '" + belegNr +"'";
|
||
|
||
def results = d3.sql.executeAndGet(sqlGetBelegTyp);
|
||
List<String> resultRows = results.collect{it.get("belegTyp")};
|
||
|
||
def belegTyp = resultRows[0];
|
||
if ( belegTyp != null && !belegTyp.equals("") ) {
|
||
// Betreff
|
||
sql += "AND fs1.dok_dat_feld_${Const.gDDF_BELEGART} LIKE '%${belegTyp}%' ";
|
||
}
|
||
}
|
||
}
|
||
|
||
sql = sql + " AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
|
||
} else if( doc.getType().getId().equals(Const.gDTS_DEQUI) ) {
|
||
|
||
lSubject = doc.field[Const.gDDF_SUBJECT]
|
||
|
||
def where = "";
|
||
|
||
if ( ! ( lSubject == null || lSubject.equals("") ) )
|
||
{
|
||
where = " AND fs1.dok_dat_feld_${Const.gDDF_SUBJECT} = '" + lSubject + "' ";
|
||
}
|
||
|
||
// Alle Werte für Maschinenprojekt
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
where +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"AND (fs1.dok_dat_feld_${Const.gDDF_PROZESS} = 'PZ009' ) " +
|
||
" and fs1.dok_dat_feld_26 like 'DG%' " +
|
||
"ORDER BY 2 ";
|
||
//d3.log.error( "SQL: " + sql );
|
||
//d3.log.error( "Dok-Art " + doc.getType().getId() );
|
||
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
doc.getType().getId()
|
||
]);
|
||
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
|
||
|
||
|
||
//ResRows.add("DG074"); // Medien
|
||
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
|
||
|
||
} else {
|
||
String sql = "SELECT DISTINCT fs1.dok_dat_feld_${Const.gDDF_REGISTER} as val, mv.value_char " +
|
||
"FROM firmen_spezifisch fs1 " +
|
||
"LEFT JOIN firmen_spezifisch fs2 ON fs1.dok_dat_feld_${Const.gDDF_REGISTER} = fs2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"LEFT JOIN firm_spez_mult_val mv ON fs2.doku_id = mv.doku_id " +
|
||
"WHERE fs1.kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
"AND fs1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? " +
|
||
"AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"AND mv.row_number = '${fieldLanguage}' " +
|
||
"ORDER BY 2 ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[doc.getType().getId()]);
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("DG074"); // Medien
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
|
||
// d3.getArchive().removeTranslationFromCache("DokumentuntergruppeValues", new Locale("de"));
|
||
// d3.getArchive().removeTranslationFromCache("DokumentuntergruppeValues", new Locale("en"));
|
||
}
|
||
|
||
@ValueSet(entrypoint="GremiumAPValues")
|
||
def getGremiumAPValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage des Gremiums aus den zugehörigen Gremien in der Projektakte
|
||
// Nicht mehr im Einsatz.
|
||
// def resultset
|
||
|
||
// String sql = "SELECT mv.value_char as val " +
|
||
// "FROM firmen_spezifisch " +
|
||
// "WHERE kue_dokuart = '${Const.gDTS_AAFOL}' " +
|
||
// "AND dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = ? ";
|
||
// resultset = d3.sql.executeAndGet(sql,[doc.getType().getId()]);
|
||
|
||
// List<String> ResRows = resultset.collect{it.get("val")};
|
||
// ResRows.add("Medien")
|
||
// repoField.provideValuesForValueSet(ResRows);
|
||
|
||
// DBMS ALIAS d3server_value_char_allowed, d3server_repos_id_allowed
|
||
// DBMS SQL SELECT mv.value_char, ':repos_id' \
|
||
// FROM firmen_spezifisch fs, firm_spez_mult_val mv \
|
||
// WHERE fs.doku_id = mv.doku_id \
|
||
// AND fs.dok_dat_feld_:gDDF_PROJNR = :+dok_dat_feld[:gDDF_PROJNR] \
|
||
// AND mv.field_no = '64' \
|
||
// AND fs.kue_dokuart = :+gDTS_APROJ
|
||
// DBMS ALIAS
|
||
}
|
||
|
||
@ValueSet(entrypoint="HauptProjValues")
|
||
def getHauptProjValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Org.Projektklammer z.B. Dokumentart Organisationsprojektdokumente
|
||
// 31.07.2017 Prüfung und ggf. Anpassung '%:dok_dat_feld[gDDF_PROZESS](10)'
|
||
//if( doc.field[Const.gDDF_PROZESS] != "" && doc.field[Const.gDDF_PROZESS] != null ) {
|
||
|
||
def resultset
|
||
def length
|
||
List<String> ResRows
|
||
|
||
String sql = "SELECT DISTINCT LEFT(f.dok_dat_feld_${Const.gDDF_PROJNR},11) as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_APROJ}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
|
||
ResRows = resultset.collect{it.get("val")};
|
||
ResRows = ResRows.sort();
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
|
||
@ValueSet(entrypoint="ProjTitleMValues")
|
||
def getProjTitleMValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// OFF!
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für den Projekttitel
|
||
}
|
||
|
||
@ValueSet(entrypoint="ProzArtValues")
|
||
def getProzArtValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für die Prozessart abhängig von der Prozessgruppe
|
||
//def val1 = "%" + doc.field[Const.gDDF_PROZESSGROUP].toString() + "%";
|
||
def resultset
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_PROZESSART} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AAFOL}' ";
|
||
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
@ValueSet(entrypoint="ProzessValues")
|
||
def getProzessValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
|
||
// Information ob Suchdialog oder Importdialog
|
||
def appID
|
||
def DocType
|
||
def RepoID
|
||
|
||
try {
|
||
appID = d3.remote.getVersion()[0..2];
|
||
RepoID = d3.remote.getServerId()
|
||
RepoID = "%" + RepoID + "%"
|
||
} catch (Exception e) {
|
||
//d3.log.error("Exception on d3.remote.getVersion = " + e);
|
||
}
|
||
|
||
d3.log.info("APP ID ${appID} Buchungskreis ${doc.field[Const.gDDF_BUCHKREIS]} ");
|
||
|
||
if (doc.getType().getId() == "${Const.gDTS_AHAUP}" || doc.getType().getId() == "${Const.gDTS_DOSSI}" || doc.getType().getId() == "${Const.gDTS_ATEIL}")
|
||
{
|
||
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für den Prozess abhängig von der Prozessart
|
||
def val1 = "%" + doc.field[Const.gDDF_PROZESS].toString() + "%";
|
||
def resultset
|
||
def lRow
|
||
def lang = d3.remote.language
|
||
|
||
if ( lang != "049" ) {
|
||
lRow = "2"
|
||
}
|
||
else {
|
||
lRow = "1"
|
||
}
|
||
|
||
String sql = "select t1.dok_dat_feld_${Const.gDDF_PROZESS} as val " +
|
||
"from firmen_spezifisch as t1 " +
|
||
"inner join firmen_spezifisch as t2 on t1.dok_dat_feld_${Const.gDDF_PROZESS} = t2.dok_dat_feld_${Const.gDFF_SCHLUESSEL} " +
|
||
"inner join firm_spez_mult_val as t3 on t2.doku_id = t3.doku_id " +
|
||
"where t1.kue_dokuart = '${Const.gDTS_AAFOL}' and t2.kue_dokuart = '${Const.gDTS_AZTXT}' " +
|
||
"and t1.dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${Const.gDTS_AHAUP}' " +
|
||
"and t1.dok_dat_feld_${Const.gDDF_SUBJECT} like '${RepoID}' " +
|
||
"and t3.field_no = '${Const.gDDF_UEBERSETZUNG}' " +
|
||
"and row_number = '${lRow}' "
|
||
|
||
//String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_PROZESS} as val " +
|
||
// "FROM firmen_spezifisch " +
|
||
// "WHERE kue_dokuart = '${Const.gDTS_AAFOL}' AND dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${Const.gDTS_AHAUP}' ";
|
||
|
||
if( doc.field[Const.gDDF_PROZESS] != "" && doc.field[Const.gDDF_PROZESS] != null && validate == 0) {
|
||
sql = sql + "AND t3.value_char like '${val1}' order by t3.value_char asc";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
} else {
|
||
sql = sql + "order by t3.value_char asc"
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
}
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
d3.getArchive().removeTranslationFromCache("ProzessValues", new Locale("de"));
|
||
d3.getArchive().removeTranslationFromCache("ProzessValues", new Locale("en"));
|
||
|
||
} else {
|
||
|
||
if(appID == '200' && ( doc.field[Const.gDDF_BUCHKREIS] == "" || doc.field[Const.gDDF_BUCHKREIS] == null )) {
|
||
|
||
// Prozess (Kunde)
|
||
if( doc.getType().getId() == Const.gDTS_APROZ ) {
|
||
DocType = Const.gDTS_APROZ
|
||
} else if( doc.getType().getId() == Const.gDTS_AEINK ) {
|
||
DocType = Const.gDTS_AEINK
|
||
} else if( doc.getType().getId() == Const.gDTS_APROA) {
|
||
DocType = Const.gDTS_APROA
|
||
} else {
|
||
def resultset
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_PROZESS} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AAFOL}' ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")})
|
||
}
|
||
// d3.log.info("Wert validate -${DocType}-")
|
||
|
||
def dokuArtTemp = doc.getType().getId();
|
||
def resultset
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_PROZESS} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${DocType}' ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")})
|
||
|
||
} else {
|
||
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für den Prozess abhängig von der Prozessart
|
||
def val1 = "%" + doc.field[Const.gDDF_PROZESS].toString() + "%";
|
||
def resultset
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_PROZESS} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AAFOL}' ";
|
||
|
||
if( doc.field[Const.gDDF_PROZESS] != "" && doc.field[Const.gDDF_PROZESS] != null ) {
|
||
sql = sql + "AND dok_dat_feld_${Const.gDDF_PROZESS} like ? ";
|
||
resultset = d3.sql.executeAndGet(sql,[val1]);
|
||
} else {
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
}
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="HauptProjekteValues")
|
||
def getHauptProjekteValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// OFF!
|
||
// Abfrage der Werte zu Hauptprojekt (67) für Dokumente
|
||
}
|
||
|
||
@ValueSet(entrypoint="OppNumValues")
|
||
def getOppNumValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für die Opportunitydokumente abhängig von den existierenden Opportunityakten
|
||
// - Opportunity_Nr
|
||
// - weitere Opportunity_Nr
|
||
// - Hauptopportunity
|
||
|
||
List<String> valueList = new ArrayList<>();
|
||
String lSQLState1 = "";
|
||
|
||
|
||
if(doc.field[Const.gDDF_OPPNRM][row_no] != null) {
|
||
lSQLState1 = "OR dok_dat_feld_${Const.gDDF_OPPNUMMER} like '%${doc.field[Const.gDDF_OPPNRM][row_no]}%' "
|
||
}
|
||
|
||
def lang = d3.remote.language
|
||
def lNoSubmission
|
||
|
||
if ( lang != "049" ) {
|
||
lNoSubmission = "No Submission"
|
||
}
|
||
else {
|
||
lNoSubmission = "keine Submission"
|
||
}
|
||
|
||
def resultset
|
||
|
||
if( validate == 1 ) {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_OPPNUMMER} as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND ( fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} = '${doc.field[Const.gDDF_OPPNUMMER]}' " +
|
||
lSQLState1 +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} = '${doc.field[Const.gDDF_HAUPTOPP]}') ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
if (doc.field[Const.gDDF_OPPNUMMER] != "" && doc.field[Const.gDDF_OPPNUMMER] != null){
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_OPPNUMMER} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SUBMISSION},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} like '%${doc.field[Const.gDDF_OPPNUMMER]}%' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else if (doc.field[Const.gDDF_HAUPTOPP] != "" && doc.field[Const.gDDF_HAUPTOPP] != null) {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_OPPNUMMER} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SUBMISSION},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} like '%${doc.field[Const.gDDF_HAUPTOPP]}%' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_OPPNUMMER} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SUBMISSION},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND ( fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} = '${doc.field[Const.gDDF_OPPNUMMER]}' " +
|
||
lSQLState1 +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} = '${doc.field[Const.gDDF_HAUPTOPP]}') ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="MProjNumValues")
|
||
def getMProjNumValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für die Maschinenprojektdokumente abhängig von den existierenden Maschinenprojektakten
|
||
// - Projekt_Nr
|
||
// - weitere Projekt_Nr
|
||
def lang = d3.remote.language
|
||
def lNoSubmission
|
||
|
||
if ( lang != "049" ) {
|
||
lNoSubmission = "No Submission"
|
||
}
|
||
else {
|
||
lNoSubmission = "keine Submission"
|
||
}
|
||
|
||
def resultset
|
||
if( validate == 1 ) {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_AUFTRNR} as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_AMPRA}' " +
|
||
"OR fs.kue_dokuart = '${Const.gDTS_APREN}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
if( docType.getId().equals(Const.gDTS_ENTMAP) ) {
|
||
// Entwicklungsprojektdokumenten -> in Abhängigkeit zu ProjektNr eingeschränkt auf EN-XXXXX
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_AUFTRNR} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SUBMISSION},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_AMPRA}' " +
|
||
"OR fs.kue_dokuart = '${Const.gDTS_APREN}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND dok_dat_feld_${Const.gDDF_AUFTRNR} LIKE 'EN%' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else if( docType.getId().equals(Const.gDTS_DMAP1) ) {
|
||
// Maschinenprojektdokumenten -> in Abhängigkeit zu Projekt eingeschränkt auf PR-XXXXX
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_AUFTRNR} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SUBMISSION},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_AMPRA}' " +
|
||
"OR fs.kue_dokuart = '${Const.gDTS_APREN}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND dok_dat_feld_${Const.gDDF_AUFTRNR} LIKE 'PR%' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
// 22.08.2022 - Einschränkung auf min 2 Zeichen
|
||
int currDdf = repoField.getPreferedFieldNumber();
|
||
String val1 = null;
|
||
if(currDdf > 59 && currDdf < 70) {
|
||
// Mehrfachfeld (weitere Projektnummer)
|
||
if(doc.field[currDdf][row_no] != null) {
|
||
val1 = doc.field[currDdf][row_no].toString();
|
||
}
|
||
} else {
|
||
// Einfachfeld (Projektnummer)
|
||
if(doc.field[currDdf] != null) {
|
||
val1 = doc.field[currDdf].toString();
|
||
}
|
||
}
|
||
|
||
int length = 0;
|
||
if(val1 != null) {
|
||
length = val1.length();
|
||
}
|
||
if( length >= 2 ) {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_AUFTRNR} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SUBMISSION},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_AMPRA}' " +
|
||
"OR fs.kue_dokuart = '${Const.gDTS_APREN}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mind. 2 Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
@ValueSet(entrypoint="OffNoValues")
|
||
def getOffNoValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage der vorhandenen Angebotsnummern in Abhängigkeit zu Opp. Nr. und Angebotsnamen
|
||
def resultset
|
||
def lOppNoInput = doc.field[Const.gDDF_OPPNUMMER].toString();
|
||
def lOppNo
|
||
|
||
//d3.log.error("doc.field[Const.gDDF_ANNAME]: " + doc.field[Const.gDDF_ANNAME] );
|
||
//d3.log.error("doc.field[Const.gDDF_OPPNUMMER]: " + doc.field[Const.gDDF_OPPNUMMER] );
|
||
|
||
if( doc.field[Const.gDDF_ANNAME] == "angebotsübergreifend/vor Angebot" ) {
|
||
List<String> ErrResultset = ["99999"]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
|
||
if( doc.field[Const.gDDF_OPPNUMMER] != "" && doc.field[Const.gDDF_OPPNUMMER] != null ) {
|
||
//Splitten des zusammengesetzten String Opportunitynummer und Submission nach Opportunitynummer
|
||
if( lOppNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = lOppNoInput.split('\\|');
|
||
lOppNo = str[0];
|
||
} else {
|
||
lOppNo = doc.field[Const.gDDF_OPPNUMMER].toString();
|
||
}
|
||
}
|
||
|
||
// String sql = "SELECT dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
// "FROM firmen_spezifisch " +
|
||
// "WHERE kue_dokuart = '${Const.gDTS_AREGI}' " +
|
||
// "AND dok_dat_feld_${Const.gDDF_OPPNUMMER} = ? " ;
|
||
// resultset = d3.sql.executeAndGet(sql,[lOppNo]);
|
||
// repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
if( ( doc.field[Const.gDDF_OPPNUMMER] == '' || doc.field[Const.gDDF_OPPNUMMER] == null ) && ( doc.field[Const.gDDF_ANNAME] == '' || doc.field[Const.gDDF_ANNAME] == null ) ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte wählen Sie zunächst den Angebotsnamen"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
} else if( ( doc.field[Const.gDDF_ANNAME] == '' || doc.field[Const.gDDF_ANNAME] == null ) && ( doc.field[Const.gDDF_OPPNUMMER] != '' || doc.field[Const.gDDF_OPPNUMMER] != null ) ) {
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AREGI}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_OPPNUMMER} = ? " ;
|
||
//resultset = d3.sql.executeAndGet(sql,[doc.field[Const.gDDF_OPPNUMMER]]);
|
||
resultset = d3.sql.executeAndGet(sql,[lOppNo]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else if( doc.field[Const.gDDF_ANNAME] != '' && doc.field[Const.gDDF_ANNAME] != null && ( doc.field[Const.gDDF_OPPNUMMER] == '' || doc.field[Const.gDDF_OPPNUMMER] == null ) ) {
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AREGI}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_ANNAME} = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[doc.field[Const.gDDF_ANNAME]]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else if( doc.field[Const.gDDF_ANNAME] != '' && doc.field[Const.gDDF_ANNAME] != null && doc.field[Const.gDDF_OPPNUMMER] != '' && doc.field[Const.gDDF_OPPNUMMER] != null ) {
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_PROJTITLE} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AREGI}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_ANNAME} = ? " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_OPPNUMMER} = ? " ;
|
||
//resultset = d3.sql.executeAndGet(sql,[doc.field[Const.gDDF_ANNAME], doc.field[Const.gDDF_OPPNUMMER]]);
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
doc.field[Const.gDDF_ANNAME],
|
||
lOppNo
|
||
]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="OffNameValues")
|
||
def getOffNameValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage der Angebotsnamen in Abhängigkeit zur Opportunitynummer
|
||
def resultset
|
||
if( doc.field[Const.gDDF_OPPNUMMER] == "" || doc.field[Const.gDDF_OPPNUMMER] == null ) {
|
||
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_ANNAME} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AUNTE}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("angebotsübergreifend/vor Angebot")
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
|
||
} else {
|
||
def OpportunityNoInput = doc.field[Const.gDDF_OPPNUMMER].toString();
|
||
def OpportunityNo
|
||
|
||
if( OpportunityNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = OpportunityNoInput.split('\\|');
|
||
OpportunityNo = str[0];
|
||
} else {
|
||
OpportunityNo = doc.field[Const.gDDF_OPPNUMMER].toString()
|
||
}
|
||
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_ANNAME} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AUNTE}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_OPPNUMMER} = ? ";
|
||
resultset = d3.sql.executeAndGet(sql, [OpportunityNo]);
|
||
|
||
List<String> ResRows = resultset.collect{it.get("val")};
|
||
ResRows.add("angebotsübergreifend/vor Angebot")
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="SubmissionValues")
|
||
def getSubmissionValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für die Submission
|
||
def resultset
|
||
|
||
def length
|
||
def val1 = doc.field[Const.gDDF_SUBMISSION].toString()
|
||
|
||
length = val1.length();
|
||
// d3.log.error("length: " + length.toString());
|
||
// d3.log.error("val1: " + val1.toString());
|
||
if( val1.length() >= 2 && doc.field[Const.gDDF_SUBMISSION] != "" && doc.field[Const.gDDF_SUBMISSION] != null ) {
|
||
|
||
if( docType.getId().equals(Const.gDTS_DOPP1) ) {
|
||
// Dokumentsammler Suche - Anzeige aller Werte in Abhängigkeit zu Opportunitydokumente
|
||
String sql = "SELECT distinct(dok_dat_feld_${Const.gDDF_SUBMISSION}) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_AOPPU}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else if( docType.getId().equals(Const.gDTS_DMAP1) ) {
|
||
// Dokumentsammler Suche - Anzeige aller Werte in Abhängigkeit zu Maschinenprojektdokumente
|
||
String sql = "SELECT distinct(dok_dat_feld_${Const.gDDF_SUBMISSION}) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_AMPRA}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else if( docType.getId().equals(Const.gDTS_ENTMAP) ) {
|
||
// Dokumentsammler Suche - Anzeige aller Werte in Abhängigkeit zu Entwicklungsprojektdokumente
|
||
String sql = "SELECT distinct(dok_dat_feld_${Const.gDDF_SUBMISSION}) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_APREN}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else {
|
||
// Anzeige aller möglichen Werte
|
||
String sql = "SELECT distinct(dok_dat_feld_${Const.gDDF_SUBMISSION}) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE ( fs.kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"OR fs.kue_dokuart = '${Const.gDTS_ASEBE}' " +
|
||
"OR fs.kue_dokuart = '${Const.gDTS_AMPRA}' " +
|
||
"OR fs.kue_dokuart = '${Const.gDTS_APREN}' ) " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND dok_dat_feld_${Const.gDDF_SUBMISSION} LIKE '%${doc.field[Const.gDDF_SUBMISSION]}%'";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens zwei Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="RespSalesmanValues")
|
||
def getRespSalesmanValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Abfrage zur Generierung der dynamischen Wertemenge für den zust. Verkäufer
|
||
def resultset
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_RESPSALESMAN} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"OR kue_dokuart = '${Const.gDTS_APREN}' " +
|
||
"OR kue_dokuart = '${Const.gDTS_AMPRA}' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
@ValueSet(entrypoint="CustActNameValues")
|
||
def getCustActNameValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
// Kundenkontakt_Beschreibung
|
||
// dynamische Wertemenge für die Ermittlung der Kundenkontaktakten zu einer Opportunity Kundenkontakt_Beschreibung
|
||
def Language = d3.remote.getLanguage();
|
||
if( ( doc.field[Const.gDDF_OPPNUMMER] == "" || doc.field[Const.gDDF_OPPNUMMER] == null ) && ( doc.field[Const.gDDF_AUFTRNR] == "" || doc.field[Const.gDDF_AUFTRNR] == null ) && ( doc.field[Const.gDDF_KNR] == "" || doc.field[Const.gDDF_KNR] == null ) ) {
|
||
if( Language != null && Language.equals("049") ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte wählen Sie zunächst entweder Opportunity, Maschinenprojekt oder Kundennummer für die Auswahl"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Please choose an Opportunity, Project or Customernumber at first."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
} else {
|
||
|
||
def resultset
|
||
String sql = "SELECT f.dok_dat_feld_${Const.gDDF_KDAKTNAME} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AKONT}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " ;
|
||
// Überprüfung ob die Auftragsnummer gefüllt ist, ggf. Split
|
||
|
||
if( doc.field[Const.gDDF_KNR] != null ) {
|
||
def CustomerNoInput = doc.field[Const.gDDF_KNR].toString();
|
||
def CustomerNo
|
||
|
||
if( CustomerNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = CustomerNoInput.split('\\|');
|
||
CustomerNo = str[0];
|
||
} else {
|
||
CustomerNo = doc.field[Const.gDDF_KNR].toString()
|
||
}
|
||
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_KNR} = '${CustomerNo}' ";
|
||
}
|
||
|
||
if( doc.field[Const.gDDF_AUFTRNR] != "" && doc.field[Const.gDDF_AUFTRNR] != null ) {
|
||
def ProjectNoInput = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
def ProjectNo
|
||
|
||
if( ProjectNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = ProjectNoInput.split('\\|');
|
||
ProjectNo = str[0];
|
||
} else {
|
||
ProjectNo = doc.field[Const.gDDF_AUFTRNR].toString()
|
||
}
|
||
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_AUFTRNR} = '${ProjectNo}' ";
|
||
} else if( doc.field[Const.gDDF_OPPNUMMER] != "" && doc.field[Const.gDDF_OPPNUMMER] != null ) {
|
||
// Überprüfung ob die Opportunitynummer gefüllt ist, ggf. Split
|
||
def OpportunityNoInput = doc.field[Const.gDDF_OPPNUMMER].toString();
|
||
def OpportunityNo
|
||
|
||
if( OpportunityNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = OpportunityNoInput.split('\\|');
|
||
OpportunityNo = str[0];
|
||
} else {
|
||
OpportunityNo = doc.field[Const.gDDF_OPPNUMMER].toString()
|
||
}
|
||
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_OPPNUMMER} = '${OpportunityNo}' ";
|
||
}
|
||
|
||
// Überprüfung des Kontaktdatums
|
||
if ( doc.field[Const.gDDF_KONTAKTDATE] != null) {
|
||
|
||
// d3.log.error("Kontaktdatum: " + doc.field[Const.gDDF_KONTAKTDATE] );
|
||
def KontaktDate = doc.field[Const.gDDF_KONTAKTDATE]
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_KONTAKTDATE} = ? ";
|
||
resultset = d3.sql.executeAndGet(sql, [KontaktDate]);
|
||
}
|
||
else{
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
}
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="CustActDateValues")
|
||
def getCustActDateValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Ermittlung der Kundenkontaktakten zu einer Opportunity
|
||
def Language = d3.getNatives().getd3fcLanguage();
|
||
def resultset
|
||
def val1
|
||
|
||
String sql = "SELECT CONVERT(varchar, f.dok_dat_feld_${Const.gDDF_KONTAKTDATE}, 104) as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AKONT}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " ;
|
||
|
||
if( ( doc.field[Const.gDDF_OPPNUMMER] == "" || doc.field[Const.gDDF_OPPNUMMER] == null ) && ( doc.field[Const.gDDF_AUFTRNR] == "" || doc.field[Const.gDDF_AUFTRNR] == null ) && ( doc.field[Const.gDDF_KNR] != "" && doc.field[Const.gDDF_KNR] != null ) ) {
|
||
def CustomerNoInput = doc.field[Const.gDDF_KNR].toString();
|
||
def CustomerNo
|
||
|
||
if( CustomerNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = CustomerNoInput.split('\\|');
|
||
CustomerNo = str[0];
|
||
} else {
|
||
CustomerNo = doc.field[Const.gDDF_KNR].toString()
|
||
}
|
||
val1 = CustomerNo
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_KNR} = ? ";
|
||
} else if( doc.field[Const.gDDF_OPPNUMMER] != "" && doc.field[Const.gDDF_OPPNUMMER] != null ) {
|
||
def OpportunityNoInput = doc.field[Const.gDDF_OPPNUMMER].toString();
|
||
def OpportunityNo
|
||
|
||
if( OpportunityNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = OpportunityNoInput.split('\\|');
|
||
OpportunityNo = str[0];
|
||
} else {
|
||
OpportunityNo = doc.field[Const.gDDF_OPPNUMMER].toString()
|
||
}
|
||
val1 = OpportunityNo
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_OPPNUMMER} = ? ";
|
||
} else if ( dok_dat_feld[gDDF_AUFTRNR] != "" && dok_dat_feld[gDDF_AUFTRNR] != null )
|
||
{
|
||
def ProjectNoInput = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
def ProjectNo
|
||
|
||
if( ProjectNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = ProjectNoInput.split('\\|');
|
||
ProjectNo = str[0];
|
||
} else {
|
||
ProjectNo = doc.field[Const.gDDF_AUFTRNR].toString()
|
||
}
|
||
val1 = ProjectNo
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_AUFTRNR} = ? ";
|
||
}
|
||
|
||
// Überprüfung des Kontaktdatums
|
||
if ( doc.field[Const.gDDF_KONTAKTDATE] != "" && doc.field[Const.gDDF_KONTAKTDATE] != null) {
|
||
// d3.log.error("Kontaktdatum: " + doc.field[Const.gDDF_KONTAKTDATE] );
|
||
def KontaktDate = doc.field[Const.gDDF_KONTAKTDATE]
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_KONTAKTDATE} = ? ";
|
||
resultset = d3.sql.executeAndGet(sql, [val1, KontaktDate]);
|
||
} else {
|
||
resultset = d3.sql.executeAndGet(sql, [val1]);
|
||
}
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
@ValueSet(entrypoint="CustActIDValues")
|
||
def getCustActIDValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Ermittlung der Kundenkontaktakten zu einer Opportunity
|
||
def Language = d3.getNatives().getd3fcLanguage();
|
||
def resultset
|
||
def val1
|
||
|
||
String sql = "SELECT DISTINCT ISNULL(f.dok_dat_feld_${Const.gDDF_AUFTRNR},'') as SQLAuftragsnr, ISNULL(f.dok_dat_feld_${Const.gDDF_OPPNUMMER},'') as SQLOpportunityNr, ISNULL(f.dok_dat_feld_${Const.gDDF_KONTAKTNUMMER},'') as SQLKontaktID, ISNULL(CONVERT(varchar, f.dok_dat_feld_${Const.gDDF_KONTAKTDATE}, 104),'') as SQLKontaktDatum, ISNULL(f.dok_dat_feld_${Const.gDDF_KDAKTNAME},'') as SQLKontaktBeschr, ISNULL(f.dok_dat_feld_${Const.gDDF_KNR},'') as SQLKundenNr " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AKONT}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id "
|
||
|
||
if( doc.field[Const.gDDF_OPPNUMMER] != "" && doc.field[Const.gDDF_OPPNUMMER] != null ) {
|
||
def OpportunityNoInput = doc.field[Const.gDDF_OPPNUMMER].toString();
|
||
def OpportunityNo
|
||
|
||
if( OpportunityNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = OpportunityNoInput.split('\\|');
|
||
OpportunityNo = str[0];
|
||
} else {
|
||
OpportunityNo = doc.field[Const.gDDF_OPPNUMMER].toString()
|
||
}
|
||
val1 = OpportunityNo
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_OPPNUMMER} = ? ";
|
||
} else if ( doc.field[Const.gDDF_AUFTRNR] != "" && doc.field[Const.gDDF_AUFTRNR] != null )
|
||
{
|
||
def ProjectNoInput = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
def ProjectNo
|
||
|
||
if( ProjectNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = ProjectNoInput.split('\\|');
|
||
ProjectNo = str[0];
|
||
} else {
|
||
ProjectNo = doc.field[Const.gDDF_AUFTRNR].toString()
|
||
}
|
||
val1 = ProjectNo
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_AUFTRNR} = ? ";
|
||
}else if( doc.field[Const.gDDF_KNR] != "" && doc.field[Const.gDDF_KNR] != null ) {
|
||
def CustomerNoInput = doc.field[Const.gDDF_KNR].toString();
|
||
def CustomerNo
|
||
|
||
if( CustomerNoInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = CustomerNoInput.split('\\|');
|
||
CustomerNo = str[0];
|
||
} else {
|
||
CustomerNo = doc.field[Const.gDDF_KNR].toString();
|
||
}
|
||
val1 = CustomerNo
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_KNR} = ? ";
|
||
} else if( doc.field[Const.gDDF_KNAME] != "" && doc.field[Const.gDDF_KNAME] != null ) {
|
||
def CustomerNameInput = doc.field[Const.gDDF_KNAME].toString();
|
||
def CustomerName
|
||
def CustomerNo
|
||
|
||
if( CustomerNameInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = CustomerNameInput.split('\\|');
|
||
CustomerNo = str[0];
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte wählen Sie die Kundennummer und den Kundennamen aus der Auswahlliste aus."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
val1 = CustomerNo
|
||
sql = sql + "AND f.dok_dat_feld_${Const.gDDF_KNR} = ? ";
|
||
}
|
||
if( val1 == "" || val1 == null ) {
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
} else {
|
||
resultset = d3.sql.executeAndGet(sql, [val1]);
|
||
}
|
||
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
|
||
List<String> ResRows
|
||
def length
|
||
ResRows = resultset.collect{it.get("SQLKontaktID")};
|
||
length = ResRows.size();
|
||
|
||
if( validate == 1 ) {
|
||
for(int i = 0;i<length;i++) {
|
||
ResRows[i] = resultset[i].get("SQLKontaktID")
|
||
}
|
||
ResRows = ResRows.sort();
|
||
ResRows = ResRows.reverse();
|
||
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
} else {
|
||
for(int i = 0;i<length;i++) {
|
||
if( ( resultset[i].get("SQLAuftragsnr") == "" || resultset[i].get("SQLAuftragsnr") == null ) && ( resultset[i].get("SQLOpportunityNr") == "" || resultset[i].get("SQLOpportunityNr") == null ) ) {
|
||
// Kundenmanagement
|
||
ResRows[i] = "CM|" + resultset[i].get("SQLKundenNr") + "|" + resultset[i].get("SQLKontaktID") + "|" + resultset[i].get("SQLKontaktDatum") + "|" + resultset[i].get("SQLKontaktBeschr")
|
||
} else if ( resultset[i].get("SQLAuftragsnr") != "" && resultset[i].get("SQLAuftragsnr") != null ) {
|
||
// Maschinenprojekt
|
||
ResRows[i] = "PR|" + resultset[i].get("SQLAuftragsnr") + "|" + resultset[i].get("SQLKontaktID") + "|" + resultset[i].get("SQLKontaktDatum") + "|" + resultset[i].get("SQLKontaktBeschr")
|
||
} else {
|
||
// Opportunity
|
||
ResRows[i] = "OP|" + resultset[i].get("SQLOpportunityNr") + "|" + resultset[i].get("SQLKontaktID") + "|" + resultset[i].get("SQLKontaktDatum") + "|" + resultset[i].get("SQLKontaktBeschr")
|
||
}
|
||
}
|
||
ResRows = ResRows.sort();
|
||
ResRows = ResRows.reverse();
|
||
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="SubjectValues")
|
||
def getSubjectValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
d3.getArchive().removeTranslationFromCache("SubjectValues", new Locale("en"));
|
||
d3.getArchive().removeTranslationFromCache("SubjectValues", new Locale("de"));
|
||
|
||
// Ermittlung der Werte für das Feld "Akte"
|
||
// d3.log.error("Groovy - ValueSets: start SubjectValues " + doc.getType().getId());
|
||
if( doc.getType().getId().equals(Const.gDTS_DPRST) && ( doc.field[Const.gDDF_AUFTRNR] != null && !doc.field[Const.gDDF_AUFTRNR].equals("") ) ) {
|
||
|
||
def resultset = d3.sql.executeAndGet("""SELECT distinct(dok_dat_feld_${Const.gDDF_SUBJECT}) as subject
|
||
FROM firmen_spezifisch
|
||
WHERE kue_dokuart = '${Const.gDTS_AAFOL}'
|
||
AND dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${docType.id}'
|
||
AND dok_dat_feld_${Const.gDDF_SUBJECT} <> '${Const.gAK_Projektorganisation}' """);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("subject")});
|
||
return 0;
|
||
|
||
} else if ( doc.getType().getId().equals(Const.gDTS_DPRST) && ( !doc.field[Const.gDDF_OPPNUMMER].equals("") || doc.field[Const.gDDF_OPPNUMMER] == null && doc.field[Const.gDDF_AUFTRNR] == null ) ) {
|
||
List<String> lEmpty = [""]
|
||
repoField.provideValuesForValueSet(lEmpty);
|
||
|
||
} else if( doc.getType().getId().equals(Const.gDTS_AAFOL) ) {
|
||
List<String> keysReesultset = []
|
||
|
||
// Bereitstellung der bisher manuellen Wertemenge "Betreff" (ID 69) für die administrative folders
|
||
def sqlStatement = "SELECT DISTINCT value_char_allowed as value " +
|
||
"FROM doc_field_val_names dfvn " +
|
||
"LEFT JOIN doc_field_values dfv ON dfvn.predef_val_id = dfv.predef_value_id " +
|
||
"WHERE dfvn.predef_val_id = 69 "
|
||
List<GroovyRowResult> sqlResult = d3.sql.executeAndGet(sqlStatement)
|
||
|
||
for(GroovyRowResult grr : sqlResult) {
|
||
def value = grr.get("value")
|
||
|
||
def sqlStatementShortKey = "SELECT DISTINCT dok_dat_feld_${Const.gDFF_SCHLUESSEL} as shortKey " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = 'AZTXT' " +
|
||
"AND dok_dat_feld_${Const.gDDF_ORGENTRY} = '${value}' " +
|
||
"AND dok_dat_feld_${Const.gDFF_SCHLUESSEL} LIKE 'AK%' "
|
||
List<GroovyRowResult> sqlResultShortKey = d3.sql.executeAndGet(sqlStatementShortKey)
|
||
if( sqlResultShortKey.size() > 0 ) {
|
||
keysReesultset.add(sqlResultShortKey.getAt(0).get("shortKey"))
|
||
}
|
||
}
|
||
repoField.provideValuesForValueSet(keysReesultset);
|
||
|
||
} else if ( ( doc.getType().getId().equals(Const.gDTS_DEQUI) ) || ( doc.getType().getId().equals(Const.gDTS_AEQUI) ) ) {
|
||
|
||
// Wertemenge für Equipmentakte abhängig von Aktengruppe
|
||
// Wertemenge soll Werte liefern, die in der AAFOL-Akte enthalten sind
|
||
|
||
def lDokGroup = doc.field[Const.gDDF_DOKGROUP];
|
||
def lFolderGroup = doc.field[Const.gDDF_AKTENGRP];
|
||
|
||
def where = "";
|
||
|
||
if ( ! ( lDokGroup == null || lDokGroup.equals("") ) )
|
||
{
|
||
where = " AND dok_dat_feld_26 in (select dok_dat_feld_48 from firmen_spezifisch where dok_dat_feld_26 = '" + lDokGroup + "') ";
|
||
}
|
||
|
||
if ( ! ( lFolderGroup == null || lFolderGroup.equals("") ) )
|
||
{
|
||
where = where + " AND dok_dat_feld_48 = '" + lFolderGroup + "' ";
|
||
}
|
||
|
||
|
||
//def ergebnis = d3.sql.executeAndGet( "select distinct dok_dat_feld_48 from firmen_spezifisch where kue_dokuart = 'aafol' and dok_dat_feld_48 like 'AK%' and dok_dat_feld_45 = 'DEQUI' " + where + " order by dok_dat_feld_48" );
|
||
def STATEMENT = "select distinct dok_dat_feld_26 from firmen_spezifisch where kue_dokuart = 'aafol' and dok_dat_feld_26 like 'AK%' and dok_dat_feld_45 = 'DEQUI' " + where;
|
||
d3.log.error( STATEMENT );
|
||
def ergebnis = d3.sql.executeAndGet( STATEMENT );
|
||
repoField.provideValuesForValueSet( ergebnis.collect{ it.get("dok_dat_feld_26") } );
|
||
|
||
return 0;
|
||
|
||
} else {
|
||
// Hinweis, da die Dokumentart ECR Dokumente das Attribut "Akte" nicht enthält wurde diese Unterscheidung weggenommen
|
||
// Der ELSE Zweig gilt für Spezifikationsdokumente, Maschinenprojektdokumente, Technikdokumente, Vertriebsdokumente, Dummysuche, Alle Maschinenprojekt- und Opportunitydokumente
|
||
def resultset = d3.sql.executeAndGet("""SELECT distinct(dok_dat_feld_${Const.gDDF_SUBJECT}) as subject
|
||
FROM firmen_spezifisch
|
||
WHERE kue_dokuart = '${Const.gDTS_AAFOL}'
|
||
AND dok_dat_feld_${Const.gDDF_ANWENDUNGSFALL} = '${docType.id}'""");
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("subject")});
|
||
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="SalesgroupValues")
|
||
def getSalesgroupValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Verkäufergruppe
|
||
def resultset
|
||
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_SALESGROUP} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"OR kue_dokuart = '${Const.gDTS_APREN}' " +
|
||
"OR kue_dokuart = '${Const.gDTS_AMPRA}' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
@ValueSet(entrypoint="BauakteValues")
|
||
def getBauakteValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Bauakte
|
||
// 31.07.2017 LIKE nur, wenn gefüllt, wenn kleiner 10.000 alle anzeigen und über die automatische Nachfilterung des Clients
|
||
def resultset
|
||
def lBauprojekt = "%" + doc.field[Const.gDDF_BAUPROJEKT] + "%";
|
||
|
||
if ( doc.getType().getId() == "${Const.gDTS_DBAUD}" || doc.getType().getId() == "${Const.gDTS_ABAUN}" ) {
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_BAUAKTE} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ABAUK}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_BAUPROJEKT} like ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[lBauprojekt]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
// 31.07.2017 Vorschlagswertemenge?
|
||
List<String> ErrResultset = [doc.field[Const.gDDF_BAUAKTE]]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="BauakteUnterValues")
|
||
def getBauakteUnterValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Untergruppe Bauakte
|
||
if ( doc.getType().getId() == "${Const.gDTS_DBAUD}" ) {
|
||
def resultset
|
||
def lBauakte = doc.field[Const.gDDF_BAUAKTE].toString();
|
||
def lBauprojekt = "%" + doc.field[Const.gDDF_BAUPROJEKT].toString() + "%";
|
||
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_UNTERBAUAKTE} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ABAUN}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_BAUAKTE} = ? " +
|
||
"AND dok_dat_feld_${Const.gDDF_BAUPROJEKT} like ? " ;
|
||
resultset = d3.sql.executeAndGet(sql, [lBauakte, lBauprojekt]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
// 31.07.2017 Vorschlagswertemenge?
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_UNTERBAUAKTE]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="BauaktengruppeValues")
|
||
def getBauaktengruppeValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Bauaktengruppe
|
||
if ( doc.getType().getId() == "${Const.gDTS_DBAUD}" || doc.getType().getId() == "${Const.gDTS_ABAUP}" || doc.getType().getId() == "${Const.gDTS_DBAAU}" || doc.getType().getId() == "${Const.gDTS_DBAAS}" || doc.getType().getId() == "${Const.gDTS_DBABE}" || doc.getType().getId() == "${Const.gDTS_DBAGE}" ) {
|
||
def resultset
|
||
def lBauprojekt = doc.field[Const.gDDF_BAUPROJEKT].toString();
|
||
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_BAUAKTENGRUPPE} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ABAUG}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_BAUPROJEKT} like ? " ;
|
||
resultset = d3.sql.executeAndGet(sql, [lBauprojekt]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_BAUAKTENGRUPPE]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="BauprojektValues")
|
||
def getBauprojektValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Bauprojekt
|
||
if( doc.getType().getId() == "${Const.gDTS_DBAUD}" || doc.getType().getId() == "${Const.gDTS_ABAUN}" || doc.getType().getId() == "${Const.gDTS_ABAUP}" ) {
|
||
def resultset
|
||
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_BAUPROJEKT} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ABAUP}' ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
|
||
List<String> ResRows
|
||
ResRows = resultset.collect{it.get("val")};
|
||
|
||
ResRows = ResRows.sort();
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_BAUPROJEKT]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="BauplanaenderungValues")
|
||
def getBauplanaenderungValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für die Bauplanaenderung -> Bauprojekt Unteraktentitel
|
||
// OFF!
|
||
def resultset
|
||
def val1
|
||
def val2
|
||
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_BAUPLANAENDERUNG} as val " +
|
||
"FROM firmen_spezifisch ";
|
||
|
||
if ( doc.getType().getId() == "${Const.gDTS_DBAUD}" && ( doc.field[Const.gDDF_BAUAKTE](1,1) == "8" || doc.field[Const.gDDF_BAUAKTE](1,1) == "4" || doc.field[Const.gDDF_BAUAKTE](1,1) == "6" ) ) {
|
||
sql = sql + "WHERE dok_dat_feld_:gDDF_BAUAKTE = ? " +
|
||
"AND dok_dat_feld_:gDDF_BAUPROJEKT = ? ";
|
||
val1 = doc.field[Const.gDDF_BAUAKTE].toString();
|
||
val2 = doc.field[Const.gDDF_BAUPROJEKT].toString();
|
||
|
||
} else if (doc.getType().getId() == "${Const.gDTS_DBAAU}") {
|
||
sql = sql + "WHERE dok_dat_feld_:gDDF_BAUAKTE = ? " +
|
||
"AND dok_dat_feld_:gDDF_BAUPROJEKT = ? ";
|
||
val1 = gAUSFUEHRUNG
|
||
val2 = doc.field[Const.gDDF_BAUPROJEKT].toString();
|
||
|
||
} else if (doc.getType().getId() == "${Const.gDTS_DBAGE}") {
|
||
sql = sql + "WHERE dok_dat_feld_:gDDF_BAUAKTE = ? " +
|
||
"AND dok_dat_feld_:gDDF_BAUPROJEKT = ? ";
|
||
val1 = gGENEHMIGUNG
|
||
val2 = doc.field[Const.gDDF_BAUPROJEKT].toString();
|
||
|
||
} else if (doc.getType().getId() == "${Const.gDTS_DBABE}") {
|
||
sql = sql + "WHERE dok_dat_feld_:gDDF_BAUAKTE = ? " +
|
||
"AND dok_dat_feld_:gDDF_BAUPROJEKT = ? ";
|
||
val1 = gBESPRECHUNG
|
||
val2 = doc.field[Const.gDDF_BAUPROJEKT].toString();
|
||
|
||
} else if (doc.getType().getId() == "${Const.gDTS_DBAAS}") {
|
||
sql = sql + "WHERE dok_dat_feld_:gDDF_BAUAKTE = ? " +
|
||
"AND dok_dat_feld_:gDDF_BAUPROJEKT = ? ";
|
||
val1 = gAUSSCHREIBUNG
|
||
val2 = doc.field[Const.gDDF_BAUPROJEKT].toString();
|
||
|
||
} else {
|
||
// 31.07.2017 Vorschlagswertemenge?
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_BAUPLANAENDERUNG]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return 0;
|
||
}
|
||
resultset = d3.sql.executeAndGet(sql, [val1, val2]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
}
|
||
|
||
@ValueSet(entrypoint="MappCustomActionValues")
|
||
def getMappCustomActionValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge Zuordnung Kundenkontakt
|
||
// Muss Vorschlag bleiben, da später "bereits zugeordnet" ergänzt wird
|
||
// d3.log.error("MappCustomActionValues " + user.id );
|
||
if( validate == 1 ) {
|
||
def ProjInput = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
def Projectnumber
|
||
def resultset
|
||
List<String> ResRows
|
||
List<String> ResRows2
|
||
def length
|
||
|
||
if( doc.field[Const.gDDF_AUFTRNR] != "" && doc.field[Const.gDDF_AUFTRNR] != null ) {
|
||
if( ProjInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = ProjInput.split('\\|');
|
||
Projectnumber = str[0];
|
||
} else {
|
||
Projectnumber = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
}
|
||
|
||
String sql = "SELECT 'bereits zugeordnet ' + ISNULL(dok_dat_feld_${Const.gDDF_KONTAKTNUMMER},'') + '|' + Convert(Varchar(25), dok_dat_feld_${Const.gDDF_KONTAKTDATE}, 104) + '|' + dok_dat_feld_${Const.gDDF_KDAKTNAME} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AKONT}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_AUFTRNR} = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[Projectnumber]);
|
||
|
||
ResRows = resultset.collect{it.get("val")}
|
||
ResRows2 = resultset.collect{it.get("val")}
|
||
length = ResRows.size()
|
||
// d3.log.error( "length: " + length.toString() );
|
||
|
||
ResRows.each{
|
||
// d3.log.error( "Werte: " + it );
|
||
// d3.log.error( "Länge: " + it.length().toString() );
|
||
if( it.length() > 19 ) {
|
||
|
||
// d3.log.error( "Länger als 19: " + it.length().toString() );
|
||
// d3.log.error( "Länger als 19:-" + it.substring(19) + "-" );
|
||
ResRows2.add( it.substring(19) )
|
||
}
|
||
}
|
||
ResRows2 = ResRows2.sort();
|
||
repoField.provideValuesForValueSet(ResRows2);
|
||
}
|
||
} else {
|
||
def ProjInput = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
def Projectnumber
|
||
def resultset
|
||
if( doc.field[Const.gDDF_AUFTRNR] != "" && doc.field[Const.gDDF_AUFTRNR] != null ) {
|
||
if( ProjInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = ProjInput.split('\\|');
|
||
Projectnumber = str[0];
|
||
} else {
|
||
Projectnumber = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
}
|
||
|
||
String sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_KONTAKTNUMMER},'') + '|' + Convert(Varchar(25), dok_dat_feld_${Const.gDDF_KONTAKTDATE}, 104) + '|' + dok_dat_feld_${Const.gDDF_KDAKTNAME} as val " +
|
||
"FROM firmen_spezifisch as f, phys_datei as p " +
|
||
"WHERE f.kue_dokuart = '${Const.gDTS_AKONT}' " +
|
||
"AND p.frei_o_gesperrt = 'f' " +
|
||
"AND p.doku_id = f.doku_id " +
|
||
"AND f.dok_dat_feld_${Const.gDDF_AUFTRNR} = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[Projectnumber]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
"Bitte wählen Sie zunächst eine Maschinenprojektnummer"
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ActivityIDECRValues")
|
||
def getActivityIDECRValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge ECR AktivitätsID
|
||
// Eingabe: Projektnummer 19 gDDF_AUFTRNR + Unterakte ECR gDTS_AMECR oder ECR Dokument gDTS_DMECR
|
||
// Ausgabe: ECR Aktivitäts ID´s 15 gDDF_AKTIVITAETSID und ECR Beschreibung 24 gDDF_BESCHREIBUNG
|
||
def ProjInput = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
def Projectnumber
|
||
def resultset
|
||
List<String> ResRows
|
||
def length
|
||
List<String> ErrResultset
|
||
|
||
def docFieldValue = doc.docFieldAsString(Const.gDDF_AKTIVITAETSID)
|
||
|
||
// d3.log.error("ActivityIDECRValues DocType/docFieldValue " + docType.id + " " + docFieldValue );
|
||
|
||
if( validate == 1 && user.id != "Master" ) {
|
||
if( ProjInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = ProjInput.split('\\|');
|
||
Projectnumber = str[0];
|
||
} else {
|
||
Projectnumber = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
}
|
||
|
||
String sql = "SELECT ISNULL(fs.dok_dat_feld_${Const.gDDF_AKTIVITAETSID},'') as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AMECR}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_AUFTRNR} = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[Projectnumber]);
|
||
ResRows = resultset.collect{it.get("val")};
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
} else {
|
||
|
||
if ( ( doc.getType().getId() == "${Const.gDTS_AMECR}" || doc.getType().getId() == "${Const.gDTS_DMECR}" ) && doc.field[Const.gDDF_AUFTRNR] != "" && doc.field[Const.gDDF_AUFTRNR] != null ) {
|
||
if( ProjInput.indexOf('|') >= 1 ) {
|
||
String[] str;
|
||
str = ProjInput.split('\\|');
|
||
Projectnumber = str[0];
|
||
} else {
|
||
Projectnumber = doc.field[Const.gDDF_AUFTRNR].toString();
|
||
}
|
||
|
||
String sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_AKTIVITAETSID},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_BESCHREIBUNG},'') as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AMECR}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_AUFTRNR} = ? " +
|
||
"AND fs.doku_id = pd.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " ;
|
||
resultset = d3.sql.executeAndGet(sql,[Projectnumber]);
|
||
// repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
ResRows = resultset.collect{it.get("val")};
|
||
length = ResRows.size();
|
||
|
||
// 31.07.2017 Überprüfung der Funktion
|
||
|
||
if( length > 1000 || length == 0 )
|
||
{
|
||
ErrResultset = [
|
||
"Bitte überprüfen Sie Ihre Eingaben. Es wurden " + length + " Ergebnisse gefunden"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
} else {
|
||
repoField.provideValuesForValueSet(ResRows);
|
||
}
|
||
} else {
|
||
ErrResultset = [
|
||
"Bitte wählen Sie zunächst eine Projektnummer"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="PackageValues")
|
||
def getPackageValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für Vertriebsmedien -> Attributfeld 6 Package
|
||
def lDivision = doc.field[Const.gDDF_DIVISION].getAt(row_no).toString();
|
||
def lMachinesystem = doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no).toString();
|
||
def lMachine = doc.field[Const.gDDF_MACHINE].getAt(row_no).toString();
|
||
def lFunctions = doc.field[Const.gDDF_FUNCTIONS].getAt(row_no).toString();
|
||
def lModules = doc.field[Const.gDDF_MODULES].getAt(row_no).toString();
|
||
def resultset
|
||
|
||
if( doc.getType().getId() == "${Const.gDTS_DVEME}" ) {
|
||
if( doc.field[Const.gDDF_DIVISION].getAt(row_no) != "" && doc.field[Const.gDDF_DIVISION].getAt(row_no) != null && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != "" && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != null && doc.field[Const.gDDF_MACHINE].getAt(row_no) != "" && doc.field[Const.gDDF_MACHINE].getAt(row_no) != null && doc.field[Const.gDDF_FUNCTIONS].getAt(row_no) != "" && doc.field[Const.gDDF_FUNCTIONS].getAt(row_no) != null && doc.field[Const.gDDF_MODULES].getAt(row_no) != "" && doc.field[Const.gDDF_MODULES].getAt(row_no) != null )
|
||
{
|
||
String sql = "SELECT DISTINCT Package as val " +
|
||
"FROM Z_Vertriebsmedien " +
|
||
"WHERE Division = ? " +
|
||
"AND Machinesystem = ? " +
|
||
"AND Machine = ? " +
|
||
"AND Functions = ? " +
|
||
"AND Modules = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
lDivision,
|
||
lMachinesystem,
|
||
lMachine,
|
||
lFunctions,
|
||
lModules
|
||
]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ModulesValues")
|
||
def getModulesValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge 5. Module
|
||
def lDivision = doc.field[Const.gDDF_DIVISION].getAt(row_no).toString();
|
||
def lMachinesystem = doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no).toString();
|
||
def lMachine = doc.field[Const.gDDF_MACHINE].getAt(row_no).toString();
|
||
def lFunctions = doc.field[Const.gDDF_FUNCTIONS].getAt(row_no).toString();
|
||
def resultset
|
||
|
||
if( doc.getType().getId() == "${Const.gDTS_DVEME}" ) {
|
||
if( doc.field[Const.gDDF_DIVISION].getAt(row_no) != "" && doc.field[Const.gDDF_DIVISION].getAt(row_no) != null && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != "" && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != null && doc.field[Const.gDDF_MACHINE].getAt(row_no) != "" && doc.field[Const.gDDF_MACHINE].getAt(row_no) != null && doc.field[Const.gDDF_FUNCTIONS].getAt(row_no) != "" && doc.field[Const.gDDF_FUNCTIONS].getAt(row_no) != null )
|
||
{
|
||
String sql = "SELECT DISTINCT Modules as val " +
|
||
"FROM Z_Vertriebsmedien " +
|
||
"WHERE Division = ? " +
|
||
"AND Machinesystem = ? " +
|
||
"AND Machine = ? " +
|
||
"AND Functions = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
lDivision,
|
||
lMachinesystem,
|
||
lMachine,
|
||
lFunctions
|
||
]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="FunctionsValues")
|
||
def getFunctionsValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge 4. Functions
|
||
def lDivision = doc.field[Const.gDDF_DIVISION].getAt(row_no).toString();
|
||
def lMachinesystem = doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no).toString();
|
||
def lMachine = doc.field[Const.gDDF_MACHINE].getAt(row_no).toString();
|
||
def resultset
|
||
|
||
if( doc.getType().getId() == "${Const.gDTS_DVEME}" ) {
|
||
if( doc.field[Const.gDDF_DIVISION].getAt(row_no) != "" && doc.field[Const.gDDF_DIVISION].getAt(row_no) != null && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != "" && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != null && doc.field[Const.gDDF_MACHINE].getAt(row_no) != "" && doc.field[Const.gDDF_MACHINE].getAt(row_no) != null )
|
||
{
|
||
String sql = "SELECT DISTINCT Functions as val " +
|
||
"FROM Z_Vertriebsmedien " +
|
||
"WHERE Division = ? " +
|
||
"AND Machinesystem = ? " +
|
||
"AND Machine = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
lDivision,
|
||
lMachinesystem,
|
||
lMachine
|
||
]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="MachineValues")
|
||
def getMachineValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge 3. Machine
|
||
def lDivision = doc.field[Const.gDDF_DIVISION].getAt(row_no).toString();
|
||
def lMachinesystem = doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no).toString();
|
||
def resultset
|
||
|
||
if( doc.getType().getId() == "${Const.gDTS_DVEME}" ) {
|
||
if( doc.field[Const.gDDF_DIVISION].getAt(row_no) != "" && doc.field[Const.gDDF_DIVISION].getAt(row_no) != null && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != "" && doc.field[Const.gDDF_MACHINESYSTEM].getAt(row_no) != null )
|
||
{
|
||
String sql = "SELECT DISTINCT Machine as val " +
|
||
"FROM Z_Vertriebsmedien " +
|
||
"WHERE Division = ? " +
|
||
"AND Machinesystem = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[lDivision, lMachinesystem]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="MachineSystemValues")
|
||
def getMachineSystemValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge 2. Machine system
|
||
def lDivision = doc.field[Const.gDDF_DIVISION].getAt(row_no).toString();
|
||
def resultset
|
||
|
||
if( doc.getType().getId() == "${Const.gDTS_DVEME}" ) {
|
||
if( doc.field[Const.gDDF_DIVISION].getAt(row_no) != "" && doc.field[Const.gDDF_DIVISION].getAt(row_no) != null )
|
||
{
|
||
String sql = "SELECT DISTINCT Machinesystem as val " +
|
||
"FROM Z_Vertriebsmedien " +
|
||
"WHERE Division = ? " ;
|
||
resultset = d3.sql.executeAndGet(sql,[lDivision]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="DivisionValues")
|
||
def getDivisionValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge 1. Division
|
||
def resultset
|
||
|
||
if( doc.getType().getId() == "${Const.gDTS_DVEME}" ) {
|
||
String sql = "SELECT DISTINCT Division as val " +
|
||
"FROM Z_Vertriebsmedien ";
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="CaseValues")
|
||
def getCaseValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge Beteiligter Vorgang
|
||
def length
|
||
def resultset
|
||
def ResRows = [];
|
||
int ResCount = 0
|
||
def DocCaption1
|
||
def Admin
|
||
|
||
if( doc.getType().getId() == "${Const.gDTS_DABTE}" )
|
||
{
|
||
if( d3.config.value("d3fc_server_id") == "T" ) {
|
||
Admin = "d3tadm";
|
||
} else if( d3.config.value("d3fc_server_id") == "Q" ) {
|
||
Admin = "d3qadm";
|
||
} else {
|
||
Admin = "d3padm";
|
||
}
|
||
|
||
String sql = "SELECT doku_id as ResDocuId, kue_dokuart as ResKueDokuart " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AOPPU}' " +
|
||
"OR kue_dokuart = '${Const.gDTS_APREN}' " +
|
||
"OR kue_dokuart = '${Const.gDTS_AMPRA}' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
length = resultset.size();
|
||
|
||
for(int i = 0;i<length;i++) {
|
||
|
||
def myDoc = d3.archive.getDocument( resultset[i].get("ResDocuId"), Admin )
|
||
def myCaption = myDoc.getCaption()
|
||
// d3.log.error("myCaption: " + myCaption);
|
||
ResRows.add( myCaption + "~" + resultset[i].get("ResDocuId") );
|
||
}
|
||
ResRows = ResRows.sort();
|
||
|
||
repoField.provideValuesForValueSet(ResRows)
|
||
|
||
if( ResRows.size() > 10000 ) {
|
||
d3.log.error("Funktion entrypoint='CaseValues' muss angepasst werden, es sind mehr als 10.000 Cases in der Auswahl");
|
||
}
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="AttachmentValues")
|
||
def getAttachmentValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge Regelberichte DDF 61 abhängige Anlage
|
||
def resultset
|
||
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_ANLAGE} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_DAREG}' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
@ValueSet(entrypoint="MarketresearchValues")
|
||
def getMarketresearchValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge Marktforschung Projektname
|
||
if( doc.getType().getId() == "${Const.gDTS_DMARK}" ) {
|
||
def resultset
|
||
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_MARKETINGPROJEKT} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AMARK}' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_MARKETINGPROJEKT]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="d3userValues")
|
||
def getd3userValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge d.3 Benutzer
|
||
if ( doc.getType().getId() == "${Const.gDTS_DMARK}" || doc.getType().getId() == "${Const.gDTS_AVEVO}" || doc.getType().getId() == "${Const.gDTS_DVEDO}" ||
|
||
doc.getType().getId() == "${Const.gDTS_AREME}" || doc.getType().getId() == "${Const.gDTS_AMARK}" || doc.getType().getId() == "${Const.gDTS_DABTE}" ||
|
||
doc.getType().getId() == "${Const.gDTS_AHAUP}" || doc.getType().getId() == "${Const.gDTS_DSCHU}" )
|
||
{
|
||
def resultset
|
||
|
||
String sql = "SELECT ISNULL( benutzername, '') + '=' + ISNULL( realname, '') as val " +
|
||
"FROM benutzer " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="EventValues")
|
||
def getEventValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// dynamische Wertemenge für Vorgänge im Bereich Abteilungsvorgänge abhängig zur Dokumentgruppe
|
||
if ( doc.getType().getId() == "${Const.gDTS_DABTE}" && user.id != "d3_async" || (doc.getType().getId() == "${Const.gDTS_AREME}" && validate == 0))
|
||
{
|
||
def lSearch
|
||
List<String> lRestrictionSet = []
|
||
def lQueryString
|
||
def lValues
|
||
String sql
|
||
|
||
println(user.id)
|
||
def lUser = user.id
|
||
|
||
if (doc.field[Const.gDDF_EVENT])
|
||
{
|
||
lSearch = "%" + doc.field[Const.gDDF_EVENT] + "%";
|
||
} else {
|
||
lSearch = "%";
|
||
}
|
||
|
||
//jleu 20190605 - Workaround da API Funktion zur Abfrage von RestrictionSets in Groovy fehlt
|
||
sql = "select mv.value_char from firmen_spezifisch fs, firm_spez_mult_val mv " +
|
||
"where kue_dokuart = '\$SET\$' and fs.doku_id = mv.doku_id and " +
|
||
"fs.dok_dat_feld_48 = 'ORG_Berechtigungen' and fs.dok_dat_feld_49 = '${lUser}'"
|
||
|
||
lRestrictionSet = d3.sql.executeAndGet(sql);
|
||
lRestrictionSet = lRestrictionSet.collect{it.get("value_char")}
|
||
|
||
lValues = lRestrictionSet.toString()
|
||
lValues = lValues.replace("[","")
|
||
lValues = lValues.replace("]","")
|
||
lValues = lValues.split(";")
|
||
|
||
for (int i = 0; i < lValues.size(); i++)
|
||
{
|
||
if (i == 0)
|
||
{
|
||
lQueryString = "'" + lValues[i] + "'"
|
||
} else {
|
||
lQueryString = lQueryString + ",'" + lValues[i] + "'"
|
||
}
|
||
}
|
||
|
||
d3.log.info("RestrictionSet Werte für User " + lUser + " - " + lQueryString)
|
||
|
||
def resultset
|
||
sql = "SELECT DISTINCT fs.dok_dat_feld_${Const.gDDF_EVENT} as val " +
|
||
"FROM firmen_spezifisch fs, firm_spez_mult_val fm " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AREME}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_EVENT} like ? " +
|
||
"AND (fs.dok_dat_feld_${Const.gDDF_CASEOWNER} = ? " +
|
||
"OR fm.value_char = ? AND fm.field_no = '${Const.gDDF_D3USER67}') " +
|
||
"AND fs.doku_id = fm.doku_id " +
|
||
"UNION " +
|
||
"select fs.dok_dat_feld_${Const.gDDF_EVENT} as val " +
|
||
"from firmen_spezifisch fs, firm_spez_mult_val mv " +
|
||
"where fs.kue_dokuart = '${Const.gDTS_AREME}' and fs.doku_id = mv.doku_id " +
|
||
"and mv.field_no = '${Const.gDDF_ORGEINHEITEN}' and mv.value_char in (${lQueryString})"
|
||
|
||
//String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_EVENT} as val " +
|
||
// "FROM firmen_spezifisch " +
|
||
// "WHERE kue_dokuart = '${Const.gDTS_AREME}' " +
|
||
// "AND dok_dat_feld_${Const.gDDF_DOKGROUP} = ? ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[lSearch, lUser, lUser]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> SingleResultset = [doc.field[Const.gDDF_EVENT]]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return 0;
|
||
}
|
||
|
||
}
|
||
|
||
@ValueSet(entrypoint="StructureValues")
|
||
def getStructureValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
//dynamische Wertemenge für Strukturinformationen an Dossier
|
||
if ( doc.getType().getId() == "${Const.gDTS_DOSSI}" )
|
||
{
|
||
def resultset
|
||
|
||
def lTeilVoNr
|
||
def lTeilString
|
||
def lArrayLength
|
||
|
||
if (doc.field[Const.gDDF_TEILVONR])
|
||
{
|
||
lTeilString = doc.field[Const.gDDF_TEILVONR].split("\\|");
|
||
lArrayLength = lTeilString.length
|
||
|
||
if (lArrayLength == 1)
|
||
{
|
||
lTeilVoNr = lTeilString[0];
|
||
} else {
|
||
lTeilVoNr = lTeilString[1];
|
||
}
|
||
} else {
|
||
lTeilVoNr = "";
|
||
}
|
||
|
||
String sql = "SELECT fm.value_char as val " +
|
||
"FROM firmen_spezifisch fs, firm_spez_mult_val fm " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ATEIL}' AND fm.field_no = '${Const.gDDF_STRUKTURINFOS}' AND fs.doku_id = fm.doku_id " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_TEILVONR} = ? ";
|
||
resultset = d3.sql.executeAndGet(sql,[lTeilVoNr]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="MainFolderValues")
|
||
def getMainFolderValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
//dynamische Wertemenge für Hauptakten an Dossier
|
||
if ( (doc.getType().getId() == "${Const.gDTS_DOSSI}" || doc.getType().getId() == "${Const.gDTS_AHAUP}" || doc.getType().getId() == "${Const.gDTS_ATEIL}" || doc.getType().getId() == "${Const.gDTS_DUMMY}") && (user.id != "d3_async" && user.id != "hostimp") )
|
||
{
|
||
def lSearch
|
||
def resultset
|
||
List<String> lRestrictionSet = []
|
||
def lUser = user.id
|
||
def lMainNo
|
||
def lArrayLength
|
||
String sql
|
||
def lValues
|
||
def lQueryString
|
||
|
||
if (doc.field[Const.gDDF_HAUPTVONR])
|
||
{
|
||
lSearch = "%" + doc.field[Const.gDDF_HAUPTVONR] + "%";
|
||
} else {
|
||
lSearch = "%";
|
||
}
|
||
|
||
//jleu 20190605 - Workaround da API Funktion zur Abfrage von RestrictionSets in Groovy fehlt
|
||
sql = "select mv.value_char from firmen_spezifisch fs, firm_spez_mult_val mv " +
|
||
"where kue_dokuart = '\$SET\$' and fs.doku_id = mv.doku_id and " +
|
||
"fs.dok_dat_feld_48 = 'ORG_Berechtigungen' and fs.dok_dat_feld_49 = '${lUser}'"
|
||
|
||
lRestrictionSet = d3.sql.executeAndGet(sql);
|
||
lRestrictionSet = lRestrictionSet.collect{it.get("value_char")}
|
||
|
||
lValues = lRestrictionSet.toString()
|
||
lValues = lValues.replace("[","")
|
||
lValues = lValues.replace("]","")
|
||
lValues = lValues.split(";")
|
||
|
||
for (int i = 0; i < lValues.size(); i++)
|
||
{
|
||
if (i == 0)
|
||
{
|
||
lQueryString = "'" + lValues[i] + "'"
|
||
} else {
|
||
lQueryString = lQueryString + ",'" + lValues[i] + "'"
|
||
}
|
||
}
|
||
|
||
d3.log.info("RestrictionSet Werte für User " + lUser + " - " + lQueryString)
|
||
|
||
//Beim Validate nur nach doku_id suchen
|
||
if (validate == 1)
|
||
{
|
||
if (doc.field[Const.gDDF_HAUPTVONR])
|
||
{
|
||
lMainNo = doc.field[Const.gDDF_HAUPTVONR].split("\\|")
|
||
lSearch = lMainNo[0]
|
||
d3.log.info("Wert validate -${lSearch}-")
|
||
|
||
sql = "SELECT DISTINCT fs.dok_dat_feld_${Const.gDDF_HAUPTVONR} as val " +
|
||
"FROM firmen_spezifisch fs, firm_spez_mult_val fm " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AHAUP}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_HAUPTVONR} = ? " +
|
||
"AND (fs.dok_dat_feld_${Const.gDDF_CASEOWNER} = ? " +
|
||
"OR fm.value_char = ? AND fm.field_no = '${Const.gDDF_D3USER67}') " +
|
||
"AND fs.doku_id = fm.doku_id " +
|
||
"UNION " +
|
||
"select fs.dok_dat_feld_${Const.gDDF_HAUPTVONR} as val " +
|
||
"from firmen_spezifisch fs, firm_spez_mult_val mv " +
|
||
"where fs.kue_dokuart = '${Const.gDTS_AHAUP}' and fs.doku_id = mv.doku_id " +
|
||
"and mv.field_no = '${Const.gDDF_ORGEINHEITEN}' and mv.value_char in (${lQueryString})"
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[lSearch, lUser, lUser]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_HAUPTVONR]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return Const.RETURNCODE_OK;
|
||
}
|
||
//Suche nach Vorgängen für den Benutzer
|
||
} else {
|
||
sql = "SELECT DISTINCT (fs.dok_dat_feld_${Const.gDDF_HAUPTVOBEZ} + '|' + fs.dok_dat_feld_${Const.gDDF_HAUPTVONR}) as val " +
|
||
"FROM firmen_spezifisch fs, firm_spez_mult_val fm " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AHAUP}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_HAUPTVOBEZ} like ? " +
|
||
"AND (fs.dok_dat_feld_${Const.gDDF_CASEOWNER} = ? " +
|
||
"OR fm.value_char = ? AND fm.field_no = '${Const.gDDF_D3USER67}') " +
|
||
"AND fs.doku_id = fm.doku_id " +
|
||
"UNION " +
|
||
"select fs.dok_dat_feld_${Const.gDDF_HAUPTVOBEZ} + '|' + fs.dok_dat_feld_${Const.gDDF_HAUPTVONR} as val " +
|
||
"from firmen_spezifisch fs, firm_spez_mult_val mv " +
|
||
"where fs.kue_dokuart = '${Const.gDTS_AHAUP}' and fs.doku_id = mv.doku_id " +
|
||
"and mv.field_no = '${Const.gDDF_ORGEINHEITEN}' and mv.value_char in (${lQueryString})"
|
||
resultset = d3.sql.executeAndGet(sql,[lSearch, lUser, lUser]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_HAUPTVONR]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return Const.RETURNCODE_OK;
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="SubFolderValues")
|
||
def getSubFolderValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
//dynamische Wertemenge für Hauptakten an Dossier
|
||
if ( doc.getType().getId() == "${Const.gDTS_DOSSI}" || doc.getType().getId() == "${Const.gDTS_AHAUP}" )
|
||
{
|
||
if (doc.field[Const.gDDF_HAUPTVONR])
|
||
{
|
||
def resultset
|
||
def lMainNo = doc.field[Const.gDDF_HAUPTVONR].split("\\|")
|
||
def lArrayLength = lMainNo.length
|
||
def lMain
|
||
String sql
|
||
|
||
println(lArrayLength)
|
||
|
||
if (lArrayLength == 1)
|
||
{
|
||
sql = "SELECT dok_dat_feld_${Const.gDDF_TEILVONR} as val ";
|
||
lMain = lMainNo[0]
|
||
} else {
|
||
sql = "SELECT dok_dat_feld_${Const.gDDF_TEILVOBEZ} + '|' + dok_dat_feld_${Const.gDDF_TEILVONR} as val ";
|
||
lMain = lMainNo[1]
|
||
}
|
||
|
||
sql = sql + "FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ATEIL}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_HAUPTVONR} = ? ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[lMain]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_TEILVONR]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return Const.RETURNCODE_OK;
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ContractNoValues")
|
||
def getContractNoValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
//dynamische Wertemenge für Vertragsnummer intern
|
||
if ( doc.getType().getId() == "${Const.gDTS_EVDOK}" || doc.getType().getId() == "${Const.gDTS_EVUNT}" )
|
||
{
|
||
def resultset
|
||
def lSearch
|
||
String sql
|
||
|
||
if (doc.field[Const.gDDF_CONTRACTNO])
|
||
{
|
||
lSearch = "%" + doc.field[Const.gDDF_CONTRACTNO] + "%";
|
||
} else {
|
||
lSearch = "%";
|
||
}
|
||
|
||
sql = "SELECT dok_dat_feld_${Const.gDDF_CONTRACTNO} + '|' + dok_dat_feld_${Const.gDDF_CONTRACTNAME} as val " +
|
||
"FROM firmen_spezifisch where kue_dokuart in ('${Const.gDTS_EVERT}','${Const.gDTS_RVERT}') " +
|
||
"AND dok_dat_feld_${Const.gDDF_CONTRACTNO} like ?"
|
||
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[lSearch]);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else {
|
||
List<String> SingleResultset = [
|
||
doc.field[Const.gDDF_CONTRACTNO]
|
||
]
|
||
repoField.provideValuesForValueSet(SingleResultset)
|
||
return Const.RETURNCODE_OK;
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="SupplierNoValues")
|
||
def getSupplierNoValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Ermittlung der Werte für das Feld "Akte"
|
||
// d3.log.error("Groovy - ValueSets: start SubjectValues " + doc.getType().getId());
|
||
|
||
def resultset
|
||
def lSearch
|
||
def lSearch1
|
||
def lSearch2
|
||
def lSearch3
|
||
String sql
|
||
def val1 = ""
|
||
|
||
if( repoField.getPreferedFieldNumber() == Const.gDDF_WEITLIEFNR )
|
||
{
|
||
d3.log.info("Nummer 1");
|
||
if( doc.field[Const.gDDF_WEITLIEFNR].getAt(row_no) )
|
||
{
|
||
val1 = doc.field[Const.gDDF_WEITLIEFNR].getAt(row_no).toString() + "%"
|
||
if ( val1.length() > 3 )
|
||
{
|
||
lSearch1 = "%" + val1 + "%";
|
||
lSearch2 = val1 + "%";
|
||
lSearch3 = val1;
|
||
}
|
||
d3.log.info("val1 " + val1 );
|
||
d3.log.info("lSearch1 " + lSearch1 );
|
||
d3.log.info("lSearch2 " + lSearch2 );
|
||
d3.log.info("lSearch3 " + lSearch3 );
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if( doc.field[Const.gDDF_LNR] )
|
||
{
|
||
val1 = doc.field[Const.gDDF_LNR].toString() + "%"
|
||
if ( val1.length() > 3 )
|
||
{
|
||
lSearch1 = "%" + val1 + "%";
|
||
lSearch2 = val1 + "%";
|
||
lSearch3 = val1;
|
||
}
|
||
}
|
||
}
|
||
sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_LNR},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_LNAME},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_LNAME2},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_LLAND},'') + '|' + ISNULL(dok_dat_feld_${Const.gDDF_LORT},'') as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ALIEF}' "
|
||
|
||
if ( val1.length() > 3 )
|
||
{
|
||
sql = sql + "AND ( dok_dat_feld_${Const.gDDF_LNAME} like ? OR dok_dat_feld_${Const.gDDF_LNAME} like ? OR dok_dat_feld_${Const.gDDF_LNAME} like ? " +
|
||
"OR dok_dat_feld_${Const.gDDF_LNR} like ? OR dok_dat_feld_${Const.gDDF_LNR} like ? OR dok_dat_feld_${Const.gDDF_LNR} like ? ) "
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
lSearch1,
|
||
lSearch2,
|
||
lSearch3,
|
||
lSearch1,
|
||
lSearch2,
|
||
lSearch3
|
||
]);
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
return 0;
|
||
}
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens drei Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
|
||
// 06.09.2018: Auf Wunsch von Frau Luk wird eine Leersuche nicht mehr unterstützt
|
||
// lSearch = "%";
|
||
// sql = sql + "AND dok_dat_feld_${Const.gDDF_LNAME} like ? "
|
||
|
||
// resultset = d3.sql.executeAndGet(sql,[lSearch]);
|
||
// d3.log.error( "Es wurden ${resultset.size()} Lieferanten gefunden. Eingabe: ${doc.field[Const.gDDF_LNAME]}" )
|
||
// if( resultset.size() >= 10000 ) {
|
||
// List<String> ErrResultset = ["Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."]
|
||
// repoField.provideValuesForValueSet(ErrResultset)
|
||
// return 0;
|
||
// } else {
|
||
// repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
// return 0;
|
||
// }
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="SupplierNameValues")
|
||
def getSupplierNameValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Ermittlung des Lieferantennamens
|
||
// Die Ermittlung erfolgt nun generell per d.3 Akte "Lieferantenakte" (ALIEF)
|
||
// Ausnahme: Lieferantenkontaktdokument (DLIMA), hier wird die Lieferantenauswahl anhand Projekt/Opportunitynummer eingeschränkt
|
||
|
||
// d3.log.error("Ermittlung des Lieferantennamens ${docType.id}")
|
||
|
||
def lCallID = d3.remote.getVersion()[0..2];
|
||
// d3.log.error("lCallID ${lCallID}")
|
||
|
||
// Vorherige Programmierung:
|
||
// CallID 220 d.3 Import
|
||
// CallID 231 Change Attribute DXP
|
||
// CallID 200 d.xplorer
|
||
|
||
// Bei Dokumenten wird immer komplett eingeschränkt:
|
||
// if ( ldokuartShort == "D" )
|
||
// {
|
||
// lSearchParamCutSet = "X"
|
||
// }
|
||
// Bei Akten wird NICHT eingeschränkt bei
|
||
// - 220 d.3 Import und 231 Change Attribute DXP
|
||
// - 200 d.xplorer wenn der Buchungskreis gefüllt ist
|
||
// Bei Akten wird eingeschränkt, wenn es der d.xplorer ist und der Buchungskreis leer ist (Suche)
|
||
// else
|
||
// {
|
||
// if ( lCallID == "220" || lCallID == "231" )
|
||
// {
|
||
// lSearchParamCutSet = ""
|
||
// }
|
||
// else if ( lCallID == "200" && dok_dat_feld[gDDF_BUCHKREIS] != "" )
|
||
// {
|
||
// lSearchParamCutSet = ""
|
||
// }
|
||
// else if ( lCallID == "200" && dok_dat_feld[gDDF_BUCHKREIS] == "" )
|
||
// {
|
||
// lSearchParamCutSet = "X"
|
||
// }
|
||
// else
|
||
// {
|
||
// lSearchParamCutSet = "X"
|
||
// }
|
||
// }
|
||
|
||
def resultset
|
||
def Additionalresultset
|
||
def lSearch1
|
||
def lSearch2
|
||
def lSearch3
|
||
def lSearch4
|
||
def lALIKOSearch
|
||
def lOppNoInput
|
||
def lProjNoInput
|
||
String[] str;
|
||
String sql
|
||
def lSupplierNames
|
||
List<String> AdditionalResults = []
|
||
def val1 = doc.field[Const.gDDF_LNAME].toString() + "%"
|
||
def length
|
||
length = val1.length();
|
||
|
||
// if( docType.id != Const.gDTS_DLIKO && docType.id != Const.gDTS_ALIKO )
|
||
// Besonderheit Projektlieferantendokumente (DLIKO): Hier wird der Lieferant aus den Projektliefertanten (ALIKO) ausgewählt.
|
||
if( docType.id != Const.gDTS_DLIKO )
|
||
{
|
||
// Grundsätzliche Erstellung des MSSQL Statements je nach Dokumentart. Es gibt 14 Dokumentarten, in denen der Lieferanten_Name verfügbar ist
|
||
// Sonderfälle sind hier Projektliefertanten (ALIKO) und Projektlieferantendokumente (DLIKO), aus dem Grund die hier programmierten Ausnahmen
|
||
if( docType.id == Const.gDTS_ALIKO && lCallID == "200" && ( doc.field[Const.gDDF_BUCHKREIS] == "" || doc.field[Const.gDDF_BUCHKREIS] == null ) )
|
||
{
|
||
// Bei der Suche innerhalb der Projektlieferantenakte (Erkennung per 200 d.xplorer und leerem Buchungskreis)
|
||
// wird die Suche anhand Opportunity/Projektnummer ggf. eingeschränkt und nur über Projektlieferant (ALIKO) gesucht
|
||
// gDDF_LNR gDDF_LNAME gDDF_LNAME2 gDDF_LLAND gDDF_LORT
|
||
lALIKOSearch = 1
|
||
sql = "SELECT DISTINCT ISNULL(fs.dok_dat_feld_${Const.gDDF_LNR},'') as LNR, ISNULL(fs.dok_dat_feld_${Const.gDDF_LNAME},'') as LName " +
|
||
"FROM firmen_spezifisch fs, phys_datei pd " +
|
||
"WHERE pd.doku_id = fs.doku_id " +
|
||
"AND fs.kue_dokuart = '${Const.gDTS_ALIKO}' " +
|
||
"AND pd.frei_o_gesperrt = 'f'"
|
||
|
||
if( doc.field[Const.gDDF_AUFTRNR] && !doc.field[Const.gDDF_OPPNUMMER] ) {
|
||
lProjNoInput = doc.field[Const.gDDF_AUFTRNR]
|
||
if( lProjNoInput.indexOf('|') >= 1 ) {
|
||
str = lProjNoInput.split('\\|');
|
||
lProjNoInput = str[0];
|
||
}
|
||
sql = sql + "AND fs.dok_dat_feld_${Const.gDDF_AUFTRNR} = '${lProjNoInput}' "
|
||
} else if( !doc.field[Const.gDDF_AUFTRNR] && doc.field[Const.gDDF_OPPNUMMER] ) {
|
||
lOppNoInput = doc.field[Const.gDDF_OPPNUMMER]
|
||
if( lOppNoInput.indexOf('|') >= 1 ) {
|
||
str = lOppNoInput.split('\\|');
|
||
lOppNoInput = str[0];
|
||
}
|
||
sql = sql + "AND fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} = '${lOppNoInput}' "
|
||
}
|
||
}
|
||
else
|
||
{
|
||
// Bei allen anderen Dokumentarten, außer Projektlieferantendokumnte DLIKO, erfolgt keine Einschränkung
|
||
sql = "SELECT ISNULL(fs.dok_dat_feld_${Const.gDDF_LNR},'') + '|' + ISNULL(fs.dok_dat_feld_${Const.gDDF_LNAME},'') + '|' + ISNULL(fs.dok_dat_feld_${Const.gDDF_LNAME2},'') + '|' + ISNULL(fs.dok_dat_feld_${Const.gDDF_LLAND},'') + '|' + ISNULL(fs.dok_dat_feld_${Const.gDDF_LORT},'') as val " +
|
||
"FROM firmen_spezifisch fs, phys_datei pd " +
|
||
"WHERE pd.doku_id = fs.doku_id " +
|
||
"AND fs.kue_dokuart = '${Const.gDTS_ALIEF}' " +
|
||
"AND pd.frei_o_gesperrt = 'f'"
|
||
}
|
||
|
||
// Hier erfolgt eine weitere Einschränkung des MSSQL Statements auf den Lieferantennamen.
|
||
// Falls kein Name (mind. 3 Zeichen) angegeben wurde und es keine Suche nach einem Projektliefertanten (ALIKO) ist wird ein Fehler ausgegeben.
|
||
if ( ( val1.length() > 3 && doc.field[Const.gDDF_LNAME] ) || (docType.id == Const.gDTS_ALIKO && lCallID == "200" && ( doc.field[Const.gDDF_BUCHKREIS] == "" || doc.field[Const.gDDF_BUCHKREIS] == null )) )
|
||
{
|
||
if( doc.field[Const.gDDF_LNAME] )
|
||
{
|
||
lSearch1 = "%" + doc.field[Const.gDDF_LNAME] + "%";
|
||
lSearch2 = doc.field[Const.gDDF_LNAME] + "%";
|
||
lSearch3 = doc.field[Const.gDDF_LNAME];
|
||
|
||
// IMUE 12.03.2019 - das Verhalten bei Kundenname und Lieferantname war anders - bei Kundenname konnte auch nach Nummer gefiltert werden, bei Lieferantname nicht, daher Änderung der SQL Abfrage notwendig
|
||
//sql = sql + "AND ( fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? )"
|
||
|
||
sql = sql + "AND ( fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR " +
|
||
"fs.dok_dat_feld_${Const.gDDF_LNR} like ? OR fs.dok_dat_feld_${Const.gDDF_LNR} like ? OR fs.dok_dat_feld_${Const.gDDF_LNR} like ? ) ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
lSearch1,
|
||
lSearch2,
|
||
lSearch3,
|
||
lSearch1,
|
||
lSearch2,
|
||
lSearch3
|
||
]);
|
||
}
|
||
else
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
if( lALIKOSearch == 1 ){
|
||
|
||
resultset.each {
|
||
if( it.LNR != "" ) {
|
||
sql = "SELECT ISNULL(fs.dok_dat_feld_${Const.gDDF_LNAME2},'') as LName2, ISNULL(fs.dok_dat_feld_${Const.gDDF_LLAND},'') as LLand, ISNULL(fs.dok_dat_feld_${Const.gDDF_LORT},'') as LOrt " +
|
||
"FROM firmen_spezifisch fs, phys_datei pd " +
|
||
"WHERE pd.doku_id = fs.doku_id " +
|
||
"AND fs.kue_dokuart = '${Const.gDTS_ALIEF}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_LNAME} = '$it.LName' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_LNR} = '$it.LNR' " +
|
||
"AND pd.frei_o_gesperrt = 'f' "
|
||
|
||
Additionalresultset = d3.sql.executeAndGet(sql);
|
||
|
||
if( Additionalresultset.size() == 1 ) {
|
||
def TMPLieferantenname = it.LName
|
||
def TMPLieferantennr = it.LNR
|
||
|
||
if( TMPLieferantennr == "" )
|
||
TMPLieferantennr = "d3"
|
||
|
||
Additionalresultset.each{
|
||
AdditionalResults.add( TMPLieferantennr + "|" + TMPLieferantenname + "|" + it.LName2 + "|" + it.LLand + "|" + it.Lort )
|
||
}
|
||
} else {
|
||
def TMPLieferantenname = it.LName
|
||
def TMPLieferantennr = it.LNR
|
||
|
||
if( TMPLieferantennr == "" )
|
||
TMPLieferantennr = "d3"
|
||
|
||
AdditionalResults.add( TMPLieferantennr + "|" + it.LName + "|||" )
|
||
}
|
||
|
||
} else {
|
||
def TMPLieferantenname = it.LName
|
||
def TMPLieferantennr = it.LNR
|
||
|
||
if( TMPLieferantennr == "" )
|
||
TMPLieferantennr = "d3"
|
||
|
||
AdditionalResults.add( TMPLieferantennr + "|" + it.LName + "|||" )
|
||
}
|
||
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(AdditionalResults)
|
||
|
||
// lSupplierNames =
|
||
|
||
// repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
return 0;
|
||
} else {
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
return 0;
|
||
}
|
||
}
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens drei Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
|
||
// 06.09.2018: Auf Wunsch von Frau Luk wird eine Leersuche nicht mehr unterstützt
|
||
// lSearch1 = "%";
|
||
|
||
// sql = sql + "AND dok_dat_feld_${Const.gDDF_LNAME} like ? "
|
||
|
||
// resultset = d3.sql.executeAndGet(sql,[lSearch1]);
|
||
// d3.log.error( "Es wurden ${resultset.size()} Lieferanten gefunden. Eingabe: ${doc.field[Const.gDDF_LNAME]}" )
|
||
// if( resultset.size() >= 10000 ) {
|
||
// List<String> ErrResultset = ["Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."]
|
||
// repoField.provideValuesForValueSet(ErrResultset)
|
||
// return 0;
|
||
// } else {
|
||
// repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
// return 0;
|
||
// }
|
||
}
|
||
} else {
|
||
sql = "SELECT DISTINCT ISNULL(fs.dok_dat_feld_${Const.gDDF_LNR},'') as LNR, ISNULL(fs.dok_dat_feld_${Const.gDDF_LNAME},'') as LName " +
|
||
"FROM firmen_spezifisch fs, phys_datei pd " +
|
||
"WHERE pd.doku_id = fs.doku_id " +
|
||
"AND fs.kue_dokuart = '${Const.gDTS_ALIKO}' " +
|
||
"AND pd.frei_o_gesperrt = 'f'"
|
||
|
||
// IMUE 27.02.2019 - OPG-2105 - Änderung bei der Suche
|
||
//if( lCallID == "200" && ( doc.field[Const.gDDF_BUCHKREIS] == "" || doc.field[Const.gDDF_BUCHKREIS] == null )) {
|
||
// // Bei der Suche - Mache was anderes
|
||
// sql = "SELECT DISTINCT ISNULL(fs.dok_dat_feld_${Const.gDDF_LNR},'') as LNR, ISNULL(fs.dok_dat_feld_${Const.gDDF_LNAME},'') as LName " +
|
||
// "FROM firmen_spezifisch fs, phys_datei pd " +
|
||
// "WHERE pd.doku_id = fs.doku_id " +
|
||
// "AND fs.kue_dokuart = '${Const.gDTS_ALIKO}' " +
|
||
// "AND pd.frei_o_gesperrt = 'f'"
|
||
//} else {
|
||
if( doc.field[Const.gDDF_AUFTRNR] && !doc.field[Const.gDDF_OPPNUMMER] ) {
|
||
lProjNoInput = doc.field[Const.gDDF_AUFTRNR]
|
||
if( lProjNoInput.indexOf('|') >= 1 ) {
|
||
str = lProjNoInput.split('\\|');
|
||
lProjNoInput = str[0];
|
||
}
|
||
sql = sql + "AND fs.dok_dat_feld_${Const.gDDF_AUFTRNR} = '${lProjNoInput}' "
|
||
} else if( !doc.field[Const.gDDF_AUFTRNR] && doc.field[Const.gDDF_OPPNUMMER] ) {
|
||
lOppNoInput = doc.field[Const.gDDF_OPPNUMMER]
|
||
if( lOppNoInput.indexOf('|') >= 1 ) {
|
||
str = lOppNoInput.split('\\|');
|
||
lOppNoInput = str[0];
|
||
}
|
||
sql = sql + "AND fs.dok_dat_feld_${Const.gDDF_OPPNUMMER} = '${lOppNoInput}' "
|
||
} else {
|
||
if( lCallID == "200" && ( doc.field[Const.gDDF_BUCHKREIS] == "" || doc.field[Const.gDDF_BUCHKREIS] == null )) {
|
||
// IMUE 27.02.2019 - OPG-2105 - in der Suche ist die Eingabe der Oppertuntiy oder Maschinenprojekt kein Pflicht, wenn diese aber eingegeben wird, soll das Ergebnis trotzdem beschränkt werden
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte wählen Sie zunächst entweder Opportunity oder Maschinenprojekt aus."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
}
|
||
}
|
||
//}
|
||
|
||
if (doc.field[Const.gDDF_LNAME]) {
|
||
lSearch1 = "%" + doc.field[Const.gDDF_LNAME] + "%";
|
||
lSearch2 = doc.field[Const.gDDF_LNAME] + "%";
|
||
lSearch3 = doc.field[Const.gDDF_LNAME];
|
||
|
||
// IMUE 12.03.2019 - das Verhalten bei Kundenname und Lieferantname war anders - bei Kundenname konnte auch nach Nummer gefiltert werden, bei Lieferantname nicht, daher Änderung der SQL Abfrage notwendig
|
||
// sql = sql + "AND ( fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? ) "
|
||
|
||
sql = sql + "AND ( fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR fs.dok_dat_feld_${Const.gDDF_LNAME} like ? OR " +
|
||
"fs.dok_dat_feld_${Const.gDDF_LNR} like ? OR fs.dok_dat_feld_${Const.gDDF_LNR} like ? OR fs.dok_dat_feld_${Const.gDDF_LNR} like ? ) ";
|
||
|
||
resultset = d3.sql.executeAndGet(sql,[
|
||
lSearch1,
|
||
lSearch2,
|
||
lSearch3,
|
||
lSearch1,
|
||
lSearch2,
|
||
lSearch3
|
||
]);
|
||
} else {
|
||
lSearch1 = "%";
|
||
sql = sql + "AND fs.dok_dat_feld_${Const.gDDF_LNAME} like ? "
|
||
resultset = d3.sql.executeAndGet(sql,[lSearch1]);
|
||
}
|
||
|
||
resultset.each {
|
||
if( it.LNR != "" ) {
|
||
sql = "SELECT ISNULL(fs.dok_dat_feld_${Const.gDDF_LNAME2},'') as LName2, ISNULL(fs.dok_dat_feld_${Const.gDDF_LLAND},'') as LLand, ISNULL(fs.dok_dat_feld_${Const.gDDF_LORT},'') as LOrt " +
|
||
"FROM firmen_spezifisch fs, phys_datei pd " +
|
||
"WHERE pd.doku_id = fs.doku_id " +
|
||
"AND fs.kue_dokuart = '${Const.gDTS_ALIEF}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_LNAME} = '$it.LName' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_LNR} = '$it.LNR' " +
|
||
"AND pd.frei_o_gesperrt = 'f' "
|
||
|
||
Additionalresultset = d3.sql.executeAndGet(sql);
|
||
|
||
if( Additionalresultset.size() == 1 ) {
|
||
def TMPLieferantenname = it.LName
|
||
def TMPLieferantennr = it.LNR
|
||
|
||
if( TMPLieferantennr == "" )
|
||
TMPLieferantennr = "d3"
|
||
|
||
Additionalresultset.each{
|
||
AdditionalResults.add( TMPLieferantennr + "|" + TMPLieferantenname + "|" + it.LName2 + "|" + it.LLand + "|" + it.Lort )
|
||
|
||
}
|
||
} else {
|
||
def TMPLieferantenname = it.LName
|
||
def TMPLieferantennr = it.LNR
|
||
|
||
if( TMPLieferantennr == "" )
|
||
TMPLieferantennr = "d3"
|
||
|
||
AdditionalResults.add( TMPLieferantennr + "|" + it.LName + "|||" )
|
||
}
|
||
|
||
} else {
|
||
def TMPLieferantenname = it.LName
|
||
def TMPLieferantennr = it.LNR
|
||
|
||
if( TMPLieferantennr == "" )
|
||
TMPLieferantennr = "d3"
|
||
|
||
AdditionalResults.add( TMPLieferantennr + "|" + it.LName + "|||" )
|
||
}
|
||
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(AdditionalResults)
|
||
|
||
// lSupplierNames =
|
||
|
||
// repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="SupplierContactDescription")
|
||
def getSupplierContactDescriptionValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
def appID
|
||
try {
|
||
appID = d3.remote.getVersion()[0..2];
|
||
} catch (Exception e) {
|
||
d3.log.error("Exception on d3.remote.getVersion = " + e);
|
||
}
|
||
// wenn ALONT und Import / Update dann leere Wertemenge
|
||
if(docType.getId().equals(Const.gDTS_ALONT) && appID == '220') {
|
||
// IMPORT und UPDATE
|
||
List<String> Results = []
|
||
repoField.provideValuesForValueSet(Results);
|
||
return 0;
|
||
|
||
} else {
|
||
// gDDF_KONTAKTDATE, gDDF_KDAKTKAT, gDDF_KDAKTBESCH
|
||
def sql
|
||
def resultset
|
||
def TMPLNR
|
||
String[] str
|
||
List<String> AdditionalResults = []
|
||
List<String> KategorieResult = []
|
||
|
||
if( doc.field[Const.gDDF_LNR] ) {
|
||
TMPLNR = doc.field[Const.gDDF_LNR]
|
||
if( TMPLNR.indexOf('|') >= 1 ) {
|
||
str = TMPLNR.split('\\|');
|
||
TMPLNR = str[0];
|
||
}
|
||
|
||
if( validate == 1 ) {
|
||
|
||
if( docType.id == Const.gDTS_ALONT ) {
|
||
List<String> NewResultset = [
|
||
doc.field[Const.gDDF_KONTAKTBESCH]
|
||
]
|
||
repoField.provideValuesForValueSet(NewResultset)
|
||
} else {
|
||
sql = "SELECT ISNULL(dok_dat_feld_${Const.gDDF_KONTAKTBESCH},'') as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ALONT}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_LNR} = '${TMPLNR}' "
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
return 0;
|
||
}
|
||
} else {
|
||
|
||
// IMUE 02.04.2019 - Ergänzung, das nur Akten angegeben werden, die nicht den Status "Freigabe/gesperrt" haben - https://jira.d-velop.de/browse/OPG-2135
|
||
sql = "SELECT ISNULL(CONVERT(varchar, fs.dok_dat_feld_${Const.gDDF_KONTAKTDATE}, 104),'') as date, ISNULL(fs.dok_dat_feld_${Const.gDDF_LIEFAKTKAT},'') as kdkat, ISNULL(fs.dok_dat_feld_${Const.gDDF_KONTAKTBESCH},'') as kdbsch " +
|
||
"FROM firmen_spezifisch fs " +
|
||
"LEFT JOIN doc_versions dv ON fs.doku_id = dv.doc_id " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ALONT}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_LNR} = '${TMPLNR}' " +
|
||
"AND dv.doc_state LIKE 'fr' AND dv.block_date IS NULL "
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
|
||
resultset.each{
|
||
def KontDate = it.date
|
||
def KontBesch = it.kdbsch
|
||
def lang = d3.remote.language
|
||
|
||
// IMUE 16.04.2019 - Umstellung der Wertemenge durch KD - somit hat sich die ID von 52 (Kategorie) auf 125 (Kategorie_Lieferant) geändert
|
||
sql = "SELECT value_char_transl as kdkattransl FROM doc_field_val_lang WHERE language = '${lang}' AND predef_value_id = '${SystemSpecificConst.gPredValueIDKatLief}' AND value_char_allowed = '${it.kdkat}' "
|
||
KategorieResult = d3.sql.executeAndGet(sql);
|
||
|
||
KategorieResult.each{
|
||
AdditionalResults.add( KontDate + "|" + it.kdkattransl + "|" + KontBesch )
|
||
|
||
}
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(AdditionalResults);
|
||
|
||
return 0;
|
||
}
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte wählen Sie zuerst eine Lieferant_Nr aus."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
// 07.2019 wird produktiv noch nicht genutzt
|
||
@ValueSet(entrypoint="MachineDocumentModuls")
|
||
def getMachineDocumentsModuls(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
|
||
|
||
/*
|
||
// Create a trust manager that does not validate certificate chains -> entfernt 13.02.2019
|
||
Dafür ist es erforderlich das Zertifikat in Java als vertrauenswürdig hinzuzufügen:
|
||
cd D:\d3\d3server.prg\JRE\bin keytool.exe -import -keystore "D:\d3\d3server.prg\JRE\lib\security\cacerts" -file "E:\optima_group_ca.cer"
|
||
*/
|
||
|
||
List<String> modulsResultset = [];
|
||
|
||
// Information ob Suchdialog oder Importdialog
|
||
def appID
|
||
try {
|
||
appID = d3.remote.getVersion()[0..2];
|
||
} catch (Exception e) {
|
||
d3.log.error("Exception on d3.remote.getVersion = " + e);
|
||
}
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url;
|
||
/*
|
||
* wenn der Import- oder Updatedialog aufgerufen wird, sollen nur die "nicht gelöschten" Objekte angezeigt werden (Deleted = false)
|
||
* bei der Suche sollen nur bereits verwendete Eigenschaften angezeigt werden
|
||
* Lösungsweg:
|
||
* appID -- 200 = d.xplorer | 220 = d.3 import
|
||
* verstecktes Attribut das immer gefüllt ist -- Suche = null | Update = <Auswahl Feldnr/Wert> | Import = null
|
||
*/
|
||
if(appID == '220' || doc.field[Const.gDDF_VERSIONINTERN] != null) {
|
||
// IMPORT und UPDATE
|
||
url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/ModuleSet?$filter=Deleted%20eq%20false%20&$format=json&$orderby=Id');
|
||
} else if(appID == '200') {
|
||
// SUCHE
|
||
String query = "SELECT DISTINCT fs.dok_dat_feld_" + Const.gDDF_MODULM + " as value FROM firmen_spezifisch fs WHERE fs.kue_dokuart = '" + Const.gDTS_DERZ1 + "' AND fs.dok_dat_feld_" + Const.gDDF_MODULM + " IS NOT NULL";
|
||
List<GroovyRowResult> result = d3.sql.executeAndGet(query);
|
||
for(GroovyRowResult grr : result) {
|
||
modulsResultset.add(grr.get("value"));
|
||
}
|
||
} else {
|
||
url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/ModuleSet?$format=json&$orderby=Id');
|
||
}
|
||
|
||
try {
|
||
if(url != null) {
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
for (int i = 0; i < arr.length(); i++)
|
||
{
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
// Eindeutige GUID
|
||
String guid = metadataObj.getString("GUID");
|
||
|
||
modulsResultset.add(guid);
|
||
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error( " ## ValueSet for MachineDocumentsFunctions - Exception = " + e.getMessage() );
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(modulsResultset)
|
||
|
||
}
|
||
|
||
// 07.2019 wird produktiv noch nicht genutzt
|
||
@ValueSet(entrypoint="MachineDocumentFunctions")
|
||
def getMachineDocumentsFunctions(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
|
||
|
||
/*
|
||
// Create a trust manager that does not validate certificate chains -> entfernt 13.02.2019
|
||
Dafür ist es erforderlich das Zertifikat in Java als vertrauenswürdig hinzuzufügen:
|
||
cd D:\d3\d3server.prg\JRE\bin keytool.exe -import -keystore "D:\d3\d3server.prg\JRE\lib\security\cacerts" -file "E:\optima_group_ca.cer"
|
||
*/
|
||
|
||
List<String> functionsResultset = [];
|
||
|
||
// Information ob Suchdialog oder Importdialog
|
||
def appID
|
||
try {
|
||
appID = d3.remote.getVersion()[0..2];
|
||
} catch (Exception e) {
|
||
d3.log.error("Exception on d3.remote.getVersion = " + e);
|
||
}
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url;
|
||
/*
|
||
* wenn der Import- oder Updatedialog aufgerufen wird, sollen nur die "nicht gelöschten" Objekte angezeigt werden (Deleted = false)
|
||
* bei der Suche sollen nur bereits verwendete Eigenschaften angezeigt werden
|
||
* Lösungsweg:
|
||
* appID -- 200 = d.xplorer | 220 = d.3 import
|
||
* verstecktes Attribut das immer gefüllt ist -- Suche = null | Update = <Auswahl Feldnr/Wert> | Import = null
|
||
*/
|
||
if(appID == '220' || doc.field[Const.gDDF_VERSIONINTERN] != null) {
|
||
// IMPORT und UPDATE
|
||
url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/FunctionSet?$filter=Deleted%20eq%20false%20&$format=json&$orderby=Id');
|
||
} else if(appID == '200') {
|
||
// SUCHE
|
||
String query = "SELECT DISTINCT fsmv.value_char as value FROM firmen_spezifisch fs LEFT JOIN firm_spez_mult_val fsmv on fs.doku_id = fsmv.doku_id WHERE fs.kue_dokuart = '" + Const.gDTS_DERZ1 + "' AND fsmv.field_no = '" + Const.gDDF_FUNKTIONM + "' AND fsmv.field_no IS NOT NULL";
|
||
List<GroovyRowResult> result = d3.sql.executeAndGet(query);
|
||
for(GroovyRowResult grr : result) {
|
||
functionsResultset.add(grr.get("value"));
|
||
}
|
||
} else {
|
||
url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/FunctionSet?$format=json&$orderby=Id');
|
||
}
|
||
|
||
try {
|
||
if(url != null) {
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
for (int i = 0; i < arr.length(); i++)
|
||
{
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
// Eindeutige Guid
|
||
String guid = metadataObj.getString("GUID");
|
||
functionsResultset.add(guid);
|
||
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error( " ## ValueSet for MachineDocumentsFunctions - Exception = " + e.getMessage() );
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(functionsResultset)
|
||
|
||
}
|
||
|
||
// 07.2019 wird produktiv noch nicht genutzt
|
||
@ValueSet(entrypoint="MachineDocumentMachineType")
|
||
def getMachineDocumentsMachineType(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
|
||
|
||
/*
|
||
// Create a trust manager that does not validate certificate chains -> entfernt 13.02.2019
|
||
Dafür ist es erforderlich das Zertifikat in Java als vertrauenswürdig hinzuzufügen:
|
||
cd D:\d3\d3server.prg\JRE\bin keytool.exe -import -keystore "D:\d3\d3server.prg\JRE\lib\security\cacerts" -file "E:\optima_group_ca.cer"
|
||
*/
|
||
|
||
List<String> machineTypeResultset = [];
|
||
|
||
// Information ob Suchdialog oder Importdialog
|
||
def appID
|
||
try {
|
||
appID = d3.remote.getVersion()[0..2];
|
||
} catch (Exception e) {
|
||
d3.log.error("Exception on d3.remote.getVersion = " + e);
|
||
}
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url;
|
||
/*
|
||
* wenn der Import- oder Updatedialog aufgerufen wird, sollen nur die "nicht gelöschten" Objekte angezeigt werden (Deleted = false)
|
||
* bei der Suche sollen nur bereits verwendete Eigenschaften angezeigt werden
|
||
* Lösungsweg:
|
||
* appID -- 200 = d.xplorer | 220 = d.3 import
|
||
* verstecktes Attribut das immer gefüllt ist -- Suche = null | Update = <Auswahl Feldnr/Wert> | Import = null
|
||
*/
|
||
if(appID == '220' || doc.field[Const.gDDF_VERSIONINTERN] != null) {
|
||
// IMPORT und UPDATE
|
||
|
||
url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/MachineSimpleSet?$filter=Deleted%20eq%20false&$format=json&$orderby=Id');
|
||
} else if(appID == '200') {
|
||
// SUCHE
|
||
String query = "SELECT DISTINCT fsmv.value_char as value FROM firmen_spezifisch fs LEFT JOIN firm_spez_mult_val fsmv on fs.doku_id = fsmv.doku_id WHERE fs.kue_dokuart = '" + Const.gDTS_DERZ1 + "' AND fsmv.field_no = '" + Const.gDDF_MASCHINENTYPEN + "' AND fsmv.field_no IS NOT NULL";
|
||
List<GroovyRowResult> result = d3.sql.executeAndGet(query);
|
||
for(GroovyRowResult grr : result) {
|
||
machineTypeResultset.add(grr.get("value"));
|
||
}
|
||
} else {
|
||
url =new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/MachineSimpleSet?$format=json&$orderby=Id');
|
||
}
|
||
|
||
try {
|
||
if(url != null) {
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
for (int i = 0; i < arr.length(); i++)
|
||
{
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
// Eindeutige Id
|
||
String id = metadataObj.getString("Id");
|
||
machineTypeResultset.add(id);
|
||
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error( " ## ValueSet for MachineDocumentsFunctions - Exception = " + e.getMessage() );
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(machineTypeResultset);
|
||
}
|
||
|
||
@ValueSet(entrypoint="VorlagenProzArtValues")
|
||
def VorlagenProzArtValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
def resultset;
|
||
|
||
def sqlQuery = """SELECT DISTINCT dok_dat_feld_${Const.gDFF_SCHLUESSEL} as val
|
||
FROM firmen_spezifisch fs
|
||
JOIN firm_spez_mult_val fsmv
|
||
ON fsmv.doku_id = fs.doku_id
|
||
WHERE kue_dokuart = '${Const.gDTS_AZTXT}'
|
||
AND dok_dat_feld_${Const.gDFF_SCHLUESSEL} in ( SELECT processtypes
|
||
FROM opg_tmpl_mgmt_processtypes )""";
|
||
|
||
if( doc.field[Const.gDDF_PROZESS] != "" && doc.field[Const.gDDF_PROZESS] != null ) {
|
||
sqlQuery = sqlQuery + " AND fsmv.value_char like ? and fsmv.field_no = ${Const.gDDF_UEBERSETZUNG} OR fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} like ?";
|
||
resultset = d3.sql.executeAndGet(sqlQuery, [
|
||
"%" + doc.field[Const.gDDF_PROZESS].toString() + "%",
|
||
"%" + doc.field[Const.gDDF_PROZESS].toString() + "%"
|
||
]);
|
||
} else {
|
||
resultset = d3.sql.executeAndGet(sqlQuery);
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
d3.getArchive().removeTranslationFromCache("VorlagenProzArtValues", new Locale("de"));
|
||
d3.getArchive().removeTranslationFromCache("VorlagenProzArtValues", new Locale("en"));
|
||
}
|
||
|
||
@ValueSet(entrypoint="RegisterValues")
|
||
def getRegisterValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
//d3.log.info("RegisterValues loaded");
|
||
|
||
def registerValueList = [];
|
||
def registerResultset = [];
|
||
|
||
registerValueList = d3.sql.executeAndGet("SELECT DISTINCT value_char_allowed FROM dbo.doc_field_val_lang WHERE predef_value_id = '${SystemSpecificConst.gPredValueIDRegister}'");
|
||
|
||
for ( int i = 0; i < registerValueList.size(); i++ ) {
|
||
registerResultset.add( registerValueList.get(i).get("value_char_allowed") );
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(registerResultset);
|
||
}
|
||
|
||
@ValueSet(entrypoint="OGValues")
|
||
def getOGValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
//def OGValueList = [];
|
||
//def OGResultset = [];
|
||
|
||
//OGValueList = d3.sql.executeAndGet("SELECT dok_dat_feld_38 FROM firmen_spezifisch WHERE kue_dokuart = 'AZTXT' and dok_dat_feld_38 like 'OG%'");
|
||
|
||
//for ( int i = 0; i < OGValueList.size(); i++ ) {
|
||
//OGResultset.add( OGValueList.get(i).get("dok_dat_feld_38") );
|
||
//}
|
||
|
||
//repoField.provideValuesForValueSet(OGResultset);
|
||
//d3.getArchive().removeTranslationFromCache("OGValues", new Locale("de"));
|
||
//d3.getArchive().removeTranslationFromCache("OGValues", new Locale("en"));
|
||
List<String> OGValuesResultset = [];
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url;
|
||
|
||
url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZCA_D3_AUTHORIZATIONS_SRV/OrgUnitSet?$format=json&$orderby=ExternalId');
|
||
|
||
try {
|
||
if(url != null) {
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
//d3.log.error("## getMachineDocumentsMachineType - Aufruf der Connection");
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
for (int i = 0; i < arr.length(); i++)
|
||
{
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
// Eindeutige Id
|
||
String id = metadataObj.getString("Id");
|
||
OGValuesResultset.add(id);
|
||
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error( " ## ValueSet for OGValues - Exception = " + e.getMessage() );
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(OGValuesResultset);
|
||
d3.getArchive().removeTranslationFromCache("OGValues", new Locale("de"));
|
||
d3.getArchive().removeTranslationFromCache("OGValues", new Locale("en"));
|
||
|
||
}
|
||
|
||
@ValueSet(entrypoint="BuchungskreisValues")
|
||
def getValuesBuchungskreis(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
// Hinweis ehemals JPL - > Verwendung von "GetValueList_SAP_Buchungskreis" und SAP Baustein "ZBC_D3_GETVALUELIST_BUKRS"
|
||
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
|
||
|
||
d3.log.info("getValuesBuchungskreis gestartet");
|
||
|
||
List<String> buchungskreisResultset = [];
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/CompanySet?$format=json&$orderby=CompanyCode');
|
||
|
||
try {
|
||
if(url != null) {
|
||
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
for (int i = 0; i < arr.length(); i++)
|
||
{
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
// Eindeutige Id
|
||
String companyCode = metadataObj.getString("CompanyCode");
|
||
buchungskreisResultset.add(companyCode);
|
||
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error( " ## BuchungskreisValues - Exception = " + e.getMessage() );
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(buchungskreisResultset);
|
||
}
|
||
|
||
|
||
@ValueSet(entrypoint="getValueListSAPFunction")
|
||
def getValueListSAPFunction(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
// Hinweis ehemals JPL - > Verwendung von "GetValueList_SAP_Funktion" und SAP Baustein "ZBC_D3_GETVALUELIST_FUNCTION"
|
||
|
||
def lLanguage
|
||
List<String> functionResultset = [];
|
||
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
lLanguage = "DE"
|
||
} else if( d3.remote.getLanguage().equals("001") ) {
|
||
lLanguage = "EN"
|
||
} else {
|
||
lLanguage = d3.remote.getLanguage()
|
||
}
|
||
|
||
if( doc.field[Const.gDDF_NPN].equals("") || doc.field[Const.gDDF_NPN] == null ) {
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
functionResultset[0] = 'Bitte geben Sie zuerst eine gültige Netzplannummer ein'
|
||
repoField.provideValuesForValueSet(functionResultset)
|
||
} else {
|
||
functionResultset[0] = 'Please choose a valid Network No. at first.'
|
||
repoField.provideValuesForValueSet(functionResultset)
|
||
}
|
||
} else {
|
||
|
||
//String aufsplitten
|
||
String[] splittedString = doc.field[Const.gDDF_NPN].split("\\|")
|
||
|
||
//Wenn Vertragsnummer ermittelt wurde, dann Vertragsnummer in Attributfeld schreiben
|
||
if( splittedString != null && splittedString.size() > 0 && !splittedString[0].equals("") ) {
|
||
doc.field[Const.gDDF_NPN] = splittedString[0].trim();
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url = new URL("https://" + SystemSpecificConst.baseOdata + "/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/NetworkFunctionRelationSet?\$filter=NetworkNo%20eq%20'${doc.field[Const.gDDF_NPN]}'%20and%20LanguageIso639_1%20eq%20'${lLanguage}'&\$format=json");
|
||
try {
|
||
if(url != null) {
|
||
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
|
||
if( arr.length() > 0 ) {
|
||
for (int i = 0; i < arr.length(); i++) {
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
String lFUNCTION = metadataObj.getString("FunctionIdNo");
|
||
String lFUNCTIONNAME = metadataObj.getString("Description");
|
||
|
||
functionResultset.add(lFUNCTION + "|" + lFUNCTIONNAME)
|
||
}
|
||
} else {
|
||
d3.log.error("getValueListSAPFunction - Es konnten keine Werte ermittelt werden")
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
functionResultset[0] = 'Zur angegebenen Netzplannummer konnte keine Funktion ermittelt werden.'
|
||
repoField.provideValuesForValueSet(functionResultset)
|
||
} else {
|
||
functionResultset[0] = 'No functions could be determined for the specified network number.'
|
||
repoField.provideValuesForValueSet(functionResultset)
|
||
}
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error( " ## getValueListSAPFunction - Exception = " + e.getMessage() );
|
||
}
|
||
}
|
||
}
|
||
repoField.provideValuesForValueSet(functionResultset)
|
||
}
|
||
|
||
// imue 30.07.2019 - für die Eigenschaft "Mustermaterial_Nr" bereits im Einsatz
|
||
@ValueSet(entrypoint="getValueListSAPMaterialNo")
|
||
def getValueListSAPMaterialNo(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
// Hinweis ehemals JPL - > Verwendung von "GetValueList_SAP_MaterialNo" und SAP Baustein "ZBC_D3_GETVALUELIST_SAMPLE_MAT"
|
||
|
||
def lLanguage
|
||
def lSearchProj
|
||
def lSearchOpp
|
||
List<String> materialNoResultset = [];
|
||
|
||
// Unterscheidung wurde die Opportunity oder Maschinenprojektnummer eingegeben
|
||
// Übergabe des passenden Wertes + Sparchschlüssel Variable: d3server_letzte_api_sprache
|
||
// Hinweis für Deutsch oder Englisch ist es nicht der korrekte Ländercode, daher die Übersetzung an dieser Stelle weiteres kommt per d.3 national
|
||
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
lLanguage = "DE"
|
||
} else if( d3.remote.getLanguage().equals("001") ) {
|
||
lLanguage = "EN"
|
||
} else {
|
||
lLanguage = "DE"
|
||
}
|
||
|
||
// 08.05.2017 Split der Opportunity oder Projektnummer, falls nötig
|
||
if( !doc.field[Const.gDDF_OPPNUMMER].equals("") && doc.field[Const.gDDF_OPPNUMMER] != null) {
|
||
String[] splittedString = doc.field[Const.gDDF_OPPNUMMER].split(" \\| ")
|
||
if( splittedString != null && splittedString.size() > 0 ) {
|
||
lSearchOpp = splittedString[0].trim()
|
||
} else {
|
||
lSearchOpp = doc.field[Const.gDDF_OPPNUMMER]
|
||
}
|
||
} else if( !doc.field[Const.gDDF_AUFTRNR].equals("") && doc.field[Const.gDDF_AUFTRNR] != null) {
|
||
String[] splittedString = doc.field[Const.gDDF_AUFTRNR].split("\\|")
|
||
if( splittedString != null && splittedString.size() > 0 ) {
|
||
lSearchProj = splittedString[0].trim()
|
||
} else {
|
||
lSearchProj = doc.field[Const.gDDF_AUFTRNR]
|
||
}
|
||
}
|
||
|
||
// Durch OData zwei Entities notwendig
|
||
JSONArray jsonResult
|
||
if( lSearchProj != null && !lSearchProj.equals("") ) {
|
||
// -> Project
|
||
URL url1 = new URL("https://" + SystemSpecificConst.baseOdata + "/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/SampleMaterialProjectRelationSet?\$filter=ProjExtId%20eq%20'${lSearchProj}'%20and%20LanguageIso639_1%20eq%20'${lLanguage}'&\$format=json");
|
||
try {
|
||
if(url1 != null) {
|
||
URLConnection con = url1.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
jsonResult = obj.get("d").getJSONArray("results");
|
||
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error("validateSAPMaterialNo - OData Project Exception - " + e.getMessage())
|
||
}
|
||
|
||
} else if( lSearchOpp != null && !lSearchOpp.equals("") ) {
|
||
// -> Opportunity
|
||
URL url2 = new URL("https://" + SystemSpecificConst.baseOdata + "/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/SampleMaterialOpportunityRelationSet?\$filter=OpportunityNo%20eq%20'${lSearchOpp}'%20and%20LanguageIso639_1%20eq%20'${lLanguage}'&\$format=json");
|
||
try {
|
||
if(url2 != null) {
|
||
URLConnection con = url2.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
jsonResult = obj.get("d").getJSONArray("results");
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error("validateSAPMaterialNo - OData Opportunity Exception - " + e.getMessage())
|
||
}
|
||
}
|
||
|
||
if(jsonResult != null && jsonResult.size() > 0 ) {
|
||
for(int i = 0; i < jsonResult.size(); i++) {
|
||
|
||
JSONObject metadataObj = jsonResult.getJSONObject(i);
|
||
|
||
String lMaterialNo = metadataObj.getString("MaterialNo");
|
||
String lMaterialBezeichnung = metadataObj.getString("ShortText");
|
||
|
||
materialNoResultset.add(lMaterialNo + " | " + lMaterialBezeichnung)
|
||
}
|
||
} else {
|
||
d3.log.error("getValueListSAPMaterialNo - Es konnten keine Werte ermittelt werden")
|
||
}
|
||
repoField.provideValuesForValueSet(materialNoResultset);
|
||
}
|
||
|
||
|
||
@ValueSet(entrypoint="getValueListSAPModul")
|
||
def getValueListSAPModul(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
// Hinweis ehemals JPL - > Verwendung von "GetValueList_SAP_Modul" und SAP Baustein "ZBC_D3_GETVALUELIST_MODULE"
|
||
|
||
List<String> modulResultset = [];
|
||
def lLanguage
|
||
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
lLanguage = "DE"
|
||
} else if( d3.remote.getLanguage().equals("001") ) {
|
||
lLanguage = "EN"
|
||
} else {
|
||
lLanguage = d3.remote.getLanguage()
|
||
}
|
||
|
||
String test1 = doc.field[Const.gDDF_FUNKTION]
|
||
String test2 = doc.field[Const.gDDF_NPN]
|
||
|
||
if( doc.field[Const.gDDF_FUNKTION].equals("") || doc.field[Const.gDDF_FUNKTION] == null) {
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
modulResultset[0] = 'Bitte geben Sie zuerst eine gültige Funktion und eine gültige Netzplannummer ein.'
|
||
repoField.provideValuesForValueSet(modulResultset)
|
||
} else {
|
||
modulResultset[0] = 'Please choose valid Network No. and Function at first.'
|
||
repoField.provideValuesForValueSet(modulResultset)
|
||
}
|
||
} else {
|
||
def lRetCode
|
||
String[] splittedString = doc.field[Const.gDDF_FUNKTION].split("\\|")
|
||
lRetCode = splittedString.size()
|
||
if( lRetCode > 0 && !splittedString[0].equals("") ) {
|
||
doc.field[Const.gDDF_FUNKTION] = splittedString[0].trim();
|
||
} else {
|
||
d3.log.error("getValueListSAPModul: Das Feld Funktion konnte nicht gesplittet werden!")
|
||
}
|
||
|
||
String[] splittedStringSec = doc.field[Const.gDDF_NPN].split("\\|")
|
||
lRetCode = splittedStringSec.size()
|
||
if( lRetCode > 0 && !splittedStringSec[0].equals("") ) {
|
||
doc.field[Const.gDDF_NPN] = splittedStringSec[0].trim();
|
||
} else {
|
||
d3.log.error("getValueListSAPModul: Das Feld Netzplannummer konnte nicht gesplittet werden!")
|
||
}
|
||
|
||
// Filterung im oData Aufruf ist ein Pflichtfelder, daher folgende Prüfung vorher notwendig
|
||
if(!doc.field[Const.gDDF_NPN].equals("") && doc.field[Const.gDDF_NPN] != null && !doc.field[Const.gDDF_FUNKTION].equals("") && doc.field[Const.gDDF_FUNKTION] != null) {
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url = new URL("https://" + SystemSpecificConst.baseOdata + "/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/NetworkFunctionModuleRelationSet?\$filter=NetworkNo%20eq%20'${doc.field[Const.gDDF_NPN]}'%20and%20FunctionIdNo%20eq%20'${doc.field[Const.gDDF_FUNKTION]}'%20and%20LanguageIso639_1%20eq%20'${lLanguage}'&\$format=json");
|
||
try {
|
||
if(url != null) {
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
|
||
if( arr.length() > 0 ) {
|
||
for (int i = 0; i < arr.length(); i++) {
|
||
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
def lMODULE = metadataObj.getString("ModuleIdNo");
|
||
def lMODULENAME = metadataObj.getString("Description");
|
||
|
||
modulResultset[i] = lMODULE + "|" + lMODULENAME
|
||
}
|
||
} else {
|
||
d3.log.error("getValueListSAPModul - Es konnten keine Werte ermittelt werden")
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
modulResultset[0] = 'Zur angegebenen Netzplannummer und Funktion konnte kein Modul ermittelt werden.'
|
||
repoField.provideValuesForValueSet(modulResultset)
|
||
} else {
|
||
modulResultset[0] = 'No module could be determined for the specified network number and function.'
|
||
repoField.provideValuesForValueSet(modulResultset)
|
||
}
|
||
}
|
||
}
|
||
|
||
} catch(Exception e) {
|
||
d3.log.error("getValueListSAPModul - Exception = " + e.getMessage())
|
||
}
|
||
} else {
|
||
// sollte eigentlich nie erreicht werden, da es direkt am Anfang abgefangen wird
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
modulResultset[0] = 'Bitte geben Sie zuerst eine gültige Funktion und eine gültige Netzplannummer ein'
|
||
} else {
|
||
modulResultset[0] = 'Please choose valid Network No. and Function at first.'
|
||
}
|
||
}
|
||
}
|
||
repoField.provideValuesForValueSet(modulResultset);
|
||
}
|
||
|
||
|
||
@ValueSet(entrypoint="NetzplanSAPValues")
|
||
def getValueListSAPNetzplan(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
// imue 10.2019 - Ergänzung um Maschinentyp (Feld ist nicht modifizierbar)
|
||
// wenn Maschinentyp in der Suche ausgewählt wird, zeige alle vorhandenen Werte, ansonsten alles wie gehabt
|
||
def lApiIdTemp = d3.remote.getVersion()[0..2];
|
||
|
||
if( repoField.getId().equals(SystemSpecificConst.gMaschinentypID) && lApiIdTemp != null && lApiIdTemp == 200 && doc.field[Const.gDDF_VERSIONINTERN] == null && doc.field[Const.gDDF_NPN] == null && doc.field[Const.gDDF_AUFTRNR] == null ) {
|
||
// Suche -> wenn ID gleich 200 und verstecktes Attribut ist leer
|
||
List<String> lMaschinentypen = new ArrayList<>();
|
||
|
||
def sqlStatement = "SELECT DISTINCT dok_dat_feld_4 as maschinentyp" +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = 'DMDOK' " +
|
||
"AND dok_dat_feld_4 IS NOT NULL "
|
||
List<GroovyRowResult> sqlResult = d3.sql.executeAndGet(sqlStatement);
|
||
if(sqlResult != null && sqlResult.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResult) {
|
||
lMaschinentypen.add(grr.get("maschinentyp"));
|
||
}
|
||
|
||
}
|
||
repoField.provideValuesForValueSet(lMaschinentypen);
|
||
|
||
} else {
|
||
List<String> netzplanResultset = new ArrayList<>();
|
||
|
||
// Workaround da es aktuell keinen Weg gibt, die Repo-ID über Groovy-Objekt zu ermitteln
|
||
int reposIdDBField = repoField.getPreferedFieldNumber();
|
||
String reposIDName = repoField.getName();
|
||
String sqlStatement = "SELECT rt.repository_id as repoID " +
|
||
"FROM field_repository fr " +
|
||
"LEFT JOIN repository_titles rt ON fr.repository_id = rt.repository_id " +
|
||
"WHERE rt.repository_title = '${reposIDName}'" +
|
||
"AND fr.doc_field_nr_pref = '${reposIdDBField}'"
|
||
List<GroovyRowResult> sqlResult = d3.sql.executeAndGet(sqlStatement);
|
||
|
||
if(sqlResult != null && sqlResult.size() > 0) {
|
||
int repos_id = sqlResult.getAt(0).get("repoID");
|
||
|
||
if( doc.field[Const.gDDF_AUFTRNR] == null || doc.field[Const.gDDF_AUFTRNR].equals("") ) {
|
||
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
netzplanResultset.add("Bitte geben Sie zuerst eine Projektnummer ein");
|
||
repoField.provideValuesForValueSet(netzplanResultset);
|
||
} else {
|
||
netzplanResultset.add("Please choose a Projectnumber at first.");
|
||
repoField.provideValuesForValueSet(netzplanResultset);
|
||
}
|
||
|
||
} else {
|
||
|
||
//String aufsplitten
|
||
String[] splittedString = doc.field[Const.gDDF_AUFTRNR].split("\\|")
|
||
|
||
//Wenn Vertragsnummer ermittelt wurde, dann Vertragsnummer in Attributfeld schreiben
|
||
if( splittedString != null && splittedString.size() > 0 && !splittedString[0].equals("") ) {
|
||
doc.field[Const.gDDF_AUFTRNR] = splittedString[0].trim();
|
||
}
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
URL url = new URL("https://" + SystemSpecificConst.baseOdata + "/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/ProjectNetworkRelationSet?\$filter=ProjExtId%20eq%20'${doc.field[Const.gDDF_AUFTRNR]}'&\$format=json");
|
||
|
||
try {
|
||
if(url != null) {
|
||
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
|
||
if(arr.length() > 0) {
|
||
for(int i = 0; i < arr.size(); i++) {
|
||
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
// 07.05.2020: Umgestellt von ProjExtId auf NetworkNo
|
||
String lNPN = metadataObj.getString("NetworkNo");
|
||
// 07.05.2020: Umgestellt von Description auf MachineType gewechselt
|
||
String lNPNAME = metadataObj.getString("MachineType");
|
||
String lPSPElement = metadataObj.getString("PSPElement");
|
||
|
||
if(repos_id == SystemSpecificConst.gNetzplanNrId) {
|
||
netzplanResultset.add(lNPN + " | " + lPSPElement + " | " + lNPNAME);
|
||
|
||
} else if(repos_id == SystemSpecificConst.gPSPElementId ) {
|
||
netzplanResultset.add(lPSPElement + " | " + lNPN + " | " + lNPNAME);
|
||
|
||
} else if(repos_id == SystemSpecificConst.gMaschinentypID ) {
|
||
|
||
if( doc.field[Const.gDDF_NPN] != null ) {
|
||
String[] splittedStringNPN = doc.field[Const.gDDF_NPN].toString().split("\\|");
|
||
if(splittedStringNPN != null && splittedStringNPN.size() > 0) {
|
||
String lDocFieldNetzplan = splittedStringNPN[0];
|
||
// in Abhängigkeit zum eingetragenen Netzplan
|
||
if(lNPN.trim().equals(lDocFieldNetzplan.trim())) {
|
||
netzplanResultset.add(lNPN + " | " + lPSPElement + " | " + lNPNAME);
|
||
}
|
||
}
|
||
|
||
} else if( doc.field[Const.gDDF_PSPELEMENT] != null ) {
|
||
String[] splittedStringPSP = doc.field[Const.gDDF_PSPELEMENT].toString().split("\\|");
|
||
if(splittedStringPSP != null && splittedStringPSP.size() > 0) {
|
||
String lDocFieldNetzplan = splittedStringPSP[1];
|
||
// in Abhängigkeit zum eingetragenen Netzplan
|
||
if(lNPN.trim().equals(lDocFieldNetzplan.trim())) {
|
||
netzplanResultset.add(lNPN + " | " + lPSPElement + " | " + lNPNAME);
|
||
}
|
||
}
|
||
|
||
} else {
|
||
netzplanResultset.add(lNPN + " | " + lPSPElement + " | " + lNPNAME);
|
||
}
|
||
|
||
} else {
|
||
netzplanResultset.add(lNPN + " | " + lPSPElement + " | " + lNPNAME);
|
||
}
|
||
}
|
||
} else {
|
||
d3.log.error("getValueListSAPNetzplan - Es konnten keine Werte ermittelt werden")
|
||
if( d3.remote.getLanguage().equals("049") ) {
|
||
netzplanResultset.add("Zur angegebenen Projektnummer konnte keine Netzplan_Nr ermittelt werden.");
|
||
repoField.provideValuesForValueSet(netzplanResultset);
|
||
} else {
|
||
netzplanResultset.add("No networkplan_no could be determined for the specified project number.");
|
||
repoField.provideValuesForValueSet(netzplanResultset);
|
||
}
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error("getValueListSAPNetzplan - Exception = " + e.getMessage())
|
||
}
|
||
}
|
||
}
|
||
repoField.provideValuesForValueSet(netzplanResultset);
|
||
}
|
||
}
|
||
|
||
// imue 02.07.2019 noch nicht in Verwendung und noch nicht getestet - Wird überhaupt nicht mehr gebraucht?
|
||
@ValueSet(entrypoint="getValueListSAPNetzplanVorg")
|
||
def getValueListSAPNetzplanVorg(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc) {
|
||
|
||
List<String> netzplanResultset = [];
|
||
|
||
d3.log.info("Ermittlung der Netzplanvorgangsnummer")
|
||
|
||
def suchstrName
|
||
|
||
if( !doc.field[Const.gDDF_NPN].equals("") && doc.field[Const.gDDF_NPN] != null ) {
|
||
suchstrName = doc.field[Const.gDDF_NPN].substring(0,11)
|
||
d3.log.info("Der Suchstring hat folgenden Wert: << ${suchstrName} >> ")
|
||
}
|
||
|
||
if(SystemSpecificConst.needCertificateCheck == false) {
|
||
deactivateCertificateCheck();
|
||
}
|
||
|
||
|
||
URL url = new URL("https://" + SystemSpecificConst.baseOdata + "/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/ProjectNetworkRelationSet?\$filter=ProjExtId%20eq%20'${suchstrName}'&\$format=json");
|
||
|
||
try {
|
||
if(url != null) {
|
||
URLConnection con = url.openConnection();
|
||
|
||
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
|
||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
|
||
con.setRequestProperty ("Authorization", basicAuth);
|
||
|
||
InputStream is = con.getInputStream();
|
||
String responseValue = IOUtils.toString(is, "UTF-8");
|
||
is.close();
|
||
|
||
JSONObject obj = new JSONObject(responseValue);
|
||
|
||
JSONArray arr = obj.get("d").getJSONArray("results");
|
||
|
||
if(arr.length() > 0) {
|
||
for(int i = 0; i < arr.size(); i++) {
|
||
|
||
JSONObject metadataObj = arr.getJSONObject(i);
|
||
|
||
def lNPN = metadataObj.getString("ProjExtId");
|
||
def lNPNAME = metadataObj.getString("Description");
|
||
def lPSPElement = metadataObj.getString("PSPElement");
|
||
|
||
if( !lNPN.equals("") ) {
|
||
netzplanResultset.add(lNPN)
|
||
}
|
||
}
|
||
} else {
|
||
d3.log.error("getValueListSAPNetzplanVorg - Es konnten keine Werte ermittelt werden")
|
||
}
|
||
}
|
||
} catch(Exception e) {
|
||
d3.log.error("getValueListSAPNetzplanVorg - Exception = " + e.getMessage())
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(netzplanResultset);
|
||
}
|
||
|
||
@ValueSet(entrypoint="ThemaValues")
|
||
def getThemaValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
def val1
|
||
def sqlext
|
||
|
||
if ( doc.field[Const.gDDF_THEMA][row_no] != null && !doc.field[Const.gDDF_THEMA][row_no].equals("") ) {
|
||
val1 = "%" + doc.field[Const.gDDF_THEMA].getAt(row_no).toString() + "%";
|
||
sqlext = "AND mv.value_char like '${val1}'"
|
||
}
|
||
else {
|
||
sqlext = ""
|
||
}
|
||
|
||
// dynamische Wertemenge d.3 Benutzer
|
||
if ( doc.getType().getId() == "${Const.gDTS_DWISS}" )
|
||
{
|
||
def resultset
|
||
|
||
String sql = "SELECT DISTINCT TOP 100 mv.value_char as val " +
|
||
"FROM firmen_spezifisch fs, firm_spez_mult_val mv " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_DWISS}' AND fs.doku_id = mv.doku_id " +
|
||
"AND mv.field_no = '${Const.gDDF_THEMA}' ";
|
||
|
||
sql = sql + sqlext;
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ServiceRequestIDValues")
|
||
def getServiceRequestIDValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc )
|
||
{
|
||
def lang = d3.remote.language
|
||
def lNoSubmission
|
||
|
||
if ( lang != "049" ) {
|
||
lNoSubmission = "No Description"
|
||
}
|
||
else {
|
||
lNoSubmission = "keine Beschreibung"
|
||
}
|
||
|
||
// Anzeige abhängig zum aktuellen Eigenschaftsfeld
|
||
String currSrIdToCheck = null;
|
||
if(repoField.id().equals(String.valueOf(SystemSpecificConst.gSRIDID))) {
|
||
currSrIdToCheck = doc.field[Const.gDDF_SRID];
|
||
} else if(repoField.id().equals(String.valueOf(SystemSpecificConst.gWeitereSRIDID))) {
|
||
currSrIdToCheck = doc.field[Const.gDDF_WEITERESRID][row_no];
|
||
}
|
||
|
||
int length = 0
|
||
if ( currSrIdToCheck != null ) {
|
||
length = currSrIdToCheck.length();
|
||
}
|
||
|
||
def resultset
|
||
if( validate == 1 ) {
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_SRID} as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ASERE}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND dok_dat_feld_${Const.gDDF_SRID} = '${currSrIdToCheck}'"
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else if(length < 6) {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens sechs Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset);
|
||
|
||
} else if(length >= 6) {
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_SRID} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ASERE}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND (dok_dat_feld_${Const.gDDF_SRID} LIKE '%${currSrIdToCheck}%' " +
|
||
" OR dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG} LIKE '%${currSrIdToCheck}%')"
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else {
|
||
String sql = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_SRID} + ' | ' + ISNULL( dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG},'${lNoSubmission}' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ASERE}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ServicBelegIDValues")
|
||
def getServicBelegIDValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc )
|
||
{
|
||
|
||
// Weitere Belegnummer immer abhängig vom bisherigem Belegtyp, daher voherige Hinuzvalidierung notwendig
|
||
if(Integer.valueOf(repoField.id()) == SystemSpecificConst.gWeitereBelegNrID) {
|
||
if(doc.field[Const.gDDF_BELEGNUMMER] != null) {
|
||
String belegNummerTemp = doc.field[Const.gDDF_BELEGNUMMER]
|
||
String[] splittedString = doc.field[Const.gDDF_BELEGNUMMER].split("\\s+");
|
||
if( splittedString != null && splittedString[0] != null && !splittedString[0].equals("") ) {
|
||
belegNummerTemp = splittedString[0];
|
||
}
|
||
String sqlSatement = "SELECT dok_dat_feld_${Const.gDDF_BELEGTYP} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_ASEBE}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_BELEGNUMMER} = '${belegNummerTemp}' ";
|
||
List<GroovyRowResult> sqlResult = d3.sql.executeAndGet(sqlSatement);
|
||
if(sqlResult != null && sqlResult.size() == 1) {
|
||
String belegTypTemp = sqlResult.getAt(0).get("val");
|
||
if(belegTypTemp != null && !belegTypTemp.equals("")) {
|
||
if(doc.field[Const.gDDF_BELEGTYP] == null || !doc.field[Const.gDDF_BELEGTYP].equals(belegTypTemp) ) {
|
||
doc.field[Const.gDDF_BELEGTYP] = belegTypTemp;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
String belegTyp = doc.field[Const.gDDF_BELEGTYP];
|
||
|
||
def resultset
|
||
if( validate == 1 ) {
|
||
|
||
String belegNummerTemp = doc.field[Const.gDDF_BELEGNUMMER]
|
||
String sql = "SELECT dok_dat_feld_${Const.gDDF_BELEGNUMMER} as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ASEBE}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_BELEGNUMMER} = '${belegNummerTemp}' " +
|
||
"AND pd.frei_o_gesperrt = 'f' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else if( belegTyp != null ) {
|
||
String sql = "SELECT top 9000 dok_dat_feld_${Const.gDDF_BELEGNUMMER} + ' ' + ISNULL( dok_dat_feld_${Const.gDDF_KURZTEXT},'' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ASEBE}' " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_BELEGTYP} = '${belegTyp}'" +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
} else {
|
||
|
||
String val1 = ""
|
||
int length = 0
|
||
if ( doc.field[Const.gDDF_BELEGNUMMER] != null ) {
|
||
val1 = "%" + doc.field[Const.gDDF_BELEGNUMMER].toString() + "%"
|
||
length = val1.length();
|
||
}
|
||
|
||
if ( length >= 3 && doc.field[Const.gDDF_BELEGNUMMER] != null ) {
|
||
String sql = "SELECT top 9000 dok_dat_feld_${Const.gDDF_BELEGNUMMER} + ' ' + ISNULL( dok_dat_feld_${Const.gDDF_KURZTEXT},'' ) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_ASEBE}' " +
|
||
"AND (fs.dok_dat_feld_${Const.gDDF_BELEGNUMMER} like '${val1}'" +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_KURZTEXT} like '${val1}' )" +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " ;
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens drei Zeichen ein"
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="ServicBelegartValues")
|
||
def ServicBelegTypValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc ) {
|
||
//d3.log.error("Start ServicBelegartValues");
|
||
String belegNrFull = doc.field[Const.gDDF_BELEGNUMMER];
|
||
String belegTyp = doc.field[Const.gDDF_BELEGTYP];
|
||
|
||
String belegNr = null;
|
||
if( belegNrFull != null ) {
|
||
String[] splittedBelegNr = belegNrFull.split();
|
||
if(splittedBelegNr.size() >= 1) {
|
||
belegNr = splittedBelegNr[0];
|
||
}
|
||
}
|
||
if( validate == 1 ) {
|
||
String sql = "SELECT distinct(dok_dat_feld_${Const.gDDF_BELEGTYP}) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = ? " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = ? " +
|
||
"AND dok_dat_feld_${Const.gDDF_BELEGTYP} = ? ";
|
||
List<Object> params = [
|
||
Const.gDTS_ASEBE,
|
||
"f",
|
||
belegTyp
|
||
];
|
||
def resultset = d3.sql.executeAndGet(sql, params);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else if( belegNr != null ) {
|
||
String sql = "SELECT distinct(dok_dat_feld_${Const.gDDF_BELEGTYP}) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = ? " +
|
||
"AND fs.dok_dat_feld_${Const.gDDF_BELEGNUMMER} = ? " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = ? " ;
|
||
List<Object> params = [
|
||
Const.gDTS_ASEBE,
|
||
belegNr,
|
||
"f"
|
||
];
|
||
def resultset = d3.sql.executeAndGet(sql, params);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
} else {
|
||
String sql = "SELECT distinct(dok_dat_feld_${Const.gDDF_BELEGTYP}) as val " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = ? " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = ? " ;
|
||
List<Object> params = [Const.gDTS_ASEBE, "f"];
|
||
def resultset = d3.sql.executeAndGet(sql, params);
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
}
|
||
|
||
}
|
||
|
||
/* Anpassung jleu 28.11.2025 Like und Validate Suche eingefuegt*/
|
||
@ValueSet(entrypoint="ServiceAllBeschreibungValues")
|
||
def serviceAllBeschreibungValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc ) {
|
||
|
||
String sql
|
||
String dummyvalue = doc.field[Const.gDDF_SRID].trim();
|
||
String where = "";
|
||
|
||
|
||
if( doc.field[Const.gDDF_SRID] != null )
|
||
{
|
||
String[] splittedString;
|
||
splittedString = doc.field[Const.gDDF_SRID].split(" \\| ");
|
||
if(splittedString != null) {
|
||
def lRetCodeSR = splittedString.size();
|
||
if( lRetCodeSR > 1 ) {
|
||
dummyvalue = splittedString[0].trim();
|
||
}
|
||
}
|
||
}
|
||
|
||
if ( dummyvalue.length() > 0 )
|
||
{
|
||
where = " AND dok_dat_feld_${Const.gDDF_SRID} = '${dummyvalue}'";
|
||
}
|
||
|
||
sql = "select distinct dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG} as val FROM firmen_spezifisch WHERE kue_dokuart = '${Const.gDTS_ASERE}' " + where;
|
||
|
||
|
||
def resultset = d3.sql.executeAndGet(sql);
|
||
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
|
||
}
|
||
|
||
@ValueSet(entrypoint="GeschaeftspartnerValues")
|
||
def getGeschaeftspartnerValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc ) {
|
||
|
||
List<String> valueList = new ArrayList<>();
|
||
String lSQLState1 = "";
|
||
String lSQLState2 = "";
|
||
String lSQLState3 = "";
|
||
|
||
int ltmp = 0;
|
||
if(doc.field[Const.gDDF_GESPART] != null && doc.field[Const.gDDF_GESPART][row_no] != null) {
|
||
ltmp = doc.field[Const.gDDF_GESPART][row_no].toString().length();
|
||
}
|
||
|
||
if (ltmp >= 3) {
|
||
lSQLState1 = "AND (dok_dat_feld_${Const.gDDF_LNAME} like '%${doc.field[Const.gDDF_GESPART][row_no]}%' or dok_dat_feld_${Const.gDDF_LNR} like '%${doc.field[Const.gDDF_GESPART][row_no]}%')";
|
||
lSQLState2 = "AND (dok_dat_feld_${Const.gDDF_KNAME} like '%${doc.field[Const.gDDF_GESPART][row_no]}%' or dok_dat_feld_${Const.gDDF_KNR} like '%${doc.field[Const.gDDF_GESPART][row_no]}%')";
|
||
lSQLState3 = "AND (dok_dat_feld_${Const.gDDF_PARTNERNAME} like '%${doc.field[Const.gDDF_GESPART][row_no]}%' or dok_dat_feld_${Const.gDDF_PARTNERID} like '%${doc.field[Const.gDDF_GESPART][row_no]}%')";
|
||
|
||
|
||
|
||
|
||
//Anpassung für Lieferantenname
|
||
String sqlStatementSupp = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_LNAME} as lSuppName, dok_dat_feld_${Const.gDDF_LNR} as lSuppNr FROM firmen_spezifisch WHERE kue_dokuart = '${Const.gDTS_ALIEF}' " + lSQLState1;
|
||
List<GroovyRowResult> sqlResultSupp = d3.sql.executeAndGet(sqlStatementSupp);
|
||
if(sqlResultSupp != null && sqlResultSupp.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResultSupp) {
|
||
valueList.add(grr.get("lSuppName") + " (" + grr.get("lSuppNr") + ")");
|
||
}
|
||
}
|
||
|
||
//Anpassung für Kundenname
|
||
String sqlStatementCust = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_KNAME} as lCustName, dok_dat_feld_${Const.gDDF_KNR} as lCustNr FROM firmen_spezifisch WHERE kue_dokuart = '${Const.gDTS_AKUND}' " + lSQLState2;
|
||
List<GroovyRowResult> sqlResultCust = d3.sql.executeAndGet(sqlStatementCust);
|
||
if(sqlResultCust != null && sqlResultCust.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResultCust) {
|
||
valueList.add(grr.get("lCustName") + " (" + grr.get("lCustNr") + ")");
|
||
}
|
||
}
|
||
|
||
//Anpassung für Partnerakte
|
||
String sqlStatementPart = "SELECT dok_dat_feld_${Const.gDDF_PARTNERNAME} as lPartName, dok_dat_feld_${Const.gDDF_PARTNERID} as lPartNr FROM firmen_spezifisch WHERE kue_dokuart = '${Const.gDTS_PRTNR}' " + lSQLState3;
|
||
List<GroovyRowResult> sqlResultPart = d3.sql.executeAndGet(sqlStatementPart);
|
||
if(sqlResultPart != null && sqlResultPart.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResultPart) {
|
||
valueList.add(grr.get("lPartName") + " (" + grr.get("lPartNr") + ")");
|
||
}
|
||
}
|
||
|
||
|
||
} else {
|
||
valueList.add("Bitte wenigstens 3 Zeichen eingeben");
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(valueList);
|
||
}
|
||
|
||
@ValueSet(entrypoint="GeschaeftspartnerNrValues")
|
||
def getGeschaeftspartNrValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc ) {
|
||
|
||
List<String> valueList = new ArrayList<>();
|
||
String lSQLState1 = "";
|
||
String lSQLState2 = "";
|
||
|
||
if(doc.field[Const.gDDF_GESPART] != null && doc.field[Const.gDDF_GESPARTNR60][row_no] != null) {
|
||
lSQLState1 = "AND dok_dat_feld_${Const.gDDF_LNAME} like '%${doc.field[Const.gDDF_GESPARTNR60][row_no]}%'"
|
||
lSQLState2 = "AND dok_dat_feld_${Const.gDDF_KNAME} like '%${doc.field[Const.gDDF_GESPARTNR60][row_no]}%'"
|
||
}
|
||
|
||
//Anpassung für Lieferantennr
|
||
String sqlStatementSupp = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_LNR} as lSuppNr FROM firmen_spezifisch WHERE kue_dokuart = '${Const.gDTS_ALIEF}' " + lSQLState1 + " ORDER BY dok_dat_feld_${Const.gDDF_LNR}";
|
||
List<GroovyRowResult> sqlResultSupp = d3.sql.executeAndGet(sqlStatementSupp);
|
||
if(sqlResultSupp != null && sqlResultSupp.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResultSupp) {
|
||
valueList.add(grr.get("lSuppNr"));
|
||
}
|
||
}
|
||
|
||
//Anpassung für Kundennr
|
||
String sqlStatementCust = "SELECT DISTINCT dok_dat_feld_${Const.gDDF_KNR} as lCustNr FROM firmen_spezifisch WHERE kue_dokuart = '$Const.gDTS_AKUND}' " + lSQLState2 + " ORDER BY dok_dat_feld_${Const.gDDF_KNR}";
|
||
List<GroovyRowResult> sqlResultCust = d3.sql.executeAndGet(sqlStatementCust);
|
||
if(sqlResultCust != null && sqlResultCust.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResultCust) {
|
||
valueList.add(grr.get("lCustNr"));
|
||
}
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(valueList);
|
||
}
|
||
|
||
@ValueSet(entrypoint="EquipmentValues")
|
||
def getEquipmentValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc ) {
|
||
String currentValue = null;
|
||
if( Integer.valueOf(repoField.id()) == SystemSpecificConst.gEquipmentID ) {
|
||
currentValue = doc.field[Const.gDDF_EQUIPMENT];
|
||
} else if( Integer.valueOf(repoField.id()) == SystemSpecificConst.gWeitereEquipmentID ) {
|
||
currentValue = doc.field[Const.gDDF_WEITEREEQUIPMENT][row_no];
|
||
}
|
||
if( currentValue != null && currentValue.length() >= 3 ) {
|
||
// Alle bestehenden Werte holen anhand der Equipment Akte
|
||
String sqlStatement = "SELECT dok_dat_feld_${Const.gDDF_EQUIPMENT} as equ, dok_dat_feld_${Const.gDDF_NPN} as netz, dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG} as besch " +
|
||
"FROM firmen_spezifisch as fs, phys_datei as pd " +
|
||
"WHERE fs.kue_dokuart = '${Const.gDTS_AEQUI}' " +
|
||
"AND pd.doku_id = fs.doku_id " +
|
||
"AND pd.frei_o_gesperrt = 'f' " +
|
||
"AND ( fs.dok_dat_feld_${Const.gDDF_EQUIPMENT} like '%${currentValue}%' " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_NPN} like '%${currentValue}%' " +
|
||
"OR fs.dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG} like '%${currentValue}%' )";
|
||
List<GroovyRowResult> sqlResult = d3.sql.executeAndGet(sqlStatement);
|
||
List<String> valueList = new ArrayList<>();
|
||
if(sqlResult != null && sqlResult.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResult) {
|
||
String currentNetzplan = grr.get("netz");
|
||
if( currentNetzplan != null && !currentNetzplan.trim().equals("") && !currentNetzplan.trim().equals("null") ) {
|
||
valueList.add(grr.get("equ") + " | " + grr.get("netz") + " | " + grr.get("besch"));
|
||
} else {
|
||
valueList.add(grr.get("equ") + " | " + "| " + grr.get("besch"));
|
||
}
|
||
}
|
||
}
|
||
repoField.provideValuesForValueSet(valueList);
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens drei Zeichen ein"
|
||
];
|
||
repoField.provideValuesForValueSet(ErrResultset);
|
||
}
|
||
}
|
||
|
||
@ValueSet(entrypoint="getITSMValues")
|
||
def getITSMValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc)
|
||
{
|
||
// Ermittelt die Beschreibung - bei ITSM wird auch die Nummer gesucht und zusammengesetzet
|
||
// d3.log.error("Groovy - ValueSets: start SubjectValues " + doc.getType().getId());
|
||
|
||
def resultset
|
||
String sql
|
||
def val1 = ""
|
||
int length = 0
|
||
|
||
if ( doc.field[Const.gDDF_ITSMID] != null ) {
|
||
val1 = "%" + doc.field[Const.gDDF_ITSMID].toString() + "%"
|
||
} else {
|
||
val1 = "%"
|
||
}
|
||
length = val1.length();
|
||
|
||
|
||
if ( docType.id == Const.gDTS_DITSM ) {
|
||
sql = "SELECT dok_dat_feld_${Const.gDDF_ITSMID} +'|' + dok_dat_feld_${Const.gDDF_SAPBESCHREIBUNG} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${Const.gDTS_AITSM}' " +
|
||
"AND dok_dat_feld_${Const.gDDF_SAPBESCHREIBUNG} like '${val1}'"
|
||
} else {
|
||
sql = "SELECT dok_dat_feld_${Const.gDDF_ITSMID} as val " +
|
||
"FROM firmen_spezifisch " +
|
||
"WHERE kue_dokuart = '${doc.getType().getId()}' " +
|
||
"ORDER BY dok_dat_feld_${Const.gDDF_ITSMID} ";
|
||
}
|
||
|
||
resultset = d3.sql.executeAndGet(sql);
|
||
if( resultset.size() >= 10000 ) {
|
||
List<String> ErrResultset = [
|
||
"Bitte grenzen Sie Ihre Auswahl weiter ein, es wurden mehr als 10.000 Einträge gefunden."
|
||
]
|
||
repoField.provideValuesForValueSet(ErrResultset)
|
||
return 0;
|
||
} else {
|
||
repoField.provideValuesForValueSet(resultset.collect{it.get("val")});
|
||
return 0;
|
||
}
|
||
|
||
}
|
||
|
||
// Deaktivierung der Zertifikatsprüfung
|
||
def deactivateCertificateCheck() {
|
||
// CONNECT WITHOUT SSL CHECK
|
||
TrustManager[] trustAllCerts = new TrustManager[1]
|
||
def tm = new X509TrustManager() {
|
||
public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; }
|
||
public void checkClientTrusted(X509Certificate[] certs, String authType) { }
|
||
public void checkServerTrusted(X509Certificate[] certs, String authType) { }
|
||
}
|
||
trustAllCerts[0] = tm;
|
||
SSLContext sc = SSLContext.getInstance("SSL");
|
||
sc.init(null, trustAllCerts, new java.security.SecureRandom());
|
||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||
HostnameVerifier allHostsValid = new HostnameVerifier() {
|
||
public boolean verify(String hostname, SSLSession session) { return true; }
|
||
};
|
||
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
|
||
// CONNECT WITHOUT SSL CHECK
|
||
}
|
||
|
||
@ValueSet(entrypoint="EinkaufsbelegValues")
|
||
def getEinkaufsbelegValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc ) {
|
||
|
||
String currentValue = null;
|
||
|
||
if( Integer.valueOf(repoField.getId()) == SystemSpecificConst.gEinkaufsBelegNrID ) {
|
||
currentValue = doc.field[Const.gDDF_BELEGNUMMER];
|
||
} else if( Integer.valueOf(repoField.getId()) == SystemSpecificConst.gWeitereEinkaufBelegNrID ) {
|
||
currentValue = doc.field[Const.gDDF_WEITEREBELEGNR][row_no];
|
||
}
|
||
|
||
if( currentValue != null && currentValue.length() >= 3 ) {
|
||
// Alle bestehenden Werte (Änderung auf Hook aufgrund Mengenbeschränkung und daher notwendiger Mindesteingabe)
|
||
String sqlStatement = """SELECT DISTINCT dok_dat_feld_${Const.gDDF_BELEGNUMMER} val
|
||
FROM firmen_spezifisch
|
||
WHERE kue_dokuart = ?
|
||
AND dok_dat_feld_${Const.gDDF_BELEGNUMMER} LIKE '%${currentValue}%' """;
|
||
List<Object> params = [Const.gDTS_AEIBE]
|
||
List<GroovyRowResult> sqlResult = d3.sql.executeAndGet(sqlStatement, params);
|
||
List<String> valueList = new ArrayList<>();
|
||
if(sqlResult != null && sqlResult.size() > 0) {
|
||
for(GroovyRowResult grr : sqlResult) {
|
||
String currentNewValue = grr.get("val");
|
||
if(currentNewValue != null) {
|
||
valueList.add(currentNewValue);
|
||
}
|
||
}
|
||
}
|
||
repoField.provideValuesForValueSet(valueList);
|
||
} else {
|
||
List<String> ErrResultset = [
|
||
"Bitte geben Sie mindestens drei Zeichen ein"
|
||
];
|
||
repoField.provideValuesForValueSet(ErrResultset);
|
||
}
|
||
|
||
}
|
||
|
||
// 12.12.2022 Equipment Anwendungsfall Service
|
||
@ValueSet(entrypoint="EquipmentsValues")
|
||
def getEquipmentsValues(D3Interface d3, RepositoryField repoField, User user, DocumentType docType, Integer row_no, Integer validate, Document doc ) {
|
||
|
||
List<String> valueList = new ArrayList<>();
|
||
|
||
// Bei Service Beleg Dokumente muss die SR_ID auf Basis der Beleg-Nummer und der Service Beleg Akte ermittelt werden
|
||
// Bei Service Request Dokumente und Akten ist die SR_ID direkt gefüllt und kann genutzt werden
|
||
if(docType.getId().equals(Const.gDTS_DSEBE)) {
|
||
|
||
Functions.splitServBelegnummer(d3, doc, docType);
|
||
|
||
if(doc.field[Const.gDDF_BELEGNUMMER] != null) {
|
||
String sqlStatementBel = """SELECT dok_dat_feld_${Const.gDDF_SRID} currSrId
|
||
FROM firmen_spezifisch
|
||
WHERE kue_dokuart = ?
|
||
AND dok_dat_feld_${Const.gDDF_BELEGNUMMER} = ? """;
|
||
List<Object> paramsBel = [Const.gDTS_ASEBE, doc.field[Const.gDDF_BELEGNUMMER]];
|
||
List<GroovyRowResult> sqlResultBel = d3.sql.executeAndGet(sqlStatementBel, paramsBel);
|
||
if(sqlResultBel != null && sqlResultBel.size() > 0) {
|
||
String currSrdId = sqlResultBel.getAt(0).get("currSrId");
|
||
if(currSrdId != null) {
|
||
doc.field[Const.gDDF_SRID] = currSrdId;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// Werte ausschließlich aus dem zugrundeliegenden Service Request
|
||
if(doc.field[Const.gDDF_SRID] != null) {
|
||
|
||
Functions.splitServSrId(d3, doc, docType);
|
||
|
||
String sqlStatement = """SELECT DISTINCT mv.value_char currValue
|
||
FROM firmen_spezifisch fs
|
||
LEFT JOIN firm_spez_mult_val mv ON fs.doku_id = mv.doku_id
|
||
WHERE fs.kue_dokuart = ?
|
||
AND mv.field_no = ?
|
||
AND fs.dok_dat_feld_${Const.gDDF_SRID} = ? """;
|
||
List<Object> params = [Const.gDTS_ASERE, Const.gDDF_EQUIPMENTS, doc.field[Const.gDDF_SRID]];
|
||
List<GroovyRowResult> sqlResult = d3.sql.executeAndGet(sqlStatement, params);
|
||
|
||
if(sqlResult != null) {
|
||
for(GroovyRowResult grr : sqlResult) {
|
||
String currEquipments = grr.get("currValue");
|
||
if(currEquipments != null) {
|
||
|
||
// Es sollen nur Werte angezeigt werden, zu denen es zusätzlich auch eine Equipmentakte gibt
|
||
String sqlStatementFol = null;
|
||
if(doc.field[Const.gDDF_EQUIPMENTS][row_no] != null) {
|
||
sqlStatementFol = """SELECT dok_dat_feld_${Const.gDDF_EQUIPMENT} equipmentNo, dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG} equipmentDesc
|
||
FROM firmen_spezifisch
|
||
WHERE kue_dokuart = ?
|
||
AND dok_dat_feld_${Const.gDDF_EQUIPMENT} = ?
|
||
AND (dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG} LIKE '%${doc.field[Const.gDDF_EQUIPMENTS][row_no]}%' OR dok_dat_feld_${Const.gDDF_EQUIPMENT} LIKE '%${doc.field[Const.gDDF_EQUIPMENTS][row_no]}%')""";
|
||
} else {
|
||
sqlStatementFol = """SELECT dok_dat_feld_${Const.gDDF_EQUIPMENT} equipmentNo, dok_dat_feld_${Const.gDDF_SVBESCHREIBUNG} equipmentDesc
|
||
FROM firmen_spezifisch
|
||
WHERE kue_dokuart = ?
|
||
AND dok_dat_feld_${Const.gDDF_EQUIPMENT} = ? """;
|
||
}
|
||
List<Object> paramsFol = [Const.gDTS_AEQUI, currEquipments];
|
||
List<GroovyRowResult> sqlResultFol = d3.sql.executeAndGet(sqlStatementFol, paramsFol);
|
||
if(sqlResultFol != null && sqlResultFol.size() > 0) {
|
||
for(GroovyRowResult grrFold : sqlResultFol) {
|
||
|
||
// Bezeichnung soll mit in Wertemenge erscheinen, damit danach gesucht werden kann
|
||
String currEquipmentNo = grrFold.get("equipmentNo");
|
||
String currEquipmentDesc = grrFold.get("equipmentDesc");
|
||
if(currEquipmentNo != null) {
|
||
if(currEquipmentDesc != null) {
|
||
valueList.add(currEquipments + " | " + currEquipmentDesc);
|
||
} else {
|
||
valueList.add(currEquipments);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
repoField.provideValuesForValueSet(valueList);
|
||
}
|
||
|
||
} // Abschluss von ValueSets_Common |