Umstellung auf constantValues
This commit is contained in:
@@ -28,30 +28,24 @@ import org.apache.http.impl.client.HttpClientBuilder
|
||||
import org.apache.http.util.EntityUtils
|
||||
import groovy.json.JsonSlurper
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import constantValues;
|
||||
|
||||
public class D3Hooks
|
||||
{
|
||||
@Entrypoint( entrypoint = "hook_insert_exit_20" )
|
||||
public int insertExit_20( D3Interface d3, Document doc, String fileDestination, int importOk, User user, DocumentType docType )
|
||||
{
|
||||
def repo_id = "2e0f1447-d775-51aa-8593-0e0a5d9662aa";
|
||||
def baseUri = "https://d3ecm.rau.rau-pforzheim.de";
|
||||
def authUsr = "Zyu0W+L0fb6HF0sxPRyPdETFQFBCTOBLb1KcZfli2Sfeepce3TAmYQ22Qq1upRpNAsZou2njb9rkV4c0MRzMdwhPMwEcQCgDWo/VDxsOLkk=&_z_A0V5ayCQR0EAw9MiR-iA1MQAZsBKD5iT_eZeqUR-mqT2T-xMwoBzOA2BvbwjxQEXwJoiuAEGbrxTzJRFYMTVwhHGjwW-p";
|
||||
|
||||
//xlog( d3, 2, "repo_id " + repo_id );
|
||||
//xlog( d3, 2, "baseUri " + baseUri );
|
||||
//xlog( d3, 2, "authUsr " + authUsr );
|
||||
|
||||
def empfaenger = [];
|
||||
|
||||
def username = getUserIdpId( d3, "D3-User", repo_id, baseUri, authUsr );
|
||||
def username = getUserIdpId( d3, "D3-User", constantValues.repo_id, constantValues.baseUri, constantValues.authUsr );
|
||||
|
||||
//xlog( d3, 2, "username " + username );
|
||||
xlog( d3, 2, "username " + username );
|
||||
|
||||
|
||||
empfaenger.push( username );
|
||||
|
||||
def e = createTask( d3, user, docType, doc, "Neues Dokument", "Es wurde ein neues Dokument importiert: " + doc.id, empfaenger, baseUri, authUsr, repo_id );
|
||||
def e = createTask( d3, user, docType, doc, "Neues Dokument", "Es wurde ein neues Dokument importiert: " + doc.id, empfaenger, constantValues.baseUri, constantValues.authUsr, constantValues.repo_id );
|
||||
|
||||
|
||||
return 0;
|
||||
@@ -60,10 +54,16 @@ public class D3Hooks
|
||||
@Entrypoint( entrypoint = "hook_validate_import_entry_10" )
|
||||
public int hook_validate_import_entry_10( D3Interface d3, User user, DocumentType docType, Document doc, String nextcall )
|
||||
{
|
||||
doc.setStatus( "Freigabe" );
|
||||
d3.log.error( "START hook_validate_import_entry_10 " );
|
||||
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, 51 ) ) // Kundenstammdaten
|
||||
if ( doc.getStatus() != "DOC_STAT_RELEASE" )
|
||||
{
|
||||
doc.setStatus( "Freigabe" );
|
||||
}
|
||||
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, constantValues.GeschPNrId ) ) // Kundenstammdaten
|
||||
{
|
||||
if ( doc.field[ 6 ] )
|
||||
{
|
||||
@@ -144,11 +144,11 @@ public class D3Hooks
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// eingefügt von CALB/d.velop AG / 2024.06.12 / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 200)
|
||||
// eingefügt von CALB/d.velop AG / 2024.06.12 / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 240)
|
||||
|
||||
if ( ( isRepoIdInDocType( d3, docType.id, 48 ) ) && ( isRepoIdInDocType( d3, docType.id, 1 ) ) ) // Mandant / Buchungskreis ist in der Dokumentart enthalten
|
||||
if ( ( isRepoIdInDocType( d3, docType.id, constantValues.MandantId ) ) && ( isRepoIdInDocType( d3, docType.id, constantValues.BuKrsId ) ) ) // Mandant / Buchungskreis ist in der Dokumentart enthalten
|
||||
{
|
||||
if ( doc.field[ 39 ] == "200" )
|
||||
if ( doc.field[ 39 ] == "240" )
|
||||
{
|
||||
if ( doc.field[ 1 ] )
|
||||
{
|
||||
@@ -158,9 +158,9 @@ public class D3Hooks
|
||||
}
|
||||
else
|
||||
{
|
||||
def sqlQuery = "SELECT mandant_name FROM [D3ServiceT].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'";
|
||||
def sqlQuery = "SELECT mandant_name FROM [" + constantValues.DatabaseName + "].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'";
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def resultRows = sql.rows( sqlQuery );
|
||||
|
||||
@@ -171,10 +171,11 @@ public class D3Hooks
|
||||
}
|
||||
}
|
||||
|
||||
// Einfügung Ende / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 200)
|
||||
// Einfügung Ende / Setzen des Mandanten bei SAP-Dokumenten (Mandant = 240)
|
||||
///////////////////////////
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, 31 ) ) // Materialstammdaten, ID 31 => Materialnummer
|
||||
|
||||
if ( isRepoIdInDocType( d3, docType.id, constantValues.MatNrId ) ) // Materialstammdaten, ID 31 => Materialnummer
|
||||
{
|
||||
for ( int i = 1; i <= Integer.valueOf( d3.config.value( "CUR_60ER_FIELD_NR" ) ); i++ )
|
||||
{
|
||||
@@ -258,9 +259,9 @@ public class D3Hooks
|
||||
// Buchungskreis gefüllt, Firma aber nicht, d.h. offenbar ein Beleg aus SAP (=> da wird nur der Buchungskreis angegeben)
|
||||
// Firma wird aus Stammdaten gefüllt
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def row = sql.firstRow( "SELECT mandant_name FROM [D3ServiceT].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'" );
|
||||
def row = sql.firstRow( "SELECT mandant_name FROM [" + constantValues.DatabaseName + "].[dbo].[dv_mandant] where mandant_nr = '" + doc.field[ 1 ] + "'" );
|
||||
|
||||
if ( row )
|
||||
{
|
||||
@@ -317,6 +318,7 @@ public class D3Hooks
|
||||
// temporäres Objekt holen, um zu prüfen, das sich Eigenschaften geändert haben
|
||||
def oldDocAttributes = d3.archive.getDocument(doc.id());
|
||||
|
||||
|
||||
def ergebnis = hook_validate_update_entry_10( d3, user, docTypeNew, doc, "" );
|
||||
|
||||
d3.log.error("ENDE | hookUpdAttribEntry20")
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.dvelop.d3.server.ValueSetTranslation
|
||||
// Special libraries -----------------------------------------------------------------------------
|
||||
import groovy.sql.Sql;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
import constantValues;
|
||||
|
||||
public class D3ValueSets {
|
||||
|
||||
@@ -25,10 +25,9 @@ public class D3ValueSets {
|
||||
def getClient(D3Interface d3, RepositoryField reposField, User d3User, DocumentType docTypeShort, int row_no, int validate, Document docObj) {
|
||||
d3.log.info( "[DBS] START getClient");
|
||||
|
||||
def sqlQuery = """SELECT kuliname + ' | ' + strasse + ' | ' + plz + ' | ' + ort + ' | ' + land + ' | ' + kulinr
|
||||
FROM [D3ServiceT].[dbo].[dv_kulistamm] order by kuliname""";
|
||||
def sqlQuery = "SELECT kuliname + ' | ' + strasse + ' | ' + plz + ' | ' + ort + ' | ' + land + ' | ' + kulinr FROM [" + constantValues.DatabaseName + "].[dbo].[dv_kulistamm] order by kuliname";
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def resultRows = sql.rows( sqlQuery );
|
||||
def clientIDPList = [];
|
||||
@@ -57,10 +56,9 @@ public class D3ValueSets {
|
||||
def getClientNr(D3Interface d3, RepositoryField reposField, User d3User, DocumentType docTypeShort, int row_no, int validate, Document docObj) {
|
||||
d3.log.info( "[DBS] START getClientNr");
|
||||
|
||||
def sqlQuery = """SELECT kuliname + ' | ' + strasse + ' | ' + plz + ' | ' + ort + ' | ' + land + ' | ' + kulinr
|
||||
FROM [D3ServiceT].[dbo].[dv_kulistamm] order by kulinr""";
|
||||
def sqlQuery = "SELECT kuliname + ' | ' + strasse + ' | ' + plz + ' | ' + ort + ' | ' + land + ' | ' + kulinr FROM [" + constantValues.DatabaseName + "].[dbo].[dv_kulistamm] order by kulinr";
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def resultRows = sql.rows( sqlQuery );
|
||||
def clientIDPList = [];
|
||||
@@ -89,10 +87,9 @@ public class D3ValueSets {
|
||||
def getMaterialNr(D3Interface d3, RepositoryField reposField, User d3User, DocumentType docTypeShort, int row_no, int validate, Document docObj) {
|
||||
d3.log.info( "[DBS] START getMaterialNr");
|
||||
|
||||
def sqlQuery = """SELECT matnr + ' | ' + bez + ' | ' + fremdart + ' | ' + mat_such
|
||||
FROM [D3ServiceT].[dbo].[dv_artikelstamm] order by matnr""";
|
||||
def sqlQuery = "SELECT matnr + ' | ' + bez + ' | ' + fremdart + ' | ' + mat_such FROM [" + constantValues.DatabaseName + "].[dbo].[dv_artikelstamm] order by matnr";
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def resultRows = sql.rows( sqlQuery );
|
||||
def clientIDPList = [];
|
||||
@@ -107,10 +104,9 @@ public class D3ValueSets {
|
||||
def getMandantName(D3Interface d3, RepositoryField reposField, User d3User, DocumentType docTypeShort, int row_no, int validate, Document docObj) {
|
||||
d3.log.info( "[DBS] START getMandantName");
|
||||
|
||||
def sqlQuery = """SELECT mandant_nr + ' | ' + mandant_name
|
||||
FROM [D3ServiceT].[dbo].[dv_mandant] order by mandant_nr""";
|
||||
def sqlQuery = "SELECT mandant_nr + ' | ' + mandant_name FROM [" + constantValues.DatabaseName + "].[dbo].[dv_mandant] order by mandant_nr";
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def resultRows = sql.rows( sqlQuery );
|
||||
def clientIDPList = [];
|
||||
@@ -126,10 +122,9 @@ public class D3ValueSets {
|
||||
def getMandantNr(D3Interface d3, RepositoryField reposField, User d3User, DocumentType docTypeShort, int row_no, int validate, Document docObj) {
|
||||
d3.log.info( "[DBS] START getMandantNr");
|
||||
|
||||
def sqlQuery = """SELECT mandant_nr + ' | ' + mandant_name
|
||||
FROM [D3ServiceT].[dbo].[dv_mandant] order by mandant_nr""";
|
||||
def sqlQuery = "SELECT mandant_nr + ' | ' + mandant_name FROM [" + constantValues.DatabaseName + "].[dbo].[dv_mandant] order by mandant_nr";
|
||||
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=D3ServiceT", 'd3DBAdminT', 'Dvelop1!', 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
def sql = groovy.sql.Sql.newInstance( "jdbc:sqlserver://d3sql;databaseName=" + constantValues.DatabaseName, constantValues.DatabaseUser, constantValues.DatabasePassword, 'com.microsoft.sqlserver.jdbc.SQLServerDriver' );
|
||||
|
||||
def resultRows = sql.rows( sqlQuery );
|
||||
def clientIDPList = [];
|
||||
|
||||
14
g.rau/constantValues.groovy
Normal file
14
g.rau/constantValues.groovy
Normal file
@@ -0,0 +1,14 @@
|
||||
public class constantValues
|
||||
{
|
||||
static final String DatabaseName = "D3ServiceP";
|
||||
static final String DatabaseUser = "d3DBAdminT";
|
||||
static final String DatabasePassword = "Dvelop1!";
|
||||
|
||||
static final String repo_id = "2e0f1447-d775-51aa-8593-0e0a5d9662aa";
|
||||
static final String baseUri = "https://d3ecm.rau.rau-pforzheim.de";
|
||||
static final String authUsr = "Zyu0W+L0fb6HF0sxPRyPdETFQFBCTOBLb1KcZfli2Sfeepce3TAmYQ22Qq1upRpNAsZou2njb9rkV4c0MRzMdwhPMwEcQCgDWo/VDxsOLkk=&_z_A0V5ayCQR0EAw9MiR-iA1MQAZsBKD5iT_eZeqUR-mqT2T-xMwoBzOA2BvbwjxQEXwJoiuAEGbrxTzJRFYMTVwhHGjwW-p";
|
||||
static final int GeschPNrId = 51;
|
||||
static final int MandantId = 48;
|
||||
static final int BuKrsId = 1;
|
||||
static final int MatNrId = 31;
|
||||
}
|
||||
Reference in New Issue
Block a user