From 3cb86ba7b3e5c33ba1f7cec84f468684bccd9973 Mon Sep 17 00:00:00 2001 From: Kana Date: Mon, 22 Jan 2024 10:12:52 +0900 Subject: [PATCH] change inController --- .../java/com/no1/wms/in/InController.java | 36 +--------- src/main/java/com/no1/wms/in/InService.java | 41 +++++++++++ src/main/webapp/WEB-INF/views/in/update.jsp | 71 ++++++++++--------- 3 files changed, 80 insertions(+), 68 deletions(-) diff --git a/src/main/java/com/no1/wms/in/InController.java b/src/main/java/com/no1/wms/in/InController.java index 6334686..8397990 100644 --- a/src/main/java/com/no1/wms/in/InController.java +++ b/src/main/java/com/no1/wms/in/InController.java @@ -79,37 +79,7 @@ public class InController { @PostMapping("/create_process") @ResponseBody public boolean createProcess(InDto dto) { - int j = inService.checkIfExistsStock(dto); - if(j == 1) { - int k = inService.updateStockProcess(dto); - if(k == 1) { - int i = inService.createProcess(dto); - if(i == k) { - System.out.println("달라서 새로만듬"); - return true; - }else { - return false; - } - }else { - return false; - } - - }else if(j == 0) { - int k = inService.createStockProcess(dto); - if(k == 1) { - int i = inService.createProcess(dto); - if(i == k) { - System.out.println("같아서 합침"); - return true; - }else { - return false; - } - }else { - return false; - } - }else { - return false; - } + return inService.chechAndUpdateOrCreateProcess(dto); } @PostMapping("/read") @@ -202,8 +172,8 @@ public class InController { List> list = null; int count = 0; - list = stockservice.warehousesSelect(searchn, search, startRow, perPage, product_id); - count = stockservice.warehouseCount(searchn, search, product_id); + list = stockservice.warehousesSelect(searchn, search, startRow, perPage); + count = stockservice.warehouseCount(searchn, search); mav.addObject("list", list); diff --git a/src/main/java/com/no1/wms/in/InService.java b/src/main/java/com/no1/wms/in/InService.java index f837f5d..4c84faa 100644 --- a/src/main/java/com/no1/wms/in/InService.java +++ b/src/main/java/com/no1/wms/in/InService.java @@ -58,4 +58,45 @@ public class InService { return mapper.createStockProcess(dto); } + //createProcess + public boolean chechAndUpdateOrCreateProcess(InDto dto) { + int j = mapper.checkIfExistsStock(dto); + if(j == 1) { + int k = mapper.updateStockProcess(dto); + if(k == 1) { + int i = mapper.createProcess(dto); + if(i == k) { + System.out.println("달라서 새로만듬"); + return true; + }else { + return false; + } + }else { + return false; + } + + }else if(j == 0) { + int k = mapper.createStockProcess(dto); + if(k == 1) { + int i = mapper.createProcess(dto); + if(i == k) { + System.out.println("같아서 합침"); + return true; + }else { + return false; + } + }else { + return false; + } + }else { + return false; + } + } + + + + + + + } diff --git a/src/main/webapp/WEB-INF/views/in/update.jsp b/src/main/webapp/WEB-INF/views/in/update.jsp index 7bdfab3..3a79e20 100644 --- a/src/main/webapp/WEB-INF/views/in/update.jsp +++ b/src/main/webapp/WEB-INF/views/in/update.jsp @@ -103,6 +103,7 @@ + @@ -216,41 +217,41 @@ });//submitBtn });//ready - function showSearchModal(title, val){ - $("#searchModalLabel").text(title); - const data = { name : val}; - $.ajax({ - type : 'post', // 타입 (get, post, put 등등) - url : '/product/show_modal', // 요청할 서버url - dataType : 'html', // 데이터 타입 (html, xml, json, text 등등) - data : data, - success : function(result) { // 결과 성공 콜백함수 - $("#search_modal_body").html(result); - searchModalBootStrap.show(); - }, - error : function(request, status, error) { - alert(error) - } - }); - } - - function showSearchModal2(title, val){ - $("#searchModalLabel").text(title); - const data = { name : val}; - $.ajax({ - type : 'post', // 타입 (get, post, put 등등) - url : '/product/show_modal2', // 요청할 서버url - dataType : 'html', // 데이터 타입 (html, xml, json, text 등등) - data : data, - success : function(result) { // 결과 성공 콜백함수 - $("#search_modal_body").html(result); - searchModalBootStrap.show(); - }, - error : function(request, status, error) { - alert(error) - } - }); - } + function showSearchModal_product(title, val){ + $("#searchModalLabel").text(title); + const data = { name : val}; + $.ajax({ + type : 'post', // 타입 (get, post, put 등등) + url : '/in/show_modal_product', // 요청할 서버url + dataType : 'html', // 데이터 타입 (html, xml, json, text 등등) + data : data, + success : function(result) { // 결과 성공 콜백함수 + $("#search_modal_body").html(result); + searchModalBootStrap.show(); + }, + error : function(request, status, error) { + alert(error) + } + }); + }//showSearchModal_products + + function showSearchModal_warehouse(title, val){ + $("#searchModalLabel").text(title); + const data = { name : val}; + $.ajax({ + type : 'post', // 타입 (get, post, put 등등) + url : '/in/show_modal_warehouse', // 요청할 서버url + dataType : 'html', // 데이터 타입 (html, xml, json, text 등등) + data : data, + success : function(result) { // 결과 성공 콜백함수 + $("#search_modal_body").html(result); + searchModalBootStrap.show(); + }, + error : function(request, status, error) { + alert(error) + } + }); + }//showSearchModal_warehouse \ No newline at end of file