node-red-trexmes-commands 1.5.1 → 1.5.3

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.5.1",
3
+ "version": "1.5.3",
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
 
@@ -209,7 +214,9 @@ module.exports = function (RED) {
209
214
  FROM PLINETOP WITH (NOLOCK)
210
215
  LEFT OUTER JOIN PLINEDET WITH (NOLOCK) ON PLINETOP.COMPANYID = PLINEDET.COMPANYID AND PLINEDET.PLINEID = PLINETOP.PLINEID
211
216
  WHERE PLINEDET.COMPANYID = ${record.companyId} AND PLINEDET.PWORKSTATIONID = ${record.wsId}
212
- ORDER BY PLINETOP.PLINENO `;
217
+ ORDER BY PLINETOP.PLINENO
218
+ SET @SqlPWorkStation = ISNULL(@SqlPWorkStation,${record.wsId})
219
+ `;
213
220
 
214
221
  query = query + ` SELECT ${SqlIsYuklemeSirasi} A.PWORKSTATIONID, PW.PWORKSTATIONNO, A.SORTID, A.PID, A.DESCRIPTION, A.WORKSTARTDATE, A.PSTOPCAUSEID, A.SETUPDURATION, A.EMPDURATION,
215
222
  A.SPEED, A.PJOBORDERID, PJB.PROORDERSNO, PJB.TRANSCODE, A.PEQUIPMENTID, PE.PEQUIPMENTNO, A.DURATION, A.FPLANSTARTDATE, A.REQWORKEMPCOUNT, A.ITEMNO, A.PLANSHIFT, A.PLANWEEK, A.PLANDAY, A.PRIORITY,
@@ -253,7 +260,7 @@ module.exports = function (RED) {
253
260
  }
254
261
 
255
262
  query += " ORDER BY A.STARTDATE, ISNULL(A.SORTID,A.PID)";
256
-
263
+
257
264
  return query;
258
265
  }
259
266
 
@@ -470,6 +477,13 @@ module.exports = function (RED) {
470
477
  return query;
471
478
  }
472
479
 
480
+ function sqlGenerateEmployeeListQuery(record) {
481
+ let query = `select EMPLOYEEID,EMPLOYEENO,EMPLOYEENAME,
482
+ QUALITYEMPLOYEE,MAINTEMPLOYEE,FORKLIFTEMPLOYEE,DEPARTMANID,PWORKCENTERID
483
+ from EMPLOYEE where COMPANYID= ${record.companyId} and STATUS = 2`;
484
+ return query;
485
+ }
486
+
473
487
  function connection(config) {
474
488
  RED.nodes.createNode(this, config);
475
489
  const node = this;
@@ -776,7 +790,10 @@ module.exports = function (RED) {
776
790
  }
777
791
  else if (record.cmdId == "103") {
778
792
  query = sqlGenerateStationStatusQuery(record);
779
- }
793
+ }
794
+ else if (record.cmdId == "104") {
795
+ query = sqlGenerateEmployeeListQuery(record);
796
+ }
780
797
  }
781
798
  else {
782
799
  query = sqlNgpCommandQueInsert(record);