@seniorsistemas/yms-integration 1.38.0-84525130-8955-4de4-9dbd-cbae08fb1cda → 1.39.0-b18a63fd-cce0-4144-98f4-dfcd1d6f5b8d

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 +79 -54
  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/wms/components/document-grid/document-grid.component.js +65 -6
  6. package/esm2015/src/wms/components/document-grid/insert-key/insert-key.component.js +8 -22
  7. package/esm2015/src/wms/components/document-grid/register-document/register-document.component.js +8 -31
  8. package/esm2015/src/wms/entities/document/document.service.js +3 -3
  9. package/esm5/src/wms/components/document-grid/document-grid.component.js +69 -6
  10. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +8 -23
  11. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +8 -32
  12. package/esm5/src/wms/entities/document/document.service.js +3 -3
  13. package/fesm2015/seniorsistemas-yms-integration.js +75 -52
  14. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  15. package/fesm5/seniorsistemas-yms-integration.js +79 -54
  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/wms/components/document-grid/document-grid.component.d.ts +9 -1
  20. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +3 -3
  21. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +3 -7
  22. package/src/wms/entities/document/document.service.d.ts +1 -1
@@ -3316,8 +3316,8 @@
3316
3316
  DocumentService.prototype.getSystemIntegration = function () {
3317
3317
  return this.http.get('yms_int/wms/queries/getSystemIntegration');
3318
3318
  };
3319
- DocumentService.prototype.getPlanta = function (plantaId) {
3320
- return this.http.get('yms/patio/entities/planta/' + plantaId);
3319
+ DocumentService.prototype.getYard = function (yardId) {
3320
+ return this.http.get('yms/patio/entities/planta/' + yardId);
3321
3321
  };
3322
3322
  DocumentService = __decorate([
3323
3323
  core.Injectable(),
@@ -3371,13 +3371,14 @@
3371
3371
  }
3372
3372
 
3373
3373
  var DocumentGridComponent = /** @class */ (function () {
3374
- function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3374
+ function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils, wmsService) {
3375
3375
  this.translate = translate;
3376
3376
  this.documentService = documentService;
3377
3377
  this.confirmationService = confirmationService;
3378
3378
  this.integrationService = integrationService;
3379
3379
  this.agendaService = agendaService;
3380
3380
  this.utils = utils;
3381
+ this.wmsService = wmsService;
3381
3382
  this.viewDocument = new core.EventEmitter();
3382
3383
  this.gridData = [];
3383
3384
  this.enableButtonIsClienteExterno = true;
@@ -3395,9 +3396,45 @@
3395
3396
  }
3396
3397
  };
3397
3398
  DocumentGridComponent.prototype.ngOnInit = function () {
3399
+ var _this = this;
3398
3400
  this.verifyClienteExterno();
3399
3401
  this.getProcessTypeByScheduling();
3400
3402
  this.listDocuments(false);
3403
+ if (!this.wmsSystem) {
3404
+ this.wmsService.getSystemIntegration()
3405
+ .subscribe(function (_a) {
3406
+ var system = _a.system;
3407
+ _this.wmsSystem = system;
3408
+ if (_this.isWmsSeniorConnect()) {
3409
+ _this.getYard();
3410
+ _this.getSchedule();
3411
+ }
3412
+ });
3413
+ }
3414
+ };
3415
+ DocumentGridComponent.prototype.getYard = function () {
3416
+ var _this = this;
3417
+ this.documentService.getYard(this.agenda.planta.id)
3418
+ .pipe(operators.catchError(function (err) {
3419
+ return rxjs.throwError(err);
3420
+ }))
3421
+ .subscribe(function (content) {
3422
+ _this.yard = content;
3423
+ });
3424
+ };
3425
+ DocumentGridComponent.prototype.getSchedule = function () {
3426
+ var _this = this;
3427
+ if (this.agenda.externalTenant && this.agenda.externalTenant.cnpj) {
3428
+ this.schedule = this.agenda;
3429
+ return;
3430
+ }
3431
+ this.agendaService.get(this.agenda.id)
3432
+ .pipe(operators.catchError(function (err) {
3433
+ return rxjs.throwError(err);
3434
+ }))
3435
+ .subscribe(function (content) {
3436
+ _this.schedule = content;
3437
+ });
3401
3438
  };
3402
3439
  DocumentGridComponent.prototype.verifyClienteExterno = function () {
3403
3440
  var _this = this;
@@ -3537,7 +3574,7 @@
3537
3574
  accept: function () {
3538
3575
  _this.removeDocumentIfIdUndfined();
3539
3576
  if (_this.selection.length < 1) {
3540
- return rxjs.empty();
3577
+ return null;
3541
3578
  }
3542
3579
  return rxjs.forkJoin(_this.selection.map(function (document) { return _this.documentService.delete(document.id); }))
3543
3580
  .pipe(operators.takeUntil(_this.ngUnsubscribe))
@@ -3659,6 +3696,30 @@
3659
3696
  DocumentGridComponent.prototype.sucessMessage = function () {
3660
3697
  return this.utils.message("success", this.summary, "saved_message_content");
3661
3698
  };
3699
+ DocumentGridComponent.prototype.validateDocument = function (document) {
3700
+ if (this.isWmsSeniorConnect()) {
3701
+ if (!this.yard.codigo) {
3702
+ this.buildMessage("yms.int.yard_code_not_found_warning_description");
3703
+ return false;
3704
+ }
3705
+ if (document.logistcUnitDocument !== this.yard.codigo) {
3706
+ this.buildMessage("yms.int.document_yard_mismatch_agenda_warning_description");
3707
+ return false;
3708
+ }
3709
+ if (!this.schedule.externalTenant) {
3710
+ this.buildMessage("yms.int.partner_not_informed_agenda_warning_description");
3711
+ return false;
3712
+ }
3713
+ if (document.partnerDocument !== this.schedule.externalTenant.cnpj) {
3714
+ this.buildMessage("yms.int.partner_differs_from_agenda_warning_description");
3715
+ return false;
3716
+ }
3717
+ }
3718
+ return true;
3719
+ };
3720
+ DocumentGridComponent.prototype.buildMessage = function (description) {
3721
+ this.utils.message("warn", "yms.int.documento_invalido_warning_header", description);
3722
+ };
3662
3723
  __decorate([
3663
3724
  core.Input(),
3664
3725
  __metadata("design:type", Object)
@@ -3714,7 +3775,8 @@
3714
3775
  api.ConfirmationService,
3715
3776
  IntegrationService,
3716
3777
  AgendaService,
3717
- UtilsMessageService])
3778
+ UtilsMessageService,
3779
+ FormWmsService])
3718
3780
  ], DocumentGridComponent);
