n8n-backup/workflows/MT - Aufträge.json

603 lines
14 KiB
JSON

{
"active": false,
"connections": {
"Auftragsdaten CSV einlesen": {
"main": [
[
{
"node": "In Billbee Format umwandeln",
"type": "main",
"index": 0
}
]
]
},
"FTP": {
"main": [
[
{
"node": "FTP1",
"type": "main",
"index": 0
}
]
]
},
"PDF": {
"main": [
[
{
"node": "Dokumente hochladen",
"type": "main",
"index": 0
}
],
[
{
"node": "Auftragsdaten CSV einlesen",
"type": "main",
"index": 0
}
]
]
},
"FTP1": {
"main": [
[
{
"node": "PDF",
"type": "main",
"index": 0
}
]
]
},
"Rückmeldung CSV erzeugen": {
"main": [
[
{
"node": "FTP2",
"type": "main",
"index": 0
}
]
]
},
"In Ausgabeformat umwandeln": {
"main": [
[
{
"node": "Rückmeldung CSV erzeugen",
"type": "main",
"index": 0
}
]
]
},
"Webhook für Billbee": {
"main": [
[
{
"node": "In Ausgabeformat umwandeln",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "FTP",
"type": "main",
"index": 0
}
]
]
},
"In Billbee Format umwandeln": {
"main": [
[
{
"node": "Api-Key",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Bestellung an Billbee senden": {
"main": [
[
{
"node": "Ins Archiv verschieben",
"type": "main",
"index": 0
}
]
]
},
"Dokumente hochladen": {
"main": [
[
{
"node": "Ins Archiv verschieben1",
"type": "main",
"index": 0
}
]
]
},
"Api-Key": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Bestellung an Billbee senden",
"type": "main",
"index": 0
}
]
]
}
},
"createdAt": "2023-08-25T09:49:59.525Z",
"id": "5",
"name": "MT - Aufträge",
"nodes": [
{
"parameters": {
"protocol": "sftp",
"operation": "list",
"path": "/out"
},
"id": "ba2e889a-bb18-4892-8d24-5a55c2fbd6c7",
"name": "FTP",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
-600,
400
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"authentication": "basicAuth",
"requestMethod": "POST",
"url": "https://app.billbee.io/api/v1/orders?shopId=97989",
"jsonParameters": true,
"options": {
"fullResponse": false
},
"bodyParametersJson": "={{$json}}",
"headerParametersJson": "={\n \"Content-Type\":\"application/json\",\n \"X-Billbee-Api-Key\":\"{{$node[\"Api-Key\"].json[\"stdout\"]}}\"\n }"
},
"name": "Bestellung an Billbee senden",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1140,
440
],
"id": "00be2cc0-8c39-48ab-90d8-ca331c38d08e",
"credentials": {
"httpBasicAuth": {
"id": "2",
"name": "Billbee"
}
}
},
{
"parameters": {
"operation": "toFile",
"fileFormat": "csv",
"options": {
"fileName": "=DESADV_ORD_{{$now}}.csv",
"headerRow": true
}
},
"id": "2c9c4207-9f54-4241-968e-bfb40b773746",
"name": "Rückmeldung CSV erzeugen",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
-360,
680
]
},
{
"parameters": {
"binaryPropertyName": "=data",
"options": {
"headerRow": true
}
},
"id": "44087b14-bb6a-40c6-8774-960d8146f57c",
"name": "Auftragsdaten CSV einlesen",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
180,
420
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"name\"]}}",
"operation": "endsWith",
"value2": "pdf"
}
]
}
},
"id": "8e5876bb-5c18-4e23-a9cc-b1de8dca44cd",
"name": "PDF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-140,
400
]
},
{
"parameters": {
"protocol": "sftp",
"path": "=/out/{{$json[\"name\"]}}"
},
"id": "483244e0-0e2b-4ddf-b9b4-e281553b44e4",
"name": "FTP1",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
-360,
400
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"protocol": "sftp",
"operation": "rename",
"oldPath": "={{$node[\"PDF\"].binary.data.directory}}/{{$node[\"PDF\"].binary.data.fileName}}",
"newPath": "=/archiv/{{$node[\"PDF\"].binary.data.fileName}}",
"options": {}
},
"id": "773eb234-4f45-4ce5-bb54-aa5bb92edd22",
"name": "Ins Archiv verschieben",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
1340,
440
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"protocol": "sftp",
"operation": "upload",
"path": "=/in/{{$binary.data.fileName}}"
},
"id": "acb8aa11-0841-4f51-9a4f-cfed549b018c",
"name": "FTP2",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
-120,
680
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"jsCode": "let lines = [];\n\nfor (const item of $input.all()) {\n let parcel_type;\n switch(item.json.query.id) {\n case \"Eurocourier\":\n parcel_type = \"EC_STD_NATIONAL\";\n break;\n case \"GLS\":\n parcel_type = \"GLS_STD_NATIONAL\";\n break;\n default:\n parcel_type = \"DPD_STD_NATIONAL\";\n}\n let line = {\n \"TB_ORDER_ID\": item.json.query.id,\n \"ORDER_PAID\" : 0,\n \"TYPE\" : item.json.query.type,\n \"PARCEL_TYPE\": parcel_type,\n \"SHIP_CODE\" : item.json.query.shipment,\n \"COMMENT_INTERN\" : \"\",\n \"COMMENT\" : \"\",\n }; \n lines.push(line);\n}\n\nreturn lines;"
},
"id": "8cad55fd-7cf8-4264-b733-8c0887009c89",
"name": "In Ausgabeformat umwandeln",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
-600,
680
]
},
{
"parameters": {
"path": "1730d70c-f532-4b6f-a20e-e2fc7edb2d45",
"options": {}
},
"id": "5661688b-d65b-4703-a422-67387bfd37c3",
"name": "Webhook für Billbee",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
-840,
680
],
"webhookId": "1730d70c-f532-4b6f-a20e-e2fc7edb2d45"
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours"
}
]
}
},
"id": "37ae4d6d-fc48-475f-9ed2-8837774daab1",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1,
"position": [
-840,
400
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "CreatedAt",
"value": "={{ $today.toISODate()}}"
},
{
"name": "Ordernumber",
"value": "={{ $json[\"TB_ORDER_ID\"] }}"
},
{
"name": "invoiceAddress.Company",
"value": "={{ $json[\"CUST_SHIP_EXTENSION\"] }}"
},
{
"name": "invoiceAddress.Company",
"value": "={{ $json[\"CUST_SHIP_SURNAME\"] }}"
},
{
"name": "invoiceAddress.Street",
"value": "={{ $json[\"CUST_SHIP_STREET_NO\"] }}"
},
{
"name": "invoiceAddress.City",
"value": "={{ $json[\"CUST_SHIP_CITY\"] }}"
},
{
"name": "invoiceAddress.Zip",
"value": "={{$json[\"CUST_SHIP_ZIP\"]}}"
},
{
"name": "invoiceAddress.Country",
"value": "={{ $json[\"CUST_SHIP_COUNTRY_CODE\"] }}"
},
{
"name": "invoiceAddress.CountryISO2",
"value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}"
},
{
"name": "invoiceAddress.FirstName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "invoiceAddress.LastName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "invoiceAddress.Email",
"value": "={{$json[\"CUST_SHIP_EMAIL\"]}}"
},
{
"name": "shippingAddress.Company",
"value": "={{ $json[\"CUST_SHIP_EXTENSION\"] }}"
},
{
"name": "shippingAddress.Company",
"value": "={{ $json[\"CUST_SHIP_SURNAME\"] }}"
},
{
"name": "shippingAddress.Street",
"value": "={{ $json[\"CUST_SHIP_STREET_NO\"] }}"
},
{
"name": "shippingAddress.City",
"value": "={{ $json[\"CUST_SHIP_CITY\"] }}"
},
{
"name": "shippingAddress.Zip",
"value": "={{$json[\"CUST_SHIP_ZIP\"]}}"
},
{
"name": "shippingAddress.Country",
"value": "={{ $json[\"CUST_SHIP_COUNTRY_CODE\"] }}"
},
{
"name": "shippingAddress.CountryISO2",
"value": "={{$json[\"CUST_SHIP_COUNTRY_CODE\"]}}"
},
{
"name": "shippingAddress.FirstName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "shippingAddress.LastName",
"value": "={{$json[\"CUST_SHIP_FIRSTNAME\"]}}"
},
{
"name": "shippingAddress.Email",
"value": "={{$json[\"CUST_SHIP_EMAIL\"]}}"
},
{
"name": "=orderItems[0].product.SKU",
"value": "={{$json[\"POS_TEXT\"]}}"
},
{
"name": "=orderItems[0].Quantity",
"value": "={{$json[\"POS_QUANTITY\"]}}"
},
{
"name": "=orderItems[0].TotalPrice",
"value": "={{$json[\"POS_SALESPRICE\"]}}"
},
{
"name": "Customer.Name",
"value": "MyToys Group"
},
{
"name": "Customer.Email",
"value": "dev@lanakk.com"
}
],
"number": [
{
"name": "PaymentMethod",
"value": 26
},
{
"name": "Customer.Id",
"value": 163662708
},
{
"name": "Customer.Number",
"value": 20089
},
{
"name": "State",
"value": 3
}
]
},
"options": {
"dotNotation": true
}
},
"id": "2b43b12b-ab1e-4f74-b859-15969e180160",
"name": "In Billbee Format umwandeln",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
460,
420
]
},
{
"parameters": {
"protocol": "sftp",
"operation": "rename",
"oldPath": "=/out/{{$json[\"name\"]}}",
"newPath": "=/archiv/{{$json[\"name\"]}}",
"options": {}
},
"id": "1c973d28-8bbe-4cb8-9af3-3153107afac0",
"name": "Ins Archiv verschieben1",
"type": "n8n-nodes-base.ftp",
"typeVersion": 1,
"position": [
460,
160
],
"credentials": {
"sftp": {
"id": "1",
"name": "SFTP MyToys"
}
}
},
{
"parameters": {
"binaryData": true,
"name": "={{ $json[\"name\"] }}",
"parents": [
"0AFGOvDYEtp0yUk9PVA"
],
"options": {}
},
"id": "6aadcdef-1bee-4584-85b3-1bc4e56900a8",
"name": "Dokumente hochladen",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 2,
"position": [
180,
160
],
"credentials": {
"googleDriveOAuth2Api": {
"id": "9",
"name": "Google Drive account"
}
}
},
{
"parameters": {
"command": "echo \"$BILBEE_API_KEY\""
},
"id": "f05bbf61-9fdf-4a34-b7cc-8abcfd70c346",
"name": "Api-Key",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
700,
580
]
},
{
"parameters": {},
"id": "7d776c8e-801b-461e-8576-03c45fb60d4c",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"typeVersion": 2,
"position": [
900,
440
]
}
],
"pinData": {},
"settings": {},
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2023-08-25T09:49:59.525Z",
"versionId": "c4fed224-596d-4265-ad0d-3f68e9b3656c"
}