@seniorsistemas/yms-integration 1.18.4 → 1.19.1

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.
Files changed (22) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +44 -24
  2. package/bundles/seniorsistemas-yms-integration.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-yms-integration.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-yms-integration.umd.min.js.map +1 -1
  5. package/esm2015/src/devices/balancas/balancas.service.js +4 -1
  6. package/esm2015/src/devices/balancas/visualiar-balanca/visualizar-balanca.component.js +8 -25
  7. package/esm2015/src/devices/balancas/weightScale.js +1 -1
  8. package/esm2015/src/sam-senior/components/visitor-edit/visitor-edit-list/visitor-edit-list.component.js +32 -1
  9. package/esm5/src/devices/balancas/balancas.service.js +4 -1
  10. package/esm5/src/devices/balancas/visualiar-balanca/visualizar-balanca.component.js +8 -25
  11. package/esm5/src/devices/balancas/weightScale.js +1 -1
  12. package/esm5/src/sam-senior/components/visitor-edit/visitor-edit-list/visitor-edit-list.component.js +32 -1
  13. package/fesm2015/seniorsistemas-yms-integration.js +42 -22
  14. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  15. package/fesm5/seniorsistemas-yms-integration.js +42 -22
  16. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  17. package/package.json +1 -1
  18. package/seniorsistemas-yms-integration.metadata.json +1 -1
  19. package/src/devices/balancas/balancas.service.d.ts +1 -0
  20. package/src/devices/balancas/visualiar-balanca/visualizar-balanca.component.d.ts +2 -11
  21. package/src/devices/balancas/weightScale.d.ts +2 -2
  22. package/src/sam-senior/components/visitor-edit/visitor-edit-list/visitor-edit-list.component.d.ts +1 -0
@@ -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));
@@ -1900,6 +1889,16 @@ var VisitanteComponent = /** @class */ (function () {
1900
1889
  driver: true
1901
1890
  });
1902
1891
  }
1892
+ if (this.visitors.length > 0) {
1893
+ this.visitors[0].visitor = {
1894
+ name: mot.nome,
1895
+ document: mot.cpf,
1896
+ contact: this.getContatoMotorista(mot),
1897
+ visitorSituation: VisitorSituation.CHECK_IN_PENDING,
1898
+ documentType: this.getDocumentType(),
1899
+ driver: true
1900
+ };
1901
+ }
1903
1902
  };
1904
1903
  VisitanteComponent.prototype.adicionaVisitantesGrid = function () {
1905
1904
  var _this = this;
@@ -1992,6 +1991,14 @@ var VisitanteComponent = /** @class */ (function () {
1992
1991
  if (visitor.document === visitante.document) {
1993
1992
  visitor.contact = visitante.contact;
1994
1993
  visitor.name = visitante.name;
1994
+ var novoVisitante_1 = _this.buildVisitorCredentialsDto(visitor);
1995
+ _this.visitors.forEach(function (result) {
1996
+ if (result.visitor.document === novoVisitante_1.visitor.document) {
1997
+ result.visitor.name = novoVisitante_1.visitor.name;
1998
+ result.visitor.contact = novoVisitante_1.visitor.contact;
1999
+ }
2000
+ });
2001
+ _this.visitorsChange.emit(_this.visitors);
1995
2002
  _this.visitorFound = true;
1996
2003
  }
1997
2004
  });
@@ -2019,6 +2026,19 @@ var VisitanteComponent = /** @class */ (function () {
2019
2026
  this.visitorsChange.emit(this.visitors);
2020
2027
  this.hasChange.emit(true);
2021
2028
  };
2029
+ VisitanteComponent.prototype.buildVisitorCredentialsDto = function (visitor) {
2030
+ var visitorCredentialsDto = new VisitorCredentialsDto();
2031
+ var visitante = {
2032
+ name: visitor.name,
2033
+ document: visitor.document,
2034
+ contact: visitor.contact,
2035
+ documentType: visitor.documentType,
2036
+ visitorSituation: visitor.visitorSituation,
2037
+ driver: false
2038
+ };
2039
+ visitorCredentialsDto.visitor = visitante;
2040
+ return visitorCredentialsDto;
2041
+ };
2022
2042
  VisitanteComponent.prototype.model = function (visitante) {
2023
2043
  var _this = this;
2024
2044
  var isDriver = visitante.document === this.motorista.cpf;