@seniorsistemas/yms-integration 1.18.4 → 1.19.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.
@@ -12,9 +12,9 @@ import { MessageService, DynamicDialogRef, DynamicDialogConfig, DialogService, C
12
12
  import { ControleCircuito, ControleOperacao, IntegrationDispatcher, CircuitoFinalizado, ControleUnificado, ChegadaVeiculo, IntegrationEventsCallback, IntegrationModule, ChegadaVeiculoOverride, Agendamento } from '@seniorsistemas/yms-routines';
13
13
  import { trigger, state, style, transition, animate } from '@angular/animations';
14
14
  import { PermissionsModule } from '@seniorsistemas/platform-components';
15
- import { StompService, StompConfig } from '@stomp/ng2-stompjs';
16
- import { CookieService } from 'ngx-cookie-service';
15
+ import { StompConfig, StompService } from '@stomp/ng2-stompjs';
17
16
  import * as SockJS from 'sockjs-client';
17
+ import { CookieService } from 'ngx-cookie-service';
18
18
  import { DynamicDialogModule } from 'primeng/components/dynamicdialog/dynamicdialog';
19
19
  import { TooltipModule, SharedModule, CardModule, DialogModule, PanelModule, InputTextModule as InputTextModule$1, DropdownModule, ConfirmDialogModule, TabViewModule, CalendarModule } from 'primeng/primeng';
20
20
  import { SelectPlantService, SelectPlantModule } from '@seniorsistemas/yms-components';
@@ -375,6 +375,9 @@ var BalancasService = /** @class */ (function (_super) {
375
375
  BalancasService.prototype.fallbackCall = function (balanca, peso) {
376
376
  return this.http.post(this.urlBalanca + "actions/manualWeight", { code: balanca, weight: peso }).pipe(this.defaultCatch());
377
377
  };
378
+ BalancasService.prototype.getStabilizedWeight = function (code) {
379
+ return this.http.post(this.urlBalanca + "queries/getStabilizedWeight", { code: code }).pipe(this.defaultCatch());
380
+ };
378
381
  BalancasService.prototype.getWeightScaleByCode = function (code) {
379
382
  var params = {
380
383
  displayFields: ["description", "code"],
@@ -408,13 +411,10 @@ var VisualizarBalancaDescritor = /** @class */ (function () {
408
411
  }());
409
412
  var VisualizarBalancaComponent = /** @class */ (function (_super) {
410
413
  __extends(VisualizarBalancaComponent, _super);
411
- function VisualizarBalancaComponent(service, client, cookieService) {
414
+ function VisualizarBalancaComponent(service) {
412
415
  var _this = _super.call(this) || this;
413
416
  _this.service = service;
414
- _this.client = client;
415
- _this.cookieService = cookieService;
416
417
  _this.loading = false;
417
- _this.websocket = new IntegrationWebSocket(_this.client, _this.cookieService, 'integration');
418
418
  _this.unsubscribe$ = new Subject();
419
419
  _this.weightScales$ = new BehaviorSubject([]);
420
420
  _this.weightScaleValues = new Map();
@@ -432,19 +432,10 @@ var VisualizarBalancaComponent = /** @class */ (function (_super) {
432
432
  _this.weightScales$.next(contents);
433
433
  contents.forEach(function (value) {
434
434
  _this.weightScaleValues.set(value.id, 0);
435
- });
436
- });
437
- this.websocket.connect(function (url, client) {
438
- client.subscribe(url + "wsWeightScale")
439
- .pipe(map(function (message) { return message.body; }), map(function (body) { return JSON.parse(body).data; }), takeUntil(_this.unsubscribe$))
440
- .subscribe(function (payload) {
441
- if (!_this.weightScales$.value.length)
442
- return;
443
- var index = _this.weightScales$.value.findIndex(function (value) { return value.id === payload.weightScale.id; });
444
- if (index < 0)
445
- return;
446
- var find = _this.weightScales$.value[index];
447
- _this.weightScaleValues.set(find.id, payload.weight);
435
+ _this.service.getStabilizedWeight(value.code)
436
+ .subscribe(function (stabilized) {
437
+ _this.weightScaleValues.set(value.id, stabilized.weight);
438
+ });
448
439
  });
449
440
  });
450
441
  };
@@ -461,9 +452,7 @@ var VisualizarBalancaComponent = /** @class */ (function (_super) {
461
452
  selector: 'visualizar-balanca-component',
462
453
  template: "<div *sLoadingState=\"loading\">\n <p-table [value]=\"weightScales$ | async\">\n <ng-template pTemplate=\"header\">\n <tr>\n <th>C\u00F3digo</th>\n <th>Descri\u00E7\u00E3o</th>\n <th>Peso</th>\n </tr>\n </ng-template>\n <ng-template let-rowData pTemplate=\"body\">\n <tr>\n <td>{{rowData.code}}</td>\n <td>{{rowData.description}}</td>\n <td>{{weightScaleValues.get(rowData.id)}}</td>\n </tr>\n </ng-template>\n </p-table>\n</div>"
463
454
  }),
464
- __metadata("design:paramtypes", [BalancasService,
465
- StompService,
466
- CookieService])
455
+ __metadata("design:paramtypes", [BalancasService])
467
456
  ], VisualizarBalancaComponent);
468
457
  return VisualizarBalancaComponent;
469
458
  }(VisualizarBalancaDescritor));