@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
@@ -3257,8 +3257,8 @@ var DocumentService = /** @class */ (function (_super) {
3257
3257
  DocumentService.prototype.getSystemIntegration = function () {
3258
3258
  return this.http.get('yms_int/wms/queries/getSystemIntegration');
3259
3259
  };
3260
- DocumentService.prototype.getPlanta = function (plantaId) {
3261
- return this.http.get('yms/patio/entities/planta/' + plantaId);
3260
+ DocumentService.prototype.getYard = function (yardId) {
3261
+ return this.http.get('yms/patio/entities/planta/' + yardId);
3262
3262
  };
3263
3263
  DocumentService = __decorate([
3264
3264
  Injectable(),
@@ -3312,13 +3312,14 @@ function getInvoiceConditions(translate) {
3312
3312
  }
3313
3313
 
3314
3314
  var DocumentGridComponent = /** @class */ (function () {
3315
- function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3315
+ function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils, wmsService) {
3316
3316
  this.translate = translate;
3317
3317
  this.documentService = documentService;
3318
3318
  this.confirmationService = confirmationService;
3319
3319
  this.integrationService = integrationService;
3320
3320
  this.agendaService = agendaService;
3321
3321
  this.utils = utils;
3322
+ this.wmsService = wmsService;
3322
3323
  this.viewDocument = new EventEmitter();
3323
3324
  this.gridData = [];
3324
3325
  this.enableButtonIsClienteExterno = true;
@@ -3336,9 +3337,45 @@ var DocumentGridComponent = /** @class */ (function () {
3336
3337
  }
3337
3338
  };
3338
3339
  DocumentGridComponent.prototype.ngOnInit = function () {
3340
+ var _this = this;
3339
3341
  this.verifyClienteExterno();
3340
3342
  this.getProcessTypeByScheduling();
3341
3343
  this.listDocuments(false);
3344
+ if (!this.wmsSystem) {
3345
+ this.wmsService.getSystemIntegration()
3346
+ .subscribe(function (_a) {
3347
+ var system = _a.system;
3348
+ _this.wmsSystem = system;
3349
+ if (_this.isWmsSeniorConnect()) {
3350
+ _this.getYard();
3351
+ _this.getSchedule();
3352
+ }
3353
+ });
3354
+ }
3355
+ };
3356
+ DocumentGridComponent.prototype.getYard = function () {
3357
+ var _this = this;
3358
+ this.documentService.getYard(this.agenda.planta.id)
3359
+ .pipe(catchError(function (err) {
3360
+ return throwError(err);
3361
+ }))
3362
+ .subscribe(function (content) {
3363
+ _this.yard = content;
3364
+ });
3365
+ };
3366
+ DocumentGridComponent.prototype.getSchedule = function () {
3367
+ var _this = this;
3368
+ if (this.agenda.externalTenant && this.agenda.externalTenant.cnpj) {
3369
+ this.schedule = this.agenda;
3370
+ return;
3371
+ }
3372
+ this.agendaService.get(this.agenda.id)
3373
+ .pipe(catchError(function (err) {
3374
+ return throwError(err);
3375
+ }))
3376
+ .subscribe(function (content) {
3377
+ _this.schedule = content;
3378
+ });
3342
3379
  };
3343
3380
  DocumentGridComponent.prototype.verifyClienteExterno = function () {
3344
3381
  var _this = this;
@@ -3478,7 +3515,7 @@ var DocumentGridComponent = /** @class */ (function () {
3478
3515
  accept: function () {
3479
3516
  _this.removeDocumentIfIdUndfined();
3480
3517
  if (_this.selection.length < 1) {
3481
- return empty();
3518
+ return null;
3482
3519
  }
3483
3520
  return forkJoin(_this.selection.map(function (document) { return _this.documentService.delete(document.id); }))
3484
3521
  .pipe(takeUntil(_this.ngUnsubscribe))
@@ -3600,6 +3637,30 @@ var DocumentGridComponent = /** @class */ (function () {
3600
3637
  DocumentGridComponent.prototype.sucessMessage = function () {
3601
3638
  return this.utils.message("success", this.summary, "saved_message_content");
3602
3639
  };
3640
+ DocumentGridComponent.prototype.validateDocument = function (document) {
3641
+ if (this.isWmsSeniorConnect()) {
3642
+ if (!this.yard.codigo) {
3643
+ this.buildMessage("yms.int.yard_code_not_found_warning_description");
3644
+ return false;
3645
+ }
3646
+ if (document.logistcUnitDocument !== this.yard.codigo) {
3647
+ this.buildMessage("yms.int.document_yard_mismatch_agenda_warning_description");
3648
+ return false;
3649
+ }
3650
+ if (!this.schedule.externalTenant) {
3651
+ this.buildMessage("yms.int.partner_not_informed_agenda_warning_description");
3652
+ return false;
3653
+ }
3654
+ if (document.partnerDocument !== this.schedule.externalTenant.cnpj) {
3655
+ this.buildMessage("yms.int.partner_differs_from_agenda_warning_description");
3656
+ return false;
3657
+ }
3658
+ }
3659
+ return true;
3660
+ };
3661
+ DocumentGridComponent.prototype.buildMessage = function (description) {
3662
+ this.utils.message("warn", "yms.int.documento_invalido_warning_header", description);
3663
+ };
3603
3664
  __decorate([
3604
3665
  Input(),
3605
3666
  __metadata("design:type", Object)
@@ -3655,7 +3716,8 @@ var DocumentGridComponent = /** @class */ (function () {
3655
3716
  ConfirmationService,
3656
3717
  IntegrationService,
3657
3718
  AgendaService,
3658
- UtilsMessageService])
3719
+ UtilsMessageService,
3720
+ FormWmsService])
3659
3721
  ], DocumentGridComponent);
3660
3722
  return DocumentGridComponent;
3661
3723
  }());
@@ -3703,11 +3765,10 @@ var Document = /** @class */ (function () {
3703
3765
  }());
3704
3766
 
3705
3767
  var RegisterDocumentComponent = /** @class */ (function () {
3706
- function RegisterDocumentComponent(fb, translate, utils, documentService) {
3768
+ function RegisterDocumentComponent(fb, translate, documentGridComponent) {
3707
3769
  this.fb = fb;
3708
3770
  this.translate = translate;
3709
- this.utils = utils;
3710
- this.documentService = documentService;
3771
+ this.documentGridComponent = documentGridComponent;
3711
3772
  this.document = new EventEmitter();
3712
3773
  this.visible = new EventEmitter();
3713
3774
  this.visibleChange = new EventEmitter();
@@ -3715,23 +3776,12 @@ var RegisterDocumentComponent = /** @class */ (function () {
3715
3776
  this.invoiceCondition = getInvoiceConditions(this.translate);
3716
3777
  }
3717
3778
  RegisterDocumentComponent.prototype.ngOnInit = function () {
3718
- this.getYard();
3719
3779
  this.getFormGroup();
3720
3780
  this.watchFormChanges();
3721
3781
  };
3722
3782
  RegisterDocumentComponent.prototype.ngOnChanges = function () {
3723
3783
  this.visibilityConfig();
3724
3784
  };
3725
- RegisterDocumentComponent.prototype.getYard = function () {
3726
- var _this = this;
3727
- this.documentService.getPlanta(this.agenda.planta.id)
3728
- .pipe(catchError(function (err) {
3729
- return throwError(err);
3730
- }))
3731
- .subscribe(function (content) {
3732
- _this.planta = content;
3733
- });
3734
- };
3735
3785
  RegisterDocumentComponent.prototype.visibilityConfig = function () {
3736
3786
  if (!this.edit && this.visible) {
3737
3787
  this.formGroup.disable();
@@ -3782,18 +3832,10 @@ var RegisterDocumentComponent = /** @class */ (function () {
3782
3832
  });
3783
3833
  };
3784
3834
  RegisterDocumentComponent.prototype.save = function () {
3785
- if (this.isWmsSeniorConnect()) {
3786
- if (!this.planta.codigo) {
3787
- this.utils.message("warn", "yms.int.yard_code_not_found_warning_header", "yms.int.yard_code_not_found_warning_description");
3788
- return;
3789
- }
3790
- var logistcUnitDocument = this.formGroup.get("logistcUnitDocument").value;
3791
- if (logistcUnitDocument !== this.planta.codigo) {
3792
- this.utils.message("warn", "yms.int.document_yard_mismatch_agenda_warning_header", "yms.int.document_yard_mismatch_agenda_warning_description");
3793
- return;
3794
- }
3795
- }
3796
3835
  this.document.emit(Document.fromDto(this.formGroup.getRawValue()));
3836
+ if (!this.documentGridComponent.validateDocument(document)) {
3837
+ return;
3838
+ }
3797
3839
  this.formGroup.reset();
3798
3840
  };
3799
3841
  RegisterDocumentComponent.prototype.isWmsWis = function () {
@@ -3851,8 +3893,7 @@ var RegisterDocumentComponent = /** @class */ (function () {
3851
3893
  }),
3852
3894
  __metadata("design:paramtypes", [FormBuilder,
3853
3895
  TranslateService,
3854
- UtilsMessageService,
3855
- DocumentService])
3896
+ DocumentGridComponent])
3856
3897
  ], RegisterDocumentComponent);
3857
3898
  return RegisterDocumentComponent;
3858
3899
  }());
@@ -3899,13 +3940,14 @@ var ExternalTenantService = /** @class */ (function (_super) {
3899
3940
  }(EntityService));
3900
3941
 
3901
3942
  var InsertKeyComponent = /** @class */ (function () {
3902
- function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService) {
3943
+ function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, documentGridComponent) {
3903
3944
  this.formBuilder = formBuilder;
3904
3945
  this.documentService = documentService;
3905
3946
  this.utils = utils;
3906
3947
  this.confirmationService = confirmationService;
3907
3948
  this.translate = translate;
3908
3949
  this.externalTenantService = externalTenantService;
3950
+ this.documentGridComponent = documentGridComponent;
3909
3951
  this.visible = new EventEmitter();
3910
3952
  this.document = new EventEmitter();
3911
3953
  this.visibleChange = new EventEmitter();
@@ -3915,7 +3957,6 @@ var InsertKeyComponent = /** @class */ (function () {
3915
3957
  }
3916
3958
  InsertKeyComponent.prototype.ngOnInit = function () {
3917
3959
  var _this = this;
3918
- this.getYard();
3919
3960
  this.formGroup = this.formBuilder.group({
3920
3961
  key: [undefined],
3921
3962
  purchaseOrder: [undefined],
@@ -3927,16 +3968,6 @@ var InsertKeyComponent = /** @class */ (function () {
3927
3968
  _this.validateKeyDetails(nf);
3928
3969
  });
3929
3970
  };
3930
- InsertKeyComponent.prototype.getYard = function () {
3931
- var _this = this;
3932
- this.documentService.getPlanta(this.agenda.planta.id)
3933
- .pipe(catchError(function (err) {
3934
- return throwError(err);
3935
- }))
3936
- .subscribe(function (content) {
3937
- _this.planta = content;
3938
- });
3939
- };
3940
3971
  InsertKeyComponent.prototype.isWmsWis = function () {
3941
3972
  return this.wmsSystem === WmsSystem.WIS;
3942
3973
  };
@@ -3980,15 +4011,8 @@ var InsertKeyComponent = /** @class */ (function () {
3980
4011
  return;
3981
4012
  }
3982
4013
  var document = content.contents[0];
3983
- if (_this.isWmsSeniorConnect()) {
3984
- if (!_this.planta.codigo) {
3985
- _this.utils.message("warn", "yms.int.yard_code_not_found_warning_header", "yms.int.yard_code_not_found_warning_description");
3986
- return;
3987
- }
3988
- if (document.logistcUnitDocument !== _this.planta.codigo) {
3989
- _this.utils.message("warn", "yms.int.document_yard_mismatch_agenda_warning_header", "yms.int.document_yard_mismatch_agenda_warning_description");
3990
- return;
3991
- }
4014
+ if (!_this.documentGridComponent.validateDocument(document)) {
4015
+ return;
3992
4016
  }
3993
4017
  document.invoiceKey = _this.formGroup.get('key').value;
3994
4018
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
@@ -4110,7 +4134,8 @@ var InsertKeyComponent = /** @class */ (function () {
4110
4134
  UtilsMessageService,
4111
4135
  ConfirmationService,
4112
4136
  TranslateService,
4113
- ExternalTenantService])
4137
+ ExternalTenantService,
4138
+ DocumentGridComponent])
4114
4139
  ], InsertKeyComponent);
4115
4140
  return InsertKeyComponent;
4116
4141
  }());