3719
3781
  return DocumentGridComponent;
3720
3782
  }());
@@ -3762,11 +3824,10 @@
3762
3824
  }());
3763
3825
 
3764
3826
  var RegisterDocumentComponent = /** @class */ (function () {
3765
- function RegisterDocumentComponent(fb, translate, utils, documentService) {
3827
+ function RegisterDocumentComponent(fb, translate, documentGridComponent) {
3766
3828
  this.fb = fb;
3767
3829
  this.translate = translate;
3768
- this.utils = utils;
3769
- this.documentService = documentService;
3830
+ this.documentGridComponent = documentGridComponent;
3770
3831
  this.document = new core.EventEmitter();
3771
3832
  this.visible = new core.EventEmitter();
3772
3833
  this.visibleChange = new core.EventEmitter();
@@ -3774,23 +3835,12 @@
3774
3835
  this.invoiceCondition = getInvoiceConditions(this.translate);
3775
3836
  }
3776
3837
  RegisterDocumentComponent.prototype.ngOnInit = function () {
3777
- this.getYard();
3778
3838
  this.getFormGroup();
3779
3839
  this.watchFormChanges();
3780
3840
  };
3781
3841
  RegisterDocumentComponent.prototype.ngOnChanges = function () {
3782
3842
  this.visibilityConfig();
3783
3843
  };
3784
- RegisterDocumentComponent.prototype.getYard = function () {
3785
- var _this = this;
3786
- this.documentService.getPlanta(this.agenda.planta.id)
3787
- .pipe(operators.catchError(function (err) {
3788
- return rxjs.throwError(err);
3789
- }))
3790
- .subscribe(function (content) {
3791
- _this.planta = content;
3792
- });
3793
- };
3794
3844
  RegisterDocumentComponent.prototype.visibilityConfig = function () {
3795
3845
  if (!this.edit && this.visible) {
3796
3846
  this.formGroup.disable();
@@ -3841,18 +3891,10 @@
3841
3891
  });
3842
3892
  };
3843
3893
  RegisterDocumentComponent.prototype.save = function () {
3844
- if (this.isWmsSeniorConnect()) {
3845
- if (!this.planta.codigo) {
3846
- this.utils.message("warn", "yms.int.yard_code_not_found_warning_header", "yms.int.yard_code_not_found_warning_description");
3847
- return;
3848
- }
3849
- var logistcUnitDocument = this.formGroup.get("logistcUnitDocument").value;
3850
- if (logistcUnitDocument !== this.planta.codigo) {
3851
- this.utils.message("warn", "yms.int.document_yard_mismatch_agenda_warning_header", "yms.int.document_yard_mismatch_agenda_warning_description");
3852
- return;
3853
- }
3854
- }
3855
3894
  this.document.emit(Document.fromDto(this.formGroup.getRawValue()));
3895
+ if (!this.documentGridComponent.validateDocument(document)) {
3896
+ return;
3897
+ }
3856
3898
  this.formGroup.reset();
3857
3899
  };
3858
3900
  RegisterDocumentComponent.prototype.isWmsWis = function () {
@@ -3910,8 +3952,7 @@
3910
3952
  }),
3911
3953
  __metadata("design:paramtypes", [forms.FormBuilder,
3912
3954
  core$1.TranslateService,
3913
- UtilsMessageService,
3914
- DocumentService])
3955
+ DocumentGridComponent])
3915
3956
  ], RegisterDocumentComponent);
