@seniorsistemas/yms-integration 1.39.0 → 1.40.0-c5bb9262-143e-4c54-86ef-c7f4a8489d6b

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 (29) hide show
  1. package/bundles/seniorsistemas-yms-integration.umd.js +81 -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 +63 -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 +9 -31
  8. package/esm2015/src/wms/components/document-list/document-list.component.js +2 -1
  9. package/esm2015/src/wms/components/utils/invoice-conditions.js +2 -1
  10. package/esm2015/src/wms/entities/document/document.service.js +3 -3
  11. package/esm2015/src/wms/entities/invoice-condition/invoice-condition.js +2 -1
  12. package/esm5/src/wms/components/document-grid/document-grid.component.js +67 -6
  13. package/esm5/src/wms/components/document-grid/insert-key/insert-key.component.js +8 -23
  14. package/esm5/src/wms/components/document-grid/register-document/register-document.component.js +9 -32
  15. package/esm5/src/wms/components/document-list/document-list.component.js +2 -1
  16. package/esm5/src/wms/components/utils/invoice-conditions.js +2 -1
  17. package/esm5/src/wms/entities/document/document.service.js +3 -3
  18. package/esm5/src/wms/entities/invoice-condition/invoice-condition.js +2 -1
  19. package/fesm2015/seniorsistemas-yms-integration.js +77 -52
  20. package/fesm2015/seniorsistemas-yms-integration.js.map +1 -1
  21. package/fesm5/seniorsistemas-yms-integration.js +81 -54
  22. package/fesm5/seniorsistemas-yms-integration.js.map +1 -1
  23. package/package.json +1 -1
  24. package/seniorsistemas-yms-integration.metadata.json +1 -1
  25. package/src/wms/components/document-grid/document-grid.component.d.ts +9 -1
  26. package/src/wms/components/document-grid/insert-key/insert-key.component.d.ts +3 -3
  27. package/src/wms/components/document-grid/register-document/register-document.component.d.ts +3 -7
  28. package/src/wms/entities/document/document.service.d.ts +1 -1
  29. package/src/wms/entities/invoice-condition/invoice-condition.d.ts +2 -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(),
@@ -3298,6 +3298,7 @@ var InvoiceCondition;
3298
3298
  InvoiceCondition["MANUAL_AUTHORIZED"] = "MANUAL_AUTHORIZED";
3299
3299
  InvoiceCondition["DEVOLUTION"] = "DEVOLUTION";
3300
3300
  InvoiceCondition["REJECTED"] = "REJECTED";
3301
+ InvoiceCondition["DIVERGENCE"] = "DIVERGENCE";
3301
3302
  })(InvoiceCondition || (InvoiceCondition = {}));
3302
3303
 
