@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.
@@ -3486,6 +3486,50 @@ let ErpProcessService = class ErpProcessService {
3486
3486
  erpProcessData.fornecedores = this.listarIdsFornecedores(formGroup.getRawValue().fornecedores);
3487
3487
  return erpProcessData;
3488
3488
  }
3489
+ builderErpProcessDataValidaNotaNoContrato(erpProcessData, formGroup) {
3490
+ erpProcessData = this.builderErpProcessData(erpProcessData, formGroup);
3491
+ erpProcessData.recebimentoTemNota = this.verificaSeTemNotaNoContratoNoFornecedo(formGroup.getRawValue().fornecedores);
3492
+ return erpProcessData;
3493
+ }
3494
+ verificaSeTemNotaNoContratoNoFornecedo(fornecedores) {
3495
+ let contratosTemNota = false;
3496
+ let listaContratos = [];
3497
+ if (fornecedores != null) {
3498
+ fornecedores.filter(element => element.contratos != null && element.contratos != undefined).forEach(element => listaContratos.push(element.contratos));
3499
+ }
3500
+ let listaNotas = [];
3501
+ if (listaContratos != null) {
3502
+ listaContratos.filter(contratos => contratos != null && contratos != undefined).forEach(contratos => listaNotas.push(contratosTemNota = this.verificaSeContratosTemNota(contratos)));
3503
+ }
3504
+ return contratosTemNota;
3505
+ }
3506
+ verificaSeContratosTemNota(contratos) {
3507
+ let contratosTemNota = true;
3508
+ contratos.filter(contrato => contrato != null && contrato != undefined).forEach(contrato => contratosTemNota = contratosTemNota && (contrato.notas.length > 0));
3509
+ return contratosTemNota;
3510
+ }
3511
+ builderErpProcessDataValidaNotaNaOrdemCompra(erpProcessData, formGroup) {
3512
+ erpProcessData = this.builderErpProcessData(erpProcessData, formGroup);
3513
+ erpProcessData.recebimentoTemNota = this.verificaSeTemNotaNaOrdemCompraDoFornecedo(formGroup.getRawValue().fornecedores);
3514
+ return erpProcessData;
3515
+ }
3516
+ verificaSeTemNotaNaOrdemCompraDoFornecedo(fornecedores) {
3517
+ let ordemCompraTemNota = false;
3518
+ let listaOrdens = [];
3519
+ if (fornecedores != null) {
3520
+ fornecedores.filter(element => element.ordens != null && element.ordens != undefined).forEach(element => listaOrdens.push(element.ordens));
3521
+ }
3522
+ let listaNotas = [];
3523
+ if (listaOrdens != null) {
3524
+ listaOrdens.filter(ordens => ordens != null && ordens != undefined).forEach(ordens => listaNotas.push(ordemCompraTemNota = this.verificaSeOrdemCompraTemNota(ordens)));
3525
+ }
3526
+ return ordemCompraTemNota;
3527
+ }
3528
+ verificaSeOrdemCompraTemNota(contratos) {
3529
+ let ordemCompraTemNota = true;
3530
+ contratos.filter(ordem => ordem != null && ordem != undefined).forEach(ordem => ordemCompraTemNota = ordemCompraTemNota && (ordem.notas.length > 0));
3531
+ return ordemCompraTemNota;
3532
+ }
3489
3533
  getFieldFormGroup(formGroup, fieldName) {
3490
3534
  if (formGroup.get(fieldName) == null || formGroup.get(fieldName).value == null) {
3491
3535
  return null;
@@ -7817,7 +7861,7 @@ let RecebimentoOrdemCompraFormComponent = class RecebimentoOrdemCompraFormCompon
7817
7861
  if (this.isNew() || !this.enableRevalidation) {
7818
7862
  return this.saveAndInit(start);
7819
7863
  }
7820
- this.erpProcessData = this.erpProcessService.builderErpProcessData(this.erpProcessData, this.formGroup);
7864
+ this.erpProcessData = this.erpProcessService.builderErpProcessDataValidaNotaNaOrdemCompra(this.erpProcessData, this.formGroup);
7821
7865
  this.erpProcessService.changeDataErp(this.erpProcessData);
7822
7866
  return this.agendaService
7823
7867
  .checarRevalidacao(this.erpProcessData)
@@ -9334,7 +9378,7 @@ let RecebimentoFormComponent = class RecebimentoFormComponent {
9334
9378
  if (this.isNew() || !this.enableRevalidation) {
9335
9379
  return this.saveAndInit(start);
9336
9380
  }
9337
- this.erpProcessData = this.erpProcessService.builderErpProcessData(this.erpProcessData, this.formGroup);
9381
+ this.erpProcessData = this.erpProcessService.builderErpProcessDataValidaNotaNoContrato(this.erpProcessData, this.formGroup);
9338
9382
  this.erpProcessService.changeDataErp(this.erpProcessData);
9339
9383
  return this.agendaService
9340
9384
  .checarRevalidacao(this.erpProcessData)