3916
3957
  return RegisterDocumentComponent;
3917
3958
  }());
@@ -3958,13 +3999,14 @@
3958
3999
  }(EntityService));
3959
4000
 
3960
4001
  var InsertKeyComponent = /** @class */ (function () {
3961
- function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService) {
4002
+ function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, documentGridComponent) {
3962
4003
  this.formBuilder = formBuilder;
3963
4004
  this.documentService = documentService;
3964
4005
  this.utils = utils;
3965
4006
  this.confirmationService = confirmationService;
3966
4007
  this.translate = translate;
3967
4008
  this.externalTenantService = externalTenantService;
4009
+ this.documentGridComponent = documentGridComponent;
3968
4010
  this.visible = new core.EventEmitter();
3969
4011
  this.document = new core.EventEmitter();
3970
4012
  this.visibleChange = new core.EventEmitter();
@@ -3974,7 +4016,6 @@
3974
4016
  }
3975
4017
  InsertKeyComponent.prototype.ngOnInit = function () {
3976
4018
  var _this = this;
3977
- this.getYard();
3978
4019
  this.formGroup = this.formBuilder.group({
3979
4020
  key: [undefined],
3980
4021
  purchaseOrder: [undefined],
@@ -3986,16 +4027,6 @@
3986
4027
  _this.validateKeyDetails(nf);
3987
4028
  });
3988
4029
  };
3989
- InsertKeyComponent.prototype.getYard = function () {
3990
- var _this = this;
3991
- this.documentService.getPlanta(this.agenda.planta.id)
3992
- .pipe(operators.catchError(function (err) {
3993
- return rxjs.throwError(err);
3994
- }))
3995
- .subscribe(function (content) {
3996
- _this.planta = content;
3997
- });
3998
- };
3999
4030
  InsertKeyComponent.prototype.isWmsWis = function () {
4000
4031
  return this.wmsSystem === WmsSystem.WIS;
4001
4032
  };
@@ -4039,15 +4070,8 @@
4039
4070
  return;
4040
4071
  }
4041
4072
  var document = content.contents[0];
4042
- if (_this.isWmsSeniorConnect()) {
4043
- if (!_this.planta.codigo) {
4044
- _this.utils.message("warn", "yms.int.yard_code_not_found_warning_header", "yms.int.yard_code_not_found_warning_description");
4045
- return;
4046
- }
4047
- if (document.logistcUnitDocument !== _this.planta.codigo) {
4048
- _this.utils.message("warn", "yms.int.document_yard_mismatch_agenda_warning_header", "yms.int.document_yard_mismatch_agenda_warning_description");
4049
- return;
4050
- }
4073
+ if (!_this.documentGridComponent.validateDocument(document)) {
4074
+ return;
4051
4075
  }
4052
4076
  document.invoiceKey = _this.formGroup.get('key').value;
4053
4077
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
@@ -4169,7 +4193,8 @@
4169
4193
  UtilsMessageService,
4170
4194
  api.ConfirmationService,
4171
4195
  core$1.TranslateService,
4172
- ExternalTenantService])
4196
+ ExternalTenantService,
4197
+ DocumentGridComponent])
4173
4198
  ], InsertKeyComponent);
4174
4199
  return InsertKeyComponent;
4175
4200
  }());