node-red-trexmes-commands 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,7 +49,7 @@ As an operation return, for example, when the operation is successful for the "L
49
49
 
50
50
  The example can be found in the node-red import examples page.
51
51
 
52
- ![trexMes-CMD Node image1](https://raw.githubusercontent.com/asafyurdakul/node-red-trexmes-commands/master/src/assets/1.jpg)
52
+ ![trexMes-CMD Node image1](https://raw.githubusercontent.com/asafyurdakul/node-red-trexmes-commands/master/assets/1.jpg)
53
53
 
54
54
  # Requirements
55
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-trexmes-commands",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "A node-red node to execute commands for Trex Mes Systems",
5
5
  "main": "trexcommands.js",
6
6
  "dependencies": {
package/trexcommands.html CHANGED
@@ -419,7 +419,8 @@
419
419
  { value: '100|Get Open Jobs', label: 'Get Open Jobs', hasValue: false },
420
420
  { value: '101|Get StopCause List', label: 'Get StopCause List', hasValue: false },
421
421
  { value: '102|Get PWorkstation List', label: 'Get PWorkstation List', hasValue: false },
422
- { value: '103|Get Station Status', label: 'Get Station Status', hasValue: false }
422
+ { value: '103|Get Station Status', label: 'Get Station Status', hasValue: false },
423
+ { value: '104|Get Employee List', label: 'Get Employee List', hasValue: false }
423
424
  ],
424
425
  typeField: $('#node-input-modeOptType'),
425
426
  default: 'Load Job Plan'
@@ -478,7 +479,10 @@
478
479
  }
479
480
  else if(operationMode.startsWith('103|')) { //Get Station Status
480
481
  data = '{ "WorkstationId": 10 }';
481
- }
482
+ }
483
+ else if(operationMode.startsWith('104|')) { //Get Employee List
484
+ data = '{}';
485
+ }
482
486
  node.editor.setValue(JSON.stringify(JSON.parse(data),null, 2));
483
487
 
484
488
  });
package/trexcommands.js CHANGED
@@ -34,7 +34,7 @@ module.exports = function (RED) {
34
34
  function checkPayload(payload) {
35
35
  let result = { "isOk" : false, "isGetFunc": false };
36
36
  if(!payload.WorkstationId){
37
- if(payload.operationMode != "102" )
37
+ if(payload.operationMode != "102" && payload.operationMode != "104")
38
38
  {
39
39
  return result;
40
40
  }
@@ -135,7 +135,12 @@ module.exports = function (RED) {
135
135
  result.command = JSON.stringify({ "WorkstationId" : payload.WorkstationId });
136
136
  result.isOk = true;
137
137
  result.isGetFunc = true;
138
- }
138
+ }
139
+ else if(payload.operationMode == "104" ) { // Get Employee List
140
+ result.command = JSON.stringify({ });
141
+ result.isOk = true;
142
+ result.isGetFunc = true;
143
+ }
139
144
  return result;
140
145
  }
141
146
 
@@ -470,6 +475,13 @@ module.exports = function (RED) {
470
475
  return query;
471
476
  }
472
477
 
478
+ function sqlGenerateEmployeeListQuery(record) {
479
+ let query = `select EMPLOYEEID,EMPLOYEENO,EMPLOYEENAME,
480
+ QUALITYEMPLOYEE,MAINTEMPLOYEE,FORKLIFTEMPLOYEE,DEPARTMANID,PWORKCENTERID
481
+ from EMPLOYEE where COMPANYID= ${record.companyId} and STATUS = 2`;
482
+ return query;
483
+ }
484
+
473
485
  function connection(config) {
474
486
  RED.nodes.createNode(this, config);
475
487
  const node = this;
@@ -776,7 +788,10 @@ module.exports = function (RED) {
776
788
  }
777
789
  else if (record.cmdId == "103") {
778
790
  query = sqlGenerateStationStatusQuery(record);
779
- }
791
+ }
792
+ else if (record.cmdId == "104") {
793
+ query = sqlGenerateEmployeeListQuery(record);
794
+ }
780
795
  }
781
796
  else {
782
797
  query = sqlNgpCommandQueInsert(record);