Commit 3d0a1c68931343c436b38a9d766db27c6ac5a0c7

Authored by geovane.filho
2 parents 42303001 b672b95a
Exists in master

Merge branch 'adm-1.15.0' into tarefa-3943

cit-adm-materiais-api/src/main/java/br/com/centralit/api/model/UnidadeMedida.java
... ... @@ -9,6 +9,7 @@ import javax.persistence.GeneratedValue;
9 9 import javax.persistence.GenerationType;
10 10 import javax.persistence.Id;
11 11 import javax.persistence.ManyToOne;
  12 +import javax.persistence.Transient;
12 13  
13 14 import org.hibernate.envers.Audited;
14 15  
... ... @@ -58,6 +59,12 @@ public class UnidadeMedida extends PersistentObject {
58 59 /** Atributo serialVersionUID. */
59 60 private static final long serialVersionUID = -7573208249312737668L;
60 61  
  62 + @Transient
  63 + private final Long TIPO_NUMERICO_INTEIRO = new Long (1l);
  64 +
  65 + @Transient
  66 + private final Long TIPO_NUMERICO_DECIMAL = new Long (2l);
  67 +
61 68 /** Atributo id. */
62 69 @Id
63 70 @GeneratedValue(strategy = GenerationType.AUTO)
... ... @@ -94,6 +101,14 @@ public class UnidadeMedida extends PersistentObject {
94 101 @JsonView({ ViewsAdmMateriais.UnidadeMedidaListView.class })
95 102 private Boolean isUnidadePadrao;
96 103  
  104 + @Transient
  105 + @JsonView({ ViewsAdmMateriais.UnidadeMedidaListView.class })
  106 + private BigDecimal quantidadeInteiro;
  107 +
  108 + @Transient
  109 + @JsonView({ ViewsAdmMateriais.UnidadeMedidaListView.class })
  110 + private BigDecimal quantidadeDecimal;
  111 +
97 112 /**
98 113 * Responsável pela criação de novas instâncias desta classe.
99 114 */
... ... @@ -227,6 +242,26 @@ public class UnidadeMedida extends PersistentObject {
227 242 this.quantidadePadrao = quantidadePadrao;
228 243 }
229 244  
  245 + public BigDecimal getQuantidadeInteiro() {
  246 + return quantidadePadrao;
  247 + }
  248 +
  249 + public void setQuantidadeInteiro(BigDecimal quantidadeInteiro) {
  250 + if(this.tipoNumerico != null && this.tipoNumerico.getCodigo().equals(TIPO_NUMERICO_INTEIRO)){
  251 + this.quantidadePadrao = quantidadeInteiro;
  252 + }
  253 + }
  254 +
  255 + public BigDecimal getQuantidadeDecimal() {
  256 + return quantidadePadrao;
  257 + }
  258 +
  259 + public void setQuantidadeDecimal(BigDecimal quantidadeDecimal) {
  260 + if(this.tipoNumerico != null && this.tipoNumerico.getCodigo().equals(TIPO_NUMERICO_DECIMAL)){
  261 + this.quantidadePadrao = quantidadeDecimal;
  262 + }
  263 + }
  264 +
230 265 public Boolean getIsUnidadePadrao() {
231 266 return isUnidadePadrao;
232 267 }
... ...
cit-adm-materiais-api/src/main/resources/scripts-bd/postgres/v1.15.0/01-cit-adm-materiais-v1.15.0-postgres.sql
... ... @@ -736,9 +736,9 @@ CREATE TABLE alm_en_entradaitem_aud
736 736 );
737 737  
738 738  
739   -
740   -
741   -
  739 +
  740 +
  741 +
742 742 CREATE TABLE alm_baixa
743 743 (
744 744 databaixa timestamp without time zone NOT NULL,
... ... @@ -1482,12 +1482,20 @@ VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, LOCALTIMESTAMP, 0, true,
1482 1482 INSERT INTO menufile (id, datacriacao, dataedicao, version, ativo, caminho, dominiomenufile_id, menu_id)
1483 1483 VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, LOCALTIMESTAMP, 0, true, '/cit-almoxarifado-web/assets/js/angular/custom/repository/MaterialLocalEstoqueRepository.min.js',
1484 1484 (SELECT id FROM dominio WHERE chave = 'tipoFile' AND codigo = 2), (SELECT id FROM menu WHERE chave = 'USUARIO'));
1485   -
1486   -
  1485 +
  1486 +
1487 1487 ALTER TABLE alm_me_localestoque ALTER COLUMN unidadeMedidaEntrada_id DROP NOT NULL;
1488 1488 ALTER TABLE alm_me_localestoque ADD COLUMN localPrincipal BOOLEAN;
1489 1489  
  1490 +ALTER TABLE alm_me_localestoque_aud ADD COLUMN localPrincipal BOOLEAN;
  1491 +
1490 1492  
1491 1493 ALTER TABLE alm_me_localestoque DROP CONSTRAINT uk_jsrcjmbvm7pnw3ql1hoiyhamj;
1492 1494 ALTER TABLE alm_me_localestoque DROP CONSTRAINT uk_qnx0r3sv9yxte5bholpq15k4p;
1493   --- ERICK FIM 04/05/2016
1494 1495 \ No newline at end of file
  1496 +-- ERICK FIM 04/05/2016
  1497 +
  1498 +-- JOYFAS INICIO 06/05/16
  1499 +alter table alm_mc_unidmedidaentrada add isPadrao boolean;
  1500 +
  1501 +alter table alm_mc_unidmedidaentrada_aud add isPadrao boolean;
  1502 +-- JOYFAS FIM 06/05/16
1495 1503 \ No newline at end of file
... ...
cit-adm-materiais-web/src/main/webapp/assets/js/angular/custom/controller/UnidadeMedidaController.js
... ... @@ -3,7 +3,10 @@
3 3 citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository', '$translate', '$timeout', 'DominioRepository',
4 4 function UnidadeMedidaController($scope, UnidadeMedidaRepository, $translate, $timeout, DominioRepository) {
5 5  
6   - $scope.unidadeMedida = {};
  6 + $scope.unidadeMedida = {
  7 + showDecimal: false,
  8 + showInteiro: false
  9 + };
7 10  
8 11 // Limpa formulário para novo cadastro
9 12 $scope.resetForm = function() {
... ... @@ -79,4 +82,34 @@ citApp.controller('UnidadeMedidaController', ['$scope', 'UnidadeMedidaRepository
79 82 $scope.tipoNumericoList = result;
80 83 });
81 84  
82   -}]);
  85 + $scope.atualizaCampoQTDEPadrao = function(){
  86 + $scope.unidadeMedida.quantidadePadrao;
  87 + };
  88 +
  89 + $scope.alternaTipoNumerico = function(){
  90 + $timeout(function(){
  91 + if($scope.unidadeMedida.tipoNumerico){
  92 + switch($scope.unidadeMedida.tipoNumerico.codigo){
  93 + case 1:
  94 + $scope.showInteiro= true;
  95 + $scope.showDecimal = false;
  96 + $scope.unidadeMedida.quantidadeDecimal = '';
  97 + break;
  98 +
  99 + case 2:
  100 + $scope.showDecimal = true;
  101 + $scope.showInteiro= false;
  102 + $scope.unidadeMedida.quantidadeInteiro = '';
  103 + break;
  104 +
  105 + }
  106 + }else{
  107 + $scope.showDecimal = false;
  108 + $scope.showInteiro= false;
  109 + $scope.unidadeMedida.quantidadeInteiro = '';
  110 + $scope.unidadeMedida.quantidadeDecimal = '';
  111 + }
  112 + });
  113 + };
  114 +
  115 +}]);
