node-red-trexmes-commands 1.2.3 → 1.3.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.2.3",
3
+ "version": "1.3.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
@@ -416,7 +416,8 @@
416
416
  { value: '14|Start Test Mode', label: 'Start Test Mode', hasValue: false },
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
- { value: '100|Get Open Jobs', label: 'Get Open Jobs', hasValue: false }
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
421
  ],
421
422
  typeField: $('#node-input-modeOptType'),
422
423
  default: 'Load Job Plan'
@@ -467,6 +468,12 @@
467
468
  $("#node-input-label-getOpenJobs-filter").show();
468
469
  $("#node-input-getOpenJobs-filter").show();
469
470
  }
471
+ else if(operationMode.startsWith('101|')) { //Get StopCause List
472
+ data = '{ "WorkstationId": 10 }';
473
+ }
474
+ else if(operationMode.startsWith('102|')) { //Get Employee List
475
+ data = '{ "WorkstationId": 10 }';
476
+ }
470
477
  node.editor.setValue(JSON.stringify(JSON.parse(data),null, 2));
471
478
 
472
479
  });
package/trexcommands.js CHANGED
@@ -116,6 +116,11 @@ module.exports = function (RED) {
116
116
  result.command = JSON.stringify({ "WorkstationId" : payload.WorkstationId });
117
117
  result.isOk = true;
118
118
  result.isGetFunc = true;
119
+ }
120
+ else if(payload.operationMode == "101" ) { // Get StopCause List
121
+ result.command = JSON.stringify({ "WorkstationId" : payload.WorkstationId });
122
+ result.isOk = true;
123
+ result.isGetFunc = true;
119
124
  }
120
125
  return result;
121
126
  }
@@ -238,6 +243,41 @@ module.exports = function (RED) {
238
243
  return query;
239
244
  }
240
245
 
246
+ function sqlGenerateStopCauseListQuery(record) {
247
+ let query = `DECLARE
248
+ @ACILIS_DURUS NVARCHAR(100),
249
+ @ARKAEKIPMAN_DURUS NVARCHAR(100),
250
+ @ONEKIPMAN_DURUS NVARCHAR(100),
251
+ @PLANYOK_DURUS NVARCHAR(100),
252
+ @NOCONNECTION_DURUS NVARCHAR(100),
253
+ @VARDIYAYOK_DURUS NVARCHAR(100),
254
+ @SHIFTEDSHIFT_DURUS NVARCHAR(100)
255
+
256
+ select @ACILIS_DURUS = PARAMVALUE from UPSYSPARAM where PARAMNAME='PSTOPCAUSEID_ACILISDURUS' and COMPANYID = ${record.companyId}
257
+ select @ARKAEKIPMAN_DURUS = PARAMVALUE from UPSYSPARAM where PARAMNAME='PSTOPCAUSEID_ARKAEKIPMANDURUSU' and COMPANYID = ${record.companyId}
258
+ select @ONEKIPMAN_DURUS = PARAMVALUE from UPSYSPARAM where PARAMNAME='PSTOPCAUSEID_ONEKIPMANDURUSU' and COMPANYID = ${record.companyId}
259
+ select @PLANYOK_DURUS = PARAMVALUE from UPSYSPARAM where PARAMNAME='PSTOPCAUSEID_PLANYOK' and COMPANYID = ${record.companyId}
260
+ select @NOCONNECTION_DURUS = PARAMVALUE from UPSYSPARAM where PARAMNAME='PSTOPCAUSEID_NOCONNECTION' and COMPANYID = ${record.companyId}
261
+ select @VARDIYAYOK_DURUS = PARAMVALUE from UPSYSPARAM where PARAMNAME='PSTOPCAUSEID_VARDIYAYOKDURUSU' and COMPANYID = ${record.companyId}
262
+ select @SHIFTEDSHIFT_DURUS = PARAMVALUE from UPSYSPARAM where PARAMNAME='PSTOPCAUSEID_SHIFTEDSHIFT' and COMPANYID = ${record.companyId}
263
+
264
+ SELECT A.*
265
+ ,B.PSTOPCAUSENO
266
+ ,B.PSTOPCAUSENAME
267
+ ,B.GROUPCODE
268
+ FROM PSTOPCAUSEWS A
269
+ INNER JOIN PSTOPCAUSE B ON A.COMPANYID = B.COMPANYID
270
+ AND A.PSTOPCAUSEID = B.PSTOPCAUSEID
271
+ WHERE A.COMPANYID = ${record.companyId}
272
+ AND B.STATUS = 2
273
+ AND A.PWORKSTATIONID = ${record.wsId}
274
+ AND A.PSTOPCAUSEID NOT IN (@ACILIS_DURUS,@ARKAEKIPMAN_DURUS, @ONEKIPMAN_DURUS,@PLANYOK_DURUS,
275
+ @NOCONNECTION_DURUS,@VARDIYAYOK_DURUS,@SHIFTEDSHIFT_DURUS)`;
276
+
277
+ return query;
278
+
279
+ }
280
+
241
281
  function connection(config) {
242
282
  RED.nodes.createNode(this, config);
243
283
  const node = this;
@@ -536,11 +576,15 @@ module.exports = function (RED) {
536
576
 
537
577
  query = sqlGenerateProductionPlanQuery(record);
538
578
  }
579
+ else if(record.cmdId == "101")
580
+ {
581
+ query = sqlGenerateStopCauseListQuery(record);
582
+ }
539
583
  }
540
584
  else {
541
585
  query = sqlNgpCommandQueInsert(record);
542
586
  }
543
- node.log("query: " + query);
587
+ //node.log("query: " + query);
544
588
 
545
589
  trexmesCN.execSql("", query, [], {}, function (err, data, info) {
546
590
  if (err) {