Commit af72ab5019d3132eabe96b25d8df65256ebacc42
1 parent
0182eb51
Exists in
master
[Redmine Atendimento #4863]Rascunho
Showing
4 changed files
with
84 additions
and
34 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/model/EntradaAlmoxarifado.java
... | ... | @@ -17,11 +17,17 @@ import javax.persistence.OneToMany; |
17 | 17 | import javax.persistence.Table; |
18 | 18 | import javax.persistence.Temporal; |
19 | 19 | import javax.persistence.TemporalType; |
20 | +import javax.persistence.Transient; | |
20 | 21 | |
21 | 22 | import org.hibernate.envers.AuditJoinTable; |
22 | 23 | import org.hibernate.envers.Audited; |
23 | 24 | import org.hibernate.envers.NotAudited; |
24 | 25 | |
26 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
27 | +import com.fasterxml.jackson.annotation.JsonView; | |
28 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |
29 | +import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |
30 | + | |
25 | 31 | import br.com.centralit.api.framework.json.ViewsAdmMateriais; |
26 | 32 | import br.com.centralit.framework.json.JsonCalendarSimpleDateDeserializer; |
27 | 33 | import br.com.centralit.framework.json.JsonCalendarSimpleDateSerializer; |
... | ... | @@ -31,11 +37,6 @@ import br.com.centralit.framework.model.Dominio; |
31 | 37 | import br.com.centralit.framework.model.arquitetura.PersistentObjectAuditOrganizacao; |
32 | 38 | import br.com.centralit.framework.util.UtilObjeto; |
33 | 39 | |
34 | -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
35 | -import com.fasterxml.jackson.annotation.JsonView; | |
36 | -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |
37 | -import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |
38 | - | |
39 | 40 | /** |
40 | 41 | * <p> |
41 | 42 | * <img src="http://centralit.com.br/images/logo_central.png"> |
... | ... | @@ -76,11 +77,13 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
76 | 77 | |
77 | 78 | /** Atributo serialVersionUID. */ |
78 | 79 | private static final long serialVersionUID = 6267732497145774401L; |
79 | - | |
80 | + | |
80 | 81 | /** Atributo id. */ |
81 | 82 | @Id |
82 | -// @SequenceGenerator(name = "entrada_id_seq", sequenceName = "entrada_id_seq") | |
83 | -// @GeneratedValue(strategy = GenerationType.AUTO, generator = "entrada_id_seq") | |
83 | + // @SequenceGenerator(name = "entrada_id_seq", sequenceName = | |
84 | + // "entrada_id_seq") | |
85 | + // @GeneratedValue(strategy = GenerationType.AUTO, generator = | |
86 | + // "entrada_id_seq") | |
84 | 87 | @GeneratedValue(strategy = GenerationType.AUTO) |
85 | 88 | @JsonView({ Views.GenericView.class }) |
86 | 89 | private Long id; |
... | ... | @@ -98,7 +101,8 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
98 | 101 | @Temporal(TemporalType.TIMESTAMP) |
99 | 102 | @JsonSerialize(using = JsonCalendarSimpleDateSerializer.class) |
100 | 103 | @JsonDeserialize(using = JsonCalendarSimpleDateDeserializer.class) |
101 | - @JsonView({ Views.EntradaListView.class, Views.BemPatrimonialEditView.class, Views.BemPatrimonialListView.class, Views.BemPatrimonialAutoCompleteView.class, Views.GenericView.class }) | |
104 | + @JsonView({ Views.EntradaListView.class, Views.BemPatrimonialEditView.class, Views.BemPatrimonialListView.class, | |
105 | + Views.BemPatrimonialAutoCompleteView.class, Views.GenericView.class }) | |
102 | 106 | private Calendar dataContabil; |
103 | 107 | |
104 | 108 | /** Atributo dataRecebimento. */ |
... | ... | @@ -106,7 +110,7 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
106 | 110 | @Temporal(TemporalType.TIMESTAMP) |
107 | 111 | @JsonSerialize(using = JsonCalendarSimpleDateSerializer.class) |
108 | 112 | @JsonDeserialize(using = JsonCalendarSimpleDateDeserializer.class) |
109 | - @JsonView({ Views.EntradaListView.class, Views.BemPatrimonialEditView.class }) | |
113 | + @JsonView({ Views.EntradaListView.class, Views.BemPatrimonialEditView.class }) | |
110 | 114 | private Calendar dataRecebimento; |
111 | 115 | |
112 | 116 | /** Atributo codigo. */ |
... | ... | @@ -150,12 +154,12 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
150 | 154 | /** Atributo codigo. */ |
151 | 155 | @Column(length = 30) |
152 | 156 | private String codigoAsi; |
153 | - | |
157 | + | |
154 | 158 | /** Atributo entrada concluida. */ |
155 | 159 | @Column(name = "isentradaconcluida") |
156 | 160 | @JsonView({ Views.EntradaListView.class }) |
157 | 161 | private Boolean isEntradaConcluida; |
158 | - | |
162 | + | |
159 | 163 | /** Atributo entrada contabilizada. */ |
160 | 164 | @Column(name = "iscontabilizada") |
161 | 165 | @JsonView({ Views.EntradaListView.class }) |
... | ... | @@ -175,15 +179,19 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
175 | 179 | @OneToMany(fetch = FetchType.LAZY, mappedBy = "entrada", cascade = CascadeType.ALL, orphanRemoval = true) |
176 | 180 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
177 | 181 | private Collection<EntradaAlmoxarifadoItem> entradasItem; |
178 | - | |
182 | + | |
179 | 183 | @ManyToOne(fetch = FetchType.LAZY, optional = false) |
180 | 184 | @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) |
181 | 185 | private Dominio dominioFinalidade; |
182 | - | |
186 | + | |
183 | 187 | @ManyToOne(fetch = FetchType.LAZY, optional = true) |
184 | 188 | @JsonView(ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class) |
185 | 189 | private EstruturaOrganizacional unidadeRequisitante; |
186 | 190 | |
191 | + @Transient | |
192 | + @JsonView({ ViewsAdmMateriais.EntradaAlmoxarifadoEditView.class }) | |
193 | + private Long rascunho; | |
194 | + | |
187 | 195 | /** |
188 | 196 | * Retorna o valor do atributo <code>id</code> |
189 | 197 | * |
... | ... | @@ -433,17 +441,17 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
433 | 441 | |
434 | 442 | this.dataReferencia = dataReferencia; |
435 | 443 | } |
436 | - | |
444 | + | |
437 | 445 | /** |
438 | 446 | * Define o valor do atributo <code>isEntradaConcluida</code>. |
439 | 447 | * |
440 | 448 | * @param isEntradaConcluida |
441 | 449 | */ |
442 | 450 | public void setIsEntradaConcluida(Boolean isEntradaConcluida) { |
443 | - | |
451 | + | |
444 | 452 | this.isEntradaConcluida = isEntradaConcluida; |
445 | 453 | } |
446 | - | |
454 | + | |
447 | 455 | /** |
448 | 456 | * Retorna o valor do atributo <code>isEntradaConcluida</code> |
449 | 457 | * |
... | ... | @@ -453,24 +461,24 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
453 | 461 | |
454 | 462 | return isEntradaConcluida; |
455 | 463 | } |
456 | - | |
464 | + | |
457 | 465 | /** |
458 | 466 | * Define o valor do atributo <code>isContabilizada</code>. |
459 | 467 | * |
460 | 468 | * @param isContabilizada |
461 | 469 | */ |
462 | 470 | public void setIsContabilizada(Boolean isContabilizada) { |
463 | - | |
471 | + | |
464 | 472 | this.isContabilizada = isContabilizada; |
465 | 473 | } |
466 | - | |
474 | + | |
467 | 475 | /** |
468 | 476 | * Retorna o valor do atributo <code>isContabilizada</code> |
469 | 477 | * |
470 | 478 | * @return <code>IsContabilizada</code> |
471 | 479 | */ |
472 | 480 | public Boolean getIsContabilizada() { |
473 | - | |
481 | + | |
474 | 482 | return isContabilizada; |
475 | 483 | } |
476 | 484 | |
... | ... | @@ -489,7 +497,7 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
489 | 497 | return this; |
490 | 498 | } |
491 | 499 | } |
492 | - | |
500 | + | |
493 | 501 | /** |
494 | 502 | * Retorna o valor do atributo <code>almoxarifado</code> |
495 | 503 | * |
... | ... | @@ -565,5 +573,13 @@ public class EntradaAlmoxarifado extends PersistentObjectAuditOrganizacao implem |
565 | 573 | public void setUnidadeRequisitante(EstruturaOrganizacional unidadeRequisitante) { |
566 | 574 | this.unidadeRequisitante = unidadeRequisitante; |
567 | 575 | } |
568 | - | |
576 | + | |
577 | + public Long getRascunho() { | |
578 | + return rascunho; | |
579 | + } | |
580 | + | |
581 | + public void setRascunho(Long rascunho) { | |
582 | + this.rascunho = rascunho; | |
583 | + } | |
584 | + | |
569 | 585 | } | ... | ... |
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/EntradaAlmoxarifadoServiceImpl.java
1 | 1 | package br.com.centralit.api.service.impl; |
2 | 2 | |
3 | +import java.util.ArrayList; | |
3 | 4 | import java.util.Calendar; |
4 | 5 | import java.util.HashMap; |
6 | +import java.util.List; | |
5 | 7 | import java.util.Map; |
6 | 8 | |
9 | +import org.apache.commons.lang3.StringUtils; | |
7 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
8 | 11 | import org.springframework.beans.factory.annotation.Qualifier; |
9 | 12 | import org.springframework.stereotype.Service; |
10 | 13 | import org.springframework.validation.Validator; |
11 | 14 | |
15 | +import com.drew.lang.StringUtil; | |
16 | + | |
12 | 17 | import br.com.centralit.api.dao.EntradaAlmoxarifadoDao; |
13 | 18 | import br.com.centralit.api.model.BemAlmoxarifadoCaracteristica; |
14 | 19 | import br.com.centralit.api.model.EntradaAlmoxarifado; |
... | ... | @@ -26,6 +31,7 @@ import br.com.centralit.api.service.MaterialCaracteristicaService; |
26 | 31 | import br.com.centralit.api.service.MaterialConsumoService; |
27 | 32 | import br.com.centralit.api.service.MovimentoEstoqueService; |
28 | 33 | import br.com.centralit.api.service.ParceiroService; |
34 | +import br.com.centralit.api.service.RascunhoService; | |
29 | 35 | import br.com.centralit.api.service.UnidadeMedidaService; |
30 | 36 | import br.com.centralit.api.service.UsuarioService; |
31 | 37 | import br.com.centralit.api.service.validation.EntradaAlmoxarifadoAllValidator; |
... | ... | @@ -106,6 +112,9 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
106 | 112 | @Autowired |
107 | 113 | private ConfiguracaoParametroSistemaService configuracaoParametroSistemaService; |
108 | 114 | |
115 | + @Autowired | |
116 | + private RascunhoService rascunhoService; | |
117 | + | |
109 | 118 | private Validator validatorBasic; |
110 | 119 | |
111 | 120 | private Validator validatorAll; |
... | ... | @@ -152,6 +161,8 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
152 | 161 | configurarNotaRecebimento(entradaAlmoxarifado); |
153 | 162 | |
154 | 163 | entrada.setCodigo(String.valueOf(entradaAlmoxarifado.getNotaRecebimento())); |
164 | + | |
165 | + rascunhoService.removeById(entrada.getRascunho()); | |
155 | 166 | |
156 | 167 | return entradaAlmoxarifado; |
157 | 168 | } |
... | ... | @@ -188,16 +199,24 @@ public class EntradaAlmoxarifadoServiceImpl extends GenericServiceImpl<EntradaAl |
188 | 199 | entradaAlmoxarifadoItem.setUnidadeMedidaEntrada(this.unidadeMedidaService.find(entradaAlmoxarifadoItem.getUnidadeMedidaEntrada().getId())); |
189 | 200 | |
190 | 201 | entradaAlmoxarifadoItem.setEntrada(entrada); |
202 | + | |
203 | + List<BemAlmoxarifadoCaracteristica> caracteristicas = new ArrayList<BemAlmoxarifadoCaracteristica>(); | |
191 | 204 | |
192 | 205 | //TODO Arrumar caracteristicas |
193 | 206 | for (BemAlmoxarifadoCaracteristica bemAlmoxarifadoCaracteristica : entradaAlmoxarifadoItem.getCaracteristicas()) { |
207 | + | |
208 | + if(StringUtils.isNotBlank(bemAlmoxarifadoCaracteristica.getValorCaracteristica())){ | |
209 | + bemAlmoxarifadoCaracteristica.setMaterialCaracteristica(this.materialCaracteristicaService.find(bemAlmoxarifadoCaracteristica.getMaterialCaracteristica().getId())); | |
210 | + | |
211 | + bemAlmoxarifadoCaracteristica.setCaracteristica(bemAlmoxarifadoCaracteristica.getMaterialCaracteristica().getCaracteristica()); | |
212 | + | |
213 | + bemAlmoxarifadoCaracteristica.setEntradaItem(entradaAlmoxarifadoItem); | |
214 | + caracteristicas.add(bemAlmoxarifadoCaracteristica); | |
215 | + } | |
194 | 216 | |
195 | - bemAlmoxarifadoCaracteristica.setMaterialCaracteristica(this.materialCaracteristicaService.find(bemAlmoxarifadoCaracteristica.getMaterialCaracteristica().getId())); | |
196 | - | |
197 | - bemAlmoxarifadoCaracteristica.setCaracteristica(bemAlmoxarifadoCaracteristica.getMaterialCaracteristica().getCaracteristica()); | |
198 | - | |
199 | - bemAlmoxarifadoCaracteristica.setEntradaItem(entradaAlmoxarifadoItem); | |
200 | 217 | } |
218 | + | |
219 | + entradaAlmoxarifadoItem.setCaracteristicas(caracteristicas); | |
201 | 220 | |
202 | 221 | } |
203 | 222 | ... | ... |
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js
... | ... | @@ -40,6 +40,9 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
40 | 40 | |
41 | 41 | $scope.atualizarListaSizeSelectEntradaItem(); |
42 | 42 | $scope.edit = true; |
43 | + | |
44 | + $scope.startTimerIntervalSaveDraft($scope.workspace , $scope.entradaAlmoxarifado, true); | |
45 | + | |
43 | 46 | $timeout(function(){ |
44 | 47 | $scope.entradaAlmoxarifadoForm.$submitted = false; |
45 | 48 | $scope.entradaAlmoxarifadoForm.$setPristine(); |
... | ... | @@ -135,6 +138,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
135 | 138 | $scope.calcularValorTotalMateriais(); |
136 | 139 | $scope.atualizarListaSizeSelectEntradaItem(); |
137 | 140 | $scope.edit = edit; |
141 | + $scope.stopTimerIntervalDraft($scope.workspace); | |
138 | 142 | $scope.setLoading(false); |
139 | 143 | }); |
140 | 144 | |
... | ... | @@ -146,6 +150,17 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
146 | 150 | } |
147 | 151 | }); |
148 | 152 | }; |
153 | + | |
154 | + $scope.setRascunho = function(rascunho){ | |
155 | + | |
156 | + if (rascunho) { | |
157 | + $scope.entradaAlmoxarifado = rascunho; | |
158 | + } | |
159 | + $scope.workspace.objetoScope = $scope.entradaAlmoxarifado; | |
160 | + $scope.startTimerIntervalSaveDraft($scope.workspace); | |
161 | + $scope.edit = true; | |
162 | + $scope.setLoading(false); | |
163 | + }; | |
149 | 164 | |
150 | 165 | $scope.findAutoCompleteAlmoxarifado = function(value){ |
151 | 166 | return EstruturaOrganizacionalAlmoxarifadoRepository.listarEstruturasOrganizacionaisAlmoxarifadoPorOrganizacao(value, $scope.usuarioLogado.organizacao.id).then(function(result) { |
... | ... | @@ -410,6 +425,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
410 | 425 | |
411 | 426 | $scope.entradaAlmoxarifado.isEntradaConcluida = true; |
412 | 427 | $scope.entradaAlmoxarifadoOriginal.isEntradaConcluida = true; |
428 | + $scope.entradaAlmoxarifado.rascunho = $scope.workspace.rascunho ? $scope.workspace.rascunho.id : null; | |
413 | 429 | |
414 | 430 | if (contabilizar) { |
415 | 431 | $scope.dataContabilFinal = $scope.entradaAlmoxarifado.dataContabil; |
... | ... | @@ -1078,12 +1094,7 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
1078 | 1094 | if (formDialogCaracteristicas.$valid) { |
1079 | 1095 | angular.forEach($scope.entradaAlmoxarifado.entradasItem, function(entradaItem){ |
1080 | 1096 | if (entradaItem.$checked) { |
1081 | - entradaItem.caracteristicas = []; | |
1082 | - angular.forEach($scope.caracteristicasGenericas, function(caracteristicaGenerica){ | |
1083 | - if(caracteristicaGenerica.valorCaracteristica){ | |
1084 | - entradaItem.caracteristicas.push(caracteristicaGenerica); | |
1085 | - } | |
1086 | - }); | |
1097 | + entradaItem.caracteristicas = $scope.caracteristicasGenericas; | |
1087 | 1098 | } |
1088 | 1099 | }); |
1089 | 1100 | $scope.caracteristicasGenericas = []; | ... | ... |
cit-almoxarifado-web/src/main/webapp/html/entradaAlmoxarifado/entradaAlmoxarifadoList.html
... | ... | @@ -29,6 +29,10 @@ |
29 | 29 | <i class="fa fa-print"></i> |
30 | 30 | <translate>LABEL.RELATORIO</translate> |
31 | 31 | </button> |
32 | + | |
33 | + <button class="btn btn-clear" ng-click="showListRascunho(workspace.name, 'entradaAlmoxarifadoControllerId')" type="button"> | |
34 | + <i class="fa fa-list"></i> <translate>PORTAL.LABEL.SHOW_RASCUNHO</translate> | |
35 | + </button> | |
32 | 36 | |
33 | 37 | <span class="divider-vertical"></span> |
34 | 38 | ... | ... |