CSUN#38640 -- Koppeling CSU met PostNL
svn path=/Website/branches/v2016.3/; revision=32642
This commit is contained in:
39
CUST/CSUN/import/PostNLAxxerion.xsl
Normal file
39
CUST/CSUN/import/PostNLAxxerion.xsl
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<xsl:output method="xml" indent="yes" encoding="utf-8" />
|
||||
<xsl:decimal-format name="european" decimal-separator="," grouping-separator="." />
|
||||
<xsl:param name="mode" />
|
||||
<xsl:variable name="Rev">
|
||||
<xsl:value-of select="substring(translate('$Revision$', '$ ', ''), 10)" />
|
||||
</xsl:variable>
|
||||
<xsl:template match="werkorder">
|
||||
<facilitor>
|
||||
<xsl:element name="melding">
|
||||
<xsl:attribute name="key">
|
||||
<xsl:value-of select="referencereq"/></xsl:attribute>
|
||||
<xsl:attribute name="type">unknown</xsl:attribute>
|
||||
<datum><xsl:value-of select="concat('20',substring(senddate,1,2), '-', substring(senddate,4,2), '-', substring(senddate,7,2), 'T', substring(senddate,10,5))"/></datum>
|
||||
<stdmelding>41</stdmelding>
|
||||
<omschrijving>
|
||||
Extern nummer: <xsl:value-of select="referencereq"/>
|
||||
Melder: <xsl:value-of select="concat(requestorfirstname, ' ', requestorlastname)"/>
|
||||
Kostenplaats: <xsl:value-of select="costcenter"/>
|
||||
Telefoonnummer: <xsl:value-of select="telephonereq"/>
|
||||
Emailadres: <xsl:value-of select="emaildadres"/>
|
||||
Omschrijving: <xsl:value-of select="description"/>
|
||||
Locatie: <xsl:value-of select="dimensioncode"/>
|
||||
Ruimte: <xsl:value-of select="area"/>
|
||||
</omschrijving>
|
||||
</xsl:element>
|
||||
</facilitor>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="facilitor">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
<!-- Stylesheet edited using Stylus Studio - (c) 2004-2007. Progress Software Corporation. All rights reserved. --><!-- Stylesheet edited using Stylus Studio - (c) 2004-2007. Progress Software Corporation. All rights reserved. --><!-- Stylesheet edited using Stylus Studio - (c) 2004-2007. Progress Software Corporation. All rights reserved. --><!-- Stylesheet edited using Stylus Studio - (c) 2004-2007. Progress Software Corporation. All rights reserved. --><!-- Stylesheet edited using Stylus Studio - (c) 2004-2007. Progress Software Corporation. All rights reserved. --><!-- Stylesheet edited using Stylus Studio - (c) 2004-2007. Progress Software Corporation. All rights reserved. --><!-- Stylesheet edited using Stylus Studio - (c) 2004-2007. Progress Software Corporation. All rights reserved. -->
|
||||
115
CUST/CSUN/import/api_mldsoap_axxerion.js
Normal file
115
CUST/CSUN/import/api_mldsoap_axxerion.js
Normal file
@@ -0,0 +1,115 @@
|
||||
// GetStatus.js
|
||||
// Haalt statuswijzigingen op van de FTP server.
|
||||
//
|
||||
// $Revision$
|
||||
// $Id$
|
||||
//
|
||||
// Opzet in kader van PNBR#
|
||||
|
||||
function padout(number) { return (number < 10) ? "0" + number : number; }
|
||||
|
||||
function date2string(mydate) {
|
||||
return padout(mydate.getFullYear()) + "-" + padout(mydate.getMonth() + 1) + "-" + padout(mydate.getDate())
|
||||
+ " " + padout(mydate.getHours()) + "-" + padout(mydate.getMinutes() + 1) + "-" + padout(mydate.getSeconds());
|
||||
}
|
||||
|
||||
var api = WScript.Arguments(0); // api
|
||||
var folder = WScript.Arguments(1); // folder
|
||||
var url = WScript.Arguments(2); // url
|
||||
|
||||
try {
|
||||
var fh, lenght;
|
||||
|
||||
fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
objRS = new ActiveXObject("ADODB.Recordset");
|
||||
objRS.CursorLocation = 3 // useClient
|
||||
objRS.Fields.Append ("Name", 200, 100) // adVarChar
|
||||
objRS.Fields.Append ("created", 7 ) // adDate
|
||||
objRS.Open();
|
||||
|
||||
try
|
||||
{
|
||||
var backdir_api = ".\\BACKUP"+(new Date).getFullYear()+"\\";
|
||||
if (!fso.FolderExists(backdir_api))
|
||||
fso.CreateFolder(backdir_api);
|
||||
backdir_api += api + "\\";
|
||||
if (!fso.FolderExists(backdir_api))
|
||||
fso.CreateFolder(backdir_api);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
WScript.Echo("Cannot create backup folder " + backDir + "\n" + e.description);
|
||||
WScript.Quit();
|
||||
}
|
||||
|
||||
// plaats de bestandsnamen en creatiedata in een resultset om deze vervolgens te kunnen filteren.
|
||||
folder = folder.replace(/\//g,"\\");
|
||||
//WScript.Echo("Folder: " + folder);
|
||||
var f = fso.GetFolder(folder);
|
||||
var fc = new Enumerator(f.files);
|
||||
var filecount = 0;
|
||||
for (; !fc.atEnd(); fc.moveNext())
|
||||
{
|
||||
filename = fc.item().name;
|
||||
//WScript.Echo("File: " + filename);
|
||||
var file = fso.GetFile(folder + filename);
|
||||
var dt = new Date(file.DateCreated);
|
||||
|
||||
//WScript.Echo("File: " + filename + " timestamp:" + date2string(dt));
|
||||
if (fc.item().name.toUpperCase().indexOf(".XML") != -1 && fc.item().name.toUpperCase().indexOf("WORKORDER") != -1) {
|
||||
filecount++;
|
||||
objRS.AddNew();
|
||||
objRS("Name") = filename;
|
||||
objRS("created") = file.DateCreated;
|
||||
}
|
||||
}
|
||||
if (filecount > 0) {
|
||||
objRS.Sort = "created ASC";
|
||||
objRS.MoveFirst();
|
||||
while (!objRS.EOF)
|
||||
{
|
||||
filename = objRS("Name").Value;
|
||||
WScript.Echo("File (sorted): " + filename);
|
||||
objRS.MoveNext();
|
||||
var fileStream = new ActiveXObject("ADODB.Stream");
|
||||
fileStream.open();
|
||||
fileStream.CharSet = "Windows-1252"; // het doel
|
||||
fileStream.LoadFromFile(folder + filename);
|
||||
//WScript.Echo("Filesize " + fileStream.Size);
|
||||
fileStream.Position = 0;
|
||||
//WScript.Echo("Request1: " + fileStream.ReadText);
|
||||
XMLReq = fileStream.ReadText;
|
||||
WScript.Echo("Request: " + XMLReq);
|
||||
var objXMLHTTP = new ActiveXObject("MSXML2.ServerXMLHTTP.6.0");
|
||||
|
||||
objXMLHTTP.open("POST",
|
||||
url
|
||||
);
|
||||
|
||||
objXMLHTTP.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
||||
objXMLHTTP.send(XMLReq);
|
||||
|
||||
//WScript.Echo("Status: " + objXMLHTTP.status);
|
||||
//WScript.Echo("StatusText: " + objXMLHTTP.statusText);
|
||||
WScript.Echo("Result: " + objXMLHTTP.responseText);
|
||||
|
||||
if (objXMLHTTP.status == 200) {
|
||||
jsDate = new Date;
|
||||
dateString = padout(jsDate.getFullYear()) + "-" + padout(jsDate.getMonth() + 1) + "-" + padout(jsDate.getDate());
|
||||
timeString = padout(jsDate.getHours()) + "-" + padout(jsDate.getMinutes() + 1) + "-" + padout(jsDate.getSeconds());
|
||||
backDir = backdir_api + dateString + "_" + api + "\\";
|
||||
if (!fso.FolderExists(backDir))
|
||||
fso.CreateFolder(backDir)
|
||||
// deze file backuppen
|
||||
//WScript.Echo("from:" + filename);
|
||||
//WScript.Echo("to:" + backDir + timeString + "_" + filename);
|
||||
fso.MoveFile(folder + filename, backDir + timeString + "_" + filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
WScript.Echo("Serieuze fout in api_opdrsoap_com4.js: " + e.description)
|
||||
WScript.Quit(1);
|
||||
}
|
||||
27
CUST/CSUN/import/gen_import_mld_axxerion.bat
Normal file
27
CUST/CSUN/import/gen_import_mld_axxerion.bat
Normal file
@@ -0,0 +1,27 @@
|
||||
REM GEN_IMPORT_MLD_AXXERION.BAT
|
||||
REM
|
||||
REM Importeert meldingen vanuit Axxerion van PostNL
|
||||
REM
|
||||
REM Context : roep deze file aan indien nodig, of schedule deze
|
||||
REM Verseist: de randvoorwaarde voor het gebruik van gen_import
|
||||
REM
|
||||
REM $Revision$
|
||||
REM $Id$
|
||||
REM
|
||||
REM (c) 2010, SG|facilitor bv, +31 (53) 4800700, support@sgfacilitor.nl
|
||||
REM
|
||||
|
||||
|
||||
REM melding toevoegen
|
||||
cscript .\api_mldsoap_axxerion.js POSTNL2CSUN d:\Apps\Facilitor\ftp_sites\LocalUser\CSUN\meldingen\ "https://csun.facilitor.nl/default.asp?fac_id=CSUN&API=POSTNL2CSUN&APIKEY=NBnosuzMZGS9u3KoBJe5lIvOTGumSbcz" >>genimport.log 2>>&1
|
||||
|
||||
REM bijlagen toevoegen
|
||||
REM move D:\Apps\Facilitor\ftp_sites\RABO\bijlagen\bijlagen*.xml .
|
||||
REM cscript ..\..\..\utils\gen_import\gen_import.wsf RABO BIJLAGEN >>genimport.log 2>>&1
|
||||
REM CALL ..\..\..\utils\gen_export\gen_export.bat BIJLAGEN >>genimport.log 2>>&1
|
||||
REM CALL AxxerionBijlagen.bat >>genimport.log 2>>&1
|
||||
|
||||
REM @Work
|
||||
REM cscript .\api_mldsoap_axxerion.js POSTNL2CSUN d:\Apps\Facilitor\Branch20163\CUST\CSUN\import\ "http://facws001/branch20163/default.asp?fac_id=CSUN&API=POSTNL2CSUN&APIKEY=NBnosuzMZGS9u3KoBJe5lIvOTGumSbcz" >>genimport.log 2>>&1
|
||||
|
||||
:einde
|
||||
Reference in New Issue
Block a user