Commit 0416ac3fe3a3c8cf6de9b64d60b810eb41a8bb1c
1 parent
1fcb31af
Exists in
master
Redmine #4783 terminando regras da reestruturação da entrada de materiais
Showing
3 changed files
with
35 additions
and
6 deletions
Show diff stats
cit-almoxarifado-api/src/main/java/br/com/centralit/api/service/impl/MovimentoEstoqueServiceImpl.java
... | ... | @@ -83,6 +83,8 @@ import br.com.centralit.framework.util.UtilObjeto; |
83 | 83 | @Service("movimentoEstoqueService") |
84 | 84 | public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEstoque, Long> implements MovimentoEstoqueService { |
85 | 85 | |
86 | + private static final int MAXIMO_SAIDAS = 10; | |
87 | + | |
86 | 88 | private static final int IGUAL = 0; |
87 | 89 | |
88 | 90 | private static int SCALE_DIVISOR_DECIMAL = 4; |
... | ... | @@ -623,18 +625,35 @@ public class MovimentoEstoqueServiceImpl extends GenericServiceImpl<MovimentoEst |
623 | 625 | List<String> baixas = this.baixaAlmoxarifadoItemService.buscarBaixasComMateriaisDaEntrada(entrada); |
624 | 626 | |
625 | 627 | String retorno = ""; |
628 | + int totalSaidas = 0; | |
626 | 629 | |
627 | 630 | if (!atendimentos.isEmpty()) { |
628 | 631 | retorno = retorno + this.internacionalizacaoService.getTranslate("ALMOXARIFADO.LABEL.ATENDIMENTO_S", idioma) + ": "; |
629 | - for (String atendimento : atendimentos) { | |
630 | - retorno = retorno + atendimento + "; "; | |
632 | + | |
633 | + if (atendimentos.size() >= MAXIMO_SAIDAS) { | |
634 | + for (int i = 0; i < MAXIMO_SAIDAS; i++) { | |
635 | + retorno = retorno + atendimentos.get(i) + "; "; | |
636 | + totalSaidas++; | |
637 | + } | |
638 | + } else { | |
639 | + for (String atendimento : atendimentos) { | |
640 | + retorno = retorno + atendimento + "; "; | |
641 | + totalSaidas++; | |
642 | + } | |
631 | 643 | } |
632 | 644 | } |
633 | 645 | |
634 | - if (!baixas.isEmpty()) { | |
635 | - retorno = retorno + this.internacionalizacaoService.getTranslate("ALMOXARIFADO.LABEL.BAIXA_S", idioma) + ": "; | |
636 | - for (String baixa : baixas) { | |
637 | - retorno = retorno + baixa + "; "; | |
646 | + if (!baixas.isEmpty() && (totalSaidas < MAXIMO_SAIDAS)) { | |
647 | + retorno = retorno + this.internacionalizacaoService.getTranslate("ALMOXARIFADO.LABEL.BAIXA_S", idioma) + ": "; | |
648 | + | |
649 | + if (baixas.size() >= (MAXIMO_SAIDAS - totalSaidas)) { | |
650 | + for (int i = 0; i < (MAXIMO_SAIDAS - totalSaidas); i++) { | |
651 | + retorno = retorno + baixas.get(i) + "; "; | |
652 | + } | |
653 | + } else { | |
654 | + for (String baixa : baixas) { | |
655 | + retorno = retorno + baixa + "; "; | |
656 | + } | |
638 | 657 | } |
639 | 658 | } |
640 | 659 | ... | ... |
cit-almoxarifado-web/src/main/java/br/com/centralit/listener/StartupListenerAlmoxarifado.java
... | ... | @@ -396,6 +396,7 @@ public class StartupListenerAlmoxarifado extends UtilStartup implements Applicat |
396 | 396 | internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.MSG.MATERIAL_SEM_ENDERECO_CADASTRE", "Não existem endereços de estoque do almoxarifado selecionado para esta entrada vinculados a este material, favor vincular no cadastro do material!", dominio, modulo)); |
397 | 397 | internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.MSG.ENTRADA_ENDERECOS_ESTOQUE_DESVINCULADOS_MATERIAL", "Todos os materiais desta entrada tiveram seu endereço de estoque retirados!", dominio, modulo)); |
398 | 398 | internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.MSG.ENTRADA_ENDERECOS_ESTOQUE_PADRAO_VINCULADOS_MATERIAL", "Todos os materiais desta entrada que tinham endereços padrões neste almoxarifado foram vinculados a ele!", dominio, modulo)); |
399 | + internacionalizacaoList.add(new Internacionalizacao("ALMOXARIFADO.MSG.EXCLUSAO_ULTIMO_ITEM_ENTRADA", "É necessário existir ao menos um item nesta lista, para continuar exclua a entrada inteira ou adicione outro item primeiro!", dominio, modulo)); | |
399 | 400 | } |
400 | 401 | } |
401 | 402 | ... | ... |
cit-almoxarifado-web/src/main/webapp/assets/js/angular/custom/controller/EntradaAlmoxarifadoController.js
... | ... | @@ -436,10 +436,16 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
436 | 436 | }; |
437 | 437 | |
438 | 438 | $scope.removerEntradaItem = function(){ |
439 | + | |
439 | 440 | // recupera os itens da entrada selecionados |
440 | 441 | var itensSelecionados = $scope.getEntradaItemChecked(); |
441 | 442 | |
442 | 443 | if (itensSelecionados.length > 0) { |
444 | + if ($scope.entradaAlmoxarifado.entradasItem.length == 1) { | |
445 | + $scope.showAlert('warning', $translate.instant('ALMOXARIFADO.MSG.EXCLUSAO_ULTIMO_ITEM_ENTRADA')); | |
446 | + return; | |
447 | + } | |
448 | + | |
443 | 449 | $scope.$openModalConfirm({ |
444 | 450 | message: $translate.instant('MSG.CONFIRMA_EXCLUSAO'), |
445 | 451 | callback: function() { |
... | ... | @@ -875,6 +881,9 @@ citApp.controller('EntradaAlmoxarifadoController', ['$scope', '$filter', 'FileUp |
875 | 881 | //Watch para controlar as mudanças de almoxarifado |
876 | 882 | $scope.setAlmoxarifado = function() { |
877 | 883 | $timeout(function() { |
884 | + if (!$scope.edit) { | |
885 | + return; | |
886 | + } | |
878 | 887 | if ($scope.entradaAlmoxarifado.almoxarifado) { |
879 | 888 | if ($scope.entradaAlmoxarifado.entradasItem && $scope.entradaAlmoxarifado.entradasItem.length > 0) { |
880 | 889 | for (var i = 0; i < $scope.entradaAlmoxarifado.entradasItem.length; i++) { | ... | ... |