画面截图
    image.png
    导出的代码

    1. [
    2. {
    3. "id": "648f70b0.d1af8",
    4. "type": "tab",
    5. "label": "influxdb更新",
    6. "disabled": false,
    7. "info": ""
    8. },
    9. {
    10. "id": "e65c2e04.5407c",
    11. "type": "influxdb in",
    12. "z": "648f70b0.d1af8",
    13. "influxdb": "f97c94dc.166388",
    14. "name": "",
    15. "query": "",
    16. "rawOutput": false,
    17. "precision": "",
    18. "retentionPolicy": "",
    19. "org": "organisation",
    20. "x": 520,
    21. "y": 820,
    22. "wires": [
    23. [
    24. "dc9ff540.bbf6b8"
    25. ]
    26. ]
    27. },
    28. {
    29. "id": "ba743a19.4ac0e8",
    30. "type": "file",
    31. "z": "648f70b0.d1af8",
    32. "name": "文件path",
    33. "filename": "",
    34. "appendNewline": false,
    35. "createDir": true,
    36. "overwriteFile": "true",
    37. "encoding": "utf8",
    38. "x": 1360,
    39. "y": 820,
    40. "wires": [
    41. [
    42. "b72bb10e.26629"
    43. ]
    44. ]
    45. },
    46. {
    47. "id": "dc9ff540.bbf6b8",
    48. "type": "function",
    49. "z": "648f70b0.d1af8",
    50. "name": "数据转换(csv格式)",
    51. "func": "//node.warn(msg.payload);\nlet result = [];\nfor (let i = 0; i < msg.payload.length; i++) {\n let row = [];\n row[0] = msg.payload[i].data2; //温度信息\n result[i] = row;\n}\n\nmsg.robotId = msg.payload[0].robot_id; //用于文件名前缀\nmsg.payload = result;\n\nreturn msg;\n",
    52. "outputs": 1,
    53. "noerr": 0,
    54. "initialize": "",
    55. "finalize": "",
    56. "libs": [],
    57. "x": 750,
    58. "y": 820,
    59. "wires": [
    60. [
    61. "e4201bfc.4c9378"
    62. ]
    63. ]
    64. },
    65. {
    66. "id": "e4201bfc.4c9378",
    67. "type": "csv",
    68. "z": "648f70b0.d1af8",
    69. "name": "csv属性设置",
    70. "sep": ",",
    71. "hdrin": false,
    72. "hdrout": "once",
    73. "multi": "one",
    74. "ret": "\\r\\n",
    75. "temp": "value",
    76. "skip": "1",
    77. "strings": false,
    78. "include_empty_strings": false,
    79. "include_null_values": false,
    80. "x": 970,
    81. "y": 820,
    82. "wires": [
    83. [
    84. "e6d65f32.606ee",
    85. "a38ed121.def7f"
    86. ]
    87. ]
    88. },
    89. {
    90. "id": "e6d65f32.606ee",
    91. "type": "debug",
    92. "z": "648f70b0.d1af8",
    93. "name": "",
    94. "active": false,
    95. "tosidebar": true,
    96. "console": false,
    97. "tostatus": false,
    98. "complete": "false",
    99. "statusVal": "",
    100. "statusType": "auto",
    101. "x": 1170,
    102. "y": 760,
    103. "wires": []
    104. },
    105. {
    106. "id": "2fb1f8f.b3ddd08",
    107. "type": "SFTP-main",
    108. "z": "648f70b0.d1af8",
    109. "path": "/",
    110. "method": "put",
    111. "remoteFilePath": "remotePath",
    112. "remoteFilePathType": "msg",
    113. "localFilePath": "filename",
    114. "localFilePathType": "msg",
    115. "server": "42aee480.a1f85c",
    116. "outputs": 1,
    117. "debug": false,
    118. "name": "SFTP设置",
    119. "x": 370,
    120. "y": 980,
    121. "wires": [
    122. [
    123. "ecf9e410.459b38"
    124. ]
    125. ]
    126. },
    127. {
    128. "id": "fe7e246c.93dca8",
    129. "type": "function",
    130. "z": "648f70b0.d1af8",
    131. "name": "取得前一天的文件",
    132. "func": "/**\n* 自定义函数名:PrefixZero\n* @param num: 被操作数\n* @param n: 固定的总位数\n*/\nfunction prefixZero(num, n) {\n return (Array(n).join(0) + num).slice(-n);\n}\n\nlet date = new Date();\nlet dateStr = date.getFullYear().toString();\ndateStr += prefixZero((date.getMonth() + 1), 2);\ndateStr += prefixZero((date.getDate() - 1), 2);\n\n//test data\n//dateStr = \"20210623\";\n\nlet len = msg.payload.length;\nlet file = [];\nfor (let i = 0; i < len; i++) {\n if (msg.payload[i].indexOf(dateStr) != -1) {\n file.push(msg.payload[i]);\n }\n}\nmsg.remoteFiles = file;\nflow.set(\"date\", dateStr);\n\nreturn msg;",
    133. "outputs": 1,
    134. "noerr": 0,
    135. "initialize": "",
    136. "finalize": "",
    137. "libs": [],
    138. "x": 670,
    139. "y": 1420,
    140. "wires": [
    141. [
    142. "3ab6be3e.0f6082"
    143. ]
    144. ]
    145. },
    146. {
    147. "id": "b26d6a97.a6fe68",
    148. "type": "inject",
    149. "z": "648f70b0.d1af8",
    150. "d": true,
    151. "name": "每天6:30执行",
    152. "props": [
    153. {
    154. "p": "payload"
    155. },
    156. {
    157. "p": "topic",
    158. "vt": "str"
    159. }
    160. ],
    161. "repeat": "",
    162. "crontab": "30 06 * * *",
    163. "once": false,
    164. "onceDelay": 0.1,
    165. "topic": "",
    166. "payload": "",
    167. "payloadType": "date",
    168. "x": 160,
    169. "y": 1420,
    170. "wires": [
    171. [
    172. "154e2ab3.a536a5"
    173. ]
    174. ]
    175. },
    176. {
    177. "id": "154e2ab3.a536a5",
    178. "type": "SFTP-main",
    179. "z": "648f70b0.d1af8",
    180. "path": "/",
    181. "method": "list",
    182. "remoteFilePath": "/home/ftpuser/BD/cs001/bd_alarm",
    183. "remoteFilePathType": "str",
    184. "localFilePath": "",
    185. "localFilePathType": "msg",
    186. "server": "42aee480.a1f85c",
    187. "outputs": 1,
    188. "debug": false,
    189. "name": "文件一览(bd_alarm)",
    190. "x": 420,
    191. "y": 1420,
    192. "wires": [
    193. [
    194. "fe7e246c.93dca8"
    195. ]
    196. ]
    197. },
    198. {
    199. "id": "315d8d2d.cbdfa2",
    200. "type": "SFTP-main",
    201. "z": "648f70b0.d1af8",
    202. "path": "/",
    203. "method": "get",
    204. "remoteFilePath": "remoteFiles",
    205. "remoteFilePathType": "msg",
    206. "localFilePath": "localPath",
    207. "localFilePathType": "msg",
    208. "server": "42aee480.a1f85c",
    209. "outputs": 1,
    210. "debug": false,
    211. "name": "下载到本地",
    212. "x": 1430,
    213. "y": 1460,
    214. "wires": [
    215. [
    216. "f48e4d67.4eded"
    217. ]
    218. ]
    219. },
    220. {
    221. "id": "3ab6be3e.0f6082",
    222. "type": "switch",
    223. "z": "648f70b0.d1af8",
    224. "name": "",
    225. "property": "remoteFiles.length",
    226. "propertyType": "msg",
    227. "rules": [
    228. {
    229. "t": "eq",
    230. "v": "0",
    231. "vt": "num"
    232. },
    233. {
    234. "t": "gt",
    235. "v": "0",
    236. "vt": "num"
    237. }
    238. ],
    239. "checkall": "true",
    240. "repair": false,
    241. "outputs": 2,
    242. "x": 870,
    243. "y": 1420,
    244. "wires": [
    245. [
    246. "6de0eac2.027864"
    247. ],
    248. [
    249. "1a760ff6.0f77"
    250. ]
    251. ]
    252. },
    253. {
    254. "id": "50e30eb6.bf8da",
    255. "type": "debug",
    256. "z": "648f70b0.d1af8",
    257. "name": "",
    258. "active": true,
    259. "tosidebar": true,
    260. "console": false,
    261. "tostatus": false,
    262. "complete": "payload",
    263. "targetType": "msg",
    264. "statusVal": "",
    265. "statusType": "auto",
    266. "x": 1350,
    267. "y": 1360,
    268. "wires": []
    269. },
    270. {
    271. "id": "4bf86818.0a9228",
    272. "type": "comment",
    273. "z": "648f70b0.d1af8",
    274. "name": "从SFTP下载解析后的文件(bd_alarm)",
    275. "info": "",
    276. "x": 210,
    277. "y": 1380,
    278. "wires": []
    279. },
    280. {
    281. "id": "b72bb10e.26629",
    282. "type": "function",
    283. "z": "648f70b0.d1af8",
    284. "name": "SFTP路径",
    285. "func": "msg.remotePath = \"/home/ftpuser/cs001/BDU_data\";\n\nreturn msg;",
    286. "outputs": 1,
    287. "noerr": 0,
    288. "initialize": "",
    289. "finalize": "",
    290. "libs": [],
    291. "x": 130,
    292. "y": 980,
    293. "wires": [
    294. [
    295. "2fb1f8f.b3ddd08"
    296. ]
    297. ]
    298. },
    299. {
    300. "id": "5aca1c99.bfb0e4",
    301. "type": "comment",
    302. "z": "648f70b0.d1af8",
    303. "name": "从本地上传到SFTP(原始数据)",
    304. "info": "",
    305. "x": 190,
    306. "y": 940,
    307. "wires": []
    308. },
    309. {
    310. "id": "98193f68.47407",
    311. "type": "csv",
    312. "z": "648f70b0.d1af8",
    313. "name": "csv解析方式",
    314. "sep": ",",
    315. "hdrin": "",
    316. "hdrout": "none",
    317. "multi": "mult",
    318. "ret": "\\n",
    319. "temp": "date,takt_rms,result,index",
    320. "skip": "1",
    321. "strings": false,
    322. "include_empty_strings": "",
    323. "include_null_values": "",
    324. "x": 930,
    325. "y": 2100,
    326. "wires": [
    327. [
    328. "8fcee820.959168"
    329. ]
    330. ]
    331. },
    332. {
    333. "id": "66f2bef4.d15d7",
    334. "type": "inject",
    335. "z": "648f70b0.d1af8",
    336. "d": true,
    337. "name": "每天5:00执行",
    338. "props": [
    339. {
    340. "p": "payload"
    341. },
    342. {
    343. "p": "topic",
    344. "vt": "str"
    345. }
    346. ],
    347. "repeat": "",
    348. "crontab": "00 05 * * *",
    349. "once": false,
    350. "onceDelay": 0.1,
    351. "topic": "",
    352. "payload": "",
    353. "payloadType": "date",
    354. "x": 160,
    355. "y": 1960,
    356. "wires": [
    357. [
    358. "5e80430c.992ccc"
    359. ]
    360. ]
    361. },
    362. {
    363. "id": "fbbbd20a.a49e1",
    364. "type": "debug",
    365. "z": "648f70b0.d1af8",
    366. "name": "",
    367. "active": true,
    368. "tosidebar": true,
    369. "console": false,
    370. "tostatus": false,
    371. "complete": "payload",
    372. "targetType": "msg",
    373. "statusVal": "",
    374. "statusType": "auto",
    375. "x": 1370,
    376. "y": 2160,
    377. "wires": []
    378. },
    379. {
    380. "id": "6467c5f2.f9675c",
    381. "type": "file in",
    382. "z": "648f70b0.d1af8",
    383. "name": "文件路径及名称",
    384. "filename": "",
    385. "format": "utf8",
    386. "chunk": false,
    387. "sendError": false,
    388. "encoding": "utf8",
    389. "x": 760,
    390. "y": 2180,
    391. "wires": [
    392. [
    393. "98193f68.47407"
    394. ]
    395. ]
    396. },
    397. {
    398. "id": "8fcee820.959168",
    399. "type": "function",
    400. "z": "648f70b0.d1af8",
    401. "name": "数据转换",
    402. "func": "let records = msg.payload;\nif (records == null) {\n return;\n}\n\nfunction convertTime(str){\n\tlet date1 = new Date(str);\n\treturn date1.getTime() * 1000000;\n}\n\nlet res = [];\nlet len = records.length;\nfor (let i = 0; i < len; i++) {\n let obj = [];\n // fields\n obj[0] = {\n movement_evl: 0,\n segment_evl: parseFloat(records[i].takt_rms),\n data_index: parseInt(records[i].index),\n time_gap: 0,\n mark: 0,\n time: convertTime(records[i].date)\n };\n // tags\n obj[1] = {\n plc_id: \"1\",\n robot_id: flow.get(\"robot_id\"),\n cs_id: \"cs001\",\n moto_num: flow.get(\"axis_id\"),\n act_date: flow.get(\"date\")\n };\n res[i] = obj;\n}\n\nmsg.payload = res;\n\nreturn msg;",
    403. "outputs": 1,
    404. "noerr": 0,
    405. "initialize": "",
    406. "finalize": "",
    407. "libs": [],
    408. "x": 1120,
    409. "y": 2100,
    410. "wires": [
    411. [
    412. "fbbbd20a.a49e1",
    413. "5f940f1f.3f32"
    414. ]
    415. ]
    416. },
    417. {
    418. "id": "f52a56f3.391c58",
    419. "type": "comment",
    420. "z": "648f70b0.d1af8",
    421. "name": "RMS Takt数据写入",
    422. "info": "",
    423. "x": 150,
    424. "y": 2060,
    425. "wires": []
    426. },
    427. {
    428. "id": "2e93c280.2cc70e",
    429. "type": "function",
    430. "z": "648f70b0.d1af8",
    431. "name": "",
    432. "func": "//msg.filename = \"C:/temp/data/rms_takt/p2_1_20210601fft.csv_tact.csv_3.csv_3sigma.csv\";\nmsg.filename = msg.payload;\n\n//解析文件名\nlet s = msg.filename.lastIndexOf(\"\\\\\");\nlet splitStr = msg.filename.substr(s + 1).split(\"_\");\nflow.set(\"robot_id\", splitStr[0]);\nflow.set(\"axis_id\", splitStr[1]);\n\nreturn msg;",
    433. "outputs": 1,
    434. "noerr": 0,
    435. "initialize": "",
    436. "finalize": "",
    437. "libs": [],
    438. "x": 610,
    439. "y": 2100,
    440. "wires": [
    441. [
    442. "6467c5f2.f9675c"
    443. ]
    444. ]
    445. },
    446. {
    447. "id": "bdf2ba06.5ab968",
    448. "type": "csv",
    449. "z": "648f70b0.d1af8",
    450. "name": "csv解析方式",
    451. "sep": ",",
    452. "hdrin": "",
    453. "hdrout": "none",
    454. "multi": "one",
    455. "ret": "\\n",
    456. "temp": "",
    457. "skip": "1",
    458. "strings": false,
    459. "include_empty_strings": "",
    460. "include_null_values": "",
    461. "x": 990,
    462. "y": 2640,
    463. "wires": [
    464. [
    465. "b6042bbe.11d9c8"
    466. ]
    467. ]
    468. },
    469. {
    470. "id": "33acdbda.963b24",
    471. "type": "debug",
    472. "z": "648f70b0.d1af8",
    473. "name": "",
    474. "active": false,
    475. "tosidebar": true,
    476. "console": false,
    477. "tostatus": false,
    478. "complete": "payload",
    479. "targetType": "msg",
    480. "statusVal": "",
    481. "statusType": "auto",
    482. "x": 1410,
    483. "y": 2720,
    484. "wires": []
    485. },
    486. {
    487. "id": "4d476239.558e9c",
    488. "type": "file in",
    489. "z": "648f70b0.d1af8",
    490. "name": "文件路径及名称",
    491. "filename": "",
    492. "format": "lines",
    493. "chunk": false,
    494. "sendError": false,
    495. "encoding": "utf8",
    496. "x": 780,
    497. "y": 2640,
    498. "wires": [
    499. [
    500. "bdf2ba06.5ab968"
    501. ]
    502. ]
    503. },
    504. {
    505. "id": "635f943c.04c5dc",
    506. "type": "function",
    507. "z": "648f70b0.d1af8",
    508. "name": "数据转换",
    509. "func": "let records = msg.payload;\nif (records == null) {\n return;\n}\n\nfunction convertTime(str){\n\tlet date1 = new Date(str);\n\treturn date1.getTime();\n}\n\nconst START_POS = 3;\nlet dateTime = convertTime(records['col1']);\nconst PTN_NO = records['col2'];\n\nlet res = [];\nlet len = Object.getOwnPropertyNames(records).length;\n\nfor (let i = START_POS; i <= len; i++) {\n let obj = [];\n obj[0] = {\n data: parseFloat(records['col' + i]), \n time: (dateTime + i - START_POS) * 1000000\n };\n obj[1] = {\n robot_id: flow.get(\"robot_id\"),\n cs_id: \"cs001\",\n moto_num: flow.get(\"axis_id\"),\n ptn_no: PTN_NO,\n type: \"RMS\",\n date: flow.get(\"date\")\n };\n \n res[i - START_POS] = obj;\n}\n\nmsg.payload = res;\n\nreturn msg;",
    510. "outputs": 1,
    511. "noerr": 0,
    512. "initialize": "",
    513. "finalize": "",
    514. "libs": [],
    515. "x": 1200,
    516. "y": 2640,
    517. "wires": [
    518. [
    519. "33acdbda.963b24",
    520. "fc0987cb.1f1c18"
    521. ]
    522. ]
    523. },
    524. {
    525. "id": "ccb9b2f5.de6ac",
    526. "type": "comment",
    527. "z": "648f70b0.d1af8",
    528. "name": "Takt PTN数据写入",
    529. "info": "",
    530. "x": 150,
    531. "y": 2600,
    532. "wires": []
    533. },
    534. {
    535. "id": "b20efe9b.de753",
    536. "type": "csv",
    537. "z": "648f70b0.d1af8",
    538. "name": "csv解析方式",
    539. "sep": ",",
    540. "hdrin": "",
    541. "hdrout": "none",
    542. "multi": "mult",
    543. "ret": "\\n",
    544. "temp": "value1,value2",
    545. "skip": "0",
    546. "strings": false,
    547. "include_empty_strings": "",
    548. "include_null_values": "",
    549. "x": 990,
    550. "y": 3240,
    551. "wires": [
    552. [
    553. "62c5b80f.bd9348"
    554. ]
    555. ]
    556. },
    557. {
    558. "id": "d3ca118f.ef8bb",
    559. "type": "debug",
    560. "z": "648f70b0.d1af8",
    561. "name": "",
    562. "active": true,
    563. "tosidebar": true,
    564. "console": false,
    565. "tostatus": false,
    566. "complete": "payload",
    567. "targetType": "msg",
    568. "statusVal": "",
    569. "statusType": "auto",
    570. "x": 1370,
    571. "y": 3220,
    572. "wires": []
    573. },
    574. {
    575. "id": "b69fb787.2b0648",
    576. "type": "file in",
    577. "z": "648f70b0.d1af8",
    578. "name": "文件路径及名称",
    579. "filename": "",
    580. "format": "utf8",
    581. "chunk": false,
    582. "sendError": false,
    583. "encoding": "utf8",
    584. "x": 840,
    585. "y": 3160,
    586. "wires": [
    587. [
    588. "b20efe9b.de753"
    589. ]
    590. ]
    591. },
    592. {
    593. "id": "62c5b80f.bd9348",
    594. "type": "function",
    595. "z": "648f70b0.d1af8",
    596. "name": "数据转换",
    597. "func": "let records = msg.payload;\nif (records == null) {\n return;\n}\n\nlet csvValue = records.value1;\nlet timeStamp = new Date().getTime();\n\nlet res = [];\nlet len = records.length;\nfor (let i = 0; i < len; i++) {\n let obj = [];\n // fields\n obj[0] = {\n data: parseFloat(records[i].value1),\n time: (timeStamp + i) * 1000000\n };\n // tags\n obj[1] = {\n robot_id: flow.get(\"robot_id\"),\n cs_id: \"cs001\",\n moto_num: flow.get(\"axis_id\"),\n ptn_no: flow.get(\"ptn_no\"),\n type: \"normal\",\n date: flow.get(\"date\")\n };\n res[i] = obj;\n}\n\nmsg.payload = res;\n\nreturn msg;",
    598. "outputs": 1,
    599. "noerr": 0,
    600. "initialize": "",
    601. "finalize": "",
    602. "libs": [],
    603. "x": 1140,
    604. "y": 3160,
    605. "wires": [
    606. [
    607. "d3ca118f.ef8bb",
    608. "fb61e2c4.86601"
    609. ]
    610. ]
    611. },
    612. {
    613. "id": "f3b1dea0.61391",
    614. "type": "comment",
    615. "z": "648f70b0.d1af8",
    616. "name": "PTN标准数据写入",
    617. "info": "",
    618. "x": 150,
    619. "y": 3120,
    620. "wires": []
    621. },
    622. {
    623. "id": "eb9e84f2.d60098",
    624. "type": "delay",
    625. "z": "648f70b0.d1af8",
    626. "name": "",
    627. "pauseType": "rate",
    628. "timeout": "5",
    629. "timeoutUnits": "seconds",
    630. "rate": "1",
    631. "nbRateUnits": "1",
    632. "rateUnits": "second",
    633. "randomFirst": "1",
    634. "randomLast": "5",
    635. "randomUnits": "seconds",
    636. "drop": false,
    637. "outputs": 1,
    638. "x": 370,
    639. "y": 3160,
    640. "wires": [
    641. [
    642. "b621af95.8c6d"
    643. ]
    644. ]
    645. },
    646. {
    647. "id": "1a760ff6.0f77",
    648. "type": "function",
    649. "z": "648f70b0.d1af8",
    650. "name": "本地路径",
    651. "func": "msg.localPath = \"C:/temp/data/bd_alarm/\" + flow.get(\"date\");\nmsg.payload = \"create_time: \" + new Date();\nmsg.filename = msg.localPath + \"/data_info\";\n\nreturn msg;",
    652. "outputs": 1,
    653. "noerr": 0,
    654. "initialize": "",
    655. "finalize": "",
    656. "libs": [],
    657. "x": 1060,
    658. "y": 1460,
    659. "wires": [
    660. [
    661. "d1e14a82.113e68"
    662. ]
    663. ]
    664. },
    665. {
    666. "id": "d1e14a82.113e68",
    667. "type": "file",
    668. "z": "648f70b0.d1af8",
    669. "name": "",
    670. "filename": "",
    671. "appendNewline": false,
    672. "createDir": true,
    673. "overwriteFile": "true",
    674. "encoding": "utf8",
    675. "x": 1250,
    676. "y": 1420,
    677. "wires": [
    678. [
    679. "315d8d2d.cbdfa2"
    680. ]
    681. ]
    682. },
    683. {
    684. "id": "a2c7a910.4b5ab8",
    685. "type": "csv",
    686. "z": "648f70b0.d1af8",
    687. "name": "csv解析方式",
    688. "sep": ",",
    689. "hdrin": true,
    690. "hdrout": "none",
    691. "multi": "one",
    692. "ret": "\\n",
    693. "temp": "",
    694. "skip": "0",
    695. "strings": false,
    696. "include_empty_strings": "",
    697. "include_null_values": "",
    698. "x": 850,
    699. "y": 1600,
    700. "wires": [
    701. [
    702. "6248b363.ecf8cc"
    703. ]
    704. ]
    705. },
    706. {
    707. "id": "60b8a9c4.b90b98",
    708. "type": "debug",
    709. "z": "648f70b0.d1af8",
    710. "name": "",
    711. "active": true,
    712. "tosidebar": true,
    713. "console": false,
    714. "tostatus": false,
    715. "complete": "payload",
    716. "targetType": "msg",
    717. "statusVal": "",
    718. "statusType": "auto",
    719. "x": 1410,
    720. "y": 1660,
    721. "wires": []
    722. },
    723. {
    724. "id": "f2cf6364.15c36",
    725. "type": "file in",
    726. "z": "648f70b0.d1af8",
    727. "name": "文件路径及名称",
    728. "filename": "",
    729. "format": "lines",
    730. "chunk": false,
    731. "sendError": false,
    732. "encoding": "utf8",
    733. "x": 700,
    734. "y": 1680,
    735. "wires": [
    736. [
    737. "a2c7a910.4b5ab8"
    738. ]
    739. ]
    740. },
    741. {
    742. "id": "39df6d58.17fe72",
    743. "type": "function",
    744. "z": "648f70b0.d1af8",
    745. "name": "数据转换",
    746. "func": "if (msg.csvData == null || msg.payload == null) {\n return;\n}\n\nlet checkId = msg.csvData.checkID;\nlet checkTime = msg.csvData.checkTime + msg.csvData.checkMSecond;\nlet robotId = msg.csvData.checkRobotID;\nlet axisId = msg.csvData.checkAxisID;\nlet alarmPos = msg.csvData.alarmPos;\nlet alarmRan = msg.csvData.alarmRan;\nlet alarmType = msg.csvData.alarmType;\nlet alarmLevel = msg.csvData.alarmLevel;\nlet normalPtnId = msg.csvData.normalPtnTaktID;\nlet ptnId;\nif (msg.payload.length == 0) {\n ptnId = 1;\n node.warn(\"checkID=\" + checkId + \" RobotID=\" + robotId + \" AxisID=\" + axisId + \" checkTime=\" + checkTime + \"\\n\" + msg.query);\n} else {\n ptnId = msg.payload[0].data_index; //msg.csvData.ptn\n}\n\nfunction getTimeStamp(str) {\n return new Date(str).getTime() * 1000000;\n}\n\nmsg.payload = [\n {\n measurement: \"bd_alarm\",\n fields: {\n alarm_pos: alarmPos,\n alarm_ran: alarmRan,\n alarm_type: alarmType,\n alarm_level: alarmLevel,\n ptn_no: ptnId\n },\n tags:{\n robot_id: robotId,\n cs_id: \"cs001\",\n check_axis_id: axisId, //通道\n check_id: checkId,\n check_time: checkTime,\n act_date: flow.get(\"date\"),\n normal_ptn_takt_id: normalPtnId\n },\n timestamp: getTimeStamp(checkTime)\n }\n];\n\nreturn msg;",
    747. "outputs": 1,
    748. "noerr": 0,
    749. "initialize": "",
    750. "finalize": "",
    751. "libs": [],
    752. "x": 1220,
    753. "y": 1600,
    754. "wires": [
    755. [
    756. "60b8a9c4.b90b98",
    757. "af31ccc8.941d2"
    758. ]
    759. ]
    760. },
    761. {
    762. "id": "af31ccc8.941d2",
    763. "type": "influxdb batch",
    764. "z": "648f70b0.d1af8",
    765. "influxdb": "f97c94dc.166388",
    766. "precision": "",
    767. "retentionPolicy": "",
    768. "name": "bd_alarm",
    769. "database": "influxdb1",
    770. "precisionV18FluxV20": "ns",
    771. "retentionPolicyV18Flux": "autogen",
    772. "org": "",
    773. "bucket": "",
    774. "x": 1400,
    775. "y": 1600,
    776. "wires": []
    777. },
    778. {
    779. "id": "887a6a3d.a08788",
    780. "type": "comment",
    781. "z": "648f70b0.d1af8",
    782. "name": "BD_ALARM数据写入",
    783. "info": "",
    784. "x": 160,
    785. "y": 1560,
    786. "wires": []
    787. },
    788. {
    789. "id": "a9eec31d.a0fe1",
    790. "type": "function",
    791. "z": "648f70b0.d1af8",
    792. "name": "",
    793. "func": "//msg.filename = \"C:/temp/data/bd_alarm/p2_7_20210604rms_bda.csv\";\nmsg.filename = msg.payload;\n\n//解析文件名\n//let s = msg.filename.lastIndexOf(\"/\");\n//let splitStr = msg.filename.substr(s + 1).split(\"_\");\n//msg.robot_id = splitStr[0];\n//msg.axis_id = splitStr[1];\n\nreturn msg;",
    794. "outputs": 1,
    795. "noerr": 0,
    796. "initialize": "",
    797. "finalize": "",
    798. "libs": [],
    799. "x": 590,
    800. "y": 1600,
    801. "wires": [
    802. [
    803. "f2cf6364.15c36"
    804. ]
    805. ]
    806. },
    807. {
    808. "id": "b046e723.f476d8",
    809. "type": "delay",
    810. "z": "648f70b0.d1af8",
    811. "name": "",
    812. "pauseType": "rate",
    813. "timeout": "5",
    814. "timeoutUnits": "seconds",
    815. "rate": "1",
    816. "nbRateUnits": "2",
    817. "rateUnits": "second",
    818. "randomFirst": "1",
    819. "randomLast": "5",
    820. "randomUnits": "seconds",
    821. "drop": false,
    822. "outputs": 1,
    823. "x": 400,
    824. "y": 1600,
    825. "wires": [
    826. [
    827. "a9eec31d.a0fe1"
    828. ]
    829. ]
    830. },
    831. {
    832. "id": "9cfd32cd.c2013",
    833. "type": "fs-file-lister",
    834. "z": "648f70b0.d1af8",
    835. "name": "指定文件目录",
    836. "start": "msg.localPath",
    837. "pattern": "*.csv",
    838. "folders": "*",
    839. "hidden": false,
    840. "lstype": "files",
    841. "path": true,
    842. "single": false,
    843. "depth": 0,
    844. "stat": false,
    845. "showWarnings": true,
    846. "x": 240,
    847. "y": 1680,
    848. "wires": [
    849. [
    850. "b046e723.f476d8"
    851. ]
    852. ]
    853. },
    854. {
    855. "id": "f48e4d67.4eded",
    856. "type": "function",
    857. "z": "648f70b0.d1af8",
    858. "name": "",
    859. "func": "msg.payload = {\"start\":msg.localPath,\"pattern\":\"*.csv\",\"folders\":\"*\"};\n\nreturn msg;",
    860. "outputs": 1,
    861. "noerr": 0,
    862. "initialize": "",
    863. "finalize": "",
    864. "libs": [],
    865. "x": 110,
    866. "y": 1600,
    867. "wires": [
    868. [
    869. "9cfd32cd.c2013"
    870. ]
    871. ]
    872. },
    873. {
    874. "id": "5e80430c.992ccc",
    875. "type": "SFTP-main",
    876. "z": "648f70b0.d1af8",
    877. "path": "/",
    878. "method": "list",
    879. "remoteFilePath": "/home/ftpuser/cs001/Mod1/TAKT_RMS",
    880. "remoteFilePathType": "str",
    881. "localFilePath": "",
    882. "localFilePathType": "msg",
    883. "server": "42aee480.a1f85c",
    884. "outputs": 1,
    885. "debug": false,
    886. "name": "文件一览(takt_rms)",
    887. "x": 410,
    888. "y": 1960,
    889. "wires": [
    890. [
    891. "cc9d82b9.9d905"
    892. ]
    893. ]
    894. },
    895. {
    896. "id": "cc9d82b9.9d905",
    897. "type": "function",
    898. "z": "648f70b0.d1af8",
    899. "name": "取得前一天的文件",
    900. "func": "/**\n* 自定义函数名:PrefixZero\n* @param num: 被操作数\n* @param n: 固定的总位数\n*/\nfunction prefixZero(num, n) {\n return (Array(n).join(0) + num).slice(-n);\n}\n\nlet date = new Date();\nlet dateStr = date.getFullYear().toString();\ndateStr += prefixZero((date.getMonth() + 1), 2);\ndateStr += prefixZero((date.getDate() - 1), 2);\n\n//test data\ndateStr = \"20210613\";\n\nlet len = msg.payload.length;\nlet file = [];\nfor (let i = 0; i < len; i++) {\n if (msg.payload[i].indexOf(dateStr) != -1) {\n file.push(msg.payload[i]);\n }\n}\nmsg.remoteFiles = file;\nflow.set(\"date\", dateStr);\n\nreturn msg;",
    901. "outputs": 1,
    902. "noerr": 0,
    903. "initialize": "",
    904. "finalize": "",
    905. "libs": [],
    906. "x": 670,
    907. "y": 1960,
    908. "wires": [
    909. [
    910. "f6f28f4a.607bd"
    911. ]
    912. ]
    913. },
    914. {
    915. "id": "f6f28f4a.607bd",
    916. "type": "switch",
    917. "z": "648f70b0.d1af8",
    918. "name": "",
    919. "property": "remoteFiles.length",
    920. "propertyType": "msg",
    921. "rules": [
    922. {
    923. "t": "eq",
    924. "v": "0",
    925. "vt": "num"
    926. },
    927. {
    928. "t": "gt",
    929. "v": "0",
    930. "vt": "num"
    931. }
    932. ],
    933. "checkall": "true",
    934. "repair": false,
    935. "outputs": 2,
    936. "x": 870,
    937. "y": 1960,
    938. "wires": [
    939. [
    940. "9eba8011.89748"
    941. ],
    942. [
    943. "e95d0985.2f9048"
    944. ]
    945. ]
    946. },
    947. {
    948. "id": "a475ddd2.a2187",
    949. "type": "debug",
    950. "z": "648f70b0.d1af8",
    951. "name": "",
    952. "active": true,
    953. "tosidebar": true,
    954. "console": false,
    955. "tostatus": false,
    956. "complete": "payload",
    957. "targetType": "msg",
    958. "statusVal": "",
    959. "statusType": "auto",
    960. "x": 1410,
    961. "y": 1900,
    962. "wires": []
    963. },
    964. {
    965. "id": "e95d0985.2f9048",
    966. "type": "function",
    967. "z": "648f70b0.d1af8",
    968. "name": "本地路径",
    969. "func": "msg.localPath = \"C:/temp/data/rms_takt/\" + flow.get(\"date\");\nmsg.payload = \"create_time: \" + new Date();\nmsg.filename = msg.localPath + \"/data_info\";\n\nreturn msg;",
    970. "outputs": 1,
    971. "noerr": 0,
    972. "initialize": "",
    973. "finalize": "",
    974. "libs": [],
    975. "x": 1040,
    976. "y": 2000,
    977. "wires": [
    978. [
    979. "a5d1d7a0.ab0628"
    980. ]
    981. ]
    982. },
    983. {
    984. "id": "a5d1d7a0.ab0628",
    985. "type": "file",
    986. "z": "648f70b0.d1af8",
    987. "name": "",
    988. "filename": "",
    989. "appendNewline": false,
    990. "createDir": true,
    991. "overwriteFile": "true",
    992. "encoding": "utf8",
    993. "x": 1230,
    994. "y": 1940,
    995. "wires": [
    996. [
    997. "cbd684bc.9742d8"
    998. ]
    999. ]
    1000. },
    1001. {
    1002. "id": "cbd684bc.9742d8",
    1003. "type": "SFTP-main",
    1004. "z": "648f70b0.d1af8",
    1005. "path": "/",
    1006. "method": "get",
    1007. "remoteFilePath": "remoteFiles",
    1008. "remoteFilePathType": "msg",
    1009. "localFilePath": "localPath",
    1010. "localFilePathType": "msg",
    1011. "server": "42aee480.a1f85c",
    1012. "outputs": 1,
    1013. "debug": false,
    1014. "name": "下载到本地",
    1015. "x": 1410,
    1016. "y": 2000,
    1017. "wires": [
    1018. [
    1019. "aaaad24a.0459"
    1020. ]
    1021. ]
    1022. },
    1023. {
    1024. "id": "bf3e53e5.546a7",
    1025. "type": "comment",
    1026. "z": "648f70b0.d1af8",
    1027. "name": "从SFTP下载数据(takt_rms)",
    1028. "info": "",
    1029. "x": 180,
    1030. "y": 1920,
    1031. "wires": []
    1032. },
    1033. {
    1034. "id": "aaaad24a.0459",
    1035. "type": "function",
    1036. "z": "648f70b0.d1af8",
    1037. "name": "",
    1038. "func": "msg.payload = {\"start\":msg.localPath,\"pattern\":\"*.csv\",\"folders\":\"*\"};\n\nreturn msg;",
    1039. "outputs": 1,
    1040. "noerr": 0,
    1041. "initialize": "",
    1042. "finalize": "",
    1043. "libs": [],
    1044. "x": 110,
    1045. "y": 2100,
    1046. "wires": [
    1047. [
    1048. "45eb5c68.d144b4"
    1049. ]
    1050. ]
    1051. },
    1052. {
    1053. "id": "45eb5c68.d144b4",
    1054. "type": "fs-file-lister",
    1055. "z": "648f70b0.d1af8",
    1056. "name": "指定文件目录",
    1057. "start": "msg.localPath",
    1058. "pattern": "*.csv",
    1059. "folders": "*",
    1060. "hidden": false,
    1061. "lstype": "files",
    1062. "path": true,
    1063. "single": false,
    1064. "depth": 0,
    1065. "stat": false,
    1066. "showWarnings": true,
    1067. "x": 220,
    1068. "y": 2180,
    1069. "wires": [
    1070. [
    1071. "6a7600df.0ac16"
    1072. ]
    1073. ]
    1074. },
    1075. {
    1076. "id": "7d07c0d9.c7c79",
    1077. "type": "inject",
    1078. "z": "648f70b0.d1af8",
    1079. "d": true,
    1080. "name": "每天5:30执行",
    1081. "props": [
    1082. {
    1083. "p": "payload"
    1084. },
    1085. {
    1086. "p": "topic",
    1087. "vt": "str"
    1088. }
    1089. ],
    1090. "repeat": "",
    1091. "crontab": "30 05 * * *",
    1092. "once": false,
    1093. "onceDelay": 0.1,
    1094. "topic": "",
    1095. "payload": "",
    1096. "payloadType": "date",
    1097. "x": 160,
    1098. "y": 2480,
    1099. "wires": [
    1100. [
    1101. "1e04d895.b9bba7"
    1102. ]
    1103. ]
    1104. },
    1105. {
    1106. "id": "1e04d895.b9bba7",
    1107. "type": "SFTP-main",
    1108. "z": "648f70b0.d1af8",
    1109. "path": "/",
    1110. "method": "list",
    1111. "remoteFilePath": "/home/ftpuser/cs001/Mod1/OneTaktOneRow",
    1112. "remoteFilePathType": "str",
    1113. "localFilePath": "",
    1114. "localFilePathType": "msg",
    1115. "server": "42aee480.a1f85c",
    1116. "outputs": 1,
    1117. "debug": false,
    1118. "name": "文件一览(takt_ptn)",
    1119. "x": 410,
    1120. "y": 2480,
    1121. "wires": [
    1122. [
    1123. "880b87d6.8950a8"
    1124. ]
    1125. ]
    1126. },
    1127. {
    1128. "id": "880b87d6.8950a8",
    1129. "type": "function",
    1130. "z": "648f70b0.d1af8",
    1131. "name": "取得前一天的文件",
    1132. "func": "/**\n* 自定义函数名:PrefixZero\n* @param num: 被操作数\n* @param n: 固定的总位数\n*/\nfunction prefixZero(num, n) {\n return (Array(n).join(0) + num).slice(-n);\n}\n\nlet date = new Date();\nlet dateStr = date.getFullYear().toString();\ndateStr += prefixZero((date.getMonth() + 1), 2);\ndateStr += prefixZero((date.getDate() - 1), 2);\n\n//test data\ndateStr = \"20210613\";\n\nlet len = msg.payload.length;\nlet file = [];\nfor (let i = 0; i < len; i++) {\n if (msg.payload[i].indexOf(dateStr) != -1) {\n file.push(msg.payload[i]);\n }\n}\nmsg.remoteFiles = file;\nmsg.date = dateStr\nflow.set(\"date\", dateStr)\n\nreturn msg;",
    1133. "outputs": 1,
    1134. "noerr": 0,
    1135. "initialize": "",
    1136. "finalize": "",
    1137. "libs": [],
    1138. "x": 670,
    1139. "y": 2480,
    1140. "wires": [
    1141. [
    1142. "1e63f311.bb6aed"
    1143. ]
    1144. ]
    1145. },
    1146. {
    1147. "id": "1e63f311.bb6aed",
    1148. "type": "switch",
    1149. "z": "648f70b0.d1af8",
    1150. "name": "",
    1151. "property": "remoteFiles.length",
    1152. "propertyType": "msg",
    1153. "rules": [
    1154. {
    1155. "t": "eq",
    1156. "v": "0",
    1157. "vt": "num"
    1158. },
    1159. {
    1160. "t": "gt",
    1161. "v": "0",
    1162. "vt": "num"
    1163. }
    1164. ],
    1165. "checkall": "true",
    1166. "repair": false,
    1167. "outputs": 2,
    1168. "x": 870,
    1169. "y": 2480,
    1170. "wires": [
    1171. [
    1172. "919b6e6c.47484"
    1173. ],
    1174. [
    1175. "e6481b72.501cc8"
    1176. ]
    1177. ]
    1178. },
    1179. {
    1180. "id": "4130f5af.7063bc",
    1181. "type": "debug",
    1182. "z": "648f70b0.d1af8",
    1183. "name": "",
    1184. "active": true,
    1185. "tosidebar": true,
    1186. "console": false,
    1187. "tostatus": false,
    1188. "complete": "payload",
    1189. "targetType": "msg",
    1190. "statusVal": "",
    1191. "statusType": "auto",
    1192. "x": 1410,
    1193. "y": 2420,
    1194. "wires": []
    1195. },
    1196. {
    1197. "id": "e6481b72.501cc8",
    1198. "type": "function",
    1199. "z": "648f70b0.d1af8",
    1200. "name": "本地路径",
    1201. "func": "msg.localPath = \"C:/temp/data/takt_ptn/\" + msg.date;\nmsg.payload = \"create_time: \" + new Date();\nmsg.filename = msg.localPath + \"/data_info\";\n\nreturn msg;",
    1202. "outputs": 1,
    1203. "noerr": 0,
    1204. "initialize": "",
    1205. "finalize": "",
    1206. "libs": [],
    1207. "x": 1040,
    1208. "y": 2500,
    1209. "wires": [
    1210. [
    1211. "82a9504c.2130d"
    1212. ]
    1213. ]
    1214. },
    1215. {
    1216. "id": "82a9504c.2130d",
    1217. "type": "file",
    1218. "z": "648f70b0.d1af8",
    1219. "name": "",
    1220. "filename": "",
    1221. "appendNewline": false,
    1222. "createDir": true,
    1223. "overwriteFile": "true",
    1224. "encoding": "utf8",
    1225. "x": 1230,
    1226. "y": 2460,
    1227. "wires": [
    1228. [
    1229. "57461667.f797f8"
    1230. ]
    1231. ]
    1232. },
    1233. {
    1234. "id": "57461667.f797f8",
    1235. "type": "SFTP-main",
    1236. "z": "648f70b0.d1af8",
    1237. "path": "/",
    1238. "method": "get",
    1239. "remoteFilePath": "remoteFiles",
    1240. "remoteFilePathType": "msg",
    1241. "localFilePath": "localPath",
    1242. "localFilePathType": "msg",
    1243. "server": "42aee480.a1f85c",
    1244. "outputs": 1,
    1245. "debug": false,
    1246. "name": "下载到本地",
    1247. "x": 1410,
    1248. "y": 2500,
    1249. "wires": [
    1250. [
    1251. "736b2a9a.722a24"
    1252. ]
    1253. ]
    1254. },
    1255. {
    1256. "id": "f80dfb5.d066108",
    1257. "type": "comment",
    1258. "z": "648f70b0.d1af8",
    1259. "name": "从SFTP下载数据(takt_ptn)",
    1260. "info": "",
    1261. "x": 180,
    1262. "y": 2440,
    1263. "wires": []
    1264. },
    1265. {
    1266. "id": "53b6f3f2.d9291c",
    1267. "type": "comment",
    1268. "z": "648f70b0.d1af8",
    1269. "name": "######################################################################----------TAKT_PTN----------################################################################################",
    1270. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1271. "x": 760,
    1272. "y": 2380,
    1273. "wires": []
    1274. },
    1275. {
    1276. "id": "736b2a9a.722a24",
    1277. "type": "function",
    1278. "z": "648f70b0.d1af8",
    1279. "name": "",
    1280. "func": "msg.payload = {\"start\":msg.localPath,\"pattern\":\"*.csv\",\"folders\":\"*\"};\n\nreturn msg;",
    1281. "outputs": 1,
    1282. "noerr": 0,
    1283. "initialize": "",
    1284. "finalize": "",
    1285. "libs": [],
    1286. "x": 110,
    1287. "y": 2640,
    1288. "wires": [
    1289. [
    1290. "f4797cc9.1cf6f"
    1291. ]
    1292. ]
    1293. },
    1294. {
    1295. "id": "f4797cc9.1cf6f",
    1296. "type": "fs-file-lister",
    1297. "z": "648f70b0.d1af8",
    1298. "name": "指定文件目录",
    1299. "start": "msg.localPath",
    1300. "pattern": "*.csv",
    1301. "folders": "*",
    1302. "hidden": false,
    1303. "lstype": "files",
    1304. "path": true,
    1305. "single": false,
    1306. "depth": 0,
    1307. "stat": false,
    1308. "showWarnings": true,
    1309. "x": 240,
    1310. "y": 2720,
    1311. "wires": [
    1312. [
    1313. "8607526c.fe58c"
    1314. ]
    1315. ]
    1316. },
    1317. {
    1318. "id": "f9b4d7dc.b45908",
    1319. "type": "function",
    1320. "z": "648f70b0.d1af8",
    1321. "name": "",
    1322. "func": "//msg.filename = \"C:/temp/data/takt_ptn/p2_1_20210601.csv\";\nmsg.filename = msg.payload;\n//解析文件名\nlet s = msg.filename.lastIndexOf(\"\\\\\");\nlet splitStr = msg.filename.substr(s + 1).split(\"_\");\nflow.set(\"robot_id\", splitStr[0]);\nflow.set(\"axis_id\", splitStr[1]);\n\nreturn msg;",
    1323. "outputs": 1,
    1324. "noerr": 0,
    1325. "initialize": "",
    1326. "finalize": "",
    1327. "libs": [],
    1328. "x": 610,
    1329. "y": 2720,
    1330. "wires": [
    1331. [
    1332. "4d476239.558e9c"
    1333. ]
    1334. ]
    1335. },
    1336. {
    1337. "id": "aaf20f27.d0f05",
    1338. "type": "comment",
    1339. "z": "648f70b0.d1af8",
    1340. "name": "######################################################################----------RMS_TAKT----------################################################################################",
    1341. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1342. "x": 760,
    1343. "y": 1860,
    1344. "wires": []
    1345. },
    1346. {
    1347. "id": "4cbd6e6b.e3879",
    1348. "type": "comment",
    1349. "z": "648f70b0.d1af8",
    1350. "name": "######################################################################----------BD_ALARM----------################################################################################",
    1351. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1352. "x": 760,
    1353. "y": 1300,
    1354. "wires": []
    1355. },
    1356. {
    1357. "id": "ceb21553.e1dec8",
    1358. "type": "comment",
    1359. "z": "648f70b0.d1af8",
    1360. "name": "######################################################################----------NORMAL_PTN----------################################################################################",
    1361. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1362. "x": 770,
    1363. "y": 2900,
    1364. "wires": []
    1365. },
    1366. {
    1367. "id": "aeb120e6.cf309",
    1368. "type": "inject",
    1369. "z": "648f70b0.d1af8",
    1370. "d": true,
    1371. "name": "每天5:00执行",
    1372. "props": [
    1373. {
    1374. "p": "payload"
    1375. },
    1376. {
    1377. "p": "topic",
    1378. "vt": "str"
    1379. }
    1380. ],
    1381. "repeat": "",
    1382. "crontab": "00 05 * * *",
    1383. "once": false,
    1384. "onceDelay": 0.1,
    1385. "topic": "",
    1386. "payload": "",
    1387. "payloadType": "date",
    1388. "x": 160,
    1389. "y": 3000,
    1390. "wires": [
    1391. [
    1392. "3d501c8.e7579e4"
    1393. ]
    1394. ]
    1395. },
    1396. {
    1397. "id": "3d501c8.e7579e4",
    1398. "type": "SFTP-main",
    1399. "z": "648f70b0.d1af8",
    1400. "path": "/",
    1401. "method": "list",
    1402. "remoteFilePath": "/home/ftpuser/cs001/Mod1/PTN",
    1403. "remoteFilePathType": "str",
    1404. "localFilePath": "",
    1405. "localFilePathType": "msg",
    1406. "server": "42aee480.a1f85c",
    1407. "outputs": 1,
    1408. "debug": false,
    1409. "name": "文件一览(takt_ptn)",
    1410. "x": 410,
    1411. "y": 3000,
    1412. "wires": [
    1413. [
    1414. "549cd5f4.9ca7ec"
    1415. ]
    1416. ]
    1417. },
    1418. {
    1419. "id": "549cd5f4.9ca7ec",
    1420. "type": "function",
    1421. "z": "648f70b0.d1af8",
    1422. "name": "取得前一天的文件",
    1423. "func": "/**\n* 自定义函数名:PrefixZero\n* @param num: 被操作数\n* @param n: 固定的总位数\n*/\nfunction prefixZero(num, n) {\n return (Array(n).join(0) + num).slice(-n);\n}\n\nlet date = new Date();\nlet dateStr = date.getFullYear().toString();\ndateStr += prefixZero((date.getMonth() + 1), 2);\ndateStr += prefixZero((date.getDate() - 1), 2);\n\n//test data\ndateStr = \"20210613\";\n\nlet len = msg.payload.length;\nlet file = [];\nfor (let i = 0; i < len; i++) {\n if (msg.payload[i].indexOf(dateStr) != -1) {\n file.push(msg.payload[i]);\n }\n}\nmsg.remoteFiles = file;\nflow.set(\"date\", dateStr);\n\nreturn msg;",
    1424. "outputs": 1,
    1425. "noerr": 0,
    1426. "initialize": "",
    1427. "finalize": "",
    1428. "libs": [],
    1429. "x": 670,
    1430. "y": 3000,
    1431. "wires": [
    1432. [
    1433. "69d1b07d.c6ce4"
    1434. ]
    1435. ]
    1436. },
    1437. {
    1438. "id": "69d1b07d.c6ce4",
    1439. "type": "switch",
    1440. "z": "648f70b0.d1af8",
    1441. "name": "",
    1442. "property": "remoteFiles.length",
    1443. "propertyType": "msg",
    1444. "rules": [
    1445. {
    1446. "t": "eq",
    1447. "v": "0",
    1448. "vt": "num"
    1449. },
    1450. {
    1451. "t": "gt",
    1452. "v": "0",
    1453. "vt": "num"
    1454. }
    1455. ],
    1456. "checkall": "true",
    1457. "repair": false,
    1458. "outputs": 2,
    1459. "x": 870,
    1460. "y": 3000,
    1461. "wires": [
    1462. [
    1463. "4fcf6764.974948"
    1464. ],
    1465. [
    1466. "1469daa7.0060a5"
    1467. ]
    1468. ]
    1469. },
    1470. {
    1471. "id": "2eb22c28.cffbf4",
    1472. "type": "debug",
    1473. "z": "648f70b0.d1af8",
    1474. "name": "",
    1475. "active": true,
    1476. "tosidebar": true,
    1477. "console": false,
    1478. "tostatus": false,
    1479. "complete": "payload",
    1480. "targetType": "msg",
    1481. "statusVal": "",
    1482. "statusType": "auto",
    1483. "x": 1410,
    1484. "y": 2940,
    1485. "wires": []
    1486. },
    1487. {
    1488. "id": "1469daa7.0060a5",
    1489. "type": "function",
    1490. "z": "648f70b0.d1af8",
    1491. "name": "本地路径",
    1492. "func": "msg.localPath = \"C:/temp/data/normal_ptn/\" + flow.get(\"date\");\nmsg.payload = \"create_time: \" + new Date();\nmsg.filename = msg.localPath + \"/data_info\";\n\nreturn msg;",
    1493. "outputs": 1,
    1494. "noerr": 0,
    1495. "initialize": "",
    1496. "finalize": "",
    1497. "libs": [],
    1498. "x": 1040,
    1499. "y": 3020,
    1500. "wires": [
    1501. [
    1502. "6d2b18b0.74bb68"
    1503. ]
    1504. ]
    1505. },
    1506. {
    1507. "id": "6d2b18b0.74bb68",
    1508. "type": "file",
    1509. "z": "648f70b0.d1af8",
    1510. "name": "",
    1511. "filename": "",
    1512. "appendNewline": false,
    1513. "createDir": true,
    1514. "overwriteFile": "true",
    1515. "encoding": "utf8",
    1516. "x": 1230,
    1517. "y": 2980,
    1518. "wires": [
    1519. [
    1520. "d26c2756.8b4798"
    1521. ]
    1522. ]
    1523. },
    1524. {
    1525. "id": "d26c2756.8b4798",
    1526. "type": "SFTP-main",
    1527. "z": "648f70b0.d1af8",
    1528. "path": "/",
    1529. "method": "get",
    1530. "remoteFilePath": "remoteFiles",
    1531. "remoteFilePathType": "msg",
    1532. "localFilePath": "localPath",
    1533. "localFilePathType": "msg",
    1534. "server": "42aee480.a1f85c",
    1535. "outputs": 1,
    1536. "debug": false,
    1537. "name": "下载到本地",
    1538. "x": 1410,
    1539. "y": 3020,
    1540. "wires": [
    1541. [
    1542. "18118e2d.0a5912"
    1543. ]
    1544. ]
    1545. },
    1546. {
    1547. "id": "7e38d583.8132fc",
    1548. "type": "comment",
    1549. "z": "648f70b0.d1af8",
    1550. "name": "从SFTP下载数据(normal_ptn)",
    1551. "info": "",
    1552. "x": 190,
    1553. "y": 2960,
    1554. "wires": []
    1555. },
    1556. {
    1557. "id": "18118e2d.0a5912",
    1558. "type": "function",
    1559. "z": "648f70b0.d1af8",
    1560. "name": "",
    1561. "func": "msg.payload = {\"start\":msg.localPath,\"pattern\":\"*.csv\",\"folders\":\"*\"};\n\nreturn msg;",
    1562. "outputs": 1,
    1563. "noerr": 0,
    1564. "initialize": "",
    1565. "finalize": "",
    1566. "libs": [],
    1567. "x": 110,
    1568. "y": 3160,
    1569. "wires": [
    1570. [
    1571. "ab5e9c6f.ff64e"
    1572. ]
    1573. ]
    1574. },
    1575. {
    1576. "id": "ab5e9c6f.ff64e",
    1577. "type": "fs-file-lister",
    1578. "z": "648f70b0.d1af8",
    1579. "name": "指定文件目录",
    1580. "start": "msg.localPath",
    1581. "pattern": "*.csv",
    1582. "folders": "*",
    1583. "hidden": false,
    1584. "lstype": "files",
    1585. "path": true,
    1586. "single": false,
    1587. "depth": 0,
    1588. "stat": false,
    1589. "showWarnings": true,
    1590. "x": 220,
    1591. "y": 3240,
    1592. "wires": [
    1593. [
    1594. "eb9e84f2.d60098"
    1595. ]
    1596. ]
    1597. },
    1598. {
    1599. "id": "b621af95.8c6d",
    1600. "type": "function",
    1601. "z": "648f70b0.d1af8",
    1602. "name": "",
    1603. "func": "//msg.filename = \"C:/temp/data/normal_ptn/ptn_p2_1_20200529.csv\";\nmsg.filename = msg.payload;\n\n//解析文件名\nlet s = msg.filename.lastIndexOf(\"\\\\\");\nlet splitStr = msg.filename.substr(s + 1).split(\"_\");\nflow.set(\"robot_id\", splitStr[1]);\nflow.set(\"axis_id\", splitStr[2]);\n// ptn_no\nlet e = msg.filename.lastIndexOf(\"_\");\nflow.set(\"ptn_no\", msg.filename.substring(s + 1, e));\n\n//删除旧的标准PTN数据\nmsg.query = \"delete from bd_ptn_normal where robot_id = '\" + splitStr[1] + \n \"' and moto_num = '\" + splitStr[2] + \"'\";\n\nreturn msg;",
    1604. "outputs": 1,
    1605. "noerr": 0,
    1606. "initialize": "",
    1607. "finalize": "",
    1608. "libs": [],
    1609. "x": 570,
    1610. "y": 3160,
    1611. "wires": [
    1612. [
    1613. "1f16287a.d8db98"
    1614. ]
    1615. ]
    1616. },
    1617. {
    1618. "id": "e1a07114.2cfca",
    1619. "type": "comment",
    1620. "z": "648f70b0.d1af8",
    1621. "name": "############################################################################################################################################################################",
    1622. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1623. "x": 760,
    1624. "y": 1160,
    1625. "wires": []
    1626. },
    1627. {
    1628. "id": "90419061.6f85a",
    1629. "type": "comment",
    1630. "z": "648f70b0.d1af8",
    1631. "name": "#################################################################     下载数据并保存到DB     ########################################################################",
    1632. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1633. "x": 760,
    1634. "y": 1200,
    1635. "wires": []
    1636. },
    1637. {
    1638. "id": "234528a8.a5f5e8",
    1639. "type": "comment",
    1640. "z": "648f70b0.d1af8",
    1641. "name": "############################################################################################################################################################################",
    1642. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1643. "x": 760,
    1644. "y": 1240,
    1645. "wires": []
    1646. },
    1647. {
    1648. "id": "5347666c.e740e8",
    1649. "type": "inject",
    1650. "z": "648f70b0.d1af8",
    1651. "d": true,
    1652. "name": "",
    1653. "props": [
    1654. {
    1655. "p": "payload"
    1656. },
    1657. {
    1658. "p": "topic",
    1659. "vt": "str"
    1660. }
    1661. ],
    1662. "repeat": "1",
    1663. "crontab": "",
    1664. "once": false,
    1665. "onceDelay": 0.1,
    1666. "topic": "",
    1667. "payload": "[170,0,0,8,0,0,0,0,3,3,16,16,16,16,0,255]",
    1668. "payloadType": "bin",
    1669. "x": 130,
    1670. "y": 200,
    1671. "wires": [
    1672. [
    1673. "cb0c97b1.617cf8"
    1674. ]
    1675. ]
    1676. },
    1677. {
    1678. "id": "40ddbcce.6972d4",
    1679. "type": "serial out",
    1680. "z": "648f70b0.d1af8",
    1681. "d": true,
    1682. "name": "",
    1683. "serial": "25f44ffa.156ed",
    1684. "x": 910,
    1685. "y": 200,
    1686. "wires": []
    1687. },
    1688. {
    1689. "id": "cb0c97b1.617cf8",
    1690. "type": "function",
    1691. "z": "648f70b0.d1af8",
    1692. "name": "",
    1693. "func": "var temp= new Buffer([0x01,0x03,0x00,0x00,0x00,0x02,0xC4,0x0B]);\nmsg.payload = temp;\nreturn msg;",
    1694. "outputs": 1,
    1695. "noerr": 0,
    1696. "initialize": "",
    1697. "finalize": "",
    1698. "libs": [],
    1699. "x": 510,
    1700. "y": 200,
    1701. "wires": [
    1702. [
    1703. "40ddbcce.6972d4",
    1704. "af00c902.581078"
    1705. ]
    1706. ]
    1707. },
    1708. {
    1709. "id": "3edb396a.d5d456",
    1710. "type": "serial in",
    1711. "z": "648f70b0.d1af8",
    1712. "d": true,
    1713. "name": "",
    1714. "serial": "25f44ffa.156ed",
    1715. "x": 110,
    1716. "y": 360,
    1717. "wires": [
    1718. [
    1719. "f5c05094.3b92e"
    1720. ]
    1721. ]
    1722. },
    1723. {
    1724. "id": "10d86fcb.0e9f7",
    1725. "type": "debug",
    1726. "z": "648f70b0.d1af8",
    1727. "name": "",
    1728. "active": false,
    1729. "tosidebar": true,
    1730. "console": false,
    1731. "tostatus": false,
    1732. "complete": "payload",
    1733. "targetType": "msg",
    1734. "statusVal": "",
    1735. "statusType": "auto",
    1736. "x": 610,
    1737. "y": 420,
    1738. "wires": []
    1739. },
    1740. {
    1741. "id": "af00c902.581078",
    1742. "type": "debug",
    1743. "z": "648f70b0.d1af8",
    1744. "name": "",
    1745. "active": false,
    1746. "tosidebar": true,
    1747. "console": false,
    1748. "tostatus": false,
    1749. "complete": "payload",
    1750. "targetType": "msg",
    1751. "statusVal": "",
    1752. "statusType": "auto",
    1753. "x": 930,
    1754. "y": 260,
    1755. "wires": []
    1756. },
    1757. {
    1758. "id": "f5c05094.3b92e",
    1759. "type": "function",
    1760. "z": "648f70b0.d1af8",
    1761. "name": "",
    1762. "func": "// 补0操作\nfunction prefixZero(num, n) {\n return (Array(n).join(0) + num).slice(-n);\n}\n\nlet rtnVal = msg.payload;\nlet humidity = \"0x\" + rtnVal[3].toString(16) + prefixZero(rtnVal[4].toString(16), 2);\nhumidity = parseInt(humidity, 16) / 10;\nlet temperature = \"0x\" + rtnVal[5].toString(16) + prefixZero(rtnVal[6].toString(16), 2);\ntemperature = parseInt(temperature, 16) / 10;\nmsg.payload = [humidity, temperature];\nreturn msg;",
    1763. "outputs": 1,
    1764. "noerr": 0,
    1765. "initialize": "",
    1766. "finalize": "",
    1767. "libs": [],
    1768. "x": 350,
    1769. "y": 360,
    1770. "wires": [
    1771. [
    1772. "10d86fcb.0e9f7",
    1773. "cb8c2d22.cda7a"
    1774. ]
    1775. ]
    1776. },
    1777. {
    1778. "id": "cb8c2d22.cda7a",
    1779. "type": "function",
    1780. "z": "648f70b0.d1af8",
    1781. "name": "数据转换",
    1782. "func": "let d1 = msg.payload[0];\nlet d2 = msg.payload[1];\n\nmsg.payload = [\n {\n measurement: \"bd_current_data\",\n fields: {\n data1: d1,\n data2: d2\n },\n tags:{\n index: \"001\",\n robot_id: \"DEV1\",\n cs_id: \"cs01\",\n moto_num: \"1\",\n data_index: \"5\",\n day_mark: \"0\"\n }\n }];\n\nreturn msg;",
    1783. "outputs": 1,
    1784. "noerr": 0,
    1785. "initialize": "",
    1786. "finalize": "",
    1787. "libs": [],
    1788. "x": 600,
    1789. "y": 360,
    1790. "wires": [
    1791. [
    1792. "cb17ffea.ec229"
    1793. ]
    1794. ]
    1795. },
    1796. {
    1797. "id": "cb17ffea.ec229",
    1798. "type": "influxdb batch",
    1799. "z": "648f70b0.d1af8",
    1800. "influxdb": "f97c94dc.166388",
    1801. "precision": "",
    1802. "retentionPolicy": "",
    1803. "name": "influxdb1",
    1804. "database": "influxdb1",
    1805. "precisionV18FluxV20": "ns",
    1806. "retentionPolicyV18Flux": "autogen",
    1807. "org": "",
    1808. "bucket": "",
    1809. "x": 920,
    1810. "y": 360,
    1811. "wires": []
    1812. },
    1813. {
    1814. "id": "846135f2.c015f8",
    1815. "type": "comment",
    1816. "z": "648f70b0.d1af8",
    1817. "name": "############################################################################################################################################################################",
    1818. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1819. "x": 760,
    1820. "y": 60,
    1821. "wires": []
    1822. },
    1823. {
    1824. "id": "c45a7c0c.67df",
    1825. "type": "comment",
    1826. "z": "648f70b0.d1af8",
    1827. "name": "#################################################################     实时数据取得并保存     ########################################################################",
    1828. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1829. "x": 760,
    1830. "y": 100,
    1831. "wires": []
    1832. },
    1833. {
    1834. "id": "9ef535bd.fdc398",
    1835. "type": "comment",
    1836. "z": "648f70b0.d1af8",
    1837. "name": "############################################################################################################################################################################",
    1838. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1839. "x": 760,
    1840. "y": 140,
    1841. "wires": []
    1842. },
    1843. {
    1844. "id": "aedee7f3.a66da8",
    1845. "type": "comment",
    1846. "z": "648f70b0.d1af8",
    1847. "name": "############################################################################################################################################################################",
    1848. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1849. "x": 760,
    1850. "y": 620,
    1851. "wires": []
    1852. },
    1853. {
    1854. "id": "d2ec06eb.1d7f88",
    1855. "type": "comment",
    1856. "z": "648f70b0.d1af8",
    1857. "name": "#################################################################     从DB取出数据并上传     ########################################################################",
    1858. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1859. "x": 760,
    1860. "y": 660,
    1861. "wires": []
    1862. },
    1863. {
    1864. "id": "c7fd4177.d73f4",
    1865. "type": "comment",
    1866. "z": "648f70b0.d1af8",
    1867. "name": "############################################################################################################################################################################",
    1868. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    1869. "x": 760,
    1870. "y": 700,
    1871. "wires": []
    1872. },
    1873. {
    1874. "id": "c29eda28.3561d8",
    1875. "type": "comment",
    1876. "z": "648f70b0.d1af8",
    1877. "name": "读取DB数据并生成CSV",
    1878. "info": "",
    1879. "x": 160,
    1880. "y": 780,
    1881. "wires": []
    1882. },
    1883. {
    1884. "id": "2a30de65.cc8632",
    1885. "type": "inject",
    1886. "z": "648f70b0.d1af8",
    1887. "d": true,
    1888. "name": "每天0:01执行",
    1889. "props": [
    1890. {
    1891. "p": "payload"
    1892. },
    1893. {
    1894. "p": "topic",
    1895. "vt": "str"
    1896. }
    1897. ],
    1898. "repeat": "",
    1899. "crontab": "01 00 * * *",
    1900. "once": false,
    1901. "onceDelay": 0.1,
    1902. "topic": "",
    1903. "payload": "",
    1904. "payloadType": "date",
    1905. "x": 160,
    1906. "y": 820,
    1907. "wires": [
    1908. [
    1909. "e692b994.5c52e8"
    1910. ]
    1911. ]
    1912. },
    1913. {
    1914. "id": "e692b994.5c52e8",
    1915. "type": "function",
    1916. "z": "648f70b0.d1af8",
    1917. "name": "查询语句",
    1918. "func": "/**\n* 自定义函数名:PrefixZero\n* @param num: 被操作数\n* @param n: 固定的总位数\n*/\nfunction prefixZero(num, n) {\n return (Array(n).join(0) + num).slice(-n);\n}\n\n/**\n * 取得过去日期,格式yyyy-MM-dd\n * @param n: 过去天数\n */\nfunction getBeforeDate(n) {\n let day = new Date();\n day.setTime(day.getTime()-24*60*60*1000*n);\n let formatedDate = day.getFullYear() + \"-\" + prefixZero((day.getMonth() + 1), 2) + \"-\" + prefixZero(day.getDate(), 2);\n return formatedDate;\n}\n\nconst TIME = \"T16:00:00Z\";\nlet startTime = getBeforeDate(2) + TIME;\nlet yestoday = getBeforeDate(1);\nlet endTime = yestoday + TIME;\nmsg.query = \"SELECT * from bd_current_data WHERE time >= '\" + startTime + \"' AND time <= '\" + endTime + \"'\";\nmsg.notifyDate = yestoday;\nmsg.date = yestoday.replaceAll(\"-\",\"\"); //后面要用到\n\nreturn msg;",
    1919. "outputs": 1,
    1920. "noerr": 0,
    1921. "initialize": "",
    1922. "finalize": "",
    1923. "libs": [],
    1924. "x": 340,
    1925. "y": 820,
    1926. "wires": [
    1927. [
    1928. "e65c2e04.5407c"
    1929. ]
    1930. ]
    1931. },
    1932. {
    1933. "id": "a38ed121.def7f",
    1934. "type": "function",
    1935. "z": "648f70b0.d1af8",
    1936. "name": "本地路径",
    1937. "func": "msg.localPath = \"C:/temp/data/current_data/\" + msg.date;\nmsg.csvfile = msg.robotId + \"_\" + msg.date + \"_\" + \"temperature.csv\";\nmsg.filename = msg.localPath + \"/\" + msg.csvfile;\n\nreturn msg;",
    1938. "outputs": 1,
    1939. "noerr": 0,
    1940. "initialize": "",
    1941. "finalize": "",
    1942. "libs": [],
    1943. "x": 1160,
    1944. "y": 820,
    1945. "wires": [
    1946. [
    1947. "ba743a19.4ac0e8"
    1948. ]
    1949. ]
    1950. },
    1951. {
    1952. "id": "6de0eac2.027864",
    1953. "type": "function",
    1954. "z": "648f70b0.d1af8",
    1955. "name": "",
    1956. "func": "msg.payload = \"BD_ALARM: 指定日期(\" + flow.get(\"date\") + \")没有数据。\";\n\nreturn msg;",
    1957. "outputs": 1,
    1958. "noerr": 0,
    1959. "initialize": "",
    1960. "finalize": "",
    1961. "libs": [],
    1962. "x": 1050,
    1963. "y": 1360,
    1964. "wires": [
    1965. [
    1966. "50e30eb6.bf8da"
    1967. ]
    1968. ]
    1969. },
    1970. {
    1971. "id": "9eba8011.89748",
    1972. "type": "function",
    1973. "z": "648f70b0.d1af8",
    1974. "name": "",
    1975. "func": "msg.payload = \"RMS_TAKT: 指定日期(\" + flow.get(\"date\") + \")没有数据。\";\n\nreturn msg;",
    1976. "outputs": 1,
    1977. "noerr": 0,
    1978. "initialize": "",
    1979. "finalize": "",
    1980. "libs": [],
    1981. "x": 1030,
    1982. "y": 1900,
    1983. "wires": [
    1984. [
    1985. "a475ddd2.a2187"
    1986. ]
    1987. ]
    1988. },
    1989. {
    1990. "id": "919b6e6c.47484",
    1991. "type": "function",
    1992. "z": "648f70b0.d1af8",
    1993. "name": "",
    1994. "func": "msg.payload = \"TAKT_PTN: 指定日期(\" + msg.date + \")没有数据。\";\n\nreturn msg;",
    1995. "outputs": 1,
    1996. "noerr": 0,
    1997. "initialize": "",
    1998. "finalize": "",
    1999. "libs": [],
    2000. "x": 1030,
    2001. "y": 2420,
    2002. "wires": [
    2003. [
    2004. "4130f5af.7063bc"
    2005. ]
    2006. ]
    2007. },
    2008. {
    2009. "id": "4fcf6764.974948",
    2010. "type": "function",
    2011. "z": "648f70b0.d1af8",
    2012. "name": "",
    2013. "func": "msg.payload = \"NORMAL_PTN: 指定日期(\" + flow.get(\"date\") + \")没有数据。\";\n\nreturn msg;",
    2014. "outputs": 1,
    2015. "noerr": 0,
    2016. "initialize": "",
    2017. "finalize": "",
    2018. "libs": [],
    2019. "x": 1030,
    2020. "y": 2940,
    2021. "wires": [
    2022. [
    2023. "2eb22c28.cffbf4"
    2024. ]
    2025. ]
    2026. },
    2027. {
    2028. "id": "fc0987cb.1f1c18",
    2029. "type": "influxdb out",
    2030. "z": "648f70b0.d1af8",
    2031. "influxdb": "f97c94dc.166388",
    2032. "name": "bd_ptn_takt",
    2033. "measurement": "bd_ptn_takt",
    2034. "precision": "",
    2035. "retentionPolicy": "",
    2036. "database": "database",
    2037. "precisionV18FluxV20": "ms",
    2038. "retentionPolicyV18Flux": "",
    2039. "org": "organisation",
    2040. "bucket": "bucket",
    2041. "x": 1410,
    2042. "y": 2640,
    2043. "wires": []
    2044. },
    2045. {
    2046. "id": "ecf9e410.459b38",
    2047. "type": "function",
    2048. "z": "648f70b0.d1af8",
    2049. "name": "生成notify文件",
    2050. "func": "//node.warn(msg.payload);\nlet result = [];\nresult[0] = msg.notifyDate;\nresult[1] = msg.remotePath + \"/\" + msg.csvfile;\n\nmsg.payload = result;\n\nreturn msg;\n",
    2051. "outputs": 1,
    2052. "noerr": 0,
    2053. "initialize": "",
    2054. "finalize": "",
    2055. "libs": [],
    2056. "x": 580,
    2057. "y": 980,
    2058. "wires": [
    2059. [
    2060. "594964e8.56125c"
    2061. ]
    2062. ]
    2063. },
    2064. {
    2065. "id": "594964e8.56125c",
    2066. "type": "csv",
    2067. "z": "648f70b0.d1af8",
    2068. "name": "csv属性设置",
    2069. "sep": ",",
    2070. "hdrin": true,
    2071. "hdrout": "once",
    2072. "multi": "one",
    2073. "ret": "\\r\\n",
    2074. "temp": "通知日期,原始数据",
    2075. "skip": "0",
    2076. "strings": false,
    2077. "include_empty_strings": false,
    2078. "include_null_values": false,
    2079. "x": 790,
    2080. "y": 980,
    2081. "wires": [
    2082. [
    2083. "b3522263.1cfa7"
    2084. ]
    2085. ]
    2086. },
    2087. {
    2088. "id": "b3522263.1cfa7",
    2089. "type": "function",
    2090. "z": "648f70b0.d1af8",
    2091. "name": "本地路径",
    2092. "func": "msg.localPath = \"C:/temp/data/current_data/\" + msg.date;\n//msg.payload = \"create_time: \" + new Date();\nmsg.filename = msg.localPath + \"/\" + msg.robotId + \"_notify_\" + msg.date + \".csv\";\n\nreturn msg;",
    2093. "outputs": 1,
    2094. "noerr": 0,
    2095. "initialize": "",
    2096. "finalize": "",
    2097. "libs": [],
    2098. "x": 980,
    2099. "y": 980,
    2100. "wires": [
    2101. [
    2102. "40dc1daa.c11494"
    2103. ]
    2104. ]
    2105. },
    2106. {
    2107. "id": "40dc1daa.c11494",
    2108. "type": "file",
    2109. "z": "648f70b0.d1af8",
    2110. "name": "文件path",
    2111. "filename": "",
    2112. "appendNewline": false,
    2113. "createDir": true,
    2114. "overwriteFile": "true",
    2115. "encoding": "utf8",
    2116. "x": 1160,
    2117. "y": 920,
    2118. "wires": [
    2119. [
    2120. "650edbba.1994b4"
    2121. ]
    2122. ]
    2123. },
    2124. {
    2125. "id": "650edbba.1994b4",
    2126. "type": "SFTP-main",
    2127. "z": "648f70b0.d1af8",
    2128. "path": "/",
    2129. "method": "put",
    2130. "remoteFilePath": "/home/ftpuser/cs001/notify",
    2131. "remoteFilePathType": "str",
    2132. "localFilePath": "filename",
    2133. "localFilePathType": "msg",
    2134. "server": "42aee480.a1f85c",
    2135. "outputs": 1,
    2136. "debug": false,
    2137. "name": "SFTP设置",
    2138. "x": 1350,
    2139. "y": 980,
    2140. "wires": [
    2141. []
    2142. ]
    2143. },
    2144. {
    2145. "id": "ad6004.2445e",
    2146. "type": "influxdb in",
    2147. "z": "648f70b0.d1af8",
    2148. "influxdb": "f97c94dc.166388",
    2149. "name": "bd_takt_rms",
    2150. "query": "",
    2151. "rawOutput": false,
    2152. "precision": "",
    2153. "retentionPolicy": "",
    2154. "org": "organisation",
    2155. "x": 1130,
    2156. "y": 1680,
    2157. "wires": [
    2158. [
    2159. "39df6d58.17fe72"
    2160. ]
    2161. ]
    2162. },
    2163. {
    2164. "id": "5f940f1f.3f32",
    2165. "type": "influxdb out",
    2166. "z": "648f70b0.d1af8",
    2167. "influxdb": "f97c94dc.166388",
    2168. "name": "bd_takt_rms",
    2169. "measurement": "bd_takt_rms",
    2170. "precision": "",
    2171. "retentionPolicy": "",
    2172. "database": "database",
    2173. "precisionV18FluxV20": "ms",
    2174. "retentionPolicyV18Flux": "",
    2175. "org": "organisation",
    2176. "bucket": "bucket",
    2177. "x": 1370,
    2178. "y": 2100,
    2179. "wires": []
    2180. },
    2181. {
    2182. "id": "6248b363.ecf8cc",
    2183. "type": "function",
    2184. "z": "648f70b0.d1af8",
    2185. "name": "",
    2186. "func": "if (msg.payload == null) {\n return;\n}\n\nfunction convertTime(str){\n\tlet date1 = new Date(str);\n\treturn date1.getTime() * 1000000;\n}\n\nlet checkTime = msg.payload.checkTime + msg.payload.checkMSecond;\ncheckTime = convertTime(checkTime);\n\n//解析文件名\nlet s = msg.filename.lastIndexOf(\"\\\\\");\nlet splitStr = msg.filename.substr(s + 1).split(\"_\");\nlet robotId = splitStr[0];\nlet axisId = splitStr[1];\n\n//查询数据库,取出索引\nmsg.query = \"select time, data_index from bd_takt_rms where robot_id = '\" + robotId + \n \"' and moto_num = '\" + axisId + \n \"' and act_date = '\" + flow.get(\"date\") + \n \"' and time < \" + checkTime + \n \" order by time desc limit 1\";\n//node.warn(msg.query);\n\nmsg.csvData = msg.payload;\n\nreturn msg;",
    2187. "outputs": 1,
    2188. "noerr": 0,
    2189. "initialize": "",
    2190. "finalize": "",
    2191. "libs": [],
    2192. "x": 1030,
    2193. "y": 1600,
    2194. "wires": [
    2195. [
    2196. "ad6004.2445e"
    2197. ]
    2198. ]
    2199. },
    2200. {
    2201. "id": "fb61e2c4.86601",
    2202. "type": "influxdb out",
    2203. "z": "648f70b0.d1af8",
    2204. "influxdb": "f97c94dc.166388",
    2205. "name": "bd_ptn_normal",
    2206. "measurement": "bd_ptn_normal",
    2207. "precision": "",
    2208. "retentionPolicy": "",
    2209. "database": "database",
    2210. "precisionV18FluxV20": "ms",
    2211. "retentionPolicyV18Flux": "",
    2212. "org": "organisation",
    2213. "bucket": "bucket",
    2214. "x": 1380,
    2215. "y": 3160,
    2216. "wires": []
    2217. },
    2218. {
    2219. "id": "8607526c.fe58c",
    2220. "type": "delay",
    2221. "z": "648f70b0.d1af8",
    2222. "name": "",
    2223. "pauseType": "rate",
    2224. "timeout": "5",
    2225. "timeoutUnits": "seconds",
    2226. "rate": "1",
    2227. "nbRateUnits": "90",
    2228. "rateUnits": "second",
    2229. "randomFirst": "1",
    2230. "randomLast": "5",
    2231. "randomUnits": "seconds",
    2232. "drop": false,
    2233. "outputs": 1,
    2234. "x": 440,
    2235. "y": 2640,
    2236. "wires": [
    2237. [
    2238. "f9b4d7dc.b45908"
    2239. ]
    2240. ]
    2241. },
    2242. {
    2243. "id": "a4bd4a15.51a958",
    2244. "type": "comment",
    2245. "z": "648f70b0.d1af8",
    2246. "name": "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~保存设备数据信息~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
    2247. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    2248. "x": 720,
    2249. "y": 3400,
    2250. "wires": []
    2251. },
    2252. {
    2253. "id": "ce0ae552.82e978",
    2254. "type": "inject",
    2255. "z": "648f70b0.d1af8",
    2256. "name": "",
    2257. "props": [
    2258. {
    2259. "p": "payload"
    2260. },
    2261. {
    2262. "p": "topic",
    2263. "vt": "str"
    2264. }
    2265. ],
    2266. "repeat": "",
    2267. "crontab": "",
    2268. "once": false,
    2269. "onceDelay": 0.1,
    2270. "topic": "",
    2271. "payload": "",
    2272. "payloadType": "date",
    2273. "x": 130,
    2274. "y": 3460,
    2275. "wires": [
    2276. [
    2277. "b035f6fb.1fa848"
    2278. ]
    2279. ]
    2280. },
    2281. {
    2282. "id": "b035f6fb.1fa848",
    2283. "type": "function",
    2284. "z": "648f70b0.d1af8",
    2285. "name": "数据转换",
    2286. "func": "let timeStamp = new Date().getTime();\n\nlet res = [];\n//定义轴数\nconst axisCount = 7;\n//定义机器人数量\nconst robots = [\"p1\", \"p2\"];\n\nlet index = 1;\nfor (let i = 0; i < robots.length; i++) {\n for (let j = 1; j <= axisCount; j++) {\n let obj = [];\n // fields\n obj[0] = {\n plc_no: \"0\",\n st_index: \"0\",\n status: \"normal\",\n time: (timeStamp + index) * 1000000\n };\n // tags\n obj[1] = {\n robot_id: robots[i],\n cs_id: \"cs001\",\n axis_id: j,\n };\n \n res[index - 1] = obj;\n index++;\n }\n}\n\nmsg.payload = res;\n\nreturn msg;",
    2287. "outputs": 1,
    2288. "noerr": 0,
    2289. "initialize": "",
    2290. "finalize": "",
    2291. "libs": [],
    2292. "x": 320,
    2293. "y": 3460,
    2294. "wires": [
    2295. [
    2296. "a3a973ed.a5f18"
    2297. ]
    2298. ]
    2299. },
    2300. {
    2301. "id": "a3a973ed.a5f18",
    2302. "type": "influxdb out",
    2303. "z": "648f70b0.d1af8",
    2304. "influxdb": "f97c94dc.166388",
    2305. "name": "bd_dev",
    2306. "measurement": "bd_dev",
    2307. "precision": "",
    2308. "retentionPolicy": "",
    2309. "database": "database",
    2310. "precisionV18FluxV20": "ms",
    2311. "retentionPolicyV18Flux": "",
    2312. "org": "organisation",
    2313. "bucket": "bucket",
    2314. "x": 540,
    2315. "y": 3500,
    2316. "wires": []
    2317. },
    2318. {
    2319. "id": "6a7600df.0ac16",
    2320. "type": "delay",
    2321. "z": "648f70b0.d1af8",
    2322. "name": "",
    2323. "pauseType": "rate",
    2324. "timeout": "5",
    2325. "timeoutUnits": "seconds",
    2326. "rate": "1",
    2327. "nbRateUnits": "1",
    2328. "rateUnits": "second",
    2329. "randomFirst": "1",
    2330. "randomLast": "5",
    2331. "randomUnits": "seconds",
    2332. "drop": false,
    2333. "outputs": 1,
    2334. "x": 410,
    2335. "y": 2100,
    2336. "wires": [
    2337. [
    2338. "2e93c280.2cc70e"
    2339. ]
    2340. ]
    2341. },
    2342. {
    2343. "id": "8e4db390.4f458",
    2344. "type": "comment",
    2345. "z": "648f70b0.d1af8",
    2346. "name": "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~日期管理~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
    2347. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    2348. "x": 690,
    2349. "y": 3660,
    2350. "wires": []
    2351. },
    2352. {
    2353. "id": "831c2a56.faeab8",
    2354. "type": "inject",
    2355. "z": "648f70b0.d1af8",
    2356. "d": true,
    2357. "name": "每天0:01执行",
    2358. "props": [
    2359. {
    2360. "p": "payload"
    2361. },
    2362. {
    2363. "p": "topic",
    2364. "vt": "str"
    2365. }
    2366. ],
    2367. "repeat": "",
    2368. "crontab": "00 00 * * *",
    2369. "once": false,
    2370. "onceDelay": 0.1,
    2371. "topic": "",
    2372. "payload": "",
    2373. "payloadType": "date",
    2374. "x": 160,
    2375. "y": 3720,
    2376. "wires": [
    2377. [
    2378. "612b461a.c55928"
    2379. ]
    2380. ]
    2381. },
    2382. {
    2383. "id": "612b461a.c55928",
    2384. "type": "function",
    2385. "z": "648f70b0.d1af8",
    2386. "name": "数据转换",
    2387. "func": "/**\n* 自定义函数名:PrefixZero\n* @param num: 被操作数\n* @param n: 固定的总位数\n*/\nfunction prefixZero(num, n) {\n return (Array(n).join(0) + num).slice(-n);\n}\n\nlet date = new Date();\nlet dateStr = date.getFullYear().toString();\ndateStr += prefixZero((date.getMonth() + 1), 2);\nlet yestoday = dateStr + prefixZero((date.getDate() - 1), 2);\nlet today = dateStr + prefixZero(date.getDate(), 2);\n//test data\n//yestoday = \"20210623\";\n//today = \"20210624\";\n\nlet obj = [];\n // fields\n obj[0] = {\n date: yestoday,\n time: new Date()\n };\n // tags\n obj[1] = {\n now_date: today\n };\n\nmsg.payload = obj;\n\nreturn msg;",
    2388. "outputs": 1,
    2389. "noerr": 0,
    2390. "initialize": "",
    2391. "finalize": "",
    2392. "libs": [],
    2393. "x": 360,
    2394. "y": 3720,
    2395. "wires": [
    2396. [
    2397. "94d3afb9.92ddc",
    2398. "bf5c6295.8a877"
    2399. ]
    2400. ]
    2401. },
    2402. {
    2403. "id": "94d3afb9.92ddc",
    2404. "type": "influxdb out",
    2405. "z": "648f70b0.d1af8",
    2406. "influxdb": "f97c94dc.166388",
    2407. "name": "bd_date",
    2408. "measurement": "bd_date",
    2409. "precision": "",
    2410. "retentionPolicy": "",
    2411. "database": "database",
    2412. "precisionV18FluxV20": "ms",
    2413. "retentionPolicyV18Flux": "",
    2414. "org": "organisation",
    2415. "bucket": "bucket",
    2416. "x": 600,
    2417. "y": 3720,
    2418. "wires": []
    2419. },
    2420. {
    2421. "id": "bf5c6295.8a877",
    2422. "type": "debug",
    2423. "z": "648f70b0.d1af8",
    2424. "name": "",
    2425. "active": true,
    2426. "tosidebar": true,
    2427. "console": false,
    2428. "tostatus": false,
    2429. "complete": "payload",
    2430. "targetType": "msg",
    2431. "statusVal": "",
    2432. "statusType": "auto",
    2433. "x": 610,
    2434. "y": 3780,
    2435. "wires": []
    2436. },
    2437. {
    2438. "id": "c62b4b13.b3e498",
    2439. "type": "function",
    2440. "z": "648f70b0.d1af8",
    2441. "name": "测试数据",
    2442. "func": "let timeStamp = new Date().getTime();\n\nlet res = [];\n//定义轴数\nconst axisCount = 1;\n//定义机器人数量\nconst robots = [\"h1\"];\n\nlet index = 1;\nfor (let i = 0; i < robots.length; i++) {\n for (let j = 1; j <= axisCount; j++) {\n let obj = [];\n // fields\n obj[0] = {\n plc_no: \"0\",\n st_index: \"0\",\n status: \"normal\",\n time: (timeStamp + index) * 1000000\n };\n // tags\n obj[1] = {\n robot_id: robots[i],\n cs_id: \"cs001\",\n axis_id: j,\n };\n \n res[index - 1] = obj;\n index++;\n }\n}\n\nmsg.payload = res;\n\nreturn msg;",
    2443. "outputs": 1,
    2444. "noerr": 0,
    2445. "initialize": "",
    2446. "finalize": "",
    2447. "libs": [],
    2448. "x": 320,
    2449. "y": 3540,
    2450. "wires": [
    2451. [
    2452. "a3a973ed.a5f18"
    2453. ]
    2454. ]
    2455. },
    2456. {
    2457. "id": "43bde28d.154a5c",
    2458. "type": "inject",
    2459. "z": "648f70b0.d1af8",
    2460. "name": "",
    2461. "props": [
    2462. {
    2463. "p": "payload"
    2464. },
    2465. {
    2466. "p": "topic",
    2467. "vt": "str"
    2468. }
    2469. ],
    2470. "repeat": "",
    2471. "crontab": "",
    2472. "once": false,
    2473. "onceDelay": 0.1,
    2474. "topic": "",
    2475. "payload": "",
    2476. "payloadType": "date",
    2477. "x": 130,
    2478. "y": 3540,
    2479. "wires": [
    2480. [
    2481. "c62b4b13.b3e498"
    2482. ]
    2483. ]
    2484. },
    2485. {
    2486. "id": "b6042bbe.11d9c8",
    2487. "type": "delay",
    2488. "z": "648f70b0.d1af8",
    2489. "name": "",
    2490. "pauseType": "rate",
    2491. "timeout": "5",
    2492. "timeoutUnits": "seconds",
    2493. "rate": "200",
    2494. "nbRateUnits": "1",
    2495. "rateUnits": "second",
    2496. "randomFirst": "1",
    2497. "randomLast": "5",
    2498. "randomUnits": "seconds",
    2499. "drop": false,
    2500. "outputs": 1,
    2501. "x": 1100,
    2502. "y": 2720,
    2503. "wires": [
    2504. [
    2505. "635f943c.04c5dc"
    2506. ]
    2507. ]
    2508. },
    2509. {
    2510. "id": "1be218a6.09b5b7",
    2511. "type": "inject",
    2512. "z": "648f70b0.d1af8",
    2513. "name": "",
    2514. "props": [
    2515. {
    2516. "p": "payload"
    2517. },
    2518. {
    2519. "p": "topic",
    2520. "vt": "str"
    2521. }
    2522. ],
    2523. "repeat": "",
    2524. "crontab": "",
    2525. "once": false,
    2526. "onceDelay": 0.1,
    2527. "topic": "",
    2528. "payload": "",
    2529. "payloadType": "date",
    2530. "x": 130,
    2531. "y": 4160,
    2532. "wires": [
    2533. [
    2534. "4774f4e3.a5878c"
    2535. ]
    2536. ]
    2537. },
    2538. {
    2539. "id": "ce68bbb1.4a2bb8",
    2540. "type": "debug",
    2541. "z": "648f70b0.d1af8",
    2542. "name": "test001",
    2543. "active": true,
    2544. "tosidebar": true,
    2545. "console": false,
    2546. "tostatus": false,
    2547. "complete": "payload",
    2548. "targetType": "msg",
    2549. "statusVal": "",
    2550. "statusType": "auto",
    2551. "x": 780,
    2552. "y": 4160,
    2553. "wires": []
    2554. },
    2555. {
    2556. "id": "2ca356d1.09af3a",
    2557. "type": "complete",
    2558. "z": "648f70b0.d1af8",
    2559. "name": "",
    2560. "scope": [
    2561. "ce68bbb1.4a2bb8"
    2562. ],
    2563. "uncaught": false,
    2564. "x": 130,
    2565. "y": 4280,
    2566. "wires": [
    2567. [
    2568. "d7114c74.24a46"
    2569. ]
    2570. ]
    2571. },
    2572. {
    2573. "id": "5f650ae4.e27c24",
    2574. "type": "debug",
    2575. "z": "648f70b0.d1af8",
    2576. "name": "",
    2577. "active": true,
    2578. "tosidebar": true,
    2579. "console": false,
    2580. "tostatus": false,
    2581. "complete": "payload",
    2582. "targetType": "msg",
    2583. "statusVal": "",
    2584. "statusType": "auto",
    2585. "x": 590,
    2586. "y": 4280,
    2587. "wires": []
    2588. },
    2589. {
    2590. "id": "d7114c74.24a46",
    2591. "type": "function",
    2592. "z": "648f70b0.d1af8",
    2593. "name": "",
    2594. "func": "msg.payload = flow.get(\"t1\");\n\nreturn msg;",
    2595. "outputs": 1,
    2596. "noerr": 0,
    2597. "initialize": "",
    2598. "finalize": "",
    2599. "libs": [],
    2600. "x": 330,
    2601. "y": 4280,
    2602. "wires": [
    2603. [
    2604. "5f650ae4.e27c24"
    2605. ]
    2606. ]
    2607. },
    2608. {
    2609. "id": "4cdf3e60.f26f6",
    2610. "type": "influxdb in",
    2611. "z": "648f70b0.d1af8",
    2612. "influxdb": "f97c94dc.166388",
    2613. "name": "",
    2614. "query": "",
    2615. "rawOutput": false,
    2616. "precision": "",
    2617. "retentionPolicy": "",
    2618. "org": "organisation",
    2619. "x": 360,
    2620. "y": 4160,
    2621. "wires": [
    2622. [
    2623. "786c977c.5fb108"
    2624. ]
    2625. ]
    2626. },
    2627. {
    2628. "id": "786c977c.5fb108",
    2629. "type": "function",
    2630. "z": "648f70b0.d1af8",
    2631. "name": "",
    2632. "func": "flow.set(\"t1\", 333);\n\nreturn msg;",
    2633. "outputs": 1,
    2634. "noerr": 0,
    2635. "initialize": "",
    2636. "finalize": "",
    2637. "libs": [],
    2638. "x": 570,
    2639. "y": 4160,
    2640. "wires": [
    2641. [
    2642. "ce68bbb1.4a2bb8"
    2643. ]
    2644. ]
    2645. },
    2646. {
    2647. "id": "1f16287a.d8db98",
    2648. "type": "influxdb in",
    2649. "z": "648f70b0.d1af8",
    2650. "influxdb": "f97c94dc.166388",
    2651. "name": "bd_ptn_normal",
    2652. "query": "",
    2653. "rawOutput": false,
    2654. "precision": "",
    2655. "retentionPolicy": "",
    2656. "org": "organisation",
    2657. "x": 700,
    2658. "y": 3240,
    2659. "wires": [
    2660. [
    2661. "b69fb787.2b0648"
    2662. ]
    2663. ]
    2664. },
    2665. {
    2666. "id": "4774f4e3.a5878c",
    2667. "type": "function",
    2668. "z": "648f70b0.d1af8",
    2669. "name": "",
    2670. "func": "var r = \"p1\";\nvar m = \"1\";\nmsg.query = \"delete from bd_ptn_normal where robot_id = '\" + r + \n \"' and moto_num = '\" + m + \"'\";\n\nreturn msg;",
    2671. "outputs": 1,
    2672. "noerr": 0,
    2673. "initialize": "",
    2674. "finalize": "",
    2675. "libs": [],
    2676. "x": 230,
    2677. "y": 4080,
    2678. "wires": [
    2679. [
    2680. "4cdf3e60.f26f6"
    2681. ]
    2682. ]
    2683. },
    2684. {
    2685. "id": "cfc6f50b.d4a328",
    2686. "type": "comment",
    2687. "z": "648f70b0.d1af8",
    2688. "name": "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~删除数据~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
    2689. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    2690. "x": 690,
    2691. "y": 4020,
    2692. "wires": []
    2693. },
    2694. {
    2695. "id": "adbe799a.91ad38",
    2696. "type": "comment",
    2697. "z": "648f70b0.d1af8",
    2698. "name": "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~插入offset~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
    2699. "info": "1\n2\n3\n4\n5\n6\n7\n8\n9",
    2700. "x": 690,
    2701. "y": 4400,
    2702. "wires": []
    2703. },
    2704. {
    2705. "id": "c4fdddba.3fed",
    2706. "type": "function",
    2707. "z": "648f70b0.d1af8",
    2708. "name": "数据转换",
    2709. "func": "let res = [];\nconst MAX_TAKT_NUM = 1800; //1天数据量,每隔48秒1个值,最多有1800\nconst INTERVAL = 30; //取得takt index前后30条数据,offset要设为taktIdx-30*2400\nconst PTN_NUMS = 2400;\n\n\nfor (let i = 1; i <= MAX_TAKT_NUM; i++) {\n let obj = [];\n let offsetValue = 0;\n if (i > INTERVAL) {\n offsetValue = (i - INTERVAL) * PTN_NUMS;\n }\n \n // fields\n obj[0] = {\n offset_pos: offsetValue,\n };\n // tags\n obj[1] = {\n takt_idx: i\n };\n \n res[i - 1] = obj;\n}\n\nmsg.payload = res;\n\nreturn msg;",
    2710. "outputs": 1,
    2711. "noerr": 0,
    2712. "initialize": "",
    2713. "finalize": "",
    2714. "libs": [],
    2715. "x": 380,
    2716. "y": 4460,
    2717. "wires": [
    2718. [
    2719. "aa1666bb.d037e8",
    2720. "c366c55b.572b38"
    2721. ]
    2722. ]
    2723. },
    2724. {
    2725. "id": "aa1666bb.d037e8",
    2726. "type": "influxdb out",
    2727. "z": "648f70b0.d1af8",
    2728. "influxdb": "f97c94dc.166388",
    2729. "name": "bd_offset",
    2730. "measurement": "bd_offset",
    2731. "precision": "",
    2732. "retentionPolicy": "",
    2733. "database": "database",
    2734. "precisionV18FluxV20": "ms",
    2735. "retentionPolicyV18Flux": "",
    2736. "org": "organisation",
    2737. "bucket": "bucket",
    2738. "x": 620,
    2739. "y": 4460,
    2740. "wires": []
    2741. },
    2742. {
    2743. "id": "c366c55b.572b38",
    2744. "type": "debug",
    2745. "z": "648f70b0.d1af8",
    2746. "name": "",
    2747. "active": true,
    2748. "tosidebar": true,
    2749. "console": false,
    2750. "tostatus": false,
    2751. "complete": "payload",
    2752. "targetType": "msg",
    2753. "statusVal": "",
    2754. "statusType": "auto",
    2755. "x": 630,
    2756. "y": 4520,
    2757. "wires": []
    2758. },
    2759. {
    2760. "id": "81a93bd2.31b038",
    2761. "type": "inject",
    2762. "z": "648f70b0.d1af8",
    2763. "name": "",
    2764. "props": [
    2765. {
    2766. "p": "payload"
    2767. },
    2768. {
    2769. "p": "topic",
    2770. "vt": "str"
    2771. }
    2772. ],
    2773. "repeat": "",
    2774. "crontab": "",
    2775. "once": false,
    2776. "onceDelay": 0.1,
    2777. "topic": "",
    2778. "payload": "",
    2779. "payloadType": "date",
    2780. "x": 150,
    2781. "y": 4460,
    2782. "wires": [
    2783. [
    2784. "c4fdddba.3fed"
    2785. ]
    2786. ]
    2787. },
    2788. {
    2789. "id": "f97c94dc.166388",
    2790. "type": "influxdb",
    2791. "z": "648f70b0.d1af8",
    2792. "hostname": "127.0.0.1",
    2793. "port": "8086",
    2794. "protocol": "http",
    2795. "database": "influxdb1",
    2796. "name": "influxdb1",
    2797. "usetls": false,
    2798. "tls": "",
    2799. "influxdbVersion": "1.x",
    2800. "url": "http://localhost:8086",
    2801. "rejectUnauthorized": true
    2802. },
    2803. {
    2804. "id": "42aee480.a1f85c",
    2805. "type": "SFTP-credentials",
    2806. "host": "118.190.53.60",
    2807. "port": "22",
    2808. "username": "root",
    2809. "password": "HCR&D1234"
    2810. },
    2811. {
    2812. "id": "25f44ffa.156ed",
    2813. "type": "serial-port",
    2814. "serialport": "COM4",
    2815. "serialbaud": "4800",
    2816. "databits": "8",
    2817. "parity": "none",
    2818. "stopbits": "1",
    2819. "waitfor": "",
    2820. "dtr": "none",
    2821. "rts": "none",
    2822. "cts": "none",
    2823. "dsr": "none",
    2824. "newline": "0",
    2825. "bin": "bin",
    2826. "out": "time",
    2827. "addchar": "",
    2828. "responsetimeout": "10000"
    2829. }
    2830. ]