{"version":3,"sources":["main.js","config/cache.js","config/Constants.js","config/database.js","config/en-US.js","config/EntitiesMetadata.js","config/http.js","config/pt-BR.js","config/rotas.js","config/SincronizaAbastecimentos.js","config/SincronizacaoEncerrantes.js","config/TransitionConfig.js","config/translation.js","controller/AbastecimentoController.js","controller/AbastecimentoTanqueController.js","controller/AlteraDataHoraController.js","controller/AnomaliaController.js","controller/ApuracaoRecFisicoController.js","controller/AssociacaoRecebimentoController.js","controller/BarcodeController.js","controller/BlocoMedidorController.js","controller/CadTurnoController.js","controller/CaminhaoCompartimentoController.js","controller/CaminhaoTanqueController.js","controller/CargaMassaController.js","controller/CentroCustoController.js","controller/ComplexoController.js","controller/ConfigController.js","controller/ContingenciaController.js","controller/ContratoController.js","controller/DetalheRecebimentoController.js","controller/DetalheRecFisicoController.js","controller/DiretoriaController.js","controller/DivergenciaController.js","controller/ElementoPepController.js","controller/EmpresaClassificacaoController.js","controller/EmpresaController.js","controller/EquipamentoComplexoController.js","controller/EquipamentoController.js","controller/EquipamentoMarcaController.js","controller/EquipamentoModeloController.js","controller/EquipamentoTanqueController.js","controller/EquipamentoTipoController.js","controller/EquipamentoTipoGriController.js","controller/EstornoController.js","controller/FooterController.js","controller/GerenciaController.js","controller/HomeController.js","controller/importCargaEmMassaController.js","controller/ImportsController.js","controller/ImportsRegistroController.js","controller/integracaoTibcoController.js","controller/MensagensController.js","controller/ModalEnvioCargaController.js","controller/ModalFiltrosAssociacaoController.js","controller/ModalImportController.js","controller/ModalImportStreamController.js","controller/ModalJustificativaReaberturaController.js","controller/ModalTurnoValidadoController.js","controller/MotoristaController.js","controller/NavbarController.js","controller/NavioCompartimentoController.js","controller/NavioTanqueController.js","controller/NivelAnomaliaController.js","controller/OrdemEstatisticaController.js","controller/PainelDeEstoqueController.js","controller/PerfilModalController.js","controller/PerfisController.js","controller/PostoController.js","controller/RecebimentoFiscalController.js","controller/RecebimentoFisicoController.js","controller/RecebimentosController.js","controller/RecuperacaoCombustivelController.js","controller/RegAnomaliaController.js","controller/RegImportacaoController.js","controller/RegTurnoBlocoController.js","controller/RegTurnoController.js","controller/RegTurnoTanqueController.js","controller/SaidaPortariaController.js","controller/SelAbastecimentosController.js","controller/SelComplexoSolicitanteController.js","controller/SelecaoRecebimentoFisicoController..js","controller/SelTipoRecFisicoController.js","controller/SelTurnoController.js","controller/TipoFiscalController.js","controller/TransferenciaController - Copia.js","controller/TransferenciaController.js","controller/UnidadeController.js","controller/UsuariosController.js","controller/ValidacaoController.js","controller/ValidacaoDetalheController.js","controller/VisualizadorImagemController.js","directives/cargaStatusFilter.js","directives/dontColapseOnDesktopDirective.js","directives/filterSearch.js","directives/focusOnDirective.js","directives/IhmDblClickDirective.js","directives/IndividualFilterSearch.js","directives/maxCharacters.js","directives/onlyDigitsDirective.js","directives/onlyIntegers.js","directives/uppercase.js","model/AbastecimentoModel.js","model/AspectoVisualModel.js","model/AssociacaoRecebimentoModel.js","model/BlocoMedidorModel.js","model/CadEquipamentoModel.js","model/CadTurnoModel.js","model/CaminhaoTanqueModel.js","model/CargaMassaModel.js","model/CavaloMecanicoModel.js","model/CentroCustoModel.js","model/CentroLucroModel.js","model/ComplexoModel.js","model/ContingenciaModel.js","model/ContratoModel.js","model/CtrEncerranteModel.js","model/CtrHorHodModel.js","model/DiretoriaModel.js","model/ElementoPepModel.js","model/EmpresaClassificacaoModel.js","model/EmpresaModel.js","model/EntidadeModels.js","model/EquipamentoMarcaModel.js","model/EquipamentoModel.js","model/EquipamentoModeloModel.js","model/EquipamentoTipoGriModel.js","model/EquipamentoTipoModel.js","model/GeneralModel.js","model/GerenciaModel.js","model/HstEquipamentoModel.js","model/MessageModel.js","model/MotoristaModel.js","model/NavioTanqueModel.js","model/NivelAnomaliaModel.js","model/OrdemEstatisticaModel.js","model/PainelDeEstoqueModel.js","model/ParamsModel.js","model/PerfilModel.js","model/PostoModel.js","model/ProdutoModel.js","model/RecebimentoFiscalModel.js","model/RecebimentoFisicoModel.js","model/RecuperacaoCombustivelModel.js","model/RegAbastecimentoTanqueModel.js","model/RegAnomaliaModel.js","model/RegEstornoModel.js","model/TanquePostoModel.js","model/TipoFiscalModel.js","model/TranferenciaModel.js","model/TransacaoModel.js","model/TransacaoPerfilModel.js","model/TreeViewModel.js","model/TurnoModel.js","model/UnidadeModel.js","model/UsuarioModel.js","model/VagaoTanqueModel.js","model/ValidacaoModel.js","services/$httpLegacy.js","services/AlertExceptionService.js","services/applyLenghtRule.js","services/BarCodeService.js","services/ConvertDate.js","services/DanfeService.js","services/DivergenciaService.js","services/ExportCSV.js","services/ExportOperationCsv.js","services/FileReaderService.js","services/FocusService.js","services/GeneralService.js","services/getValueInPath.js","services/IsOnLineService.js","services/MenusService.js","services/MessageService.js","services/ModalService.js","services/PrivilegesService.js","services/RegAnomaliaService.js","services/RequestService.js","services/SelTurnoService.js","services/SpinnerService.js","services/SyncService.js","services/TransitionService.js","services/TranslateService.js","services/UsuarioService.js","services/ValidacaoService.js","model/polyfills/arrayFrom.js","model/polyfills/every.js","model/polyfills/filter.js","model/polyfills/find.js","model/polyfills/includes.js","model/polyfills/map.js","model/polyfills/reduce.js","model/polyfills/some.js","services/exports/ImportService.js","services/validation/CheckAbastecimento.js","services/validation/CheckAssociacaoRecebimento.js","services/validation/CheckContingencia.js","services/validation/CheckEquipamento.js","services/validation/CheckEstorno.js","services/validation/CheckPainelEstoque.js","services/validation/CheckRecebimentoFiscal.js","services/validation/CheckRecebimentoFisico.js","services/validation/CheckService.js","services/validation/CheckTransferencia.js","services/validation/CheckTurno.js"],"names":["dependencias","angular","module","run","$rootScope","version","config","$qProvider","errorOnUnhandledRejections","cacheHandler","$interval","TransitionService","Constant","handleUpdate","checkUpdate","intervalPromise","window","applicationCache","addEventListener","update","cancel","updateReady","TIME_TO_CHECK_UPDATE","$inject","constant","SERVER_WAITING_TIME","SERVER_WAITING_TIME_TO_SAVE","TIME_BEFORE_GO_TO_SERVER","TIME_TO_SYNC_ENCERRANTES","TIME_TO_SYNC_ABASTECIMENTOS","PING_TIMEOUT","SESSION_TIME","EDICAO","NOVO","INDICADORES_BINARIOS","S","N","INDICADORES_ATIVO","CLASSIFICACOES_EMPRESA","OPERACIONAL","CONSTRUCAO_CIVIL","FORNECEDOR","LOCACAO","MANUTENCAO_MECANICA","TRANSPORTADORA","PRESTACAO_DE_SERVIÇOS","SAUDE","LOGISTICA","QUIMICA","CONSULTORIA","UNIDADES_ALTURA","MM","M","TIPOS_RECEBIMENTO","C","V","T","FONTES_PAGADORAS","E","O","R","OPERACOES","A","CABECALHOREFERENCIAL","ABASTECIMENTO","TRANSFERENCIA","RECEBIMENTOFISICO_CAMINHAOTANQUE","RECEBIMENTOFISICO_NAVIOTANQUE","RECEBIMENTOFISICO_VAGAOTANQUE","RECEBIMENTOFISICO_TANQUETANQUE","Configuration","ngDexieProvider","setOptions","name","debug","setConfiguration","db","stores","CAD_EQUIPAMENTO","CTR_HOR_HOD","CTR_ENCERRANTE","CAD_BLOCO_MEDIDOR","REG_ABASTECIMENTO","REG_GRUPO_ANOMALIA","TranslateServiceProvider","resources","enUSJson","value","validacao","validacaoEquipamento","serverUrl","entityUrl","entityId","historyId","hasValidationFlow","shouldGetFullHistory","displayColumns","compareColumns","property","key","validacaoAbastecimento","validacaoTurno","validacaoAfericaoBloco","validacaoPosto","validacaoUsuario","validacaoTransferencia","validacaoRecebimentoFisico","validacaoRecebimentoFiscal","configHTTP","$httpProvider","defaults","headers","common","navigator","language","transformResponse","push","data","headerGetter","type","redirect","location","href","indexOf","convertDate","objeto","prop","Object","test","Date","ptBRJson","$stateProvider","$locationProvider","$urlRouterProvider","otherwise","state","url","templateUrl","privilege","controller","controllerAs","menu","tabela","icon","$timeout","AbastecimentoModel","SelTurnoService","sincronizaAbastecimentos","onLine","turno","IdcRegTurno","populaBanco","then","catch","erro","console","log","CtrEncerranteModel","sincronizaEncerrantes","$transitions","$state","ModalService","MessageService","PrivilegesService","TranslateService","hasPermission","includes","onBefore","trans","current","$to","self","hash","rotasAlteradas","prompt","clearCurrent","onFinish","reload","AbastecimentoController","BlocoMedidorModel","GeneralModel","focus","RegAnomaliaService","CtrHorHodModel","$filter","$q","UsuarioService","CadEquipamentoModel","CheckAbastecimento","RegEstornoModel","InicializaVariaveis","abastecimento","listaAbastecimento","selected","regTanqueSelected","filtro","isTelaConsuta","changeTimeout","msgValidaTag","tagPlacaValida","Anomalias","status","blocosMedidores","isEmAvaliacao","abastecimentoEstornado","onChangeTurno","regTurno","getAbastecimentos","setValido","listAbastecimentoTanque","length","forEach","tanque","valido","salvarServidor","formAbastecimento","resolve","reject","ValHorHod","NomDispositivo","dataFinalOriginal","DthFinal","getNowTurno","refresh","message","alert","tanqueIndexToremove","index","ValEncerranteAbastecimento","ValEncerrante","IdcBlocoMedidor","i","splice","SglPosto","VolumeTotal","VolAbastecimento","abastecimentoAux","verificaAbastecimentoEncavalado","resposta","verificaAbastecimentoExistente","dataFormatada","DthInicial","CodTagPlacaEqp","confirm","salvaAbastecimento","isFechado","success","error","undefined","isProdutoEquipamentoCompativel","getByIdcPosto","IdcPosto","blocos","listBlocosInvalidos","blocoProximoVenc","proximoAVenc","listInvalidos","msgReturn","produtoValido","indexBloco","bloco","ChkBloqueioCertificadoVencido","IsBlocoInvalido","DthVencCertificado","IsBlocoAVencer","indexTanque","indexProduto","listProdutoTanque","IdcProduto","StuBlocoMedidor","SglBlocoMedidor","join","ChkContingencia","Error","atualizaAbastecimentoSelected","tagPlaca","online","DthVencimentoContrato","resValidation","msgTagWarning","getNowTurnoMaisUmMinuto","duracao","retornaTempoAbastecimento","HodHorValido","MaxHor","UltimoHorHod","dateDiffInDays","DthCtrHorHod","NomeOperador","nome","DthAbastecimentoTanque","changeHorimetro","preencheAbastecimento","regAbastecimento","retorno","ChkHorimetro","ChkResetAutomaticoHorHod","ContratoVencido","DscGerenciaGa","DthCriacaoReg","IdcAbastecimento","IdcCentroCusto","CodCentroCusto","IdcContrato","IdcElementoPep","CodElementoPep","IdcEmpresa","IdcEquipamento","IdcGri","IdcOrdemEstatistica","CodOrdemEstatistica","IdcTipoFiscal","IdcTransferencia","IdcUsuario","IsLocomotiva","IsWaitingApprovalChange","ListTanques","NomEmpresa","NumDigitos","PendenteAvaliacao","PossuiHorHod","SglGerenciaGa","SglTurno","StatusSalvamento","StuAbastecimento","TanquesLiberadosParaAbastecimento","TipoEquipamento","preencheAbastecimentoTanque","regAbastecimentoTanque","ChkAbastecimentoTanque","ChkResetAutomaticoBlocoMedidor","ChkResetAutomaticoEncerrante","DenAbastecimento","DscClasseProduto","DscProduto","DscTanqueEquipamento","DscTipoProduto","EncerranteValido","IdcAbastecimentoTanque","IdcCargaMassa","IdcRateio","IdcTanqueEquipamento","IdcUsuMan","RegPorEncerrante","RegEstornado","SglProduto","StuEnvioSap","TmpAbastecimento","UeFator","ValCapacidadeNominal","ValConsumoEsp","VolAbastecimento20c","VolAtual","idDataGrid","listAnomalia","preencheRelProduto","relProduto","DscClasse","DscTipo","a","b","Math","floor","abs","this","modalTanque","turnoFechado","canSelect","diff","hours","minutes","seconds","isNaN","idcRegTurno","getAllByIdcRegTurno","DthInicialSearch","DthFinalSearch","abastClick","checkTurnoFechado","editar","tanqueClick","regTanque","form","$invalid","$submitted","editarTanque","keys","IdcEstorno","ChkCompensaEstorno","some","item","setCurrent","open","atualizar","selectTurno","novo","salvar","cancelar","resetForm","newChangeTime","obj","changePlaca","validaTagPlaca","LoadEstorno","idcEquipamento","dateTime","getLastHorimetro","ValHorHodAtual","registrarAnomalia","id","anomalia","getEquipamentos","placa","searchParams","getAll","listaEstorno","hasHorHod","toUpperCase","isBlocked","AbastecimentoTanqueController","$uibModalInstance","getBlocos","abTanque","mantemBloco","DataFinal","patternEncerrante","getPatternEncerrante","formato","getFormatoEncerrante","previousAbTanque","JSON","parse","stringify","finalizaEdicaoTanque","formAbTanque","$valid","close","restorePreviousEditableValues","ok","changeBloco","changeEncerrante","tipo","idcBlocoMedidor","valorEncerrante","dataInicial","valVolume","numDigitos","NumCasasDecimais","calculaVolume","volume","encerrante","reset","getVolume20C","pIdcProduto","pValTemperatura","pValDensidade","pValVolume","Number","AlteraDataHoraController","dataHora","alteraDataHora","popUpDataHora","dismiss","AnomaliaController","goHome","go","finally","ApuracaoRecFisicoController","apuracao","recebimento","ValidacaoService","calculaVolume20","apuracaoRecFisico","CadTanquePosto","idProdutoApuracao","MedidaTemperaturaMediaInicial","MedidaTemperaturaMediaFinal","MedidaDensidadeInicial","MedidaDensidadeFinal","QuantidadeProdutoInicial","QuantidadeProdutoFinal","setAltura","UnidadeAlturaRegua","CadTanquePostoUnidadeAlturaRegua","fator","MedidaAlturaInicial","AlturaInicialProxy","MedidaAlturaFinal","AlturaFinalProxy","previousApuracaoRecFisicoApuracao","MedidaTemperaturaSuperficieInicial","MedidaTemperaturaSuperficieFinal","MedidaTemperaturaMeioInicial","MedidaTemperaturaMeioFinal","MedidaTemperaturaFundoInicial","MedidaTemperaturaFundoFinal","mostrarTemperaturasInicial","IndicadorTipoRecebimento","mostrarTemperaturasFinal","getVolumeByAltura","pAltRegua","pIdcTanquePosto","IdcTanquePosto","IdentificadorTanquePostoAbastecimento","getVolumeByAltRegua","changeVolume20C","ignoraRecalculo","changeTempMediaInicial","changeTempMediaFinal","media","changeTempInicial","round","changeTempFinal","AssociacaoRecebimentoController","AssociacaoRecebimentoModel","RecebimentoFisicoModel","RecebimentoFiscalModel","CheckAssociacaoRecebimento","$scope","getAssociacoes","associacaoRecebimento","listaAssociacao","DataHoraUTCCriacaoSearch","DataHoraUTCCriacao","getFisicos","IdcGrupo","initDate","endDate","getAllByIdcProduto","ListRecebimentoFisicoProduto","DataHoraUTCInicioRecebimentoFisicoSearch","DataHoraUTCInicioRecebimentoFisico","quant","getQuantidadeRecebimento","getFiscais","ListRecebimentoFiscalProduto","DataHoraUTCInicioRecebimentoFiscalSearch","DataHoraUTCInicioRecebimentoFiscal","insertOrRemove","list","indexOfItem","formatLitros","number","toFixed","formartPercentual","Infinity","getTotalFiscal","associacao","reduce","sum","fiscal","QuantidadeProdutoNotaFiscal","getTotalFisico","fisico","getEstoqueInicial","getEstoque","getEstoqueFinal","ListApuracaoRecebimentoProdutoTanquePosto","sum2","resetTela","criaNovaAssociacao","IdentificadorGrupoRecebimentoFisicoFiscal","IdentificadorUsuarioCriacao","indice","DataHoraUTCUltimaAtualizacao","IdentificadorUsuarioUltimaAtualizacao","IdentificadorDiretoria","IdentificadorProduto","IndicadorSituacao","CodigoGrupoRecebimento","QuantidadeProdutoTotalNotasFiscais","QuantidadeProdutoTotalRecebida","QuantidadeProdutoDivergencia","DataHoraUTCFechamento","IdentificadorUsuarioResponsavelFechamento","CadProduto","CadUsuarioCriacao","CadUsuarioUltimaAtualizacao","CadUsuarioFechamento","regRecebimentoFisico","ListDetalheRecebimentoProduto","QuantidadeRecebida","modalFiltros","date","before","setMonth","getMonth","setHours","beforeFisico","dateFisico","beforeFiscal","dateFiscal","filtroFiscal","filtroFisico","initDateFiscal","endDateFiscal","initDateFisico","endDateFisico","DataHoraUTCInitDateFiscal","DataHoraUTCEndDateFiscal","DataHoraUTCInitDateFisico","DataHoraUTCEndDateFisico","comparatorFiscal","input","search_param","CodigoDANFENotaFiscal","String","equals","comparatorFisico","propKey","isInludedFisico","isInludedFiscal","associacaoRecebimentoClick","getById","associaoCompleta","filtrarComDataFiscal","filtrarComDataFisico","produto","recFiscalClick","recFisicoClick","getFechamento","totalFiscal","totalFisico","estoqueInicial","estoqueFinal","divergencia","initial-storage-amount","final-storage-amount","distributed-amount","invoice-total","physical-total","divergence","divergence-percentual","storage-divergence","fechar","BarcodeController","barcode","isClosed","tracks","ratio","blackWhite","stop","inicializar","treatStream","stream","getTracks","video","srcObject","onloadedmetadata","e","play","canvas","width","videoWidth","height","document","querySelector","context","getContext","createElement","detector","BarcodeDetector","videoConstraints","facingMode","ideal","getUserMedia","requestAnimationFrame","draw","drawImage","videoHeight","imageData","getImageData","r","g","avg","bw","putImageData","readBarCode","detect","rawValue","BlocoMedidorController","ComplexoModel","DiretoriaModel","UnidadeModel","PostoModel","getBlocoMedidor","cadBlocoMedidor","listaBlocoMedidor","getDiretorias","listaDiretorias","listaComplexo","listaUnidades","listaPosto","listaStatus","CadPosto","CadUnidade","IdcUnidade","CadComplexo","SglComplexo","CadDiretoria","SglDiretoria","IdcDiretoria","changeComplexos","getComplexos","getBySgl","changeUnidades","getUnidades","getAllSameComplexo","changePostos","getPostos","getAllSameUnidade","blocoClick","formcadBlocoMedidor","save","excluir","CadTurnoController","CadTurnoModel","getTurno","cadTurno","listaTurno","click","formcadTurno","ListCadCaminhaoCompartimento","IdcTurno","CaminhaoCompartimentoController","regCompartimento","caCompartimento","IdcCaminhaoCompartimento","formcaCompartimento","CaminhaoTanqueController","CaminhaoTanqueModel","getCaminhaoTanque","cadCaminhaoTanque","listaCaminhao","modalCompartimento","popupDataInicial","opened","regCompartimentoSelected","compartimentoClick","editarCompartimento","adicionarCompartimento","IdcCaminhaoTanque","formcadCaminhaoTanque","excluirCompleto","openDataInicial","$event","stopPropagation","CargaMassaController","CargaMassaModel","AlertExceptionService","SpinnerService","getAbatCSV","abast","formatDateToDDMMYYYY","hour","formatTimeToHHMM","cargaMassa","getStatus","CodPlanta","CodDeposito","CodMterial","CodTagPlaca","getDate","padStart","getFullYear","getHours","getMinutes","getCargaMassa","sppiner","spin","getByPeriod","dthInicial","dthFinal","diretoria","movimentacao","listacargaMassa","listacargaMassaOriginal","applyFilter","idcCargaMassa","listaAbastecimentos","filter","carga","filtered","complexo","IdcComplexo","posto","unidade","classe","IdcClasse","IdcTipo","resetSearch","cnpj","resetSearch2","getNewAbast","getListNewAbast","newListNewAbast","idcs","listaAbastecimentosSelected","map","listSelect","getProduto","listaClasse","isTelaNew","listaDiretoria","listaUnidade","listaCnpj","listaProduto","listaProdutoTipo","searchTermSglDiretoria","currentStatus","New","searchTermSglPosto","modalEnvio","6","0","3","-1","11","10","7","statusList","downloadCSV","getElementById","querySelectorAll","csv","linhaCSV","header","csvString","link","escape","download","DscCargaMassa","body","appendChild","removeChild","translate","prototype","addDays","days","valueOf","setDate","processaManual","processaManualmente","err","Message","cancelarAgendamento","cancela","clickAbast","find","clickAbastNew","IdentificadorTransferenciaProduto","checkAll","abast2","unCheckAll","getLocais","ListCadComplexo","ChangeComplexo","getCnpjs","ChangeComplexoNew","ChangeClasse","ListCadProdutoTipo","ChangeTipo","ListCadProduto","ChangeClasseNew","ChangeTipoNew","onChangeFiltrosCargas","onChangeFiltrosCargasNew","ChangeProduto","ChangeProdutoNew","s","ChangeDiretoria","ChangeUnidade","ListCadPosto","ChangePosto","ChangeCnpj","ListCadUnidade","u","CodCnpj","ChangeDiretoriaNew","change","saveNew","DthCargaMassa","payload","ListRegAbastecimentoTanque","ListTransferenciaProduto","ctr","getTotalAbast","getTotalAbastSelected","delete","deleteCarga","getTotalVolume","replace","getTotalVolumeSelected","getTotalAbastCarga","getTotalAbastSelectedCarga","getTotalVolumeCarga","getTotalVolumeSelectedCarga","enviar","IdcAbast","Agendado","tipoEnvio","DthAgendado","dthEnvio","ListCtrEnvioErp","send","ChangeTipoMovimentacao","voltar","dataCompleta","ano","mes","slice","dia","horas","minutos","items","seen","Set","has","add","ElementoPepController","CentroCustoModel","GerenciaModel","getCentroCusto","cadCentroCusto","listacadCentroCusto","getGerencia","listaGerencia","listaCentroCusto","formcadCentroCusto","ComplexoController","cadComplexo","listacadComplexo","listDiretorias","listStatus","formcadComplexo","ConfigController","$http","get","response","ContingenciaController","ContingenciaModel","CheckContingencia","InicializaVariaveis2","contingencia","original","editClick","getDateNowWithoutTime","setMinutes","setSeconds","setMilliseconds","rejectf","isTelaBusca","diretoriaSelected","complexoSelected","unidadeSelected","PostoSelected","dataFinal","popupDataFinal","spinner","sort","DscDiretoria","Tag","filters","getAllByFilters","getVolumeTotal","somatorio","elemento","cancelarList","changeDiretoria","openDataFinal","changeComplexo","changeUnidade","SglUnidade","DscComplexo","DscUnidade","DscPosto","ContratoController","ContratoModel","cadContrato","formcadContrato","DetalheRecebimentoController","locals","detalheRecebimento","codigoRecebimento","List","DetalheRecFisicoController","detalhe","AspectoVisualModel","getBloco","detalheRecFisico","getNumDigitos","retorePreviousEditableValues","previousDetalheRecFisico","MedidaDensidadeProduto","MedidaTemperaturaProduto","MedidaDensidadeBoletim","MedidaTemperaturaMassa","IdentificadorAspectoVisual","IndicadorPresencaAgua","aspectosVisuais","indicadorBinario","CtrEncerrante","ValEncerranteAtual","QuantidadeComplementoProduto","dataEncerrante","DataHoraUTCComplemento","IdentificadorCompartimentoCaminhaoTanque","ChkResetAutomatico","DthCtrEncerrante","calcula20g","IdentificadorProdutoPosto","QuantidadeRecebida20GrausCelsius","getByIdcPostoAndId","DiretoriaController","cadDiretoria","listacadDiretoria","formcadDiretoria","DivergenciaController","confirmOperation","distribuido","divergenciaPercentual","divergenciaTancagem","confirmar","ElementoPepModel","getElementos","cadElementoPep","listaElemento","formcadElementoPep","EmpresaClassificacaoController","EmpresaClassificacaoModel","getEmpresaClassificacao","cadEmpresaClassificacao","listaEmpresaClassificacao","regCompartimentoselected","classificacaoClick","formcadEmpresaClassificacao","IdcClassificacao","EmpresaController","EmpresaModel","getEmpresa","cadEmpresa","listaEmpresa","empresaClick","formcadEmpresa","EquipamentoComplexoController","$mdDialog","$element","variaveisComplexos","regComplexo","OrdemEstatisticaModel","CentroLucroModel","idcEmpresa","searchTermIdcEmpresa","RestartVarsForCopy","eqComplexo","IdcEquipamentoComplexo","isCopy","getContrato","getByIdEmpresa","listaContrato","getCentroLucroByCentroCusto","idcCentroCusto","getByIdCentroCusto","CadCentroLucro","IdcCentroLucro","CentroLucroConcat","CodCentroLucro","SglCentroLucro","getCentroLucroByOrdemEstatistica","idcOrdemEstatistica","getByIdOrdemEstatistica","getCentroLucroByElementoPep","idcElementoPep","getByIdElementoPep","showPopUpMessage","title","template","preserveScope","multiple","hasBackdrop","zIndex","mdDialog","hide","parent","element","show","cleanSearchTerm","fieldName","on","ev","modalVisualizadorImagem","complexos","DthVencimento","listaElementoPep","listaOrdemEstatistica","tipoFonte","atribuirSlgComplexo","complexoMessage","ContratoChange","contrato","CadContrato","CodContrato","atribuirCodFontePagadora","fontePagadora","TipoFonte","IdcFonte","CodFontePagadora","SglGerencia","IdcGerencia","IdcCentroCfusto","limparCodFontePagadora","gerencia","FonteChange","comboChange","fontePagadoraMessage","gerenciaMessage","getContratos","chkInativoClick","ChkInativo","complexExist","copy","formEqComplexo","IdcComplexoSolicitante","ImagemContrato","mesmoComplexos","new","assign","inicializarImagem","reader","FileReader","onload","result","readAsDataURL","files","visualizarImagem","imagem","image","excluirImagem","CadImagemContrato","ImgImagem","EquipamentoController","EquipamentoModel","EquipamentoModeloModel","EquipamentoMarcaModel","TipoFiscalModel","EquipamentoTipoModel","EquipamentoTipoGriModel","HstEquipamentoModel","CheckEquipamento","RegAbastecimentoTanqueModel","getEquipamento","cadEquipamento","listaEquipamento","getEquipamentoMarca","listaMarca","getTipoFiscal","listaTipoFiscal","getTipo","listaTipo","getTipoGri","listaGri","executaAcaoPerfilCadastrar","funcaoSePossuiPermissao","openModalComplexoSolicitante","modalComplexoSolicitante","entry","ListCadComplexoPrivilege","modalEquipamento","complexoAdded","listaModelo","tanqueEquipamentoSelected","imagemContrato","tanqueInativo","equipamentoExistente","edicao","complexoEquipamentoSelected","privilegesComplexos","ListaContratos","limitStep","limit","stopSpinning","complexPrivileges","clickedComplex","toString","equipamentoClick","equipamentoClickWaiting","AnoFabricacao","parseInt","getEquipamentoModelo","CadModelo","CadMarca","IdcMarca","getAbastecimentoTanque","montarObjetoComplexo","ListRelEquipamentoComplexo","ImagemDut","CadImagemDut","vencido","datatual","equipamentostu","StuEquipamento","equipamentortn","CadCentroCusto","CadElementoPep","CadOrdemEstatistica","CadGerencia","FormatStatus","AbastecimentoTanque","ListCadTanqueEquipamento","TanqueAbastecido","j","filteredModelo","itemModelo","IdcModelo","modeloMessage","tanqueEquipamento","adicionarTanque","ListRelTanqueEquipamentoProduto","IdentificadorChange","IdentificadorTagplaca","CodTag","CodPlaca","changeTag","tag","chkContigenciaClick","equipamentoTanque","tanques","formcadEquipamento","salvarWaiting","getExistente","StuTanqueEquipamento","CodSolicitacaoAceite","IdcUsuarioSolicitante","CadEquipamentoTipo","CadTipoFiscal","CadGri","ListHstTanqueEquipamento","ListHstRelEquipamentoComplexo","ObsEquipamento","ListHstRelTanqueEquipamentoProduto","salvarHistorico","start","ListHstEquipamento","CodRespostaAceite","loadMore","last","inview","getMaxYear","onkeypress","fromCharCode","which","adicionarComplexo","editarComplexo","IncluidoAlterado","listaContratos","complexoClick","complexoEquipamento","originalComplexo","FormatFontePagadora","excluirComplexo","entityPrivilege","split","jQuery","event","special","touchstart","setup","_","ns","handle","passive","touchmove","wheel","EquipamentoMarcaController","cadEquipamentoMarca","marcaClick","formcadEquipamentoMarca","EquipamentoModeloController","cadEquipamentoModelo","modeloClick","formcadEquipamentoModelo","EquipamentoTanqueController","ProdutoModel","equipamentoTanqueCTRL","isSelected","semTanque","validaDescricao","produtoClick","textChange","formequipamentoTanqueCTRL","CadTanqueEquipamento","EquipamentoTipoController","cadEquipamentoTipo","listaEquipamentoTipo","tipoClick","formcadEquipamentoTipo","EquipamentoTipoGriController","cadEquipamentoTipoGri","listaEquipamentoTipoGri","formcadEquipamentoTipoGri","EstornoController","CheckEstorno","estorno","selectedByShift","canGetGrid","canChangeLocalidade","isTelaConsulta","getComplexo","getUnidade","getPosto","getProdutos","getAllByIdcPosto","atualizaLocalidadeTurno","changePosto","today","lastMonth","DthInicio","DthFim","EnviadoSap","getStatusSap","stuEnvioSap","abastecimentoEstorno","buscar","formFiltroEstorno","formEstorno","FooterController","footer","GerenciaController","cadGerencia","formcadGerencia","HomeController","MenusService","listMenu","ImportCargaEmMassaController","ExportCsv","EntidadeModels","ImportService","FileReaderService","operacaoDados","importCargaEmMassa","showErrosInExcelDateTime","rowlist","Retorno","operacaoName","rowsInErros","resetFileField","imputFile","Files","classList","requireFileInput","AllDivs","$","divCinco","setNameOfOperation","resultOperation","namesTemplates","param","values","formValidadoImportacao","validado","operacaoSelected","convertToObjectArray","fileContents","convertToObject","content","templateIsValid","line","incomingHeader","replaceAll","referencialHeader","fileContent","lines","trim","objArray","temp","arrTime","reverse","arr","createListObjectOperation","object","createToAbastecimento","createToTransfencia","createToRecebimentoFisicoCaminhaoTanque","createToRecebimentoFisicoNavioTanque","createToRecebimentoFisicoVagaoTanque","createToRecebimentoFisicoTanqueTanque","removeEmptyRow","position","toRemove","keyOut","qtdAttObj","qtdAttVista","keyIn","isNoblanckFilds","oper","validateEmptyField","invalid","coluna","NoblanckFildsItem","showInvalidsFields","messagesError","validateDataTimeInRowLine","time","concatDataHora","row","dateString","toDateString","options","minute","hour12","toLocaleString","match","AMPM","sHours","sMinutes","currentDate","hasOwnProperty","call","objectsSelecteds","detalhesAbastecimento","DthInicialRowExecel","AbastecimentoRowExcel","codigo_usuario","tag_placa","data_inicial","data_final","horimetro","observacao","abastecimentoTanque","AbastecimentoTanqueRowExcel","sigla_tanque","codigo_material","bloco_medidor","volume_atual","IdentificadorAberturaFechamentoTurnoPostoOrigem","IdentificadorUsuarioResponsavelPostoOrigem","DataHoraUTCInicioRetiradaOrigem","DataHoraUTCFimRetiradaOrigem","IdentificadorEncerranteBlocoMedidorOrigem","NomeSistemaOrigemDadoPostoOrigem","IdentificadorProdutoPostoDestino","IdentificadorAberturaFechamentoTurnoPostoDestino","IdentificadorUsuarioResponsavelPostoDestino","DataHoraUTCInicioRecebimentoDestino","DataHoraUTCFimRecebimentoDestino","NumeroIdentificacaoLacres","QuantidadeLacres","CodigoHexadecimalCorLacres","QuantidadeTransferida","QuantidadeTransferida20GrausCelsius","NomeSistemaOrigemDadoPostoDestino","IndicadorUtilizacaoSkidPostoDestino","IdentificadorCargaMassaMovimentacao","IdentificadorEmpresaTransportadora","IdentificadorCaminhaoTanque","IdentificadorNavioTanque","IdentificadorCavaloMecanico","IdentificadorMotoristaCavaloCaminhaoTanque","IndicadorConcordanciaMotorista","CadCaminhaoTanque","CadCavaloMecanico","CadEmpresa","CadMotorista","CadUsuarioResponsavelPostoOrigem","CadUsuarioResponsavelPostoDestino","IdcCtrEncerrante","IdcTblOperacao","TblOperacao","RegTurnoOrigem","RegTurnoDestino","TransferenciaRowExcel","Bloco_Medidor","Codigo_Usuário","Posto_de_Destino","Data_Inicial","Data_Final","Encerrante","Volume","Observacoes","RecebimentoProdutoRow","Produto","MotoristaConcorda","RecebimentocomSkid","CavaloMecanico","CaminhoTanque","NumerodoCompartimento","VolumeRecebido","Densidade","Temperatura","DensidadeBoletim","TemperaturaMassa","AspectoVisual","PresencadeAgua","SiglaTanque","AlturaInicialMM","AlturaFinalMM","QuantidadeInicial","QuantidadeFinal","QuantidadeInicial20C","QuantidadeFinal20C","DensidadeInicial","DensidadeFinal","TemperaturaMediaInicial","TemperaturaSuperficieInicial","TemperaturaMeioInicial","TemperaturaFundoInicial","TemperaturaMediaFinal","TemperaturaSuperficieFinal","TemperaturaMeioFinal","TemperaturaFundoFinal","NavioTanque","VagaoTanque","modalHistorico","isImportacao","isBaixarTemplate","isValidInputFile","disableRecebimentoFisico","dis","RC","RN","RV","RT","getServicesToExport","operacaoExport","chave","exportTemplate","getServicesToImport","operacaoImport","alldados","operacao","import","importDirect","operacaoChange","tpOperacaoSelected","operacaoTipoChange","pop","fileChange","target","baixarTemplate","importaRegistros","preparar","inicializacao","all","Array","from","readAsText","teste","getHistorico","selectedValue","selectedOperation","disableHistorico","historico","operacoes","tpOperacoes","formToValidate","formImportCargaEmMassa","ImportsController","imports","cadastros","table","export","importAll","exportAll","ImportsRegistroController","exportStream","importStream","importAllStream","exportAllStream","exportIdMap","integracaoTibcoController","getFilas","params","action","integracaoTibco","filas","getMessages","fila","Status","changeFila","editMessage","msgObj","RequestMsg","put","MensagensController","ModalEnvioCargaController","envioCarga","envio","changeTipoEnvio","TipoEnvio","operation","ModalFiltrosAssociacaoController","modalFiltrosAssociacao","produtos","getIdcPosto","ModalImportController","modalImport","ModalImportStreamController","ModalJustificativaReaberturaController","justificativa","justificativaReaberturaTurno","MsgAtencao","ModalTurnoValidadoController","TurnoModel","TanquePostoModel","getComplete","turnoCompleto","modalTurnoValidado","showTela","fechamento","listaFechamento","formatFechamento","getByIdPosto","ListaRegTurnoTanquePostoDQO","tanqueDQO","AltInicial","AltFinal","setFirstAndLastEncerrantes","ListaRegTurnoBlocoMedidorDQO","getFirstAndLast","firstCounter","first","lastCounter","lista","StuTurno","setValidoLista","TurnoSel","showFechamento","MotoristaController","MotoristaModel","getMotoristas","cadMotorista","listacadMotorista","datepickerOpened","formcadMotorista","IdcMotorista","NavbarController","nav","usuario","listMenus","logout","sessionStorage","setItem","NavioCompartimentoController","IdcNavioCompartimento","NavioTanqueController","NavioTanqueModel","getNavioTanque","cadNavioTanque","listaNavio","IdcNavioTanque","ListCadNavioCompartimento","formcadNavioTanque","NivelAnomaliaController","NivelAnomaliaModel","getNivelAnomalia","cadNivelAnomalia","listaNivel","formcadNivelAnomalia","IdcNivel","OrdemEstatisticaController","getOrdemEstatistica","cadOrdemEstatistica","formcadOrdemEstatistica","PainelDeEstoqueController","PainelDeEstoqueModel","CheckPainelEstoque","resetFields","painelDeEstoque","ProdutoSelected","DthAtual","formpainelDeEstoque","criaNovoInput","IdcInputPainelEstoque","VolumeAtual","currentVolume","VolumeSobreRodas","currentVolumeWheels","VolumeEmTransito","currentvolumeTraffic","ConsumoPorDia","dailyIntake","DthMedicao","TipPosto","StuPosto","StuUnidade","StuComplexo","StuDiretoria","changeProduto","getLitragens","dados","salvaInputPainelEstoque","PerfilModalController","perfil","perfilModal","PerfisController","PerfilModel","TransacaoModel","getPerfis","perfis","ListaPerfis","getTransacoes","ListTransacaoPerfil","filtroTransacoes","selectedTransacao","selectedTransacaoPerfil","p","IdentificadorPerfil","perfilArray","clickTransacoes","t","clickTransacoesPerfil","tp","adicionar","scope","IdentificadorTransacao","Transacao","remover","getAvailableTransactions","Codigo","PostoController","cadPosto","validPosto","d","c","getTurnos","turnos","searchTermFontePagadoraCodigo","searchTermTurno","selectedTurno","individualFilter","ChkTransferenciaSap","IdcGrupoTurno","changeFonte","clickTurno","RecebimentoFiscalController","DanfeService","CavaloMecanicoModel","VagaoTanqueModel","BarCodeService","CheckRecebimentoFiscal","init","code","recebimentoFiscal","localStorage","getItem","removeItem","CodigoBarrasNotaFiscal","changeBarcode","caminhoes","cavalos","navios","vagoes","motoristas","getTransportadoras","empresas","transportadoras","getFornecedores","fornecedores","getRecebimentosFiscais","setListaRecebimentoFiscal","listaRecebimentoFiscal","setListaProdutos","formRecebimentoFiscal","possuiFormulario","create","montaDataEmissaoNF","dadosCodBarras","DataInicial","substring","createRecebimento","IdentificadorRecebimentoFiscalProduto","IdentificadorPostoAbastecimento","IdentificadorAberturaFechamentoTurnoPosto","IdentificadorUsuarioResponsavelRecebimento","NomeSistemaOrigemDado","PreCadastro","DataHoraUTCFimRecebimentoFiscal","DataEmissaoNotaFiscal","IdentificadorEmpresaFornecedora","IdentificadorProdutoNotaFiscal","PrecoUnitarioProdutoNotaFiscal","PesoLiquidoNotaFiscal","PesoBrutoNotaFiscal","PesoBrutoVale","DataHoraUTCChegadaCaminhaoPortaria","DataHoraUTCEntradaCaminhaoPortaria","DataHoraUTCSaidaCaminhaoPortaria","IdentificadorVagaoTanque","CadEmpresaFornecedora","CadEmpresaTransportadora","CadUsuarioResponsavelRecebimento","modalSelTipo","tipos","readBarcode","getScan","idcPosto","recebimentoFiscalClick","regRecebimentoFiscal","changeCaminhao","changeMotorista","$dirty","numDanfe","dataEmissaoNotaFiscal","diadanfe","diaEmissaoNotaFiscal","identificadorRecebimentoFiscalProduto","empresaFornecedora","empresaTransportadora","vagaoTanque","caminhaoTanque","cavaloMecanico","motoristaCavaloCaminhaoTanque","codigoHexadecimalCorLacres","quantidadeLacres","numeroIdentificacaoLacres","produtoNotaFiscal","quantidadeProdutoNotaFiscal","precoUnitarioProdutoNotaFiscal","pesoLiquidoNotaFiscal","pesoBrutoNotaFiscal","pesoBrutoVale","NumeroItemNota","numeroItemNota","CnpjNotaFiscal","cnpjNotaFiscal","DensidadeCarga","densidadeCarga","TemperaturaCarga","temperaturaCarga","changeInvoiceNumber","invoice","codBarraCan","changeDiaEmissao","concat","changeHoraFinal","campo","changeTime","milis","datavalidadecertificado","caminhao","DthValidadeCertificado","CnhVencimento","motorista","isDisabled","atualizaDataHoraChegadaAgendada","dataHoraAtualizada","updateDataSaidaPortaria","getDataSaidaButtonText","showDataSaidaButton","RecebimentoFisicoController","CheckRecebimentoFisico","recebimentoFisico","telas","CONSULTA","REGISTRO","tela","listarecebimentoFisico","tanquesPosto","detalheSelected","apuracaoSelected","validaHorainicial","min","validaMinHoraInicial","max","validaMaxHoraInicial","validaHoraFinal","validaMinHoraFinal","dataHoraFinalRec","DataHoraUTCFimRecebimentoFisico","dataHoraInicialRec","dataHoraInicioTurno","minDate","isSameTurnoInicio","dataHoraFinalTurno","menorQueTurno","IdentificadorAberturaFechamentoTurnoInicioRecebimento","getIdcRegTurno","getRecebimentosFisicos","getTanquesPosto","setListarecebimentoFisico","listRegRecebimentoFisico","listaRecebimentoFisico","DataHoraUTCFimRecebimentoFisicoSearch","criaNovoRecebimento","IdentificadorRecebimentoFisicoProduto","IdentificadorUsuarioResponsavelInicioRecebimento","IdentificadorUsuarioResponsavelTerminoRecebimento","IdentificadorAberturaFechamentoTurnoTerminoRecebimento","IndicadorUtilizacaoSkid","CadUsuarioResponsavelInicioRecebimento","CadUsuarioResponsavelTerminoRecebimento","RegTurnoInicio","RegTurnoTermino","criaDetalhe","criaApuracao","IdentificadorApuracaoRecebimentoProdutoTanque","QuantidadeProdutoInicial20GrausCelsius","QuantidadeProdutoFinal20GrausCelsius","compartimento","IdentificadorDetalheRecebimentoProduto","IdentificadorEncerranteBlocoMedidor","CadAspectoVisual","PesoLiquidoRecebido","MedidaAlturaEspacoVazio","CadCaminhaoCompartimento","forgetCounters","createOrUpdate","modalDetalhe","modalApuracao","getQuantidadeFaltante","getByIdPostoAndStuTanque","detalheClick","apuracaoClick","formRecebimentoFisico","disableHoraInicial","RecebimentosController","DivergenciaService","recebimentos","selectedFisico","isSameTurnoInicioFisico","getAllRecebimentos","listaRecebimentos","DataHoraUTCEndSearch","Desassociar","Cancelado","selectedFiscal","isEditarFiscal","isEditarFisico","lastIndexFisico","lastIndexFiscal","standardProduto","tabselector","isEditing","criaNovoRecebimentoFiscal","IdentificadorCaminhaoCompartimento","RegTurno","criaNovoRecebimentoFisico","Edited","setCacheDates","isFreeDateTimeFiscal","isFreeDateTime","newDate","isFreeDateTimeFisico","getObjDetalhe","tipoRecebimento","codigoDanfe","sglPosto","dataHoraInicial","dataHoraFinal","operador","isSameTurnoInicioFiscal","modalDivergencia","modalSelectionRecFisico","modalDetalheRecebimento","modalSaidaPortaria","idEmAvaliacaoFiscal","idEmAvaliacaoFisico","validacaoFiscal","validacaoFisico","isClosedShift","getPostosByIdc","Idcposto","loadPosto","DscTurno","changeProdutoEmFisico","changeProdutoEmFiscal","changeInitialTimeFisico","openModalSelectionRecebimentoFisico","getUnidadesBySqlSglComplexo","getUnidadesBySqlIdcComplexo","Complexo","loadUnidade","getstandardProduto","recebimentosClick","getByIdRecebimento","adicionarNota","recebimentosFiscal","CodBarrasDuplicado","existeRecebimentoNessaDataHora","DataHoraUTCInicioRecebimentoFiscalDesc","preCreateAbaFiscal","adicionarRecebimentoFisico","recebimentosFisico","IndicadorUtilizacaoSkidDesc","qtd","DataHoraUTCInicioRecebimentoFisicoDesc","preCreateAbaFisico","setProtutoEmAbas","abas","getNotaFiscal","produtoFiscal","getDiaDanfe","LastCodigoDANFENotaFiscal","changeCaminhaoRecebimentoFiscal","getNotaFisico","produtoFisico","editarNota","getCounter","editarFisico","RegTurnoInicioRecebimento","CadTurno","recebimentoFisicoCancel","cancelarEditFisico","novoFisico","editedToSave","isEditedToSave","hasSameStation","SameStation","physicalStations","invoiceStation","runSave","IdcRegTurnoSalvamento","salvarRecebimento","isToCloseShift","msgSameStation","resumoDivergencia","dadosDivergencia","changetab","counter","recebimentoFisicoExcluir","recebimentoFiscalExcluir","cancelarEditFiscal","abrir","divergenciaObj","openModalDivergenciaDatabase","isOpenedModalDivergencia","openModalDivergencia","setTimeout","getAllByDthInicio","recebimentosFisicos","recebimentosSelecao","openModalDetalheRecebemento","listaDetalhes","detalheFiscal","detalheFisico","isOpenedModalDetalhe","grupo","NomUsuarioCriacao","quantidadeRecebidaDetalhes","openModalSaidaPortaria","isOpenedModalSaida","fiscais","baseObj","IdentificadorCamihaoTanqueSaida","DscCaminhaoTanque","idSaidaInputDanfe","idSaidaInputTrunck","idSaidaInputData","idSaidaInputHora","editado","listaSaidas","desassociarExcluirFiscal","promptCancel","changeProdutoEmAbas","idProduto","selectedForm","isProdutoGrupo","isProdutoInGrupo","identificadorGrupoRecebimentoFisicoFiscal","preCadastro","atribuiValoresFromDanfeService","getByCodBarras","getUTCDate","getMaxDayOfMonth","changeCaminhaoRecebimentoFisico","disableHoraInicialFiscal","disableHoraInicialFisico","canEditFisico","VerificaCanada","RegAnomaliaController","RegAnomaliaModel","getListas","getGrupos","regAnomalia","niveis","grupos","DscGrupo","DscItem","nivel","DscObservacao","obs","idcTblOperacao","StuAnomalia","arg","DscGrupoAnomalia","DscItemAnomalia","DscItemBD","CodNivelAnomalia","CodNivel","IdcItem","salvarAnomalia","shouldShowTooltip","touched","$touched","submitted","$$parentForm","DthAnomalia","DscCausa","RegImportacaoController","regImportacao","RegTurnoBlocoController","finalizaEdicao","turnoBloco","DthEncerranteInicial","previousTurnoBloco","ValEncerranteInicial","DthEncerranteFinal","ValEncerranteFinal","active","validaEncerranteInicial","$value","validaEncerrante","ValEncerranteFinalTurnoAnterior","NumToleranciaAcima","NumToleranciaAbaixo","validaEncerranteFinal","ValEncerranteFinalPostoFacil","anterior","proximo","changeTimeInicial","changeTimeFinal","checkFirstCounter","checkLastCounter","RegTurnoController","CheckTurno","MessageModel","canOpenShift","isEmValidacao","clearTurno","valida","validaLista","validaValor","showMessage","salvarServidorWaiting","selTurnoService","salvarTurno","updateFechamento","validaVolumesEncerrantesFinais","VolFinal","realizaFechamento","stuAnomalia","fecharTurno","validarTurno","NumAnomaliasJaFechadas","EnviaSap","alarm","mensagem","AlarmMessage","modalBloco","blocoSelected","tanqueSelected","registroValido","userHasNoPermissionToValidate","search","nodeId","editarBloco","updateInformacoesFechamento","goToFechamento","IdcAnomalia","inoperar","inoperarTurno","RegTurnoTanqueController","turnoTanque","setAlturaRegua","turnoTanquePrevious","expedido","TmpInicial","TmpFinal","DenInicial","DenFinal","VolInicial","changeAltura","SaidaPortariaController","saidaPortaria","getLista","changeField","idfiscal","SelAbastecimentosController","selAbast","abastecimentos","somaVolumes","getRessuprimento","aba","abastServidor","abastTransferencia","SelComplexoSolicitanteController","selComplexoSolicitante","SelecaoRecebimentoFisicoController","selecaoRecebFisico","selection","somaRecebimentoFisico","getDescricaoTipo","SelTipoRecFisicoController","selTipoRecFisico","SelTurnoController","TreeViewModel","localidades","statusTurno","selTurno","getTreeView","tree","dataTreeview","diretorias","children","setLocalidades","openModalSelecao","modalTurno","openModalJustificativa","modalJustificativa","model","availableOptions","lastNodeId","lastDataInicial","lastDataFinal","statusAnterior","size","turnoMenorData","dataInicialOptions","maxDate","dataFinalOptions","statusSelect","turnoList","checkTodos","select","changeFiltro","pNodeId","force","cloneFinal","changeStatus","reabrir","preventDefault","JustifReaberturaTurno","isAvaliacao","reOpenShift","reopenShift","reason","showReabrirButton","canReopenShift","confirmarInoperar","inoperarMultiplos","checkTodosTurnos","checked","checkboxSelected","criarLista","selTurnoInoperar","service","TipoFiscalController","TransferenciaController","TranferenciaModel","CheckTransferencia","transferencia","postos","vinculaAbastecimentos","ListRegAbastecimento","sum1","selectAbastecimentos","modalAbastecimentos","isRessuprimento","ChkRessuprimento","getTranferencias","getPostosDestino","getNumCasasDecimais","setListaTransferencia","listaTransferencia","setListaPostos","setListaBlocos","formTransferencia","goToConsulta","regTransferencia","isDestino","registrarChegada","REGISTRO_ORIGEM","REGISTRO_DESTINO","getAllByIdcRegTurnoPosto","transferenciaClick","filtraPostosPorProduto","ListCadTanquePosto","desabilitaQuantidades","desabilitaBtnRessuprimento","postosAtivos","getLastLacre","ultimoLacre","DataHoraUTCInicioRetiradaOrigemSearch","blocosAtivos","getTotalCapacidadeTanque","capacidadeTanque","UnidadeController","getAllSameDiretoria","cadUnidade","listaCadUnidade","formcadUnidade","UsuariosController","UsuarioModel","getUsers","usuarios","getAllNew","perfilSelected","filtroPerfil","pefisModifieds","modalPerfil","StuUsuario","getPerfils","CadUsuarioPerfils","perfilClick","hasEdit","IdcUsuarioPerfil","formUsuarios","ValidacaoController","ValidacaoModel","EntitiesMetadata","getValueInPath","SyncService","getKey","mapDisplayColumns","display","mapping","column","keyValue","getList","originalList","ValidacaoDetalheController","$window","fillComparingList","oldValue","newValue","comparingList","getEquivalentValues","isArray","mountComparisonValue","oldPropArray","newPropArray","checkedKeys","equivalentValues","oldElement","newElement","highlight","oldPath","newPath","oldProperty","newProperty","keylabel","label","getNewValue","metadata","getOldValue","retOld","idName","idValue","respond","isApproved","isAprovado","now","SolicitacaoAtualizacao","DataHoraUTCAvaliacao","DthResposta","IdentificadorUsuarioAvaliador","IdcUsuarioResposta","IdcUsuarioAceiteAlteracaoParameter","DthAceiteAlteracaoParameter","CodAceiteParameter","IdcUsuarioAceiteAlteracao","DthAceiteAlteracao","CodAceite","history","back","dispatchEvent","tipoSolicitacao","justifReaberturaTurno","aprovar","reprovar","complexosAlterados","equipamentoComplexoList","complexoAlterado","itemComplexo","DscCentroLucro","FontePagadora","IdcFontePagadora","IdcImagemContrato","PrazoInativacao","DthInativacaoEquipamento","DscGerencia","IdcHstEquipamento","hasValidation","VisualizadorImagemController","visualizadorImagemCTRL","filterObject","out","dontColapseOnDesktop","matchMedia","restrict","handleMedia","mediaQueryList","matches","off","addListener","directive","compareData","isArrayParam","filterCondition","multiFilter","paramIndex","paramItem","toLowerCase","focusOn","elem","attr","$on","ihmDblclick","firstClickTime","waitingSecondClick","attrs","bind","getTime","$apply","inp","retorna","keyIndex","maxCharacters","allowedKeys","ctrlKey","onlyDigits","conteudo","clipboardData","getData","onlyIntegers","require","modelCtrl","$parsers","css","$httpLegacy","ngDexie","RequestService","post","historicoURL","OnlyPending","preencheBancoInterno","promises","idTela","atualizaHorimetro","ctrHorHod","updateHorimetro","atualizaEncerrante","updateEncerrante","getByIdcRegTurno","section","function","parameter","user","validarAbastecimentoEncavaladoOffLine","dados_encerrante","dados_abastecimento","filter_encerrante_operacao","IdcOperacao","filter_encerrante_blocos_medidores","findIndex","filter_encerrante_periodo","DthInicialOperacao","DthFinalOperacao","toArray","encerrante_data","filter_abastecimento_operacao","filter_abastecimento_bloco_medidor","ele","filter_abastecimento_periodo","abastecimento_data","blocos_abastecimento","blocos_encerrantes","blocos_validados","localeCompare","funcaoGet","funcaoUpdate","retornaUpdate","salvaAbastecimentosNaoSincronizados","salvaListaAbastecimentosNaoSincronizados","argumento","emProgresso","clear","idcAbastecimento","updateEquipamento","dataAbastecimento","equipamentoR","equipamentoO","getDb","factory","serverUrl2","getQtds","method","updateFiscaisAssociados","fiscaisLista","$http2","getBlocosInterno","bulkPut","pIdcPosto","pIdcRegTurno","Function","eqp","RegExp","equipamentos","bulkAdd","IdCaminhaoTanque","idcDiretoria","idcUsuario","getType","idcComplexo","idcProduto","idcClasse","idcTipo","idcUnidade","regCargaMassa","Promise","idcCarga","IdCavaloMecanico","All","contingenciaURL","IdComplexo","saveContigencia","isContingencia","getLastEncerranteInterno","idcBloco","orderBy","calculaVolumeInterno","ctrEncerranteAnterior","maximoBloco","pow","encerranteCalculado","volumeCalculado","getLastEncerranteServidor","getEncerrantesTurno","mergeWithMemory","encerranteSalvo","encerrantes","countersInMemory","encerranteEmMemoria","rememberCounter","surrogateId","getEncerrantesPeriodo","numCasasDecimais","lastBloco","lastDate","lastCtrEncerrante","momentoUltimoRequest","parseFloat","ctrEncerrante","getLastHorimetroInterno","getHorimetrosTurno","horimetros","equipamento","getByClassificacao","classificacao","Classificacao","cadMarca","getCount","CodTagplaca","cadModelo","pUserID","atualizaBancoInterno","promiseTimeOut","isResolved","waitingTime","AlarmStatusFmt","AlarmStatus","AlarmGroupFmt","IdNavioTanque","inputPainelDeEstoque","ParamsModel","IdcPerfil","IdcPostoSameComplexo","TanquesAtivosByPosto","dataHoraUTCInicioRecebimentoFiscal","identiicadorRecebimentoFiscalProduto","IdcTurnoInicio","IdcTurnoTermino","dataHoraUTCInicioRecebimentoFisico","ApenasCargaEmMassa","identificadorRecebimentoFisicoProduto","preencheAnomalia","timeout","parameters","regEstorno","StuTanque","IdcRegTurnoOrigem","IdcPostoDestino","hasDestinyOpenedShift","selectedTransferencia","IsFunctionValidate","DthInicioTranferencia","DthFimTranferencia","getDestinyShiftState","IsFunctionValidState","functionValidState","tranferencia","TransacaoPerfilModel","getByPerfil","$httpRegular","dthAtual","urlSelTurno","turnoObj","urlRegTurno","pIdcUsuarioFechamento","IdcUsuarioAbertura","IdcUsuarioValidacao","DthValidacao","pRegTurno","IdcUnidadeDiretoria","cadUsuario","Content-Type","aux","getMessageError","InnerException","applyLenghtRule","single","field","rule","blockSaving","anomaly","validator","messages","stringField","valid","maxLength","decimal","splited","many","propName","entidade","every","innerValid","zxinglistener","processBarcode","decodeURIComponent","removeEventListener","getParam","paramName","fullQuery","cb","callback","origin","zxingWindow","encodeURIComponent","ConvertDate","validateBarCodeNFe","codBarras","base9","resto","novaOrigem","substr","$document","dscTitulo","csvContent","cabecalho","dataString","msSaveOrOpenBlob","blob","Blob","encodeURI","msSaveBlob","URL","createObjectURL","ExportOperationCsv","decodeText","readerResult","possibleEncodings","text","tryRead","encoding","TextDecoder","fatal","decode","file","onerror","readAsArrayBuffer","FocusService","$broadcast","GeneralService","formatDate","path","IsOnLineService","menus","relatorios","relatorio","DscTitulo","CodRelatorio","titulo","storeMessage","msg","AlarmDateTime","textAux","extractMessages","exc","$uibModal","Modal","extend","animation","ariaLabelledBy","ariaDescribedBy","appendTo","backdrop","keyboard","instance","resolveObject","privileges","flatten","apply","modal","temTurnoValido","request","requesTimes","timeoutPromise","promiseUpdate","selectedItem","forceSelection","callbacks","promise","oldIdcRegTurno","noop","opts","radius","scale","corners","color","opacity","rotate","direction","speed","trail","className","shadow","hwaccel","targetId","timeToStart","targetRetries","Spinner","shouldSpin","eventName","transition","marcaRotaAlterada","rota","replaceArgs","str","args","default","$get","arguments","provider","sendToAAD","setUserHeader","hasUserSession","DthLogin","_validacao","_messages","validaHorimetro","required","pattern","minlength","maxlength","BaseMaxSize","verifyValue","valElement","valMaxBase","elements","val","maxValue","validaExpiracao","$setPristine","$setUntouched","showAlways","dirty","$error","atributeMessage","$$attr","$normalize","cap1","encerranteEsperado","limiteInferior","limiteSuperior","tempDate","setFullYear","turnoDthInicial","turnoDthFinal","dataTurno","decimalPlaces","toStr","isCallable","fn","toInteger","isFinite","maxSafeInteger","toLength","len","arrayLike","TypeError","mapFn","kValue","k","callbackfn","thisArg","func","res","defineProperty","predicate","o","configurable","writable","searchElement","fromIndex","n","x","y","mappedValue","fun","sendToServer","chunk","sendData","array","maxSize","chunkedArray","linha","sendOperationData","operationDates","urlOperacao","dir","com","uni","pos","statusPrincipal","turnoMsg","streamsURL","modalImportStream","generateTemplate","columns","GridHistorico","CodImportacao","tables","streamSaver","supported","loop","fetch","fileStream","createWriteStream","pipeTo","CheckService","withinlimit","oneTanqk","oneTank","hojeAgora","rules","requiredFields","requiredFiltersFields","funcionValidateRequired","rulesFilters","hoje","numberFields","fieldsMaxlength","TYPES","CAMINHAO_TANQUE","VAGAO_TANQUE","TANQUE_A_TANQUE","NAVIO_TANQUE","recebimentosComVolume","apuracaoFieldsMaxlength","detalhesFieldsMaxlength","entity","askAnomaly","blockMessages","anomalyMessages","toLocaleTimeString","SglTanque","ValCapacidadeCritica","ValCapacidadeLastro","diferencaEmListros","digitos","decimais","TransferenciasPostoDefault"],"mappings":"CAAA,WACI,YAEA,IAAIA,IACA,YACA,UACA,YACA,eACA,cACA,UACA,aACA,iBACA,aACA,aAGJC,SAAQC,OAAO,cAAeF,GACzBG,KA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AAa,iBACbC,mBAAqB,EACrBC,sBAAwB,EACxBC,gBACI,mBACA,oBACA,oBACA,wBACA,sBACA,qBAEJC,iBACK,oBAAqB,+BACrB,WAAY,sBACZ,WAAY,aACZ,aAAc,wBACd,WAAY,sBAETC,UAAa,2BAA4B,4BACzCC,IAAO,kBACPF,gBACI,kCACA,wBACA,uBACA,wBAIJC,UAAa,0BAA2B,2BACxCC,IAAO,iBACPF,gBACI,2BACA,wBAKA,aACA,eAKhBK,wBACIZ,UAAa,eACbC,UAAa,YACbC,SAAY,0BACZC,UAAa,6BACbC,mBAAqB,EACrBC,sBAAwB,EACxBC,gBACI,kCACA,cACA,wBACA,gBACA,UACA,gBACA,yBAEJC,gBACI,kCACA,cACA,wBACA,gBACA,cACA,UACA,gBACA,wBACA,qBACA,aACA,uBACA,qBACA,iBACA,mBAGRM,gBACIb,UAAa,YACbC,UAAa,SACbC,SAAY,WACZC,UAAa,cACbC,mBAAqB,EACrBC,sBAAwB,EACxBC,gBACI,WACA,WACA,WACA,YAEJC,gBACI,WACA,WACA,WACA,WACA,8BACA,wBACA,mBACA,WAEIC,UAAa,qBAAsB,sBACnCC,IAAO,iBACPF,gBACI,YACA,YACA,wBACA,cACA,aACA,iBACA,UACA,qBACA,aACA,aACA,oBACA,oBACA,YAEIC,UAAa,4BAA6B,gCAC1CC,IAAO,kBACPF,iBACK,kCAAmC,oCACnC,kCAAmC,oCACnC,8BAA+B,gCAC/B,wCAAyC,0CACzC,mCAAoC,qCACpC,6BAA8B,+BAC9B,sCAAuC,wCACvC,qCAAsC,uCACtC,kCAAmC,oCACnC,kCAAmC,oCACnC,0BAA2B,iCAQpDO,kBACId,UAAa,cACbC,UAAa,WACbC,SAAY,aACZC,UAAa,gBACbC,mBAAqB,EACrBC,sBAAwB,EACxBC,gBACI,aACA,aACA,eACA,eAEJC,gBACI,aACA,eACA,cACA,aACA,eAGRQ,wBACIf,UAAa,oBACbC,UAAa,iBACbC,SAAY,oCACZC,UAAa,0DACbC,mBAAqB,EACrBC,sBAAwB,EACxBC,gBACI,oBACA,kCACA,wBACA,8CACA,yBAEJC,gBACI,mCACA,oBACA,gDACA,wBACA,kCACA,+BACA,sCACA,mCACA,yBACC,mCAAoC,sCACrC,gDAGRS,4BACIhB,UAAa,wBACbC,UAAa,qBACbC,SAAY,wCACZC,UAAa,8DACbC,mBAAqB,EACrBC,sBAAwB,EACxBC,gBACI,sDACA,qCACA,kCACA,wBACA,qDAEJC,gBACI,8CACA,wBACA,qCACA,kCACA,oDACA,qDACA,gCACA,6BACA,6BACA,sDACA,iCACA,oBACA,2BACA,0BACA,yBAEIC,UAAa,4CAA6C,mEAC1DC,IAAO,gDACPF,gBACI,2BACA,oBACA,sBACA,uBACA,yBACA,8BACA,gCACA,8BACA,gCACA,6BACA,+BACA,mCACA,qCACA,yBACA,uCACA,2BACA,4CAIJC,UAAa,gCAAiC,uDAC9CC,IAAO,yCACPF,gBACI,oCACA,iDACC,mCAAoC,sCAGrC,yBACA,wBACA,0BACA,yBACA,2BACA,yBACA,4BACA,yBACA,wBACA,sBACA,+BACA,qBACA,uCAKhBU,4BACIjB,UAAa,wBACbC,UAAa,qBACbC,SAAY,wCACZC,UAAa,8DACbC,mBAAqB,EACrBC,sBAAwB,EACxBC,gBACI,sDACA,wBACA,wBACA,8BACA,qCACA,+CAEJC,gBACI,wBACA,wBACA,8BACA,qCACA,8CAEA,6BACA,6BACA,mCACA,sCACA,4BACA,oBACA,gCAEA,qCACA,kCACA,yBACA,wBACA,6BACA,wBACA,qCACA,qCACA,mCACA,6CACA,sDACA,2BACA,wBACA,4BACA,sBACA,gBACA,wBACA,iCACA,mBACA;CC9apB,WACI,YAQA,SAASW,GAAWC,GAEhBA,EAAcC,SAASC,QAAQC,OAAO,iBAAmBC,UAAUC,SAEnEL,EAAcC,SAASK,kBAAkBC,KAAK,SAAUC,EAAMC,GAE1D,GAAIC,GAAOD,EAAa,gBACpBE,EAAWF,EAAa,WAE5B,OAAIE,QACAxG,OAAOyG,SA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,EAAmBnY,kBAAoB,KACvCmY,EAAmBlY,iBAAmB,KACtCkY,EAAmBjY,gBAAkB,KACrCiY,EAAmBhY,cAAgB,KACnCgY,EAAmBuN,eAAiBC,uBACpCxN,EAAmBuL,sBACnBvL,EAAmB3oB,mBAlH3B/qB,QAAQC,OAAO,eAAeyI,WAAW,+BAAgC0qC,GACzEA,EAA6B9xC,SACzB,YACA,kBACA,iBACA,iBACA,gBACA,eACA,aACA,WACA,gBACA,mBACA,KACA,oBACA,oBACA,qBACA,eACA,WACA,eACA,eACA,iBACA,qBACA,iBACA,UACA,iBACA,sBACA,mBACA,qBACA;CC/BR,WACI,YAQA,SAAS6/C,GAAkB5N,GAKvB,GAAI6N,GAAUzqC,IACdyqC,GAAQle,MAAQ,aAChB,IAAIme,IACA,gBACA,eACA,cACA,eACA,YACA,kBACA,YACA,oBACA,mBACA,cACA,mBACA,YACA,aACA,uBACA,kBACA,UACA,mBACA,wBACA,mBACA,mBACA,4BACA,cACA,eACA,kBACA,gBACA,sBACA,sBACA,mBACA,qBACA,oBACA,qBACA,qBACA,uBACA,8BACA,sBACA,6BAOJD,GAAQC,UAAYA,EAAUxvB,IAAI,SAAUyvB,GACxC,OACIA,MAAOA,EACPC,OAAQhO,EAAcgO,OAAOD,GAC7B7B,OAAQlM,EAAckM,OAAO6B,MAWrCF,EAAQI,UAAY,WAChBjO,EAAciO,UAAUH,IAG5BD,EAAQK,UAAY,WAChBlO,EAAckO,UAAUJ,IA5EhCrhD,QAAQC,OAAO,eAAeyI,WAAW,oBAAqBy4C,GAE9DA,EAAkB7/C,SACd;CCNR,WACI,YAQA,SAASogD,GAA0BnO,GAK/B,GAAI6N,GAAUzqC,IACdyqC,GAAQle,MAAQ,WAChB,IAAIme,IAEA,aACA,cACA,gBACA,eACA,cACA,eACA,YACA,kBACA,kBACA,YACA,oBACA,qBACA,mBACA,cACA,mBACA,2BACA,YACA,aACA,uBACA,kBACA,UACA,mBACA,wBACA,mBACA,4BACA,cACA,eACA,k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AMszD,kBAMhD,OAJKggB,IACDF,EAASp8E,KAAKgD,EAAiB,2BAG5Bs5E,OAKnBN,KAAQ,yBACRC,aAAe,EACfC,SAAW,EACXC,UAAa,SAAUz2E,EAAU02E,GAC7B,MAAO12E,GAASm4C,6BACXg/B,MAAM,SAAU7zE,GACb,IAAKA,EAAMszD,mBAAoB,OAAO,CACtC,IAAIggB,GAAQtzE,EAAMszD,oBAAsB52D,EAASe,QAMjD,OAJK61E,IACDF,EAASp8E,KAAKgD,EAAiB,2BAG5Bs5E,OAKnBN,KAAQ,8BACRC,aAAe,EACfC,SAAW,EACXC,UAAa,SAAUz2E,EAAU02E,GAC7B,GAAIE,GAAQ52E,EAAS0mF,4BAA8B1mF,EAAS0mF,2BAA2BtmF,OAAS,IACvE,WAAjBJ,EAAS2O,MAAsC,UAAjB3O,EAAS2O,KAS/C,OANKioE,IAA0B,WAAjB52E,EAAS2O,KAGbioE,GAA0B,UAAjB52E,EAAS2O,MACxB+nE,EAASp8E,KAAKgD,EAAiB,6BAH/Bo5E,EAASp8E,KAAKgD,EAAiB,6BAK3Bs5E,KAMiB9d,IAjd7C3lE,QAAQC,OAAO,eAAei7E,QAAQ,aAAcvW,GAEpDA,EAAWrjE,SACP,eACA,mBACA","file":"main-942707af7f.js","sourcesContent":["(function () {\r\n 'use strict';\r\n\r\n var dependencias = [\r\n 'ui.router',\r\n 'ngTouch',\r\n 'ngAnimate',\r\n 'ui.bootstrap',\r\n 'ui.validate',\r\n 'ngdexie',\r\n 'ngdexie.ui',\r\n 'angular-inview',\r\n 'ngMaterial',\r\n 'ngMessages',\r\n ];\r\n\r\n angular.module('posto-facil', dependencias)\r\n .run(['$rootScope', function ($rootScope) {\r\n $rootScope.version = '1.24';\r\n }]).config(['$qProvider', function ($qProvider) {\r\n $qProvider.errorOnUnhandledRejections(false);\r\n }]);\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').run(cacheHandler);\r\n\r\n cacheHandler.$inject = [\r\n '$interval',\r\n 'TransitionService',\r\n 'Constant'\r\n ];\r\n\r\n function cacheHandler(\r\n $interval,\r\n TransitionService,\r\n Constant\r\n ) {\r\n var checkUpdate = true;\r\n var intervalPromise = null;\r\n\r\n function handleUpdate() {\r\n checkUpdate = false;\r\n }\r\n\r\n if (!window.applicationCache) return;\r\n\r\n applicationCache.addEventListener('obsolete', handleUpdate);\r\n applicationCache.addEventListener('updateready', handleUpdate);\r\n\r\n intervalPromise = $interval(function () {\r\n\r\n if (checkUpdate) {\r\n return applicationCache.update();\r\n }\r\n\r\n $interval.cancel(intervalPromise);\r\n TransitionService.updateReady = true;\r\n\r\n }, Constant.TIME_TO_CHECK_UPDATE);\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').constant('Constant', {\r\n TIME_TO_CHECK_UPDATE: 5 * 60 * 1000,//5 minutos\r\n SERVER_WAITING_TIME: 1000,//1 segundo\r\n SERVER_WAITING_TIME_TO_SAVE: 5000,//5 segundos\r\n TIME_BEFORE_GO_TO_SERVER: 500,//0.5 segundos\r\n TIME_TO_SYNC_ENCERRANTES: 5 * 60 * 1000,//5 minutos\r\n TIME_TO_SYNC_ABASTECIMENTOS: 5 * 60 * 1000,//5 minutos\r\n PING_TIMEOUT: 3000,// 3 segundos\r\n SESSION_TIME: 1000 * 60 * 60 * 24,\r\n EDICAO: 'editar',\r\n NOVO: 'novo',\r\n INDICADORES_BINARIOS: {\r\n S: 'sim',\r\n N: 'nao'\r\n },\r\n INDICADORES_ATIVO: {\r\n S: 'active',\r\n N: 'inactive'\r\n },\r\n CLASSIFICACOES_EMPRESA: {\r\n OPERACIONAL: 'OPERACIONAL',\r\n CONSTRUCAO_CIVIL: 'CONSTRUÇÃO CIVIL',\r\n FORNECEDOR: 'FORNECEDOR',\r\n LOCACAO: 'LOCAÇÃO',\r\n MANUTENCAO_MECANICA: 'MANUTENÇÃO MECANICA',\r\n TRANSPORTADORA: 'TRANSPORTADORA',\r\n PRESTACAO_DE_SERVIÇOS: 'PRESTAÇÃO DE SERVIÇOS',\r\n SAUDE: 'SAÚDE',\r\n LOGISTICA: 'LOGÍSTICA',\r\n QUIMICA: 'QUÍMICA',\r\n CONSULTORIA: 'CONSULTORIA'\r\n },\r\n UNIDADES_ALTURA: {\r\n \"MM\": 1,\r\n \"M\": 1000\r\n },\r\n TIPOS_RECEBIMENTO: {\r\n C: 'truck-tanker',\r\n N: 'ship-tank',\r\n V: 'tank-wagon',\r\n T: 'tank-to-tank'\r\n },\r\n FONTES_PAGADORAS: {\r\n C: 'bill-department',\r\n E: 'pepElement',\r\n O: 'statisticalOrder',\r\n R: 'rateio'\r\n },\r\n OPERACOES: {\r\n A: 'ABASTECIMENTO',\r\n T: 'TRANSFERENCIA',\r\n R: 'RECEBIMENTOFISICO'\r\n },\r\n CABECALHOREFERENCIAL: {\r\n ABASTECIMENTO : 'Código Usuário (*);Tag/Placa (*);Data Inicial (*);Hora Inicial (*);Data Final (*);Hora Final (*);Horímetro/Hodômetro (*);Observações;Sigla Tanque;Código Material Produto;Bloco Medidor (*);Volume (L);Encerrante;Volume Atual (L)',\r\n TRANSFERENCIA : 'Código Usuário (*);Bloco Medidor (*);Posto de Destino (*);Data Inicial (*);Hora Inicial (*);Data Final (*);Hora Final (*);Encerrante;Volume (L);Observações',\r\n RECEBIMENTOFISICO_CAMINHAOTANQUE : 'Código Usuário (*);Produto (*);Data Inicial (*);Hora Inicial (*);Data Final (*);Hora Final (*);Motorista Concorda?;Recebimento com SKID?;Cavalo Mecânico (*);Caminhão Tanque (*);Observações;Número do Compartimento (*);Volume Recebido (*);Densidade;Temperatura;Densidade (Boletim);Temperatura (Massa);Aspecto Visual;Presença de Água;Sigla Tanque (*);Altura Inicial MM;Altura Final MM;Quantidade Inicial;Quantidade Final;Densidade Inicial;Densidade Final;Temperatura Média Inicial;Temperatura Superfície Inicial;Temperatura Meio Inicial;Temperatura Fundo Inicial;Temperatura Média Final;Temperatura Superfície Final;Temperatura Meio Final;Temperatura Fundo Final',\r\n RECEBIMENTOFISICO_NAVIOTANQUE : 'Código Usuário (*);Produto (*);Data Inicial (*);Hora Inicial (*);Data Final (*);Hora Final (*);Motorista Concorda?;Recebimento com SKID?;Navio Tanque (*);Observações;Volume Recebido (*);Densidade;Temperatura;Densidade (Boletim);Temperatura (Massa);Aspecto Visual;Presença de Água;Sigla Tanque (*);Altura Inicial MM;Altura Final MM;Quantidade Inicial;Quantidade Final;Densidade Inicial;Densidade Final;Temperatura Média Inicial;Temperatura Superfície Inicial;Temperatura Meio Inicial;Temperatura Fundo Inicial;Temperatura Média Final;Temperatura Superfície Final;Temperatura Meio Final;Temperatura Fundo Final',\r\n RECEBIMENTOFISICO_VAGAOTANQUE : 'Código Usuário (*);Produto (*);Data Inicial (*);Hora Inicial (*);Data Final (*);Hora Final (*);Motorista Concorda?;Recebimento com SKID?;Vagão Tanque (*);Observações;Volume Recebido (*);Densidade;Temperatura;Densidade (Boletim);Temperatura (Massa);Aspecto Visual;Presença de Água;Sigla Tanque (*);Altura Inicial MM;Altura Final MM;Quantidade Inicial;Quantidade Final;Densidade Inicial;Densidade Final;Temperatura Média Inicial;Temperatura Superfície Inicial;Temperatura Meio Inicial;Temperatura Fundo Inicial;Temperatura Média Final;Temperatura Superfície Final;Temperatura Meio Final;Temperatura Fundo Final',\r\n RECEBIMENTOFISICO_TANQUETANQUE : 'Código Usuário (*);Produto (*);Data Inicial (*);Hora Inicial (*);Data Final (*);Hora Final (*);Motorista Concorda?;Recebimento com SKID?;Observações;Volume Recebido (*);Densidade;Temperatura;Densidade (Boletim);Temperatura (Massa);Aspecto Visual;Presença de Água;Sigla Tanque (*);Altura Inicial MM;Altura Final MM;Quantidade Inicial;Quantidade Final;Densidade Inicial;Densidade Final;Temperatura Média Inicial;Temperatura Superfície Inicial;Temperatura Meio Inicial;Temperatura Fundo Inicial;Temperatura Média Final;Temperatura Superfície Final;Temperatura Meio Final;Temperatura Fundo Final',\r\n }\r\n });\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').config(Configuration);\r\n\r\n Configuration.$inject = ['ngDexieProvider'];\r\n\r\n function Configuration(ngDexieProvider) {\r\n ngDexieProvider.setOptions({ name: 'posto-facil', debug: false });\r\n ngDexieProvider.setConfiguration(function (db) {\r\n db.version(1).stores({\r\n CAD_EQUIPAMENTO: \"IdcEquipamento,CodTagPlacaEqp\",\r\n CTR_HOR_HOD: \"[DthCtrHorHod+IdcEquipamento], DthCtrHorHod,IdcEquipamento\",\r\n CTR_ENCERRANTE: \"[DthCtrEncerrante+IdcBlocoMedidor], DthCtrEncerrante,IdcBlocoMedidor\",\r\n CAD_BLOCO_MEDIDOR: \"IdcBlocoMedidor,IdcPosto,IdcProduto\",\r\n REG_ABASTECIMENTO: \"++idTela\",\r\n REG_GRUPO_ANOMALIA: \"[IdcGrupo+IdcItem+IdcNivel]\"\r\n });\r\n });\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').config(config);\r\n\r\n config.$inject = ['TranslateServiceProvider'];\r\n\r\n function config(TranslateServiceProvider) {\r\n TranslateServiceProvider.resources = TranslateServiceProvider.resources || {};\r\n TranslateServiceProvider.resources['en'] = TranslateServiceProvider.resources['en-US'] = enUSJson;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').value('EntitiesMetadata', {\r\n \"validacao\": {\r\n \"validacaoEquipamento\": {\r\n \"serverUrl\": \"_hstEquipamento\",\r\n \"entityUrl\": \"_equipamentoTemp\",\r\n \"entityId\": \"IdcEquipamento\",\r\n \"historyId\": \"IdcHstEquipamento\",\r\n \"hasValidationFlow\": true,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"CodTagPlaca\",\r\n \"CadEquipamentoTipo.CodTipo\",\r\n \"CadModelo.CodModelo\",\r\n \"CadModelo.CadMarca.CodMarca\",\r\n \"CadComplexoSolicitante.SglComplexo\"\r\n ],\r\n \"compareColumns\": [\r\n \"CodTagPlaca\", \r\n \"AnoFabricacao\", \r\n \"CadEquipamentoTipo.CodTipo\",\r\n \"CadGri.CodGri\",\r\n \"CadModelo.CodModelo\", \r\n \"CadTipoFiscal.DscTipoFiscal\",\r\n \"ChkHorimetro\", \r\n \"CodTag\",\r\n \"CodPlaca\",\r\n \"CodRenavan\", \r\n \"NumDigitos\",\r\n \r\n \"IdcImagemDut\",\r\n {\r\n \"property\": [\"ListRelEquipamentoComplexo\", \"ListHstRelEquipamentoComplexo\"],\r\n \"key\": \"IdcComplexo\",\r\n \"compareColumns\": [\r\n \"CadComplexo.SglComplexo\",\r\n \"CadContrato.CodContrato\",\r\n \"FontePagadora.TipoFonte\",\r\n \"FontePagadora.CodFontePagadora\",\r\n \"CadCentroLucro.CodCentroLucro\",\r\n \"CadCentroLucro.DscCentroLucro\",\r\n \"IdcImagemContrato\",\r\n \"ChkInativo\",\r\n \"PrazoInativacao\",\r\n \"StuEquipamento\",\r\n \"DthInativacaoEquipamento\"\r\n ]\r\n },\r\n {\r\n \"property\": [\"ListCadTanqueEquipamento\", \"ListHstTanqueEquipamento\"],\r\n \"key\": \"IdcTanqueEquipamento\",\r\n \"compareColumns\": [\r\n \"DscTanqueEquipamento\",\r\n \"ValCapacidadeNominal\",\r\n \"StuTanqueEquipamento\",\r\n {\r\n \"property\": [\"ListRelTanqueEquipamentoProduto\", \"ListHstRelTanqueEquipamentoProduto\"],\r\n \"key\": \"IdcProduto\",\r\n \"compareColumns\": [\r\n \"CadProduto.SglProduto\",\r\n \"ValConsumoEsp\"\r\n ]\r\n }\r\n ]\r\n } \r\n ]\r\n },\r\n \"validacaoAbastecimento\": {\r\n \"serverUrl\": \"_hstAbastecimento\",\r\n \"entityUrl\": \"_abastecimento\",\r\n \"entityId\": \"IdcAbastecimento\",\r\n \"historyId\": \"IdcHstAbastecimento\",\r\n \"hasValidationFlow\": true,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"CadEquipamento.CodTagPlaca\",\r\n \"DthInicial\",\r\n \"DthFinal\",\r\n \"CadUsuario.NomUsuario\"\r\n ],\r\n \"compareColumns\": [\r\n \"CadEquipamento.CodTagPlaca\",\r\n \"DthInicial\",\r\n \"DthFinal\",\r\n \"CadUsuario.NomUsuario\",\r\n \"CadUsuario.NomUsuario\",\r\n \"ValHorHod\",\r\n \"CadPosto.SglPosto\",\r\n \"NomDispositivo\",\r\n \"StuAbastecimento\",\r\n {\r\n \"property\": [\"ListRegAbastecimentoTanque\", \"ListHstAbastecimentoTanque\"],\r\n \"key\": \"IdcTanqueEquipamento\",\r\n \"compareColumns\": [\r\n \"CadTanqueEquipamento.DscTanqueEquipamento\",\r\n \"CadBlocoMedidor.SglBlocoMedidor\",\r\n \"CadProduto.SglProduto\",\r\n \"VolAbastecimento\",\r\n \"ValEncerrante\",\r\n // \"TmpAbastecimento\",\r\n // \"DenAbastecimento\",\r\n // \"VolAbastecimento20c\",\r\n \"VolAtual\",\r\n \"ChkResetAutomaticoEncerrante\",\r\n \"DthAbastecimentoTanque\",\r\n \"StuEnvioSap\"\r\n ]\r\n },\r\n ]\r\n },\r\n \"validacaoTurno\": {\r\n \"serverUrl\": \"_hstTurno\",\r\n \"entityUrl\": \"_turno\",\r\n \"entityId\": \"IdcRegTurno\",\r\n \"historyId\": \"IdcHstRegTurno\",\r\n \"hasValidationFlow\": true,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"RegTurnoSglPosto\",\r\n \"RegTurno.SglTurno\",\r\n \"RegTurno.StuTurno\",\r\n \"CodUsuarioAlteracaoN1\",\r\n \"RegTurno.DthInicial\",\r\n \"RegTurno.DthFinal\"\r\n ],\r\n \"compareColumns\": [\r\n [\"CadPosto.SglPosto\", \"RegTurno.CadPosto.SglPosto\"],\r\n [\"SglTurno\", \"RegTurno.SglTurno\"],\r\n [\"StuTurno\", \"StuTurno\"],\r\n [\"DthInicial\", \"RegTurno.DthInicial\"],\r\n [\"DthFinal\", \"RegTurno.DthFinal\"],\r\n {\r\n \"property\": [\"ListRegTurnoBlocoMedidor\", \"ListHstTurnoBlocoMedidor\"],\r\n \"key\": \"IdcBlocoMedidor\",\r\n \"compareColumns\": [\r\n \"CadBlocoMedidor.SglBlocoMedidor\",\r\n \"CadProduto.SglProduto\",\r\n \"ValEncerranteInicial\",\r\n \"ValEncerranteFinal\"\r\n ]\r\n },\r\n {\r\n \"property\": [\"ListRegTurnoTanquePosto\", \"ListHstTurnoTanquePosto\"],\r\n \"key\": \"IdcTanquePosto\",\r\n \"compareColumns\": [\r\n \"CadTanquePosto.SglTanque\",\r\n \"CadProduto.SglProduto\",\r\n // \"TmpInicial\",\r\n // \"TmpFinal\",\r\n // \"Vol20cInicial\",\r\n // \"Vol20cFinal\",\r\n \"VolInicial\",\r\n \"VolFinal\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"validacaoAfericaoBloco\": {\r\n \"serverUrl\": \"_hstAfericao\",\r\n \"entityUrl\": \"_afericao\",\r\n \"entityId\": \"IdcBlocoMedidorAfericao\",\r\n \"historyId\": \"IdcHstBlocoMedidorAfericao\",\r\n \"hasValidationFlow\": true,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"CadBlocoMedidor.SglBlocoMedidor\",\r\n \"DthAfericao\",\r\n \"CadProduto.SglProduto\",\r\n \"ValEncerrante\",\r\n \"ValErro\",\r\n \"ValCalibracao\",\r\n \"CadUsuario.NomUsuario\"\r\n ],\r\n \"compareColumns\": [\r\n \"CadBlocoMedidor.SglBlocoMedidor\",\r\n \"DthAfericao\",\r\n \"CadProduto.SglProduto\",\r\n \"ValEncerrante\",\r\n \"VolAfericao\",\r\n \"ValErro\",\r\n \"ValCalibracao\",\r\n \"CadUsuario.NomUsuario\",\r\n \"ChkResetAutomatico\",\r\n \"ChkRetorno\",\r\n \"DscOrgaoCertificador\",\r\n \"DthVencCertificado\",\r\n \"NomDispositivo\",\r\n \"NumCertificado\"\r\n ]\r\n },\r\n \"validacaoPosto\": {\r\n \"serverUrl\": \"_hstPosto\",\r\n \"entityUrl\": \"_posto\",\r\n \"entityId\": \"IdcPosto\",\r\n \"historyId\": \"IdcHstPosto\",\r\n \"hasValidationFlow\": false,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"SglPosto\",\r\n \"DscPosto\",\r\n \"TipPosto\",\r\n \"StuPosto\"\r\n ],\r\n \"compareColumns\": [\r\n \"SglPosto\",\r\n \"DscPosto\",\r\n \"TipPosto\",\r\n \"StuPosto\",\r\n \"CadGrupoTurno.DscGrupoTurno\",\r\n \"CadUnidade.SglUnidade\",\r\n \"ChkRessuprimento\",\r\n \"ChkSkid\",\r\n {\r\n \"property\": [\"ListCadTanquePosto\", \"ListHstTanquePosto\"],\r\n \"key\": \"IdcTanquePosto\",\r\n \"compareColumns\": [\r\n \"SglTanque\",\r\n \"DscTanque\",\r\n \"CadProduto.SglProduto\",\r\n \"CodDeposito\",\r\n \"AltInterna\",\r\n \"ChkAlturaRegua\",\r\n \"ChkSkid\",\r\n \"ChkTabelaArqueacao\",\r\n \"CpmInterno\",\r\n \"DimInterno\",\r\n \"EixoMaiorEliptica\",\r\n \"EixoMenorEliptica\",\r\n \"HstPosto\",\r\n {\r\n \"property\": [\"ListRelTanqueBlocoMedidor\", \"ListHstRelTanqueBlocoMedidor\"],\r\n \"key\": \"IdcBlocoMedidor\",\r\n \"compareColumns\": [\r\n [\"CadBlocoMedidor.SglBlocoMedidor\", \"HstBlocoMedidor.SglBlocoMedidor\"],\r\n [\"CadBlocoMedidor.DscBlocoMedidor\", \"HstBlocoMedidor.DscBlocoMedidor\"],\r\n [\"CadBlocoMedidor.ChkBloqueio\", \"HstBlocoMedidor.ChkBloqueio\"],\r\n [\"CadBlocoMedidor.NomDipositivoBloqueio\", \"HstBlocoMedidor.NomDipositivoBloqueio\"],\r\n [\"CadBlocoMedidor.NumCasasDecimais\", \"HstBlocoMedidor.NumCasasDecimais\"],\r\n [\"CadBlocoMedidor.NumDigitos\", \"HstBlocoMedidor.NumDigitos\"],\r\n [\"CadBlocoMedidor.NumToleranciaAbaixo\", \"HstBlocoMedidor.NumToleranciaAbaixo\"],\r\n [\"CadBlocoMedidor.NumToleranciaAcima\", \"HstBlocoMedidor.NumToleranciaAcima\"],\r\n [\"CadBlocoMedidor.SglBlocoMedidor\", \"HstBlocoMedidor.SglBlocoMedidor\"],\r\n [\"CadBlocoMedidor.StuBlocoMedidor\", \"HstBlocoMedidor.StuBlocoMedidor\"],\r\n [\"CadBlocoMedidor.UeFator\", \"HstBlocoMedidor.UeFator\"]\r\n\r\n ]\r\n }\r\n ]\r\n },\r\n ]\r\n },\r\n \"validacaoUsuario\": {\r\n \"serverUrl\": \"_hstUsuario\",\r\n \"entityUrl\": \"_usuario\",\r\n \"entityId\": \"IdcUsuario\",\r\n \"historyId\": \"IdcHstUsuario\",\r\n \"hasValidationFlow\": false,\r\n \"shouldGetFullHistory\": false,\r\n \"displayColumns\": [\r\n \"CodUsuario\",\r\n \"NomUsuario\",\r\n \"EmailUsuario\",\r\n \"FoneUsuario\"\r\n ],\r\n \"compareColumns\": [\r\n \"CodUsuario\",\r\n \"EmailUsuario\",\r\n \"FoneUsuario\",\r\n \"NomUsuario\",\r\n \"StuUsuario\"\r\n ]\r\n },\r\n \"validacaoTransferencia\": {\r\n \"serverUrl\": \"_hstTransferencia\",\r\n \"entityUrl\": \"_transferencia\",\r\n \"entityId\": \"IdentificadorTransferenciaProduto\",\r\n \"historyId\": \"IdentificadorSolicitacaoAtualizacaoTransferenciaProduto\",\r\n \"hasValidationFlow\": true,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"CadPosto.SglPosto\",\r\n \"DataHoraUTCInicioRetiradaOrigem\",\r\n \"QuantidadeTransferida\",\r\n \"CadUsuarioResponsavelPostoOrigem.NomUsuario\",\r\n \"CadProduto.SglProduto\"\r\n ],\r\n \"compareColumns\": [\r\n \"RegTurnoOrigem.CadPosto.SglPosto\",\r\n \"CadPosto.SglPosto\",\r\n \"CtrEncerrante.CadBlocoMedidor.SglBlocoMedidor\",\r\n \"CadProduto.SglProduto\",\r\n \"DataHoraUTCInicioRetiradaOrigem\",\r\n \"DataHoraUTCFimRetiradaOrigem\",\r\n \"DataHoraUTCInicioRecebimentoDestino\",\r\n \"DataHoraUTCFimRecebimentoDestino\",\r\n \"QuantidadeTransferida\",\r\n [\"CtrEncerrante.ValEncerranteAtual\", \"CtrEncerrante.QuantidadeEncerrante\"],\r\n \"CadUsuarioResponsavelPostoOrigem.NomUsuario\"\r\n ]\r\n },\r\n \"validacaoRecebimentoFisico\": {\r\n \"serverUrl\": \"_hstRecebimentoFisico\",\r\n \"entityUrl\": \"_recebimentoFisico\",\r\n \"entityId\": \"IdentificadorRecebimentoFisicoProduto\",\r\n \"historyId\": \"IdentificadorSolicitacaoAtualizacaoRecebimentoFisicoProduto\",\r\n \"hasValidationFlow\": true,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"GrupoRecebimentoFisicoFiscal.CodigoGrupoRecebimento\",\r\n \"DataHoraUTCInicioRecebimentoFisico\",\r\n \"DataHoraUTCFimRecebimentoFisico\",\r\n \"CadProduto.SglProduto\",\r\n \"CadUsuarioResponsavelInicioRecebimento.NomUsuario\"\r\n ],\r\n \"compareColumns\": [\r\n \"RegTurnoInicioRecebimento.CadPosto.SglPosto\",\r\n \"CadProduto.SglProduto\",\r\n \"DataHoraUTCInicioRecebimentoFisico\",\r\n \"DataHoraUTCFimRecebimentoFisico\",\r\n \"CadUsuarioResponsavelInicioRecebimento.NomUsuario\",\r\n \"CadUsuarioResponsavelTerminoRecebimento.NomUsuario\",\r\n \"CadVagaoTanque.CodVagaoTanque\",\r\n \"CadCaminhaoTanque.CodPlaca\",\r\n \"CadCavaloMecanico.CodPlaca\",\r\n \"GrupoRecebimentoFisicoFiscal.CodigoGrupoRecebimento\",\r\n \"IndicadorConcordanciaMotorista\",\r\n \"IndicadorSituacao\",\r\n \"IndicadorTipoRecebimento\",\r\n \"IndicadorUtilizacaoSkid\",\r\n \"NomeSistemaOrigemDado\",\r\n {\r\n \"property\": [\"ListApuracaoRecebimentoProdutoTanquePosto\", \"ListSolicitacaoAtualizacaoApuracaoRecebimentoProdutoTanquePosto\"],\r\n \"key\": \"IdentificadorApuracaoRecebimentoProdutoTanque\",\r\n \"compareColumns\": [\r\n \"CadTanquePosto.SglTanque\",\r\n \"MedidaAlturaFinal\",\r\n \"MedidaAlturaInicial\",\r\n \"MedidaDensidadeFinal\",\r\n \"MedidaDensidadeInicial\",\r\n \"MedidaTemperaturaFundoFinal\",\r\n \"MedidaTemperaturaFundoInicial\",\r\n \"MedidaTemperaturaMediaFinal\",\r\n \"MedidaTemperaturaMediaInicial\",\r\n \"MedidaTemperaturaMeioFinal\",\r\n \"MedidaTemperaturaMeioInicial\",\r\n \"MedidaTemperaturaSuperficieFinal\",\r\n \"MedidaTemperaturaSuperficieInicial\",\r\n \"QuantidadeProdutoFinal\",\r\n \"QuantidadeProdutoFinal20GrausCelsius\",\r\n \"QuantidadeProdutoInicial\",\r\n \"QuantidadeProdutoInicial20GrausCelsius\"\r\n ]\r\n },\r\n {\r\n \"property\": [\"ListDetalheRecebimentoProduto\", \"ListSolicitacaoAtualizacaoDetalheRecebimentoProduto\"],\r\n \"key\": \"IdentificadorDetalheRecebimentoProduto\",\r\n \"compareColumns\": [\r\n \"CadAspectoVisual.DscAspectoVisual\",\r\n \"CtrEncerrante.CadBlocoMedidor.SglBlocoMedidor\",\r\n [\"CtrEncerrante.ValEncerranteAtual\", \"CtrEncerrante.QuantidadeEncerrante\"],\r\n // [\"CtrEncerrante.ChkResetAutomatico\", \"CtrEncerrante.IndicadorResetAutomatico\"],\r\n // [\"CtrEncerrante.RegPorEncerrante\", \"CtrEncerrante.IndicadorModoObtencaoEncerrante\"],\r\n \"DataHoraUTCComplemento\",\r\n \"IndicadorPresencaAgua\",\r\n \"MedidaAlturaEspacoVazio\",\r\n \"MedidaDensidadeProduto\",\r\n \"MedidaTemperaturaProduto\",\r\n \"MedidaDensidadeBoletim\",\r\n \"MedidaDensidadeProduto20C\",\r\n \"MedidaTemperaturaMassa\",\r\n \"NomeSistemaOrigemDado\",\r\n \"PesoLiquidoRecebido\",\r\n \"QuantidadeComplementoProduto\",\r\n \"QuantidadeRecebida\",\r\n \"QuantidadeRecebida20GrausCelsius\"\r\n ]\r\n }\r\n ]\r\n },\r\n \"validacaoRecebimentoFiscal\": {\r\n \"serverUrl\": \"_hstRecebimentoFiscal\",\r\n \"entityUrl\": \"_recebimentoFiscal\",\r\n \"entityId\": \"IdentificadorRecebimentoFiscalProduto\",\r\n \"historyId\": \"IdentificadorSolicitacaoAtualizacaoRecebimentoFiscalProduto\",\r\n \"hasValidationFlow\": true,\r\n \"shouldGetFullHistory\": true,\r\n \"displayColumns\": [\r\n \"GrupoRecebimentoFisicoFiscal.CodigoGrupoRecebimento\",\r\n \"CodigoDANFENotaFiscal\",\r\n \"CadProduto.SglProduto\",\r\n \"QuantidadeProdutoNotaFiscal\",\r\n \"DataHoraUTCInicioRecebimentoFiscal\",\r\n \"CadUsuarioResponsavelRecebimento.NomUsuario\"\r\n ],\r\n \"compareColumns\": [\r\n \"CodigoDANFENotaFiscal\",\r\n \"CadProduto.SglProduto\",\r\n \"QuantidadeProdutoNotaFiscal\",\r\n \"DataHoraUTCInicioRecebimentoFiscal\",\r\n \"CadUsuarioResponsavelRecebimento.NomUsuario\",\r\n \r\n \"CadCaminhaoTanque.CodPlaca\",\r\n \"CadCavaloMecanico.CodPlaca\",\r\n \"CadEmpresaFornecedora.NomEmpresa\",\r\n \"CadEmpresaTransportadora.NomEmpresa\",\r\n \"CadMotorista.NomMotorista\",\r\n \"CadPosto.SglPosto\",\r\n \"CadVagaoTanque.CodVagaoTanque\",\r\n \r\n \"DataHoraUTCInicioRecebimentoFiscal\",\r\n \"DataHoraUTCFimRecebimentoFiscal\",\r\n \"CodigoBarrasNotaFiscal\",\r\n \"CodigoDANFENotaFiscal\",\r\n \"CodigoHexadecimalCorLacres\",\r\n \"DataEmissaoNotaFiscal\",\r\n \"DataHoraUTCChegadaCaminhaoPortaria\",\r\n \"DataHoraUTCEntradaCaminhaoPortaria\",\r\n \"DataHoraUTCSaidaCaminhaoPortaria\",\r\n \"DataHoraUTCAgendadaChegadaCaminhaoPortaria\",\r\n \"GrupoRecebimentoFisicoFiscal.CodigoGrupoRecebimento\",\r\n \"IndicadorTipoRecebimento\",\r\n \"NomeSistemaOrigemDado\",\r\n \"NumeroIdentificacaoLacres\",\r\n \"PesoBrutoNotaFiscal\",\r\n \"PesoBrutoVale\",\r\n \"PesoLiquidoNotaFiscal\",\r\n \"PrecoUnitarioProdutoNotaFiscal\",\r\n \"QuantidadeLacres\",\r\n \"QuantidadeProdutoNotaFiscal\"\r\n ]\r\n }\r\n }\r\n });\r\n\r\n\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').config(configHTTP);\r\n\r\n configHTTP.$inject = [\r\n '$httpProvider'\r\n ];\r\n\r\n function configHTTP($httpProvider) {\r\n\r\n $httpProvider.defaults.headers.common[\"user-language\"] = navigator.language;\r\n\r\n $httpProvider.defaults.transformResponse.push(function (data, headerGetter) {\r\n\r\n var type = headerGetter('content-type');\r\n var redirect = headerGetter('redirect');\r\n\r\n if (redirect) {\r\n window.location.href = redirect;\r\n return;\r\n }\r\n\r\n if (type && type.indexOf('application/json') !== -1) {\r\n data = convertDate(data);\r\n }\r\n\r\n return data;\r\n });\r\n\r\n }\r\n\r\n function convertDate(objeto) {\r\n\r\n for (var prop in objeto) {\r\n if (objeto[prop] instanceof Object) {\r\n convertDate(objeto[prop]);\r\n } else if (/^\\d{4}-\\d{2}-\\d{2}/.test(objeto[prop])) {\r\n objeto[prop] = new Date(objeto[prop]);\r\n }\r\n }\r\n\r\n return objeto;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').config(config);\r\n\r\n config.$inject = ['TranslateServiceProvider'];\r\n\r\n function config(TranslateServiceProvider) {\r\n TranslateServiceProvider.resources = TranslateServiceProvider.resources || {};\r\n TranslateServiceProvider.resources['pt-BR'] = ptBRJson;\r\n\r\n }\r\n\r\n})();","(function () {\r\n \"use strict\";\r\n\r\n angular.module(\"posto-facil\").config(Configuration);\r\n\r\n Configuration.$inject = [\r\n \"$stateProvider\",\r\n \"$locationProvider\",\r\n \"$urlRouterProvider\"\r\n ];\r\n\r\n /**\r\n * Configuration Function to Set Up the routes\r\n * @param {object} $stateProvider\r\n * @param {object} $locationProvider\r\n */\r\n function Configuration(\r\n $stateProvider,\r\n $locationProvider,\r\n $urlRouterProvider\r\n ) {\r\n //$locationProvider.html5Mode(true);\r\n $urlRouterProvider.otherwise(\"/\");\r\n\r\n $stateProvider\r\n .state({\r\n name: \"home\",\r\n url: \"/\",\r\n templateUrl: \"home.html\",\r\n privilege: \"Visualizar_Registro_Turno\",\r\n controller: \"HomeController\",\r\n controllerAs: \"home\"\r\n })\r\n .state({\r\n name: \"turno\",\r\n url: \"/turno\",\r\n templateUrl: \"turno.html\",\r\n controller: \"RegTurnoController\",\r\n controllerAs: \"turno\",\r\n menu: \"registro\",\r\n privilege: \"Visualizar_Registro_Turno\",\r\n tabela: \"REG_TURNO\",\r\n icon: \"list-alt\"\r\n })\r\n .state({\r\n name: \"abastecimento\",\r\n url: \"/abastecimento\",\r\n templateUrl: \"abastecimento.html\",\r\n controller: \"AbastecimentoController\",\r\n controllerAs: \"abastecimento\",\r\n menu: \"registro\",\r\n privilege: \"Visualizar_Registro_Abastecimento\",\r\n tabela: \"REG_ABASTECIMENTO\",\r\n icon: \"tint\"\r\n })\r\n .state({\r\n name: \"transferencia\",\r\n url: \"/transferencia\",\r\n templateUrl: \"transferencia.html\",\r\n controller: \"TransferenciaController\",\r\n controllerAs: \"transferencia\",\r\n menu: \"registro\",\r\n privilege: \"Visualizar_Registro_Movimentacao_Posto_Movel\",\r\n tabela: \"V5ETRANT\",\r\n icon: \"random\"\r\n })\r\n .state({\r\n name: \"anomalia\",\r\n url: \"/anomalia\",\r\n controller: \"AnomaliaController\",\r\n controllerAs: \"anomalia\",\r\n menu: \"registro\",\r\n privilege: \"Visualizar_Registro_Anomalia\",\r\n tabela: \"REG_ANOMALIA\",\r\n icon: \"flag\"\r\n })\r\n .state({\r\n name: \"config\",\r\n templateUrl: \"config.html\",\r\n url: \"/config\",\r\n controller: \"ConfigController\",\r\n controllerAs: \"config\",\r\n menu: \"admin\",\r\n privilege: \"Visualizar_Config\"\r\n })\r\n .state({\r\n name: \"imports\",\r\n url: \"/imports\",\r\n templateUrl: \"imports.html\",\r\n controller: \"ImportsController\",\r\n controllerAs: \"imports\",\r\n menu: \"admin\",\r\n privilege: \"Visualizar_Imports\"\r\n })\r\n .state({\r\n name: \"importsRegistro\",\r\n url: \"/importsRegistro\",\r\n templateUrl: \"imports.html\",\r\n controller: \"ImportsRegistroController\",\r\n controllerAs: \"imports\",\r\n menu: \"admin\",\r\n privilege: \"Visualizar_Imports\"\r\n })\r\n .state({\r\n name: \"perfis\",\r\n url: \"/perfis\",\r\n templateUrl: \"perfis.html\",\r\n controller: \"PerfisController\",\r\n controllerAs: \"perfis\",\r\n menu: \"admin\",\r\n privilege: \"Visualizar_Perfis\",\r\n tabela: \"V40PERFT\"\r\n })\r\n\r\n .state({\r\n name: \"estorno\",\r\n url: \"/estorno\",\r\n templateUrl: \"estorno.html\",\r\n controller: \"EstornoController\",\r\n controllerAs: \"estorno\",\r\n menu: \"admin\",\r\n privilege: \"Visualizar_Registro_Recebimento_Fiscal\",//\"Visualizar_Registro_Estorno\",\r\n tabela: \"REG_ESTORNO\",\r\n icon: \"flag\"\r\n })\r\n .state({\r\n name: \"recebimentos\",\r\n url: \"/recebimentos\",\r\n templateUrl: \"recebimentos.html\",\r\n controller: \"RecebimentosController\",\r\n controllerAs: \"recebimentos\",\r\n menu: \"registro\",\r\n privilege: \"Visualizar_Registro_Recebimento_Fisico\",\r\n tabela: \"V5IGRECT\",\r\n icon: \"list\"\r\n })\r\n .state({\r\n name: \"recebimentoFisico\",\r\n url: \"/recebimentoFisico\",\r\n templateUrl: \"recebimentoFisico.html\",\r\n controller: \"RecebimentoFisicoController\",\r\n controllerAs: \"recebimentoFisico\",\r\n privilege: \"Visualizar_Registro_Recebimento_Fisico\",\r\n tabela: \"V5FREFCT\",\r\n icon: \"download\"\r\n })\r\n /*.state({\r\n \tname: 'cadComplexo',\r\n \turl: '/complexo',\r\n \ttemplateUrl: 'complexo.html',\r\n \tcontroller: 'ComplexoController',\r\n \tcontrollerAs: 'cadComplexo',\r\n \tmenu: 'cadastros',\r\n \tprivilege: 'Visualizar_Cadastro_Complexo'\r\n })\r\n\r\n .state({\r\n \tname: 'cadDiretoria',\r\n \turl: '/diretoria',\r\n \ttemplateUrl: 'diretoria.html',\r\n \tcontroller: 'DiretoriaController',\r\n \tcontrollerAs: 'cadDiretoria',\r\n \tmenu: 'cadastros',\r\n \tprivilege: 'Visualizar_Cadastro_Diretoria'\r\n })\r\n .state({\r\n \tname: 'cadUnidade',\r\n \turl: '/unidade',\r\n \ttemplateUrl: 'unidade.html',\r\n \tcontroller: 'UnidadeController',\r\n \tcontrollerAs: 'cadUnidade',\r\n \tmenu: 'cadastros',\r\n \tprivilege: 'Visualizar_Cadastro_Unidade'\r\n })*/\r\n // .state({\r\n // \tname: 'cadNivelAnomalia',\r\n // \turl: '/nivelAnomalia',\r\n // \ttemplateUrl: 'nivelAnomalia.html',\r\n // \tcontroller: 'NivelAnomaliaController',\r\n // \tcontrollerAs: 'cadNivelAnomalia',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Anomalia'\r\n // })\r\n // .state({\r\n // \tname: 'cadGerencia',\r\n // \turl: '/gerencia',\r\n // \ttemplateUrl: 'gerencia.html',\r\n // \tcontroller: 'GerenciaController',\r\n // \tcontrollerAs: 'cadGerencia',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Gerencia'\r\n // })\r\n // .state({\r\n // \tname: 'cadElementoPep',\r\n // \turl: '/ElementoPep',\r\n // \ttemplateUrl: 'elementoPep.html',\r\n // \tcontroller: 'ElementoPepController',\r\n // \tcontrollerAs: 'cadElementoPep',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Elemento_PEP'\r\n // })\r\n // .state({\r\n // \tname: 'cadCentroCusto',\r\n // \turl: '/CentroCusto',\r\n // \ttemplateUrl: 'centroCusto.html',\r\n // \tcontroller: 'CentroCustoController',\r\n // \tcontrollerAs: 'cadCentroCusto',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Centro_de_Custo'\r\n // })\r\n // .state({\r\n // \tname: 'cadOrdemEstatistica',\r\n // \turl: '/OrdemEstatistica',\r\n // \ttemplateUrl: 'ordemEstatistica.html',\r\n // \tcontroller: 'OrdemEstatisticaController',\r\n // \tcontrollerAs: 'cadOrdemEstatistica',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Ordem_Estatistica'\r\n // })\r\n\r\n // .state({\r\n // \tname: 'cadCaminhaoTanque',\r\n // \turl: '/CaminhaoTanque',\r\n // \ttemplateUrl: 'caminhaoTanque.html',\r\n // \tcontroller: 'CaminhaoTanqueController',\r\n // \tcontrollerAs: 'cadCaminhaoTanque',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Caminhao_Tanque'\r\n // })\r\n .state({\r\n name: 'cadNavioTanque',\r\n url: '/NavioTanque',\r\n templateUrl: 'navioTanque.html',\r\n controller: 'NavioTanqueController',\r\n controllerAs: 'cadNavioTanque',\r\n menu: 'cadastros',\r\n privilege: 'Visualizar_Cadastro_Caminhao_Tanque'\r\n })\r\n // .state({\r\n // \tname: 'cadMotorista',\r\n // \turl: '/Motorista',\r\n // \ttemplateUrl: 'motorista.html',\r\n // \tcontroller: 'MotoristaController',\r\n // \tcontrollerAs: 'cadMotorista',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Motorista'\r\n // })\r\n // .state({\r\n // \tname: 'cadEmpresaClassificacao',\r\n // \turl: '/EmpresaClassificacao',\r\n // \ttemplateUrl: 'empresaClassificacao.html',\r\n // \tcontroller: 'EmpresaClassificacaoController',\r\n // \tcontrollerAs: 'cadEmpresaClassificacao',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Motorista'//Visualizar_Cadastro_Empresa verificar com o sherman\r\n // })\r\n // .state({\r\n // \tname: 'cadEmpresa',\r\n // \turl: '/Empresa',\r\n // \ttemplateUrl: 'empresa.html',\r\n // \tcontroller: 'EmpresaController',\r\n // \tcontrollerAs: 'cadEmpresa',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Motorista'//Visualizar_Cadastro_Empresa verificar com o sherman\r\n // })\r\n // .state({\r\n // \tname: 'cadEquipamentoMarca',\r\n // \turl: '/EquipamentoMarca',\r\n // \ttemplateUrl: 'equipamentoMarca.html',\r\n // \tcontroller: 'EquipamentoMarcaController',\r\n // \tcontrollerAs: 'cadEquipamentoMarca',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Marca_Equipamento'\r\n // })\r\n // .state({\r\n // \tname: 'cadEquipamentoModelo',\r\n // \turl: '/EquipamentoModelo',\r\n // \ttemplateUrl: 'equipamentoModelo.html',\r\n // \tcontroller: 'EquipamentoModeloController',\r\n // \tcontrollerAs: 'cadEquipamentoModelo',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Modelo_Equipamento'\r\n // })\r\n // .state({\r\n // \tname: 'cadEquipamentoTipoGri',\r\n // \turl: '/EquipamentoTipoGri',\r\n // \ttemplateUrl: 'equipamentoTipoGri.html',\r\n // \tcontroller: 'EquipamentoTipoGriController',\r\n // \tcontrollerAs: 'cadEquipamentoTipoGri',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_TipoGRI_Equipamento'\r\n // })\r\n .state({\r\n \tname: 'cadBlocoMedidor',\r\n \turl: '/BlocoMedidor',\r\n \ttemplateUrl: 'blocoMedidor.html',\r\n \tcontroller: 'BlocoMedidorController',\r\n \tcontrollerAs: 'cadBlocoMedidor',\r\n \tmenu: 'cadastros',\r\n \tprivilege: 'Visualizar_Cadastro_BlocoMedidor'\r\n })\r\n /* .state({\r\n \tname: 'cadTurno',\r\n \turl: '/CadTurno',\r\n \ttemplateUrl: 'cadTurno.html',\r\n \tcontroller: 'CadTurnoController',\r\n \tcontrollerAs: 'cadTurno',\r\n \tmenu: 'cadastros',\r\n \tprivilege: 'Visualizar_Cadastro_Turno'\r\n })*/\r\n // .state({\r\n // \tname: 'cadTipoFiscal',\r\n // \turl: '/TipoFiscal',\r\n // \ttemplateUrl: 'tipoFiscal.html',\r\n // \tcontroller: 'TipoFiscalController',\r\n // \tcontrollerAs: 'cadTipoFiscal',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Tipo_Fiscal'\r\n // })\r\n .state({\r\n name: \"cadEquipamento\",\r\n url: \"/Equipamento\",\r\n templateUrl: \"equipamento.html\",\r\n controller: \"EquipamentoController\",\r\n controllerAs: \"cadEquipamento\",\r\n menu: \"cadastros\",\r\n privilege: \"Visualizar_Cadastro_Equipamento\"\r\n })\r\n // .state({\r\n // \tname: 'cadContrato',\r\n // \turl: '/Contrato',\r\n // \ttemplateUrl: 'contrato.html',\r\n // \tcontroller: 'ContratoController',\r\n // \tcontrollerAs: 'cadContrato',\r\n // \tmenu: 'cadastros',\r\n // \tprivilege: 'Visualizar_Cadastro_Contrato'\r\n // })\r\n .state({\r\n name: \"validacaoEquipamento\",\r\n url: \"/validacaoEquipamento\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_Equipamento\"\r\n })\r\n .state({\r\n name: \"validacaoAbastecimento\",\r\n url: \"/validacaoAbastecimento\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_Alteracao_Abastecimento\"\r\n })\r\n .state({\r\n name: \"validacaoTurno\",\r\n url: \"/validacaoTurno\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_Alteracao_Turno\"\r\n })\r\n .state({\r\n name: \"validacaoAfericaoBloco\",\r\n url: \"/validacaoAfericaoBloco\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_Alteracao_Afericao\"\r\n })\r\n .state({\r\n name: \"validacaoTransferencia\",\r\n url: \"/validacaoTransferencia\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_Transferencia\"\r\n })\r\n .state({\r\n name: \"validacaoRecebimentoFisico\",\r\n url: \"/validacaoRecebimentoFisico\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_RecebimentoFisico\"\r\n })\r\n .state({\r\n name: \"validacaoRecebimentoFiscal\",\r\n url: \"/validacaoRecebimentoFiscal\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_RecebimentoFiscal\"\r\n })\r\n .state({\r\n name: \"validacaoPosto\",\r\n url: \"/validacaoPosto\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_Posto\"\r\n })\r\n .state({\r\n name: \"validacaoUsuario\",\r\n url: \"/validacaoUsuario\",\r\n templateUrl: \"validacao.html\",\r\n controller: \"ValidacaoController\",\r\n controllerAs: \"validacao\",\r\n menu: \"validacao\",\r\n privilege: \"Validar_Usuario\"\r\n })\r\n .state({\r\n name: \"validacaoEquipamento.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_Equipamento\"\r\n })\r\n .state({\r\n name: \"validacaoAbastecimento.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_Alteracao_Abastecimento\"\r\n })\r\n .state({\r\n name: \"validacaoTurno.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_Alteracao_Turno\"\r\n })\r\n .state({\r\n name: \"validacaoAfericaoBloco.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_Alteracao_Afericao\"\r\n })\r\n .state({\r\n name: \"validacaoTransferencia.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_Transferencia\"\r\n })\r\n .state({\r\n name: \"validacaoRecebimentoFisico.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_RecebimentoFisico\"\r\n })\r\n .state({\r\n name: \"validacaoRecebimentoFiscal.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_RecebimentoFiscal\"\r\n })\r\n .state({\r\n name: \"validacaoPosto.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_Posto\"\r\n })\r\n .state({\r\n name: \"validacaoUsuario.detalhe\",\r\n url: \"/detalhe\",\r\n templateUrl: \"validacaoDetalhe.html\",\r\n controller: \"ValidacaoDetalheController\",\r\n controllerAs: \"detalhe\",\r\n privilege: \"Validar_Usuario\"\r\n })\r\n .state({\r\n name: \"cargaMassa\",\r\n url: \"/cargaMassa\",\r\n templateUrl: \"cargaMassa.html\",\r\n controller: \"CargaMassaController\",\r\n controllerAs: \"cargaMassa\",\r\n menu: \"registro\",\r\n privilege: \"Visualizar_Validacao_Carga_em_Massa\",\r\n icon: \"sort\"\r\n\r\n })\r\n .state({\r\n name: \"integracaoTibco\",\r\n url: \"/integracaoTibco\",\r\n templateUrl: \"integracaoTibco.html\",\r\n controller: \"integracaoTibcoController\",\r\n controllerAs: \"integracaoTibco\",\r\n menu: \"admin\",\r\n privilege: \"Visualizar_Imports\"\r\n })\r\n .state({\r\n name: \"Importação de Registro em Massa\",\r\n url: \"/importcargaemmassa\",\r\n templateUrl: \"importCargaEmMassa.html\",\r\n controller: \"importCargaEmMassaController\",\r\n controllerAs: \"importCargaEmMassa\",\r\n menu: \"registro\",\r\n privilege: \"Validar_Equipamento\",\r\n tabela: \"HST_CARGAEMMASSA\",\r\n icon: \"new-window\"\r\n })\r\n .state({\r\n name: \"painelDeEstoque\",\r\n url: \"/paineldeestoque\",\r\n templateUrl: \"painelDeEstoque.html\",\r\n controller: \"PainelDeEstoqueController\",\r\n controllerAs: \"painelDeEstoque\",\r\n menu: \"registro\",\r\n privilege: \"Validar_Equipamento\",\r\n tabela: \"REG_INPUT_PAINEL_ESTOQUE\",\r\n icon: \"glyphicon glyphicon-modal-window\"\r\n })\r\n .state({\r\n name: \"contingencia\",\r\n url: \"/contingencia\",\r\n templateUrl: \"contingencia.html\",\r\n controller: \"ContingenciaController\",\r\n controllerAs: \"contingencia\",\r\n menu: \"registro\",\r\n privilege: \"Visualizar_Registro_Abastecimento\",\r\n icon: \"indent-left\"\r\n })\r\n .state({\r\n name: \"users\",\r\n url: \"/usuarios\",\r\n templateUrl: \"usuarios.html\",\r\n controller: \"UsuariosController\",\r\n controllerAs: \"usuarios\",\r\n menu: \"admin\",\r\n privilege: \"Visualizar_Registro_Abastecimento\",\r\n icon: \"indent-left\"\r\n })\r\n\r\n .state({\r\n name: \"cadPosto\",\r\n url: \"/posto\",\r\n templateUrl: \"posto.html\",\r\n controller: \"PostoController\",\r\n controllerAs: \"cadPosto\",\r\n menu: \"cadastros\",\r\n privilege: \"Visualizar_Validacao_Carga_em_Massa\",\r\n icon: \"indent-left\"\r\n })\r\n }\r\n})();\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').run(Configuration);\r\n\r\n Configuration.$inject = [\r\n '$timeout',\r\n 'Constant',\r\n 'AbastecimentoModel',\r\n 'SelTurnoService'\r\n ];\r\n\r\n /**\r\n * Configura a sincronizãção periódica de encerrantes\r\n */\r\n function Configuration(\r\n $timeout,\r\n Constant,\r\n AbastecimentoModel,\r\n SelTurnoService\r\n ) {\r\n (function sincronizaAbastecimentos() {\r\n var onLine = navigator.onLine !== false;\r\n\r\n if (SelTurnoService.turno && SelTurnoService.turno.IdcRegTurno && onLine) {\r\n AbastecimentoModel.populaBanco(SelTurnoService.turno.IdcRegTurno)\r\n .then(function () {\r\n $timeout(sincronizaAbastecimentos, Constant.TIME_TO_SYNC_ABASTECIMENTOS);\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n $timeout(sincronizaAbastecimentos, Constant.TIME_TO_SYNC_ABASTECIMENTOS);\r\n });\r\n } else {\r\n $timeout(sincronizaAbastecimentos, Constant.TIME_TO_SYNC_ABASTECIMENTOS);\r\n }\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').run(Configuration);\r\n\r\n Configuration.$inject = [\r\n '$timeout',\r\n 'Constant',\r\n 'CtrEncerranteModel',\r\n 'SelTurnoService'\r\n ];\r\n\r\n /**\r\n * Configura a sincronizãção periódica de encerrantes\r\n */\r\n function Configuration(\r\n $timeout,\r\n Constant,\r\n CtrEncerranteModel,\r\n SelTurnoService\r\n ) {\r\n (function sincronizaEncerrantes() {\r\n var onLine = navigator.onLine !== false;\r\n\r\n if (SelTurnoService.turno && SelTurnoService.turno.IdcRegTurno && onLine) {\r\n CtrEncerranteModel.populaBanco(SelTurnoService.turno.IdcRegTurno)\r\n .then(function () {\r\n $timeout(sincronizaEncerrantes, Constant.TIME_TO_SYNC_ENCERRANTES);\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n $timeout(sincronizaEncerrantes, Constant.TIME_TO_SYNC_ENCERRANTES);\r\n });\r\n } else {\r\n $timeout(sincronizaEncerrantes, Constant.TIME_TO_SYNC_ENCERRANTES);\r\n }\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').run(Configuration);\r\n\r\n Configuration.$inject = [\r\n '$transitions',\r\n '$state',\r\n 'TransitionService',\r\n 'ModalService',\r\n 'MessageService',\r\n 'PrivilegesService',\r\n 'TranslateService'\r\n ];\r\n\r\n function Configuration(\r\n $transitions,\r\n $state,\r\n TransitionService,\r\n ModalService,\r\n MessageService,\r\n PrivilegesService,\r\n TranslateService\r\n ) {\r\n $transitions.onBefore({}, function (trans) {\r\n var current = $state.current.name;\r\n\r\n if (trans.$to().self.privilege &&\r\n !hasPermission(trans.$to().self.privilege)\r\n ) {\r\n window.location.hash = '';\r\n return false;\r\n }\r\n\r\n\r\n if (TransitionService.rotasAlteradas[current]) {\r\n return MessageService.prompt(TranslateService('exit-confirmation'))\r\n .then(function () {\r\n TransitionService.clearCurrent();\r\n });\r\n } else {\r\n return true;\r\n }\r\n });\r\n\r\n $transitions.onFinish({}, function (trans) {\r\n if (TransitionService.updateReady) {\r\n window.location.reload();\r\n }\r\n });\r\n\r\n function hasPermission(privilege) {\r\n return PrivilegesService.includes(privilege);\r\n }\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').run(run);\r\n\r\n run.$inject = [\r\n 'TranslateService',\r\n '$rootScope'\r\n ];\r\n\r\n function run(\r\n TranslateService,\r\n $rootScope\r\n ) {\r\n $rootScope.trans = TranslateService;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('AbastecimentoController', AbastecimentoController);\r\n AbastecimentoController.$inject = [\r\n 'SelTurnoService',\r\n 'BlocoMedidorModel',\r\n 'AbastecimentoModel',\r\n 'ModalService',\r\n '$timeout',\r\n 'ValidacaoService',\r\n 'TransitionService',\r\n 'GeneralModel',\r\n 'FocusService',\r\n 'MessageService',\r\n 'RegAnomaliaService',\r\n 'Constant',\r\n 'CtrHorHodModel',\r\n '$filter',\r\n '$q',\r\n 'UsuarioService',\r\n 'CadEquipamentoModel',\r\n 'TranslateService',\r\n 'CheckAbastecimento',\r\n 'RegEstornoModel'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function AbastecimentoController(\r\n SelTurnoService,\r\n BlocoMedidorModel,\r\n AbastecimentoModel,\r\n ModalService,\r\n $timeout,\r\n validacao,\r\n TransitionService,\r\n GeneralModel,\r\n focus,\r\n MessageService,\r\n RegAnomaliaService,\r\n Constant,\r\n CtrHorHodModel,\r\n $filter,\r\n $q,\r\n UsuarioService,\r\n CadEquipamentoModel,\r\n TranslateService,\r\n CheckAbastecimento,\r\n RegEstornoModel\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var abastecimento = this;\r\n\r\n //Propriedades privadas\r\n var modalTanque = new ModalService({\r\n templateUrl: 'abastecimentoTanque.html',\r\n controller: 'AbastecimentoTanqueController',\r\n controllerAs: 'abTanque'\r\n });\r\n function InicializaVariaveis() {\r\n\r\n //Propriedades públicas\r\n abastecimento.SelTurnoService = SelTurnoService;\r\n abastecimento.validacao = validacao;\r\n abastecimento.listaAbastecimento = null;\r\n abastecimento.selected = null;\r\n abastecimento.regTanqueSelected = null;\r\n abastecimento.filtro = null;\r\n abastecimento.isTelaConsuta = true;\r\n abastecimento.changeTimeout = null;\r\n abastecimento.msgValidaTag = TranslateService('invalid-equipment');\r\n abastecimento.tagPlacaValida = false;\r\n abastecimento.Anomalias = [];\r\n abastecimento.status = Constant.NOVO;\r\n abastecimento.Constant = Constant;\r\n abastecimento.blocosMedidores = null;\r\n abastecimento.isEmAvaliacao = false;\r\n abastecimento.abastecimentoEstornado = false;\r\n }\r\n InicializaVariaveis();\r\n //Métodos privados\r\n function onChangeTurno(regTurno) {\r\n if (!regTurno || !regTurno.IdcRegTurno) { return; }\r\n\r\n abastecimento.getAbastecimentos(regTurno.IdcRegTurno);\r\n }\r\n\r\n function setValido(abastecimento) {\r\n if (abastecimento &&\r\n abastecimento.listAbastecimentoTanque &&\r\n abastecimento.listAbastecimentoTanque.length) {\r\n angular.forEach(abastecimento.listAbastecimentoTanque, function (tanque) {\r\n tanque.valido = true;\r\n });\r\n return abastecimento;\r\n }\r\n }\r\n\r\n function salvarServidor(formAbastecimento) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n return new $q(function (resolve, reject) {\r\n\r\n abastecimento.selected.ValHorHod = abastecimento.selected.ValHorHod || 0;\r\n abastecimento.selected.NomDispositivo = \"WEB-MOBILE\";\r\n if (abastecimento.selected.dataFinalOriginal) {\r\n abastecimento.selected.DthFinal = validacao.getNowTurno();\r\n }\r\n\r\n if (!abastecimento.selected || !abastecimento.selected.listAbastecimentoTanque) {\r\n reject({ refresh: true, message: function () { MessageService.alert(TranslateService('error'), TranslateService('invalid-refueling-data'), null, 'Erro') } });\r\n return;\r\n }\r\n\r\n var tanqueIndexToremove = [];\r\n\r\n //TODO - Por algum motivo existem duas propriedades. Deve-se verificar para que exista uma só\r\n abastecimento.selected.listAbastecimentoTanque.forEach(function (tanque, index) {\r\n tanque.ValEncerranteAbastecimento = tanque.ValEncerrante;\r\n if (!(tanque.IdcBlocoMedidor && tanque.ValEncerrante)) {\r\n tanqueIndexToremove.push(index);\r\n }\r\n });\r\n\r\n for (var i = tanqueIndexToremove.length - 1; i >= 0; i--) {\r\n var itemsToRemove = 1;\r\n abastecimento.selected.listAbastecimentoTanque.splice(tanqueIndexToremove[i], itemsToRemove);\r\n }\r\n\r\n //Guarda as anomalias registradas dentro do registro do abastecimento e limpa a lista geral de anomalias\r\n abastecimento.selected.Anomalias = abastecimento.Anomalias;\r\n abastecimento.Anomalias = [];\r\n\r\n abastecimento.selected.SglPosto = abastecimento.SelTurnoService.turno.SglPosto;\r\n abastecimento.selected.VolumeTotal = abastecimento.selected.listAbastecimentoTanque[0].VolAbastecimento;\r\n\r\n var abastecimentoAux = abastecimento.selected;\r\n AbastecimentoModel.verificaAbastecimentoEncavalado(abastecimento.selected).then(function (resposta) {\r\n AbastecimentoModel.verificaAbastecimentoExistente(abastecimento.selected)\r\n .then(function (resposta) {\r\n if (resposta == \"repeted\") {\r\n var dataFormatada = $filter('date')(abastecimentoAux.DthInicial, TranslateService('datetime-format'));\r\n reject({ refresh: true, message: function () { MessageService.alert(TranslateService('apont-ja-exist-equip-data', abastecimentoAux.CodTagPlacaEqp, dataFormatada)) } });\r\n }else{\r\n if((resposta != \"\")){\r\n MessageService.prompt(\r\n TranslateService('apont-ja-exist-equip-turno', abastecimentoAux.CodTagPlacaEqp, resposta)\r\n ).then(function (confirm) {\r\n abastecimento.salvaAbastecimento(abastecimentoAux, SelTurnoService.isFechado())\r\n .then(function (success) { resolve(success) })\r\n .catch(function (error) { reject(error) });\r\n }).catch(function (cancel) { reject({ refresh: true, message: undefined }) });\r\n }else{\r\n abastecimento.salvaAbastecimento(abastecimentoAux, SelTurnoService.isFechado())\r\n .then(function (success) { resolve(success) })\r\n .catch(function (error) { reject(error) });\r\n }\r\n }\r\n\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n reject({ refresh: true, message: undefined });\r\n });\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n reject({ refresh: false, message: function () { MessageService.alert(TranslateService('saving-failed'), erro) } });\r\n\r\n });\r\n });\r\n }\r\n\r\n abastecimento.salvaAbastecimento = function (regAbastecimento, turnoFechado) {\r\n return new $q(function (resolve, reject) {\r\n AbastecimentoModel.salvaAbastecimento(regAbastecimento, turnoFechado)\r\n .then(function (resposta) {\r\n if (resposta && resposta.StatusSalvamento) {\r\n abastecimento.getAbastecimentos(SelTurnoService.turno.IdcRegTurno);\r\n abastecimento.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true; \r\n resolve({ refresh: true, message: function () { MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\") } });\r\n //validacao.resetForm(formAbastecimento);\r\n } else {\r\n throw new Error(TranslateService('saving-failed'));\r\n }\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n reject({ refresh: true, message: function () { MessageService.alert(TranslateService('error'), erro) } });\r\n });\r\n });\r\n };\r\n\r\n abastecimento.retornaTempoAbastecimento = function (regAbastecimento) {\r\n var diff = regAbastecimento.DthFinal - regAbastecimento.DthInicial;\r\n var hours = Math.floor(diff / 3.6e6);\r\n var minutes = Math.floor((diff % 3.6e6) / 6e4);\r\n var seconds = Math.floor((diff % 6e4) / 1000);\r\n\r\n if (isNaN(diff) || isNaN(hours) || isNaN(minutes) || isNaN(seconds)) {\r\n return TranslateService('data-invalida');\r\n }\r\n else {\r\n return (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds);\r\n }\r\n };\r\n\r\n function isProdutoEquipamentoCompativel(abastecimento) {\r\n return BlocoMedidorModel.getByIdcPosto(SelTurnoService.turno.IdcPosto, SelTurnoService.turno.IdcRegTurno)\r\n .then(function (blocos) {\r\n var listBlocosInvalidos = [];\r\n var blocoProximoVenc = [];\r\n var proximoAVenc = [];\r\n var listInvalidos = [];\r\n var msgReturn = \"\";\r\n var produtoValido = false;\r\n for (var indexBloco in blocos) {\r\n var bloco = blocos[indexBloco];\r\n\r\n if (bloco.ChkBloqueioCertificadoVencido) {\r\n if (bloco.IsBlocoInvalido) {\r\n listBlocosInvalidos.push(bloco);\r\n }\r\n else if (bloco.DthVencCertificado != null) {\r\n if (bloco.IsBlocoAVencer) {\r\n blocoProximoVenc.push(bloco);\r\n }\r\n }\r\n }\r\n for (var indexTanque in abastecimento.listAbastecimentoTanque) {\r\n var tanque = abastecimento.listAbastecimentoTanque[indexTanque];\r\n for (var indexProduto in tanque.listProdutoTanque) {\r\n var produtoAbastecimento = tanque.listProdutoTanque[indexProduto];\r\n if (produtoAbastecimento.IdcProduto === bloco.IdcProduto && bloco.StuBlocoMedidor === 'S') {\r\n produtoValido = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (blocoProximoVenc.length > 0) {\r\n for (var i in blocoProximoVenc) {\r\n if (!proximoAVenc.includes(blocoProximoVenc[i].SglBlocoMedidor)) {\r\n proximoAVenc.push(blocoProximoVenc[i].SglBlocoMedidor);\r\n }\r\n }\r\n if (blocoProximoVenc.length > 1) {\r\n msgReturn += TranslateService('refueling-some-next-expiration-measuring') + proximoAVenc.join();\r\n } else {\r\n msgReturn += '\\n' + TranslateService('refueling-next-expiration-measuring') + blocoProximoVenc[i].SglBlocoMedidor;\r\n }\r\n }\r\n\r\n\r\n if (abastecimento.ChkContingencia) {\r\n msgReturn += TranslateService('equipamento-faz-contingencia');\r\n }\r\n\r\n if (listBlocosInvalidos.length > 0) {\r\n\r\n if (listBlocosInvalidos.length === blocos.length) {\r\n throw new Error(TranslateService('refueling-measuring-invalid'));\r\n } else {\r\n msgReturn += '\\n' + TranslateService('refueling-some-measuring-invalid');\r\n\r\n for (var i in listBlocosInvalidos) {\r\n if (!listInvalidos.includes(listBlocosInvalidos[i].SglBlocoMedidor)) {\r\n listInvalidos.push(listBlocosInvalidos[i].SglBlocoMedidor);\r\n }\r\n }\r\n if (listBlocosInvalidos.length > 1) {\r\n msgReturn += listInvalidos.join();\r\n } else {\r\n msgReturn += listBlocosInvalidos[i].SglBlocoMedidor;\r\n }\r\n }\r\n }\r\n\r\n if (!produtoValido) {\r\n throw new Error(TranslateService('refueling-incompatible-product'));\r\n }\r\n return msgReturn;\r\n });\r\n }\r\n\r\n function atualizaAbastecimentoSelected(resposta, tagPlaca) {\r\n var online = navigator.onLine;\r\n\r\n if (!resposta || resposta === 'null') {\r\n abastecimento.tagPlacaValida = false;\r\n abastecimento.msgValidaTag = TranslateService('non-existing-equipment');\r\n abastecimento.selected = {};\r\n abastecimento.selected.CodTagPlacaEqp = tagPlaca;\r\n return $q.reject();\r\n } else if (resposta.DthVencimentoContrato < new Date()) {\r\n var dataFormatada = $filter('date')(resposta.DthVencimentoContrato, TranslateService('date-format'));\r\n abastecimento.tagPlacaValida = false;\r\n abastecimento.msgValidaTag = TranslateService('expired-contract') + dataFormatada;\r\n abastecimento.selected = {};\r\n abastecimento.selected.CodTagPlacaEqp = tagPlaca;\r\n return $q.reject();\r\n } else {\r\n return isProdutoEquipamentoCompativel(resposta)\r\n .then(function (resValidation) {\r\n abastecimento.msgTagWarning = resValidation;\r\n abastecimento.tagPlacaValida = true;\r\n abastecimento.selected = resposta;\r\n abastecimento.selected.dataFinalOriginal = true;\r\n abastecimento.selected.IdcPosto = SelTurnoService.turno.IdcPosto;\r\n abastecimento.selected.IdcRegTurno = SelTurnoService.turno.IdcRegTurno;\r\n abastecimento.selected.DthInicial = validacao.getNowTurno();\r\n abastecimento.selected.DthFinal = validacao.getNowTurnoMaisUmMinuto();\r\n abastecimento.selected.duracao = abastecimento.retornaTempoAbastecimento(abastecimento.selected);\r\n abastecimento.selected.HodHorValido = false;\r\n abastecimento.selected.ValHorHod = null;\r\n abastecimento.selected.MaxHor = online\r\n ? abastecimento.selected.UltimoHorHod + (dateDiffInDays(resposta.DthCtrHorHod, abastecimento.selected.DthInicial)) \r\n : 9999999999\r\n abastecimento.selected.NomeOperador = UsuarioService.nome;\r\n abastecimento.selected.listAbastecimentoTanque.forEach(function (tanque) {\r\n tanque.DthAbastecimentoTanque = abastecimento.selected.DthInicial;\r\n tanque.ValEncerrante = null;\r\n tanque.valido = true;\r\n });\r\n\r\n abastecimento.changeHorimetro();\r\n\r\n return $q.resolve();\r\n })\r\n .catch(function (error) {\r\n abastecimento.tagPlacaValida = false;\r\n abastecimento.msgValidaTag = error.message;\r\n abastecimento.selected = {};\r\n abastecimento.selected.CodTagPlacaEqp = tagPlaca;\r\n return $q.reject();\r\n });\r\n }\r\n }\r\n\r\n function preencheAbastecimento(regAbastecimento) {\r\n var retorno = {\r\n \"Anomalias\": null,\r\n \"ChkHorimetro\": false,\r\n \"ChkResetAutomaticoHorHod\": false,\r\n \"CodTagPlacaEqp\": \"\",\r\n \"ContratoVencido\": true,\r\n \"DscGerenciaGa\": null,\r\n \"DthCriacaoReg\": new Date,\r\n \"DthFinal\": new Date,\r\n \"DthInicial\": new Date,\r\n \"DthVencimentoContrato\": new Date,\r\n \"IdcAbastecimento\": 0,\r\n \"IdcCentroCusto\": 0,\r\n \"CodCentroCusto\": \"\",\r\n \"IdcContrato\": 0,\r\n \"IdcElementoPep\": 0,\r\n \"CodElementoPep\": \"\",\r\n \"IdcEmpresa\": 0,\r\n \"IdcEquipamento\": 0,\r\n \"IdcGri\": 0,\r\n \"IdcOrdemEstatistica\": 0,\r\n \"CodOrdemEstatistica\": \"\",\r\n \"IdcPosto\": 0,\r\n \"IdcRegTurno\": 0,\r\n \"IdcTipoFiscal\": 0,\r\n \"IdcTransferencia\": null,\r\n \"IdcUsuario\": 0,\r\n \"IsLocomotiva\": false,\r\n \"IsWaitingApprovalChange\": false,\r\n \"ListTanques\": [],\r\n \"NomDispositivo\": null,\r\n \"NomEmpresa\": \"\",\r\n \"NomeOperador\": \"\",\r\n \"NumDigitos\": 0,\r\n \"PendenteAvaliacao\": false,\r\n \"PossuiHorHod\": false,\r\n \"SglGerenciaGa\": null,\r\n \"SglTurno\": \"\",\r\n \"StatusSalvamento\": 0,\r\n \"StuAbastecimento\": null,\r\n \"TanquesLiberadosParaAbastecimento\": 0,\r\n \"TipoEquipamento\": \"\",\r\n \"UltimoHorHod\": 0,\r\n \"ValHorHod\": 0,\r\n \"VolumeTotal\": 0,\r\n \"key\": 0\r\n };\r\n\r\n for (var key in regAbastecimento) {\r\n retorno[key] = regAbastecimento[key];\r\n }\r\n\r\n for (var i in regAbastecimento.listAbastecimentoTanque) {\r\n regAbastecimento.listAbastecimentoTanque[i] = preencheAbastecimentoTanque(regAbastecimento.listAbastecimentoTanque[i]);\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function preencheAbastecimentoTanque(regAbastecimentoTanque) {\r\n var retorno = {\r\n \"ChkAbastecimentoTanque\": 0,\r\n \"ChkResetAutomaticoBlocoMedidor\": false,\r\n \"ChkResetAutomaticoEncerrante\": false,\r\n \"DenAbastecimento\": null,\r\n \"DscClasseProduto\": null,\r\n \"DscProduto\": null,\r\n \"DscTanqueEquipamento\": \"EQP-TQ-001\",\r\n \"DscTipoProduto\": null,\r\n \"DthAbastecimentoTanque\": \"/Date(-62135589600000)/\",\r\n \"DthCriacaoReg\": \"/Date(-62135589600000)/\",\r\n \"EncerranteValido\": false,\r\n \"IdcAbastecimento\": 0,\r\n \"IdcAbastecimentoTanque\": 0,\r\n \"IdcBlocoMedidor\": 0,\r\n \"IdcCargaMassa\": null,\r\n \"IdcEquipamento\": 1,\r\n \"IdcProduto\": 0,\r\n \"IdcRateio\": null,\r\n \"IdcTanqueEquipamento\": 1,\r\n \"IdcUsuMan\": null,\r\n \"RegPorEncerrante\": null,\r\n \"RegEstornado\": false,\r\n \"SglBlocoMedidor\": null,\r\n \"SglProduto\": null,\r\n \"StuEnvioSap\": \"\",\r\n \"TmpAbastecimento\": null,\r\n \"UeFator\": 1,\r\n \"ValCapacidadeNominal\": 300,\r\n \"ValConsumoEsp\": 0,\r\n \"ValEncerrante\": 0,\r\n \"ValEncerranteAbastecimento\": null,\r\n \"VolAbastecimento\": null,\r\n \"VolAbastecimento20c\": null,\r\n \"VolAtual\": null,\r\n \"idDataGrid\": 1,\r\n \"key\": 0,\r\n \"listAnomalia\": []\r\n };\r\n\r\n for (var key in regAbastecimentoTanque) {\r\n retorno[key] = regAbastecimentoTanque[key];\r\n }\r\n\r\n for (var i in regAbastecimentoTanque.listProdutoTanque) {\r\n regAbastecimentoTanque.listProdutoTanque[i] = preencheRelProduto(regAbastecimentoTanque.listProdutoTanque[i]);\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function preencheRelProduto(relProduto) {\r\n var retorno = {\r\n \"DscClasse\": \"COMBUSTIVEL\",\r\n \"DscTipo\": \"DIESEL\",\r\n \"IdcProduto\": 2,\r\n \"SglProduto\": \"S500\",\r\n \"length\": 1,\r\n \"listAnomalia\": []\r\n };\r\n\r\n for (var key in relProduto) {\r\n retorno[key] = relProduto[key];\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n //Métodos publicos\r\n\r\n abastecimento.getAbastecimentos = function (idcRegTurno) {\r\n abastecimento.status = Constant.EDICAO;\r\n AbastecimentoModel.getAllByIdcRegTurno(idcRegTurno)\r\n .then(function (resposta) {\r\n abastecimento.listaAbastecimento = resposta;\r\n for (var i = 0; i < abastecimento.listaAbastecimento.length; i++) {\r\n abastecimento.listaAbastecimento[i].DthInicialSearch =\r\n $filter('date')(\r\n abastecimento.listaAbastecimento[i].DthInicial,\r\n TranslateService('datetime-format')\r\n );\r\n abastecimento.listaAbastecimento[i].DthFinalSearch =\r\n $filter('date')(\r\n abastecimento.listaAbastecimento[i].DthFinal,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n });\r\n };\r\n\r\n abastecimento.abastClick = function (regAbastecimento) {\r\n\r\n SelTurnoService.checkTurnoFechado(function () {\r\n abastecimento.status = Constant.EDICAO;\r\n abastecimento.editar(regAbastecimento);\r\n abastecimento.isEmAvaliacao = false;\r\n\r\n AbastecimentoModel.isEmAvaliacao(regAbastecimento.IdcAbastecimento)\r\n .then(function (resposta) {\r\n abastecimento.isEmAvaliacao = resposta;\r\n });\r\n });\r\n };\r\n\r\n abastecimento.tanqueClick = function (regTanque, form) {\r\n if (abastecimento.abastecimentoEstornado) return;\r\n\r\n if (form.$invalid) {\r\n form.$submitted = true;\r\n MessageService.prompt(\r\n TranslateService(\"atention\"),\r\n TranslateService(\"continue-with-invalid-data\")\r\n ).then(function () {\r\n abastecimento.regTanqueSelected = regTanque;\r\n abastecimento.editarTanque(regTanque);\r\n });\r\n } else {\r\n abastecimento.regTanqueSelected = regTanque;\r\n abastecimento.editarTanque(regTanque);\r\n }\r\n };\r\n\r\n abastecimento.editar = function (regAbastecimento) {\r\n if (!regAbastecimento) return;\r\n abastecimento.selected = {};\r\n if (regAbastecimento.IdcTransferencia) {\r\n return MessageService.alert(TranslateService('atention'), TranslateService('resupply-association-error'));\r\n }\r\n\r\n abastecimento.tagPlacaValida = abastecimento.status !== Constant.NOVO;\r\n abastecimento.msgTagWarning = null;\r\n abastecimento.selected = setValido(regAbastecimento);\r\n if(Object.keys(regAbastecimento).length)\r\n abastecimento.selected.duracao = abastecimento.retornaTempoAbastecimento(regAbastecimento);\r\n\r\n if (abastecimento.selected && abastecimento.selected.IdcEstorno) {\r\n abastecimento.selected.ChkCompensaEstorno = true;\r\n }\r\n\r\n abastecimento.abastecimentoEstornado = regAbastecimento.listAbastecimentoTanque && regAbastecimento.listAbastecimentoTanque.some(function (item) { return item.StuEnvioSap == \"7\" });\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n abastecimento.isTelaConsuta = false;\r\n SelTurnoService.canSelect = false;\r\n\r\n focus('tagPlaca');\r\n };\r\n\r\n abastecimento.editarTanque = function (regTanque) {\r\n modalTanque.open({ regTanque: regTanque, isEmAvaliacao: abastecimento.isEmAvaliacao });\r\n };\r\n\r\n abastecimento.atualizar = function () {\r\n InicializaVariaveis();\r\n abastecimento.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n\r\n abastecimento.SelTurnoService.onChangeTurno(onChangeTurno);\r\n abastecimento.SelTurnoService.selectTurno()\r\n .then(onChangeTurno)\r\n .catch(console.log);\r\n };\r\n\r\n abastecimento.novo = function () {\r\n abastecimento.isEmAvaliacao = false;\r\n abastecimento.status = Constant.NOVO;\r\n abastecimento.selected = {};\r\n abastecimento.editar(abastecimento.selected);\r\n };\r\n\r\n abastecimento.salvar = function (formAbastecimento) {\r\n if (!abastecimento.selected) return;\r\n\r\n SelTurnoService.checkTurnoFechado(function () {\r\n\r\n CheckAbastecimento(abastecimento.selected)\r\n .then(function () {\r\n salvarServidor(formAbastecimento).then(function (success) {\r\n if (success && success.message && typeof success.message === 'function')\r\n success.message();\r\n abastecimento.atualizar();\r\n }).catch(function (error) {\r\n if (error && error.message && typeof error.message === 'function')\r\n error.message();\r\n\r\n if (error && error.refresh)\r\n abastecimento.atualizar();\r\n }); \r\n });\r\n });\r\n };\r\n\r\n abastecimento.cancelar = function (formAbastecimento) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n abastecimento.Anomalias = [];\r\n abastecimento.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n validacao.resetForm(formAbastecimento);\r\n abastecimento.atualizar();\r\n };\r\n\r\n abastecimento.newChangeTime = function (obj, prop) {\r\n if (!abastecimento.selected || !abastecimento.selected.listAbastecimentoTanque) return;\r\n\r\n abastecimento.selected.dataFinalOriginal = false;\r\n \r\n abastecimento.selected.listAbastecimentoTanque.forEach(function (tanque) {\r\n tanque.DthAbastecimentoTanque = abastecimento.selected.DthInicial;\r\n });\r\n\r\n validacao.newChangeTime(obj, prop);\r\n\r\n abastecimento.changeHorimetro();\r\n\r\n abastecimento.selected.duracao = abastecimento.retornaTempoAbastecimento(abastecimento.selected);\r\n abastecimento.selected.duracao = abastecimento.selected.DthInicial <= abastecimento.selected.DthFinal ? abastecimento.selected.duracao : \"--:--.--\";\r\n\r\n };\r\n\r\n abastecimento.changePlaca = function (tagPlaca) {\r\n $timeout.cancel(abastecimento.changeTimeout);\r\n abastecimento.changeTimeout = $timeout(function () {\r\n return AbastecimentoModel.validaTagPlaca(\r\n abastecimento.selected.CodTagPlacaEqp,\r\n SelTurnoService.turno.IdcRegTurno,\r\n SelTurnoService.turno.IdcPosto\r\n ).then(function (resposta) {\r\n if (abastecimento.status === Constant.NOVO) {\r\n\r\n resposta = preencheAbastecimento(resposta);\r\n\r\n return atualizaAbastecimentoSelected(resposta, abastecimento.selected.CodTagPlacaEqp)\r\n .then(function () {\r\n return abastecimento.LoadEstorno();\r\n });\r\n }\r\n else\r\n abastecimento.LoadEstorno();\r\n\r\n abastecimento.changeHorimetro();\r\n });\r\n }, Constant.TIME_BEFORE_GO_TO_SERVER);\r\n \r\n return abastecimento.changeTimeout;\r\n };\r\n\r\n function dateDiffInDays(a, b){\r\n return Math.floor(Math.abs(a - b) / 36e5);\r\n }\r\n\r\n\r\n //TODO Tem que fazer também a validação da quantidade de dígitos do horímetro\r\n abastecimento.changeHorimetro = function () {\r\n var idcEquipamento = abastecimento.selected.IdcEquipamento;\r\n var dateTime = abastecimento.selected.DthInicial;\r\n var online = navigator.onLine;\r\n CtrHorHodModel.getLastHorimetro(idcEquipamento, dateTime)\r\n .then(function (resposta) {\r\n // console.log(resposta.ValHorHodAtual, (dateDiffInDays(resposta.DthCtrHorHod, dateTime) - 3))\r\n abastecimento.selected.UltimoHorHod = resposta && resposta.ValHorHodAtual ? resposta.ValHorHodAtual : 0;\r\n abastecimento.selected.MaxHor = online\r\n ? abastecimento.selected.UltimoHorHod + (dateDiffInDays(resposta.DthCtrHorHod, abastecimento.selected.DthInicial))\r\n : 9999999999\r\n });\r\n };\r\n\r\n abastecimento.registrarAnomalia = function () {\r\n var id = abastecimento.selected ? abastecimento.selected.IdcAbastecimento : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n abastecimento.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n abastecimento.getEquipamentos = function (placa) {\r\n return CadEquipamentoModel.getEquipamentos(placa);\r\n };\r\n\r\n abastecimento.LoadEstorno = function () {\r\n var searchParams = {\r\n IdcEquipamento: abastecimento.selected.IdcEquipamento,\r\n IdcRegTurno: abastecimento.selected.IdcRegTurno,\r\n IdcAbastecimento: abastecimento.selected.IdcAbastecimento\r\n }\r\n\r\n if (!abastecimento.selected.ChkCompensaEstorno) {\r\n abastecimento.listaEstorno = []\r\n abastecimento.selected.IdcEstorno = null;\r\n return $q.resolve();\r\n }\r\n else\r\n return RegEstornoModel.getAll(searchParams, 'GET').then(function (resposta) {\r\n abastecimento.listaEstorno = resposta;\r\n });\r\n }\r\n\r\n abastecimento.hasHorHod = function (regAbastecimento) {\r\n\r\n if (!(regAbastecimento && regAbastecimento.TipoEquipamento)) {\r\n return false;\r\n }\r\n\r\n return regAbastecimento.TipoEquipamento !== 'L' &&\r\n regAbastecimento.TipoEquipamento.toUpperCase().indexOf('COMBOIO') === -1;\r\n };\r\n\r\n abastecimento.isBlocked = function () {\r\n return abastecimento.isEmAvaliacao;\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n abastecimento.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n\r\n abastecimento.SelTurnoService.onChangeTurno(onChangeTurno);\r\n abastecimento.SelTurnoService.selectTurno()\r\n .then(onChangeTurno)\r\n .catch(console.log);\r\n })();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('AbastecimentoTanqueController', AbastecimentoTanqueController);\r\n AbastecimentoTanqueController.$inject = [\r\n '$uibModalInstance',\r\n 'regTanque',\r\n 'isEmAvaliacao',\r\n 'BlocoMedidorModel',\r\n 'GeneralModel',\r\n '$filter',\r\n 'ValidacaoService',\r\n 'CtrEncerranteModel',\r\n 'SelTurnoService',\r\n 'FocusService',\r\n 'ModalService',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function AbastecimentoTanqueController(\r\n $uibModalInstance,\r\n regTanque,\r\n isEmAvaliacao,\r\n BlocoMedidorModel,\r\n GeneralModel,\r\n $filter,\r\n validacao,\r\n CtrEncerranteModel,\r\n SelTurnoService,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var abTanque = this;\r\n var previousAbTanque = undefined;\r\n\r\n //Propriedades privadas\r\n var bloco = null;\r\n\r\n //Propriedades públicas\r\n abTanque.SelTurnoService = SelTurnoService;\r\n abTanque.regTanque = regTanque;\r\n abTanque.blocos = null;\r\n abTanque.validacao = validacao;\r\n abTanque.patternEncerrante = validacao.getPatternEncerrante(bloco);\r\n abTanque.formato = validacao.getFormatoEncerrante(bloco);\r\n\r\n //Métodos privados\r\n function getBlocos() {\r\n BlocoMedidorModel.getByIdcPosto(SelTurnoService.turno.IdcPosto, SelTurnoService.turno.IdcRegTurno)\r\n .then(function (resposta) {\r\n\r\n abTanque.blocos = $filter('filter')(resposta, function (bloco) {\r\n var mantemBloco = false;\r\n regTanque.listProdutoTanque.forEach(function (tanque) {\r\n\r\n if (tanque.IdcProduto === bloco.IdcProduto &&\r\n ((regTanque && regTanque.IdcBlocoMedidor && regTanque.IdcBlocoMedidor === bloco.IdcBlocoMedidor) || bloco.StuBlocoMedidor === 'S')\r\n && (bloco.ChkBloqueioCertificadoVencido === false\r\n || (bloco.DthVencCertificado > SelTurnoService.turno.DataFinal && bloco.ChkBloqueioCertificadoVencido === true))) {\r\n mantemBloco = true;\r\n }\r\n });\r\n\r\n return mantemBloco;\r\n\r\n });\r\n\r\n if (abTanque.blocos && abTanque.blocos.length) {\r\n if (abTanque.regTanque.IdcBlocoMedidor == 0) {\r\n abTanque.regTanque.IdcBlocoMedidor = abTanque.blocos[0].IdcBlocoMedidor;\r\n abTanque.regTanque.SglBlocoMedidor = abTanque.blocos[0].SglBlocoMedidor;\r\n abTanque.regTanque.DscProduto = abTanque.blocos[0].DscProduto;\r\n abTanque.regTanque.SglProduto = abTanque.blocos[0].SglProduto;\r\n abTanque.regTanque.IdcProduto = abTanque.blocos[0].IdcProduto;\r\n bloco = abTanque.blocos[0];\r\n abTanque.patternEncerrante = validacao.getPatternEncerrante(bloco);\r\n abTanque.formato = validacao.getFormatoEncerrante(bloco);\r\n }\r\n else {\r\n for (var i = 0; i < abTanque.blocos.length; i++) {\r\n if (abTanque.blocos[i].IdcBlocoMedidor == abTanque.regTanque.IdcBlocoMedidor) {\r\n bloco = abTanque.blocos[i];\r\n abTanque.patternEncerrante = validacao.getPatternEncerrante(bloco);\r\n abTanque.formato = validacao.getFormatoEncerrante(bloco);\r\n }\r\n }\r\n }\r\n }\r\n\r\n previousAbTanque = JSON.parse(JSON.stringify(abTanque));\r\n }).catch(function (error) {\r\n MessageService.alert(TranslateService('error'), error);\r\n });\r\n }\r\n\r\n function finalizaEdicaoTanque(formAbTanque) {\r\n regTanque.valido = formAbTanque.$valid;\r\n $uibModalInstance.close(true);\r\n validacao.resetForm(formAbTanque);\r\n }\r\n\r\n //Métodos publicos\r\n abTanque.ok = function (formAbTanque) {\r\n if (formAbTanque.$valid) {\r\n finalizaEdicaoTanque(formAbTanque);\r\n } else {\r\n MessageService.prompt(TranslateService('continue-with-invalid-data'))\r\n .then(function () {\r\n finalizaEdicaoTanque(formAbTanque);\r\n });\r\n }\r\n };\r\n\r\n abTanque.cancel = function () {\r\n restorePreviousEditableValues();\r\n $uibModalInstance.close(true);\r\n };\r\n\r\n abTanque.changeBloco = function () {\r\n if ((!abTanque.blocos) || (!abTanque.regTanque)) {\r\n return;\r\n }\r\n\r\n bloco = null;\r\n abTanque.blocos.forEach(function (item) {\r\n if (item.IdcBlocoMedidor === abTanque.regTanque.IdcBlocoMedidor) {\r\n bloco = item;\r\n abTanque.patternEncerrante = validacao.getPatternEncerrante(bloco);\r\n abTanque.formato = validacao.getFormatoEncerrante(bloco);\r\n }\r\n });\r\n\r\n if (bloco) {\r\n abTanque.regTanque.SglBlocoMedidor = bloco.SglBlocoMedidor;\r\n abTanque.regTanque.DscProduto = bloco.DscProduto;\r\n abTanque.regTanque.SglProduto = bloco.SglProduto;\r\n abTanque.regTanque.IdcProduto = bloco.IdcProduto;\r\n abTanque.regTanque.VolAbastecimento = null;\r\n abTanque.regTanque.ValEncerrante = null;\r\n abTanque.regTanque.ChkResetAutomaticoBlocoMedidor = false;\r\n }\r\n };\r\n\r\n function restorePreviousEditableValues() {\r\n abTanque.regTanque.IdcBlocoMedidor = previousAbTanque.regTanque.IdcBlocoMedidor;\r\n abTanque.regTanque.VolAbastecimento = previousAbTanque.regTanque.VolAbastecimento;\r\n abTanque.regTanque.ValEncerrante = previousAbTanque.regTanque.ValEncerrante;\r\n abTanque.regTanque.VolAtual = previousAbTanque.regTanque.VolAtual;\r\n }\r\n\r\n abTanque.changeEncerrante = function (tipo) {\r\n\r\n if (tipo === 'encerrante' && (abTanque.regTanque.ValEncerrante == null || abTanque.regTanque.ValEncerrante == 0)) {\r\n return;\r\n }\r\n\r\n if (tipo !== 'encerrante' && abTanque.regTanque.VolAbastecimento == null) {\r\n return;\r\n }\r\n\r\n var idcBlocoMedidor = abTanque.regTanque.IdcBlocoMedidor;\r\n var valorEncerrante = tipo === 'encerrante' ? abTanque.regTanque.ValEncerrante : null;\r\n var dataInicial = abTanque.regTanque.DthAbastecimentoTanque;\r\n var valVolume = abTanque.regTanque.VolAbastecimento;\r\n var numDigitos = bloco ? bloco.NumDigitos - bloco.NumCasasDecimais : 0;\r\n\r\n CtrEncerranteModel.calculaVolume(idcBlocoMedidor, valorEncerrante, dataInicial, valVolume, numDigitos, null, bloco.NumCasasDecimais)\r\n .then(function (resposta) {\r\n abTanque.regTanque.VolAbastecimento = resposta.volume;\r\n abTanque.regTanque.ValEncerrante = resposta.encerrante;\r\n abTanque.regTanque.ChkResetAutomaticoBlocoMedidor = resposta.reset;\r\n abTanque.regTanque.ChkResetAutomaticoEncerrante = resposta.reset;\r\n abTanque.regTanque.RegPorEncerrante = tipo === 'encerrante';\r\n });\r\n };\r\n\r\n abTanque.getVolume20C = function () {\r\n if (!abTanque.regTanque) return;\r\n\r\n var pIdcProduto = abTanque.regTanque.IdcProduto;\r\n var pValTemperatura = abTanque.regTanque.TmpAbastecimento;\r\n var pValDensidade = abTanque.regTanque.DenAbastecimento;\r\n var pValVolume = abTanque.regTanque.VolAbastecimento;\r\n\r\n if (pIdcProduto && pValTemperatura && pValDensidade && pValVolume) {\r\n GeneralModel.getVolume20C(pIdcProduto, pValTemperatura, pValDensidade, pValVolume)\r\n .then(function (resposta) {\r\n abTanque.regTanque.VolAbastecimento20c = Number(resposta);\r\n });\r\n }\r\n\r\n };\r\n\r\n abTanque.isBlocked = function () {\r\n return isEmAvaliacao;\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n getBlocos();\r\n //focus('encerrante');\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('AlteraDataHoraController', AlteraDataHoraController);\r\n\r\n AlteraDataHoraController.$inject = [\r\n 'dataHora',\r\n '$uibModalInstance'\r\n ];\r\n\r\n function AlteraDataHoraController(\r\n dataHora,\r\n $uibModalInstance\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var alteraDataHora = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n alteraDataHora.dataHora = dataHora;\r\n \r\n alteraDataHora.popUpDataHora = false\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n alteraDataHora.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n alteraDataHora.ok = function () {\r\n $uibModalInstance.close(alteraDataHora.dataHora);\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('AnomaliaController', AnomaliaController);\r\n\r\n AnomaliaController.$inject = [\r\n 'RegAnomaliaService',\r\n '$state'\r\n ];\r\n\r\n function AnomaliaController(\r\n RegAnomaliaService,\r\n $state\r\n ) {\r\n\r\n var anomalia = this;\r\n\r\n RegAnomaliaService.novo().finally(goHome);\r\n\r\n function goHome() {\r\n $state.go('home');\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ApuracaoRecFisicoController', ApuracaoRecFisicoController);\r\n\r\n ApuracaoRecFisicoController.$inject = [\r\n '$uibModalInstance',\r\n 'apuracao',\r\n 'recebimento',\r\n 'isEmAvaliacao',\r\n 'ValidacaoService',\r\n 'GeneralModel',\r\n 'Constant',\r\n 'SelTurnoService'\r\n ];\r\n\r\n function ApuracaoRecFisicoController(\r\n $uibModalInstance,\r\n apuracao,\r\n recebimento,\r\n isEmAvaliacao,\r\n ValidacaoService,\r\n GeneralModel,\r\n Constant,\r\n SelTurnoService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var apuracaoRecFisico = this;\r\n var previousApuracaoRecFisicoApuracao = JSON.parse(JSON.stringify(apuracao));\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n apuracaoRecFisico.SelTurnoService = SelTurnoService;\r\n apuracaoRecFisico.apuracao = apuracao;\r\n apuracaoRecFisico.recebimento = recebimento;\r\n apuracaoRecFisico.validacao = ValidacaoService;\r\n apuracaoRecFisico.mostrarTemperaturasInicial = apuracaoRecFisico.recebimento.IndicadorTipoRecebimento === 'T';\r\n apuracaoRecFisico.mostrarTemperaturasFinal = apuracaoRecFisico.recebimento.IndicadorTipoRecebimento === 'T';\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function calculaVolume20(tipo) {\r\n\r\n var pIdcProduto = apuracaoRecFisico.apuracao.CadTanquePosto ? apuracaoRecFisico.apuracao.CadTanquePosto.IdcProduto : apuracaoRecFisico.apuracao.idProdutoApuracao;\r\n var pValTemperatura = tipo === 'inicial' ? apuracaoRecFisico.apuracao.MedidaTemperaturaMediaInicial : apuracaoRecFisico.apuracao.MedidaTemperaturaMediaFinal;\r\n var pValDensidade = tipo === 'inicial' ? apuracaoRecFisico.apuracao.MedidaDensidadeInicial : apuracaoRecFisico.apuracao.MedidaDensidadeFinal;\r\n var pValVolume = tipo === 'inicial' ? apuracaoRecFisico.apuracao.QuantidadeProdutoInicial : apuracaoRecFisico.apuracao.QuantidadeProdutoFinal;\r\n var prop = tipo === 'inicial' ? 'QuantidadeProdutoInicial20GrausCelsius' : 'QuantidadeProdutoFinal20GrausCelsius';\r\n\r\n if (!(pIdcProduto && pValTemperatura && pValDensidade && pValVolume)) return;\r\n\r\n GeneralModel.getVolume20C(pIdcProduto, pValTemperatura, pValDensidade, pValVolume).then(function (resposta) {\r\n apuracaoRecFisico.apuracao[prop] = Number(resposta);\r\n });\r\n }\r\n\r\n function setAltura() {\r\n\r\n var UnidadeAlturaRegua = apuracaoRecFisico.apuracao.CadTanquePosto ? apuracaoRecFisico.apuracao.CadTanquePosto.UnidadeAlturaRegua : apuracaoRecFisico.apuracao.CadTanquePostoUnidadeAlturaRegua; \r\n\r\n var fator = Constant.UNIDADES_ALTURA[UnidadeAlturaRegua.toUpperCase()];\r\n\r\n apuracaoRecFisico.apuracao.MedidaAlturaInicial = apuracaoRecFisico.apuracao.AlturaInicialProxy * fator;\r\n apuracaoRecFisico.apuracao.MedidaAlturaFinal = apuracaoRecFisico.apuracao.AlturaFinalProxy * fator;\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n apuracaoRecFisico.cancel = function () {\r\n restorePreviousEditableValues();\r\n $uibModalInstance.close(true);\r\n };\r\n\r\n apuracaoRecFisico.ok = function () {\r\n $uibModalInstance.close('ok');\r\n };\r\n\r\n apuracaoRecFisico.getVolumeByAltura = function (tipo) {\r\n\r\n setAltura();\r\n\r\n var prop = tipo === 'inicial' ? 'QuantidadeProdutoInicial' : 'QuantidadeProdutoFinal';\r\n var pAltRegua = tipo === 'inicial' ? apuracaoRecFisico.apuracao.MedidaAlturaInicial : apuracaoRecFisico.apuracao.MedidaAlturaFinal;\r\n var pIdcTanquePosto = apuracaoRecFisico.apuracao.CadTanquePosto ? apuracaoRecFisico.apuracao.CadTanquePosto.IdcTanquePosto : apuracaoRecFisico.apuracao.IdentificadorTanquePostoAbastecimento\r\n\r\n GeneralModel.getVolumeByAltRegua(pIdcTanquePosto, pAltRegua).then(function (resposta) {\r\n apuracaoRecFisico.apuracao[prop] = Number(resposta);\r\n apuracaoRecFisico.changeVolume20C(tipo);\r\n });\r\n };\r\n\r\n apuracaoRecFisico.changeVolume20C = function (tipo, ignoraRecalculo) {\r\n\r\n if (!ignoraRecalculo) {\r\n if (tipo === 'inicial') {\r\n apuracaoRecFisico.changeTempMediaInicial();\r\n } else {\r\n apuracaoRecFisico.changeTempMediaFinal();\r\n }\r\n }\r\n\r\n calculaVolume20(tipo);\r\n };\r\n\r\n apuracaoRecFisico.changeTempMediaInicial = function () {\r\n var media = apuracaoRecFisico.apuracao.MedidaTemperaturaMediaInicial;\r\n\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaSuperficieInicial = media;\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMeioInicial = media;\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaFundoInicial = media;\r\n\r\n };\r\n\r\n apuracaoRecFisico.changeTempInicial = function () {\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMediaInicial =\r\n ValidacaoService.round(\r\n (apuracaoRecFisico.apuracao.MedidaTemperaturaSuperficieInicial +\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMeioInicial +\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaFundoInicial) / 3);\r\n\r\n calculaVolume20('inicial');\r\n };\r\n\r\n apuracaoRecFisico.changeTempMediaFinal = function () {\r\n var media = apuracaoRecFisico.apuracao.MedidaTemperaturaMediaFinal;\r\n\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaSuperficieFinal = media;\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMeioFinal = media;\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaFundoFinal = media;\r\n\r\n };\r\n\r\n apuracaoRecFisico.changeTempFinal = function () {\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMediaFinal =\r\n ValidacaoService.round(\r\n (apuracaoRecFisico.apuracao.MedidaTemperaturaSuperficieFinal +\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMeioFinal +\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaFundoFinal) / 3);\r\n\r\n calculaVolume20('final');\r\n };\r\n\r\n apuracaoRecFisico.isBlocked = function () {\r\n return isEmAvaliacao;\r\n }\r\n\r\n function restorePreviousEditableValues() {\r\n apuracaoRecFisico.apuracao.AlturaInicialProxy = previousApuracaoRecFisicoApuracao.AlturaInicialProxy; //Altura Inicial MM\r\n apuracaoRecFisico.apuracao.AlturaFinalProxy = previousApuracaoRecFisicoApuracao.AlturaFinalProxy; //Altura Final MM\r\n\r\n apuracaoRecFisico.apuracao.MedidaDensidadeInicial = previousApuracaoRecFisicoApuracao.MedidaDensidadeInicial; //Dens. Inicial\r\n apuracaoRecFisico.apuracao.MedidaDensidadeFinal = previousApuracaoRecFisicoApuracao.MedidaDensidadeFinal; //Dens. Final\r\n\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMediaInicial = previousApuracaoRecFisicoApuracao.MedidaTemperaturaMediaInicial; //Temperatura Média Final\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMediaFinal = previousApuracaoRecFisicoApuracao.MedidaTemperaturaMediaFinal; //Temperatura Média Inicial\r\n\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaSuperficieInicial = previousApuracaoRecFisicoApuracao.MedidaTemperaturaSuperficieInicial; //Temperatura Superfície Inicial\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaSuperficieFinal = previousApuracaoRecFisicoApuracao.MedidaTemperaturaSuperficieFinal; //Temperatura Superfície Final\r\n\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMeioInicial = previousApuracaoRecFisicoApuracao.MedidaTemperaturaMeioInicial; //Temperatura Meio Inicial\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaMeioFinal = previousApuracaoRecFisicoApuracao.MedidaTemperaturaMeioFinal; //Temperatura Meio Final\r\n\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaFundoInicial = previousApuracaoRecFisicoApuracao.MedidaTemperaturaFundoInicial; //Temperatura Fundo Inicial\r\n apuracaoRecFisico.apuracao.MedidaTemperaturaFundoFinal = previousApuracaoRecFisicoApuracao.MedidaTemperaturaFundoFinal; //Temperatura Fundo Final\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('AssociacaoRecebimentoController', AssociacaoRecebimentoController);\r\n\r\n AssociacaoRecebimentoController.$inject = [\r\n 'SelTurnoService',\r\n 'AssociacaoRecebimentoModel',\r\n 'RecebimentoFisicoModel',\r\n 'RecebimentoFiscalModel',\r\n 'MessageService',\r\n 'UsuarioService',\r\n 'ModalService',\r\n 'RegAnomaliaService',\r\n 'TranslateService',\r\n 'CheckAssociacaoRecebimento',\r\n '$filter',\r\n '$scope'\r\n ];\r\n\r\n function AssociacaoRecebimentoController(\r\n SelTurnoService,\r\n AssociacaoRecebimentoModel,\r\n RecebimentoFisicoModel,\r\n RecebimentoFiscalModel,\r\n MessageService,\r\n UsuarioService,\r\n ModalService,\r\n RegAnomaliaService,\r\n TranslateService,\r\n CheckAssociacaoRecebimento,\r\n $filter,\r\n $scope\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var associacaoRecebimento = this;\r\n var modalFiltros = new ModalService({\r\n templateUrl: 'modalFiltrosAssociacao.html',\r\n controller: 'ModalFiltrosAssociacaoController',\r\n controllerAs: 'modalFiltrosAssociacao'\r\n });\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n var date = new Date(SelTurnoService.turno.DataFinal);\r\n var before = new Date(SelTurnoService.turno.DataFinal).setMonth((date.getMonth() - 1 ));\r\n before = new Date(before)\r\n before.setHours(0, 0, 0, 0);\r\n date.setHours(23, 59, 59)\r\n var beforeFisico = before;\r\n var dateFisico = date;\r\n var beforeFiscal = before;\r\n var dateFiscal = date;\r\n associacaoRecebimento.SelTurnoService = SelTurnoService;\r\n associacaoRecebimento.filtro = null;\r\n associacaoRecebimento.filtroFiscal = null;\r\n associacaoRecebimento.filtroFisico = null;\r\n associacaoRecebimento.selected = null;\r\n associacaoRecebimento.listaAssociacao = [];\r\n associacaoRecebimento.isTelaConsuta = true;\r\n associacaoRecebimento.ListRecebimentoFiscalProduto = [];\r\n associacaoRecebimento.ListRecebimentoFisicoProduto = [];\r\n associacaoRecebimento.initDateFiscal = beforeFiscal;\r\n associacaoRecebimento.endDateFiscal = dateFiscal;\r\n associacaoRecebimento.initDateFisico = beforeFisico;\r\n associacaoRecebimento.endDateFisico = dateFisico;\r\n associacaoRecebimento.DataHoraUTCInitDateFiscal = null;\r\n associacaoRecebimento.DataHoraUTCEndDateFiscal = null;\r\n associacaoRecebimento.DataHoraUTCInitDateFisico = null;\r\n associacaoRecebimento.DataHoraUTCEndDateFisico = null;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n associacaoRecebimento.SelTurnoService.onChangeTurno(onChangeTurno);\r\n SelTurnoService.canSelect = true;\r\n SelTurnoService.selectTurno().then(onChangeTurno).catch(console.log);\r\n }\r\n\r\n function getAssociacoes() {\r\n AssociacaoRecebimentoModel.getAll()\r\n //AssociacaoRecebimentoModel.getByTimeRange(SelTurnoService.turno.DataInicial, SelTurnoService.turno.DataFinal )\r\n .then(function (resposta) {\r\n associacaoRecebimento.listaAssociacao = resposta;\r\n for (var i = 0; i < associacaoRecebimento.listaAssociacao.length; i++) {\r\n associacaoRecebimento.listaAssociacao[i].DataHoraUTCCriacaoSearch =\r\n $filter('date')(\r\n associacaoRecebimento.listaAssociacao[i].DataHoraUTCCriacao,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n });\r\n }\r\n\r\n function getFisicos(IdcProduto, IdcGrupo, initDate, endDate) {\r\n RecebimentoFisicoModel.getAllByIdcProduto(IdcProduto, IdcGrupo, initDate, endDate)\r\n .then(function (resposta) {\r\n associacaoRecebimento.ListRecebimentoFisicoProduto = resposta;\r\n for (var i = 0; i < associacaoRecebimento.ListRecebimentoFisicoProduto.length; i++) {\r\n associacaoRecebimento.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisicoSearch =\r\n $filter('date')(\r\n associacaoRecebimento.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n associacaoRecebimento.ListRecebimentoFisicoProduto[i].quant = getQuantidadeRecebimento(associacaoRecebimento.ListRecebimentoFisicoProduto[i]);\r\n }\r\n });\r\n }\r\n\r\n function getFiscais(IdcProduto, IdcGrupo, initDate, endDate) {\r\n RecebimentoFiscalModel.getAllByIdcProduto(IdcProduto, IdcGrupo, initDate, endDate)\r\n .then(function (resposta) {\r\n associacaoRecebimento.ListRecebimentoFiscalProduto = resposta;\r\n for (var i = 0; i < associacaoRecebimento.ListRecebimentoFiscalProduto.length; i++) {\r\n associacaoRecebimento.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscalSearch =\r\n $filter('date')(\r\n associacaoRecebimento.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n });\r\n }\r\n\r\n $scope.comparatorFiscal = function (input, search_param) {\r\n if (input && (input.CodigoDANFENotaFiscal || input.QuantidadeProdutoNotaFiscal || input.DataHoraUTCInicioRecebimentoFiscal)) {\r\n return (String(input.CodigoDANFENotaFiscal).includes(search_param) ||\r\n String(input.QuantidadeProdutoNotaFiscal).includes(search_param) ||\r\n String(input.DataHoraUTCInicioRecebimentoFiscal).includes(search_param));\r\n }\r\n else {\r\n return angular.equals(input, search_param);\r\n }\r\n };\r\n\r\n $scope.comparatorFisico = function (input, search_param) {\r\n if (input && (input.quant || input.DataHoraUTCInicioRecebimentoFisico)) {\r\n return (String(input.quant).includes(search_param) ||\r\n String(input.DataHoraUTCInicioRecebimentoFisico).includes(search_param));\r\n }\r\n else {\r\n return angular.equals(input, search_param);\r\n }\r\n };\r\n\r\n function insertOrRemove(list, item, key) {\r\n var index = associacaoRecebimento.indexOfItem(list, item, key);\r\n if (index === -1) {\r\n list.push(item);\r\n } else {\r\n list.splice(index, 1);\r\n }\r\n }\r\n\r\n function formatLitros(number) {\r\n number = number || 0;\r\n return number.toFixed(2) + \" \" + TranslateService('litros');\r\n }\r\n\r\n function formartPercentual(number) {\r\n number = number || 0;\r\n number = number === -Infinity ? -100 : number;\r\n return number.toFixed(2) + \"%\";\r\n }\r\n\r\n function getTotalFiscal(associacao) {\r\n return associacao\r\n .ListRecebimentoFiscalProduto\r\n .reduce(function (sum, fiscal) {\r\n return fiscal.QuantidadeProdutoNotaFiscal + sum;\r\n }, 0);\r\n }\r\n\r\n function getTotalFisico(associacao) {\r\n return associacao\r\n .ListRecebimentoFisicoProduto\r\n .reduce(function (sum, fisico) {\r\n return associacaoRecebimento.getQuantidadeRecebimento(fisico) + sum;\r\n }, 0);\r\n }\r\n\r\n function getEstoqueInicial(associacao) {\r\n return getEstoque(associacao, \"QuantidadeProdutoInicial\");\r\n }\r\n\r\n function getEstoqueFinal(associacao) {\r\n return getEstoque(associacao, \"QuantidadeProdutoFinal\");\r\n }\r\n\r\n function getEstoque(associacao, prop) {\r\n return associacao\r\n .ListRecebimentoFisicoProduto\r\n .reduce(function (sum, fisico) {\r\n return sum + fisico\r\n .ListApuracaoRecebimentoProdutoTanquePosto\r\n .reduce(function (sum2, apuracao) {\r\n return sum2 + apuracao[prop];\r\n }, 0);\r\n }, 0);\r\n }\r\n\r\n function resetTela() {\r\n getAssociacoes();\r\n associacaoRecebimento.selected = null;\r\n associacaoRecebimento.isTelaConsuta = true;\r\n }\r\n\r\n function criaNovaAssociacao(IdcProduto) {\r\n return {\r\n \"IdentificadorGrupoRecebimentoFisicoFiscal\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorDiretoria\": 1, //TODO incluir esta informação\r\n \"IdentificadorProduto\": IdcProduto,\r\n \"IndicadorSituacao\": \"A\", // A: aberto F: Fechado\r\n\r\n //AAAAMMDDXXXXSSSSS - Preenchido no servidor\r\n \"CodigoGrupoRecebimento\": null,\r\n\r\n //São preenchidos automáticamento ao selecionar as associações\r\n \"QuantidadeProdutoTotalNotasFiscais\": 0.0,\r\n \"QuantidadeProdutoTotalRecebida\": 0.0,\r\n \"QuantidadeProdutoDivergencia\": 0.0,\r\n \"ListRecebimentoFiscalProduto\": [],\r\n \"ListRecebimentoFisicoProduto\": [],\r\n\r\n //Informações do fechamento\r\n \"DataHoraUTCFechamento\": null,\r\n \"IdentificadorUsuarioResponsavelFechamento\": null,\r\n\r\n //Informações de simples referencia\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioFechamento\": null\r\n };\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n associacaoRecebimento.indexOfItem = function (list, item, propKey) {\r\n for (var i = 0; i < list.length; i++) {\r\n if (list[i][propKey] === item[propKey]) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n associacaoRecebimento.isInludedFisico = function (fisico) {\r\n if (!associacaoRecebimento.selected) { return; }\r\n\r\n return associacaoRecebimento.indexOfItem(\r\n associacaoRecebimento.selected.ListRecebimentoFisicoProduto,\r\n fisico,\r\n 'IdentificadorRecebimentoFisicoProduto'\r\n ) !== -1;\r\n };\r\n\r\n associacaoRecebimento.isInludedFiscal = function (fiscal) {\r\n if (!associacaoRecebimento.selected) { return; }\r\n\r\n return associacaoRecebimento.indexOfItem(\r\n associacaoRecebimento.selected.ListRecebimentoFiscalProduto,\r\n fiscal,\r\n 'IdentificadorRecebimentoFiscalProduto'\r\n ) !== -1;\r\n };\r\n\r\n associacaoRecebimento.associacaoRecebimentoClick = function (associacao) {\r\n AssociacaoRecebimentoModel.getById(associacao.IdentificadorGrupoRecebimentoFisicoFiscal)\r\n .then(function (resposta) {\r\n if (resposta.length) {\r\n var associaoCompleta = resposta[0];\r\n associaoCompleta.CadUsuarioCriacao = associacao.CadUsuarioCriacao;\r\n associacaoRecebimento.editar(associaoCompleta);\r\n } else {\r\n MessageService.alert(\"erro\");\r\n }\r\n });\r\n };\r\n\r\n associacaoRecebimento.atualizar = function () {\r\n getAssociacoes();\r\n };\r\n\r\n associacaoRecebimento.filtrarComDataFiscal = function (associacao){\r\n getFiscais(associacao.IdentificadorProduto, associacao.IdentificadorGrupoRecebimentoFisicoFiscal, associacaoRecebimento.initDateFiscal, associacaoRecebimento.endDateFiscal);\r\n };\r\n\r\n associacaoRecebimento.filtrarComDataFisico = function (associacao){\r\n getFisicos(associacao.IdentificadorProduto, associacao.IdentificadorGrupoRecebimentoFisicoFiscal, associacaoRecebimento.initDateFisico, associacaoRecebimento.endDateFisico);\r\n };\r\n\r\n associacaoRecebimento.editar = function (associacao) {\r\n var date = new Date(SelTurnoService.turno.DataFinal);\r\n var before = new Date(SelTurnoService.turno.DataFinal).setMonth((date.getMonth() - 1));\r\n before = new Date(before)\r\n before.setHours(0, 0, 0, 0);\r\n date.setHours(23, 59, 59)\r\n var beforeFisico = before;\r\n var dateFisico = date;\r\n var beforeFiscal = before;\r\n var dateFiscal = date;\r\n\r\n associacaoRecebimento.initDateFiscal = beforeFiscal;\r\n associacaoRecebimento.endDateFiscal = dateFiscal;\r\n associacaoRecebimento.initDateFisico = beforeFisico;\r\n associacaoRecebimento.endDateFisico = dateFisico;\r\n\r\n getFisicos(associacao.IdentificadorProduto, associacao.IdentificadorGrupoRecebimentoFisicoFiscal, associacaoRecebimento.initDateFisico, associacaoRecebimento.endDateFisico);\r\n getFiscais(associacao.IdentificadorProduto, associacao.IdentificadorGrupoRecebimentoFisicoFiscal, associacaoRecebimento.initDateFiscal, associacaoRecebimento.endDateFiscal);\r\n\r\n\r\n\r\n associacaoRecebimento.selected = associacao;\r\n associacaoRecebimento.selected.Anomalias = associacaoRecebimento.selected.Anomalias || [];\r\n associacaoRecebimento.isTelaConsuta = false;\r\n };\r\n\r\n associacaoRecebimento.novo = function () {\r\n modalFiltros.open()\r\n .then(function (resposta) {\r\n var associacao = criaNovaAssociacao(resposta.produto.IdcProduto);\r\n associacaoRecebimento.editar(associacao);\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n\r\n };\r\n\r\n associacaoRecebimento.cancelar = function () {\r\n resetTela();\r\n };\r\n\r\n associacaoRecebimento.salvar = function () { \r\n CheckAssociacaoRecebimento(associacaoRecebimento.selected)\r\n .then(function () {\r\n AssociacaoRecebimentoModel.salvar(associacaoRecebimento.selected)\r\n .then(function () {\r\n MessageService.alert(\r\n TranslateService('success'),\r\n TranslateService('association-saved')\r\n );\r\n resetTela();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert('Erro', erro);\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('error-saving-association')\r\n );\r\n console.log(erro);\r\n });\r\n });\r\n };\r\n\r\n\r\n associacaoRecebimento.recFiscalClick = function (fiscal) {\r\n insertOrRemove(\r\n associacaoRecebimento.selected.ListRecebimentoFiscalProduto,\r\n fiscal,\r\n 'IdentificadorRecebimentoFiscalProduto'\r\n );\r\n };\r\n\r\n associacaoRecebimento.recFisicoClick = function (fisico) {\r\n insertOrRemove(\r\n associacaoRecebimento.selected.ListRecebimentoFisicoProduto,\r\n fisico,\r\n 'IdentificadorRecebimentoFisicoProduto'\r\n );\r\n };\r\n\r\n associacaoRecebimento.getQuantidadeRecebimento = function (regRecebimentoFisico) {\r\n return regRecebimentoFisico.ListDetalheRecebimentoProduto.reduce(function (sum, item) {\r\n return sum + item.QuantidadeRecebida;\r\n }, 0);\r\n };\r\n\r\n function getQuantidadeRecebimento(regRecebimentoFisico) {\r\n return regRecebimentoFisico.ListDetalheRecebimentoProduto.reduce(function (sum, item) {\r\n return sum + item.QuantidadeRecebida;\r\n }, 0);\r\n }\r\n\r\n associacaoRecebimento.getFechamento = function (associacao) {\r\n if (!associacao) {\r\n return;\r\n }\r\n\r\n var totalFiscal = getTotalFiscal(associacao);\r\n var totalFisico = getTotalFisico(associacao);\r\n var estoqueInicial = getEstoqueInicial(associacao);\r\n var estoqueFinal = getEstoqueFinal(associacao);\r\n var distribuido = 0; //TODO - Incluir busca de volume distribuido\r\n var divergencia = totalFiscal - totalFisico;\r\n\r\n //Seta os valores calculados na associação selecionada\r\n associacao.QuantidadeProdutoTotalNotasFiscais = totalFiscal;\r\n associacao.QuantidadeProdutoTotalRecebida = totalFisico;\r\n associacao.QuantidadeProdutoDivergencia = divergencia;\r\n\r\n return {\r\n \"initial-storage-amount\": formatLitros(estoqueInicial),\r\n \"final-storage-amount\": formatLitros(estoqueFinal),\r\n \"distributed-amount\": formatLitros(distribuido),\r\n \"invoice-total\": formatLitros(totalFiscal),\r\n \"physical-total\": formatLitros(totalFisico),\r\n \"divergence\": formatLitros(divergencia),\r\n \"divergence-percentual\": formartPercentual(((totalFiscal - totalFisico) / totalFiscal) * 100),\r\n \"storage-divergence\": formatLitros(estoqueFinal + distribuido - estoqueInicial - totalFisico)\r\n };\r\n };\r\n\r\n associacaoRecebimento.registrarAnomalia = function () {\r\n var id = associacaoRecebimento.selected ? associacaoRecebimento.selected.IdentificadorGrupoRecebimentoFisicoFiscal : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n associacaoRecebimento.selected.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n associacaoRecebimento.fechar = function () {\r\n associacaoRecebimento.selected.DataHoraUTCFechamento = new Date();\r\n associacaoRecebimento.selected.IdentificadorUsuarioResponsavelFechamento = UsuarioService.indice;\r\n associacaoRecebimento.selected.IndicadorSituacao = 'F'; //A: Aberto, F: Fechado\r\n associacaoRecebimento.salvar();\r\n\r\n };\r\n\r\n function onChangeTurno(regTurno) {\r\n getAssociacoes();\r\n }\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('BarcodeController', BarcodeController);\r\n\r\n BarcodeController.$inject = [\r\n '$timeout',\r\n '$uibModalInstance',\r\n 'TranslateService'\r\n ];\r\n\r\n function BarcodeController(\r\n $timeout,\r\n $uibModalInstance,\r\n TranslateService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var barcode = this;\r\n var isClosed = false;\r\n var tracks = [];\r\n var ratio = 0.2125;\r\n var blackWhite = false;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n barcode.cancelar = function () {\r\n isClosed = true;\r\n for (var i = 0; i < tracks.length; i++) {\r\n tracks[i].stop();\r\n }\r\n $uibModalInstance.dismiss(TranslateService('cancel-by-user'));\r\n };\r\n\r\n barcode.ok = function () {\r\n blackWhite = true;\r\n // var detector = new BarcodeDetector;\r\n // var img = document.createElement('img');\r\n // img.onload = function () {\r\n // console.log('carregou');\r\n // detector.detect(img)\r\n // .then(console.log)\r\n // .catch(console.log);\r\n // }\r\n // img.src = 'img/barcode.png';\r\n };\r\n\r\n barcode.inicializar = function () {\r\n var canvas = document.querySelector('#barcode-canvas');\r\n var context = canvas.getContext('2d');\r\n var video = document.createElement('video');\r\n var detector = new BarcodeDetector;\r\n var videoConstraints = { video: { facingMode: { ideal: \"environment\" } } };\r\n\r\n navigator.getUserMedia(videoConstraints, treatStream, console.log);\r\n\r\n function treatStream(stream) {\r\n tracks = stream.getTracks();\r\n //video.src = window.URL.createObjectURL(stream);\r\n video.srcObject = stream;\r\n\r\n video.onloadedmetadata = function (e) {\r\n video.play();\r\n canvas.width = video.videoWidth;\r\n canvas.height = video.videoWidth * ratio;\r\n console.log(\"inicializado\");\r\n };\r\n }\r\n\r\n requestAnimationFrame(function draw() {\r\n context.drawImage(\r\n video,\r\n 0,\r\n (video.videoHeight - (video.videoWidth * ratio)) / 2,\r\n video.videoWidth,\r\n video.videoWidth * ratio,\r\n 0,\r\n 0,\r\n canvas.width,\r\n canvas.height\r\n );\r\n\r\n if (blackWhite) {\r\n // This function cannot be called if the image is not rom the same domain.\r\n // You'll get security error if you do.\r\n var imageData = context.getImageData(0, 0, canvas.width, canvas.height);\r\n\r\n for (var i = 0; i < imageData.data.length; i += 4) {\r\n var r = imageData.data[i + 0];\r\n var g = imageData.data[i + 1];\r\n var b = imageData.data[i + 2];\r\n var avg = Math.floor((r + g + b) / 3);\r\n var bw = avg > 30 ? 255 : 0;\r\n\r\n imageData.data[i + 0] = bw;\r\n imageData.data[i + 1] = bw;\r\n imageData.data[i + 2] = bw;\r\n }\r\n\r\n context.putImageData(imageData, 0, 0);\r\n\r\n // This loop gets every pixels on the image and\r\n // for (var j = 0; j < imageData.height; j++) {\r\n // for (var i = 0; i < imageData.width; i++) {\r\n // var index = (i * 4) * imageData.width + (j * 4);\r\n // var red = imageData.data[index];\r\n // var green = imageData.data[index + 1];\r\n // var blue = imageData.data[index + 2];\r\n // //var alpha = imageData.data[index + 3];\r\n // var average = (red + green + blue) / 3;\r\n // imageData.data[index] = average;\r\n // imageData.data[index + 1] = average;\r\n // imageData.data[index + 2] = average;\r\n // //imageData.data[index + 3] = alpha;\r\n // }\r\n // }\r\n }\r\n\r\n\r\n\r\n if (!isClosed) requestAnimationFrame(draw);\r\n })\r\n\r\n function grayscale(image, bPlaceImage) {\r\n var myCanvas = document.createElement(\"canvas\");\r\n var myCanvasContext = myCanvas.getContext(\"2d\");\r\n\r\n var imgWidth = image.width;\r\n var imgHeight = image.height;\r\n // You'll get some string error if you fail to specify the dimensions\r\n myCanvas.width = imgWidth;\r\n myCanvas.height = imgHeight;\r\n // alert(imgWidth);\r\n myCanvasContext.drawImage(image, 0, 0);\r\n\r\n // This function cannot be called if the image is not rom the same domain.\r\n // You'll get security error if you do.\r\n var imageData = myCanvasContext.getImageData(0, 0, imgWidth, imgHeight);\r\n\r\n // This loop gets every pixels on the image and\r\n for (j = 0; j < imageData.height; i++) {\r\n for (i = 0; i < imageData.width; j++) {\r\n var index = (i * 4) * imageData.width + (j * 4);\r\n var red = imageData.data[index];\r\n var green = imageData.data[index + 1];\r\n var blue = imageData.data[index + 2];\r\n var alpha = imageData.data[index + 3];\r\n var average = (red + green + blue) / 3;\r\n imageData.data[index] = average;\r\n imageData.data[index + 1] = average;\r\n imageData.data[index + 2] = average;\r\n imageData.data[index + 3] = alpha;\r\n }\r\n }\r\n\r\n return myCanvas.toDataURL();\r\n }\r\n\r\n return $timeout(function readBarCode() {\r\n return detector.detect(canvas)\r\n .then(function (resposta) {\r\n\r\n console.log(resposta);\r\n\r\n\r\n if (resposta && resposta[0]) {\r\n\r\n console.log(resposta[0].rawValue);\r\n\r\n $uibModalInstance.close(resposta[0].rawValue);\r\n return resposta[0].rawValue;\r\n }\r\n\r\n if (!isClosed) {\r\n return $timeout(readBarCode, 100);\r\n }\r\n })\r\n .catch(console.log);\r\n });\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('BlocoMedidorController', BlocoMedidorController);\r\n\r\n BlocoMedidorController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'BlocoMedidorModel',\r\n 'ComplexoModel',\r\n 'DiretoriaModel',\r\n 'UnidadeModel',\r\n 'PostoModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function BlocoMedidorController(\r\n ValidacaoService,\r\n Constant,\r\n BlocoMedidorModel,\r\n ComplexoModel,\r\n DiretoriaModel,\r\n UnidadeModel,\r\n PostoModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadBlocoMedidor = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadBlocoMedidor.filtro = '';\r\n cadBlocoMedidor.listaBlocoMedidor = null; \r\n cadBlocoMedidor.listaComplexo = null; \r\n cadBlocoMedidor.listaDiretorias = null; \r\n cadBlocoMedidor.listaUnidades = null; \r\n cadBlocoMedidor.listaPosto = null;\r\n cadBlocoMedidor.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadBlocoMedidor.selected = {CadPosto:{\r\n SglPosto: null,\r\n CadUnidade:{\r\n IdcUnidade: 0,\r\n CadComplexo:{\r\n SglComplexo: null,\r\n CadDiretoria:{\r\n SglDiretoria:0\r\n }\r\n }\r\n }\r\n }\r\n\r\n };\r\n cadBlocoMedidor.selected.CadPosto.CadUnidade.CadComplexo.CadDiretoria.IdcDiretoria\r\n\r\n\r\n cadBlocoMedidor.isTelaConsuta = true;\r\n cadBlocoMedidor.validacao = ValidacaoService;\r\n cadBlocoMedidor.IdcPosto = null;\r\n \r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadBlocoMedidor.isTelaConsuta = true\r\n getBlocoMedidor(); \r\n getDiretorias();\r\n \r\n \r\n }\r\n\r\n function getBlocoMedidor() {\r\n BlocoMedidorModel.getAll()\r\n .then(function (resposta) {\r\n cadBlocoMedidor.listaBlocoMedidor = resposta;\r\n });\r\n }\r\n\r\n\r\n\r\n\r\n function getUnidades() {\r\n UnidadeModel.getAllSameDiretoria()\r\n .then(function (resposta) {\r\n cadBlocoMedidor.listaUnidades = resposta;\r\n });\r\n }\r\n\r\n function getDiretorias() {\r\n DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n cadBlocoMedidor.listaDiretorias = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n\r\n cadBlocoMedidor.changeComplexos = function (item) {\r\n\r\n cadBlocoMedidor.selected.CadPosto.CadUnidade.CadComplexo.SglComplexo = '';\r\n cadBlocoMedidor.selected.CadPosto.CadUnidade.IdcUnidade = '';\r\n cadBlocoMedidor.selected.CadPosto.IdcPosto = '';\r\n cadBlocoMedidor.getComplexos(item);\r\n }\r\n\r\n cadBlocoMedidor.getComplexos = function (item) {\r\n \r\n\r\n ComplexoModel.getBySgl(item)\r\n .then(function (resposta) {\r\n cadBlocoMedidor.listaComplexo = resposta;\r\n });\r\n }\r\n\r\n cadBlocoMedidor.changeUnidades = function (item) {\r\n\r\n //cadBlocoMedidor.selected.CadPosto.CadUnidade.CadComplexo.SglComplexo = '';\r\n cadBlocoMedidor.selected.CadPosto.CadUnidade.IdcUnidade = '';\r\n cadBlocoMedidor.selected.CadPosto.IdcPosto = '';\r\n cadBlocoMedidor.getUnidades(item);\r\n }\r\n\r\n cadBlocoMedidor.getUnidades = function (item) {\r\n \r\n UnidadeModel.getAllSameComplexo(item)\r\n .then(function (resposta) {\r\n cadBlocoMedidor.listaUnidades = resposta;\r\n });\r\n }\r\n\r\n cadBlocoMedidor.changePostos = function (item) {\r\n\r\n cadBlocoMedidor.selected.CadPosto.IdcPosto = '';\r\n cadBlocoMedidor.getPostos(item);\r\n }\r\n\r\n cadBlocoMedidor.getPostos = function (item) {\r\n PostoModel.getAllSameUnidade(item)\r\n .then(function (resposta) {\r\n cadBlocoMedidor.listaPosto = resposta;\r\n });\r\n }\r\n\r\n\r\n cadBlocoMedidor.blocoClick = function (item) {\r\n cadBlocoMedidor.selected = item;\r\n cadBlocoMedidor.isTelaConsuta = false;\r\n cadBlocoMedidor.getComplexos(cadBlocoMedidor.selected.CadPosto.CadUnidade.CadComplexo.CadDiretoria.SglDiretoria);\r\n cadBlocoMedidor.getUnidades(cadBlocoMedidor.selected.CadPosto.CadUnidade.CadComplexo.SglComplexo);\r\n cadBlocoMedidor.getPostos(cadBlocoMedidor.selected.CadPosto.CadUnidade.IdcUnidade);\r\n }\r\n\r\n\r\n cadBlocoMedidor.atualizar = function () {\r\n getBlocoMedidor();\r\n } \r\n\r\n cadBlocoMedidor.novo = function (formcadBlocoMedidor) {\r\n cadBlocoMedidor.isTelaConsuta = false;\r\n cadBlocoMedidor.selected = {};\r\n ValidacaoService.resetForm(formcadBlocoMedidor);\r\n }\r\n\r\n cadBlocoMedidor.salvar = function (formcadBlocoMedidor) {\r\n //cadBlocoMedidor.IdcPosto = 10;\r\n if(formcadBlocoMedidor.$valid)\r\n {\r\n BlocoMedidorModel.save(cadBlocoMedidor.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadBlocoMedidor);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadBlocoMedidor.isTelaConsuta = true;\r\n getBlocoMedidor();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadBlocoMedidor.cancelar = function (formcadBlocoMedidor) {\r\n cadBlocoMedidor.isTelaConsuta = true;\r\n getBlocoMedidor();\r\n cadBlocoMedidor.selected = null;\r\n ValidacaoService.resetForm(formcadBlocoMedidor);\r\n }\r\n\r\n cadBlocoMedidor.excluir = function (formcadBlocoMedidor) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n BlocoMedidorModel.excluir(cadBlocoMedidor.selected.IdcBlocoMedidor)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadBlocoMedidor);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadBlocoMedidor.isTelaConsuta = true;\r\n getBlocoMedidor();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('CadTurnoController', CadTurnoController);\r\n\r\n CadTurnoController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'ModalService',\r\n 'CadTurnoModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function CadTurnoController(\r\n ValidacaoService,\r\n Constant,\r\n ModalService,\r\n CadTurnoModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadTurno = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadTurno.filtro = '';\r\n cadTurno.listaTurno = null; \r\n cadTurno.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadTurno.selected = null;\r\n cadTurno.isTelaConsuta = true;\r\n cadTurno.validacao = ValidacaoService;\r\n\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadTurno.isTelaConsuta = true\r\n getTurno(); \r\n }\r\n\r\n function getTurno() {\r\n CadTurnoModel.getAll()\r\n .then(function (resposta) {\r\n cadTurno.listaTurno = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadTurno.click = function (item) {\r\n cadTurno.selected = item;\r\n cadTurno.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadTurno.atualizar = function () {\r\n getTurno();\r\n } \r\n\r\n cadTurno.novo = function (formcadTurno) {\r\n cadTurno.isTelaConsuta = false;\r\n cadTurno.selected = {\r\n ListCadCaminhaoCompartimento : []\r\n };\r\n ValidacaoService.resetForm(formcadTurno);\r\n }\r\n\r\n cadTurno.salvar = function (formcadTurno) {\r\n \r\n if(formcadTurno.$valid)\r\n {\r\n CadTurnoModel.save(cadTurno.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadTurno);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadTurno.isTelaConsuta = true;\r\n getTurno();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n cadTurno.cancelar = function (formcadTurno) {\r\n cadTurno.isTelaConsuta = true;\r\n getTurno();\r\n cadTurno.selected = null;\r\n }\r\n\r\n cadTurno.excluir = function (formcadTurno) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n CadTurnoModel.excluir(cadTurno.selected.IdcTurno)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadTurno);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadTurno.isTelaConsuta = true;\r\n getTurno();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('CaminhaoCompartimentoController', CaminhaoCompartimentoController);\r\n CaminhaoCompartimentoController.$inject = [\r\n '$uibModalInstance',\r\n 'regCompartimento',\r\n 'ValidacaoService',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'ValidacaoService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function CaminhaoCompartimentoController(\r\n $uibModalInstance,\r\n regCompartimento,\r\n validacao,\r\n MessageService,\r\n TranslateService,\r\n ValidacaoService\r\n \r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var caCompartimento = this;\r\n\r\n //Propriedades privadas\r\n\r\n\r\n //Propriedades públicas\r\n\r\n caCompartimento.regCompartimento = regCompartimento;\r\n caCompartimento.IdcCaminhaoCompartimento = regCompartimento.IdcCaminhaoCompartimento; \r\n \r\n\r\n //Métodos privados\r\n \r\n\r\n //Métodos publicos\r\n\r\n caCompartimento.salvar = function (formcaCompartimento) {\r\n \r\n if(formcaCompartimento.$valid)\r\n {\r\n ValidacaoService.resetForm(formcaCompartimento);\r\n $uibModalInstance.close(caCompartimento.regCompartimento);\r\n } else {\r\n MessageService.alert(TranslateService('error'), TranslateService('invalid-data') + erro);\r\n }\r\n }\r\n\r\n caCompartimento.cancel = function (formcaCompartimento) {\r\n $uibModalInstance.close(true);\r\n validacao.resetForm(formcaCompartimento);\r\n }; \r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('CaminhaoTanqueController', CaminhaoTanqueController);\r\n\r\n CaminhaoTanqueController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'ModalService',\r\n 'CaminhaoTanqueModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function CaminhaoTanqueController(\r\n ValidacaoService,\r\n Constant,\r\n ModalService,\r\n CaminhaoTanqueModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadCaminhaoTanque = this;\r\n\r\n var modalCompartimento = new ModalService({\r\n templateUrl: 'caminhaoCompartimento.html',\r\n controller: 'CaminhaoCompartimentoController',\r\n controllerAs: 'caCompartimento'\r\n });\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadCaminhaoTanque.filtro = '';\r\n cadCaminhaoTanque.listaCaminhao = null; \r\n cadCaminhaoTanque.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadCaminhaoTanque.selected = null;\r\n cadCaminhaoTanque.isTelaConsuta = true;\r\n cadCaminhaoTanque.validacao = ValidacaoService;\r\n cadCaminhaoTanque.popupDataInicial = { opened: false };\r\n cadCaminhaoTanque.regCompartimentoSelected = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadCaminhaoTanque.isTelaConsuta = true\r\n getCaminhaoTanque(); \r\n }\r\n\r\n function getCaminhaoTanque() {\r\n CaminhaoTanqueModel.getAll()\r\n .then(function (resposta) {\r\n cadCaminhaoTanque.listaCaminhao = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadCaminhaoTanque.click = function (item) {\r\n cadCaminhaoTanque.selected = item;\r\n cadCaminhaoTanque.isTelaConsuta = false;\r\n }\r\n\r\n cadCaminhaoTanque.compartimentoClick = function (regCompartimento) {\r\n cadCaminhaoTanque.regCompartimentoSelected = regCompartimento;\r\n cadCaminhaoTanque.editarCompartimento(regCompartimento);\r\n };\r\n\r\n cadCaminhaoTanque.adicionarCompartimento = function(){\r\n cadCaminhaoTanque.editarCompartimento({})\r\n .then(function(resposta){\r\n resposta.DthCriacaoReg = new Date();\r\n resposta.IdcCaminhaoTanque = cadCaminhaoTanque.selected.IdcCaminhaoTanque;\r\n cadCaminhaoTanque.selected.ListCadCaminhaoCompartimento.push(resposta);\r\n });\r\n };\r\n\r\n cadCaminhaoTanque.editarCompartimento = function (regCompartimento) {\r\n return modalCompartimento.open({ regCompartimento: regCompartimento });\r\n };\r\n\r\n\r\n cadCaminhaoTanque.atualizar = function () {\r\n getCaminhaoTanque();\r\n } \r\n\r\n cadCaminhaoTanque.novo = function (formcadCaminhaoTanque) {\r\n cadCaminhaoTanque.isTelaConsuta = false;\r\n cadCaminhaoTanque.selected = {\r\n ListCadCaminhaoCompartimento : []\r\n };\r\n ValidacaoService.resetForm(formcadCaminhaoTanque);\r\n }\r\n\r\n cadCaminhaoTanque.salvar = function (formcadCaminhaoTanque) {\r\n \r\n if(formcadCaminhaoTanque.$valid)\r\n {\r\n CaminhaoTanqueModel.save(cadCaminhaoTanque.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadCaminhaoTanque);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadCaminhaoTanque.isTelaConsuta = true;\r\n getCaminhaoTanque();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadCaminhaoTanque.cancelar = function (formcadCaminhaoTanque) {\r\n cadCaminhaoTanque.isTelaConsuta = true;\r\n getCaminhaoTanque();\r\n cadCaminhaoTanque.selected = null;\r\n }\r\n\r\n cadCaminhaoTanque.excluirCompleto = function (formcadCaminhaoTanque) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n CaminhaoTanqueModel.excluir(cadCaminhaoTanque.selected.IdcCaminhaoTanque)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadCaminhaoTanque);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadCaminhaoTanque.isTelaConsuta = true;\r\n getCaminhaoTanque();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n cadCaminhaoTanque.openDataInicial = function () {\r\n cadCaminhaoTanque.popupDataInicial.opened = true;\r\n };\r\n\r\n cadCaminhaoTanque.excluir = function($event, regCompartimento){\r\n $event.stopPropagation();\r\n var index = cadCaminhaoTanque.selected.ListCadCaminhaoCompartimento.indexOf(regCompartimento);\r\n cadCaminhaoTanque.selected.ListCadCaminhaoCompartimento.splice(index, 1);\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();"," (function () {\r\n \"use strict\";\r\n\r\n angular\r\n .module(\"posto-facil\")\r\n .controller(\"CargaMassaController\", CargaMassaController);\r\n\r\n CargaMassaController.$inject = [\r\n \"CargaMassaModel\",\r\n \"AlertExceptionService\",\r\n 'DiretoriaModel',\r\n 'TranslateService',\r\n 'ComplexoModel',\r\n 'UsuarioService',\r\n 'ModalService',\r\n 'SpinnerService',\r\n 'MessageService',\r\n '$filter'\r\n\r\n ];\r\n\r\n function CargaMassaController(\r\n CargaMassaModel,\r\n AlertExceptionService,\r\n DiretoriaModel,\r\n TranslateService,\r\n ComplexoModel,\r\n UsuarioService,\r\n ModalService,\r\n SpinnerService,\r\n MessageService,\r\n $filter\r\n ) {\r\n var cargaMassa = this;\r\n\r\n cargaMassa.isTelaConsuta = true;\r\n cargaMassa.isTelaNew = false;\r\n cargaMassa.filtro = \"\";\r\n cargaMassa.listacargaMassa = [];\r\n cargaMassa.listacargaMassaOriginal = [];\r\n cargaMassa.listaDiretoria = [];\r\n cargaMassa.listaComplexo = [];\r\n cargaMassa.listaUnidade = [];\r\n cargaMassa.listaPosto = [];\r\n cargaMassa.listaCnpj = [];\r\n cargaMassa.listaClasse = [];\r\n cargaMassa.listaProduto = [];\r\n cargaMassa.listaProdutoTipo = [];\r\n cargaMassa.listaAbastecimentosSelected = []\r\n cargaMassa.listaAbastecimentos = [];\r\n cargaMassa.selected = null;\r\n cargaMassa.dthInicial = new Date();\r\n cargaMassa.dthFinal = new Date();\r\n cargaMassa.diretoria = null;\r\n cargaMassa.complexo = null;\r\n cargaMassa.cnpj = null;\r\n cargaMassa.classe = null;\r\n cargaMassa.tipo = null;\r\n cargaMassa.unidade = null;\r\n cargaMassa.posto = null;\r\n cargaMassa.searchTermSglDiretoria = '';\r\n cargaMassa.currentStatus = null;\r\n cargaMassa.New = {};\r\n cargaMassa.newListNewAbast = [];\r\n cargaMassa.produto = null;\r\n var sppiner = new SpinnerService();\r\n cargaMassa.searchTermSglPosto = '';\r\n cargaMassa.movimentacao = \"A\";\r\n\r\n var modalEnvio = new ModalService({\r\n templateUrl: 'modalEnvioCarga.html',\r\n controller: 'ModalEnvioCargaController',\r\n controllerAs: 'envioCarga'\r\n });\r\n\r\n var status = {\r\n \"6\": \"env-sucesso\",\r\n \"0\": \"env-pronto\",\r\n \"3\": \"env-processamento\",\r\n \"-1\": \"env-erro\",\r\n \"11\": \"env-agendado\",\r\n \"10\": \"env-manual\",\r\n \"7\": \"env-estorno\",\r\n }\r\n\r\n cargaMassa.statusList = [\r\n { id: \"6\", name: \"env-sucesso\"},\r\n { id: \"0\", name: \"env-pronto\"},\r\n { id: \"-1\", name: \"env-erro\"},\r\n { id: \"3\", name: \"env-processamento\"},\r\n { id: \"11\", name: \"env-agendado\"},\r\n { id: \"7\", name: \"env-estorno\"},\r\n { id: \"10\", name: \"env-manual\"},\r\n { id: \"100\", name: \"env-todos\"}\r\n ]\r\n\r\n\r\n // Funções privadas\r\n function inicializar() {\r\n cargaMassa.getDiretorias()\r\n getProduto();\r\n cargaMassa.currentStatus = '100'\r\n var dataCompleta = new Date(cargaMassa.dthFinal);\r\n\r\n var ano = dataCompleta.getFullYear();\r\n var mes = ('0' + (dataCompleta.getMonth() + 1)).slice(-2); \r\n var dia = ('0' + dataCompleta.getDate()).slice(-2); \r\n var horas = ('0' + dataCompleta.getHours()).slice(-2); \r\n var minutos = ('0' + dataCompleta.getMinutes()).slice(-2); \r\n\r\n cargaMassa.dthFinal = ano + '-' + mes + '-' + dia + ' ' + horas + ':' + minutos + ':000'; \r\n cargaMassa.dthFinal = new Date(cargaMassa.dthFinal);\r\n\r\n\r\n cargaMassa.dthInicial = cargaMassa.dthFinal.addDays(-5);\r\n }\r\n\r\n cargaMassa.downloadCSV = function () {\r\n const tabela = document.getElementById(\"tabela\");\r\n const linhas = tabela.querySelectorAll(\"tr\");\r\n\r\n // Array para armazenar os dados da tabela\r\n var csv = [];\r\n\r\n csv.push(\"sep=,\");\r\n\r\n const headers = [\r\n \"Data\",\r\n \"Hora\",\r\n \"Planta\",\r\n \"Depósito\",\r\n \"Material\",\r\n \"Volume\",\r\n \"Unidade\",\r\n \"Placa\",\r\n \"Centro de Custo\",\r\n \"Ordem Estatística\",\r\n \"Elemento PEP\",\r\n \"Status\",\r\n ]\r\n\r\n var linhaCSV = [];\r\n\r\n angular.forEach(headers, function (header) {\r\n linhaCSV.push(header);\r\n\r\n })\r\n\r\n csv.push(linhaCSV.join(\",\"));\r\n\r\n linhaCSV = [];\r\n\r\n var abast = cargaMassa.listaAbastecimentos;\r\n\r\n angular.forEach(abast, function (a) {\r\n linhaCSV = getAbatCSV(a);\r\n csv.push(linhaCSV.join(\",\"));\r\n })\r\n\r\n // Converte o array em uma string\r\n const csvString = csv.join(\"\\n\");\r\n\r\n\r\n // Cria um link para download\r\n const link = document.createElement(\"a\");\r\n link.href = \"data:text/csv;charset=ISO-8859-1,\" + escape(csvString);\r\n link.download = cargaMassa.selected.DscCargaMassa + \".csv\";\r\n\r\n // Aciona o clique para baixar o arquivo \r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n\r\n\r\n function getAbatCSV(abast) {\r\n var date = formatDateToDDMMYYYY(abast.DthInicial)\r\n var hour = formatTimeToHHMM(abast.DthInicial)\r\n var status = TranslateService(cargaMassa.getStatus(abast.StuEnvioSap))\r\n var abast = [\r\n date,\r\n hour,\r\n abast.CodPlanta,\r\n abast.CodDeposito,\r\n abast.CodMterial,\r\n abast.VolAbastecimento,\r\n \"L\",\r\n abast.CodTagPlaca,\r\n abast.CodCentroCusto,\r\n abast.CodOrdemEstatistica,\r\n abast.CodElementoPep,\r\n status\r\n ]\r\n\r\n return abast;\r\n }\r\n\r\n\r\n function formatDateToDDMMYYYY(date) {\r\n const day = String(date.getDate()).padStart(2, '0'); // Adiciona zero à esquerda se necessário\r\n const month = String(date.getMonth() + 1).padStart(2, '0'); // Mês começa em 0\r\n const year = date.getFullYear();\r\n\r\n return day + \"-\" + month + \"-\" + year;\r\n }\r\n function formatTimeToHHMM(date) {\r\n const hours = String(date.getHours()).padStart(2, '0'); // Adiciona zero à esquerda se necessário\r\n const minutes = String(date.getMinutes()).padStart(2, '0'); // Adiciona zero à esquerda se necessário\r\n\r\n return hours + \":\" +minutes;\r\n }\r\n\r\n cargaMassa.translate = function (key) {\r\n return TranslateService(key);\r\n }\r\n\r\n function getCargaMassa() {\r\n sppiner.spin();\r\n return CargaMassaModel.getByPeriod(\r\n cargaMassa.dthInicial,\r\n cargaMassa.dthFinal,\r\n cargaMassa.diretoria ? cargaMassa.diretoria.IdcDiretoria : null,\r\n cargaMassa.movimentacao,\r\n UsuarioService.indice\r\n )\r\n .then(function (resposta) {\r\n cargaMassa.listacargaMassa = resposta;\r\n cargaMassa.listacargaMassaOriginal = resposta;\r\n applyFilter();\r\n sppiner.stop();\r\n })\r\n .catch(AlertExceptionService);\r\n }\r\n\r\n Date.prototype.addDays = function (days) {\r\n var date = new Date(this.valueOf());\r\n date.setDate(date.getDate() + days);\r\n return date;\r\n }\r\n\r\n\r\n cargaMassa.processaManual = function () {\r\n MessageService.prompt(\r\n TranslateService('confirma')\r\n ).then(function (confirm) {\r\n sppiner.spin();\r\n return CargaMassaModel.processaManualmente(cargaMassa.selected.IdcCargaMassa, UsuarioService.indice)\r\n .then(function () {\r\n sppiner.stop();\r\n MessageService.alert(TranslateService('success'), TranslateService('carga-massa-status-atualizado'));\r\n getAbastecimentos(cargaMassa.selected.IdcCargaMassa);\r\n })\r\n .catch(function (err) {\r\n MessageService.alert(TranslateService('error'), err.data.Message);\r\n sppiner.stop();\r\n });\r\n }).catch(function (cancel) { reject({ refresh: true, message: undefined }) });\r\n \r\n }\r\n\r\n cargaMassa.cancelarAgendamento = function () {\r\n MessageService.prompt(\r\n TranslateService('confirma')\r\n ).then(function (confirm) {\r\n sppiner.spin();\r\n return CargaMassaModel.cancela(cargaMassa.selected.IdcCargaMassa)\r\n .then(function () {\r\n sppiner.stop();\r\n MessageService.alert(TranslateService('success'), TranslateService('carga-massa-status-atualizado'));\r\n getAbastecimentos(cargaMassa.selected.IdcCargaMassa);\r\n })\r\n .catch(function (err) {\r\n MessageService.alert(TranslateService('error'), err.data.Message);\r\n sppiner.stop();\r\n });\r\n }).catch(function (cancel) { reject({ refresh: true, message: undefined }) });\r\n }\r\n\r\n function getAbastecimentos(idcCargaMassa) {\r\n sppiner.spin();\r\n return CargaMassaModel.getAbastecimentos(idcCargaMassa)\r\n .then(function (resposta) {\r\n cargaMassa.listaAbastecimentos = resposta;\r\n angular.forEach(cargaMassa.listaAbastecimentos, function (abast) {\r\n abast.selected = true;\r\n });\r\n sppiner.stop();\r\n })\r\n .catch(AlertExceptionService);\r\n }\r\n\r\n // Funções públicas\r\n cargaMassa.click = function (item) {\r\n cargaMassa.selected = item;\r\n getAbastecimentos(item.IdcCargaMassa).then(function () {\r\n cargaMassa.isTelaConsuta = false;\r\n cargaMassa.filtro = \"\";\r\n cargaMassa.listaAbastecimentosSelected = cargaMassa.listaAbastecimentos;\r\n });\r\n };\r\n\r\n cargaMassa.clickAbast = function (abast) {\r\n if (abast.StuEnvioSap != \"6\" && abast.StuEnvioSap != \"11\" && abast.StuEnvioSap != \"3\") {\r\n abast.selected = !abast.selected\r\n var abastSel = cargaMassa.listaAbastecimentosSelected.find(function (a) {\r\n return a.IdcAbastecimentoTanque == abast.IdcAbastecimentoTanque\r\n })\r\n\r\n if (abastSel) {\r\n cargaMassa.listaAbastecimentosSelected = cargaMassa.listaAbastecimentosSelected.filter(function (a) {\r\n return a.IdcAbastecimentoTanque != abast.IdcAbastecimentoTanque\r\n });\r\n } else {\r\n cargaMassa.listaAbastecimentosSelected.push(abast);\r\n }\r\n }\r\n\r\n \r\n };\r\n\r\n cargaMassa.clickAbastNew = function (abast) {\r\n abast.selected = !abast.selected\r\n\r\n var abastSel = cargaMassa.listaAbastecimentosSelected.find(function (a) {\r\n if (abast.IdcAbastecimentoTanque) {\r\n return a.IdcAbastecimentoTanque == abast.IdcAbastecimentoTanque\r\n\r\n }\r\n else {\r\n return a.IdentificadorTransferenciaProduto == abast.IdentificadorTransferenciaProduto\r\n\r\n }\r\n })\r\n\r\n if (abastSel) {\r\n cargaMassa.listaAbastecimentosSelected = cargaMassa.listaAbastecimentosSelected.filter(function (a) {\r\n\r\n if (abast.IdcAbastecimentoTanque) {\r\n return a.IdcAbastecimentoTanque != abast.IdcAbastecimentoTanque\r\n\r\n }\r\n else {\r\n return a.IdentificadorTransferenciaProduto != abast.IdentificadorTransferenciaProduto\r\n\r\n }\r\n });\r\n } else {\r\n cargaMassa.listaAbastecimentosSelected.push(abast);\r\n }\r\n\r\n };\r\n\r\n\r\n cargaMassa.checkAll = function () {\r\n\r\n var abast2 = $filter(\"filter\")(cargaMassa.newListNewAbast, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n angular.forEach(abast2, function (abast) {\r\n abast.selected = true;\r\n\r\n var a2 = cargaMassa.listaAbastecimentosSelected.find(function (a) {\r\n return a.IdcAbastecimentoTanque == abast.IdcAbastecimentoTanque;\r\n })\r\n\r\n if (!a2) {\r\n cargaMassa.listaAbastecimentosSelected.push(abast);\r\n }\r\n\r\n\r\n });\r\n\r\n }\r\n\r\n cargaMassa.unCheckAll = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.newListNewAbast, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n angular.forEach(abast2, function (abast) {\r\n abast.selected = false;\r\n\r\n var a2 = cargaMassa.listaAbastecimentosSelected.find(function (a) {\r\n return a.IdcAbastecimentoTanque == abast.IdcAbastecimentoTanque;\r\n })\r\n\r\n if (a2) {\r\n cargaMassa.listaAbastecimentosSelected = cargaMassa.listaAbastecimentosSelected.filter(function (a) {\r\n return a.IdcAbastecimentoTanque != abast.IdcAbastecimentoTanque;\r\n })\r\n }\r\n\r\n });\r\n }\r\n\r\n\r\n cargaMassa.getDiretorias = function () {\r\n sppiner.spin();\r\n CargaMassaModel.getLocais(UsuarioService.indice)\r\n .then(function (resposta) {\r\n cargaMassa.listaDiretoria = resposta;\r\n cargaMassa.diretoria = cargaMassa.listaDiretoria[0];\r\n cargaMassa.listaComplexo = cargaMassa.diretoria.ListCadComplexo;\r\n sppiner.stop();\r\n getCargaMassa();\r\n });\r\n }\r\n\r\n\r\n cargaMassa.getStatus = function (key) {\r\n return status[key];\r\n }\r\n\r\n function applyFilter() {\r\n cargaMassa.listacargaMassa = cargaMassa.listacargaMassaOriginal.filter(function (carga) {\r\n var filtered = true;\r\n\r\n filtered = filtered && ((cargaMassa.diretoria && cargaMassa.diretoria.IdcDiretoria == carga.IdcDiretoria) || cargaMassa.diretoria == null)\r\n filtered = filtered && ((cargaMassa.complexo && cargaMassa.complexo.IdcComplexo == carga.IdcComplexo) || cargaMassa.complexo == null)\r\n filtered = filtered && ((cargaMassa.posto && cargaMassa.posto.IdcPosto == carga.IdcPosto) || cargaMassa.posto == null)\r\n filtered = filtered && ((cargaMassa.unidade && cargaMassa.unidade.IdcUnidade == carga.IdcUnidade) || cargaMassa.unidade == null)\r\n filtered = filtered && ((cargaMassa.produto && cargaMassa.produto.IdcProduto == carga.IdcProduto) || cargaMassa.produto == null)\r\n filtered = filtered && ((cargaMassa.classe && cargaMassa.classe.IdcClasse == carga.IdcClasse) || cargaMassa.classe == null)\r\n filtered = filtered && ((cargaMassa.tipo && cargaMassa.tipo.IdcTipo == carga.IdcTipo) || cargaMassa.tipo == null)\r\n\r\n return filtered;\r\n })\r\n }\r\n\r\n cargaMassa.ChangeComplexo = function () {\r\n cargaMassa.cnpj = null;\r\n cargaMassa.unidade = null;\r\n cargaMassa.posto = null;\r\n\r\n applyFilter();\r\n if (cargaMassa.complexo) {\r\n sppiner.spin();\r\n CargaMassaModel.getCnpjs(cargaMassa.complexo.IdcComplexo)\r\n .then(function (resposta) {\r\n cargaMassa.listaCnpj = resposta;\r\n sppiner.stop();\r\n\r\n });\r\n }\r\n }\r\n cargaMassa.ChangeComplexoNew = function () {\r\n sppiner.spin();\r\n CargaMassaModel.getCnpjs(cargaMassa.complexo.IdcComplexo)\r\n .then(function (resposta) {\r\n cargaMassa.listaCnpj = resposta;\r\n sppiner.spin();\r\n getNewAbast();\r\n });\r\n }\r\n\r\n cargaMassa.ChangeClasse = function () {\r\n cargaMassa.listaProdutoTipo = cargaMassa.classe.ListCadProdutoTipo;\r\n applyFilter();\r\n resetSearch2();\r\n\r\n }\r\n\r\n cargaMassa.ChangeTipo = function () {\r\n cargaMassa.listaProduto = cargaMassa.tipo.ListCadProduto;\r\n applyFilter();\r\n }\r\n\r\n cargaMassa.ChangeClasseNew = function () {\r\n cargaMassa.listaProdutoTipo = cargaMassa.classe.ListCadProdutoTipo;\r\n getNewAbast();\r\n resetSearch2();\r\n\r\n }\r\n\r\n cargaMassa.ChangeTipoNew = function () {\r\n cargaMassa.listaProduto = cargaMassa.tipo.ListCadProduto;\r\n getNewAbast();\r\n }\r\n\r\n cargaMassa.atualizar = function () {\r\n getCargaMassa();\r\n };\r\n\r\n cargaMassa.onChangeFiltrosCargas = function () {\r\n getCargaMassa();\r\n };\r\n\r\n cargaMassa.onChangeFiltrosCargasNew = function () {\r\n getNewAbast();\r\n };\r\n\r\n\r\n cargaMassa.ChangeProduto = function () {\r\n applyFilter();\r\n };\r\n\r\n cargaMassa.ChangeProdutoNew = function () {s\r\n getNewAbast();\r\n };\r\n\r\n\r\n cargaMassa.ChangeDiretoria = function () {\r\n cargaMassa.listaComplexo = cargaMassa.diretoria.ListCadComplexo;\r\n resetSearch();\r\n\r\n getCargaMassa();\r\n\r\n }\r\n\r\n\r\n\r\n\r\n cargaMassa.ChangeUnidade = function () {\r\n cargaMassa.listaPosto = cargaMassa.unidade.ListCadPosto;\r\n applyFilter();\r\n };\r\n\r\n\r\n cargaMassa.ChangePosto = function () {\r\n if (cargaMassa.selected)\r\n getNewAbast();\r\n applyFilter();\r\n }\r\n\r\n cargaMassa.ChangeCnpj = function () {\r\n cargaMassa.unidade = null;\r\n cargaMassa.posto = null;\r\n\r\n cargaMassa.listaUnidade = cargaMassa.complexo.ListCadUnidade.filter(function (u) {\r\n return u.CodCnpj == cargaMassa.cnpj;\r\n });\r\n if (cargaMassa.selected)\r\n getNewAbast();\r\n applyFilter();\r\n }\r\n\r\n function resetSearch() {\r\n cargaMassa.complexo = null;\r\n cargaMassa.unidade = null;\r\n cargaMassa.posto = null;\r\n cargaMassa.cnpj = null\r\n\r\n }\r\n\r\n function resetSearch2() {\r\n cargaMassa.tipo = null;\r\n cargaMassa.produto = null;\r\n }\r\n\r\n\r\n cargaMassa.ChangeDiretoriaNew = function (change) {\r\n resetSearch();\r\n cargaMassa.listaComplexo = cargaMassa.diretoria.ListCadComplexo;\r\n getNewAbast();\r\n }\r\n\r\n cargaMassa.saveNew = function () {\r\n if (!cargaMassa.New.DscCargaMassa || !cargaMassa.New.DthCargaMassa) {\r\n return;\r\n }\r\n var payload = {\r\n DscCargaMassa: cargaMassa.New.DscCargaMassa,\r\n DthCargaMassa: cargaMassa.New.DthCargaMassa,\r\n ListRegAbastecimentoTanque: cargaMassa.listaAbastecimentosSelected.filter(function (a) {\r\n return a.IdcAbastecimentoTanque != undefined;\r\n }),\r\n ListTransferenciaProduto: cargaMassa.listaAbastecimentosSelected.filter(function (a) {\r\n return a.IdentificadorTransferenciaProduto != undefined;\r\n })\r\n }\r\n sppiner.spin();\r\n CargaMassaModel.save(payload)\r\n .then(function (resposta) {\r\n cargaMassa.selected = resposta;\r\n cargaMassa.isTelaConsuta = false\r\n angular.forEach(cargaMassa.listaAbastecimentos, function (abast) {\r\n abast.selected = true;\r\n });\r\n sppiner.stop();\r\n MessageService.alert(TranslateService('success'), TranslateService('carga-massa-salva-sucesso'));\r\n cargaMassa.isTelaNew = false;\r\n cargaMassa.isTelaConsuta = false;\r\n cargaMassa.filtro = \"\";\r\n getAbastecimentos(cargaMassa.selected.IdcCargaMassa)\r\n })\r\n .catch(function (err) {\r\n console.log(err)\r\n MessageService.alert(TranslateService('atention'), err.data.Message);\r\n sppiner.stop();\r\n });\r\n }\r\n\r\n cargaMassa.save = function () {\r\n\r\n var abast = cargaMassa.listaAbastecimentos.filter(function (a) {\r\n return a.IdcAbastecimentoTanque != undefined && a.selected;\r\n });\r\n var ctr = cargaMassa.listaAbastecimentos.filter(function (a) {\r\n return a.IdentificadorTransferenciaProduto != undefined && a.selected;\r\n })\r\n\r\n var payload = {\r\n DscCargaMassa: cargaMassa.selected.DscCargaMassa,\r\n DthCargaMassa: cargaMassa.selected.DthCargaMassa,\r\n IdcCargaMassa: cargaMassa.selected.IdcCargaMassa,\r\n DthCriacaoReg: cargaMassa.selected.DthCriacaoReg,\r\n ListRegAbastecimentoTanque: abast,\r\n ListTransferenciaProduto: ctr\r\n }\r\n sppiner.spin();\r\n CargaMassaModel.save(payload)\r\n .then(function (resposta) {\r\n cargaMassa.selected = resposta;\r\n sppiner.stop();\r\n cargaMassa.filtro = \"\";\r\n MessageService.alert(TranslateService('success'), TranslateService('carga-massa-salva-sucesso'));\r\n getAbastecimentos(cargaMassa.selected.IdcCargaMassa);\r\n })\r\n .catch(function (err) {\r\n MessageService.alert(TranslateService('atention'), err.data.Message);\r\n sppiner.stop();\r\n });\r\n }\r\n\r\n \r\n\r\n\r\n\r\n cargaMassa.getTotalAbast = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.newListNewAbast, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n\r\n return abast2.length\r\n }\r\n\r\n cargaMassa.getTotalAbastSelected = function () {\r\n\r\n return cargaMassa.listaAbastecimentosSelected.length\r\n }\r\n\r\n\r\n cargaMassa.delete = function () {\r\n MessageService.prompt(\r\n TranslateService('confirma')\r\n ).then(function (confirm) {\r\n const name = cargaMassa.selected.DscCargaMassa\r\n CargaMassaModel.deleteCarga(cargaMassa.selected.IdcCargaMassa)\r\n .then(function (resposta) {\r\n cargaMassa.isTelaConsuta = true;\r\n cargaMassa.filtro = \"\";\r\n getCargaMassa();\r\n MessageService.alert(TranslateService('success'), TranslateService('carga-massa-excluida-sucesso', name));\r\n })\r\n .catch(function (err) {\r\n MessageService.alert(TranslateService('error'), err.data.Message);\r\n });\r\n }).catch(function (cancel) { reject({ refresh: true, message: undefined }) });\r\n\r\n\r\n \r\n }\r\n\r\n cargaMassa.getTotalVolume = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.newListNewAbast, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n\r\n return abast2\r\n .reduce(function (sum, abast) {\r\n return abast.VolAbastecimento + sum;\r\n }, 0).toFixed(2)\r\n .replace('.', ',')\r\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.');\r\n \r\n }\r\n\r\n cargaMassa.getTotalVolumeSelected = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.listaAbastecimentosSelected, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n return abast2\r\n .reduce(function (sum, abast) {\r\n return abast.VolAbastecimento + sum;\r\n }, 0).toFixed(2)\r\n .replace('.', ',')\r\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.');\r\n }\r\n\r\n cargaMassa.getTotalAbastCarga = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.listaAbastecimentos, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n\r\n\r\n return abast2.length\r\n }\r\n\r\n cargaMassa.getTotalAbastSelectedCarga = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.listaAbastecimentosSelected, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n\r\n return abast2.length\r\n }\r\n\r\n cargaMassa.getTotalVolumeCarga = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.listaAbastecimentos, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n\r\n return abast2\r\n .reduce(function (sum, abast) {\r\n return abast.VolAbastecimento + sum;\r\n }, 0).toFixed(2)\r\n .replace('.', ',')\r\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.');\r\n\r\n }\r\n\r\n cargaMassa.getTotalVolumeSelectedCarga = function () {\r\n var abast2 = $filter(\"filter\")(cargaMassa.listaAbastecimentosSelected, cargaMassa.filtro)\r\n abast2 = $filter(\"filterCargaStatus\")(abast2, cargaMassa.currentStatus)\r\n\r\n\r\n return abast2\r\n .reduce(function (sum, abast) {\r\n return abast.VolAbastecimento + sum;\r\n }, 0).toFixed(2)\r\n .replace('.', ',')\r\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.');\r\n }\r\n\r\n\r\n\r\n\r\n cargaMassa.novo = function () {\r\n cargaMassa.isTelaConsuta = false;\r\n cargaMassa.filtro = \"\";\r\n cargaMassa.isTelaNew = true\r\n cargaMassa.New = {};\r\n cargaMassa.New.DthCargaMassa = new Date();\r\n cargaMassa.listaAbastecimentosSelected = [];\r\n getNewAbast();\r\n };\r\n\r\n cargaMassa.enviar = function () {\r\n modalEnvio.open({ cargaMassa: cargaMassa.selected })\r\n .then(function (resposta) {\r\n if (resposta) {\r\n var abast = cargaMassa.listaAbastecimentosSelected.map(function (a) {\r\n return {\r\n IdcAbast: a.IdcAbastecimentoTanque,\r\n IdcUsuMan: UsuarioService.indice,\r\n IdcTransferencia: a.IdentificadorTransferenciaProduto\r\n }\r\n });\r\n\r\n console.log(abast);\r\n var payload = {\r\n DscCargaMassa: cargaMassa.selected.DscCargaMassa,\r\n DthCargaMassa: cargaMassa.selected.DthCargaMassa,\r\n IdcCargaMassa: cargaMassa.selected.IdcCargaMassa,\r\n DthCriacaoReg: cargaMassa.selected.DthCriacaoReg,\r\n Agendado: resposta.tipoEnvio == 'agendar',\r\n DthAgendado: resposta.dthEnvio,\r\n ListCtrEnvioErp: abast\r\n }\r\n sppiner.spin();\r\n CargaMassaModel.send(payload)\r\n .then(function (resposta) {\r\n cargaMassa.selected = resposta;\r\n sppiner.stop();\r\n MessageService.alert(TranslateService('success'), TranslateService('carga-massa-sap-gpv'));\r\n cargaMassa.isTelaConsuta = true;\r\n cargaMassa.filtro = \"\";\r\n getCargaMassa()\r\n\r\n })\r\n .catch(function (err) {\r\n MessageService.alert(TranslateService('atention'), TranslateService('carga-massa-erro-registro-faltante'));\r\n sppiner.stop();\r\n });\r\n }\r\n })\r\n }\r\n\r\n cargaMassa.ChangeTipoMovimentacao = function (carga) {\r\n if (carga)\r\n getCargaMassa();\r\n else\r\n getNewAbast();\r\n }\r\n\r\n function getNewAbast() {\r\n sppiner.spin();\r\n CargaMassaModel.getListNewAbast(\r\n cargaMassa.dthInicial,\r\n cargaMassa.dthFinal,\r\n cargaMassa.diretoria ? cargaMassa.diretoria.IdcDiretoria : null,\r\n cargaMassa.complexo ? cargaMassa.complexo.IdcComplexo : null,\r\n cargaMassa.produto ? cargaMassa.produto.IdcProduto : null,\r\n cargaMassa.classe ? cargaMassa.classe.IdcClasse : null,\r\n cargaMassa.tipo ? cargaMassa.tipo.IdcTipo : null,\r\n cargaMassa.cnpj,\r\n cargaMassa.posto ? cargaMassa.posto.IdcPosto : null,\r\n cargaMassa.unidade ? cargaMassa.unidade.IdcUnidade : null,\r\n cargaMassa.movimentacao\r\n )\r\n .then(function (resposta) {\r\n cargaMassa.newListNewAbast = resposta;\r\n var idcs = cargaMassa.listaAbastecimentosSelected.map(function (a) {\r\n return a.IdcAbastecimentoTanque\r\n });\r\n\r\n var listSelect = cargaMassa.newListNewAbast.filter(function (a) {\r\n return idcs.indexOf(a.IdcAbastecimentoTanque) != -1\r\n })\r\n\r\n angular.forEach(listSelect, function (abast) {\r\n abast.selected = true;\r\n });\r\n sppiner.stop();\r\n });\r\n }\r\n\r\n cargaMassa.voltar = function () {\r\n cargaMassa.isTelaConsuta = true;\r\n cargaMassa.filtro = \"\";\r\n cargaMassa.isTelaNew = false;\r\n };\r\n\r\n function getProduto() {\r\n sppiner.spin();\r\n CargaMassaModel.getProduto()\r\n .then(function (resposta) {\r\n cargaMassa.listaClasse = resposta;\r\n sppiner.stop();\r\n });\r\n }\r\n\r\n // Inicialização\r\n inicializar();\r\n }\r\n})();\r\n\r\n(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil')\r\n .filter('uniqueCarga', function () {\r\n return function (items) {\r\n\r\n if (!items) return [];\r\n\r\n var seen = new Set();\r\n var a = items.filter(function (item) {\r\n if (seen.has(item.DscCargaMassa))\r\n return false;\r\n seen.add(item.DscCargaMassa)\r\n return true;\r\n })\r\n console.log(a)\r\n return a;\r\n };\r\n });\r\n})();\r\n\r\n\r\n\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('CentroCustoController', ElementoPepController);\r\n\r\n ElementoPepController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'CentroCustoModel',\r\n 'GerenciaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function ElementoPepController(\r\n ValidacaoService,\r\n Constant,\r\n CentroCustoModel,\r\n GerenciaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadCentroCusto = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadCentroCusto.filtro = '';\r\n cadCentroCusto.listaCentroCusto = null;\r\n cadCentroCusto.listaGerencia = null;\r\n \r\n cadCentroCusto.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadCentroCusto.selected = null;\r\n cadCentroCusto.isTelaConsuta = true;\r\n cadCentroCusto.validacao = ValidacaoService;\r\n cadCentroCusto.IdcCentroCusto = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n getCentroCusto();\r\n getGerencia();\r\n\r\n \r\n }\r\n\r\n function getCentroCusto() {\r\n CentroCustoModel.getAll()\r\n .then(function (resposta) {\r\n cadCentroCusto.listacadCentroCusto = resposta;\r\n \r\n });\r\n }\r\n\r\n function getGerencia() {\r\n GerenciaModel.getAll()\r\n .then(function (resposta) {\r\n\r\n cadCentroCusto.listaGerencia = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadCentroCusto.click = function (item) {\r\n cadCentroCusto.selected = item;\r\n //cadCentroCusto.DscGerencia = item.CadGerencia.DscGerencia;\r\n cadCentroCusto.IdcCentroCusto = item.IdcCentroCusto;\r\n cadCentroCusto.isTelaConsuta = false;\r\n\r\n\r\n }\r\n\r\n\r\n cadCentroCusto.atualizar = function () {\r\n getCentroCusto();\r\n }\r\n\r\n cadCentroCusto.novo = function () {\r\n cadCentroCusto.isTelaConsuta = false;\r\n cadCentroCusto.selected = {};\r\n ValidacaoService.resetForm(formcadCentroCusto);\r\n }\r\n\r\n cadCentroCusto.salvar = function (formcadCentroCusto) {\r\n \r\n if(formcadCentroCusto.$valid)\r\n {\r\n\r\n CentroCustoModel.save(cadCentroCusto.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadCentroCusto);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadCentroCusto.isTelaConsuta = true;\r\n getCentroCusto();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadCentroCusto.cancelar = function (formcadCentroCusto) {\r\n cadCentroCusto.isTelaConsuta = true;\r\n getCentroCusto();\r\n cadCentroCusto.selected = null;\r\n cadCentroCusto.IdcCentroCusto = null;\r\n }\r\n\r\n cadCentroCusto.excluir = function (formcadCentroCusto) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n CentroCustoModel.excluir(cadCentroCusto.IdcCentroCusto)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadCentroCusto);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadCentroCusto.isTelaConsuta = true;\r\n getCentroCusto();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ComplexoController', ComplexoController);\r\n\r\n ComplexoController.$inject = [\r\n 'ValidacaoService',\r\n 'ComplexoModel',\r\n 'DiretoriaModel',\r\n 'Constant',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function ComplexoController(\r\n ValidacaoService,\r\n ComplexoModel,\r\n DiretoriaModel,\r\n Constant,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var cadComplexo = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n cadComplexo.filtro = '';\r\n cadComplexo.listacadComplexo = null;\r\n cadComplexo.listDiretorias = null;\r\n cadComplexo.listStatus = Constant.INDICADORES_ATIVO;\r\n cadComplexo.selected = null;\r\n cadComplexo.isTelaConsuta = true;\r\n cadComplexo.validacao = ValidacaoService;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializar() {\r\n getComplexos();\r\n getDiretorias();\r\n }\r\n\r\n function getComplexos() {\r\n return ComplexoModel.getAll()\r\n .then(function (resposta) {\r\n cadComplexo.listacadComplexo = resposta;\r\n });\r\n }\r\n\r\n function getDiretorias() {\r\n DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n cadComplexo.listDiretorias = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n cadComplexo.click = function (item) {\r\n cadComplexo.selected = item;\r\n cadComplexo.isTelaConsuta = false;\r\n }\r\n\r\n cadComplexo.atualizar = function () {\r\n getComplexos();\r\n }\r\n\r\n cadComplexo.novo = function () {\r\n cadComplexo.isTelaConsuta = false;\r\n cadComplexo.selected = {};\r\n }\r\n\r\n cadComplexo.salvar = function (formcadComplexo) {\r\n ComplexoModel.save(cadComplexo.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadComplexo);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadComplexo.isTelaConsuta = true;\r\n getComplexos();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n\r\n }\r\n\r\n cadComplexo.cancelar = function (formcadComplexo) {\r\n cadComplexo.isTelaConsuta = true;\r\n getComplexos();\r\n cadComplexo.selected = null;\r\n }\r\n\r\n cadComplexo.excluir = function (formcadComplexo) {\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n ComplexoModel.excluir(cadComplexo.selected.IdcComplexo)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadComplexo);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadComplexo.isTelaConsuta = true;\r\n getComplexos();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ConfigController', ConfigController);\r\n\r\n ConfigController.$inject = [\r\n '$http'\r\n ];\r\n\r\n function ConfigController(\r\n $http\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var config = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n config.filtro = '';\r\n config.list = [];\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n $http.get('/server/mobileServer/_config.ashx')\r\n .then(function (response) {\r\n config.list = response.data;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ContingenciaController', ContingenciaController);\r\n ContingenciaController.$inject = [\r\n 'SelTurnoService',\r\n 'BlocoMedidorModel',\r\n 'ContingenciaModel',\r\n 'ModalService',\r\n '$timeout',\r\n 'ValidacaoService',\r\n 'TransitionService',\r\n 'GeneralModel',\r\n 'FocusService',\r\n 'MessageService',\r\n 'RegAnomaliaService',\r\n 'Constant',\r\n 'CtrHorHodModel',\r\n '$filter',\r\n '$q',\r\n 'UsuarioService',\r\n 'CadEquipamentoModel',\r\n 'TranslateService',\r\n 'CheckContingencia',\r\n 'RegEstornoModel',\r\n 'DiretoriaModel',\r\n 'ComplexoModel',\r\n 'UnidadeModel',\r\n 'PostoModel',\r\n 'SpinnerService',\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function ContingenciaController(\r\n SelTurnoService,\r\n BlocoMedidorModel,\r\n ContingenciaModel,\r\n ModalService,\r\n $timeout,\r\n validacao,\r\n TransitionService,\r\n GeneralModel,\r\n focus,\r\n MessageService,\r\n RegAnomaliaService,\r\n Constant,\r\n CtrHorHodModel,\r\n $filter,\r\n $q,\r\n UsuarioService,\r\n CadEquipamentoModel,\r\n TranslateService,\r\n CheckContingencia,\r\n RegEstornoModel,\r\n DiretoriaModel,\r\n ComplexoModel,\r\n UnidadeModel,\r\n PostoModel,\r\n SpinnerService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var contingencia = this;\r\n\r\n //Propriedades privadas\r\n var modalTanque = new ModalService({\r\n templateUrl: 'abastecimentoTanque.html',\r\n controller: 'AbastecimentoTanqueController',\r\n controllerAs: 'abTanque'\r\n });\r\n function InicializaVariaveis() {\r\n\r\n //Propriedades públicas\r\n contingencia.SelTurnoService = SelTurnoService;\r\n contingencia.validacao = validacao;\r\n contingencia.listaAbastecimento = null;\r\n contingencia.selected = null;\r\n contingencia.regTanqueSelected = null;\r\n contingencia.filtro = null;\r\n contingencia.isTelaConsuta = false;\r\n contingencia.isTelaBusca = true;\r\n contingencia.changeTimeout = null;\r\n contingencia.msgValidaTag = TranslateService('invalid-equipment');\r\n contingencia.tagPlacaValida = false;\r\n contingencia.Anomalias = [];\r\n contingencia.status = Constant.NOVO;\r\n contingencia.Constant = Constant;\r\n contingencia.blocosMedidores = null;\r\n contingencia.isEmAvaliacao = false;\r\n contingencia.abastecimentoEstornado = false;\r\n\r\n\r\n contingencia.diretoriaSelected = null;\r\n contingencia.diretoriaSelected = null;\r\n contingencia.complexoSelected = null;\r\n contingencia.unidadeSelected = null;\r\n contingencia.PostoSelected = null;\r\n contingencia.listaDiretoria = [];\r\n contingencia.listaComplexo = [];\r\n contingencia.listaUnidade = [];\r\n contingencia.listaPosto = [];\r\n\r\n contingencia.dataInicial = getDateNowWithoutTime();\r\n contingencia.dataFinal = getDateNowWithoutTime();\r\n contingencia.popupDataInicial = { opened: false };\r\n contingencia.popupDataFinal = { opened: false };\r\n\r\n contingencia.spinner = new SpinnerService();\r\n contingencia.original = null;\r\n contingencia.editClick = true;\r\n \r\n }\r\n InicializaVariaveis();\r\n //Métodos privados\r\n\r\n function InicializaVariaveis2() {\r\n\r\n //Propriedades públicas\r\n contingencia.SelTurnoService = SelTurnoService;\r\n contingencia.validacao = validacao;\r\n contingencia.selected = null;\r\n contingencia.regTanqueSelected = null;\r\n\r\n contingencia.original = null;\r\n\r\n contingencia.editClick = true;\r\n\r\n }\r\n\r\n function setValido(abastecimento) {\r\n if (abastecimento &&\r\n abastecimento.listAbastecimentoTanque &&\r\n abastecimento.listAbastecimentoTanque.length) {\r\n angular.forEach(abastecimento.listAbastecimentoTanque, function (tanque) {\r\n tanque.valido = true;\r\n });\r\n return abastecimento;\r\n }\r\n }\r\n\r\n function getDateNowWithoutTime() {\r\n var response = new Date;\r\n response.setHours(0);\r\n response.setMinutes(0);\r\n response.setSeconds(0);\r\n response.setMilliseconds(0);\r\n return response;\r\n }\r\n\r\n contingencia.getDiretorias = function () {\r\n DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n contingencia.listaDiretoria = resposta.sort(function (a, b) {\r\n return a.DscDiretoria < b.DscDiretoria ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n function salvarServidor(formAbastecimento) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n return new $q(function (resolve, reject) {\r\n\r\n contingencia.selected.ValHorHod = contingencia.selected.ValHorHod || 0;\r\n contingencia.selected.NomDispositivo = \"WEB-MOBILE\";\r\n\r\n if (!contingencia.selected || !contingencia.selected.listAbastecimentoTanque) {\r\n reject({ refresh: true, message: function () { MessageService.alert(TranslateService('error'), TranslateService('invalid-refueling-data'), null, 'Erro') } });\r\n return;\r\n }\r\n\r\n var tanqueIndexToremove = [];\r\n\r\n //TODO - Por algum motivo existem duas propriedades. Deve-se verificar para que exista uma só\r\n contingencia.selected.listAbastecimentoTanque.forEach(function (tanque, index) {\r\n tanque.ValEncerranteAbastecimento = tanque.ValEncerrante;\r\n if (!(tanque.IdcBlocoMedidor && tanque.ValEncerrante)) {\r\n tanqueIndexToremove.push(index);\r\n }\r\n });\r\n\r\n for (var i = tanqueIndexToremove.length - 1; i >= 0; i--) {\r\n var itemsToRemove = 1;\r\n contingencia.selected.listAbastecimentoTanque.splice(tanqueIndexToremove[i], itemsToRemove);\r\n }\r\n\r\n console.log(contingencia.selected)\r\n\r\n //Guarda as anomalias registradas dentro do registro do abastecimento e limpa a lista geral de anomalias\r\n contingencia.selected.Anomalias = contingencia.Anomalias;\r\n contingencia.Anomalias = [];\r\n\r\n //contingencia.selected.SglPosto = contingencia.SelTurnoService.turno.SglPosto;\r\n contingencia.selected.VolumeTotal = contingencia.selected.listAbastecimentoTanque[0].VolAbastecimento;\r\n\r\n var abastecimentoAux = contingencia.selected;\r\n\r\n ContingenciaModel.verificaAbastecimentoExistente(contingencia.selected)\r\n .then(function (resposta) {\r\n if (resposta == \"repeted\") {\r\n var dataFormatada = $filter('date')(contingencia.DthInicial, TranslateService('datetime-format'));\r\n reject({ refresh: true, message: function () { MessageService.alert(TranslateService('apont-ja-exist-equip-data', abastecimentoAux.CodTagPlacaEqp, dataFormatada)) } });\r\n } else {\r\n if ((resposta != \"\")) {\r\n MessageService.prompt(\r\n TranslateService('apont-ja-exist-equip-turno', abastecimentoAux.CodTagPlacaEqp, resposta)\r\n ).then(function (confirm) {\r\n contingencia.salvaAbastecimento(abastecimentoAux, SelTurnoService.isFechado())\r\n .then(function (success) { resolve(success) })\r\n .catch(function (error) { reject(error) });\r\n }).catch(function (cancel) { reject({ refresh: true, message: undefined }) });\r\n } else {\r\n contingencia.salvaAbastecimento(abastecimentoAux, SelTurnoService.isFechado())\r\n .then(function (success) { resolve(success) })\r\n .catch(function (error) { reject(error) });\r\n }\r\n }\r\n\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n reject({ refresh: true, message: undefined });\r\n });\r\n });\r\n }\r\n\r\n contingencia.salvaAbastecimento = function (regAbastecimento, turnoFechado) {\r\n return new $q(function (resolve, reject) {\r\n var filter = {}\r\n console.log(contingencia.selected)\r\n filter.IdcPosto = contingencia.original.IdcPosto;\r\n filter.IdcRegTurno = contingencia.original.IdcRegTurno;\r\n filter.IdcAbastecimento = contingencia.original.IdcAbastecimento;\r\n filter.Tag = contingencia.selected.CodTagPlacaEqp;\r\n ContingenciaModel.salvaAbastecimento(regAbastecimento, false)\r\n .then(function (resposta) {\r\n console.log(resposta)\r\n if (resposta) {\r\n //contingencia.getAbastecimentos(SelTurnoService.turno.IdcRegTurno);\r\n contingencia.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n contingencia.listaAbastecimento = contingencia.listaAbastecimento.filter(function (abast) {\r\n return abast.IdcAbastecimento != regAbastecimento.IdcAbastecimento;\r\n });\r\n resolve({ refresh: true, message: function () { MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\") } });\r\n //validacao.resetForm(formAbastecimento);\r\n } else {\r\n throw new Error(TranslateService('saving-failed'));\r\n }\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n reject({ refresh: true, message: function () { MessageService.alert(TranslateService('error'), erro) } });\r\n });\r\n });\r\n };\r\n\r\n contingencia.retornaTempoAbastecimento = function (regAbastecimento) {\r\n var diff = regAbastecimento.DthFinal - regAbastecimento.DthInicial;\r\n var hours = Math.floor(diff / 3.6e6);\r\n var minutes = Math.floor((diff % 3.6e6) / 6e4);\r\n var seconds = Math.floor((diff % 6e4) / 1000);\r\n\r\n if (isNaN(diff) || isNaN(hours) || isNaN(minutes) || isNaN(seconds)) {\r\n return TranslateService('data-invalida');\r\n }\r\n else {\r\n return (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds);\r\n }\r\n };\r\n\r\n function isProdutoEquipamentoCompativel(abastecimento) {\r\n return BlocoMedidorModel.getByIdcPosto(contingencia.original.IdcPosto, contingencia.original.IdcRegTurno)\r\n .then(function (blocos) {\r\n var listBlocosInvalidos = [];\r\n var blocoProximoVenc = [];\r\n var proximoAVenc = [];\r\n var listInvalidos = [];\r\n var msgReturn = \"\";\r\n var produtoValido = false;\r\n for (var indexBloco in blocos) {\r\n var bloco = blocos[indexBloco];\r\n\r\n if (bloco.ChkBloqueioCertificadoVencido) {\r\n if (bloco.IsBlocoInvalido) {\r\n listBlocosInvalidos.push(bloco);\r\n }\r\n else if (bloco.DthVencCertificado != null) {\r\n if (bloco.IsBlocoAVencer) {\r\n blocoProximoVenc.push(bloco);\r\n }\r\n }\r\n }\r\n\r\n for (var indexTanque in contingencia.selected.listAbastecimentoTanque) {\r\n var tanque = contingencia.selected.listAbastecimentoTanque[indexTanque];\r\n for (var indexProduto in tanque.listProdutoTanque) {\r\n var produtoAbastecimento = tanque.listProdutoTanque[indexProduto];\r\n if (produtoAbastecimento.IdcProduto === bloco.IdcProduto && bloco.StuBlocoMedidor === 'S') {\r\n produtoValido = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (blocoProximoVenc.length > 0) {\r\n for (var i in blocoProximoVenc) {\r\n if (!proximoAVenc.includes(blocoProximoVenc[i].SglBlocoMedidor)) {\r\n proximoAVenc.push(blocoProximoVenc[i].SglBlocoMedidor);\r\n }\r\n }\r\n if (blocoProximoVenc.length > 1) {\r\n msgReturn += TranslateService('refueling-some-next-expiration-measuring') + proximoAVenc.join();\r\n } else {\r\n msgReturn += '\\n' + TranslateService('refueling-next-expiration-measuring') + blocoProximoVenc[i].SglBlocoMedidor;\r\n }\r\n }\r\n\r\n if (listBlocosInvalidos.length > 0) {\r\n\r\n if (listBlocosInvalidos.length === blocos.length) {\r\n throw new Error(TranslateService('refueling-measuring-invalid'));\r\n } else {\r\n msgReturn += '\\n' + TranslateService('refueling-some-measuring-invalid');\r\n\r\n for (var i in listBlocosInvalidos) {\r\n if (!listInvalidos.includes(listBlocosInvalidos[i].SglBlocoMedidor)) {\r\n listInvalidos.push(listBlocosInvalidos[i].SglBlocoMedidor);\r\n }\r\n }\r\n if (listBlocosInvalidos.length > 1) {\r\n msgReturn += listInvalidos.join();\r\n } else {\r\n msgReturn += listBlocosInvalidos[i].SglBlocoMedidor;\r\n }\r\n }\r\n }\r\n\r\n if (!produtoValido) {\r\n throw new Error(TranslateService('refueling-incompatible-product'));\r\n }\r\n return msgReturn;\r\n });\r\n }\r\n\r\n function atualizaAbastecimentoSelected(resposta, tagPlaca) {\r\n if (!resposta || resposta === 'null') {\r\n contingencia.tagPlacaValida = false;\r\n contingencia.msgValidaTag = TranslateService('non-existing-equipment');\r\n contingencia.selected = {};\r\n contingencia.selected.CodTagPlacaEqp = tagPlaca;\r\n return $q.reject();\r\n } else if (resposta.DthVencimentoContrato < new Date()) {\r\n var dataFormatada = $filter('date')(resposta.DthVencimentoContrato, TranslateService('date-format'));\r\n contingencia.tagPlacaValida = false;\r\n contingencia.msgValidaTag = TranslateService('expired-contract') + dataFormatada;\r\n contingencia.selected = {};\r\n contingencia.selected.CodTagPlacaEqp = tagPlaca;\r\n return $q.rejectf\r\n } else {\r\n return isProdutoEquipamentoCompativel(resposta)\r\n .then(function (resValidation) {\r\n contingencia.msgTagWarning = resValidation;\r\n contingencia.tagPlacaValida = true;\r\n contingencia.selected = resposta;\r\n contingencia.selected.dataFinalOriginal = true;\r\n contingencia.selected.ValHorHod = null;\r\n contingencia.selected.DthInicial = contingencia.original.DthInicial;\r\n contingencia.selected.DthFinal = contingencia.original.DthFinal;\r\n contingencia.selected.duracao = contingencia.retornaTempoAbastecimento(contingencia.selected);\r\n contingencia.selected.NomeOperador = UsuarioService.nome;\r\n contingencia.selected.IdcAbastecimento = contingencia.original.IdcAbastecimento;\r\n contingencia.selected.SglPosto = contingencia.original.SglPosto;\r\n contingencia.selected.SglBlocoMedidor = contingencia.original.SglBlocoMedidor;\r\n contingencia.selected.IdcPosto = contingencia.original.IdcPosto;\r\n contingencia.selected.IdcRegTurno = contingencia.original.IdcRegTurno;\r\n contingencia.selected.listAbastecimentoTanque.forEach(function (tanque) {\r\n tanque.DthAbastecimentoTanque = contingencia.selected.DthInicial;\r\n tanque.valido = true;\r\n });\r\n\r\n contingencia.changeHorimetro();\r\n\r\n return $q.resolve();\r\n })\r\n .catch(function (error) {\r\n contingencia.tagPlacaValida = false;\r\n contingencia.msgValidaTag = error.message;\r\n contingencia.selected = {};\r\n contingencia.selected.CodTagPlacaEqp = tagPlaca;\r\n return $q.reject();\r\n });\r\n }\r\n }\r\n\r\n function preencheAbastecimento(regAbastecimento) {\r\n var retorno = {\r\n \"Anomalias\": null,\r\n \"ChkContingencia\": false,\r\n \"ChkHorimetro\": false,\r\n \"ChkResetAutomaticoHorHod\": false,\r\n \"CodTagPlacaEqp\": \"\",\r\n \"ContratoVencido\": true,\r\n \"DscGerenciaGa\": null,\r\n \"DthCriacaoReg\": new Date,\r\n \"DthFinal\": new Date,\r\n \"DthInicial\": new Date,\r\n \"DthVencimentoContrato\": new Date,\r\n \"IdcAbastecimento\": 0,\r\n \"IdcCentroCusto\": 0,\r\n \"CodCentroCusto\": \"\",\r\n \"IdcContrato\": 0,\r\n \"IdcElementoPep\": 0,\r\n \"CodElementoPep\": \"\",\r\n \"IdcEmpresa\": 0,\r\n \"IdcEquipamento\": 0,\r\n \"IdcGri\": 0,\r\n \"IdcOrdemEstatistica\": 0,\r\n \"CodOrdemEstatistica\": \"\",\r\n \"IdcPosto\": 0,\r\n \"IdcRegTurno\": 0,\r\n \"IdcTipoFiscal\": 0,\r\n \"IdcTransferencia\": null,\r\n \"IdcUsuario\": 0,\r\n \"IsLocomotiva\": false,\r\n \"IsWaitingApprovalChange\": false,\r\n \"ListTanques\": [],\r\n \"NomDispositivo\": null,\r\n \"NomEmpresa\": \"\",\r\n \"NomeOperador\": \"\",\r\n \"NumDigitos\": 0,\r\n \"PendenteAvaliacao\": false,\r\n \"PossuiHorHod\": false,\r\n \"SglGerenciaGa\": null,\r\n \"SglTurno\": \"\",\r\n \"StatusSalvamento\": 0,\r\n \"StuAbastecimento\": null,\r\n \"TanquesLiberadosParaAbastecimento\": 0,\r\n \"TipoEquipamento\": \"\",\r\n \"UltimoHorHod\": 0,\r\n \"ValHorHod\": 0,\r\n \"VolumeTotal\": 0,\r\n \"key\": 0\r\n };\r\n\r\n for (var key in regAbastecimento) {\r\n retorno[key] = regAbastecimento[key];\r\n }\r\n\r\n for (var i in regAbastecimento.listAbastecimentoTanque) {\r\n regAbastecimento.listAbastecimentoTanque[i] = preencheAbastecimentoTanque(regAbastecimento.listAbastecimentoTanque[i]);\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function preencheAbastecimentoTanque(regAbastecimentoTanque) {\r\n var retorno = {\r\n \"ChkAbastecimentoTanque\": 0,\r\n \"ChkResetAutomaticoBlocoMedidor\": false,\r\n \"ChkResetAutomaticoEncerrante\": false,\r\n \"DenAbastecimento\": null,\r\n \"DscClasseProduto\": null,\r\n \"DscProduto\": null,\r\n \"DscTanqueEquipamento\": \"EQP-TQ-001\",\r\n \"DscTipoProduto\": null,\r\n \"DthAbastecimentoTanque\": \"/Date(-62135589600000)/\",\r\n \"DthCriacaoReg\": \"/Date(-62135589600000)/\",\r\n \"EncerranteValido\": false,\r\n \"IdcAbastecimento\": 0,\r\n \"IdcAbastecimentoTanque\": 0,\r\n \"IdcBlocoMedidor\": 0,\r\n \"IdcCargaMassa\": null,\r\n \"IdcEquipamento\": 1,\r\n \"IdcProduto\": 0,\r\n \"IdcRateio\": null,\r\n \"IdcTanqueEquipamento\": 1,\r\n \"IdcUsuMan\": null,\r\n \"RegPorEncerrante\": null,\r\n \"RegEstornado\": false,\r\n \"SglBlocoMedidor\": null,\r\n \"SglProduto\": null,\r\n \"StuEnvioSap\": \"\",\r\n \"TmpAbastecimento\": null,\r\n \"UeFator\": 1,\r\n \"ValCapacidadeNominal\": 300,\r\n \"ValConsumoEsp\": 0,\r\n \"ValEncerrante\": 0,\r\n \"ValEncerranteAbastecimento\": null,\r\n \"VolAbastecimento\": null,\r\n \"VolAbastecimento20c\": null,\r\n \"VolAtual\": null,\r\n \"idDataGrid\": 1,\r\n \"key\": 0,\r\n \"listAnomalia\": []\r\n };\r\n\r\n for (var key in regAbastecimentoTanque) {\r\n retorno[key] = regAbastecimentoTanque[key];\r\n }\r\n\r\n for (var i in regAbastecimentoTanque.listProdutoTanque) {\r\n regAbastecimentoTanque.listProdutoTanque[i] = preencheRelProduto(regAbastecimentoTanque.listProdutoTanque[i]);\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function preencheRelProduto(relProduto) {\r\n var retorno = {\r\n \"DscClasse\": \"COMBUSTIVEL\",\r\n \"DscTipo\": \"DIESEL\",\r\n \"IdcProduto\": 2,\r\n \"SglProduto\": \"S500\",\r\n \"length\": 1,\r\n \"listAnomalia\": []\r\n };\r\n\r\n for (var key in relProduto) {\r\n retorno[key] = relProduto[key];\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n //Métodos publicos\r\n\r\n contingencia.getAbastecimentos = function () {\r\n if (contingencia.diretoriaSelected == null || contingencia.complexoSelected == null) {\r\n MessageService.alert(TranslateService('atention'), TranslateService('diretoria-complexo-contingencia'));\r\n return;\r\n }\r\n \r\n\r\n contingencia.status = Constant.EDICAO;\r\n contingencia.spinner.spin();\r\n var filters = {}\r\n filters.IdcDiretoria = contingencia.diretoriaSelected;\r\n filters.IdcComplexo = contingencia.complexoSelected;\r\n filters.IdcUnidade = contingencia.unidadeSelected;\r\n filters.IdcPosto = contingencia.PostoSelected;\r\n filters.dataInicial = contingencia.dataInicial;\r\n filters.dataFinal = contingencia.dataFinal;\r\n ContingenciaModel.getAllByFilters(filters)\r\n .then(function (resposta) {\r\n contingencia.listaAbastecimento = resposta.data;\r\n contingencia.spinner.stop();\r\n contingencia.isTelaBusca = false;\r\n for (var i = 0; i < contingencia.listaAbastecimento.length; i++) {\r\n contingencia.listaAbastecimento[i].DthInicialSearch =\r\n $filter('date')(\r\n contingencia.listaAbastecimento[i].DthInicial,\r\n TranslateService('datetime-format')\r\n );\r\n contingencia.listaAbastecimento[i].DthFinalSearch =\r\n $filter('date')(\r\n contingencia.listaAbastecimento[i].DthFinal,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n if (contingencia.listaAbastecimento.length == 0) {\r\n MessageService.alert(TranslateService('sem-abastecimento'), TranslateService('sem-contingencia'));\r\n // MessageService.alert('Não há abastecimento', 'Não foram encontrados abastecimentos em contingencias para esses filtros');\r\n\r\n contingencia.isTelaBusca = true;\r\n }\r\n });\r\n };\r\n\r\n contingencia.abastClick = function (regAbastecimento) {\r\n contingencia.status = Constant.EDICAO;\r\n contingencia.editar(regAbastecimento);\r\n contingencia.isEmAvaliacao = false;\r\n\r\n ContingenciaModel.isEmAvaliacao(regAbastecimento.IdcAbastecimento)\r\n .then(function (resposta) {\r\n contingencia.isEmAvaliacao = resposta;\r\n });\r\n };\r\n\r\n contingencia.getVolumeTotal = function (regAbastecimento) {\r\n var soma = regAbastecimento.ListRegAbastecimentoTanque.reduce(function (somatorio, elemento) {\r\n return somatorio + elemento.VolAbastecimento;\r\n }, 0);\r\n\r\n return soma\r\n }\r\n\r\n contingencia.tanqueClick = function (regTanque, form) {\r\n if (contingencia.abastecimentoEstornado) return;\r\n\r\n if (form.$invalid) {\r\n form.$submitted = true;\r\n MessageService.prompt(\r\n TranslateService(\"atention\"),\r\n TranslateService(\"continue-with-invalid-data\")\r\n ).then(function () {\r\n contingencia.regTanqueSelected = regTanque;\r\n contingencia.editarTanque(regTanque);\r\n });\r\n } else {\r\n contingencia.regTanqueSelected = regTanque;\r\n contingencia.editarTanque(regTanque);\r\n }\r\n };\r\n\r\n contingencia.editar = function (regAbastecimento) {\r\n if (!regAbastecimento) return;\r\n contingencia.selected = {};\r\n if (regAbastecimento.IdcTransferencia) {\r\n return MessageService.alert(TranslateService('atention'), TranslateService('resupply-association-error'));\r\n }\r\n\r\n contingencia.tagPlacaValida = contingencia.status !== Constant.NOVO;\r\n contingencia.msgTagWarning = null;\r\n contingencia.selected = setValido(regAbastecimento);\r\n contingencia.original = contingencia.selected;\r\n if (Object.keys(regAbastecimento).length)\r\n contingencia.selected.duracao = contingencia.retornaTempoAbastecimento(regAbastecimento);\r\n\r\n if (contingencia.selected && contingencia.selected.IdcEstorno) {\r\n contingencia.selected.ChkCompensaEstorno = true;\r\n }\r\n\r\n contingencia.abastecimentoEstornado = regAbastecimento.listAbastecimentoTanque && regAbastecimento.listAbastecimentoTanque.some(function (item) { return item.StuEnvioSap == \"7\" });\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n contingencia.isTelaConsuta = false;\r\n SelTurnoService.canSelect = false;\r\n\r\n focus('tagPlaca');\r\n };\r\n\r\n contingencia.editarTanque = function (regTanque) {\r\n modalTanque.open({ regTanque: regTanque, isEmAvaliacao: contingencia.isEmAvaliacao });\r\n };\r\n\r\n contingencia.atualizar = function () {\r\n InicializaVariaveis2();\r\n contingencia.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n \r\n };\r\n\r\n contingencia.novo = function () {\r\n contingencia.isEmAvaliacao = false;\r\n contingencia.status = Constant.NOVO;\r\n contingencia.selected = {};\r\n contingencia.editar(contingencia.selected);\r\n };\r\n\r\n contingencia.salvar = function (formAbastecimento) {\r\n if (!contingencia.selected) return;\r\n\r\n CheckContingencia(contingencia.selected)\r\n .then(function () {\r\n MessageService.prompt(\r\n TranslateService(\"atention\"),\r\n TranslateService(\"contigencia-salvar\")\r\n ).then(function () {\r\n salvarServidor(formAbastecimento).then(function (success) {\r\n if (success && success.message && typeof success.message === 'function')\r\n success.message();\r\n contingencia.atualizar();\r\n }).catch(function (error) {\r\n if (error && error.message && typeof error.message === 'function')\r\n error.message();\r\n\r\n if (error && error.refresh)\r\n contingencia.atualizar();\r\n });\r\n });\r\n });\r\n };\r\n\r\n contingencia.cancelar = function (formAbastecimento) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n contingencia.Anomalias = [];\r\n contingencia.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n validacao.resetForm(formAbastecimento);\r\n contingencia.atualizar();\r\n };\r\n\r\n\r\n contingencia.cancelarList = function (formAbastecimento) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n contingencia.isTelaConsuta = true;\r\n contingencia.isTelaBusca = true;\r\n SelTurnoService.canSelect = true;\r\n contingencia.atualizar();\r\n };\r\n contingencia.newChangeTime = function (obj, prop) {\r\n if (!contingencia.selected || !contingencia.selected.listAbastecimentoTanque) return;\r\n\r\n contingencia.selected.dataFinalOriginal = false;\r\n\r\n contingencia.selected.listAbastecimentoTanque.forEach(function (tanque) {\r\n tanque.DthAbastecimentoTanque = contingencia.selected.DthInicial;\r\n });\r\n\r\n validacao.newChangeTime(obj, prop);\r\n\r\n contingencia.changeHorimetro();\r\n\r\n contingencia.selected.duracao = contingencia.retornaTempoAbastecimento(contingencia.selected);\r\n contingencia.selected.duracao = contingencia.selected.DthInicial <= contingencia.selected.DthFinal ? contingencia.selected.duracao : \"--:--.--\";\r\n\r\n };\r\n\r\n contingencia.changePlaca = function (tagPlaca) {\r\n $timeout.cancel(contingencia.changeTimeout);\r\n contingencia.spinner.spin();\r\n contingencia.changeTimeout = $timeout(function () {\r\n return ContingenciaModel.validaTagPlaca(\r\n contingencia.selected.CodTagPlacaEqp,\r\n contingencia.original.IdcRegTurno,\r\n contingencia.original.IdcPosto,\r\n contingencia.original.IdcAbastecimento\r\n ).then(function (resposta) {\r\n if (resposta) {\r\n contingencia.spinner.stop();\r\n resposta = preencheAbastecimento(resposta.data);\r\n return atualizaAbastecimentoSelected(resposta, contingencia.selected.CodTagPlacaEqp)\r\n .then(function () {\r\n return contingencia.LoadEstorno();\r\n });\r\n\r\n\r\n contingencia.changeHorimetro();\r\n }\r\n });\r\n }, Constant.TIME_BEFORE_GO_TO_SERVER);\r\n\r\n return contingencia.changeTimeout;\r\n };\r\n\r\n contingencia.changeDiretoria = function () {\r\n contingencia.complexoSelected = null;\r\n contingencia.unidadeSelected = null;\r\n contingencia.PostoSelected = null;\r\n contingencia.listaComplexo = [];\r\n contingencia.listaUnidade = [];\r\n contingencia.listaPosto = [];\r\n contingencia.getComplexos(\r\n contingencia.listaDiretoria.filter(function (diretoria) {\r\n return diretoria.IdcDiretoria == contingencia.diretoriaSelected ? diretoria.SglDiretoria : null;\r\n })\r\n );\r\n }\r\n\r\n contingencia.openDataInicial = function () {\r\n contingencia.popupDataInicial.opened = true;\r\n };\r\n\r\n contingencia.openDataFinal = function () {\r\n contingencia.popupDataFinal.opened = true;\r\n };\r\n\r\n contingencia.changeComplexo = function () {\r\n contingencia.unidadeSelected = null;\r\n contingencia.PostoSelected = null;\r\n contingencia.listaUnidade = [];\r\n contingencia.listaPosto = [];\r\n contingencia.getUnidades(\r\n contingencia.listaComplexo.filter(function (complexo) {\r\n return complexo.IdcComplexo == contingencia.complexoSelected ? complexo.SglComplexo : null;\r\n })\r\n );\r\n }\r\n\r\n\r\n contingencia.changeUnidade = function () {\r\n contingencia.PostoSelected = null;\r\n contingencia.listaPosto = [];\r\n contingencia.getPostos(\r\n contingencia.listaUnidade.filter(function (unidade) {\r\n return unidade.IdcUnidade == contingencia.unidadeSelected ? unidade.SglUnidade : null;\r\n })\r\n );\r\n }\r\n\r\n contingencia.getComplexos = function (item) {\r\n if (item.length)\r\n ComplexoModel.getBySgl(item[0].SglDiretoria)\r\n .then(function (resposta) {\r\n contingencia.listaComplexo = resposta.sort(function (a, b) {\r\n return a.DscComplexo < b.DscComplexo ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n contingencia.getUnidades = function (item) {\r\n if (item.length)\r\n UnidadeModel.getAllSameComplexo(item[0].SglComplexo)\r\n .then(function (resposta) {\r\n contingencia.listaUnidade = resposta.sort(function (a, b) {\r\n return a.DscUnidade < b.DscUnidade ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n contingencia.getPostos = function (item) {\r\n if (item.length)\r\n PostoModel.getAllSameUnidade(item[0].IdcUnidade)\r\n .then(function (resposta) {\r\n contingencia.listaPosto = resposta.sort(function (a, b) {\r\n return a.DscPosto < b.DscPosto ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n //TODO Tem que fazer também a validação da quantidade de dígitos do horímetro\r\n contingencia.changeHorimetro = function () {\r\n var idcEquipamento = contingencia.selected.IdcEquipamento;\r\n var dateTime = contingencia.original.DthInicial;\r\n\r\n CtrHorHodModel.getLastHorimetro(idcEquipamento, dateTime)\r\n .then(function (resposta) {\r\n contingencia.selected.UltimoHorHod = resposta && resposta.ValHorHodAtual ? resposta.ValHorHodAtual : 0;\r\n });\r\n };\r\n\r\n contingencia.registrarAnomalia = function () {\r\n var id = contingencia.selected ? contingencia.selected.IdcAbastecimento : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n contingencia.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n contingencia.getEquipamentos = function (placa) {\r\n return CadEquipamentoModel.getEquipamentos(placa);\r\n };\r\n\r\n contingencia.LoadEstorno = function () {\r\n var searchParams = {\r\n IdcEquipamento: contingencia.selected.IdcEquipamento,\r\n IdcRegTurno: contingencia.selected.IdcRegTurno,\r\n IdcAbastecimento: contingencia.selected.IdcAbastecimento\r\n }\r\n\r\n if (!contingencia.selected.ChkCompensaEstorno) {\r\n contingencia.listaEstorno = []\r\n contingencia.selected.IdcEstorno = null;\r\n return $q.resolve();\r\n }\r\n else\r\n return RegEstornoModel.getAll(searchParams, 'GET').then(function (resposta) {\r\n contingencia.listaEstorno = resposta;\r\n });\r\n }\r\n\r\n contingencia.hasHorHod = function (regAbastecimento) {\r\n\r\n if (!(regAbastecimento && regAbastecimento.TipoEquipamento)) {\r\n return false;\r\n }\r\n\r\n return regAbastecimento.TipoEquipamento !== 'L' &&\r\n regAbastecimento.TipoEquipamento.toUpperCase().indexOf('COMBOIO') === -1;\r\n };\r\n\r\n contingencia.isBlocked = function () {\r\n return contingencia.isEmAvaliacao;\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n contingencia.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n\r\n })();\r\n\r\n contingencia.getDiretorias()\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ContratoController', ContratoController);\r\n\r\n ContratoController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'ModalService',\r\n 'ContratoModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function ContratoController(\r\n ValidacaoService,\r\n Constant,\r\n ModalService,\r\n ContratoModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadContrato = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadContrato.filtro = '';\r\n cadContrato.listaTurno = null; \r\n cadContrato.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadContrato.selected = null;\r\n cadContrato.isTelaConsuta = true;\r\n cadContrato.validacao = ValidacaoService;\r\n cadContrato.popupDataInicial = { opened: false };\r\n\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadContrato.isTelaConsuta = true\r\n getTurno(); \r\n }\r\n\r\n function getTurno() {\r\n ContratoModel.getAll()\r\n .then(function (resposta) {\r\n cadContrato.listaTurno = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadContrato.click = function (item) {\r\n cadContrato.selected = item;\r\n cadContrato.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadContrato.atualizar = function () {\r\n getTurno();\r\n } \r\n\r\n cadContrato.novo = function (formcadContrato) {\r\n cadContrato.isTelaConsuta = false;\r\n cadContrato.selected = {\r\n ListCadCaminhaoCompartimento : []\r\n };\r\n ValidacaoService.resetForm(formcadContrato);\r\n }\r\n\r\n cadContrato.salvar = function (formcadContrato) {\r\n \r\n if(formcadContrato.$valid)\r\n {\r\n ContratoModel.save(cadContrato.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadContrato);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadContrato.isTelaConsuta = true;\r\n getTurno();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n cadContrato.cancelar = function (formcadContrato) {\r\n cadContrato.isTelaConsuta = true;\r\n getTurno();\r\n cadContrato.selected = null;\r\n }\r\n\r\n cadContrato.excluir = function (formcadContrato) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n ContratoModel.excluir(cadContrato.selected.IdcContrato)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadContrato);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadContrato.isTelaConsuta = true;\r\n getTurno();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n cadContrato.openDataInicial = function () {\r\n cadContrato.popupDataInicial.opened = true;\r\n };\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('DetalheRecebimentoController', DetalheRecebimentoController);\r\n DetalheRecebimentoController.$inject = [\r\n '$uibModalInstance',\r\n 'locals',\r\n 'TranslateService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function DetalheRecebimentoController(\r\n $uibModalInstance,\r\n locals,\r\n TranslateService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n\r\n\r\n //Propriedades privadas\r\n\r\n var detalheRecebimento = this;\r\n\r\n //Propriedades públicas\r\n\r\n detalheRecebimento.codigoRecebimento = locals.codigoRecebimento;\r\n\r\n //Métodos privados\r\n function formatLitros(number) {\r\n number = number || 0;\r\n return number.toFixed(2) + \" \" + TranslateService('litros');\r\n }\r\n\r\n function formartPercentual(number) {\r\n number = number || 0;\r\n number = number === -Infinity ? -100 : number;\r\n return number.toFixed(2) + \"%\";\r\n }\r\n\r\n\r\n //Métodos publicos\r\n detalheRecebimento.getFechamento = function () {\r\n if (!locals) {\r\n return;\r\n }\r\n return locals.List;\r\n };\r\n\r\n detalheRecebimento.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n })();\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('DetalheRecFisicoController', DetalheRecFisicoController);\r\n\r\n DetalheRecFisicoController.$inject = [\r\n '$uibModalInstance',\r\n 'detalhe',\r\n 'recebimento',\r\n 'isEmAvaliacao',\r\n 'SelTurnoService',\r\n 'BlocoMedidorModel',\r\n 'ValidacaoService',\r\n 'CtrEncerranteModel',\r\n 'AspectoVisualModel',\r\n 'Constant',\r\n 'GeneralModel'\r\n ];\r\n\r\n function DetalheRecFisicoController(\r\n $uibModalInstance,\r\n detalhe,\r\n recebimento,\r\n isEmAvaliacao,\r\n SelTurnoService,\r\n BlocoMedidorModel,\r\n ValidacaoService,\r\n CtrEncerranteModel,\r\n AspectoVisualModel,\r\n Constant,\r\n GeneralModel\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var detalheRecFisico = this;\r\n var previousDetalheRecFisico = JSON.parse(JSON.stringify(detalhe));\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n detalheRecFisico.SelTurnoService = SelTurnoService;\r\n detalheRecFisico.detalhe = detalhe;\r\n detalheRecFisico.recebimento = recebimento;\r\n detalheRecFisico.validacao = ValidacaoService;\r\n detalheRecFisico.blocos = [];\r\n detalheRecFisico.aspectosVisuais = [];\r\n detalheRecFisico.patternEncerrante = null;\r\n detalheRecFisico.formato = null;\r\n detalheRecFisico.indicadorBinario = Constant.INDICADORES_BINARIOS;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n BlocoMedidorModel.getByIdcPostoAndId(\r\n SelTurnoService.turno.IdcPosto,\r\n detalheRecFisico.detalhe.CtrEncerrante ? detalheRecFisico.detalhe.CtrEncerrante.IdcBlocoMedidor : 0\r\n ).then(function (blocos) {\r\n detalheRecFisico.blocos = blocos;\r\n });\r\n\r\n AspectoVisualModel.getAll()\r\n .then(function (aspectosVisuais) {\r\n detalheRecFisico.aspectosVisuais = aspectosVisuais;\r\n });\r\n }\r\n\r\n function getBloco(idcBlocoMedidor) {\r\n var bloco = null;\r\n\r\n angular.forEach(detalheRecFisico.blocos, function (item) {\r\n if (item.IdcBlocoMedidor === idcBlocoMedidor) {\r\n bloco = item;\r\n }\r\n });\r\n\r\n return bloco;\r\n }\r\n\r\n function getNumDigitos(idcBlocoMedidor) {\r\n var bloco = getBloco(idcBlocoMedidor);\r\n return bloco ? bloco.NumDigitos - bloco.NumCasasDecimais : 0;\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n detalheRecFisico.cancel = function () {\r\n retorePreviousEditableValues();\r\n $uibModalInstance.close(true);\r\n };\r\n\r\n detalheRecFisico.ok = function () {\r\n $uibModalInstance.close('ok');\r\n };\r\n\r\n function retorePreviousEditableValues() {\r\n detalheRecFisico.detalhe.QuantidadeRecebida = previousDetalheRecFisico.QuantidadeRecebida;\r\n detalheRecFisico.detalhe.MedidaDensidadeProduto = previousDetalheRecFisico.MedidaDensidadeProduto;\r\n detalheRecFisico.detalhe.MedidaTemperaturaProduto = previousDetalheRecFisico.MedidaTemperaturaProduto;\r\n detalheRecFisico.detalhe.MedidaDensidadeBoletim = previousDetalheRecFisico.MedidaDensidadeBoletim;\r\n detalheRecFisico.detalhe.MedidaTemperaturaMassa = previousDetalheRecFisico.MedidaTemperaturaMassa;\r\n detalheRecFisico.detalhe.IdentificadorAspectoVisual = previousDetalheRecFisico.IdentificadorAspectoVisual;\r\n detalheRecFisico.detalhe.IndicadorPresencaAgua = previousDetalheRecFisico.IndicadorPresencaAgua;\r\n }\r\n\r\n detalheRecFisico.changeBloco = function (idcBlocoMedidor) {\r\n var bloco = getBloco(idcBlocoMedidor);\r\n\r\n detalheRecFisico.patternEncerrante = ValidacaoService.getPatternEncerrante(bloco);\r\n detalheRecFisico.formato = ValidacaoService.getFormatoEncerrante(bloco);\r\n };\r\n\r\n detalheRecFisico.changeEncerrante = function (tipo) {\r\n\r\n if (tipo === 'encerrante' && detalheRecFisico.detalhe.CtrEncerrante.ValEncerranteAtual == null) {\r\n return;\r\n }\r\n\r\n if (tipo !== 'encerrante' && detalheRecFisico.detalhe.QuantidadeComplementoProduto == null) {\r\n return;\r\n }\r\n\r\n var idcBlocoMedidor = detalheRecFisico.detalhe.CtrEncerrante.IdcBlocoMedidor;\r\n var valorEncerrante = tipo === 'encerrante' ? detalheRecFisico.detalhe.CtrEncerrante.ValEncerranteAtual : null;\r\n var dataEncerrante = detalheRecFisico.detalhe.DataHoraUTCComplemento;\r\n var valVolume = detalheRecFisico.detalhe.QuantidadeComplementoProduto;\r\n var numDigitos = getNumDigitos(idcBlocoMedidor);\r\n\r\n CtrEncerranteModel.calculaVolume(idcBlocoMedidor, valorEncerrante, dataEncerrante, valVolume, numDigitos, detalheRecFisico.detalhe.IdentificadorCompartimentoCaminhaoTanque)\r\n .then(function (resposta) {\r\n detalheRecFisico.detalhe.QuantidadeComplementoProduto = resposta.volume;\r\n detalheRecFisico.detalhe.CtrEncerrante.ValEncerranteAtual = resposta.encerrante;\r\n detalheRecFisico.detalhe.CtrEncerrante.ChkResetAutomatico = resposta.reset;\r\n detalheRecFisico.detalhe.CtrEncerrante.RegPorEncerrante = tipo === 'encerrante' ? \"S\" : \"N\";\r\n detalheRecFisico.detalhe.CtrEncerrante.DthCtrEncerrante = dataEncerrante;\r\n });\r\n };\r\n\r\n detalheRecFisico.calcula20g = function () {\r\n\r\n if (!detalheRecFisico.detalhe ||\r\n !detalheRecFisico.detalhe.MedidaDensidadeProduto ||\r\n !detalheRecFisico.detalhe.MedidaTemperaturaProduto ||\r\n !detalheRecFisico.detalhe.QuantidadeRecebida) {\r\n return;\r\n }\r\n\r\n var pIdcProduto = recebimento.IdentificadorProdutoPosto;\r\n var pValTemperatura = detalheRecFisico.detalhe.MedidaTemperaturaProduto;\r\n var pValDensidade = detalheRecFisico.detalhe.MedidaDensidadeProduto;\r\n var pValVolume = detalheRecFisico.detalhe.QuantidadeRecebida;\r\n\r\n if (!(pIdcProduto && pValTemperatura && pValDensidade && pValVolume)) return;\r\n\r\n GeneralModel.getVolume20C(pIdcProduto, pValTemperatura, pValDensidade, pValVolume).then(function (resposta) {\r\n detalheRecFisico.detalhe.QuantidadeRecebida20GrausCelsius = Number(resposta);\r\n });\r\n };\r\n\r\n detalheRecFisico.isBlocked = function () {\r\n return isEmAvaliacao;\r\n }\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('DiretoriaController', DiretoriaController);\r\n\r\n DiretoriaController.$inject = [\r\n 'ValidacaoService',\r\n 'DiretoriaModel',\r\n 'Constant',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function DiretoriaController(\r\n ValidacaoService,\r\n DiretoriaModel,\r\n Constant,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var cadDiretoria = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n cadDiretoria.filtro = '';\r\n cadDiretoria.listacadDiretoria = null;\r\n cadDiretoria.listDiretorias = null;\r\n cadDiretoria.listStatus = Constant.INDICADORES_ATIVO;\r\n cadDiretoria.selected = null;\r\n cadDiretoria.isTelaConsuta = true;\r\n cadDiretoria.validacao = ValidacaoService;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializar() {\r\n getDiretorias();\r\n \r\n }\r\n\r\n function getDiretorias() {\r\n return DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n cadDiretoria.listacadDiretoria = resposta;\r\n });\r\n }\r\n\r\n \r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n cadDiretoria.click = function (item) {\r\n cadDiretoria.selected = item;\r\n cadDiretoria.isTelaConsuta = false;\r\n }\r\n\r\n cadDiretoria.atualizar = function () {\r\n getDiretorias();\r\n }\r\n\r\n cadDiretoria.novo = function () {\r\n cadDiretoria.isTelaConsuta = false;\r\n cadDiretoria.selected = {};\r\n }\r\n\r\n cadDiretoria.salvar = function (formcadDiretoria) {\r\n DiretoriaModel.save(cadDiretoria.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadDiretoria);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadDiretoria.isTelaConsuta = true;\r\n getDiretorias();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n\r\n }\r\n\r\n cadDiretoria.cancelar = function (formcadDiretoria) {\r\n cadDiretoria.isTelaConsuta = true;\r\n getDiretorias();\r\n cadDiretoria.selected = null;\r\n }\r\n\r\n cadDiretoria.excluir = function (formcadDiretoria) {\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n DiretoriaModel.excluir(cadDiretoria.selected.IdcDiretoria)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadDiretoria);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadDiretoria.isTelaConsuta = true;\r\n getDiretorias();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('DivergenciaController', DivergenciaController);\r\n DivergenciaController.$inject = [\r\n '$uibModalInstance',\r\n 'locals',\r\n 'TranslateService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function DivergenciaController(\r\n $uibModalInstance,\r\n locals,\r\n TranslateService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n\r\n\r\n //Propriedades privadas\r\n\r\n var divergencia = this;\r\n\r\n //Propriedades públicas\r\n\r\n divergencia.confirmOperation = locals.confirmOperation;\r\n\r\n //Métodos privados\r\n function formatLitros(number) {\r\n number = number || 0;\r\n return number.toFixed(2) + \" \" + TranslateService('litros');\r\n }\r\n\r\n function formartPercentual(number) {\r\n number = number || 0;\r\n number = number === -Infinity ? -100 : number;\r\n return number.toFixed(2) + \"%\";\r\n }\r\n\r\n\r\n //Métodos publicos\r\n divergencia.getFechamento = function () {\r\n if (!locals) {\r\n return;\r\n }\r\n return {\r\n \"initial-storage-amount\": formatLitros(locals.estoqueInicial),\r\n \"final-storage-amount\": formatLitros(locals.estoqueFinal),\r\n \"distributed-amount\": formatLitros(locals.distribuido),\r\n \"invoice-total\": formatLitros(locals.totalFiscal),\r\n \"physical-total\": formatLitros(locals.totalFisico),\r\n \"divergence\": formatLitros(locals.divergencia),\r\n \"divergence-percentual\": formartPercentual(locals.divergenciaPercentual),\r\n \"storage-divergence\": formatLitros(locals.divergenciaTancagem)\r\n };\r\n };\r\n\r\n divergencia.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n divergencia.confirmar = function () {\r\n $uibModalInstance.close('ok');\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n })();\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ElementoPepController', ElementoPepController);\r\n\r\n ElementoPepController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'ElementoPepModel',\r\n 'GerenciaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function ElementoPepController(\r\n ValidacaoService,\r\n Constant,\r\n ElementoPepModel,\r\n GerenciaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadElementoPep = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadElementoPep.filtro = '';\r\n cadElementoPep.listaElemento = null;\r\n cadElementoPep.listaGerencia = null;\r\n\r\n cadElementoPep.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadElementoPep.selected = null;\r\n cadElementoPep.isTelaConsuta = true;\r\n cadElementoPep.validacao = ValidacaoService;\r\n cadElementoPep.IdcElementoPep = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n getElementos();\r\n getGerencia();\r\n\r\n\r\n }\r\n\r\n function getElementos() {\r\n ElementoPepModel.getAll()\r\n .then(function (resposta) {\r\n cadElementoPep.listaElemento = resposta;\r\n });\r\n }\r\n\r\n function getGerencia() {\r\n GerenciaModel.getAll()\r\n .then(function (resposta) {\r\n cadElementoPep.listaGerencia = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n cadElementoPep.click = function (item) {\r\n cadElementoPep.selected = item;\r\n //cadElementoPep.DscGerencia = item.CadGerencia.DscGerencia;\r\n cadElementoPep.IdcElementoPep = item.IdcElementoPep;\r\n cadElementoPep.isTelaConsuta = false;\r\n\r\n\r\n }\r\n\r\n\r\n cadElementoPep.atualizar = function () {\r\n getElementos();\r\n }\r\n\r\n cadElementoPep.novo = function () {\r\n cadElementoPep.isTelaConsuta = false;\r\n cadElementoPep.selected = {};\r\n ValidacaoService.resetForm(formcadElementoPep);\r\n }\r\n\r\n cadElementoPep.salvar = function (formcadElementoPep) {\r\n\r\n if (formcadElementoPep.$valid) {\r\n\r\n ElementoPepModel.save(cadElementoPep.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadElementoPep);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadElementoPep.isTelaConsuta = true;\r\n getElementos();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n\r\n cadElementoPep.cancelar = function (formcadElementoPep) {\r\n cadElementoPep.isTelaConsuta = true;\r\n getElementos();\r\n cadElementoPep.selected = null;\r\n cadElementoPep.IdcElementoPep = null;\r\n }\r\n\r\n cadElementoPep.excluir = function (formcadElementoPep) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n ElementoPepModel.excluir(cadElementoPep.IdcElementoPep)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadElementoPep);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadElementoPep.isTelaConsuta = true;\r\n getElementos();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EmpresaClassificacaoController', EmpresaClassificacaoController);\r\n\r\n EmpresaClassificacaoController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'EmpresaClassificacaoModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function EmpresaClassificacaoController(\r\n ValidacaoService,\r\n Constant,\r\n EmpresaClassificacaoModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadEmpresaClassificacao = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadEmpresaClassificacao.filtro = '';\r\n cadEmpresaClassificacao.listaEmpresaClassificacao = null; \r\n cadEmpresaClassificacao.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadEmpresaClassificacao.selected = null;\r\n cadEmpresaClassificacao.isTelaConsuta = true;\r\n cadEmpresaClassificacao.validacao = ValidacaoService;\r\n cadEmpresaClassificacao.popupDataInicial = { opened: false };\r\n cadEmpresaClassificacao.regCompartimentoselected = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadEmpresaClassificacao.isTelaConsuta = true\r\n getEmpresaClassificacao(); \r\n }\r\n\r\n function getEmpresaClassificacao() {\r\n EmpresaClassificacaoModel.getAll()\r\n .then(function (resposta) {\r\n cadEmpresaClassificacao.listaEmpresaClassificacao = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadEmpresaClassificacao.classificacaoClick = function (item) {\r\n cadEmpresaClassificacao.selected = item;\r\n cadEmpresaClassificacao.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadEmpresaClassificacao.atualizar = function () {\r\n getEmpresaClassificacao();\r\n } \r\n\r\n cadEmpresaClassificacao.novo = function (formcadEmpresaClassificacao) {\r\n cadEmpresaClassificacao.isTelaConsuta = false;\r\n cadEmpresaClassificacao.selected = {};\r\n ValidacaoService.resetForm(formcadEmpresaClassificacao);\r\n }\r\n\r\n cadEmpresaClassificacao.salvar = function (formcadEmpresaClassificacao) {\r\n \r\n if(formcadEmpresaClassificacao.$valid)\r\n {\r\n EmpresaClassificacaoModel.save(cadEmpresaClassificacao.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadEmpresaClassificacao);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadEmpresaClassificacao.isTelaConsuta = true;\r\n getEmpresaClassificacao();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadEmpresaClassificacao.cancelar = function (formcadEmpresaClassificacao) {\r\n cadEmpresaClassificacao.isTelaConsuta = true;\r\n getEmpresaClassificacao();\r\n cadEmpresaClassificacao.selected = null;\r\n ValidacaoService.resetForm(formcadEmpresaClassificacao);\r\n }\r\n\r\n cadEmpresaClassificacao.excluir = function (formcadEmpresaClassificacao) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n EmpresaClassificacaoModel.excluir(cadEmpresaClassificacao.selected.IdcClassificacao)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadEmpresaClassificacao);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadEmpresaClassificacao.isTelaConsuta = true;\r\n getEmpresaClassificacao();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EmpresaController', EmpresaController);\r\n\r\n EmpresaController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'EmpresaModel',\r\n 'EmpresaClassificacaoModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function EmpresaController(\r\n ValidacaoService,\r\n Constant,\r\n EmpresaModel,\r\n EmpresaClassificacaoModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadEmpresa = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadEmpresa.filtro = '';\r\n cadEmpresa.listaEmpresa = null; \r\n cadEmpresa.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadEmpresa.selected = null;\r\n cadEmpresa.isTelaConsuta = true;\r\n cadEmpresa.validacao = ValidacaoService;\r\n cadEmpresa.regCompartimentoselected = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadEmpresa.isTelaConsuta = true\r\n getEmpresa(); \r\n getEmpresaClassificacao(); \r\n }\r\n\r\n function getEmpresa() {\r\n EmpresaModel.getAll()\r\n .then(function (resposta) {\r\n cadEmpresa.listaEmpresa = resposta;\r\n });\r\n }\r\n\r\n function getEmpresaClassificacao() {\r\n EmpresaClassificacaoModel.getAll()\r\n .then(function (resposta) {\r\n cadEmpresa.listaEmpresaClassificacao = resposta;\r\n \r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadEmpresa.empresaClick = function (item) {\r\n cadEmpresa.selected = item;\r\n cadEmpresa.isTelaConsuta = false;\r\n }\r\n\r\n cadEmpresa.atualizar = function () {\r\n getEmpresa();\r\n } \r\n\r\n cadEmpresa.novo = function (formcadEmpresa) {\r\n cadEmpresa.isTelaConsuta = false;\r\n cadEmpresa.selected = {};\r\n ValidacaoService.resetForm(formcadEmpresa);\r\n }\r\n\r\n cadEmpresa.salvar = function (formcadEmpresa) {\r\n \r\n if(formcadEmpresa.$valid)\r\n {\r\n EmpresaModel.save(cadEmpresa.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadEmpresa);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadEmpresa.isTelaConsuta = true;\r\n getEmpresa();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n \r\n cadEmpresa.cancelar = function (formcadEmpresa) {\r\n cadEmpresa.isTelaConsuta = true;\r\n getEmpresa();\r\n cadEmpresa.selected = null;\r\n ValidacaoService.resetForm(formcadEmpresa);\r\n }\r\n\r\n cadEmpresa.excluir = function (formcadEmpresa) {\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n EmpresaModel.excluir(cadEmpresa.selected.IdcEmpresa)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadEmpresa);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadEmpresa.isTelaConsuta = true;\r\n getEmpresa();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EquipamentoComplexoController', EquipamentoComplexoController);\r\n EquipamentoComplexoController.$inject = [\r\n '$mdDialog',\r\n '$element',\r\n 'ValidacaoService',\r\n 'MessageService',\r\n 'ModalService',\r\n 'TranslateService',\r\n 'ValidacaoService',\r\n 'DiretoriaModel',\r\n 'ComplexoModel',\r\n 'variaveisComplexos',\r\n 'regComplexo',\r\n 'ContratoModel',\r\n 'Constant',\r\n 'CentroCustoModel',\r\n 'ElementoPepModel',\r\n 'OrdemEstatisticaModel',\r\n 'GerenciaModel',\r\n 'CentroLucroModel',\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function EquipamentoComplexoController(\r\n $mdDialog,\r\n $element,\r\n validacao,\r\n MessageService,\r\n ModalService,\r\n TranslateService,\r\n ValidacaoService,\r\n DiretoriaModel,\r\n ComplexoModel,\r\n variaveisComplexos,\r\n regComplexo,\r\n ContratoModel,\r\n Constant,\r\n CentroCustoModel,\r\n ElementoPepModel,\r\n OrdemEstatisticaModel,\r\n GerenciaModel,\r\n CentroLucroModel,\r\n idcEmpresa,\r\n listaEmpresa,\r\n searchTermIdcEmpresa,\r\n isEmAvaliacao\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var eqComplexo = this;\r\n\r\n //Propriedades privadas\r\n\r\n eqComplexo.cleanSearchTerm = function (fieldName) {\r\n eqComplexo[fieldName] = '';\r\n };\r\n\r\n $element.find('input').on('keydown', function (ev) {\r\n ev.stopPropagation();\r\n });\r\n\r\n var modalVisualizadorImagem = new ModalService({\r\n templateUrl: 'visualizadorImagem.html',\r\n controller: 'VisualizadorImagemController',\r\n controllerAs: 'visualizadorImagemCTRL'\r\n });\r\n\r\n //Propriedades públicas\r\n eqComplexo.idcEmpresa = 0\r\n eqComplexo.regComplexo = {};\r\n eqComplexo.complexos = [];\r\n eqComplexo.listaEmpresa = null;\r\n eqComplexo.listaDiretoria = null;\r\n eqComplexo.listaContrato = null;\r\n eqComplexo.searchTermIdcEmpresa = \"\";\r\n eqComplexo.listaComplexo = null;\r\n eqComplexo.validacao = ValidacaoService;\r\n eqComplexo.DthVencimento = null;\r\n eqComplexo.listaCentroCusto = [];\r\n eqComplexo.listaElementoPep = [];\r\n eqComplexo.listaOrdemEstatistica = [];\r\n eqComplexo.listaGerencia = [];\r\n eqComplexo.tipoFonte = Constant.FONTES_PAGADORAS;\r\n eqComplexo.isCopy = false;\r\n eqComplexo.listaStatus = Constant.INDICADORES_ATIVO;\r\n eqComplexo.regComplexo = {\r\n CadComplexo: {\r\n SglComplexo: null,\r\n CadDiretoria: {\r\n SglDiretoria: null\r\n }\r\n },\r\n IdcCentroLucro: null\r\n } \r\n\r\n\r\n function RestartVarsForCopy() {\r\n eqComplexo.regComplexo.CadComplexo = null;\r\n eqComplexo.regComplexo.IdcEquipamentoComplexo = null;\r\n eqComplexo.isCopy = true;\r\n }\r\n \r\n\r\n //Métodos privado\r\n function inicializar() {\r\n Object.assign(eqComplexo.regComplexo, regComplexo);\r\n eqComplexo.complexos = variaveisComplexos.complexos;\r\n if (eqComplexo.regComplexo.CadImagemContrato)\r\n eqComplexo.regComplexo.ImagemContrato = \"data:image/png;base64,\" + eqComplexo.regComplexo.CadImagemContrato.ImgImagem;\r\n\r\n if (typeof eqComplexo.regComplexo.CadContrato !== \"undefined\") {\r\n eqComplexo.idcEmpresa = eqComplexo.regComplexo.CadContrato.IdcEmpresa;\r\n eqComplexo.regComplexo.IdcContrato = eqComplexo.regComplexo.CadContrato.IdcContrato;\r\n getContrato(eqComplexo.idcEmpresa);\r\n eqComplexo.isEmAvaliacao = variaveisComplexos.isEmAvaliacao;\r\n eqComplexo.regComplexo.DthVencimento = eqComplexo.regComplexo.CadContrato.DthVencimento;\r\n }\r\n\r\n eqComplexo.listaEmpresa = variaveisComplexos.listaEmpresa;\r\n\r\n\r\n getDiretorias(variaveisComplexos.listaDiretoria);\r\n if (regComplexo) {\r\n if (!eqComplexo.regComplexo.TipoFonte) {\r\n eqComplexo.regComplexo.TipoFonte = 'C'\r\n }\r\n eqComplexo.FonteChange(eqComplexo.regComplexo.TipoFonte, false)\r\n .then(function () {\r\n if (eqComplexo.regComplexo.TipoFonte === 'C')\r\n eqComplexo.regComplexo.IdcFonte = eqComplexo.regComplexo.IdcCentroCusto\r\n else if (eqComplexo.regComplexo.TipoFonte === 'E')\r\n eqComplexo.regComplexo.IdcFonte = eqComplexo.regComplexo.IdcElementoPep\r\n else if (eqComplexo.regComplexo.TipoFonte === 'O')\r\n eqComplexo.regComplexo.IdcFonte = eqComplexo.regComplexo.IdcOrdemEstatistica\r\n else\r\n eqComplexo.regComplexo.IdcFonte = eqComplexo.regComplexo.IdcGerencia\r\n\r\n if (eqComplexo.regComplexo.IdcFonte)\r\n eqComplexo.atribuirCodFontePagadora();\r\n });\r\n\r\n eqComplexo.ChangeDiretoria(false);\r\n }\r\n \r\n }\r\n\r\n function getDiretorias(listaDiretoria) {\r\n eqComplexo.listaDiretoria = listaDiretoria;\r\n if (regComplexo) {\r\n eqComplexo.ChangeDiretoria(false);\r\n }\r\n }\r\n\r\n function getContrato(item) {\r\n\r\n return ContratoModel.getByIdEmpresa(item)\r\n .then(function (resposta) {\r\n eqComplexo.listaContrato = resposta;\r\n });\r\n\r\n if (typeof regComplexo.IdcContrato !== \"undefined\" && regComplexo.IdcContrato > 0) eqComplexo.ContratoChange();\r\n }\r\n\r\n eqComplexo.ChangeDiretoria = function (change) {\r\n if (eqComplexo.regComplexo.CadComplexo &&\r\n eqComplexo.regComplexo.CadComplexo.CadDiretoria.SglDiretoria)\r\n ComplexoModel.getBySgl(eqComplexo.regComplexo.CadComplexo.CadDiretoria.SglDiretoria)\r\n .then(function (resposta) {\r\n eqComplexo.listaComplexo = resposta;\r\n if (!change && eqComplexo.regComplexo.CadComplexo.IdcComplexo)\r\n eqComplexo.atribuirSlgComplexo(eqComplexo.regComplexo.CadComplexo.IdcComplexo);\r\n else\r\n eqComplexo.atribuirSlgComplexo(null);\r\n });\r\n }\r\n\r\n eqComplexo.ChangeComplexo = function () {\r\n if (eqComplexo.regComplexo.CadComplexo.IdcComplexo == null) {\r\n eqComplexo.complexoMessage = TranslateService('required');\r\n }\r\n else {\r\n eqComplexo.complexoMessage = '';\r\n }\r\n }\r\n\r\n eqComplexo.ContratoChange = function () {\r\n var contrato = eqComplexo.listaContrato.find(function (item) {\r\n return item.IdcContrato == eqComplexo.regComplexo.IdcContrato;\r\n });\r\n eqComplexo.regComplexo.CadContrato = contrato;\r\n eqComplexo.regComplexo.IdcContrato = contrato.IdcContrato\r\n \r\n eqComplexo.regComplexo.DthVencimento = contrato.DthVencimento;\r\n eqComplexo.regComplexo.CodContrato = contrato.CodContrato;\r\n };\r\n\r\n eqComplexo.atribuirSlgComplexo = function (IdcComplexo) { \r\n var complexo = eqComplexo.listaComplexo.find(function (item) {\r\n return item.IdcComplexo == IdcComplexo;\r\n });\r\n eqComplexo.regComplexo.CadComplexo.SglComplexo = complexo != null ? complexo.SglComplexo : null;\r\n eqComplexo.regComplexo.CadComplexo.IdcComplexo = complexo != null ? complexo.IdcComplexo : null;\r\n eqComplexo.ChangeComplexo();\r\n };\r\n\r\n eqComplexo.atribuirCodFontePagadora = function () {\r\n var fontePagadora = null;\r\n if (eqComplexo.regComplexo.TipoFonte === 'C') {\r\n fontePagadora = eqComplexo.listaCentroCusto.find(function (item) {\r\n return item.IdcCentroCusto == eqComplexo.regComplexo.IdcFonte;\r\n });\r\n } else if (eqComplexo.regComplexo.TipoFonte === 'E') {\r\n fontePagadora = eqComplexo.listaElementoPep.find(function (item) {\r\n return item.IdcElementoPep == eqComplexo.regComplexo.IdcFonte;\r\n });\r\n } else if (eqComplexo.regComplexo.TipoFonte === 'O') {\r\n fontePagadora = eqComplexo.listaOrdemEstatistica.find(function (item) {\r\n return item.IdcOrdemEstatistica == eqComplexo.regComplexo.IdcFonte;\r\n });\r\n }\r\n\r\n if (fontePagadora) {\r\n if (eqComplexo.regComplexo.TipoFonte === 'C') {\r\n getCentroLucroByCentroCusto(fontePagadora.IdcCentroCusto);\r\n eqComplexo.regComplexo.IdcCentroCusto = fontePagadora.IdcCentroCusto;\r\n eqComplexo.regComplexo.CodFontePagadora = fontePagadora.CodCentroCusto;\r\n eqComplexo.regComplexo.IdcFonte = fontePagadora.IdcCentroCusto;\r\n eqComplexo.regComplexo.SglGerencia = null;\r\n eqComplexo.regComplexo.IdcElementoPep = null;\r\n eqComplexo.regComplexo.IdcOrdemEstatistica = null;\r\n eqComplexo.regComplexo.IdcGerencia = null;\r\n } else if (eqComplexo.regComplexo.TipoFonte === 'E') {\r\n getCentroLucroByElementoPep(fontePagadora.IdcElementoPep);\r\n eqComplexo.regComplexo.IdcElementoPep = fontePagadora.IdcElementoPep;\r\n eqComplexo.regComplexo.CodFontePagadora = fontePagadora.CodElementoPep;\r\n eqComplexo.regComplexo.IdcFonte = fontePagadora.IdcElementoPep;\r\n eqComplexo.regComplexo.SglGerencia = null;\r\n eqComplexo.regComplexo.IdcCentroCusto = null;\r\n eqComplexo.regComplexo.IdcOrdemEstatistica = null;\r\n eqComplexo.regComplexo.IdcGerencia = null;\r\n } else if (eqComplexo.regComplexo.TipoFonte === 'O') {\r\n getCentroLucroByOrdemEstatistica(fontePagadora.IdcOrdemEstatistica);\r\n eqComplexo.regComplexo.IdcOrdemEstatistica = fontePagadora.IdcOrdemEstatistica;\r\n eqComplexo.regComplexo.CodFontePagadora = fontePagadora.CodOrdemEstatistica;\r\n eqComplexo.regComplexo.IdcFonte = fontePagadora.IdcOrdemEstatistica;\r\n eqComplexo.regComplexo.SglGerencia = null;\r\n eqComplexo.regComplexo.IdcElementoPep = null;\r\n eqComplexo.regComplexo.IdcCentroCfusto = null;\r\n eqComplexo.regComplexo.IdcGerencia = null;\r\n }\r\n }\r\n\r\n };\r\n\r\n eqComplexo.limparCodFontePagadora = function () {\r\n if (eqComplexo.regComplexo.TipoFonte == 'R') {\r\n var gerencia = eqComplexo.listaGerencia.find(function (item) {\r\n return item.IdcGerencia == eqComplexo.regComplexo.IdcGerencia;\r\n });\r\n\r\n if (gerencia) {\r\n eqComplexo.regComplexo.IdcGerencia = gerencia.IdcGerencia;\r\n eqComplexo.regComplexo.SglGerencia = gerencia.SglGerencia;\r\n eqComplexo.regComplexo.IdcFonte = null;\r\n eqComplexo.regComplexo.CodFontePagadora = null;\r\n eqComplexo.regComplexo.IdcElementoPep = null;\r\n eqComplexo.regComplexo.IdcCentroCusto = null;\r\n eqComplexo.regComplexo.IdcOrdemEstatistica = null;\r\n }\r\n }\r\n }\r\n\r\n eqComplexo.FonteChange = function (tipoFonte, comboChange) {\r\n if (comboChange) {\r\n eqComplexo.regComplexo.IdcCentroCusto = null;\r\n eqComplexo.regComplexo.IdcElementoPep = null;\r\n eqComplexo.regComplexo.IdcOrdemEstatistica = null;\r\n eqComplexo.regComplexo.CodFontePagadora = null;\r\n eqComplexo.regComplexo.IdcFonte = null;\r\n eqComplexo.regComplexo.SglGerencia = null;\r\n eqComplexo.regComplexo.IdcGerencia = null;\r\n eqComplexo.regComplexo.CadCentroLucro = null;\r\n eqComplexo.regComplexo.IdcCentroLucro = null;\r\n eqComplexo.regComplexo.CentroLucroConcat = null;\r\n\r\n if (tipoFonte != 'R') {\r\n eqComplexo.fontePagadoraMessage = TranslateService('required');\r\n eqComplexo.gerenciaMessage = '';\r\n }\r\n else {\r\n eqComplexo.gerenciaMessage = TranslateService('required');\r\n eqComplexo.fontePagadoraMessage = '';\r\n }\r\n }\r\n\r\n if (tipoFonte === 'C') {\r\n return CentroCustoModel.getAll()\r\n .then(function (resposta) {\r\n eqComplexo.listaCentroCusto = resposta;\r\n });\r\n } else if (tipoFonte === 'E') {\r\n return ElementoPepModel.getAll()\r\n .then(function (resposta) {\r\n eqComplexo.listaElementoPep = resposta;\r\n });\r\n } else if (tipoFonte === 'O') {\r\n return OrdemEstatisticaModel.getAll()\r\n .then(function (resposta) {\r\n eqComplexo.listaOrdemEstatistica = resposta;\r\n });\r\n } else {\r\n return GerenciaModel.getAll()\r\n .then(function (resposta) {\r\n eqComplexo.listaGerencia = resposta;\r\n });\r\n }\r\n }\r\n\r\n eqComplexo.getContratos = function (item) {\r\n //console.log(\"alterado \" + eqComplexo.idcEmpresa);\r\n return ContratoModel.getByIdEmpresa(item)\r\n .then(function (resposta) {\r\n eqComplexo.listaContrato = resposta;\r\n eqComplexo.regComplexo.IdcContrato = eqComplexo.listaContrato[0].IdcContrato;\r\n eqComplexo.ContratoChange();\r\n });\r\n }\r\n\r\n eqComplexo.chkInativoClick = function () {\r\n if (!eqComplexo.regComplexo.ChkInativo)\r\n eqComplexo.regComplexo.ChkInativo = false;\r\n\r\n else {\r\n eqComplexo.regComplexo.ChkInativo = true;\r\n }\r\n };\r\n\r\n eqComplexo.complexExist = function () {\r\n return !eqComplexo.regComplexo.IdcEquipamentoComplexo\r\n }\r\n\r\n //Métodos publicos\r\n\r\n\r\n eqComplexo.copy = function (item) {\r\n RestartVarsForCopy()\r\n }\r\n\r\n eqComplexo.salvar = function (formEqComplexo) {\r\n if (eqComplexo.listaContrato.length === 0) {\r\n showPopUpMessage(TranslateService('error'), TranslateService('empresa-sem-contrato'));\r\n return;\r\n }\r\n\r\n if (formEqComplexo.$valid)\r\n {\r\n ValidacaoService.resetForm(formEqComplexo);\r\n\r\n eqComplexo.regComplexo.CadComplexo = eqComplexo.listaComplexo.find(function (item) {\r\n return item.IdcComplexo == eqComplexo.regComplexo.CadComplexo.IdcComplexo;\r\n })\r\n eqComplexo.regComplexo.IdcComplexo = eqComplexo.regComplexo.CadComplexo.IdcComplexo;\r\n eqComplexo.regComplexo.IdcComplexoSolicitante = eqComplexo.regComplexo.CadComplexo.IdcComplexo;\r\n\r\n if (!(eqComplexo.regComplexo.ImagemContrato == undefined) &&\r\n !eqComplexo.regComplexo.ImagemContrato.includes('data:image/png')) {\r\n showPopUpMessage(TranslateService('error'), TranslateService('only-png'));\r\n throw new Error(TranslateService('only-png'));\r\n }\r\n\r\n var mesmoComplexos = eqComplexo.complexos.filter(function (item) { return item == eqComplexo.regComplexo.CadComplexo.IdcComplexo}).length;\r\n\r\n if (eqComplexo.regComplexo.new && mesmoComplexos == 1){\r\n showPopUpMessage(TranslateService('error'), TranslateService('existing-complex'));\r\n throw new Error(TranslateService('existing-complex'));\r\n }\r\n\r\n eqComplexo.regComplexo.IdcEmpresa = eqComplexo.idcEmpresa;\r\n Object.assign(regComplexo, eqComplexo.regComplexo);\r\n regComplexo.isCopy = eqComplexo.isCopy;\r\n $mdDialog.hide(regComplexo);\r\n } else {\r\n showPopUpMessage(TranslateService('error'), TranslateService('invalid-data'));\r\n }\r\n }\r\n\r\n eqComplexo.cancel = function (formEqComplexo) {\r\n $mdDialog.hide('cancel');\r\n validacao.resetForm(formEqComplexo);\r\n };\r\n\r\n eqComplexo.inicializarImagem = function (id) {\r\n eqComplexo[id] = $element.find('#'+id);\r\n eqComplexo[id].change(function () {\r\n eqComplexo.regComplexo['Idc' + id] = 0;\r\n var reader = new FileReader;\r\n reader.onload = function () {\r\n eqComplexo.regComplexo[id] = reader.result;\r\n }\r\n reader.readAsDataURL(eqComplexo[id][0].files[0]);\r\n });\r\n }\r\n\r\n eqComplexo.translate = function (key) {\r\n return TranslateService(key);\r\n }\r\n\r\n eqComplexo.visualizarImagem = function (id) {\r\n var imagem = eqComplexo.regComplexo[id];\r\n modalVisualizadorImagem.open({\r\n image: {\r\n image: imagem\r\n }\r\n });\r\n }\r\n\r\n eqComplexo.excluirImagem = function (id) {\r\n eqComplexo.regComplexo[id] = null;\r\n eqComplexo.regComplexo['Idc' + id] = 0;\r\n document.querySelector('#' + id).value = null;\r\n }\r\n\r\n function getCentroLucroByCentroCusto(idcCentroCusto) {\r\n CentroLucroModel.getByIdCentroCusto(idcCentroCusto)\r\n .then(function (resposta) {\r\n eqComplexo.regComplexo.CadCentroLucro = resposta;\r\n eqComplexo.regComplexo.IdcCentroLucro = resposta ? resposta.IdcCentroLucro : null;\r\n eqComplexo.regComplexo.CentroLucroConcat = eqComplexo.regComplexo.CadCentroLucro ? eqComplexo.regComplexo.CadCentroLucro.CodCentroLucro + \" - \" + eqComplexo.regComplexo.CadCentroLucro.SglCentroLucro : \"\";\r\n });\r\n }\r\n\r\n function getCentroLucroByOrdemEstatistica(idcOrdemEstatistica) {\r\n CentroLucroModel.getByIdOrdemEstatistica(idcOrdemEstatistica)\r\n .then(function (resposta) {\r\n eqComplexo.regComplexo.CadCentroLucro = resposta;\r\n eqComplexo.regComplexo.IdcCentroLucro = resposta ? resposta.IdcCentroLucro : null;\r\n eqComplexo.regComplexo.CentroLucroConcat = eqComplexo.regComplexo.CadCentroLucro ? eqComplexo.regComplexo.CadCentroLucro.CodCentroLucro + \" - \" + eqComplexo.regComplexo.CadCentroLucro.SglCentroLucro : \"\";\r\n });\r\n }\r\n\r\n function getCentroLucroByElementoPep(idcElementoPep) {\r\n CentroLucroModel.getByIdElementoPep(idcElementoPep)\r\n .then(function (resposta) {\r\n eqComplexo.regComplexo.CadCentroLucro = resposta;\r\n eqComplexo.regComplexo.IdcCentroLucro = resposta ? resposta.IdcCentroLucro : null;\r\n eqComplexo.regComplexo.CentroLucroConcat = eqComplexo.regComplexo.CadCentroLucro ? eqComplexo.regComplexo.CadCentroLucro.CodCentroLucro + \" - \" + eqComplexo.regComplexo.CadCentroLucro.SglCentroLucro : \"\";\r\n });\r\n }\r\n\r\n function showPopUpMessage(title, message) {\r\n var alert = $mdDialog.alert({\r\n template:\r\n '
' +\r\n '
' +\r\n '

' + title + '

' +\r\n '
' +\r\n '
' +\r\n '

' + message + '

' +\r\n '
' +\r\n '' +\r\n '
',\r\n preserveScope: false,\r\n multiple: true,\r\n hasBackdrop: true,\r\n zIndex: 100,\r\n controllerAs: 'dialogCtrl',\r\n controller: ['$mdDialog', function (mdDialog) {\r\n this.click = function () {\r\n mdDialog.hide(alert, \"finished\");\r\n alert = undefined;\r\n }\r\n }],\r\n parent: angular.element(document.getElementById('cad-equipamento'))\r\n });\r\n $mdDialog.show(alert);\r\n }\r\n\r\n inicializar();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n jQuery.event.special.touchstart = {\r\n setup: function (_, ns, handle) {\r\n if (ns.includes(\"noPreventDefault\")) {\r\n this.addEventListener(\"touchstart\", handle, { passive: false });\r\n } else {\r\n this.addEventListener(\"touchstart\", handle, { passive: true });\r\n }\r\n }\r\n };\r\n jQuery.event.special.touchmove = {\r\n setup: function (_, ns, handle) {\r\n if (ns.includes(\"noPreventDefault\")) {\r\n this.addEventListener(\"touchmove\", handle, { passive: false });\r\n } else {\r\n this.addEventListener(\"touchmove\", handle, { passive: true });\r\n }\r\n }\r\n };\r\n\r\n jQuery.event.special.wheel = {\r\n setup: function (_, ns, handle) {\r\n if (ns.includes(\"noPreventDefault\")) {\r\n this.addEventListener(\"wheel\", handle, { passive: false });\r\n } else {\r\n this.addEventListener(\"wheel\", handle, { passive: true });\r\n }\r\n }\r\n };\r\n\r\n\r\n angular.module('posto-facil').controller('EquipamentoController', EquipamentoController);\r\n\r\n EquipamentoController.$inject = [\r\n 'ValidacaoService',\r\n '$element',\r\n 'Constant',\r\n 'ModalService',\r\n '$mdDialog',\r\n 'EquipamentoModel',\r\n 'EquipamentoModeloModel',\r\n 'EquipamentoMarcaModel',\r\n 'TipoFiscalModel',\r\n 'EquipamentoTipoModel',\r\n 'EquipamentoTipoGriModel',\r\n 'HstEquipamentoModel',\r\n 'EmpresaModel',\r\n 'ContratoModel',\r\n 'GerenciaModel',\r\n 'CentroCustoModel',\r\n 'OrdemEstatisticaModel',\r\n 'ElementoPepModel',\r\n 'CentroLucroModel',\r\n 'DiretoriaModel',\r\n 'ComplexoModel',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'CheckEquipamento',\r\n 'UsuarioService',\r\n 'SpinnerService',\r\n '$timeout',\r\n 'AlertExceptionService',\r\n 'RegAbastecimentoTanqueModel',\r\n 'PrivilegesService'\r\n ];\r\n\r\n function EquipamentoController(\r\n ValidacaoService,\r\n $element,\r\n Constant,\r\n ModalService,\r\n $mdDialog,\r\n EquipamentoModel,\r\n EquipamentoModeloModel,\r\n EquipamentoMarcaModel,\r\n TipoFiscalModel,\r\n EquipamentoTipoModel,\r\n EquipamentoTipoGriModel,\r\n HstEquipamentoModel,\r\n EmpresaModel,\r\n ContratoModel,\r\n GerenciaModel,\r\n CentroCustoModel,\r\n OrdemEstatisticaModel,\r\n ElementoPepModel,\r\n CentroLucroModel,\r\n DiretoriaModel,\r\n ComplexoModel,\r\n MessageService,\r\n TranslateService,\r\n CheckEquipamento,\r\n UsuarioService,\r\n SpinnerService,\r\n $timeout,\r\n AlertExceptionService,\r\n RegAbastecimentoTanqueModel,\r\n PrivilegesService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadEquipamento = this;\r\n\r\n var modalEquipamento = new ModalService({\r\n templateUrl: 'equipamentoTanque.html',\r\n controller: 'EquipamentoTanqueController',\r\n controllerAs: 'equipamentoTanqueCTRL'\r\n });\r\n\r\n var modalVisualizadorImagem = new ModalService({\r\n templateUrl: 'visualizadorImagem.html',\r\n controller: 'VisualizadorImagemController',\r\n controllerAs: 'visualizadorImagemCTRL'\r\n });\r\n\r\n var modalComplexoSolicitante = new ModalService({\r\n templateUrl: 'selComplexoSolicitante.html',\r\n controller: 'SelComplexoSolicitanteController',\r\n controllerAs: 'selComplexoSolicitante'\r\n });\r\n\r\n var sppiner = new SpinnerService('cad-equipamento', 10);\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n\r\n\r\n cadEquipamento.filtro = '';\r\n cadEquipamento.listaEquipamento = null;\r\n cadEquipamento.complexoAdded = false;\r\n cadEquipamento.listaDiretoria = null;\r\n cadEquipamento.listaComplexo = null;\r\n cadEquipamento.listaModelo = null;\r\n cadEquipamento.listaMarca = null;\r\n cadEquipamento.listaTipo = null;\r\n cadEquipamento.listaGri = null;\r\n cadEquipamento.listaTipoFiscal = null;\r\n cadEquipamento.listaEmpresa = null;\r\n cadEquipamento.listaDiretoria = null;\r\n cadEquipamento.listaGerencia = null;\r\n cadEquipamento.listaCentroCusto = null;\r\n cadEquipamento.listaOrdemEstatistica = null;\r\n cadEquipamento.listaElementoPep = null;\r\n cadEquipamento.tanqueEquipamentoSelected = null;\r\n cadEquipamento.listaProduto = null;\r\n cadEquipamento.imagemContrato = null;\r\n cadEquipamento.tanqueInativo = true;\r\n cadEquipamento.equipamentoExistente = [];\r\n cadEquipamento.edicao = false;\r\n cadEquipamento.complexoEquipamentoSelected = null;\r\n cadEquipamento.privilegesComplexos = []\r\n cadEquipamento.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadEquipamento.selected = {\r\n ListCadComplexo: [],\r\n IdcComplexoSolicitante: 0,\r\n ListaContratos: []\r\n };\r\n cadEquipamento.isTelaConsuta = true;\r\n cadEquipamento.validacao = ValidacaoService;\r\n cadEquipamento.popupDataInicial = { opened: false };\r\n cadEquipamento.limitStep = 50;\r\n cadEquipamento.limit = cadEquipamento.limitStep;\r\n\r\n cadEquipamento.stopSpinning = function () {\r\n sppiner.stop();\r\n };\r\n\r\n cadEquipamento.cleanSearchTerm = function (fieldName) {\r\n cadEquipamento[fieldName] = '';\r\n };\r\n\r\n $element.find('input').on('keydown', function (ev) {\r\n ev.stopPropagation();\r\n });\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n\r\n cadEquipamento.privilegesComplexos = Object.keys(UsuarioService.entityPrivilege)\r\n .map(function (key) {\r\n if (UsuarioService.entityPrivilege[key].includes('Cadastrar_Equipamento') && key.split(\"-\")[2])\r\n return key.split(\"-\")[2]\r\n }).filter(function (item) {\r\n return item != undefined\r\n });\r\n\r\n cadEquipamento.isTelaConsuta = true\r\n getEquipamento()\r\n .then(function () { \r\n getEquipamentoMarca();\r\n getTipoFiscal();\r\n getTipo();\r\n getTipoGri();\r\n getEmpresa();\r\n getDiretorias();\r\n });\r\n }\r\n\r\n function getEquipamento() {\r\n sppiner.spin();\r\n return EquipamentoModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamento.listaEquipamento = resposta;\r\n });\r\n }\r\n\r\n function getEquipamentoMarca() {\r\n EquipamentoMarcaModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamento.listaMarca = resposta;\r\n });\r\n }\r\n\r\n function getTipoFiscal() {\r\n TipoFiscalModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamento.listaTipoFiscal = resposta;\r\n });\r\n }\r\n\r\n function getTipo() {\r\n EquipamentoTipoModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamento.listaTipo = resposta;\r\n });\r\n }\r\n\r\n function getTipoGri() {\r\n EquipamentoTipoGriModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamento.listaGri = resposta;\r\n });\r\n }\r\n\r\n function getEmpresa() {\r\n EmpresaModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamento.listaEmpresa = resposta;\r\n });\r\n }\r\n\r\n function getDiretorias() {\r\n DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamento.listaDiretoria = resposta;\r\n });\r\n }\r\n\r\n function executaAcaoPerfilCadastrar(funcaoSePossuiPermissao) {\r\n if (PrivilegesService.includes('Cadastrar_Equipamento')) {\r\n funcaoSePossuiPermissao();\r\n } else {\r\n MessageService.alert(TranslateService('atention'), TranslateService('acao-falhou-user-permis-cad-equip'));\r\n }\r\n }\r\n\r\n function openModalComplexoSolicitante() {\r\n return modalComplexoSolicitante.open({\r\n entry: {\r\n complexos: cadEquipamento.selected.ListCadComplexoPrivilege\r\n }\r\n });\r\n }\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n cadEquipamento.complexPrivileges = function (clickedComplex) {\r\n var validPrivileges = false;\r\n if (cadEquipamento.selected && cadEquipamento.selected.ListCadComplexo && cadEquipamento.selected.ListCadComplexo.length > 0) {\r\n validPrivileges = cadEquipamento.selected.ListCadComplexo.some(function (item) {\r\n return cadEquipamento.privilegesComplexos.includes(item[\"IdcComplexo\"].toString()) && (!clickedComplex || item[\"IdcComplexo\"] == clickedComplex)\r\n });\r\n }\r\n else {\r\n validPrivileges = !cadEquipamento.edicao;\r\n }\r\n return validPrivileges\r\n }\r\n\r\n cadEquipamento.equipamentoClick = function (item) {\r\n if (cadEquipamento.equipamentoClickWaiting) return;\r\n cadEquipamento.equipamentoClickWaiting = true;\r\n EquipamentoModel.getById(item.IdcEquipamento)\r\n .then(function (resposta) {\r\n if (!resposta || !resposta.length) return;\r\n cadEquipamento.complexoAdded = false;\r\n console.log(resposta[0])\r\n\r\n cadEquipamento.edicao = true;\r\n cadEquipamento.selected = resposta[0];\r\n cadEquipamento.selected.AnoFabricacao = parseInt(resposta[0].AnoFabricacao); \r\n cadEquipamento.isTelaConsuta = false;\r\n cadEquipamento.getEquipamentoModelo(cadEquipamento.selected.CadModelo.CadMarca.IdcMarca);\r\n cadEquipamento.getAbastecimentoTanque(cadEquipamento.selected.IdcEquipamento);\r\n cadEquipamento.montarObjetoComplexo(resposta[0].ListRelEquipamentoComplexo);\r\n cadEquipamento.selected.IdcComplexoSolicitante = 0;\r\n \r\n cadEquipamento.selected.ImagemDut = \"data:image/png;base64,\" + cadEquipamento.selected.CadImagemDut.ImgImagem;\r\n\r\n\r\n cadEquipamento.getContrato(cadEquipamento.selected.IdcEmpresa);\r\n })\r\n .finally(function () {\r\n $timeout(function () {\r\n cadEquipamento.equipamentoClickWaiting = false;\r\n }, 100);\r\n });\r\n }\r\n\r\n cadEquipamento.montarObjetoComplexo = function (ListCadComplexo) {\r\n cadEquipamento.selected.IdcEmpresa = ListCadComplexo[0].CadContrato.IdcEmpresa; \r\n for (var i = 0; i < ListCadComplexo.length; i++) {\r\n ListCadComplexo[i].CodContrato = ListCadComplexo[i].CadContrato.CodContrato;\r\n var vencido = new Date(ListCadComplexo[i].CadContrato.DthVencimento);\r\n var datatual = new Date();\r\n var equipamentostu = ListCadComplexo[i].StuEquipamento;\r\n if (vencido <= datatual && equipamentostu != 'S') {\r\n ListCadComplexo[i].equipamentortn = 'Inapto'\r\n } else if (vencido > datatual && equipamentostu == 'S') {\r\n ListCadComplexo[i].equipamentortn = 'Apto'\r\n } else if (vencido <= datatual && equipamentostu == 'S') {\r\n ListCadComplexo[i].equipamentortn = 'Inapto'\r\n } else if (vencido > datatual && equipamentostu != 'S') {\r\n ListCadComplexo[i].equipamentortn = 'Inapto'\r\n }\r\n if (ListCadComplexo[i].CadCentroCusto != null) {\r\n ListCadComplexo[i].TipoFonte = 'C';\r\n ListCadComplexo[i].CodFontePagadora = ListCadComplexo[i].CadCentroCusto.CodCentroCusto;\r\n ListCadComplexo[i].IdcGerencia = null;\r\n } else if (ListCadComplexo[i].CadElementoPep != null) {\r\n ListCadComplexo[i].TipoFonte = 'E';\r\n ListCadComplexo[i].CodFontePagadora = ListCadComplexo[i].CadElementoPep.CodElementoPep;\r\n ListCadComplexo[i].IdcGerencia = null;\r\n } else if (ListCadComplexo[i].CadOrdemEstatistica != null) {\r\n ListCadComplexo[i].TipoFonte = 'O';\r\n ListCadComplexo[i].CodFontePagadora = ListCadComplexo[i].CadOrdemEstatistica.CodOrdemEstatistica;\r\n ListCadComplexo[i].IdcGerencia = null;\r\n } else if (ListCadComplexo[i].CadGerencia != null) {\r\n ListCadComplexo[i].TipoFonte = 'R';\r\n ListCadComplexo[i].IdcGerencia = ListCadComplexo[i].CadGerencia.IdcGerencia;\r\n ListCadComplexo[i].SglGerencia = ListCadComplexo[i].CadGerencia.SglGerencia;\r\n } \r\n cadEquipamento.selected.ListCadComplexo = ListCadComplexo;\r\n }\r\n \r\n\r\n }\r\n\r\n \r\n\r\n cadEquipamento.FormatStatus = function (item) {\r\n if (item == 'S')\r\n return TranslateService('stu-equipamento-S');\r\n\r\n if (item == 'N')\r\n return TranslateService('stu-equipamento-N');\r\n\r\n if (item == 'SA')\r\n return TranslateService('stu-equipamento-SA');\r\n\r\n if (item == 'NA')\r\n return TranslateService('stu-equipamento-NA');\r\n }\r\n\r\n cadEquipamento.getAbastecimentoTanque = function (item) {\r\n\r\n RegAbastecimentoTanqueModel.getAbastecimentoTanque(item)\r\n .then(function (resposta) {\r\n var AbastecimentoTanque = resposta;\r\n\r\n for (var i = 0; i < cadEquipamento.selected.ListCadTanqueEquipamento.length; i++) {\r\n cadEquipamento.selected.ListCadTanqueEquipamento[i].TanqueAbastecido = false;\r\n\r\n for (var j = 0; AbastecimentoTanque.length; j++) {\r\n if (cadEquipamento.selected.ListCadTanqueEquipamento[i].IdcTanqueEquipamento == AbastecimentoTanque[j].IdcTanqueEquipamento) {\r\n cadEquipamento.selected.ListCadTanqueEquipamento[i].TanqueAbastecido = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n });\r\n }\r\n\r\n cadEquipamento.getEquipamentoModelo = function (item) {\r\n EquipamentoModeloModel.getById(item)\r\n .then(function (resposta) {\r\n cadEquipamento.listaModelo = resposta;\r\n\r\n var filteredModelo = resposta.filter(function (itemModelo) {\r\n return itemModelo.IdcModelo == cadEquipamento.selected.CadModelo.IdcModelo;\r\n });\r\n\r\n if (filteredModelo && filteredModelo.length == 0) {\r\n cadEquipamento.selected.CadModelo.IdcModelo = null;\r\n cadEquipamento.modeloMessage = TranslateService('required');\r\n }\r\n });\r\n }\r\n\r\n\r\n cadEquipamento.tanqueClick = function (tanqueEquipamento) {\r\n if (cadEquipamento.isEmAvaliacao(tanqueEquipamento) || !cadEquipamento.complexPrivileges()) {\r\n return;\r\n }\r\n\r\n cadEquipamento.tanqueEquipamentoSelected = tanqueEquipamento;\r\n cadEquipamento.editarTanque(tanqueEquipamento);\r\n };\r\n\r\n cadEquipamento.adicionarTanque = function () {\r\n cadEquipamento.tanqueEquipamentoSelected = {\r\n ListRelTanqueEquipamentoProduto: {}\r\n }\r\n cadEquipamento.editarTanque(cadEquipamento.tanqueEquipamentoSelected)\r\n .then(function (resposta) {\r\n resposta.DthCriacaoReg = new Date();\r\n resposta.IdcEquipamento = cadEquipamento.selected.IdcEquipamento;\r\n cadEquipamento.selected.ListCadTanqueEquipamento.push(resposta);\r\n });\r\n };\r\n\r\n cadEquipamento.IdentificadorChange = function () {\r\n if (cadEquipamento.selected.IdentificadorTagplaca == 'T') {\r\n cadEquipamento.selected.CodTagPlaca = cadEquipamento.selected.CodTag;\r\n } else {\r\n cadEquipamento.selected.CodTagPlaca = cadEquipamento.selected.CodPlaca;\r\n }\r\n };\r\n\r\n cadEquipamento.changeTag = function (tag) {\r\n if (!cadEquipamento.selected.CodPlaca || cadEquipamento.selected.CodPlaca == '') {\r\n if (tag && tag.length > 0) {\r\n cadEquipamento.selected.IdentificadorTagplaca = \"T\";\r\n }\r\n }\r\n else if (!tag || tag == '') {\r\n if (cadEquipamento.selected.CodPlaca && cadEquipamento.selected.CodPlaca.length > 0) {\r\n cadEquipamento.selected.IdentificadorTagplaca = \"P\";\r\n }\r\n }\r\n }\r\n\r\n cadEquipamento.chkContigenciaClick = function () {\r\n console.log(cadEquipamento.selected.ChkContingencia)\r\n }\r\n\r\n cadEquipamento.changePlaca = function (placa) {\r\n if (!cadEquipamento.selected.CodTag || cadEquipamento.selected.CodTag == '') {\r\n if (placa && placa.length > 0) {\r\n cadEquipamento.selected.IdentificadorTagplaca = \"P\";\r\n }\r\n }\r\n else if (!placa || placa == '') {\r\n if (cadEquipamento.selected.CodTag && cadEquipamento.selected.CodTag.length > 0) {\r\n cadEquipamento.selected.IdentificadorTagplaca = \"T\";\r\n }\r\n }\r\n }\r\n\r\n cadEquipamento.editarTanque = function (tanqueEquipamento) {\r\n return modalEquipamento.open({\r\n locals: {\r\n equipamentoTanque: tanqueEquipamento,\r\n tanques: cadEquipamento.selected.ListCadTanqueEquipamento\r\n }\r\n });\r\n }; \r\n\r\n cadEquipamento.atualizar = function () {\r\n getEquipamento();\r\n }\r\n\r\n cadEquipamento.novo = function (formcadEquipamento) {\r\n cadEquipamento.complexoAdded = false;\r\n executaAcaoPerfilCadastrar(function () {\r\n cadEquipamento.isTelaConsuta = false;\r\n cadEquipamento.edicao = false;\r\n cadEquipamento.selected = { \r\n ListCadTanqueEquipamento: [],\r\n IdentificadorTagplaca: null,\r\n ListCadComplexo: [],\r\n IdcComplexoSolicitante: 0,\r\n ListaContratos: []\r\n };\r\n ValidacaoService.resetForm(formcadEquipamento);\r\n });\r\n }\r\n\r\n cadEquipamento.salvar = function (formcadEquipamento) {\r\n var complexoAdded = cadEquipamento.complexoAdded;\r\n\r\n executaAcaoPerfilCadastrar(function () {\r\n if (cadEquipamento.salvarWaiting)\r\n return;\r\n\r\n cadEquipamento.salvarWaiting = true;\r\n\r\n if (cadEquipamento.selected.IdentificadorTagplaca === null) {\r\n cadEquipamento.salvarWaiting = false;\r\n return;\r\n }\r\n else {\r\n cadEquipamento.selected.CodTagPlaca = cadEquipamento.selected.IdentificadorTagplaca === 'T' ?\r\n cadEquipamento.selected.CodTag : cadEquipamento.selected.CodPlaca;\r\n\r\n if (cadEquipamento.selected.CodTagPlaca === \"\" || cadEquipamento.selected.CodTagPlaca === null ||\r\n cadEquipamento.selected.CodTagPlaca === undefined) {\r\n cadEquipamento.salvarWaiting = false;\r\n return;\r\n }\r\n }\r\n\r\n sppiner.spin();\r\n\r\n return EquipamentoModel.getExistente(\r\n cadEquipamento.selected.CodTagPlaca \r\n ).then(function (resposta) {\r\n cadEquipamento.equipamentoExistente = resposta;\r\n\r\n if ((cadEquipamento.edicao == false) && (cadEquipamento.equipamentoExistente.length != 0)) {\r\n throw new Error(TranslateService('exist-equipment'));\r\n }\r\n else {\r\n\r\n if (\r\n !(cadEquipamento.selected.ImagemDut == undefined) &&\r\n !cadEquipamento.selected.ImagemDut.includes('data:image/png')\r\n ) {\r\n throw new Error(TranslateService('only-png'));\r\n }\r\n if (cadEquipamento.selected.ListCadTanqueEquipamento.length == 0) {\r\n cadEquipamento.tanqueInativo = true;\r\n }\r\n\r\n for (i = 0; i < cadEquipamento.selected.ListCadTanqueEquipamento.length; i++) {\r\n if (cadEquipamento.selected.ListCadTanqueEquipamento[i].StuTanqueEquipamento == \"S\") {\r\n cadEquipamento.tanqueInativo = false;\r\n }\r\n }\r\n\r\n if (cadEquipamento.tanqueInativo) {\r\n throw new Error(TranslateService('tank-empty'));\r\n }\r\n\r\n\r\n if (cadEquipamento.selected.ListCadComplexo.length == 0) {\r\n throw new Error(TranslateService('complex-empty'));\r\n }\r\n\r\n if (cadEquipamento.selected.CodSolicitacaoAceite != \"E\") {\r\n if (cadEquipamento.selected.IdcEquipamento > 0) {\r\n cadEquipamento.selected.CodSolicitacaoAceite = \"A\";\r\n } else {\r\n cadEquipamento.selected.CodSolicitacaoAceite = \"I\";\r\n }\r\n }\r\n\r\n cadEquipamento.selected.IdcUsuarioSolicitante = UsuarioService.indice; \r\n cadEquipamento.selected.IdcTipo = cadEquipamento.selected.CadEquipamentoTipo ? cadEquipamento.selected.CadEquipamentoTipo.IdcTipo : 0;\r\n cadEquipamento.selected.IdcTipoFiscal = cadEquipamento.selected.CadTipoFiscal ? cadEquipamento.selected.CadTipoFiscal.IdcTipoFiscal : 0;\r\n cadEquipamento.selected.IdcGri = cadEquipamento.selected.CadGri ? cadEquipamento.selected.CadGri.IdcGri : 0;\r\n cadEquipamento.selected.IdcModelo = cadEquipamento.selected.CadModelo ? cadEquipamento.selected.CadModelo.IdcModelo : 0;\r\n cadEquipamento.selected.IdcMarca = cadEquipamento.selected.CadModelo ? cadEquipamento.selected.CadModelo.CadMarca.IdcMarca : 0;\r\n cadEquipamento.selected.ListHstTanqueEquipamento = cadEquipamento.selected.ListCadTanqueEquipamento;\r\n cadEquipamento.selected.ListHstRelEquipamentoComplexo = cadEquipamento.selected.ListCadComplexo;\r\n cadEquipamento.selected.$valid = formcadEquipamento.$valid;\r\n cadEquipamento.selected.CodTagPlaca = cadEquipamento.selected.IdentificadorTagplaca === 'T' ? cadEquipamento.selected.CodTag : cadEquipamento.selected.CodPlaca;\r\n cadEquipamento.selected.ObsEquipamento = cadEquipamento.selected.ObsEquipamento;\r\n cadEquipamento.complexoAdded = false;\r\n\r\n for (var i = 0; i < cadEquipamento.selected.ListCadTanqueEquipamento.length; i++) {\r\n cadEquipamento.selected.ListHstTanqueEquipamento[i].ListHstRelTanqueEquipamentoProduto = cadEquipamento.selected.ListCadTanqueEquipamento[i].ListRelTanqueEquipamentoProduto;\r\n }\r\n\r\n sppiner.stop();\r\n return CheckEquipamento(cadEquipamento.selected);\r\n }\r\n }).then(function () {\r\n if (cadEquipamento.selected.ListCadComplexo.length === 1) {\r\n cadEquipamento.selected.IdcComplexoSolicitante = cadEquipamento.selected.ListCadComplexo[0].IdcComplexo;\r\n }\r\n else if (cadEquipamento.selected.IdcComplexoSolicitante === 0){\r\n cadEquipamento.selected.ListCadComplexoPrivilege = cadEquipamento.selected.ListCadComplexo\r\n .filter(function (item) { return cadEquipamento.privilegesComplexos.includes(item[\"IdcComplexo\"].toString()) });\r\n\r\n if (cadEquipamento.selected.ListCadComplexoPrivilege.length == 1) {\r\n cadEquipamento.selected.IdcComplexoSolicitante = cadEquipamento.selected.ListCadComplexoPrivilege[0].IdcComplexo;\r\n }\r\n }\r\n\r\n \r\n if (cadEquipamento.selected.IdcComplexoSolicitante === 0) {\r\n openModalComplexoSolicitante()\r\n .then(function (resposta) {\r\n if (resposta !== false) {\r\n cadEquipamento.selected.IdcComplexoSolicitante = resposta;\r\n cadEquipamento.salvarHistorico(formcadEquipamento);\r\n }\r\n });\r\n } else {\r\n cadEquipamento.salvarHistorico(formcadEquipamento);\r\n } \r\n \r\n }).catch(function (e) {\r\n AlertExceptionService(e);\r\n sppiner.stop();\r\n cadEquipamento.salvarWaiting = false;\r\n cadEquipamento.complexoAdded = complexoAdded;\r\n })\r\n .finally(function () {\r\n sppiner.stop();\r\n $timeout(function () {\r\n sppiner.stop();\r\n cadEquipamento.salvarWaiting = false;\r\n }, 100);\r\n });\r\n \r\n });\r\n }\r\n\r\n cadEquipamento.salvarHistorico = function (formcadEquipamento) {\r\n sppiner.start();\r\n return HstEquipamentoModel.save(cadEquipamento.selected).then(function (resposta) {\r\n ValidacaoService.resetForm(formcadEquipamento);\r\n MessageService.alert(TranslateService('success'), TranslateService('approved-saved'));\r\n cadEquipamento.isTelaConsuta = true;\r\n getEquipamento();\r\n });\r\n }\r\n\r\n cadEquipamento.cancelar = function (formcadEquipamento) {\r\n ValidacaoService.resetForm(formcadEquipamento);\r\n cadEquipamento.isTelaConsuta = true;\r\n getEquipamento();\r\n cadEquipamento.selected = null;\r\n }\r\n\r\n cadEquipamento.excluirCompleto = function (formcadEquipamento) {\r\n executaAcaoPerfilCadastrar(function () {\r\n if (cadEquipamento.selected.IdcEquipamento > 0) {\r\n cadEquipamento.selected.CodSolicitacaoAceite = \"E\";\r\n cadEquipamento.salvar(formcadEquipamento);\r\n }\r\n });\r\n }\r\n\r\n cadEquipamento.openDataInicial = function () {\r\n cadEquipamento.popupDataInicial.opened = true;\r\n };\r\n\r\n cadEquipamento.excluir = function ($event, tanqueEquipamento) {\r\n $event.stopPropagation();\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n var index = cadEquipamento.selected.ListCadTanqueEquipamento.indexOf(tanqueEquipamento);\r\n cadEquipamento.selected.ListCadTanqueEquipamento.splice(index, 1)\r\n .then(function () {\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n cadEquipamento.inicializarImagem = function (id) {\r\n cadEquipamento[id] = document.querySelector('#' + id);\r\n cadEquipamento[id].addEventListener('change', function () {\r\n cadEquipamento.selected['Idc' + id] = 0;\r\n var reader = new FileReader;\r\n reader.onload = function () {\r\n cadEquipamento.selected[id] = reader.result;\r\n }\r\n reader.readAsDataURL(cadEquipamento[id].files[0]);\r\n });\r\n }\r\n\r\n //modalVisualizadorImagem\r\n cadEquipamento.visualizarImagem = function (id) {\r\n var imagem = cadEquipamento.selected[id];\r\n modalVisualizadorImagem.open({\r\n image: {\r\n image: imagem\r\n }\r\n });\r\n }\r\n\r\n cadEquipamento.excluirImagem = function (id) {\r\n cadEquipamento.selected[id] = null;\r\n cadEquipamento.selected['Idc' + id] = 0;\r\n document.querySelector('#' + id).value = null;\r\n }\r\n\r\n cadEquipamento.isEmAvaliacao = function () {\r\n var isEmAvaliacao = false;\r\n\r\n if (cadEquipamento.selected && cadEquipamento.selected.ListCadComplexo) {\r\n if (cadEquipamento.selected.ListCadComplexo.length > 0) {\r\n isEmAvaliacao = cadEquipamento.selected.ListCadComplexo.some(function (item) {\r\n return item.StuEquipamento.indexOf(\"A\") != -1\r\n });\r\n }\r\n \r\n }\r\n \r\n return isEmAvaliacao || !isEmAvaliacao && cadEquipamento.selected && cadEquipamento.selected.ListHstEquipamento\r\n && cadEquipamento.selected.ListHstEquipamento[0] && cadEquipamento.selected.ListHstEquipamento[0].CodRespostaAceite == null;\r\n }\r\n\r\n cadEquipamento.loadMore = function (last, inview) {\r\n if (last && inview) {\r\n cadEquipamento.limit += cadEquipamento.limitStep;\r\n }\r\n }\r\n\r\n cadEquipamento.getMaxYear = function () {\r\n return new Date().getFullYear().toString();\r\n };\r\n\r\n document.getElementById(\"CodTag\").onkeypress = function (e) {\r\n var chr = String.fromCharCode(e.which);\r\n if (\"1234567890qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM-\".indexOf(chr) < 0)\r\n return false;\r\n };\r\n\r\n cadEquipamento.adicionarComplexo = function () {\r\n cadEquipamento.editarComplexo({ new: true }).then(function (resposta) {\r\n resposta.DthCriacaoReg = new Date();\r\n resposta.IdcEquipamento = cadEquipamento.selected.IdcEquipamento;\r\n resposta.IncluidoAlterado = true;\r\n if(cadEquipamento.selected.IdcComplexoSolicitante === 0){\r\n cadEquipamento.selected.IdcComplexoSolicitante = resposta.IdcComplexoSolicitante;\r\n }\r\n cadEquipamento.selected.ListCadComplexo.push(resposta);\r\n });\r\n };\r\n\r\n cadEquipamento.editarComplexo = function (regComplexo) {\r\n var complexos = cadEquipamento.selected.ListCadComplexo.map(function (item) {\r\n return item.IdcComplexo\r\n });\r\n return $mdDialog.show({\r\n parent: angular.element(document.body),\r\n templateUrl: 'equipamentoComplexo.html',\r\n variaveisComplexos: {\r\n complexos: complexos,\r\n listaEmpresa: cadEquipamento.listaEmpresa,\r\n listaContratos: cadEquipamento.selected.ListaContratos,\r\n listaDiretoria: cadEquipamento.listaDiretoria,\r\n isEmAvaliacao: cadEquipamento.isEmAvaliacao() || !cadEquipamento.complexPrivileges()\r\n },\r\n regComplexo: regComplexo,\r\n controller: 'EquipamentoComplexoController',\r\n controllerAs: 'eqComplexo',\r\n preserveScope: false,\r\n multiple: true\r\n });\r\n }\r\n\r\n cadEquipamento.complexoClick = function (complexoEquipamento) {\r\n if ((cadEquipamento.isEmAvaliacao(complexoEquipamento) || !cadEquipamento.complexPrivileges(complexoEquipamento.IdcComplexo))) {\r\n return;\r\n }\r\n var originalComplexo = angular.copy(cadEquipamento.selected.ListCadComplexo);\r\n cadEquipamento.editarComplexo(complexoEquipamento).then(function (resposta) {\r\n if (resposta !== \"cancel\") {\r\n if (resposta.isCopy) {\r\n resposta.DthCriacaoReg = new Date();\r\n resposta.IdcEquipamento = cadEquipamento.selected.IdcEquipamento;\r\n resposta.IncluidoAlterado = true;\r\n if (cadEquipamento.selected.IdcComplexoSolicitante === 0) {\r\n cadEquipamento.selected.IdcComplexoSolicitante = resposta.IdcComplexoSolicitante;\r\n }\r\n cadEquipamento.selected.ListCadComplexo = originalComplexo;\r\n cadEquipamento.selected.ListCadComplexo.push(resposta);\r\n\r\n } else {\r\n complexoEquipamento.DthCriacaoReg = new Date();\r\n complexoEquipamento.IncluidoAlterado = true;\r\n if (cadEquipamento.selected.IdcComplexoSolicitante === 0) {\r\n cadEquipamento.selected.IdcComplexoSolicitante = resposta.IdcComplexoSolicitante;\r\n }\r\n cadEquipamento.complexoAdded = true;\r\n cadEquipamento.selected.IdcEmpresa = resposta.IdcEmpresa;\r\n cadEquipamento.getContrato(cadEquipamento.selected.IdcEmpresa);\r\n }\r\n }\r\n });\r\n };\r\n\r\n\r\n cadEquipamento.FormatFontePagadora = function (item) {\r\n if (item == 'C')\r\n return TranslateService('bill-department');\r\n\r\n if (item == 'E')\r\n return TranslateService('pepElement');\r\n\r\n if (item == 'O')\r\n return TranslateService('statisticalOrder');\r\n\r\n if (item == 'R')\r\n return TranslateService('rateio');\r\n };\r\n\r\n cadEquipamento.FormatStatus = function (status) {\r\n return TranslateService('stu-equipamento-' + status);\r\n }\r\n\r\n cadEquipamento.excluirComplexo = function ($event, complexoEquipamento) {\r\n $event.stopPropagation();\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n var index = cadEquipamento.selected.ListCadComplexo.indexOf(complexoEquipamento);\r\n cadEquipamento.selected.ListCadComplexo.splice(index, 1)\r\n .then(function () {\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n };\r\n\r\n document.getElementById(\"CodPlaca\").onkeypress = function (e) {\r\n var chr = String.fromCharCode(e.which);\r\n if (\"1234567890qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM-\".indexOf(chr) < 0)\r\n return false;\r\n };\r\n\r\n cadEquipamento.getContrato = function(item) {\r\n return ContratoModel.getByIdEmpresa(item)\r\n .then(function (resposta) {\r\n cadEquipamento.selected.ListaContratos = resposta;\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EquipamentoMarcaController', EquipamentoMarcaController);\r\n\r\n EquipamentoMarcaController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'EquipamentoMarcaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function EquipamentoMarcaController(\r\n ValidacaoService,\r\n Constant,\r\n EquipamentoMarcaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadEquipamentoMarca = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadEquipamentoMarca.filtro = '';\r\n cadEquipamentoMarca.listaMarca = null; \r\n cadEquipamentoMarca.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadEquipamentoMarca.selected = null;\r\n cadEquipamentoMarca.isTelaConsuta = true;\r\n cadEquipamentoMarca.validacao = ValidacaoService;\r\n \r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadEquipamentoMarca.isTelaConsuta = true\r\n getEquipamentoMarca(); \r\n \r\n }\r\n\r\n function getEquipamentoMarca() {\r\n EquipamentoMarcaModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamentoMarca.listaMarca = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadEquipamentoMarca.marcaClick = function (item) {\r\n cadEquipamentoMarca.selected = item;\r\n cadEquipamentoMarca.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadEquipamentoMarca.atualizar = function () {\r\n getEquipamentoMarca();\r\n } \r\n\r\n cadEquipamentoMarca.novo = function (formcadEquipamentoMarca) {\r\n cadEquipamentoMarca.isTelaConsuta = false;\r\n cadEquipamentoMarca.selected = {};\r\n ValidacaoService.resetForm(formcadEquipamentoMarca);\r\n }\r\n\r\n cadEquipamentoMarca.salvar = function (formcadEquipamentoMarca) {\r\n \r\n if(formcadEquipamentoMarca.$valid)\r\n {\r\n EquipamentoMarcaModel.save(cadEquipamentoMarca.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadEquipamentoMarca);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadEquipamentoMarca.isTelaConsuta = true;\r\n getEquipamentoMarca();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadEquipamentoMarca.cancelar = function (formcadEquipamentoMarca) {\r\n cadEquipamentoMarca.isTelaConsuta = true;\r\n getEquipamentoMarca();\r\n cadEquipamentoMarca.selected = null;\r\n ValidacaoService.resetForm(formcadEquipamentoMarca);\r\n }\r\n\r\n cadEquipamentoMarca.excluir = function (formcadEquipamentoMarca) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n EquipamentoMarcaModel.excluir(cadEquipamentoMarca.selected.IdcMarca)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadEquipamentoMarca);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadEquipamentoMarca.isTelaConsuta = true;\r\n getEquipamentoMarca();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EquipamentoModeloController', EquipamentoModeloController);\r\n\r\n EquipamentoModeloController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'EquipamentoModeloModel',\r\n 'EquipamentoMarcaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function EquipamentoModeloController(\r\n ValidacaoService,\r\n Constant,\r\n EquipamentoModeloModel,\r\n EquipamentoMarcaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadEquipamentoModelo = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadEquipamentoModelo.filtro = '';\r\n cadEquipamentoModelo.listaModelo = null; \r\n cadEquipamentoModelo.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadEquipamentoModelo.selected = null;\r\n cadEquipamentoModelo.isTelaConsuta = true;\r\n cadEquipamentoModelo.validacao = ValidacaoService;\r\n cadEquipamentoModelo.listaMarca = null;\r\n \r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadEquipamentoModelo.isTelaConsuta = true\r\n getEquipamentoModelo(); \r\n getEquipamentoMarca(); \r\n \r\n }\r\n\r\n function getEquipamentoModelo() {\r\n EquipamentoModeloModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamentoModelo.listaModelo = resposta;\r\n });\r\n }\r\n\r\n function getEquipamentoMarca() {\r\n EquipamentoMarcaModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamentoModelo.listaMarca = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadEquipamentoModelo.modeloClick = function (item) {\r\n cadEquipamentoModelo.selected = item;\r\n cadEquipamentoModelo.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadEquipamentoModelo.atualizar = function () {\r\n getEquipamentoModelo();\r\n } \r\n\r\n cadEquipamentoModelo.novo = function (formcadEquipamentoModelo) {\r\n cadEquipamentoModelo.isTelaConsuta = false;\r\n cadEquipamentoModelo.selected = {};\r\n ValidacaoService.resetForm(formcadEquipamentoModelo);\r\n }\r\n\r\n cadEquipamentoModelo.salvar = function (formcadEquipamentoModelo) {\r\n \r\n if(formcadEquipamentoModelo.$valid)\r\n {\r\n EquipamentoModeloModel.save(cadEquipamentoModelo.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadEquipamentoModelo);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadEquipamentoModelo.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadEquipamentoModelo.cancelar = function (formcadEquipamentoModelo) {\r\n cadEquipamentoModelo.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n cadEquipamentoModelo.selected = null;\r\n ValidacaoService.resetForm(formcadEquipamentoModelo);\r\n }\r\n\r\n cadEquipamentoModelo.excluir = function (formcadEquipamentoModelo) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n EquipamentoModeloModel.excluir(cadEquipamentoModelo.selected.IdcModelo)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadEquipamentoModelo);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadEquipamentoModelo.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EquipamentoTanqueController', EquipamentoTanqueController);\r\n EquipamentoTanqueController.$inject = [\r\n '$uibModalInstance',\r\n 'Constant',\r\n 'locals',\r\n 'ValidacaoService',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'ValidacaoService',\r\n 'ProdutoModel'\r\n ];\r\n\r\n\r\n function EquipamentoTanqueController(\r\n $uibModalInstance,\r\n Constant,\r\n locals,\r\n validacao,\r\n MessageService,\r\n TranslateService,\r\n ValidacaoService,\r\n ProdutoModel\r\n\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var equipamentoTanqueCTRL = this;\r\n var equipamentoTanque = locals.equipamentoTanque;\r\n var tanques = locals.tanques || [];\r\n\r\n //Propriedades privadas\r\n\r\n\r\n //Propriedades públicas\r\n\r\n equipamentoTanqueCTRL.equipamentoTanque = equipamentoTanque;\r\n equipamentoTanqueCTRL.listaStatus = Constant.INDICADORES_ATIVO;\r\n equipamentoTanqueCTRL.validacao = ValidacaoService;\r\n equipamentoTanqueCTRL.semTanque = 0;\r\n\r\n //Métodos privados\r\n\r\n function inicializar() {\r\n getProduto();\r\n }\r\n\r\n function getProduto() {\r\n ProdutoModel.getAll()\r\n .then(function (resposta) {\r\n\r\n equipamentoTanqueCTRL.listaProduto = resposta;\r\n\r\n for (var i = 0; i < equipamentoTanqueCTRL.listaProduto.length; i++) {\r\n for (var j = 0; j < equipamentoTanqueCTRL.equipamentoTanque.ListRelTanqueEquipamentoProduto.length; j++) {\r\n equipamentoTanqueCTRL.listaProduto[i].DthCriacaoReg = new Date;\r\n if (equipamentoTanqueCTRL.listaProduto[i].IdcProduto ==\r\n equipamentoTanqueCTRL.equipamentoTanque.ListRelTanqueEquipamentoProduto[j].IdcProduto\r\n ) {\r\n equipamentoTanqueCTRL.listaProduto[i].ValConsumoEsp = equipamentoTanqueCTRL.equipamentoTanque.ListRelTanqueEquipamentoProduto[j].ValConsumoEsp;\r\n equipamentoTanqueCTRL.listaProduto[i].DthCriacaoReg = equipamentoTanqueCTRL.equipamentoTanque.ListRelTanqueEquipamentoProduto[j].DthCriacaoReg;\r\n equipamentoTanqueCTRL.listaProduto[i].isSelected = true;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n\r\n //Métodos publicos\r\n equipamentoTanqueCTRL.validaDescricao = function (value) {\r\n return !tanques.some(function (tanque) {\r\n return tanque !== equipamentoTanqueCTRL.equipamentoTanque &&\r\n tanque.DscTanqueEquipamento === value;\r\n });\r\n };\r\n\r\n equipamentoTanqueCTRL.produtoClick = function (produto) {\r\n produto.isSelected = !produto.isSelected;\r\n\r\n if (!produto.isSelected) {\r\n produto.ValConsumoEsp = null;\r\n }\r\n }\r\n\r\n equipamentoTanqueCTRL.textChange = function ($event, produto) {\r\n $event.stopPropagation();\r\n produto.isSelected = true;\r\n }\r\n\r\n equipamentoTanqueCTRL.salvar = function (formequipamentoTanqueCTRL) {\r\n\r\n if (formequipamentoTanqueCTRL.$valid) {\r\n !equipamentoTanque.TanqueAbastecido ? equipamentoTanqueCTRL.equipamentoTanque.TanqueAbastecido = false :\r\n equipamentoTanqueCTRL.equipamentoTanque.TanqueAbastecido = true;\r\n equipamentoTanqueCTRL.equipamentoTanque.ListRelTanqueEquipamentoProduto = [];\r\n for (var i = 0; i < equipamentoTanqueCTRL.listaProduto.length; i++) {\r\n if (equipamentoTanqueCTRL.listaProduto[i].isSelected) {\r\n equipamentoTanqueCTRL.semTanque++;\r\n equipamentoTanqueCTRL.equipamentoTanque.ListRelTanqueEquipamentoProduto.push({\r\n \"IdcTanqueEquipamento\": equipamentoTanque.IdcTanqueEquipamento,\r\n \"IdcProduto\": equipamentoTanqueCTRL.listaProduto[i].IdcProduto,\r\n \"ValConsumoEsp\": equipamentoTanqueCTRL.listaProduto[i].ValConsumoEsp || 0,\r\n \"DthCriacaoReg\": equipamentoTanqueCTRL.listaProduto[i].DthCriacaoReg,\r\n \"CadProduto\": null,\r\n \"CadTanqueEquipamento\": null\r\n });\r\n }\r\n }\r\n if(equipamentoTanqueCTRL.semTanque == 0)\r\n {\r\n MessageService.alert(TranslateService('error'), TranslateService('empty-product'));\r\n }else\r\n {\r\n ValidacaoService.resetForm(formequipamentoTanqueCTRL);\r\n $uibModalInstance.close(equipamentoTanqueCTRL.equipamentoTanque);\r\n }\r\n } else {\r\n MessageService.alert(TranslateService('error'), TranslateService('invalid-data'));\r\n }\r\n\r\n }\r\n\r\n equipamentoTanqueCTRL.cancel = function (formequipamentoTanqueCTRL) {\r\n $uibModalInstance.close(true);\r\n validacao.resetForm(formequipamentoTanqueCTRL);\r\n };\r\n\r\n inicializar();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EquipamentoTipoController', EquipamentoTipoController);\r\n\r\n EquipamentoTipoController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'EquipamentoTipoModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function EquipamentoTipoController(\r\n ValidacaoService,\r\n Constant,\r\n EquipamentoTipoModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadEquipamentoTipo = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadEquipamentoTipo.filtro = '';\r\n cadEquipamentoTipo.listaEquipamentoTipo = null; \r\n cadEquipamentoTipo.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadEquipamentoTipo.selected = null;\r\n cadEquipamentoTipo.isTelaConsuta = true;\r\n cadEquipamentoTipo.validacao = ValidacaoService;\r\n \r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadEquipamentoTipo.isTelaConsuta = true\r\n getEquipamentoModelo(); \r\n }\r\n\r\n function getEquipamentoModelo() {\r\n EquipamentoTipoModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamentoTipo.listaEquipamentoTipo = resposta;\r\n });\r\n }\r\n\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadEquipamentoTipo.tipoClick = function (item) {\r\n cadEquipamentoTipo.selected = item;\r\n cadEquipamentoTipo.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadEquipamentoTipo.atualizar = function () {\r\n getEquipamentoModelo();\r\n } \r\n\r\n cadEquipamentoTipo.novo = function (formcadEquipamentoTipo) {\r\n cadEquipamentoTipo.isTelaConsuta = false;\r\n cadEquipamentoTipo.selected = {};\r\n ValidacaoService.resetForm(formcadEquipamentoTipo);\r\n }\r\n\r\n cadEquipamentoTipo.salvar = function (formcadEquipamentoTipo) {\r\n \r\n if(formcadEquipamentoTipo.$valid)\r\n {\r\n EquipamentoTipoModel.save(cadEquipamentoTipo.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadEquipamentoTipo);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadEquipamentoTipo.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadEquipamentoTipo.cancelar = function (formcadEquipamentoTipo) {\r\n cadEquipamentoTipo.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n cadEquipamentoTipo.selected = null;\r\n ValidacaoService.resetForm(formcadEquipamentoTipo);\r\n }\r\n\r\n cadEquipamentoTipo.excluir = function (formcadEquipamentoTipo) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n EquipamentoTipoModel.excluir(cadEquipamentoTipo.selected.IdcTipo)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadEquipamentoTipo);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadEquipamentoTipo.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('EquipamentoTipoGriController', EquipamentoTipoGriController);\r\n\r\n EquipamentoTipoGriController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'EquipamentoTipoGriModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function EquipamentoTipoGriController(\r\n ValidacaoService,\r\n Constant,\r\n EquipamentoTipoGriModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadEquipamentoTipoGri = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadEquipamentoTipoGri.filtro = '';\r\n cadEquipamentoTipoGri.listaEquipamentoTipoGri = null; \r\n cadEquipamentoTipoGri.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadEquipamentoTipoGri.selected = null;\r\n cadEquipamentoTipoGri.isTelaConsuta = true;\r\n cadEquipamentoTipoGri.validacao = ValidacaoService;\r\n \r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadEquipamentoTipoGri.isTelaConsuta = true\r\n getEquipamentoModelo(); \r\n }\r\n\r\n function getEquipamentoModelo() {\r\n EquipamentoTipoGriModel.getAll()\r\n .then(function (resposta) {\r\n cadEquipamentoTipoGri.listaEquipamentoTipoGri = resposta;\r\n });\r\n }\r\n\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadEquipamentoTipoGri.tipoClick = function (item) {\r\n cadEquipamentoTipoGri.selected = item;\r\n cadEquipamentoTipoGri.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadEquipamentoTipoGri.atualizar = function () {\r\n getEquipamentoModelo();\r\n } \r\n\r\n cadEquipamentoTipoGri.novo = function (formcadEquipamentoTipoGri) {\r\n cadEquipamentoTipoGri.isTelaConsuta = false;\r\n cadEquipamentoTipoGri.selected = {};\r\n ValidacaoService.resetForm(formcadEquipamentoTipoGri);\r\n }\r\n\r\n cadEquipamentoTipoGri.salvar = function (formcadEquipamentoTipoGri) {\r\n \r\n if(formcadEquipamentoTipoGri.$valid)\r\n {\r\n EquipamentoTipoGriModel.save(cadEquipamentoTipoGri.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadEquipamentoTipoGri);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadEquipamentoTipoGri.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadEquipamentoTipoGri.cancelar = function (formcadEquipamentoTipoGri) {\r\n cadEquipamentoTipoGri.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n cadEquipamentoTipoGri.selected = null;\r\n ValidacaoService.resetForm(formcadEquipamentoTipoGri);\r\n }\r\n\r\n cadEquipamentoTipoGri.excluir = function (formcadEquipamentoTipoGri) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n EquipamentoTipoGriModel.excluir(cadEquipamentoTipoGri.selected.IdcGri)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadEquipamentoTipoGri);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadEquipamentoTipoGri.isTelaConsuta = true;\r\n getEquipamentoModelo();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n jQuery.event.special.touchstart = {\r\n setup: function (_, ns, handle) {\r\n if (ns.includes(\"noPreventDefault\")) {\r\n this.addEventListener(\"touchstart\", handle, { passive: false });\r\n } else {\r\n this.addEventListener(\"touchstart\", handle, { passive: true });\r\n }\r\n }\r\n };\r\n jQuery.event.special.touchmove = {\r\n setup: function (_, ns, handle) {\r\n if (ns.includes(\"noPreventDefault\")) {\r\n this.addEventListener(\"touchmove\", handle, { passive: false });\r\n } else {\r\n this.addEventListener(\"touchmove\", handle, { passive: true });\r\n }\r\n }\r\n };\r\n\r\n jQuery.event.special.wheel = {\r\n setup: function (_, ns, handle) {\r\n if (ns.includes(\"noPreventDefault\")) {\r\n this.addEventListener(\"wheel\", handle, { passive: false });\r\n } else {\r\n this.addEventListener(\"wheel\", handle, { passive: true });\r\n }\r\n }\r\n };\r\n\r\n angular.module('posto-facil').controller('EstornoController', EstornoController);\r\n EstornoController.$inject = [\r\n 'SelTurnoService',\r\n 'RegEstornoModel',\r\n 'AbastecimentoModel',\r\n 'ModalService',\r\n '$timeout',\r\n 'ValidacaoService',\r\n 'TransitionService',\r\n 'GeneralModel',\r\n 'FocusService',\r\n 'MessageService',\r\n 'Constant',\r\n '$filter',\r\n '$q',\r\n '$element',\r\n 'UsuarioService',\r\n 'CadEquipamentoModel',\r\n 'TranslateService',\r\n 'DiretoriaModel',\r\n 'ComplexoModel',\r\n 'UnidadeModel',\r\n 'PostoModel',\r\n 'ProdutoModel',\r\n 'SpinnerService',\r\n 'CheckEstorno',\r\n 'AlertExceptionService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function EstornoController(\r\n SelTurnoService,\r\n RegEstornoModel,\r\n AbastecimentoModel,\r\n ModalService,\r\n $timeout,\r\n validacao,\r\n TransitionService,\r\n GeneralModel,\r\n focus,\r\n MessageService,\r\n Constant,\r\n $filter,\r\n $q,\r\n $element,\r\n UsuarioService,\r\n CadEquipamentoModel,\r\n TranslateService,\r\n DiretoriaModel,\r\n ComplexoModel,\r\n UnidadeModel,\r\n PostoModel,\r\n ProdutoModel,\r\n SpinnerService,\r\n CheckEstorno,\r\n AlertExceptionService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var estorno = this;\r\n\r\n //Propriedades privadas\r\n var modalTanque = new ModalService({\r\n templateUrl: 'abastecimentoTanque.html',\r\n controller: 'AbastecimentoTanqueController',\r\n controllerAs: 'abTanque'\r\n });\r\n\r\n var sppiner = new SpinnerService('estorno', 10);\r\n\r\n estorno.SelTurnoService = SelTurnoService;\r\n function InicializaVariaveis() {\r\n estorno.validacao = validacao;\r\n estorno.listaAbastecimento = [];\r\n estorno.selectedByShift = null;\r\n estorno.canGetGrid = true;\r\n estorno.canChangeLocalidade = true;\r\n estorno.isTelaConsulta = true;\r\n estorno.isEmAvaliacao = false;\r\n\r\n }\r\n\r\n var today = new Date();\r\n today.setHours(0, 0, 0, 0);\r\n\r\n\r\n var lastMonth = new Date();\r\n lastMonth.setMonth(lastMonth.getMonth() - 1);\r\n lastMonth.setHours(0, 0, 0, 0);\r\n\r\n estorno.filters = {\r\n CadDiretoria: null,\r\n CadComplexo: null,\r\n CadUnidade: null,\r\n DthInicio: lastMonth,\r\n DthFim: today\r\n };\r\n\r\n estorno.searchParams = {\r\n IdcDiretoria: null,\r\n IdcComplexo: null,\r\n IdcUnidade: null,\r\n IdcPosto: null,\r\n IdcProduto: null,\r\n DthInicio: null,\r\n DthFim: null\r\n };\r\n\r\n estorno.cleanSearchTerm = function (fieldName) {\r\n estorno[fieldName] = '';\r\n };\r\n\r\n $element.find('input').on('keydown', function (ev) {\r\n ev.stopPropagation();\r\n });\r\n \r\n InicializaVariaveis();\r\n\r\n //Métodos privados\r\n\r\n function getDiretorias() {\r\n if (estorno.listaDiretoria && estorno.listaDiretoria.length > 0) {\r\n return $q.resolve();\r\n }\r\n return DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n estorno.listaDiretoria = resposta;\r\n });\r\n }\r\n\r\n //Métodos publicos\r\n\r\n estorno.getAbastecimentos = function () {\r\n sppiner.spin();\r\n estorno.canGetGrid = false;\r\n\r\n estorno.filters.DthFim.setHours(23, 59, 59)\r\n\r\n estorno.searchParams.IdcDiretoria = estorno.filters.CadDiretoria ? estorno.filters.CadDiretoria.IdcDiretoria : null;\r\n estorno.searchParams.IdcComplexo = estorno.filters.CadComplexo ? estorno.filters.CadComplexo.IdcComplexo : null;\r\n estorno.searchParams.IdcUnidade = estorno.filters.CadUnidade ? estorno.filters.CadUnidade.IdcUnidade : null;\r\n estorno.searchParams.IdcPosto = estorno.filters.CadPosto ? estorno.filters.CadPosto.IdcPosto : null;\r\n estorno.searchParams.IdcProduto = estorno.filters.IdcProduto;\r\n estorno.searchParams.CodTagPlaca = estorno.filters.CodTagPlaca;\r\n estorno.searchParams.DthInicio = estorno.filters.DthInicio;\r\n estorno.searchParams.DthFim = estorno.filters.DthFim;\r\n estorno.searchParams.EnviadoSap = estorno.filters.EnviadoSap;\r\n estorno.searchParams.IdcAbastecimento = estorno.filters.IdcAbastecimento && estorno.filters.IdcAbastecimento != \"\" ? estorno.filters.IdcAbastecimento : null;\r\n\r\n\r\n RegEstornoModel.getAll(estorno.searchParams, 'grid')\r\n .then(function (resposta) {\r\n estorno.canGetGrid = true;\r\n estorno.listaAbastecimento = resposta;\r\n sppiner.stop();\r\n for (var i = 0; i < estorno.listaAbastecimento.length; i++) {\r\n estorno.listaAbastecimento[i].DthInicialSearch =\r\n $filter('date')(\r\n estorno.listaAbastecimento[i].DthInicial,\r\n TranslateService('datetime-format')\r\n );\r\n estorno.listaAbastecimento[i].DthFinalSearch =\r\n $filter('date')(\r\n estorno.listaAbastecimento[i].DthFinal,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n estorno.listaAbastecimento.sort();\r\n })\r\n .catch(function (err) {\r\n sppiner.stop();\r\n AlertExceptionService(err);\r\n });\r\n };\r\n\r\n estorno.getStatusSap = function (stuEnvioSap) {\r\n return stuEnvioSap == \"6\" ? \"S\" : \"N\";\r\n };\r\n\r\n estorno.changeDiretoria = function () {\r\n if (estorno.canChangeLocalidade) {\r\n getComplexo().then(function () {\r\n estorno.filters.CadComplexo = null;\r\n estorno.filters.CadUnidade = null;\r\n estorno.filters.CadPosto = null;\r\n });\r\n }\r\n };\r\n\r\n function getComplexo(){\r\n if (estorno.filters.CadDiretoria) {\r\n return ComplexoModel.getBySgl(estorno.filters.CadDiretoria.SglDiretoria)\r\n .then(function (resposta) {\r\n estorno.listaComplexo = resposta;\r\n estorno.listaUnidade = [];\r\n estorno.listaPosto = [];\r\n });\r\n }\r\n else {\r\n estorno.listaComplexo = []\r\n estorno.listaUnidade = [];\r\n estorno.listaPosto = [];\r\n estorno.filters.CadComplexo = null;\r\n estorno.filters.CadUnidade = null;\r\n estorno.filters.CadPosto = null;\r\n }\r\n }\r\n\r\n estorno.changeComplexo = function () {\r\n if (estorno.canChangeLocalidade) {\r\n getUnidade().then(function () {\r\n estorno.filters.CadUnidade = null;\r\n estorno.filters.CadPosto = null;\r\n });\r\n }\r\n };\r\n\r\n function getUnidade() {\r\n if (estorno.filters.CadComplexo) {\r\n return UnidadeModel.getAllSameComplexo(estorno.filters.CadComplexo.SglComplexo)\r\n .then(function (resposta) {\r\n estorno.listaUnidade = resposta;\r\n estorno.listaPosto = [];\r\n });\r\n }\r\n else {\r\n estorno.listaUnidade = [];\r\n estorno.listaPosto = [];\r\n estorno.filters.CadUnidade = null;\r\n estorno.filters.CadPosto = null;\r\n }\r\n }\r\n\r\n estorno.changeUnidade = function () {\r\n if (estorno.canChangeLocalidade) {\r\n getPosto().then(function () {\r\n estorno.filters.CadPosto = null;\r\n });;\r\n }\r\n };\r\n\r\n function getPosto() {\r\n if (estorno.filters.CadUnidade) {\r\n return PostoModel.getAllSameUnidade(estorno.filters.CadUnidade.IdcUnidade)\r\n .then(function (resposta) {\r\n estorno.listaPosto = resposta;\r\n });\r\n }\r\n else {\r\n estorno.listaPosto = [];\r\n estorno.filters.CadPosto = null;\r\n }\r\n }\r\n\r\n estorno.changePosto = function () {\r\n getProdutos().then(function (listaProduto) {\r\n estorno.listaProduto = listaProduto;\r\n });\r\n estorno.filters.CodTagPlaca = null;\r\n }\r\n\r\n estorno.getEquipamentos = function (placa) {\r\n return CadEquipamentoModel.getEquipamentos(placa);\r\n };\r\n\r\n function getProdutos() {\r\n if (estorno.filters.CadPosto)\r\n return ProdutoModel.getAllByIdcPosto(estorno.filters.CadPosto.IdcPosto)\r\n else {\r\n return ProdutoModel.getAll();\r\n }\r\n }\r\n\r\n estorno.abastClick = function (abastecimentoEstorno) {\r\n\r\n\r\n if (abastecimentoEstorno.IdcTransferencia) {\r\n return MessageService.alert(TranslateService('atention'), TranslateService('resupply-association-error'));\r\n }\r\n estorno.isEmAvaliacao = false;\r\n AbastecimentoModel.isEmAvaliacao(abastecimentoEstorno.IdcAbastecimento)\r\n .then(function (resposta) {\r\n estorno.isEmAvaliacao = resposta;\r\n });\r\n\r\n estorno.isTelaConsulta = false;\r\n estorno.isEmAvaliacao = false;\r\n estorno.selected = abastecimentoEstorno;\r\n };\r\n\r\n function onChangeTurno(regTurno) {\r\n \r\n if ((!regTurno || !regTurno.IdcRegTurno)) {\r\n return null;\r\n }\r\n\r\n\r\n estorno.selectedByShift = regTurno;\r\n\r\n if (estorno.canChangeLocalidade)\r\n getDiretorias().then(atualizaLocalidadeTurno)\r\n .then(function () {\r\n estorno.canChangeLocalidade = true;\r\n if (estorno.canGetGrid)\r\n estorno.getAbastecimentos();\r\n estorno.changePosto();\r\n });\r\n\r\n }\r\n\r\n function atualizaLocalidadeTurno() {\r\n sppiner.spin();\r\n estorno.canChangeLocalidade = false;\r\n if (estorno.selectedByShift && estorno.selectedByShift != null) {\r\n var diretoria = estorno.listaDiretoria.find(function (item) { return item.IdcDiretoria == estorno.selectedByShift.IdcDiretoria });\r\n\r\n if (diretoria) {\r\n estorno.filters.CadDiretoria = diretoria;\r\n\r\n return getComplexo().then(function () {\r\n var complexo = estorno.listaComplexo.find(function (item) { return item.IdcComplexo == estorno.selectedByShift.IdcComplexo });\r\n\r\n if (complexo) {\r\n estorno.filters.CadComplexo = complexo;\r\n\r\n return getUnidade().then(function () {\r\n var unidade = estorno.listaUnidade.find(function (item) { return item.IdcUnidade == estorno.selectedByShift.IdcUnidade });\r\n\r\n if (unidade) {\r\n estorno.filters.CadUnidade = unidade;\r\n\r\n return getPosto().then(function () {\r\n var posto = estorno.listaPosto.find(function (item) { return item.IdcPosto == estorno.selectedByShift.IdcPosto });\r\n\r\n if (posto) {\r\n estorno.filters.CadPosto = posto;\r\n estorno.selectedByShift = null;\r\n return $q.resolve();\r\n }\r\n else {\r\n estorno.selectedByShift = null;\r\n return $q.reject();\r\n }\r\n });\r\n }\r\n else {\r\n estorno.selectedByShift = null;\r\n return $q.reject();\r\n }\r\n });\r\n }\r\n else {\r\n estorno.selectedByShift = null;\r\n return $q.reject();\r\n }\r\n });\r\n }\r\n else {\r\n estorno.selectedByShift = null;\r\n return $q.reject();\r\n }\r\n }\r\n }\r\n\r\n estorno.atualizar = function () {\r\n InicializaVariaveis();\r\n estorno.isTelaConsulta = true;\r\n\r\n estorno.getAbastecimentos();\r\n };\r\n\r\n estorno.buscar = function (formFiltroEstorno) {\r\n CheckEstorno(formFiltroEstorno, 'filtro')\r\n .then(function () {\r\n estorno.atualizar()\r\n })\r\n };\r\n\r\n estorno.cancelar = function (formEstorno) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n estorno.Anomalias = [];\r\n estorno.isTelaConsulta = true;\r\n validacao.resetForm(formEstorno);\r\n };\r\n\r\n estorno.isBlocked = function () {\r\n return estorno.isEmAvaliacao;\r\n };\r\n\r\n estorno.salvar = function (formEstorno) {\r\n if (!estorno.selected) return;\r\n \r\n estorno.selected.IdcUsuario = UsuarioService.indice;\r\n estorno.selected.IdcUsuario = UsuarioService.indice;\r\n estorno.selected.$valid = formEstorno.$valid;\r\n CheckEstorno(estorno.selected)\r\n .then(function () {\r\n return RegEstornoModel.save(estorno.selected)\r\n .then(function () {\r\n estorno.atualizar();\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\");\r\n });\r\n \r\n })\r\n //.catch(function (err) {\r\n // AlertExceptionService(err);\r\n // sppiner.stop();\r\n //});\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n estorno.isTelaConsulta = true;\r\n\r\n estorno.SelTurnoService.onChangeTurno(onChangeTurno);\r\n estorno.selectedByShift = SelTurnoService.turno;\r\n if (estorno.canChangeLocalidade)\r\n getDiretorias().then(atualizaLocalidadeTurno)\r\n .then(function () {\r\n estorno.canChangeLocalidade = true;\r\n if (estorno.canGetGrid)\r\n estorno.getAbastecimentos();\r\n estorno.changePosto();\r\n });\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('FooterController', FooterController);\r\n FooterController.$inject = [\r\n 'SelTurnoService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function FooterController(SelTurnoService) {\r\n //Associa a instancia do controller em uma variável privada\r\n var footer = this;\r\n\r\n //Propriedades privadas\r\n\r\n //Propriedades públicas\r\n footer.SelTurnoService = SelTurnoService;\r\n\r\n //Métodos privados\r\n\r\n //Métodos publicos\r\n footer.selectTurno = function () {\r\n footer.SelTurnoService.selectTurno(true).catch(console.log);;\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('GerenciaController', GerenciaController);\r\n\r\n GerenciaController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'GerenciaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function GerenciaController(\r\n ValidacaoService,\r\n Constant,\r\n GerenciaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadGerencia = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadGerencia.filtro = '';\r\n cadGerencia.listaGerencia = null;\r\n cadGerencia.listaDiretoria = null;\r\n cadGerencia.listaComplexo = null;\r\n cadGerencia.listaUnidades = null;\r\n cadGerencia.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadGerencia.selected = null;\r\n cadGerencia.isTelaConsuta = true;\r\n cadGerencia.validacao = ValidacaoService;\r\n cadGerencia.IdcGerencia = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n getGerencia()\r\n\r\n\r\n }\r\n\r\n function getGerencia() {\r\n GerenciaModel.getAll()\r\n .then(function (resposta) {\r\n cadGerencia.listaGerencia = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n cadGerencia.click = function (item) {\r\n cadGerencia.selected = item;\r\n cadGerencia.IdcGerencia = item.IdcGerencia;\r\n cadGerencia.isTelaConsuta = false;\r\n \r\n\r\n }\r\n\r\n cadGerencia.atualizar = function () {\r\n getGerencia();\r\n }\r\n\r\n cadGerencia.novo = function (formcadGerencia) {\r\n cadGerencia.isTelaConsuta = false;\r\n cadGerencia.selected = {};\r\n ValidacaoService.resetForm(formcadGerencia);\r\n }\r\n\r\n cadGerencia.salvar = function (formcadGerencia) {\r\n\r\n if (formcadGerencia.$valid) {\r\n\r\n GerenciaModel.save(cadGerencia.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadGerencia);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadGerencia.isTelaConsuta = true;\r\n getGerencia();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n\r\n cadGerencia.cancelar = function (formcadGerencia) {\r\n cadGerencia.isTelaConsuta = true;\r\n getGerencia();\r\n cadGerencia.selected = null;\r\n cadGerencia.IdcGerencia = null;\r\n }\r\n\r\n cadGerencia.excluir = function (formcadGerencia) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n GerenciaModel.excluir(cadGerencia.selected.IdcGerencia)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadGerencia);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadGerencia.isTelaConsuta = true;\r\n getGerencia();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n\t'use strict';\r\n\r\n\tangular.module('posto-facil').controller('HomeController', HomeController);\r\n\r\n\tHomeController.$inject = [\r\n 'MenusService'\r\n\t];\r\n\r\n\t/**\r\n\t * Controller da página home\r\n\t */\r\n\tfunction HomeController(MenusService) {\r\n\t\tvar home = this;\r\n\r\n\t\thome.listMenu = MenusService;\r\n\t}\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('importCargaEmMassaController', ImportCargaEmMassaController);\r\n ImportCargaEmMassaController.$inject = [\r\n 'ExportCsv',\r\n 'SelTurnoService',\r\n 'EntidadeModels',\r\n 'DiretoriaModel',\r\n 'ComplexoModel',\r\n 'UnidadeModel',\r\n 'PostoModel',\r\n 'Constant',\r\n 'ImportService',\r\n 'ValidacaoService',\r\n '$q',\r\n 'FileReaderService',\r\n 'TransitionService',\r\n 'AbastecimentoModel',\r\n 'ModalService',\r\n '$timeout',\r\n 'GeneralModel',\r\n 'FocusService',\r\n 'MessageService',\r\n 'RegAnomaliaService',\r\n 'CtrHorHodModel',\r\n '$filter',\r\n 'UsuarioService',\r\n 'CadEquipamentoModel',\r\n 'TranslateService',\r\n 'CheckAbastecimento',\r\n 'SpinnerService'\r\n ];\r\n function ImportCargaEmMassaController(\r\n ExportCsv,\r\n SelTurnoService,\r\n EntidadeModels,\r\n DiretoriaModel,\r\n ComplexoModel,\r\n UnidadeModel,\r\n PostoModel,\r\n Constant,\r\n ImportService,\r\n ValidacaoService,\r\n $q,\r\n FileReaderService,\r\n TransitionService,\r\n AbastecimentoModel,\r\n ModalService,\r\n $timeout,\r\n GeneralModel,\r\n focus,\r\n MessageService,\r\n RegAnomaliaService,\r\n CtrHorHodModel,\r\n $filter,\r\n UsuarioService,\r\n CadEquipamentoModel,\r\n TranslateService,\r\n CheckAbastecimento,\r\n SpinnerService\r\n ) {\r\n\r\n var importCargaEmMassa = this;\r\n var input = null;\r\n\r\n var modalHistorico = new ModalService({\r\n templateUrl: 'regImportacao.html',\r\n controller: 'RegImportacaoController',\r\n controllerAs: 'regImportacao'\r\n });\r\n\r\n var spinner = new SpinnerService('formImportCargaEmMassa', 10);\r\n\r\n importCargaEmMassa.SelTurnoService = SelTurnoService;\r\n importCargaEmMassa.isImportacao = false;\r\n importCargaEmMassa.isBaixarTemplate = false;\r\n importCargaEmMassa.isValidInputFile = true;\r\n importCargaEmMassa.disableRecebimentoFisico = true;\r\n importCargaEmMassa.dis = false;\r\n importCargaEmMassa.validacao = ValidacaoService;\r\n importCargaEmMassa.param = [];\r\n importCargaEmMassa.objectsSelecteds = [];\r\n importCargaEmMassa.operacaoName = \"\";\r\n importCargaEmMassa.rowsInErros = [];\r\n var namesTemplates = [\r\n {\r\n A: 'ABASTECIMENTO'\r\n }, {\r\n T: 'TRANSFERENCIA'\r\n }, {\r\n RC: 'RECEBIMENTOFISICO_CAMINHAOTANQUE'\r\n }, {\r\n RN: 'RECEBIMENTOFISICO_NAVIOTANQUE'\r\n }, {\r\n RV: 'RECEBIMENTOFISICO_VAGAOTANQUE'\r\n }, {\r\n RT: 'RECEBIMENTOFISICO_TANQUETANQUE'\r\n }\r\n ];\r\n\r\n function InicializaVariaveis() {\r\n // Propriedades públicas\r\n importCargaEmMassa.listaDiretoria = [];\r\n importCargaEmMassa.listaComplexo = [];\r\n importCargaEmMassa.listaUnidade = [];\r\n importCargaEmMassa.listaPosto = [];\r\n importCargaEmMassa.operacoes = Constant.OPERACOES;\r\n importCargaEmMassa.tpOperacoes = Constant.TIPOS_RECEBIMENTO;\r\n importCargaEmMassa.operacaoSelected = null;\r\n importCargaEmMassa.tpOperacaoSelected = null;\r\n importCargaEmMassa.diretoriaSelected = null;\r\n importCargaEmMassa.complexoSelected = null;\r\n importCargaEmMassa.unidadeSelected = null;\r\n importCargaEmMassa.PostoSelected = null;\r\n importCargaEmMassa.formToValidate = formImportCargaEmMassa;\r\n importCargaEmMassa.getServicesToExport();\r\n importCargaEmMassa.getDiretorias();\r\n }\r\n\r\n function operacaoDados() {\r\n return {\r\n diretoria: importCargaEmMassa.diretoriaSelected,\r\n complexo: importCargaEmMassa.complexoSelected,\r\n unidade: importCargaEmMassa.unidadeSelected,\r\n posto: importCargaEmMassa.PostoSelected\r\n }\r\n }\r\n\r\n importCargaEmMassa.getServicesToExport = function (result) {\r\n importCargaEmMassa.operacaoExport = namesTemplates.map(function (name) {\r\n return {\r\n chave: Object.keys(name),\r\n name: Object.values(name),\r\n exportTemplate: ImportService.exportTemplate(Object.values(name)),\r\n }\r\n\r\n });\r\n }\r\n\r\n function resetOperacao() {\r\n importCargaEmMassa.objectsSelecteds = [];\r\n importCargaEmMassa.disableOperationBotton = false;\r\n }\r\n\r\n importCargaEmMassa.getServicesToImport = function (result) {\r\n if(importCargaEmMassa.rowsInErros.length == 0){\r\n Object.assign({}, result);\r\n importCargaEmMassa.operacaoImport = namesTemplates.map(function (name) {\r\n spinner.spin();\r\n if (Object.keys(name) == importCargaEmMassa.param.toString().replace(',', \"\")) {\r\n var alldados = Object.assign(operacaoDados(), { operacao: Object.values(name)[0] });\r\n return {\r\n chave: Object.keys(name),\r\n name: Object.values(name),\r\n import: ImportService.importDirect(result, alldados)\r\n .then(function () {\r\n spinner.stop();\r\n })\r\n .catch(function (erro) {\r\n spinner.stop();\r\n console.log(erro);\r\n MessageService.alert(TranslateService(\"Oper-falha-Operacao\"));\r\n })\r\n }\r\n }\r\n });\r\n }else{\r\n MessageService.alert(TranslateService(\"Oper-falha-erros\"));\r\n showErrosInExcelDateTime(importCargaEmMassa.rowsInErros)\r\n }\r\n resetFileField();\r\n }\r\n\r\n function showErrosInExcelDateTime(rowlist) {\r\n var resposta = [];\r\n var obj = {};\r\n obj.Retorno = TranslateService(\"Oper-falha-erros\");;\r\n resposta.push(obj);\r\n for (var i = 0; i < rowlist.length; i++) {\r\n obj = {};\r\n obj.Retorno = TranslateService(\"campos-data-hora-ivalidos\", rowlist[i]);\r\n resposta.push(obj);\r\n }\r\n if (resposta.length) {\r\n ExportCsv(resposta, TranslateService('RETORNO_') + importCargaEmMassa.operacaoName);\r\n }\r\n importCargaEmMassa.rowsInErros = [];\r\n }\r\n\r\n importCargaEmMassa.changeDiretoria = function () {\r\n importCargaEmMassa.complexoSelected = null;\r\n importCargaEmMassa.unidadeSelected = null;\r\n importCargaEmMassa.PostoSelected = null;\r\n importCargaEmMassa.listaComplexo = [];\r\n importCargaEmMassa.listaUnidade = [];\r\n importCargaEmMassa.listaPosto = [];\r\n importCargaEmMassa.getComplexos(\r\n importCargaEmMassa.listaDiretoria.filter(function (diretoria) {\r\n return diretoria.IdcDiretoria == importCargaEmMassa.diretoriaSelected ? diretoria.SglDiretoria : null;\r\n })\r\n );\r\n }\r\n importCargaEmMassa.changeComplexo = function () {\r\n importCargaEmMassa.unidadeSelected = null;\r\n importCargaEmMassa.PostoSelected = null;\r\n importCargaEmMassa.listaUnidade = [];\r\n importCargaEmMassa.listaPosto = [];\r\n importCargaEmMassa.getUnidades(\r\n importCargaEmMassa.listaComplexo.filter(function (complexo) {\r\n return complexo.IdcComplexo == importCargaEmMassa.complexoSelected ? complexo.SglComplexo : null;\r\n })\r\n );\r\n }\r\n\r\n importCargaEmMassa.changeUnidade = function () {\r\n importCargaEmMassa.PostoSelected = null;\r\n importCargaEmMassa.listaPosto = [];\r\n importCargaEmMassa.getPostos(\r\n importCargaEmMassa.listaUnidade.filter(function (unidade) {\r\n return unidade.IdcUnidade == importCargaEmMassa.unidadeSelected ? unidade.SglUnidade : null;\r\n })\r\n );\r\n }\r\n\r\n importCargaEmMassa.getPostos = function (item) {\r\n if (item.length)\r\n PostoModel.getAllSameUnidade(item[0].IdcUnidade)\r\n .then(function (resposta) {\r\n importCargaEmMassa.listaPosto = resposta.sort(function (a, b) {\r\n return a.DscPosto < b.DscPosto ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n importCargaEmMassa.getUnidades = function (item) {\r\n if (item.length)\r\n UnidadeModel.getAllSameComplexo(item[0].SglComplexo)\r\n .then(function (resposta) {\r\n importCargaEmMassa.listaUnidade = resposta.sort(function (a, b) {\r\n return a.DscUnidade < b.DscUnidade ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n importCargaEmMassa.getComplexos = function (item) {\r\n if (item.length)\r\n ComplexoModel.getBySgl(item[0].SglDiretoria)\r\n .then(function (resposta) {\r\n importCargaEmMassa.listaComplexo = resposta.sort(function (a, b) {\r\n return a.DscComplexo < b.DscComplexo ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n importCargaEmMassa.getDiretorias = function () {\r\n DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n importCargaEmMassa.listaDiretoria = resposta.sort(function (a, b) {\r\n return a.DscDiretoria < b.DscDiretoria ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n importCargaEmMassa.operacaoChange = function () {\r\n importCargaEmMassa.param = []\r\n importCargaEmMassa.param.push(importCargaEmMassa.operacaoSelected);\r\n if (importCargaEmMassa.operacaoSelected == 'R') {\r\n importCargaEmMassa.disableRecebimentoFisico = false;\r\n } else {\r\n importCargaEmMassa.disableRecebimentoFisico = true;\r\n importCargaEmMassa.tpOperacaoSelected = \" \"\r\n }\r\n setNameOfOperation();\r\n resetFileField();\r\n }\r\n function resetFileField() {\r\n var imputFile = document.getElementById(\"arquivoImportacao\");\r\n if(imputFile.files.length != 0){\r\n imputFile.files[0].Files = {};\r\n imputFile.value = \"\";\r\n imputFile.classList.value = \"form-control ng-touched ng-not-empty ng-dirty ng-valid-parse ng-valid ng-valid-required\";\r\n }\r\n }\r\n\r\n importCargaEmMassa.operacaoTipoChange = function () {\r\n if (importCargaEmMassa.param.length == 2) {\r\n importCargaEmMassa.param.pop();\r\n }\r\n importCargaEmMassa.param.push(importCargaEmMassa.tpOperacaoSelected);\r\n setNameOfOperation()\r\n resetFileField();\r\n }\r\n\r\n importCargaEmMassa.fileChange = function (ev) {\r\n var AllDivs = $(\"div.tooltip\"); \r\n var divCinco = AllDivs[AllDivs.length -1];\r\n if (ev.target.value != \"\"){\r\n $(divCinco).hide();\r\n ev.target.classList.value = \"form-control ng-touched ng-not-empty ng-dirty ng-valid-parse ng-valid ng-valid-required\";\r\n }\r\n else{\r\n $(divCinco).show();\r\n ev.target.classList.value = \"form-control ng-pristine ng-empty ng-invalid ng-invalid-required ng-touched\";\r\n }\r\n }\r\n function requireFileInput(input) {\r\n var AllDivs = $(\"div.tooltip\"); \r\n var divCinco = AllDivs[AllDivs.length -1];\r\n if (input.value != \"\"){\r\n $(divCinco).hide();\r\n input.classList.value = \"form-control unRequiredInputFile\";\r\n }\r\n else{\r\n $(divCinco).show();\r\n input.classList.value = \"form-control requiredInputFile\";\r\n }\r\n }\r\n\r\n function setNameOfOperation() {\r\n var resultOperation = namesTemplates.filter(function (template) {\r\n var tipo = importCargaEmMassa.param.toString().replace(',', \"\");\r\n if (Object.keys(template) == tipo)\r\n return template\r\n else if (Object.keys(template) == \"R\")\r\n return { tipo: null }\r\n })[0]\r\n\r\n if(resultOperation != undefined){\r\n importCargaEmMassa.operacaoName = Object.values(resultOperation)[0];\r\n }\r\n }\r\n\r\n importCargaEmMassa.baixarTemplate = function () {\r\n importCargaEmMassa.isImportacao = false;\r\n importCargaEmMassa.isBaixarTemplate = true;\r\n importCargaEmMassa.operacaoExport.filter(function (operacao) {\r\n return operacao.chave[0] == importCargaEmMassa.param.toString().replace(',', \"\");\r\n })[0].exportTemplate();\r\n }\r\n\r\n importCargaEmMassa.importaRegistros = function () {\r\n importCargaEmMassa.objectsSelecteds = [];\r\n importCargaEmMassa.isImportacao = true;\r\n if(formValidadoImportacao ()){\r\n importCargaEmMassa.preparar()\r\n }\r\n }\r\n\r\n function formValidadoImportacao () {\r\n var validado = false;\r\n var imputFile = document.getElementById(\"arquivoImportacao\");\r\n if( importCargaEmMassa.diretoriaSelected != null &&\r\n importCargaEmMassa.complexoSelected != null &&\r\n importCargaEmMassa.unidadeSelected != null &&\r\n importCargaEmMassa.PostoSelected != null &&\r\n importCargaEmMassa.operacaoSelected != null &&\r\n imputFile.value != \"\"){\r\n validado = true;\r\n }\r\n else{\r\n requireFileInput(imputFile)\r\n }\r\n return validado;\r\n }\r\n\r\n importCargaEmMassa.inicializacao = function () {\r\n input = document.querySelector('#arquivoImportacao');\r\n if (input) {\r\n importCargaEmMassa.isValidInputFile = true;\r\n }\r\n }\r\n\r\n importCargaEmMassa.preparar = function () {\r\n if (input.files.length) {\r\n $q.all(Array.from(input.files).map(FileReaderService.readAsText))\r\n .then(function (result) {\r\n result[0].name = importCargaEmMassa.operacaoName;\r\n result = convertToObjectArray(result);\r\n result = removeEmptyRow(result);\r\n //if(importCargaEmMassa.operacaoName == \"ABASTECIMENTO\" || importCargaEmMassa.operacaoName == \"TRANSFERENCIA\"){\r\n result = validateEmptyField(result);\r\n \r\n createListObjectOperation(result);\r\n if (importCargaEmMassa.objectsSelecteds.length){\r\n importCargaEmMassa.getServicesToImport(importCargaEmMassa.objectsSelecteds);\r\n }\r\n });\r\n } else {\r\n importCargaEmMassa.isValidInputFile = false;\r\n }\r\n }\r\n\r\n function convertToObjectArray(fileContents) {\r\n\r\n var retorno = {};\r\n\r\n for (var i in fileContents) {\r\n retorno[fileContents[i].name] = convertToObject(fileContents[i].content);\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function templateIsValid(line) {\r\n var incomingHeader = line;\r\n var incomingHeader = incomingHeader.replaceAll(' ', '').replace(/(\\r\\n|\\n|\\r)/gm, \"\");\r\n var referencialHeader = Constant.CABECALHOREFERENCIAL[importCargaEmMassa.operacaoName];\r\n var referencialHeader = referencialHeader.replaceAll(' ', '');\r\n return incomingHeader == referencialHeader\r\n }\r\n\r\n function convertToObject(fileContent) {\r\n var lines = fileContent.split('\\n');\r\n if(!templateIsValid(lines[2])){\r\n MessageService.alert( TranslateService(\"template-Is-Valid\"));\r\n resetFileField();\r\n return;\r\n }\r\n var headers = lines[2].split(';')\r\n .map(function (header) { return header.trim() })\r\n .filter(function (header) { return !!header });\r\n var objArray = [];\r\n\r\n\r\n for (var i = 3; i < lines.length; i++) {\r\n var values = lines[i].split(';');\r\n\r\n if (values.length < headers.length) {\r\n continue;\r\n }\r\n\r\n var obj = {};\r\n var temp = null;\r\n\r\n for (var j = 0; j < headers.length; j++) {\r\n values[j] = values[j].trim();\r\n\r\n var arrTime = values[j].split('/');\r\n\r\n if (values[j] === \"null\") {\r\n temp = null;\r\n } else if (arrTime.length == 3) {\r\n if (!isNaN(Date.parse(values[j].split('/').reverse().join('-')))) {\r\n\r\n var arr = values[j].split('/');\r\n temp = new Date([arr[2], arr[1], arr[0]].join('-') + \" 23:59:59\");\r\n }\r\n } else {\r\n temp = values[j];\r\n }\r\n obj[headers[j]] = temp;\r\n }\r\n objArray.push(obj);\r\n }\r\n\r\n return objArray\r\n }\r\n\r\n importCargaEmMassa.teste = function () {\r\n console.log(\"achou\");\r\n }\r\n\r\n function createListObjectOperation(object) {\r\n for (var key in object) {\r\n switch (key) {\r\n case \"ABASTECIMENTO\":\r\n createToAbastecimento(object, key)\r\n break;\r\n case \"TRANSFERENCIA\":\r\n createToTransfencia(object, key)\r\n break;\r\n case \"RECEBIMENTOFISICO_CAMINHAOTANQUE\":\r\n createToRecebimentoFisicoCaminhaoTanque(object, key)\r\n break;\r\n case \"RECEBIMENTOFISICO_NAVIOTANQUE\":\r\n createToRecebimentoFisicoNavioTanque(object, key)\r\n break;\r\n case \"RECEBIMENTOFISICO_VAGAOTANQUE\":\r\n createToRecebimentoFisicoVagaoTanque(object, key)\r\n break;\r\n case \"RECEBIMENTOFISICO_TANQUETANQUE\":\r\n createToRecebimentoFisicoTanqueTanque(object, key)\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n }\r\n\r\n //#region ABASTECIMENTO TRANFERENCIA\r\n function removeEmptyRow(object) {\r\n var position = -1; var toRemove = []; var keyOut = \"\";\r\n for (keyOut in object) {\r\n position = 0;\r\n object[keyOut].forEach(function (item) {\r\n var qtdAttObj = Object.keys(item).length\r\n var qtdAttVista = 0\r\n for (var keyIn in item) {\r\n if (item[keyIn] == \"\") {\r\n qtdAttVista += 1\r\n if(qtdAttVista == qtdAttObj){\r\n if (toRemove.indexOf(position) == -1){\r\n toRemove.push(position)\r\n }\r\n }\r\n }\r\n }\r\n position += 1;\r\n });\r\n\r\n }\r\n toRemove.reverse();\r\n for (var index = 0; index < toRemove.length; index++) {\r\n object[keyOut].splice(toRemove[index], 1);\r\n }\r\n return object;\r\n }\r\n\r\n function isNoblanckFilds(item, oper) {\r\n if(oper == \"ABASTECIMENTO\"){\r\n if(item[\"Código Usuário (*)\"] == \"\" &&\r\n item[\"Tag/Placa (*)\"] == \"\" &&\r\n item[\"Horímetro/Hodômetro (*)\"] == \"\"&&\r\n item[\"Data Inicial (*)\"] == \"\"&&\r\n item[\"Hora Inicial (*)\"] == \"\"&&\r\n item[\"Data Final (*)\"] == \"\"&&\r\n item[\"Hora Inicial (*)\"] == \"\"){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n }else\r\n if(oper == \"TRANSFERENCIA\"){\r\n return true;\r\n }else{\r\n if(item[\"Código Usuário (*)\"] == \"\" &&\r\n item[\"Produto (*)\"] == \"\" &&\r\n item[\"Data Inicial (*)\"] == \"\"&&\r\n item[\"Hora Inicial (*)\"] == \"\"&&\r\n item[\"Data Final (*)\"] == \"\"&&\r\n item[\"Hora Inicial (*)\"] == \"\"){\r\n return false;\r\n }else{\r\n return true;\r\n }\r\n }\r\n\r\n }\r\n\r\n function validateEmptyField(object) {\r\n var invalid = []; var line = 3; var coluna = \"\"; var NoblanckFildsItem = null\r\n for (var keyOut in object) {\r\n var oper = keyOut;\r\n object[keyOut].forEach(function (item, i) {\r\n if(isNoblanckFilds(item, oper)){\r\n NoblanckFildsItem = item\r\n line +=1;\r\n for (var keyIn in item) {\r\n coluna = keyIn;\r\n if(keyIn.indexOf(\"*\") != -1){\r\n if (item[keyIn] == \"\") {\r\n invalid.push(TranslateService(\"CampoLinhaErro\", coluna, line))\r\n }\r\n }\r\n }\r\n }else{\r\n line +=1;\r\n if(oper == \"ABASTECIMENTO\"){\r\n item[\"Código Usuário (*)\"] = NoblanckFildsItem[\"Código Usuário (*)\"]\r\n item[\"Tag/Placa (*)\"] = NoblanckFildsItem[\"Tag/Placa (*)\"]\r\n item[\"Horímetro/Hodômetro (*)\"] = NoblanckFildsItem[\"Horímetro/Hodômetro (*)\"]\r\n item[\"Observações\"] = NoblanckFildsItem[\"Observações\"]\r\n item[\"Data Inicial (*)\"] = NoblanckFildsItem[\"Data Inicial (*)\"]\r\n item[\"Hora Inicial (*)\"] = NoblanckFildsItem[\"Hora Inicial (*)\"]\r\n item[\"Data Final (*)\"] = NoblanckFildsItem[\"Data Final (*)\"]\r\n item[\"Hora Final (*)\"] = NoblanckFildsItem[\"Hora Final (*)\"]\r\n }\r\n }\r\n });\r\n\r\n \r\n }\r\n return invalid.length == 0 ? object : showInvalidsFields(invalid);\r\n }\r\n\r\n function showInvalidsFields(invalid) {\r\n var messagesError = TranslateService('campoRequired')+\" \\r\\n\";\r\n for (var i = 0; i < invalid.length; i++) {\r\n messagesError += invalid[i] + \"\\r\\n\";\r\n }\r\n MessageService.alert(TranslateService('error'), messagesError, null, 'Erro');\r\n resetFileField();\r\n }\r\n\r\n function validateDataTimeInRowLine(date, time) {\r\n if(date instanceof Date && !isNaN(date.valueOf()) &&\r\n /([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])\\s*([AaPp][Mm])/.test(time)){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }\r\n\r\n function concatDataHora(data, time, row) {\r\n \r\n if(data == \"\" && time == \"\"){\r\n return;\r\n }\r\n var dateString = new Date(data).toDateString();\r\n \r\n \r\n var date = new Date(dateString + \" \" + time);\r\n var options = {\r\n hour: 'numeric',\r\n minute: 'numeric',\r\n hour12: true\r\n };\r\n var timeString = date.toLocaleString('en-US', options);\r\n time = timeString;\r\n if(validateDataTimeInRowLine(data, time)){\r\n var hours = Number(time.match(/^(\\d+)/)[1]);\r\n var minutes = Number(time.match(/:(\\d+)/)[1]);\r\n var AMPM = time.match(/\\s(.*)$/)[1];\r\n if(AMPM == \"PM\" && hours<12) hours = hours+12;\r\n if(AMPM == \"AM\" && hours==12) hours = hours-12;\r\n var sHours = hours.toString();\r\n var sMinutes = minutes.toString();\r\n if(hours<10) sHours = \"0\" + sHours;\r\n if(minutes<10) sMinutes = \"0\" + sMinutes;\r\n data.setHours(sHours);\r\n data.setMinutes(sMinutes);\r\n data.setSeconds(0);\r\n return data; \r\n }else{\r\n // if(importCargaEmMassa.operacaoName == \"ABASTECIMENTO\" || importCargaEmMassa.operacaoName == \"TRANSFERENCIA\"){\r\n if(!importCargaEmMassa.rowsInErros.includes(row))\r\n importCargaEmMassa.rowsInErros.push(row)\r\n // }\r\n }\r\n }\r\n\r\n function createToAbastecimento(object, key) {\r\n var currentDate = new Date();\r\n if (Object.hasOwnProperty.call(object, key)) {\r\n for (var i = 0; i < object[key].length; i++) {\r\n importCargaEmMassa.objectsSelecteds.push(\r\n {\r\n \"detalhesAbastecimento\": {\r\n \"Anomalias\": null,\r\n \"ChkHorimetro\": false,\r\n \"ChkResetAutomaticoHorHod\": false,\r\n \"CodTagPlacaEqp\": \"\",\r\n \"ContratoVencido\": true,\r\n \"DscGerenciaGa\": null,\r\n \"DthCriacaoReg\": currentDate,\r\n \"DthFinal\": currentDate,\r\n \"DthInicial\": currentDate,\r\n \"DthInicialRowExecel\": currentDate,\r\n \"DthVencimentoContrato\": currentDate,\r\n \"IdcAbastecimento\": 0,\r\n \"IdcCentroCusto\": 0,\r\n \"CodCentroCusto\": \"\",\r\n \"IdcContrato\": 0,\r\n \"IdcElementoPep\": 0,\r\n \"CodElementoPep\": \"\",\r\n \"IdcEmpresa\": 0,\r\n \"IdcEquipamento\": 0,\r\n \"IdcGri\": 0,\r\n \"IdcOrdemEstatistica\": 0,\r\n \"CodOrdemEstatistica\": \"\",\r\n \"IdcPosto\": 0,\r\n \"IdcRegTurno\": 0,\r\n \"IdcTipoFiscal\": 0,\r\n \"IdcTransferencia\": null,\r\n \"IdcUsuario\": 0,\r\n \"IsLocomotiva\": false,\r\n \"IsWaitingApprovalChange\": false,\r\n \"ListTanques\": [],\r\n \"NomDispositivo\": \"WEB-MOBILE\",\r\n \"NomEmpresa\": \"\",\r\n \"NomeOperador\": \"\",\r\n \"NumDigitos\": 0,\r\n \"PendenteAvaliacao\": false,\r\n \"PossuiHorHod\": false,\r\n \"SglGerenciaGa\": null,\r\n \"SglTurno\": \"\",\r\n \"StatusSalvamento\": 0, \r\n \"StuAbastecimento\": \"S\",\r\n \"TanquesLiberadosParaAbastecimento\": 0,\r\n \"TipoEquipamento\": \"\",\r\n \"UltimoHorHod\": 0,\r\n \"ValHorHod\": 0,\r\n \"VolumeTotal\": 0,\r\n \"key\": 0,\r\n \"AbastecimentoRowExcel\": {\r\n \"codigo_usuario\": object[key][i]['Código Usuário (*)'],\r\n \"tag_placa\": object[key][i]['Tag/Placa (*)'],\r\n \"data_inicial\": concatDataHora(object[key][i]['Data Inicial (*)'], object[key][i]['Hora Inicial (*)'], (i+4)),\r\n \"data_final\": concatDataHora(object[key][i]['Data Final (*)'], object[key][i]['Hora Final (*)'], (i+4)),\r\n \"horimetro\": object[key][i]['Horímetro/Hodômetro (*)'],\r\n \"observacao\": object[key][i]['Observações']\r\n }\r\n },\r\n \"abastecimentoTanque\": {\r\n \"ChkAbastecimentoTanque\": 0,\r\n \"ChkResetAutomaticoBlocoMedidor\": false,\r\n \"ChkResetAutomaticoEncerrante\": false,\r\n \"DenAbastecimento\": null,\r\n \"DscClasseProduto\": null,\r\n \"DscProduto\": null,\r\n \"DscTanqueEquipamento\": \"EQP-TQ-001\",\r\n \"DscTipoProduto\": null,\r\n \"DthAbastecimentoTanque\": \"/Date(-62135589600000)/\",\r\n \"DthCriacaoReg\": \"/Date(-62135589600000)/\",\r\n \"EncerranteValido\": false,\r\n \"IdcAbastecimento\": 0,\r\n \"IdcAbastecimentoTanque\": 0,\r\n \"IdcBlocoMedidor\": 0,\r\n \"IdcCargaMassa\": null,\r\n \"IdcEquipamento\": 1,\r\n \"IdcProduto\": 0,\r\n \"IdcRateio\": null,\r\n \"IdcTanqueEquipamento\": 1,\r\n \"IdcUsuMan\": null,\r\n \"RegPorEncerrante\": null,\r\n \"SglBlocoMedidor\": null,\r\n \"SglProduto\": null,\r\n \"StuEnvioSap\": \"0\",\r\n \"TmpAbastecimento\": null,\r\n \"UeFator\": 1,\r\n \"ValCapacidadeNominal\": 300,\r\n \"ValConsumoEsp\": 0,\r\n \"ValEncerrante\": 0,\r\n \"ValEncerranteAbastecimento\": null,\r\n \"VolAbastecimento\": null,\r\n \"VolAbastecimento20c\": null,\r\n \"VolAtual\": null,\r\n \"idDataGrid\": 1,\r\n \"key\": 0,\r\n \"listAnomalia\": [],\r\n \"AbastecimentoTanqueRowExcel\": {\r\n \"sigla_tanque\": object[key][i]['Sigla Tanque'],\r\n \"codigo_material\": object[key][i]['Código Material Produto'],\r\n \"bloco_medidor\": object[key][i]['Bloco Medidor (*)'],\r\n \"volume\": object[key][i]['Volume (L)'],\r\n \"encerrante\": object[key][i]['Encerrante'],\r\n \"volume_atual\": object[key][i]['Volume Atual (L)'],\r\n }\r\n\r\n }\r\n }\r\n )\r\n }\r\n }\r\n }\r\n\r\n function createToTransfencia(object, key) {\r\n var currentDate = new Date();\r\n if (Object.hasOwnProperty.call(object, key)) {\r\n for (var i = 0; i < object[key].length; i++) {\r\n importCargaEmMassa.objectsSelecteds.push(\r\n {\r\n \"dataFinalOriginal\": true,\r\n \"IdentificadorTransferenciaProduto\": 0,\r\n \"DataHoraUTCCriacao\": currentDate,\r\n \"IdentificadorUsuarioCriacao\": 0,\r\n \"DataHoraUTCUltimaAtualizacao\": currentDate,\r\n \"IdentificadorUsuarioUltimaAtualizacao\": 0,\r\n \"IdentificadorProduto\": 0,\r\n \"IdentificadorAberturaFechamentoTurnoPostoOrigem\": 0,\r\n \"IdentificadorUsuarioResponsavelPostoOrigem\": 0,\r\n \"DataHoraUTCInicioRetiradaOrigem\": currentDate,\r\n \"DataHoraUTCFimRetiradaOrigem\": currentDate,\r\n \"IdentificadorEncerranteBlocoMedidorOrigem\": 0,\r\n \"NomeSistemaOrigemDadoPostoOrigem\": \"WEB-MOBILE\",\r\n \"IndicadorSituacao\": \"AB\",\r\n \"IdentificadorProdutoPostoDestino\": 0,\r\n \"IdentificadorAberturaFechamentoTurnoPostoDestino\": null,\r\n \"IdentificadorUsuarioResponsavelPostoDestino\": 0,\r\n \"DataHoraUTCInicioRecebimentoDestino\": currentDate,\r\n \"DataHoraUTCFimRecebimentoDestino\": currentDate,\r\n \"NumeroIdentificacaoLacres\": 0,\r\n \"QuantidadeLacres\": 0,\r\n \"CodigoHexadecimalCorLacres\": \"\",\r\n \"QuantidadeTransferida\": 0,\r\n \"QuantidadeTransferida20GrausCelsius\": 0,\r\n \"MedidaTemperaturaProduto\": 0.0,\r\n \"MedidaDensidadeProduto\": 0.0,\r\n \"NomeSistemaOrigemDadoPostoDestino\": \"\",\r\n \"IndicadorUtilizacaoSkidPostoDestino\": 0,\r\n \"IdentificadorCargaMassaMovimentacao\": 0,\r\n \"IdentificadorEmpresaTransportadora\": 0,\r\n \"IdentificadorCaminhaoTanque\": 0,\r\n \"IdentificadorNavioTanque\": 0,\r\n \"IdentificadorCavaloMecanico\": 0,\r\n \"IdentificadorMotoristaCavaloCaminhaoTanque\": 0,\r\n \"IndicadorConcordanciaMotorista\": 0,\r\n \"CadCaminhaoTanque\": null,\r\n \"CadCavaloMecanico\": null,\r\n \"CadEmpresa\": null,\r\n \"CadMotorista\": null,\r\n \"CadPosto\": null,\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioResponsavelPostoOrigem\": null,\r\n \"CadUsuarioResponsavelPostoDestino\": null,\r\n \"CtrEncerrante\": {\r\n \"IdcCtrEncerrante\": 0,\r\n \"IdcBlocoMedidor\": 0,\r\n \"DthCtrEncerrante\": currentDate,\r\n \"ValEncerranteAtual\": 0,\r\n \"IdcTblOperacao\": 0,\r\n \"TblOperacao\": \"V5ETRANT\",\r\n \"ChkResetAutomatico\": false,\r\n \"DthCriacaoReg\": currentDate\r\n },\r\n \"RegTurnoOrigem\": 0,\r\n \"RegTurnoDestino\": 0,\r\n \"TransferenciaRowExcel\": {\r\n 'Bloco_Medidor': object[key][i]['Bloco Medidor (*)'],\r\n 'Codigo_Usuário': object[key][i]['Código Usuário (*)'],\r\n 'Posto_de_Destino': object[key][i]['Posto de Destino (*)'],\r\n 'Data_Inicial': concatDataHora(object[key][i]['Data Inicial (*)'], object[key][i]['Hora Inicial (*)'], (i+4)),\r\n 'Data_Final': concatDataHora(object[key][i]['Data Final (*)'], object[key][i]['Hora Final (*)'], (i+4)),\r\n 'Encerrante': object[key][i]['Encerrante'],\r\n 'Volume': object[key][i]['Volume (L)'],\r\n 'Observacoes': object[key][i]['Observações']\r\n }\r\n }\r\n )\r\n }\r\n }\r\n }\r\n\r\n\r\n //#endregion\r\n\r\n //#region RECEBIMENTO FISICO\r\n\r\n function createToRecebimentoFisicoCaminhaoTanque(object, key) {\r\n if (Object.hasOwnProperty.call(object, key)) {\r\n for (var i = 0; i < object[key].length; i++) {\r\n importCargaEmMassa.objectsSelecteds.push(\r\n {\r\n \"RecebimentoProdutoRow\":{\r\n 'Codigo_Usuário': object[key][i]['Código Usuário (*)'],\r\n 'Produto': object[key][i]['Produto (*)'],\r\n 'Data_Inicial': concatDataHora(object[key][i]['Data Inicial (*)'], object[key][i]['Hora Inicial (*)'], (i+4)),\r\n 'Data_Final': concatDataHora(object[key][i]['Data Final (*)'], object[key][i]['Hora Final (*)'], (i+4)),\r\n 'MotoristaConcorda': object[key][i]['Motorista Concorda?'],\r\n 'RecebimentocomSkid': object[key][i]['Recebimento com SKID?'],\r\n 'CavaloMecanico': object[key][i]['Cavalo Mecânico (*)'],\r\n 'CaminhoTanque': object[key][i]['Caminhão Tanque (*)'],\r\n 'Observacoes': object[key][i]['Observações'],\r\n 'NumerodoCompartimento': object[key][i]['Número do Compartimento (*)'], //inicio detalhe recebimento\r\n 'VolumeRecebido': object[key][i]['Volume Recebido (*)'],\r\n 'Densidade': object[key][i]['Densidade'],\r\n 'Temperatura': object[key][i]['Temperatura'],\r\n 'DensidadeBoletim': object[key][i]['Densidade (Boletim)'],\r\n 'TemperaturaMassa': object[key][i]['Temperatura (Massa)'],\r\n 'AspectoVisual': object[key][i]['Aspecto Visual'],\r\n 'PresencadeAgua': object[key][i]['Presença de Água'],\r\n 'SiglaTanque': object[key][i]['Sigla Tanque (*)'],//apuração tancagem\r\n 'AlturaInicialMM': object[key][i]['Altura Inicial MM'],\r\n 'AlturaFinalMM': object[key][i]['Altura Final MM'],\r\n 'QuantidadeInicial': object[key][i]['Quantidade Inicial'],\r\n 'QuantidadeFinal': object[key][i]['Quantidade Final'],\r\n 'QuantidadeInicial20C': object[key][i]['Quantidade Inicial 20°C'],\r\n 'QuantidadeFinal20C': object[key][i]['Quantidade Final 20°C'],\r\n 'DensidadeInicial': object[key][i]['Densidade Inicial'],\r\n 'DensidadeFinal': object[key][i]['Densidade Final'],\r\n 'TemperaturaMediaInicial': object[key][i]['Temperatura Média Inicial'],\r\n 'TemperaturaSuperficieInicial': object[key][i]['Temperatura Superfície Inicial'],\r\n 'TemperaturaMeioInicial': object[key][i]['Temperatura Meio Inicial'],\r\n 'TemperaturaFundoInicial': object[key][i]['Temperatura Fundo Inicial'],\r\n 'TemperaturaMediaFinal': object[key][i]['Temperatura Média Final'],\r\n 'TemperaturaSuperficieFinal': object[key][i]['Temperatura Superfície Final'],\r\n 'TemperaturaMeioFinal': object[key][i]['Temperatura Meio Final'],\r\n 'TemperaturaFundoFinal': object[key][i]['Temperatura Fundo Final']}\r\n })}\r\n }\r\n }\r\n\r\n function createToRecebimentoFisicoNavioTanque(object, key) {\r\n if (Object.hasOwnProperty.call(object, key)) {\r\n for (var i = 0; i < object[key].length; i++) {\r\n importCargaEmMassa.objectsSelecteds.push(\r\n {\r\n \"RecebimentoProdutoRow\":{\r\n 'Codigo_Usuário': object[key][i]['Código Usuário (*)'],\r\n 'Produto': object[key][i]['Produto (*)'],\r\n 'Data_Inicial': concatDataHora(object[key][i]['Data Inicial (*)'], object[key][i]['Hora Inicial (*)'], (i+4)),\r\n 'Data_Final': concatDataHora(object[key][i]['Data Final (*)'], object[key][i]['Hora Final (*)'], (i+4)),\r\n 'MotoristaConcorda': object[key][i]['Motorista Concorda?'],\r\n 'RecebimentocomSkid': object[key][i]['Recebimento com SKID?'],\r\n 'NavioTanque': object[key][i]['Navio Tanque (*)'],\r\n 'Observacoes': object[key][i]['Observações'],\r\n 'NumerodoCompartimento': object[key][i]['Número do Compartimento (*)'], //inicio detalhe recebimento\r\n 'VolumeRecebido': object[key][i]['Volume Recebido (*)'],\r\n 'Densidade': object[key][i]['Densidade'],\r\n 'Temperatura': object[key][i]['Temperatura'],\r\n 'DensidadeBoletim': object[key][i]['Densidade (Boletim)'],\r\n 'TemperaturaMassa': object[key][i]['Temperatura (Massa)'],\r\n 'AspectoVisual': object[key][i]['Aspecto Visual'],\r\n 'PresencadeAgua': object[key][i]['Presença de Água'],\r\n 'SiglaTanque': object[key][i]['Sigla Tanque (*)'],//apuração tancagem\r\n 'AlturaInicialMM': object[key][i]['Altura Inicial MM'],\r\n 'AlturaFinalMM': object[key][i]['Altura Final MM'],\r\n 'QuantidadeInicial': object[key][i]['Quantidade Inicial'],\r\n 'QuantidadeFinal': object[key][i]['Quantidade Final'],\r\n 'QuantidadeInicial20C': object[key][i]['Quantidade Inicial 20°C'],\r\n 'QuantidadeFinal20C': object[key][i]['Quantidade Final 20°C'],\r\n 'DensidadeInicial': object[key][i]['Densidade Inicial'],\r\n 'DensidadeFinal': object[key][i]['Densidade Final'],\r\n 'TemperaturaMediaInicial': object[key][i]['Temperatura Média Inicial'],\r\n 'TemperaturaSuperficieInicial': object[key][i]['Temperatura Superfície Inicial'],\r\n 'TemperaturaMeioInicial': object[key][i]['Temperatura Meio Inicial'],\r\n 'TemperaturaFundoInicial': object[key][i]['Temperatura Fundo Inicial'],\r\n 'TemperaturaMediaFinal': object[key][i]['Temperatura Média Final'],\r\n 'TemperaturaSuperficieFinal': object[key][i]['Temperatura Superfície Final'],\r\n 'TemperaturaMeioFinal': object[key][i]['Temperatura Meio Final'],\r\n 'TemperaturaFundoFinal': object[key][i]['Temperatura Fundo Final']}\r\n })}\r\n }\r\n }\r\n\r\n function createToRecebimentoFisicoVagaoTanque(object, key) {\r\n if (Object.hasOwnProperty.call(object, key)) {\r\n for (var i = 0; i < object[key].length; i++) {\r\n importCargaEmMassa.objectsSelecteds.push(\r\n {\r\n \"RecebimentoProdutoRow\":{\r\n 'Codigo_Usuário': object[key][i]['Código Usuário (*)'],\r\n 'Produto': object[key][i]['Produto (*)'],\r\n 'Data_Inicial': concatDataHora(object[key][i]['Data Inicial (*)'], object[key][i]['Hora Inicial (*)'], (i+4)),\r\n 'Data_Final': concatDataHora(object[key][i]['Data Final (*)'], object[key][i]['Hora Final (*)'], (i+4)),\r\n 'MotoristaConcorda': object[key][i]['Motorista Concorda?'],\r\n 'RecebimentocomSkid': object[key][i]['Recebimento com SKID?'],\r\n 'VagaoTanque': object[key][i]['Vagão Tanque (*)'],\r\n 'Observacoes': object[key][i]['Observações'],\r\n 'NumerodoCompartimento': object[key][i]['Número do Compartimento (*)'], //inicio detalhe recebimento\r\n 'VolumeRecebido': object[key][i]['Volume Recebido (*)'],\r\n 'Densidade': object[key][i]['Densidade'],\r\n 'Temperatura': object[key][i]['Temperatura'],\r\n 'DensidadeBoletim': object[key][i]['Densidade (Boletim)'],\r\n 'TemperaturaMassa': object[key][i]['Temperatura (Massa)'],\r\n 'AspectoVisual': object[key][i]['Aspecto Visual'],\r\n 'PresencadeAgua': object[key][i]['Presença de Água'],\r\n 'SiglaTanque': object[key][i]['Sigla Tanque (*)'],//apuração tancagem\r\n 'AlturaInicialMM': object[key][i]['Altura Inicial MM'],\r\n 'AlturaFinalMM': object[key][i]['Altura Final MM'],\r\n 'QuantidadeInicial': object[key][i]['Quantidade Inicial'],\r\n 'QuantidadeFinal': object[key][i]['Quantidade Final'],\r\n 'QuantidadeInicial20C': object[key][i]['Quantidade Inicial 20°C'],\r\n 'QuantidadeFinal20C': object[key][i]['Quantidade Final 20°C'],\r\n 'DensidadeInicial': object[key][i]['Densidade Inicial'],\r\n 'DensidadeFinal': object[key][i]['Densidade Final'],\r\n 'TemperaturaMediaInicial': object[key][i]['Temperatura Média Inicial'],\r\n 'TemperaturaSuperficieInicial': object[key][i]['Temperatura Superfície Inicial'],\r\n 'TemperaturaMeioInicial': object[key][i]['Temperatura Meio Inicial'],\r\n 'TemperaturaFundoInicial': object[key][i]['Temperatura Fundo Inicial'],\r\n 'TemperaturaMediaFinal': object[key][i]['Temperatura Média Final'],\r\n 'TemperaturaSuperficieFinal': object[key][i]['Temperatura Superfície Final'],\r\n 'TemperaturaMeioFinal': object[key][i]['Temperatura Meio Final'],\r\n 'TemperaturaFundoFinal': object[key][i]['Temperatura Fundo Final']}\r\n })}\r\n }\r\n }\r\n\r\n function createToRecebimentoFisicoTanqueTanque(object, key) {\r\n if (Object.hasOwnProperty.call(object, key)) {\r\n for (var i = 0; i < object[key].length; i++) {\r\n importCargaEmMassa.objectsSelecteds.push(\r\n {\r\n \"RecebimentoProdutoRow\":{\r\n 'Codigo_Usuário': object[key][i]['Código Usuário (*)'],\r\n 'Produto': object[key][i]['Produto (*)'],\r\n 'Data_Inicial': concatDataHora(object[key][i]['Data Inicial (*)'], object[key][i]['Hora Inicial (*)'], (i+4)),\r\n 'Data_Final': concatDataHora(object[key][i]['Data Final (*)'], object[key][i]['Hora Final (*)'], (i+4)),\r\n 'MotoristaConcorda': object[key][i]['Motorista Concorda?'],\r\n 'RecebimentocomSkid': object[key][i]['Recebimento com SKID?'],\r\n 'Observacoes': object[key][i]['Observações'],\r\n 'NumerodoCompartimento': object[key][i]['Número do Compartimento (*)'], //inicio detalhe recebimento\r\n 'VolumeRecebido': object[key][i]['Volume Recebido (*)'],\r\n 'Densidade': object[key][i]['Densidade'],\r\n 'Temperatura': object[key][i]['Temperatura'],\r\n 'DensidadeBoletim': object[key][i]['Densidade (Boletim)'],\r\n 'TemperaturaMassa': object[key][i]['Temperatura (Massa)'],\r\n 'AspectoVisual': object[key][i]['Aspecto Visual'],\r\n 'PresencadeAgua': object[key][i]['Presença de Água'],\r\n 'SiglaTanque': object[key][i]['Sigla Tanque (*)'],//apuração tancagem\r\n 'AlturaInicialMM': object[key][i]['Altura Inicial MM'],\r\n 'AlturaFinalMM': object[key][i]['Altura Final MM'],\r\n 'QuantidadeInicial': object[key][i]['Quantidade Inicial'],\r\n 'QuantidadeFinal': object[key][i]['Quantidade Final'],\r\n 'QuantidadeInicial20C': object[key][i]['Quantidade Inicial 20°C'],\r\n 'QuantidadeFinal20C': object[key][i]['Quantidade Final 20°C'],\r\n 'DensidadeInicial': object[key][i]['Densidade Inicial'],\r\n 'DensidadeFinal': object[key][i]['Densidade Final'],\r\n 'TemperaturaMediaInicial': object[key][i]['Temperatura Média Inicial'],\r\n 'TemperaturaSuperficieInicial': object[key][i]['Temperatura Superfície Inicial'],\r\n 'TemperaturaMeioInicial': object[key][i]['Temperatura Meio Inicial'],\r\n 'TemperaturaFundoInicial': object[key][i]['Temperatura Fundo Inicial'],\r\n 'TemperaturaMediaFinal': object[key][i]['Temperatura Média Final'],\r\n 'TemperaturaSuperficieFinal': object[key][i]['Temperatura Superfície Final'],\r\n 'TemperaturaMeioFinal': object[key][i]['Temperatura Meio Final'],\r\n 'TemperaturaFundoFinal': object[key][i]['Temperatura Fundo Final']}\r\n })}\r\n }\r\n }\r\n\r\n //****EMPLEMENTAR AQUI TODOS OBJETOS DE RECEBIMENTO FISICO */\r\n\r\n //#endregion\r\n\r\n //#region HISTORICO DE OPERAÇÕES\r\n\r\n importCargaEmMassa.getHistorico = function () {\r\n var selectedValue = importCargaEmMassa.param.toString().replace(',', \"\");\r\n var selectedOperation = namesTemplates.filter(function (name) {\r\n return Object.keys(name) != null ? (selectedValue.length == 1 ? Object.keys(name)[0][0] : Object.keys(name)[0]) ==\r\n (selectedValue.length == 1 ? selectedValue[0] : selectedValue) : false;\r\n })\r\n .map(function (name) {\r\n return Object.values(name)[0]\r\n });;\r\n\r\n var alldados = Object.assign(operacaoDados(), { operacao: selectedOperation != null ? selectedOperation : []});\r\n importCargaEmMassa.disableHistorico = true;\r\n\r\n ImportService.getHistorico(alldados).then(function (response) {\r\n importCargaEmMassa.disableHistorico = false;\r\n modalHistorico.open({ historico: response });\r\n })\r\n .catch(function () {\r\n importCargaEmMassa.disableHistorico = false;\r\n });\r\n\r\n \r\n }\r\n\r\n //#endregion\r\n\r\n InicializaVariaveis();\r\n }\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ImportsController', ImportsController);\r\n\r\n ImportsController.$inject = [\r\n 'ImportService'\r\n ];\r\n\r\n function ImportsController(ImportService) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var imports = this;\r\n imports.title = 'master-data';\r\n var cadastros = [\r\n \"CAD_DIRETORIA\",\r\n \"CAD_COMPLEXO\",\r\n \"CAD_UNIDADE\",\r\n \"CAD_GERENCIA\",\r\n \"CAD_TURNO\",\r\n \"CAD_GRUPO_TURNO\",\r\n \"CAD_POSTO\",\r\n \"CAD_BLOCO_MEDIDOR\",\r\n \"CAD_PRODUTO_TIPO\",\r\n \"CAD_PRODUTO\",\r\n \"CAD_TANQUE_POSTO\",\r\n \"CAD_MARCA\",\r\n \"CAD_MODELO\",\r\n \"CAD_EQUIPAMENTO_TIPO\",\r\n \"CAD_TIPO_FISCAL\",\r\n \"CAD_GRI\",\r\n \"CAD_CENTRO_CUSTO\",\r\n \"CAD_ORDEM_ESTATISTICA\",\r\n \"CAD_ELEMENTO_PEP\",\r\n \"CAD_CENTRO_LUCRO\",\r\n \"CAD_EMPRESA_CLASSIFICACAO\",\r\n \"CAD_EMPRESA\",\r\n \"CAD_CONTRATO\",\r\n \"CAD_EQUIPAMENTO\",\r\n \"CAD_MOTORISTA\",\r\n \"CAD_CAMINHAO_TANQUE\",\r\n \"CAD_CAVALO_MECANICO\",\r\n \"CAD_VAGAO_TANQUE\",\r\n \"CAD_NIVEL_ANOMALIA\",\r\n \"CAD_ITEM_ANOMALIA\",\r\n \"CAD_GRUPO_ANOMALIA\",\r\n \"CAD_ASPECTO_VISUAL\",\r\n \"CAD_ARQUEACAO_TANQUE\",\r\n \"CAD_ARQUEACAO_TANQUE_MATRIZ\",\r\n \"CAD_ARQUEACAO_VAGAO\",\r\n \"CAD_ARQUEACAO_VAGAO_MATRIZ\"\r\n ];\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n //imports.cadastros = arguments;\r\n imports.cadastros = cadastros.map(function (table) {\r\n return {\r\n table: table,\r\n export: ImportService.export(table),\r\n import: ImportService.import(table)\r\n }\r\n });\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n imports.importAll = function () {\r\n ImportService.importAll(cadastros);\r\n };\r\n\r\n imports.exportAll = function () {\r\n ImportService.exportAll(cadastros);\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ImportsRegistroController', ImportsRegistroController);\r\n\r\n ImportsRegistroController.$inject = [\r\n 'ImportService'\r\n ];\r\n\r\n function ImportsRegistroController(ImportService) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var imports = this;\r\n imports.title = 'registros';\r\n var cadastros = [\r\n\r\n 'CAD_IMAGEM',\r\n 'CAD_USUARIO',\r\n 'CAD_DIRETORIA',\r\n 'CAD_COMPLEXO',\r\n 'CAD_UNIDADE',\r\n 'CAD_GERENCIA',\r\n 'CAD_TURNO',\r\n 'CAD_GRUPO_TURNO',\r\n 'REL_GRUPO_TURNO',\r\n 'CAD_POSTO',\r\n 'CAD_BLOCO_MEDIDOR',\r\n 'CAD_PRODUTO_CLASSE',\r\n 'CAD_PRODUTO_TIPO',\r\n 'CAD_PRODUTO',\r\n 'CAD_TANQUE_POSTO',\r\n 'REL_TANQUE_BLOCO_MEDIDOR',\r\n 'CAD_MARCA',\r\n 'CAD_MODELO',\r\n 'CAD_EQUIPAMENTO_TIPO',\r\n 'CAD_TIPO_FISCAL',\r\n 'CAD_GRI',\r\n 'CAD_CENTRO_CUSTO',\r\n 'CAD_ORDEM_ESTATISTICA',\r\n 'CAD_ELEMENTO_PEP',\r\n 'CAD_EMPRESA_CLASSIFICACAO',\r\n 'CAD_EMPRESA',\r\n 'CAD_CONTRATO',\r\n 'CAD_EQUIPAMENTO',\r\n 'CAD_TANQUE_EQUIPAMENTO',\r\n 'REL_TANQUE_EQUIPAMENTO_PRODUTO',\r\n 'CAD_MOTORISTA',\r\n 'CAD_CAMINHAO_TANQUE',\r\n 'CAD_CAMINHAO_COMPARTIMENTO',\r\n 'CAD_CAVALO_MECANICO',\r\n 'CAD_VAGAO_TANQUE',\r\n 'CAD_NIVEL_ANOMALIA',\r\n 'CAD_ITEM_ANOMALIA',\r\n 'REL_ITEM_NIVEL_ANOMALIA',\r\n 'CAD_GRUPO_ANOMALIA',\r\n 'REL_GRUPO_ITEM_ANOMALIA',\r\n 'CAD_ASPECTO_VISUAL',\r\n 'CAD_ARQUEACAO_TANQUE',\r\n 'CAD_ARQUEACAO_TANQUE_MATRIZ',\r\n 'CAD_ARQUEACAO_VAGAO',\r\n 'CAD_ARQUEACAO_VAGAO_MATRIZ',\r\n\r\n 'REG_TURNO',\r\n 'REG_TURNO_BLOCO_MEDIDOR',\r\n 'REG_TURNO_TANQUE_POSTO',\r\n 'REG_TURNO_FECHAMENTO',\r\n 'REG_RATEIO',\r\n 'REL_RATEIO_CENTRO_CUSTO',\r\n 'REG_CARGA_MASSA',\r\n 'REG_ABASTECIMENTO',\r\n 'REG_ABASTECIMENTO_TANQUE',\r\n 'REG_REC_CAMINHAO_TANQUE',\r\n 'REG_REC_CHEGADA_EXTERNA_CAMINHAO_TANQUE',\r\n 'REG_REC_COMPARTIMENTO_CAMINHAO_TANQUE',\r\n 'REG_REC_COMPLEMENTO_CAMINHAO_TANQUE',\r\n 'REG_REC_AMOSTRAGEM_CAMINHAO_TANQUE',\r\n 'REG_REC_BLOCO_MEDIDOR_CAMINHAO_TANQUE',\r\n 'REG_REC_TANQUE_POSTO_CAMINHAO_TANQUE',\r\n 'REG_MOVIMENTACAO_POSTO_MOVEL',\r\n 'REG_BLOCO_MEDIDOR_TROCA',\r\n 'REG_BLOCO_MEDIDOR_RESET',\r\n 'REG_BLOCO_MEDIDOR_AFERICAO',\r\n 'REG_BLOQUEIO_BLOCO_MEDIDOR',\r\n 'HST_TURNO',\r\n 'HST_TURNO_BLOCO_MEDIDOR',\r\n 'HST_TURNO_TANQUE_POSTO',\r\n 'HST_ABASTECIMENTO',\r\n 'HST_ABASTECIMENTO_TANQUE',\r\n 'HST_REC_CAMINHAO_TANQUE',\r\n 'HST_REC_CHEGADA_EXTERNA_CAMINHAO_TANQUE',\r\n 'HST_REC_COMPARTIMENTO_CAMINHAO_TANQUE',\r\n 'HST_REC_COMPLEMENTO_CAMINHAO_TANQUE',\r\n 'HST_REC_AMOSTRAGEM_CAMINHAO_TANQUE',\r\n 'HST_REC_BLOCO_MEDIDOR_CAMINHAO_TANQUE',\r\n 'HST_REC_TANQUE_POSTO_CAMINHAO_TANQUE',\r\n 'HST_MOVIMENTACAO_POSTO_MOVEL',\r\n 'HST_BLOCO_MEDIDOR_AFERICAO',\r\n 'HST_EQUIPAMENTO',\r\n 'HST_TANQUE_EQUIPAMENTO',\r\n 'HST_REL_TANQUE_EQUIPAMENTO_PRODUTO',\r\n 'HST_USUARIO',\r\n 'CTR_ENCERRANTE',\r\n 'CTR_HOR_HOD',\r\n 'REG_ANOMALIA'\r\n ];\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n //imports.cadastros = arguments;\r\n imports.cadastros = cadastros.map(function (table) {\r\n return {\r\n table: table,\r\n export: ImportService.exportStream([table]),\r\n import: ImportService.importStream([table])\r\n }\r\n });\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n imports.importAll = function () {\r\n ImportService.importAllStream(cadastros);\r\n };\r\n\r\n imports.exportAll = function () {\r\n ImportService.exportAllStream(cadastros);\r\n };\r\n\r\n imports.exportIdMap = function(){\r\n ImportService.exportStream([\"MAP_IDC_REMOTO_RECEBIMENTO\"])();\r\n }\r\n\r\n }\r\n\r\n})();","(function() {\r\n \"use strict\";\r\n\r\n angular\r\n .module(\"posto-facil\")\r\n .controller(\"integracaoTibcoController\", integracaoTibcoController);\r\n\r\n integracaoTibcoController.$inject = [\"$http\", \"MessageService\"];\r\n\r\n function integracaoTibcoController($http, MessageService) {\r\n var integracaoTibco = this;\r\n var serverUrl = \"../server/mobileServer/_ctrMessageTibco.ashx\";\r\n\r\n integracaoTibco.filtro = \"\";\r\n integracaoTibco.list = [];\r\n integracaoTibco.filas = [];\r\n integracaoTibco.fila = null;\r\n integracaoTibco.selected = null;\r\n integracaoTibco.isTelaConsulta = true;\r\n\r\n inicializar();\r\n\r\n function inicializar() {\r\n getFilas();\r\n }\r\n\r\n function getFilas() {\r\n return $http\r\n .get(serverUrl, {\r\n params: {\r\n action: \"getFilas\",\r\n type: \"generic\"\r\n }\r\n })\r\n .then(function(resposta) {\r\n integracaoTibco.filas = resposta.data;\r\n });\r\n }\r\n\r\n function getMessages(fila) {\r\n return $http\r\n .get(serverUrl, {\r\n params: {\r\n fila: fila\r\n }\r\n })\r\n .then(function(resposta) {\r\n resposta.data.forEach(function(item){\r\n item.Status = item.Status ? item.Status.trim().toUpperCase() : item.Status;\r\n });\r\n integracaoTibco.list = resposta.data;\r\n });\r\n }\r\n\r\n integracaoTibco.changeFila = function(fila) {\r\n return getMessages(fila);\r\n };\r\n\r\n integracaoTibco.editMessage = function(message) {\r\n integracaoTibco.selected = message;\r\n var msgObj = JSON.parse(integracaoTibco.selected.RequestMsg);\r\n integracaoTibco.selected.RequestMsg = JSON.stringify(msgObj, null, \" \");\r\n integracaoTibco.isTelaConsulta = false;\r\n };\r\n\r\n integracaoTibco.salvar = function() {\r\n var msgObj = JSON.parse(integracaoTibco.selected.RequestMsg);\r\n integracaoTibco.selected.RequestMsg = JSON.stringify(msgObj);\r\n\r\n return $http\r\n .put(serverUrl, integracaoTibco.selected)\r\n .then(function() {\r\n return MessageService.alert(\"sucesso\", \"Salvo com sucesso\");\r\n })\r\n .then(function() {\r\n integracaoTibco.isTelaConsulta = true;\r\n })\r\n .catch(function(e) {\r\n return MessageService.alert(\"erro\", JSON.stringify(e));\r\n });\r\n };\r\n\r\n integracaoTibco.atualizar = function(){\r\n return getMessages(integracaoTibco.fila);\r\n };\r\n\r\n integracaoTibco.cancelar = function() {\r\n integracaoTibco.isTelaConsulta = true;\r\n };\r\n }\r\n})();\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('MensagensController', MensagensController);\r\n MensagensController.$inject = [\r\n 'MessageService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function MensagensController(MessageService) {\r\n //Associa a instancia do controller em uma variável privada\r\n var mensagens = this;\r\n\r\n //Propriedades privadas\r\n\r\n //Propriedades públicas\r\n mensagens.MessageService = MessageService;\r\n\r\n //Métodos privados\r\n //Métodos publicos\r\n }\r\n\r\n})();","(function () {\r\n \"use strict\";\r\n\r\n angular\r\n .module(\"posto-facil\")\r\n .controller(\"ModalEnvioCargaController\", ModalEnvioCargaController);\r\n\r\n ModalEnvioCargaController.$inject = [\r\n \"CargaMassaModel\",\r\n \"AlertExceptionService\",\r\n '$uibModalInstance',\r\n 'TranslateService',\r\n 'ComplexoModel',\r\n 'UsuarioService',\r\n 'ModalService',\r\n 'cargaMassa'\r\n\r\n\r\n ];\r\n\r\n function ModalEnvioCargaController(\r\n CargaMassaModel,\r\n AlertExceptionService,\r\n $uibModalInstance,\r\n TranslateService,\r\n ComplexoModel,\r\n UsuarioService,\r\n ModalService,\r\n cargaMassa\r\n ) {\r\n var envioCarga = this;\r\n envioCarga.envio = {};\r\n\r\n function inicializar() {\r\n envioCarga.currentDate = new Date();\r\n if (cargaMassa.DthAgendado > new Date) {\r\n envioCarga.envio.TipoEnvio = cargaMassa.Agendado ? \"agendar\" : 'agora';\r\n envioCarga.envio.dthEnvio = cargaMassa.DthAgendado;\r\n\r\n }\r\n else {\r\n envioCarga.envio.TipoEnvio = 'agora';\r\n }\r\n\r\n }\r\n\r\n\r\n envioCarga.changeTipoEnvio = function () {\r\n\r\n }\r\n\r\n envioCarga.ok = function () {\r\n if (envioCarga.envio.TipoEnvio == \"agendar\"\r\n && (envioCarga.envio.dthEnvio < envioCarga.currentDate || envioCarga.envio.dthEnvio === undefined)) {\r\n return;\r\n }\r\n var payload = {\r\n operation: true,\r\n tipoEnvio: envioCarga.envio.TipoEnvio,\r\n dthEnvio: envioCarga.envio.dthEnvio\r\n }\r\n $uibModalInstance.close(payload);\r\n }\r\n\r\n envioCarga.cancel = function () {\r\n $uibModalInstance.close();\r\n }\r\n\r\n inicializar();\r\n\r\n\r\n }\r\n})();\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ModalFiltrosAssociacaoController', ModalFiltrosAssociacaoController);\r\n\r\n ModalFiltrosAssociacaoController.$inject = [\r\n 'SelTurnoService',\r\n '$uibModalInstance',\r\n 'ProdutoModel'\r\n ];\r\n\r\n function ModalFiltrosAssociacaoController(\r\n SelTurnoService,\r\n $uibModalInstance,\r\n ProdutoModel\r\n ) {\r\n\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var modalFiltrosAssociacao = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n modalFiltrosAssociacao.produtos = [];\r\n modalFiltrosAssociacao.filtro = {};\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n ProdutoModel.getAllByIdcPosto(SelTurnoService.getIdcPosto())\r\n .then(function (produtos) {\r\n modalFiltrosAssociacao.produtos = produtos;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n modalFiltrosAssociacao.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n modalFiltrosAssociacao.ok = function () {\r\n $uibModalInstance.close(modalFiltrosAssociacao.filtro);\r\n };\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ModalImportController', ModalImportController);\r\n\r\n ModalImportController.$inject = [\r\n '$uibModalInstance',\r\n '$q',\r\n 'FileReaderService'\r\n ];\r\n\r\n function ModalImportController(\r\n $uibModalInstance,\r\n $q,\r\n FileReaderService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var modalImport = this;\r\n var input = null;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n\r\n function convertToObjectArray(fileContents) {\r\n\r\n var retorno = {};\r\n\r\n for (var i in fileContents) {\r\n retorno[fileContents[i].name] = convertToObject(fileContents[i].content);\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function convertToObject(fileContent) {\r\n var lines = fileContent.split('\\n');\r\n var headers = lines[0].split(';')\r\n .map(function (header) { return header.trim() })\r\n .filter(function (header) { return !!header });\r\n var objArray = [];\r\n\r\n\r\n for (var i = 1; i < lines.length; i++) {\r\n var values = lines[i].split(';');\r\n\r\n if (values.length < headers.length) {\r\n continue;\r\n }\r\n\r\n var obj = {};\r\n var temp = null;\r\n\r\n for (var j = 0; j < headers.length; j++) {\r\n values[j] = values[j].trim();\r\n\r\n var arrTime = values[j].split('/');\r\n\r\n if (values[j] === \"null\") {\r\n temp = null;\r\n } else if (arrTime.length == 3) {\r\n if (!isNaN(Date.parse(values[j].split('/').reverse().join('-')))) {\r\n\r\n var arr = values[j].split('/');\r\n temp = new Date([arr[2], arr[1], arr[0]].join('-') + \" 23:59:59\");\r\n\r\n //temp = Date.parseLocal(values[j] + \"23:59:59\"); \r\n //} else if (!isNaN(Number(values[j]))) {\r\n // temp = Number(values[j]);\r\n }\r\n } else {\r\n temp = values[j];\r\n }\r\n obj[headers[j]] = temp;\r\n }\r\n objArray.push(obj);\r\n }\r\n\r\n return objArray\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n modalImport.inicializacao = function () {\r\n input = document.querySelector('#arquivoImportacao');\r\n }\r\n\r\n modalImport.ok = function () {\r\n\r\n $q.all(Array.from(input.files).map(FileReaderService.readAsText))\r\n .then(function (result) {\r\n result = convertToObjectArray(result);\r\n $uibModalInstance.close(result);\r\n });\r\n }\r\n\r\n modalImport.cancel = function () {\r\n $uibModalInstance.close(true);\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ModalImportStreamController', ModalImportStreamController);\r\n\r\n ModalImportStreamController.$inject = [\r\n '$uibModalInstance'\r\n ];\r\n\r\n function ModalImportStreamController(\r\n $uibModalInstance\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var modalImport = this;\r\n var input = null;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n modalImport.inicializacao = function () {\r\n input = document.querySelector('#arquivoImportacao');\r\n }\r\n\r\n modalImport.ok = function () {\r\n $uibModalInstance.close(input.files);\r\n }\r\n\r\n modalImport.cancel = function () {\r\n $uibModalInstance.close(true);\r\n }\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ModalJustificativaReaberturaController', ModalJustificativaReaberturaController);\r\n ModalJustificativaReaberturaController.$inject = [\r\n '$uibModalInstance',\r\n 'TranslateService',\r\n 'ValidacaoService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function ModalJustificativaReaberturaController(\r\n $uibModalInstance,\r\n TranslateService,\r\n validacao\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var justificativa = this;\r\n\r\n //Propriedades públicas\r\n justificativa.validacao = validacao;\r\n\r\n //Métodos privados\r\n\r\n function inicializar() {\r\n justificativa.MsgAtencao = TranslateService('turno-possuir-eventos-sap-responsabilidade-usuario');\r\n }\r\n\r\n //Métodos publicos\r\n justificativa.ok = function (form) {\r\n if (form.$valid) {\r\n $uibModalInstance.close(justificativa.justificativaReaberturaTurno);\r\n return justificativa.justificativaReaberturaTurno;\r\n }\r\n }\r\n\r\n justificativa.cancel = function () {\r\n $uibModalInstance.close(false);\r\n };\r\n\r\n inicializar();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ModalTurnoValidadoController', ModalTurnoValidadoController);\r\n\r\n ModalTurnoValidadoController.$inject = [\r\n 'SelTurnoService',\r\n '$uibModalInstance',\r\n 'locals',\r\n 'TurnoModel',\r\n 'TranslateService',\r\n 'TanquePostoModel',\r\n 'CtrEncerranteModel',\r\n 'MessageService'\r\n ];\r\n\r\n function ModalTurnoValidadoController(\r\n SelTurnoService,\r\n $uibModalInstance,\r\n locals,\r\n TurnoModel,\r\n TranslateService,\r\n TanquePostoModel,\r\n CtrEncerranteModel,\r\n MessageService\r\n ) {\r\n\r\n\r\n //Propriedades privadas\r\n var modalTurnoValidado = this;\r\n var TurnoSel = locals.turno;\r\n\r\n //Propriedades públicas\r\n modalTurnoValidado.SelTurnoService = SelTurnoService;\r\n modalTurnoValidado.regTurno = null;\r\n modalTurnoValidado.isEmAvaliacao = false;\r\n modalTurnoValidado.showFechamento = false;\r\n modalTurnoValidado.turno = TurnoSel;\r\n modalTurnoValidado.listaFechamento = null;\r\n\r\n //Inicialização\r\n function inicializacao() {\r\n onChangeTurno(TurnoSel);\r\n };\r\n\r\n //Métodos privados\r\n function onChangeTurno(regTurno) {\r\n if (!regTurno) return;\r\n TurnoModel.getComplete(regTurno).then(function (turnoCompleto) {\r\n modalTurnoValidado.regTurno = setValido(turnoCompleto);\r\n modalTurnoValidado.showTela = !!turnoCompleto;\r\n modalTurnoValidado.regTurno.SglPosto = regTurno.SglPosto;\r\n\r\n return TurnoModel.getFechamento(modalTurnoValidado.regTurno.IdcRegTurno, modalTurnoValidado.regTurno.IdcPosto);\r\n }).then(function (fechamento) {\r\n modalTurnoValidado.listaFechamento = formatFechamento(fechamento);\r\n }).then(function () {\r\n return TanquePostoModel.getByIdPosto(modalTurnoValidado.regTurno.IdcPosto);\r\n }).then(function (tanques) {\r\n modalTurnoValidado.regTurno.ListaRegTurnoTanquePostoDQO.forEach(function (tanqueDQO) {\r\n tanques.forEach(function (tanque) {\r\n if (tanque.IdcTanquePosto === tanqueDQO.IdcTanquePosto) {\r\n tanqueDQO.CadTanquePosto = tanque;\r\n tanqueDQO.AlturaInicialProxy = tanqueDQO.AltInicial;\r\n tanqueDQO.AlturaFinalProxy = tanqueDQO.AltFinal;\r\n }\r\n });\r\n });\r\n\r\n setFirstAndLastEncerrantes(regTurno);\r\n\r\n }).catch(function (error) {\r\n console.log(error);\r\n MessageService.alert(TranslateService('error-ocurred') + error.toString().replace(TranslateService('error') + ': ', ''));\r\n $state.go('home');\r\n });\r\n }\r\n\r\n function setFirstAndLastEncerrantes(regTurno) {\r\n modalTurnoValidado.regTurno.ListaRegTurnoBlocoMedidorDQO.forEach(function (bloco) {\r\n CtrEncerranteModel.getFirstAndLast(\r\n regTurno.DthInicial,\r\n regTurno.DthFinal,\r\n bloco.IdcBlocoMedidor\r\n ).then(function (resposta) {\r\n bloco.firstCounter = resposta.first && resposta.first.DthCtrEncerrante;\r\n bloco.lastCounter = resposta.last && resposta.last.DthCtrEncerrante;\r\n }).catch(function (error) {\r\n console.log(error);\r\n\r\n var message = error && error.data ? error.data.Message : error;\r\n\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('error-ocurred') + message\r\n );\r\n $state.go('home');\r\n });\r\n });\r\n }\r\n\r\n function formatFechamento(lista) {\r\n var retorno = {};\r\n angular.forEach(lista, function (item) {\r\n retorno[item.DscProduto] = retorno[item.DscProduto] || [];\r\n retorno[item.DscProduto].push(item);\r\n });\r\n return retorno;\r\n }\r\n\r\n function setValido(regTurno) {\r\n if (!regTurno) return;\r\n if (regTurno.StuTurno !== 'AB') return regTurno;\r\n setValidoLista(regTurno.ListaRegTurnoTanquePostoDQO);\r\n setValidoLista(regTurno.ListaRegTurnoBlocoMedidorDQO);\r\n return regTurno;\r\n }\r\n\r\n function setValidoLista(lista) {\r\n lista.forEach(function (item) {\r\n item.valido = true;\r\n });\r\n }\r\n\r\n // Métodos publicos\r\n\r\n modalTurnoValidado.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n modalTurnoValidado.ok = function () {\r\n $uibModalInstance.close();\r\n };\r\n\r\n inicializacao();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('MotoristaController', MotoristaController);\r\n\r\n MotoristaController.$inject = [\r\n 'ValidacaoService',\r\n 'MotoristaModel',\r\n 'Constant',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function MotoristaController(\r\n ValidacaoService,\r\n MotoristaModel,\r\n Constant,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var cadMotorista = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n cadMotorista.filtro = '';\r\n cadMotorista.listacadMotorista = null;\r\n cadMotorista.listDiretorias = null;\r\n cadMotorista.listStatus = Constant.INDICADORES_ATIVO;\r\n cadMotorista.selected = null;\r\n cadMotorista.isTelaConsuta = true;\r\n cadMotorista.validacao = ValidacaoService;\r\n cadMotorista.datepickerOpened = false;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializar() {\r\n getMotoristas();\r\n \r\n }\r\n\r\n function getMotoristas() {\r\n return MotoristaModel.getAll()\r\n .then(function (resposta) {\r\n cadMotorista.listacadMotorista = resposta;\r\n });\r\n }\r\n\r\n \r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n cadMotorista.click = function (item) {\r\n cadMotorista.selected = item;\r\n cadMotorista.isTelaConsuta = false;\r\n }\r\n\r\n cadMotorista.atualizar = function () {\r\n getMotoristas();\r\n }\r\n\r\n cadMotorista.novo = function () {\r\n cadMotorista.isTelaConsuta = false;\r\n cadMotorista.selected = {};\r\n }\r\n\r\n cadMotorista.salvar = function (formcadMotorista) {\r\n MotoristaModel.save(cadMotorista.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadMotorista);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadMotorista.isTelaConsuta = true;\r\n getMotoristas();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n\r\n }\r\n\r\n cadMotorista.cancelar = function (formcadMotorista) {\r\n cadMotorista.isTelaConsuta = true;\r\n getMotoristas();\r\n cadMotorista.selected = null;\r\n }\r\n\r\n cadMotorista.excluir = function (formcadMotorista) {\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n MotoristaModel.excluir(cadMotorista.selected.IdcMotorista)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadMotorista);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadMotorista.isTelaConsuta = true;\r\n getMotoristas();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('NavbarController', NavbarController);\r\n NavbarController.$inject = [\r\n 'UsuarioService',\r\n 'MenusService',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function NavbarController(\r\n UsuarioService,\r\n MenusService,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var nav = this;\r\n\r\n //Propriedades privadas\r\n\r\n //Propriedades públicas\r\n nav.usuario = UsuarioService;\r\n nav.listMenus = MenusService;\r\n\r\n //Métodos privados\r\n //Métodos publicos\r\n\r\n nav.logout = function () {\r\n sessionStorage.setItem('actionState', 'logout');\r\n window.location.href = '..';\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('NavioCompartimentoController', NavioCompartimentoController);\r\n NavioCompartimentoController.$inject = [\r\n '$uibModalInstance',\r\n 'regCompartimento',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'ValidacaoService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function NavioCompartimentoController(\r\n $uibModalInstance,\r\n regCompartimento,\r\n MessageService,\r\n TranslateService,\r\n ValidacaoService\r\n \r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var caCompartimento = this;\r\n\r\n //Propriedades privadas\r\n\r\n\r\n //Propriedades públicas\r\n \r\n caCompartimento.regCompartimento = regCompartimento;\r\n caCompartimento.VolAtual = regCompartimento.ValCapacidadeNominal;\r\n caCompartimento.IdcNavioCompartimento = regCompartimento.IdcNavioCompartimento; \r\n caCompartimento.validacao = ValidacaoService;\r\n\r\n //Métodos privados\r\n \r\n\r\n //Métodos publicos\r\n\r\n caCompartimento.salvar = function (formcaCompartimento) {\r\n \r\n if(formcaCompartimento.$valid)\r\n {\r\n caCompartimento.regCompartimento.ValCapacidadeNominal = caCompartimento.VolAtual;\r\n ValidacaoService.resetForm(formcaCompartimento);\r\n $uibModalInstance.close(caCompartimento.regCompartimento);\r\n } else {\r\n MessageService.alert(TranslateService('error'), TranslateService('invalid-data'));\r\n }\r\n }\r\n\r\n caCompartimento.cancel = function (formcaCompartimento) {\r\n $uibModalInstance.close(true);\r\n caCompartimento.validacao.resetForm(formcaCompartimento);\r\n }; \r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('NavioTanqueController', NavioTanqueController);\r\n\r\n NavioTanqueController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'ModalService',\r\n 'NavioTanqueModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function NavioTanqueController(\r\n ValidacaoService,\r\n Constant,\r\n ModalService,\r\n NavioTanqueModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadNavioTanque = this;\r\n\r\n var modalCompartimento = new ModalService({\r\n templateUrl: 'navioCompartimento.html',\r\n controller: 'NavioCompartimentoController',\r\n controllerAs: 'caCompartimento'\r\n });\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadNavioTanque.filtro = '';\r\n cadNavioTanque.listaNavio = null; \r\n cadNavioTanque.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadNavioTanque.selected = null;\r\n cadNavioTanque.isTelaConsuta = true;\r\n cadNavioTanque.validacao = ValidacaoService;\r\n cadNavioTanque.popupDataInicial = { opened: false };\r\n cadNavioTanque.regCompartimentoSelected = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadNavioTanque.isTelaConsuta = true;\r\n getNavioTanque(); \r\n }\r\n\r\n function getNavioTanque() {\r\n NavioTanqueModel.getAll()\r\n .then(function (resposta) {\r\n cadNavioTanque.listaNavio = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadNavioTanque.click = function (item) {\r\n cadNavioTanque.selected = item;\r\n cadNavioTanque.isTelaConsuta = false;\r\n };\r\n\r\n cadNavioTanque.compartimentoClick = function (regCompartimento) {\r\n cadNavioTanque.regCompartimentoSelected = regCompartimento;\r\n cadNavioTanque.editarCompartimento(regCompartimento);\r\n };\r\n\r\n cadNavioTanque.adicionarCompartimento = function(){\r\n cadNavioTanque.editarCompartimento({})\r\n .then(function(resposta){\r\n resposta.DthCriacaoReg = new Date();\r\n resposta.IdcNavioTanque = cadNavioTanque.selected.IdcNavioTanque;\r\n cadNavioTanque.selected.ListCadNavioCompartimento.push(resposta);\r\n });\r\n };\r\n\r\n cadNavioTanque.editarCompartimento = function (regCompartimento) {\r\n return modalCompartimento.open({ regCompartimento: regCompartimento });\r\n };\r\n\r\n\r\n cadNavioTanque.atualizar = function () {\r\n getNavioTanque();\r\n }; \r\n\r\n cadNavioTanque.novo = function (formcadNavioTanque) {\r\n cadNavioTanque.isTelaConsuta = false;\r\n cadNavioTanque.selected = {\r\n ListCadNavioCompartimento: []\r\n };\r\n ValidacaoService.resetForm(formcadNavioTanque);\r\n };\r\n\r\n cadNavioTanque.salvar = function (formcadNavioTanque) {\r\n\r\n if (formcadNavioTanque.$valid) {\r\n NavioTanqueModel.save(cadNavioTanque.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadNavioTanque);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadNavioTanque.isTelaConsuta = true;\r\n getNavioTanque();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + TranslateService('erro-capacidade-tanque'));\r\n });\r\n }\r\n };\r\n\r\n cadNavioTanque.cancel = function (formcadNavioTanque) {\r\n $uibModalInstance.close(true);\r\n };\r\n\r\n \r\n cadNavioTanque.cancelar = function (formcadNavioTanque) {\r\n cadNavioTanque.isTelaConsuta = true;\r\n getNavioTanque();\r\n cadNavioTanque.selected = null;\r\n };\r\n\r\n cadNavioTanque.excluirCompleto = function (formcadNavioTanque) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n NavioTanqueModel.excluir(cadNavioTanque.selected.IdcNavioTanque)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadNavioTanque);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadNavioTanque.isTelaConsuta = true;\r\n getNavioTanque();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('navio-erro-excluir'));\r\n });\r\n });\r\n };\r\n\r\n cadNavioTanque.openDataInicial = function () {\r\n cadNavioTanque.popupDataInicial.opened = true;\r\n };\r\n\r\n cadNavioTanque.excluir = function ($event, regCompartimento) {\r\n $event.stopPropagation();\r\n var index = cadNavioTanque.selected.ListCadNavioCompartimento.indexOf(regCompartimento);\r\n cadNavioTanque.selected.ListCadNavioCompartimento.splice(index, 1);\r\n };\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('NivelAnomaliaController', NivelAnomaliaController);\r\n\r\n NivelAnomaliaController.$inject = [\r\n 'ValidacaoService',\r\n 'NivelAnomaliaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function NivelAnomaliaController(\r\n ValidacaoService,\r\n NivelAnomaliaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadNivelAnomalia = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadNivelAnomalia.filtro = '';\r\n cadNivelAnomalia.listaNivel = null;\r\n cadNivelAnomalia.selected = null;\r\n cadNivelAnomalia.isTelaConsuta = true;\r\n cadNivelAnomalia.validacao = ValidacaoService;\r\n \r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n getNivelAnomalia()\r\n }\r\n\r\n function getNivelAnomalia() {\r\n NivelAnomaliaModel.getAll()\r\n .then(function (resposta) {\r\n cadNivelAnomalia.listaNivel = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadNivelAnomalia.click = function (item) {\r\n cadNivelAnomalia.selected = item;\r\n cadNivelAnomalia.isTelaConsuta = false;\r\n \r\n\r\n }\r\n\r\n cadNivelAnomalia.atualizar = function () {\r\n getNivelAnomalia();\r\n }\r\n\r\n cadNivelAnomalia.novo = function () {\r\n cadNivelAnomalia.isTelaConsuta = false;\r\n cadNivelAnomalia.selected = {};\r\n ValidacaoService.resetForm(formcadNivelAnomalia);\r\n }\r\n\r\n cadNivelAnomalia.salvar = function (formcadNivelAnomalia) {\r\n \r\n if(formcadNivelAnomalia.$valid)\r\n {\r\n NivelAnomaliaModel.save(cadNivelAnomalia.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadNivelAnomalia);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadNivelAnomalia.isTelaConsuta = true;\r\n getNivelAnomalia();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadNivelAnomalia.cancelar = function (formcadNivelAnomalia) {\r\n cadNivelAnomalia.isTelaConsuta = true;\r\n getNivelAnomalia();\r\n cadNivelAnomalia.selected = null;\r\n }\r\n\r\n cadNivelAnomalia.excluir = function (formcadNivelAnomalia) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n NivelAnomaliaModel.excluir(cadNivelAnomalia.selected.IdcNivel)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadNivelAnomalia);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadNivelAnomalia.isTelaConsuta = true;\r\n getNivelAnomalia();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('OrdemEstatisticaController', OrdemEstatisticaController);\r\n\r\n OrdemEstatisticaController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'OrdemEstatisticaModel',\r\n 'GerenciaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function OrdemEstatisticaController(\r\n ValidacaoService,\r\n Constant,\r\n OrdemEstatisticaModel,\r\n GerenciaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadOrdemEstatistica = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadOrdemEstatistica.filtro = '';\r\n cadOrdemEstatistica.listaElemento = null;\r\n cadOrdemEstatistica.listaGerencia = null;\r\n \r\n cadOrdemEstatistica.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadOrdemEstatistica.selected = null;\r\n cadOrdemEstatistica.isTelaConsuta = true;\r\n cadOrdemEstatistica.validacao = ValidacaoService;\r\n cadOrdemEstatistica.IdcOrdemEstatistica = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n \r\n cadOrdemEstatistica.isTelaConsuta = true\r\n getOrdemEstatistica();\r\n getGerencia();\r\n\r\n \r\n }\r\n\r\n function getOrdemEstatistica() {\r\n OrdemEstatisticaModel.getAll()\r\n .then(function (resposta) {\r\n cadOrdemEstatistica.listaElemento = resposta;\r\n ;\r\n });\r\n }\r\n\r\n function getGerencia() {\r\n GerenciaModel.getAll()\r\n .then(function (resposta) {\r\n cadOrdemEstatistica.listaGerencia = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadOrdemEstatistica.click = function (item) {\r\n cadOrdemEstatistica.selected = item;\r\n cadOrdemEstatistica.IdcOrdemEstatistica = item.IdcOrdemEstatistica;\r\n cadOrdemEstatistica.isTelaConsuta = false;\r\n \r\n }\r\n\r\n\r\n cadOrdemEstatistica.atualizar = function () {\r\n getOrdemEstatistica();\r\n }\r\n\r\n cadOrdemEstatistica.novo = function (formcadOrdemEstatistica) {\r\n cadOrdemEstatistica.isTelaConsuta = false;\r\n cadOrdemEstatistica.selected = {};\r\n ValidacaoService.resetForm(formcadOrdemEstatistica);\r\n }\r\n\r\n cadOrdemEstatistica.salvar = function (formcadOrdemEstatistica) {\r\n \r\n if(formcadOrdemEstatistica.$valid)\r\n {\r\n OrdemEstatisticaModel.save(cadOrdemEstatistica.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadOrdemEstatistica);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadOrdemEstatistica.isTelaConsuta = true;\r\n getOrdemEstatistica();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadOrdemEstatistica.cancelar = function (formcadOrdemEstatistica) {\r\n cadOrdemEstatistica.isTelaConsuta = true;\r\n getOrdemEstatistica();\r\n cadOrdemEstatistica.selected = null;\r\n cadOrdemEstatistica.IdcOrdemEstatistica = null;\r\n }\r\n\r\n cadOrdemEstatistica.excluir = function (formcadOrdemEstatistica) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n OrdemEstatisticaModel.excluir(cadOrdemEstatistica.IdcOrdemEstatistica)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadOrdemEstatistica);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadOrdemEstatistica.isTelaConsuta = true;\r\n getOrdemEstatistica();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('PainelDeEstoqueController', PainelDeEstoqueController);\r\n PainelDeEstoqueController.$inject = [\r\n 'MessageService',\r\n 'TranslateService',\r\n 'ValidacaoService',\r\n 'DiretoriaModel',\r\n 'ComplexoModel',\r\n 'UnidadeModel',\r\n 'PostoModel',\r\n 'ProdutoModel',\r\n 'PainelDeEstoqueModel',\r\n 'CheckPainelEstoque',\r\n '$scope'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function PainelDeEstoqueController(\r\n MessageService,\r\n TranslateService,\r\n ValidacaoService,\r\n DiretoriaModel,\r\n ComplexoModel,\r\n UnidadeModel,\r\n PostoModel,\r\n ProdutoModel,\r\n PainelDeEstoqueModel,\r\n CheckPainelEstoque,\r\n $scope\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var painelDeEstoque = this;\r\n\r\n //Propriedades privadas\r\n \r\n\r\n\r\n //Propriedades públicas\r\n \r\n painelDeEstoque.validacao = ValidacaoService;\r\n //Métodos privados\r\n \r\n\r\n function InicializaVariaveis() {\r\n // Propriedades públicas\r\n painelDeEstoque.selected = null;\r\n painelDeEstoque.listaDiretoria = [];\r\n painelDeEstoque.listaComplexo = [];\r\n painelDeEstoque.listaUnidade = [];\r\n painelDeEstoque.listaPosto = [];\r\n painelDeEstoque.listaProduto = [];\r\n painelDeEstoque.diretoriaSelected = null;\r\n painelDeEstoque.complexoSelected = null;\r\n painelDeEstoque.unidadeSelected = null;\r\n painelDeEstoque.PostoSelected = null;\r\n painelDeEstoque.ProdutoSelected = null;\r\n painelDeEstoque.DthAtual = new Date();\r\n painelDeEstoque.getDiretorias();\r\n }\r\n\r\n painelDeEstoque.getProdutos = function (item) {\r\n if (item.length)\r\n ProdutoModel.getAllByIdcPosto(item[0].IdcPosto, true)\r\n .then(function (resposta) {\r\n painelDeEstoque.listaProduto = resposta.sort(function (a, b) {\r\n return a.DscProduto < b.DscProduto ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n painelDeEstoque.getPostos = function (item) {\r\n if (item.length)\r\n PostoModel.getAllSameUnidade(item[0].IdcUnidade)\r\n .then(function (resposta) {\r\n resposta = resposta.filter(function (posto) {\r\n return posto.TipPosto != \"M\";\r\n })\r\n painelDeEstoque.listaPosto = resposta.filter(function (posto) {\r\n return posto.StuPosto != \"N\";\r\n }).sort(function (a, b) {\r\n return a.DscPosto < b.DscPosto ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n painelDeEstoque.getUnidades = function (item) {\r\n if (item.length)\r\n UnidadeModel.getAllSameComplexo(item[0].SglComplexo)\r\n .then(function (resposta) {\r\n painelDeEstoque.listaUnidade = resposta.filter(function (unidade) {\r\n return unidade.StuUnidade != \"N\";\r\n }).sort(function (a, b) {\r\n return a.DscUnidade < b.DscUnidade ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n painelDeEstoque.getComplexos = function (item) {\r\n if (item.length)\r\n ComplexoModel.getBySgl(item[0].SglDiretoria)\r\n .then(function (resposta) {\r\n painelDeEstoque.listaComplexo = resposta.filter(function (complexo) {\r\n return complexo.StuComplexo != \"N\";\r\n }).sort(function (a, b) {\r\n return a.DscComplexo < b.DscComplexo ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n painelDeEstoque.getDiretorias = function () {\r\n DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n painelDeEstoque.listaDiretoria = resposta.filter(function (diretoria) {\r\n return diretoria.StuDiretoria != \"N\";\r\n }).sort(function (a, b) {\r\n return a.DscDiretoria < b.DscDiretoria ? -1 : 1;\r\n });\r\n \r\n });\r\n }\r\n\r\n painelDeEstoque.changeDiretoria = function () {\r\n painelDeEstoque.complexoSelected = null;\r\n painelDeEstoque.unidadeSelected = null;\r\n painelDeEstoque.PostoSelected = null;\r\n painelDeEstoque.ProdutoSelected = null;\r\n painelDeEstoque.listaComplexo = [];\r\n painelDeEstoque.listaUnidade = [];\r\n painelDeEstoque.listaPosto = [];\r\n painelDeEstoque.listaProduto = [];\r\n painelDeEstoque.getComplexos(\r\n painelDeEstoque.listaDiretoria.filter(function (diretoria) {\r\n return diretoria.IdcDiretoria == painelDeEstoque.selected.diretoriaSelected ? diretoria.SglDiretoria : null;\r\n })\r\n );\r\n }\r\n painelDeEstoque.changeComplexo = function () {\r\n painelDeEstoque.unidadeSelected = null;\r\n painelDeEstoque.PostoSelected = null;\r\n painelDeEstoque.ProdutoSelected = null;\r\n painelDeEstoque.listaUnidade = [];\r\n painelDeEstoque.listaPosto = [];\r\n painelDeEstoque.listaProduto = [];\r\n painelDeEstoque.getUnidades(\r\n painelDeEstoque.listaComplexo.filter(function (complexo) {\r\n return complexo.IdcComplexo == painelDeEstoque.selected.complexoSelected ? complexo.SglComplexo : null;\r\n })\r\n );\r\n }\r\n\r\n painelDeEstoque.changeUnidade = function () {\r\n painelDeEstoque.PostoSelected = null;\r\n painelDeEstoque.ProdutoSelected = null;\r\n painelDeEstoque.listaPosto = [];\r\n painelDeEstoque.listaProduto = [];\r\n painelDeEstoque.getPostos(\r\n painelDeEstoque.listaUnidade.filter(function (unidade) {\r\n return unidade.IdcUnidade == painelDeEstoque.selected.unidadeSelected ? unidade.SglUnidade : null;\r\n })\r\n );\r\n }\r\n\r\n painelDeEstoque.changePosto = function () {\r\n painelDeEstoque.selected.ProdutoSelected = null;\r\n painelDeEstoque.getProdutos(\r\n painelDeEstoque.listaPosto.filter(function (posto) {\r\n return posto.IdcPosto == painelDeEstoque.selected.PostoSelected ? posto.SglPosto : null;\r\n })\r\n );\r\n }\r\n\r\n painelDeEstoque.changeProduto = function () {\r\n PainelDeEstoqueModel.getLitragens(painelDeEstoque.selected.PostoSelected, painelDeEstoque.selected.ProdutoSelected)\r\n .then(function (resposta) {\r\n if (resposta) {\r\n var dados = resposta[0];\r\n painelDeEstoque.selected.currentVolume = dados.VolumeAtual;\r\n painelDeEstoque.selected.currentVolumeWheels = dados.VolumeSobreRodas;\r\n painelDeEstoque.selected.currentvolumeTraffic = dados.VolumeEmTransito;\r\n painelDeEstoque.selected.dailyIntake = dados.ConsumoPorDia;\r\n painelDeEstoque.selected.IdcRegTurno = dados.IdcRegTurno;\r\n\r\n console.log(resposta)\r\n } else {\r\n throw new Error(TranslateService('saving-failed'));\r\n }\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), erro);\r\n });\r\n }\r\n\r\n painelDeEstoque.salvar = function () {\r\n if ($scope.formpainelDeEstoque.$valid)\r\n {\r\n CheckPainelEstoque(painelDeEstoque.selected)\r\n .then(function () {\r\n painelDeEstoque.salvarServidor();\r\n });\r\n } else {\r\n MessageService.alert(TranslateService('error'), TranslateService('invalid-data'));\r\n }\r\n }\r\n\r\n painelDeEstoque.salvarServidor = function () {\r\n PainelDeEstoqueModel.salvaInputPainelEstoque(criaNovoInput(painelDeEstoque.selected))\r\n .then(function (resposta) {\r\n if (resposta) {\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\");\r\n resetFields();\r\n } else {\r\n throw new Error(TranslateService('saving-failed'));\r\n }\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), erro);\r\n });\r\n };\r\n\r\n painelDeEstoque.cancel = function () {\r\n painelDeEstoque.validacao.resetForm($scope.formpainelDeEstoque);\r\n }; \r\n function resetFields() {\r\n painelDeEstoque.selected = null;\r\n painelDeEstoque.diretoriaSelected = null;\r\n painelDeEstoque.complexoSelected = null;\r\n painelDeEstoque.unidadeSelected = null;\r\n painelDeEstoque.PostoSelected = null;\r\n painelDeEstoque.ProdutoSelected = null;\r\n painelDeEstoque.DthAtual = new Date();\r\n ValidacaoService.resetForm($scope.formpainelDeEstoque);\r\n }\r\n \r\n function criaNovoInput(selected) {\r\n return {\r\n \"IdcInputPainelEstoque\": 0,\r\n \"IdcUsuario\": 0,\r\n \"IdcRegTurno\": selected.IdcRegTurno,\r\n \"IdcDiretoria\": selected.diretoriaSelected,\r\n \"IdcComplexo\": selected.complexoSelected,\r\n \"IdcUnidade\": selected.unidadeSelected,\r\n \"IdcPosto\": selected.PostoSelected,\r\n \"IdcProduto\": selected.ProdutoSelected,\r\n \"VolumeAtual\": selected.currentVolume,\r\n \"VolumeSobreRodas\": selected.currentVolumeWheels,\r\n \"VolumeEmTransito\": selected.currentvolumeTraffic,\r\n \"ConsumoPorDia\": selected.dailyIntake,\r\n \"DthMedicao\": selected.DthMedicao,\r\n \"DthCriacaoReg\": new Date(),\r\n \"NomDispositivo\": 'WEB-MOBILE'\r\n };\r\n }\r\n\r\n\r\n InicializaVariaveis();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('PerfilModalController', PerfilModalController);\r\n\r\n PerfilModalController.$inject = [\r\n 'perfil',\r\n '$uibModalInstance'\r\n ];\r\n\r\n function PerfilModalController(\r\n perfil,\r\n $uibModalInstance\r\n ) {\r\n var perfilModal = this;\r\n\r\n var original = perfil;\r\n\r\n perfilModal.perfil = perfil;\r\n perfilModal.Status = perfilModal.perfil.Status == 'S' ? true : false\r\n\r\n\r\n perfilModal.ok = function () {\r\n perfilModal.perfil.Status = perfilModal.Status ? 'S' : 'N'\r\n $uibModalInstance.close(perfilModal.perfil);\r\n }\r\n\r\n perfilModal.cancel = function () {\r\n retorePreviousEditableValues();\r\n $uibModalInstance.close(true);\r\n }\r\n\r\n perfilModal.teste = function () {\r\n console.log(perfilModal.perfil.Status)\r\n }\r\n\r\n function retorePreviousEditableValues() {\r\n perfilModal.perfil = original;\r\n }\r\n\r\n }\r\n\r\n }) ();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('PerfisController', PerfisController);\r\n\r\n PerfisController.$inject = [\r\n 'PerfilModel',\r\n 'TransacaoModel',\r\n '$filter',\r\n 'MessageService',\r\n 'UsuarioService'\r\n ];\r\n\r\n function PerfisController(\r\n PerfilModel,\r\n TransacaoModel,\r\n $filter,\r\n MessageService,\r\n UsuarioService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var perfis = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n perfis.filtro = \"\";\r\n perfis.filtroTransacoes = \"\";\r\n perfis.ListaPerfis = [];\r\n perfis.ListTransacaoPerfil = [];\r\n perfis.selected = null;\r\n perfis.selectedTransacao = null;\r\n perfis.selectedTransacaoPerfil = null;\r\n perfis.isTelaConsuta = true;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializar() {\r\n getPerfis();\r\n getTransacoes();\r\n }\r\n\r\n function getPerfis() {\r\n return PerfilModel.getAll()\r\n .then(function (resposta) {\r\n perfis.ListaPerfis = resposta;\r\n });\r\n }\r\n\r\n function getTransacoes() {\r\n return TransacaoModel.getAll()\r\n .then(function (resposta) {\r\n perfis.ListTransacaoPerfil = resposta;\r\n });\r\n }\r\n\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n perfis.click = function (p) {\r\n\r\n PerfilModel.getById(p.IdentificadorPerfil)\r\n .then(function (perfilArray) {\r\n perfis.selected = perfilArray.length ? perfilArray[0] : p;\r\n perfis.isTelaConsuta = false;\r\n });\r\n\r\n };\r\n\r\n perfis.clickTransacoes = function (t) {\r\n perfis.selectedTransacao = t;\r\n };\r\n\r\n perfis.clickTransacoesPerfil = function (tp) {\r\n perfis.selectedTransacaoPerfil = tp;\r\n }\r\n\r\n perfis.atualizar = function () {\r\n getPerfis();\r\n }\r\n\r\n perfis.voltar = function () {\r\n perfis.isTelaConsuta = true;\r\n getPerfis();\r\n }\r\n\r\n perfis.adicionar = function () {\r\n if (!perfis.selectedTransacao) {\r\n return MessageService.alert(angular.element(document).scope().trans('necess-sel-trans-disp-adicionar'));\r\n }\r\n\r\n if (!perfis.selected.ListTransacaoPerfil.find(function (t) {\r\n return t.IdentificadorTransacao === perfis.selectedTransacao.IdentificadorTransacao\r\n })) {\r\n perfis.selected.ListTransacaoPerfil.push({\r\n \"IdentificadorTransacao\": perfis.selectedTransacao.IdentificadorTransacao,\r\n \"IdentificadorPerfil\": perfis.selected.IdentificadorPerfil,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"Transacao\": perfis.selectedTransacao\r\n });\r\n\r\n perfis.selectedTransacao = null;\r\n }\r\n\r\n }\r\n\r\n perfis.remover = function () {\r\n if (!perfis.selectedTransacaoPerfil) {\r\n return MessageService.alert(angular.element(document).scope().trans('necess-sel-trans-vinc-remover'));\r\n }\r\n\r\n var index = perfis.selected.ListTransacaoPerfil.indexOf(perfis.selectedTransacaoPerfil);\r\n perfis.selected.ListTransacaoPerfil.splice(index, 1);\r\n perfis.selectedTransacaoPerfil = null;\r\n }\r\n\r\n perfis.getAvailableTransactions = function () {\r\n if (!perfis.selected) {\r\n return [];\r\n }\r\n\r\n return $filter('filter')(perfis.ListTransacaoPerfil, function (t) {\r\n return !perfis.selected.ListTransacaoPerfil.some(function (tp) {\r\n return tp.IdentificadorTransacao === t.IdentificadorTransacao;\r\n })\r\n });\r\n }\r\n\r\n perfis.salvar = function () {\r\n PerfilModel.save(perfis.selected)\r\n .then(function () {\r\n MessageService.alert(angular.element(document).scope().trans('success'), angular.element(document).scope().trans('registro-salvo-sucesso'));\r\n })\r\n .catch(function (erro) {\r\n if (erro && erro.data && erro.data.Message) erro = erro.data.Message;\r\n MessageService.alert(angular.element(document).scope().trans('error'), angular.element(document).scope().trans('ocorreu-erro-salvar') + ' ' + erro);\r\n });\r\n }\r\n\r\n perfis.novo = function () {\r\n perfis.click({\r\n Codigo: \"\",\r\n DataHoraUTCCriacao: new Date(),\r\n DataHoraUTCUltimaAtualizacao: new Date(),\r\n IdentificadorPerfil: 0,\r\n IdentificadorUsuarioCriacao: UsuarioService.indice,\r\n IdentificadorUsuarioUltimaAtualizacao: UsuarioService.indice,\r\n ListTransacaoPerfil: []\r\n });\r\n }\r\n\r\n inicializar();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('PostoController', PostoController);\r\n\r\n PostoController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'UsuarioService',\r\n 'PostoModel',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'SpinnerService',\r\n 'CentroCustoModel',\r\n 'ElementoPepModel',\r\n 'OrdemEstatisticaModel',\r\n 'GerenciaModel'\r\n ];\r\n\r\n function PostoController(\r\n ValidacaoService,\r\n Constant,\r\n UsuarioService,\r\n PostoModel,\r\n MessageService,\r\n TranslateService,\r\n SpinnerService,\r\n CentroCustoModel,\r\n ElementoPepModel,\r\n OrdemEstatisticaModel,\r\n GerenciaModel\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadPosto = this;\r\n cadPosto.lista = [];\r\n cadPosto.filtro = \"\";\r\n cadPosto.isTelaConsuta = true;\r\n cadPosto.selected = {};\r\n cadPosto.listaDiretoria = [];\r\n cadPosto.complexo = null;\r\n cadPosto.diretoria = null;\r\n cadPosto.unidade = null;\r\n cadPosto.listaComplexo = [];\r\n cadPosto.listaUnidade = [];\r\n cadPosto.turnos = [];\r\n cadPosto.tipoFonte = Constant.FONTES_PAGADORAS;\r\n cadPosto.searchTermFontePagadoraCodigo = \"\";\r\n cadPosto.validacao = ValidacaoService;\r\n cadPosto.listaCentroCusto = [];\r\n cadPosto.listaElementoPep = [];\r\n cadPosto.listaOrdemEstatistica = [];\r\n var sppiner = new SpinnerService();\r\n cadPosto.searchTermTurno = \"\";\r\n cadPosto.selectedTurno = null;\r\n cadPosto.individualFilter = {};\r\n\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n\r\n getPosto();\r\n getTurnos();\r\n }\r\n\r\n\r\n cadPosto.atualizar = function () {\r\n getPosto();\r\n }\r\n\r\n cadPosto.novo = function () {\r\n cadPosto.selected = {};\r\n cadPosto.selected.TipPosto = \"P\"\r\n cadPosto.isTelaConsuta = false;\r\n getDiretorias();\r\n }\r\n\r\n cadPosto.cancelar = function () {\r\n cadPosto.selected = {};\r\n cadPosto.isTelaConsuta = true;\r\n }\r\n\r\n cadPosto.ChangeDiretoria = function () {\r\n cadPosto.listaComplexo = cadPosto.diretoria.ListCadComplexo;\r\n cadPosto.complexo = null;\r\n }\r\n\r\n cadPosto.ChangeComplexo = function () {\r\n cadPosto.listaUnidade = cadPosto.complexo.ListCadUnidade\r\n cadPosto.unidade = null;\r\n }\r\n\r\n function getPosto() {\r\n var usuario = UsuarioService.indice\r\n PostoModel.getPostos(usuario).then(function (resposta) {\r\n cadPosto.lista = resposta;\r\n });\r\n }\r\n\r\n cadPosto.save = function () {\r\n cadPosto.selected.IdcUsuario = UsuarioService.indice;\r\n cadPosto.selected.IdcCentroCusto = null;\r\n cadPosto.selected.IdcElementoPep = null;\r\n cadPosto.selected.IdcOrdemEstatistica = null;\r\n if (!validPosto())\r\n return;\r\n\r\n if (cadPosto.selected.ChkTransferenciaSap) {\r\n if (cadPosto.selected.TipoFonte === 'C') {\r\n cadPosto.selected.IdcCentroCusto = cadPosto.selected.IdcFonte; \r\n\r\n } else if (cadPosto.selected.TipoFonte === 'E') {\r\n cadPosto.selected.IdcElementoPep = cadPosto.selected.IdcFonte; \r\n } else if (cadPosto.selected.TipoFonte === 'O') {\r\n cadPosto.selected.IdcOrdemEstatistica = cadPosto.selected.IdcFonte; \r\n }\r\n }\r\n cadPosto.selected.IdcUnidade = cadPosto.unidade.IdcUnidade;\r\n cadPosto.selected.IdcGrupoTurno = cadPosto.selectedTurno.IdcGrupoTurno;\r\n sppiner.spin()\r\n PostoModel.save(cadPosto.selected)\r\n .then(function () {\r\n cadPosto.isTelaConsuta = true;\r\n cadPosto.selected = {};\r\n sppiner.stop();\r\n })\r\n .catch(function(err){\r\n sppiner.stop()\r\n })\r\n }\r\n\r\n function validPosto() {\r\n return cadPosto.selected.SglPosto && cadPosto.unidade && cadPosto.selected.StuPosto;\r\n \r\n }\r\n\r\n function getDiretorias() {\r\n sppiner.spin();\r\n PostoModel.getLocais(UsuarioService.indice)\r\n .then(function (resposta) {\r\n cadPosto.listaDiretoria = resposta;\r\n cadPosto.diretoria = resposta.filter(function (d) {\r\n return d.SglDiretoria == cadPosto.selected.SglDiretoria\r\n })[0];\r\n cadPosto.listaComplexo = cadPosto.diretoria.ListCadComplexo;\r\n cadPosto.complexo = cadPosto.listaComplexo.filter(function (c) {\r\n return c.SglComplexo == cadPosto.selected.SglComplexo;\r\n })[0];\r\n cadPosto.listaUnidade = cadPosto.complexo.ListCadUnidade;\r\n cadPosto.unidade = cadPosto.listaUnidade.filter(function (u) {\r\n return u.SglUnidade == cadPosto.selected.SglUnidade;\r\n })[0];\r\n sppiner.stop();\r\n })\r\n .catch(function (err) {\r\n console.log(err)\r\n\r\n sppiner.stop();\r\n });\r\n }\r\n\r\n function getTurnos() {\r\n PostoModel.getTurnos()\r\n .then(function (resposta) {\r\n cadPosto.turnos = resposta\r\n })\r\n }\r\n\r\n cadPosto.FonteChange = function (tipoFonte, changeFonte) {\r\n if (changeFonte) {\r\n cadPosto.selected.IdcFonte = null;\r\n }\r\n if (tipoFonte === 'C') {\r\n return CentroCustoModel.getAll()\r\n .then(function (resposta) {\r\n cadPosto.listaCentroCusto = resposta;\r\n });\r\n } else if (tipoFonte === 'E') {\r\n return ElementoPepModel.getAll()\r\n .then(function (resposta) {\r\n cadPosto.listaElementoPep = resposta;\r\n });\r\n } else if (tipoFonte === 'O') {\r\n return OrdemEstatisticaModel.getAll()\r\n .then(function (resposta) {\r\n cadPosto.listaOrdemEstatistica = resposta;\r\n });\r\n } else {\r\n return GerenciaModel.getAll()\r\n .then(function (resposta) {\r\n cadPosto.listaGerencia = resposta;\r\n });\r\n }\r\n }\r\n\r\n \r\n\r\n\r\n inicializar();\r\n\r\n cadPosto.click = function (posto) {\r\n cadPosto.selected = posto;\r\n cadPosto.isTelaConsuta = false;\r\n getDiretorias();\r\n\r\n var turno = cadPosto.turnos.filter(function (t) {\r\n return t.IdcGrupoTurno == posto.IdcGrupoTurno\r\n })[0];\r\n\r\n if (cadPosto.selected.ChkTransferenciaSap) {\r\n if (cadPosto.selected.IdcCentroCusto != undefined) {\r\n cadPosto.selected.IdcFonte = cadPosto.selected.IdcCentroCusto;\r\n cadPosto.selected.TipoFonte = \"C\";\r\n cadPosto.FonteChange(\"C\")\r\n\r\n } else if (cadPosto.selected.IdcElementoPep != undefined) {\r\n cadPosto.selected.IdcFonte = cadPosto.selected.IdcElementoPep;\r\n cadPosto.selected.TipoFonte = \"E\";\r\n cadPosto.FonteChange(\"E\")\r\n\r\n } else if (cadPosto.selected.IdcOrdemEstatistica != undefined) {\r\n cadPosto.selected.IdcFonte = cadPosto.selected.IdcOrdemEstatistica;\r\n cadPosto.selected.TipoFonte = \"O\";\r\n cadPosto.FonteChange(\"O\")\r\n\r\n\r\n }\r\n }\r\n\r\n cadPosto.selectedTurno = turno;\r\n }\r\n\r\n cadPosto.clickTurno = function (turno) {\r\n cadPosto.turnos.forEach(function (t) {\r\n t.selected\r\n })\r\n }\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RecebimentoFiscalController', RecebimentoFiscalController);\r\n\r\n RecebimentoFiscalController.$inject = [\r\n 'ValidacaoService',\r\n 'SelTurnoService',\r\n 'TransitionService',\r\n 'MessageService',\r\n 'RecebimentoFiscalModel',\r\n 'ProdutoModel',\r\n 'RegAnomaliaService',\r\n 'DanfeService',\r\n 'UsuarioService',\r\n 'CaminhaoTanqueModel',\r\n 'CavaloMecanicoModel',\r\n 'NavioTanqueModel',\r\n 'EmpresaModel',\r\n '$element',\r\n '$filter',\r\n 'MotoristaModel',\r\n 'VagaoTanqueModel',\r\n 'ModalService',\r\n 'Constant',\r\n 'BarCodeService',\r\n 'TranslateService',\r\n '$timeout',\r\n 'CheckRecebimentoFiscal',\r\n 'PrivilegesService'\r\n ];\r\n\r\n function RecebimentoFiscalController(\r\n ValidacaoService,\r\n SelTurnoService,\r\n TransitionService,\r\n MessageService,\r\n RecebimentoFiscalModel,\r\n ProdutoModel,\r\n RegAnomaliaService,\r\n DanfeService,\r\n UsuarioService,\r\n CaminhaoTanqueModel,\r\n CavaloMecanicoModel,\r\n NavioTanqueModel,\r\n EmpresaModel,\r\n $element,\r\n $filter,\r\n MotoristaModel,\r\n VagaoTanqueModel,\r\n ModalService,\r\n Constant,\r\n BarCodeService,\r\n TranslateService,\r\n $timeout,\r\n CheckRecebimentoFiscal,\r\n PrivilegesService\r\n ) {\r\n\r\n var recebimentoFiscal = this;\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var bloco = null;\r\n var modalSelTipo = new ModalService({\r\n templateUrl: 'selTipoRecFisico.html',\r\n controller: 'SelTipoRecFisicoController',\r\n controllerAs: 'selTipoRecFisico'\r\n });\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n recebimentoFiscal.SelTurnoService = SelTurnoService;\r\n recebimentoFiscal.isTelaConsuta = true;\r\n recebimentoFiscal.filtro = null;\r\n recebimentoFiscal.selected = null;\r\n recebimentoFiscal.validacao = ValidacaoService;\r\n recebimentoFiscal.produtos = [];\r\n recebimentoFiscal.caminhoes = null;\r\n recebimentoFiscal.cavalos = null;\r\n recebimentoFiscal.vagoes = [];\r\n recebimentoFiscal.transportadoras = null;\r\n recebimentoFiscal.fornecedores = null;\r\n recebimentoFiscal.motoristas = null;\r\n recebimentoFiscal.tipos = Constant.TIPOS_RECEBIMENTO;\r\n recebimentoFiscal.isEmAvaliacao = false;\r\n\r\n recebimentoFiscal.cleanSearchTerm = function (fieldName) {\r\n recebimentoFiscal[fieldName] = '';\r\n };\r\n\r\n $element.find('input').on('keydown', function (ev) {\r\n ev.stopPropagation();\r\n });\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n BarCodeService.init(function (code) {\r\n if (!code || code === \"null\") return;\r\n\r\n $timeout(function () {\r\n alert(code);\r\n\r\n recebimentoFiscal.isTelaConsuta = false;\r\n recebimentoFiscal.selected = JSON.parse(localStorage.getItem(\"recebimentoFiscal.selected\"));\r\n localStorage.removeItem(\"recebimentoFiscal.selected\");\r\n\r\n $timeout(function () {\r\n recebimentoFiscal.selected.CodigoBarrasNotaFiscal = code;\r\n recebimentoFiscal.changeBarcode();\r\n });\r\n\r\n }, 2000);\r\n });\r\n\r\n recebimentoFiscal.SelTurnoService.onChangeTurno(onChangeTurno);\r\n recebimentoFiscal.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n SelTurnoService.selectTurno().then(onChangeTurno).catch(console.log);\r\n\r\n CaminhaoTanqueModel.getAll().then(function (caminhoes) {\r\n recebimentoFiscal.caminhoes = $filter('orderBy')(caminhoes, 'CodPlaca');\r\n });\r\n\r\n CavaloMecanicoModel.getAll().then(function (cavalos) {\r\n recebimentoFiscal.cavalos = $filter('orderBy')(cavalos, 'CodPlaca');\r\n });\r\n\r\n NavioTanqueModel.getAll().then(function (navios) {\r\n recebimentoFiscal.navios = $filter('orderBy')(navios, 'CodNavioTanque');\r\n });\r\n\r\n VagaoTanqueModel.getAll().then(function (vagoes) {\r\n recebimentoFiscal.vagoes = $filter('orderBy')(vagoes, 'CodVagaoTanque');\r\n });\r\n\r\n MotoristaModel.getAll().then(function (motoristas) {\r\n recebimentoFiscal.motoristas = $filter('orderBy')(motoristas, 'NomMotorista');\r\n });\r\n\r\n EmpresaModel.getTransportadoras().then(function (empresas) {\r\n recebimentoFiscal.transportadoras = $filter('orderBy')(empresas, 'NomEmpresa');\r\n });\r\n\r\n EmpresaModel.getFornecedores().then(function (empresas) {\r\n recebimentoFiscal.fornecedores = $filter('orderBy')(empresas, 'NomEmpresa');\r\n });\r\n }\r\n\r\n function onChangeTurno(regTurno) {\r\n recebimentoFiscal.getRecebimentosFiscais(regTurno.IdcRegTurno);\r\n recebimentoFiscal.getProdutos(regTurno.IdcPosto);\r\n }\r\n\r\n function setListaRecebimentoFiscal(resposta) {\r\n recebimentoFiscal.listaRecebimentoFiscal = resposta;\r\n for (var i = 0; i < recebimentoFiscal.listaRecebimentoFiscal.length; i++) {\r\n recebimentoFiscal.listaRecebimentoFiscal[i].DataHoraUTCInicioRecebimentoFiscalSearch =\r\n $filter('date')(\r\n recebimentoFiscal.listaRecebimentoFiscal[i].DataHoraUTCInicioRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n }\r\n\r\n function setListaProdutos(produtos) {\r\n recebimentoFiscal.produtos = produtos;\r\n }\r\n\r\n function salvarServidor(formRecebimentoFiscal, possuiFormulario) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n if (!recebimentoFiscal.selected) {\r\n return MessageService.alert(TranslateService('error'), TranslateService('invalid-data'), null, 'Erro');\r\n\r\n }\r\n\r\n RecebimentoFiscalModel.create(recebimentoFiscal.selected)\r\n .then(function (resposta) {\r\n if(possuiFormulario)\r\n ValidacaoService.resetForm(formRecebimentoFiscal);\r\n inicializacao();\r\n return MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), erro);\r\n });\r\n }\r\n\r\n function montaDataEmissaoNF(dadosCodBarras) {\r\n var ano = Number(SelTurnoService.turno.DataInicial.getFullYear().toString().substring(0, 2) + dadosCodBarras.ano);\r\n var mes = Number(dadosCodBarras.mes) - 1;\r\n var retorno = new Date(ano, mes, 1);\r\n return retorno;\r\n }\r\n\r\n function createRecebimento(tipo) {\r\n return {\r\n\r\n //Informações preenchidas automáticamente pelo sistema\r\n \"dataFinalOriginal\": true,\r\n\r\n \"IdentificadorRecebimentoFiscalProduto\": 0,\r\n\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorPostoAbastecimento\": SelTurnoService.turno.IdcPosto,\r\n \"IdentificadorAberturaFechamentoTurnoPosto\": SelTurnoService.turno.IdcRegTurno,\r\n \"IdentificadorUsuarioResponsavelRecebimento\": UsuarioService.indice,\r\n \"NomeSistemaOrigemDado\": 'WEB-MOBILE',\r\n \"PreCadastro\": 'N',\r\n\r\n //Informações preenchidas pelo usuário\r\n \"DataHoraUTCInicioRecebimentoFiscal\": ValidacaoService.getNowTurno(),\r\n \"DataHoraUTCFimRecebimentoFiscal\": ValidacaoService.getNowTurnoMaisUmMinuto(),\r\n \"CodigoBarrasNotaFiscal\": null,\r\n \"CodigoDANFENotaFiscal\": null,\r\n \"DataEmissaoNotaFiscal\": null,\r\n \"IdentificadorEmpresaFornecedora\": null,\r\n \"IdentificadorEmpresaTransportadora\": null,\r\n \"IdentificadorCavaloMecanico\": null,\r\n \"IdentificadorCaminhaoTanque\": null,\r\n \"IdentificadorMotoristaCavaloCaminhaoTanque\": null,\r\n \"NumeroIdentificacaoLacres\": null,\r\n \"QuantidadeLacres\": null,\r\n \"CodigoHexadecimalCorLacres\": null,\r\n \"IdentificadorProdutoNotaFiscal\": null,\r\n \"QuantidadeProdutoNotaFiscal\": null,\r\n \"PrecoUnitarioProdutoNotaFiscal\": null,\r\n\r\n \"PesoLiquidoNotaFiscal\": null,\r\n \"PesoBrutoNotaFiscal\": null,\r\n \"PesoBrutoVale\": null,\r\n\r\n \"DataHoraUTCChegadaCaminhaoPortaria\": null,\r\n \"DataHoraUTCEntradaCaminhaoPortaria\": null,\r\n \"DataHoraUTCSaidaCaminhaoPortaria\": null,\r\n\r\n \"IdentificadorVagaoTanque\": null,\r\n\r\n \"IndicadorTipoRecebimento\": tipo,\r\n\r\n // Informações de entidades associadas que são preenchidas \r\n // no backend através dos ids\r\n \"CadCaminhaoTanque\": null,\r\n \"CadCavaloMecanico\": null,\r\n \"CadEmpresaFornecedora\": null,\r\n \"CadEmpresaTransportadora\": null,\r\n \"CadMotorista\": null,\r\n \"CadPosto\": null,\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioResponsavelRecebimento\": null\r\n };\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n recebimentoFiscal.readBarcode = function () {\r\n localStorage.setItem(\"recebimentoFiscal.selected\", JSON.stringify(recebimentoFiscal.selected));\r\n BarCodeService.getScan(function (code) {\r\n $timeout(function () {\r\n recebimentoFiscal.selected.CodigoBarrasNotaFiscal = code;\r\n recebimentoFiscal.changeBarcode();\r\n });\r\n });\r\n };\r\n\r\n\r\n recebimentoFiscal.getRecebimentosFiscais = function (idcRegTurno) {\r\n return RecebimentoFiscalModel.getAllByIdcRegTurno(idcRegTurno)\r\n .then(setListaRecebimentoFiscal);\r\n };\r\n\r\n recebimentoFiscal.getProdutos = function (idcPosto) {\r\n return ProdutoModel.getAllByIdcPosto(idcPosto)\r\n .then(setListaProdutos);\r\n };\r\n\r\n recebimentoFiscal.recebimentoFiscalClick = function (regRecebimentoFiscal) {\r\n SelTurnoService.checkTurnoFechado(function () {\r\n recebimentoFiscal.isEmAvaliacao = false;\r\n RecebimentoFiscalModel.isEmAvaliacao(regRecebimentoFiscal.IdentificadorRecebimentoFiscalProduto)\r\n .then(function (resposta) {\r\n recebimentoFiscal.isEmAvaliacao = resposta;\r\n recebimentoFiscal.editar(regRecebimentoFiscal);\r\n });\r\n });\r\n };\r\n\r\n recebimentoFiscal.atualizar = function () {\r\n recebimentoFiscal.getRecebimentosFiscais(SelTurnoService.turno.IdcRegTurno);\r\n };\r\n\r\n recebimentoFiscal.novo = function () {\r\n\r\n return modalSelTipo.open({ tipos: recebimentoFiscal.tipos })\r\n .then(createRecebimento)\r\n .then(recebimentoFiscal.editar)\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n recebimentoFiscal.editar = function (regRecebimentoFiscal) {\r\n if (!regRecebimentoFiscal) return;\r\n\r\n recebimentoFiscal.selected = regRecebimentoFiscal;\r\n recebimentoFiscal.selected.Anomalias = recebimentoFiscal.selected.Anomalias || [];\r\n\r\n recebimentoFiscal.changeCaminhao();\r\n recebimentoFiscal.changeMotorista();\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n recebimentoFiscal.isTelaConsuta = false;\r\n SelTurnoService.canSelect = false;\r\n };\r\n\r\n recebimentoFiscal.salvar = function (formRecebimentoFiscal) {\r\n if (!recebimentoFiscal.selected) return;\r\n\r\n SelTurnoService.checkTurnoFechado(function () {\r\n\r\n recebimentoFiscal.selected.$valid = formRecebimentoFiscal.$valid;\r\n recebimentoFiscal.selected.produtos = recebimentoFiscal.produtos;\r\n CheckRecebimentoFiscal(recebimentoFiscal.selected)\r\n .then(function () {\r\n salvarServidor(formRecebimentoFiscal, true);\r\n });\r\n });\r\n };\r\n\r\n recebimentoFiscal.cancelar = function (formRecebimentoFiscal) {\r\n\r\n function cancel() {\r\n TransitionService.clearCurrent();\r\n recebimentoFiscal.selected.Anomalias = [];\r\n recebimentoFiscal.isTelaConsuta = true;\r\n SelTurnoService.canSelect = true;\r\n ValidacaoService.resetForm(formRecebimentoFiscal);\r\n recebimentoFiscal.getRecebimentosFiscais(SelTurnoService.turno.IdcRegTurno);\r\n }\r\n\r\n if (formRecebimentoFiscal.$dirty) {\r\n\r\n MessageService.prompt(\r\n TranslateService('atention'),\r\n TranslateService('exit-confirmation')\r\n ).then(function () {\r\n cancel();\r\n });\r\n } else {\r\n cancel();\r\n }\r\n };\r\n\r\n recebimentoFiscal.registrarAnomalia = function () {\r\n var id = recebimentoFiscal.selected ? recebimentoFiscal.selected.IdentificadorRecebimentoFiscalProduto : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n recebimentoFiscal.selected.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n recebimentoFiscal.changeBarcode = function () {\r\n\r\n DanfeService(recebimentoFiscal.selected.CodigoBarrasNotaFiscal, false)\r\n .then(function (retorno) {\r\n recebimentoFiscal.selected.CodigoDANFENotaFiscal = retorno.numDanfe;\r\n recebimentoFiscal.selected.DataEmissaoNotaFiscal = retorno.dataEmissaoNotaFiscal == null ? montaDataEmissaoNF(retorno) : retorno.dataEmissaoNotaFiscal;\r\n recebimentoFiscal.selected.diadanfe = retorno.diaEmissaoNotaFiscal == null ? 1 : retorno.diaEmissaoNotaFiscal;\r\n recebimentoFiscal.selected.IdentificadorRecebimentoFiscalProduto = retorno.identificadorRecebimentoFiscalProduto;\r\n recebimentoFiscal.selected.IdentificadorEmpresaFornecedora = retorno.empresaFornecedora;\r\n recebimentoFiscal.selected.IdentificadorEmpresaTransportadora = retorno.empresaTransportadora;\r\n recebimentoFiscal.selected.IdentificadorVagaoTanque = retorno.vagaoTanque;\r\n recebimentoFiscal.selected.IdentificadorCaminhaoTanque = retorno.caminhaoTanque;\r\n recebimentoFiscal.selected.IdentificadorCavaloMecanico = retorno.cavaloMecanico;\r\n recebimentoFiscal.selected.IdentificadorMotoristaCavaloCaminhaoTanque = retorno.motoristaCavaloCaminhaoTanque;\r\n recebimentoFiscal.selected.CodigoHexadecimalCorLacres = retorno.codigoHexadecimalCorLacres;\r\n recebimentoFiscal.selected.QuantidadeLacres = retorno.quantidadeLacres;\r\n recebimentoFiscal.selected.NumeroIdentificacaoLacres = retorno.numeroIdentificacaoLacres;\r\n recebimentoFiscal.selected.IdentificadorProdutoNotaFiscal = retorno.produtoNotaFiscal;\r\n recebimentoFiscal.selected.QuantidadeProdutoNotaFiscal = retorno.quantidadeProdutoNotaFiscal;\r\n recebimentoFiscal.selected.PrecoUnitarioProdutoNotaFiscal = retorno.precoUnitarioProdutoNotaFiscal;\r\n recebimentoFiscal.selected.PesoLiquidoNotaFiscal = retorno.pesoLiquidoNotaFiscal;\r\n recebimentoFiscal.selected.PesoBrutoNotaFiscal = retorno.pesoBrutoNotaFiscal;\r\n recebimentoFiscal.selected.PesoBrutoVale = retorno.pesoBrutoVale;\r\n recebimentoFiscal.selected.NumeroItemNota = retorno.numeroItemNota;\r\n recebimentoFiscal.selected.CnpjNotaFiscal = retorno.cnpjNotaFiscal;\r\n recebimentoFiscal.selected.DensidadeCarga = retorno.densidadeCarga;\r\n recebimentoFiscal.selected.TemperaturaCarga = retorno.temperaturaCarga;\r\n\r\n recebimentoFiscal.changeCaminhao();\r\n recebimentoFiscal.changeMotorista();\r\n\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n recebimentoFiscal.selected.CodigoDANFENotaFiscal = null;\r\n recebimentoFiscal.selected.DataEmissaoNotaFiscal = null;\r\n recebimentoFiscal.selected.diadanfe = null;\r\n recebimentoFiscal.selected.IdentificadorRecebimentoFiscalProduto = 0;\r\n recebimentoFiscal.selected.IdentificadorEmpresaFornecedora = null;\r\n recebimentoFiscal.selected.IdentificadorEmpresaTransportadora = null;\r\n recebimentoFiscal.selected.IdentificadorVagaoTanque = null;\r\n recebimentoFiscal.selected.IdentificadorCaminhaoTanque = null;\r\n recebimentoFiscal.selected.IdentificadorCavaloMecanico = null;\r\n recebimentoFiscal.selected.IdentificadorMotoristaCavaloCaminhaoTanque = null;\r\n recebimentoFiscal.selected.CodigoHexadecimalCorLacres = null;\r\n recebimentoFiscal.selected.QuantidadeLacres = null;\r\n recebimentoFiscal.selected.NumeroIdentificacaoLacres = null;\r\n recebimentoFiscal.selected.IdentificadorProdutoNotaFiscal = null;\r\n recebimentoFiscal.selected.QuantidadeProdutoNotaFiscal = null;\r\n recebimentoFiscal.selected.PrecoUnitarioProdutoNotaFiscal = null;\r\n recebimentoFiscal.selected.PesoLiquidoNotaFiscal = null;\r\n recebimentoFiscal.selected.PesoBrutoNotaFiscal = null;\r\n recebimentoFiscal.selected.PesoBrutoVale = null;\r\n recebimentoFiscal.selected.DensidadeCarga = null;\r\n recebimentoFiscal.selected.TemperaturaCarga = null;\r\n\r\n recebimentoFiscal.changeCaminhao();\r\n recebimentoFiscal.changeMotorista();\r\n });\r\n };\r\n\r\n recebimentoFiscal.changeInvoiceNumber = function (invoice) {\r\n if ((recebimentoFiscal.selected.diadanfe === null || typeof recebimentoFiscal.selected.diadanfe === \"undefined\") &&\r\n (recebimentoFiscal.selected.CodigoBarrasNotaFiscal === null || typeof recebimentoFiscal.selected.CodigoBarrasNotaFiscal === \"undefined\")) {\r\n var codBarraCan;\r\n var data = new Date();\r\n recebimentoFiscal.selected.diadanfe = 1;\r\n recebimentoFiscal.selected.DataEmissaoNotaFiscal = new Date();\r\n recebimentoFiscal.changeDiaEmissao(recebimentoFiscal.selected.diadanfe);\r\n codBarraCan = invoice.concat(data.getFullYear(), data.getMonth()+1, data.getDate());\r\n recebimentoFiscal.selected.CodigoBarrasNotaFiscal = codBarraCan.padStart(44, '0');\r\n }\r\n };\r\n\r\n recebimentoFiscal.changeHoraFinal = function (selected, campo) {\r\n selected.dataFinalOriginal = false;\r\n ValidacaoService.changeTime(selected, campo);\r\n };\r\n\r\n recebimentoFiscal.changeDiaEmissao = function (diadanfe) {\r\n if (!diadanfe) {\r\n return;\r\n }\r\n var milis = recebimentoFiscal.selected.DataEmissaoNotaFiscal.setDate(diadanfe);\r\n recebimentoFiscal.selected.DataEmissaoNotaFiscal = new Date(milis);\r\n };\r\n\r\n recebimentoFiscal.changeCaminhao = function () {\r\n //seleciona o caminhao na lista a parir do id selecionado\r\n var IdcCaminhaoTanque = recebimentoFiscal.selected.IdentificadorCaminhaoTanque;\r\n if (!IdcCaminhaoTanque) return recebimentoFiscal.selected.datavalidadecertificado = null;\r\n var caminhao = $filter('filter')(recebimentoFiscal.caminhoes, { IdcCaminhaoTanque: IdcCaminhaoTanque }, true)[0];\r\n recebimentoFiscal.selected.datavalidadecertificado = caminhao.DthValidadeCertificado;\r\n };\r\n\r\n recebimentoFiscal.changeMotorista = function () {\r\n //seleciona o motorista na lista a parir do id selecionado\r\n var IdcMotorista = recebimentoFiscal.selected.IdentificadorMotoristaCavaloCaminhaoTanque;\r\n if (!IdcMotorista) return recebimentoFiscal.selected.CnhVencimento = null;\r\n var motorista = $filter('filter')(recebimentoFiscal.motoristas, { IdcMotorista: IdcMotorista }, true)[0];\r\n recebimentoFiscal.selected.CnhVencimento = motorista.CnhVencimento;\r\n };\r\n\r\n recebimentoFiscal.isBlocked = function () {\r\n return recebimentoFiscal.isEmAvaliacao;\r\n };\r\n\r\n recebimentoFiscal.isDisabled = function () {\r\n if (recebimentoFiscal && recebimentoFiscal.selected) {\r\n var selected = recebimentoFiscal.selected;\r\n var isDisabled = !selected.CodigoDANFENotaFiscal || recebimentoFiscal.isEmAvaliacao;\r\n return isDisabled;\r\n }\r\n return false;\r\n\r\n };\r\n\r\n\r\n recebimentoFiscal.atualizaDataHoraChegadaAgendada = function (selected) {\r\n\r\n var modalAtualizaDataHora = new ModalService({\r\n templateUrl: 'modalAlteraDataHora.html',\r\n controller: 'AlteraDataHoraController',\r\n controllerAs: 'alteraDataHora'\r\n });\r\n\r\n return modalAtualizaDataHora.open({ dataHora: selected.DataHoraUTCSaidaCaminhaoPortaria })\r\n .then(function (dataHoraAtualizada) {\r\n recebimentoFiscal.selected = selected;\r\n recebimentoFiscal.selected.DataHoraUTCSaidaCaminhaoPortaria = dataHoraAtualizada;\r\n return RecebimentoFiscalModel.updateDataSaidaPortaria(selected);\r\n });\r\n };\r\n\r\n recebimentoFiscal.getDataSaidaButtonText = function (regRecebimentoFiscal) {\r\n if (regRecebimentoFiscal.DataHoraUTCSaidaCaminhaoPortaria) {\r\n return $filter('date')(regRecebimentoFiscal.DataHoraUTCSaidaCaminhaoPortaria, TranslateService(\"datetime-format\"));\r\n }\r\n\r\n return TranslateService('date-entrance-leave');\r\n };\r\n\r\n recebimentoFiscal.showDataSaidaButton = function () {\r\n return PrivilegesService.includes(\"Validar_RecebimentoFiscal\");\r\n };\r\n\r\n inicializacao();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RecebimentoFisicoController', RecebimentoFisicoController);\r\n\r\n RecebimentoFisicoController.$inject = [\r\n 'SelTurnoService',\r\n 'RecebimentoFisicoModel',\r\n 'ModalService',\r\n 'UsuarioService',\r\n 'TransitionService',\r\n 'ProdutoModel',\r\n 'ValidacaoService',\r\n 'CaminhaoTanqueModel',\r\n 'NavioTanqueModel',\r\n 'CavaloMecanicoModel',\r\n 'TanquePostoModel',\r\n '$element',\r\n '$filter',\r\n 'Constant',\r\n 'MessageService',\r\n 'RegAnomaliaService',\r\n 'VagaoTanqueModel',\r\n 'TranslateService',\r\n 'CheckRecebimentoFisico',\r\n 'CtrEncerranteModel'\r\n ];\r\n\r\n function RecebimentoFisicoController(\r\n SelTurnoService,\r\n RecebimentoFisicoModel,\r\n ModalService,\r\n UsuarioService,\r\n TransitionService,\r\n ProdutoModel,\r\n ValidacaoService,\r\n CaminhaoTanqueModel,\r\n NavioTanqueModel,\r\n CavaloMecanicoModel,\r\n TanquePostoModel,\r\n $element,\r\n $filter,\r\n Constant,\r\n MessageService,\r\n RegAnomaliaService,\r\n VagaoTanqueModel,\r\n TranslateService,\r\n CheckRecebimentoFisico,\r\n CtrEncerranteModel\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var recebimentoFisico = this;\r\n var modalSelTipo = new ModalService({\r\n templateUrl: 'selTipoRecFisico.html',\r\n controller: 'SelTipoRecFisicoController',\r\n controllerAs: 'selTipoRecFisico'\r\n });\r\n\r\n var modalDetalhe = new ModalService({\r\n templateUrl: 'detalheRecFisico.html',\r\n controller: 'DetalheRecFisicoController',\r\n controllerAs: 'detalheRecFisico'\r\n });\r\n\r\n var modalApuracao = new ModalService({\r\n templateUrl: 'apuracaoRecFisico.html',\r\n controller: 'ApuracaoRecFisicoController',\r\n controllerAs: 'apuracaoRecFisico'\r\n });\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n function InicializaVariaveis() {\r\n recebimentoFisico.SelTurnoService = SelTurnoService;\r\n recebimentoFisico.telas = {\r\n CONSULTA: 'CONSULTA',\r\n REGISTRO: 'REGISTRO'\r\n };\r\n recebimentoFisico.tipos = Constant.TIPOS_RECEBIMENTO;\r\n recebimentoFisico.indicadorBinario = Constant.INDICADORES_BINARIOS;\r\n recebimentoFisico.tela = recebimentoFisico.telas.CONSULTA;\r\n recebimentoFisico.filtro = null;\r\n recebimentoFisico.selected = null;\r\n recebimentoFisico.listarecebimentoFisico = [];\r\n recebimentoFisico.produtos = [];\r\n recebimentoFisico.SelTurnoService = SelTurnoService;\r\n recebimentoFisico.validacao = ValidacaoService;\r\n recebimentoFisico.cavalos = [];\r\n recebimentoFisico.caminhoes = [];\r\n recebimentoFisico.vagoes = [];\r\n recebimentoFisico.tanquesPosto = [];\r\n recebimentoFisico.detalheSelected = null;\r\n recebimentoFisico.apuracaoSelected = null;\r\n recebimentoFisico.validaHorainicial = {\r\n min: validaMinHoraInicial,\r\n max: validaMaxHoraInicial\r\n };\r\n\r\n recebimentoFisico.validaHoraFinal = {\r\n min: validaMinHoraFinal\r\n };\r\n recebimentoFisico.isEmAvaliacao = false;\r\n }\r\n InicializaVariaveis();\r\n\r\n recebimentoFisico.cleanSearchTerm = function (fieldName) {\r\n recebimentoFisico[fieldName] = '';\r\n };\r\n\r\n $element.find('input').on('keydown', function (ev) {\r\n ev.stopPropagation();\r\n });\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n recebimentoFisico.SelTurnoService.onChangeTurno(onChangeTurno);\r\n recebimentoFisico.tela = recebimentoFisico.telas.CONSULTA;\r\n SelTurnoService.canSelect = true;\r\n SelTurnoService.selectTurno().then(onChangeTurno).catch(console.log);\r\n CaminhaoTanqueModel.getAll().then(function (caminhoes) {\r\n recebimentoFisico.caminhoes = $filter('orderBy')(caminhoes, 'CodPlaca');\r\n });\r\n\r\n CavaloMecanicoModel.getAll().then(function (cavalos) {\r\n recebimentoFisico.cavalos = $filter('orderBy')(cavalos, 'CodPlaca');\r\n });\r\n\r\n NavioTanqueModel.getAll().then(function (navios) {\r\n recebimentoFisico.navios = $filter('orderBy')(navios, 'CodNavioTanque');\r\n });\r\n\r\n VagaoTanqueModel.getAll().then(function (vagoes) {\r\n recebimentoFisico.vagoes = $filter('orderBy')(vagoes, 'CodVagaoTanque');\r\n });\r\n }\r\n\r\n function validaMinHoraFinal() {\r\n if (!recebimentoFisico.selected) {\r\n return true;\r\n }\r\n\r\n var dataHoraFinalRec = recebimentoFisico.selected.DataHoraUTCFimRecebimentoFisico;\r\n var dataHoraInicialRec = recebimentoFisico.selected.DataHoraUTCInicioRecebimentoFisico;\r\n var dataHoraInicioTurno = recebimentoFisico.SelTurnoService.turno.DataInicial;\r\n var minDate = dataHoraInicioTurno > dataHoraInicialRec ? dataHoraInicioTurno : dataHoraInicialRec;\r\n\r\n if (!dataHoraFinalRec) {\r\n return true;\r\n }\r\n\r\n return dataHoraFinalRec > minDate;\r\n }\r\n\r\n function validaMinHoraInicial() {\r\n if (!recebimentoFisico.selected) {\r\n return true;\r\n }\r\n\r\n if (!isSameTurnoInicio()) {\r\n return true;\r\n }\r\n\r\n return recebimentoFisico.selected.DataHoraUTCInicioRecebimentoFisico >= recebimentoFisico.SelTurnoService.turno.DataInicial;\r\n }\r\n\r\n function validaMaxHoraInicial() {\r\n if (!recebimentoFisico.selected) {\r\n return true;\r\n }\r\n\r\n if (!isSameTurnoInicio()) {\r\n return true;\r\n }\r\n\r\n var dataHoraFinalRec = recebimentoFisico.selected.DataHoraUTCFimRecebimentoFisico;\r\n var dataHoraInicialRec = recebimentoFisico.selected.DataHoraUTCInicioRecebimentoFisico;\r\n var dataHoraFinalTurno = recebimentoFisico.SelTurnoService.turno.DataFinal;\r\n var menorQueTurno = dataHoraInicialRec <= dataHoraFinalTurno;\r\n\r\n return dataHoraFinalRec ? dataHoraInicialRec < dataHoraFinalRec && menorQueTurno : menorQueTurno;\r\n }\r\n\r\n function isSameTurnoInicio() {\r\n return recebimentoFisico.selected.IdentificadorAberturaFechamentoTurnoInicioRecebimento === SelTurnoService.getIdcRegTurno();\r\n }\r\n\r\n function onChangeTurno(regTurno) {\r\n recebimentoFisico.getRecebimentosFisicos(regTurno.IdcRegTurno);\r\n recebimentoFisico.getProdutos(regTurno.IdcPosto);\r\n recebimentoFisico.getTanquesPosto(regTurno.IdcPosto);\r\n }\r\n\r\n function setListarecebimentoFisico(listRegRecebimentoFisico) {\r\n recebimentoFisico.listaRecebimentoFisico = listRegRecebimentoFisico;\r\n for (var i = 0; i < recebimentoFisico.listaRecebimentoFisico.length; i++) {\r\n recebimentoFisico.listaRecebimentoFisico[i].DataHoraUTCInicioRecebimentoFisicoSearch =\r\n $filter('date')(\r\n recebimentoFisico.listaRecebimentoFisico[i].DataHoraUTCInicioRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n recebimentoFisico.listaRecebimentoFisico[i].DataHoraUTCFimRecebimentoFisicoSearch =\r\n $filter('date')(\r\n recebimentoFisico.listaRecebimentoFisico[i].DataHoraUTCFimRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n }\r\n\r\n function setListaProdutos(produtos) {\r\n recebimentoFisico.produtos = produtos;\r\n }\r\n\r\n function criaNovoRecebimento(tipo) {\r\n return {\r\n \"IdentificadorRecebimentoFisicoProduto\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorProdutoPosto\": recebimentoFisico.produtos.length ? recebimentoFisico.produtos[0].IdcProduto : 0,\r\n \"DataHoraUTCInicioRecebimentoFisico\": ValidacaoService.getNowTurno(),\r\n \"IdentificadorUsuarioResponsavelInicioRecebimento\": UsuarioService.indice,\r\n \"IdentificadorAberturaFechamentoTurnoInicioRecebimento\": SelTurnoService.getIdcRegTurno(),\r\n \"DataHoraUTCFimRecebimentoFisico\": null,\r\n \"IdentificadorUsuarioResponsavelTerminoRecebimento\": null,\r\n \"IdentificadorAberturaFechamentoTurnoTerminoRecebimento\": null,\r\n \"IndicadorUtilizacaoSkid\": 'S',\r\n \"IndicadorConcordanciaMotorista\": 'S',\r\n\r\n \"IndicadorSituacao\": 'AB',\r\n \"NomeSistemaOrigemDado\": 'WEB-MOBILE',\r\n \"IdentificadorCargaMassaMovimentacao\": null,\r\n \"IndicadorTipoRecebimento\": tipo,\r\n\r\n \"IdentificadorCavaloMecanico\": null,\r\n \"IdentificadorCaminhaoTanque\": null,\r\n\r\n \"IdentificadorVagaoTanque\": null,\r\n\r\n \"IdentificadorNavioTanque\": null,\r\n\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioResponsavelInicioRecebimento\": null,\r\n \"CadUsuarioResponsavelTerminoRecebimento\": null,\r\n \"RegTurnoInicio\": null,\r\n \"RegTurnoTermino\": null,\r\n\r\n \"ListDetalheRecebimentoProduto\": tipo === 'C' ? [] : [criaDetalhe()],\r\n \"ListApuracaoRecebimentoProdutoTanquePosto\": recebimentoFisico.tanquesPosto.map(criaApuracao)\r\n };\r\n }\r\n\r\n function criaApuracao(tanque) {\r\n if (!tanque) {\r\n return;\r\n }\r\n\r\n return {\r\n \"IdentificadorApuracaoRecebimentoProdutoTanque\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorRecebimentoFisicoProduto\": 0,\r\n \"IdentificadorTanquePostoAbastecimento\": tanque.IdcTanquePosto,\r\n \"CadTanquePosto\": tanque,\r\n\r\n //Informações inseridas pelo usuário\r\n \"MedidaAlturaInicial\": null,\r\n \"QuantidadeProdutoInicial\": 0,\r\n \"QuantidadeProdutoInicial20GrausCelsius\": null,\r\n \"MedidaTemperaturaMediaInicial\": null,\r\n \"MedidaTemperaturaSuperficieInicial\": null,\r\n \"MedidaTemperaturaMeioInicial\": null,\r\n \"MedidaTemperaturaFundoInicial\": null,\r\n \"MedidaDensidadeInicial\": null,\r\n\r\n \"MedidaAlturaFinal\": null,\r\n \"QuantidadeProdutoFinal\": 0,\r\n \"QuantidadeProdutoFinal20GrausCelsius\": null,\r\n \"MedidaTemperaturaMediaFinal\": null,\r\n \"MedidaTemperaturaSuperficieFinal\": null,\r\n \"MedidaTemperaturaMeioFinal\": null,\r\n \"MedidaTemperaturaFundoFinal\": null,\r\n \"MedidaDensidadeFinal\": null,\r\n\r\n //Proxies para altura\r\n \"AlturaInicialProxy\": null,\r\n \"AlturaFinalProxy\": null\r\n };\r\n }\r\n\r\n function criaDetalhe(compartimento) {\r\n\r\n compartimento = compartimento || {};\r\n\r\n return {\r\n //Identificadores preenchidos automáticamente pelo entity\r\n \"IdentificadorDetalheRecebimentoProduto\": 0,\r\n \"IdentificadorRecebimentoFisicoProduto\": 0,\r\n \"IdentificadorEncerranteBlocoMedidor\": null,\r\n\r\n //Objetos que existem na entidade, mas não precisam ser preenchidos\r\n \"CadAspectoVisual\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n\r\n //Informações capturadas automáticamente no momento do lançamento\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"NomeSistemaOrigemDado\": 'WEB-MOBILE',\r\n\r\n //Informações do usuário comuns a todos os tipos\r\n \"QuantidadeRecebida\": null,\r\n \"QuantidadeRecebida20GrausCelsius\": null,\r\n \"PesoLiquidoRecebido\": null,\r\n \"IdentificadorAspectoVisual\": null,\r\n \"IndicadorPresencaAgua\": null,\r\n\r\n //Inclusão destes campos para calcular volume a 20 graus celsius\r\n \"MedidaDensidadeProduto\": null,\r\n \"MedidaTemperaturaProduto\": null,\r\n\r\n //Específico para vagão (Preenchido pelo usuário)\r\n \"MedidaAlturaEspacoVazio\": null,\r\n\r\n //=============================================================================================//\r\n\r\n //Específico para caminhão (Preenchido automáticamente)\r\n \"CadCaminhaoCompartimento\": compartimento,\r\n \"IdentificadorCompartimentoCaminhaoTanque\": compartimento.IdcCaminhaoCompartimento || null,\r\n\r\n //Específico para caminhão com complemento\r\n \"DataHoraUTCComplemento\": ValidacaoService.getNowTurno(),\r\n \"QuantidadeComplementoProduto\": null,\r\n \"CtrEncerrante\": {\r\n \"IdcCtrEncerrante\": 0,\r\n \"IdcBlocoMedidor\": 0,\r\n \"DthCtrEncerrante\": ValidacaoService.getNowTurno(),\r\n \"ValEncerranteAtual\": 0,\r\n \"IdcTblOperacao\": 0,\r\n \"TblOperacao\": \"V5GDETRT\",\r\n \"ChkResetAutomatico\": false,\r\n \"DthCriacaoReg\": new Date(),\r\n \"RegPorEncerrante\": \"S\"\r\n }\r\n };\r\n }\r\n\r\n function hasQuantity() {\r\n var list = recebimentoFisico.selected.ListDetalheRecebimentoProduto;\r\n for (var key in list) {\r\n var element = list[key];\r\n if (element.QuantidadeRecebida) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n function salvarServidor(form) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n //Limpa os encerrantes salvos em memória\r\n CtrEncerranteModel.forgetCounters();\r\n\r\n if (!recebimentoFisico.selected) {\r\n return MessageService.alert(TranslateService('error'), TranslateService('invalid-data'), null, 'Erro');\r\n }\r\n\r\n if (recebimentoFisico.selected.DataHoraUTCFimRecebimentoFisico) {\r\n recebimentoFisico.selected.IdentificadorAberturaFechamentoTurnoTerminoRecebimento = SelTurnoService.getIdcRegTurno();\r\n recebimentoFisico.selected.IndicadorSituacao = 'FE';\r\n }\r\n\r\n recebimentoFisico.selected.ListDetalheRecebimentoProduto.forEach(function(item){\r\n if(item && !item.QuantidadeRecebida){\r\n item.QuantidadeRecebida = 0;\r\n }\r\n });\r\n\r\n RecebimentoFisicoModel.createOrUpdate(recebimentoFisico.selected)\r\n .then(function (resposta) {\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\");\r\n ValidacaoService.resetForm(form);\r\n inicializacao();\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), erro);\r\n });\r\n }\r\n\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n // recebimentoFisico.recebimentoFisicoClick = function (regRecebimentoFisico) {\r\n // console.log('recebimentoFisicoClick');\r\n // };\r\n\r\n recebimentoFisico.getQuantidadeRecebimento = function (regRecebimentoFisico) {\r\n return regRecebimentoFisico.ListDetalheRecebimentoProduto.reduce(function (sum, item) {\r\n return sum + (item.QuantidadeRecebida && item.QuantidadeRecebida !== null ? item.QuantidadeRecebida : 0);\r\n }, 0);\r\n };\r\n\r\n recebimentoFisico.getQuantidadeFaltante = function (regRecebimentoFisico) {\r\n return regRecebimentoFisico.ListDetalheRecebimentoProduto.reduce(function (sum, item) {\r\n return sum + item.QuantidadeComplementoProduto;\r\n }, 0);\r\n };\r\n\r\n recebimentoFisico.atualizar = function () {\r\n InicializaVariaveis();\r\n inicializacao();\r\n recebimentoFisico.getRecebimentosFisicos(SelTurnoService.turno.IdcRegTurno);\r\n };\r\n\r\n recebimentoFisico.getProdutos = function (idcPosto) {\r\n return ProdutoModel.getAllByIdcPosto(idcPosto)\r\n .then(setListaProdutos);\r\n };\r\n\r\n recebimentoFisico.getTanquesPosto = function (IdcPosto) {\r\n TanquePostoModel.getByIdPostoAndStuTanque(IdcPosto, 'S')\r\n .then(function (tanquesPosto) {\r\n recebimentoFisico.tanquesPosto = tanquesPosto;\r\n });\r\n };\r\n\r\n recebimentoFisico.detalheClick = function (detalhe) {\r\n recebimentoFisico.detalheSelected = detalhe;\r\n modalDetalhe.open({\r\n detalhe: detalhe,\r\n recebimento: recebimentoFisico.selected,\r\n isEmAvaliacao: recebimentoFisico.isEmAvaliacao\r\n })\r\n .then(function (resposta) {\r\n console.log(resposta);\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n recebimentoFisico.apuracaoClick = function (apuracao) {\r\n recebimentoFisico.apuracaoSelected = apuracao;\r\n modalApuracao.open({\r\n apuracao: apuracao,\r\n recebimento: recebimentoFisico.selected,\r\n isEmAvaliacao: recebimentoFisico.isEmAvaliacao\r\n })\r\n .then(function (resposta) {\r\n console.log(resposta);\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n recebimentoFisico.cancelar = function (form) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n CtrEncerranteModel.forgetCounters();\r\n recebimentoFisico.selected.Anomalias = [];\r\n recebimentoFisico.tela = recebimentoFisico.telas.CONSULTA;\r\n SelTurnoService.canSelect = true;\r\n ValidacaoService.resetForm(form);\r\n recebimentoFisico.getRecebimentosFisicos(SelTurnoService.turno.IdcRegTurno);\r\n };\r\n\r\n recebimentoFisico.novo = function () {\r\n return modalSelTipo.open({ tipos: recebimentoFisico.tipos })\r\n .then(criaNovoRecebimento)\r\n .then(recebimentoFisico.editar)\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n recebimentoFisico.changeCaminhao = function (caminhao) {\r\n\r\n //seleciona o caminhao na lista a parir do id selecionado\r\n caminhao = $filter('filter')(recebimentoFisico.caminhoes, { IdcCaminhaoTanque: caminhao }, true)[0];\r\n\r\n recebimentoFisico.selected.ListDetalheRecebimentoProduto =\r\n caminhao.ListCadCaminhaoCompartimento.map(criaDetalhe);\r\n };\r\n\r\n recebimentoFisico.editar = function (recebimento) {\r\n if (!recebimento) return;\r\n recebimentoFisico.selected = {};\r\n SelTurnoService.checkTurnoFechado(function () {\r\n\r\n recebimentoFisico.isEmAvaliacao = false;\r\n RecebimentoFisicoModel.isEmAvaliacao(recebimento.IdentificadorRecebimentoFisicoProduto)\r\n .then(function (resposta) {\r\n recebimentoFisico.isEmAvaliacao = resposta;\r\n\r\n angular.forEach(recebimento.ListApuracaoRecebimentoProdutoTanquePosto, function (apuracao) {\r\n for (var i = 0; i < recebimentoFisico.tanquesPosto.length; i++) {\r\n if (recebimentoFisico.tanquesPosto[i].IdcTanquePosto == apuracao.IdentificadorTanquePostoAbastecimento) {\r\n apuracao.CadTanquePosto = angular.copy(recebimentoFisico.tanquesPosto[i]);\r\n }\r\n }\r\n });\r\n\r\n recebimentoFisico.selected = recebimento;\r\n recebimentoFisico.selected.Anomalias = recebimentoFisico.selected.Anomalias || [];\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n recebimentoFisico.tela = recebimentoFisico.telas.REGISTRO;\r\n SelTurnoService.canSelect = false;\r\n });\r\n });\r\n };\r\n\r\n recebimentoFisico.getRecebimentosFisicos = function (idcRegTurno) {\r\n RecebimentoFisicoModel.getAllByIdcRegTurno(idcRegTurno)\r\n .then(setListarecebimentoFisico);\r\n return idcRegTurno;\r\n };\r\n\r\n recebimentoFisico.registrarAnomalia = function () {\r\n var id = recebimentoFisico.selected ? recebimentoFisico.selected.IdentificadorRecebimentoFisicoProduto : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n recebimentoFisico.selected.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n recebimentoFisico.salvar = function (formRecebimentoFisico) {\r\n if (!recebimentoFisico.selected) {\r\n return;\r\n }\r\n\r\n SelTurnoService.checkTurnoFechado(function () {\r\n\r\n recebimentoFisico.selected.$valid = formRecebimentoFisico.$valid;\r\n CheckRecebimentoFisico(recebimentoFisico.selected)\r\n .then(function () {\r\n salvarServidor(formRecebimentoFisico);\r\n });\r\n });\r\n };\r\n\r\n recebimentoFisico.disableHoraInicial = function () {\r\n if (!recebimentoFisico.selected) {\r\n return true;\r\n }\r\n\r\n return recebimentoFisico.isBlocked() || !isSameTurnoInicio();\r\n\r\n }\r\n\r\n recebimentoFisico.isBlocked = function () {\r\n return recebimentoFisico.isEmAvaliacao;\r\n }\r\n\r\n inicializacao();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RecebimentosController', RecebimentosController);\r\n\r\n RecebimentosController.$inject = [\r\n 'ValidacaoService',\r\n 'SelTurnoService',\r\n 'ComplexoModel',\r\n 'UnidadeModel',\r\n 'PostoModel',\r\n 'ProdutoModel',\r\n 'CadTurnoModel',\r\n 'TanquePostoModel',\r\n 'AssociacaoRecebimentoModel',\r\n 'RecebimentoFisicoModel',\r\n 'RecebimentoFiscalModel',\r\n 'CaminhaoTanqueModel',\r\n 'CavaloMecanicoModel',\r\n 'NavioTanqueModel',\r\n 'EmpresaModel',\r\n 'MotoristaModel',\r\n 'VagaoTanqueModel',\r\n 'MessageService',\r\n 'UsuarioService',\r\n 'ModalService',\r\n 'RegAnomaliaService',\r\n 'DanfeService',\r\n 'DivergenciaService',\r\n 'TranslateService',\r\n 'CheckAssociacaoRecebimento',\r\n '$filter',\r\n '$element',\r\n '$scope',\r\n 'Constant',\r\n 'BarCodeService',\r\n '$timeout',\r\n 'CheckRecebimentoFiscal',\r\n 'CheckRecebimentoFisico',\r\n 'PrivilegesService',\r\n 'TransitionService'\r\n ];\r\n\r\n function RecebimentosController(\r\n ValidacaoService,\r\n SelTurnoService,\r\n ComplexoModel,\r\n UnidadeModel,\r\n PostoModel,\r\n ProdutoModel,\r\n CadTurnoModel,\r\n TanquePostoModel,\r\n AssociacaoRecebimentoModel,\r\n RecebimentoFisicoModel,\r\n RecebimentoFiscalModel,\r\n CaminhaoTanqueModel,\r\n CavaloMecanicoModel,\r\n NavioTanqueModel,\r\n EmpresaModel,\r\n MotoristaModel,\r\n VagaoTanqueModel,\r\n MessageService,\r\n UsuarioService,\r\n ModalService,\r\n RegAnomaliaService,\r\n DanfeService,\r\n DivergenciaService,\r\n TranslateService,\r\n CheckAssociacaoRecebimento,\r\n $filter,\r\n $element,\r\n $scope,\r\n Constant,\r\n BarCodeService,\r\n $timeout,\r\n CheckRecebimentoFiscal,\r\n CheckRecebimentoFisico,\r\n PrivilegesService,\r\n TransitionService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var recebimentos = this;\r\n\r\n var modalSelTipo = new ModalService({\r\n templateUrl: 'selTipoRecFisico.html',\r\n controller: 'SelTipoRecFisicoController',\r\n controllerAs: 'selTipoRecFisico'\r\n });\r\n\r\n var modalDivergencia = new ModalService({\r\n templateUrl: 'divergencia.html',\r\n controller: 'DivergenciaController',\r\n controllerAs: 'divergencia'\r\n });\r\n\r\n var modalSelectionRecFisico = new ModalService({\r\n templateUrl: 'selecaoRecebimentoFisico.html',\r\n controller: 'SelecaoRecebimentoFisicoController',\r\n controllerAs: 'selecaoRecebFisico'\r\n });\r\n\r\n var modalDetalheRecebimento = new ModalService({\r\n templateUrl: 'detalheRecebimento.html',\r\n controller: 'DetalheRecebimentoController',\r\n controllerAs: 'detalheRecebimento'\r\n });\r\n\r\n var modalSaidaPortaria = new ModalService({\r\n templateUrl: 'saidaPortaria.html',\r\n controller: 'SaidaPortariaController',\r\n controllerAs: 'saidaPortaria'\r\n });\r\n\r\n var modalDetalhe = new ModalService({\r\n templateUrl: 'detalheRecFisico.html',\r\n controller: 'DetalheRecFisicoController',\r\n controllerAs: 'detalheRecFisico'\r\n });\r\n\r\n var modalApuracao = new ModalService({\r\n templateUrl: 'apuracaoRecFisico.html',\r\n controller: 'ApuracaoRecFisicoController',\r\n controllerAs: 'apuracaoRecFisico'\r\n });\r\n\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n //Controle da tela\r\n recebimentos.SelTurnoService = SelTurnoService;\r\n recebimentos.tabselector = 'firsttab'\r\n recebimentos.isTelaConsuta = true;\r\n recebimentos.isEditarFiscal = false;\r\n recebimentos.isEditarFisico = false;\r\n recebimentos.IndicadorTipoRecebimento = null;\r\n recebimentos.indicadorBinario = Constant.INDICADORES_BINARIOS;\r\n recebimentos.tipos = Constant.TIPOS_RECEBIMENTO;\r\n //Controle das variaveis\r\n recebimentos.listaRecebimentos = [];\r\n recebimentos.selected = null;\r\n recebimentos.selectedFiscal = null;\r\n recebimentos.selectedFisico = null;\r\n recebimentos.lastIndexFisico = 1;\r\n recebimentos.lastIndexFiscal = 1;\r\n //Controle da Combos\r\n recebimentos.produto = null;\r\n recebimentos.standardProduto = null;\r\n recebimentos.produtos = [];\r\n recebimentos.vagoes = [];\r\n recebimentos.listaComplexo = [];\r\n recebimentos.tanquesPosto = [];\r\n recebimentos.caminhoes = null;\r\n recebimentos.cavalos = null;\r\n recebimentos.transportadoras = null;\r\n recebimentos.fornecedores = null;\r\n recebimentos.motoristas = null;\r\n //Controle da Validação\r\n recebimentos.isEmAvaliacao = false;\r\n recebimentos.idEmAvaliacaoFiscal = 0;\r\n recebimentos.idEmAvaliacaoFisico = 0;\r\n recebimentos.isEditing = false;\r\n recebimentos.validacaoFiscal = ValidacaoService;\r\n recebimentos.validacaoFisico = ValidacaoService;\r\n recebimentos.detalheSelected = null;\r\n recebimentos.validaHorainicial = {\r\n min: validaMinHoraInicial,\r\n max: validaMaxHoraInicial\r\n };\r\n recebimentos.validaHoraFinal = {\r\n min: validaMinHoraFinal\r\n };\r\n\r\n\r\n\r\n\r\n function validaMinHoraFinal() {\r\n if (!recebimentos.selectedFisico) {\r\n return true;\r\n }\r\n\r\n var dataHoraFinalRec = recebimentos.selectedFisico.DataHoraUTCFimRecebimentoFisico;\r\n var dataHoraInicialRec = recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisico;\r\n var dataHoraInicioTurno = recebimentos.SelTurnoService.turno.DataInicial;\r\n var minDate = dataHoraInicioTurno > dataHoraInicialRec ? dataHoraInicioTurno : dataHoraInicialRec;\r\n\r\n if (!dataHoraFinalRec) {\r\n return true;\r\n }\r\n\r\n return dataHoraFinalRec > minDate;\r\n }\r\n\r\n function validaMinHoraInicial() {\r\n if (!recebimentos.selectedFisico) {\r\n return true;\r\n }\r\n\r\n if (!isSameTurnoInicioFisico()) {\r\n return true;\r\n }\r\n\r\n return recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisico >= recebimentos.SelTurnoService.turno.DataInicial;\r\n }\r\n\r\n function validaMaxHoraInicial() {\r\n if (!recebimentos.selectedFisico) {\r\n return true;\r\n }\r\n\r\n if (!isSameTurnoInicioFisico()) {\r\n return true;\r\n }\r\n\r\n var dataHoraFinalRec = recebimentos.selectedFisico.DataHoraUTCFimRecebimentoFisico;\r\n var dataHoraInicialRec = recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisico;\r\n var dataHoraFinalTurno = recebimentos.SelTurnoService.turno.DataFinal;\r\n var menorQueTurno = dataHoraInicialRec <= dataHoraFinalTurno;\r\n\r\n return dataHoraFinalRec ? dataHoraInicialRec < dataHoraFinalRec && menorQueTurno : menorQueTurno;\r\n }\r\n\r\n recebimentos.cleanSearchTerm = function (fieldName) {\r\n recebimentos[fieldName] = '';\r\n };\r\n\r\n $element.find('input').on('keydown', function (ev) {\r\n ev.stopPropagation();\r\n });\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n\r\n function inicializacao() {\r\n recebimentos.SelTurnoService.onChangeTurno(onChangeTurno);\r\n SelTurnoService.canSelect = true;\r\n SelTurnoService.selectTurno().then(onChangeTurno).catch(console.log);\r\n recebimentos.getComplexos();\r\n recebimentos.getTurno();\r\n recebimentos.getPostos();\r\n recebimentos.getPostosByIdc(recebimentos.SelTurnoService.getIdcPosto());\r\n\r\n BarCodeService.init(function (code) {\r\n if (!code || code === \"null\") return;\r\n\r\n $timeout(function () {\r\n alert(code);\r\n\r\n recebimentos.isTelaConsuta = false;\r\n recebimentos.selected = JSON.parse(localStorage.getItem(\"recebimentos.selected\"));\r\n localStorage.removeItem(\"recebimentos.selected\");\r\n\r\n $timeout(function () {\r\n recebimentos.selected.CodigoBarrasNotaFiscal = code;\r\n recebimentos.changeBarcode();\r\n });\r\n\r\n }, 2000);\r\n });\r\n\r\n AssociacaoRecebimentoModel.VerificaCanada(recebimentos.SelTurnoService.turno.IdcPosto)\r\n .then(function (resposta) {\r\n console.log(resposta)\r\n if (resposta) {\r\n window.location.href = '/mobile/#!/recebimentoFisico'\r\n }\r\n })\r\n CaminhaoTanqueModel.getAll().then(function (caminhoes) {\r\n recebimentos.caminhoes = $filter('orderBy')(caminhoes, 'CodPlaca');\r\n });\r\n\r\n CavaloMecanicoModel.getAll().then(function (cavalos) {\r\n recebimentos.cavalos = $filter('orderBy')(cavalos, 'CodPlaca');\r\n });\r\n\r\n NavioTanqueModel.getAll().then(function (navios) {\r\n recebimentos.navios = $filter('orderBy')(navios, 'CodNavioTanque');\r\n });\r\n\r\n VagaoTanqueModel.getAll().then(function (vagoes) {\r\n recebimentos.vagoes = $filter('orderBy')(vagoes, 'CodVagaoTanque');\r\n });\r\n\r\n MotoristaModel.getAll().then(function (motoristas) {\r\n recebimentos.motoristas = $filter('orderBy')(motoristas, 'NomMotorista');\r\n });\r\n\r\n EmpresaModel.getTransportadoras().then(function (empresas) {\r\n recebimentos.transportadoras = $filter('orderBy')(empresas, 'NomEmpresa');\r\n });\r\n\r\n EmpresaModel.getFornecedores().then(function (empresas) {\r\n recebimentos.fornecedores = $filter('orderBy')(empresas, 'NomEmpresa');\r\n });\r\n\r\n }\r\n\r\n recebimentos.isClosedShift = function () {\r\n return recebimentos.SelTurnoService.turno.StuTurno == \"AB\" ? false : true;\r\n }\r\n\r\n function getAssociacoes() {\r\n AssociacaoRecebimentoModel.getAllRecebimentos()\r\n .then(function (resposta) {\r\n recebimentos.listaRecebimentos = resposta;\r\n for (var i = 0; i < recebimentos.listaRecebimentos.length; i++) {\r\n recebimentos.listaRecebimentos[i].DataHoraUTCCriacaoSearch =\r\n $filter('date')(\r\n recebimentos.listaRecebimentos[i].DataHoraUTCCriacao,\r\n TranslateService('datetime-format')\r\n );\r\n if(recebimentos.listaRecebimentos[i].DataHoraUTCEndSearch.getFullYear() != 0){\r\n recebimentos.listaRecebimentos[i].DataHoraUTCEndSearch =\r\n $filter('date')(\r\n recebimentos.listaRecebimentos[i].DataHoraUTCEndSearch,\r\n TranslateService('datetime-format')\r\n );\r\n }else{\r\n //recebimentos.listaRecebimentos[i].DataHoraUTCEndSearch = \"00/00/0000 00:00\"\r\n }\r\n }\r\n });\r\n }\r\n\r\n recebimentos.getPostosByIdc = function (Idcposto) {\r\n if (Idcposto)\r\n PostoModel.getAllSameComplexo(Idcposto)\r\n .then(function (resposta) {\r\n recebimentos.listaPosto = resposta.sort(function (a, b) {\r\n return a.DscPosto < b.DscPosto ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n recebimentos.getPostos = function (posto) {\r\n if (posto)\r\n PostoModel.getAllSameUnidade(posto.IdcUnidade)\r\n .then(function (resposta) {\r\n recebimentos.listaPosto = resposta.sort(function (a, b) {\r\n return a.DscPosto < b.DscPosto ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n recebimentos.loadPosto = function (posto) {\r\n recebimentos.getPostos(posto)\r\n }\r\n\r\n recebimentos.getTurno = function () {\r\n CadTurnoModel.getAll()\r\n .then(function (resposta) {\r\n recebimentos.listaTurno = resposta.sort(function (a, b) {\r\n return a.DscTurno < b.DscTurno ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n recebimentos.getAllByIdcPosto = function () {\r\n return ProdutoModel.getAllByIdcPosto(SelTurnoService.getIdcPosto())\r\n .then(function (produtos) {\r\n recebimentos.produtos = produtos;\r\n });\r\n }\r\n\r\n recebimentos.getAll = function () {\r\n ProdutoModel.getAll()\r\n .then(function (produtos) {\r\n recebimentos.produtos = produtos;\r\n });\r\n }\r\n\r\n recebimentos.changeProdutoEmFisico = function () {\r\n recebimentos.selectedFisico.IdentificadorProdutoPosto = recebimentos.Produto;\r\n recebimentos.selectedFiscal.IdentificadorProdutoNotaFiscal = recebimentos.Produto;\r\n }\r\n recebimentos.changeProdutoEmFiscal = function () {\r\n recebimentos.selectedFisico.IdentificadorProdutoPosto = recebimentos.Produto;\r\n recebimentos.selectedFiscal.IdentificadorProdutoNotaFiscal = recebimentos.Produto;\r\n }\r\n\r\n recebimentos.changeInitialTimeFisico = function () {\r\n if (!recebimentos.selectedFisico.IdentificadorRecebimentoFisicoProduto) {\r\n recebimentos.openModalSelectionRecebimentoFisico();\r\n }\r\n recebimentos.validacaoFisico.changeTime(recebimentos.selectedFisico, 'DataHoraUTCInicioRecebimentoFisico')\r\n }\r\n\r\n recebimentos.getUnidadesBySqlSglComplexo = function (SglComplexo) {\r\n if (SglComplexo)\r\n UnidadeModel.getAllSameComplexo(SglComplexo)\r\n .then(function (resposta) {\r\n recebimentos.listaUnidade = resposta.sort(function (a, b) {\r\n return a.DscUnidade < b.DscUnidade ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n\r\n recebimentos.getUnidadesBySqlIdcComplexo = function (IdcComplexo) {\r\n var Complexo = recebimentos.listaComplexo.filter(function (a) {\r\n return a.IdcComplexo == IdcComplexo;\r\n })[0];\r\n if (Complexo.SglComplexo)\r\n UnidadeModel.getAllSameComplexo(Complexo.SglComplexo)\r\n .then(function (resposta) {\r\n recebimentos.listaUnidade = resposta.sort(function (a, b) {\r\n return a.DscUnidade < b.DscUnidade ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n recebimentos.loadUnidade = function (IdcComplexo) {\r\n recebimentos.getUnidadesBySqlIdcComplexo(IdcComplexo)\r\n }\r\n\r\n recebimentos.getComplexos = function () {\r\n ComplexoModel.getAll()\r\n .then(function (resposta) {\r\n recebimentos.listaComplexo = resposta.sort(function (a, b) {\r\n return a.DscComplexo < b.DscComplexo ? -1 : 1;\r\n });\r\n });\r\n }\r\n\r\n\r\n $scope.comparatorFiscal = function (input, search_param) {\r\n if (input && (input.CodigoDANFENotaFiscal || input.QuantidadeProdutoNotaFiscal || input.DataHoraUTCInicioRecebimentoFiscal)) {\r\n return (String(input.CodigoDANFENotaFiscal).includes(search_param) ||\r\n String(input.QuantidadeProdutoNotaFiscal).includes(search_param) ||\r\n String(input.DataHoraUTCInicioRecebimentoFiscal).includes(search_param));\r\n }\r\n else {\r\n return angular.equals(input, search_param);\r\n }\r\n };\r\n\r\n $scope.comparatorFisico = function (input, search_param) {\r\n if (input && (input.quant || input.DataHoraUTCInicioRecebimentoFisico)) {\r\n return (String(input.quant).includes(search_param) ||\r\n String(input.DataHoraUTCInicioRecebimentoFisico).includes(search_param));\r\n }\r\n else {\r\n return angular.equals(input, search_param);\r\n }\r\n };\r\n\r\n function insertOrRemove(list, item, key) {\r\n var index = recebimentos.indexOfItem(list, item, key);\r\n if (index === -1) {\r\n list.push(item);\r\n } else {\r\n list.splice(index, 1);\r\n }\r\n }\r\n\r\n function formatLitros(number) {\r\n number = number || 0;\r\n return number.toFixed(2) + \" \" + TranslateService('litros');\r\n }\r\n\r\n function formartPercentual(number) {\r\n number = number || 0;\r\n number = number === -Infinity ? -100 : number;\r\n return number.toFixed(2) + \"%\";\r\n }\r\n\r\n function getTotalFiscal(associacao) {\r\n return associacao\r\n .ListRecebimentoFiscalProduto\r\n .reduce(function (sum, fiscal) {\r\n return !fiscal.Desassociar ? fiscal.QuantidadeProdutoNotaFiscal + sum : sum;\r\n }, 0);\r\n }\r\n\r\n function getTotalFisico(associacao) {\r\n return associacao\r\n .ListRecebimentoFisicoProduto\r\n .reduce(function (sum, fisico) {\r\n return !fisico.Desassociar ? recebimentos.getQuantidadeRecebimento(fisico) + sum : sum;\r\n }, 0);\r\n }\r\n\r\n function getEstoqueInicial(associacao) {\r\n return getEstoque(associacao, \"QuantidadeProdutoInicial\");\r\n }\r\n\r\n function getEstoqueFinal(associacao) {\r\n return getEstoque(associacao, \"QuantidadeProdutoFinal\");\r\n }\r\n\r\n function getEstoque(associacao, prop) {\r\n return associacao\r\n .ListRecebimentoFisicoProduto\r\n .reduce(function (sum, fisico) {\r\n return !fisico.Cancelado ? sum + fisico\r\n .ListApuracaoRecebimentoProdutoTanquePosto\r\n .reduce(function (sum2, apuracao) {\r\n return sum2 + apuracao[prop];\r\n }, 0) : sum;\r\n }, 0);\r\n }\r\n\r\n function resetTela() {\r\n getAssociacoes();\r\n recebimentos.selected = null;\r\n recebimentos.selectedFiscal = null;\r\n recebimentos.selectedFisico = null;\r\n recebimentos.isTelaConsuta = true;\r\n recebimentos.isEditarFiscal = false;\r\n recebimentos.isEditarFisico = false;\r\n recebimentos.lastIndexFisico = 1;\r\n recebimentos.lastIndexFiscal = 1;\r\n recebimentos.standardProduto = null;\r\n recebimentos.produto = null;\r\n recebimentos.tabselector = 'firsttab';\r\n recebimentos.isEditing = false;\r\n SelTurnoService.canSelect = true;\r\n\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n }\r\n\r\n function criaNovoRecebimentoFiscal(tipo) {\r\n recebimentos.IndicadorTipoRecebimento = tipo;\r\n\r\n if (recebimentos.standardProduto)\r\n recebimentos.produto = recebimentos.standardProduto;\r\n\r\n return {\r\n\r\n //Informações preenchidas automáticamente pelo sistema\r\n \"dataFinalOriginal\": true,\r\n \"index\": 0,\r\n \"IdentificadorRecebimentoFiscalProduto\": 0,\r\n \"IdentificadorGrupoRecebimentoFisicoFiscal\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorPostoAbastecimento\": SelTurnoService.turno.IdcPosto,\r\n \"IdentificadorAberturaFechamentoTurnoPosto\": SelTurnoService.turno.IdcRegTurno,\r\n \"IdentificadorUsuarioResponsavelRecebimento\": UsuarioService.indice,\r\n \"NomeSistemaOrigemDado\": 'WEB-MOBILE',\r\n \"PreCadastro\": 'N',\r\n \"SglComplexo\": recebimentos.SelTurnoService.turno.SglComplexo,\r\n \"SglUnidade\": recebimentos.SelTurnoService.turno.SglUnidade,\r\n \"SglPosto\": recebimentos.SelTurnoService.turno.SglPosto,\r\n \"SglTurno\": recebimentos.SelTurnoService.turno.SglTurno,\r\n //Informações preenchidas pelo usuário\r\n \"DataHoraUTCInicioRecebimentoFiscal\": ValidacaoService.getNowTurno(),\r\n \"DataHoraUTCFimRecebimentoFiscal\": ValidacaoService.getNowTurnoMaisUmMinuto(),\r\n \"CodigoBarrasNotaFiscal\": null,\r\n \"CodigoDANFENotaFiscal\": null,\r\n \"DataEmissaoNotaFiscal\": null,\r\n \"IdentificadorEmpresaFornecedora\": null,\r\n \"IdentificadorEmpresaTransportadora\": null,\r\n \"IdentificadorCavaloMecanico\": null,\r\n \"IdentificadorCaminhaoTanque\": null,\r\n \"IdentificadorCaminhaoCompartimento\": null,\r\n \"IdentificadorMotoristaCavaloCaminhaoTanque\": null,\r\n \"NumeroIdentificacaoLacres\": null,\r\n \"QuantidadeLacres\": null,\r\n \"CodigoHexadecimalCorLacres\": null,\r\n \"IdentificadorProdutoNotaFiscal\": recebimentos.standardProduto ? recebimentos.standardProduto : null,\r\n \"QuantidadeProdutoNotaFiscal\": null,\r\n \"PrecoUnitarioProdutoNotaFiscal\": null,\r\n\r\n \"PesoLiquidoNotaFiscal\": null,\r\n \"PesoBrutoNotaFiscal\": null,\r\n \"PesoBrutoVale\": null,\r\n\r\n \"DataHoraUTCChegadaCaminhaoPortaria\": null,\r\n \"DataHoraUTCEntradaCaminhaoPortaria\": null,\r\n \"DataHoraUTCSaidaCaminhaoPortaria\": null,\r\n\r\n \"IdentificadorVagaoTanque\": null,\r\n\r\n \"IndicadorTipoRecebimento\": tipo,\r\n\r\n // Informações de entidades associadas que são preenchidas \r\n // no backend através dos ids\r\n \"CadCaminhaoTanque\": null,\r\n \"CadCavaloMecanico\": null,\r\n \"CadEmpresaFornecedora\": null,\r\n \"CadEmpresaTransportadora\": null,\r\n \"CadMotorista\": null,\r\n \"CadPosto\": null,\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioResponsavelRecebimento\": null,\r\n \"RegTurno\": recebimentos.SelTurnoService.turno,\r\n \"Desassociar\": false\r\n };\r\n }\r\n\r\n function criaNovoRecebimentoFisico(tipo) {\r\n recebimentos.IndicadorTipoRecebimento = tipo;\r\n if (recebimentos.standardProduto)\r\n recebimentos.produto = recebimentos.standardProduto;\r\n\r\n return {\r\n \"Anomalias\": [],\r\n \"index\": 0,\r\n \"IdentificadorRecebimentoFisicoProduto\": 0,\r\n \"IdentificadorGrupoRecebimentoFisicoFiscal\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorProdutoPosto\": recebimentos.produtos.length ? recebimentos.produtos[0].IdcProduto : 0,\r\n \"DataHoraUTCInicioRecebimentoFisico\": ValidacaoService.getNowTurno(),\r\n \"SglComplexo\": recebimentos.SelTurnoService.turno.SglComplexo,\r\n \"SglUnidade\": recebimentos.SelTurnoService.turno.SglUnidade,\r\n \"SglPosto\": recebimentos.SelTurnoService.turno.SglPosto,\r\n \"SglTurno\": recebimentos.SelTurnoService.turno.SglTurno,\r\n \"IdentificadorUsuarioResponsavelInicioRecebimento\": UsuarioService.indice,\r\n \"IdentificadorAberturaFechamentoTurnoInicioRecebimento\": SelTurnoService.getIdcRegTurno(),\r\n \"DataHoraUTCFimRecebimentoFisico\": null,\r\n \"IdentificadorUsuarioResponsavelTerminoRecebimento\": null,\r\n \"IdentificadorAberturaFechamentoTurnoTerminoRecebimento\": null,\r\n \"IndicadorUtilizacaoSkid\": 'S',\r\n \"IndicadorConcordanciaMotorista\": 'S',\r\n\r\n \"IndicadorSituacao\": 'AB',\r\n \"NomeSistemaOrigemDado\": 'WEB-MOBILE',\r\n \"IdentificadorCargaMassaMovimentacao\": null,\r\n \"IndicadorTipoRecebimento\": tipo,\r\n\r\n \"IdentificadorCavaloMecanico\": null,\r\n \"IdentificadorCaminhaoTanque\": null,\r\n\r\n \"IdentificadorVagaoTanque\": null,\r\n\r\n \"IdentificadorNavioTanque\": null,\r\n \"IdcPosto\":null,\r\n\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioResponsavelInicioRecebimento\": null,\r\n \"CadUsuarioResponsavelTerminoRecebimento\": null,\r\n \"RegTurnoInicio\": null,\r\n \"RegTurnoTermino\": null,\r\n \"ListDetalheRecebimentoProduto\": tipo === 'C' ? [] : [criaDetalhe()],\r\n \"ListApuracaoRecebimentoProdutoTanquePosto\": recebimentos.tanquesPosto.map(criaApuracao),\r\n \"Desassociar\": false\r\n };\r\n }\r\n function criaNovaAssociacao(tipo) {\r\n recebimentos.IndicadorTipoRecebimento = tipo;\r\n\r\n\r\n recebimentos.selectedFisico = criaNovoRecebimentoFisico(tipo);\r\n recebimentos.selectedFiscal = criaNovoRecebimentoFiscal(tipo);\r\n return {\r\n \"IdentificadorGrupoRecebimentoFisicoFiscal\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorDiretoria\": 1, //TODO incluir esta informação\r\n \"IndicadorSituacao\": \"A\", // A: aberto F: Fechado\r\n \"IndicadorTipoRecebimento\": tipo,\r\n \"IdentificadorProduto\": 0,\r\n\r\n \"CodigoGrupoRecebimento\": null,\r\n\r\n //São preenchidos automáticamento ao selecionar as associações\r\n \"QuantidadeProdutoTotalNotasFiscais\": 0.0,\r\n \"QuantidadeProdutoTotalRecebida\": 0.0,\r\n \"QuantidadeProdutoDivergencia\": 0.0,\r\n \"ListRecebimentoFiscalProduto\": [],\r\n \"ListRecebimentoFisicoProduto\": [],\r\n\r\n //Informações do fechamento\r\n \"DataHoraUTCFechamento\": null,\r\n \"IdentificadorUsuarioResponsavelFechamento\": null,\r\n\r\n //Informações de simples referencia\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioFechamento\": null,\r\n \"Edited\": false\r\n };\r\n\r\n \r\n \r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n recebimentos.indexOfItem = function (list, item, propKey) {\r\n for (var i = 0; i < list.length; i++) {\r\n if (list[i][propKey] === item[propKey]) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n recebimentos.isInludedFisico = function (fisico) {\r\n if (!recebimentos.selected) { return; }\r\n\r\n return recebimentos.indexOfItem(\r\n recebimentos.selected.ListRecebimentoFisicoProduto,\r\n fisico,\r\n 'IdentificadorRecebimentoFisicoProduto'\r\n ) !== -1;\r\n };\r\n\r\n recebimentos.isInludedFiscal = function (fiscal) {\r\n if (!recebimentos.selected) { return; }\r\n\r\n return recebimentos.indexOfItem(\r\n recebimentos.selected.ListRecebimentoFiscalProduto,\r\n fiscal,\r\n 'IdentificadorRecebimentoFiscalProduto'\r\n ) !== -1;\r\n };\r\n\r\n function setCacheDates(associaoCompleta) {\r\n recebimentos.CadPosto = null;\r\n for (var i = 0; i < associaoCompleta.ListRecebimentoFiscalProduto.length; i++) {\r\n if (!recebimentos.CadPosto) {\r\n recebimentos.CadPosto = associaoCompleta.ListRecebimentoFiscalProduto[i].CadPosto;\r\n }\r\n }\r\n }\r\n\r\n recebimentos.getstandardProduto = function () {\r\n recebimentos.standardProduto = recebimentos.selected.IdentificadorProduto;\r\n }\r\n recebimentos.recebimentosClick = function (associacao) {\r\n AssociacaoRecebimentoModel.getByIdRecebimento(associacao.IdentificadorGrupoRecebimentoFisicoFiscal)\r\n .then(function (resposta) {\r\n if (resposta.length) {\r\n var associaoCompleta = resposta[0];\r\n setCacheDates(associaoCompleta);\r\n recebimentos.editar(associaoCompleta);\r\n recebimentos.tabselector = 'firsttab'\r\n } else {\r\n MessageService.alert(\"erro\");\r\n }\r\n });\r\n };\r\n\r\n recebimentos.atualizar = function () {\r\n getAssociacoes();\r\n };\r\n\r\n function isFreeDateTimeFiscal(recebimento) {\r\n var isFreeDateTime = true;\r\n var newDate = recebimento.DataHoraUTCInicioRecebimentoFiscal.toString();\r\n var currentDate = null;\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFiscalProduto.length; i++) {\r\n currentDate = recebimentos.selected.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscal.toString();\r\n if(recebimentos.selected.ListRecebimentoFiscalProduto[i].IdentificadorRecebimentoFiscalProduto > 0){\r\n if( recebimentos.selected.ListRecebimentoFiscalProduto[i].IdentificadorRecebimentoFiscalProduto != recebimento.IdentificadorRecebimentoFiscalProduto){\r\n if(currentDate === newDate){\r\n isFreeDateTime = false;\r\n }\r\n }\r\n }else{\r\n if( recebimentos.selected.ListRecebimentoFiscalProduto[i].index != recebimento.index){\r\n if(currentDate === newDate){\r\n isFreeDateTime = false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return isFreeDateTime;\r\n }\r\n\r\n recebimentos.adicionarNota = function (recebimentosFiscal, formRecebimentoFiscal) {\r\n if (recebimentos.selectedFiscal.CodBarrasDuplicado) {\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('danfe-duplicated', recebimentos.selectedFiscal.CodigoBarrasNotaFiscal));\r\n }\r\n else if(!isFreeDateTimeFiscal(recebimentosFiscal)){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n RecebimentoFiscalModel.existeRecebimentoNessaDataHora(recebimentosFiscal.DataHoraUTCInicioRecebimentoFiscal, SelTurnoService.getIdcRegTurno(), recebimentosFiscal.IdentificadorRecebimentoFiscalProduto)\r\n .then(function (resposta) {\r\n if(resposta.length > 0){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n if (recebimentosFiscal.IdentificadorProdutoNotaFiscal == null ||\r\n recebimentosFiscal.IdentificadorProdutoNotaFiscal == 0) {\r\n recebimentosFiscal.IdentificadorProdutoNotaFiscal = recebimentos.standardProduto || recebimentos.produto\r\n }\r\n\r\n if (recebimentosFiscal.IdentificadorProdutoNotaFiscal) {\r\n recebimentos.standardProduto = recebimentos.produto\r\n recebimentosFiscal.SglProduto = recebimentos.produtos.filter(function (a) {\r\n return a.IdcProduto == recebimentosFiscal.IdentificadorProdutoNotaFiscal;\r\n })[0].SglProduto;\r\n }\r\n\r\n recebimentosFiscal.IdentificadorGrupoRecebimentoFisicoFiscal = 0\r\n recebimentosFiscal.DataHoraUTCInicioRecebimentoFiscalDesc =\r\n $filter('date')(\r\n recebimentosFiscal.DataHoraUTCInicioRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n recebimentosFiscal.index = recebimentos.lastIndexFiscal;\r\n recebimentos.selectedFiscal.$valid = formRecebimentoFiscal.$valid;\r\n recebimentos.selectedFiscal.produtos = recebimentos.produtos;\r\n \r\n CheckRecebimentoFiscal(recebimentos.selectedFiscal)\r\n .then(function () {\r\n recebimentosFiscal.Edited = true;\r\n recebimentos.selected.ListRecebimentoFiscalProduto.push(recebimentosFiscal);\r\n recebimentos.lastIndexFiscal++;\r\n recebimentos.selectedFiscal = null;\r\n recebimentos.preCreateAbaFiscal(recebimentos.IndicadorTipoRecebimento)\r\n });\r\n }\r\n });\r\n }\r\n }\r\n function isFreeDateTimeFisico(recebimento) {\r\n var isFreeDateTime = true;\r\n var newDate = recebimento.DataHoraUTCInicioRecebimentoFisico.toString();\r\n var currentDate = null;\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFisicoProduto.length; i++) {\r\n currentDate = recebimentos.selected.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisico.toString();\r\n if(recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorRecebimentoFisicoProduto > 0){\r\n if(recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorRecebimentoFisicoProduto != recebimento.IdentificadorRecebimentoFisicoProduto){\r\n if(currentDate === newDate){\r\n isFreeDateTime = false;\r\n }\r\n }\r\n }else{\r\n if(recebimentos.selected.ListRecebimentoFisicoProduto[i].index != recebimento.index){\r\n if(currentDate === newDate){\r\n isFreeDateTime = false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return isFreeDateTime;\r\n }\r\n\r\n recebimentos.adicionarRecebimentoFisico = function (recebimentosFisico, formRecebimentoFisico) {\r\n if(!isFreeDateTimeFisico(recebimentosFisico)){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n RecebimentoFisicoModel.existeRecebimentoNessaDataHora(recebimentosFisico.DataHoraUTCInicioRecebimentoFisico, SelTurnoService.getIdcRegTurno(), recebimentosFisico.IdentificadorRecebimentoFisicoProduto)\r\n .then(function (resposta) {\r\n if(resposta.length > 0){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n recebimentosFisico.IdentificadorProdutoPosto = recebimentos.produto;\r\n\r\n if (recebimentosFisico.IdentificadorProdutoPosto) {\r\n recebimentos.standardProduto = recebimentos.produto\r\n recebimentosFisico.SglProduto = recebimentos.produtos.filter(function (a) {\r\n return a.IdcProduto == recebimentosFisico.IdentificadorProdutoPosto;\r\n })[0].SglProduto;\r\n }\r\n\r\n if (recebimentosFisico.DataHoraUTCFimRecebimentoFisico) {\r\n recebimentosFisico.IdentificadorAberturaFechamentoTurnoTerminoRecebimento = SelTurnoService.getIdcRegTurno();\r\n recebimentosFisico.IndicadorSituacao = 'FE';\r\n }\r\n\r\n recebimentosFisico.IndicadorUtilizacaoSkidDesc = recebimentosFisico.IndicadorUtilizacaoSkid === 'S' ? TranslateService('sim') : TranslateService('nao');\r\n recebimentosFisico.IdcPosto = recebimentos.SelTurnoService.turno.IdcPosto;\r\n recebimentosFisico.SglPosto = recebimentos.SelTurnoService.turno.SglPosto;\r\n recebimentosFisico.SglTurno = recebimentos.SelTurnoService.turno.SglTurno;\r\n recebimentosFisico.qtd = getQuantidadeRecebimento(recebimentos.selectedFisico)\r\n recebimentosFisico.DataHoraUTCInicioRecebimentoFisicoDesc =\r\n $filter('date')(\r\n recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n recebimentos.selectedFisico.$valid = formRecebimentoFisico.$valid;\r\n CheckRecebimentoFisico(recebimentos.selectedFisico)\r\n .then(function () {\r\n recebimentosFisico.Edited = true;\r\n recebimentosFisico.index = recebimentos.lastIndexFisico;\r\n recebimentos.selected.ListRecebimentoFisicoProduto.push(recebimentosFisico);\r\n recebimentos.lastIndexFisico++;\r\n recebimentos.selectedFisico = null;\r\n recebimentos.preCreateAbaFisico(recebimentos.IndicadorTipoRecebimento)\r\n });\r\n\r\n if (recebimentosFisico.IdentificadorRecebimentoFisicoProduto && recebimentosFisico.IdentificadorRecebimentoFisicoProduto) {\r\n recebimentosFisico.IdentificadorGrupoRecebimentoFisicoFiscal = 0;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n recebimentos.setProtutoEmAbas = function (abas) {\r\n if (abas.IdentificadorProdutoNotaFiscal) {\r\n recebimentos.produto = abas.IdentificadorProdutoNotaFiscal\r\n recebimentos.standardProduto = abas.IdentificadorProdutoNotaFiscal\r\n } else if (abas.IdentificadorProdutoPosto) {\r\n recebimentos.produto = abas.IdentificadorProdutoPosto\r\n recebimentos.standardProduto = abas.IdentificadorProdutoPosto\r\n } else {\r\n recebimentos.produto = null;\r\n recebimentos.standardProduto = null;\r\n }\r\n }\r\n\r\n recebimentos.getNotaFiscal = function (produtoFiscal) {\r\n RecebimentoFiscalModel.isEmAvaliacao(produtoFiscal.IdentificadorRecebimentoFiscalProduto)\r\n .then(function (resposta) {\r\n if (resposta) {\r\n MessageService.alert(TranslateService(\"receb-em-validacao\"));\r\n recebimentos.isEmAvaliacao = resposta;\r\n recebimentos.idEmAvaliacaoFiscal = produtoFiscal.IdentificadorRecebimentoFiscalProduto;\r\n } else {\r\n recebimentos.setProtutoEmAbas(produtoFiscal);\r\n recebimentos.isEditing = true;\r\n recebimentos.isEmAvaliacao = resposta;\r\n recebimentos.isEditarFiscal = true;\r\n recebimentos.selectedFiscal = produtoFiscal;\r\n recebimentos.selectedFiscal.SglComplexo = produtoFiscal.SglComplexo;\r\n recebimentos.selectedFiscal.SglUnidade = produtoFiscal.SglUnidade;\r\n recebimentos.selectedFiscal.SglPosto = produtoFiscal.CadPosto ? produtoFiscal.CadPosto.SglPosto : null;\r\n recebimentos.selectedFiscal.SglTurno = produtoFiscal.RegTurno ? produtoFiscal.RegTurno.SglTurno : null;\r\n //recebimentos.getPostos(produtoFiscal.CadPosto);\r\n recebimentos.selectedFiscal.diadanfe = getDiaDanfe(produtoFiscal)\r\n recebimentos.selectedFiscal.LastCodigoDANFENotaFiscal = recebimentos.selectedFiscal.CodigoDANFENotaFiscal;\r\n recebimentos.changeCaminhaoRecebimentoFiscal();\r\n recebimentos.changeMotorista();\r\n }\r\n });\r\n\r\n\r\n\r\n function getDiaDanfe(produtoFiscal) {\r\n return produtoFiscal.DataEmissaoNotaFiscal.getDate()\r\n }\r\n }\r\n\r\n recebimentos.getNotaFisico = function (produtoFisico) {\r\n RecebimentoFisicoModel.isEmAvaliacao(produtoFisico.IdentificadorRecebimentoFisicoProduto)\r\n .then(function (resposta) {\r\n if (resposta) {\r\n MessageService.alert(TranslateService(\"receb-em-validacao\"));\r\n recebimentos.isEmAvaliacao = resposta;\r\n recebimentos.idEmAvaliacaoFisico = produtoFisico.IdentificadorRecebimentoFisicoProduto;\r\n } else {\r\n produtoFisico.ListDetalheRecebimentoProduto = produtoFisico.ListDetalheRecebimentoProduto.sort(function (a, b) {\r\n return a.IdentificadorDetalheRecebimentoProduto - b.IdentificadorDetalheRecebimentoProduto;\r\n });\r\n recebimentos.isEditing = true;\r\n recebimentos.isEmAvaliacao = resposta;\r\n recebimentos.isEditarFisico = true;\r\n recebimentos.selectedFisico = produtoFisico;\r\n recebimentos.selectedFisico.qtd = getQuantidadeRecebimento(recebimentos.selectedFisico);\r\n recebimentos.selectedFisico.SglPosto = produtoFisico.SglPosto;\r\n recebimentos.selectedFisico.SglTurno = produtoFisico.SglTurno;\r\n recebimentos.getPostos(produtoFisico.CadPosto);\r\n recebimentos.selectedFisico.IdentificadorProdutoPosto = produtoFisico.IdentificadorProdutoPosto;\r\n recebimentos.produto = recebimentos.selectedFisico.IdentificadorProdutoPosto;\r\n recebimentos.standardProduto = recebimentos.selectedFisico.IdentificadorProdutoPosto;\r\n }\r\n });\r\n }\r\n\r\n recebimentos.editarNota = function (formRecebimentoFiscal) {\r\n if(!isFreeDateTimeFiscal(recebimentos.selectedFiscal)){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n RecebimentoFiscalModel.existeRecebimentoNessaDataHora(recebimentos.selectedFiscal.DataHoraUTCInicioRecebimentoFiscal, SelTurnoService.getIdcRegTurno(), recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto)\r\n .then(function (resposta) {\r\n if(resposta.length > 0 && recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto != resposta[0].IdentificadorRecebimentoFiscalProduto){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n recebimentos.selectedFiscal.$valid = formRecebimentoFiscal.$valid;\r\n recebimentos.selectedFiscal.produtos = recebimentos.produtos;\r\n CheckRecebimentoFiscal(recebimentos.selectedFiscal)\r\n .then(function () {\r\n var tipo = null;\r\n recebimentos.selectedFiscal.DataHoraUTCInicioRecebimentoFiscalDesc =\r\n $filter('date')(\r\n recebimentos.selectedFiscal.DataHoraUTCInicioRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n ValidacaoService.resetForm(formRecebimentoFiscal);\r\n recebimentos.selectedFiscal.Desassociar = false;\r\n recebimentos.selectedFiscal.Edited = true;\r\n recebimentos.isEditing = false;\r\n recebimentos.selectedFiscal.IdentificadorProdutoNotaFiscal = recebimentos.produto;\r\n\r\n if ((recebimentos.getCounter() == 'one' && recebimentos.selectedFiscal.IdentificadorProdutoNotaFiscal)\r\n && (!recebimentos.standardProduto || recebimentos.standardProduto != recebimentos.produto)) {\r\n recebimentos.standardProduto = recebimentos.produto\r\n recebimentos.selectedFiscal.CadProduto = recebimentos.produtos.filter(function (a) {\r\n return a.IdcProduto == recebimentos.selectedFiscal.IdentificadorProdutoNotaFiscal;\r\n })[0];\r\n }\r\n\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFiscalProduto.length; i++) {\r\n tipo = recebimentos.selected.ListRecebimentoFiscalProduto[0].IndicadorTipoRecebimento;\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto[i].IdentificadorRecebimentoFiscalProduto > 0){\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto[i].IdentificadorRecebimentoFiscalProduto == recebimentos.selected.IdentificadorRecebimentoFiscalProduto)\r\n recebimentos.selected.ListRecebimentoFiscalProduto[i] = recebimentos.selectedFiscal;\r\n }else{\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto[i].index == recebimentos.selected.index)\r\n recebimentos.selected.ListRecebimentoFiscalProduto[i] = recebimentos.selectedFiscal;\r\n }\r\n }\r\n recebimentos.selectedFiscal = null;\r\n recebimentos.isEditarFiscal = false;\r\n recebimentos.selectedFiscal = criaNovoRecebimentoFiscal(tipo);\r\n ValidacaoService.resetForm(formRecebimentoFiscal);\r\n });\r\n }\r\n });\r\n }\r\n }\r\n recebimentos.editarFisico = function (formRecebimentoFisico) {\r\n if(!isFreeDateTimeFisico(recebimentos.selectedFisico)){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n RecebimentoFisicoModel.existeRecebimentoNessaDataHora(recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisico, SelTurnoService.getIdcRegTurno(), recebimentos.selectedFisico.IdentificadorRecebimentoFisicoProduto)\r\n .then(function (resposta) {\r\n if(resposta.length > 0 && recebimentos.selectedFisico.IdentificadorRecebimentoFisicoProduto != resposta[0].IdentificadorRecebimentoFisicoProduto){\r\n MessageService.alert(TranslateService(\"existe-Receb-DataHora\"));\r\n }else{\r\n recebimentos.selectedFisico.$valid = formRecebimentoFisico.$valid;\r\n CheckRecebimentoFisico(recebimentos.selectedFisico)\r\n .then(function () {\r\n var tipo = null;\r\n ValidacaoService.resetForm(formRecebimentoFisico);\r\n recebimentos.selectedFisico.Cancelado = false;\r\n recebimentos.selectedFisico.Edited = true;\r\n recebimentos.isEditing = false;\r\n recebimentos.selectedFisico.IdentificadorProdutoPosto = recebimentos.produto;\r\n\r\n\r\n if ((recebimentos.getCounter() == 'one' && recebimentos.selectedFisico.IdentificadorProdutoPosto)\r\n && (!recebimentos.standardProduto || recebimentos.standardProduto != recebimentos.produto)) {\r\n recebimentos.standardProduto = recebimentos.produto\r\n recebimentos.selectedFisico.CadProduto = recebimentos.produtos.filter(function (a) {\r\n return a.IdcProduto == recebimentos.selectedFisico.IdentificadorProdutoPosto;\r\n })[0];\r\n }\r\n\r\n\r\n if (recebimentos.selectedFisico.IdentificadorAberturaFechamentoTurnoTerminoRecebimento == null && recebimentos.selectedFisico.DataHoraUTCFimRecebimentoFisico) {\r\n recebimentos.selectedFisico.IdentificadorAberturaFechamentoTurnoTerminoRecebimento = SelTurnoService.getIdcRegTurno();\r\n recebimentos.selectedFisico.IndicadorSituacao = 'FE';\r\n }\r\n\r\n recebimentos.selectedFisico.IndicadorUtilizacaoSkidDesc = recebimentos.selectedFisico.IndicadorUtilizacaoSkid === 'S' ? TranslateService('sim') : TranslateService('nao');\r\n\r\n recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisicoDesc =\r\n $filter('date')(\r\n recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFisicoProduto.length; i++) {\r\n tipo = recebimentos.selected.ListRecebimentoFisicoProduto[0].IndicadorTipoRecebimento;\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorRecebimentoFisicoProduto > 0) {\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorRecebimentoFisicoProduto == recebimentos.selectedFisico.IdentificadorRecebimentoFisicoProduto) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i] = recebimentos.selectedFisico;\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].qtd = getQuantidadeRecebimento(recebimentos.selected.ListRecebimentoFisicoProduto[i])\r\n recebimentos.selected.QuantidadeProdutoTotalRecebida = getQuantidadeRecebimento(recebimentos.selected.ListRecebimentoFisicoProduto[i])\r\n }\r\n }else{\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].index == recebimentos.selectedFisico.index) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i] = recebimentos.selectedFisico;\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].qtd = getQuantidadeRecebimento(recebimentos.selected.ListRecebimentoFisicoProduto[i])\r\n recebimentos.selected.QuantidadeProdutoTotalRecebida = getQuantidadeRecebimento(recebimentos.selected.ListRecebimentoFisicoProduto[i])\r\n }\r\n }\r\n }\r\n recebimentos.selectedFisico = null;\r\n recebimentos.isEditarFisico = false;\r\n recebimentos.selectedFisico = criaNovoRecebimentoFisico(tipo);\r\n });\r\n }\r\n });\r\n }\r\n }\r\n\r\n recebimentos.editar = function (associacao) {\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n recebimentos.selected = associacao;\r\n recebimentos.getstandardProduto()\r\n recebimentos.selected.Anomalias = recebimentos.selected.Anomalias || [];\r\n\r\n SelTurnoService.canSelect = false;\r\n recebimentos.isTelaConsuta = false;\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto.length > 0) {\r\n recebimentos.preCreateAbaFiscal(recebimentos.selected.ListRecebimentoFiscalProduto[0].IndicadorTipoRecebimento)\r\n recebimentos.selected.IndicadorTipoRecebimento = recebimentos.selected.ListRecebimentoFiscalProduto[0].IndicadorTipoRecebimento;\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto) {\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFiscalProduto.length; i++) {\r\n recebimentos.selected.ListRecebimentoFiscalProduto[i].index = recebimentos.lastIndexFiscal;\r\n recebimentos.selected.ListRecebimentoFiscalProduto[i].CadProduto = recebimentos.selected.CadProduto;\r\n recebimentos.selected.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscalDesc = $filter('date')(\r\n recebimentos.selected.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n recebimentos.lastIndexFiscal++;\r\n }\r\n }\r\n } else {\r\n recebimentos.preCreateAbaFiscal(recebimentos.selected.IndicadorTipoRecebimento)\r\n }\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto.length > 0) {\r\n recebimentos.preCreateAbaFisico(recebimentos.selected.ListRecebimentoFisicoProduto[0].IndicadorTipoRecebimento)\r\n recebimentos.selected.IndicadorTipoRecebimento = recebimentos.selected.ListRecebimentoFisicoProduto[0].IndicadorTipoRecebimento;\r\n var CadPosto = null;\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFisicoProduto.length; i++) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].index = recebimentos.lastIndexFisico;\r\n CadPosto = recebimentos.listaPosto.filter(function (a) {\r\n return a.IdcPosto == recebimentos.selected.ListRecebimentoFisicoProduto[i].RegTurnoInicioRecebimento.IdcPosto;\r\n })[0];\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].SglPosto = CadPosto.SglPosto;\r\n\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto.length > 0) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].CadPosto = recebimentos.selected.ListRecebimentoFiscalProduto[0].CadPosto;\r\n } else {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].CadPosto = recebimentos.selected.ListRecebimentoFisicoProduto[0].RegTurnoInicioRecebimento.CadPosto;\r\n }\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].qtd = getQuantidadeRecebimento(recebimentos.selected.ListRecebimentoFisicoProduto[i])\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].IndicadorUtilizacaoSkidDesc = recebimentos.selected.ListRecebimentoFisicoProduto[i].IndicadorUtilizacaoSkid == 'S' ? TranslateService('sim') : TranslateService('nao');\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].CadProduto = recebimentos.selected.CadProduto;\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].CadTurno = $filter('filter')(recebimentos.listaTurno, { IdcTurno: recebimentos.selected.ListRecebimentoFisicoProduto[i].RegTurnoInicioRecebimento.IdcTurno }, true)[0];\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisicoDesc = $filter('date')(\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n recebimentos.lastIndexFisico++;\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].Cancelado = false\r\n if (!recebimentos.selected.ListRecebimentoFisicoProduto[i].ListApuracaoRecebimentoProdutoTanquePosto.length) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].ListApuracaoRecebimentoProdutoTanquePosto = recebimentos.tanquesPosto.map(criaApuracao);\r\n }\r\n }\r\n } else {\r\n recebimentos.preCreateAbaFisico(recebimentos.selected.IndicadorTipoRecebimento)\r\n }\r\n\r\n };\r\n\r\n recebimentos.recebimentoFisicoCancel = function (recebimentoFisico) {\r\n\r\n if (recebimentoFisico.IdentificadorRecebimentoFisicoProduto != null) {\r\n if (!recebimentoFisico.Desassociar) {\r\n MessageService.prompt(TranslateService('atention'), TranslateService('recebimento-desassocicao'))\r\n .then(function () {\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto.length) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto.filter(function (a) {\r\n return a.IdentificadorRecebimentoFisicoProduto == recebimentoFisico.IdentificadorRecebimentoFisicoProduto;\r\n })[0].Desassociar = true;\r\n recebimentoFisico.Cancelado = true;\r\n recebimentos.cancelarEditFisico(recebimentoFisico)\r\n }\r\n });\r\n } \r\n // else {\r\n // if (recebimentos.selected.ListRecebimentoFisicoProduto.length) {\r\n // recebimentos.selected.ListRecebimentoFisicoProduto.filter(function (a) {\r\n // return a.IdentificadorRecebimentoFisicoProduto == recebimentoFisico.IdentificadorRecebimentoFisicoProduto;\r\n // })[0].Desassociar = false;//91308\r\n // }\r\n // recebimentoFisico.Cancelado = false;\r\n // }\r\n }\r\n }\r\n\r\n recebimentos.preCreateAbaFiscal = function (tipo) {\r\n recebimentos.selectedFiscal = criaNovoRecebimentoFiscal(tipo)\r\n }\r\n\r\n recebimentos.preCreateAbaFisico = function (tipo) {\r\n recebimentos.selectedFisico = criaNovoRecebimentoFisico(tipo)\r\n }\r\n\r\n recebimentos.novo = function () {\r\n return modalSelTipo.open({ tipos: recebimentos.tipos })\r\n .then(criaNovaAssociacao)\r\n .then(recebimentos.editar)\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n recebimentos.novoFisico = function () {\r\n return modalSelTipo.open({ tipos: recebimentos.tipos })\r\n .then(criaNovoRecebimentoFisico)\r\n .then(recebimentos.editar)\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n recebimentos.cancelar = function () {\r\n resetTela();\r\n };\r\n\r\n recebimentos.editedToSave = function () {\r\n var isEditedToSave = false;\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto.length == 0 &&\r\n recebimentos.selected.ListRecebimentoFisicoProduto.length == 0) {\r\n isEditedToSave = false;\r\n } else {\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFiscalProduto.length; i++) {\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto[i].Edited) {\r\n isEditedToSave = recebimentos.selected.ListRecebimentoFiscalProduto[i].Edited;\r\n }\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto[i].Desassociar) {\r\n isEditedToSave = recebimentos.selected.ListRecebimentoFiscalProduto[i].Desassociar;\r\n }\r\n }\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFisicoProduto.length; i++) {\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].Edited) {\r\n isEditedToSave = recebimentos.selected.ListRecebimentoFisicoProduto[i].Edited;\r\n }\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].Desassociar) {\r\n isEditedToSave = recebimentos.selected.ListRecebimentoFisicoProduto[i].Desassociar;\r\n }\r\n }\r\n }\r\n return isEditedToSave;\r\n };\r\n\r\n recebimentos.hasSameStation = function () {\r\n var SameStation = '';\r\n var physicalStations = [];\r\n var invoiceStation = null;\r\n\r\n if(recebimentos.selected.ListRecebimentoFiscalProduto.length > 0 &&\r\n recebimentos.selected.ListRecebimentoFisicoProduto) {\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFiscalProduto.length; i++) {\r\n invoiceStation = invoiceStation == null\r\n ? !recebimentos.selected.ListRecebimentoFiscalProduto[i].Desassociar\r\n ? recebimentos.selected.ListRecebimentoFiscalProduto[i].SglPosto\r\n : null\r\n : invoiceStation;\r\n if (invoiceStation != null\r\n && !recebimentos.selected.ListRecebimentoFiscalProduto[i].Desassociar\r\n && invoiceStation != recebimentos.selected.ListRecebimentoFiscalProduto[i].SglPosto) {\r\n SameStation = 'fiscal-multiplos-postos';\r\n }\r\n for (var j = 0; j < recebimentos.selected.ListRecebimentoFisicoProduto.length; j++) {\r\n if (!recebimentos.selected.ListRecebimentoFisicoProduto[j].Cancelado\r\n && !physicalStations.includes(recebimentos.selected.ListRecebimentoFisicoProduto[j].SglPosto)) {\r\n physicalStations.push(recebimentos.selected.ListRecebimentoFisicoProduto[j].SglPosto);\r\n }\r\n }\r\n }\r\n if (physicalStations.length > 0 && invoiceStation != null && !physicalStations.includes(invoiceStation)) {\r\n SameStation = 'nao-tem-mesmo-postos';\r\n }\r\n }else{\r\n SameStation = '';\r\n }\r\n \r\n return SameStation;\r\n };\r\n\r\n recebimentos.runSave = function () {\r\n SelTurnoService.checkTurnoFechado(function () {\r\n recebimentos.selected.IdcRegTurnoSalvamento = recebimentos.SelTurnoService.getIdcRegTurno();\r\n if (recebimentos.standardProduto != recebimentos.selected.IdentificadorProduto) {\r\n recebimentos.selected.IdentificadorProduto = recebimentos.standardProduto;\r\n recebimentos.selected.CadProduto = recebimentos.produtos.filter(function (a) {\r\n return a.IdcProduto == recebimentos.standardProduto\r\n })[0];\r\n }\r\n \r\n AssociacaoRecebimentoModel.salvarRecebimento(recebimentos.selected)\r\n .then(function () {\r\n MessageService.alert(\r\n TranslateService('success'),\r\n TranslateService('association-saved')\r\n );\r\n resetTela();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert('Erro', erro);\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('error-saving-association')\r\n );\r\n console.log(erro);\r\n });\r\n });\r\n\r\n }\r\n\r\n recebimentos.salvar = function (isToCloseShift) {\r\n if (isToCloseShift) {\r\n recebimentos.runSave();\r\n } else {\r\n if (!recebimentos.editedToSave()) {\r\n MessageService.alert(\r\n TranslateService('not-edited-item')\r\n );\r\n } else {\r\n var msgSameStation = recebimentos.hasSameStation()\r\n if (msgSameStation && msgSameStation !== '') {\r\n MessageService.alert(\r\n TranslateService(msgSameStation)\r\n );\r\n }\r\n else {\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto.length > 0 && recebimentos.selected.IdentificadorGrupoRecebimentoFisicoFiscal != 0) {\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFisicoProduto.length; i++) {\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorGrupoRecebimentoFisicoFiscal == 0) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorGrupoRecebimentoFisicoFiscal = recebimentos.selected.IdentificadorGrupoRecebimentoFisicoFiscal;\r\n }\r\n }\r\n }\r\n var resumoDivergencia = recebimentos.dadosDivergencia(recebimentos.selected)\r\n if (resumoDivergencia.divergencia && resumoDivergencia.divergencia != 0)\r\n modalDivergencia.open({\r\n locals: {\r\n estoqueInicial: resumoDivergencia.estoqueInicial,\r\n estoqueFinal: resumoDivergencia.estoqueFinal,\r\n distribuido: resumoDivergencia.distribuido,\r\n totalFiscal: resumoDivergencia.totalFiscal,\r\n totalFisico: resumoDivergencia.totalFisico,\r\n divergencia: resumoDivergencia.divergencia,\r\n divergenciaPercentual: resumoDivergencia.divergenciaPercentual,\r\n divergenciaTancagem: resumoDivergencia.divergenciaTancagem,\r\n confirmOperation: true\r\n }\r\n }).then(function (value) {\r\n recebimentos.runSave();\r\n });\r\n else\r\n recebimentos.runSave();\r\n }\r\n }\r\n }\r\n };\r\n\r\n recebimentos.recFiscalClick = function (fiscal) {\r\n insertOrRemove(\r\n recebimentos.selected.ListRecebimentoFiscalProduto,\r\n fiscal,\r\n 'IdentificadorRecebimentoFiscalProduto'\r\n );\r\n };\r\n\r\n recebimentos.recFisicoClick = function (fisico) {\r\n insertOrRemove(\r\n recebimentos.selected.ListRecebimentoFisicoProduto,\r\n fisico,\r\n 'IdentificadorRecebimentoFisicoProduto'\r\n );\r\n };\r\n\r\n recebimentos.changetab = function (item) {\r\n recebimentos.tabselector = item;\r\n //alterar para ser apenas quando for um recebimento e apenas um item\r\n var counter = recebimentos.getCounter();\r\n if (recebimentos.standardProduto != recebimentos.produto && counter == \"one\") {\r\n recebimentos.produto = recebimentos.standardProduto;\r\n }\r\n }\r\n\r\n recebimentos.getQuantidadeRecebimento = function (regRecebimentoFisico) {\r\n if (regRecebimentoFisico.ListDetalheRecebimentoProduto.length == 0)\r\n return 0;\r\n return regRecebimentoFisico.ListDetalheRecebimentoProduto.reduce(function (sum, item) {\r\n return item && item.QuantidadeRecebida ? sum + item.QuantidadeRecebida : sum;\r\n }, 0);\r\n };\r\n\r\n function getQuantidadeRecebimento(regRecebimentoFisico) {\r\n if (regRecebimentoFisico.ListDetalheRecebimentoProduto.length == 0)\r\n return 0;\r\n return regRecebimentoFisico.ListDetalheRecebimentoProduto.reduce(function (sum, item) {\r\n return item && item.QuantidadeRecebida ? sum + item.QuantidadeRecebida : sum;\r\n }, 0);\r\n }\r\n\r\n recebimentos.recebimentoFisicoExcluir = function (recebimentoFisico) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto = recebimentos.selected.ListRecebimentoFisicoProduto.filter(function (item) {\r\n return item.index != recebimentoFisico.index;\r\n });\r\n if (recebimentoFisico.IdentificadorRecebimentoFisicoProduto == recebimentos.selectedFisico.IdentificadorRecebimentoFisicoProduto) {\r\n recebimentos.cancelarEditFisico(recebimentoFisico)\r\n }\r\n }\r\n\r\n recebimentos.recebimentoFiscalExcluir = function (recebimentoFiscal) {\r\n recebimentos.selected.ListRecebimentoFiscalProduto = recebimentos.selected.ListRecebimentoFiscalProduto.filter(function (item) {\r\n return item.index != recebimentoFiscal.index;\r\n });\r\n if (recebimentoFiscal.identificadorRecebimentoFiscalProduto == recebimentos.selectedFiscal.identificadorRecebimentoFiscalProduto) {\r\n recebimentos.cancelarEditFiscal(recebimentoFiscal)\r\n }\r\n }\r\n\r\n recebimentos.registrarAnomalia = function () {\r\n var id = recebimentos.selected ? recebimentos.selected.IdentificadorGrupoRecebimentoFisicoFiscal : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n recebimentos.selected.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n recebimentos.abrir = function () {\r\n recebimentos.selected.DataHoraUTCUltimaAtualizacao = new Date();\r\n recebimentos.selected.IdentificadorUsuarioUltimaAtualizacao = UsuarioService.indice;\r\n recebimentos.selected.IndicadorSituacao = 'A'; //A: Aberto, F: Fechado\r\n recebimentos.selected.Edited = true;\r\n recebimentos.salvar(true);\r\n };\r\n\r\n recebimentos.fechar = function () {\r\n recebimentos.selected.DataHoraUTCFechamento = new Date();\r\n recebimentos.selected.IdentificadorUsuarioResponsavelFechamento = UsuarioService.indice;\r\n recebimentos.selected.IndicadorSituacao = 'F'; //A: Aberto, F: Fechado\r\n recebimentos.selected.Edited = true;\r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFisicoProduto.length; i++) {\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorAberturaFechamentoTurnoTerminoRecebimento == null &&\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].DataHoraUTCFimRecebimentoFisico != null) {\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorAberturaFechamentoTurnoTerminoRecebimento = recebimentos.SelTurnoService.getIdcRegTurno();\r\n recebimentos.selected.ListRecebimentoFisicoProduto[i].IndicadorSituacao = 'FE'\r\n }\r\n }\r\n recebimentos.salvar(true);\r\n };\r\n\r\n recebimentos.dadosDivergencia = function (divergencia) {\r\n var divergenciaObj = {\r\n totalFiscal: getTotalFiscal(divergencia),\r\n totalFisico: getTotalFisico(divergencia),\r\n estoqueInicial: getEstoqueInicial(divergencia),\r\n estoqueFinal: getEstoqueFinal(divergencia),\r\n distribuido: 0 //TODO - Incluir busca de volume distribuido\r\n };\r\n\r\n divergenciaObj.divergencia = divergenciaObj.totalFiscal - divergenciaObj.totalFisico;\r\n divergenciaObj.divergenciaPercentual = ((divergenciaObj.totalFiscal - divergenciaObj.totalFisico) / divergenciaObj.totalFiscal) * 100;\r\n divergenciaObj.divergenciaTancagem = divergenciaObj.estoqueFinal + divergenciaObj.distribuido - divergenciaObj.estoqueInicial - divergenciaObj.totalFisico;\r\n return divergenciaObj;\r\n };\r\n\r\n recebimentos.openModalDivergenciaDatabase = function (associacao) {\r\n if (associacao.IdentificadorGrupoRecebimentoFisicoFiscal && associacao.IdentificadorGrupoRecebimentoFisicoFiscal != 0 && !recebimentos.isOpenedModalDivergencia) {\r\n recebimentos.isOpenedModalDivergencia = true;\r\n AssociacaoRecebimentoModel.getByIdRecebimento(associacao.IdentificadorGrupoRecebimentoFisicoFiscal)\r\n .then(function (resposta) {\r\n recebimentos.isOpenedModalDivergencia = false;\r\n if (resposta.length) {\r\n var divergencia = resposta[0];\r\n\r\n var resumoDivergencia = recebimentos.dadosDivergencia(divergencia)\r\n\r\n return modalDivergencia.open({\r\n locals: {\r\n estoqueInicial: resumoDivergencia.estoqueInicial,\r\n estoqueFinal: resumoDivergencia.estoqueFinal,\r\n distribuido: resumoDivergencia.distribuido, //TODO - Incluir busca de volume distribuido\r\n totalFiscal: resumoDivergencia.totalFiscal,\r\n totalFisico: resumoDivergencia.totalFisico,\r\n divergencia: resumoDivergencia.divergencia,\r\n divergenciaPercentual: resumoDivergencia.divergenciaPercentual,\r\n divergenciaTancagem: resumoDivergencia.divergenciaTancagem,\r\n confirmOperation: false\r\n }\r\n });\r\n }\r\n });\r\n }\r\n };\r\n\r\n recebimentos.openModalDivergencia = function (associacao) {\r\n if (!recebimentos.isOpenedModalDivergencia) {\r\n recebimentos.isOpenedModalDivergencia = true;\r\n setTimeout(function () {\r\n recebimentos.isOpenedModalDivergencia = false;\r\n\r\n var resumoDivergencia = recebimentos.dadosDivergencia(associacao);\r\n return modalDivergencia.open({\r\n locals: {\r\n estoqueInicial: resumoDivergencia.estoqueInicial,\r\n estoqueFinal: resumoDivergencia.estoqueFinal,\r\n distribuido: resumoDivergencia.distribuido, //TODO - Incluir busca de volume distribuido\r\n totalFiscal: resumoDivergencia.totalFiscal,\r\n totalFisico: resumoDivergencia.totalFisico,\r\n divergencia: resumoDivergencia.divergencia,\r\n divergenciaPercentual: resumoDivergencia.divergenciaPercentual,\r\n divergenciaTancagem: resumoDivergencia.divergenciaTancagem,\r\n confirmOperation: false\r\n }\r\n });\r\n }, 250);\r\n }\r\n };\r\n\r\n recebimentos.openModalSelectionRecebimentoFisico = function (associacao) {\r\n RecebimentoFisicoModel.getAllByDthInicio(recebimentos.selectedFisico.DataHoraUTCInicioRecebimentoFisico, SelTurnoService.getIdcRegTurno())\r\n .then(function (recebimentosFisicos) {\r\n if (recebimentosFisicos.length && recebimentosFisicos.length > 0) {\r\n\r\n MessageService.prompt(TranslateService('atention'), TranslateService('recebimento-desassociado-existente'))\r\n .then(function () {\r\n\r\n return modalSelectionRecFisico.open({\r\n locals: {\r\n recebimentosSelecao: recebimentosFisicos\r\n }\r\n })\r\n .then(function (recebimentoFisico) {\r\n\r\n if (recebimentos.IndicadorTipoRecebimento != recebimentoFisico.IndicadorTipoRecebimento) {\r\n MessageService.alert(TranslateService(\"tipo-recebimento-divcergente\"));\r\n return;\r\n }\r\n\r\n RecebimentoFisicoModel.isEmAvaliacao(recebimentoFisico.IdentificadorRecebimentoFisicoProduto)\r\n .then(function (resposta) {\r\n if (resposta) {\r\n MessageService.alert(TranslateService(\"receb-em-validacao\"));\r\n recebimentos.isEmAvaliacao = resposta;\r\n recebimentos.idEmAvaliacaoFisico = recebimentoFisico.IdentificadorRecebimentoFisicoProduto;\r\n } else {\r\n if (recebimentos.standardProduto == 0) {\r\n recebimentos.standardProduto = recebimentoFisico.IdentificadorProdutoPosto\r\n }\r\n if (recebimentos.standardProduto != recebimentoFisico.IdentificadorProdutoPosto) {\r\n MessageService.alert(TranslateService(\"validacao-produtoRecebimento-divergente\"));\r\n recebimentos.produto = recebimentos.standardProduto;\r\n } else {\r\n //recebimentos.isEditing = true;\r\n //recebimentos.isEditarFisico = true;\r\n recebimentos.produto = recebimentoFisico.IdentificadorProdutoPosto;\r\n recebimentos.isEmAvaliacao = resposta;\r\n recebimentos.selectedFisico = recebimentoFisico;\r\n recebimentos.selectedFisico.qtd = getQuantidadeRecebimento(recebimentos.selectedFisico);\r\n recebimentos.selectedFisico.SglPosto = recebimentoFisico.SglPosto;\r\n recebimentos.selectedFisico.SglTurno = recebimentoFisico.SglTurno;\r\n recebimentos.getPostos(recebimentoFisico.CadPosto);\r\n }\r\n }\r\n });\r\n })\r\n });\r\n }\r\n\r\n });\r\n };\r\n\r\n function getObjDetalhe() {\r\n var detalhe = {\r\n \"tipoRecebimento\": null,\r\n \"codigoDanfe\": null,\r\n \"sglPosto\": null,\r\n \"dataHoraInicial\": null,\r\n \"dataHoraFinal\": null,\r\n \"volume\": null,\r\n \"operador\": null\r\n };\r\n return detalhe;\r\n }\r\n\r\n recebimentos.openModalDetalheRecebemento = function (associacao) {\r\n var listaDetalhes = [];\r\n var detalheFiscal = null\r\n var detalheFisico = null\r\n if (!recebimentos.isOpenedModalDetalhe) {\r\n recebimentos.isOpenedModalDetalhe = true;\r\n\r\n AssociacaoRecebimentoModel.getByIdRecebimento(associacao.IdentificadorGrupoRecebimentoFisicoFiscal, true)\r\n .then(function (resposta) {\r\n recebimentos.isOpenedModalDetalhe = false;\r\n if (resposta.length) {\r\n var grupo = resposta[0];\r\n for (var i = 0; i < grupo.ListRecebimentoFiscalProduto.length; i++) {\r\n detalheFiscal = getObjDetalhe();\r\n detalheFiscal.tipoRecebimento = TranslateService('Invoice-type'),\r\n detalheFiscal.codigoDanfe = grupo.ListRecebimentoFiscalProduto[i].CodigoDANFENotaFiscal,\r\n detalheFiscal.sglPosto = grupo.ListRecebimentoFiscalProduto[i].SglPosto,\r\n detalheFiscal.dataHoraInicial = $filter('date')(\r\n grupo.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n detalheFiscal.dataHoraFinal = $filter('date')(\r\n grupo.ListRecebimentoFiscalProduto[i].DataHoraUTCFimRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n detalheFiscal.volume = grupo.ListRecebimentoFiscalProduto[i].QuantidadeProdutoNotaFiscal,\r\n detalheFiscal.operador = grupo.ListRecebimentoFiscalProduto[i].NomUsuarioCriacao;\r\n listaDetalhes.push(detalheFiscal)\r\n detalheFiscal = null\r\n }\r\n for (var i = 0; i < grupo.ListRecebimentoFisicoProduto.length; i++) {\r\n detalheFisico = getObjDetalhe();\r\n detalheFisico.tipoRecebimento = TranslateService('fisical-type'),\r\n detalheFisico.codigoDanfe = \" - \";\r\n detalheFisico.sglPosto = grupo.ListRecebimentoFisicoProduto[i].SglPosto;\r\n detalheFisico.dataHoraInicial = $filter('date')(\r\n grupo.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n detalheFisico.dataHoraFinal = $filter('date')(\r\n grupo.ListRecebimentoFisicoProduto[i].DataHoraUTCFimRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n detalheFisico.volume = grupo.ListRecebimentoFisicoProduto[i].quantidadeRecebidaDetalhes;\r\n detalheFisico.operador = grupo.ListRecebimentoFisicoProduto[i].NomUsuarioCriacao;\r\n listaDetalhes.push(detalheFisico)\r\n detalheFiscal = null\r\n }\r\n\r\n return modalDetalheRecebimento.open({\r\n locals: {\r\n List: listaDetalhes,\r\n codigoRecebimento: grupo.CodigoGrupoRecebimento\r\n }\r\n });\r\n }\r\n });\r\n }\r\n };\r\n\r\n recebimentos.openModalSaidaPortaria = function (recebimento, tipo) {\r\n if (!recebimentos.isOpenedModalSaida && tipo == 'C') {\r\n recebimentos.isOpenedModalSaida = true;\r\n AssociacaoRecebimentoModel.getByIdRecebimento(recebimento.IdentificadorGrupoRecebimentoFisicoFiscal)\r\n .then(function (resposta) {\r\n recebimentos.isOpenedModalSaida = false;\r\n if (resposta) {\r\n var fiscais = [];\r\n var baseObj = null;\r\n for (var i = 0; i < resposta[0].ListRecebimentoFiscalProduto.length; i++) {\r\n if (resposta[0].ListRecebimentoFiscalProduto[i].CadCaminhaoTanque) {\r\n resposta[0].ListRecebimentoFiscalProduto[i].IdentificadorCamihaoTanqueSaida =\r\n resposta[0].ListRecebimentoFiscalProduto[i].CadCaminhaoTanque.CodPlaca + \" \" +\r\n resposta[0].ListRecebimentoFiscalProduto[i].CadCaminhaoTanque.DscCaminhaoTanque\r\n }\r\n baseObj = {\r\n \"idSaidaInputDanfe\": \"InputDanfe\" + i,\r\n \"idSaidaInputTrunck\": \"InputTrunck\" + i,\r\n \"idSaidaInputData\": \"InputData\" + i,\r\n \"idSaidaInputHora\": \"InputHora\" + i,\r\n \"fiscal\": resposta[0].ListRecebimentoFiscalProduto[i],\r\n \"editado\": false\r\n };\r\n fiscais.push(baseObj)\r\n }\r\n }\r\n return modalSaidaPortaria.open({\r\n listaSaidas: {\r\n\r\n lista: fiscais\r\n }\r\n });\r\n\r\n });\r\n }\r\n }\r\n\r\n function onChangeTurno(regTurno) {\r\n return recebimentos.getAllByIdcPosto().then(function () {\r\n getAssociacoes();\r\n recebimentos.getTanquesPosto(regTurno.IdcPosto);\r\n });\r\n }\r\n\r\n recebimentos.getTanquesPosto = function (IdcPosto) {\r\n TanquePostoModel.getByIdPostoAndStuTanque(IdcPosto, 'S')\r\n .then(function (tanquesPosto) {\r\n recebimentos.tanquesPosto = tanquesPosto;\r\n });\r\n };\r\n\r\n // ******** Js para Aba de Fiscal\r\n\r\n recebimentos.cancelarEditFiscal = function (recebimentoFiscal, formRecebimentoFiscal) {\r\n if (recebimentos.isEditarFiscal) {\r\n recebimentos.selectedFiscal = null;\r\n recebimentos.isEditarFiscal = false;\r\n recebimentos.isEditing = false;\r\n ValidacaoService.resetForm(formRecebimentoFiscal);\r\n recebimentos.selectedFiscal = criaNovoRecebimentoFiscal(recebimentoFiscal.IndicadorTipoRecebimento)\r\n }\r\n };\r\n\r\n recebimentos.cancelarEditFisico = function (recebimentoFisico) {\r\n if (recebimentos.isEditarFisico || recebimentoFisico.IdentificadorRecebimentoFisicoProduto) {\r\n recebimentos.isEditing = false;\r\n recebimentos.selectedFisico = null;\r\n recebimentos.isEditarFisico = false;\r\n recebimentos.selectedFisico = criaNovoRecebimentoFisico(recebimentoFisico.IndicadorTipoRecebimento)\r\n }\r\n };\r\n\r\n recebimentos.desassociarExcluirFiscal = function (recebimentoFiscal) {\r\n if (!recebimentoFiscal.Desassociar) {\r\n MessageService.prompt(TranslateService('atention'), TranslateService('recebimento-desassocicao'))\r\n .then(function () {\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto.length) {\r\n recebimentos.selected.ListRecebimentoFiscalProduto.filter(function (a) {\r\n return a.IdentificadorRecebimentoFiscalProduto == recebimentoFiscal.IdentificadorRecebimentoFiscalProduto;\r\n })[0].Desassociar = true;\r\n }\r\n recebimentos.cancelarEditFiscal(recebimentoFiscal)\r\n });\r\n } \r\n // else {\r\n // if (recebimentos.selected.ListRecebimentoFiscalProduto.length) {\r\n // recebimentos.selected.ListRecebimentoFiscalProduto.filter(function (a) {\r\n // return a.IdentificadorRecebimentoFiscalProduto == recebimentoFiscal.IdentificadorRecebimentoFiscalProduto;\r\n // })[0].Desassociar = false;\r\n // }\r\n // }\r\n };\r\n\r\n function getFisicos(IdcProduto, IdcGrupo) {\r\n RecebimentoFisicoModel.getAllByIdcProduto(IdcProduto, IdcGrupo)\r\n .then(function (resposta) {\r\n recebimentos.ListRecebimentoFisicoProduto = resposta;\r\n for (var i = 0; i < recebimentos.ListRecebimentoFisicoProduto.length; i++) {\r\n recebimentos.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisicoSearch =\r\n $filter('date')(\r\n recebimentos.ListRecebimentoFisicoProduto[i].DataHoraUTCInicioRecebimentoFisico,\r\n TranslateService('datetime-format')\r\n );\r\n recebimentos.ListRecebimentoFisicoProduto[i].quant = getQuantidadeRecebimento(recebimentos.ListRecebimentoFisicoProduto[i]);\r\n }\r\n });\r\n }\r\n\r\n recebimentos.getFiscais = function (IdcProduto, IdcGrupo) {\r\n RecebimentoFiscalModel.getAllByIdcProduto(IdcProduto, IdcGrupo)\r\n .then(function (resposta) {\r\n recebimentos.ListRecebimentoFiscalProduto = resposta;\r\n for (var i = 0; i < recebimentos.ListRecebimentoFiscalProduto.length; i++) {\r\n recebimentos.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscalSearch =\r\n $filter('date')(\r\n recebimentos.ListRecebimentoFiscalProduto[i].DataHoraUTCInicioRecebimentoFiscal,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n });\r\n }\r\n\r\n function montaDataEmissaoNF(dadosCodBarras) {\r\n var ano = Number(SelTurnoService.turno.DataInicial.getFullYear().toString().substring(0, 2) + dadosCodBarras.ano);\r\n var mes = Number(dadosCodBarras.mes) - 1;\r\n var retorno = new Date(ano, mes, 1);\r\n return retorno;\r\n }\r\n\r\n recebimentos.readBarcode = function () {\r\n //localStorage.setItem(\"recebimentos.selected\", JSON.stringify(recebimentos.selected));\r\n BarCodeService.getScan(function (code) {\r\n $timeout(function () {\r\n recebimentos.selected.CodigoBarrasNotaFiscal = code;\r\n recebimentos.changeBarcode();\r\n });\r\n });\r\n };\r\n\r\n\r\n recebimentos.promptCancel = function () {\r\n recebimentos.selectedFiscal = null;\r\n recebimentos.preCreateAbaFiscal(recebimentos.IndicadorTipoRecebimento)\r\n }\r\n\r\n recebimentos.changeProdutoEmAbas = function (idProduto, selectedForm) {\r\n var isProduto = recebimentos.isProdutoGrupo(idProduto, selectedForm)\r\n if (!isProduto) {\r\n MessageService.alert(TranslateService(\"validacao-produtoSelecionado-divergente\"));\r\n recebimentos.produto = recebimentos.standardProduto\r\n }\r\n }\r\n\r\n recebimentos.getCounter = function () {\r\n var counter = 'none';\r\n\r\n if ((!recebimentos.selected.ListRecebimentoFiscalProduto || recebimentos.selected.ListRecebimentoFiscalProduto.length == 0)\r\n && (!recebimentos.selected.ListRecebimentoFisicoProduto || recebimentos.selected.ListRecebimentoFisicoProduto.length == 0)) {\r\n return counter;\r\n }\r\n\r\n counter = recebimentos.selected.ListRecebimentoFiscalProduto && recebimentos.selected.ListRecebimentoFiscalProduto.length > 1 ? 'moreThanOne' : 'one';\r\n\r\n if (\r\n ((recebimentos.selected.ListRecebimentoFisicoProduto && recebimentos.selected.ListRecebimentoFisicoProduto.length == 1)\r\n && (!recebimentos.selected.ListRecebimentoFiscalProduto || recebimentos.selected.ListRecebimentoFiscalProduto.length == 0))\r\n || ((recebimentos.selected.ListRecebimentoFiscalProduto && recebimentos.selected.ListRecebimentoFiscalProduto.length == 1)\r\n && (!recebimentos.selected.ListRecebimentoFisicoProduto || recebimentos.selected.ListRecebimentoFisicoProduto.length == 0))\r\n ) {\r\n counter = 'one';\r\n }\r\n\r\n if (\r\n ((recebimentos.selected.ListRecebimentoFisicoProduto && recebimentos.selected.ListRecebimentoFisicoProduto.length == 1)\r\n && (recebimentos.selected.ListRecebimentoFiscalProduto && recebimentos.selected.ListRecebimentoFiscalProduto.length == 1))\r\n || (recebimentos.selected.ListRecebimentoFisicoProduto && recebimentos.selected.ListRecebimentoFisicoProduto.length > 1)\r\n || (recebimentos.selected.ListRecebimentoFiscalProduto && recebimentos.selected.ListRecebimentoFiscalProduto.length > 1)\r\n \r\n ) {\r\n counter = 'moreThanOne'\r\n }\r\n \r\n return counter;\r\n }\r\n\r\n recebimentos.isProdutoGrupo = function (idProduto, selectedForm) {\r\n var counter = recebimentos.getCounter();\r\n var isProdutoInGrupo = true;\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto && recebimentos.selected.ListRecebimentoFiscalProduto.length != 0) {\r\n \r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFiscalProduto.length; i++) {\r\n if (recebimentos.selected.ListRecebimentoFiscalProduto[i].IdentificadorProdutoNotaFiscal != idProduto && (!selectedForm || selectedForm.index == 0)) {\r\n isProdutoInGrupo = false;\r\n }\r\n }\r\n }\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto && recebimentos.selected.ListRecebimentoFisicoProduto.length != 0) {\r\n \r\n for (var i = 0; i < recebimentos.selected.ListRecebimentoFisicoProduto.length; i++) {\r\n if (recebimentos.selected.ListRecebimentoFisicoProduto[i].IdentificadorProdutoPosto != idProduto && (!selectedForm || selectedForm.index == 0)) {\r\n isProdutoInGrupo = false;\r\n }\r\n }\r\n }\r\n\r\n if (recebimentos.standardProduto && recebimentos.standardProduto != 0\r\n && recebimentos.standardProduto != idProduto\r\n && (counter == 'moreThanOne'\r\n || (counter == 'one' && (!selectedForm || selectedForm.index == 0))\r\n )\r\n ) {\r\n isProdutoInGrupo = false;\r\n }\r\n\r\n return isProdutoInGrupo;\r\n }\r\n\r\n recebimentos.changeBarcode = function () {\r\n DanfeService(recebimentos.selectedFiscal.CodigoBarrasNotaFiscal, true)\r\n .then(function (retorno) {\r\n var isProduto = recebimentos.isProdutoGrupo(retorno.produtoNotaFiscal)\r\n if (!isProduto && retorno.produtoNotaFiscal != undefined) {\r\n MessageService.alert(TranslateService(\"validacao-produtoNota-divergente\"));\r\n } else {\r\n if (retorno.identificadorGrupoRecebimentoFisicoFiscal === null && retorno.preCadastro === 'N') {\r\n MessageService.prompt(\r\n TranslateService('danfe-duplicated-toReuse', recebimentos.selectedFiscal.CodigoBarrasNotaFiscal)\r\n ).then(function () {\r\n recebimentos.atribuiValoresFromDanfeService(retorno);\r\n });\r\n }\r\n else {\r\n recebimentos.atribuiValoresFromDanfeService(retorno);\r\n }\r\n \r\n \r\n }\r\n })\r\n .catch(function (erro) {\r\n recebimentos.selectedFiscal.CodigoDANFENotaFiscal = null;\r\n recebimentos.selectedFiscal.DataEmissaoNotaFiscal = null;\r\n recebimentos.selectedFiscal.diadanfe = null;\r\n recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto = 0;\r\n recebimentos.selectedFiscal.IdentificadorEmpresaFornecedora = null;\r\n recebimentos.selectedFiscal.IdentificadorEmpresaTransportadora = null;\r\n recebimentos.selectedFiscal.IdentificadorVagaoTanque = null;\r\n recebimentos.selectedFiscal.IdentificadorCaminhaoTanque = null;\r\n recebimentos.selectedFiscal.IdentificadorCavaloMecanico = null;\r\n recebimentos.selectedFiscal.IdentificadorMotoristaCavaloCaminhaoTanque = null;\r\n recebimentos.selectedFiscal.CodigoHexadecimalCorLacres = null;\r\n recebimentos.selectedFiscal.QuantidadeLacres = null;\r\n recebimentos.selectedFiscal.NumeroIdentificacaoLacres = null;\r\n recebimentos.selectedFiscal.IdentificadorProdutoNotaFiscal = null;\r\n recebimentos.selectedFiscal.QuantidadeProdutoNotaFiscal = null;\r\n recebimentos.selectedFiscal.PrecoUnitarioProdutoNotaFiscal = null;\r\n recebimentos.selectedFiscal.PesoLiquidoNotaFiscal = null;\r\n recebimentos.selectedFiscal.PesoBrutoNotaFiscal = null;\r\n recebimentos.selectedFiscal.PesoBrutoVale = null;\r\n recebimentos.selectedFiscal.DensidadeCarga = null;\r\n recebimentos.selectedFiscal.TemperaturaCarga = null;\r\n recebimentos.selectedFiscal.IndicadorTipoRecebimento = null;\r\n\r\n recebimentos.changeCaminhao();\r\n recebimentos.changeMotorista();\r\n });\r\n };\r\n\r\n recebimentos.atribuiValoresFromDanfeService = function (retorno) {\r\n recebimentos.selectedFiscal.CodigoDANFENotaFiscal = retorno.numDanfe;\r\n recebimentos.selectedFiscal.DataEmissaoNotaFiscal = retorno.dataEmissaoNotaFiscal == null ? montaDataEmissaoNF(retorno) : retorno.dataEmissaoNotaFiscal;\r\n recebimentos.selectedFiscal.diadanfe = retorno.diaEmissaoNotaFiscal == null ? 1 : retorno.diaEmissaoNotaFiscal;\r\n recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto = retorno.identificadorRecebimentoFiscalProduto;\r\n recebimentos.selectedFiscal.IdentificadorEmpresaFornecedora = retorno.empresaFornecedora;\r\n recebimentos.selectedFiscal.IdentificadorEmpresaTransportadora = retorno.empresaTransportadora;\r\n recebimentos.selectedFiscal.IdentificadorVagaoTanque = retorno.vagaoTanque;\r\n recebimentos.selectedFiscal.IdentificadorCaminhaoTanque = retorno.caminhaoTanque;\r\n recebimentos.selectedFiscal.IdentificadorCavaloMecanico = retorno.cavaloMecanico;\r\n recebimentos.selectedFiscal.IdentificadorMotoristaCavaloCaminhaoTanque = retorno.motoristaCavaloCaminhaoTanque;\r\n recebimentos.selectedFiscal.CodigoHexadecimalCorLacres = retorno.codigoHexadecimalCorLacres;\r\n recebimentos.selectedFiscal.QuantidadeLacres = retorno.quantidadeLacres;\r\n recebimentos.selectedFiscal.NumeroIdentificacaoLacres = retorno.numeroIdentificacaoLacres;\r\n recebimentos.selectedFiscal.IdentificadorProdutoNotaFiscal = retorno.produtoNotaFiscal;\r\n if (retorno.produtoNotaFiscal != undefined) {\r\n recebimentos.produto = retorno.produtoNotaFiscal;\r\n recebimentos.standardProduto = retorno.produtoNotaFiscal;\r\n }\r\n recebimentos.selectedFiscal.QuantidadeProdutoNotaFiscal = retorno.quantidadeProdutoNotaFiscal;\r\n recebimentos.selectedFiscal.PrecoUnitarioProdutoNotaFiscal = retorno.precoUnitarioProdutoNotaFiscal;\r\n recebimentos.selectedFiscal.PesoLiquidoNotaFiscal = retorno.pesoLiquidoNotaFiscal;\r\n recebimentos.selectedFiscal.PesoBrutoNotaFiscal = retorno.pesoBrutoNotaFiscal;\r\n recebimentos.selectedFiscal.PesoBrutoVale = retorno.pesoBrutoVale;\r\n recebimentos.selectedFiscal.NumeroItemNota = retorno.numeroItemNota;\r\n recebimentos.selectedFiscal.CnpjNotaFiscal = retorno.cnpjNotaFiscal;\r\n recebimentos.selectedFiscal.DensidadeCarga = retorno.densidadeCarga;\r\n recebimentos.selectedFiscal.TemperaturaCarga = retorno.temperaturaCarga;\r\n recebimentos.selectedFiscal.IndicadorTipoRecebimento = recebimentos.IndicadorTipoRecebimento;\r\n\r\n recebimentos.changeCaminhaoRecebimentoFiscal();\r\n recebimentos.changeMotorista();\r\n }\r\n\r\n recebimentos.changeInvoiceNumber = function (invoice) {\r\n if (!invoice) {\r\n invoice = \"\";\r\n }\r\n if ((recebimentos.selectedFiscal.diadanfe === null || typeof recebimentos.selectedFiscal.diadanfe === \"undefined\") &&\r\n (recebimentos.selectedFiscal.CodigoBarrasNotaFiscal === null || typeof recebimentos.selectedFiscal.CodigoBarrasNotaFiscal === \"undefined\")\r\n || recebimentos.selectedFiscal.LastCodigoDANFENotaFiscal !== invoice\r\n ) {\r\n var codBarraCan;\r\n var data = new Date();\r\n recebimentos.selectedFiscal.diadanfe = 1;\r\n recebimentos.selectedFiscal.DataEmissaoNotaFiscal = new Date();\r\n recebimentos.changeDiaEmissao(recebimentos.selectedFiscal.diadanfe);\r\n codBarraCan = invoice.concat(data.getFullYear(), data.getMonth() + 1, data.getDate());\r\n recebimentos.selectedFiscal.CodigoBarrasNotaFiscal = codBarraCan.padStart(44, '0');\r\n if (!recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto)\r\n recebimentos.selectedFiscal.LastCodigoDANFENotaFiscal = invoice;\r\n }\r\n\r\n if (recebimentos.SelTurnoService.turno.SglDiretoria === 'VBD' && invoice) {\r\n RecebimentoFiscalModel.getByCodBarras(recebimentos.selectedFiscal.CodigoBarrasNotaFiscal)\r\n .then(function (resposta) {\r\n if (resposta && resposta.length) {\r\n var retorno = {\r\n mes: resposta[0].DataHoraUTCCriacao.getMonth() + 1,\r\n ano: resposta[0].DataHoraUTCCriacao.getFullYear(),\r\n numDanfe: invoice,\r\n diaEmissaoNotaFiscal: resposta[0].DataEmissaoNotaFiscal.getUTCDate(),\r\n dataEmissaoNotaFiscal: resposta[0].DataEmissaoNotaFiscal,\r\n identificadorRecebimentoFiscalProduto: resposta[0].IdentificadorRecebimentoFiscalProduto,\r\n empresaFornecedora: resposta[0].IdentificadorEmpresaFornecedora,\r\n empresaTransportadora: resposta[0].IdentificadorEmpresaTransportadora,\r\n vagaoTanque: resposta[0].IdentificadorVagaoTanque,\r\n caminhaoTanque: resposta[0].IdentificadorCaminhaoTanque,\r\n cavaloMecanico: resposta[0].IdentificadorCavaloMecanico,\r\n motoristaCavaloCaminhaoTanque: resposta[0].IdentificadorMotoristaCavaloCaminhaoTanque,\r\n codigoHexadecimalCorLacres: resposta[0].CodigoHexadecimalCorLacres,\r\n quantidadeLacres: resposta[0].QuantidadeLacres,\r\n numeroIdentificacaoLacres: resposta[0].NumeroIdentificacaoLacres,\r\n produtoNotaFiscal: resposta[0].IdentificadorProdutoNotaFiscal,\r\n quantidadeProdutoNotaFiscal: resposta[0].QuantidadeProdutoNotaFiscal,\r\n precoUnitarioProdutoNotaFiscal: resposta[0].PrecoUnitarioProdutoNotaFiscal,\r\n pesoLiquidoNotaFiscal: resposta[0].PesoLiquidoNotaFiscal,\r\n pesoBrutoNotaFiscal: resposta[0].PesoBrutoNotaFiscal,\r\n pesoBrutoVale: resposta[0].PesoBrutoVale,\r\n numeroItemNota: resposta[0].NumeroItemNota,\r\n cnpjNotaFiscal: resposta[0].CnpjNotaFiscal,\r\n densidadeCarga: resposta[0].DensidadeCarga,\r\n temperaturaCarga: resposta[0].TemperaturaCarga,\r\n identificadorGrupoRecebimentoFisicoFiscal: resposta[0].IdentificadorGrupoRecebimentoFisicoFiscal,\r\n preCadastro: resposta[0].PreCadastro\r\n }\r\n var isProduto = recebimentos.isProdutoGrupo(retorno.produtoNotaFiscal)\r\n if (!isProduto && retorno.produtoNotaFiscal != undefined) {\r\n MessageService.alert(TranslateService(\"validacao-produtoNota-divergente\"));\r\n } else {\r\n if (retorno.identificadorGrupoRecebimentoFisicoFiscal && retorno.preCadastro === 'N'\r\n && (!recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto || recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto != retorno.identificadorRecebimentoFiscalProduto)) {\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('danfe-duplicated', recebimentos.selectedFiscal.CodigoBarrasNotaFiscal));\r\n recebimentos.selectedFiscal.CodBarrasDuplicado = true;\r\n }\r\n else if (retorno.identificadorGrupoRecebimentoFisicoFiscal === null && retorno.preCadastro === 'N'\r\n && (!recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto || recebimentos.selectedFiscal.IdentificadorRecebimentoFiscalProduto != retorno.identificadorRecebimentoFiscalProduto) ) {\r\n MessageService.prompt(\r\n TranslateService('danfe-duplicated-toReuse', recebimentos.selectedFiscal.CodigoBarrasNotaFiscal)\r\n ).then(function () {\r\n recebimentos.selectedFiscal.CodBarrasDuplicado = false;\r\n recebimentos.atribuiValoresFromDanfeService(retorno);\r\n });\r\n }\r\n }\r\n }\r\n else {\r\n recebimentos.selectedFiscal.CodBarrasDuplicado = false;\r\n }\r\n });\r\n }\r\n \r\n };\r\n\r\n recebimentos.changeHoraFinal = function (selected, campo) {\r\n selected.dataFinalOriginal = false;\r\n ValidacaoService.changeTime(selected, campo);\r\n };\r\n\r\n recebimentos.changeDiaEmissao = function (diadanfe) {\r\n if (!diadanfe || diadanfe > recebimentos.validacaoFiscal.getMaxDayOfMonth(recebimentos.selectedFiscal.DataEmissaoNotaFiscal)) {\r\n return;\r\n } \r\n var milis = recebimentos.selectedFiscal.DataEmissaoNotaFiscal.setDate(diadanfe);\r\n recebimentos.selectedFiscal.DataEmissaoNotaFiscal = new Date(milis);\r\n };\r\n\r\n recebimentos.changeCaminhaoRecebimentoFiscal = function () {\r\n //seleciona o caminhao na lista a parir do id selecionado\r\n var IdcCaminhaoTanque = recebimentos.selectedFiscal.IdentificadorCaminhaoTanque;\r\n if (!IdcCaminhaoTanque) return recebimentos.selectedFiscal.datavalidadecertificado = null;\r\n var caminhao = $filter('filter')(recebimentos.caminhoes, { IdcCaminhaoTanque: IdcCaminhaoTanque }, true)[0];\r\n recebimentos.selectedFiscal.datavalidadecertificado = caminhao.DthValidadeCertificado;\r\n };\r\n\r\n recebimentos.changeCaminhaoRecebimentoFisico = function (caminhao) {\r\n\r\n //seleciona o caminhao na lista a parir do id selecionado\r\n if (caminhao != undefined) {\r\n caminhao = $filter('filter')(recebimentos.caminhoes, { IdcCaminhaoTanque: caminhao }, true)[0];\r\n\r\n recebimentos.selectedFisico.ListDetalheRecebimentoProduto =\r\n caminhao.ListCadCaminhaoCompartimento.map(criaDetalhe);\r\n }\r\n };\r\n\r\n recebimentos.changeMotorista = function () {\r\n //seleciona o motorista na lista a parir do id selecionado\r\n if (recebimentos.isTelaConsuta == false) {\r\n var IdcMotorista = recebimentos.selectedFiscal.IdentificadorMotoristaCavaloCaminhaoTanque;\r\n if (!IdcMotorista) return recebimentos.selectedFiscal.CnhVencimento = null;\r\n var motorista = $filter('filter')(recebimentos.motoristas, { IdcMotorista: IdcMotorista }, true)[0];\r\n recebimentos.selectedFiscal.CnhVencimento = motorista.CnhVencimento;\r\n }\r\n };\r\n\r\n recebimentos.isBlocked = function () {\r\n return recebimentos.isEmAvaliacao || (recebimentos.selectedFiscal && recebimentos.selectedFiscal.CodBarrasDuplicado);\r\n };\r\n\r\n recebimentos.isDisabled = function () {\r\n if (recebimentos && recebimentos.selected) {\r\n var selected = recebimentos.selected;\r\n var isDisabled = !selected.CodigoDANFENotaFiscal || recebimentos.isEmAvaliacao;\r\n return isDisabled;\r\n }\r\n return false;\r\n\r\n };\r\n\r\n recebimentos.apuracaoClick = function (apuracao) {\r\n recebimentos.apuracaoSelected = apuracao;\r\n modalApuracao.open({\r\n apuracao: apuracao,\r\n recebimento: recebimentos.selectedFisico,\r\n isEmAvaliacao: recebimentos.isEmAvaliacao\r\n })\r\n .then(function (resposta) {\r\n console.log(resposta);\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n function criaDetalhe(compartimento) {\r\n\r\n compartimento = compartimento || {};\r\n\r\n return {\r\n //Identificadores preenchidos automáticamente pelo entity\r\n \"IdentificadorDetalheRecebimentoProduto\": 0,\r\n \"IdentificadorRecebimentoFisicoProduto\": 0,\r\n \"IdentificadorEncerranteBlocoMedidor\": null,\r\n\r\n //Objetos que existem na entidade, mas não precisam ser preenchidos\r\n \"CadAspectoVisual\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n\r\n //Informações capturadas automáticamente no momento do lançamento\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"NomeSistemaOrigemDado\": 'WEB-MOBILE',\r\n\r\n //Informações do usuário comuns a todos os tipos\r\n \"QuantidadeRecebida\": null,\r\n \"QuantidadeRecebida20GrausCelsius\": null,\r\n \"PesoLiquidoRecebido\": null,\r\n \"IdentificadorAspectoVisual\": null,\r\n \"IndicadorPresencaAgua\": null,\r\n\r\n //Inclusão destes campos para calcular volume a 20 graus celsius\r\n \"MedidaDensidadeProduto\": null,\r\n \"MedidaTemperaturaProduto\": null,\r\n\r\n //Específico para vagão (Preenchido pelo usuário)\r\n \"MedidaAlturaEspacoVazio\": null,\r\n\r\n //=============================================================================================//\r\n\r\n //Específico para caminhão (Preenchido automáticamente)\r\n \"CadCaminhaoCompartimento\": compartimento,\r\n \"IdentificadorCompartimentoCaminhaoTanque\": compartimento.IdcCaminhaoCompartimento || null,\r\n\r\n //Específico para caminhão com complemento\r\n \"DataHoraUTCComplemento\": ValidacaoService.getNowTurno(),\r\n \"QuantidadeComplementoProduto\": null,\r\n \"CtrEncerrante\": {\r\n \"IdcCtrEncerrante\": 0,\r\n \"IdcBlocoMedidor\": 0,\r\n \"DthCtrEncerrante\": ValidacaoService.getNowTurno(),\r\n \"ValEncerranteAtual\": 0,\r\n \"IdcTblOperacao\": 0,\r\n \"TblOperacao\": \"V5GDETRT\",\r\n \"ChkResetAutomatico\": false,\r\n \"DthCriacaoReg\": new Date(),\r\n \"RegPorEncerrante\": \"S\"\r\n }\r\n };\r\n }\r\n\r\n function criaApuracao(tanque) {\r\n if (!tanque) {\r\n return;\r\n }\r\n\r\n return {\r\n \"IdentificadorApuracaoRecebimentoProdutoTanque\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorRecebimentoFisicoProduto\": 0,\r\n \"IdentificadorTanquePostoAbastecimento\": tanque.IdcTanquePosto,\r\n \"CadTanquePosto\": tanque,\r\n\r\n //Informações inseridas pelo usuário\r\n \"MedidaAlturaInicial\": null,\r\n \"QuantidadeProdutoInicial\": 0,\r\n \"QuantidadeProdutoInicial20GrausCelsius\": null,\r\n \"MedidaTemperaturaMediaInicial\": null,\r\n \"MedidaTemperaturaSuperficieInicial\": null,\r\n \"MedidaTemperaturaMeioInicial\": null,\r\n \"MedidaTemperaturaFundoInicial\": null,\r\n \"MedidaDensidadeInicial\": null,\r\n\r\n \"MedidaAlturaFinal\": null,\r\n \"QuantidadeProdutoFinal\": 0,\r\n \"QuantidadeProdutoFinal20GrausCelsius\": null,\r\n \"MedidaTemperaturaMediaFinal\": null,\r\n \"MedidaTemperaturaSuperficieFinal\": null,\r\n \"MedidaTemperaturaMeioFinal\": null,\r\n \"MedidaTemperaturaFundoFinal\": null,\r\n \"MedidaDensidadeFinal\": null,\r\n\r\n //Proxies para altura\r\n \"AlturaInicialProxy\": null,\r\n \"AlturaFinalProxy\": null\r\n };\r\n }\r\n\r\n recebimentos.detalheClick = function (detalhe) {\r\n recebimentos.detalheSelected = detalhe;\r\n modalDetalhe.open({\r\n detalhe: detalhe,\r\n recebimento: recebimentos.selectedFisico,\r\n isEmAvaliacao: recebimentos.isEmAvaliacao\r\n })\r\n .then(function (resposta) {\r\n console.log(resposta);\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n };\r\n\r\n function isSameTurnoInicioFiscal() {\r\n return recebimentos.selectedFiscal.IdentificadorAberturaFechamentoTurnoInicioRecebimento === SelTurnoService.getIdcRegTurno();\r\n }\r\n\r\n recebimentos.disableHoraInicialFiscal = function () {\r\n if (!recebimentos.selectedFiscal) {\r\n return true;\r\n }\r\n return recebimentos.isBlocked() || !isSameTurnoInicioFiscal();\r\n }\r\n\r\n function isSameTurnoInicioFisico() {\r\n return recebimentos.selectedFisico.IdentificadorAberturaFechamentoTurnoInicioRecebimento === SelTurnoService.getIdcRegTurno();\r\n }\r\n\r\n recebimentos.disableHoraInicialFisico = function () {\r\n if (!recebimentos.selectedFisico) {\r\n return true;\r\n }\r\n return recebimentos.isBlocked() || !isSameTurnoInicioFisico();\r\n }\r\n\r\n recebimentos.canEditFisico = function () {\r\n var hours = 0;\r\n if (recebimentos.selectedFisico.RegTurnoInicioRecebimento) {\r\n var diff = recebimentos.SelTurnoService.turno.DataInicial - recebimentos.selectedFisico.RegTurnoInicioRecebimento.DthFinal;\r\n hours = Math.floor(diff / 3.6e6);\r\n }\r\n \r\n return (recebimentos.selectedFisico.IdentificadorAberturaFechamentoTurnoInicioRecebimento == recebimentos.SelTurnoService.getIdcRegTurno())\r\n || (recebimentos.selectedFisico.IdentificadorAberturaFechamentoTurnoTerminoRecebimento == recebimentos.SelTurnoService.getIdcRegTurno())\r\n || (recebimentos.selectedFisico.IdentificadorAberturaFechamentoTurnoTerminoRecebimento == null\r\n && recebimentos.selectedFisico.RegTurnoInicioRecebimento != null\r\n && recebimentos.selectedFisico.RegTurnoInicioRecebimento.IdcPosto == recebimentos.SelTurnoService.turno.IdcPosto\r\n && hours < 1)\r\n }\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('CentroCustoController', ElementoPepController);\r\n\r\n ElementoPepController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'CentroCustoModel',\r\n 'GerenciaModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function ElementoPepController(\r\n ValidacaoService,\r\n Constant,\r\n CentroCustoModel,\r\n GerenciaModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadCentroCusto = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadCentroCusto.filtro = '';\r\n cadCentroCusto.listaCentroCusto = null;\r\n cadCentroCusto.listaGerencia = null;\r\n \r\n cadCentroCusto.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadCentroCusto.selected = null;\r\n cadCentroCusto.isTelaConsuta = true;\r\n cadCentroCusto.validacao = ValidacaoService;\r\n cadCentroCusto.IdcCentroCusto = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n getCentroCusto();\r\n getGerencia();\r\n\r\n \r\n }\r\n\r\n function getCentroCusto() {\r\n CentroCustoModel.getAll()\r\n .then(function (resposta) {\r\n cadCentroCusto.listacadCentroCusto = resposta;\r\n \r\n });\r\n }\r\n\r\n function getGerencia() {\r\n GerenciaModel.getAll()\r\n .then(function (resposta) {\r\n\r\n cadCentroCusto.listaGerencia = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadCentroCusto.click = function (item) {\r\n cadCentroCusto.selected = item;\r\n //cadCentroCusto.DscGerencia = item.CadGerencia.DscGerencia;\r\n cadCentroCusto.IdcCentroCusto = item.IdcCentroCusto;\r\n cadCentroCusto.isTelaConsuta = false;\r\n\r\n\r\n }\r\n\r\n\r\n cadCentroCusto.atualizar = function () {\r\n getCentroCusto();\r\n }\r\n\r\n cadCentroCusto.novo = function () {\r\n cadCentroCusto.isTelaConsuta = false;\r\n cadCentroCusto.selected = {};\r\n ValidacaoService.resetForm(formcadCentroCusto);\r\n }\r\n\r\n cadCentroCusto.salvar = function (formcadCentroCusto) {\r\n \r\n if(formcadCentroCusto.$valid)\r\n {\r\n\r\n CentroCustoModel.save(cadCentroCusto.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadCentroCusto);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadCentroCusto.isTelaConsuta = true;\r\n getCentroCusto();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n \r\n cadCentroCusto.cancelar = function (formcadCentroCusto) {\r\n cadCentroCusto.isTelaConsuta = true;\r\n getCentroCusto();\r\n cadCentroCusto.selected = null;\r\n cadCentroCusto.IdcCentroCusto = null;\r\n }\r\n\r\n cadCentroCusto.excluir = function (formcadCentroCusto) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n CentroCustoModel.excluir(cadCentroCusto.IdcCentroCusto)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadCentroCusto);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadCentroCusto.isTelaConsuta = true;\r\n getCentroCusto();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RegAnomaliaController', RegAnomaliaController);\r\n RegAnomaliaController.$inject = [\r\n 'RegAnomaliaModel',\r\n 'SelTurnoService',\r\n 'ValidacaoService',\r\n '$uibModalInstance',\r\n 'TranslateService',\r\n 'locals'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function RegAnomaliaController(\r\n RegAnomaliaModel,\r\n SelTurnoService,\r\n validacao,\r\n $uibModalInstance,\r\n TranslateService,\r\n locals\r\n ) {\r\n\r\n //Associa a instancia do controller em uma variável privada\r\n var regAnomalia = this;\r\n\r\n //Propriedades privadas\r\n\r\n //Propriedades públicas\r\n regAnomalia.grupos = {};\r\n regAnomalia.items = {};\r\n regAnomalia.niveis = [];\r\n regAnomalia.anomalia = {};\r\n regAnomalia.validacao = validacao;\r\n regAnomalia.SelTurnoService = SelTurnoService;\r\n regAnomalia.nivel = {};\r\n regAnomalia.anomalia.DscObservacao = locals.obs;\r\n regAnomalia.anomalia.IdcTblOperacao = locals.idcTblOperacao;\r\n regAnomalia.anomalia.StuAnomalia = locals.StuAnomalia;\r\n\r\n //Métodos privados\r\n function getListas() {\r\n var grupos = {};\r\n var items = {};\r\n RegAnomaliaModel.getGrupos().then(function (resposta) {\r\n regAnomalia.niveis = resposta;\r\n\r\n resposta.forEach(function (item) {\r\n if (!regAnomalia.grupos[item.DscGrupo]) {\r\n regAnomalia.grupos[item.DscGrupo] = {};\r\n }\r\n regAnomalia.grupos[item.DscGrupo][item.DscItem] = true;\r\n });\r\n });\r\n }\r\n\r\n regAnomalia.teste = function (arg) {\r\n return arg + 2;\r\n };\r\n\r\n\r\n //Métodos publicos\r\n regAnomalia.ok = function (form) {\r\n if (form.$valid) {\r\n\r\n regAnomalia.anomalia.IdcRegTurno = (SelTurnoService.turno || {}).IdcRegTurno || null;\r\n regAnomalia.anomalia.DscGrupoAnomalia = regAnomalia.nivel.DscGrupo;\r\n regAnomalia.anomalia.DscItemAnomalia = regAnomalia.nivel.DscItemBD;\r\n regAnomalia.anomalia.CodNivelAnomalia = regAnomalia.nivel.CodNivel;\r\n regAnomalia.anomalia.IdcGrupo = regAnomalia.nivel.IdcGrupo;\r\n regAnomalia.anomalia.IdcItem = regAnomalia.nivel.IdcItem;\r\n regAnomalia.anomalia.IdcNivel = regAnomalia.nivel.IdcNivel;\r\n\r\n RegAnomaliaModel.salvarAnomalia(regAnomalia.anomalia).then(function (resposta) {\r\n $uibModalInstance.close(resposta);\r\n });\r\n }\r\n };\r\n\r\n regAnomalia.cancel = function () {\r\n $uibModalInstance.dismiss(TranslateService('cancel-by-user'));\r\n };\r\n\r\n regAnomalia.shouldShowTooltip = function (campo) {\r\n if (!campo) {\r\n return false;\r\n }\r\n\r\n var touched = campo.$touched;\r\n var submitted = campo.$$parentForm.$submitted;\r\n var invalid = campo.$invalid;\r\n var retorno = (submitted && invalid) || (touched && invalid);\r\n\r\n return retorno;\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n getListas();\r\n regAnomalia.anomalia.DthAnomalia = validacao.getNowTurno();\r\n regAnomalia.anomalia.DscCausa = TranslateService('manual-anomaly');\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RegImportacaoController', RegImportacaoController);\r\n RegImportacaoController.$inject = [\r\n '$uibModalInstance',\r\n 'historico',\r\n 'ModalService',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function RegImportacaoController(\r\n $uibModalInstance,\r\n historico,\r\n ModalService,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var regImportacao = this;\r\n regImportacao.historico = historico.data;\r\n\r\n //Métodos privados\r\n \r\n regImportacao.ok = function () {\r\n $uibModalInstance.close(true);\r\n }\r\n \r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RegTurnoBlocoController', RegTurnoBlocoController);\r\n RegTurnoBlocoController.$inject = [\r\n '$uibModalInstance',\r\n 'bloco',\r\n 'ModalService',\r\n 'SelTurnoService',\r\n 'ValidacaoService',\r\n 'MessageService',\r\n 'blocos',\r\n 'isEmAvaliacao',\r\n 'TranslateService',\r\n 'CtrEncerranteModel'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function RegTurnoBlocoController(\r\n $uibModalInstance,\r\n bloco,\r\n ModalService,\r\n SelTurnoService,\r\n validacao,\r\n MessageService,\r\n blocos,\r\n isEmAvaliacao,\r\n TranslateService,\r\n CtrEncerranteModel\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var turnoBloco = this;\r\n var previousTurnoBloco = JSON.parse(JSON.stringify(bloco));\r\n\r\n //Propriedades privadas\r\n\r\n //Propriedades públicas\r\n turnoBloco.bloco = bloco;\r\n turnoBloco.blocos = blocos;\r\n turnoBloco.SelTurnoService = SelTurnoService;\r\n turnoBloco.patternEncerrante = null;\r\n turnoBloco.validacao = validacao;\r\n turnoBloco.formato = null;\r\n turnoBloco.active = blocos.indexOf(bloco);\r\n turnoBloco.isEmAvaliacao = isEmAvaliacao;\r\n\r\n //Métodos privados\r\n function finalizaEdicao(form) {\r\n turnoBloco.bloco.valido = form.$valid;\r\n $uibModalInstance.close(turnoBloco.blocos);\r\n validacao.resetForm(form);\r\n }\r\n\r\n\r\n //Métodos publicos\r\n turnoBloco.ok = function (form) {\r\n form.$valid = true;\r\n form.$invalid = false;\r\n finalizaEdicao(form);\r\n };\r\n\r\n turnoBloco.validaEncerranteInicial = function ($value) {\r\n return validacao.validaEncerrante($value,\r\n turnoBloco.bloco.ValEncerranteFinalTurnoAnterior,\r\n turnoBloco.bloco.NumToleranciaAcima,\r\n turnoBloco.bloco.NumToleranciaAbaixo);\r\n };\r\n\r\n turnoBloco.validaEncerranteFinal = function ($value) {\r\n if (turnoBloco.SelTurnoService.turno.StuTurno == \"NO\" || (turnoBloco.SelTurnoService.turno.StuTurno == \"AB\" && $value == null)) {\r\n return true;\r\n }\r\n else if (turnoBloco.SelTurnoService.turno.StuTurno == \"AB\" && $value != null) {\r\n return validacao.validaEncerrante($value,\r\n turnoBloco.bloco.ValEncerranteFinalPostoFacil,\r\n turnoBloco.bloco.NumToleranciaAcima,\r\n turnoBloco.bloco.NumToleranciaAbaixo);\r\n }\r\n };\r\n\r\n turnoBloco.anterior = function () {\r\n turnoBloco.active = (--turnoBloco.active + blocos.length) % blocos.length;\r\n turnoBloco.bloco = blocos[turnoBloco.active];\r\n };\r\n\r\n turnoBloco.proximo = function () {\r\n turnoBloco.active = ++turnoBloco.active % blocos.length;\r\n turnoBloco.bloco = blocos[turnoBloco.active];\r\n };\r\n\r\n turnoBloco.cancel = function () {\r\n retorePreviousEditableValues();\r\n $uibModalInstance.close(true);\r\n };\r\n\r\n function retorePreviousEditableValues() {\r\n bloco.DthEncerranteInicial = new Date(previousTurnoBloco.DthEncerranteInicial);\r\n bloco.ValEncerranteInicial = previousTurnoBloco.ValEncerranteInicial;\r\n bloco.DthEncerranteFinal = new Date(previousTurnoBloco.DthEncerranteFinal);\r\n bloco.ValEncerranteFinal = previousTurnoBloco.ValEncerranteFinal;\r\n }\r\n\r\n turnoBloco.changeTimeInicial = function (bloco) {\r\n turnoBloco.validacao.changeTime(bloco, 'DthEncerranteInicial');\r\n CtrEncerranteModel.getFirstAndLast(\r\n SelTurnoService.turno.DataInicial,\r\n SelTurnoService.turno.DataFinal,\r\n bloco.IdcBlocoMedidor\r\n ).then(function (resposta) {\r\n bloco.firstCounter = resposta.first.DthCtrEncerrante;\r\n bloco.lastCounter = resposta.last.DthCtrEncerrante;\r\n });\r\n };\r\n\r\n turnoBloco.changeTimeFinal = function (bloco) {\r\n turnoBloco.validacao.changeTime(bloco, 'DthEncerranteFinal');\r\n CtrEncerranteModel.getFirstAndLast(\r\n SelTurnoService.turno.DataInicial,\r\n SelTurnoService.turno.DataFinal,\r\n bloco.IdcBlocoMedidor\r\n ).then(function (resposta) {\r\n bloco.firstCounter = resposta.first.DthCtrEncerrante;\r\n bloco.lastCounter = resposta.last.DthCtrEncerrante;\r\n });\r\n };\r\n\r\n turnoBloco.checkFirstCounter = function (bloco, $value) {\r\n if (!bloco.firstCounter) return true;\r\n return $value < bloco.firstCounter\r\n };\r\n\r\n turnoBloco.checkLastCounter = function (bloco, $value) {\r\n if (!bloco.lastCounter) return true;\r\n return $value > bloco.lastCounter\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n turnoBloco.bloco.DthEncerranteInicial = turnoBloco.bloco.DthEncerranteInicial ||\r\n turnoBloco.SelTurnoService.turno.DataInicial;\r\n turnoBloco.bloco.DthEncerranteFinal = turnoBloco.bloco.DthEncerranteFinal ||\r\n turnoBloco.SelTurnoService.turno.DataFinal;\r\n turnoBloco.formato = validacao.getFormatoEncerrante(bloco);\r\n turnoBloco.patternEncerrante = validacao.getPatternEncerrante(turnoBloco.bloco);\r\n\r\n previousTurnoBloco = JSON.parse(JSON.stringify(bloco));\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RegTurnoController', RegTurnoController);\r\n RegTurnoController.$inject = [\r\n 'UsuarioService',\r\n 'SelTurnoService',\r\n 'TurnoModel',\r\n 'ModalService',\r\n 'TransitionService',\r\n 'MessageService',\r\n 'RegAnomaliaService',\r\n '$state',\r\n 'SpinnerService',\r\n 'TanquePostoModel',\r\n 'TranslateService',\r\n 'CheckTurno',\r\n 'CtrEncerranteModel',\r\n '$q',\r\n 'MessageModel'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function RegTurnoController(\r\n UsuarioService,\r\n SelTurnoService,\r\n TurnoModel,\r\n ModalService,\r\n TransitionService,\r\n MessageService,\r\n RegAnomaliaService,\r\n $state,\r\n SpinnerService,\r\n TanquePostoModel,\r\n TranslateService,\r\n CheckTurno,\r\n CtrEncerranteModel,\r\n $q,\r\n MessageModel\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var turno = this;\r\n\r\n //Propriedades privadas\r\n var sppiner = new SpinnerService();\r\n\r\n var modalTanque = new ModalService({\r\n templateUrl: 'turnoTanque.html',\r\n controller: 'RegTurnoTanqueController',\r\n controllerAs: 'turnoTanque'\r\n });\r\n\r\n var modalBloco = new ModalService({\r\n templateUrl: 'turnoBloco.html',\r\n controller: 'RegTurnoBlocoController',\r\n controllerAs: 'turnoBloco'\r\n });\r\n\r\n //Propriedades públicas\r\n turno.usuario = UsuarioService;\r\n turno.selTurnoService = SelTurnoService;\r\n turno.regTurno = null;\r\n turno.blocoSelected = null;\r\n turno.tanqueSelected = null;\r\n turno.showFechamento = false;\r\n turno.listaFechamento = null;\r\n turno.showTela = false;\r\n turno.registroValido = false;\r\n turno.isEmAvaliacao = false;\r\n\r\n //Métodos privados\r\n function onChangeTurno(regTurno) {\r\n if (!regTurno) return;\r\n\r\n TurnoModel.canOpenShift(regTurno).then(function (resposta) {\r\n return TurnoModel.isEmAvaliacao(resposta.IdcRegTurno)\r\n .then(function (isEmValidacao) {\r\n turno.isEmAvaliacao = isEmValidacao;\r\n return resposta\r\n });\r\n }).then(function (resposta) {\r\n if (!resposta.canOpenShift) {\r\n SelTurnoService.turno = null;\r\n throw new Error(TranslateService('shift-can-not-be-opened'));\r\n }\r\n\r\n if (resposta.StuTurno === 'VA' ||\r\n resposta.StuTurno === 'FI' ||\r\n resposta.StuTurno === 'IN') {\r\n SelTurnoService.turno = null;\r\n throw new Error(TranslateService('closed-shift-can-not-be-opened'));\r\n }\r\n\r\n return TurnoModel.getComplete(regTurno);\r\n }).then(function (turnoCompleto) {\r\n turno.regTurno = setValido(turnoCompleto);\r\n turno.showTela = !!turnoCompleto;\r\n return TurnoModel.getFechamento(turno.regTurno.IdcRegTurno, turno.regTurno.IdcPosto);\r\n }).then(function (fechamento) {\r\n turno.listaFechamento = formatFechamento(fechamento);\r\n }).then(function () {\r\n return TanquePostoModel.getByIdPosto(turno.regTurno.IdcPosto);\r\n }).then(function (tanques) {\r\n turno.regTurno.ListaRegTurnoTanquePostoDQO.forEach(function (tanqueDQO) {\r\n tanques.forEach(function (tanque) {\r\n if (tanque.IdcTanquePosto === tanqueDQO.IdcTanquePosto) {\r\n tanqueDQO.CadTanquePosto = tanque;\r\n tanqueDQO.AlturaInicialProxy = tanqueDQO.AltInicial;\r\n tanqueDQO.AlturaFinalProxy = tanqueDQO.AltFinal;\r\n }\r\n });\r\n });\r\n\r\n setFirstAndLastEncerrantes(turno.regTurno);\r\n\r\n }).catch(function (error) {\r\n console.log(error);\r\n MessageService.alert(TranslateService('error-ocurred') + error.toString().replace(TranslateService('error') +': ', ''));\r\n $state.go('home');\r\n });\r\n }\r\n\r\n function setFirstAndLastEncerrantes(regTurno) {\r\n\r\n regTurno.ListaRegTurnoBlocoMedidorDQO.forEach(function (bloco) {\r\n CtrEncerranteModel.getFirstAndLast(\r\n regTurno.DthInicial,\r\n regTurno.DthFinal,\r\n bloco.IdcBlocoMedidor\r\n ).then(function (resposta) {\r\n bloco.firstCounter = resposta.first && resposta.first.DthCtrEncerrante;\r\n bloco.lastCounter = resposta.last && resposta.last.DthCtrEncerrante;\r\n }).catch(function(error){\r\n console.log(error);\r\n\r\n var message = error && error.data ? error.data.Message : error;\r\n\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('error-ocurred') + message\r\n );\r\n $state.go('home');\r\n });\r\n });\r\n\r\n }\r\n\r\n function formatFechamento(lista) {\r\n var retorno = {};\r\n angular.forEach(lista, function (item) {\r\n retorno[item.DscProduto] = retorno[item.DscProduto] || [];\r\n retorno[item.DscProduto].push(item);\r\n });\r\n return retorno;\r\n }\r\n\r\n function clearTurno() {\r\n SelTurnoService.turno = null;\r\n turno.regTurno = null;\r\n turno.listaFechamento = null;\r\n $state.go('home');\r\n }\r\n\r\n function setValido(regTurno) {\r\n if (!regTurno) return;\r\n if (regTurno.StuTurno !== 'AB') return regTurno;\r\n setValidoLista(regTurno.ListaRegTurnoTanquePostoDQO);\r\n setValidoLista(regTurno.ListaRegTurnoBlocoMedidorDQO);\r\n return regTurno;\r\n }\r\n\r\n function setValidoLista(lista) {\r\n lista.forEach(function (item) {\r\n item.valido = true;\r\n });\r\n }\r\n\r\n function valida() {\r\n if (!turno.regTurno) return false;\r\n var valido = true;\r\n\r\n valido &= validaLista(turno.regTurno.ListaRegTurnoTanquePostoDQO, 'VolInicial');\r\n valido &= validaLista(turno.regTurno.ListaRegTurnoBlocoMedidorDQO, 'ValEncerranteInicial');\r\n return valido;\r\n }\r\n\r\n function validaLista(lista, prop) {\r\n var valido = true;\r\n lista.forEach(function (item) {\r\n valido &= turno.validaValor(item[prop]);\r\n });\r\n return valido;\r\n }\r\n\r\n var salvarServidorWaiting = false;\r\n function salvarServidor(showMessage) {\r\n\r\n if (salvarServidorWaiting) return $q.reject();\r\n salvarServidorWaiting = true;\r\n\r\n if (showMessage === undefined) {\r\n showMessage = true;\r\n }\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n sppiner.spin();\r\n\r\n return turno.selTurnoService.salvarTurno(turno.regTurno).then(function (resposta) {\r\n if (!resposta || resposta === \"0\") throw new Error(TransitionService('erro-servidor'));\r\n turno.regTurno = setValido(resposta);\r\n turno.updateFechamento();\r\n\r\n if (showMessage) {\r\n return MessageService.showMessage('Sucesso');\r\n }\r\n\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n if (showMessage) {\r\n MessageService.showMessage('Erro');\r\n }\r\n return erro;\r\n }).then(function () {\r\n return TurnoModel.isEmAvaliacao(turno.regTurno.IdcRegTurno);\r\n }).then(function (isEmValidacao) {\r\n sppiner.stop();\r\n turno.isEmAvaliacao = isEmValidacao;\r\n salvarServidorWaiting = false;\r\n }).catch(function () {\r\n sppiner.stop();\r\n salvarServidorWaiting = false;\r\n });\r\n\r\n }\r\n\r\n function validaVolumesEncerrantesFinais(regTurno) {\r\n var valido = true;\r\n if (!(regTurno && regTurno.ListaRegTurnoBlocoMedidorDQO && regTurno.ListaRegTurnoTanquePostoDQO)) return false;\r\n\r\n angular.forEach(regTurno.ListaRegTurnoBlocoMedidorDQO, function (bloco) {\r\n valido &= !!bloco.DthEncerranteFinal;\r\n valido &= (bloco.ValEncerranteFinal == 0 ? true : !!bloco.ValEncerranteFinal);\r\n });\r\n\r\n angular.forEach(regTurno.ListaRegTurnoTanquePostoDQO, function (tanque) {\r\n valido &= (tanque.VolFinal == 0 ? true : !!tanque.VolFinal);\r\n });\r\n\r\n return valido;\r\n }\r\n\r\n function realizaFechamento(tipo) {\r\n\r\n var stuAnomalia = tipo === \"validar\" ? \"FE\" : \"AB\";\r\n turno.regTurno.tipo = tipo;\r\n return CheckTurno(turno.regTurno, stuAnomalia)\r\n .then(function () {\r\n if (tipo === \"validar\") {\r\n return true;\r\n }\r\n return salvarServidor(false);\r\n })\r\n .then(function (resposta) {\r\n if (resposta === \"0\") {\r\n throw new Error(TransitionService('erro-servidor'))\r\n }\r\n\r\n if (tipo === 'fechar') {\r\n return TurnoModel.fecharTurno(turno.regTurno.IdcRegTurno);\r\n }\r\n\r\n return TurnoModel.validarTurno(turno.regTurno);\r\n })\r\n .then(function (resposta) {\r\n if (resposta !== 'FALSE') {\r\n clearTurno();\r\n if (resposta.NumAnomaliasJaFechadas)\r\n MessageService.alert(TranslateService('success'), TranslateService('turno-validado-anomalia-fechadas', resposta.NumAnomaliasJaFechadas));\r\n else\r\n MessageService.alert(TranslateService('success'), TranslateService(tipo === 'fechar' ? 'shift-closed-successfully' : (resposta.EnviaSap && resposta.EnviaSap != null ? 'sucessoSAP' : 'shift-validated-successfully')));\r\n } else {\r\n MessageService.alert(TranslateService('error'), TranslateService(tipo === 'fechar' ? 'error-closing-shift' : 'error-validating-shift'));\r\n }\r\n })\r\n .catch(function (erro) {\r\n MessageModel.getMessages('erro').then(function (retorno) {\r\n if (retorno.data && retorno.data.length) {\r\n var alarm = retorno.data[0];\r\n var mensagem = alarm.AlarmMessage;\r\n if (erro != undefined) {\r\n MessageService.alert(TranslateService('atention'), ((erro != TranslateService('cancel-by-user') && erro != TranslateService('modalService-cancelou')) ? erro + ' ' + mensagem : TranslateService('modalService-cancelou')));\r\n }\r\n }\r\n });\r\n console.log(erro);\r\n });\r\n }\r\n\r\n turno.userHasNoPermissionToValidate = function () {\r\n if (!turno || !turno.regTurno) return false;\r\n var search = '-' + turno.regTurno.IdcPosto;\r\n var nodeId = Object.keys(UsuarioService.entityPrivilege).find(function (key) {\r\n //quebra a chave em array, para pegar o item referente ao posto\r\n var arrayFeatures = key.split(\"-\");\r\n //A ultima posição do Array é referente ao id do POSTO\r\n if (arrayFeatures.length === 5) {\r\n //valida se o ultimo item do array é igual ao posto\r\n return key.substring(key.length - search.length, key.length) === search;\r\n } else {\r\n return false;\r\n }\r\n });\r\n if (!nodeId) return false;\r\n return !UsuarioService.entityPrivilege[nodeId].includes('Validar_Turno');\r\n //return !PrivilegesService.includes(\"Validar_Turno\");\r\n };\r\n\r\n\r\n //Métodos publicos\r\n turno.tanqueClick = function (tanque) {\r\n turno.tanqueSelected = tanque;\r\n turno.editarTanque(tanque);\r\n };\r\n\r\n turno.blocoClick = function (bloco) {\r\n turno.blocoSelected = bloco;\r\n turno.editarBloco(bloco);\r\n };\r\n\r\n turno.editarBloco = function (bloco) {\r\n if (!bloco) return;\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n modalBloco.open({\r\n bloco: bloco,\r\n isEmAvaliacao: turno.isEmAvaliacao,\r\n blocos: function () {\r\n return turno.regTurno.ListaRegTurnoBlocoMedidorDQO;\r\n }\r\n });\r\n };\r\n\r\n turno.editarTanque = function (tanque) {\r\n if (!tanque) return;\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n modalTanque.open({\r\n locals: {\r\n tanque: tanque,\r\n tanques: turno.regTurno.ListaRegTurnoTanquePostoDQO,\r\n isEmAvaliacao: turno.isEmAvaliacao\r\n }\r\n });\r\n };\r\n\r\n turno.updateInformacoesFechamento = function () {\r\n if (!turno.regTurno) return;\r\n TurnoModel.getFechamento(turno.regTurno.IdcRegTurno, turno.regTurno.IdcPosto).then(function (fechamento) {\r\n turno.listaFechamento = formatFechamento(fechamento);;\r\n MessageService.prompt(TranslateService('information'), TranslateService('closing-information'));\r\n });\r\n };\r\n\r\n turno.updateFechamento = function () {\r\n if (!turno.regTurno) return;\r\n\r\n TurnoModel.getFechamento(turno.regTurno.IdcRegTurno, turno.regTurno.IdcPosto).then(function (fechamento) {\r\n turno.listaFechamento = formatFechamento(fechamento);\r\n });\r\n };\r\n\r\n turno.goToFechamento = function () {\r\n turno.showFechamento = true;\r\n turno.updateFechamento();\r\n };\r\n\r\n turno.registrarAnomalia = function () {\r\n var id = turno.regTurno ? turno.regTurno.IdcRegTurno : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n if (turno.regTurno.listAnomalia) {\r\n turno.regTurno.listAnomalia.push(anomalia.IdcAnomalia);\r\n }\r\n });\r\n };\r\n\r\n turno.salvar = function () {\r\n if (!turno.regTurno) return $q.reject();\r\n\r\n return CheckTurno(turno.regTurno)\r\n .then(salvarServidor);\r\n };\r\n\r\n turno.fecharTurno = function (tipo) {\r\n if (!turno.regTurno) return;\r\n\r\n if (validaVolumesEncerrantesFinais(turno.regTurno)) {\r\n if (valida()) {\r\n if (tipo === 'validar') {\r\n MessageService.prompt(TranslateService('atention'), TranslateService('confirma-validacao'))\r\n .then(function (resposta) {\r\n realizaFechamento(tipo);\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n });\r\n } else {\r\n realizaFechamento(tipo);\r\n } \r\n } else {\r\n //MessageService.alert('Dados Inválidos', 'Um ou mais dados dos blocos e/ou tanques estão inválidos. Corrija antes de salvar.');\r\n MessageService.prompt(TranslateService('invalid-data'), TranslateService('invalid-data-anomaly'))\r\n .then(function () {\r\n return turno.registrarAnomalia();\r\n })\r\n .then(function (resposta) {\r\n if (tipo === 'validar') {\r\n MessageService.prompt(TranslateService('atention'), TranslateService('confirma-validacao'))\r\n .then(function (resposta) {\r\n realizaFechamento(tipo);\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n });\r\n } else {\r\n realizaFechamento(tipo);\r\n }\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n });\r\n }\r\n } else {\r\n MessageService.alert(TranslateService('error'), TranslateService('volumes-counters-not-informed'));\r\n }\r\n\r\n };\r\n\r\n turno.inoperar = function () {\r\n if (!turno.regTurno) return;\r\n turno.regTurno.StuTurno = 'IN';\r\n TurnoModel.inoperarTurno(turno.regTurno).then(function (resposta) {\r\n turno.regTurno = null;\r\n SelTurnoService.turno = null;\r\n return MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n return MessageService.alert(TranslateService('error'), erro);\r\n }).then(function () {\r\n $state.go('home');\r\n });\r\n };\r\n\r\n turno.validaValor = function (volume) {\r\n return volume !== null &&\r\n volume !== undefined &&\r\n volume >= 0;\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n turno.selTurnoService.onChangeTurno(onChangeTurno);\r\n turno.selTurnoService.selectTurno().catch(console.log);\r\n })();\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('RegTurnoTanqueController', RegTurnoTanqueController);\r\n RegTurnoTanqueController.$inject = [\r\n '$uibModalInstance',\r\n 'ValidacaoService',\r\n 'GeneralModel',\r\n 'MessageService',\r\n 'Constant',\r\n 'locals',\r\n 'TranslateService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function RegTurnoTanqueController(\r\n $uibModalInstance,\r\n validacao,\r\n GeneralModel,\r\n MessageService,\r\n Constant,\r\n locals,\r\n TranslateService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var turnoTanque = this;\r\n\r\n //Propriedades privadas\r\n\r\n //Propriedades públicas\r\n turnoTanque.tanque = locals.tanque;\r\n turnoTanque.tanques = locals.tanques;\r\n turnoTanque.validacao = validacao;\r\n turnoTanque.active = turnoTanque.tanques.indexOf(locals.tanque);\r\n turnoTanque.isEmAvaliacao = locals.isEmAvaliacao;\r\n turnoTanque.expedido = null;\r\n\r\n var turnoTanquePrevious = JSON.parse(JSON.stringify(turnoTanque));\r\n\r\n //Métodos privados\r\n\r\n function finalizaEdicao(form) {\r\n turnoTanque.tanque.valido = form.$valid;\r\n $uibModalInstance.close(turnoTanque.tanque);\r\n validacao.resetForm(form);\r\n }\r\n\r\n function setAlturaRegua() {\r\n var fator = Constant.UNIDADES_ALTURA[turnoTanque.tanque.CadTanquePosto.UnidadeAlturaRegua.toUpperCase()];\r\n\r\n turnoTanque.tanque.AltInicial = turnoTanque.tanque.AlturaInicialProxy * fator;\r\n turnoTanque.tanque.AltFinal = turnoTanque.tanque.AlturaFinalProxy * fator;\r\n }\r\n\r\n //Métodos publicos\r\n turnoTanque.ok = function (form) {\r\n form.$valid = true;\r\n form.$invalid = false;\r\n finalizaEdicao(form);\r\n };\r\n\r\n turnoTanque.cancel = function (form) {\r\n retorePreviousEditableValues();\r\n $uibModalInstance.close(true);\r\n /*\r\n form.$valid = true;\r\n form.$invalid = false;\r\n turnoTanque.tanque.valido = form.$valid;\r\n $uibModalInstance.close(turnoTanque.tanque);\r\n */\r\n };\r\n\r\n function retorePreviousEditableValues() {\r\n \r\n turnoTanque.tanque.AlturaInicialProxy = turnoTanquePrevious.tanque.AlturaInicialProxy;\r\n turnoTanque.tanque.AlturaFinalProxy = turnoTanquePrevious.tanque.AlturaFinalProxy;\r\n }\r\n\r\n turnoTanque.changeVolume20C = function (tipo) {\r\n var pIdcProduto = turnoTanque.tanque.IdcProduto;\r\n var pValTemperatura = tipo === 'inicial' ? turnoTanque.tanque.TmpInicial : turnoTanque.tanque.TmpFinal;\r\n var pValDensidade = tipo === 'inicial' ? turnoTanque.tanque.DenInicial : turnoTanque.tanque.DenFinal;\r\n var pValVolume = tipo === 'inicial' ? turnoTanque.tanque.VolInicial : turnoTanque.tanque.VolFinal;\r\n var prop = tipo === 'inicial' ? 'Vol20cInicial' : 'Vol20cFinal';\r\n\r\n if (!(pIdcProduto && pValTemperatura && pValDensidade && pValVolume)) return;\r\n\r\n GeneralModel.getVolume20C(pIdcProduto, pValTemperatura, pValDensidade, pValVolume).then(function (resposta) {\r\n turnoTanque.tanque[prop] = Number(resposta);\r\n });\r\n };\r\n\r\n turnoTanque.changeAltura = function (tipo) {\r\n\r\n setAlturaRegua();\r\n\r\n var prop = tipo === 'inicial' ? 'VolInicial' : 'VolFinal';\r\n var pAltRegua = tipo === 'inicial' ? turnoTanque.tanque.AltInicial : turnoTanque.tanque.AltFinal;\r\n var pIdcTanquePosto = turnoTanque.tanque.IdcTanquePosto;\r\n\r\n GeneralModel.getVolumeByAltRegua(pIdcTanquePosto, pAltRegua).then(function (resposta) {\r\n turnoTanque.tanque[prop] = Number(resposta);\r\n turnoTanque.changeVolume20C(tipo);\r\n });\r\n };\r\n\r\n turnoTanque.anterior = function () {\r\n turnoTanque.active = (--turnoTanque.active + turnoTanque.tanques.length) % turnoTanque.tanques.length;\r\n turnoTanque.tanque = turnoTanque.tanques[turnoTanque.active];\r\n turnoTanquePrevious = JSON.parse(JSON.stringify(turnoTanque));\r\n };\r\n\r\n turnoTanque.proximo = function () {\r\n turnoTanque.active = ++turnoTanque.active % turnoTanque.tanques.length;\r\n turnoTanque.tanque = turnoTanque.tanques[turnoTanque.active];\r\n turnoTanquePrevious = JSON.parse(JSON.stringify(turnoTanque));\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('SaidaPortariaController', SaidaPortariaController);\r\n SaidaPortariaController.$inject = [\r\n '$uibModalInstance',\r\n 'listaSaidas',\r\n 'TranslateService',\r\n 'RecebimentoFiscalModel',\r\n 'MessageService'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function SaidaPortariaController(\r\n $uibModalInstance,\r\n listaSaidas,\r\n TranslateService,\r\n RecebimentoFiscalModel,\r\n MessageService\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n\r\n\r\n //Propriedades privadas\r\n\r\n var saidaPortaria = this;\r\n saidaPortaria.dataHora = false;\r\n \r\n\r\n saidaPortaria.lista = []\r\n //Propriedades públicas\r\n\r\n //Métodos publicos\r\n saidaPortaria.getLista = function () {\r\n if (!listaSaidas) {\r\n return;\r\n }\r\n saidaPortaria.lista = listaSaidas.lista;\r\n };\r\n\r\n saidaPortaria.changeField = function (idfiscal) {\r\n saidaPortaria.dataHora = true;\r\n saidaPortaria.lista.filter(function (item) {\r\n return item.fiscal.IdentificadorRecebimentoFiscalProduto == idfiscal;\r\n })[0].editado = true;\r\n };\r\n\r\n saidaPortaria.ok = function () {\r\n for (var i = 0; i < saidaPortaria.lista.length; i++) {\r\n if(saidaPortaria.lista[i].editado){\r\n RecebimentoFiscalModel.updateDataSaidaPortaria(saidaPortaria.lista[i].fiscal)\r\n .then(function (resposta) {\r\n $uibModalInstance.dismiss('cancel');\r\n setTimeout(function() {\r\n return MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n }, 600);\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), erro);\r\n });\r\n }\r\n }\r\n }\r\n\r\n saidaPortaria.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n saidaPortaria.getLista()\r\n })();\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('SelAbastecimentosController', SelAbastecimentosController);\r\n\r\n SelAbastecimentosController.$inject = [\r\n '$uibModalInstance',\r\n 'AbastecimentoModel',\r\n 'locals'\r\n ];\r\n\r\n function SelAbastecimentosController(\r\n $uibModalInstance,\r\n AbastecimentoModel,\r\n locals\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var selAbast = this;\r\n var posto = locals.posto;\r\n var abastecimentos = locals.abastecimentos;\r\n var IdcTransferencia = locals.IdcTransferencia;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n selAbast.listaAbastecimentos = [];\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n AbastecimentoModel.getRessuprimento(posto.IdcPosto, IdcTransferencia)\r\n .then(function (listaAbastecimentos) {\r\n selAbast.listaAbastecimentos = listaAbastecimentos;\r\n\r\n selAbast.listaAbastecimentos.forEach(function(aba){\r\n if(aba.IdcTransferencia == IdcTransferencia){\r\n aba.selected = true;\r\n }\r\n });\r\n\r\n if (!abastecimentos) {\r\n return;\r\n }\r\n\r\n selAbast.listaAbastecimentos.forEach(function (abastServidor) {\r\n abastecimentos.forEach(function (abastTransferencia) {\r\n if (abastServidor.IdcAbastecimento === abastTransferencia.IdcAbastecimento) {\r\n abastServidor.selected = true;\r\n }\r\n })\r\n });\r\n })\r\n }\r\n\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n selAbast.ok = function () {\r\n var retorno = [];\r\n\r\n if (selAbast.listaAbastecimentos) {\r\n retorno = selAbast.listaAbastecimentos.filter(function (item) {\r\n return item.selected;\r\n });\r\n }\r\n\r\n $uibModalInstance.close(retorno);\r\n };\r\n\r\n selAbast.somaVolumes = function (regAbastecimento) {\r\n return regAbastecimento.ListRegAbastecimentoTanque.reduce(function (sum, tanque) {\r\n return sum + tanque.VolAbastecimento;\r\n }, 0);\r\n };\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('SelComplexoSolicitanteController', SelComplexoSolicitanteController);\r\n\r\n SelComplexoSolicitanteController.$inject = [\r\n '$uibModalInstance',\r\n 'entry'\r\n ];\r\n\r\n function SelComplexoSolicitanteController(\r\n $uibModalInstance,\r\n entry\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var selComplexoSolicitante = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n selComplexoSolicitante.complexos = entry.complexos;\r\n selComplexoSolicitante.selected = null;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n selComplexoSolicitante.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n selComplexoSolicitante.ok = function () {\r\n $uibModalInstance.close(selComplexoSolicitante.selected);\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('SelecaoRecebimentoFisicoController', SelecaoRecebimentoFisicoController);\r\n SelecaoRecebimentoFisicoController.$inject = [\r\n '$uibModalInstance',\r\n 'locals',\r\n 'TranslateService',\r\n 'MessageService',\r\n 'Constant'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function SelecaoRecebimentoFisicoController(\r\n $uibModalInstance,\r\n locals,\r\n TranslateService,\r\n MessageService,\r\n Constant\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n\r\n\r\n //Propriedades privadas\r\n\r\n var selecaoRecebFisico = this;\r\n\r\n //Propriedades públicas\r\n\r\n selecaoRecebFisico.listaRecebimentos = locals.recebimentosSelecao;\r\n\r\n //Métodos privados\r\n \r\n \r\n //Métodos publicos\r\n\r\n selecaoRecebFisico.selection = function (recebimento) {\r\n recebimento.ListDetalheRecebimentoProduto = recebimento.ListDetalheRecebimentoProduto.sort(function (a, b) {\r\n return a.IdentificadorDetalheRecebimentoProduto - b.IdentificadorDetalheRecebimentoProduto;\r\n });\r\n if (selecaoRecebFisico.selected) {\r\n selecaoRecebFisico.selected = null;\r\n }\r\n else {\r\n selecaoRecebFisico.selected = recebimento;\r\n }\r\n }\r\n\r\n selecaoRecebFisico.somaRecebimentoFisico = function(listaDetalhes) {\r\n return listaDetalhes.reduce(function (sum, fisico) {\r\n return fisico.QuantidadeRecebida + sum;\r\n }, 0);\r\n }\r\n\r\n selecaoRecebFisico.getDescricaoTipo = function (tipo) {\r\n return TranslateService(Constant.TIPOS_RECEBIMENTO[tipo]);\r\n }\r\n\r\n selecaoRecebFisico.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n selecaoRecebFisico.confirmar = function () {\r\n if (selecaoRecebFisico.selected) {\r\n $uibModalInstance.close(selecaoRecebFisico.selected);\r\n }\r\n else {\r\n MessageService.alert(TranslateService('select-a-line-to-edit'));\r\n }\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n })();\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('SelTipoRecFisicoController', SelTipoRecFisicoController);\r\n\r\n SelTipoRecFisicoController.$inject = [\r\n 'tipos',\r\n '$uibModalInstance'\r\n ];\r\n\r\n function SelTipoRecFisicoController(\r\n tipos,\r\n $uibModalInstance\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var selTipoRecFisico = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n selTipoRecFisico.tipos = tipos;\r\n selTipoRecFisico.selected = null;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n selTipoRecFisico.cancelar = function () {\r\n $uibModalInstance.dismiss('cancel');\r\n };\r\n\r\n selTipoRecFisico.ok = function () {\r\n $uibModalInstance.close(selTipoRecFisico.selected);\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').service('localidades', function () { });\r\n angular.module('posto-facil').controller('SelTurnoController', SelTurnoController);\r\n SelTurnoController.$inject = [\r\n '$uibModalInstance',\r\n 'TurnoModel',\r\n 'TreeViewModel',\r\n 'SpinnerService',\r\n 'ModalService',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'UsuarioService',\r\n 'localidades',\r\n 'SelTurnoService',\r\n 'TanquePostoModel'\r\n ];\r\n\r\n /**\r\n * Controller da barra de navegação\r\n * \r\n */\r\n function SelTurnoController(\r\n $uibModalInstance,\r\n TurnoModel,\r\n TreeViewModel,\r\n SpinnerService,\r\n ModalService,\r\n MessageService,\r\n TranslateService,\r\n UsuarioService,\r\n localidades,\r\n statusTurno,\r\n SelTurnoService,\r\n TanquePostoModel\r\n ) {\r\n //Associa a instancia do controller em uma variável privada\r\n var selTurno = this;\r\n\r\n selTurno.statusTurno = {\r\n model: statusTurno,\r\n availableOptions: [\r\n { id: 'TO', status: TranslateService('todos') },\r\n { id: 'NO', status: TranslateService('novo') },\r\n { id: 'AB', status: TranslateService('aberto') },\r\n { id: 'FE', status: TranslateService('fechado') },\r\n { id: 'VA', status: TranslateService('validado') },\r\n { id: 'IN', status: TranslateService('inoperante') }\r\n ]\r\n };\r\n\r\n //Propriedades privadas\r\n\r\n var modalJustificativa = new ModalService({\r\n templateUrl: 'modalJustificativaReabertura.html',\r\n controller: 'ModalJustificativaReaberturaController',\r\n controllerAs: 'justificativa'\r\n });\r\n\r\n var modalTurno = new ModalService({\r\n templateUrl: 'modalTurnoValidado.html',\r\n controller: 'ModalTurnoValidadoController',\r\n controllerAs: 'modalTurnoValidado',\r\n size: 'xl'\r\n });\r\n\r\n var nodeId = 'root';\r\n var lastNodeId;\r\n var lastDataInicial;\r\n var lastDataFinal;\r\n var sppiner = new SpinnerService('table-selturno');\r\n var statusAnterior;\r\n var turnoMenorData = null;\r\n\r\n //Propriedades públicas\r\n selTurno.localidades = localidades;\r\n selTurno.turnos = [];\r\n selTurno.diretorias = [];\r\n selTurno.selected = selTurno.turnos[0];\r\n selTurno.dataInicial = getDateNowWithoutTime();\r\n selTurno.dataFinal = getDateNowWithoutTime();\r\n selTurno.dataInicialOptions = { maxDate: selTurno.dataFinal };\r\n selTurno.dataFinalOptions = { minDate: selTurno.dataInicial };\r\n selTurno.popupDataInicial = { opened: false };\r\n selTurno.popupDataFinal = { opened: false };\r\n selTurno.dataTreeview = [];\r\n selTurno.mensagem = null;\r\n selTurno.statusSelect = 'TO';\r\n selTurno.turnoList = [];\r\n selTurno.checkTodos = { select: false };\r\n\r\n //Métodos privados\r\n function getTurnos(nodeId, dthInicial, dthFinal, status) {\r\n selTurno.mensagem = null;\r\n sppiner.spin();\r\n TurnoModel.getAll(nodeId, dthInicial, dthFinal, status)\r\n .then(function (turnos) {\r\n selTurno.turnos = turnos;\r\n sppiner.stop();\r\n if (!turnos || turnos.length === 0) {\r\n selTurno.mensagem = TranslateService(\"not-found\");\r\n }\r\n });\r\n }\r\n\r\n function getDateNowWithoutTime() {\r\n var response = new Date;\r\n response.setHours(0);\r\n response.setMinutes(0);\r\n response.setSeconds(0);\r\n response.setMilliseconds(0);\r\n return response;\r\n }\r\n\r\n function getTreeView() {\r\n return TreeViewModel.getAll()\r\n .then(function (tree) {\r\n selTurno.dataTreeview = tree;\r\n selTurno.diretorias = tree[0].children;\r\n\r\n setLocalidades(selTurno.diretorias);\r\n });\r\n }\r\n\r\n function setLocalidades(diretorias) {\r\n if (!(diretorias && diretorias.length)) return;\r\n\r\n selTurno.localidades.diretoria = selTurno.localidades.diretoria || diretorias[0];\r\n\r\n if (!(selTurno.localidades.diretoria &&\r\n selTurno.localidades.diretoria.children &&\r\n selTurno.localidades.diretoria.children.length)) return;\r\n\r\n selTurno.localidades.complexo = selTurno.localidades.complexo || selTurno.localidades.diretoria.children[0];\r\n\r\n if (!(selTurno.localidades.complexo &&\r\n selTurno.localidades.complexo.children &&\r\n selTurno.localidades.complexo.children.length)) return;\r\n\r\n selTurno.localidades.unidade = selTurno.localidades.unidade || selTurno.localidades.complexo.children[0];\r\n\r\n if (!(selTurno.localidades.unidade &&\r\n selTurno.localidades.unidade.children &&\r\n selTurno.localidades.unidade.children.length)) return;\r\n\r\n selTurno.localidades.posto = selTurno.localidades.posto || selTurno.localidades.unidade.children[0];\r\n\r\n nodeId = selTurno.localidades.posto.id;\r\n }\r\n\r\n //Métodos publicos\r\n selTurno.ok = function () {\r\n if (!selTurno.selected) {\r\n MessageService.alert(\r\n TranslateService('atention'),\r\n TranslateService(\"no-shift-selected\")\r\n );\r\n return;\r\n }\r\n\r\n if (selTurno.selected.StuTurno !== 'AB' &&\r\n selTurno.selected.StuTurno !== 'NO' &&\r\n selTurno.selected.StuTurno !== 'FE') {\r\n MessageService.alert(\r\n TranslateService('atention'),\r\n TranslateService(\"status-not-allowed\")\r\n );\r\n return;\r\n }\r\n $uibModalInstance.close(selTurno.selected);\r\n };\r\n\r\n selTurno.cancel = function () {\r\n $uibModalInstance.dismiss(TranslateService(\"cancel-by-user\"));\r\n };\r\n\r\n selTurno.openDataInicial = function () {\r\n selTurno.popupDataInicial.opened = true;\r\n };\r\n\r\n selTurno.openDataFinal = function () {\r\n selTurno.popupDataFinal.opened = true;\r\n };\r\n\r\n selTurno.changeFiltro = function (pNodeId, force) {\r\n nodeId = pNodeId || nodeId;\r\n\r\n if (lastDataFinal == selTurno.dataFinal &&\r\n lastDataInicial == selTurno.dataInicial &&\r\n lastNodeId == nodeId &&\r\n !force) {\r\n return;\r\n }\r\n\r\n //Para o datepicker reconhecer o range tem que setar de novo os options sempre\r\n //que a data muda\r\n selTurno.dataInicialOptions = { maxDate: selTurno.dataFinal };\r\n selTurno.dataFinalOptions = { minDate: selTurno.dataInicial };\r\n\r\n lastDataFinal = selTurno.dataFinal;\r\n lastDataInicial = selTurno.dataInicial;\r\n lastNodeId = nodeId;\r\n\r\n var cloneFinal = new Date(selTurno.dataFinal);\r\n cloneFinal.setDate(cloneFinal.getDate() + 1)\r\n\r\n getTurnos(nodeId, selTurno.dataInicial, cloneFinal, selTurno.statusSelect);\r\n };\r\n\r\n selTurno.changeStatus = function (pNodeId) {\r\n\r\n nodeId = pNodeId || nodeId;\r\n\r\n var cloneFinal = new Date(selTurno.dataFinal);\r\n cloneFinal.setDate(cloneFinal.getDate() + 1);\r\n\r\n getTurnos(nodeId, selTurno.dataInicial, cloneFinal, selTurno.statusSelect);\r\n\r\n };\r\n\r\n selTurno.select = function (turno) {\r\n selTurno.selected = turno;\r\n if (turno.StuTurno === 'VA') {\r\n openModalSelecao(turno);\r\n }\r\n else {\r\n selTurno.ok();\r\n }\r\n };\r\n\r\n function openModalSelecao(turno) {\r\n return modalTurno.open({\r\n locals: {\r\n turno: turno\r\n }\r\n });\r\n }\r\n\r\n function openModalJustificativa(turno) {\r\n return modalJustificativa.open({\r\n locals: {\r\n turno: turno\r\n }\r\n });\r\n }\r\n\r\n selTurno.reabrir = function (e, turno) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n MessageService.prompt(\r\n TranslateService(\"atention\"),\r\n TranslateService(turno.StuTurno != \"IN\" ? (turno.StuTurno != \"VA\" ? \"reopen-shift-message\" : \"deseja-solicitar-reabertura-turno\") : \"reset-shift-message\")\r\n ).then(function () {\r\n if (turno.StuTurno == \"VA\") {\r\n e.stopPropagation();\r\n openModalJustificativa(turno).then(function (resposta) {\r\n if (resposta !== false) {\r\n turno.JustifReaberturaTurno = resposta;\r\n turno.isAvaliacao = true;\r\n selTurno.reOpenShift(turno);\r\n }\r\n });\r\n } else {\r\n selTurno.reOpenShift(turno);\r\n }\r\n });\r\n };\r\n\r\n selTurno.reOpenShift = function (turno) {\r\n\r\n return TurnoModel.reopenShift(turno)\r\n .then(function (resposta) {\r\n if (resposta == \"null\") {\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('error-reopening-shift')\r\n );\r\n } else {\r\n return MessageService.alert(\r\n TranslateService('success'),\r\n TranslateService(turno.StuTurno != 'IN' ? (turno.StuTurno != 'VA' ? 'success-reopening-shift' : 'solicitacao-reabertura-turno-validacao-sucesso' ) : 'success-reset-shift')\r\n ).then(function () {\r\n if (turno.StuTurno == 'IN') {\r\n selTurno.changeFiltro(null, true);\r\n return;\r\n }\r\n turno.StuTurno = resposta.StuTurno;\r\n if (turno.StuTurno !== 'VA') {\r\n selTurno.select(turno);\r\n }\r\n });\r\n }\r\n }).catch(function (reason) {\r\n console.log(\"Não quer abrir\", reason);\r\n });\r\n }\r\n\r\n selTurno.showReabrirButton = function (turno) {\r\n return (['FE', 'IN', 'NO'].indexOf(turno.StuTurno) !== -1 && selTurno.canReopenShift(turno)) ||\r\n (turno.StuTurno === 'VA');\r\n };\r\n\r\n selTurno.canReopenShift = function (turno) {\r\n if (!turno) return false;\r\n var search = '-' + turno.IdcPosto;\r\n var nodeId = Object.keys(UsuarioService.entityPrivilege).find(function (key) {\r\n\r\n //quebra a chave em array, para pegar o item referente ao posto\r\n var arrayFeatures = key.split(\"-\");\r\n //A ultima posição do Array é referente ao id do POSTO\r\n if (arrayFeatures.length === 5) {\r\n //valida se o ultimo item do array é igual ao posto\r\n return key.substring(key.length - search.length, key.length) === search;\r\n } else {\r\n return false;\r\n }\r\n\r\n });\r\n\r\n if (!nodeId) return false;\r\n\r\n return UsuarioService.entityPrivilege[nodeId].includes('Registrar_Reabertura_Turno');\r\n };\r\n\r\n selTurno.operacao = function (e, turno) {\r\n\r\n if (turno.StuTurno === \"NO\") {\r\n selTurno.inoperar(e, turno);\r\n } else {\r\n selTurno.reabrir(e, turno);\r\n }\r\n };\r\n\r\n selTurno.inoperar = function (e, regTurno) {\r\n\r\n selTurno.turnoList = [];\r\n\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n selTurno.turnoList.push(regTurno);\r\n turnoMenorData = regTurno;\r\n\r\n selTurno.confirmarInoperar();\r\n\r\n };\r\n\r\n selTurno.inoperarMultiplos = function () {\r\n\r\n if (selTurno.statusSelect != 'NO') {\r\n lastDataInicial = selTurno.dataInicial;\r\n lastDataFinal = selTurno.dataFinal;\r\n statusAnterior = selTurno.statusSelect;\r\n selTurno.statusSelect = 'NO';\r\n selTurno.checkTodos = { select: false };\r\n } else {\r\n selTurno.statusSelect = statusAnterior;\r\n selTurno.dataInicial = lastDataInicial;\r\n selTurno.dataFinal = lastDataFinal;\r\n }\r\n\r\n selTurno.changeStatus();\r\n\r\n };\r\n\r\n selTurno.checkTodosTurnos = function () {\r\n angular.forEach(selTurno.turnos, function (item) {\r\n item.selected = event.target.checked;\r\n });\r\n };\r\n\r\n selTurno.checkboxSelected = function (turno) {\r\n turno.selected = event.target.checked;\r\n };\r\n\r\n selTurno.criarLista = function () {\r\n selTurno.turnoList = [];\r\n for (var i = 0; i < selTurno.turnos.length; i++) {\r\n if (selTurno.turnos[i].selected) {\r\n selTurno.turnoList.push(selTurno.turnos[i]);\r\n if (turnoMenorData == null) {\r\n turnoMenorData = selTurno.turnos[i];\r\n } else {\r\n if (selTurno.turnos[i].DataInicial < turnoMenorData.DataInicial) {\r\n turnoMenorData = selTurno.turnos[i];\r\n }\r\n }\r\n }\r\n }\r\n\r\n selTurno.confirmarInoperar();\r\n };\r\n\r\n selTurno.confirmarInoperar = function () {\r\n\r\n if (selTurno.turnoList.length > 0) {\r\n MessageService.prompt(\r\n TranslateService(\"atention\"),\r\n selTurno.turnoList.length == 1 ? TranslateService(\"msg-inoperar-turno\") : TranslateService(\"msg-inoperar-varios-turnos\", selTurno.turnoList.length)\r\n ).then(function () {\r\n TurnoModel.canOpenShift(turnoMenorData).then(function (resposta) {\r\n if (!resposta.canOpenShift) {\r\n SelTurnoService.turno = null;\r\n throw new Error(TranslateService('shift-can-not-be-inoperated'));\r\n }\r\n\r\n TurnoModel.selTurnoInoperar(selTurno.turnoList).then(function () {\r\n selTurno.turnoList = [];\r\n selTurno.changeFiltro(null, true);\r\n return MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n return MessageService.alert(TranslateService('error'), erro);\r\n }).then(function () {\r\n selTurno.checkTodos = { select: false };\r\n selTurno.changeFiltro(null, true);\r\n return;\r\n });\r\n\r\n }).catch(function (error) {\r\n console.log(error);\r\n MessageService.alert(TranslateService('error-ocurred') + error.toString().replace(TranslateService('error') + ': ', ''));\r\n });\r\n\r\n }).catch(function (reason) {\r\n console.log(\"Não quer inoperar\", reason);\r\n });\r\n } else {\r\n MessageService.alert(TranslateService('lista-turno-vazia'));\r\n }\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n getTreeView()\r\n .then(function () {\r\n selTurno.changeFiltro();\r\n });\r\n })();\r\n }\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('TipoFiscalController', TipoFiscalController);\r\n\r\n TipoFiscalController.$inject = [\r\n 'ValidacaoService',\r\n 'Constant',\r\n 'ModalService',\r\n 'TipoFiscalModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function TipoFiscalController(\r\n ValidacaoService,\r\n Constant,\r\n ModalService,\r\n TipoFiscalModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadTurno = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadTurno.filtro = '';\r\n cadTurno.listaTurno = null; \r\n cadTurno.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadTurno.selected = null;\r\n cadTurno.isTelaConsuta = true;\r\n cadTurno.validacao = ValidacaoService;\r\n\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n cadTurno.isTelaConsuta = true\r\n getTurno(); \r\n }\r\n\r\n function getTurno() {\r\n TipoFiscalModel.getAll()\r\n .then(function (resposta) {\r\n cadTurno.listaTurno = resposta;\r\n });\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n \r\n cadTurno.click = function (item) {\r\n cadTurno.selected = item;\r\n cadTurno.isTelaConsuta = false;\r\n }\r\n\r\n\r\n cadTurno.atualizar = function () {\r\n getTurno();\r\n } \r\n\r\n cadTurno.novo = function (formcadTurno) {\r\n cadTurno.isTelaConsuta = false;\r\n cadTurno.selected = {\r\n ListCadCaminhaoCompartimento : []\r\n };\r\n ValidacaoService.resetForm(formcadTurno);\r\n }\r\n\r\n cadTurno.salvar = function (formcadTurno) {\r\n \r\n if(formcadTurno.$valid)\r\n {\r\n TipoFiscalModel.save(cadTurno.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadTurno);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadTurno.isTelaConsuta = true;\r\n getTurno();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n }\r\n\r\n cadTurno.cancelar = function (formcadTurno) {\r\n cadTurno.isTelaConsuta = true;\r\n getTurno();\r\n cadTurno.selected = null;\r\n }\r\n\r\n cadTurno.excluir = function (formcadTurno) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n TipoFiscalModel.excluir(cadTurno.selected.IdcTipoFiscal)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadTurno);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadTurno.isTelaConsuta = true;\r\n getTurno();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('TransferenciaController', TransferenciaController);\r\n\r\n TransferenciaController.$inject = [\r\n 'SelTurnoService',\r\n 'TranferenciaModel',\r\n 'TransitionService',\r\n 'FocusService',\r\n 'ValidacaoService',\r\n 'ProdutoModel',\r\n 'UsuarioService',\r\n 'PostoModel',\r\n 'BlocoMedidorModel',\r\n 'CtrEncerranteModel',\r\n 'GeneralModel',\r\n 'RegAnomaliaService',\r\n 'MessageService',\r\n 'ModalService',\r\n 'TranslateService',\r\n 'CheckTransferencia'\r\n ];\r\n\r\n function TransferenciaController(\r\n SelTurnoService,\r\n TranferenciaModel,\r\n TransitionService,\r\n focus,\r\n ValidacaoService,\r\n ProdutoModel,\r\n UsuarioService,\r\n PostoModel,\r\n BlocoMedidorModel,\r\n CtrEncerranteModel,\r\n GeneralModel,\r\n RegAnomaliaService,\r\n MessageService,\r\n ModalService,\r\n TranslateService,\r\n CheckTransferencia\r\n ) {\r\n\r\n var transferencia = this;\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var bloco = null;\r\n var modalAbastecimentos = new ModalService({\r\n templateUrl: 'selAbastecimentos.html',\r\n controller: 'SelAbastecimentosController',\r\n controllerAs: 'selAbast'\r\n });\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n transferencia.SelTurnoService = SelTurnoService;\r\n transferencia.telas = {\r\n CONSULTA: 'CONSULTA',\r\n REGISTRO_ORIGEM: 'REGISTRO_ORIGEM',\r\n REGISTRO_DESTINO: 'REGISTRO_DESTINO'\r\n };\r\n\r\n function InicializaVariaveis() {\r\n transferencia.tela = transferencia.telas.CONSULTA;\r\n transferencia.filtro = null;\r\n transferencia.selected = null;\r\n transferencia.validacao = ValidacaoService;\r\n transferencia.produtos = [];\r\n transferencia.postos = [];\r\n transferencia.blocos = [];\r\n transferencia.patternEncerrante = ValidacaoService.getPatternEncerrante(bloco);\r\n transferencia.formato = ValidacaoService.getFormatoEncerrante(bloco);\r\n transferencia.isEmAvaliacao = false;\r\n }\r\n InicializaVariaveis();\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n transferencia.SelTurnoService.onChangeTurno(onChangeTurno);\r\n transferencia.tela = transferencia.telas.CONSULTA;\r\n SelTurnoService.canSelect = true;\r\n SelTurnoService.selectTurno()\r\n .then(onChangeTurno)\r\n .catch(console.log);\r\n }\r\n\r\n function vinculaAbastecimentos(abastecimentos) {\r\n transferencia.selected.ListRegAbastecimento = abastecimentos;\r\n transferencia.selected.QuantidadeTransferida = abastecimentos.reduce(function (sum1, abast) {\r\n return abast.ListRegAbastecimentoTanque.reduce(function (sum2, tanque) {\r\n return tanque.VolAbastecimento + sum2;\r\n }, 0) + sum1;\r\n }, 0);\r\n\r\n transferencia.changeEncerrante();\r\n }\r\n\r\n function selectAbastecimentos(posto) {\r\n return modalAbastecimentos.open({\r\n locals: {\r\n posto: posto,\r\n IdcTransferencia: transferencia.selected.IdentificadorTransferenciaProduto,\r\n abastecimentos: transferencia.selected.ListRegAbastecimento\r\n }\r\n })\r\n }\r\n\r\n function isRessuprimento() {\r\n var posto = getPosto(transferencia.selected.IdentificadorProdutoPostoDestino);\r\n return posto ? posto.ChkRessuprimento : false;\r\n }\r\n\r\n function getPosto(idcPosto) {\r\n if (!transferencia.postos.length) {\r\n return null;\r\n }\r\n\r\n return transferencia.postos.reduce(function (r, p) {\r\n return p.IdcPosto === idcPosto ? p : r;\r\n }, null);\r\n }\r\n\r\n function onChangeTurno(regTurno) {\r\n if (!regTurno) { return; }\r\n\r\n transferencia.getTranferencias(regTurno.IdcRegTurno, regTurno.IdcPosto);\r\n transferencia.getProdutos(regTurno.IdcPosto);\r\n transferencia.getPostosDestino(regTurno.IdcPosto);\r\n transferencia.getBlocos(regTurno.IdcPosto);\r\n }\r\n\r\n function getNumDigitos() {\r\n bloco = bloco || transferencia.changeBloco();\r\n return bloco ? bloco.NumDigitos - bloco.NumCasasDecimais : 0;\r\n }\r\n\r\n function getNumCasasDecimais() {\r\n bloco = bloco || transferencia.changeBloco();\r\n return bloco ? bloco.NumCasasDecimais : 0;\r\n }\r\n\r\n function setListaTransferencia(resposta) {\r\n transferencia.listaTransferencia = resposta;\r\n }\r\n\r\n function setListaProdutos(produtos) {\r\n transferencia.produtos = produtos;\r\n }\r\n\r\n function setListaPostos(postos) {\r\n transferencia.postos = postos;\r\n }\r\n\r\n function setListaBlocos(blocos) {\r\n transferencia.blocos = blocos;\r\n }\r\n\r\n function salvarServidor(formTransferencia) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n if (!transferencia.selected) {\r\n return MessageService.alert(TranslateService('error'), TranslateService('invalid-data'), null, 'Erro');\r\n }\r\n\r\n TranferenciaModel.createOrUpdate(transferencia.selected)\r\n .then(function (resposta) {\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\");\r\n ValidacaoService.resetForm(formTransferencia);\r\n inicializacao();\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n }\r\n\r\n function goToConsulta(regTransferencia) {\r\n if (transferencia.isDestino(regTransferencia)) {\r\n transferencia.registrarChegada(regTransferencia);\r\n } else {\r\n transferencia.selected = regTransferencia;\r\n transferencia.editar(transferencia.selected);\r\n }\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n transferencia.getTranferencias = function (idcRegTurno, idcPosto) {\r\n TranferenciaModel.getAllByIdcRegTurnoPosto(idcRegTurno, idcPosto)\r\n .then(setListaTransferencia);\r\n return idcRegTurno;\r\n };\r\n\r\n transferencia.getProdutos = function (idcPosto) {\r\n ProdutoModel.getAllByIdcPosto(idcPosto)\r\n .then(setListaProdutos);\r\n return idcPosto;\r\n };\r\n\r\n transferencia.getPostosDestino = function (idcPosto) {\r\n PostoModel.getAllSameComplexo(idcPosto)\r\n .then(setListaPostos);\r\n return idcPosto;\r\n };\r\n\r\n transferencia.getBlocos = function (idcPosto) {\r\n BlocoMedidorModel.getByIdcPosto(idcPosto)\r\n .then(setListaBlocos);\r\n return idcPosto;\r\n };\r\n\r\n transferencia.transferenciaClick = function (regTransferencia) {\r\n SelTurnoService.checkTurnoFechado(function () {\r\n transferencia.isEmAvaliacao = false;\r\n TranferenciaModel.isEmAvaliacao(regTransferencia.IdentificadorTransferenciaProduto)\r\n .then(function (resposta) {\r\n transferencia.isEmAvaliacao = resposta;\r\n goToConsulta(regTransferencia);\r\n });\r\n });\r\n };\r\n\r\n transferencia.isBlocked = function () {\r\n return transferencia.isEmAvaliacao;\r\n }\r\n\r\n transferencia.atualizar = function () {\r\n InicializaVariaveis();\r\n SelTurnoService.canSelect = true;\r\n transferencia.SelTurnoService.onChangeTurno(onChangeTurno);\r\n transferencia.SelTurnoService.selectTurno()\r\n .then(onChangeTurno)\r\n .catch(console.log);\r\n //onChangeTurno(SelTurnoService.turno);\r\n };\r\n\r\n transferencia.novo = function () {\r\n transferencia.selected = {\r\n \"dataFinalOriginal\": true,\r\n\r\n \"IdentificadorTransferenciaProduto\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorProduto\": 0,\r\n \"IdentificadorAberturaFechamentoTurnoPostoOrigem\": SelTurnoService.getIdcRegTurno(),\r\n \"IdentificadorUsuarioResponsavelPostoOrigem\": UsuarioService.indice,\r\n \"DataHoraUTCInicioRetiradaOrigem\": ValidacaoService.getNowTurno(),\r\n \"DataHoraUTCFimRetiradaOrigem\": ValidacaoService.getNowTurnoMaisUmMinuto(),\r\n \"IdentificadorEncerranteBlocoMedidorOrigem\": 0,\r\n \"NomeSistemaOrigemDadoPostoOrigem\": \"WEB-MOBILE\",\r\n \"IndicadorSituacao\": \"AB\",\r\n \"IdentificadorProdutoPostoDestino\": 0,\r\n \"IdentificadorAberturaFechamentoTurnoPostoDestino\": null,\r\n \"IdentificadorUsuarioResponsavelPostoDestino\": null,\r\n \"DataHoraUTCInicioRecebimentoDestino\": null,\r\n \"DataHoraUTCFimRecebimentoDestino\": null,\r\n \"NumeroIdentificacaoLacres\": null,\r\n \"QuantidadeLacres\": null,\r\n \"CodigoHexadecimalCorLacres\": null,\r\n \"QuantidadeTransferida\": null,\r\n \"QuantidadeTransferida20GrausCelsius\": null,\r\n \"MedidaTemperaturaProduto\": null,\r\n \"MedidaDensidadeProduto\": null,\r\n \"NomeSistemaOrigemDadoPostoDestino\": null,\r\n \"IndicadorUtilizacaoSkidPostoDestino\": null,\r\n \"IdentificadorCargaMassaMovimentacao\": null,\r\n \"IdentificadorEmpresaTransportadora\": null,\r\n \"IdentificadorCaminhaoTanque\": null,\r\n \"IdentificadorCavaloMecanico\": null,\r\n \"IdentificadorMotoristaCavaloCaminhaoTanque\": null,\r\n \"IndicadorConcordanciaMotorista\": null,\r\n \"CadCaminhaoTanque\": null,\r\n \"CadCavaloMecanico\": null,\r\n \"CadEmpresa\": null,\r\n \"CadMotorista\": null,\r\n \"CadPosto\": null,\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioResponsavelPostoOrigem\": null,\r\n \"CadUsuarioResponsavelPostoDestino\": null,\r\n \"CtrEncerrante\": {\r\n \"IdcCtrEncerrante\": 0,\r\n \"IdcBlocoMedidor\": 0,\r\n \"DthCtrEncerrante\": new Date(),\r\n \"ValEncerranteAtual\": null,\r\n \"IdcTblOperacao\": 0,\r\n \"TblOperacao\": \"V5ETRANT\",\r\n \"ChkResetAutomatico\": false,\r\n \"DthCriacaoReg\": new Date()\r\n },\r\n \"RegTurnoOrigem\": null,\r\n \"RegTurnoDestino\": null\r\n };\r\n\r\n transferencia.editar(transferencia.selected);\r\n };\r\n\r\n transferencia.changeHoraFinal = function (selected, campo) {\r\n selected.dataFinalOriginal = false;\r\n ValidacaoService.changeTime(selected, campo);\r\n };\r\n\r\n transferencia.editar = function (regTransferencia) {\r\n if (!regTransferencia) return;\r\n //transferencia.selected = {};\r\n regTransferencia.Anomalias = regTransferencia.Anomalias || [];\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n transferencia.tela = transferencia.telas.REGISTRO_ORIGEM;\r\n SelTurnoService.canSelect = false;\r\n\r\n focus('IdentificadorProduto');\r\n };\r\n\r\n transferencia.salvar = function (formTransferencia) {\r\n if (!transferencia.selected) return;\r\n\r\n SelTurnoService.checkTurnoFechado(function () {\r\n\r\n if (transferencia.selected.dataFinalOriginal && !transferencia.isDestino(transferencia.selected)) {\r\n transferencia.selected.DataHoraUTCFimRetiradaOrigem = ValidacaoService.getNowTurno();\r\n }\r\n\r\n //Ajusta os horários de chegada no destino como sugestão de acordo com os horários de saída da horigem\r\n transferencia.selected.DataHoraUTCInicioRecebimentoDestino = transferencia.selected.DataHoraUTCInicioRetiradaOrigem;\r\n transferencia.selected.DataHoraUTCFimRecebimentoDestino = transferencia.selected.DataHoraUTCFimRetiradaOrigem;\r\n transferencia.selected.$valid = formTransferencia.$valid;\r\n\r\n CheckTransferencia(transferencia.selected).then(function () {\r\n salvarServidor(formTransferencia);\r\n transferencia.atualizar();\r\n });\r\n });\r\n };\r\n\r\n transferencia.cancelar = function (formTransferencia) {\r\n transferencia.selected.Anomalias = [];\r\n transferencia.tela = transferencia.telas.CONSULTA;\r\n SelTurnoService.canSelect = true;\r\n ValidacaoService.resetForm(formTransferencia);\r\n //onChangeTurno(SelTurnoService.turno);\r\n transferencia.atualizar();\r\n };\r\n\r\n transferencia.registrarAnomalia = function () {\r\n var id = transferencia.selected ? transferencia.selected.IdentificadorTransferenciaProduto : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n console.log(anomalia);\r\n\r\n transferencia.selected.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n transferencia.changeProduto = function () {\r\n\r\n };\r\n\r\n transferencia.changePosto = function () {\r\n if (!transferencia.selected) {\r\n return;\r\n }\r\n\r\n var posto = getPosto(transferencia.selected.IdentificadorProdutoPostoDestino);\r\n\r\n if (posto && posto.ChkRessuprimento) {\r\n\r\n transferencia.selected.CtrEncerrante.ValEncerranteAtual = null;\r\n transferencia.selected.QuantidadeTransferida = null;\r\n\r\n selectAbastecimentos(posto)\r\n .then(vinculaAbastecimentos);\r\n }\r\n\r\n };\r\n\r\n transferencia.changeBloco = function () {\r\n if (!transferencia.blocos ||\r\n !transferencia.selected ||\r\n !transferencia.selected.CtrEncerrante) return null;\r\n\r\n bloco = null;\r\n transferencia.blocos.forEach(function (item) {\r\n if (item.IdcBlocoMedidor === transferencia.selected.CtrEncerrante.IdcBlocoMedidor) {\r\n bloco = item;\r\n transferencia.patternEncerrante = ValidacaoService.getPatternEncerrante(bloco);\r\n transferencia.formato = ValidacaoService.getFormatoEncerrante(bloco);\r\n }\r\n });\r\n\r\n if (bloco) {\r\n transferencia.selected.IdentificadorProduto = bloco.IdcProduto;\r\n }\r\n\r\n return bloco;\r\n };\r\n\r\n transferencia.changeEncerrante = function (tipo) {\r\n\r\n if (tipo === 'encerrante' && !transferencia.selected.CtrEncerrante.ValEncerranteAtual) {\r\n return;\r\n }\r\n\r\n if (tipo !== 'encerrante' && !transferencia.selected.QuantidadeTransferida) {\r\n return;\r\n }\r\n\r\n var idcBlocoMedidor = transferencia.selected.CtrEncerrante.IdcBlocoMedidor;\r\n var valorEncerrante = tipo === 'encerrante' ? transferencia.selected.CtrEncerrante.ValEncerranteAtual : null;\r\n var dataEncerrante = transferencia.selected.CtrEncerrante.DthCtrEncerrante = transferencia.selected.DataHoraUTCFimRetiradaOrigem;\r\n var valVolume = transferencia.selected.QuantidadeTransferida;\r\n var numDigitos = getNumDigitos();\r\n\r\n CtrEncerranteModel.calculaVolume(idcBlocoMedidor, valorEncerrante, dataEncerrante, valVolume, numDigitos)\r\n .then(function (resposta) {\r\n transferencia.selected.QuantidadeTransferida = ValidacaoService.round(resposta.volume, getNumCasasDecimais());\r\n transferencia.selected.CtrEncerrante.ValEncerranteAtual = ValidacaoService.round(resposta.encerrante, getNumCasasDecimais());\r\n transferencia.selected.CtrEncerrante.ChkResetAutomatico = resposta.reset;\r\n });\r\n };\r\n\r\n transferencia.getVolume20C = function () {\r\n if (!transferencia.selected) return;\r\n\r\n var pIdcProduto = transferencia.selected.IdentificadorProduto;\r\n var pValTemperatura = transferencia.selected.MedidaTemperaturaProduto;\r\n var pValDensidade = transferencia.selected.MedidaDensidadeProduto;\r\n var pValVolume = transferencia.selected.QuantidadeTransferida;\r\n\r\n if (pIdcProduto && pValTemperatura && pValDensidade && pValVolume) {\r\n GeneralModel.getVolume20C(pIdcProduto, pValTemperatura, pValDensidade, pValVolume)\r\n .then(function (resposta) {\r\n transferencia.selected.QuantidadeTransferida20GrausCelsius = Number(resposta);\r\n });\r\n }\r\n };\r\n\r\n transferencia.filtraPostosPorProduto = function (posto) {\r\n if (!transferencia.selected) return false;\r\n\r\n if (posto.IdcPosto === SelTurnoService.turno.IdcPosto) {\r\n return false;\r\n }\r\n\r\n var idProduto = transferencia.selected.IdentificadorProduto;\r\n\r\n for (var i = 0; i < posto.ListCadTanquePosto.length; i++) {\r\n var tanque = posto.ListCadTanquePosto[i];\r\n\r\n if (tanque.IdcProduto === idProduto) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n\r\n transferencia.registrarChegada = function (regTransferencia) {\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n regTransferencia.DataHoraUTCUltimaAtualizacao = new Date();\r\n regTransferencia.IdentificadorUsuarioUltimaAtualizacao = UsuarioService.indice;\r\n regTransferencia.IndicadorSituacao = \"FE\";\r\n regTransferencia.IdentificadorAberturaFechamentoTurnoPostoDestino = SelTurnoService.getIdcRegTurno();\r\n regTransferencia.IdentificadorUsuarioResponsavelPostoDestino = UsuarioService.indice;\r\n\r\n //A sugestão de horário será colocada no salvamento da origem iguais aos dados da origem no salvamento da origem\r\n //regTransferencia.DataHoraUTCInicioRecebimentoDestino = regTransferencia.DataHoraUTCInicioRecebimentoDestino || ValidacaoService.getNowTurno();\r\n //regTransferencia.DataHoraUTCFimRecebimentoDestino = regTransferencia.DataHoraUTCFimRecebimentoDestino || ValidacaoService.getNowTurnoMaisUmMinuto();\r\n\r\n regTransferencia.NomeSistemaOrigemDadoPostoDestino = \"WEB-MOBILE\";\r\n\r\n transferencia.selected = regTransferencia;\r\n\r\n transferencia.tela = transferencia.telas.REGISTRO_DESTINO;\r\n };\r\n\r\n transferencia.isDestino = function (regTransferencia) {\r\n return regTransferencia.IdentificadorProdutoPostoDestino === transferencia.SelTurnoService.turno.IdcPosto;\r\n };\r\n\r\n transferencia.desabilitaQuantidades = function () {\r\n if (!transferencia.selected) {\r\n return true;\r\n }\r\n\r\n return (!transferencia.selected.IdentificadorProdutoPostoDestino) ||\r\n isRessuprimento();\r\n };\r\n\r\n transferencia.desabilitaBtnRessuprimento = function () {\r\n if (!transferencia.selected) {\r\n return true;\r\n }\r\n\r\n return (!transferencia.selected.IdentificadorProdutoPostoDestino) ||\r\n !isRessuprimento() ||\r\n transferencia.isEmAvaliacao;\r\n };\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('TransferenciaController', TransferenciaController);\r\n\r\n TransferenciaController.$inject = [\r\n 'SelTurnoService',\r\n 'TranferenciaModel',\r\n 'TransitionService',\r\n 'FocusService',\r\n 'ValidacaoService',\r\n 'ProdutoModel',\r\n 'UsuarioService',\r\n 'PostoModel',\r\n 'BlocoMedidorModel',\r\n 'CtrEncerranteModel',\r\n 'GeneralModel',\r\n 'RegAnomaliaService',\r\n 'MessageService',\r\n 'ModalService',\r\n 'TranslateService',\r\n 'CheckTransferencia',\r\n '$filter'\r\n ];\r\n\r\n function TransferenciaController(\r\n SelTurnoService,\r\n TranferenciaModel,\r\n TransitionService,\r\n focus,\r\n ValidacaoService,\r\n ProdutoModel,\r\n UsuarioService,\r\n PostoModel,\r\n BlocoMedidorModel,\r\n CtrEncerranteModel,\r\n GeneralModel,\r\n RegAnomaliaService,\r\n MessageService,\r\n ModalService,\r\n TranslateService,\r\n CheckTransferencia,\r\n $filter\r\n ) {\r\n\r\n var transferencia = this;\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var bloco = null;\r\n var modalAbastecimentos = new ModalService({\r\n templateUrl: 'selAbastecimentos.html',\r\n controller: 'SelAbastecimentosController',\r\n controllerAs: 'selAbast'\r\n });\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n transferencia.SelTurnoService = SelTurnoService;\r\n transferencia.telas = {\r\n CONSULTA: 'CONSULTA',\r\n REGISTRO_ORIGEM: 'REGISTRO_ORIGEM',\r\n REGISTRO_DESTINO: 'REGISTRO_DESTINO'\r\n };\r\n transferencia.tela = transferencia.telas.CONSULTA;\r\n transferencia.filtro = null;\r\n transferencia.selected = null;\r\n transferencia.validacao = ValidacaoService;\r\n transferencia.produtos = [];\r\n transferencia.postos = [];\r\n transferencia.postosAtivos = [];\r\n transferencia.blocos = [];\r\n transferencia.blocosAtivos = [];\r\n transferencia.patternEncerrante = ValidacaoService.getPatternEncerrante(bloco);\r\n transferencia.formato = ValidacaoService.getFormatoEncerrante(bloco);\r\n transferencia.isEmAvaliacao = false;\r\n transferencia.capacidadeTanque = \"\";\r\n transferencia.ultimoLacre = {}\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializacao() {\r\n transferencia.SelTurnoService.onChangeTurno(onChangeTurno);\r\n transferencia.tela = transferencia.telas.CONSULTA;\r\n SelTurnoService.canSelect = true;\r\n SelTurnoService.selectTurno()\r\n .then(onChangeTurno)\r\n .catch(console.log);\r\n }\r\n\r\n function vinculaAbastecimentos(abastecimentos) {\r\n transferencia.selected.ListRegAbastecimento = abastecimentos;\r\n transferencia.selected.QuantidadeTransferida = abastecimentos.reduce(function (sum1, abast) {\r\n return abast.ListRegAbastecimentoTanque.reduce(function (sum2, tanque) {\r\n return tanque.VolAbastecimento + sum2;\r\n }, 0) + sum1;\r\n }, 0);\r\n\r\n transferencia.changeEncerrante();\r\n }\r\n\r\n function selectAbastecimentos(posto) {\r\n return modalAbastecimentos.open({\r\n locals: {\r\n posto: posto,\r\n IdcTransferencia: transferencia.selected.IdentificadorTransferenciaProduto,\r\n abastecimentos: transferencia.selected.ListRegAbastecimento\r\n }\r\n });\r\n }\r\n\r\n function isRessuprimento() {\r\n var posto = getPosto(transferencia.selected.IdentificadorProdutoPostoDestino);\r\n return posto ? posto.ChkRessuprimento : false;\r\n }\r\n\r\n function getPosto(idcPosto) {\r\n if (!transferencia.postos.length) {\r\n return null;\r\n }\r\n\r\n return transferencia.postosAtivos.reduce(function (r, p) {\r\n return p.IdcPosto === idcPosto ? p : r;\r\n }, null);\r\n }\r\n\r\n function getLastLacre(idcPosto) {\r\n TranferenciaModel.getLastLacre(idcPosto)\r\n .then(function (resposta) {\r\n transferencia.ultimoLacre = resposta;\r\n console.log()\r\n })\r\n }\r\n\r\n function onChangeTurno(regTurno) {\r\n if (!regTurno) { return; }\r\n\r\n transferencia.getTranferencias(regTurno.IdcRegTurno, regTurno.IdcPosto);\r\n transferencia.getProdutos(regTurno.IdcPosto);\r\n transferencia.getPostosDestino(regTurno.IdcPosto);\r\n transferencia.getBlocos(regTurno.IdcPosto);\r\n getLastLacre(regTurno.IdcPosto);\r\n }\r\n\r\n function getNumDigitos() {\r\n bloco = bloco || transferencia.changeBloco();\r\n return bloco ? bloco.NumDigitos - bloco.NumCasasDecimais : 0;\r\n }\r\n\r\n function getNumCasasDecimais() {\r\n bloco = bloco || transferencia.changeBloco();\r\n return bloco ? bloco.NumCasasDecimais : 0;\r\n }\r\n\r\n function setListaTransferencia(resposta) {\r\n transferencia.listaTransferencia = resposta;\r\n for (var i = 0; i < transferencia.listaTransferencia.length; i++) {\r\n transferencia.listaTransferencia[i].DataHoraUTCInicioRetiradaOrigemSearch =\r\n $filter('date')(\r\n transferencia.listaTransferencia[i].DataHoraUTCInicioRetiradaOrigem,\r\n TranslateService('datetime-format')\r\n );\r\n }\r\n }\r\n\r\n function setListaProdutos(produtos) {\r\n transferencia.produtos = produtos;\r\n }\r\n\r\n function setListaPostos(postos) {\r\n transferencia.postos = postos;\r\n transferencia.postosAtivos = transferencia.postos;\r\n }\r\n\r\n function setListaBlocos(blocos) {\r\n transferencia.blocos = blocos;\r\n transferencia.blocosAtivos = transferencia.blocos;\r\n }\r\n\r\n function salvarServidor(formTransferencia) {\r\n //Seta a flag de transição para NÂO perguntar o usuário se deseja sair sem salvar\r\n TransitionService.clearCurrent();\r\n\r\n if (!transferencia.selected) {\r\n return MessageService.alert(TranslateService('error'), TranslateService('invalid-data'), null, 'Erro');\r\n }\r\n transferencia.selected.NomeSistemaOrigemDadoPostoOrigem = \"WEB-MOBILE\";\r\n TranferenciaModel.createOrUpdate(transferencia.selected)\r\n .then(function (resposta) {\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\");\r\n ValidacaoService.resetForm(formTransferencia);\r\n inicializacao();\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), (typeof erro === \"object\" && erro.data ? erro : TranslateService('error-ocurred') + erro));\r\n });\r\n }\r\n\r\n function doCreateOrUpdate(transferenciaSelected, formTransferencia) {\r\n TranferenciaModel.createOrUpdate(transferenciaSelected)\r\n .then(function (resposta) {\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'), null, \"Sucesso\");\r\n ValidacaoService.resetForm(formTransferencia);\r\n inicializacao();\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n MessageService.alert(TranslateService('error'), (typeof erro === \"object\" && erro.data ? erro : TranslateService('error-ocurred') + erro));\r\n })\r\n }\r\n\r\n function goToConsulta(regTransferencia) {\r\n if (transferencia.isDestino(regTransferencia)) {\r\n transferencia.registrarChegada(regTransferencia);\r\n } else {\r\n transferencia.selected = regTransferencia;\r\n transferencia.editar(transferencia.selected);\r\n }\r\n getTotalCapacidadeTanque();\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n transferencia.getTranferencias = function (idcRegTurno, idcPosto) {\r\n TranferenciaModel.getAllByIdcRegTurnoPosto(idcRegTurno, idcPosto)\r\n .then(setListaTransferencia);\r\n return idcRegTurno;\r\n };\r\n\r\n transferencia.getProdutos = function (idcPosto) {\r\n ProdutoModel.getAllByIdcPosto(idcPosto)\r\n .then(setListaProdutos);\r\n return idcPosto;\r\n };\r\n\r\n transferencia.getPostosDestino = function (idcPosto) {\r\n PostoModel.getAllSameComplexo(idcPosto)\r\n .then(setListaPostos);\r\n return idcPosto;\r\n };\r\n\r\n transferencia.getBlocos = function (idcPosto) {\r\n BlocoMedidorModel.getByIdcPosto(idcPosto)\r\n .then(setListaBlocos);\r\n return idcPosto;\r\n };\r\n\r\n transferencia.transferenciaClick = function (regTransferencia) { \r\n\r\n SelTurnoService.checkTurnoFechado(function () {\r\n transferencia.isEmAvaliacao = false;\r\n TranferenciaModel.isEmAvaliacao(regTransferencia.IdentificadorTransferenciaProduto)\r\n .then(function (resposta) {\r\n transferencia.isEmAvaliacao = resposta;\r\n goToConsulta(regTransferencia);\r\n });\r\n });\r\n };\r\n\r\n transferencia.isBlocked = function () {\r\n return transferencia.isEmAvaliacao;\r\n };\r\n\r\n transferencia.atualizar = function () {\r\n onChangeTurno(SelTurnoService.turno);\r\n };\r\n\r\n transferencia.novo = function () {\r\n transferencia.capacidadeTanque = \"\";\r\n transferencia.selected = {\r\n \"dataFinalOriginal\": true,\r\n\r\n \"IdentificadorTransferenciaProduto\": 0,\r\n \"DataHoraUTCCriacao\": new Date(),\r\n \"IdentificadorUsuarioCriacao\": UsuarioService.indice,\r\n \"DataHoraUTCUltimaAtualizacao\": new Date(),\r\n \"IdentificadorUsuarioUltimaAtualizacao\": UsuarioService.indice,\r\n \"IdentificadorProduto\": 0,\r\n \"IdentificadorAberturaFechamentoTurnoPostoOrigem\": SelTurnoService.getIdcRegTurno(),\r\n \"IdentificadorUsuarioResponsavelPostoOrigem\": UsuarioService.indice,\r\n \"DataHoraUTCInicioRetiradaOrigem\": ValidacaoService.getNowTurno(),\r\n \"DataHoraUTCFimRetiradaOrigem\": ValidacaoService.getNowTurnoMaisUmMinuto(),\r\n \"IdentificadorEncerranteBlocoMedidorOrigem\": 0,\r\n \"NomeSistemaOrigemDadoPostoOrigem\": \"WEB-MOBILE\",\r\n \"IndicadorSituacao\": \"AB\",\r\n \"IdentificadorProdutoPostoDestino\": null,\r\n \"IdentificadorAberturaFechamentoTurnoPostoDestino\": null,\r\n \"IdentificadorUsuarioResponsavelPostoDestino\": null,\r\n \"DataHoraUTCInicioRecebimentoDestino\": null,\r\n \"DataHoraUTCFimRecebimentoDestino\": null,\r\n \"NumeroIdentificacaoLacres\": transferencia.ultimoLacre == null ? null : transferencia.ultimoLacre.NumeroIdentificacaoLacres,\r\n \"QuantidadeLacres\": transferencia.ultimoLacre == null ? null : transferencia.ultimoLacre.QuantidadeLacres,\r\n \"CodigoHexadecimalCorLacres\": transferencia.ultimoLacre == null ? null : transferencia.ultimoLacre.CodigoHexadecimalCorLacres,\r\n \"QuantidadeTransferida\": null,\r\n \"QuantidadeTransferida20GrausCelsius\": null,\r\n \"MedidaTemperaturaProduto\": null,\r\n \"MedidaDensidadeProduto\": null,\r\n \"NomeSistemaOrigemDadoPostoDestino\": null,\r\n \"IndicadorUtilizacaoSkidPostoDestino\": null,\r\n \"IdentificadorCargaMassaMovimentacao\": null,\r\n \"IdentificadorEmpresaTransportadora\": null,\r\n \"IdentificadorCaminhaoTanque\": null,\r\n \"IdentificadorCavaloMecanico\": null,\r\n \"IdentificadorMotoristaCavaloCaminhaoTanque\": null,\r\n \"IndicadorConcordanciaMotorista\": null,\r\n \"CadCaminhaoTanque\": null,\r\n \"CadCavaloMecanico\": null,\r\n \"CadEmpresa\": null,\r\n \"CadMotorista\": null,\r\n \"CadPosto\": null,\r\n \"CadProduto\": null,\r\n \"CadUsuarioCriacao\": null,\r\n \"CadUsuarioUltimaAtualizacao\": null,\r\n \"CadUsuarioResponsavelPostoOrigem\": null,\r\n \"CadUsuarioResponsavelPostoDestino\": null,\r\n \"CtrEncerrante\": {\r\n \"IdcCtrEncerrante\": 0,\r\n \"IdcBlocoMedidor\": null,\r\n \"DthCtrEncerrante\": new Date(),\r\n \"ValEncerranteAtual\": null,\r\n \"IdcTblOperacao\": 0,\r\n \"TblOperacao\": \"V5ETRANT\",\r\n \"ChkResetAutomatico\": false,\r\n \"DthCriacaoReg\": new Date()\r\n },\r\n \"RegTurnoOrigem\": null,\r\n \"RegTurnoDestino\": null\r\n };\r\n\r\n transferencia.editar(transferencia.selected);\r\n };\r\n \r\n transferencia.changeHoraFinal = function (selected, campo) {\r\n selected.dataFinalOriginal = false;\r\n ValidacaoService.newChangeTime(selected, campo);\r\n selected.CtrEncerrante.DthCtrEncerrante = selected.DataHoraUTCFimRetiradaOrigem;\r\n transferencia.changeEncerrante('volume');\r\n \r\n };\r\n\r\n transferencia.editar = function (regTransferencia) {\r\n if (!regTransferencia) return;\r\n\r\n regTransferencia.Anomalias = regTransferencia.Anomalias || [];\r\n\r\n transferencia.blocosAtivos = transferencia.blocos.filter(function (bloco) {\r\n return bloco.StuBlocoMedidor === 'S' || (regTransferencia.IdentificadorTransferenciaProduto > 0 && regTransferencia.CtrEncerrante.IdcBlocoMedidor === bloco.IdcBlocoMedidor);\r\n });\r\n\r\n transferencia.postosAtivos = transferencia.postos.filter(function (posto) {\r\n return posto.StuPosto === 'S' || (regTransferencia.IdentificadorTransferenciaProduto > 0 && regTransferencia.IdentificadorProdutoPostoDestino === posto.IdcPosto);\r\n });\r\n\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n transferencia.tela = transferencia.telas.REGISTRO_ORIGEM;\r\n SelTurnoService.canSelect = false;\r\n\r\n focus('IdentificadorProduto');\r\n };\r\n\r\n transferencia.salvar = function (formTransferencia) {\r\n if (!transferencia.selected) return;\r\n\r\n SelTurnoService.checkTurnoFechado(function () {\r\n if (transferencia.selected.dataFinalOriginal && !transferencia.isDestino(transferencia.selected)) {\r\n transferencia.selected.DataHoraUTCFimRetiradaOrigem = ValidacaoService.getNowTurno();\r\n }\r\n\r\n //Ajusta os horários de chegada no destino como sugestão de acordo com os horários de saída da horigem\r\n transferencia.selected.DataHoraUTCInicioRecebimentoDestino = transferencia.selected.DataHoraUTCInicioRetiradaOrigem;\r\n transferencia.selected.DataHoraUTCFimRecebimentoDestino = transferencia.selected.DataHoraUTCFimRetiradaOrigem;\r\n transferencia.selected.$valid = formTransferencia.$valid;\r\n\r\n CheckTransferencia(transferencia.selected).then(function () {\r\n salvarServidor(formTransferencia);\r\n });\r\n });\r\n };\r\n\r\n transferencia.cancelar = function (formTransferencia) {\r\n transferencia.selected.Anomalias = [];\r\n transferencia.tela = transferencia.telas.CONSULTA;\r\n SelTurnoService.canSelect = true;\r\n ValidacaoService.resetForm(formTransferencia);\r\n onChangeTurno(SelTurnoService.turno);\r\n };\r\n\r\n transferencia.registrarAnomalia = function () {\r\n var id = transferencia.selected ? transferencia.selected.IdentificadorTransferenciaProduto : null;\r\n return RegAnomaliaService.novo(null, id).then(function (anomalia) {\r\n console.log(anomalia);\r\n\r\n transferencia.selected.Anomalias.push(anomalia);\r\n });\r\n };\r\n\r\n transferencia.changeProduto = function () {\r\n\r\n };\r\n\r\n function getTotalCapacidadeTanque(posto) {\r\n if (posto == undefined) {\r\n posto = getPosto(transferencia.selected.IdentificadorProdutoPostoDestino);\r\n }\r\n\r\n const tanques = posto.ListCadTanquePosto.filter(function (t) {\r\n return t.IdcProduto == transferencia.selected.IdentificadorProduto\r\n })\r\n\r\n\r\n transferencia.capacidadeTanque = tanques\r\n .reduce(function (sum, tanque) {\r\n return tanque.ValCapacidadeNominal + sum;\r\n }, 0).toFixed(0)\r\n .replace('.', ',')\r\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.');\r\n\r\n }\r\n\r\n transferencia.changePosto = function () {\r\n if (!transferencia.selected) {\r\n return;\r\n }\r\n\r\n // TODO - Tem que avaliar o cenário onde o turno de destino está VALIDADO\r\n transferencia.selected.IdentificadorAberturaFechamentoTurnoPostoDestino = null;\r\n\r\n var posto = getPosto(transferencia.selected.IdentificadorProdutoPostoDestino);\r\n getTotalCapacidadeTanque(posto)\r\n if (posto && posto.ChkRessuprimento) {\r\n\r\n transferencia.selected.CtrEncerrante.ValEncerranteAtual = null;\r\n transferencia.selected.QuantidadeTransferida = null;\r\n\r\n selectAbastecimentos(posto)\r\n .then(vinculaAbastecimentos);\r\n }\r\n\r\n };\r\n\r\n transferencia.changeBloco = function () {\r\n if (!transferencia.blocosAtivos ||\r\n !transferencia.selected ||\r\n !transferencia.selected.CtrEncerrante) return null;\r\n\r\n bloco = null;\r\n transferencia.blocosAtivos.forEach(function (item) {\r\n if (item.IdcBlocoMedidor === transferencia.selected.CtrEncerrante.IdcBlocoMedidor) {\r\n bloco = item;\r\n transferencia.patternEncerrante = ValidacaoService.getPatternEncerrante(bloco);\r\n transferencia.formato = ValidacaoService.getFormatoEncerrante(bloco);\r\n }\r\n });\r\n\r\n if (bloco) {\r\n transferencia.selected.IdentificadorProduto = bloco.IdcProduto;\r\n }\r\n\r\n\r\n transferencia.changeEncerrante('volume');\r\n\r\n return bloco;\r\n };\r\n\r\n transferencia.changeEncerrante = function (tipo) {\r\n\r\n if (tipo === 'encerrante' && transferencia.selected.CtrEncerrante.ValEncerranteAtual === undefined) {\r\n return;\r\n }\r\n\r\n if (tipo !== 'encerrante' && transferencia.selected.QuantidadeTransferida === undefined) {\r\n return;\r\n }\r\n\r\n\r\n var idcBlocoMedidor = transferencia.selected.CtrEncerrante.IdcBlocoMedidor;\r\n var valorEncerrante = tipo === 'encerrante' ? transferencia.selected.CtrEncerrante.ValEncerranteAtual : null;\r\n var dataEncerrante = transferencia.selected.CtrEncerrante.DthCtrEncerrante = transferencia.selected.DataHoraUTCFimRetiradaOrigem;\r\n var valVolume = transferencia.selected.QuantidadeTransferida;\r\n var numDigitos = getNumDigitos();\r\n\r\n CtrEncerranteModel.calculaVolume(idcBlocoMedidor, valorEncerrante, dataEncerrante, valVolume, numDigitos)\r\n .then(function (resposta) {\r\n transferencia.selected.QuantidadeTransferida = ValidacaoService.round(resposta.volume, getNumCasasDecimais());\r\n transferencia.selected.CtrEncerrante.ValEncerranteAtual = ValidacaoService.round(resposta.encerrante, getNumCasasDecimais());\r\n transferencia.selected.CtrEncerrante.ChkResetAutomatico = resposta.reset;\r\n });\r\n };\r\n\r\n transferencia.getVolume20C = function () {\r\n if (!transferencia.selected) return;\r\n\r\n var pIdcProduto = transferencia.selected.IdentificadorProduto;\r\n var pValTemperatura = transferencia.selected.MedidaTemperaturaProduto;\r\n var pValDensidade = transferencia.selected.MedidaDensidadeProduto;\r\n var pValVolume = transferencia.selected.QuantidadeTransferida;\r\n\r\n if (pIdcProduto && pValTemperatura && pValDensidade && pValVolume) {\r\n GeneralModel.getVolume20C(pIdcProduto, pValTemperatura, pValDensidade, pValVolume)\r\n .then(function (resposta) {\r\n transferencia.selected.QuantidadeTransferida20GrausCelsius = Number(resposta);\r\n });\r\n }\r\n };\r\n\r\n transferencia.filtraPostosPorProduto = function (posto) {\r\n if (!transferencia.selected) return false;\r\n\r\n if (posto.IdcPosto === SelTurnoService.turno.IdcPosto) {\r\n return false;\r\n }\r\n\r\n var idProduto = transferencia.selected.IdentificadorProduto;\r\n\r\n for (var i = 0; i < posto.ListCadTanquePosto.length; i++) {\r\n var tanque = posto.ListCadTanquePosto[i];\r\n\r\n if (tanque.IdcProduto === idProduto) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n\r\n transferencia.registrarChegada = function (regTransferencia) {\r\n //Seta a flag de transição para perguntar o usuário se deseja sair sem salvar\r\n TransitionService.setCurrent();\r\n\r\n regTransferencia.DataHoraUTCUltimaAtualizacao = new Date();\r\n regTransferencia.IdentificadorUsuarioUltimaAtualizacao = UsuarioService.indice;\r\n regTransferencia.IndicadorSituacao = \"FE\";\r\n regTransferencia.IdentificadorAberturaFechamentoTurnoPostoDestino = SelTurnoService.getIdcRegTurno();\r\n regTransferencia.IdentificadorUsuarioResponsavelPostoDestino = UsuarioService.indice;\r\n\r\n //A sugestão de horário será colocada no salvamento da origem iguais aos dados da origem no salvamento da origem\r\n //regTransferencia.DataHoraUTCInicioRecebimentoDestino = regTransferencia.DataHoraUTCInicioRecebimentoDestino || ValidacaoService.getNowTurno();\r\n //regTransferencia.DataHoraUTCFimRecebimentoDestino = regTransferencia.DataHoraUTCFimRecebimentoDestino || ValidacaoService.getNowTurnoMaisUmMinuto();\r\n\r\n regTransferencia.NomeSistemaOrigemDadoPostoDestino = \"WEB-MOBILE\";\r\n\r\n transferencia.selected = regTransferencia;\r\n\r\n transferencia.tela = transferencia.telas.REGISTRO_DESTINO;\r\n };\r\n\r\n transferencia.isDestino = function (regTransferencia) {\r\n return regTransferencia.IdentificadorProdutoPostoDestino === transferencia.SelTurnoService.turno.IdcPosto;\r\n };\r\n\r\n transferencia.desabilitaQuantidades = function () {\r\n if (!transferencia.selected) {\r\n return true;\r\n }\r\n\r\n return (!transferencia.selected.IdentificadorProdutoPostoDestino) ||\r\n isRessuprimento();\r\n };\r\n\r\n transferencia.desabilitaBtnRessuprimento = function () {\r\n if (!transferencia.selected) {\r\n return true;\r\n }\r\n\r\n return (!transferencia.selected.IdentificadorProdutoPostoDestino) ||\r\n !isRessuprimento() ||\r\n transferencia.isEmAvaliacao;\r\n };\r\n\r\n inicializacao();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('UnidadeController', UnidadeController);\r\n\r\n UnidadeController.$inject = [\r\n 'ValidacaoService',\r\n 'UnidadeModel',\r\n 'DiretoriaModel',\r\n 'ComplexoModel',\r\n 'Constant',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function UnidadeController(\r\n ValidacaoService,\r\n UnidadeModel,\r\n DiretoriaModel,\r\n ComplexoModel,\r\n Constant,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n // /////////////////////////\r\n // //Propriedades privadas//\r\n // /////////////////////////\r\n var cadUnidade = this;\r\n\r\n // /////////////////////////\r\n // //Propriedades públicas//\r\n // /////////////////////////\r\n cadUnidade.filtro = '';\r\n cadUnidade.listaCadUnidade = null;\r\n cadUnidade.listaDiretoria = null;\r\n cadUnidade.listaComplexo = null;\r\n cadUnidade.listaUnidades = null;\r\n cadUnidade.listaStatus = Constant.INDICADORES_ATIVO;\r\n cadUnidade.selected = null;\r\n cadUnidade.isTelaConsuta = true;\r\n cadUnidade.validacao = ValidacaoService;\r\n cadUnidade.SglDiretoria = null;\r\n\r\n // ////////////////////\r\n // //Métodos privados//\r\n // ////////////////////\r\n function inicializar() {\r\n \r\n getUnidades();\r\n getDiretorias();\r\n \r\n }\r\n\r\n\r\n function getUnidades() {\r\n UnidadeModel.getAllSameDiretoria()\r\n .then(function (resposta) {\r\n cadUnidade.listaUnidades = resposta;\r\n \r\n });\r\n }\r\n\r\n function getDiretorias() {\r\n DiretoriaModel.getAll()\r\n .then(function (resposta) {\r\n \r\n cadUnidade.listaDiretoria = resposta;\r\n \r\n });\r\n }\r\n\r\n \r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n cadUnidade.click = function (item) {\r\n cadUnidade.selected = item;\r\n cadUnidade.SglDiretoria = item.CadComplexo.CadDiretoria.SglDiretoria;\r\n cadUnidade.isTelaConsuta = false;\r\n cadUnidade.getComplexos(cadUnidade.SglDiretoria);\r\n\r\n }\r\n\r\n cadUnidade.getComplexos = function (item) {\r\n ComplexoModel.getBySgl(item)\r\n .then(function (resposta) {\r\n cadUnidade.listaComplexo = resposta;\r\n\r\n });\r\n }\r\n\r\n\r\n cadUnidade.atualizar = function () {\r\n getUnidades();\r\n }\r\n\r\n cadUnidade.novo = function () {\r\n cadUnidade.isTelaConsuta = false;\r\n cadUnidade.selected = {};\r\n cadUnidade.SglDiretoria = null;\r\n ValidacaoService.resetForm(formcadUnidade);\r\n }\r\n\r\n cadUnidade.salvar = function (formcadUnidade) {\r\n \r\n if(formcadUnidade.$valid)\r\n {\r\n\r\n UnidadeModel.save(cadUnidade.selected)\r\n .then(function (resposta) {\r\n ValidacaoService.resetForm(formcadUnidade);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-saved'));\r\n cadUnidade.isTelaConsuta = true;\r\n getUnidades();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n\r\n }\r\n\r\n }\r\n\r\n cadUnidade.cancelar = function (formcadUnidade) {\r\n cadUnidade.isTelaConsuta = true;\r\n getUnidades();\r\n cadUnidade.selected = null;\r\n cadUnidade.SglDiretoria = null;\r\n }\r\n \r\n cadUnidade.excluir = function (formcadUnidade) {\r\n\r\n MessageService.prompt(TranslateService('delete'), TranslateService('delete-confirmation'))\r\n .then(function () {\r\n UnidadeModel.excluir(cadUnidade.selected.IdcUnidade)\r\n .then(function () {\r\n ValidacaoService.resetForm(formcadUnidade);\r\n MessageService.alert(TranslateService('success'), TranslateService('successfully-deleted'));\r\n cadUnidade.isTelaConsuta = true;\r\n getUnidades();\r\n })\r\n .catch(function (erro) {\r\n MessageService.alert(TranslateService('error'), TranslateService('error-ocurred') + erro);\r\n });\r\n });\r\n }\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('UsuariosController', UsuariosController);\r\n\r\n UsuariosController.$inject = [\r\n 'UsuarioModel',\r\n 'ModalService',\r\n 'SpinnerService'\r\n ];\r\n\r\n function UsuariosController(\r\n UsuarioModel,\r\n ModalService,\r\n SpinnerService\r\n ) {\r\n\r\n\r\n\r\n var usuarios = this;\r\n\r\n usuarios.selected = {};\r\n usuarios.lista = [];\r\n usuarios.isTelaConsuta = true;\r\n usuarios.filtro = \"\";\r\n usuarios.perfilSelected = {};\r\n usuarios.filtroPerfil = \"\";\r\n var pefisModifieds = [];\r\n\r\n usuarios.spinner = new SpinnerService();\r\n\r\n\r\n\r\n var modalPerfil = new ModalService({\r\n templateUrl: 'perfilModal.html',\r\n controller: 'PerfilModalController',\r\n controllerAs: 'perfilModal'\r\n });\r\n\r\n function Inicializar() {\r\n getUsers();\r\n }\r\n\r\n Inicializar();\r\n\r\n\r\n\r\n function getUsers() {\r\n usuarios.spinner.spin();\r\n\r\n UsuarioModel.getAllNew()\r\n .then(function (data) {\r\n usuarios.spinner.stop();\r\n usuarios.lista = data;\r\n })\r\n }\r\n\r\n\r\n usuarios.click = function (u) {\r\n\r\n //implentar metodo para obter perfis\r\n\r\n\r\n usuarios.selected = u;\r\n\r\n console.log(usuarios.selected.StuUsuario)\r\n usuarios.spinner.spin();\r\n\r\n usuarios.isTelaConsuta = false;\r\n UsuarioModel.getPerfils(u.IdcUsuario)\r\n .then(function (data) {\r\n usuarios.spinner.stop();\r\n usuarios.selected.CadUsuarioPerfils = data;\r\n });\r\n\r\n\r\n };\r\n\r\n\r\n usuarios.perfilClick = function (p) {\r\n\r\n\r\n usuarios.perfilSelected = p;\r\n\r\n //console.log(usuarios.perfilSelected)\r\n modalPerfil.open({\r\n perfil: usuarios.perfilSelected\r\n })\r\n .then(function (resposta) {\r\n\r\n var hasEdit = true;\r\n\r\n for (var key in pefisModifieds) {\r\n var user = pefisModifieds[key];\r\n\r\n if (user.IdcUsuarioPerfil == resposta.IdcUsuarioPerfil) {\r\n pefisModifieds[key] = resposta;\r\n hasEdit = false;\r\n\r\n }\r\n\r\n }\r\n\r\n if (hasEdit) {\r\n pefisModifieds.push(resposta);\r\n }\r\n\r\n \r\n\r\n //console.log(pefisModifieds);\r\n\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n });\r\n\r\n\r\n };\r\n\r\n usuarios.atualizar = function () {\r\n getUsers();\r\n }\r\n\r\n usuarios.cancelar = function () {\r\n usuarios.isTelaConsuta = true;\r\n };\r\n\r\n usuarios.salvar = function (formUsuarios) {\r\n var usuario = usuarios.selected;\r\n\r\n usuario.CadUsuarioPerfils = pefisModifieds;\r\n\r\n\r\n usuarios.spinner.spin();\r\n UsuarioModel.update(usuario)\r\n .then(function (data) {\r\n usuarios.spinner.stop();\r\n usuarios.isTelaConsuta = true;\r\n //getUsers();\r\n });\r\n\r\n };\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ValidacaoController', ValidacaoController);\r\n\r\n ValidacaoController.$inject = [\r\n '$state',\r\n 'ValidacaoModel',\r\n 'EntitiesMetadata',\r\n 'getValueInPath',\r\n 'SyncService'\r\n ];\r\n\r\n function ValidacaoController(\r\n $state,\r\n ValidacaoModel,\r\n EntitiesMetadata,\r\n getValueInPath,\r\n SyncService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var mapping = EntitiesMetadata.validacao;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n var validacao = this;\r\n validacao.name = $state.current.name;\r\n validacao.list = [];\r\n validacao.originalList = [];\r\n validacao.filtro = '';\r\n validacao.selected = null;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function inicializar() {\r\n getList();\r\n\r\n SyncService.addEventListener('aprovacao', function () {\r\n getList();\r\n });\r\n }\r\n\r\n\r\n function getKey(key){\r\n if(key == 'NomUsuario'){\r\n console.log(validacao.name)\r\n return 'Operator'\r\n \r\n }\r\n return key;\r\n }\r\n\r\n function mapDisplayColumns(line) {\r\n var retorno = {\r\n original: line,\r\n display: {}\r\n };\r\n\r\n for (var index in mapping[validacao.name].displayColumns) {\r\n var column = mapping[validacao.name].displayColumns[index];\r\n var keyValue = getValueInPath(line, column);\r\n var key = getKey(keyValue.key);\r\n retorno.display[key] = keyValue.value;\r\n console.log(retorno.display);\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function getList() {\r\n\r\n // TODO - Cannot read property 'serverUrl' of undefined\r\n // Quanto recarrega a página\r\n ValidacaoModel.getAll(mapping[validacao.name].serverUrl)\r\n .then(function (resposta) {\r\n validacao.originalList = resposta;\r\n validacao.list = resposta.map(mapDisplayColumns);\r\n })\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n validacao.atualizar = function () {\r\n getList();\r\n };\r\n\r\n validacao.isTelaConsuta = function () {\r\n return $state.current.name.indexOf('detalhe') < 0;\r\n };\r\n\r\n validacao.click = function (item) {\r\n validacao.selected = item;\r\n $state.go(validacao.name + '.detalhe');\r\n };\r\n\r\n\r\n inicializar();\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('ValidacaoDetalheController', ValidacaoDetalheController);\r\n\r\n ValidacaoDetalheController.$inject = [\r\n '$window',\r\n 'EntitiesMetadata',\r\n 'ValidacaoModel',\r\n '$q',\r\n 'getValueInPath',\r\n 'UsuarioService',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'SyncService',\r\n 'AlertExceptionService'\r\n ];\r\n\r\n function ValidacaoDetalheController(\r\n $window,\r\n EntitiesMetadata,\r\n ValidacaoModel,\r\n $q,\r\n getValueInPath,\r\n UsuarioService,\r\n MessageService,\r\n TranslateService,\r\n SyncService,\r\n AlertExceptionService\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var mapping = EntitiesMetadata.validacao;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n var detalhe = this;\r\n detalhe.oldValue = null;\r\n detalhe.newValue = null;\r\n detalhe.name = null;\r\n detalhe.filtro = \"\";\r\n detalhe.comparingList = [];\r\n detalhe.tipoSolicitacao = \"\";\r\n detalhe.justifReaberturaTurno = null;\r\n detalhe.isAprovado = false;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n function fillComparingList(compareColumns, oldValue, newValue) {\r\n\r\n try {\r\n var comparingList = [];\r\n compareColumns.forEach(function (prop) {\r\n comparingList = comparingList.concat(getEquivalentValues(prop, oldValue, newValue));\r\n });\r\n\r\n return comparingList;\r\n\r\n } catch (error) {\r\n console.log(error);\r\n\r\n }\r\n\r\n };\r\n\r\n function getEquivalentValues(prop, oldValue, newValue) {\r\n\r\n if (!(oldValue && newValue)) return;\r\n\r\n if (Array.isArray(prop)) {\r\n return [mountComparisonValue(oldValue, newValue, prop[0], prop[1])];\r\n }\r\n\r\n if (typeof prop === \"string\") {\r\n return [mountComparisonValue(oldValue, newValue, prop, prop)];\r\n }\r\n\r\n var oldPropArray = oldValue ? oldValue[prop.property[0]] || oldValue[prop.property[1]] : [];\r\n var newPropArray = newValue ? newValue[prop.property[1]] : [];\r\n var checkedKeys = [];\r\n var equivalentValues = [];\r\n\r\n for (var i = 0; i < oldPropArray.length; i++) {\r\n var oldElement = oldPropArray[i];\r\n var newElement = newPropArray.find(function (item) {\r\n return item[prop.key] === oldElement[prop.key];\r\n });\r\n checkedKeys.push(oldElement[prop.key]);\r\n\r\n equivalentValues = equivalentValues.concat(\r\n fillComparingList(prop.compareColumns, oldElement, newElement)\r\n .map(function (item, index) {\r\n if (!item) return;\r\n item.highlight = index === 0 ? true : item.highlight;\r\n return item;\r\n })\r\n );\r\n }\r\n\r\n return equivalentValues;\r\n }\r\n\r\n function mountComparisonValue(oldValue, newValue, oldPath, newPath) {\r\n var oldProperty = getValueInPath(oldValue, oldPath);\r\n var newProperty = getValueInPath(newValue, newPath);\r\n\r\n console.log(detalhe.name)\r\n console.log(oldProperty.key)\r\n if(oldProperty.value != null && newProperty.value != null){\r\n\r\n var keylabel = oldProperty.key\r\n\r\n \r\n if(keylabel == 'NomUsuario' && detalhe.name == 'validacaoTransferencia'){\r\n keylabel = 'operator'\r\n }\r\n\r\n return {\r\n label:keylabel,\r\n oldValue: oldProperty.value,\r\n newValue: newProperty.value\r\n };\r\n\r\n }\r\n\r\n \r\n }\r\n\r\n function getNewValue(selected, metadata) {\r\n if (!metadata.shouldGetFullHistory) {\r\n return $q.resolve(selected);\r\n }\r\n var retNew = getById(metadata.serverUrl, metadata.historyId, selected[metadata.historyId]);\r\n return retNew;\r\n }\r\n\r\n function getOldValue(selected, metadata) {\r\n var retOld = '';\r\n try {\r\n retOld = getById(metadata.entityUrl, metadata.entityId, selected[metadata.entityId]);\r\n if (retOld === undefined) {\r\n retOld = '';\r\n }\r\n return retOld;\r\n } catch (e) {\r\n retOld = '';\r\n }\r\n return retOld;\r\n }\r\n\r\n function getById(url, idName, idValue) {\r\n return ValidacaoModel.getById(url, idName, idValue)\r\n .then(function (resposta) {\r\n if (resposta && resposta.length) {\r\n return resposta[0];\r\n }\r\n\r\n return {};\r\n });\r\n };\r\n\r\n function respond(isApproved) {\r\n detalhe.isAprovado = true;\r\n\r\n var now = new Date();\r\n\r\n detalhe.newValue.SolicitacaoAtualizacao = detalhe.newValue.SolicitacaoAtualizacao || {};\r\n\r\n detalhe.newValue.SolicitacaoAtualizacao.DataHoraUTCAvaliacao = now;\r\n detalhe.newValue.DthResposta = now;\r\n\r\n detalhe.newValue.SolicitacaoAtualizacao.IdentificadorUsuarioAvaliador = UsuarioService.indice;\r\n detalhe.newValue.IdcUsuarioResposta = UsuarioService.indice;\r\n detalhe.newValue.SolicitacaoAtualizacao.IndicadorSituacao = isApproved ? 'A' : 'R';\r\n detalhe.newValue.CodRespostaAceite = isApproved ? 1 : 0;\r\n\r\n \r\n if (detalhe.name == 'validacaoTurno') {\r\n detalhe.newValue.IdcUsuarioAceiteAlteracaoParameter = UsuarioService.indice;\r\n detalhe.newValue.DthAceiteAlteracaoParameter = now;\r\n detalhe.newValue.CodAceiteParameter = isApproved ? 1 : 0;\r\n }\r\n else {\r\n detalhe.newValue.IdcUsuarioAceiteAlteracao = UsuarioService.indice;\r\n detalhe.newValue.DthAceiteAlteracao = now;\r\n detalhe.newValue.CodAceite = isApproved ? 1 : 0;\r\n }\r\n\r\n\r\n return ValidacaoModel.put(detalhe.metadata.serverUrl, detalhe.newValue)\r\n .then(function () {\r\n return MessageService.alert(\r\n TranslateService('success'),\r\n TranslateService('successfully-saved')\r\n );\r\n })\r\n .then(function () {\r\n detalhe.isAprovado = false;\r\n $window.history.back();\r\n SyncService.dispatchEvent('aprovacao');\r\n }).catch(AlertExceptionService);\r\n }\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n detalhe.cancel = function () {\r\n $window.history.back();\r\n };\r\n\r\n detalhe.aprovar = function () {\r\n respond(true);\r\n };\r\n\r\n detalhe.reprovar = function () {\r\n respond(false);\r\n };\r\n\r\n detalhe.init = function (selected, name) {\r\n\r\n detalhe.name = name;\r\n detalhe.metadata = mapping[name];\r\n\r\n $q.all([\r\n getOldValue(selected, mapping[name]),\r\n getNewValue(selected, mapping[name])\r\n ]).then(function (values) {\r\n detalhe.oldValue = Object.keys(values[0]).length ? values[0] : values[1];\r\n detalhe.newValue = values[1];\r\n\r\n if (name === 'validacaoTurno') {\r\n detalhe.justifReaberturaTurno = detalhe.newValue.JustifReaberturaTurno;\r\n }\r\n else if (name === 'validacaoEquipamento') {\r\n if (detalhe.newValue.ListHstRelEquipamentoComplexo.length > 0) {\r\n var complexosAlterados = detalhe.newValue.ListHstRelEquipamentoComplexo.filter(function (item) { return item.StuEquipamento.includes(\"A\") });\r\n \r\n\r\n if (complexosAlterados && complexosAlterados.length) {\r\n \r\n var equipamentoComplexoList = detalhe.oldValue.ListRelEquipamentoComplexo ? detalhe.oldValue.ListRelEquipamentoComplexo : detalhe.oldValue.ListHstRelEquipamentoComplexo;\r\n \r\n for (var i = 0; i < equipamentoComplexoList.length; i++) {\r\n var item = equipamentoComplexoList[i];\r\n var complexoAlterado = complexosAlterados.find(function (itemComplexo){\r\n return itemComplexo.IdcComplexo == item.IdcComplexo;\r\n })\r\n if (complexoAlterado && item.IdcEquipamento == 0) {\r\n\r\n item.IdcCentroLucro = \"-\";\r\n item.CadComplexo = { IdcComplexo: \"-\", SglComplexo: \"-\" }\r\n item.CadContrato = { IdcContrato: \"-\", CodContrato: \"-\" }\r\n item.CadCentroLucro = { IdcCentroLucro: \"-\", CodCentroLucro: \"-\" }\r\n item.CadCentroLucro = { CodCentroLucro: \"-\", DscCentroLucro: \"-\" }\r\n item.IdcContrato = \"-\";\r\n item.IdcOrdemEstatistica = \"-\";\r\n item.IdcElementoPep = \"-\";\r\n item.IdcCentroCusto = \"-\";\r\n item.FontePagadora = { TipoFonte: \"-\", IdcFontePagadora: \"-\", CodFontePagadora: \"-\" }\r\n item.IdcGerencia = \"-\";\r\n item.IdcImagemContrato = \"-\";\r\n item.PrazoInativacao = \"-\";\r\n item.StuEquipamento = \"-\";\r\n item.DthInativacaoEquipamento = \"-\";\r\n \r\n if (complexoAlterado.IdcCentroCusto != null) {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('bill-department'),\r\n IdcFontePagadora: complexoAlterado.IdcCentroCusto,\r\n CodFontePagadora: complexoAlterado.CadCentroCusto.CodCentroCusto\r\n };\r\n }\r\n else if (complexoAlterado.IdcElementoPep != null) {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('pepElement'),\r\n IdcFontePagadora: complexoAlterado.IdcElementoPep,\r\n CodFontePagadora: complexoAlterado.CadElementoPep.CodElementoPep\r\n };\r\n }\r\n else if (complexoAlterado.IdcOrdemEstatistica != null) {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('statisticalOrder'),\r\n IdcFontePagadora: complexoAlterado.IdcOrdemEstatistica,\r\n CodFontePagadora: complexoAlterado.CadOrdemEstatistica.CodOrdemEstatistica\r\n };\r\n }\r\n else {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('rateio'),\r\n IdcFontePagadora: complexoAlterado.IdcGerencia,\r\n CodFontePagadora: complexoAlterado.CadGerencia.DscGerencia\r\n };\r\n }\r\n\r\n }\r\n else if(complexoAlterado && complexoAlterado.IdcHstEquipamento != 0){\r\n\r\n\r\n if (item.IdcCentroCusto != null) {\r\n item.FontePagadora = {\r\n TipoFonte: TranslateService('bill-department'),\r\n IdcFontePagadora: item.IdcCentroCusto,\r\n CodFontePagadora: item.CadCentroCusto.CodCentroCusto\r\n };\r\n }\r\n else if (item.IdcElementoPep != null) {\r\n item.FontePagadora = {\r\n TipoFonte: TranslateService('pepElement'),\r\n IdcFontePagadora: item.IdcElementoPep,\r\n CodFontePagadora: item.CadElementoPep.CodElementoPep\r\n };\r\n }\r\n else if (item.IdcOrdemEstatistica != null) {\r\n item.FontePagadora = {\r\n TipoFonte: TranslateService('statisticalOrder'),\r\n IdcFontePagadora: item.IdcOrdemEstatistica,\r\n CodFontePagadora: item.CadOrdemEstatistica.CodOrdemEstatistica\r\n };\r\n }\r\n else {\r\n item.FontePagadora = {\r\n TipoFonte: TranslateService('rateio'),\r\n IdcFontePagadora: item.IdcGerencia,\r\n CodFontePagadora: item.CadGerencia.DscGerencia\r\n };\r\n }\r\n\r\n if (complexoAlterado.IdcCentroCusto != null) {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('bill-department'),\r\n IdcFontePagadora: complexoAlterado.IdcCentroCusto,\r\n CodFontePagadora: complexoAlterado.CadCentroCusto.CodCentroCusto\r\n };\r\n }\r\n else if (complexoAlterado.IdcElementoPep != null) {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('pepElement'),\r\n IdcFontePagadora: complexoAlterado.IdcElementoPep,\r\n CodFontePagadora: complexoAlterado.CadElementoPep.CodElementoPep\r\n };\r\n }\r\n else if (complexoAlterado.IdcOrdemEstatistica != null) {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('statisticalOrder'),\r\n IdcFontePagadora: complexoAlterado.IdcOrdemEstatistica,\r\n CodFontePagadora: complexoAlterado.CadOrdemEstatistica.CodOrdemEstatistica\r\n };\r\n }\r\n else {\r\n complexoAlterado.FontePagadora = {\r\n TipoFonte: TranslateService('rateio'),\r\n IdcFontePagadora: complexoAlterado.IdcGerencia,\r\n CodFontePagadora: complexoAlterado.CadGerencia.DscGerencia\r\n };\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (detalhe.newValue.CodSolicitacaoAceite) {\r\n detalhe.tipoSolicitacao = TranslateService('tipoSolicitacao' + detalhe.newValue.CodSolicitacaoAceite);\r\n }\r\n\r\n detalhe.comparingList = fillComparingList(mapping[name].compareColumns, detalhe.oldValue, detalhe.newValue);\r\n });\r\n\r\n };\r\n\r\n detalhe.hasValidation = function () {\r\n return mapping[detalhe.name].hasValidationFlow;\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').controller('VisualizadorImagemController', VisualizadorImagemController);\r\n\r\n VisualizadorImagemController.$inject = [\r\n '$uibModalInstance',\r\n 'image'\r\n ];\r\n\r\n function VisualizadorImagemController(\r\n $uibModalInstance,\r\n image\r\n ) {\r\n\r\n /////////////////////////\r\n //Propriedades privadas//\r\n /////////////////////////\r\n var visualizadorImagemCTRL = this;\r\n\r\n /////////////////////////\r\n //Propriedades públicas//\r\n /////////////////////////\r\n visualizadorImagemCTRL.image = image.image;\r\n\r\n ////////////////////\r\n //Métodos privados//\r\n ////////////////////\r\n\r\n ////////////////////\r\n //Métodos publicos//\r\n ////////////////////\r\n\r\n visualizadorImagemCTRL.salvar = function () {\r\n $uibModalInstance.close();\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil')\r\n .filter('filterCargaStatus', function () {\r\n return function (input, filterObject) {\r\n if (filterObject == \"\" || filterObject == undefined || filterObject == \"100\") {\r\n return input;\r\n }\r\n\r\n var out = input.filter(function (a) {\r\n return a.StuEnvioSap == filterObject\r\n });\r\n\r\n console.log(out);\r\n return out;\r\n };\r\n });\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').directive('dontColapseOnDesktop', dontColapseOnDesktop);\r\n\r\n function dontColapseOnDesktop() {\r\n\r\n if (typeof window.matchMedia !== 'function') return { restrict: 'A', link: function () { } };\r\n\r\n return {\r\n restrict: 'A',\r\n link: function (scope, element) {\r\n\r\n var mediaQueryList = window.matchMedia(\"(min-width: 768px)\");\r\n mediaQueryList.addListener(handleMedia);\r\n\r\n function preventDefault(e) {\r\n e.preventDefault();\r\n }\r\n\r\n function handleMedia(mediaQueryList) {\r\n if (mediaQueryList && mediaQueryList.matches) {\r\n element.on('hide.bs.collapse', preventDefault);\r\n element.on('show.bs.collapse', preventDefault);\r\n } else {\r\n element.off('hide.bs.collapse', preventDefault);\r\n element.off('show.bs.collapse', preventDefault);\r\n }\r\n }\r\n\r\n handleMedia(mediaQueryList);\r\n }\r\n };\r\n }\r\n\r\n})();","(function(){\r\n 'use strict';\r\n\r\n angular.module('posto-facil')\r\n .filter('filterSearch', function () {\r\n return function (input, filterObject, param) {\r\n if (filterObject == undefined) { return input; }\r\n var out = [];\r\n if (input != undefined) {\r\n var isArrayParam = typeof param === 'object';\r\n \r\n out = input.filter(function (value) { return (!filterObject || filterObject == '') || (value && param && compareData(isArrayParam, value, param, filterObject));})\r\n }\r\n return out;\r\n };\r\n });\r\n})();\r\n\r\n\r\nfunction compareData(isArrayParam, value, param, filterObject) {\r\n var filterCondition = true;\r\n if (isArrayParam) {\r\n var multiFilter = false;\r\n for (var paramIndex in param) {\r\n var paramItem = param[paramIndex];\r\n\r\n multiFilter = String(value[paramItem]).toLowerCase().includes(filterObject.toLowerCase());\r\n if (multiFilter) {\r\n break;\r\n }\r\n }\r\n filterCondition = multiFilter;\r\n }\r\n else {\r\n filterCondition = String(value[param]).toLowerCase().includes(filterObject.toLowerCase());\r\n }\r\n return filterCondition;\r\n}","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').directive('focusOn', focusOn);\r\n\r\n function focusOn() {\r\n return function (scope, elem, attr) {\r\n scope.$on('focusOn', function (e, name) {\r\n if (name === attr.focusOn) {\r\n elem[0].focus();\r\n }\r\n });\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').directive('ihmDblclick', ihmDblclick);\r\n\r\n function ihmDblclick() {\r\n\r\n var DblClickInterval = 300; //milliseconds\r\n\r\n var firstClickTime;\r\n var waitingSecondClick = false;\r\n\r\n return {\r\n restrict: 'A',\r\n link: function (scope, element, attrs) {\r\n element.bind('click', function (e) {\r\n\r\n if (!waitingSecondClick) {\r\n firstClickTime = (new Date()).getTime();\r\n waitingSecondClick = true;\r\n\r\n setTimeout(function () {\r\n waitingSecondClick = false;\r\n }, DblClickInterval);\r\n }\r\n else {\r\n waitingSecondClick = false;\r\n\r\n var time = (new Date()).getTime();\r\n if (time - firstClickTime < DblClickInterval) {\r\n scope.$apply(attrs.ihmDblclick);\r\n }\r\n }\r\n });\r\n }\r\n };\r\n }\r\n\r\n})();\r\n\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil')\r\n .filter('IndividualfilterSearch', function () {\r\n return function (input, filterObject, param) {\r\n const keys = Object.keys(filterObject)\r\n var out = [];\r\n\r\n out = input.filter(function (inp) {\r\n var retorna = true;\r\n for (var keyIndex in keys) {\r\n var key = keys[keyIndex];\r\n if (retorna) {\r\n if (filterObject[key].toUpperCase() != \"\" && filterObject[key] != undefined) {\r\n retorna = inp[key].toUpperCase().includes(filterObject[key].toUpperCase());\r\n }\r\n else {\r\n retorna = true;\r\n }\r\n }\r\n\r\n }\r\n\r\n return retorna;\r\n\r\n });\r\n\r\n return out;\r\n };\r\n });\r\n})();\r\n\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').directive('maxCharacters', maxCharacters);\r\n\r\n function maxCharacters() {\r\n return {\r\n restrict: 'A',\r\n link: function (scope, element, config) {\r\n var max = parseInt(config.maxCharacters);\r\n element[0].addEventListener('keydown', function (event) {\r\n scope.$apply(function () {\r\n try {\r\n var allowedKeys = [\r\n \"Del\",\r\n \"Backspace\",\r\n \"Delete\",\r\n \"Left\",\r\n \"Right\",\r\n \"Down\",\r\n \"Up\",\r\n \"ArrowUp\",\r\n \"ArrowDown\",\r\n \"ArrowLeft\",\r\n \"ArrowRight\",\r\n \"Control\",\r\n \"Tab\"\r\n ];\r\n if (event.key && (allowedKeys.indexOf(event.key) === -1)) {\r\n if (event.ctrlKey && (event.key == 'v' || event.key === 'c' || event.key === 'x')) {\r\n return;\r\n }\r\n if(element[0].value.length === max) event.preventDefault();\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n });\r\n });\r\n }\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').directive('onlyDigits', onlyDigits);\r\n\r\n function onlyDigits() {\r\n\r\n var oldValue = '';\r\n var elemento = {};\r\n var valorAtual = null;\r\n var hasValue = false;\r\n\r\n return {\r\n restrict: 'A',\r\n link: function (scope, element) {\r\n\r\n if (element && element[0]) {\r\n element[0].addEventListener('keydown', function (event) {\r\n scope.$apply(function () {\r\n try {\r\n var allowedKeys = [\r\n \"0\",\r\n \"1\",\r\n \"2\",\r\n \"3\",\r\n \"4\",\r\n \"5\",\r\n \"6\",\r\n \"7\",\r\n \"8\",\r\n \"9\",\r\n \",\",\r\n \".\",\r\n \"Del\",\r\n \"\",\r\n \"Backspace\",\r\n \"Delete\",\r\n \"Left\",\r\n \"Right\",\r\n \"Down\",\r\n \"Up\",\r\n \"ArrowUp\",\r\n \"ArrowDown\",\r\n \"ArrowLeft\",\r\n \"ArrowRight\",\r\n \"Control\",\r\n \":\",\r\n \"/\",\r\n \"Divide\",\r\n \"Tab\"\r\n ];\r\n if (event.key && (allowedKeys.indexOf(event.key) === -1)) {\r\n if (event.ctrlKey && (event.key == 'v' || event.key === 'c' || event.key === 'x')) {\r\n return;\r\n }\r\n event.preventDefault();\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n });\r\n });\r\n\r\n element[0].addEventListener('paste', function (event) {\r\n scope.$apply(function () {\r\n try {\r\n var conteudo = event.clipboardData && event.clipboardData.getData(\"text\");\r\n var conteudoSemLetras = conteudo ? conteudo.replace(/[^0-9\\.,\\/:]/g, '') : null;\r\n if (conteudo !== conteudoSemLetras) {\r\n event.preventDefault();\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n });\r\n });\r\n }\r\n }\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').directive('onlyIntegers', onlyIntegers);\r\n\r\n function onlyIntegers() {\r\n return {\r\n restrict: 'A',\r\n link: function (scope, element) {\r\n\r\n if (element && element[0]) {\r\n element[0].addEventListener('keydown', function (event) {\r\n scope.$apply(function () {\r\n try {\r\n var allowedKeys = [\r\n \"0\",\r\n \"1\",\r\n \"2\",\r\n \"3\",\r\n \"4\",\r\n \"5\",\r\n \"6\",\r\n \"7\",\r\n \"8\",\r\n \"9\",\r\n \"Del\",\r\n \"\",\r\n \"Backspace\",\r\n \"Delete\",\r\n \"Left\",\r\n \"Right\",\r\n \"Down\",\r\n \"Up\",\r\n \"ArrowUp\",\r\n \"ArrowDown\",\r\n \"ArrowLeft\",\r\n \"ArrowRight\",\r\n \"Control\",\r\n \"Tab\"\r\n ];\r\n if (event.key && (allowedKeys.indexOf(event.key) === -1)) {\r\n if (event.ctrlKey && (event.key == 'v' || event.key === 'c' || event.key === 'x')) {\r\n return;\r\n }\r\n event.preventDefault();\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n });\r\n });\r\n\r\n element[0].addEventListener('paste', function (event) {\r\n scope.$apply(function () {\r\n try {\r\n var conteudo = event.clipboardData && event.clipboardData.getData(\"text\");\r\n var conteudoSemLetras = conteudo ? conteudo.replace(/[^0-9]/g, '') : null;\r\n if (conteudo !== conteudoSemLetras) {\r\n event.preventDefault();\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n });\r\n });\r\n }\r\n }\r\n };\r\n }\r\n\r\n})();","(function(){\r\n 'use strict';\r\n\r\n angular.module('posto-facil')\r\n .directive('uppercased', function () {\r\n return {\r\n require: 'ngModel',\r\n link: function (scope, element, attrs, modelCtrl) {\r\n modelCtrl.$parsers.push(function (input) {\r\n return input ? input.toUpperCase() : \"\";\r\n });\r\n element.css(\"text-transform\", \"uppercase\");\r\n }\r\n };\r\n });\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('AbastecimentoModel', AbastecimentoModel);\r\n\r\n AbastecimentoModel.$inject = [\r\n '$httpLegacy',\r\n '$http',\r\n 'UsuarioService',\r\n 'CadEquipamentoModel',\r\n '$q',\r\n '$timeout',\r\n 'Constant',\r\n 'ngDexie',\r\n 'CtrHorHodModel',\r\n 'CtrEncerranteModel',\r\n 'RequestService',\r\n 'TranslateService',\r\n '$filter'\r\n ];\r\n\r\n function AbastecimentoModel(\r\n $httpLegacy,\r\n $http,\r\n UsuarioService,\r\n CadEquipamentoModel,\r\n $q,\r\n $timeout,\r\n Constant,\r\n ngDexie,\r\n CtrHorHodModel,\r\n CtrEncerranteModel,\r\n RequestService,\r\n TranslateService,\r\n $filter\r\n ) {\r\n\r\n RequestService.url = '../server/ashx/_regAbastecimento.ashx';\r\n var historicoURL = '../server/mobileServer/_hstAbastecimento.ashx';\r\n\r\n //Propriedades privadas\r\n var db = ngDexie.getDb();\r\n var emProgresso = false;\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function post(dados) {\r\n return $httpLegacy.post('../server/ashx/_regAbastecimento.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function isEmAvaliacao(IdcAbastecimento) {\r\n\r\n if (!IdcAbastecimento) return $q.resolve(false);\r\n\r\n return $http.get(historicoURL, {\r\n params: {\r\n IdcAbastecimento: IdcAbastecimento,\r\n OnlyPending: true\r\n }\r\n }).then(function (resposta) {\r\n return !!resposta.data.length;\r\n });\r\n }\r\n\r\n function preencheBancoInterno(abastecimentos) {\r\n var promises = [];\r\n\r\n abastecimentos.forEach(function (item) {\r\n promises.push(db.REG_ABASTECIMENTO.put(item)\r\n .then(function (idTela) {\r\n item.idTela = idTela;\r\n return item;\r\n }));\r\n });\r\n\r\n return $q.all(promises);\r\n }\r\n\r\n function atualizaHorimetro(resposta) {\r\n if (!resposta) return;\r\n var ctrHorHod = resposta ? {\r\n \"IdcEquipamento\": resposta.IdcEquipamento,\r\n \"DthCtrHorHod\": resposta.DthInicial,\r\n \"ValHorHodAtual\": resposta.ValHorHod\r\n } : null;\r\n\r\n CtrHorHodModel.updateHorimetro(ctrHorHod);\r\n }\r\n\r\n function atualizaEncerrante(resposta) {\r\n if (!resposta) return;\r\n\r\n resposta.listAbastecimentoTanque.forEach(function (tanque) {\r\n var encerrante = {\r\n DthCtrEncerrante: tanque.DthAbastecimentoTanque,\r\n IdcBlocoMedidor: tanque.IdcBlocoMedidor,\r\n ValEncerranteAtual: tanque.ValEncerranteAbastecimento\r\n };\r\n\r\n CtrEncerranteModel.updateEncerrante(encerrante);\r\n });\r\n }\r\n\r\n function getByIdcRegTurno(idcRegTurno) {\r\n if (!idcRegTurno) return $q.resolve([]);\r\n\r\n var dados = {\r\n 'section': 'abastecimento',\r\n 'function': 'dataGrid',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n idcRegTurno: idcRegTurno\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function validarAbastecimentoEncavaladoOffLine(abastecimento) {\r\n return new $q(function (resolve, reject) {\r\n\r\n var dados_encerrante = null;\r\n var dados_abastecimento = null;\r\n\r\n db.CTR_ENCERRANTE.filter(function (item) {\r\n // Tbl Encerrante: Filtro de operacao, Filtrar somente os encerrantes que possuam IdcOperacao e Bloco Medidor Descartando as operações de abastecimento, pois a validação do abastecimento será feita pela própria tabela de abastecimento.\r\n var filter_encerrante_operacao = item.IdcOperacao && item.IdcOperacao > 0 && item.TblOperacao != 'REG_ABASTECIMENTO_TANQUE' && item.IdcBlocoMedidor > 0;\r\n\r\n // Tbl Encerrante: Filtrar somente os encerrantes que estão relacionados no abastecimento atual.\r\n var filter_encerrante_blocos_medidores = abastecimento.listAbastecimentoTanque.findIndex(function (find) { return find.IdcBlocoMedidor === item.IdcBlocoMedidor }) >= 0;\r\n\r\n // Tbl Encerrante: Filtro de período, levando em consideração se o movimento possui data inicial e final.\r\n var filter_encerrante_periodo = (\r\n // Filtro de Data - Filtrar Encerrantes com data encavalada onde possua data de início e fim (Abastecimento não é considerado aqui pois já é validado pela tabela de abastecimentos na condicional acima)\r\n (['V5ETRANT'].includes(item.TblOperacao) &&\r\n ((abastecimento.DthInicial >= item.DthInicialOperacao && abastecimento.DthInicial <= item.DthFinalOperacao) || (abastecimento.DthFinal >= item.DthInicialOperacao && abastecimento.DthFinal <= item.DthFinalOperacao) ||\r\n (item.DthInicialOperacao >= abastecimento.DthInicial && item.DthInicialOperacao <= abastecimento.DthFinal) || (item.DthFinalOperacao >= abastecimento.DthInicial && item.DthFinalOperacao <= abastecimento.DthFinal))\r\n ) ||\r\n // Filtro de Data - Filtrar Encerrantes com data encavalada onde não possua data de início.\r\n (['V5GDETRT', 'REG_BLOCO_MEDIDOR_AFERICAO'].includes(item.TblOperacao) &&\r\n (item.DthFinalOperacao >= abastecimento.DthInicial && item.DthFinalOperacao <= abastecimento.DthFinal)\r\n )\r\n );\r\n\r\n return (filter_encerrante_operacao && filter_encerrante_blocos_medidores && filter_encerrante_periodo);\r\n }).toArray().then(function (encerrante_data) {\r\n dados_encerrante = encerrante_data;\r\n return db.REG_ABASTECIMENTO.filter(function (item) {\r\n // Tbl Abastecimento: Filtro de operação de abastecimento atual desconsiderando o ID da operação atual para checar colisões entre os abastecimentos\r\n var filter_abastecimento_operacao = abastecimento.idTela && abastecimento.idTela > 0 ? abastecimento.idTela != item.idTela : true;\r\n\r\n // Tbl Abastecimento: Filtro de Bloco Medidor, filtrar somente os abastecimentos que utilizam o mesmo bloco medidor do abastecimento atual e que não esteja estornado.\r\n var filter_abastecimento_bloco_medidor = item.listAbastecimentoTanque.filter(function (elem) {\r\n return elem.RegEstornado !== true && abastecimento.listAbastecimentoTanque.some(function (ele) {\r\n return elem.IdcBlocoMedidor > 0 && ele.IdcBlocoMedidor > 0 && elem.IdcBlocoMedidor === ele.IdcBlocoMedidor;\r\n });\r\n });\r\n\r\n // Tbl Abastecimento: Filtro de período, filtrar abastecimentos com data encavalada\r\n var filter_abastecimento_periodo = (\r\n (abastecimento.DthInicial >= item.DthInicial && abastecimento.DthInicial <= item.DthFinal) || (abastecimento.DthFinal >= item.DthInicial && abastecimento.DthFinal <= item.DthFinal) ||\r\n (item.DthInicial >= abastecimento.DthInicial && item.DthInicial <= abastecimento.DthFinal) || (item.DthFinal >= abastecimento.DthInicial && item.DthFinal <= abastecimento.DthFinal)\r\n );\r\n\r\n return filter_abastecimento_operacao && filter_abastecimento_bloco_medidor.length > 0 && filter_abastecimento_periodo;\r\n }).toArray();\r\n }).then(function (abastecimento_data) {\r\n dados_abastecimento = abastecimento_data;\r\n if (dados_abastecimento.length > 0)\r\n throw new Error(\"Existe abastecimento encavalado\");\r\n if (dados_encerrante.length > 0)\r\n throw new Error(\"Existe encerrante encavalado\");\r\n\r\n resolve();\r\n }).catch(function (error) {\r\n // Arrays destinados a guardar as siglas dos blocos medidores com dados encavalados, neste primeiro momento existirá repetição que será tratada mais abaixo.\r\n var blocos_abastecimento = [];\r\n var blocos_encerrantes = [];\r\n dados_abastecimento.forEach(function (elem) {\r\n elem.listAbastecimentoTanque.map(function (a) {\r\n if (a.IdcBlocoMedidor && a.IdcBlocoMedidor > 0 && a.SglBlocoMedidor && a.RegEstornado !== true)\r\n blocos_abastecimento.push(a.SglBlocoMedidor)\r\n });\r\n });\r\n\r\n dados_encerrante.forEach(function (elem) {\r\n if (elem.IdcBlocoMedidor && elem.IdcBlocoMedidor > 0 && elem.SglBlocoMedidor)\r\n blocos_encerrantes.push(elem.SglBlocoMedidor);\r\n });\r\n\r\n // Gerar novo array agora removendo as entradas duplicadas - operação equivalente a um Distinct.\r\n var blocos_validados = Array.from(new Set(blocos_abastecimento.concat(blocos_encerrantes)));\r\n // Ordernar os blocos levando em consideração caracteres NON-ASCII ex: é, í, ó, etc.\r\n blocos_validados = blocos_validados.sort(function (a, b) { return a.localeCompare(b) });\r\n\r\n reject(TranslateService('bloco-medidor-tem-operacoes-periodo').replace('{0}', blocos_validados.join(', ')));\r\n });\r\n });\r\n };\r\n\r\n //Métodos publicos\r\n function getAllByIdcRegTurno(idcRegTurno) {\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'abastecimento',\r\n 'function': 'dataGrid',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n idcRegTurno: idcRegTurno\r\n },\r\n 'funcaoGet': function () {\r\n return db.REG_ABASTECIMENTO.filter(function (item) {\r\n return item.IdcRegTurno === idcRegTurno;\r\n }).toArray();\r\n },\r\n 'funcaoUpdate': populaBanco,\r\n 'retornaUpdate': true\r\n });\r\n }\r\n\r\n function salvaAbastecimentosNaoSincronizados(abastecimentos) {\r\n var promises = [];\r\n if (abastecimentos.length > 0) {\r\n promises.push(salvaListaAbastecimentosNaoSincronizados(abastecimentos));\r\n }\r\n return $q.all(promises);\r\n }\r\n\r\n function populaBanco(argumento) {\r\n\r\n if (emProgresso) {\r\n return $timeout(populaBanco, 100, true, argumento);\r\n }\r\n\r\n emProgresso = true;\r\n var IdcRegTurno = null;\r\n var abastecimentos = null;\r\n\r\n if (angular.isArray(argumento)) {\r\n abastecimentos = argumento;\r\n } else {\r\n IdcRegTurno = argumento;\r\n }\r\n\r\n //Recupera todos os abastecimentos do banco interno\r\n return db.REG_ABASTECIMENTO.toArray()\r\n .then(function (abastecimentos) {\r\n\r\n //Salva todos os abastecimentos não sincronizados \r\n return salvaAbastecimentosNaoSincronizados(abastecimentos);\r\n })\r\n .then(function () {\r\n\r\n //Recupera toda a lista de ado servidor para o turno\r\n return (abastecimentos || getByIdcRegTurno(IdcRegTurno));\r\n })\r\n .then(function (value) {\r\n\r\n //Guarda a lista de abastecimentos e limpa o banco antes de continuar\r\n abastecimentos = value;\r\n return db.REG_ABASTECIMENTO.clear();\r\n })\r\n .then(function () {\r\n\r\n //Popula o banco interno com os abastecimentos trazidos do servidor\r\n return preencheBancoInterno(abastecimentos);\r\n })\r\n .then(function (resposta) {\r\n emProgresso = false;\r\n return resposta;\r\n });\r\n }\r\n\r\n function validaTagPlaca(tagPlaca, IdcRegTurno, IdcPosto) {\r\n\r\n //Dados a serem postados no servidor\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'validaTagPlaca',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n idcRegTurno: IdcRegTurno,\r\n tagPlaca: tagPlaca,\r\n posto: IdcPosto,\r\n idcAbastecimento: 0\r\n },\r\n 'id': tagPlaca,\r\n 'funcaoGet': CadEquipamentoModel.getEquipamento,\r\n 'funcaoUpdate': CadEquipamentoModel.updateEquipamento\r\n });\r\n }\r\n\r\n function salvaAbastecimento(dataAbastecimento, turnoFechado) {\r\n\r\n dataAbastecimento.IdcUsuario = UsuarioService.indice;\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'salvar',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n dataAbastecimento: JSON.stringify(dataAbastecimento),\r\n turnoFechado: !!turnoFechado\r\n },\r\n 'funcaoGet': function () {\r\n return db.REG_ABASTECIMENTO.put(dataAbastecimento)\r\n .then(function (resposta) {\r\n atualizaHorimetro(dataAbastecimento);\r\n atualizaEncerrante(dataAbastecimento);\r\n dataAbastecimento.idTela = resposta;\r\n dataAbastecimento.StatusSalvamento = true;\r\n return dataAbastecimento;\r\n });\r\n },\r\n 'funcaoUpdate': function (resposta) {\r\n atualizaHorimetro(resposta);\r\n atualizaEncerrante(resposta);\r\n if (dataAbastecimento.idTela) {\r\n resposta.idTela = dataAbastecimento.idTela;\r\n }\r\n return db.REG_ABASTECIMENTO.put(resposta)\r\n .then(function (idTela) {\r\n resposta.idTela = idTela;\r\n return resposta;\r\n });\r\n },\r\n 'retornaUpdate': true\r\n });\r\n }\r\n\r\n function salvaListaAbastecimentosNaoSincronizados(listaAbastecimento, turnoFechado) {\r\n\r\n listaAbastecimento.forEach(function (item) {\r\n item.IdcUsuario = UsuarioService.indice;\r\n });\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'salvarListaAbastecimento',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n dataAbastecimento: JSON.stringify(listaAbastecimento),\r\n turnoFechado: !!turnoFechado\r\n },\r\n 'funcaoGet': function () {\r\n return db.REG_ABASTECIMENTO.toArray();\r\n },\r\n 'funcaoUpdate': function (resposta) {\r\n resposta.forEach(function (item) {\r\n atualizaHorimetro(item);\r\n atualizaEncerrante(item);\r\n if (listaAbastecimento[0].idTela) {\r\n item.idTela = listaAbastecimento[0].idTela;\r\n }\r\n db.REG_ABASTECIMENTO.put(item)\r\n .then(function (idTela) {\r\n item.idTela = idTela;\r\n return item;\r\n });\r\n });\r\n },\r\n 'retornaUpdate': true\r\n });\r\n }\r\n\r\n function verificaAbastecimentoEncavalado(abastecimento) {\r\n return new $q(function (resolve, reject) {\r\n if (!abastecimento) {\r\n reject(TranslateService('saving-failed'));\r\n } else {\r\n if (navigator.onLine) {\r\n var dados = {\r\n 'section': 'registro',\r\n 'function': 'validarDadosEncavalados',\r\n 'parameter': {\r\n dataAbastecimento: JSON.stringify(abastecimento)\r\n }\r\n };\r\n post(dados).then(function (success) {\r\n resolve(success);\r\n }).catch(function (error) {\r\n reject(error);\r\n });\r\n }\r\n else {\r\n validarAbastecimentoEncavaladoOffLine(abastecimento).then(function (success) {\r\n resolve(success);\r\n }).catch(function (error) {\r\n reject(error);\r\n });\r\n }\r\n }\r\n });\r\n }\r\n\r\n function verificaAbastecimentoExistente(abastecimento) {\r\n if (!abastecimento) return $q.resolve([]);\r\n\r\n return db.REG_ABASTECIMENTO.toArray()\r\n .then(function (resposta) {\r\n for (var key in resposta) {\r\n var equipamentoR = resposta[key].IdcEquipamento;\r\n var data = resposta[key].DthInicial;\r\n if (abastecimento.IdcAbastecimento === 0) {\r\n if (equipamentoR === abastecimento.IdcEquipamento && data.getTime() === abastecimento.DthInicial.getTime()) {\r\n return \"repeted\";\r\n }\r\n }\r\n }\r\n var retorno = \"\";\r\n for (var key in resposta) {\r\n var turno = resposta[key].IdcRegTurno;\r\n var DthInicial = resposta[key].DthInicial;\r\n var equipamentoO = resposta[key].IdcEquipamento;\r\n if (abastecimento.IdcAbastecimento === 0) {\r\n if (equipamentoO === abastecimento.IdcEquipamento && turno === abastecimento.IdcRegTurno) {\r\n if (equipamentoO === abastecimento.IdcEquipamento && retorno == \"\") {\r\n retorno = $filter('date')(DthInicial, TranslateService('datetime-format')\r\n );\r\n retorno = retorno.split(\" \")[0] + \" (\";\r\n }\r\n retorno = retorno + ($filter('date')(DthInicial, TranslateService('datetime-format')).split(\" \")[1]) + \"hs\";\r\n if (key < (resposta.length - 1)) {\r\n retorno = retorno + \", \";\r\n } else {\r\n retorno = retorno + \").\";\r\n }\r\n }\r\n }\r\n }\r\n\r\n return retorno;\r\n });\r\n }\r\n\r\n function getRessuprimento(IdcPosto, IdcTransferencia) {\r\n return $http.get(\"../server/mobileServer/_abastecimento.ashx\", {\r\n params: {\r\n IdcPosto: IdcPosto,\r\n IdcTransferencia: IdcTransferencia\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n validaTagPlaca: validaTagPlaca,\r\n salvaAbastecimento: salvaAbastecimento,\r\n verificaAbastecimentoExistente: verificaAbastecimentoExistente,\r\n verificaAbastecimentoEncavalado: verificaAbastecimentoEncavalado,\r\n populaBanco: populaBanco,\r\n getAllByIdcRegTurno: getAllByIdcRegTurno,\r\n getRessuprimento: getRessuprimento,\r\n isEmAvaliacao: isEmAvaliacao\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('AspectoVisualModel', AspectoVisualModel);\r\n\r\n AspectoVisualModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function AspectoVisualModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_cadAspectoVisual.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('AssociacaoRecebimentoModel', AssociacaoRecebimentoModel);\r\n\r\n AssociacaoRecebimentoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function AssociacaoRecebimentoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_grupoRecebimento.ashx';\r\n var serverUrl2 = '../server/mobileServer/_recebimentoAutomatico.ashx';\r\n\r\n var data = [{\r\n CodigoGrupoRecebimento: '20210709DIFS0000W',\r\n CodigoDanfe: '0003451423',\r\n Produto: 'S500',\r\n Postos: 'PACD/PPSL',\r\n DataHoraUTCSearch: new Date(),\r\n DataHoraUTCInitSearch: new Date(),\r\n DataHoraUTCEndSearch: new Date(),\r\n NomUsuario: 'BRUNO HENRIQUE FARIAS',\r\n IndicadorSituacao: 'A',\r\n DataHoraUTCOutWayDoorSearch: new Date(),\r\n filtro: null\r\n },\r\n {\r\n CodigoGrupoRecebimento: '20210709DIFS00002',\r\n CodigoDanfe: '0003451424',\r\n Produto: 'S10',\r\n Postos: 'PPPP',\r\n DataHoraUTCSearch: new Date(),\r\n DataHoraUTCInitSearch: new Date(),\r\n DataHoraUTCEndSearch: new Date(),\r\n NomUsuario: 'JOEL HENRIQUE VAZ',\r\n IndicadorSituacao: 'I',\r\n DataHoraUTCOutWayDoorSearch: new Date(),\r\n filtro: null\r\n }\r\n ];\r\n \r\n function getAll() {\r\n\r\n return $http.get(serverUrl, { params: {type: \"generic\" }} )\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAllRecebimentos() {\r\n\r\n return $http.get(serverUrl2, { params: {type: \"generic\" }} )\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n //function getByTimeRange(dthInicial, dthFinal) {\r\n\r\n // return $http.get(serverUrl, { params: { DthInicial: dthInicial, DthFinal: dthFinal} })\r\n // .then(function (response) {\r\n // return response.data;\r\n // });\r\n //}\r\n\r\n function getById(id) {\r\n\r\n return $http.get(serverUrl, { params: { IdentificadorGrupoRecebimentoFisicoFiscal: id } })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getByIdRecebimento(id, get) {\r\n\r\n return $http.get(serverUrl2, { params: { IdentificadorGrupoRecebimentoFisicoFiscal: id, getQtds: get } })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function salvar(associacao) {\r\n var method = associacao.IdentificadorGrupoRecebimentoFisicoFiscal ? 'put' : 'post';\r\n return $http[method](serverUrl, associacao)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function salvarRecebimento(recebimento) {\r\n var method = recebimento.IdentificadorGrupoRecebimentoFisicoFiscal ? 'put' : 'post';\r\n return $http[method](serverUrl2, recebimento)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function VerificaCanada(idcPosto) {\r\n return $http.get(serverUrl2, { params: { type: \"generic\", VerificaCanada: true, IdcPosto: idcPosto } })\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function updateFiscaisAssociados(fiscaisLista) {\r\n var method = 'put';\r\n return $http[method](serverUrl2, fiscaisLista )\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n salvar: salvar,\r\n getAllRecebimentos: getAllRecebimentos,\r\n salvarRecebimento: salvarRecebimento,\r\n getByIdRecebimento: getByIdRecebimento,\r\n updateFiscaisAssociados: updateFiscaisAssociados,\r\n VerificaCanada: VerificaCanada\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('BlocoMedidorModel', BlocoMedidorModel);\r\n\r\n BlocoMedidorModel.$inject = [\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n 'ngDexie',\r\n '$q',\r\n 'Constant',\r\n '$timeout',\r\n 'RequestService',\r\n '$http',\r\n ];\r\n\r\n function BlocoMedidorModel(\r\n $http,\r\n UsuarioService,\r\n ngDexie,\r\n $q,\r\n Constant,\r\n $timeout,\r\n RequestService,\r\n $http2\r\n ) {\r\n\r\n RequestService.url = '../server/ashx/_regAbastecimento.ashx';\r\n\r\n var serverUrl = '../server/mobileServer/_blocoMedidor.ashx';\r\n\r\n //Propriedades privadas\r\n var db = ngDexie.getDb();\r\n\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function getAll() {\r\n\r\n return $http2.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n //});\r\n }).catch(function (error) {\r\n console.error(error);\r\n });\r\n }\r\n\r\n\r\n\r\n function post(dados) {\r\n return $http.post('../server/ashx/_regAbastecimento.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n\r\n function save(cadBlocoMedidor) {\r\n\r\n cadBlocoMedidor.IdcPosto = cadBlocoMedidor.CadPosto.IdcPosto;\r\n cadBlocoMedidor.CadPosto = null;\r\n\r\n if (cadBlocoMedidor.IdcBlocoMedidor) {\r\n return $http2.put(serverUrl, cadBlocoMedidor)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http2.post(serverUrl, cadBlocoMedidor)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function excluir(id) {\r\n return $http2.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n\r\n function getBlocosInterno() {\r\n return db.CAD_BLOCO_MEDIDOR.toArray();\r\n }\r\n\r\n function preencheBancoInterno(blocos) {\r\n db.CAD_BLOCO_MEDIDOR.clear().then(function () {\r\n return db.CAD_BLOCO_MEDIDOR.bulkPut(blocos);\r\n }).then(function () {\r\n //console.info(\"Blocos salvos com sucesso no banco do browser.\", resposta);\r\n }).catch(function (error) {\r\n console.error(\"Ocorreu um erro ao salvar lista de blocos.\", error);\r\n });\r\n }\r\n\r\n //Métodos publicos\r\n function getByIdcPosto(idcPosto, idcRegTurno) {\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'dataBlocoMedidor',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n IdcPosto: idcPosto,\r\n idcRegTurno: idcRegTurno\r\n },\r\n 'funcaoGet': getBlocosInterno,\r\n 'funcaoUpdate': preencheBancoInterno\r\n });\r\n }\r\n\r\n function getByIdcPostoAndId(idcPosto, idcBlocoMedidor) {\r\n return getByIdcPosto(idcPosto)\r\n .then(function (blocos) {\r\n return blocos.filter(function (bloco) {\r\n return bloco.StuBlocoMedidor === 'S' ||\r\n bloco.IdcBlocoMedidor === idcBlocoMedidor;\r\n });\r\n });\r\n }\r\n\r\n function populaBanco(idcPosto, idcRegTurno) {\r\n return getByIdcPosto(idcPosto, idcRegTurno);\r\n }\r\n\r\n\r\n return {\r\n getByIdcPosto: getByIdcPosto,\r\n getByIdcPostoAndId: getByIdcPostoAndId,\r\n populaBanco: populaBanco,\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CadEquipamentoModel', CadEquipamentoModel);\r\n\r\n CadEquipamentoModel.$inject = [\r\n '$httpLegacy',\r\n '$http',\r\n 'ngDexie',\r\n '$timeout',\r\n '$q',\r\n '$filter'\r\n ];\r\n\r\n function CadEquipamentoModel(\r\n $httpLegacy,\r\n $http,\r\n ngDexie,\r\n $timeout,\r\n $q,\r\n $filter\r\n ) {\r\n\r\n //Propriedades privadas \r\n var db = ngDexie.getDb();\r\n var serverUrl = '../server/mobileServer/_equipamento.ashx';\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n\r\n //Métodos publicos\r\n function getAll(IdcPosto, IdcRegTurno) {\r\n var dados = {\r\n 'section': 'equipamento',\r\n 'function': 'GetEquipamentoByPostoTurno',\r\n 'parameter': {\r\n 'pIdcPosto': IdcPosto,\r\n 'pIdcRegTurno': IdcRegTurno\r\n }\r\n };\r\n\r\n return $httpLegacy.post('../server/ashx/_default.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getAllNew(IdcRegTurno) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n type: \"grid\",\r\n IdcRegTurno: IdcRegTurno,\r\n Function: \"GetForRefuelling\"\r\n }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getEquipamentos(placa) {\r\n return db.CAD_EQUIPAMENTO\r\n //.where('CodTagPlacaEqp')\r\n //.startsWith($filter('uppercase')(placa))\r\n .filter(function (eqp) { return new RegExp($filter('uppercase')(placa)).test(eqp.CodTagPlacaEqp); })\r\n .toArray();\r\n }\r\n\r\n function populaBanco(IdcPosto, IdcRegTurno) {\r\n var equipamentos;\r\n getAllNew(IdcRegTurno)\r\n .then(function (resposta) {\r\n equipamentos = resposta;\r\n return db.CAD_EQUIPAMENTO.clear();\r\n })\r\n .then(function () {\r\n return db.CAD_EQUIPAMENTO.bulkAdd(equipamentos);\r\n })\r\n .then(function (resposta) {\r\n //console.info(\"Equipamentos salvos com sucesso no banco do browser.\", resposta);\r\n })\r\n .catch(function (error) {\r\n console.error(\"Ocorreu um erro ao salvar lista de equipamentos.\", error);\r\n });\r\n }\r\n\r\n function getEquipamento(tagPlaca) {\r\n //Como as promises do Dexie não são reconhecidas pelo AngularJS é preciso indicar o apply.\r\n //Usando o $scope.$apply() aqui não funciona pq quando o Model retorna a resposta do backend\r\n //o serviço $http já fica encapsula o código no $apply, por isso é utilizado o $timeout aqui\r\n //para o angular executar o ciclo de $digest\r\n //https://github.com/FlussoBV/NgDexie/wiki/ngDexie.getDb\r\n return $timeout(function () {\r\n return db.CAD_EQUIPAMENTO.get({ CodTagPlacaEqp: tagPlaca.toUpperCase() });\r\n });\r\n }\r\n\r\n function updateEquipamento(obj) {\r\n if (obj) {\r\n return db.CAD_EQUIPAMENTO.put(obj);\r\n }\r\n }\r\n\r\n\r\n return {\r\n getAll: getAll,\r\n getAllNew: getAllNew,\r\n populaBanco: populaBanco,\r\n getEquipamento: getEquipamento,\r\n updateEquipamento: updateEquipamento,\r\n getEquipamentos: getEquipamentos\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CadTurnoModel', CadTurnoModel);\r\n\r\n CadTurnoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function CadTurnoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_cadTurno.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdcTurno) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcTurno: IdcTurno\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadTurno) {\r\n\r\n if (cadTurno.IdcTurno) {\r\n return $http.put(serverUrl, cadTurno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadTurno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CaminhaoTanqueModel', CaminhaoTanqueModel);\r\n\r\n CaminhaoTanqueModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function CaminhaoTanqueModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_caminhaoTanque.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdCaminhaoTanque) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdCaminhaoTanque: IdCaminhaoTanque\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadCaminhaoTanque) {\r\n\r\n cadCaminhaoTanque.CadGerencia = null;\r\n\r\n if (cadCaminhaoTanque.IdcCaminhaoTanque) {\r\n return $http.put(serverUrl, cadCaminhaoTanque)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadCaminhaoTanque)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function(){\r\n 'use strict';\r\n\r\n angular.module(\"posto-facil\").factory(\"CargaMassaModel\", CargaMassaModel);\r\n\r\n CargaMassaModel.$inject = [\r\n \"$http\"\r\n ];\r\n\r\n function CargaMassaModel(\r\n $http\r\n ){\r\n var serverUrl = '../server/mobileServer/_cargaMassa.ashx';\r\n\r\n function getByPeriod(dthInicial, dthFinal, idcDiretoria, movimentacao, idcUsuario){\r\n return $http.get(serverUrl, {\r\n params: {\r\n dthInicial: dthInicial,\r\n dthFinal: dthFinal,\r\n idcDiretoria: idcDiretoria,\r\n getType: \"carga\",\r\n type: \"generic\",\r\n movimentacao: movimentacao,\r\n idcUsuario: idcUsuario\r\n }\r\n }).then(function(response){\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAbastecimentos(idcCargaMassa){\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"abastecimentos\",\r\n type: \"generic\",\r\n idcCargaMassa: idcCargaMassa\r\n }\r\n }).then(function(response){\r\n return response.data;\r\n });\r\n }\r\n\r\n function getLocais(idcUsuario) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"postos\",\r\n type: \"generic\",\r\n idcUsuario: idcUsuario\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getCnpjs(idcComplexo) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"cnpj\",\r\n type: \"generic\",\r\n idcComplexo: idcComplexo\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getListNewAbast(dthInicial, dthFinal, idcDiretoria, idcComplexo, idcProduto, idcClasse, idcTipo, cnpj, idcPosto, idcUnidade, movimentacao) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"new\",\r\n type: \"generic\",\r\n dthInicial: dthInicial,\r\n dthFinal: dthFinal,\r\n idcDiretoria: idcDiretoria,\r\n idcComplexo: idcComplexo,\r\n idcProduto: idcProduto,\r\n idcClasse: idcClasse,\r\n idcTipo: idcTipo,\r\n cnpj: cnpj,\r\n idcPosto: idcPosto,\r\n idcUnidade: idcUnidade,\r\n movimentacao: movimentacao\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(regCargaMassa) {\r\n return $http.post(serverUrl, regCargaMassa)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function send(regCargaMassa) {\r\n return $http.put(serverUrl, regCargaMassa)\r\n .then(function (response) {\r\n return response.data;\r\n })\r\n .catch(function (err) {\r\n return Promise.reject(err.data)\r\n });\r\n }\r\n\r\n function processaManualmente(idcCarga, idcUsuario) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"manual\",\r\n type: \"generic\",\r\n idcCargaMassa: idcCarga,\r\n idcUsuario: idcUsuario\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function cancela(idcCarga, idcUsuario) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"cancelSheduled\",\r\n type: \"generic\",\r\n idcCargaMassa: idcCarga,\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function deleteCarga(idcCargaMassa) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"delete\",\r\n type: \"generic\",\r\n idcCargaMassa: idcCargaMassa,\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getProduto() {\r\n return $http.get(serverUrl, {\r\n params: {\r\n getType: \"produto\",\r\n type: \"generic\",\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getByPeriod: getByPeriod,\r\n getAbastecimentos: getAbastecimentos,\r\n getCnpjs: getCnpjs,\r\n getProduto: getProduto,\r\n getListNewAbast: getListNewAbast,\r\n getLocais: getLocais,\r\n save: save,\r\n send: send,\r\n processaManualmente: processaManualmente,\r\n deleteCarga: deleteCarga,\r\n cancela: cancela\r\n }\r\n }\r\n})()","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CavaloMecanicoModel', CavaloMecanicoModel);\r\n\r\n CavaloMecanicoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function CavaloMecanicoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_cavaloMecanico.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdCavaloMecanico) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdCavaloMecanico: IdCavaloMecanico\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CentroCustoModel', CentroCustoModel);\r\n\r\n CentroCustoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function CentroCustoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_centroCusto.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: { 'All': true }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadCentroCusto) {\r\n\r\n cadCentroCusto.CadGerencia = null;\r\n\r\n if (cadCentroCusto.IdcCentroCusto) {\r\n return $http.put(serverUrl, cadCentroCusto)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadCentroCusto)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n \r\n };\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CentroLucroModel', CentroLucroModel);\r\n\r\n CentroLucroModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function CentroLucroModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_centroLucro.ashx';\r\n\r\n function getByIdCentroCusto(IdcCentroCusto) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcCentroCusto: IdcCentroCusto\r\n }\r\n }).then(function (response) {\r\n\r\n var retorno = response.data[0];\r\n\r\n if (retorno != null) {\r\n retorno.CentroLucroConcat = retorno.CodCentroLucro + \" - \" + retorno.SglCentroLucro;\r\n }\r\n else {\r\n retorno = null;\r\n }\r\n \r\n return retorno;\r\n });\r\n }\r\n\r\n function getByIdElementoPep(IdcElementoPep) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcElementoPep: IdcElementoPep\r\n }\r\n }).then(function (response) {\r\n\r\n var retorno = response.data[0];\r\n\r\n if (retorno != null) {\r\n retorno.CentroLucroConcat = retorno.CodCentroLucro + \" - \" + retorno.SglCentroLucro;\r\n }\r\n else {\r\n retorno = null;\r\n }\r\n\r\n return retorno;\r\n });\r\n }\r\n\r\n function getByIdOrdemEstatistica(IdcOrdemEstatistica) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcOrdemEstatistica: IdcOrdemEstatistica\r\n }\r\n }).then(function (response) {\r\n\r\n var retorno = response.data[0];\r\n\r\n if (retorno != null) {\r\n retorno.CentroLucroConcat = retorno.CodCentroLucro + \" - \" + retorno.SglCentroLucro;\r\n }\r\n else {\r\n retorno = null;\r\n }\r\n\r\n return retorno;\r\n });\r\n }\r\n\r\n return {\r\n getByIdCentroCusto: getByIdCentroCusto,\r\n getByIdOrdemEstatistica: getByIdOrdemEstatistica,\r\n getByIdElementoPep: getByIdElementoPep\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ComplexoModel', ComplexoModel);\r\n\r\n ComplexoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n\r\n function ComplexoModel($http) {\r\n var serverUrl = '../server/mobileServer/_cadComplexo.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: { 'All': true }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getBySgl(SglDiretoria) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n SglDiretoria: SglDiretoria\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadComplexo) {\r\n if (cadComplexo.IdcComplexo) {\r\n return $http.put(serverUrl, cadComplexo)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadComplexo)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir,\r\n getBySgl: getBySgl\r\n }\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ContingenciaModel', ContingenciaModel);\r\n\r\n ContingenciaModel.$inject = [\r\n '$httpLegacy',\r\n '$http',\r\n 'UsuarioService',\r\n 'CadEquipamentoModel',\r\n '$q',\r\n '$timeout',\r\n 'Constant',\r\n 'ngDexie',\r\n 'CtrHorHodModel',\r\n 'CtrEncerranteModel',\r\n 'RequestService',\r\n 'TranslateService',\r\n '$filter'\r\n ];\r\n\r\n function ContingenciaModel(\r\n $httpLegacy,\r\n $http,\r\n UsuarioService,\r\n CadEquipamentoModel,\r\n $q,\r\n $timeout,\r\n Constant,\r\n ngDexie,\r\n CtrHorHodModel,\r\n CtrEncerranteModel,\r\n RequestService,\r\n TranslateService,\r\n $filter\r\n ) {\r\n\r\n RequestService.url = '../server/ashx/_regAbastecimento.ashx';\r\n var contingenciaURL = '../server/mobileServer/_contingencia.ashx'\r\n var historicoURL = '../server/mobileServer/_hstAbastecimento.ashx';\r\n\r\n //Propriedades privadas\r\n var db = ngDexie.getDb();\r\n var emProgresso = false;\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function post(dados) {\r\n return $httpLegacy.post('../server/ashx/_regAbastecimento.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function isEmAvaliacao(IdcAbastecimento) {\r\n\r\n if (!IdcAbastecimento) return $q.resolve(false);\r\n\r\n return $http.get(historicoURL, {\r\n params: {\r\n IdcAbastecimento: IdcAbastecimento,\r\n OnlyPending: true\r\n }\r\n }).then(function (resposta) {\r\n return !!resposta.data.length;\r\n });\r\n }\r\n\r\n function preencheBancoInterno(abastecimentos) {\r\n var promises = [];\r\n\r\n abastecimentos.forEach(function (item) {\r\n promises.push(db.REG_ABASTECIMENTO.put(item)\r\n .then(function (idTela) {\r\n item.idTela = idTela;\r\n return item;\r\n }));\r\n });\r\n\r\n return $q.all(promises);\r\n }\r\n\r\n function atualizaHorimetro(resposta) {\r\n if (!resposta) return;\r\n var ctrHorHod = resposta ? {\r\n \"IdcEquipamento\": resposta.IdcEquipamento,\r\n \"DthCtrHorHod\": resposta.DthInicial,\r\n \"ValHorHodAtual\": resposta.ValHorHod\r\n } : null;\r\n\r\n CtrHorHodModel.updateHorimetro(ctrHorHod);\r\n }\r\n\r\n function atualizaEncerrante(resposta) {\r\n if (!resposta) return;\r\n\r\n resposta.listAbastecimentoTanque.forEach(function (tanque) {\r\n var encerrante = {\r\n DthCtrEncerrante: tanque.DthAbastecimentoTanque,\r\n IdcBlocoMedidor: tanque.IdcBlocoMedidor,\r\n ValEncerranteAtual: tanque.ValEncerranteAbastecimento\r\n };\r\n\r\n CtrEncerranteModel.updateEncerrante(encerrante);\r\n });\r\n }\r\n\r\n function getByIdcRegTurno(idcRegTurno) {\r\n if (!idcRegTurno) return $q.resolve([]);\r\n\r\n var dados = {\r\n 'section': 'abastecimento',\r\n 'function': 'dataGrid',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n idcRegTurno: idcRegTurno\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function validarAbastecimentoEncavaladoOffLine(abastecimento) {\r\n return new $q(function (resolve, reject) {\r\n\r\n var dados_encerrante = null;\r\n var dados_abastecimento = null;\r\n\r\n db.CTR_ENCERRANTE.filter(function (item) {\r\n // Tbl Encerrante: Filtro de operacao, Filtrar somente os encerrantes que possuam IdcOperacao e Bloco Medidor Descartando as operações de abastecimento, pois a validação do abastecimento será feita pela própria tabela de abastecimento.\r\n var filter_encerrante_operacao = item.IdcOperacao && item.IdcOperacao > 0 && item.TblOperacao != 'REG_ABASTECIMENTO_TANQUE' && item.IdcBlocoMedidor > 0;\r\n\r\n // Tbl Encerrante: Filtrar somente os encerrantes que estão relacionados no abastecimento atual.\r\n var filter_encerrante_blocos_medidores = abastecimento.listAbastecimentoTanque.findIndex(function (find) { return find.IdcBlocoMedidor === item.IdcBlocoMedidor }) >= 0;\r\n\r\n // Tbl Encerrante: Filtro de período, levando em consideração se o movimento possui data inicial e final.\r\n var filter_encerrante_periodo = (\r\n // Filtro de Data - Filtrar Encerrantes com data encavalada onde possua data de início e fim (Abastecimento não é considerado aqui pois já é validado pela tabela de abastecimentos na condicional acima)\r\n (['V5ETRANT'].includes(item.TblOperacao) &&\r\n ((abastecimento.DthInicial >= item.DthInicialOperacao && abastecimento.DthInicial <= item.DthFinalOperacao) || (abastecimento.DthFinal >= item.DthInicialOperacao && abastecimento.DthFinal <= item.DthFinalOperacao) ||\r\n (item.DthInicialOperacao >= abastecimento.DthInicial && item.DthInicialOperacao <= abastecimento.DthFinal) || (item.DthFinalOperacao >= abastecimento.DthInicial && item.DthFinalOperacao <= abastecimento.DthFinal))\r\n ) ||\r\n // Filtro de Data - Filtrar Encerrantes com data encavalada onde não possua data de início.\r\n (['V5GDETRT', 'REG_BLOCO_MEDIDOR_AFERICAO'].includes(item.TblOperacao) &&\r\n (item.DthFinalOperacao >= abastecimento.DthInicial && item.DthFinalOperacao <= abastecimento.DthFinal)\r\n )\r\n );\r\n\r\n return (filter_encerrante_operacao && filter_encerrante_blocos_medidores && filter_encerrante_periodo);\r\n }).toArray().then(function (encerrante_data) {\r\n dados_encerrante = encerrante_data;\r\n return db.REG_ABASTECIMENTO.filter(function (item) {\r\n // Tbl Abastecimento: Filtro de operação de abastecimento atual desconsiderando o ID da operação atual para checar colisões entre os abastecimentos\r\n var filter_abastecimento_operacao = abastecimento.idTela && abastecimento.idTela > 0 ? abastecimento.idTela != item.idTela : true;\r\n\r\n // Tbl Abastecimento: Filtro de Bloco Medidor, filtrar somente os abastecimentos que utilizam o mesmo bloco medidor do abastecimento atual e que não esteja estornado.\r\n var filter_abastecimento_bloco_medidor = item.listAbastecimentoTanque.filter(function (elem) {\r\n return elem.RegEstornado !== true && abastecimento.listAbastecimentoTanque.some(function (ele) {\r\n return elem.IdcBlocoMedidor > 0 && ele.IdcBlocoMedidor > 0 && elem.IdcBlocoMedidor === ele.IdcBlocoMedidor;\r\n });\r\n });\r\n\r\n // Tbl Abastecimento: Filtro de período, filtrar abastecimentos com data encavalada\r\n var filter_abastecimento_periodo = (\r\n (abastecimento.DthInicial >= item.DthInicial && abastecimento.DthInicial <= item.DthFinal) || (abastecimento.DthFinal >= item.DthInicial && abastecimento.DthFinal <= item.DthFinal) ||\r\n (item.DthInicial >= abastecimento.DthInicial && item.DthInicial <= abastecimento.DthFinal) || (item.DthFinal >= abastecimento.DthInicial && item.DthFinal <= abastecimento.DthFinal)\r\n );\r\n\r\n return filter_abastecimento_operacao && filter_abastecimento_bloco_medidor.length > 0 && filter_abastecimento_periodo;\r\n }).toArray();\r\n }).then(function (abastecimento_data) {\r\n dados_abastecimento = abastecimento_data;\r\n if (dados_abastecimento.length > 0)\r\n throw new Error(\"Existe abastecimento encavalado\");\r\n if (dados_encerrante.length > 0)\r\n throw new Error(\"Existe encerrante encavalado\");\r\n\r\n resolve();\r\n }).catch(function (error) {\r\n // Arrays destinados a guardar as siglas dos blocos medidores com dados encavalados, neste primeiro momento existirá repetição que será tratada mais abaixo.\r\n var blocos_abastecimento = [];\r\n var blocos_encerrantes = [];\r\n dados_abastecimento.forEach(function (elem) {\r\n elem.listAbastecimentoTanque.map(function (a) {\r\n if (a.IdcBlocoMedidor && a.IdcBlocoMedidor > 0 && a.SglBlocoMedidor && a.RegEstornado !== true)\r\n blocos_abastecimento.push(a.SglBlocoMedidor)\r\n });\r\n });\r\n\r\n dados_encerrante.forEach(function (elem) {\r\n if (elem.IdcBlocoMedidor && elem.IdcBlocoMedidor > 0 && elem.SglBlocoMedidor)\r\n blocos_encerrantes.push(elem.SglBlocoMedidor);\r\n });\r\n\r\n // Gerar novo array agora removendo as entradas duplicadas - operação equivalente a um Distinct.\r\n var blocos_validados = Array.from(new Set(blocos_abastecimento.concat(blocos_encerrantes)));\r\n // Ordernar os blocos levando em consideração caracteres NON-ASCII ex: é, í, ó, etc.\r\n blocos_validados = blocos_validados.sort(function (a, b) { return a.localeCompare(b) });\r\n\r\n reject(TranslateService('bloco-medidor-tem-operacoes-periodo').replace('{0}', blocos_validados.join(', ')));\r\n });\r\n });\r\n };\r\n\r\n //Métodos publicos\r\n\r\n function getAllByIdcRegTurno(idcRegTurno) {\r\n\r\n return $http.get(contingenciaURL, {\r\n params: {\r\n user: UsuarioService.indice,\r\n idcRegTurno: idcRegTurno,\r\n type: \"grid\"\r\n }\r\n })\r\n }\r\n\r\n function getAllByFilters(filters) {\r\n return $http.get(contingenciaURL, {\r\n params: {\r\n user: UsuarioService.indice,\r\n IdcDiretoria: filters.IdcDiretoria,\r\n IdComplexo: filters.IdcComplexo,\r\n IdcUnidade: filters.IdcUnidade,\r\n IdcPosto: filters.IdcPosto,\r\n dataInicial: filters.dataInicial,\r\n dataFinal: filters.dataFinal,\r\n type: \"grid\"\r\n }\r\n })\r\n }\r\n\r\n\r\n function saveContigencia(filters) {\r\n return $http.get(contingenciaURL, {\r\n params: {\r\n IdcPosto: filters.IdcPosto,\r\n IdcRegTurno: filters.IdcRegTurno,\r\n IdcAbastecimento: filters.IdcAbastecimento,\r\n Tag: filters.Tag,\r\n }\r\n })\r\n }\r\n\r\n function salvaAbastecimentosNaoSincronizados(abastecimentos) {\r\n var promises = [];\r\n if (abastecimentos.length > 0) {\r\n promises.push(salvaListaAbastecimentosNaoSincronizados(abastecimentos));\r\n }\r\n return $q.all(promises);\r\n }\r\n\r\n function populaBanco(argumento) {\r\n\r\n if (emProgresso) {\r\n return $timeout(populaBanco, 100, true, argumento);\r\n }\r\n\r\n emProgresso = true;\r\n var IdcRegTurno = null;\r\n var abastecimentos = null;\r\n\r\n if (angular.isArray(argumento)) {\r\n abastecimentos = argumento;\r\n } else {\r\n IdcRegTurno = argumento;\r\n }\r\n\r\n //Recupera todos os abastecimentos do banco interno\r\n return db.REG_ABASTECIMENTO.toArray()\r\n .then(function (abastecimentos) {\r\n\r\n //Salva todos os abastecimentos não sincronizados \r\n return salvaAbastecimentosNaoSincronizados(abastecimentos);\r\n })\r\n .then(function () {\r\n\r\n //Recupera toda a lista de ado servidor para o turno\r\n return (abastecimentos || getByIdcRegTurno(IdcRegTurno));\r\n })\r\n .then(function (value) {\r\n\r\n //Guarda a lista de abastecimentos e limpa o banco antes de continuar\r\n abastecimentos = value;\r\n return db.REG_ABASTECIMENTO.clear();\r\n })\r\n .then(function () {\r\n\r\n //Popula o banco interno com os abastecimentos trazidos do servidor\r\n return preencheBancoInterno(abastecimentos);\r\n })\r\n .then(function (resposta) {\r\n emProgresso = false;\r\n return resposta;\r\n });\r\n }\r\n\r\n function validaTagPlaca(tagPlaca, IdcRegTurno, IdcPosto, idcAbastecimento) {\r\n\r\n\r\n return $http.get(contingenciaURL, {\r\n params: {\r\n user: UsuarioService.indice,\r\n IdcRegTurno: IdcRegTurno,\r\n idcAbastecimento: idcAbastecimento,\r\n tagPlaca: tagPlaca,\r\n posto: IdcPosto,\r\n operation: 'ValidaPlaca',\r\n type: 'generic'\r\n }\r\n })\r\n\r\n }\r\n\r\n function salvaAbastecimento(dataAbastecimento, turnoFechado) {\r\n\r\n dataAbastecimento.IdcUsuario = UsuarioService.indice\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'salvar',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n dataAbastecimento: JSON.stringify(dataAbastecimento),\r\n isContingencia: true\r\n },\r\n 'funcaoGet': function () {\r\n return db.REG_ABASTECIMENTO.put(dataAbastecimento)\r\n .then(function (resposta) {\r\n atualizaHorimetro(dataAbastecimento);\r\n atualizaEncerrante(dataAbastecimento);\r\n dataAbastecimento.idTela = resposta;\r\n dataAbastecimento.StatusSalvamento = true;\r\n return dataAbastecimento;\r\n });\r\n },\r\n 'funcaoUpdate': function (resposta) {\r\n atualizaHorimetro(resposta);\r\n atualizaEncerrante(resposta);\r\n if (dataAbastecimento.idTela) {\r\n resposta.idTela = dataAbastecimento.idTela;\r\n }\r\n return db.REG_ABASTECIMENTO.put(resposta)\r\n .then(function (idTela) {\r\n resposta.idTela = idTela;\r\n return resposta;\r\n });\r\n },\r\n 'retornaUpdate': true\r\n });\r\n }\r\n\r\n function salvaListaAbastecimentosNaoSincronizados(listaAbastecimento, turnoFechado) {\r\n\r\n listaAbastecimento.forEach(function (item) {\r\n item.IdcUsuario = UsuarioService.indice;\r\n });\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'salvarListaAbastecimento',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n dataAbastecimento: JSON.stringify(listaAbastecimento),\r\n turnoFechado: !!turnoFechado\r\n },\r\n 'funcaoGet': function () {\r\n return db.REG_ABASTECIMENTO.toArray();\r\n },\r\n 'funcaoUpdate': function (resposta) {\r\n resposta.forEach(function (item) {\r\n atualizaHorimetro(item);\r\n atualizaEncerrante(item);\r\n if (listaAbastecimento[0].idTela) {\r\n item.idTela = listaAbastecimento[0].idTela;\r\n }\r\n db.REG_ABASTECIMENTO.put(item)\r\n .then(function (idTela) {\r\n item.idTela = idTela;\r\n return item;\r\n });\r\n });\r\n },\r\n 'retornaUpdate': true\r\n });\r\n }\r\n\r\n function verificaAbastecimentoEncavalado(abastecimento) {\r\n return new $q(function (resolve, reject) {\r\n if (!abastecimento) {\r\n reject(TranslateService('saving-failed'));\r\n } else {\r\n if (navigator.onLine) {\r\n var dados = {\r\n 'section': 'registro',\r\n 'function': 'validarDadosEncavalados',\r\n 'parameter': {\r\n dataAbastecimento: JSON.stringify(abastecimento)\r\n }\r\n };\r\n post(dados).then(function (success) {\r\n resolve(success);\r\n }).catch(function (error) {\r\n reject(error);\r\n });\r\n }\r\n else {\r\n validarAbastecimentoEncavaladoOffLine(abastecimento).then(function (success) {\r\n resolve(success);\r\n }).catch(function (error) {\r\n reject(error);\r\n });\r\n }\r\n }\r\n });\r\n }\r\n\r\n function verificaAbastecimentoExistente(abastecimento) {\r\n if (!abastecimento) return $q.resolve([]);\r\n\r\n return db.REG_ABASTECIMENTO.toArray()\r\n .then(function (resposta) {\r\n for (var key in resposta) {\r\n var equipamentoR = resposta[key].IdcEquipamento;\r\n var data = resposta[key].DthInicial;\r\n if (abastecimento.IdcAbastecimento === 0) {\r\n if (equipamentoR === abastecimento.IdcEquipamento && data.getTime() === abastecimento.DthInicial.getTime()) {\r\n return \"repeted\";\r\n }\r\n }\r\n }\r\n var retorno = \"\";\r\n for (var key in resposta) {\r\n var turno = resposta[key].IdcRegTurno;\r\n var DthInicial = resposta[key].DthInicial;\r\n var equipamentoO = resposta[key].IdcEquipamento;\r\n if (abastecimento.IdcAbastecimento === 0) {\r\n if (equipamentoO === abastecimento.IdcEquipamento && turno === abastecimento.IdcRegTurno) {\r\n if (equipamentoO === abastecimento.IdcEquipamento && retorno == \"\") {\r\n retorno = $filter('date')(DthInicial, TranslateService('datetime-format')\r\n );\r\n retorno = retorno.split(\" \")[0] + \" (\";\r\n }\r\n retorno = retorno + ($filter('date')(DthInicial, TranslateService('datetime-format')).split(\" \")[1]) + \"hs\";\r\n if (key < (resposta.length - 1)) {\r\n retorno = retorno + \", \";\r\n } else {\r\n retorno = retorno + \").\";\r\n }\r\n }\r\n }\r\n }\r\n\r\n return retorno;\r\n });\r\n }\r\n\r\n function getRessuprimento(IdcPosto, IdcTransferencia) {\r\n return $http.get(\"../server/mobileServer/_abastecimento.ashx\", {\r\n params: {\r\n IdcPosto: IdcPosto,\r\n IdcTransferencia: IdcTransferencia\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n validaTagPlaca: validaTagPlaca,\r\n salvaAbastecimento: salvaAbastecimento,\r\n verificaAbastecimentoExistente: verificaAbastecimentoExistente,\r\n verificaAbastecimentoEncavalado: verificaAbastecimentoEncavalado,\r\n populaBanco: populaBanco,\r\n getAllByIdcRegTurno: getAllByIdcRegTurno,\r\n getAllByFilters: getAllByFilters,\r\n getRessuprimento: getRessuprimento,\r\n isEmAvaliacao: isEmAvaliacao,\r\n saveContigencia: saveContigencia\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ContratoModel', ContratoModel);\r\n\r\n ContratoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function ContratoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_cadContrato.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdcContrato) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcContrato: IdcContrato\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getByIdEmpresa(IdcEmpresa) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcEmpresa: IdcEmpresa\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadTurno) {\r\n\r\n if (cadTurno.IdcContrato) {\r\n return $http.put(serverUrl, cadTurno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadTurno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir,\r\n getByIdEmpresa: getByIdEmpresa\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CtrEncerranteModel', CtrEncerranteModel);\r\n\r\n CtrEncerranteModel.$inject = [\r\n '$httpLegacy',\r\n '$http',\r\n '$q',\r\n 'ngDexie',\r\n '$timeout',\r\n 'Constant',\r\n 'RequestService',\r\n '$transitions'\r\n ];\r\n\r\n function CtrEncerranteModel(\r\n $httpLegacy,\r\n $http,\r\n $q,\r\n ngDexie,\r\n $timeout,\r\n Constant,\r\n RequestService,\r\n $transitions\r\n ) {\r\n\r\n RequestService.url = '../server/ashx/_regAbastecimento.ashx';\r\n\r\n //Propriedades privadas \r\n var db = ngDexie.getDb();\r\n var lastBloco = null;\r\n var lastDate = null;\r\n var lastCtrEncerrante = null;\r\n var momentoUltimoRequest = null;\r\n var countersInMemory = {};\r\n var serverUrl = '../server/mobileServer/_ctrEncerrante.ashx';\r\n\r\n $transitions.onBefore({}, function () {\r\n forgetCounters();\r\n });\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function post(dados) {\r\n return $httpLegacy.post('../server/ashx/_regAbastecimento.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getLastEncerranteInterno(idcBloco, dateTime) {\r\n return db.CTR_ENCERRANTE\r\n .orderBy('DthCtrEncerrante')\r\n .filter(function (item) {\r\n return item.IdcBlocoMedidor === idcBloco && item.DthCtrEncerrante < dateTime;\r\n })\r\n .last();\r\n }\r\n\r\n function calculaVolumeInterno(ctrEncerranteAnterior, valorEncerrante, valVolume, numDigitos) {\r\n\r\n var reset = false;\r\n var maximoBloco = Math.pow(10, numDigitos);\r\n var encerranteCalculado = valorEncerrante;\r\n var volumeCalculado = valVolume;\r\n if ((encerranteCalculado && encerranteCalculado < ctrEncerranteAnterior.ValEncerranteAtual) ||\r\n (!encerranteCalculado) && (volumeCalculado + ctrEncerranteAnterior.ValEncerranteAtual) >= maximoBloco) {\r\n reset = true;\r\n }\r\n\r\n if (reset) {\r\n if (encerranteCalculado) {\r\n encerranteCalculado = maximoBloco + encerranteCalculado;\r\n } else {\r\n volumeCalculado = volumeCalculado - maximoBloco;\r\n }\r\n }\r\n\r\n if (encerranteCalculado) {\r\n return {\r\n volume: encerranteCalculado - ctrEncerranteAnterior.ValEncerranteAtual,\r\n encerrante: valorEncerrante,\r\n reset: reset\r\n };\r\n } else {\r\n return {\r\n volume: valVolume,\r\n encerrante: volumeCalculado + ctrEncerranteAnterior.ValEncerranteAtual,\r\n reset: reset\r\n };\r\n }\r\n }\r\n\r\n function getLastEncerranteServidor(idcBlocoMedidor, dateTime) {\r\n if (!idcBlocoMedidor || !dateTime) {\r\n return $q.reject('Parametros nulos.');\r\n }\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'getLastEncerrante',\r\n 'parameter': {\r\n idcBloco: idcBlocoMedidor,\r\n dateTime: dateTime\r\n },\r\n 'funcaoGet': function () {\r\n return getLastEncerranteInterno(idcBlocoMedidor, dateTime);\r\n },\r\n 'funcaoUpdate': updateEncerrante\r\n });\r\n }\r\n\r\n function getEncerrantesTurno(IdcRegTurno) {\r\n if (!IdcRegTurno) {\r\n return $q.reject('Não foi passado o turno!');\r\n }\r\n\r\n var dados = {\r\n 'section': 'registro',\r\n 'function': 'getEncerrantesByIdcRegTurno',\r\n 'parameter': {\r\n 'pIdcRegTurno': IdcRegTurno\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function mergeWithMemory(idcBlocoMedidor, dateTime, encerranteSalvo) {\r\n var encerrantes = [];\r\n if (encerranteSalvo) {\r\n encerrantes.push(encerranteSalvo)\r\n };\r\n\r\n for (var key in countersInMemory) {\r\n var encerranteEmMemoria = countersInMemory[key];\r\n if (\r\n encerranteEmMemoria.IdcBlocoMedidor == idcBlocoMedidor &&\r\n encerranteEmMemoria.DthCtrEncerrante < dateTime\r\n ) {\r\n encerrantes.push(encerranteEmMemoria);\r\n }\r\n }\r\n\r\n if (!encerrantes.length) return {};\r\n\r\n return encerrantes.sort(function (a, b) {\r\n return a.DthCtrEncerrante < b.DthCtrEncerrante ? 1 : -1;\r\n })[0];\r\n }\r\n\r\n function rememberCounter(idcBlocoMedidor, valorEncerrante, dateTime, surrogateId) {\r\n countersInMemory[surrogateId] = {\r\n \"IdcCtrEncerrante\": surrogateId,\r\n \"IdcBlocoMedidor\": idcBlocoMedidor,\r\n \"DthCtrEncerrante\": dateTime,\r\n \"ValEncerranteAtual\": valorEncerrante,\r\n \"IdcTblOperacao\": 0,\r\n \"TblOperacao\": \"\",\r\n \"ChkResetAutomatico\": false,\r\n \"DthCriacaoReg\": null,\r\n \"RegPorEncerrante\": \"S\",\r\n \"key\": surrogateId\r\n };\r\n }\r\n\r\n //Métodos publicos\r\n function forgetCounters() {\r\n countersInMemory = {};\r\n }\r\n\r\n function getFirstAndLast(dthInicial, dthFinal, idcBloco) {\r\n return getEncerrantesPeriodo(\r\n dthInicial,\r\n dthFinal,\r\n idcBloco\r\n ).then(function (encerrantes) {\r\n if (!encerrantes.length) return {};\r\n\r\n encerrantes = encerrantes\r\n .filter(function (encerrante) {\r\n return encerrante.TblOperacao.indexOf(\"REG_TURNO_BLOCO_MEDIDOR\") === -1;\r\n })\r\n .sort(function (a, b) {\r\n return a.DthCtrEncerrante > b.DthCtrEncerrante ? 1 : -1;\r\n });\r\n\r\n return {\r\n first: encerrantes[0] || {},\r\n last: encerrantes[encerrantes.length - 1] || {}\r\n };\r\n\r\n });\r\n }\r\n\r\n function getEncerrantesPeriodo(dthInicial, dthFinal, idcBloco) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n DthInicial: dthInicial,\r\n DthFinal: dthFinal,\r\n IdcBlocoMedidor: idcBloco\r\n }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function calculaVolume(idcBlocoMedidor, valorEncerrante, dateTime, valVolume, numDigitos, surrogateId, numCasasDecimais) {\r\n if (!idcBlocoMedidor || !dateTime || !numDigitos) {\r\n return $q.reject('Os parametros idcBlocoMedidor, dateTime e numDigitos são obrigatórios.');\r\n }\r\n\r\n numCasasDecimais = parseInt(numCasasDecimais || 2);\r\n\r\n // Para calcular o volume com encerrante anterior que ainda não foi salvo\r\n // a idéia é ter uma chave fictícia que substituirá o idcCtrEncerrante\r\n // gravar isso em uma estrutura map ou array e mesclar os dados dessa \r\n // estrutura com a resposta do último encerrante salvo para recuperar\r\n // o último encerrante. Ao finalizar o lançamento ou cancelar o registro\r\n // essa estrutura deve ser resetada.\r\n\r\n var encerrante = valorEncerrante || 0;\r\n var volume = valVolume || 0;\r\n\r\n //Se os parametros não mudaram e o último request foi feito a menos de um minuto atrás\r\n //não vai no servidor de novo para buscar o último ctrencerrante\r\n return (new $q(function (resolve) {\r\n\r\n if (lastBloco == idcBlocoMedidor &&\r\n lastDate == dateTime &&\r\n lastCtrEncerrante &&\r\n ((new Date()) - momentoUltimoRequest) < 60 * 1000\r\n ) {\r\n resolve(calculaVolumeInterno(lastCtrEncerrante, encerrante, volume, numDigitos));\r\n } else {\r\n momentoUltimoRequest = new Date();\r\n getLastEncerranteServidor(idcBlocoMedidor, dateTime).then(function (resposta) {\r\n lastBloco = idcBlocoMedidor;\r\n lastDate = dateTime;\r\n\r\n lastCtrEncerrante = mergeWithMemory(idcBlocoMedidor, dateTime, resposta);\r\n return calculaVolumeInterno(lastCtrEncerrante, encerrante, volume, numDigitos);\r\n }).then(resolve);\r\n }\r\n })).then(function (resposta) {\r\n\r\n resposta.volume = parseFloat(resposta.volume.toFixed(numCasasDecimais));\r\n resposta.encerrante = parseFloat(resposta.encerrante.toFixed(numCasasDecimais));\r\n \r\n\r\n if (surrogateId) {\r\n rememberCounter(idcBlocoMedidor, resposta.encerrante, dateTime, surrogateId);\r\n }\r\n return resposta;\r\n });\r\n }\r\n\r\n function populaBanco(IdcRegTurno) {\r\n var encerrantes;\r\n return getEncerrantesTurno(IdcRegTurno)\r\n .then(function (resposta) {\r\n encerrantes = resposta;\r\n return db.CTR_ENCERRANTE.clear();\r\n })\r\n .then(function () {\r\n return db.CTR_ENCERRANTE.bulkPut(encerrantes);\r\n })\r\n .then(function (resposta) {\r\n //console.info(\"Encerrantes salvos com sucesso no banco do browser.\", resposta);\r\n })\r\n .catch(function (error) {\r\n //console.error(\"Ocorreu um erro ao salvar lista de encerrantes.\", error);\r\n });\r\n }\r\n\r\n function updateEncerrante(ctrEncerrante) {\r\n if (!ctrEncerrante) return;\r\n db.CTR_ENCERRANTE.put(ctrEncerrante);\r\n }\r\n\r\n return {\r\n calculaVolume: calculaVolume,\r\n populaBanco: populaBanco,\r\n updateEncerrante: updateEncerrante,\r\n forgetCounters: forgetCounters,\r\n getEncerrantesPeriodo: getEncerrantesPeriodo,\r\n getFirstAndLast: getFirstAndLast\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CtrHorHodModel', CtrHorHodModel);\r\n\r\n CtrHorHodModel.$inject = [\r\n '$httpLegacy',\r\n 'ngDexie',\r\n '$q',\r\n 'Constant',\r\n '$timeout',\r\n 'RequestService'\r\n ];\r\n\r\n function CtrHorHodModel(\r\n $http,\r\n ngDexie,\r\n $q,\r\n Constant,\r\n $timeout,\r\n RequestService\r\n ) {\r\n\r\n RequestService.url = '../server/ashx/_regAbastecimento.ashx';\r\n\r\n //Propriedades privadas\r\n var db = ngDexie.getDb();\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function post(dados) {\r\n return $http.post('../server/ashx/_regAbastecimento.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n //Métodos publicos\r\n function getLastHorimetroInterno(idcEquipamento, dateTime) {\r\n return db.CTR_HOR_HOD\r\n .orderBy('DthCtrHorHod')\r\n .filter(function (item) {\r\n return item.IdcEquipamento === idcEquipamento && item.DthCtrHorHod < dateTime;\r\n })\r\n .last();\r\n }\r\n\r\n function getHorimetrosTurno(IdcRegTurno) {\r\n if (!IdcRegTurno) {\r\n return $q.reject('Não foi passado o turno!');\r\n }\r\n\r\n var dados = {\r\n 'section': 'registro',\r\n 'function': 'getHorimetroByIdcRegTurno',\r\n 'parameter': {\r\n 'pIdcRegTurno': IdcRegTurno\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function updateHorimetro(ctrHorHod) {\r\n if (!ctrHorHod) return;\r\n db.CTR_HOR_HOD.put(ctrHorHod);\r\n }\r\n\r\n function populaBanco(IdcRegTurno) {\r\n var horimetros;\r\n return getHorimetrosTurno(IdcRegTurno)\r\n .then(function (resposta) {\r\n horimetros = resposta;\r\n\r\n return db.CTR_HOR_HOD.clear();\r\n })\r\n .then(function () {\r\n return db.CTR_HOR_HOD.bulkPut(horimetros);\r\n })\r\n .then(function (resposta) {\r\n //console.info(\"Encerrantes salvos com sucesso no banco do browser.\", resposta);\r\n })\r\n .catch(function (error) {\r\n //console.error(\"Ocorreu um erro ao salvar lista de horimetros.\", error);\r\n });\r\n }\r\n\r\n function getLastHorimetro(idcEquipamento, dateTime) {\r\n if (!idcEquipamento || !dateTime) {\r\n return Promise.reject('Parametros nulos.');\r\n }\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAbastecimento.ashx',\r\n 'section': 'registro',\r\n 'function': 'getLastHorimetro',\r\n 'parameter': {\r\n idcEquipamento: idcEquipamento,\r\n dateTime: dateTime\r\n },\r\n 'funcaoGet': function () {\r\n return getLastHorimetroInterno(idcEquipamento, dateTime)\r\n .then(function (resposta) {\r\n if (resposta) {\r\n return resposta;\r\n } else {\r\n return db.CAD_EQUIPAMENTO.get(idcEquipamento);\r\n }\r\n })\r\n .then(function (resposta) {\r\n if (resposta && resposta.UltimoHorHod) {\r\n return { ValHorHodAtual: equipamento.UltimoHorHod };\r\n } else {\r\n return resposta;\r\n }\r\n });\r\n },\r\n 'funcaoUpdate': updateHorimetro\r\n });\r\n }\r\n\r\n\r\n return {\r\n getLastHorimetroInterno: getLastHorimetroInterno,\r\n updateHorimetro: updateHorimetro,\r\n populaBanco: populaBanco,\r\n getLastHorimetro: getLastHorimetro\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('DiretoriaModel', DiretoriaModel);\r\n\r\n DiretoriaModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n\r\n function DiretoriaModel($http) {\r\n var serverUrl = '../server/mobileServer/_cadDiretoria.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadDiretoria) {\r\n if (cadDiretoria.IdcDiretoria) {\r\n return $http.put(serverUrl, cadDiretoria)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadDiretoria)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n }\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ElementoPepModel', ElementoPepModel);\r\n\r\n ElementoPepModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function ElementoPepModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_elementoPep.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: { 'All': true }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadElementoPep) {\r\n\r\n cadElementoPep.CadGerencia = null;\r\n\r\n if (cadElementoPep.IdcElementoPep) {\r\n return $http.put(serverUrl, cadElementoPep)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadElementoPep)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n \r\n };\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EmpresaClassificacaoModel', EmpresaClassificacaoModel);\r\n\r\n EmpresaClassificacaoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function EmpresaClassificacaoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_cadEmpresaClassificacao.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n\r\n function save(cadEmpresaClassificacao) {\r\n\r\n if (cadEmpresaClassificacao.IdcClassificacao) {\r\n return $http.put(serverUrl, cadEmpresaClassificacao)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadEmpresaClassificacao)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EmpresaModel', EmpresaModel);\r\n\r\n EmpresaModel.$inject = [\r\n '$http',\r\n 'Constant'\r\n ];\r\n\r\n function EmpresaModel(\r\n $http,\r\n Constant\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_empresa.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadEmpresa) {\r\n if (cadEmpresa.IdcEmpresa) {\r\n return $http.put(serverUrl, cadEmpresa)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadEmpresa)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getByClassificacao(classificacao) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n Classificacao: classificacao\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getTransportadoras() {\r\n return getByClassificacao(Constant.CLASSIFICACOES_EMPRESA.TRANSPORTADORA);\r\n }\r\n\r\n function getFornecedores() {\r\n return getByClassificacao(Constant.CLASSIFICACOES_EMPRESA.FORNECEDOR);\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getTransportadoras: getTransportadoras,\r\n getFornecedores: getFornecedores,\r\n getByClassificacao: getByClassificacao,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EntidadeModels', EntidadeModels);\r\n\r\n EntidadeModels.$inject = [\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n 'ngDexie',\r\n '$q',\r\n 'Constant',\r\n '$timeout',\r\n 'RequestService',\r\n '$http',\r\n ];\r\n\r\n function EntidadeModels(\r\n $http,\r\n UsuarioService,\r\n ngDexie,\r\n $q,\r\n Constant,\r\n $timeout,\r\n RequestService,\r\n $http2\r\n ) {\r\n\r\n RequestService.url = '../server/ashx/_regAbastecimento.ashx';\r\n\r\n var serverUrl = '../server/mobileServer/_blocoMedidor.ashx';\r\n\r\n\r\n //Propriedades privadas\r\n var db = ngDexie.getDb();\r\n\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function getAll() {\r\n\r\n return $q.resolve( [\r\n {\r\n \"name\": 'A'\r\n },\r\n {\r\n \"name\": 'B'\r\n },\r\n {\r\n \"name\": 'C'\r\n }\r\n ])\r\n\r\n // return $http2.get(serverUrl)\r\n // .then(function (response) {\r\n // return response.data;\r\n // //});\r\n // }).catch(function (error) {\r\n // console.error(error);\r\n // });\r\n }\r\n\r\n\r\n\r\n return {\r\n \r\n getAll: getAll\r\n \r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EquipamentoMarcaModel', EquipamentoMarcaModel);\r\n\r\n EquipamentoMarcaModel.$inject = [\r\n '$http',\r\n 'Constant'\r\n ];\r\n\r\n function EquipamentoMarcaModel(\r\n $http,\r\n Constant\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_equipamentoMarca.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadMarca) {\r\n if (cadMarca.IdcMarca) {\r\n return $http.put(serverUrl, cadMarca)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadMarca)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EquipamentoModel', EquipamentoModel);\r\n\r\n EquipamentoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function EquipamentoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_equipamento.ashx';\r\n\r\n function getAll(search, type) {\r\n\r\n return $http.get(serverUrl, { params: { search: search || '', type: type || \"grid\" } })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getCount(search) {\r\n\r\n return $http.get(serverUrl, { params: { getCount: true, search: search || '' } })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdcEquipamento) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcEquipamento: IdcEquipamento\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getExistente(CodTagplaca, IdcComplexo) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n CodTagplaca: CodTagplaca \r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadEquipamento) {\r\n\r\n\r\n if (cadEquipamento.IdcCaminhaoTanque) {\r\n return $http.put(serverUrl, cadEquipamento)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadEquipamento)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir,\r\n getCount: getCount,\r\n getExistente: getExistente\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EquipamentoModeloModel', EquipamentoModeloModel);\r\n\r\n EquipamentoModeloModel.$inject = [\r\n '$http',\r\n 'Constant'\r\n ];\r\n\r\n function EquipamentoModeloModel(\r\n $http,\r\n Constant\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_equipamentoModelo.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdcMarca) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcMarca: IdcMarca\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadModelo) {\r\n if (cadModelo.IdcModelo) {\r\n return $http.put(serverUrl, cadModelo)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadModelo)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir,\r\n getById: getById\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EquipamentoTipoGriModel', EquipamentoTipoGriModel);\r\n\r\n EquipamentoTipoGriModel.$inject = [\r\n '$http',\r\n 'Constant'\r\n ];\r\n\r\n function EquipamentoTipoGriModel(\r\n $http,\r\n Constant\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_equipamentoTipoGri.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadEquipamentoTipoGri) {\r\n if (cadEquipamentoTipoGri.IdcGri) {\r\n return $http.put(serverUrl, cadEquipamentoTipoGri)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadEquipamentoTipoGri)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('EquipamentoTipoModel', EquipamentoTipoModel);\r\n\r\n EquipamentoTipoModel.$inject = [\r\n '$http',\r\n 'Constant'\r\n ];\r\n\r\n function EquipamentoTipoModel(\r\n $http,\r\n Constant\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_equipamentoTipo.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadEquipamentoTipo) {\r\n if (cadEquipamentoTipo.IdcTipo) {\r\n return $http.put(serverUrl, cadEquipamentoTipo)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadEquipamentoTipo)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('GeneralModel', GeneralModel);\r\n\r\n GeneralModel.$inject = [\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n '$q',\r\n 'CadEquipamentoModel',\r\n 'CtrHorHodModel',\r\n 'CtrEncerranteModel',\r\n 'BlocoMedidorModel',\r\n 'AbastecimentoModel',\r\n 'RegAnomaliaModel'\r\n ];\r\n\r\n function GeneralModel(\r\n $http,\r\n UsuarioService,\r\n Promise,\r\n CadEquipamentoModel,\r\n CtrHorHodModel,\r\n CtrEncerranteModel,\r\n BlocoMedidorModel,\r\n AbastecimentoModel,\r\n RegAnomaliaModel\r\n ) {\r\n\r\n //Propriedades privadas\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n\r\n //Métodos publicos\r\n function getVolume20C(pIdcProduto, pValTemperatura, pValDensidade, pValVolume) {\r\n var dados = {\r\n 'section': 'registro-turno',\r\n 'function': 'retornaVolume20C',\r\n 'parameter': {\r\n pUserID: UsuarioService.indice,\r\n pIdcProduto: pIdcProduto,\r\n pValTemperatura: pValTemperatura,\r\n pValDensidade: pValDensidade,\r\n pValVolume: pValVolume\r\n }\r\n };\r\n\r\n return $http.post('../server/ashx/_regTurno.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getVolumeByAltRegua(pIdcTanquePosto, pAltRegua) {\r\n var dados = {\r\n 'section': 'registro-turno',\r\n 'function': 'retornaVolumeByAltRegua',\r\n 'parameter': {\r\n pUserID: UsuarioService.indice,\r\n pIdcTanquePosto: pIdcTanquePosto,\r\n pAltRegua: pAltRegua\r\n }\r\n };\r\n\r\n return $http.post('../server/ashx/_regTurno.ashx', dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function atualizaBancoInterno(IdcPosto, IdcRegTurno) {\r\n CtrHorHodModel.populaBanco(IdcRegTurno);\r\n CtrEncerranteModel.populaBanco(IdcRegTurno);\r\n CadEquipamentoModel.populaBanco(IdcPosto, IdcRegTurno);\r\n BlocoMedidorModel.populaBanco(IdcPosto, IdcRegTurno);\r\n AbastecimentoModel.populaBanco(IdcRegTurno);\r\n RegAnomaliaModel.getGrupos();\r\n }\r\n\r\n return {\r\n getVolume20C: getVolume20C,\r\n getVolumeByAltRegua: getVolumeByAltRegua,\r\n atualizaBancoInterno: atualizaBancoInterno\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('GerenciaModel', GerenciaModel);\r\n\r\n GerenciaModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function GerenciaModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_gerencia.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: { 'All': true }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadNivelAnomalia) {\r\n if (cadNivelAnomalia.IdcGerencia) {\r\n return $http.put(serverUrl, cadNivelAnomalia)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadNivelAnomalia)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n \r\n };\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('HstEquipamentoModel', HstEquipamentoModel);\r\n\r\n HstEquipamentoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function HstEquipamentoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_hstEquipamento.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdcEquipamento) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcEquipamento: IdcEquipamento\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadEquipamento) {\r\n\r\n return $http.post(serverUrl, cadEquipamento)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('MessageModel', MessageModel);\r\n\r\n MessageModel.$inject = [\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n '$q',\r\n '$timeout',\r\n 'Constant',\r\n 'TranslateService'\r\n ];\r\n\r\n function MessageModel(\r\n $http,\r\n UsuarioService,\r\n $q,\r\n $timeout,\r\n Constant,\r\n TranslateService\r\n ) {\r\n\r\n //Propriedades privadas \r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n\r\n //Métodos publicos\r\n function getMessages(type) {\r\n var onLine = navigator.onLine !== false;\r\n var promiseTimeOut = null;\r\n var isResolved = false;\r\n var waitingTime = onLine ? Constant.SERVER_WAITING_TIME : 0;\r\n var dados = {\r\n 'section': 'message',\r\n 'function': 'dataMessage',\r\n 'parameter': {\r\n user: UsuarioService.indice,\r\n list: false\r\n }\r\n };\r\n\r\n return $q(function (resolve, reject) {\r\n promiseTimeOut = $timeout(function () {\r\n isResolved = true;\r\n var mensagem = {\r\n data: [{\r\n AlarmMessage: type === 'Sucesso' ? TranslateService('successfully-saved') : TranslateService('error-ocurred'),\r\n AlarmStatusFmt: type,\r\n AlarmStatus: type === 'Sucesso' ? true : false,\r\n AlarmGroupFmt: 'GEN'\r\n }]\r\n };\r\n resolve(mensagem);\r\n }, waitingTime);\r\n\r\n if (onLine) {\r\n $http.post('../server/ashx/_default.ashx', dados)\r\n .then(function (resposta) {\r\n if (!isResolved) {\r\n $timeout.cancel(promiseTimeOut);\r\n resolve(resposta.data);\r\n }\r\n });\r\n } else {\r\n\r\n }\r\n });\r\n\r\n }\r\n\r\n return {\r\n getMessages: getMessages\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('MotoristaModel', MotoristaModel);\r\n\r\n MotoristaModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function MotoristaModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_motorista.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadMotorista) {\r\n if (cadMotorista.IdcMotorista) {\r\n return $http.put(serverUrl, cadMotorista)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadMotorista)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getById(IdcMotorista) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcMotorista: IdcMotorista\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('NavioTanqueModel', NavioTanqueModel);\r\n\r\n NavioTanqueModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function NavioTanqueModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_navioTanque.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdNavioTanque) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdNavioTanque: IdNavioTanque\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadNavioTanque) {\r\n\r\n cadNavioTanque.CadGerencia = null;\r\n\r\n if (cadNavioTanque.IdcNavioTanque) {\r\n return $http.put(serverUrl, cadNavioTanque)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadNavioTanque)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('NivelAnomaliaModel', NivelAnomaliaModel);\r\n\r\n NivelAnomaliaModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function NivelAnomaliaModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_nivelAnomalia.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: { 'All': true }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadNivelAnomalia) {\r\n if (cadNivelAnomalia.IdcNivel) {\r\n return $http.put(serverUrl, cadNivelAnomalia)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadNivelAnomalia)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n \r\n };\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('OrdemEstatisticaModel', OrdemEstatisticaModel);\r\n\r\n OrdemEstatisticaModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function OrdemEstatisticaModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_ordemEstatistica.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: { 'All': true }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadOrdemEstatistica) {\r\n\r\n cadOrdemEstatistica.CadGerencia = null;\r\n\r\n if (cadOrdemEstatistica.IdcOrdemEstatistica) {\r\n return $http.put(serverUrl, cadOrdemEstatistica)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadOrdemEstatistica)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n \r\n };\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('PainelDeEstoqueModel', PainelDeEstoqueModel);\r\n\r\n PainelDeEstoqueModel.$inject = [\r\n '$http',\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n '$q',\r\n '$timeout',\r\n 'ngDexie',\r\n 'RequestService'\r\n ];\r\n\r\n function PainelDeEstoqueModel(\r\n $http,\r\n $httpLegacy,\r\n UsuarioService,\r\n $q,\r\n $timeout,\r\n ngDexie,\r\n RequestService\r\n ) {\r\n\r\n RequestService.url = '../server/mobileServer/_regInputPainelEstoque.ashx';\r\n\r\n //Propriedades privadas\r\n var db = ngDexie.getDb();\r\n var emProgresso = false;\r\n\r\n //Métodos publicos\r\n\r\n \r\n \r\n function salvaInputPainelEstoque(inputPainelDeEstoque) {\r\n inputPainelDeEstoque.IdcUsuario = UsuarioService.indice;\r\n var method = 'post';\r\n return $http[method](RequestService.url, inputPainelDeEstoque)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getLitragens(idcPosto, idcProduto) {\r\n var method = 'get';\r\n return $http[method](RequestService.url, {\r\n params: {\r\n idcPosto: idcPosto,\r\n idcProduto: idcProduto\r\n }\r\n })\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n salvaInputPainelEstoque: salvaInputPainelEstoque,\r\n getLitragens: getLitragens,\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ParamsModel', ParamsModel);\r\n\r\n ParamsModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function ParamsModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_params.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('PerfilModel', PerfilModel);\r\n\r\n PerfilModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function PerfilModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_perfil.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdcPerfil) {\r\n return $http.get(serverUrl, { params: { IdcPerfil: IdcPerfil } })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(perfil) {\r\n if (perfil.IdentificadorPerfil) {\r\n return $http.put(serverUrl, perfil);\r\n } else {\r\n return $http.post(serverUrl, perfil)\r\n .then(function (resposta) {\r\n perfil.IdentificadorPerfil = resposta.IdentificadorPerfil;\r\n return resposta;\r\n });\r\n }\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('PostoModel', PostoModel);\r\n\r\n PostoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function PostoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_posto.ashx';\r\n\r\n function getAllSameComplexo(IdcPosto) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcPostoSameComplexo: IdcPosto\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAllSameUnidade(IdcUnidade) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcUnidade: IdcUnidade\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n\r\n function getLocais(idcUsuario) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n get: \"locals\",\r\n type: \"generic\",\r\n idcUsuario: idcUsuario\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(posto) {\r\n if (posto.IdcPosto) {\r\n return $http.put(serverUrl, posto)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n } else {\r\n return $http.post(serverUrl, posto)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n }\r\n\r\n function getTurnos() {\r\n return $http.get(serverUrl, {\r\n params: {\r\n \"type\": \"generic\",\r\n \"get\": \"turnos\",\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getPostos(idcUsuario) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n \"type\": \"generic\",\r\n \"get\": \"postos\",\r\n idcUsuario: idcUsuario\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAllSameComplexo: getAllSameComplexo,\r\n getAllSameUnidade: getAllSameUnidade,\r\n getPostos: getPostos,\r\n getLocais: getLocais,\r\n getTurnos: getTurnos,\r\n save: save\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ProdutoModel', ProdutoModel);\r\n\r\n ProdutoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function ProdutoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_produto.ashx';\r\n\r\n function getAllByIdcPosto(IdcPosto, TanquesAtivosByPosto) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcPosto: IdcPosto,\r\n TanquesAtivosByPosto: TanquesAtivosByPosto\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n All: true\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAllByIdcPosto: getAllByIdcPosto,\r\n getAll: getAll\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('RecebimentoFiscalModel', RecebimentoFiscalModel);\r\n\r\n RecebimentoFiscalModel.$inject = [\r\n '$http',\r\n '$q'\r\n ];\r\n\r\n function RecebimentoFiscalModel(\r\n $http,\r\n $q\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_recebimentoFiscal.ashx';\r\n var historicoURL = '../server/mobileServer/_hstRecebimentoFiscal.ashx';\r\n\r\n function isEmAvaliacao(IdentificadorRecebimentoFiscalProduto) {\r\n\r\n if (!IdentificadorRecebimentoFiscalProduto) return $q.resolve(false);\r\n\r\n return $http.get(historicoURL, {\r\n params: {\r\n IdentificadorRecebimentoFiscalProduto: IdentificadorRecebimentoFiscalProduto,\r\n OnlyPending: true\r\n }\r\n }).then(function (resposta) {\r\n return !!resposta.data.length;\r\n });\r\n }\r\n\r\n function getAllByIdcRegTurno(idcRegTurno) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcRegTurno: idcRegTurno\r\n }\r\n }).then(function (response) {\r\n return response.data.map(function (recebimento) {\r\n recebimento.diadanfe = recebimento.DataEmissaoNotaFiscal.getDate();\r\n return recebimento\r\n });\r\n });\r\n }\r\n\r\n function getByCodBarras(CodigoBarrasNotaFiscal) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n CodigoBarrasNotaFiscal: CodigoBarrasNotaFiscal\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: {\r\n All: true\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAllByIdcProduto(IdcProduto, IdcGrupo, initDate, endDate) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcProduto: IdcProduto,\r\n IdcGrupo: IdcGrupo,\r\n initDate: initDate,\r\n endDate: endDate\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function create(recebimentoFiscal) {\r\n if (recebimentoFiscal.IdentificadorRecebimentoFiscalProduto) {\r\n return $http.put(serverUrl, recebimentoFiscal)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n } else {\r\n return $http.post(serverUrl, recebimentoFiscal)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n }\r\n\r\n function updateDataSaidaPortaria(recebimentoFiscal) {\r\n return $http.put(serverUrl, recebimentoFiscal, { params: { updateDataSaidaPortaria: true}})\r\n .then(function (response) {\r\n return response.data;\r\n }); \r\n }\r\n\r\n function existeRecebimentoNessaDataHora(dataHoraUTCInicioRecebimentoFiscal, idcRegTurno, identiicadorRecebimentoFiscalProduto) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcRegTurno: idcRegTurno,\r\n initDate: dataHoraUTCInicioRecebimentoFiscal,\r\n IdentificadorRecebimentoFiscalProduto: identiicadorRecebimentoFiscalProduto,\r\n Function: \"ExisteRecebimentoNessaDataHora\"\r\n }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAllByIdcRegTurno: getAllByIdcRegTurno,\r\n create: create,\r\n getAll: getAll,\r\n getAllByIdcProduto: getAllByIdcProduto,\r\n isEmAvaliacao: isEmAvaliacao,\r\n getByCodBarras: getByCodBarras,\r\n updateDataSaidaPortaria: updateDataSaidaPortaria,\r\n existeRecebimentoNessaDataHora: existeRecebimentoNessaDataHora\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('RecebimentoFisicoModel', RecebimentoFisicoModel);\r\n\r\n RecebimentoFisicoModel.$inject = [\r\n '$http',\r\n '$q'\r\n ];\r\n\r\n function RecebimentoFisicoModel(\r\n $http,\r\n $q\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_recebimentoFisico.ashx';\r\n var historicoURL = '../server/mobileServer/_hstRecebimentoFisico.ashx';\r\n\r\n function isEmAvaliacao(IdentificadorRecebimentoFisicoProduto) {\r\n\r\n if (!IdentificadorRecebimentoFisicoProduto) return $q.resolve(false);\r\n\r\n return $http.get(historicoURL, {\r\n params: {\r\n IdentificadorRecebimentoFisicoProduto: IdentificadorRecebimentoFisicoProduto,\r\n OnlyPending: true\r\n }\r\n }).then(function (resposta) {\r\n return !!resposta.data.length;\r\n });\r\n }\r\n\r\n function getAllByIdcRegTurno(idcRegTurno) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcTurnoInicio: idcRegTurno,\r\n IdcTurnoTermino: idcRegTurno\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: {\r\n All: true\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAllByIdcProduto(IdcProduto, IdcGrupo, initDate, endDate) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcProduto: IdcProduto,\r\n IdcGrupo: IdcGrupo,\r\n initDate: initDate,\r\n endDate: endDate\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function createOrUpdate(recebimentoFisico) {\r\n\r\n if (recebimentoFisico.IdentificadorRecebimentoFisicoProduto) {\r\n return $http.put(serverUrl, recebimentoFisico)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n } else {\r\n return $http.post(serverUrl, recebimentoFisico)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n }\r\n\r\n function getAllByDthInicio(dataHoraUTCInicioRecebimentoFisico, idcRegTurno) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcTurnoInicio: idcRegTurno,\r\n initDate: dataHoraUTCInicioRecebimentoFisico,\r\n Function: \"BuscaFisicosDesassociados\",\r\n ApenasCargaEmMassa: true\r\n }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function existeRecebimentoNessaDataHora(dataHoraUTCInicioRecebimentoFisico, idcRegTurno, identificadorRecebimentoFisicoProduto) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcTurnoInicio: idcRegTurno,\r\n initDate: dataHoraUTCInicioRecebimentoFisico,\r\n IdentificadorRecebimentoFisicoProduto: identificadorRecebimentoFisicoProduto,\r\n Function: \"ExisteRecebimentoNessaDataHora\"\r\n }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAllByIdcRegTurno: getAllByIdcRegTurno,\r\n createOrUpdate: createOrUpdate,\r\n getAll: getAll,\r\n getAllByIdcProduto: getAllByIdcProduto,\r\n isEmAvaliacao: isEmAvaliacao,\r\n getAllByDthInicio: getAllByDthInicio,\r\n existeRecebimentoNessaDataHora: existeRecebimentoNessaDataHora\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CentroCustoModel', CentroCustoModel);\r\n\r\n CentroCustoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function CentroCustoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_centroCusto.ashx';\r\n\r\n function getAll() {\r\n return $http.get(serverUrl, {\r\n params: { 'All': true }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function save(cadCentroCusto) {\r\n\r\n cadCentroCusto.CadGerencia = null;\r\n\r\n if (cadCentroCusto.IdcCentroCusto) {\r\n return $http.put(serverUrl, cadCentroCusto)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadCentroCusto)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n \r\n };\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('RegAbastecimentoTanqueModel', RegAbastecimentoTanqueModel);\r\n\r\n RegAbastecimentoTanqueModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function RegAbastecimentoTanqueModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_regAbastecimentoTanque.ashx';\r\n\r\n function getAbastecimentoTanque(idcEquipamento) {\r\n\r\n return $http.get(serverUrl, { params: { IdcEquipamento: idcEquipamento } })\r\n .then(function (resposta) {\r\n\r\n if (!resposta.data || !resposta.data.length) {\r\n return null;\r\n }\r\n else {\r\n return resposta.data;\r\n }\r\n });\r\n }\r\n\r\n return {\r\n getAbastecimentoTanque: getAbastecimentoTanque\r\n };\r\n }\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('RegAnomaliaModel', RegAnomaliaModel);\r\n\r\n RegAnomaliaModel.$inject = [\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n '$state',\r\n '$q',\r\n 'ngDexie',\r\n 'RequestService'\r\n ];\r\n\r\n function RegAnomaliaModel(\r\n $http,\r\n UsuarioService,\r\n $state,\r\n $q,\r\n ngDexie,\r\n RequestService\r\n ) {\r\n\r\n RequestService.url = '../server/ashx/_regAnomalia.ashx';\r\n\r\n //Propriedades privadas\r\n var grupos = null;\r\n var db = ngDexie.getDb();\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function preencheAnomalia(anomalia) {\r\n anomalia.IdcUsuario = UsuarioService.indice;\r\n anomalia.TblOperacao = $state.current.tabela;\r\n anomalia.NomDispositivo = 'WEB-MOBILE';\r\n\r\n return anomalia;\r\n }\r\n\r\n //Métodos publicos\r\n function getGrupos() {\r\n\r\n if (grupos) return $q.resolve(grupos);\r\n\r\n return RequestService({\r\n 'url': '../server/ashx/_regAnomalia.ashx',\r\n 'section': 'grid',\r\n 'function': 'dataGrid',\r\n 'parameter': UsuarioService.indice,\r\n 'funcaoGet': function () {\r\n return db.REG_GRUPO_ANOMALIA.toArray();\r\n },\r\n 'funcaoUpdate': function (resposta) {\r\n grupos = resposta;\r\n return db.REG_GRUPO_ANOMALIA.clear()\r\n .then(function () {\r\n return db.REG_GRUPO_ANOMALIA.bulkPut(grupos);\r\n });\r\n },\r\n });\r\n\r\n // var dados = {\r\n // 'section': 'grid',\r\n // 'function': 'dataGrid',\r\n // 'parameter': UsuarioService.indice\r\n // };\r\n\r\n // return $http.post('../server/ashx/_regAnomalia.ashx', dados)\r\n // .then(function (resposta) {\r\n // grupos = resposta.data;\r\n // return resposta.data;\r\n // });\r\n }\r\n\r\n function salvarAnomalia(anomalia) {\r\n\r\n anomalia = preencheAnomalia(anomalia);\r\n\r\n if (!navigator.onLine) {\r\n return $q.resolve(anomalia);\r\n }\r\n\r\n var dados = {\r\n 'section': 'grid',\r\n 'function': 'salvarMobile',\r\n 'parameter': {\r\n 'user': UsuarioService.indice,\r\n 'data': JSON.stringify(anomalia)\r\n }\r\n };\r\n\r\n return $http.post('../server/ashx/_regAnomalia.ashx', dados, { 'timeout': 5000 })\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n return anomalia;\r\n });\r\n }\r\n\r\n\r\n return {\r\n getGrupos: getGrupos,\r\n salvarAnomalia: salvarAnomalia\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('RegEstornoModel', RegEstornoModel);\r\n\r\n RegEstornoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function RegEstornoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_regEstorno.ashx';\r\n\r\n function getAll(filters, type) {\r\n var parameters = { params: { type: type || \"grid\" } };\r\n parameters.params = Object.assign(parameters.params, filters);\r\n return $http.get(serverUrl, parameters)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(regEstorno) {\r\n if (regEstorno.IdcEstorno) {\r\n return $http.put(serverUrl, regEstorno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, regEstorno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n save: save,\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TanquePostoModel', TanquePostoModel);\r\n\r\n TanquePostoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function TanquePostoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_tanquePosto.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getByIdPosto(IdcPosto) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcPosto: IdcPosto\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getByIdPostoAndStuTanque(IdcPosto, StuTanque) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcPosto: IdcPosto,\r\n StuTanque: StuTanque\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getByIdPosto: getByIdPosto,\r\n getByIdPostoAndStuTanque: getByIdPostoAndStuTanque\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TipoFiscalModel', TipoFiscalModel);\r\n\r\n TipoFiscalModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function TipoFiscalModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_cadTipoFiscal.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(IdcTipoFiscal) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcTipoFiscal: IdcTipoFiscal\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadTurno) {\r\n\r\n if (cadTurno.IdcTipoFiscal) {\r\n return $http.put(serverUrl, cadTurno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadTurno)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n save: save,\r\n excluir: excluir\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TranferenciaModel', TranferenciaModel);\r\n\r\n TranferenciaModel.$inject = [\r\n '$http',\r\n '$q'\r\n ];\r\n\r\n function TranferenciaModel(\r\n $http,\r\n $q\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_transferencia.ashx';\r\n var historicoURL = '../server/mobileServer/_hstTransferencia.ashx';\r\n var IsFunctionValidate = false;\r\n var IsFunctionValidState = false;\r\n\r\n function isEmAvaliacao(IdentificadorTransferenciaProduto) {\r\n\r\n if (!IdentificadorTransferenciaProduto) return $q.resolve(false);\r\n\r\n return $http.get(historicoURL, {\r\n params: {\r\n IdentificadorTransferenciaProduto: IdentificadorTransferenciaProduto,\r\n OnlyPending: true\r\n }\r\n }).then(function (resposta) {\r\n return !!resposta.data.length;\r\n });\r\n }\r\n\r\n function getAllByIdcRegTurnoPosto(idcRegTurno, idcPosto) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcRegTurnoOrigem: idcRegTurno,\r\n IdcPostoDestino: idcPosto\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getLastLacre(idcPosto) {\r\n return $http.get(serverUrl, {\r\n params: {\r\n type: \"generic\",\r\n IdcPosto: idcPosto,\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function hasDestinyOpenedShift(selectedTransferencia) {\r\n IsFunctionValidate = true;\r\n return $http.get(serverUrl, {\r\n params: {\r\n DthInicioTranferencia: selectedTransferencia.DataHoraUTCInicioRetiradaOrigem,\r\n DthFimTranferencia: selectedTransferencia.DataHoraUTCFimRetiradaOrigem,\r\n IdcPostoDestino: selectedTransferencia.IdentificadorProdutoPostoDestino,\r\n IsFunctionValidate: IsFunctionValidate\r\n }\r\n }).then(function (response) {\r\n if (response.data.length)\r\n return response.data[0].hasDestinyOpenedShift;\r\n });\r\n }\r\n\r\n function getDestinyShiftState(selectedTransferencia) {\r\n IsFunctionValidState = true;\r\n return $http.get(serverUrl, {\r\n params: {\r\n DthInicioTranferencia: selectedTransferencia.DataHoraUTCInicioRetiradaOrigem,\r\n DthFimTranferencia: selectedTransferencia.DataHoraUTCFimRetiradaOrigem,\r\n IdcPostoDestino: selectedTransferencia.IdentificadorProdutoPostoDestino,\r\n IsFunctionValidState: IsFunctionValidState\r\n }\r\n }).then(function (response) {\r\n if (response.data.length)\r\n return response.data[0].functionValidState;\r\n });\r\n }\r\n\r\n function createOrUpdate(tranferencia) {\r\n\r\n if (tranferencia.IdentificadorTransferenciaProduto) {\r\n return $http.put(serverUrl, tranferencia)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n } else {\r\n return $http.post(serverUrl, tranferencia)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n }\r\n\r\n return {\r\n getAllByIdcRegTurnoPosto: getAllByIdcRegTurnoPosto,\r\n createOrUpdate: createOrUpdate,\r\n isEmAvaliacao: isEmAvaliacao,\r\n hasDestinyOpenedShift: hasDestinyOpenedShift,\r\n getDestinyShiftState: getDestinyShiftState,\r\n getLastLacre: getLastLacre\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TransacaoModel', TransacaoModel);\r\n\r\n TransacaoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function TransacaoModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_transacao.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TransacaoPerfilModel', TransacaoPerfilModel);\r\n\r\n TransacaoPerfilModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function TransacaoPerfilModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_transacaoPerfil.ashx';\r\n\r\n function getByPerfil(IdcPerfil) {\r\n\r\n return $http.get(serverUrl,{\r\n params: {\r\n IdcPerfil: IdcPerfil\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getByPerfil: getByPerfil\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TreeViewModel', TreeViewModel);\r\n\r\n TreeViewModel.$inject = [\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n '$q'\r\n ];\r\n\r\n function TreeViewModel(\r\n $http,\r\n UsuarioService,\r\n $q\r\n ) {\r\n\r\n //Propriedades privadas \r\n var tree = null;\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n\r\n //Métodos publicos\r\n function getAll() {\r\n var dados = {\r\n 'section': 'treeview',\r\n 'function': 'dataTreeviewOnlyActiveStation',\r\n 'parameter': UsuarioService.indice\r\n };\r\n\r\n if (tree) {\r\n return $q.resolve(tree);\r\n }\r\n\r\n return $http.post('../server/ashx/_default.ashx', dados)\r\n .then(function (resposta) {\r\n tree = resposta.data;\r\n return resposta.data;\r\n });\r\n }\r\n\r\n\r\n return {\r\n getAll: getAll\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TurnoModel', TurnoModel);\r\n\r\n TurnoModel.$inject = [\r\n '$httpLegacy',\r\n 'UsuarioService',\r\n 'TranslateService',\r\n '$state',\r\n '$http',\r\n '$q'\r\n ];\r\n\r\n function TurnoModel(\r\n $http,\r\n UsuarioService,\r\n TranslateService,\r\n $state,\r\n $httpRegular,\r\n $q\r\n ) {\r\n\r\n //Propriedades privadas \r\n var privilege;\r\n var urlRegTurno = '../server/ashx/_regTurno.ashx';\r\n var urlSelTurno = '../server/ashx/_selTurno.ashx';\r\n var historicoURL = '../server/mobileServer/_hstTurno.ashx';\r\n\r\n //Propriedades públicas\r\n\r\n //Métodos privados\r\n function post(dados) {\r\n return $http.post(dados.url, dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }).catch(function (erro) {\r\n console.log(erro);\r\n throw new Error(TranslateService('verificar-disp-conexao-rede'));\r\n });\r\n }\r\n\r\n //Métodos publicos\r\n function getAll(nodeId, dthInicial, dthFinal, status) {\r\n\r\n nodeId = nodeId || 'root';\r\n dthInicial = dthInicial || new Date();\r\n dthFinal = dthFinal || new Date();\r\n privilege = $state.current.privilege;\r\n\r\n var dthAtual = new Date;\r\n\r\n var dados = {\r\n 'url': urlSelTurno,\r\n 'section': 'filtros',\r\n 'function': 'searchShifts',\r\n 'parameter': {\r\n privilege: privilege,\r\n user: UsuarioService.indice,\r\n nodeId: nodeId,\r\n //nodeId: 'root-1-1-3-37',\r\n dthInicial: dthInicial,\r\n dthFinal: dthFinal,\r\n dthAtual: dthAtual,\r\n status: status\r\n }\r\n };\r\n\r\n return post(dados).then(function (resposta) {\r\n return resposta;\r\n //.map(function (item) {\r\n //if (item.StuTurno === \"NO\") {\r\n // item.DataInicial = new Date(item.DataInicialLocal);\r\n // item.DataFinal = new Date(item.DataFinalLocal);\r\n //}\r\n //return item;\r\n //});\r\n });\r\n }\r\n\r\n function isEmAvaliacao(IdcRegTurno) {\r\n\r\n if (!IdcRegTurno) return $q.resolve(false);\r\n\r\n return $httpRegular.get(historicoURL, {\r\n params: {\r\n IdcRegTurno: IdcRegTurno,\r\n OnlyPending: true\r\n }\r\n }).then(function (resposta) {\r\n return !!resposta.data.length;\r\n });\r\n }\r\n\r\n function canOpenShift(turnoObj) {\r\n var dados = {\r\n 'url': urlSelTurno,\r\n 'section': 'selection',\r\n 'function': 'canOpenShift',\r\n 'parameter': {\r\n 'user': UsuarioService.indice,\r\n 'turno': JSON.stringify(turnoObj)\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function reopenShift(turnoObj) {\r\n var dados = {\r\n 'url': urlSelTurno,\r\n 'section': 'registro',\r\n 'function': 'reOpenShift',\r\n 'parameter': {\r\n 'user': UsuarioService.indice,\r\n 'turno': JSON.stringify(turnoObj)\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function fecharTurno(IdcRegTurno) {\r\n\r\n var dados = {\r\n 'url': urlRegTurno,\r\n 'section': 'fechamento',\r\n 'function': 'fechar',\r\n 'parameter': {\r\n 'pUserID': UsuarioService.indice,\r\n 'pIdcRegTurno': IdcRegTurno,\r\n 'pIdcUsuarioFechamento': UsuarioService.indice\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function getComplete(turnoObj) {\r\n var dados = {\r\n 'url': urlRegTurno,\r\n 'section': 'registro-turno',\r\n 'function': 'retornaRegTurno',\r\n 'parameter': {\r\n 'pUserID': UsuarioService.indice,\r\n 'turno': JSON.stringify(turnoObj)\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function getFechamento(pIdcRegTurno, pIdcPosto) {\r\n if (!pIdcRegTurno) return;\r\n\r\n var dados = {\r\n 'url': urlRegTurno,\r\n 'section': 'fechamento',\r\n 'function': 'carregar',\r\n 'parameter': {\r\n 'pUserID': UsuarioService.indice,\r\n 'pIdcRegTurno': pIdcRegTurno,\r\n 'pIdcPosto': pIdcPosto\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function validarTurno(regTurno) {\r\n\r\n regTurno.NomDispositivo = 'MOBILE';\r\n\r\n if (regTurno.IdcRegTurno === 0 &&\r\n regTurno.IdcUsuarioAbertura === null\r\n ) {\r\n regTurno.IdcUsuarioAbertura = UsuarioService.indice;\r\n }\r\n\r\n regTurno.IdcUsuarioValidacao = UsuarioService.indice;\r\n regTurno.DthValidacao = new Date();\r\n regTurno.StuTurno = 'VA';\r\n\r\n var dados = {\r\n 'url': urlRegTurno,\r\n 'section': 'registro-turno',\r\n 'function': 'validar',\r\n 'parameter': {\r\n 'pUserID': UsuarioService.indice,\r\n 'regTurno': JSON.stringify(regTurno)\r\n }\r\n };\r\n\r\n return post(dados).then(function (resposta) {\r\n if (resposta == \"0\") {\r\n throw new Error(TranslateService('nao-possivel-val-turno'));\r\n }\r\n\r\n return resposta;\r\n });\r\n }\r\n\r\n function salvarTurno(regTurno) {\r\n\r\n regTurno.NomDispositivo = 'MOBILE';\r\n\r\n if (regTurno.IdcRegTurno === 0 &&\r\n regTurno.IdcUsuarioAbertura === null\r\n ) {\r\n regTurno.IdcUsuarioAbertura = UsuarioService.indice;\r\n }\r\n\r\n var dados = {\r\n 'url': urlRegTurno,\r\n 'section': 'registro-turno',\r\n 'function': 'salvar',\r\n 'parameter': {\r\n 'pUserID': UsuarioService.indice,\r\n 'regTurno': JSON.stringify(regTurno)\r\n }\r\n };\r\n\r\n return post(dados).then(function (resposta) {\r\n if (resposta == \"0\") {\r\n throw new Error(TranslateService('nao-possivel-sal-turno'));\r\n }\r\n\r\n return resposta;\r\n });\r\n }\r\n\r\n function inoperarTurno(regTurno) {\r\n\r\n regTurno.NomDispositivo = 'MOBILE';\r\n\r\n var dados = {\r\n 'url': urlRegTurno,\r\n 'section': 'registro-turno',\r\n 'function': 'inoperarTurno',\r\n 'parameter': {\r\n 'pUserID': UsuarioService.indice,\r\n 'pRegTurno': JSON.stringify(regTurno)\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n function selTurnoInoperar(turnoList) {\r\n var dados = {\r\n 'url': urlRegTurno,\r\n 'section': 'registro-turno',\r\n 'function': 'selTurnoInoperar',\r\n 'parameter': {\r\n 'pUserID': UsuarioService.indice,\r\n 'turnoList': JSON.stringify(turnoList)\r\n }\r\n };\r\n\r\n return post(dados);\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getComplete: getComplete,\r\n getFechamento: getFechamento,\r\n salvarTurno: salvarTurno,\r\n canOpenShift: canOpenShift,\r\n fecharTurno: fecharTurno,\r\n inoperarTurno: inoperarTurno,\r\n isEmAvaliacao: isEmAvaliacao,\r\n validarTurno: validarTurno,\r\n reopenShift: reopenShift,\r\n selTurnoInoperar: selTurnoInoperar\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('UnidadeModel', UnidadeModel);\r\n\r\n UnidadeModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function UnidadeModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_unidade.ashx';\r\n\r\n function getAllSameDiretoria(IdcUnidadeDiretoria) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcUnidadeDiretoria: IdcUnidadeDiretoria\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n\r\n function getAllSameComplexo(SglComplexo) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n SglComplexo: SglComplexo\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcUnidadeDiretoria: IdcUnidadeDiretoria\r\n }\r\n })\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function save(cadUnidade) {\r\n if (cadUnidade.IdcUnidade) {\r\n return $http.put(serverUrl, cadUnidade)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return $http.post(serverUrl, cadUnidade)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n }); \r\n }\r\n\r\n function excluir(id) {\r\n return $http.delete(serverUrl, {\r\n params: { 'id': id }\r\n }).then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n return {\r\n getAllSameDiretoria: getAllSameDiretoria,\r\n getAllSameComplexo: getAllSameComplexo,\r\n getAll: getAll,\r\n save: save,\r\n excluir: excluir\r\n \r\n };\r\n\r\n\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('UsuarioModel', UsuarioModel);\r\n\r\n UsuarioModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function UsuarioModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_usuario.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getAllNew() {\r\n return $http\r\n .get(serverUrl, {\r\n params: {\r\n action: \"all\",\r\n type: \"generic\"\r\n }\r\n })\r\n .then(function (response) {\r\n\r\n return response.data;\r\n });\r\n }\r\n\r\n\r\n function getPerfils(IdcUsuario) {\r\n return $http\r\n .get(serverUrl, {\r\n params: {\r\n action: \"perfis\",\r\n type: \"generic\",\r\n IdcUsuario: IdcUsuario\r\n }\r\n })\r\n .then(function (response) {\r\n\r\n return response.data;\r\n });\r\n }\r\n\r\n function update(cadUsuario) {\r\n return $http.put(serverUrl, cadUsuario)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function getById(id) {\r\n\r\n return $http.get(serverUrl, {\r\n params: {\r\n IdcUsuario: id\r\n }\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getAllNew: getAllNew,\r\n getById: getById,\r\n getPerfils: getPerfils,\r\n update: update\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('VagaoTanqueModel', VagaoTanqueModel);\r\n\r\n VagaoTanqueModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function VagaoTanqueModel($http) {\r\n\r\n var serverUrl = '../server/mobileServer/_cadVagaoTanque.ashx';\r\n\r\n function getAll() {\r\n\r\n return $http.get(serverUrl)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ValidacaoModel', ValidacaoModel);\r\n\r\n ValidacaoModel.$inject = [\r\n '$http'\r\n ];\r\n\r\n function ValidacaoModel(\r\n $http\r\n ) {\r\n\r\n var serverUrl = '../server/mobileServer/_validacao.ashx';\r\n\r\n function getAll(target) {\r\n\r\n return $http.get(serverUrl.replace('_validacao', target))\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function put(target, data) {\r\n\r\n return $http.put(serverUrl.replace('_validacao', target), data)\r\n .then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n function getById(target, idName, idValue) {\r\n\r\n var params = {};\r\n params[idName] = idValue;\r\n\r\n return $http.get(serverUrl.replace('_validacao', target), {\r\n params: params\r\n }).then(function (response) {\r\n return response.data;\r\n });\r\n }\r\n\r\n return {\r\n getAll: getAll,\r\n getById: getById,\r\n put: put\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('$httpLegacy', $httpLegacy);\r\n\r\n $httpLegacy.$inject = [\r\n '$http'\r\n ];\r\n\r\n function $httpLegacy($http) {\r\n\r\n var legacyService = {\r\n post: function (url, dados) {\r\n return $http({\r\n headers: {\r\n \"Content-Type\": \"application/x-www-form-urlencoded\"\r\n },\r\n data: $.param(JSON.parse(JSON.stringify(dados))),\r\n url: url,\r\n method: 'POST'\r\n }).then(function (response) {\r\n\r\n var type = response.headers('content-type');\r\n\r\n if (type && (type.indexOf('application/json') !== -1 || type.indexOf('text/plain') !== -1)) {\r\n response.data = convertDate(response.data);\r\n }\r\n\r\n return response;\r\n });\r\n }\r\n };\r\n\r\n return legacyService;\r\n }\r\n\r\n //Função que varre objeto convertendo os campos de data\r\n function convertDate(objeto) {\r\n\r\n aux(objeto);\r\n return objeto;\r\n\r\n function aux(obj) {\r\n\r\n angular.forEach(obj, function (value, key) {\r\n if (typeof value == 'object') {\r\n aux(value);\r\n }\r\n else {\r\n var reg = /^\\d{4}-\\d{2}-\\d{2}/;\r\n if (reg.test(value)) {\r\n obj[key] = new Date(value);\r\n }\r\n }\r\n });\r\n\r\n }\r\n }\r\n\r\n})();","(function(){\r\n 'use strict';\r\n\r\n angular.module(\"posto-facil\").factory(\"AlertExceptionService\", AlertExceptionService);\r\n\r\n AlertExceptionService.$inject = [\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function AlertExceptionService(\r\n MessageService,\r\n TranslateService\r\n ){\r\n \r\n return function(error){\r\n\r\n var message = undefined;\r\n var typeOfError = typeof error;\r\n\r\n\r\n switch (typeOfError) {\r\n case \"undefined\":\r\n message = TranslateService('error');\r\n break;\r\n case \"string\":\r\n message = error;\r\n break;\r\n case \"object\":\r\n message = getMessageError(error);\r\n break;\r\n \r\n default:\r\n message = TranslateService('error');\r\n break;\r\n }\r\n \r\n return MessageService.alert(\r\n TranslateService('error'),\r\n message\r\n );\r\n }\r\n }\r\n\r\n\r\n function getMessageError(error){ \r\n \r\n\r\n if(!error) return TranslateService('error');\r\n \r\n if(error.data) return getMessageError(error.data);\r\n\r\n if(error.Message){\r\n var message = error.Message;\r\n if (error.InnerException) {\r\n message += getMessageError(error.InnerException);\r\n }\r\n return message;\r\n }\r\n\r\n if(error.message){\r\n return error.message\r\n }\r\n return error\r\n\r\n \r\n }\r\n})()","(function () {\r\n 'use strict';\r\n\r\n angular.module(\"posto-facil\").factory(\"applyLenghtRule\", applyLenghtRule);\r\n\r\n applyLenghtRule.$inject = [\r\n 'TranslateService',\r\n 'getValueInPath'\r\n ];\r\n\r\n function applyLenghtRule(\r\n TranslateService,\r\n getValueInPath\r\n ) {\r\n return {\r\n \"single\": function (field) {\r\n return {\r\n \"rule\": \"field-max-length\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n if (!recebimento[field.name]) return true;\r\n\r\n var stringField = recebimento[field.name].toString();\r\n var valid = stringField.length <= field.maxLength;\r\n\r\n if (field.decimal) {\r\n var splited = stringField.split(\".\");\r\n valid = splited[0].length <= (field.maxLength - field.decimal) &&\r\n (splited[1] || \"\").length <= field.decimal;\r\n }\r\n\r\n if (typeof recebimento[field.name] == \"number\") {\r\n valid = valid && recebimento[field.name] < (Math.pow(10, field.maxLength - (field.decimal || 0)));\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"field-max-length-\" + typeof recebimento[field.name],\r\n TranslateService(field.name),\r\n field.maxLength,\r\n field.decimal || 0,\r\n stringField\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n };\r\n },\r\n \"many\": function (propName) {\r\n return function (field) {\r\n return {\r\n \"rule\": \"field-max-length\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (entidade, messages) {\r\n\r\n var type = null;\r\n var stringField = null;\r\n var valid = entidade[propName].every(function (item) {\r\n\r\n var value = getValueInPath(item, field.name).value;\r\n\r\n if (!value) return true;\r\n\r\n type = typeof value;\r\n\r\n stringField = value.toString();\r\n var innerValid = stringField.length <= field.maxLength;\r\n\r\n if (field.decimal) {\r\n var splited = stringField.split(\".\");\r\n innerValid = splited[0].length <= (field.maxLength - field.decimal) &&\r\n (splited[1] || \"\").length <= field.decimal;\r\n }\r\n\r\n if (typeof value == \"number\") {\r\n innerValid = innerValid && value < (Math.pow(10, field.maxLength - (field.decimal || 0)));\r\n }\r\n\r\n return innerValid;\r\n\r\n });\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"field-max-length-\" + type,\r\n TranslateService(field.name),\r\n field.maxLength,\r\n field.decimal || 0,\r\n stringField\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n };\r\n }\r\n }\r\n }\r\n }\r\n})()","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('BarCodeService', BarCodeService);\r\n\r\n BarCodeService.$inject = [];\r\n\r\n function BarCodeService() {\r\n\r\n var callback = null;\r\n\r\n function zxinglistener(e) {\r\n localStorage[\"zxingbarcode\"] = \"\";\r\n if (e.url.split(\"?\")[0] == window.location.href) {\r\n window.focus();\r\n processBarcode(decodeURIComponent(e.newValue));\r\n }\r\n window.removeEventListener(\"storage\", zxinglistener, false);\r\n }\r\n\r\n function getParam(paramName) {\r\n var fullQuery = window.location.href.split(\"?\")[1];\r\n if (!fullQuery) {\r\n return null;\r\n }\r\n var params = fullQuery.split(\"&\").map(function (param) {\r\n var keyValue = param.split(\"=\");\r\n return {\r\n key: keyValue[0],\r\n value: keyValue[1]\r\n }\r\n });\r\n\r\n var param = params.find(function (item) {\r\n return item.key == paramName;\r\n });\r\n\r\n if (!param) {\r\n return null;\r\n }\r\n\r\n return param.value;\r\n }\r\n\r\n function init(cb) {\r\n var code = getParam(\"code\");\r\n\r\n if (code) {\r\n localStorage[\"zxingbarcode\"] = code;\r\n window.location.hash = window.location.hash.split(\"?\")[0];\r\n // self.close();\r\n //window.location.href = \"about:blank\";//In case self.close is disabled\r\n } else {\r\n window.addEventListener(\"hashchange\", function () {\r\n window.removeEventListener(\"storage\", zxinglistener, false);\r\n code = getParam(\"code\");\r\n if (code) {\r\n window.location.hash = window.location.hash.split(\"?\")[0];\r\n processBarcode(decodeURIComponent(code));\r\n }\r\n }, false);\r\n }\r\n\r\n cb(decodeURIComponent(code));\r\n }\r\n\r\n function getScan(cb) {\r\n callback = cb;\r\n var href = window.location.href.split(\"?\")[0];\r\n window.addEventListener(\"storage\", function (e) {\r\n if (e.origin !== this.window.origin) {\r\n return;\r\n }\r\n\r\n localStorage[\"zxingbarcode\"] = \"\";\r\n if (e.url.split(\"?\")[0] == window.location.href) {\r\n window.focus();\r\n processBarcode(decodeURIComponent(e.newValue));\r\n }\r\n window.removeEventListener(\"storage\", zxinglistener, false);\r\n }, false);\r\n window.zxingWindow = window.open(\"zxing://scan/?ret=\" + encodeURIComponent(href + \"?code={CODE}\"), '_self');\r\n }\r\n\r\n function processBarcode(b) {\r\n callback(b);\r\n }\r\n\r\n return {\r\n zxinglistener: zxinglistener,\r\n getScan: getScan,\r\n getParam: getParam,\r\n init: init,\r\n processBarcode: processBarcode\r\n }\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ConvertDate', ConvertDate);\r\n\r\n ConvertDate.$inject = [];\r\n\r\n function ConvertDate() {\r\n\r\n return function convertDate(objeto) {\r\n\r\n for (var prop in objeto) {\r\n if (objeto[prop] instanceof Object) {\r\n convertDate(objeto[prop]);\r\n } else if (/^\\d{4}-\\d{2}-\\d{2}/.test(objeto[prop])) {\r\n objeto[prop] = new Date(objeto[prop]);\r\n }\r\n } \r\n\r\n return objeto;\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('DanfeService', DanfeService);\r\n\r\n DanfeService.$inject = [\r\n '$q',\r\n 'RecebimentoFiscalModel',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function DanfeService(\r\n $q,\r\n RecebimentoFiscalModel,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n function validateBarCodeNFe(codBarras) {\r\n var valid = false;\r\n if (codBarras.length == 44) {\r\n var base9 = [4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];\r\n var somatorio = 0;\r\n for (var i in base9) {\r\n somatorio += base9[i] * codBarras[i];\r\n }\r\n var resto = somatorio % 11;\r\n var dv = (resto == 0 || resto == 1) ? 0 : (11 - resto);\r\n valid = dv == codBarras[43];\r\n }\r\n return valid;\r\n }\r\n\r\n return function (codBarras, novaOrigem) {\r\n\r\n return new $q(function (resolve, reject) {\r\n\r\n if (!validateBarCodeNFe(codBarras)) {\r\n return reject(new Error('Código DANFE inválido! ' + codBarras));\r\n }\r\n\r\n return RecebimentoFiscalModel.getByCodBarras(codBarras)\r\n .then(function (resposta) {\r\n if (resposta.length) {\r\n if(resposta[0].IdentificadorGrupoRecebimentoFisicoFiscal === null && resposta[0].PreCadastro === 'N'){\r\n if(novaOrigem){\r\n resolve({\r\n mes: codBarras.substr(4, 2),\r\n ano: codBarras.substr(2, 2),\r\n numDanfe: codBarras.substr(25, 9),\r\n diaEmissaoNotaFiscal: resposta[0].DataEmissaoNotaFiscal.getUTCDate(),\r\n dataEmissaoNotaFiscal: resposta[0].DataEmissaoNotaFiscal,\r\n identificadorRecebimentoFiscalProduto: resposta[0].IdentificadorRecebimentoFiscalProduto,\r\n empresaFornecedora: resposta[0].IdentificadorEmpresaFornecedora,\r\n empresaTransportadora: resposta[0].IdentificadorEmpresaTransportadora,\r\n vagaoTanque: resposta[0].IdentificadorVagaoTanque,\r\n caminhaoTanque: resposta[0].IdentificadorCaminhaoTanque,\r\n cavaloMecanico: resposta[0].IdentificadorCavaloMecanico,\r\n motoristaCavaloCaminhaoTanque: resposta[0].IdentificadorMotoristaCavaloCaminhaoTanque,\r\n codigoHexadecimalCorLacres: resposta[0].CodigoHexadecimalCorLacres,\r\n quantidadeLacres: resposta[0].QuantidadeLacres,\r\n numeroIdentificacaoLacres: resposta[0].NumeroIdentificacaoLacres,\r\n produtoNotaFiscal: resposta[0].IdentificadorProdutoNotaFiscal,\r\n quantidadeProdutoNotaFiscal: resposta[0].QuantidadeProdutoNotaFiscal,\r\n precoUnitarioProdutoNotaFiscal: resposta[0].PrecoUnitarioProdutoNotaFiscal,\r\n pesoLiquidoNotaFiscal: resposta[0].PesoLiquidoNotaFiscal,\r\n pesoBrutoNotaFiscal: resposta[0].PesoBrutoNotaFiscal,\r\n pesoBrutoVale: resposta[0].PesoBrutoVale,\r\n numeroItemNota: resposta[0].NumeroItemNota,\r\n cnpjNotaFiscal: resposta[0].CnpjNotaFiscal,\r\n densidadeCarga: resposta[0].DensidadeCarga,\r\n temperaturaCarga: resposta[0].TemperaturaCarga,\r\n identificadorGrupoRecebimentoFisicoFiscal: resposta[0].IdentificadorGrupoRecebimentoFisicoFiscal,\r\n preCadastro: resposta[0].PreCadastro\r\n })\r\n }\r\n }else{\r\n if (resposta[0].PreCadastro !== 'N') {\r\n resolve({\r\n mes: codBarras.substr(4, 2),\r\n ano: codBarras.substr(2, 2),\r\n numDanfe: codBarras.substr(25, 9),\r\n diaEmissaoNotaFiscal: resposta[0].DataEmissaoNotaFiscal.getUTCDate(),\r\n dataEmissaoNotaFiscal: resposta[0].DataEmissaoNotaFiscal,\r\n identificadorRecebimentoFiscalProduto: resposta[0].IdentificadorRecebimentoFiscalProduto,\r\n empresaFornecedora: resposta[0].IdentificadorEmpresaFornecedora,\r\n empresaTransportadora: resposta[0].IdentificadorEmpresaTransportadora,\r\n vagaoTanque: resposta[0].IdentificadorVagaoTanque,\r\n caminhaoTanque: resposta[0].IdentificadorCaminhaoTanque,\r\n cavaloMecanico: resposta[0].IdentificadorCavaloMecanico,\r\n motoristaCavaloCaminhaoTanque: resposta[0].IdentificadorMotoristaCavaloCaminhaoTanque,\r\n codigoHexadecimalCorLacres: resposta[0].CodigoHexadecimalCorLacres,\r\n quantidadeLacres: resposta[0].QuantidadeLacres,\r\n numeroIdentificacaoLacres: resposta[0].NumeroIdentificacaoLacres,\r\n produtoNotaFiscal: resposta[0].IdentificadorProdutoNotaFiscal,\r\n quantidadeProdutoNotaFiscal: resposta[0].QuantidadeProdutoNotaFiscal,\r\n precoUnitarioProdutoNotaFiscal: resposta[0].PrecoUnitarioProdutoNotaFiscal,\r\n pesoLiquidoNotaFiscal: resposta[0].PesoLiquidoNotaFiscal,\r\n pesoBrutoNotaFiscal: resposta[0].PesoBrutoNotaFiscal,\r\n pesoBrutoVale: resposta[0].PesoBrutoVale,\r\n numeroItemNota: resposta[0].NumeroItemNota,\r\n cnpjNotaFiscal: resposta[0].CnpjNotaFiscal,\r\n densidadeCarga: resposta[0].DensidadeCarga,\r\n temperaturaCarga: resposta[0].TemperaturaCarga,\r\n identificadorGrupoRecebimentoFisicoFiscal: resposta[0].IdentificadorGrupoRecebimentoFisicoFiscal,\r\n preCadastro: resposta[0].PreCadastro\r\n });\r\n } else {\r\n MessageService.alert(\r\n TranslateService('error'),\r\n TranslateService('danfe-duplicated', codBarras)\r\n ).then(reject);\r\n }\r\n }\r\n } else {\r\n resolve({\r\n mes: codBarras.substr(4, 2),\r\n ano: codBarras.substr(2, 2),\r\n numDanfe: codBarras.substr(25, 9)\r\n });\r\n }\r\n })\r\n .catch(reject);\r\n });\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('DivergenciaService', DivergenciaService);\r\n\r\n DivergenciaService.$inject = [\r\n 'RegAnomaliaModel',\r\n 'ModalService',\r\n '$document',\r\n '$q',\r\n '$state',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function DivergenciaService(\r\n TurnoModel,\r\n ModalService,\r\n $document,\r\n Promise,\r\n $state,\r\n SelTurnoService,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n //Propriedades privadas\r\n var modal = new ModalService({\r\n templateUrl: 'Divergencia.html',\r\n controller: 'DivergenciaController',\r\n controllerAs: 'Divergencia'\r\n });\r\n\r\n //Propriedades públicas\r\n var DivergenciaService = {};\r\n\r\n //Métodos privados\r\n\r\n //Métodos publicos\r\n function abrir() {\r\n \r\n return modal.open();\r\n } \r\n \r\n\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n\r\n })();\r\n\r\n\r\n return DivergenciaService;\r\n }\r\n\r\n})();","(function () {\r\n\r\n angular.module('posto-facil').factory('ExportCsv', ExportCsv);\r\n function ExportCsv() {\r\n return function (dados, dscTitulo) {\r\n\r\n var csvContent = \"\";\r\n var cabecalho = \"\";\r\n var first = true;\r\n\r\n dados.forEach(function (objeto, index) {\r\n\r\n var dataString = \"\";\r\n for (key in objeto) {\r\n if (first) {\r\n cabecalho += key.replace(\"_\", \" \") + \";\";\r\n }\r\n dataString += objeto[key] + \";\";\r\n }\r\n if (first) {\r\n cabecalho += \"\\r\\n\";\r\n }\r\n first = false;\r\n csvContent += index < dados.length ? dataString + \"\\r\\n\" : dataString;\r\n\r\n });\r\n\r\n csvContent = \"\\uFEFF\" + cabecalho + csvContent;\r\n\r\n if (window.navigator.msSaveOrOpenBlob) {\r\n var blob = new Blob([decodeURIComponent(encodeURI(csvContent))], {\r\n type: \"text/csv;charset=utf-8;\"\r\n });\r\n navigator.msSaveBlob(blob, (dscTitulo || 'base') + '.csv');\r\n } else {\r\n\r\n var blob = new Blob([csvContent], {\r\n type: \"text/csv;charset=utf-8;\"\r\n });\r\n\r\n var a = document.createElement('a');\r\n a.href = window.URL.createObjectURL(blob);\r\n a.target = '_blank';\r\n a.download = (dscTitulo || 'base') + '.csv';\r\n\r\n document.body.appendChild(a);\r\n a.click();\r\n }\r\n }\r\n };\r\n\r\n})()","(function () {\r\n\r\n angular.module('posto-facil').factory('ExportOperationCsv', ExportOperationCsv);\r\n \r\n function ExportOperationCsv() {\r\n return function (dados, dscTitulo) {\r\n var csvContent = \"\";\r\n dados.forEach(function (objeto, index) {\r\n var dataString = \"\";\r\n for (key in objeto) {\r\n dataString += objeto[key] + \";\";\r\n }\r\n csvContent += index < dados.length ? dataString + \"\\r\\n\" : dataString;\r\n });\r\n\r\n csvContent = \"\\uFEFF\" + csvContent;\r\n\r\n if (window.navigator.msSaveOrOpenBlob) {\r\n var blob = new Blob([decodeURIComponent(encodeURI(csvContent))], {\r\n type: \"text/csv;charset=utf-8;\"\r\n });\r\n navigator.msSaveBlob(blob, (dscTitulo || 'base') + '.csv');\r\n } else {\r\n\r\n var blob = new Blob([csvContent], {\r\n type: \"text/csv;charset=utf-8;\"\r\n });\r\n\r\n var a = document.createElement('a');\r\n a.href = window.URL.createObjectURL(blob);\r\n a.target = '_blank';\r\n a.download = (dscTitulo || 'base') + '.csv';\r\n\r\n document.body.appendChild(a);\r\n a.click();\r\n }\r\n }\r\n };\r\n\r\n})()","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('FileReaderService', FileReaderService);\r\n\r\n FileReaderService.$inject = [\r\n '$q'\r\n ];\r\n\r\n function FileReaderService(\r\n $q\r\n ) {\r\n\r\n return {\r\n readAsText: function (file) {\r\n return new $q(function (resolve, reject) {\r\n var reader = new FileReader();\r\n reader.onerror = reject;\r\n\r\n if (TextDecoder) {\r\n reader.onload = function () {\r\n var text = decodeText(reader.result);\r\n\r\n resolve({\r\n name: file.name.replace('.csv', ''),\r\n content: text\r\n });\r\n };\r\n\r\n reader.readAsArrayBuffer(file);\r\n } else {\r\n\r\n reader.onload = function () {\r\n resolve({\r\n name: file.name.replace('.csv', ''),\r\n content: reader.result\r\n });\r\n };\r\n\r\n reader.readAsText(file);\r\n }\r\n });\r\n }\r\n }\r\n\r\n }\r\n\r\n})();\r\n\r\nfunction decodeText(readerResult) {\r\n // https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder\r\n var possibleEncodings = [\r\n \"utf-8\",\r\n \"windows-1252\"\r\n // \"unicode-1-1-utf-8\",\r\n // \"utf8\",\r\n // \"866\",\r\n // \"cp866\",\r\n // \"csibm866\",\r\n // \"ibm866\",\r\n // \"csisolatin2\",\r\n // \"iso-8859-2\",\r\n // \"iso-ir-101\",\r\n // \"iso8859-2\",\r\n // \"iso88592\",\r\n // \"iso_8859-2\",\r\n // \"iso_8859-2:1987\",\r\n // \"l2\",\r\n // \"latin2\",\r\n // \"csisolatin3\",\r\n // \"iso-8859-3\",\r\n // \"iso-ir-109\",\r\n // \"iso8859-3\",\r\n // \"iso88593\",\r\n // \"iso_8859-3\",\r\n // \"iso_8859-3:1988\",\r\n // \"l3\",\r\n // \"latin3\",\r\n // \"csisolatin4\",\r\n // \"iso-8859-4\",\r\n // \"iso-ir-110\",\r\n // \"iso8859-4\",\r\n // \"iso88594\",\r\n // \"iso_8859-4\",\r\n // \"iso_8859-4:1988\",\r\n // \"l4\",\r\n // \"latin4\",\r\n // \"csisolatincyrillic\",\r\n // \"cyrillic\",\r\n // \"iso-8859-5\",\r\n // \"iso-ir-144\",\r\n // \"iso88595\",\r\n // \"iso_8859-5\",\r\n // \"iso_8859-5:1988\",\r\n // \"arabic\",\r\n // \"asmo-708\",\r\n // \"csiso88596e\",\r\n // \"csiso88596i\",\r\n // \"csisolatinarabic\",\r\n // \"ecma-114\",\r\n // \"iso-8859-6\",\r\n // \"iso-8859-6-e\",\r\n // \"iso-8859-6-i\",\r\n // \"iso-ir-127\",\r\n // \"iso8859-6\",\r\n // \"iso88596\",\r\n // \"iso_8859-6\",\r\n // \"iso_8859-6:1987\",\r\n // \"csisolatingreek\",\r\n // \"ecma-118\",\r\n // \"elot_928\",\r\n // \"greek\",\r\n // \"greek8\",\r\n // \"iso-8859-7\",\r\n // \"iso-ir-126\",\r\n // \"iso8859-7\",\r\n // \"iso88597\",\r\n // \"iso_8859-7\",\r\n // \"iso_8859-7:1987\",\r\n // \"sun_eu_greek\",\r\n // \"csiso88598e\",\r\n // \"csisolatinhebrew\",\r\n // \"hebrew\",\r\n // \"iso-8859-8\",\r\n // \"iso-8859-8-e\",\r\n // \"iso-ir-138\",\r\n // \"iso8859-8\",\r\n // \"iso88598\",\r\n // \"iso_8859-8\",\r\n // \"iso_8859-8:1988\",\r\n // \"visual\",\r\n // \"csiso88598i\",\r\n // \"iso-8859-8-i\",\r\n // \"logical\",\r\n // \"csisolatin6\",\r\n // \"iso-8859-10\",\r\n // \"iso-ir-157\",\r\n // \"iso8859-10\",\r\n // \"iso885910\",\r\n // \"l6\",\r\n // \"latin6\",\r\n // \"iso-8859-13\",\r\n // \"iso8859-13\",\r\n // \"iso885913\",\r\n // \"iso-8859-14\",\r\n // \"iso8859-14\",\r\n // \"iso885914\",\r\n // \"csisolatin9\",\r\n // \"iso-8859-15\",\r\n // \"iso8859-15\",\r\n // \"iso885915\",\r\n // \"l9\",\r\n // \"latin9\",\r\n // \"iso-8859-16\",\r\n // \"cskoi8r\",\r\n // \"koi\",\r\n // \"koi8\",\r\n // \"koi8-r\",\r\n // \"koi8_r\",\r\n // \"koi8-u\",\r\n // \"csmacintosh\",\r\n // \"mac\",\r\n // \"macintosh\",\r\n // \"x-mac-roman\",\r\n // \"dos-874\",\r\n // \"iso-8859-11\",\r\n // \"iso8859-11\",\r\n // \"iso885911\",\r\n // \"tis-620\",\r\n // \"windows-874\",\r\n // \"cp1250\",\r\n // \"windows-1250\",\r\n // \"x-cp1250\",\r\n // \"cp1251\",\r\n // \"windows-1251\",\r\n // \"x-cp1251\",\r\n // \"ansi_x3.4-1968\",\r\n // \"ascii\",\r\n // \"cp1252\",\r\n // \"cp819\",\r\n // \"csisolatin1\",\r\n // \"ibm819\",\r\n // \"iso-8859-1\",\r\n // \"iso-ir-100\",\r\n // \"iso8859-1\",\r\n // \"iso88591\",\r\n // \"iso_8859-1\",\r\n // \"iso_8859-1:1987\",\r\n // \"l1\",\r\n // \"latin1\",\r\n // \"us-ascii\",\r\n // \"x-cp1252\",\r\n // \"cp1253\",\r\n // \"windows-1253\",\r\n // \"x-cp1253\",\r\n // \"cp1254\",\r\n // \"csisolatin5\",\r\n // \"iso-8859-9\",\r\n // \"iso-ir-148\",\r\n // \"iso8859-9\",\r\n // \"iso88599\",\r\n // \"iso_8859-9\",\r\n // \"iso_8859-9:1989\",\r\n // \"l5\",\r\n // \"latin5\",\r\n // \"windows-1254\",\r\n // \"x-cp1254\",\r\n // \"cp1255\",\r\n // \"windows-1255\",\r\n // \"x-cp1255\",\r\n // \"cp1256\",\r\n // \"windows-1256\",\r\n // \"x-cp1256\",\r\n // \"cp1257\",\r\n // \"windows-1257\",\r\n // \"x-cp1257\",\r\n // \"cp1258\",\r\n // \"windows-1258\",\r\n // \"x-cp1258\",\r\n // \"x-mac-cyrillic\",\r\n // \"x-mac-ukrainian\",\r\n // \"chinese\",\r\n // \"csgb2312\",\r\n // \"csiso58gb231280\",\r\n // \"gb2312\",\r\n // \"gb_2312\",\r\n // \"gb_2312-80\",\r\n // \"gbk\",\r\n // \"iso-ir-58\",\r\n // \"x-gbk\",\r\n // \"gb18030\",\r\n // \"hz-gb-2312\",\r\n // \"big5\",\r\n // \"big5-hkscs\",\r\n // \"cn-big5\",\r\n // \"csbig5\",\r\n // \"x-x-big5\",\r\n // \"cseucpkdfmtjapanese\",\r\n // \"euc-jp\",\r\n // \"x-euc-jp\",\r\n // \"csiso2022jp\",\r\n // \"iso-2022-jp\",\r\n // 'iso-2022-jp',\r\n // \"csshiftjis\",\r\n // \"ms_kanji\",\r\n // \"shift-jis\",\r\n // \"shift_jis\",\r\n // \"sjis\",\r\n // \"windows-31j\",\r\n // \"x-sjis\",\r\n // \"cseuckr\",\r\n // \"csksc56011987\",\r\n // \"euc-kr\",\r\n // \"iso-ir-149\",\r\n // \"korean\",\r\n // \"ks_c_5601-1987\",\r\n // \"ks_c_5601-1989\",\r\n // \"ksc5601\",\r\n // \"ksc_5601\",\r\n // \"windows-949\",\r\n // \"csiso2022kr\",\r\n // \"iso-2022-kr\",\r\n // \"utf-16be\",\r\n // \"utf-16\",\r\n // \"utf-16le\",\r\n // \"x-user-defined\",\r\n // \"iso-2022-cn\",\r\n // \"iso-2022-cn-ext\"\r\n ];\r\n var text = null;\r\n var index = 0;\r\n\r\n (function tryRead(encoding) {\r\n try {\r\n if (!encoding) return;\r\n text = (new TextDecoder(encoding, { fatal: true })).decode(readerResult);\r\n }\r\n catch (error) {\r\n tryRead(possibleEncodings[++index]);\r\n }\r\n })(possibleEncodings[index]);\r\n\r\n return text || (new TextDecoder()).decode(readerResult);\r\n}\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('FocusService', FocusService);\r\n FocusService.$inject = [\r\n '$rootScope',\r\n '$timeout'\r\n ];\r\n\r\n function FocusService($rootScope, $timeout) {\r\n return function (name) {\r\n $timeout(function () {\r\n $rootScope.$broadcast('focusOn', name);\r\n });\r\n };\r\n }\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('GeneralService', GeneralService);\r\n GeneralService.$inject = [\r\n '$uibModalInstance'\r\n ];\r\n\r\n function GeneralService($uibModalInstance) {\r\n return {\r\n teste: $uibModalInstance.close\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('getValueInPath', getValueInPath);\r\n\r\n getValueInPath.$inject = [\r\n '$filter'\r\n ];\r\n\r\n function getValueInPath(\r\n $filter\r\n ) {\r\n\r\n return function getValueInPath(obj, path) {\r\n var path = path.split(\".\");\r\n var retorno = {\r\n key: path,\r\n value: obj\r\n };\r\n\r\n for (var i = 0; i < path.length; i++) {\r\n retorno.value = formatDate(retorno.value ? retorno.value[path[i]] : null);\r\n retorno.key = path[i];\r\n }\r\n\r\n return retorno;\r\n }\r\n\r\n function formatDate(date) {\r\n if (!(date instanceof Date)) return date;\r\n return $filter(\"date\")(date, \"dd/MM/yyyy HH:mm\");\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('IsOnLineService', IsOnLineService);\r\n\r\n IsOnLineService.$inject = [\r\n '$http',\r\n 'Constant',\r\n '$q'\r\n ];\r\n\r\n function IsOnLineService(\r\n $http,\r\n Constant,\r\n $q\r\n ) {\r\n\r\n return function () {\r\n\r\n if (!navigator.onLine) {\r\n return $q.reject();\r\n }\r\n\r\n return $http({\r\n method: 'GET',\r\n url: 'ping.json',\r\n timeout: Constant.PING_TIMEOUT\r\n });\r\n };\r\n }\r\n\r\n})();","(function() {\r\n \"use strict\";\r\n\r\n angular.module(\"posto-facil\").factory(\"MenusService\", MenusService);\r\n MenusService.$inject = [\"$state\", \"PrivilegesService\", \"$http\"];\r\n\r\n function MenusService($state, PrivilegesService, $http) {\r\n var menus = $state\r\n .get()\r\n .filter(function(state) {\r\n return state.menu;\r\n })\r\n .filter(function(state) {\r\n return PrivilegesService.includes(state.privilege);\r\n })\r\n .reduce(function(menu, state) {\r\n menu[state.menu] = menu[state.menu] || [];\r\n menu[state.menu].push(state);\r\n return menu;\r\n }, {});\r\n\r\n $http\r\n .get(\"../server/mobileServer/_relatorios.ashx\")\r\n .then(function(resposta) {\r\n menus.relatorios = resposta.data.map(function(relatorio) {\r\n return {\r\n name: relatorio.DscTitulo,\r\n href: \"../relatorios/relatorio.html#/\" + relatorio.CodRelatorio\r\n };\r\n });\r\n });\r\n\r\n return menus;\r\n }\r\n})();\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('MessageService', MessageService);\r\n MessageService.$inject = [\r\n 'MessageModel',\r\n 'ModalService',\r\n 'TranslateService'\r\n ];\r\n\r\n function MessageService(\r\n MessageModel,\r\n ModalService,\r\n TranslateService\r\n ) {\r\n var messages = [];\r\n\r\n /**\r\n * Mostra a última mensagem do RTDB no servidor\r\n * TODO - Essa função deve ser retirada quando as respostas do servidor passarem a não utilizar o RTDB mais\r\n * \r\n * @param {string} type Tipo de mensagem (Erro, Sucesso) para mostrar mensagem genérica offline\r\n */\r\n function showMessage(type) {\r\n return MessageModel.getMessages(type).then(function (retorno) {\r\n if (retorno.data && retorno.data.length) {\r\n messages = messages.concat(retorno.data);\r\n var alarm = retorno.data[0];\r\n var mensagem = alarm.AlarmMessage;\r\n var titulo = alarm.AlarmStatus ? TranslateService('success') : TranslateService('error');\r\n ModalService.alert(titulo, mensagem);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Função para adicionar a mensagem exibida na lista de mensagens utilizada pela tela de mensagens\r\n * @param {string} type Tipo da mensagem\r\n * @param {string} text Texto da mensagem\r\n */\r\n function storeMessage(type, text) {\r\n var msg = {\r\n \"AlarmDateTime\": new Date(),\r\n \"AlarmGroupFmt\": \"GEN\",\r\n \"AlarmStatus\": true,\r\n \"AlarmStatusFmt\": type || 'Geral',\r\n \"AlarmMessage\": text\r\n };\r\n\r\n messages.push(msg);\r\n }\r\n\r\n /**\r\n * Função de alerta que mantem as mensagens exibidas em memória para apresentar na tela de mensagens.\r\n * \r\n * @param {string} title \r\n * @param {string} text \r\n * @param {number} timeout \r\n * @param {string} type \r\n */\r\n function alert(title, text, timeout, type) {\r\n\r\n var textAux = text;\r\n if (typeof text === \"object\" && text.data) {\r\n if (typeof text.data === \"string\") {\r\n textAux = text.data;\r\n } else if (typeof text.data === \"object\") {\r\n textAux = extractMessages(text.data);\r\n }\r\n }\r\n text = textAux;\r\n\r\n storeMessage(type, text);\r\n\r\n\r\n return ModalService.alert(title, text, timeout);\r\n }\r\n\r\n function extractMessages(exc) {\r\n var message = '';\r\n if (exc.Message) {\r\n message += exc.Message;\r\n message += ' ';\r\n if (exc.InnerException) {\r\n message += extractMessages(exc.InnerException);\r\n }\r\n } else {\r\n message = JSON.stringify(exc);\r\n }\r\n return message;\r\n }\r\n\r\n /**\r\n * Função para mostra mensagem para o usuário com opção de \"ok\" e \"cancelar\"\r\n * @param {string} title Título a ser apresentado no componente de alerta\r\n * @param {string} text Texto da mensagem\r\n * @param {string} type Tipo da mensagem\r\n */\r\n function prompt(title, text, type) {\r\n storeMessage(type, text);\r\n return ModalService.prompt(title, text);\r\n }\r\n\r\n return {\r\n showMessage: showMessage,\r\n alert: alert,\r\n prompt: prompt,\r\n messages: messages\r\n };\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ModalService', ModalService);\r\n ModalService.$inject = [\r\n '$uibModal',\r\n '$document',\r\n 'TranslateService'\r\n ];\r\n\r\n function ModalService(\r\n $uibModal,\r\n $document,\r\n TranslateService\r\n ) {\r\n function Modal(config) {\r\n this.config = angular.extend({\r\n animation: true,\r\n ariaLabelledBy: 'modal-title',\r\n ariaDescribedBy: 'modal-body',\r\n appendTo: $document.body,\r\n backdrop: 'static',\r\n keyboard: false\r\n }, config);\r\n this.instance = null;\r\n this.open = function (resolveObject) {\r\n if (resolveObject) {\r\n this.config.resolve = resolveObject;\r\n }\r\n this.instance = $uibModal.open(this.config);\r\n\r\n return this.instance.result.then(function (response) {\r\n return response;\r\n });\r\n };\r\n this.open = this.open.bind(this);\r\n }\r\n\r\n //Função para fazer simples alerts\r\n Modal.alert = function (title, text, timeout) {\r\n if (!text) {\r\n text = title;\r\n title = TranslateService('atention');\r\n }\r\n\r\n var alert = new Modal({\r\n template: '
' +\r\n '

' +\r\n title +\r\n '

' +\r\n '
' +\r\n '
' +\r\n '

' +\r\n text +\r\n '

' +\r\n '
' +\r\n '
' +\r\n '' +\r\n '
',\r\n size: 'sm',\r\n controller: function () {\r\n this.ok = function () {\r\n alert.instance.close();\r\n };\r\n },\r\n controllerAs: 'alert'\r\n });\r\n\r\n alert.open();\r\n\r\n if (timeout) {\r\n setTimeout(function () {\r\n alert.instance.close();\r\n }, timeout);\r\n }\r\n\r\n return alert.instance.result;\r\n };\r\n\r\n //Função para fazer simples prompt\r\n Modal.prompt = function (title, text) {\r\n if (!text) {\r\n text = title;\r\n title = TranslateService('atention');\r\n }\r\n\r\n var prompt = new Modal({\r\n template: '
' +\r\n '

' +\r\n title +\r\n '

' +\r\n '
' +\r\n '
' +\r\n '

' +\r\n text +\r\n '

' +\r\n '
' +\r\n '
' +\r\n '' +\r\n '' +\r\n '
',\r\n size: 'sm',\r\n controller: function () {\r\n this.ok = function () {\r\n prompt.instance.close(TranslateService('modalService-fechou'));\r\n };\r\n\r\n this.cancel = function () {\r\n prompt.instance.dismiss(TranslateService('modalService-cancelou'));\r\n if(angular.element('div.container').scope().recebimentos !== undefined)\r\n angular.element('div.container').scope().recebimentos.promptCancel();\r\n };\r\n },\r\n controllerAs: 'prompt'\r\n });\r\n\r\n prompt.open();\r\n\r\n return prompt.instance.result;\r\n };\r\n\r\n return Modal;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('PrivilegesService', PrivilegesService);\r\n\r\n PrivilegesService.$inject = [\r\n 'UsuarioService'\r\n ];\r\n\r\n function PrivilegesService(\r\n UsuarioService\r\n ) {\r\n\r\n var privileges = Object.keys(UsuarioService.entityPrivilege)\r\n .map(function (key) { return UsuarioService.entityPrivilege[key]; });\r\n privileges = flatten(privileges);\r\n\r\n return privileges;\r\n }\r\n\r\n function flatten(arr) {\r\n return Array.prototype.concat.apply([], arr);\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('RegAnomaliaService', RegAnomaliaService);\r\n\r\n RegAnomaliaService.$inject = [\r\n 'RegAnomaliaModel',\r\n 'ModalService',\r\n '$document',\r\n '$q',\r\n '$state',\r\n 'SelTurnoService',\r\n 'MessageService',\r\n 'TranslateService'\r\n ];\r\n\r\n function RegAnomaliaService(\r\n TurnoModel,\r\n ModalService,\r\n $document,\r\n Promise,\r\n $state,\r\n SelTurnoService,\r\n MessageService,\r\n TranslateService\r\n ) {\r\n\r\n //Propriedades privadas\r\n var modal = new ModalService({\r\n templateUrl: 'regAnomalia.html',\r\n controller: 'RegAnomaliaController',\r\n controllerAs: 'regAnomalia'\r\n });\r\n\r\n //Propriedades públicas\r\n var RegAnomaliaService = {};\r\n\r\n //Métodos privados\r\n\r\n //Métodos publicos\r\n RegAnomaliaService.novo = function (obs, idcTblOperacao, stuAnomalia) {\r\n if (SelTurnoService.temTurnoValido()) {\r\n return modal.open({\r\n locals: {\r\n obs: obs,\r\n idcTblOperacao: idcTblOperacao,\r\n StuAnomalia: stuAnomalia\r\n }\r\n });\r\n } else {\r\n return MessageService.alert(TranslateService('atention'), TranslateService('cant-generate-anomaly-without-shift'));\r\n }\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n\r\n })();\r\n\r\n\r\n return RegAnomaliaService;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('RequestService', RequestService);\r\n RequestService.$inject = [\r\n '$q',\r\n 'Constant',\r\n '$timeout',\r\n '$httpLegacy'\r\n ];\r\n\r\n function RequestService(\r\n $q,\r\n Constant,\r\n $timeout,\r\n $http\r\n ) {\r\n function post(dados) {\r\n return $http.post(dados.url || request.url, dados)\r\n .then(function (resposta) {\r\n return resposta.data;\r\n });\r\n }\r\n\r\n function request(dados) {\r\n\r\n var hash = JSON.stringify(dados);\r\n var requesTimes = {};\r\n\r\n //Faz o request no servidor e espera 500ms para o servidor responder\r\n //Se o servidor responder dentro do tempo atualiza a tela e o banco interno com os dados do servidor\r\n //Se demorar mais do que isso atualiza a tela com os dados do banco interno e espera o servidor responder\r\n //e então atualiza o banco interno com os dados que o servidor respondeu\r\n //Caso esteja offline ou a última busca tenha sido realizada a menos de um segundo \r\n //busca direto do banco interno do browser.\r\n //sem acionar o servidor\r\n\r\n return $q(function (resolve, reject) {\r\n var timeoutPromise = null;\r\n var isResolved = false;\r\n var onLine = navigator.onLine !== false;\r\n\r\n if (requesTimes[hash] !== undefined && (new Date()).getTime() - requesTimes[hash] < 1000) {\r\n onLine = false;\r\n } else if (onLine) {\r\n requesTimes[hash] = (new Date()).getTime();\r\n }\r\n\r\n var waitingTime = onLine ? Constant.SERVER_WAITING_TIME : 0;\r\n\r\n timeoutPromise = $timeout(function () {\r\n isResolved = true;\r\n dados.funcaoGet(dados.id)\r\n .then(function (resposta) {\r\n resolve(resposta);\r\n }).catch(function (erro) {\r\n reject(erro);\r\n });\r\n }, waitingTime);\r\n\r\n if (onLine) {\r\n post(dados)\r\n .then(function (resposta) {\r\n var retorno = null;\r\n var promiseUpdate = null;\r\n if (resposta !== 'null') {\r\n promiseUpdate = dados.funcaoUpdate(resposta);\r\n retorno = dados.retornaUpdate ? promiseUpdate : resposta;\r\n }\r\n return retorno;\r\n })\r\n .then(function (retorno) {\r\n if (!isResolved) {\r\n $timeout.cancel(timeoutPromise);\r\n resolve(retorno);\r\n }\r\n })\r\n .catch(function (erro) {\r\n if (!isResolved) {\r\n reject(erro);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n request.url = null;\r\n\r\n return request;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('SelTurnoService', SelTurnoService);\r\n\r\n SelTurnoService.$inject = [\r\n 'TurnoModel',\r\n 'ModalService',\r\n '$q',\r\n '$state',\r\n 'GeneralModel',\r\n 'ConvertDate',\r\n 'TranslateService',\r\n '$http',\r\n 'MessageService'\r\n ];\r\n\r\n function SelTurnoService(\r\n TurnoModel,\r\n ModalService,\r\n Promise,\r\n $state,\r\n GeneralModel,\r\n ConvertDate,\r\n TranslateService,\r\n $http,\r\n MessageService\r\n ) {\r\n\r\n //Propriedades privadas\r\n var modal = new ModalService({\r\n templateUrl: 'selTurno.html',\r\n controller: 'SelTurnoController',\r\n controllerAs: 'selTurno'\r\n });\r\n\r\n var callbacks = {};\r\n\r\n //Propriedades públicas\r\n var selTurnoService = {};\r\n selTurnoService.turno = null;\r\n selTurnoService.canSelect = true;\r\n\r\n //Métodos privados\r\n function openModalSelecao() {\r\n return modal.open().then(function (selectedItem) {\r\n selTurnoService.turno = selectedItem;\r\n localStorage.setItem('turno', JSON.stringify(selectedItem));\r\n return selTurnoService.turno;\r\n });\r\n }\r\n\r\n function temTurnoValido(forceSelection) {\r\n\r\n if (forceSelection) {\r\n return false;\r\n }\r\n\r\n if (selTurnoService.turno) {\r\n if ($state.current.privilege === 'Visualizar_Registro_Turno') {\r\n return true;\r\n }\r\n\r\n return selTurnoService.turno.StuTurno !== 'NO';\r\n }\r\n\r\n return false;\r\n }\r\n\r\n //Métodos publicos\r\n selTurnoService.temTurnoValido = temTurnoValido;\r\n\r\n selTurnoService.selectTurno = function (forceSelection) {\r\n\r\n if (!selTurnoService.canSelect) {\r\n return MessageService.alert(\r\n TranslateService('atention'),\r\n TranslateService(\"shift-can-not-be-selected\")\r\n ).then(function () {\r\n throw new Error(TranslateService(\"shift-can-not-be-selected\"));\r\n });\r\n }\r\n\r\n //Guardo o idc atual para verificar se ao fim da operação mudou o turno selecionado\r\n var oldIdcRegTurno = selTurnoService.turno ? selTurnoService.turno.IdcRegTurno : 0;\r\n var promise;\r\n\r\n if (temTurnoValido(forceSelection)) {\r\n promise = Promise.resolve(selTurnoService.turno);\r\n } else {\r\n promise = openModalSelecao();\r\n }\r\n\r\n return promise\r\n .then(function (resposta) {\r\n // Se nesse ponto o turno mudou então atualiza os registros de equipamentos do banco interno\r\n // E seta o header default para enviar nos requests\r\n if (selTurnoService.turno && oldIdcRegTurno != selTurnoService.turno.IdcRegTurno) {\r\n\r\n $http.defaults.headers.common.IdcRegTurno = selTurnoService.turno.IdcRegTurno;\r\n\r\n GeneralModel.atualizaBancoInterno(\r\n selTurnoService.turno.IdcPosto,\r\n selTurnoService.turno.IdcRegTurno\r\n );\r\n }\r\n\r\n return resposta;\r\n })\r\n .then(function (resposta) {\r\n (callbacks[$state.current.name] || angular.noop)(selTurnoService.turno);\r\n return resposta;\r\n })\r\n .catch(function (erro) {\r\n console.log(erro);\r\n throw new Error(JSON.stringify(erro));\r\n })\r\n .finally(function () {\r\n if (!temTurnoValido()) {\r\n $state.go('home');\r\n }\r\n });\r\n };\r\n\r\n selTurnoService.getIdcRegTurno = function () {\r\n if (selTurnoService.turno && selTurnoService.turno.IdcRegTurno) {\r\n return selTurnoService.turno.IdcRegTurno;\r\n }\r\n\r\n throw new Error(TranslateService(\"no-shift-selected\"));\r\n };\r\n\r\n selTurnoService.getIdcPosto = function () {\r\n if (selTurnoService.turno && selTurnoService.turno.IdcPosto) {\r\n return selTurnoService.turno.IdcPosto;\r\n }\r\n };\r\n\r\n selTurnoService.salvarTurno = function (regTurno) {\r\n return TurnoModel.salvarTurno(regTurno)\r\n .then(function (resposta) {\r\n //Atualiza os campos do turno selecionado de acordo com a resposta\r\n selTurnoService.turno.StuTurno = resposta.StuTurno;\r\n selTurnoService.turno.IdcRegTurno = resposta.IdcRegTurno;\r\n selTurnoService.turno.DataInicial = resposta.DthInicial;\r\n selTurnoService.turno.DataFinal = resposta.DthFinal;\r\n\r\n $http.defaults.headers.common.IdcRegTurno = selTurnoService.turno.IdcRegTurno;\r\n localStorage.setItem('turno', JSON.stringify(selTurnoService.turno));\r\n\r\n GeneralModel.atualizaBancoInterno(\r\n selTurnoService.turno.IdcPosto,\r\n selTurnoService.turno.IdcRegTurno\r\n );\r\n\r\n resposta.ListaRegTurnoTanquePostoDQO.forEach(function (tanqueDQO) {\r\n //tanqueDQO.CadTanquePosto = tanque;\r\n tanqueDQO.AlturaInicialProxy = tanqueDQO.AltInicial;\r\n tanqueDQO.AlturaFinalProxy = tanqueDQO.AltFinal;\r\n });\r\n\r\n return resposta;\r\n });\r\n };\r\n\r\n selTurnoService.onChangeTurno = function (callback) {\r\n callbacks[$state.current.name] = callback;\r\n };\r\n\r\n selTurnoService.isFechado = function () {\r\n if (selTurnoService.turno && selTurnoService.turno.StuTurno !== 'FE') {\r\n return false;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n selTurnoService.checkTurnoFechado = function (callback) {\r\n if (selTurnoService.isFechado()) {\r\n MessageService.prompt(\r\n TranslateService(\"atention\"),\r\n TranslateService(\"closed-shift-edition\")\r\n ).then(function () {\r\n callback();\r\n });\r\n } else {\r\n callback();\r\n }\r\n };\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n selTurnoService.turno = ConvertDate(JSON.parse(localStorage.getItem('turno')));\r\n $http.defaults.headers.common.IdcRegTurno = selTurnoService.turno && selTurnoService.turno.IdcRegTurno;\r\n //selTurnoService.selectTurno();\r\n })();\r\n\r\n\r\n return selTurnoService;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('SpinnerService', SpinnerService);\r\n\r\n SpinnerService.$inject = [];\r\n\r\n function SpinnerService() {\r\n\r\n //Propriedades privadas\r\n var opts = {\r\n lines: 13, // The number of lines to draw\r\n length: 28, // The length of each line\r\n width: 14, // The line thickness\r\n radius: 42, // The radius of the inner circle\r\n scale: 1, // Scales overall size of the spinner\r\n corners: 1, // Corner roundness (0..1)\r\n color: '#fff', // #rgb or #rrggbb or array of colors\r\n opacity: 0.25, // Opacity of the lines\r\n rotate: 0, // The rotation offset\r\n direction: 1, // 1: clockwise, -1: counterclockwise\r\n speed: 1, // Rounds per second\r\n trail: 60, // Afterglow percentage\r\n //fps: 20, // Frames per second when using setTimeout() as a fallback for CSS\r\n //zIndex: 2e9, // The z-index (defaults to 2000000000)\r\n className: 'spinner', // The CSS class to assign to the spinner\r\n //top: '50%', // Top position relative to parent\r\n //left: '50%', // Left position relative to parent\r\n shadow: false, // Whether to render a shadow\r\n hwaccel: false, // Whether to use hardware acceleration\r\n position: 'relative,' // Element positioning\r\n };\r\n\r\n //Propriedades públicas\r\n var SpinnerService = function (targetId, timeToStart) {\r\n this.targetId = targetId;\r\n this.target = targetId ? document.getElementById(this.targetId) : document.body;\r\n this.targetRetries = 0;\r\n this.spinner = new Spinner(opts);\r\n this.shouldSpin = false;\r\n this.timeToStart = timeToStart || 500;\r\n this.start = function () {\r\n if (!this.shouldSpin) {\r\n return;\r\n }\r\n\r\n if (this.target) {\r\n this.spinner.spin(this.target);\r\n } else {\r\n this.target = document.getElementById(this.targetId);\r\n if (this.targetRetries++ <= 100) {\r\n setTimeout(this.start, 100);\r\n }\r\n }\r\n };\r\n\r\n this.spin = function () {\r\n this.shouldSpin = true;\r\n setTimeout(this.start, this.timeToStart);\r\n };\r\n\r\n this.stop = function () {\r\n this.spinner.stop();\r\n this.shouldSpin = false;\r\n };\r\n\r\n this.spin = this.spin.bind(this);\r\n this.start = this.start.bind(this);\r\n this.stop = this.stop.bind(this);\r\n };\r\n\r\n //Métodos privados\r\n\r\n\r\n //Métodos publicos\r\n\r\n\r\n //Inicialização\r\n (function inicializacao() {\r\n\r\n })();\r\n\r\n return SpinnerService;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('SyncService', SyncService);\r\n\r\n SyncService.$inject = [];\r\n\r\n function SyncService() {\r\n\r\n var callbacks = {};\r\n\r\n return {\r\n addEventListener: function (eventName, callback) {\r\n callbacks[eventName] = callbacks[eventName] || [];\r\n callbacks[eventName].push(callback);\r\n },\r\n dispatchEvent: function (eventName, event) {\r\n if (!callbacks[eventName]) return;\r\n\r\n callbacks[eventName].forEach(function (cb) {\r\n cb(event);\r\n });\r\n }\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('TransitionService', TransitionService);\r\n TransitionService.$inject = [\r\n '$state',\r\n 'SelTurnoService'\r\n ];\r\n\r\n function TransitionService(\r\n $state,\r\n SelTurnoService\r\n ) {\r\n var transition = {};\r\n transition.rotasAlteradas = {};\r\n transition.updateReady = false;\r\n\r\n transition.clearCurrent = function () {\r\n SelTurnoService.canSelect = true;\r\n transition.rotasAlteradas[$state.current.name] = false;\r\n };\r\n\r\n transition.setCurrent = function () {\r\n transition.rotasAlteradas[$state.current.name] = true;\r\n };\r\n\r\n transition.marcaRotaAlterada = function (rota) {\r\n transition.rotasAlteradas[rota] = true;\r\n };\r\n\r\n return transition;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').provider('TranslateService', TranslateService);\r\n\r\n TranslateService.$inject = [];\r\n\r\n function TranslateService() {\r\n\r\n var t = this;\r\n t.language = navigator.language;\r\n t.resources = {};\r\n t.default = \"pt-BR\";\r\n\r\n t.$get = function () {\r\n return function (code) {\r\n\r\n var args = Array.from(arguments).slice(1);\r\n\r\n if (t.resources[t.language] &&\r\n t.resources[t.language][code]) {\r\n return replaceArgs(t.resources[t.language][code], args);\r\n }\r\n\r\n if (t.resources[t.default][code]) {\r\n return replaceArgs(t.resources[t.default][code], args);\r\n }\r\n\r\n return code;\r\n };\r\n };\r\n\r\n function replaceArgs(str, args) {\r\n if (!args.length) return str;\r\n\r\n return str.replace(/\\{(\\d)\\}/g, function (_, index) {\r\n return args[index];\r\n });\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('UsuarioService', UsuarioService);\r\n\r\n UsuarioService.$inject = [\r\n 'IsOnLineService',\r\n 'Constant',\r\n '$http'\r\n ];\r\n\r\n function sendToAAD() {\r\n sessionStorage.setItem('actionState', 'userLoadFailed');\r\n window.location.href = '..';\r\n return {};\r\n }\r\n\r\n function setUserHeader($http, idcUsuario) {\r\n $http.defaults.headers.common.IdcUsuario = idcUsuario;\r\n }\r\n\r\n function UsuarioService(\r\n IsOnLineService,\r\n Constant,\r\n $http\r\n ) {\r\n sessionStorage.setItem('destination', null);\r\n var user = JSON.parse(localStorage.getItem('user'));\r\n \r\n\r\n var hasUserSession = false;\r\n for (var i = 0; i < sessionStorage.length; i++) {\r\n var key = sessionStorage.key(i);\r\n \r\n if (key.includes(\"oidc.user:\")) {\r\n hasUserSession = true;\r\n }\r\n }\r\n if (!user || !hasUserSession) { return sendToAAD(); }\r\n\r\n if (user.DthLogin && new Date() - new Date(user.DthLogin) > Constant.SESSION_TIME) {\r\n return IsOnLineService().then(sendToAAD);\r\n } else if (!user.DthLogin) {\r\n user.DthLogin = new Date();\r\n }\r\n\r\n setUserHeader($http, user.indice);\r\n\r\n return user;\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ValidacaoService', ValidacaoService);\r\n ValidacaoService.$inject = [\r\n 'SelTurnoService',\r\n 'TranslateService'\r\n ];\r\n\r\n function ValidacaoService(\r\n SelTurnoService,\r\n TranslateService\r\n ) {\r\n\r\n //Propriedades privadas\r\n var _validacao = {};\r\n var _messages = {\r\n validaEncerrante: TranslateService('counter-error'),\r\n validaHorimetro: TranslateService('engine-hours-error'),\r\n required: TranslateService('required'),\r\n pattern: TranslateService('format') + '{formato}. ',\r\n time: TranslateService('time-msg'),\r\n min: TranslateService('min-msg') + ' ({ng-min}). ',\r\n max: TranslateService('max-msg') + ' ({ng-max}). ',\r\n number: TranslateService('number-msg'),\r\n minlength: TranslateService('minlength') + ' {ng-minlength}.',\r\n maxlength: TranslateService('maxlength') + ' {ng-maxlength}.'\r\n };\r\n\r\n //Métodos Públicos\r\n\r\n\r\n //retorna true se os valores dos campos forem suportados pela base de dados\r\n _validacao.BaseMaxSize = function (form) {\r\n function verifyValue(valElement, valMaxBase) {\r\n if (parseFloat(valElement) > parseFloat(valMaxBase)) {\r\n return false;\r\n } else return true;\r\n }\r\n\r\n var elements = [];\r\n\r\n if (form !== undefined)\r\n elements = $('[name=\"' + form + '\"]').find('[max-base]');\r\n else\r\n elements = angular.element('[max-base]');\r\n\r\n //se não há elementos\r\n if (elements.length === 0)\r\n return true;\r\n\r\n //se tem um só não percorre uma lista\r\n if (elements.length === 1) {\r\n return verifyValue(elements.val(), elements.attr('max-base'));\r\n }\r\n\r\n for (var i = 0; i < elements.length; i++) {\r\n var e = elements[i];\r\n var maxValue = angular.element(e).attr('max-base');\r\n var Value = angular.element(e).val();\r\n if (verifyValue(Value, maxValue) === false) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n };\r\n _validacao.getPatternEncerrante = function (bloco) {\r\n if (!bloco) return /\\d+/;\r\n var regex = new RegExp(\"^(\\\\d{1,NumDigitos})?((\\\\.|,)\\\\d{0,NumCasasDecimais})?$\"\r\n .replace('NumDigitos', bloco.NumDigitos - bloco.NumCasasDecimais)\r\n .replace('NumCasasDecimais', bloco.NumCasasDecimais));\r\n return regex;\r\n };\r\n\r\n _validacao.validaExpiracao = function (date) {\r\n if (!date) return true;\r\n return date > (new Date);\r\n }\r\n\r\n\r\n _validacao.resetForm = function (form) {\r\n //form.$$element[0].reset();\r\n\r\n form.$setPristine();\r\n\r\n angular.forEach(form, function (value, key) {\r\n if (key.indexOf('$') === 0) return;\r\n form[key].$setPristine();\r\n form[key].$setUntouched();\r\n });\r\n };\r\n\r\n\r\n _validacao.shouldShowTooltip = function (campo, showAlways) {\r\n if (!campo) {\r\n return false;\r\n }\r\n\r\n var touched = campo.$touched;\r\n var dirty = campo.$dirty;\r\n var submitted = campo.$$parentForm.$submitted;\r\n var invalid = campo.$invalid;\r\n var retorno = (submitted && invalid) || (touched && invalid) || (dirty && invalid);\r\n\r\n return showAlways ? invalid : retorno;\r\n };\r\n\r\n _validacao.getMessages = function (campo) {\r\n if (!campo) {\r\n return '';\r\n }\r\n\r\n var mensagem = '';\r\n\r\n angular.forEach(campo.$error, function (value, key) {\r\n var atributeMessage = campo.$$attr.$normalize('msg-' + key);\r\n\r\n mensagem += (campo.$$attr[atributeMessage] || _messages[key] || '').replace(/{([\\w|-]+)}/g, function (match, cap1) {\r\n return campo.$$attr[campo.$$attr.$normalize(cap1)] || '';\r\n });\r\n });\r\n\r\n return mensagem;\r\n };\r\n\r\n _validacao.validaEncerrante = function (encerrante, encerranteEsperado, NumToleranciaAcima, NumToleranciaAbaixo) {\r\n var validado = true;\r\n var limiteInferior;\r\n var limiteSuperior;\r\n\r\n if (encerranteEsperado) {\r\n\r\n limiteInferior = encerranteEsperado - NumToleranciaAbaixo;\r\n limiteSuperior = encerranteEsperado + NumToleranciaAcima;\r\n\r\n validado = encerrante >= limiteInferior && encerrante <= limiteSuperior;\r\n }\r\n\r\n return validado;\r\n };\r\n\r\n _validacao.getFormatoEncerrante = function (bloco) {\r\n if (!bloco) return 'númerico';\r\n\r\n var formato = '';\r\n for (var i = 0; i < (bloco.NumDigitos - bloco.NumCasasDecimais); i++) {\r\n formato += '9';\r\n }\r\n\r\n if (bloco.NumCasasDecimais > 0) {\r\n formato += ',';\r\n for (var j = 0; j < bloco.NumCasasDecimais; j++) {\r\n formato += '9';\r\n }\r\n }\r\n return formato;\r\n };\r\n\r\n _validacao.changeTime = function (obj, prop) {\r\n if (!obj[prop]) return;\r\n\r\n var tempDate = angular.copy(obj[prop]);\r\n var dthInicial = SelTurnoService.turno ? SelTurnoService.turno.DataInicial : new Date();\r\n var dthFinal = SelTurnoService.turno ? SelTurnoService.turno.DataFinal : new Date();\r\n\r\n if (dthInicial.getDate() === dthFinal.getDate() &&\r\n tempDate.getDate() === dthInicial.getDate() &&\r\n tempDate.getMonth() === dthInicial.getMonth() &&\r\n tempDate.getFullYear() === dthInicial.getFullYear()) {\r\n return;\r\n }\r\n\r\n if (tempDate.getHours() >= dthInicial.getHours()) {\r\n tempDate.setDate(dthInicial.getDate());\r\n tempDate.setMonth(dthInicial.getMonth());\r\n tempDate.setFullYear(dthInicial.getFullYear());\r\n } else if (tempDate.getHours() <= dthFinal.getHours()) {\r\n tempDate.setDate(dthFinal.getDate());\r\n tempDate.setMonth(dthFinal.getMonth());\r\n tempDate.setFullYear(dthFinal.getFullYear());\r\n } else {\r\n // Nesse caso o horário está fora do turno\r\n tempDate.setDate(dthFinal.getDate());\r\n tempDate.setMonth(dthFinal.getMonth());\r\n tempDate.setFullYear(dthFinal.getFullYear());\r\n }\r\n\r\n obj[prop] = tempDate;\r\n };\r\n\r\n _validacao.newChangeTime = function (obj, prop) {\r\n if (!obj[prop]) return;\r\n\r\n var dthInicial = null;\r\n var dthFinal = null;\r\n var tempDate = angular.copy(obj[prop]);\r\n var turnoDthInicial = SelTurnoService.turno ? SelTurnoService.turno.DataInicial : new Date();\r\n var turnoDthFinal = SelTurnoService.turno ? SelTurnoService.turno.DataFinal : new Date();\r\n if(prop == \"DthInicial\" || prop == \"DataHoraUTCInicioRetiradaOrigem\"){\r\n dthInicial = obj[prop] >= turnoDthInicial ? obj[prop] : turnoDthInicial;\r\n dthInicial = dthInicial >= turnoDthFinal ? turnoDthFinal : dthInicial;\r\n }else{\r\n dthInicial = turnoDthInicial;\r\n }\r\n \r\n if(prop == \"DthFinal\" || prop == \"DataHoraUTCFimRetiradaOrigem\"){\r\n dthFinal = obj[prop] <= turnoDthFinal ? obj[prop] : turnoDthFinal;\r\n dthFinal = dthFinal <= turnoDthInicial ? turnoDthInicial : dthFinal;\r\n }else{\r\n dthFinal = turnoDthFinal;\r\n }\r\n\r\n if (dthInicial.getDate() === dthFinal.getDate() &&\r\n tempDate.getDate() === dthInicial.getDate() &&\r\n tempDate.getMonth() === dthInicial.getMonth() &&\r\n tempDate.getFullYear() === dthInicial.getFullYear()) {\r\n return;\r\n }\r\n\r\n if (tempDate <= dthInicial) {\r\n tempDate.setDate(dthInicial.getDate());\r\n tempDate.setMonth(dthInicial.getMonth());\r\n tempDate.setFullYear(dthInicial.getFullYear());\r\n tempDate.setHours(dthInicial.getHours());\r\n tempDate.setMinutes(dthInicial.getMinutes());\r\n } \r\n if (tempDate >= dthFinal) {\r\n tempDate.setDate(dthFinal.getDate());\r\n tempDate.setMonth(dthFinal.getMonth());\r\n tempDate.setFullYear(dthFinal.getFullYear());\r\n tempDate.setHours(dthFinal.getHours());\r\n tempDate.setMinutes(dthFinal.getMinutes());\r\n } \r\n\r\n obj[prop] = tempDate;\r\n };\r\n\r\n _validacao.getNowTurno = function () {\r\n var now = { date: new Date() };\r\n var dataTurno = SelTurnoService.turno ? SelTurnoService.turno.DataInicial : new Date();\r\n\r\n now.date.setDate(dataTurno.getDate());\r\n now.date.setMonth(dataTurno.getMonth());\r\n now.date.setFullYear(dataTurno.getFullYear());\r\n\r\n _validacao.changeTime(now, 'date');\r\n\r\n return new Date(\r\n now.date.getFullYear(),\r\n now.date.getMonth(),\r\n now.date.getDate(),\r\n now.date.getHours(),\r\n now.date.getMinutes()\r\n );\r\n };\r\n\r\n _validacao.getNowTurnoMaisUmMinuto = function () {\r\n var data = _validacao.getNowTurno();\r\n data.setMinutes(data.getMinutes() + 1);\r\n return data;\r\n };\r\n\r\n _validacao.round = function (number, decimalPlaces) {\r\n decimalPlaces = decimalPlaces || 1;\r\n var fator = Math.pow(10, decimalPlaces);\r\n return Math.round(number * fator) / fator;\r\n };\r\n\r\n _validacao.getMaxDayOfMonth = function (date) {\r\n if (!(date && date instanceof Date)) {\r\n return;\r\n }\r\n return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();\r\n };\r\n\r\n return _validacao;\r\n }\r\n\r\n})();","// Production steps of ECMA-262, Edition 6, 22.1.2.1\r\nif (!Array.from) {\r\n Array.from = (function () {\r\n var toStr = Object.prototype.toString;\r\n var isCallable = function (fn) {\r\n return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\r\n };\r\n var toInteger = function (value) {\r\n var number = Number(value);\r\n if (isNaN(number)) { return 0; }\r\n if (number === 0 || !isFinite(number)) { return number; }\r\n return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\r\n };\r\n var maxSafeInteger = Math.pow(2, 53) - 1;\r\n var toLength = function (value) {\r\n var len = toInteger(value);\r\n return Math.min(Math.max(len, 0), maxSafeInteger);\r\n };\r\n\r\n // The length property of the from method is 1.\r\n return function from(arrayLike/*, mapFn, thisArg */) {\r\n // 1. Let C be the this value.\r\n var C = this;\r\n\r\n // 2. Let items be ToObject(arrayLike).\r\n var items = Object(arrayLike);\r\n\r\n // 3. ReturnIfAbrupt(items).\r\n if (arrayLike == null) {\r\n throw new TypeError('Array.from requires an array-like object - not null or undefined');\r\n }\r\n\r\n // 4. If mapfn is undefined, then let mapping be false.\r\n var mapFn = arguments.length > 1 ? arguments[1] : void undefined;\r\n var T;\r\n if (typeof mapFn !== 'undefined') {\r\n // 5. else\r\n // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\r\n if (!isCallable(mapFn)) {\r\n throw new TypeError('Array.from: when provided, the second argument must be a function');\r\n }\r\n\r\n // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.\r\n if (arguments.length > 2) {\r\n T = arguments[2];\r\n }\r\n }\r\n\r\n // 10. Let lenValue be Get(items, \"length\").\r\n // 11. Let len be ToLength(lenValue).\r\n var len = toLength(items.length);\r\n\r\n // 13. If IsConstructor(C) is true, then\r\n // 13. a. Let A be the result of calling the [[Construct]] internal method \r\n // of C with an argument list containing the single item len.\r\n // 14. a. Else, Let A be ArrayCreate(len).\r\n var A = isCallable(C) ? Object(new C(len)) : new Array(len);\r\n\r\n // 16. Let k be 0.\r\n var k = 0;\r\n // 17. Repeat, while k < len… (also steps a - h)\r\n var kValue;\r\n while (k < len) {\r\n kValue = items[k];\r\n if (mapFn) {\r\n A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);\r\n } else {\r\n A[k] = kValue;\r\n }\r\n k += 1;\r\n }\r\n // 18. Let putStatus be Put(A, \"length\", len, true).\r\n A.length = len;\r\n // 20. Return A.\r\n return A;\r\n };\r\n }());\r\n}","if (!Array.prototype.every) {\r\n Array.prototype.every = function (callbackfn, thisArg) {\r\n 'use strict';\r\n var T, k;\r\n\r\n if (this == null) {\r\n throw new TypeError('this is null or not defined');\r\n }\r\n\r\n // 1. Let O be the result of calling ToObject passing the this \r\n // value as the argument.\r\n var O = Object(this);\r\n\r\n // 2. Let lenValue be the result of calling the Get internal method\r\n // of O with the argument \"length\".\r\n // 3. Let len be ToUint32(lenValue).\r\n var len = O.length >>> 0;\r\n\r\n // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.\r\n if (typeof callbackfn !== 'function') {\r\n throw new TypeError();\r\n }\r\n\r\n // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.\r\n if (arguments.length > 1) {\r\n T = thisArg;\r\n }\r\n\r\n // 6. Let k be 0.\r\n k = 0;\r\n\r\n // 7. Repeat, while k < len\r\n while (k < len) {\r\n\r\n var kValue;\r\n\r\n // a. Let Pk be ToString(k).\r\n // This is implicit for LHS operands of the in operator\r\n // b. Let kPresent be the result of calling the HasProperty internal \r\n // method of O with argument Pk.\r\n // This step can be combined with c\r\n // c. If kPresent is true, then\r\n if (k in O) {\r\n\r\n // i. Let kValue be the result of calling the Get internal method\r\n // of O with argument Pk.\r\n kValue = O[k];\r\n\r\n // ii. Let testResult be the result of calling the Call internal method\r\n // of callbackfn with T as the this value and argument list \r\n // containing kValue, k, and O.\r\n var testResult = callbackfn.call(T, kValue, k, O);\r\n\r\n // iii. If ToBoolean(testResult) is false, return false.\r\n if (!testResult) {\r\n return false;\r\n }\r\n }\r\n k++;\r\n }\r\n return true;\r\n };\r\n}","if (!Array.prototype.filter)\r\n Array.prototype.filter = function (func, thisArg) {\r\n 'use strict';\r\n if (!((typeof func === 'Function' || typeof func === 'function') && this))\r\n throw new TypeError();\r\n\r\n var len = this.length >>> 0,\r\n res = new Array(len), // preallocate array\r\n t = this, c = 0, i = -1;\r\n if (thisArg === undefined)\r\n while (++i !== len)\r\n // checks to see if the key was set\r\n if (i in this)\r\n if (func(t[i], i, t))\r\n res[c++] = t[i];\r\n else\r\n while (++i !== len)\r\n // checks to see if the key was set\r\n if (i in this)\r\n if (func.call(thisArg, t[i], i, t))\r\n res[c++] = t[i];\r\n\r\n res.length = c; // shrink down array to proper size\r\n return res;\r\n };","// https://tc39.github.io/ecma262/#sec-array.prototype.find\r\nif (!Array.prototype.find) {\r\n Object.defineProperty(Array.prototype, 'find', {\r\n value: function (predicate) {\r\n // 1. Let O be ? ToObject(this value).\r\n if (this == null) {\r\n throw new TypeError('\"this\" is null or not defined');\r\n }\r\n\r\n var o = Object(this);\r\n\r\n // 2. Let len be ? ToLength(? Get(O, \"length\")).\r\n var len = o.length >>> 0;\r\n\r\n // 3. If IsCallable(predicate) is false, throw a TypeError exception.\r\n if (typeof predicate !== 'function') {\r\n throw new TypeError('predicate must be a function');\r\n }\r\n\r\n // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.\r\n var thisArg = arguments[1];\r\n\r\n // 5. Let k be 0.\r\n var k = 0;\r\n\r\n // 6. Repeat, while k < len\r\n while (k < len) {\r\n // a. Let Pk be ! ToString(k).\r\n // b. Let kValue be ? Get(O, Pk).\r\n // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).\r\n // d. If testResult is true, return kValue.\r\n var kValue = o[k];\r\n if (predicate.call(thisArg, kValue, k, o)) {\r\n return kValue;\r\n }\r\n // e. Increase k by 1.\r\n k++;\r\n }\r\n\r\n // 7. Return undefined.\r\n return undefined;\r\n },\r\n configurable: true,\r\n writable: true\r\n });\r\n}","// https://tc39.github.io/ecma262/#sec-array.prototype.includes\r\nif (!Array.prototype.includes) {\r\n Object.defineProperty(Array.prototype, 'includes', {\r\n value: function (searchElement, fromIndex) {\r\n\r\n if (this == null) {\r\n throw new TypeError('\"this\" is null or not defined');\r\n }\r\n\r\n // 1. Let O be ? ToObject(this value).\r\n var o = Object(this);\r\n\r\n // 2. Let len be ? ToLength(? Get(O, \"length\")).\r\n var len = o.length >>> 0;\r\n\r\n // 3. If len is 0, return false.\r\n if (len === 0) {\r\n return false;\r\n }\r\n\r\n // 4. Let n be ? ToInteger(fromIndex).\r\n // (If fromIndex is undefined, this step produces the value 0.)\r\n var n = fromIndex | 0;\r\n\r\n // 5. If n ≥ 0, then\r\n // a. Let k be n.\r\n // 6. Else n < 0,\r\n // a. Let k be len + n.\r\n // b. If k < 0, let k be 0.\r\n var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);\r\n\r\n function sameValueZero(x, y) {\r\n return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));\r\n }\r\n\r\n // 7. Repeat, while k < len\r\n while (k < len) {\r\n // a. Let elementK be the result of ? Get(O, ! ToString(k)).\r\n // b. If SameValueZero(searchElement, elementK) is true, return true.\r\n if (sameValueZero(o[k], searchElement)) {\r\n return true;\r\n }\r\n // c. Increase k by 1. \r\n k++;\r\n }\r\n\r\n // 8. Return false\r\n return false;\r\n }\r\n });\r\n}","// Production steps of ECMA-262, Edition 5, 15.4.4.19\r\n// Reference: http://es5.github.io/#x15.4.4.19\r\nif (!Array.prototype.map) {\r\n\r\n Array.prototype.map = function (callback/*, thisArg*/) {\r\n\r\n var T, A, k;\r\n\r\n if (this == null) {\r\n throw new TypeError('this is null or not defined');\r\n }\r\n\r\n // 1. Let O be the result of calling ToObject passing the |this| \r\n // value as the argument.\r\n var O = Object(this);\r\n\r\n // 2. Let lenValue be the result of calling the Get internal \r\n // method of O with the argument \"length\".\r\n // 3. Let len be ToUint32(lenValue).\r\n var len = O.length >>> 0;\r\n\r\n // 4. If IsCallable(callback) is false, throw a TypeError exception.\r\n // See: http://es5.github.com/#x9.11\r\n if (typeof callback !== 'function') {\r\n throw new TypeError(callback + ' is not a function');\r\n }\r\n\r\n // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.\r\n if (arguments.length > 1) {\r\n T = arguments[1];\r\n }\r\n\r\n // 6. Let A be a new array created as if by the expression new Array(len) \r\n // where Array is the standard built-in constructor with that name and \r\n // len is the value of len.\r\n A = new Array(len);\r\n\r\n // 7. Let k be 0\r\n k = 0;\r\n\r\n // 8. Repeat, while k < len\r\n while (k < len) {\r\n\r\n var kValue, mappedValue;\r\n\r\n // a. Let Pk be ToString(k).\r\n // This is implicit for LHS operands of the in operator\r\n // b. Let kPresent be the result of calling the HasProperty internal \r\n // method of O with argument Pk.\r\n // This step can be combined with c\r\n // c. If kPresent is true, then\r\n if (k in O) {\r\n\r\n // i. Let kValue be the result of calling the Get internal \r\n // method of O with argument Pk.\r\n kValue = O[k];\r\n\r\n // ii. Let mappedValue be the result of calling the Call internal \r\n // method of callback with T as the this value and argument \r\n // list containing kValue, k, and O.\r\n mappedValue = callback.call(T, kValue, k, O);\r\n\r\n // iii. Call the DefineOwnProperty internal method of A with arguments\r\n // Pk, Property Descriptor\r\n // { Value: mappedValue,\r\n // Writable: true,\r\n // Enumerable: true,\r\n // Configurable: true },\r\n // and false.\r\n\r\n // In browsers that support Object.defineProperty, use the following:\r\n // Object.defineProperty(A, k, {\r\n // value: mappedValue,\r\n // writable: true,\r\n // enumerable: true,\r\n // configurable: true\r\n // });\r\n\r\n // For best browser support, use the following:\r\n A[k] = mappedValue;\r\n }\r\n // d. Increase k by 1.\r\n k++;\r\n }\r\n\r\n // 9. return A\r\n return A;\r\n };\r\n}","// Production steps of ECMA-262, Edition 5, 15.4.4.21\r\n// Reference: http://es5.github.io/#x15.4.4.21\r\n// https://tc39.github.io/ecma262/#sec-array.prototype.reduce\r\nif (!Array.prototype.reduce) {\r\n Object.defineProperty(Array.prototype, 'reduce', {\r\n value: function (callback /*, initialValue*/) {\r\n if (this === null) {\r\n throw new TypeError('Array.prototype.reduce ' +\r\n 'called on null or undefined');\r\n }\r\n if (typeof callback !== 'function') {\r\n throw new TypeError(callback +\r\n ' is not a function');\r\n }\r\n\r\n // 1. Let O be ? ToObject(this value).\r\n var o = Object(this);\r\n\r\n // 2. Let len be ? ToLength(? Get(O, \"length\")).\r\n var len = o.length >>> 0;\r\n\r\n // Steps 3, 4, 5, 6, 7 \r\n var k = 0;\r\n var value;\r\n\r\n if (arguments.length >= 2) {\r\n value = arguments[1];\r\n } else {\r\n while (k < len && !(k in o)) {\r\n k++;\r\n }\r\n\r\n // 3. If len is 0 and initialValue is not present,\r\n // throw a TypeError exception.\r\n if (k >= len) {\r\n throw new TypeError('Reduce of empty array ' +\r\n 'with no initial value');\r\n }\r\n value = o[k++];\r\n }\r\n\r\n // 8. Repeat, while k < len\r\n while (k < len) {\r\n // a. Let Pk be ! ToString(k).\r\n // b. Let kPresent be ? HasProperty(O, Pk).\r\n // c. If kPresent is true, then\r\n // i. Let kValue be ? Get(O, Pk).\r\n // ii. Let accumulator be ? Call(\r\n // callbackfn, undefined,\r\n // « accumulator, kValue, k, O »).\r\n if (k in o) {\r\n value = callback(value, o[k], k, o);\r\n }\r\n\r\n // d. Increase k by 1. \r\n k++;\r\n }\r\n\r\n // 9. Return accumulator.\r\n return value;\r\n }\r\n });\r\n}","// Production steps of ECMA-262, Edition 5, 15.4.4.17\r\n// Reference: http://es5.github.io/#x15.4.4.17\r\nif (!Array.prototype.some) {\r\n Array.prototype.some = function (fun/*, thisArg*/) {\r\n 'use strict';\r\n\r\n if (this == null) {\r\n throw new TypeError('Array.prototype.some called on null or undefined');\r\n }\r\n\r\n if (typeof fun !== 'function') {\r\n throw new TypeError();\r\n }\r\n\r\n var t = Object(this);\r\n var len = t.length >>> 0;\r\n\r\n var thisArg = arguments.length >= 2 ? arguments[1] : void 0;\r\n for (var i = 0; i < len; i++) {\r\n if (i in t && fun.call(thisArg, t[i], i, t)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n}","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('ImportService', ImportService);\r\n\r\n ImportService.$inject = [\r\n 'ExportCsv',\r\n '$http',\r\n 'ModalService',\r\n '$q',\r\n 'TranslateService',\r\n 'ExportOperationCsv',\r\n 'MessageService',\r\n '$timeout'\r\n ];\r\n\r\n function ImportService(\r\n ExportCsv,\r\n $http,\r\n ModalService,\r\n $q,\r\n TranslateService,\r\n ExportOperationCsv,\r\n MessageService,\r\n $timeout\r\n ) {\r\n\r\n var service = {};\r\n var url = '../server/mobileServer/_import.ashx';\r\n var urlOperacao = '../server/mobileServer/_operacao.ashx';\r\n var streamsURL = '../server/mobileServer/_importExport.ashx';\r\n \r\n var modalImport = new ModalService({\r\n templateUrl: 'modalImport.html',\r\n controller: 'ModalImportController',\r\n controllerAs: 'modalImport'\r\n });\r\n\r\n var modalImportStream = new ModalService({\r\n templateUrl: 'modalImport.html',\r\n controller: 'ModalImportStreamController',\r\n controllerAs: 'modalImport'\r\n });\r\n\r\n service.generateTemplate = function (table, columns) {\r\n return function () {\r\n var obj = {};\r\n for (var i in columns) {\r\n obj[columns[i]] = '';\r\n }\r\n\r\n ExportCsv([obj], table);\r\n };\r\n };\r\n\r\n service.export = function (table) {\r\n return function () {\r\n return $http.get(url, {\r\n params: { tabela: table }\r\n })\r\n .then(function (response) {\r\n ExportCsv(response.data, table);\r\n });\r\n };\r\n };\r\n\r\n service.exportTemplate = function (table) {\r\n return function () {\r\n return $http.get(urlOperacao, {\r\n params: { tabela: table }\r\n })\r\n .then(function (response) {\r\n ExportOperationCsv(response.data, table);\r\n });\r\n };\r\n };\r\n\r\n function sendToServer(table) {\r\n return function (dados) {\r\n return $q.all(chunk(dados[table], 1000).map(function (chunk) {\r\n return sendData(chunk, table);\r\n }));\r\n }\r\n }\r\n\r\n function chunk(array, maxSize) {\r\n var chunkedArray = [];\r\n for (var i = 0; i < array.length; i += maxSize) {\r\n chunkedArray.push(array.slice(i, i + maxSize));\r\n }\r\n return chunkedArray;\r\n }\r\n\r\n function sendData(dados, table) {\r\n return $http.post(url, dados, {\r\n params: { tabela: table }\r\n }).then(function (response) {\r\n var resposta = [];\r\n for (var key in response.data) {\r\n var obj = {};\r\n obj.linha = key;\r\n obj.erro = response.data[key].replace(/\\n/g, '').replace(/\\r/g, '');\r\n resposta.push(obj);\r\n }\r\n return resposta;\r\n }).then(function (resposta) {\r\n if (resposta.length) {\r\n ExportCsv(resposta, 'ERRO_' + table);\r\n }\r\n return resposta;\r\n }).catch(console.log);\r\n }\r\n\r\n function sendOperationData(entidade, operationDates) {\r\n return $http.post(urlOperacao, entidade, {\r\n params: { \r\n tabela: operationDates.operacao,\r\n dir: operationDates.diretoria,\r\n com: operationDates.complexo,\r\n uni: operationDates.unidade,\r\n pos: operationDates.posto\r\n }\r\n }).then(function (response) {\r\n response.data.reverse();\r\n var resposta = [];\r\n var obj = {};\r\n if(response.data.length == 1){\r\n var statusPrincipal = response.data[0][0];\r\n if(statusPrincipal == TranslateService(\"Oper-Reali-Sucesso\")){\r\n MessageService.alert(TranslateService('success'), TranslateService(statusPrincipal), null, \"Sucesso\");\r\n }else{\r\n MessageService.alert(TranslateService('error'), TranslateService(statusPrincipal), null, 'Erro');\r\n }\r\n }else{\r\n var statusPrincipal = response.data[0][0];\r\n if(statusPrincipal == TranslateService(\"Oper-Reali-Sucesso\")){\r\n MessageService.alert(TranslateService('success'), TranslateService(statusPrincipal), null, \"Sucesso\");\r\n var turnoMsg = response.data[1][0];\r\n MessageService.alert(TranslateService('atention'), TranslateService(turnoMsg), null, \"atention\");\r\n }else{\r\n obj.Retorno = TranslateService(statusPrincipal);;\r\n resposta.push(obj);\r\n for (var i = (response.data.length-1); i > 0; i--) {\r\n for (var j = 0; j < response.data[i].length; j++) {\r\n obj = {};\r\n obj.Retorno = TranslateService(response.data[i][j]);\r\n resposta.push(obj);\r\n }\r\n }\r\n MessageService.alert(TranslateService('error'), TranslateService(statusPrincipal), null, 'Erro');\r\n }\r\n }\r\n return resposta;\r\n }).then(function (resposta) {\r\n if (resposta.length) {\r\n ExportCsv(resposta, TranslateService('RETORNO_') + operationDates.operacao);\r\n }\r\n return resposta;\r\n });\r\n }\r\n\r\n service.getHistorico = function(operationDates) {\r\n return $http.get(urlOperacao, {\r\n params: {\r\n GridHistorico: \"true\",\r\n CodImportacao: operationDates.operacao,\r\n IdcDiretoria: operationDates.diretoria,\r\n IdcComplexo: operationDates.complexo,\r\n IdcUnidade: operationDates.unidade,\r\n IdcPosto: operationDates.posto\r\n }\r\n }).catch(console.log);\r\n }\r\n\r\n service.import = function (table) {\r\n return function () {\r\n return modalImport.open()\r\n .then(sendToServer(table));\r\n }\r\n };\r\n\r\n service.importDirect = function (dados,operationDates) {\r\n return sendOperationData(dados, operationDates);\r\n };\r\n\r\n service.importStream = function (tables) {\r\n return function () {\r\n\r\n if (!streamSaver.supported) {\r\n alert(\"Este browser não suporta streams.\");\r\n return $q.reject(\"Este browser não suporta streams.\");\r\n }\r\n\r\n return modalImportStream.open()\r\n .then(function (files) {\r\n var index = 0;\r\n (function loop() {\r\n\r\n if (index === tables.length) {\r\n alert(\"Fim do Import das Tabelas\");\r\n console.log(\"Fim das tabelas\");\r\n return;\r\n }\r\n\r\n var table = tables[index];\r\n var file = Array.from(files).find(function (file) {\r\n return file.name.replace(\".csv\", \"\") === table;\r\n });\r\n\r\n if (!file) {\r\n index++;\r\n return loop();\r\n }\r\n\r\n fetch(streamsURL + \"?tabela=\" + table, {\r\n method: \"POST\",\r\n body: file\r\n }).then(function () {\r\n index++;\r\n loop();\r\n });\r\n\r\n })();\r\n\r\n });\r\n }\r\n }\r\n\r\n service.importAllStream = function (tables) {\r\n service.importStream(tables)();\r\n }\r\n\r\n service.importAll = function (cadastros) {\r\n\r\n return modalImport.open()\r\n .then(function (files) {\r\n var index = 0;\r\n\r\n function loop() {\r\n\r\n if (index === cadastros.length) {\r\n alert(\"Fim do Import das Tabelas\");\r\n console.log(\"Fim das tabelas\");\r\n return;\r\n }\r\n\r\n var table = cadastros[index];\r\n var data = files[table];\r\n\r\n if (!data) {\r\n index++;\r\n loop();\r\n } else {\r\n\r\n sendToServer(table)(files)\r\n .then(function () {\r\n index++;\r\n loop();\r\n })\r\n }\r\n }\r\n\r\n loop();\r\n });\r\n };\r\n\r\n service.exportAll = function (tables) {\r\n var index = 0;\r\n\r\n function loop() {\r\n\r\n if (index === tables.length) {\r\n alert(\"Fim do Export das Tabelas\");\r\n console.log(\"Fim das tabelas\");\r\n return;\r\n }\r\n\r\n var table = tables[index];\r\n\r\n service.export(table)()\r\n .then(function () {\r\n index++;\r\n setTimeout(loop, 1000);\r\n })\r\n }\r\n\r\n loop();\r\n };\r\n\r\n service.exportAllStream = function (tables) {\r\n var index = 0;\r\n\r\n function loop() {\r\n\r\n if (index === tables.length) {\r\n alert(\"Fim do Export das Tabelas\");\r\n console.log(\"Fim das tabelas\");\r\n return;\r\n }\r\n\r\n var table = tables[index];\r\n\r\n service.exportStream(table)()\r\n .then(function () {\r\n index++;\r\n setTimeout(loop, 1000);\r\n });\r\n }\r\n\r\n loop();\r\n };\r\n\r\n service.exportStream = function (table) {\r\n return function () {\r\n if (!streamSaver.supported) {\r\n alert(\"Este browser não suporta streams.\");\r\n return $q.reject(\"Este browser não suporta streams.\");\r\n }\r\n\r\n var fileStream = streamSaver.createWriteStream(table + '.csv');\r\n return fetch(streamsURL + \"?tabela=\" + table)\r\n .then(function (response) {\r\n return response.body.pipeTo(fileStream)\r\n });\r\n }\r\n }\r\n\r\n return service;\r\n\r\n }\r\n\r\n})();\r\n","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckAbastecimento', CheckAbastecimento);\r\n\r\n CheckAbastecimento.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'SelTurnoService'\r\n ];\r\n\r\n function CheckAbastecimento(\r\n CheckService,\r\n TranslateService,\r\n SelTurnoService\r\n ) {\r\n\r\n function hasHorHod(regAbastecimento) {\r\n\r\n if (!(regAbastecimento && regAbastecimento.TipoEquipamento)) {\r\n return false;\r\n }\r\n\r\n return regAbastecimento.TipoEquipamento !== 'L' &&\r\n regAbastecimento.TipoEquipamento.toUpperCase().indexOf('COMBOIO') === -1;\r\n }\r\n\r\n return function (regAbastecimento) {\r\n return CheckService(regAbastecimento, [\r\n {\r\n \"rule\": \"valida-horimetro-hodometro\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regAbastecimento, messages) {\r\n if (!hasHorHod(regAbastecimento)) return true;\r\n\r\n var valid = regAbastecimento.ValHorHod != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-horimetro-hodometro\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-horimetro-hodometro-anterior\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.ValHorHod >= regAbastecimento.UltimoHorHod;\r\n\r\n var withinlimit = true;\r\n\r\n if (regAbastecimento.ChkHorimetro) {\r\n withinlimit = regAbastecimento.ValHorHod <= regAbastecimento.MaxHor;\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-horimetro-hodometro-anterior\"\r\n ));\r\n }\r\n\r\n return valid && withinlimit;\r\n }\r\n },\r\n {\r\n \"rule\": \"initial-time-must-be-in-shift\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthInicial >= SelTurnoService.turno.DataInicial &&\r\n regAbastecimento.DthInicial <= SelTurnoService.turno.DataFinal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"initial-time-must-be-in-shift\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"final-time-must-be-in-shift\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthFinal <= SelTurnoService.turno.DataFinal &&\r\n regAbastecimento.DthFinal >= SelTurnoService.turno.DataInicial;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"final-time-must-be-in-shift\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"max-initial-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthInicial < regAbastecimento.DthFinal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"max-initial-time-contraint\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"min-end-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthFinal > regAbastecimento.DthInicial;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"min-end-time-contraint\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"times-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthFinal && regAbastecimento.DthInicial;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"times-required\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"volume-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var oneTanqk = false;\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento != null) {\r\n oneTanqk = true;\r\n } \r\n }\r\n if (!oneTanqk) {\r\n messages.push(TranslateService(\r\n \"volume-required\"\r\n ));\r\n return false;\r\n }\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"counter-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var oneTank = false;\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (regAbastecimento.listAbastecimentoTanque[index].ValEncerrante >= 0) {\r\n oneTank = true;\r\n }\r\n }\r\n if (!oneTank) {\r\n messages.push(TranslateService(\r\n \"counter-required\"\r\n ));\r\n return false;\r\n }\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"volume-maxlength\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regAbastecimento, messages) {\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (\r\n regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento >\r\n regAbastecimento.listAbastecimentoTanque[index].ValCapacidadeNominal\r\n ) {\r\n messages.push(TranslateService(\r\n \"capacity-exceeded\"\r\n ) + regAbastecimento.listAbastecimentoTanque[index].ValCapacidadeNominal);\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"volume-maxlength\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (!regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento) continue;\r\n\r\n if (\r\n regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento\r\n .toString()\r\n .replace(\".\", \"\")\r\n .length > 10\r\n ) {\r\n messages.push(TranslateService(\r\n \"volume-maxlength\"\r\n ));\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"counter-maxlength\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (!regAbastecimento.listAbastecimentoTanque[index].ValEncerrante) continue;\r\n\r\n if (\r\n regAbastecimento.listAbastecimentoTanque[index].ValEncerrante\r\n .toString()\r\n .replace(\".\", \"\")\r\n .length > 12\r\n ) {\r\n messages.push(TranslateService(\r\n \"counter-maxlength\"\r\n ));\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"estorno\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n return !regAbastecimento.ChkCompensaEstorno || (regAbastecimento.ChkCompensaEstorno && regAbastecimento.IdcEstorno);\r\n }\r\n },\r\n {\r\n \"rule\": \"invalid-Future-Date\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var hojeAgora = new Date();\r\n var valid = true;\r\n if(regAbastecimento.DthInicial < hojeAgora && regAbastecimento.DthFinal <= hojeAgora){\r\n valid = true;\r\n }else{\r\n valid = false;\r\n }\r\n \r\n if (!valid) {\r\n messages.push(TranslateService(\r\n 'invalid-Future-Date', \r\n TranslateService(\"abastecimentosPL\")\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n }\r\n ]);\r\n }\r\n }\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module(\"posto-facil\").factory(\"CheckAssociacaoRecebimento\", CheckAssociacaoRecebimento);\r\n\r\n CheckAssociacaoRecebimento.$inject = [\r\n 'CheckService',\r\n 'TranslateService'\r\n ];\r\n\r\n function CheckAssociacaoRecebimento(\r\n CheckService,\r\n TranslateService\r\n ) {\r\n return function (associacao) {\r\n return CheckService(associacao, [\r\n {\r\n \"rule\": \"valida-associacao-vazia\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (associacao, messages) {\r\n var valid = associacao.ListRecebimentoFiscalProduto.length > 0 &&\r\n associacao.ListRecebimentoFisicoProduto.length > 0;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-associacao-vazia\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n }\r\n ]);\r\n }\r\n }\r\n\r\n})()","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckContingencia', CheckContingencia);\r\n\r\n CheckContingencia.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'SelTurnoService'\r\n ];\r\n\r\n function CheckContingencia(\r\n CheckService,\r\n TranslateService,\r\n SelTurnoService\r\n ) {\r\n\r\n function hasHorHod(regAbastecimento) {\r\n\r\n if (!(regAbastecimento && regAbastecimento.TipoEquipamento)) {\r\n return false;\r\n }\r\n\r\n return regAbastecimento.TipoEquipamento !== 'L' &&\r\n regAbastecimento.TipoEquipamento.toUpperCase().indexOf('COMBOIO') === -1;\r\n }\r\n\r\n return function (regAbastecimento) {\r\n return CheckService(regAbastecimento, [\r\n {\r\n \"rule\": \"valida-horimetro-hodometro\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regAbastecimento, messages) {\r\n if (!hasHorHod(regAbastecimento)) return true;\r\n\r\n var valid = regAbastecimento.ValHorHod != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-horimetro-hodometro\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-horimetro-hodometro-anterior\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.ValHorHod >= regAbastecimento.UltimoHorHod;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-horimetro-hodometro-anterior\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"max-initial-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthInicial < regAbastecimento.DthFinal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"max-initial-time-contraint\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"min-end-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthFinal > regAbastecimento.DthInicial;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"min-end-time-contraint\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"times-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var valid = regAbastecimento.DthFinal && regAbastecimento.DthInicial;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"times-required\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"volume-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var oneTanqk = false;\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento != null) {\r\n oneTanqk = true;\r\n }\r\n }\r\n if (!oneTanqk) {\r\n messages.push(TranslateService(\r\n \"volume-required\"\r\n ));\r\n return false;\r\n }\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"counter-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var oneTank = false;\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (regAbastecimento.listAbastecimentoTanque[index].ValEncerrante >= 0) {\r\n oneTank = true;\r\n }\r\n }\r\n if (!oneTank) {\r\n messages.push(TranslateService(\r\n \"counter-required\"\r\n ));\r\n return false;\r\n }\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"volume-maxlength\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regAbastecimento, messages) {\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (\r\n regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento >\r\n regAbastecimento.listAbastecimentoTanque[index].ValCapacidadeNominal\r\n ) {\r\n messages.push(TranslateService(\r\n \"capacity-exceeded\"\r\n ) + regAbastecimento.listAbastecimentoTanque[index].ValCapacidadeNominal);\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"volume-maxlength\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (!regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento) continue;\r\n\r\n if (\r\n regAbastecimento.listAbastecimentoTanque[index].VolAbastecimento\r\n .toString()\r\n .replace(\".\", \"\")\r\n .length > 10\r\n ) {\r\n messages.push(TranslateService(\r\n \"volume-maxlength\"\r\n ));\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"counter-maxlength\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n for (var index in regAbastecimento.listAbastecimentoTanque) {\r\n if (!regAbastecimento.listAbastecimentoTanque[index].ValEncerrante) continue;\r\n\r\n if (\r\n regAbastecimento.listAbastecimentoTanque[index].ValEncerrante\r\n .toString()\r\n .replace(\".\", \"\")\r\n .length > 12\r\n ) {\r\n messages.push(TranslateService(\r\n \"counter-maxlength\"\r\n ));\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n },\r\n {\r\n \"rule\": \"estorno\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n return !regAbastecimento.ChkCompensaEstorno || (regAbastecimento.ChkCompensaEstorno && regAbastecimento.IdcEstorno);\r\n }\r\n },\r\n {\r\n \"rule\": \"invalid-Future-Date\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regAbastecimento, messages) {\r\n var hojeAgora = new Date();\r\n var valid = true;\r\n if (regAbastecimento.DthInicial < hojeAgora && regAbastecimento.DthFinal <= hojeAgora) {\r\n valid = true;\r\n } else {\r\n valid = false;\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n 'invalid-Future-Date',\r\n TranslateService(\"abastecimentosPL\")\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n }\r\n ]);\r\n }\r\n }\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckEquipamento', CheckEquipamento);\r\n\r\n CheckEquipamento.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'applyLenghtRule',\r\n 'getValueInPath'\r\n ];\r\n\r\n function CheckEquipamento(\r\n CheckService,\r\n TranslateService,\r\n applyLenghtRule,\r\n getValueInPath\r\n ) {\r\n\r\n var rules = [\r\n {\r\n \"rule\": \"invalid-data\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (equipamento, messages) {\r\n\r\n var valid = equipamento.$valid;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"invalid-data\"));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n ];\r\n\r\n var maxlength = [\r\n { \"name\": \"CodTagPlaca\", \"maxLength\": 20 },\r\n { \"name\": \"CodTag\", \"maxLength\": 30 },\r\n { \"name\": \"CodPlaca\", \"maxLength\": 30 },\r\n { \"name\": \"NumDigitos\", \"maxLength\": 2, \"decimal\": 0 },\r\n { \"name\": \"CodRenavan\", \"maxLength\": 20 },\r\n { \"name\": \"AnoFabricacao\", \"maxLength\": 4 },\r\n { \"name\": \"ObsEquipamento\", \"maxLength\": 140 }\r\n ];\r\n\r\n rules = rules.concat(maxlength.map(applyLenghtRule.single));\r\n\r\n var requiredFields = [ \r\n \"CodTagPlaca\",\r\n \"IdentificadorTagplaca\",\r\n \"ChkHorimetro\",\r\n \"NumDigitos\",\r\n \"IdcModelo\",\r\n \"CodRenavan\",\r\n \"AnoFabricacao\",\r\n \"IdcTipo\",\r\n \"IdcGri\", \r\n \"IdcTipoFiscal\"\r\n ];\r\n\r\n rules = rules.concat(requiredFields.map(function (field) {\r\n return {\r\n \"rule\": \"required-field\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (equipamento, messages) {\r\n\r\n var valid = getValueInPath(equipamento, field).value != null;\r\n\r\n if (!valid) {\r\n\r\n throw new Error(TranslateService(\"required-field\", TranslateService(field)));\r\n\r\n }\r\n\r\n return valid;\r\n }\r\n };\r\n }));\r\n\r\n return function (equipamento) {\r\n return CheckService(equipamento, rules);\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckEstorno', CheckEstorno);\r\n\r\n CheckEstorno.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'applyLenghtRule',\r\n 'getValueInPath'\r\n ];\r\n\r\n function CheckEstorno(\r\n CheckService,\r\n TranslateService,\r\n applyLenghtRule,\r\n getValueInPath\r\n ) {\r\n var rules = [\r\n {\r\n \"rule\": \"invalid-data\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (estorno, messages) {\r\n\r\n var valid = estorno.$valid;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"invalid-data\"));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n ];\r\n\r\n var requiredFiltersFields = [\r\n \"SglDiretoria.$viewValue.IdcDiretoria\",\r\n \"SglComplexo.$viewValue.IdcComplexo\",\r\n \"SglUnidade.$viewValue.IdcUnidade\"\r\n ];\r\n\r\n var funcionValidateRequired = function (field) {\r\n return {\r\n \"rule\": \"required-field\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (estorno, messages) {\r\n\r\n var valid = getValueInPath(estorno, field).value != null;\r\n\r\n //if (!valid) {\r\n // throw new Error(TranslateService(\"required-field\", TranslateService(field)));\r\n //}\r\n\r\n return valid;\r\n }\r\n };\r\n }\r\n\r\n\r\n var rulesFilters = requiredFiltersFields.map(funcionValidateRequired);\r\n\r\n\r\n var maxlength = [\r\n { \"name\": \"CodEstornoSap\", \"maxLength\": 100 },\r\n { \"name\": \"DscMotivoEstorno\", \"maxLength\": 300 },\r\n ];\r\n\r\n rules = rules.concat(maxlength.map(applyLenghtRule.single));\r\n\r\n var requiredFields = [\r\n \"DscMotivoEstorno\"\r\n ];\r\n \r\n rules = rules.concat(requiredFields.map(funcionValidateRequired));\r\n\r\n return function (estorno, type) {\r\n if (type == 'filtro')\r\n return CheckService(estorno, rulesFilters);\r\n return CheckService(estorno, rules);\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckPainelEstoque', CheckPainelEstoque);\r\n\r\n CheckPainelEstoque.$inject = [\r\n 'CheckService',\r\n 'TranslateService' \r\n ];\r\n\r\n function CheckPainelEstoque(\r\n CheckService,\r\n TranslateService \r\n ) {\r\n\r\n return function (formpainelDeEstoque) {\r\n return CheckService(formpainelDeEstoque, [\r\n {\r\n \"rule\": \"nao-pode-painel-estoque-data-futura\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (formpainelDeEstoque, messages) { \r\n var valid = formpainelDeEstoque.DthMedicao != null && formpainelDeEstoque.DthMedicao <= new Date();\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"nao-pode-painel-estoque-data-futura\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n }\r\n ]);\r\n }\r\n }\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckRecebimentoFiscal', CheckRecebimentoFiscal);\r\n\r\n CheckRecebimentoFiscal.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'ValidacaoService',\r\n 'applyLenghtRule',\r\n 'SelTurnoService'\r\n ];\r\n\r\n function CheckRecebimentoFiscal(\r\n CheckService,\r\n TranslateService,\r\n ValidacaoService,\r\n applyLenghtRule,\r\n SelTurnoService\r\n ) {\r\n\r\n var rules = [\r\n {\r\n \"rule\": \"invalid-data\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid = recebimento.$valid;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"invalid-data\"));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"produto-nao-informado\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n\r\n var valid = false;\r\n for (var i = 0; i < recebimento.produtos.length; i++) {\r\n valid = recebimento.produtos[i].IdcProduto == recebimento.IdentificadorProdutoNotaFiscal;\r\n if (valid) {\r\n break;\r\n }\r\n }\r\n\r\n if (!valid) {\r\n recebimento.IdentificadorProdutoNotaFiscal = null;\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"max-initial-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid;\r\n\r\n valid = recebimento.DataHoraUTCInicioRecebimentoFiscal < recebimento.DataHoraUTCFimRecebimentoFiscal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"max-initial-time-contraint\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"initial-time-must-be-in-shift\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid;\r\n\r\n valid = recebimento.DataHoraUTCInicioRecebimentoFiscal > SelTurnoService.turno.DataInicial &&\r\n recebimento.DataHoraUTCInicioRecebimentoFiscal < SelTurnoService.turno.DataFinal;\r\n\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"initial-time-must-be-in-shift\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"final-time-must-be-in-shift\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid;\r\n\r\n valid = recebimento.DataHoraUTCFimRecebimentoFiscal < SelTurnoService.turno.DataFinal &&\r\n recebimento.DataHoraUTCFimRecebimentoFiscal > SelTurnoService.turno.DataInicial;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"final-time-must-be-in-shift\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"certification-date-expired\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (recebimento, messages) {\r\n if (!recebimento.datavalidadecertificado) return true;\r\n\r\n var valid = recebimento.datavalidadecertificado >= (new Date);\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"certification-date-expired\"));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"cnh-date-expired\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (recebimento, messages) {\r\n if (!recebimento.CnhVencimento) return true;\r\n\r\n var valid = recebimento.CnhVencimento >= (new Date);\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"cnh-date-expired\"));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"data-emissao-invalida\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var maxDate = ValidacaoService.getMaxDayOfMonth(recebimento.DataEmissaoNotaFiscal);\r\n\r\n var valid = (recebimento.diadanfe > 0 && recebimento.diadanfe <= maxDate) || recebimento.DataEmissaoNotaFiscal === null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"data-emissao-invalida\",\r\n recebimento.diadanfe || \"0\",\r\n maxDate || 31\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"invalid-Future-Date\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n var hoje = new Date();\r\n var valid = true;\r\n if(recebimento.DataHoraUTCInicioRecebimentoFiscal < hoje && recebimento.DataHoraUTCFimRecebimentoFiscal < hoje){\r\n valid = true;\r\n }else{\r\n valid = false;\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n 'invalid-Future-Date', \r\n TranslateService(\"recebimentoFiscalPL\")\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n }\r\n\r\n ];\r\n\r\n var requiredFields = [\r\n \"DataHoraUTCInicioRecebimentoFiscal\",\r\n \"DataHoraUTCFimRecebimentoFiscal\",\r\n //\"CodigoBarrasNotaFiscal\",\r\n ];\r\n\r\n rules = rules.concat(requiredFields.map(function (field) {\r\n return {\r\n \"rule\": \"required-field\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid = recebimento[field] != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"required-field\",\r\n TranslateService(field)\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n };\r\n }));\r\n\r\n var numberFields = [\r\n ];\r\n\r\n rules = rules.concat(numberFields.map(function (field) {\r\n return {\r\n \"rule\": \"number-field\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid = typeof recebimento[field] == \"number\";\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"number-field\",\r\n TranslateService(field)\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n };\r\n }));\r\n\r\n var fieldsMaxlength = [\r\n { \"name\": \"CodigoBarrasNotaFiscal\", \"maxLength\": 44 },\r\n { \"name\": \"CodigoDANFENotaFiscal\", \"maxLength\": 12 },\r\n { \"name\": \"NumeroIdentificacaoLacres\", \"maxLength\": 200 },\r\n { \"name\": \"CodigoHexadecimalCorLacres\", \"maxLength\": 7 },\r\n { \"name\": \"QuantidadeLacres\", \"maxLength\": 4 },\r\n { \"name\": \"QuantidadeProdutoNotaFiscal\", \"maxLength\": 12, \"decimal\": 2 },\r\n { \"name\": \"PrecoUnitarioProdutoNotaFiscal\", \"maxLength\": 12, \"decimal\": 4 },\r\n { \"name\": \"PesoBrutoNotaFiscal\", \"maxLength\": 12, \"decimal\": 2 },\r\n { \"name\": \"PesoLiquidoNotaFiscal\", \"maxLength\": 12, \"decimal\": 2 },\r\n { \"name\": \"PesoBrutoVale\", \"maxLength\": 12, \"decimal\": 2 },\r\n { \"name\": \"DensidadeCarga\", \"maxLength\": 9, \"decimal\": 4 },\r\n { \"name\": \"TemperaturaCarga\", \"maxLength\": 4, \"decimal\": 1 }\r\n ];\r\n\r\n rules = rules.concat(fieldsMaxlength.map(applyLenghtRule.single));\r\n\r\n return function (recebimento) {\r\n return CheckService(recebimento, rules);\r\n }\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckRecebimentoFisico', CheckRecebimentoFisico);\r\n\r\n CheckRecebimentoFisico.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'applyLenghtRule'\r\n ];\r\n\r\n function CheckRecebimentoFisico(\r\n CheckService,\r\n TranslateService,\r\n applyLenghtRule\r\n ) {\r\n\r\n var TYPES = {\r\n get CAMINHAO_TANQUE() { return 'C'; },\r\n get VAGAO_TANQUE() { return 'V'; },\r\n get TANQUE_A_TANQUE() { return 'T'; },\r\n get NAVIO_TANQUE() { return 'N'; }\r\n };\r\n\r\n var rules = [\r\n {\r\n \"rule\": \"invalid-data\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid = recebimento.$valid;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"invalid-data\"));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"max-initial-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n if (!recebimento.DataHoraUTCFimRecebimentoFisico) return true;\r\n\r\n var valid = recebimento.DataHoraUTCInicioRecebimentoFisico < recebimento.DataHoraUTCFimRecebimentoFisico;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"max-initial-time-contraint\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"initial-time-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid = !!recebimento.DataHoraUTCInicioRecebimentoFisico;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"initial-time-required\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"quantity-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n var valid = recebimento.ListDetalheRecebimentoProduto.some(function (detalhe) {\r\n return detalhe.QuantidadeRecebida && detalhe.QuantidadeRecebida > 0;\r\n });\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"quantity-required\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"counter-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n if (!recebimento.DataHoraUTCFimRecebimentoFisico) return true;\r\n if (recebimento.IndicadorTipoRecebimento !== TYPES.CAMINHAO_TANQUE) return true;\r\n if (recebimento.IndicadorUtilizacaoSkid === 'S') return true;\r\n var recebimentosComVolume = recebimento.ListDetalheRecebimentoProduto\r\n .filter(function (detalhe) {\r\n return (detalhe.QuantidadeRecebida && detalhe.QuantidadeRecebida > 0);\r\n });\r\n\r\n var valid = false;\r\n\r\n valid = recebimentosComVolume\r\n .every(function (detalhe) {\r\n return !!(detalhe.CtrEncerrante && detalhe.CtrEncerrante.ValEncerranteAtual);\r\n });\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"counter-required\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"storage-check-required\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n\r\n if (recebimento.IndicadorTipoRecebimento !== TYPES.TANQUE_A_TANQUE) return true;\r\n var valid = true;\r\n for (var i = 0; i < recebimento.ListApuracaoRecebimentoProdutoTanquePosto.length; i++) {\r\n if(valid){\r\n if(recebimento.ListApuracaoRecebimentoProdutoTanquePosto[i].QuantidadeProdutoInicial == undefined ||\r\n recebimento.ListApuracaoRecebimentoProdutoTanquePosto[i].QuantidadeProdutoInicial == null){\r\n valid = false;\r\n }\r\n }\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"storage-check-required\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"invalid-Future-Date\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (recebimento, messages) {\r\n var hoje = new Date();\r\n var valid = true;\r\n if(recebimento.DataHoraUTCInicioRecebimentoFisico < hoje && recebimento.DataHoraUTCFimRecebimentoFisico < hoje){\r\n valid = true\r\n }else{\r\n valid = false\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n 'invalid-Future-Date', \r\n TranslateService(\"recebimentoFisicoPL\")\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n }\r\n ];\r\n\r\n var apuracaoFieldsMaxlength = [\r\n { \"name\": \"QuantidadeProdutoInicial\", \"maxLength\": 10, \"decimal\": 2 },\r\n { \"name\": \"QuantidadeProdutoFinal\", \"maxLength\": 10, \"decimal\": 2 },\r\n { \"name\": \"MedidaDensidadeInicial\", \"maxLength\": 9, \"decimal\": 4 },\r\n { \"name\": \"MedidaDensidadeFinal\", \"maxLength\": 9, \"decimal\": 4 },\r\n { \"name\": \"MedidaTemperaturaMediaInicial\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"MedidaTemperaturaMediaFinal\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"MedidaTemperaturaSuperficieInicial\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"MedidaTemperaturaSuperficieFinal\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"MedidaTemperaturaMeioInicial\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"MedidaTemperaturaMeioFinal\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"MedidaTemperaturaFundoInicial\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"MedidaTemperaturaFundoFinal\", \"maxLength\": 4, \"decimal\": 1 }\r\n ];\r\n\r\n rules = rules.concat(apuracaoFieldsMaxlength.map(applyLenghtRule.many('ListApuracaoRecebimentoProdutoTanquePosto')));\r\n\r\n var detalhesFieldsMaxlength = [\r\n { \"name\": \"QuantidadeRecebida\", \"maxLength\": 12, \"decimal\": 2 },\r\n { \"name\": \"MedidaDensidadeProduto\", \"maxLength\": 9, \"decimal\": 4 },\r\n { \"name\": \"MedidaTemperaturaProduto\", \"maxLength\": 4, \"decimal\": 1 },\r\n { \"name\": \"QuantidadeComplementoProduto\", \"maxLength\": 12, \"decimal\": 2 },\r\n { \"name\": \"CtrEncerrante.ValEncerranteAtual\", \"maxLength\": 12, \"decimal\": 2 }\r\n ];\r\n\r\n rules = rules.concat(detalhesFieldsMaxlength.map(applyLenghtRule.many('ListDetalheRecebimentoProduto')));\r\n\r\n return function (recebimento) {\r\n return CheckService(recebimento, rules);\r\n };\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckService', CheckService);\r\n\r\n CheckService.$inject = [\r\n '$q',\r\n 'MessageService',\r\n 'TranslateService',\r\n 'RegAnomaliaService'\r\n ];\r\n\r\n function CheckService(\r\n $q,\r\n MessageService,\r\n TranslateService,\r\n RegAnomaliaService\r\n ) {\r\n\r\n return function (entity, rules, stuAnomalia) {\r\n stuAnomalia = stuAnomalia || \"AB\";\r\n return new $q(function (resolve, reject) {\r\n var askAnomaly = false;\r\n var blockSaving = false;\r\n var blockMessages = [];\r\n var anomalyMessages = [TranslateService('invalid-data-anomaly')];\r\n\r\n for (var i = 0; i < rules.length; i++) {\r\n var rule = rules[i];\r\n var valid = rule.validator(entity, rule.blockSaving ? blockMessages : anomalyMessages);\r\n askAnomaly = askAnomaly || (rule.anomaly && !valid);\r\n blockSaving = blockSaving || (rule.blockSaving && !valid);\r\n }\r\n\r\n if (blockSaving) {\r\n MessageService.alert(TranslateService('saving-failed'), blockMessages.join(\"\\n\\n\"))\r\n .then(reject);\r\n } else if (askAnomaly) {\r\n MessageService.prompt(TranslateService('invalid-data'), anomalyMessages.join(\"\\n\\n\"))\r\n .then(function () {\r\n return RegAnomaliaService.novo(anomalyMessages.slice(1).join(\"\\n\"), null, stuAnomalia);\r\n })\r\n .then(function (anomalia) {\r\n if (entity.listAnomalia) {\r\n entity.listAnomalia.push(anomalia.IdcAnomalia);\r\n }\r\n\r\n if (entity.Anomalias) {\r\n entity.Anomalias.push(anomalia);\r\n }\r\n })\r\n .then(resolve)\r\n .catch(reject)\r\n } else {\r\n resolve();\r\n }\r\n\r\n });\r\n }\r\n\r\n }\r\n\r\n})();","(function () {\r\n 'use strict';\r\n\r\n angular.module(\"posto-facil\").factory(\"CheckTransferencia\", CheckTransferencia);\r\n\r\n CheckTransferencia.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'getValueInPath',\r\n 'SelTurnoService',\r\n 'applyLenghtRule'\r\n ];\r\n\r\n function CheckTransferencia(\r\n CheckService,\r\n TranslateService,\r\n getValueInPath,\r\n SelTurnoService,\r\n applyLenghtRule\r\n ) {\r\n return function (transferencia) {\r\n var rules = [\r\n {\r\n \"rule\": \"invalid-data\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (transferencia, messages) {\r\n\r\n var valid = transferencia.$valid;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"invalid-data\"));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"max-initial-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (transferencia, messages) {\r\n\r\n var valid;\r\n\r\n if (SelTurnoService.turno.IdcPosto !== IdentificadorProdutoPostoDestino) {\r\n valid = transferencia.DataHoraUTCInicioRetiradaOrigem < transferencia.DataHoraUTCFimRetiradaOrigem;\r\n } else {\r\n valid = transferencia.DataHoraUTCInicioRecebimentoDestino < transferencia.DataHoraUTCFimRecebimentoDestino;\r\n };\r\n\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"max-initial-time-contraint\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"initial-time-must-be-in-shift\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (transferencia, messages) {\r\n\r\n var valid;\r\n\r\n if (SelTurnoService.turno.IdcPosto !== IdentificadorProdutoPostoDestino) {\r\n valid = transferencia.DataHoraUTCInicioRetiradaOrigem > SelTurnoService.turno.DataInicial &&\r\n transferencia.DataHoraUTCInicioRetiradaOrigem < SelTurnoService.turno.DataFinal;\r\n } else {\r\n valid = transferencia.DataHoraUTCInicioRecebimentoDestino > SelTurnoService.turno.DataInicial &&\r\n transferencia.DataHoraUTCInicioRecebimentoDestino < SelTurnoService.turno.DataFinal;\r\n };\r\n\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"initial-time-must-be-in-shift\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"final-time-must-be-in-shift\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (transferencia, messages) {\r\n\r\n var valid;\r\n\r\n if (SelTurnoService.turno.IdcPosto !== IdentificadorProdutoPostoDestino) {\r\n valid = transferencia.DataHoraUTCFimRetiradaOrigem < SelTurnoService.turno.DataFinal &&\r\n transferencia.DataHoraUTCFimRetiradaOrigem > SelTurnoService.turno.DataInicial;\r\n } else {\r\n valid = transferencia.DataHoraUTCFimRecebimentoDestino < transferencia.SelTurnoService.turno.DataFinal &&\r\n transferencia.DataHoraUTCFimRecebimentoDestino > transferencia.SelTurnoService.turno.DataInicial;\r\n };\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"final-time-must-be-in-shift\"\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n },\r\n {\r\n \"rule\": \"invalid-Future-Date\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (transferencia, messages) {\r\n var hoje = new Date();\r\n var valid = true;\r\n if(transferencia.DataHoraUTCInicioRetiradaOrigem < hoje && transferencia.DataHoraUTCFimRetiradaOrigem < hoje){\r\n valid = true;\r\n }else{\r\n valid = false\r\n }\r\n \r\n if (!valid) {\r\n messages.push(TranslateService(\r\n 'invalid-Future-Date', \r\n TranslateService(\"transferenciaPL\")\r\n ));\r\n }\r\n \r\n return valid;\r\n }\r\n }\r\n ];\r\n\r\n var requiredFields = [\r\n \"CtrEncerrante.IdcBlocoMedidor\",\r\n \"IdentificadorProdutoPostoDestino\",\r\n \"CtrEncerrante.ValEncerranteAtual\",\r\n \"QuantidadeTransferida\",\r\n \"DataHoraUTCInicioRetiradaOrigem\",\r\n \"DataHoraUTCFimRetiradaOrigem\",\r\n \"DataHoraUTCInicioRecebimentoDestino\",\r\n \"DataHoraUTCFimRecebimentoDestino\"\r\n ];\r\n\r\n rules = rules.concat(requiredFields.map(function (field) {\r\n return {\r\n \"rule\": \"required-field\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (transferencia, messages) {\r\n\r\n var valid = getValueInPath(transferencia, field).value != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"required-field\",\r\n TranslateService(field)\r\n ));\r\n }\r\n\r\n return valid;\r\n }\r\n };\r\n }));\r\n\r\n var detalhesFieldsMaxlength = [\r\n { \"name\": \"QuantidadeTransferida\", \"maxLength\": 12, \"decimal\": 2 },\r\n { \"name\": \"CtrEncerrante.ValEncerranteAtual\", \"maxLength\": 12, \"decimal\": 2 }\r\n ];\r\n\r\n rules = rules.concat(detalhesFieldsMaxlength.map(applyLenghtRule.single));\r\n\r\n\r\n return CheckService(transferencia, rules);\r\n }\r\n }\r\n\r\n})()","(function () {\r\n 'use strict';\r\n\r\n angular.module('posto-facil').factory('CheckTurno', CheckTurno);\r\n\r\n CheckTurno.$inject = [\r\n 'CheckService',\r\n 'TranslateService',\r\n 'ValidacaoService'\r\n ];\r\n\r\n function CheckTurno(\r\n CheckService,\r\n TranslateService,\r\n ValidacaoService\r\n ) {\r\n\r\n return function (regTurno, stuAnomalia) {\r\n\r\n var rules = [\r\n {\r\n \"rule\": \"msg-first-counter\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.firstCounter) return true;\r\n\r\n var valid = bloco.DthEncerranteInicial < bloco.firstCounter;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"msg-first-counter\",\r\n bloco.firstCounter.toLocaleTimeString()\r\n ));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"msg-last-counter\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.lastCounter) return true;\r\n\r\n var valid = bloco.DthEncerranteFinal > bloco.lastCounter;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"msg-last-counter\",\r\n bloco.lastCounter.toLocaleTimeString()\r\n ));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-encerrante-inicial\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n var valid = bloco.ValEncerranteInicial != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-encerrante-inicial\", bloco.SglBlocoMedidor));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-encerrante-final\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n if (regTurno.StuTurno == 'AB' || regTurno.StuTurno == 'NO') return true;\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n var valid = bloco.ValEncerranteFinal != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-encerrante-final\", bloco.SglBlocoMedidor));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-inicial\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n var valid = tanque.VolInicial != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-inicial\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-final\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n if (regTurno.StuTurno == 'AB' || regTurno.StuTurno == 'NO') return true;\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n var valid = tanque.VolFinal != null;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-final\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-inicial-abaixo-capacidade-critica\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n var valid = tanque.VolInicial >= tanque.ValCapacidadeCritica;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-inicial-abaixo-capacidade-critica\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-final-abaixo-capacidade-critica\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n if (!tanque.VolFinal) return true;\r\n var valid = tanque.VolFinal >= tanque.ValCapacidadeCritica;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-final-abaixo-capacidade-critica\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-inicial-abaixo-capacidade-lastro\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n var valid = tanque.VolInicial >= tanque.ValCapacidadeLastro;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-inicial-abaixo-capacidade-lastro\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-final-abaixo-capacidade-lastro\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n if (!tanque.VolFinal) return true;\r\n var valid = tanque.VolFinal >= tanque.ValCapacidadeLastro;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-final-abaixo-capacidade-lastro\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-inicial-acima-capacidade\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n var valid = tanque.VolInicial <= tanque.ValCapacidadeNominal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-inicial-acima-capacidade\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-volume-final-acima-capacidade\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoTanquePostoDQO\r\n .every(function (tanque) {\r\n var valid = tanque.VolFinal <= tanque.ValCapacidadeNominal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"valida-volume-final-acima-capacidade\", tanque.SglTanque));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-encerrante-inicial-diferente-turno-anterior\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.ValEncerranteFinalTurnoAnterior) return true;\r\n\r\n var valid;\r\n var diferencaEmListros = bloco.ValEncerranteInicial - bloco.ValEncerranteFinalTurnoAnterior;\r\n\r\n if (diferencaEmListros > 0) {\r\n valid = diferencaEmListros <= bloco.NumToleranciaAcima;\r\n } else {\r\n valid = diferencaEmListros <= bloco.NumToleranciaAbaixo;\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-encerrante-inicial-diferente-turno-anterior\",\r\n bloco.SglBlocoMedidor,\r\n bloco.ValEncerranteInicial,\r\n bloco.ValEncerranteFinalTurnoAnterior\r\n ));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-encerrante-final-diferente-ultimo-postofacil\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.ValEncerranteFinal || !bloco.ValEncerranteFinalPostoFacil) return true;\r\n\r\n var valid;\r\n var diferencaEmListros = bloco.ValEncerranteFinal - bloco.ValEncerranteFinalPostoFacil;\r\n\r\n if (diferencaEmListros > 0) {\r\n valid = diferencaEmListros <= bloco.NumToleranciaAcima;\r\n } else {\r\n valid = diferencaEmListros <= bloco.NumToleranciaAbaixo;\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-encerrante-final-diferente-ultimo-postofacil\",\r\n bloco.SglBlocoMedidor,\r\n bloco.ValEncerranteFinal,\r\n bloco.ValEncerranteFinalPostoFacil\r\n ));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-encerrante-inicial-digitos\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.ValEncerranteInicial) return true;\r\n var valid = true;\r\n var digitos = bloco.NumDigitos;\r\n var decimais = bloco.NumCasasDecimais;\r\n var splited = bloco.ValEncerranteInicial.toString().split('.');\r\n splited[1] = splited[1] || '';\r\n\r\n if (\r\n splited[1].length > decimais ||\r\n splited[0].length > (digitos - decimais) ||\r\n bloco.ValEncerranteInicial.toString().replace(\".\", \"\").length > digitos\r\n ) {\r\n valid = false;\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-encerrante-digitos\",\r\n bloco.SglBlocoMedidor,\r\n digitos,\r\n decimais,\r\n ValidacaoService.getFormatoEncerrante(bloco),\r\n bloco.ValEncerranteInicial\r\n ));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"valida-encerrante-final-digitos\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.ValEncerranteFinal) return true;\r\n var valid = true;\r\n var digitos = bloco.NumDigitos;\r\n var decimais = bloco.NumCasasDecimais;\r\n var splited = bloco.ValEncerranteFinal.toString().split('.');\r\n splited[1] = splited[1] || '';\r\n\r\n if (\r\n splited[1].length > decimais ||\r\n splited[0].length > (digitos - decimais) ||\r\n bloco.ValEncerranteFinal.toString().replace(\".\", \"\").length > digitos\r\n ) {\r\n valid = false;\r\n }\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\r\n \"valida-encerrante-digitos\",\r\n bloco.SglBlocoMedidor,\r\n digitos,\r\n decimais,\r\n ValidacaoService.getFormatoEncerrante(bloco),\r\n bloco.ValEncerranteFinal\r\n ));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"min-initial-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.DthEncerranteInicial) return true;\r\n var valid = bloco.DthEncerranteInicial >= regTurno.DthInicial;\r\n\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"min-initial-time-contraint\"));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"max-initial-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.DthEncerranteInicial || !bloco.DthEncerranteFinal) return true;\r\n var valid = bloco.DthEncerranteInicial <= bloco.DthEncerranteFinal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"max-initial-time-contraint\"));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"min-end-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.DthEncerranteInicial || !bloco.DthEncerranteFinal) return true;\r\n var valid = bloco.DthEncerranteInicial <= bloco.DthEncerranteFinal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"min-end-time-contraint\"));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"max-end-time-contraint\",\r\n \"blockSaving\": true,\r\n \"anomaly\": false,\r\n \"validator\": function (regTurno, messages) {\r\n return regTurno.ListaRegTurnoBlocoMedidorDQO\r\n .every(function (bloco) {\r\n if (!bloco.DthEncerranteFinal) return true;\r\n var valid = bloco.DthEncerranteFinal <= regTurno.DthFinal;\r\n\r\n if (!valid) {\r\n messages.push(TranslateService(\"max-end-time-contraint\"));\r\n }\r\n\r\n return valid;\r\n });\r\n }\r\n },\r\n {\r\n \"rule\": \"transferencia-posto-default\",\r\n \"blockSaving\": false,\r\n \"anomaly\": true,\r\n \"validator\": function (regTurno, messages) {\r\n var valid = regTurno.TransferenciasPostoDefault && regTurno.TransferenciasPostoDefault.length > 0\r\n && (regTurno.tipo == 'validar' || regTurno.tipo == 'fechar');\r\n\r\n\r\n if (!valid && regTurno.tipo == 'validar') {\r\n messages.push(TranslateService(\"posto-default-validacao\"));\r\n }\r\n else if (!valid && regTurno.tipo == 'fechar') {\r\n messages.push(TranslateService(\"posto-default-fechamento\"));\r\n }\r\n return !valid;\r\n }\r\n }\r\n\r\n ];\r\n\r\n return CheckService(regTurno, rules, stuAnomalia);\r\n }\r\n\r\n }\r\n\r\n})();"]}