diff --git a/src/main/java/com/no1/wms/excel/ExcelDownlodeUtils.java b/src/main/java/com/no1/wms/excel/ExcelDownlodeUtils.java index daa6dd8..8850a21 100644 --- a/src/main/java/com/no1/wms/excel/ExcelDownlodeUtils.java +++ b/src/main/java/com/no1/wms/excel/ExcelDownlodeUtils.java @@ -240,7 +240,7 @@ public class ExcelDownlodeUtils { cell = row.createCell(2); cell.setCellValue((String) dto.get("warehouseName")); cell = row.createCell(3); - cell.setCellValue((String) dto.get("quantity")); + cell.setCellValue((int) dto.get("quantity")); } } diff --git a/src/main/java/com/no1/wms/in/InController.java b/src/main/java/com/no1/wms/in/InController.java index 6f62822..f822bf5 100644 --- a/src/main/java/com/no1/wms/in/InController.java +++ b/src/main/java/com/no1/wms/in/InController.java @@ -6,6 +6,7 @@ import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -79,13 +80,7 @@ public class InController { @PostMapping("/create_process") @ResponseBody public boolean createProcess(InDto dto) { - int i = inService.createProcess(dto); - int j = inService.createProcess2(dto); - if (i == 1 & i == j) { - return true; - } else { - return false; - } + return inService.chechAndUpdateOrCreateProcessForCreate(dto); } @PostMapping("/read") @@ -115,13 +110,9 @@ public class InController { // 수정 - Ajax @PutMapping("/update_process") @ResponseBody - public boolean update_process(InDto dto) { - int i = inService.updateById(dto); - if (i == 1) { - return true; - } else { - return false; - } + public boolean updateProcess(InDto dto) { + return inService.chechAndUpdateProcess(dto); + } @@ -172,14 +163,14 @@ public class InController { @RequestParam(name = "p", defaultValue = "1") int page, @RequestParam String name, String product_id, ModelAndView mav){ - int perPage = 9; // 한 페이지에 보일 글의 갯수 + int perPage = 5; // 한 페이지에 보일 글의 갯수 int startRow = (page - 1) * perPage; 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); @@ -206,7 +197,11 @@ public class InController { return mav; } - + @DeleteMapping("/delete") + @ResponseBody + public boolean delete(String id) { + return inService.deactivateById(id); + } diff --git a/src/main/java/com/no1/wms/in/InMapper.java b/src/main/java/com/no1/wms/in/InMapper.java index 97883e0..e204958 100644 --- a/src/main/java/com/no1/wms/in/InMapper.java +++ b/src/main/java/com/no1/wms/in/InMapper.java @@ -13,5 +13,13 @@ public interface InMapper { int createProcess2(InDto dto); InDto selectById (String id); int updateById(InDto dto); - + int checkIfExistsStock(InDto dto); + int updateStockProcess(InDto dto); + int createStockProcess(InDto dto); + int currntStockQuantity(InDto dto); + int currntInQuantity(InDto dto); + int updateStockProcessForUpdate(InDto dto); + int deactivateById(String id); + String selectWarehouseQuantity(String warehouseId); + int updateWarehouseQuantity(Map m); } diff --git a/src/main/java/com/no1/wms/in/InService.java b/src/main/java/com/no1/wms/in/InService.java index 6adb815..0540d73 100644 --- a/src/main/java/com/no1/wms/in/InService.java +++ b/src/main/java/com/no1/wms/in/InService.java @@ -46,6 +46,121 @@ public class InService { return mapper.updateById(dto); } + public int checkIfExistsStock(InDto dto) { + return mapper.checkIfExistsStock(dto); + } + + public int updateStockProcess(InDto dto) { + return mapper.updateStockProcess(dto); + } + + public int createStockProcess(InDto dto) { + return mapper.createStockProcess(dto); + } + + //createProcess + public boolean chechAndUpdateOrCreateProcessForCreate(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; + } + } + + //updateProcess + public boolean chechAndUpdateProcess(InDto dto) { + int j = mapper.checkIfExistsStock(dto);//재고에 동일한 창고, 제품이 있는지 + if(j == 1) {//재고에 동일한 창고, 제품이 있다면 + int currentStockQuantity = mapper.currntStockQuantity(dto);//현재 재고의 개수 + int changeInQuantity = Integer.parseInt(dto.getQuantity());//변경된 입고의 개수 + int currentInQuantity = mapper.currntInQuantity(dto);//기존의 입고의 개수 + int modifiedStockQuantity = currentStockQuantity + changeInQuantity - currentInQuantity;//수정된 재고의 개수 + if(currentStockQuantity == modifiedStockQuantity) {//현재 재고의 개수와 변한 재고의 개수가 같다면 + int i = mapper.updateById(dto);//재고는 놔두고 입고만 업데이트 한다 + if(i == 1) { + return true; + }else { + return false; + } + }else{//현재 재고의 개수보다 변한 재고의 개수가 더 크거나 작다면 + int i = mapper.updateById(dto); // 입고를 먼저 업데이트하고 + dto.setQuantity(modifiedStockQuantity+"");// 변경 개수를 적용하여 + int k = mapper.updateStockProcessForUpdate(dto); // 재고테이블에 반영한다. + if (i == k) { + return true; + }else { + return false; + } + }//else + }else {// 재고에 동일 재품 동일 창고가 없다면 오류발생. + return false; + } + + } + + public boolean deactivateById(String id) { + InDto dto = mapper.selectById(id); + int j = mapper.checkIfExistsStock(dto);//재고에 동일한 창고, 제품이 있는지 + if(j == 1) { + int currentStockQuantity = mapper.currntStockQuantity(dto);//스톡의 재고수 + int deactivateInQuantity = Integer.parseInt(dto.getQuantity());//in의 재고수 + if(currentStockQuantity >= deactivateInQuantity) {//스톡의 재고수가 in의 재고수보다 많을 때 + mapper.deactivateById(id);// 입고 비활성화 + int modifiedStockQuantity = currentStockQuantity - deactivateInQuantity; + dto.setQuantity(modifiedStockQuantity+"");// 변경 개수를 적용하여 + int k = mapper.updateStockProcessForUpdate(dto); // 재고테이블에 반영한다. + return true; + }else { + return false; + } + + }else { + return false; + } + + } + //사용하지 않음. + public void updateWarehouse(InDto dto) { + String warehouseId = dto.getId(); + String updateValue = mapper.selectWarehouseQuantity(warehouseId); + Map m = new HashMap(); + m.put("warehouseId", warehouseId); + m.put("updateValue", updateValue); + mapper.updateWarehouseQuantity(m); + + } + + + } diff --git a/src/main/java/com/no1/wms/out/ProductOutController.java b/src/main/java/com/no1/wms/out/ProductOutController.java index 47423ee..5603f85 100644 --- a/src/main/java/com/no1/wms/out/ProductOutController.java +++ b/src/main/java/com/no1/wms/out/ProductOutController.java @@ -120,7 +120,7 @@ public class ProductOutController { @ResponseBody public int delete(ProductOutDto dto) { System.out.println("데이터 :: " + dto); - int i = service.deleteOut(dto); + int i = service.outNow(dto); return i; } @@ -130,13 +130,10 @@ public class ProductOutController { @PutMapping("/outNow") @ResponseBody public boolean outNow(ProductOutDto dto) { - int i = service.outNowUpdate(dto); - if (i != 0) { - service.updateWarehouseDeleteStock(dto); - return true; - } else { - return false; - } + service.outNowUpdate(dto); + service.updateWarehouseDeleteStock(dto); + service.stockQuantityUpdate(dto); + return true; } diff --git a/src/main/java/com/no1/wms/out/ProductOutDto.java b/src/main/java/com/no1/wms/out/ProductOutDto.java index c2c0ea6..76955cf 100644 --- a/src/main/java/com/no1/wms/out/ProductOutDto.java +++ b/src/main/java/com/no1/wms/out/ProductOutDto.java @@ -26,4 +26,6 @@ public class ProductOutDto { + + } diff --git a/src/main/java/com/no1/wms/out/ProductOutMapper.java b/src/main/java/com/no1/wms/out/ProductOutMapper.java index f28f3b3..4dd549f 100644 --- a/src/main/java/com/no1/wms/out/ProductOutMapper.java +++ b/src/main/java/com/no1/wms/out/ProductOutMapper.java @@ -1,5 +1,6 @@ package com.no1.wms.out; +import com.no1.wms.stock.StockDto; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -25,6 +26,8 @@ public interface ProductOutMapper { int updateWarehousePlus(ProductOutDto dto); int updateWarehouseDeleteStock(ProductOutDto dto); + + int stockQuantityUpdate(ProductOutDto dto); int createOut(ProductOutDto dto); @@ -41,6 +44,7 @@ public interface ProductOutMapper { + } diff --git a/src/main/java/com/no1/wms/out/ProductOutService.java b/src/main/java/com/no1/wms/out/ProductOutService.java index ae3eb8d..0c3ec5b 100644 --- a/src/main/java/com/no1/wms/out/ProductOutService.java +++ b/src/main/java/com/no1/wms/out/ProductOutService.java @@ -1,5 +1,6 @@ package com.no1.wms.out; +import com.no1.wms.stock.StockDto; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -73,6 +74,10 @@ public class ProductOutService { return mapper.updateWarehouseDeleteStock(dto); } + public int stockQuantityUpdate(ProductOutDto dto) { + return mapper.stockQuantityUpdate(dto); + } + public int deleteOut(ProductOutDto dto) { return mapper.deleteOut(dto); } @@ -103,6 +108,5 @@ public class ProductOutService { } - } diff --git a/src/main/java/com/no1/wms/planin/PlanInController.java b/src/main/java/com/no1/wms/planin/PlanInController.java index 280b117..9eebad7 100644 --- a/src/main/java/com/no1/wms/planin/PlanInController.java +++ b/src/main/java/com/no1/wms/planin/PlanInController.java @@ -33,9 +33,9 @@ public class PlanInController { @GetMapping("/list") public ModelAndView list(ModelAndView mav,@RequestParam(defaultValue = "0") int searchn, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "1") int page){ - int perPage = 10; + int perPage = 15; int startRow = (page - 1) * perPage; - int count = planinservice.count(searchn, search, startRow, perPage); + int count = planinservice.count(searchn, search); @@ -44,8 +44,6 @@ public class PlanInController { - - //스톡서비스로 재고 리스트 출력 메서트 작성 List list = planinservice.selectAll(searchn, search, startRow, perPage); HashMap map = new HashMap<>(); for( int i = 0 ; i < list.size(); ++i){ diff --git a/src/main/java/com/no1/wms/planin/PlanInService.java b/src/main/java/com/no1/wms/planin/PlanInService.java index 2431a51..b816bab 100644 --- a/src/main/java/com/no1/wms/planin/PlanInService.java +++ b/src/main/java/com/no1/wms/planin/PlanInService.java @@ -21,12 +21,10 @@ public class PlanInService { } - int count(int searchn, String search, int start, int perPage){ + int count(int searchn, String search){ HashMap m = new HashMap<>(); m.put("searchn", searchn); m.put("search", search); - m.put("start", start); - m.put("perPage", perPage); return mapper.count(m); } diff --git a/src/main/java/com/no1/wms/stock/StockController.java b/src/main/java/com/no1/wms/stock/StockController.java index facdd24..65d01de 100644 --- a/src/main/java/com/no1/wms/stock/StockController.java +++ b/src/main/java/com/no1/wms/stock/StockController.java @@ -146,14 +146,9 @@ public class StockController { // 생성 - Ajax @PostMapping("/create_process") @ResponseBody - public boolean createProcess(StockDto dto) { - int i = service.createStock(dto); - if (i != 0) { - service.updateWarehousePlus(dto); - return true; - } else { - return false; - } + public int createProcess(StockDto dto) { + int c = service.checkandUpdateOrCreateProcess(dto); + return c; } @@ -172,10 +167,10 @@ public class StockController { @PostMapping("/show_modal") public ModelAndView showModal(@RequestParam(name = "searchn", defaultValue = "0") int searchn, @RequestParam(name = "search", defaultValue = "") String search, - @RequestParam(name = "p", defaultValue = "1") int page, String product_id, + @RequestParam(name = "p", defaultValue = "1") int page, @RequestParam String name, ModelAndView mav){ - int perPage = 5; // 한 페이지에 보일 글의 갯수 + int perPage = 9; // 한 페이지에 보일 글의 갯수 int startRow = (page - 1) * perPage; List> list = null; @@ -193,10 +188,9 @@ public class StockController { list = service.productSelect(searchn, search, startRow, perPage); count = service.productCount(searchn, search); }else if(name.equals("warehouse_capacity_currentCapacity")) { - list = service.warehousesSelect(searchn, search, startRow, perPage ,product_id); - count = service.warehouseCount(searchn, search ,product_id); + list = service.warehousesSelect(searchn, search, startRow, perPage); + count = service.warehouseCount(searchn, search); } - mav.addObject("list", list); mav.addObject("start", startRow + 1); @@ -230,9 +224,10 @@ public class StockController { // 리스트 다운로드 - @GetMapping("/stock/downloadExcelList") + @GetMapping("/downloadExcelList") public void downlodeExcelList(HttpServletResponse response) { List> dto = service.selectAll(); + System.out.println("엑셀 출력 확인 : : " + dto); String excelFileName = "재고 파일"; String sheetName = "재고"; String[] columnName = {"제품명","카테고리","창고","재고수"}; @@ -241,7 +236,7 @@ public class StockController { }; //서식 다운로드 - @GetMapping("/stock/downloadStockForm") + @GetMapping("/downloadStockForm") public void downlodeStockForm (HttpServletResponse response) throws IOException { String stockFormName = "재고 데이터 입력 서식.xlsx"; excelDownlodeUtils.downlodeExcelForm(response, stockFormName); diff --git a/src/main/java/com/no1/wms/stock/StockMapper.java b/src/main/java/com/no1/wms/stock/StockMapper.java index 1fa0ad7..009c55a 100644 --- a/src/main/java/com/no1/wms/stock/StockMapper.java +++ b/src/main/java/com/no1/wms/stock/StockMapper.java @@ -1,5 +1,6 @@ package com.no1.wms.stock; +import com.no1.wms.in.InDto; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -43,6 +44,12 @@ public interface StockMapper { int warehouseCount(Map m);//검색 글 갯수 + + int checkIfExistsStock(StockDto dto); + int updateStockProcess(StockDto dto); + int createStockProcess(StockDto dto); + + } diff --git a/src/main/java/com/no1/wms/stock/StockService.java b/src/main/java/com/no1/wms/stock/StockService.java index 2dbe496..1ba0e6b 100644 --- a/src/main/java/com/no1/wms/stock/StockService.java +++ b/src/main/java/com/no1/wms/stock/StockService.java @@ -13,24 +13,24 @@ import java.util.Map; public class StockService { @Autowired StockMapper mapper; - + public int count(int searchn, String search) { - - System.out.println(searchn+search); - - Map m = new HashMap(); - m.put("searchn",searchn); + + System.out.println(searchn + search); + + Map m = new HashMap(); + m.put("searchn", searchn); m.put("search", search); return mapper.count(m); } - - public List> list(int searchn, String search, int start, int perPage){ - - System.out.println(searchn+search); - + + public List> list(int searchn, String search, int start, int perPage) { + + System.out.println(searchn + search); + Map m = new HashMap(); - m.put("searchn",searchn); + m.put("searchn", searchn); m.put("search", search); m.put("start", start); m.put("perPage", perPage); @@ -38,26 +38,26 @@ public class StockService { List> result = mapper.list(m); log.debug("warehouseOne테스트 :: " + result); return result; - + } public int count2(int searchn, String search) { - System.out.println(searchn+search); + System.out.println(searchn + search); - Map m = new HashMap(); - m.put("searchn",searchn); + Map m = new HashMap(); + m.put("searchn", searchn); m.put("search", search); return mapper.count2(m); } - public List> list2(int searchn, String search, int start, int perPage){ + public List> list2(int searchn, String search, int start, int perPage) { - System.out.println(searchn+search); + System.out.println(searchn + search); Map m = new HashMap(); - m.put("searchn",searchn); + m.put("searchn", searchn); m.put("search", search); m.put("start", start); m.put("perPage", perPage); @@ -68,30 +68,30 @@ public class StockService { } - + public Map stockOne(String id) { return mapper.stockOne(id); } - - + + public int createStock(StockDto dto) { return mapper.createStock(dto); } - - + + public int updateStock(StockDto dto) { return mapper.updateStock(dto); } - public int updateWarehouse(StockDto dto){ + public int updateWarehouse(StockDto dto) { return mapper.updateWarehouse(dto); } - public int updateWarehousePlus(StockDto dto){ + public int updateWarehousePlus(StockDto dto) { return mapper.updateWarehousePlus(dto); } - public int updateWarehouseDeleteStock(StockDto dto){ + public int updateWarehouseDeleteStock(StockDto dto) { return mapper.updateWarehouseDeleteStock(dto); } @@ -100,7 +100,7 @@ public class StockService { } - public List> productSelect(int searchn, String search, int start, int perPage){ + public List> productSelect(int searchn, String search, int start, int perPage) { Map m = new HashMap(); m.put("searchn", searchn); m.put("search", search); @@ -115,32 +115,30 @@ public class StockService { public int productCount(int searchn, String search) { - Map m = new HashMap(); - m.put("searchn",searchn); + Map m = new HashMap(); + m.put("searchn", searchn); m.put("search", search); return mapper.productCount(m); } - public List> warehousesSelect(int searchn, String search, int start, int perPage, String product_id){ + public List> warehousesSelect(int searchn, String search, int start, int perPage) { Map m = new HashMap(); m.put("searchn", searchn); m.put("search", search); m.put("start", start); m.put("perPage", perPage); - m.put("product_id", product_id); List> warehouseresult = mapper.warehouseSelect(m); return warehouseresult; } - public int warehouseCount(int searchn, String search, String product_id) { + public int warehouseCount(int searchn, String search) { - Map m = new HashMap(); - m.put("searchn",searchn); + Map m = new HashMap(); + m.put("searchn", searchn); m.put("search", search); - m.put("product_id", product_id); return mapper.warehouseCount(m); } @@ -149,5 +147,17 @@ public class StockService { } -} + //createProcess + public int checkandUpdateOrCreateProcess(StockDto dto){ + mapper.updateWarehousePlus(dto); + int j = mapper.checkIfExistsStock(dto); + if (j == 1){ + mapper.updateStockProcess(dto); + return 1; + }else{ + mapper.createStockProcess(dto); + return 2; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/no1/wms/vendor/VendorController.java b/src/main/java/com/no1/wms/vendor/VendorController.java index 0f53f17..c414826 100644 --- a/src/main/java/com/no1/wms/vendor/VendorController.java +++ b/src/main/java/com/no1/wms/vendor/VendorController.java @@ -2,15 +2,22 @@ package com.no1.wms.vendor; import com.no1.wms.category.CategoryDto; import com.no1.wms.excel.ExcelDownlodeUtils; +import com.no1.wms.excel.ExcelRequestManager; import com.no1.wms.warehouse.WarehouseDto; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -146,4 +153,61 @@ public class VendorController { String vendorFormName = "거래처 데이터 입력 서식.xlsx"; excelDownlodeUtils.downlodeExcelForm(response, vendorFormName); }; + + + + @PostMapping("/vendor/uplodeExcel") + public String uploadExcel(@ModelAttribute("dto") VendorDto dto , RedirectAttributes redirectAttributes, final MultipartHttpServletRequest multiRequest, + HttpServletRequest request, ModelMap model) { + + Map resMap = new HashMap<>(); + + + try { + + ExcelRequestManager em = new ExcelRequestManager(); + + // 멀티파트 요청 객체에서 파일 맵을 가져옴 + final Map files = multiRequest.getFileMap(); + //초기화 + List> apply =null; + + //엑셀파일 가져와서 저장 및 읽기 + //변수는 멀티파트 요청 객체의 파일맵, 저장할 엑셀파일명 이름에 추가할 숫자(그냥 0으로 해도 됨) + //마찬가지로 엑셀파일 명 이름에 추가할 문자열, uplode폴더에 들어갈 폴더명(카테고리같은 파트 이름으로 해주세요) + //폴더가 없으면 자동생성되게 해뒀습니다. + //마지막으로 HttpServletRequest + apply = em.parseExcelSpringMultiPart(files, "테스트파일", 0, "", "category", request); + + for (int i = 0; i < apply.size(); i++) { + + + dto.setName(apply.get(i).get("nsme")); + dto.setPresident_name(apply.get(i).get("president_name")); + dto.setAddress(apply.get(i).get("address")); + dto.setRegistration_number(apply.get(i).get("registration_number")); + dto.setEmail(apply.get(i).get("email")); + dto.setPresident_telephone(apply.get(i).get("president_telephone")); + dto.setVendor_manager(apply.get(i).get("vendor_manager")); + dto.setVendor_manager_telephone(apply.get(i).get("vendor_manager_telephone")); + dto.setMain_product(apply.get(i).get("main_product")); + dto.setManager_id(apply.get(i).get("manager_id")); + dto.setActivation(true); + + service.createProcess(dto); + + } + + resMap.put("res", "ok"); + resMap.put("msg", "업로드 성공"); + } catch (Exception e) { + System.out.println(e.toString()); + resMap.put("res", "error"); + resMap.put("msg", "업로드 실패"); + } + + redirectAttributes.addFlashAttribute("resMap", resMap); + + return "redirect:/vendor/list"; + }; } diff --git a/src/main/java/com/no1/wms/vendor/VendorMapper.java b/src/main/java/com/no1/wms/vendor/VendorMapper.java index 46e39b6..179f677 100644 --- a/src/main/java/com/no1/wms/vendor/VendorMapper.java +++ b/src/main/java/com/no1/wms/vendor/VendorMapper.java @@ -1,5 +1,6 @@ package com.no1.wms.vendor; +import com.no1.wms.category.CategoryDto; import com.no1.wms.warehouse.WarehouseDto; import org.apache.ibatis.annotations.Mapper; @@ -19,6 +20,7 @@ public interface VendorMapper { int updateVendor(VendorDto dto); int createVendor(VendorDto dto); + int createProcess(VendorDto dto); int deleteVendor(String id); diff --git a/src/main/java/com/no1/wms/vendor/VendorService.java b/src/main/java/com/no1/wms/vendor/VendorService.java index 7e67e76..2a51ca3 100644 --- a/src/main/java/com/no1/wms/vendor/VendorService.java +++ b/src/main/java/com/no1/wms/vendor/VendorService.java @@ -1,6 +1,5 @@ package com.no1.wms.vendor; -import com.no1.wms.warehouse.WarehouseDto; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -49,6 +48,9 @@ public class VendorService { public int createVendor(VendorDto dto) { return mapper.createVendor(dto); } + public int createProcess(VendorDto dto) { + return mapper.createProcess(dto); + } public int deleteVendor(String id) { diff --git a/src/main/java/com/no1/wms/warehouse/WarehouseController.java b/src/main/java/com/no1/wms/warehouse/WarehouseController.java index 84e25fd..d852f45 100644 --- a/src/main/java/com/no1/wms/warehouse/WarehouseController.java +++ b/src/main/java/com/no1/wms/warehouse/WarehouseController.java @@ -68,9 +68,6 @@ public class WarehouseController { WarehouseDto One = service.One(id); m.addAttribute("One", One); - - - int perPage = 5; // 한 페이지에 보일 글의 갯수 int startRow = (page - 1) * perPage; m.addAttribute("start", startRow + 1); @@ -78,8 +75,8 @@ public class WarehouseController { int warehouseOneCount = service.warehouseOneCount(searchn, search, id); List> dto = service.warehouseOne(searchn, search, id, startRow, perPage); m.addAttribute("wlist", dto); - System.out.println("list ::" + dto); + System.out.println("list ::" + dto); log.debug("dto테스트 :: " + dto); int pageNum = 5;//보여질 페이지 번호 수 diff --git a/src/main/resources/mappers/InMapper.xml b/src/main/resources/mappers/InMapper.xml index f375410..1637777 100644 --- a/src/main/resources/mappers/InMapper.xml +++ b/src/main/resources/mappers/InMapper.xml @@ -38,11 +38,14 @@ - INSERT INTO product_in (id, product_id, in_date, quantity, warehouse_id, manager_id, note, activation) - VALUES (UUID(), #{product_id}, #{in_date}, #{quantity}, #{warehouse_id}, #{manager_id}, #{note}, 1) + INSERT INTO product_in (id, product_id, in_date, quantity, warehouse_id, manager_id, note, activation) + VALUES (UUID(), #{product_id}, #{in_date}, #{quantity}, #{warehouse_id}, #{manager_id}, #{note}, 1) - + + INSERT INTO stock (id, warehouse_id, product_id, quantity, activation) + VALUES (UUID(), #{warehouse_id}, #{product_id}, #{quantity}, 1) + @@ -52,13 +55,30 @@ warehouse_id = #{warehouse_id}, manager_id = #{manager_id}, note = #{note} WHERE id = #{id} - - - - + + UPDATE product_in + SET activation = 0 + WHERE id = #{id} + + + + UPDATE stock + SET quantity = #{quantity} + WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1 + + + + UPDATE stock + SET quantity = quantity + #{quantity} + WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1 + + + + update warehouse set current_capacity = #{updateValue} where id = #{warehouseId} and activation = 1 + + - SELECT COUNT(*) FROM stock - WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} + WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1 - - UPDATE stock - SET quantity = quantity + #{quantity} - WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} - - - INSERT INTO stock (id, warehouse_id, product_id, quantity, activation) - VALUES (UUID(), #{warehouse_id}, #{product_id}, #{quantity}, 1) - + + + + + + + + + diff --git a/src/main/resources/mappers/PlainInMapper.xml b/src/main/resources/mappers/PlainInMapper.xml index 3e41af4..4ddb5d2 100644 --- a/src/main/resources/mappers/PlainInMapper.xml +++ b/src/main/resources/mappers/PlainInMapper.xml @@ -66,8 +66,9 @@ and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code - plan.activation = 1 and pn like concat('%',#{search},'%') - plan.activation = 1 and plan.group_number like concat('%',#{search},'%') + plan.activation = 1 and plan.view_group_number like concat('%',#{search},'%') + plan.activation = 1 and product.name like concat('%',#{search},'%') + plan.activation = 1 and plan.quantity like concat(#{search}) order by plan.view_group_number desc limit #{start}, #{perPage} diff --git a/src/main/resources/mappers/ProductOutMapper.xml b/src/main/resources/mappers/ProductOutMapper.xml index 316f79c..a218d5f 100644 --- a/src/main/resources/mappers/ProductOutMapper.xml +++ b/src/main/resources/mappers/ProductOutMapper.xml @@ -37,10 +37,11 @@ @@ -119,6 +120,12 @@ set quantity = #{quantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date} where id = #{id}; + + + update stock + set quantity = quantity - #{quantity} + where product_id = #{product_id} and warehouse_id = #{warehouse_id}; + @@ -136,4 +143,9 @@ where id = #{id} + + + + + \ No newline at end of file diff --git a/src/main/resources/mappers/StockMapper.xml b/src/main/resources/mappers/StockMapper.xml index d41cf96..de75fa7 100644 --- a/src/main/resources/mappers/StockMapper.xml +++ b/src/main/resources/mappers/StockMapper.xml @@ -27,6 +27,7 @@ s.activation = 1 and p.name like concat('%',#{search},'%') s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%') s.activation = 1 and s.quantity like concat('%',#{search},'%') + s.activation = 1 and w.name like concat('%',#{search},'%') @@ -44,6 +45,7 @@ s.activation = 1 and p.name like concat('%',#{search},'%') s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%') s.activation = 1 and s.quantity like concat('%',#{search},'%') + s.activation = 1 and w.name like concat('%',#{search},'%') order by s.id desc limit #{start}, #{perPage} @@ -62,6 +64,7 @@ quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%') quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%') quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%') + s.activation = 1 and w.name like concat('%',#{search},'%') @@ -79,13 +82,22 @@ quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%') quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%') quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%') + s.activation = 1 and w.name like concat('%',#{search},'%') order by s.id desc limit #{start}, #{perPage} SELECT p.id as productId, name, company_name, cls_Nm_4, p.kan_code FROM product p - LEFT JOIN stock s ON s.product_id = p.id left join product_category c on p.kan_code = c.kan_code @@ -113,7 +124,6 @@ select count(w.id) from warehouse w - left join stock s on s.warehouse_id = w.id - (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and w.name like concat('%',#{search},'%') - (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and address like concat('%',#{search},'%') - (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and capacity like concat('%',#{search},'%') + w.activation = 1 and w.name like concat('%',#{search},'%') + w.activation = 1 and address like concat('%',#{search},'%') + w.activation = 1 and capacity like concat('%',#{search},'%') @@ -198,4 +210,24 @@ where id = #{id} + + + + + + + + + UPDATE stock + SET quantity = quantity + #{quantity} + WHERE warehouse_id = #{warehouseId} AND product_id = #{productId} + + + + INSERT INTO stock (id, warehouse_id, product_id, quantity, activation) + VALUES (UUID(), #{warehouseId}, #{productId}, #{quantity}, 1) + \ No newline at end of file diff --git a/src/main/resources/mappers/VendorMapper.xml b/src/main/resources/mappers/VendorMapper.xml index 60c58be..a66d094 100644 --- a/src/main/resources/mappers/VendorMapper.xml +++ b/src/main/resources/mappers/VendorMapper.xml @@ -5,7 +5,7 @@ @@ -108,7 +110,12 @@ insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation) - values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, #{activation}) + values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, 1) + + + + insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation) + values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, 1) diff --git a/src/main/resources/mappers/WarehouseMapper.xml b/src/main/resources/mappers/WarehouseMapper.xml index 060e266..a63e0ce 100644 --- a/src/main/resources/mappers/WarehouseMapper.xml +++ b/src/main/resources/mappers/WarehouseMapper.xml @@ -6,7 +6,7 @@ - - - - - - -
-
- -
-
+ + + diff --git a/src/main/webapp/WEB-INF/views/category/read.jsp b/src/main/webapp/WEB-INF/views/category/read.jsp index 7e9a3ee..f675c76 100644 --- a/src/main/webapp/WEB-INF/views/category/read.jsp +++ b/src/main/webapp/WEB-INF/views/category/read.jsp @@ -110,7 +110,7 @@ alert("삭제되었습니다."); $(location).attr("href", "/category/list"); } else { - alert("정상적으로 삭제되지 않았습니다.."); + alert("정상적으로 삭제되지 않았습니다."); } }).fail(function() { alert("오류가 발생했습니다."); @@ -127,8 +127,6 @@ $("#yesNoModalBodyTextDiv").text(yesNoModal.body); yesNoModal.yesFunction = deleteCategoryFunction; yesNoModalBootStrap.show(); - - } diff --git a/src/main/webapp/WEB-INF/views/in/create.jsp b/src/main/webapp/WEB-INF/views/in/create.jsp index 214f44c..2185ee5 100644 --- a/src/main/webapp/WEB-INF/views/in/create.jsp +++ b/src/main/webapp/WEB-INF/views/in/create.jsp @@ -25,7 +25,7 @@
- 제품명 + 제품명 @@ -63,7 +63,7 @@
- 창고명 + 창고명 @@ -94,7 +94,7 @@
입고날짜 - + @@ -138,6 +138,10 @@ var in_date = $("#in_date").val(); var manager_id = $("#manager_id").val(); var note = $("#note").val(); + var quantity = parseInt($("#quantity").val(), 10); + var remainingcapacity = parseInt($("#remainingcapacity").val(), 10); + + if(!product_id){ alert("제품을 선택해야합니다."); @@ -153,6 +157,12 @@ alert("창고을 선택해야합니다."); return false; } + if (quantity > remainingcapacity) { + alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다."); + $("#quantity").focus(); + return false; + } + if(!in_date){ in_date = new Date(); in_date = in_date.toISOString(); @@ -170,7 +180,7 @@ warehouse_id : warehouse_id, note : note } - + console.log(data); $.ajax({ url: "/in/create_process", diff --git a/src/main/webapp/WEB-INF/views/in/list.jsp b/src/main/webapp/WEB-INF/views/in/list.jsp index d6aa4ed..568af45 100644 --- a/src/main/webapp/WEB-INF/views/in/list.jsp +++ b/src/main/webapp/WEB-INF/views/in/list.jsp @@ -141,19 +141,85 @@ });//body detailTr + //검색기능 + $("#searchBtn").on("click",function(){ + + var searchn = $("#searchn").val(); + var search = $("#search").val(); + + var form = document.createElement("form"); + form.action = "/in/list"; + form.method = "get"; + + var input1 = document.createElement("input"); + input1.type = "hidden"; + input1.name = "searchn"; + input1.value = searchn; + form.appendChild(input1); + + var input2 = document.createElement("input"); + input2.type = "hidden"; + input2.name = "search"; + input2.value = search; + form.appendChild(input2); + + var input3 = document.createElement("input"); + input3.type = "hidden"; + input3.name = "p"; + input3.value = 1; + form.appendChild(input3); + + document.body.appendChild(form); + form.submit(); + + }); - - - - - - - - - - + });//ready + function pagingFunction(clickedId){ + var searchn1 = $("#searchn1").val(); + var search1 = $("#search1").val(); + + var form = document.createElement("form"); + form.action = "/in/list"; + form.method = "get"; + + var input1 = document.createElement("input"); + input1.type = "hidden"; + input1.name = "searchn"; + input1.value = searchn1; + form.appendChild(input1); + + var input2 = document.createElement("input"); + input2.type = "hidden"; + input2.name = "search"; + input2.value = search1; + form.appendChild(input2); + + var input3 = document.createElement("input"); + input3.type = "hidden"; + input3.name = "p"; + input3.value = clickedId; + form.appendChild(input3); + + document.body.appendChild(form); + form.submit(); + + }//pagingFunction + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/in/read.jsp b/src/main/webapp/WEB-INF/views/in/read.jsp index a3e21e7..50ca927 100644 --- a/src/main/webapp/WEB-INF/views/in/read.jsp +++ b/src/main/webapp/WEB-INF/views/in/read.jsp @@ -113,6 +113,42 @@ });//ready + function deleteInFunction(){ + var id = $("#id").val(); + $.ajax({ + url: "/in/delete", + type: "delete", + data: { + "id": id + }, + datatype:"json" + }).done(function(data) { + if (data == true) { + alert("삭제되었습니다."); + $(location).attr("href", "/in/list"); + } else { + alert("정상적으로 삭제되지 않았습니다."); + } + }).fail(function() { + alert("오류가 발생했습니다."); + }).always(function() { + // + }); + + }//deleteInFunction + + + function goDelete(){ + yesNoModalTextDefine("입고 삭제", "해당 입고를 삭제하시겠습니까?"); + $("#yesNoModalLabel").text(yesNoModal.title); + $("#yesNoModalBodyTextDiv").text(yesNoModal.body); + yesNoModal.yesFunction = deleteInFunction; + yesNoModalBootStrap.show(); + } + + + + diff --git a/src/main/webapp/WEB-INF/views/in/update.jsp b/src/main/webapp/WEB-INF/views/in/update.jsp index 7bdfab3..0c95de9 100644 --- a/src/main/webapp/WEB-INF/views/in/update.jsp +++ b/src/main/webapp/WEB-INF/views/in/update.jsp @@ -28,7 +28,7 @@ - +
@@ -52,7 +52,7 @@
수량 + value="${dto.quantity}">
@@ -63,7 +63,7 @@ - +
@@ -103,6 +103,7 @@ +
@@ -144,11 +145,11 @@ var in_date = $("#in_date").val(); var manager_id = $("#manager_id").val(); var note = $("#note").val(); - if(!name){ - alert("제품명을 입력해야 합니다."); - $("#name").focus(); - return false; - } + var id = $("#id").val(); + var quantityAdjustment = parseInt($("#quantityAdjustment").val(), 10); + var remainingcapacity = parseInt($("#remainingcapacity").val(), 10); + + if(!product_id){ alert("제품을 선택해야합니다."); return false; @@ -163,6 +164,12 @@ alert("창고을 선택해야합니다."); return false; } + if (quantityAdjustment > remainingcapacity) { + alert("적재 할 재고량이 재고량 한도를 넘을 수 없습니다."); + $("#quantityAdjustment").focus(); + return false; + } + if(!in_date){ in_date = new Date(); in_date = in_date.toISOString(); @@ -177,9 +184,10 @@ in_date : in_date, manager_id : manager_id, warehouse_id : warehouse_id, - note : note + note : note, + id : id } - + console.log(data); $.ajax({ url: "/in/update_process", type: "put", @@ -207,6 +215,7 @@ } else { alert("입고 수정에 실패하였습니다."); + console.log(data); } }).fail(function() { alert("오류가 발생했습니다."); @@ -216,41 +225,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 diff --git a/src/main/webapp/WEB-INF/views/modal/category.jsp b/src/main/webapp/WEB-INF/views/modal/category.jsp index 044403d..86ad135 100644 --- a/src/main/webapp/WEB-INF/views/modal/category.jsp +++ b/src/main/webapp/WEB-INF/views/modal/category.jsp @@ -113,13 +113,13 @@ - - ${dto.cls_nm_1 } - ${dto.cls_nm_2 } - ${dto.cls_nm_3 } - ${dto.cls_nm_4 } - ${dto.kan_code } - + + ${dto.cls_nm_1 } + ${dto.cls_nm_2 } + ${dto.cls_nm_3 } + ${dto.cls_nm_4 } + ${dto.kan_code } + diff --git a/src/main/webapp/WEB-INF/views/mypage/mypage.jsp b/src/main/webapp/WEB-INF/views/mypage/mypage.jsp index 10525f4..ec5136c 100644 --- a/src/main/webapp/WEB-INF/views/mypage/mypage.jsp +++ b/src/main/webapp/WEB-INF/views/mypage/mypage.jsp @@ -194,7 +194,7 @@ });//submitBtn });//ready function _onSubmit(){ - if($("#file").val() == ""){ + if($("#file").val()){ alert("이미지 파일을 업로드해주세요."); $("#file").focus(); return false; diff --git a/src/main/webapp/WEB-INF/views/out/create.jsp b/src/main/webapp/WEB-INF/views/out/create.jsp index 2c82c22..821cc7f 100644 --- a/src/main/webapp/WEB-INF/views/out/create.jsp +++ b/src/main/webapp/WEB-INF/views/out/create.jsp @@ -54,7 +54,10 @@
출고 예정 날짜 - + +
@@ -108,14 +111,14 @@ $("#submitBtn").on("click", function () { var product_id = $("#product_id").val(); - var quantity = $("#quantity").val(); + var quantity = parseInt($("#quantity").val(), 10); var expected_delivery_date = $("#expected_delivery_date").val(); var delivery_date = $("#delivery_date").val(); var warehouse_id = $("#warehouse_id").val(); var manager_id = $("#manager_id").val(); var note = $("#note").val(); var activation = $("#activation").val(); - var shipment_quantity = $("#shipment_quantity").val(); + var shipment_quantity = parseInt($("#shipment_quantity").val(), 10); if (!product_id) { @@ -195,4 +198,9 @@ }); - + diff --git a/src/main/webapp/WEB-INF/views/out/list.jsp b/src/main/webapp/WEB-INF/views/out/list.jsp index 25151ae..f096aec 100644 --- a/src/main/webapp/WEB-INF/views/out/list.jsp +++ b/src/main/webapp/WEB-INF/views/out/list.jsp @@ -30,12 +30,12 @@
+ aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요"> diff --git a/src/main/webapp/WEB-INF/views/out/read.jsp b/src/main/webapp/WEB-INF/views/out/read.jsp index 8a9d1d6..027d859 100644 --- a/src/main/webapp/WEB-INF/views/out/read.jsp +++ b/src/main/webapp/WEB-INF/views/out/read.jsp @@ -37,8 +37,13 @@
- 출고량 - + 재고량 + +
+ +
+ 출고량 +
@@ -60,7 +65,7 @@
비고 - +
@@ -68,7 +73,7 @@
-
+
@@ -109,7 +114,7 @@
@@ -137,6 +142,13 @@ $(document).ready(function () { + var deliveryDate = $("#delivery_date").val(); + + // '출고 날짜' 입력 필드에 값이 있다면, '출고' 버튼을 숨깁니다. + if (deliveryDate) { + $("#outNow").hide(); + } + $("#modifyBtn").on("click", function () { var id = $("#id").val(); @@ -207,16 +219,28 @@ function outNowUpdate() { var id = $("#id").val(); + var stockQuantity = parseInt($("#stockQuantity").val(), 10); + var outQuantity = parseInt($("#outQuantity").val(), 10); + var product_id = $("#product_id").val() + var warehouse_id = $("#warehouse_id").val(); var expected_delivery_date = $("#expected_delivery_date").val(); // 현재 날짜와 시간을 얻기 var now = new Date(); var delivery_date = now.toISOString().slice(0, 19).replace('T', ' '); + if (outQuantity > stockQuantity) { + alert("출고량이 재고량을 넘을 수 없습니다."); + return false; + } + $.ajax({ url: "/out/outNow", type: "put", data: { "id": id, + "quantity": outQuantity, + "product_id":product_id, + "warehouse_id": warehouse_id, "expected_delivery_date": expected_delivery_date, "delivery_date": delivery_date }, diff --git a/src/main/webapp/WEB-INF/views/out/update.jsp b/src/main/webapp/WEB-INF/views/out/update.jsp index 1428606..6998f31 100644 --- a/src/main/webapp/WEB-INF/views/out/update.jsp +++ b/src/main/webapp/WEB-INF/views/out/update.jsp @@ -34,10 +34,14 @@
- 출고량 - + 재고량 +
+
+ 출고량 + +
@@ -49,17 +53,20 @@
출고 예정 날짜 - + +
출고 날짜 - +
비고 - +
@@ -103,13 +110,17 @@ $("#updateBtn").on("click", function () { var id = $("#id").val(); var product_id = $("#product_id").val(); - var quantity = $("#quantity").val(); + var stockQuantity = parseInt($("#stockQuantity").val(), 10); + var outQuantity = parseInt($("#outQuantity").val(), 10); var expected_delivery_date = $("#expected_delivery_date").val(); var warehouse_id = $("#warehouse_id").val(); var note = $("#note").val(); var activation = $("#activation").val(); - + if (outQuantity > stockQuantity) { + alert("출고량이 재고량을 넘을 수 없습니다."); + return false; + } if (!product_id) { alert("제품을 선택해야 합니다."); @@ -130,7 +141,7 @@ "expected_delivery_date":expected_delivery_date, "note":note, "warehouse_id": warehouse_id, - "quantity": quantity, + "quantity": outQuantity, "activation": activation, diff --git a/src/main/webapp/WEB-INF/views/planin/list.jsp b/src/main/webapp/WEB-INF/views/planin/list.jsp index 4ceb2a0..46b7e05 100644 --- a/src/main/webapp/WEB-INF/views/planin/list.jsp +++ b/src/main/webapp/WEB-INF/views/planin/list.jsp @@ -41,11 +41,21 @@

-
- - + + +
+
+ + + + +
diff --git a/src/main/webapp/WEB-INF/views/stock/create.jsp b/src/main/webapp/WEB-INF/views/stock/create.jsp index a014b1d..976c6a5 100644 --- a/src/main/webapp/WEB-INF/views/stock/create.jsp +++ b/src/main/webapp/WEB-INF/views/stock/create.jsp @@ -7,116 +7,117 @@

-
-
-
- - - - - - -
- 제품 - - - -
- -
- 카테고리 - -
- -
- 제조사 - -
- - - -
- 창고 - - - -
- -
- 주소 - -
- -
- 용적 - -
- -
- 잔여 용량 - -
- - - -
- 재고량 - -
- - - - -
-
-
+
-
-
- - +
+ + + + + +
+ 제품 + + +
+ +
+ 카테고리 + +
+ +
+ 제조사 + +
+ + + +
+ 창고 + + + +
+ +
+ 주소 + +
+ +
+ 용적 + +
+ +
+ 잔여 용량 + +
+ + + +
+ 재고량 + +
+ +
+
+
+
+
+ + + +
+
+
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/warehouse/list.jsp b/src/main/webapp/WEB-INF/views/warehouse/list.jsp index b153df8..40d248c 100644 --- a/src/main/webapp/WEB-INF/views/warehouse/list.jsp +++ b/src/main/webapp/WEB-INF/views/warehouse/list.jsp @@ -30,13 +30,13 @@
+ aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요"> diff --git a/src/main/webapp/WEB-INF/views/warehouse/read.jsp b/src/main/webapp/WEB-INF/views/warehouse/read.jsp index 12fe0e4..53b6fcb 100644 --- a/src/main/webapp/WEB-INF/views/warehouse/read.jsp +++ b/src/main/webapp/WEB-INF/views/warehouse/read.jsp @@ -53,14 +53,21 @@
- + aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요"> + + + + + + + +
@@ -98,21 +105,26 @@
@@ -138,7 +150,8 @@
@@ -150,7 +163,7 @@ $(location).attr("href", "/warehouse/list"); })//checkBtn click - $("#modifyBtn").on("click", function() { + $("#modifyBtn").on("click", function () { var id = $("#id").val(); var form = document.createElement("form"); @@ -169,13 +182,10 @@ })//modifyBtn click - - - yesNoModal.yesFunction = deleteWarehouseFunction; - function deleteWarehouseFunction(){ + function deleteWarehouseFunction() { var id = $("#id").val(); $.ajax({ url: "/warehouse/delete", @@ -183,65 +193,138 @@ data: { "id": id }, - datatype:"json" - }).done(function(data) { + datatype: "json" + }).done(function (data) { if (data == true) { alert("삭제되었습니다."); $(location).attr("href", "/warehouse/list"); } else { alert("정상적으로 삭제되지 않았습니다.."); } - }).fail(function() { + }).fail(function () { alert("오류가 발생했습니다."); - }).always(function() { + }).always(function () { // }); }//deleteCategoryFunction const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_delete"); - $("#yes_no_modal_show").on("click", function(){ + $("#yes_no_modal_show").on("click", function () { yesNoModalBootStrap.show(); }); - $("#modal_yes_button_warehouse_delete").on("click", function(){ + $("#modal_yes_button_warehouse_delete").on("click", function () { yesNoModal.yesFunction(); yesNoModalBootStrap.hide(); }); - - - - - // 검색 버튼 클릭 시 Ajax로 검색 결과를 갱신 - $("#searchBtn").click(function () { - var search = $("#search").val(); + // $("#searchBtn").click(function () { + // var search = $("#search").val(); + // var searchn = $("#searchn").val(); + // var id = $("#id").val(); + // var p = $("#p").val(); + // + // $.ajax({ + // url: "warehouse/read.jsp", + // method: "POST", + // data: { + // search: search, + // searchn: searchn, + // id: id, + // p: p + // + // }, + // success: function (result) { + // // 검색 결과를 받아와서 결과를 보여주는 영역 업데이트 + // $("#searchResults").html(result); + // }, + // error: function () { + // alert("검색 중 오류가 발생했습니다."); + // } + // }); + // + //검색기능 + $("#searchBtn").on("click", function () { + var searchn = $("#searchn").val(); + var search = $("#search").val(); var id = $("#id").val(); - $.ajax({ - url: "read.jsp", - method: "POST", - data: { - search: search, - searchn: searchn, - id: id + var form = document.createElement("form"); + form.action = "/warehouse/read"; + form.method = "post"; + + var input1 = document.createElement("input"); + input1.type = "hidden"; + input1.name = "searchn"; + input1.value = searchn; + form.appendChild(input1); + + var input2 = document.createElement("input"); + input2.type = "hidden"; + input2.name = "search"; + input2.value = search; + form.appendChild(input2); + + var input3 = document.createElement("input"); + input3.type = "hidden"; + input3.name = "p"; + input3.value = 1; + form.appendChild(input3); + + var input4 = document.createElement("input"); + input4.type = "hidden"; + input4.name = "id"; + input4.value = id; + form.appendChild(input4); + + document.body.appendChild(form); + form.submit(); - }, - success: function (result) { - // 검색 결과를 받아와서 결과를 보여주는 영역 업데이트 - $("#searchResults").html(result); - }, - error: function () { - alert("검색 중 오류가 발생했습니다."); - } - }); }); + }); - });//ready + + function pageingFunction(clickedId) { + var searchn1 = $("#searchn1").val(); + var search1 = $("#search1").val(); + var id = $("#id").val(); + + var form = document.createElement("form"); + form.action = "/warehouse/read"; + form.method = "post"; + + var input1 = document.createElement("input"); + input1.type = "hidden"; + input1.name = "searchn"; + input1.value = searchn1; + form.appendChild(input1); + + var input2 = document.createElement("input"); + input2.type = "hidden"; + input2.name = "search"; + input2.value = search1; + form.appendChild(input2); + + var input3 = document.createElement("input"); + input3.type = "hidden"; + input3.name = "p"; + input3.value = clickedId; + form.appendChild(input3); + + var input4 = document.createElement("input"); + input4.type = "hidden"; + input4.name = "id"; + input4.value = id; + form.appendChild(input4); + + document.body.appendChild(form); + form.submit(); + }