@seniorsistemas/yms-integration 1.9.0 → 2.0.0

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.
@@ -3773,6 +3773,52 @@
3773
3773
  erpProcessData.fornecedores = this.listarIdsFornecedores(formGroup.getRawValue().fornecedores);
3774
3774
  return erpProcessData;
3775
3775
  };
3776
+ ErpProcessService.prototype.builderErpProcessDataValidaNotaNoContrato = function (erpProcessData, formGroup) {
3777
+ erpProcessData = this.builderErpProcessData(erpProcessData, formGroup);
3778
+ erpProcessData.recebimentoTemNota = this.verificaSeTemNotaNoContratoNoFornecedo(formGroup.getRawValue().fornecedores);
3779
+ return erpProcessData;
3780
+ };
3781
+ ErpProcessService.prototype.verificaSeTemNotaNoContratoNoFornecedo = function (fornecedores) {
3782
+ var _this = this;
3783
+ var contratosTemNota = false;
3784
+ var listaContratos = [];
3785
+ if (fornecedores != null) {
3786
+ fornecedores.filter(function (element) { return element.contratos != null && element.contratos != undefined; }).forEach(function (element) { return listaContratos.push(element.contratos); });
3787
+ }
3788
+ var listaNotas = [];
3789
+ if (listaContratos != null) {
3790
+ listaContratos.filter(function (contratos) { return contratos != null && contratos != undefined; }).forEach(function (contratos) { return listaNotas.push(contratosTemNota = _this.verificaSeContratosTemNota(contratos)); });
3791
+ }
3792
+ return contratosTemNota;
3793
+ };
3794
+ ErpProcessService.prototype.verificaSeContratosTemNota = function (contratos) {
3795
+ var contratosTemNota = true;
3796
+ contratos.filter(function (contrato) { return contrato != null && contrato != undefined; }).forEach(function (contrato) { return contratosTemNota = contratosTemNota && (contrato.notas.length > 0); });
3797
+ return contratosTemNota;
3798
+ };
3799
+ ErpProcessService.prototype.builderErpProcessDataValidaNotaNaOrdemCompra = function (erpProcessData, formGroup) {
3800
+ erpProcessData = this.builderErpProcessData(erpProcessData, formGroup);
3801
+ erpProcessData.recebimentoTemNota = this.verificaSeTemNotaNaOrdemCompraDoFornecedo(formGroup.getRawValue().fornecedores);
3802
+ return erpProcessData;
3803
+ };
3804
+ ErpProcessService.prototype.verificaSeTemNotaNaOrdemCompraDoFornecedo = function (fornecedores) {
3805
+ var _this = this;
3806
+ var ordemCompraTemNota = false;
3807
+ var listaOrdens = [];
3808
+ if (fornecedores != null) {
3809
+ fornecedores.filter(function (element) { return element.ordens != null && element.ordens != undefined; }).forEach(function (element) { return listaOrdens.push(element.ordens); });
3810
+ }
3811
+ var listaNotas = [];
3812
+ if (listaOrdens != null) {
3813
+ listaOrdens.filter(function (ordens) { return ordens != null && ordens != undefined; }).forEach(function (ordens) { return listaNotas.push(ordemCompraTemNota = _this.verificaSeOrdemCompraTemNota(ordens)); });
3814
+ }
3815
+ return ordemCompraTemNota;
3816
+ };
3817
+ ErpProcessService.prototype.verificaSeOrdemCompraTemNota = function (contratos) {
3818
+ var ordemCompraTemNota = true;
3819
+ contratos.filter(function (ordem) { return ordem != null && ordem != undefined; }).forEach(function (ordem) { return ordemCompraTemNota = ordemCompraTemNota && (ordem.notas.length > 0); });
3820
+ return ordemCompraTemNota;
3821
+ };
3776
3822
  ErpProcessService.prototype.getFieldFormGroup = function (formGroup, fieldName) {
3777
3823
  if (formGroup.get(fieldName) == null || formGroup.get(fieldName).value == null) {
3778
3824
  return null;
@@ -8373,7 +8419,7 @@
8373
8419
  if (this.isNew() || !this.enableRevalidation) {
8374
8420
  return this.saveAndInit(start);
8375
8421
  }
8376
- this.erpProcessData = this.erpProcessService.builderErpProcessData(this.erpProcessData, this.formGroup);
8422
+ this.erpProcessData = this.erpProcessService.builderErpProcessDataValidaNotaNaOrdemCompra(this.erpProcessData, this.formGroup);
8377
8423
  this.erpProcessService.changeDataErp(this.erpProcessData);
8378
8424
  return this.agendaService
8379
8425
  .checarRevalidacao(this.erpProcessData)
@@ -9887,7 +9933,7 @@
9887
9933
  if (this.isNew() || !this.enableRevalidation) {
9888
9934
  return this.saveAndInit(start);
9889
9935
  }
9890
- this.erpProcessData = this.erpProcessService.builderErpProcessData(this.erpProcessData, this.formGroup);
9936
+ this.erpProcessData = this.erpProcessService.builderErpProcessDataValidaNotaNoContrato(this.erpProcessData, this.formGroup);
9891
9937
  this.erpProcessService.changeDataErp(this.erpProcessData);
9892
9938
  return this.agendaService
9893
9939
  .checarRevalidacao(this.erpProcessData)