node-red-trexmes-commands 1.3.0 → 1.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-trexmes-commands",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
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
@@ -417,7 +417,8 @@
417
417
  { value: '15|Finish Test Mode', label: 'Finish Test Mode', hasValue: false },
418
418
  { value: '16|Create Deffect', label: 'Create Deffect', hasValue: false },
419
419
  { value: '100|Get Open Jobs', label: 'Get Open Jobs', hasValue: false },
420
- { value: '101|Get StopCause List', label: 'Get StopCause List', hasValue: false }
420
+ { value: '101|Get StopCause List', label: 'Get StopCause List', hasValue: false },
421
+ { value: '102|Get PWorkstation List', label: 'Get PWorkstation List', hasValue: false }
421
422
  ],
422
423
  typeField: $('#node-input-modeOptType'),
423
424
  default: 'Load Job Plan'
@@ -471,9 +472,9 @@
471
472
  else if(operationMode.startsWith('101|')) { //Get StopCause List
472
473
  data = '{ "WorkstationId": 10 }';
473
474
  }
474
- else if(operationMode.startsWith('102|')) { //Get Employee List
475
- data = '{ "WorkstationId": 10 }';
476
- }
475
+ else if(operationMode.startsWith('102|')) { //Get PWorkstation List
476
+ data = '{}';
477
+ }
477
478
  node.editor.setValue(JSON.stringify(JSON.parse(data),null, 2));
478
479
 
479
480
  });
package/trexcommands.js CHANGED
@@ -34,8 +34,12 @@ module.exports = function (RED) {
34
34
  function checkPayload(payload) {
35
35
  let result = { "isOk" : false, "isGetFunc": false };
36
36
  if(!payload.WorkstationId){
37
- return result;
37
+ if(payload.operationMode != "102" )
38
+ {
39
+ return result;
40
+ }
38
41
  }
42
+
39
43
  result.wsId = payload.WorkstationId;
40
44
 
41
45
  if(payload.operationMode == "1" ) { // Load Job Plan
@@ -121,7 +125,12 @@ module.exports = function (RED) {
121
125
  result.command = JSON.stringify({ "WorkstationId" : payload.WorkstationId });
122
126
  result.isOk = true;
123
127
  result.isGetFunc = true;
124
- }
128
+ }
129
+ else if(payload.operationMode == "102" ) { // Get PWorkstation List
130
+ result.command = JSON.stringify({ });
131
+ result.isOk = true;
132
+ result.isGetFunc = true;
133
+ }
125
134
  return result;
126
135
  }
127
136
 
@@ -278,6 +287,14 @@ module.exports = function (RED) {
278
287
 
279
288
  }
280
289
 
290
+ function sqlGeneratePWorkstationListQuery(record) {
291
+ let query = `select PWS.PWORKSTATIONID, PWS.PWORKSTATIONNO,
292
+ PWS.PWORKSTATIONNAME from PLINEDET PL inner join PWORKSTATION PWS
293
+ on PL.COMPANYID = PWS.COMPANYID and PL.PWORKSTATIONID = PWS.PWORKSTATIONID
294
+ where PWS.COMPANYID= ${record.companyId} and PWS.STATUS = 2`;
295
+ return query;
296
+ }
297
+
281
298
  function connection(config) {
282
299
  RED.nodes.createNode(this, config);
283
300
  const node = this;
@@ -580,6 +597,10 @@ module.exports = function (RED) {
580
597
  {
581
598
  query = sqlGenerateStopCauseListQuery(record);
582
599
  }
600
+ else if(record.cmdId == "102")
601
+ {
602
+ query = sqlGeneratePWorkstationListQuery(record);
603
+ }
583
604
  }
584
605
  else {
585
606
  query = sqlNgpCommandQueInsert(record);