3303
3304
  function getInvoiceConditions(translate) {
@@ -3308,17 +3309,19 @@ function getInvoiceConditions(translate) {
3308
3309
  { label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3309
3310
  { label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3310
3311
  { label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3312
+ { label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"), value: InvoiceCondition.DIVERGENCE },
3311
3313
  ];
3312
3314
  }
3313
3315
 
3314
3316
  var DocumentGridComponent = /** @class */ (function () {
3315
- function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3317
+ function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils, wmsService) {
3316
3318
  this.translate = translate;
3317
3319
  this.documentService = documentService;
3318
3320
  this.confirmationService = confirmationService;
3319
3321
  this.integrationService = integrationService;
3320
3322
  this.agendaService = agendaService;
3321
3323
  this.utils = utils;
3324
+ this.wmsService = wmsService;
3322
3325
  this.viewDocument = new EventEmitter();
3323
3326
  this.gridData = [];
3324
3327
  this.enableButtonIsClienteExterno = true;
@@ -3336,9 +3339,43 @@ var DocumentGridComponent = /** @class */ (function () {
3336
3339
  }
3337
3340
  };
3338
3341
  DocumentGridComponent.prototype.ngOnInit = function () {
3342
+ var _this = this;
3339
3343
  this.verifyClienteExterno();
3340
3344
  this.getProcessTypeByScheduling();
3341
3345
  this.listDocuments(false);
3346
+ this.wmsService.getSystemIntegration()
3347
+ .subscribe(function (_a) {
3348
+ var system = _a.system;
3349
+ _this.wmsSystem = system;
3350
+ if (_this.isWmsSeniorConnect()) {
3351
+ _this.getYard();
3352
+ _this.getSchedule();
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,11 @@ 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
- }
3835
+ var document = Document.fromDto(this.formGroup.getRawValue());
3836
+ if (!this.documentGridComponent.validateDocument(document)) {
3837
+ return;
3795
3838
  }
3796
- this.document.emit(Document.fromDto(this.formGroup.getRawValue()));
3839
+ this.document.emit(document);
3797
3840
  this.formGroup.reset();
3798
3841
  };
3799
3842
  RegisterDocumentComponent.prototype.isWmsWis = function () {
@@ -3851,8 +3894,7 @@ var RegisterDocumentComponent = /** @class */ (function () {
3851
3894
  }),
3852
3895
  __metadata("design:paramtypes", [FormBuilder,
3853
3896
  TranslateService,
3854
- UtilsMessageService,
3855
- DocumentService])
3897
+ DocumentGridComponent])
3856
3898
  ], RegisterDocumentComponent);
3857
3899
  return RegisterDocumentComponent;
3858
3900
  }());
@@ -3899,13 +3941,14 @@ var ExternalTenantService = /** @class */ (function (_super) {
3899
3941
  }(EntityService));
3900
3942
 
3901
3943
  var InsertKeyComponent = /** @class */ (function () {
3902
- function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService) {
3944
+ function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, documentGridComponent) {
3903
3945
  this.formBuilder = formBuilder;
3904
3946
  this.documentService = documentService;
3905
3947
  this.utils = utils;
3906
3948
  this.confirmationService = confirmationService;
3907
3949
  this.translate = translate;
3908
3950
  this.externalTenantService = externalTenantService;
3951
+ this.documentGridComponent = documentGridComponent;
3909
3952
  this.visible = new EventEmitter();
3910
3953
  this.document = new EventEmitter();
3911
3954
  this.visibleChange = new EventEmitter();
@@ -3915,7 +3958,6 @@ var InsertKeyComponent = /** @class */ (function () {
3915
3958
  }
3916
3959
  InsertKeyComponent.prototype.ngOnInit = function () {
3917
3960
  var _this = this;
3918
- this.getYard();
3919
3961
  this.formGroup = this.formBuilder.group({
3920
3962
  key: [undefined],
3921
3963
  purchaseOrder: [undefined],
@@ -3927,16 +3969,6 @@ var InsertKeyComponent = /** @class */ (function () {
3927
3969
  _this.validateKeyDetails(nf);
3928
3970
  });
3929
3971
  };
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
3972
  InsertKeyComponent.prototype.isWmsWis = function () {
3941
3973
  return this.wmsSystem === WmsSystem.WIS;
3942
3974
  };
@@ -3980,15 +4012,8 @@ var InsertKeyComponent = /** @class */ (function () {
3980
4012
  return;
3981
4013
  }
3982
4014
  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
- }
4015
+ if (!_this.documentGridComponent.validateDocument(document)) {
4016
+ return;
3992
4017
  }
3993
4018
  document.invoiceKey = _this.formGroup.get('key').value;
3994
4019
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
@@ -4110,7 +4135,8 @@ var InsertKeyComponent = /** @class */ (function () {
4110
4135
  UtilsMessageService,
4111
4136
  ConfirmationService,
4112
4137
  TranslateService,
4113
- ExternalTenantService])
4138
+ ExternalTenantService,
4139
+ DocumentGridComponent])
4114
4140
  ], InsertKeyComponent);
4115
4141
  return InsertKeyComponent;
4116
4142
  }());
@@ -4250,6 +4276,7 @@ var DocumentListComponent = /** @class */ (function (_super) {
4250
4276
  { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
4251
4277
  { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
4252
4278
  { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
4279
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"), value: InvoiceCondition.DIVERGENCE },
4253
4280
  ];
4254
4281
  _this.isAuthorized = function (condition) { return (condition === InvoiceCondition.AUTHORIZED); };
4255
4282
  return _this;