@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
@@ -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(),
@@ -3357,6 +3357,7 @@
3357
3357
  InvoiceCondition["MANUAL_AUTHORIZED"] = "MANUAL_AUTHORIZED";
3358
3358
  InvoiceCondition["DEVOLUTION"] = "DEVOLUTION";
3359
3359
  InvoiceCondition["REJECTED"] = "REJECTED";
3360
+ InvoiceCondition["DIVERGENCE"] = "DIVERGENCE";
3360
3361
  })(InvoiceCondition || (InvoiceCondition = {}));
3361
3362
 
3362
3363
  function getInvoiceConditions(translate) {
@@ -3367,17 +3368,19 @@
3367
3368
  { label: translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
3368
3369
  { label: translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
3369
3370
  { label: translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
3371
+ { label: translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"), value: InvoiceCondition.DIVERGENCE },
3370
3372
  ];
3371
3373
  }
3372
3374
 
3373
3375
  var DocumentGridComponent = /** @class */ (function () {
3374
- function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils) {
3376
+ function DocumentGridComponent(translate, documentService, confirmationService, integrationService, agendaService, utils, wmsService) {
3375
3377
  this.translate = translate;
3376
3378
  this.documentService = documentService;
3377
3379
  this.confirmationService = confirmationService;
3378
3380
  this.integrationService = integrationService;
3379
3381
  this.agendaService = agendaService;
3380
3382
  this.utils = utils;
3383
+ this.wmsService = wmsService;
3381
3384
  this.viewDocument = new core.EventEmitter();
3382
3385
  this.gridData = [];
3383
3386
  this.enableButtonIsClienteExterno = true;
@@ -3395,9 +3398,43 @@
3395
3398
  }
3396
3399
  };
3397
3400
  DocumentGridComponent.prototype.ngOnInit = function () {
3401
+ var _this = this;
3398
3402
  this.verifyClienteExterno();
3399
3403
  this.getProcessTypeByScheduling();
3400
3404
  this.listDocuments(false);
3405
+ this.wmsService.getSystemIntegration()
3406
+ .subscribe(function (_a) {
3407
+ var system = _a.system;
3408
+ _this.wmsSystem = system;
3409
+ if (_this.isWmsSeniorConnect()) {
3410
+ _this.getYard();
3411
+ _this.getSchedule();
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,11 @@
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
- }
3894
+ var document = Document.fromDto(this.formGroup.getRawValue());
3895
+ if (!this.documentGridComponent.validateDocument(document)) {
3896
+ return;
3854
3897
  }
3855
- this.document.emit(Document.fromDto(this.formGroup.getRawValue()));
3898
+ this.document.emit(document);
3856
3899
  this.formGroup.reset();
3857
3900
  };
3858
3901
  RegisterDocumentComponent.prototype.isWmsWis = function () {
@@ -3910,8 +3953,7 @@
3910
3953
  }),
3911
3954
  __metadata("design:paramtypes", [forms.FormBuilder,
3912
3955
  core$1.TranslateService,
3913
- UtilsMessageService,
3914
- DocumentService])
3956
+ DocumentGridComponent])
3915
3957
  ], RegisterDocumentComponent);
3916
3958
  return RegisterDocumentComponent;
3917
3959
  }());
@@ -3958,13 +4000,14 @@
3958
4000
  }(EntityService));
3959
4001
 
3960
4002
  var InsertKeyComponent = /** @class */ (function () {
3961
- function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService) {
4003
+ function InsertKeyComponent(formBuilder, documentService, utils, confirmationService, translate, externalTenantService, documentGridComponent) {
3962
4004
  this.formBuilder = formBuilder;
3963
4005
  this.documentService = documentService;
3964
4006
  this.utils = utils;
3965
4007
  this.confirmationService = confirmationService;
3966
4008
  this.translate = translate;
3967
4009
  this.externalTenantService = externalTenantService;
4010
+ this.documentGridComponent = documentGridComponent;
3968
4011
  this.visible = new core.EventEmitter();
3969
4012
  this.document = new core.EventEmitter();
3970
4013
  this.visibleChange = new core.EventEmitter();
@@ -3974,7 +4017,6 @@
3974
4017
  }
3975
4018
  InsertKeyComponent.prototype.ngOnInit = function () {
3976
4019
  var _this = this;
3977
- this.getYard();
3978
4020
  this.formGroup = this.formBuilder.group({
3979
4021
  key: [undefined],
3980
4022
  purchaseOrder: [undefined],
@@ -3986,16 +4028,6 @@
3986
4028
  _this.validateKeyDetails(nf);
3987
4029
  });
3988
4030
  };
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
4031
  InsertKeyComponent.prototype.isWmsWis = function () {
4000
4032
  return this.wmsSystem === WmsSystem.WIS;
4001
4033
  };
@@ -4039,15 +4071,8 @@
4039
4071
  return;
4040
4072
  }
4041
4073
  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
- }
4074
+ if (!_this.documentGridComponent.validateDocument(document)) {
4075
+ return;
4051
4076
  }
4052
4077
  document.invoiceKey = _this.formGroup.get('key').value;
4053
4078
  document.invoiceCondition = InvoiceCondition.AUTHORIZED;
@@ -4169,7 +4194,8 @@
4169
4194
  UtilsMessageService,
4170
4195
  api.ConfirmationService,
4171
4196
  core$1.TranslateService,
4172
- ExternalTenantService])
4197
+ ExternalTenantService,
4198
+ DocumentGridComponent])
4173
4199
  ], InsertKeyComponent);
4174
4200
  return InsertKeyComponent;
4175
4201
  }());
@@ -4309,6 +4335,7 @@
4309
4335
  { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_partial_authorized"), value: InvoiceCondition.PARTIAL_AUTHORIZED },
4310
4336
  { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_devolution"), value: InvoiceCondition.DEVOLUTION },
4311
4337
  { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_rejected"), value: InvoiceCondition.REJECTED },
4338
+ { label: _this.translate.instant("yms.int.wms_grid_document_invoice_condition_divergence"), value: InvoiceCondition.DIVERGENCE },
4312
4339
  ];
4313
4340
  _this.isAuthorized = function (condition) { return (condition === InvoiceCondition.AUTHORIZED); };
4314
4341
  return _this;