83 116 \ No newline at end of file
... ...
cit-adm-materiais-web/src/main/webapp/html/unidadeMedida/unidadeMedidaEdit.html
... ... @@ -2,26 +2,26 @@
2 2 <div class="bar-buttons-action fixed">
3 3 <div class="row">
4 4 <div class="col-sm-8 text-left">
5   -
  5 +
6 6 <button class="btn btn-clear" ng-click="saveOrUpdate()" ng-show="edit">
7 7 <i class="fa fa-save green"></i> <translate>LABEL.SALVAR</translate>
8 8 </button>
9   -
  9 +
10 10 <button class="btn btn-clear" ng-click="limparUnidadeMedida()" ng-show="unidadeMedida.id === undefined">
11 11 <i class="fa fa-eraser yellow-dark"></i> <translate>LABEL.LIMPAR</translate>
12 12 </button>
13   -
  13 +
14 14 <button class="btn btn-clear" ng-show="!edit" ng-click="edit = true">
15 15 <i class="fa fa-pencil blue"></i>
16 16 <translate>LABEL.EDITAR</translate>
17 17 </button>
18   -
  18 +
19 19 <button class="btn btn-clear" ng-click="remove(unidadeMedida);" ng-show="unidadeMedida.id !== undefined">
20 20 <i class="fa fa-times red"></i> <translate>LABEL.REMOVER</translate>
21 21 </button>
22   -
  22 +
23 23 <bloquear-desbloquear ng-model="unidadeMedida" ng-repository="UnidadeMedidaRepository" ng-edit="edit" form="unidadeMedidaForm"></bloquear-desbloquear>
24   -
  24 +
25 25 <button class="btn btn-clear" ng-click="$showPageSearchWorkspace(workspace); atualizaPaginaPesquisa();">
26 26 <i class="fa fa-search"></i> <translate>LABEL.PESQUISAR</translate>
27 27 </button>
... ... @@ -29,17 +29,17 @@
29 29 </div><!-- .col -->
30 30  
31 31 <div class="col-sm-4 text-right">
32   -
  32 +
33 33 <favorito/>
34   -
  34 +
35 35 <help-button workspace="workspace" />
36   -
  36 +
