Files
n8n-workflows/palletways/Palletways Status TP--_PW.json

1005 lines
28 KiB
JSON

{
"name": "Palletways Status TP-->PW",
"nodes": [
{
"parameters": {
"options": {}
},
"id": "fb058d6b-f234-41f2-ace2-617e5a579f22",
"name": "Parse XML to JSON",
"type": "n8n-nodes-base.xml",
"typeVersion": 1,
"position": [
768,
-96
]
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "b2e41c2d-3ee9-4ecb-a13f-df6fa1c7ade0",
"leftValue": "={{ $json.shipment.status.description }}",
"rightValue": "Send to OBC",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Send to OBC"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "6e4f9c09-50d7-43b9-b89b-7e8fd9ee9801",
"leftValue": "={{ $json.shipment.status.code }}",
"rightValue": "800",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "in uitlevering"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "e29fd6d4-e802-4578-8683-af0fc45df778",
"leftValue": "={{ $json.shipment.status.code }}",
"rightValue": "600",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Begin lossen"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "f8a3fe31-c4f3-47bf-a5a0-5e5fbb6e8bf7",
"leftValue": "={{ $json.shipment.status.code }}",
"rightValue": "601",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Afgeleverd"
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.3,
"position": [
992,
-112
],
"id": "daba04a6-1031-4457-805e-a5d06b990d33",
"name": "Switch"
},
{
"parameters": {
"path": "={{ $json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
224,
-64
],
"id": "4698ff26-cd96-4210-ae9e-890d758cb724",
"name": "Download file",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"operation": "delete",
"path": "={{ $('Download file').item.json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1664,
-640
],
"id": "06af28b9-d0d9-4bea-8afe-84ae0184c433",
"name": "FTP1",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"method": "POST",
"url": "=https://api.palletways.com/createsystemnote/?apikey=SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus%3D&commit=true'",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"name": "apikey",
"value": "SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus="
},
{
"name": "inputformat",
"value": "json"
},
{
"name": "outputformat",
"value": "json"
},
{
"name": "commit",
"value": "true"
},
{
"name": "data",
"value": "={{ JSON.stringify($json) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1664,
-832
],
"id": "1283e55c-a44e-46ef-a863-8048cdc1a323",
"name": "Post Note",
"disabled": true
},
{
"parameters": {
"operation": "delete",
"path": "={{ $('Download file').item.json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1888,
-832
],
"id": "84c0e11c-366a-42f8-b701-e7aa0f2757fb",
"name": "Verwijder note bestand",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "*/3 6-22 * * 1-5"
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
-416,
-64
],
"id": "77d08df2-d3b9-44b9-bb25-5a94ad506ad1",
"name": "Schedule Trigger"
},
{
"parameters": {
"operation": "list",
"path": "/prod/FromTP/status/pw/",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
-192,
-64
],
"id": "bc287028-ffb8-4678-9996-0c8f26098080",
"name": "List files",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "a9b06c99-6c78-4262-8bb9-432cb840c103",
"leftValue": "={{ $json.path }}",
"rightValue": ".xml",
"operator": {
"type": "string",
"operation": "contains"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.2,
"position": [
32,
-64
],
"id": "cd04cdd3-641e-44a7-9bfb-e60d84180392",
"name": "Filter alleen .xml"
},
{
"parameters": {
"operation": "xml",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
464,
-64
],
"id": "8a1a147a-4603-41ee-8229-049ed4b29290",
"name": "Extract from File"
},
{
"parameters": {
"operation": "delete",
"path": "={{ $('Download file').item.json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1440,
-448
],
"id": "2f83780b-bb47-43fc-b0d9-2350217b52db",
"name": "FTP2",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.shipment.status.planleg.Legtype_planleg }}",
"rightValue": "laden",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "29ffb651-831a-4bed-80c5-20d934de7c55"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "laden"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "783d8d52-efe5-4aeb-bbc6-3b41fdd3bc1f",
"leftValue": "={{ $json.shipment.status.planleg.Legtype_planleg }}",
"rightValue": "lossen",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "lossen"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "7662e24c-218c-44e5-a6d1-1853a846c7e4",
"leftValue": "={{ $json.shipment.status.planleg.Legtype_planleg }}",
"rightValue": "direct",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "direct"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.3,
"position": [
1216,
-656
],
"id": "e4bd6b02-2a0d-4b09-9271-34872b025d93",
"name": "Send to OBC"
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={\n \"notes\": {\n \"header\": {\n \"create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"orig_filename\": \"myfilename.xml\",\n \"notes_qty\": 1\n },\n \"note\": [\n {\n \"pw_id\": \"{{ $json.shipment.edireference }}\",\n \"barcode\": \"\",\n \"note_create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"note_create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"customer_name\": \"CustomerName1\",\n \"bin_ref\": \"TheBinRef_1\",\n \"free_text\": \"Gepland om te laden {{ \n (() => {\n const raw = $json.shipment.status.planleg.Begin_adres_eta || '';\n const parts = raw.split(' ');\n if (parts.length < 2) return '';\n const timePart = parts[1];\n const [hStr, mStr, sStr] = timePart.split(':');\n let h = Number(hStr);\n let m = Number(mStr);\n let s = Number(sStr || 0);\n if (s > 0) { m += 1; s = 0; }\n let totalMinutes = h * 60 + m;\n totalMinutes = Math.ceil(totalMinutes / 5) * 5;\n h = Math.floor(totalMinutes / 60);\n m = totalMinutes % 60;\n const hh = String(h).padStart(2, '0');\n const mm = String(m).padStart(2, '0');\n return `${hh}:${mm}`;\n })() \n}} chauffeur {{ $json.shipment.status.planleg.chauffeur }} kenteken {{ $json.shipment.status.planleg.Kenteken }}\",\n \"note_group\": \"JIN\",\n \"note_type\": \"GIN\",\n \"note_description\": \"nn\"\n }\n \n ]\n }\n} ",
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1440,
-832
],
"id": "41fd7a10-8708-40a5-96b7-b69b831b8fef",
"name": "Create Collection Note"
},
{
"parameters": {
"method": "POST",
"url": "=https://api.palletways.com/createsystemnote/?apikey=SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus%3D&commit=true",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"name": "apikey",
"value": "SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus="
},
{
"name": "inputformat",
"value": "json"
},
{
"name": "outputformat",
"value": "json"
},
{
"name": "commit",
"value": "true"
},
{
"name": "data",
"value": "={{ JSON.stringify($json) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1440,
-256
],
"id": "ebcdf42c-6a8f-4409-bbeb-e2c32bb53be7",
"name": "Post Note2"
},
{
"parameters": {
"method": "POST",
"url": "=https://portal.palletways.com/api/setETA/{{ $json.shipment.reference }}/{{ $json.shipment.status.planleg.Eind_addres_eta }}?apikey=SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus%3D&",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"name": "apikey",
"value": "SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus="
},
{
"name": "inputformat",
"value": "json"
},
{
"name": "outputformat",
"value": "json"
},
{
"name": "commit",
"value": "true"
},
{
"name": "data",
"value": "={{ JSON.stringify($json) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1440,
-640
],
"id": "acbb4e23-4bdf-4d0b-acb6-080f892ad313",
"name": "Post ETA"
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={\n \"notes\": {\n \"header\": {\n \"create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"orig_filename\": \"myfilename.xml\",\n \"notes_qty\": 1\n },\n \"note\": [\n {\n \"pw_id\": \"{{ $json.shipment.edireference }}\",\n \"barcode\": \"{{ $json.shipment.status.planleg.Barcode }}\",\n \"note_create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"note_create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"customer_name\": \"CustomerName1\",\n \"bin_ref\": \"TheBinRef_1\",\n \"free_text\": \"Gescand op voertuig {{ $json.shipment.status.planleg.Kenteken }} bij Depot 464\",\n \"note_group\": \"VL\",\n \"note_type\": \"SCN\",\n \"note_description\": \"{{ $json.shipment.status.planleg.Kenteken }}\"\n }\n \n ]\n }\n} ",
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1216,
-256
],
"id": "0777ac33-300a-4f3c-92f0-b56d0dc74417",
"name": "Create OFD Note"
},
{
"parameters": {
"operation": "delete",
"path": "={{ $('Download file').item.json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1664,
-256
],
"id": "df07a69f-5d5e-4b2b-99b1-f0bdaf5aa053",
"name": "FTP3",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"operation": "delete",
"path": "={{ $('Download file').item.json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1216,
320
],
"id": "a51d1062-ea66-43e2-97ae-2eb311b9ea1f",
"name": "FTP",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"method": "POST",
"url": "=https://api.palletways.com/createsystemnote/?apikey=SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus%3D&commit=true",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"name": "apikey",
"value": "SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus="
},
{
"name": "inputformat",
"value": "json"
},
{
"name": "outputformat",
"value": "json"
},
{
"name": "commit",
"value": "true"
},
{
"name": "data",
"value": "={{ JSON.stringify($json) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1440,
-64
],
"id": "6894bbb0-8fc2-47bb-b72b-6520044424e0",
"name": "Post Note3"
},
{
"parameters": {
"operation": "delete",
"path": "={{ $('Download file').item.json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1664,
-64
],
"id": "fdd4e0c5-246f-4ac4-b158-700b6232d075",
"name": "FTP4",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={\n \"notes\": {\n \"header\": {\n \"create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"orig_filename\": \"myfilename.xml\",\n \"notes_qty\": 1\n },\n \"note\": [\n {\n \"pw_id\": \"{{ $json.shipment.edireference }}\",\n \"barcode\": \"{{ $json.shipment.status.planleg.Barcode }}\",\n \"note_create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"note_create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"customer_name\": \"CustomerName1\",\n \"bin_ref\": \"TheBinRef_1\",\n \"free_text\": \"Driver arrived at location: {{ $json.shipment.status.position.latitude }},{{ $json.shipment.status.position.longitude }} \",\n \"note_group\": \"VP\",\n \"note_type\": \"DAR\",\n \"note_description\": \"{{ $json.shipment.status.planleg.Kenteken }}\"\n }\n \n ]\n }\n} ",
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1216,
-64
],
"id": "cabb6ce3-0af7-4eb9-9bd9-d0da4cffbede",
"name": "Create Begin Lossen"
},
{
"parameters": {
"method": "POST",
"url": "=https://api.palletways.com/createsystemnote/?apikey=SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus%3D&commit=true",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"name": "apikey",
"value": "SXJaM7PLjZDqfsnXSDP8Y9wDY6crxJySBg705MQEPus="
},
{
"name": "inputformat",
"value": "json"
},
{
"name": "outputformat",
"value": "json"
},
{
"name": "commit",
"value": "true"
},
{
"name": "data",
"value": "={{ JSON.stringify($json) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
1440,
128
],
"id": "39df5a62-2fd7-4a6d-95b5-7eceb7484177",
"name": "Post Note4"
},
{
"parameters": {
"operation": "delete",
"path": "={{ $('Download file').item.json.path }}",
"options": {}
},
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1664,
128
],
"id": "455c7c4a-f470-40b5-b246-703a783fdf2a",
"name": "FTP5",
"credentials": {
"ftp": {
"id": "oLAZ4OgmkOopMHAq",
"name": "FTP De Wit Transport"
}
}
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={\n \"notes\": {\n \"header\": {\n \"create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"orig_filename\": \"myfilename.xml\",\n \"notes_qty\": 1\n },\n \"note\": [\n {\n \"pw_id\": \"{{ $json.shipment.edireference }}\",\n \"barcode\": \"{{ $json.shipment.status.planleg.Barcode }}\",\n \"note_create_date\": \"{{$now.toFormat('dd/LL/yy')}}\",\n \"note_create_time\": \"{{$now.toFormat('HH:mm')}}\",\n \"customer_name\": \"{{ $json.shipment.status.planleg.signdby }}\",\n \"bin_ref\": \"TheBinRef_1\",\n \"free_text\": \"\",\n \"note_group\": \"POD\",\n \"note_type\": \"POD\",\n \"note_description\": \"{{ $json.shipment.status.planleg.Kenteken }}\"\n }\n \n ]\n }\n} ",
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1216,
128
],
"id": "75b42d2d-8065-4762-953f-fc1bd1c7f777",
"name": "Create Afgeleverd note"
}
],
"pinData": {},
"connections": {
"Parse XML to JSON": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Send to OBC",
"type": "main",
"index": 0
}
],
[
{
"node": "Create OFD Note",
"type": "main",
"index": 0
}
],
[
{
"node": "Create Begin Lossen",
"type": "main",
"index": 0
}
],
[
{
"node": "Create Afgeleverd note",
"type": "main",
"index": 0
}
],
[
{
"node": "FTP",
"type": "main",
"index": 0
}
]
]
},
"Download file": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Post Note": {
"main": [
[
{
"node": "Verwijder note bestand",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "List files",
"type": "main",
"index": 0
}
]
]
},
"List files": {
"main": [
[
{
"node": "Filter alleen .xml",
"type": "main",
"index": 0
}
]
]
},
"Filter alleen .xml": {
"main": [
[
{
"node": "Download file",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Parse XML to JSON",
"type": "main",
"index": 0
}
]
]
},
"Send to OBC": {
"main": [
[
{
"node": "Create Collection Note",
"type": "main",
"index": 0
}
],
[
{
"node": "Post ETA",
"type": "main",
"index": 0
}
],
[
{
"node": "FTP2",
"type": "main",
"index": 0
}
]
]
},
"Create Collection Note": {
"main": [
[
{
"node": "Post Note",
"type": "main",
"index": 0
}
]
]
},
"Post Note2": {
"main": [
[
{
"node": "FTP3",
"type": "main",
"index": 0
}
]
]
},
"Post ETA": {
"main": [
[
{
"node": "FTP1",
"type": "main",
"index": 0
}
]
]
},
"Create OFD Note": {
"main": [
[
{
"node": "Post Note2",
"type": "main",
"index": 0
}
]
]
},
"Post Note3": {
"main": [
[
{
"node": "FTP4",
"type": "main",
"index": 0
}
]
]
},
"Create Begin Lossen": {
"main": [
[
{
"node": "Post Note3",
"type": "main",
"index": 0
}
]
]
},
"Post Note4": {
"main": [
[
{
"node": "FTP5",
"type": "main",
"index": 0
}
]
]
},
"Create Afgeleverd note": {
"main": [
[
{
"node": "Post Note4",
"type": "main",
"index": 0
}
]
]
},
"FTP5": {
"main": [
[]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"timezone": "Europe/Amsterdam",
"callerPolicy": "workflowsFromSameOwner",
"availableInMCP": false,
"timeSavedMode": "fixed",
"timeSavedPerExecution": 1,
"errorWorkflow": "1Ps5lukDf2sgcGL7"
},
"versionId": "52fea8f1-0e86-4704-859e-15d013105cf1",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "bef8d409866a58c0777dfe7cca1b9c2400fd051c056d361501393ab423006b5f"
},
"nodeGroups": [],
"id": "8btNgoEz6exsoU4x",
"tags": []
}