Commit d8677df547dcde567165f6d22f92572950fff9f6

Authored by joyfas.silva
1 parent 3d81fe1b
Exists in master

{Redmine tarefa-3943}

cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js
... ... @@ -10,6 +10,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp
10 10 var CODIGO_DOMINIO_TIPO_RECEBIMENTO_COMPRA_ORCAMENTARIA = 1;
11 11  
12 12 $scope.entradaAlmoxarifado = {};
  13 + $scope.showInteiro= true;
13 14  
14 15 $scope.entradaAlmoxarifadoOriginal = {};
15 16  
... ... @@ -143,6 +144,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp
143 144 $scope.edit = edit;
144 145 $scope.stopTimerIntervalDraft($scope.workspace);
145 146 $scope.setLoading(false);
  147 + $scope.defineTipoNumerico();
146 148 });
147 149  
148 150 MovimentoEstoqueRepository.buscarMovimentosSaidaComMateriaisDaEntrada(entradaAlmoxarifado.id).then(function(result) {
... ... @@ -369,6 +371,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp
369 371 $scope.newEntrada = false;
370 372 $scope.editEntrada = editar;
371 373 $scope.entradaItem = itensSelecionados[0];
  374 + $scope.defineTipoNumerico();
372 375 $scope.entradaItem.$quantidadeEntrada = $scope.entradaItem.quantidade / $scope.entradaItem.unidadeMedidaEntrada.quantidadePadrao;
373 376 $scope.unidadesMedidasEntrada = $scope.entradaItem.material.tiposUnidadeMedidaEntrada.map(function(item){
374 377 return item.unidadeMedida;
... ... @@ -768,6 +771,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp
768 771 };
769 772 }
770 773 $scope.entradaItem.quantidade = null;
  774 + $scope.entradaItem.$quantidadeEntrada = null;
771 775 $scope.entradaItem.valorTotal = null;
772 776 $scope.entradaItem.valorUnitario = null;
773 777 $scope.entradaItem.unidadeMedidaEntrada = null;
... ... @@ -776,10 +780,11 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp
776 780 $scope.enderecosMaterial = [];
777 781 }
778 782  
779   - if ($scope.entradaItem && $scope.entradaItem.material) {
  783 + if ($scope.entradaItem && $scope.entradaItem.material) {
780 784 $scope.unidadesMedidasEntrada = $scope.entradaItem.material.tiposUnidadeMedidaEntrada.map(function(item){
781 785 if (item.isPadrao && !$scope.entradaItem.unidadeMedidaEntrada) {
782   - $scope.entradaItem.unidadeMedidaEntrada = item.unidadeMedida;
  786 + $scope.entradaItem.unidadeMedidaEntrada = item.unidadeMedida;
  787 + $scope.defineTipoNumerico();
783 788 }
784 789 return item.unidadeMedida;
785 790 });
... ... @@ -1135,22 +1140,29 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp
1135 1140 $scope.entradaItem.$quantidadeEntrada = '';
1136 1141 $timeout(function(){
1137 1142 if($scope.entradaItem.unidadeMedidaEntrada && $scope.entradaItem.unidadeMedidaEntrada.tipoNumerico){
1138   - switch($scope.entradaItem.unidadeMedidaEntrada.tipoNumerico.codigo){
1139   - case 1:
1140   - $scope.showInteiro= true;
1141   - $scope.showDecimal = false;
1142   - break;
1143   -
1144   - case 2:
1145   - $scope.showDecimal = true;
1146   - $scope.showInteiro= false;
1147   - break;
1148   - }
  1143 + $scope.defineTipoNumerico();
1149 1144 }else{
1150   - $scope.showInteiro= false;
1151   - $scope.showDecimal = false;
  1145 + $scope.showInteiro= true;
  1146 + $scope.showDecimal= false;
1152 1147 }
1153 1148 });
1154 1149 };
  1150 +
  1151 + $scope.defineTipoNumerico = function(){
  1152 + $scope.showInteiro= false;
  1153 + $scope.showDecimal= false;
  1154 + switch($scope.entradaItem.unidadeMedidaEntrada.tipoNumerico.codigo){
  1155 + case 1:
  1156 + $scope.showInteiro= true;
  1157 + $scope.showDecimal = false;
  1158 + break;
  1159 +
  1160 + case 2:
  1161 + $scope.showDecimal = true;
  1162 + $scope.showInteiro= false;
  1163 + break;
  1164 + }
  1165 + };
1155 1166  
1156 1167 }]);
  1168 +
1157 1169 \ No newline at end of file
... ...