37 37 </div><!-- .col -->
38 38 </div><!-- .row -->
39 39 </div><!-- .bar-buttons-action -->
40   -
  40 +
41 41 <breadcrumb ng-workspace="workspace"></breadcrumb>
42   -
  42 +
43 43 <form name="unidadeMedidaForm">
44 44 <p>
45 45 <small>( <span class="red">*</span> ) <translate>LABEL.CAMPOS_OBRIGATORIOS</translate></small>
... ... @@ -48,44 +48,41 @@
48 48 <fieldset>
49 49  
50 50 <legend><translate>ADMINISTRACAODEMATERIAIS.LABEL.DADOS_UNIDADE_MEDIDA</translate></legend>
51   -
  51 +
52 52 <div class="row">
53   -
  53 +
54 54 <div class="col-md-6">
55   -
  55 +
56 56 <label-input-number ng-id="unidadeMedida.codigo" ng-label="LABEL.CODIGO" ng-obrigatorio="true" ng-disabled="!edit" form="unidadeMedidaForm" ng-model="unidadeMedida.codigo" ng-custom-maxlength="5"/>
57   -
  57 +
58 58 </div>
59   -
  59 +
60 60 <div class="col-md-6">
61   -
  61 +
62 62 <label-input ng-id="unidadeMedida.descricao" ng-label="LABEL.DESCRICAO" ng-obrigatorio="true" ng-disabled="!edit" form="unidadeMedidaForm" ng-model="unidadeMedida.descricao" ng-custom-maxlength="100" />
63   -
  63 +
64 64 </div>
65   - </div>
66   - <div class="row">
  65 + </div>
  66 + <div class="row">
67 67 <div class="col-md-4">
68   -
69   - <label-select ng-id="unidadeMedida.tipoNumerico" ng-label="ADMINISTRACAODEMATERIAIS.LABEL.TIPO_NUMERICO" ng-model="unidadeMedida.tipoNumerico" form="unidadeMedidaForm" ng-obrigatorio="true" ng-disabled="!edit" ng-custom-options="dominio.originalElement as dominio.descricao for dominio" track-by="track by dominio.id" ng-list="tipoNumericoList" />
70   -
  68 +
  69 + <label-select ng-id="unidadeMedida.tipoNumerico" ng-custom-change="alternaTipoNumerico()" ng-label="ADMINISTRACAODEMATERIAIS.LABEL.TIPO_NUMERICO" ng-model="unidadeMedida.tipoNumerico" form="unidadeMedidaForm" ng-obrigatorio="true" ng-disabled="!edit" ng-custom-options="dominio.originalElement as dominio.descricao for dominio" track-by="track by dominio.id" ng-list="tipoNumericoList" />
  70 +
71 71 </div>
72   -
  72 +
73 73 <div class="col-md-4">
74   -
  74 +
75 75 <label-input ng-id="unidadeMedida.sigla" ng-label="LABEL.SIGLA" ng-model="unidadeMedida.sigla" form="unidadeMedidaForm" ng-obrigatorio="true" ng-custom-maxlength="3" ng-type="text" ng-disabled="!edit" />
76   -
77 76 </div>
78   -
79   - <div class="col-md-4">
80   -
81   - <i tooltip="{{$translate.instant('MSG.ALTERACAO_QUANTIDADE_PADRAO')}}">
82   - <label-input-number ng-id="unidadeMedida.quantidadePadrao" ng-label="ADMINISTRACAODEMATERIAIS.LABEL.QUANTIDADE_PADRAO" ng-model="unidadeMedida.quantidadePadrao" form="unidadeMedidaForm" ng-obrigatorio="false" ng-custom-maxlength="3" ng-type="text" ng-disabled="unidadeMedida.isUnidadePadrao || !edit"/>
83   - </i>
  77 +
  78 + <div class="col-md-4" ng-show="showInteiro">
  79 + <label-input-number ng-id="unidadeMedida.quantidadeInteiro" ng-model="unidadeMedida.quantidadeInteiro" ng-custom-maxlength="4" ng-type="text" ng-label="ADMINISTRACAODEMATERIAIS.LABEL.QUANTIDADE_PADRAO" ng-obrigatorio="showInteiro" form="unidadeMedidaForm" ng-disabled="unidadeMedida.isUnidadePadrao || !edit"/>
  80 + </div>
  81 + <div class="col-md-4" ng-show="showDecimal">
  82 + <label-input-decimal ng-precisao="" ng-custom-maxlength="11" ng-id="unidadeMedida.quantidadeDecimal" ng-model="unidadeMedida.quantidadeDecimal" ng-label="ADMINISTRACAODEMATERIAIS.LABEL.QUANTIDADE_PADRAO" ng-obrigatorio="showDecimal" form="unidadeMedidaForm" ng-disabled="unidadeMedida.isUnidadePadrao || !edit"/>
84 83 </div>
85   -
86 84 </div>
87   -
88   - </fieldset>
  85 + </fieldset>
89 86 </form>
90 87 </div><!-- .page-content -->
91 88  
... ...