mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
#update
/stock/create.jsp /warehouse/create.jsp /stock/list.jsp /warehouse/list.jsp /warehouse/read.jsp StockController.java StockDto.java StockMapper.xml StockMapper.java StockService.java VendorDto.java WarehouseMapper.xml WarehouseController.java #insert /vendor/create.jsp /vendor/list.jsp product_category_company_search.jsp /stock/read.jsp /vendor/read.jsp /stock/update.jsp /vendor/update.jsp VendorController.java VendorMapper.java VendorMapper.xml VendorService.java warehouse_capacity_currentCapacity.jsp
This commit is contained in:
@@ -1,101 +1,223 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
|
||||
import com.no1.wms.vendor.VendorDto;
|
||||
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.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequestMapping("/stock")
|
||||
public class StockController {
|
||||
|
||||
@Autowired
|
||||
StockService service;
|
||||
|
||||
// 재고 리스트 출력
|
||||
@GetMapping("stock/list")
|
||||
// 탭 1 재고 리스트 출력
|
||||
@GetMapping("/list")
|
||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||
int count = service.count(searchn, search);
|
||||
|
||||
|
||||
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<Object> dto = service.list(searchn, search, perPage);
|
||||
m.addAttribute("list", dto);
|
||||
|
||||
int pageNum = 4;//보여질 페이지 번호 수
|
||||
List<Map<String, Object>> dto = service.list(searchn, search, startRow ,perPage);
|
||||
m.addAttribute("slist", dto);
|
||||
|
||||
m.addAttribute("start", startRow + 1);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addAttribute("searchn", searchn);
|
||||
m.addAttribute("search", search);
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
m.addAttribute("totalPages", totalPages);
|
||||
m.addAttribute("p" , page);
|
||||
|
||||
|
||||
|
||||
return "stock/list";
|
||||
}
|
||||
|
||||
|
||||
// 탭 2 재고 리스트 출력
|
||||
@GetMapping("/list2")
|
||||
public String list2(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p2", defaultValue = "1") int page, Model m) {
|
||||
int count = service.count(searchn, search);
|
||||
|
||||
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<Map<String, Object>> dto = service.list(searchn, search, startRow ,perPage);
|
||||
m.addAttribute("slist2", dto);
|
||||
|
||||
m.addAttribute("start2", startRow + 1);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addAttribute("searchn2", searchn);
|
||||
m.addAttribute("search2", search);
|
||||
m.addAttribute("begin2", begin);
|
||||
m.addAttribute("end2", end);
|
||||
m.addAttribute("pageNum2", pageNum);
|
||||
m.addAttribute("totalPages2", totalPages);
|
||||
m.addAttribute("p2" , page);
|
||||
|
||||
|
||||
|
||||
return "stock/list";
|
||||
}
|
||||
|
||||
|
||||
// 재고 상세페이지
|
||||
@PostMapping("stock/read/{id}")
|
||||
public String read(@PathVariable String id, Model m) {
|
||||
@PostMapping("/read")
|
||||
public String read(@RequestParam String id, Model m) {
|
||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||
StockDto dto = service.stockOne(id);
|
||||
Map<String, Object> dto = service.stockOne(id);
|
||||
m.addAttribute("dto", dto);
|
||||
return "stock/read/";
|
||||
return "stock/read";
|
||||
}
|
||||
|
||||
|
||||
// 수정 - 폼
|
||||
@GetMapping("/stock/update/{id}")
|
||||
public String update(@PathVariable String id, Model m) {
|
||||
StockDto dto = service.stockOne(id);
|
||||
@PostMapping("/update")
|
||||
public String update(String id, Model m) {
|
||||
Map<String, Object> dto = service.stockOne(id);
|
||||
m.addAttribute("dto", dto);
|
||||
return "stock/update";
|
||||
}
|
||||
|
||||
|
||||
// 수정 프로세스
|
||||
@PutMapping("/board/update_process")
|
||||
@PutMapping("/update_process")
|
||||
@ResponseBody
|
||||
public String updateProcess(StockDto dto) {
|
||||
service.updateStock(dto);
|
||||
return "redirect:list";
|
||||
public boolean updateProcess(StockDto dto) {
|
||||
|
||||
int i = service.updateStock(dto);
|
||||
if (i == 1) {
|
||||
service.updateWarehouse(dto);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 생성 폼
|
||||
@GetMapping ("/stock/create")
|
||||
public String create()
|
||||
{
|
||||
@PostMapping("/create")
|
||||
public String create() {
|
||||
return "stock/create";
|
||||
}
|
||||
|
||||
|
||||
// 생성 프로세스
|
||||
@PostMapping("/stock/create_process")
|
||||
// 생성 - Ajax
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public String createProcess(StockDto dto) {
|
||||
service.createStock(dto);
|
||||
return "redirect:list";// 글목록
|
||||
public boolean createProcess(StockDto dto) {
|
||||
int i = service.createStock(dto);
|
||||
if (i != 0) {
|
||||
service.updateWarehousePlus(dto);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 삭제
|
||||
@DeleteMapping("/stock/delete")
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public int delete(String id) {
|
||||
int i = service.deleteBoard(id);
|
||||
public int delete(StockDto dto) {
|
||||
System.out.println("데이터 :: " + dto);
|
||||
int i = service.deleteStock(dto);
|
||||
service.updateWarehouseDeleteStock(dto);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@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,
|
||||
@RequestParam String name, ModelAndView mav){
|
||||
|
||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<Map<String, Object>> list = null;
|
||||
int count = 0;
|
||||
|
||||
//테스트
|
||||
System.out.println("name : " + name);
|
||||
System.out.println("list : " + list);
|
||||
System.out.println("count : " + count);
|
||||
System.out.println("mav : " + mav);
|
||||
//테스트
|
||||
|
||||
// 모달 선택
|
||||
if(name.equals("product_category_company_search")){
|
||||
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);
|
||||
count = service.warehouseCount(searchn, search);
|
||||
}
|
||||
|
||||
mav.addObject("list", list);
|
||||
|
||||
mav.addObject("start", startRow + 1);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
mav.addObject("begin", begin);
|
||||
mav.addObject("end", end);
|
||||
mav.addObject("pageNum", pageNum);
|
||||
mav.addObject("totalPages", totalPages);
|
||||
mav.addObject("p" , page);
|
||||
|
||||
mav.setViewName(name);
|
||||
|
||||
//테스트
|
||||
System.out.println("name : " + name);
|
||||
System.out.println("list : " + list);
|
||||
System.out.println("count : " + count);
|
||||
System.out.println("mav : " + mav);
|
||||
//테스트
|
||||
return mav;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import com.no1.wms.product.ProductDto;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StockDto {
|
||||
|
||||
private String id;
|
||||
private int warehouseId;
|
||||
private int productId;
|
||||
private String warehouseId;
|
||||
private String productId;
|
||||
private int quantity;
|
||||
private boolean activation;
|
||||
|
||||
private int quantityAdjustment;
|
||||
}
|
||||
|
||||
@@ -10,17 +10,37 @@ import java.util.Map;
|
||||
public interface StockMapper {
|
||||
|
||||
int count(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
List<Object> list(Map<String, Object> m);
|
||||
// List<StockDto> list(Map<String, Object> m);
|
||||
|
||||
List<Map<String, Object>> list(Map<String, Object> m);
|
||||
|
||||
|
||||
int count2(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
List<Map<String, Object>> list2(Map<String, Object> m);
|
||||
|
||||
|
||||
int updateStock(StockDto dto);
|
||||
|
||||
int updateWarehouse(StockDto dto);
|
||||
|
||||
int updateWarehousePlus(StockDto dto);
|
||||
|
||||
int updateWarehouseDeleteStock(StockDto dto);
|
||||
|
||||
int createStock(StockDto dto);
|
||||
|
||||
StockDto stockOne(String id);
|
||||
|
||||
int deleteStock(String id);
|
||||
Map<String, Object> stockOne(String id);
|
||||
|
||||
int deleteStock(StockDto dto);
|
||||
|
||||
List<Map<String, Object>> productSelect(Map<String, Object> m);
|
||||
|
||||
int productCount(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
List<Map<String, Object>> warehouseSelect(Map<String, Object> m);
|
||||
|
||||
int warehouseCount(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -8,6 +9,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StockService {
|
||||
@Autowired
|
||||
StockMapper mapper;
|
||||
@@ -19,13 +21,11 @@ public class StockService {
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", 0);
|
||||
m.put("perPage", 10000);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
|
||||
public List<Object> list(int searchn, String search, int start){
|
||||
public List<Map<String, Object>> list(int searchn, String search, int start, int perPage){
|
||||
|
||||
System.out.println(searchn+search);
|
||||
|
||||
@@ -33,14 +33,43 @@ public class StockService {
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", 10);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
return mapper.list(m);
|
||||
List<Map<String, Object>> result = mapper.list(m);
|
||||
log.debug("warehouseOne테스트 :: " + result);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public int count2(int searchn, String search) {
|
||||
|
||||
System.out.println(searchn+search);
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count2(m);
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> list2(int searchn, String search, int start, int perPage){
|
||||
|
||||
System.out.println(searchn+search);
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
List<Map<String, Object>> result = mapper.list2(m);
|
||||
log.debug("warehouseOne테스트 :: " + result);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public StockDto stockOne(String id) {
|
||||
public Map<String, Object> stockOne(String id) {
|
||||
return mapper.stockOne(id);
|
||||
}
|
||||
|
||||
@@ -54,8 +83,65 @@ public class StockService {
|
||||
return mapper.updateStock(dto);
|
||||
}
|
||||
|
||||
|
||||
public int deleteBoard(String id) {
|
||||
return mapper.deleteStock(id);
|
||||
public int updateWarehouse(StockDto dto){
|
||||
return mapper.updateWarehouse(dto);
|
||||
}
|
||||
|
||||
public int updateWarehousePlus(StockDto dto){
|
||||
return mapper.updateWarehousePlus(dto);
|
||||
}
|
||||
|
||||
public int updateWarehouseDeleteStock(StockDto dto){
|
||||
return mapper.updateWarehouseDeleteStock(dto);
|
||||
}
|
||||
|
||||
public int deleteStock(StockDto dto) {
|
||||
return mapper.deleteStock(dto);
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> productSelect(int searchn, String search, int start, int perPage){
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
List<Map<String, Object>> productresult = mapper.productSelect(m);
|
||||
|
||||
return productresult;
|
||||
}
|
||||
|
||||
public int productCount(int searchn, String search) {
|
||||
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.productCount(m);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> warehousesSelect(int searchn, String search, int start, int perPage){
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
List<Map<String, Object>> warehouseresult = mapper.warehouseSelect(m);
|
||||
|
||||
return warehouseresult;
|
||||
}
|
||||
|
||||
public int warehouseCount(int searchn, String search) {
|
||||
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("search", search);
|
||||
return mapper.warehouseCount(m);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
124
src/main/java/com/no1/wms/vendor/VendorController.java
vendored
Normal file
124
src/main/java/com/no1/wms/vendor/VendorController.java
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
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.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
public class VendorController {
|
||||
|
||||
@Autowired
|
||||
VendorService service;
|
||||
|
||||
// 재고 리스트 출력
|
||||
@GetMapping("vendor/list")
|
||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||
|
||||
int count = service.count(searchn, search);
|
||||
|
||||
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<VendorDto> dto = service.list(searchn, search, startRow ,perPage);
|
||||
|
||||
|
||||
m.addAttribute("vlist", dto);
|
||||
m.addAttribute("start", startRow + 1);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
|
||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||
int end = begin + pageNum - 1;
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addAttribute("searchn", searchn);
|
||||
m.addAttribute("search", search);
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
m.addAttribute("totalPages", totalPages);
|
||||
m.addAttribute("p" , page);
|
||||
|
||||
return "vendor/list";
|
||||
}
|
||||
|
||||
|
||||
// 재고 상세페이지
|
||||
@PostMapping("vendor/read")
|
||||
public String read(String id, Model m) {
|
||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||
|
||||
VendorDto One = service.vendorOne(id);
|
||||
System.out.println("one :: " + One);
|
||||
log.debug("One테스트 :: " + One);
|
||||
|
||||
m.addAttribute("One", One);
|
||||
|
||||
return "vendor/read";
|
||||
}
|
||||
|
||||
|
||||
// 수정 - 폼
|
||||
@PostMapping("/vendor/update")
|
||||
public String update(String id, Model m) {
|
||||
VendorDto dto = service.vendorOne(id);
|
||||
m.addAttribute("dto", dto);
|
||||
return "vendor/update";
|
||||
}
|
||||
|
||||
|
||||
// 수정 프로세스
|
||||
@PutMapping("/vendor/update_process")
|
||||
@ResponseBody
|
||||
public boolean updateProcess(VendorDto dto) {
|
||||
|
||||
int i = service.updateVendor(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 생성 폼
|
||||
@PostMapping("/vendor/create")
|
||||
public String create()
|
||||
{
|
||||
return "vendor/create";
|
||||
}
|
||||
|
||||
|
||||
// 생성 프로세스
|
||||
@PostMapping("/vendor/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(VendorDto dto) {
|
||||
int i = service.createVendor(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 삭제
|
||||
@DeleteMapping("/vendor/delete")
|
||||
@ResponseBody
|
||||
public int delete(String id) {
|
||||
int i = service.deleteVendor(id);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
18
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
18
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
@@ -8,20 +8,20 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
||||
@Alias("VendorDto")
|
||||
public class VendorDto {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String president_name;
|
||||
private String presidentName;
|
||||
private String address;
|
||||
private String registration_number;
|
||||
private String registrationNumber;
|
||||
private String email;
|
||||
private String president_telephone;
|
||||
private String vendor_manager;
|
||||
private String vendor_manager_telephone;
|
||||
private String main_product;
|
||||
private String manager_id;
|
||||
private boolean activation;
|
||||
private String presidentTelephone;
|
||||
private String vendorManager;
|
||||
private String vendorManagerTelephone;
|
||||
private String mainProduct;
|
||||
private String managerId;
|
||||
private boolean activation;
|
||||
}
|
||||
|
||||
26
src/main/java/com/no1/wms/vendor/VendorMapper.java
vendored
Normal file
26
src/main/java/com/no1/wms/vendor/VendorMapper.java
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface VendorMapper {
|
||||
|
||||
List<VendorDto> list(Map<String, Object> m);
|
||||
|
||||
int count(Map<String, Object> m);//검색 글 갯수
|
||||
|
||||
VendorDto vendorOne(String id);
|
||||
|
||||
int updateVendor(VendorDto dto);
|
||||
|
||||
int createVendor(VendorDto dto);
|
||||
|
||||
int deleteVendor(String id);
|
||||
|
||||
|
||||
}
|
||||
57
src/main/java/com/no1/wms/vendor/VendorService.java
vendored
Normal file
57
src/main/java/com/no1/wms/vendor/VendorService.java
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class VendorService {
|
||||
@Autowired
|
||||
VendorMapper mapper;
|
||||
|
||||
public int count(int searchn, String search) {
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
|
||||
public List<VendorDto> list(int searchn, String search, int start, int perPage) {
|
||||
|
||||
System.out.println(searchn + search);
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
|
||||
return mapper.list(m);
|
||||
}
|
||||
|
||||
public VendorDto vendorOne(String id) {
|
||||
return mapper.vendorOne(id);
|
||||
}
|
||||
|
||||
public int updateVendor(VendorDto dto) {
|
||||
return mapper.updateVendor(dto);
|
||||
}
|
||||
|
||||
|
||||
public int createVendor(VendorDto dto) {
|
||||
return mapper.createVendor(dto);
|
||||
}
|
||||
|
||||
|
||||
public int deleteVendor(String id) {
|
||||
return mapper.deleteVendor(id);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,10 @@ public class WarehouseController {
|
||||
|
||||
m.addAttribute("wlist", dto);
|
||||
m.addAttribute("start", startRow + 1);
|
||||
|
||||
//테스트
|
||||
System.out.println("list" + dto);
|
||||
//테스트
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
@@ -42,6 +46,8 @@ public class WarehouseController {
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addAttribute("searchn", searchn);
|
||||
m.addAttribute("search", search);
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
@@ -60,19 +66,16 @@ public class WarehouseController {
|
||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||
|
||||
WarehouseDto One = service.One(id);
|
||||
System.out.println("one :: " + One);
|
||||
log.debug("Osne테스트 :: " + One);
|
||||
|
||||
m.addAttribute("One", One);
|
||||
|
||||
int warehouseOneCount = service.warehouseOneCount(searchn, search, id);
|
||||
|
||||
log.debug("warehouseOneCount테스트 :: " + warehouseOneCount);
|
||||
|
||||
|
||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
m.addAttribute("start", startRow + 1);
|
||||
|
||||
int warehouseOneCount = service.warehouseOneCount(searchn, search, id);
|
||||
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
|
||||
m.addAttribute("wlist", dto);
|
||||
System.out.println("list ::" + dto);
|
||||
@@ -86,6 +89,8 @@ public class WarehouseController {
|
||||
if (end > totalPages) {
|
||||
end = totalPages;
|
||||
}
|
||||
m.addAttribute("searchn", searchn);
|
||||
m.addAttribute("search", search);
|
||||
m.addAttribute("begin", begin);
|
||||
m.addAttribute("end", end);
|
||||
m.addAttribute("pageNum", pageNum);
|
||||
@@ -130,9 +135,13 @@ public class WarehouseController {
|
||||
// 생성 프로세스
|
||||
@PostMapping("/warehouse/create_process")
|
||||
@ResponseBody
|
||||
public String createProcess(WarehouseDto dto) {
|
||||
service.createWarehouse(dto);
|
||||
return "redirect:list";// 글목록
|
||||
public boolean createProcess(WarehouseDto dto) {
|
||||
int i = service.createWarehouse(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,55 +3,188 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.no1.wms.stock.StockMapper">
|
||||
|
||||
<!-- select -->
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
select count(*) from stock left join warehouse on stock.warehouse_id = warehouse.id left join product on stock.product_id = product.id left join product_category on product.kan_code = product_category.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> stock.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> stock.activation = 1 and product_category.cls_Nm_4 like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by stock.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultType="java.lang.Integer">
|
||||
select * from stock left join warehouse on stock.warehouse_id = warehouse.id left join product on stock.product_id = product.id left join product_category on product.kan_code = product_category.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> stock.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> stock.activation = 1 and product_category.cls_Nm_4 like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by stock.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="stockOne" parameterType="String" resultType="com.no1.wms.stock.StockDto">
|
||||
selct * from stock where id = #{id}
|
||||
</select>
|
||||
<!-- select -->
|
||||
|
||||
|
||||
<!-- update -->
|
||||
<update id="updateStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
update stock
|
||||
set quantity = #{dto.quantity}
|
||||
where id = #{dto.id}
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
insert into stock (id, warehouse_id, product_id, quantity, activation)
|
||||
values (#{dto.id}, #{dto.warehouse_id}, #{dto.product_id}, #{dto.quantity}, 1)
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
<!-- select -->
|
||||
<select id="count" parameterType="Map" resultType="java.lang.Integer">
|
||||
select count(s.id)
|
||||
|
||||
<!-- delete -->
|
||||
<delete id="deleteStock" parameterType="String">
|
||||
delete from stock where no = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="Map" resultType="Map">
|
||||
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by s.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="count2" parameterType="Map" resultType="java.lang.Integer">
|
||||
select count(s.id)
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="list2" parameterType="Map" resultType="Map">
|
||||
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by s.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="stockOne" parameterType="Map" resultType="Map">
|
||||
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName, p.company_name, w.address, w.capacity, w.current_capacity
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="productSelect" parameterType="Map" resultType="Map">
|
||||
SELECT p.id as productId, name, company_name, cls_Nm_4
|
||||
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
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and p.activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and p.activation = 1 and cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> s.id IS NULL and p.activation = 1 and company_name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by name desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="productCount" parameterType="Map" resultType="java.lang.Integer">
|
||||
SELECT count(name)
|
||||
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
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and p.activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and p.activation = 1 and cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> s.id IS NULL and p.activation = 1 and company_name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="warehouseSelect" parameterType="Map" resultType="Map">
|
||||
select w.id as warehouseId, w.name as warehouseName, capacity, current_capacity ,address
|
||||
from warehouse w
|
||||
left join stock s on s.warehouse_id = w.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by w.name desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="warehouseCount" parameterType="Map" resultType="java.lang.Integer">
|
||||
select count(w.id)
|
||||
from warehouse w
|
||||
left join stock s on s.warehouse_id = w.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
<!-- select -->
|
||||
|
||||
|
||||
<!-- update -->
|
||||
<update id="updateStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
update stock
|
||||
set warehouse_id = #{warehouseId}, quantity = #{quantityAdjustment}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateWarehousePlus" parameterType="com.no1.wms.stock.StockDto">
|
||||
update warehouse w
|
||||
left join stock s on w.id = s.warehouse_id
|
||||
set w.current_capacity = w.current_capacity + #{quantity}
|
||||
where w.id = #{warehouseId};
|
||||
</update>
|
||||
|
||||
<update id="updateWarehouse" parameterType="com.no1.wms.stock.StockDto">
|
||||
update warehouse w
|
||||
left join stock s on w.id = s.warehouse_id
|
||||
set w.current_capacity = w.current_capacity + (#{quantityAdjustment} - #{quantity})
|
||||
where w.id = #{warehouseId};
|
||||
</update>
|
||||
|
||||
<update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
update warehouse
|
||||
set current_capacity = current_capacity - #{quantity}
|
||||
where id = #{warehouseId};
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
insert into stock (id, warehouse_id, product_id, quantity, activation)
|
||||
values (UUID(), #{warehouseId}, #{productId}, #{quantity}, #{activation})
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
<!-- delete -->
|
||||
<delete id="deleteStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
delete
|
||||
from stock
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
</mapper>
|
||||
106
src/main/resources/mappers/VendorMapper.xml
Normal file
106
src/main/resources/mappers/VendorMapper.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.no1.wms.vendor.VendorMapper">
|
||||
|
||||
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
select count(name)
|
||||
|
||||
from vendor
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> activation = 1 and president_telephone like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 2"> activation = 1 and vendor_manager like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3"> activation = 1 and vendor_manager_telephone like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultType="VendorDto">
|
||||
select id,
|
||||
name,
|
||||
president_name as presidentName,
|
||||
address,
|
||||
registration_number as registrationNumber,
|
||||
email,
|
||||
president_telephone as presidentTelephone,
|
||||
vendor_manager as vendorManager,
|
||||
vendor_manager_telephone as vendorManagerTelephone,
|
||||
main_product as mainProduct,
|
||||
manager_id as managerId,
|
||||
activation
|
||||
|
||||
from vendor
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> activation = 1 and president_telephone like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 2"> activation = 1 and vendor_manager like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3"> activation = 1 and vendor_manager_telephone like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
order by name desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="vendorOne" parameterType="String" resultType="VendorDto">
|
||||
select id,
|
||||
name,
|
||||
president_name as presidentName,
|
||||
address,
|
||||
registration_number as registrationNumber,
|
||||
email,
|
||||
president_telephone as presidentTelephone,
|
||||
vendor_manager as vendorManager,
|
||||
vendor_manager_telephone as vendorManagerTelephone,
|
||||
main_product as mainProduct,
|
||||
manager_id as managerId,
|
||||
activation
|
||||
|
||||
from vendor
|
||||
|
||||
where id = #{id}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!-- select -->
|
||||
|
||||
|
||||
<!-- update -->
|
||||
<update id="updateVendor" parameterType="VendorDto">
|
||||
update vendor
|
||||
set name = #{name},
|
||||
president_name = #{presidentName},
|
||||
address = #{address},
|
||||
registration_number = #{registrationNumber},
|
||||
email = #{email},
|
||||
president_telephone = #{presidentTelephone},
|
||||
vendor_manager = #{vendorManager},
|
||||
vendor_manager_telephone = #{vendorManagerTelephone},
|
||||
main_product = #{mainProduct},
|
||||
manager_id = #{managerId},
|
||||
activation = #{activation}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createVendor" parameterType="VendorDto">
|
||||
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}, #{presidentName}, #{address}, #{registrationNumber}, #{email}, #{presidentTelephone}, #{vendorManager}, #{vendorManagerTelephone}, #{mainProduct}, #{managerId}, #{activation})
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
<!-- delete -->
|
||||
<delete id="deleteVendor" parameterType="String">
|
||||
delete from vendor where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
</mapper>
|
||||
@@ -31,7 +31,15 @@
|
||||
<when test="searchn == 2"> w.activation = 1 and w.current_capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by w.id desc limit #{start}, #{perPage}
|
||||
order by w.name ASC limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
||||
|
||||
from warehouse w
|
||||
|
||||
where w.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="warehouseOne" parameterType="Map" resultType="Map">
|
||||
@@ -43,8 +51,8 @@
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
@@ -61,19 +69,12 @@
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
||||
|
||||
from warehouse w
|
||||
|
||||
where w.id = #{dto.id}
|
||||
</select>
|
||||
|
||||
<!-- select -->
|
||||
|
||||
@@ -84,13 +85,14 @@
|
||||
set capacity = #{capacity}, name = #{name}, address = #{address}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createWarehouse" parameterType="com.no1.wms.warehouse.WarehouseDto">
|
||||
insert into warehouse (id, name, capacity, current_capacity as currentCapacity, manager_id as managerId, address, activation)
|
||||
values (UUID(), #{dto.name}, #{dto.capacity}, 0, #{dto.managerId}, #{dto.address}, 1)
|
||||
insert into warehouse (id, name, capacity, current_capacity, manager_id, address, activation)
|
||||
values (UUID(), #{name}, #{capacity}, #{currentCapacity}, #{managerId}, #{address}, #{activation})
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<script>
|
||||
|
||||
function onSelect(tag) {
|
||||
const $tag = $(tag);
|
||||
|
||||
const tname = $tag.data('tname');
|
||||
const tid = $tag.data('tid');
|
||||
const tcategory = $tag.data('tcategory');
|
||||
const tcompany_name = $tag.data('tcompany_name');
|
||||
|
||||
$("#stock_pro_name").val(tname);
|
||||
$("#product_id").val(tid);
|
||||
$("#stock_category_name").val(tcategory);
|
||||
$("#stock_company_name_name").val(tcompany_name);
|
||||
|
||||
hideSearchModal();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// 검색 기능
|
||||
$("#searchBtn").on("click", function () {
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/stock/show_modal",
|
||||
data: {
|
||||
searchn: searchn,
|
||||
search: search,
|
||||
p: 1,
|
||||
name: "product_category_company_search"
|
||||
},
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function pageingFunction(clickedId) {
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/stock/show_modal",
|
||||
data: {
|
||||
searchn: searchn,
|
||||
search: search,
|
||||
p: clickedId,
|
||||
name: "product_category_company_search"
|
||||
},
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="div_product_category_company_search" class="text-end">
|
||||
<div class="input-group mb-3 w-50 col-centered">
|
||||
<div class="w-30">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
<option value="0">제품명</option>
|
||||
<option value="1">카테고리</option>
|
||||
<option value="2">제조사</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
<!-- 페이징작업용 -->
|
||||
<input type="hidden" id="searchn1" value="${searchn}">
|
||||
<input type="hidden" id="search1" value="${search}">
|
||||
<!-- 페이징작업용 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-centered">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th class="col-1"></th>
|
||||
<th class="col-3">제품</th>
|
||||
<th class="col-3">카테고리</th>
|
||||
<th class="col-3">제조사</th>
|
||||
<th class="col-1"></th>
|
||||
<th class="col-1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>${dto.name }</td>
|
||||
<td>${dto.cls_Nm_4 }</td>
|
||||
<td>${dto.company_name }</td>
|
||||
<td>
|
||||
<button data-tid="${dto.productId}"
|
||||
data-tname="${dto.name}"
|
||||
data-tcategory="${dto.cls_Nm_4}"
|
||||
data-tcompany_name="${dto.company_name}"
|
||||
class="btn btn-primary" onclick="onSelect(this)">선택
|
||||
</button>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row row-buttons">
|
||||
|
||||
<div class="col-12 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||
id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link "
|
||||
onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||
id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div><!-- row row-buttons -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,163 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<script>
|
||||
|
||||
function onSelect(tag) {
|
||||
const $tag = $(tag);
|
||||
|
||||
const id = $tag.data('id');
|
||||
const name = $tag.data('name');
|
||||
const address = $tag.data('address');
|
||||
const capacity = $tag.data('capacity');
|
||||
const remainingcapacity = $tag.data('remainingcapacity');
|
||||
|
||||
|
||||
$("#warehouse_id").val(id);
|
||||
$("#warehouse_name").val(name);
|
||||
$("#Address_name").val(address);
|
||||
$("#Capacity_name").val(capacity);
|
||||
$("#remainingcapacity").val(remainingcapacity);
|
||||
|
||||
hideSearchModal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
// 검색 기능
|
||||
$("#searchBtn").on("click", function () {
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/stock/show_modal",
|
||||
data: {
|
||||
searchn: searchn,
|
||||
search: search,
|
||||
p: 1,
|
||||
name: "warehouse_capacity_currentCapacity"
|
||||
},
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function pageingFunction(clickedId) {
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/stock/show_modal",
|
||||
data: {
|
||||
searchn: searchn,
|
||||
search: search,
|
||||
p: clickedId,
|
||||
name: "warehouse_capacity_currentCapacity"
|
||||
},
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div class="container" id="pageingData">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div id="div_warehouse_capacity_currentCapacity" class="text-end">
|
||||
<div class="input-group mb-3 w-50 col-centered">
|
||||
<div class="w-30">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
<option value="0">창고명</option>
|
||||
<option value="1">지역</option>
|
||||
<option value="2">용적</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th class="col-1"></th>
|
||||
<th class="col-2">창고명</th>
|
||||
<th class="col-2">지역</th>
|
||||
<th class="col-2">용적</th>
|
||||
<th class="col-2">잔여 용량</th>
|
||||
<th class="col-1"></th>
|
||||
<th class="col-1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>${dto.warehouseName }</td>
|
||||
<td>${dto.address }</td>
|
||||
<td>${dto.capacity }</td>
|
||||
<td>${dto.capacity - dto.current_capacity }</td>
|
||||
<td>
|
||||
<button data-id="${dto.warehouseId}"
|
||||
data-name="${dto.warehouseName}"
|
||||
data-address="${dto.address}"
|
||||
data-capacity="${dto.capacity}"
|
||||
data-remainingcapacity="${dto.capacity - dto.current_capacity }"
|
||||
class="btn btn-primary" onclick="onSelect(this)">선택
|
||||
</button>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row row-buttons">
|
||||
|
||||
<div class="col-12 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||
id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link "
|
||||
onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||
id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
</div><!-- row row-buttons -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,68 +1,186 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>재고 생성</title>
|
||||
<style type="text/css">
|
||||
.header {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class = "container" >
|
||||
<div class="header">
|
||||
<h1>재고 관리 생성</h1>
|
||||
</div>
|
||||
<hr>
|
||||
<div class = "row">
|
||||
<div class = "col-6">
|
||||
<form>
|
||||
<input type="text" name="search" maxlength="50" readonly/>
|
||||
<input type="submit" class="btn btn-primary" id = "search_modal_show_button" value="검색" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>재고 생성</h1>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container" style="text-align: center">
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<!--제품 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Product_label' class="input-group-text">제품</span>
|
||||
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색">
|
||||
<input hidden name="ProductName" id="product_id" value="${dto.product_id}">
|
||||
<button id="product_search_button" class="btn-primary btn" onclick="showSearchModals('제품 검색','product_category_company_search')">검색</button>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
|
||||
<!--창고 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색">
|
||||
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouse_id}">
|
||||
<button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Address_label' class="input-group-text">주소</span>
|
||||
<input readonly id="Address_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Capacity_label' class="input-group-text">용적</span>
|
||||
<input readonly id="Capacity_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='RemainingCapacity_label' class="input-group-text">잔여 용량</span>
|
||||
<input readonly id="remainingcapacity" type="text" placeholder="" value="${dto.capacity - dto.current_capacity}" class="form-control">
|
||||
</div>
|
||||
|
||||
|
||||
<!--적재할 상품의 재고수-->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">재고량</span>
|
||||
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||
placeholder="재고량을 입력하세요" aria-label="재고량" value="${dto.quantity }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="search_modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl" >
|
||||
<div class="modal-content" id="search_modal_content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="searchModalLabel">재고명 검색</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="search_modal_body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-success" id="submitBtn">생성</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="utils.js" type="text/javascript"></script>
|
||||
<script>
|
||||
|
||||
|
||||
//검색 팝업 모달 관련
|
||||
const searchModalBootStrap = new bootstrap.Modal("#search_modal");
|
||||
$("#search_modal_show_button").on("click", function(){
|
||||
searchModalBootStrap.show();
|
||||
});
|
||||
|
||||
/*
|
||||
* 검색 팝업 모달 닫는 함수
|
||||
*/
|
||||
function hideSearchModal(){
|
||||
searchModalBootStrap.hide();
|
||||
function showSearchModals(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/stock/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)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//검색 팝업 모달 관련 끝
|
||||
</script>
|
||||
$(document).ready(function () {
|
||||
|
||||
</html>
|
||||
|
||||
$("#submitBtn").on("click", function () {
|
||||
var product_id = $("#product_id").val();
|
||||
var warehouse_id = $("#warehouse_id").val();
|
||||
var quantity = $("#quantity").val();
|
||||
var activation = $("#activation").val();
|
||||
var remainingcapacity = $("#remainingcapacity").val();
|
||||
|
||||
if (!product_id) {
|
||||
alert("제품을 선택해야 합니다.");
|
||||
$("#product_id").focus();
|
||||
return false;
|
||||
}
|
||||
if (!warehouse_id) {
|
||||
alert("적재할 창고를 선택해야 합니다.");
|
||||
$("#warehouse_id").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!quantity) {
|
||||
alert("재고량를 입력해야 합니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (quantity > remainingcapacity) {
|
||||
alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/stock/create_process",
|
||||
type: "post",
|
||||
data: {
|
||||
"productId": product_id,
|
||||
"warehouseId": warehouse_id,
|
||||
"quantity": quantity,
|
||||
"activation": activation
|
||||
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("재고 정보가 생성되었습니다.");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "name";
|
||||
input.value = name;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
window.location.href = "/stock/list";
|
||||
} else {
|
||||
alert("재고 정보 생성에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$("#cancelBtn").on("click", function () {
|
||||
$(location).attr("href", "/stock/list");
|
||||
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -1,121 +1,388 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>재고 리스트</title>
|
||||
<style type="text/css">
|
||||
.header {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<script src="base.js"></script>
|
||||
<link rel="stylesheet" href="base.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
<script src="https://unpkg.com/feather-icons"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>재고 관리</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<h1>재고 리스트</h1>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>재고 관리</h1>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="body">
|
||||
<!--탭키명 -->
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">
|
||||
재고
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">
|
||||
부족한 재고
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
||||
<div id="search" align="center">
|
||||
<form action="search">
|
||||
<select name="searchn">
|
||||
<option value="0">제품명</option>
|
||||
<option value="1">카테고리</option>
|
||||
</select>
|
||||
<input type="text" name="search" maxlength="50"/>
|
||||
<input type="submit" class="btn btn-primary" value="검색" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!--재고 리스트 -->
|
||||
<c:if test="${count != 0 }">
|
||||
<table align="center">
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>제품명</th>
|
||||
<th>창고명</th>
|
||||
</tr>
|
||||
<c:forEach items="${list}" var="stock">
|
||||
<tr>
|
||||
<td><a href ="read/${stock.id}">${stock.id}</a></td>
|
||||
<td>${stock.product_name }</td>
|
||||
<td>${stock.warehouse_name }</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</table>
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">재고</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">부족한 재고</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
||||
<div class="container-fluid">
|
||||
<div class="col-12">
|
||||
<form>
|
||||
<div class="input-group mb-3 w-30 col-centered">
|
||||
<div class="w-25">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
<option value="0">제품명</option>
|
||||
<option value="1">카테고리</option>
|
||||
<option value="2">재고수</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
|
||||
<!-- 엑셀 다운로드-->
|
||||
<div class="excelButton" align="left">
|
||||
<button id="excelButton" value="excelButton">다운로드</button>
|
||||
</div>
|
||||
<div id="page" align="center">
|
||||
<c:if test="${begin > pageNum }">
|
||||
<a href="list?p=${begin-1 }">[<]</a>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end}" var="i">
|
||||
<a href="list?p=${i}">${i}</a>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<a href="list?p=${end+1}">[>]</a>
|
||||
</c:if>
|
||||
</div>
|
||||
<!-- 페이징작업용 -->
|
||||
<input type="hidden" id="searchn1" value="${searchn}">
|
||||
<input type="hidden" id="search1" value="${search}">
|
||||
<!-- 페이징작업용 -->
|
||||
|
||||
<div class="createButton" align="right">
|
||||
<button id="createButton" href="create">생성</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row row-table">
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>제품명</th>
|
||||
<th>카테고리</th>
|
||||
<th>재고수</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${slist }" var="dto">
|
||||
<tr class="detailTr col-5" data-id="${dto.id}" >
|
||||
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td class="col-1">${dto.productName }</td>
|
||||
<td class="col-1">${dto.cls_nm_4 }</td>
|
||||
<td class="col-1">${dto.quantity}</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row row-buttons">
|
||||
<div class="col-3 text-start">
|
||||
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
|
||||
<button type="button" class="btn btn-success" id="download">다운로드</button>
|
||||
</div>
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="col-3 text-end">
|
||||
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||
</div>
|
||||
</div><!-- row row-buttons -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--탭내용 2-->
|
||||
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
|
||||
<div class="container-fluid">
|
||||
<div class="col-12">
|
||||
<form>
|
||||
<div class="input-group mb-3 w-30 col-centered">
|
||||
<div class="w-25">
|
||||
<select class="form-select" name="searchn" id="searchn2">
|
||||
<option value="0">제품명</option>
|
||||
<option value="1">카테고리</option>
|
||||
<option value="2">재고수</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search2" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn2">검색</button>
|
||||
|
||||
<!-- 페이징작업용 -->
|
||||
<input type="hidden" id="searchn22" value="${searchn2}">
|
||||
<input type="hidden" id="search22" value="${search2}">
|
||||
<!-- 페이징작업용 -->
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row row-table">
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>제품명</th>
|
||||
<th>카테고리</th>
|
||||
<th>재고수</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${slist2 }" var="dto">
|
||||
<tr class="detailTr col-5" data-id="${dto.id}" >
|
||||
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td class="col-1">${dto.productName }</td>
|
||||
<td class="col-1">${dto.cls_nm_4 }</td>
|
||||
<td class="col-1">${dto.quantity }</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row row-buttons">
|
||||
<div class="col-3 text-start">
|
||||
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
|
||||
<button type="button" class="btn btn-success" id="download2">다운로드</button>
|
||||
</div>
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
|
||||
<c:if test="${begin2 > pageNum2 }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction2(this.id)" id="${begin2 - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin2 }" end="${end2 }" var="i">
|
||||
<li class="page-item <c:if test="${p2 == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction2(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end2 < totalPages2 }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction2(this.id)" id="${end2 + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="col-3 text-end">
|
||||
<button type="button" class="btn btn-primary" id="createButton2">생성</button>
|
||||
</div>
|
||||
</div><!-- row row-buttons -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</c:if>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
|
||||
탭2 내용
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
<script src="utils.js" type="text/javascript"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
//POST방식으로 create폼화면 출력
|
||||
|
||||
/*엑셀 다운로드 클릭 펑션 */
|
||||
$("#excelButton").click(function(){
|
||||
const columns = [
|
||||
{name: '번호', key: 'id'},
|
||||
{name: '제품명', key: 'product_name'},
|
||||
{name: '창고명', key: 'warehouse_name'},
|
||||
{name: '재고수', key: 'quantity'},
|
||||
{name: '카테고리', key: 'cls_Nm_4'}
|
||||
//탭 1 생성 버튼
|
||||
$("#createButton").on("click",function(){
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/create";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});
|
||||
|
||||
];
|
||||
//탭 2 생성 버튼
|
||||
$("#createButton2").on("click",function(){
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/create";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});
|
||||
|
||||
exportExcel(e, 'sheet', columns, list, 'stock');
|
||||
})
|
||||
$("body").on("click", ".detailTr", function(){
|
||||
var id = $(this).data("id");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
});
|
||||
|
||||
//탭 1 검색기능
|
||||
$("#searchBtn").on("click",function(){
|
||||
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/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();
|
||||
|
||||
});
|
||||
|
||||
|
||||
//탭 2 검색기능
|
||||
$("#searchBtn2").on("click",function(){
|
||||
|
||||
var searchn = $("#searchn2").val();
|
||||
var search = $("#search2").val();
|
||||
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/list2";
|
||||
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
|
||||
|
||||
|
||||
//탭 1 페이징
|
||||
function pageingFunction(clickedId){
|
||||
var searchn1 = $("#searchn1").val();
|
||||
var search1 = $("#search1").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/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();
|
||||
}
|
||||
|
||||
//탭 2 페이징
|
||||
function pageingFunction2(clickedId){
|
||||
var searchn2 = $("#searchn22").val();
|
||||
var search2 = $("#search22").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/list2";
|
||||
form.method = "get";
|
||||
|
||||
var input1 = document.createElement("input");
|
||||
input1.type = "hidden";
|
||||
input1.name = "searchn";
|
||||
input1.value = searchn2;
|
||||
form.appendChild(input1);
|
||||
|
||||
var input2 = document.createElement("input");
|
||||
input2.type = "hidden";
|
||||
input2.name = "search";
|
||||
input2.value = search2;
|
||||
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();
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
190
src/main/webapp/WEB-INF/views/stock/read.jsp
Normal file
190
src/main/webapp/WEB-INF/views/stock/read.jsp
Normal file
@@ -0,0 +1,190 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>재고 상세페이지</h1>
|
||||
<div class="col-10" style="text-align: right">
|
||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container" style="text-align: center">
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
<input type="hidden" class="form-control" aria-label="id" id="id" value="${dto.id}" readonly>
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<!--제품 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Product_label' class="input-group-text">제품</span>
|
||||
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색" value="${dto.productName}">
|
||||
<input hidden name="ProductName" id="product_id" value="${dto.productId}">
|
||||
<%-- <button id="product_search_button" class="btn-primary btn" onclick="showSearchModals('제품 검색','product_category_company_search')">검색</button>--%>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="" value="${dto.cls_nm_4}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="" value="${dto.company_name}">
|
||||
</div>
|
||||
|
||||
|
||||
<!--창고 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색" value="${dto.warehouseName}">
|
||||
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouseId}">
|
||||
<%-- <button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>--%>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Address_label' class="input-group-text">주소</span>
|
||||
<input readonly id="Address_name" type="text" class="form-control" placeholder="" value="${dto.address}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Capacity_label' class="input-group-text">용적</span>
|
||||
<input readonly id="Capacity_name" type="text" class="form-control" placeholder="" value="${dto.capacity}">
|
||||
</div>
|
||||
|
||||
|
||||
<!--적재할 상품의 재고수-->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">재고량</span>
|
||||
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||
placeholder="재고량을 입력하세요" aria-label="재고량" value="${dto.quantity }"
|
||||
aria-describedby="basic-addon1" readonly>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-success" id="checkBtn">확인</button>
|
||||
<button type="button" class="btn btn-secondary" id="modifyBtn">수정</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="yes_no_modal_stock_delete" tabindex="-1" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="yesNoModalLabel">삭제 하시겠습니까?</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
<button id="modal_yes_button_stock_delete" type="button" class="modal_yes btn btn-primary">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function showSearchModals(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/stock/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)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#modifyBtn").on("click", function () {
|
||||
var id = $("#id").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/update";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
})
|
||||
|
||||
$("#checkBtn").on("click", function () {
|
||||
$(location).attr("href", "/stock/list");
|
||||
|
||||
})
|
||||
|
||||
yesNoModal.yesFunction1 = deleteStockFunction;
|
||||
|
||||
function deleteStockFunction() {
|
||||
var id = $("#id").val();
|
||||
var warehouse_id = $("#warehouse_id").val();
|
||||
var quantity = $("#quantity").val();
|
||||
|
||||
$.ajax({
|
||||
url: "/stock/delete",
|
||||
type: "delete",
|
||||
data: {
|
||||
"id": id,
|
||||
"warehouseId": warehouse_id,
|
||||
"quantity" : quantity
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("삭제되었습니다.");
|
||||
$(location).attr("href", "/stock/list");
|
||||
} else {
|
||||
alert("정상적으로 삭제되지 않았습니다..");
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
}//deleteCategoryFunction
|
||||
|
||||
const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_stock_delete");
|
||||
|
||||
$("#yes_no_modal_show").on("click", function () {
|
||||
yesNoModalBootStrap.show();
|
||||
});
|
||||
|
||||
$("#modal_yes_button_stock_delete").on("click", function () {
|
||||
console.log("삭제 버튼 클릭 이벤트 실행");
|
||||
yesNoModal.yesFunction1();
|
||||
yesNoModalBootStrap.hide();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
200
src/main/webapp/WEB-INF/views/stock/update.jsp
Normal file
200
src/main/webapp/WEB-INF/views/stock/update.jsp
Normal file
@@ -0,0 +1,200 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>재고 수정</h1>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container" style="text-align: center">
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
|
||||
<input type="hidden" class="form-control" aria-label="id" id="id" value="${dto.id }" readonly>
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<!--제품 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Product_label' class="input-group-text">제품</span>
|
||||
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색" value="${dto.productName}">
|
||||
<input hidden name="ProductName" id="product_id" value="${dto.productId}">
|
||||
<%-- <button id="product_search_button" class="btn-primary btn" onclick="showSearchModals('제품 검색','product_category_company_search')">검색</button>--%>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="" value="${dto.cls_nm_4}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="" value="${dto.company_name}">
|
||||
</div>
|
||||
|
||||
|
||||
<!--창고 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색" value="${dto.company_name}">
|
||||
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouseId}">
|
||||
<%-- <button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>--%>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Address_label' class="input-group-text">주소</span>
|
||||
<input readonly id="Address_name" type="text" class="form-control" placeholder="" value="${dto.address}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Capacity_label' class="input-group-text">용적</span>
|
||||
<input readonly id="Capacity_name" type="text" class="form-control" placeholder="" value="${dto.capacity}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='RemainingCapacity_label' class="input-group-text">재고량 한도</span>
|
||||
<input readonly id="remainingcapacity" type="text" placeholder="" value="${dto.capacity - dto.current_capacity + dto.quantity}" class="form-control">
|
||||
</div>
|
||||
|
||||
<!--적재할 상품의 재고수-->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">기존 재고량</span>
|
||||
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||
placeholder="재고량을 입력하세요" aria-label="재고량" value="${dto.quantity }" readonly
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon5">수정 할 재고량</span>
|
||||
<input type="text" name="quantity" id="quantityAdjustment" class="form-control"
|
||||
placeholder="재고량을 입력하세요" aria-label="재고량"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-success" id="updateBtn">수정 완료</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
function showSearchModals(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/stock/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)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#updateBtn").on("click", function () {
|
||||
var product_id = $("#product_id").val();
|
||||
var warehouse_id = $("#warehouse_id").val();
|
||||
var quantity = $("#quantity").val();
|
||||
var activation = $("#activation").val();
|
||||
var remainingcapacity = $("#remainingcapacity").val();
|
||||
var id = $("#id").val();
|
||||
var quantityAdjustment = $("#quantityAdjustment").val();
|
||||
|
||||
|
||||
if (!product_id) {
|
||||
alert("제품을 선택해야 합니다.");
|
||||
$("#product_id").focus();
|
||||
return false;
|
||||
}
|
||||
if (!warehouse_id) {
|
||||
alert("적재할 창고를 선택해야 합니다.");
|
||||
$("#warehouse_id").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!quantity) {
|
||||
alert("재고량를 입력해야 합니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (quantity > remainingcapacity) {
|
||||
alert("적재 할 재고량이 재고량 한도를 넘을 수 없습니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/stock/update_process",
|
||||
type: "put",
|
||||
data: {
|
||||
"id": id,
|
||||
"warehouseId": warehouse_id,
|
||||
"quantity": quantity,
|
||||
"activation": activation,
|
||||
"quantityAdjustment": quantityAdjustment
|
||||
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("재고 정보가 수정되었습니다.");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "name";
|
||||
input.value = name;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
window.location.href = "/stock/list";
|
||||
} else {
|
||||
alert("재고 정보 수정에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$("#cancelBtn").on("click", function () {
|
||||
$(location).attr("href", "/stock/list");
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
253
src/main/webapp/WEB-INF/views/vendor/create.jsp
vendored
Normal file
253
src/main/webapp/WEB-INF/views/vendor/create.jsp
vendored
Normal file
@@ -0,0 +1,253 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>거래처 생성</title>
|
||||
<style>
|
||||
.body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.col-centered {
|
||||
margin: 0 auto;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.col-margin-left-32 {
|
||||
margin-left: 32%;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>거래처 생성</h1>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container" style="text-align: center">
|
||||
<form id="createForm">
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
|
||||
<%-- 세션 만들어지고 value 수정--%>
|
||||
|
||||
<input type='hidden' id="managerId" value="15b68e54-b0f0-11ee-935d-0242ac110006"/>
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">업체명</span>
|
||||
<input type="text" name="name" id="name" class="form-control"
|
||||
placeholder="업체명을 입력하세요" aria-label="업체명" value="${dto.name }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<!-- 설명만 있는 입력 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">대표자명</span>
|
||||
<input type="text" name="presidentName" id="presidentName" class="form-control"
|
||||
placeholder="대표자명을 입력하세요" aria-label="대표자명" value="${dto.presidentName }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">주소</span>
|
||||
<input type="text" name="address" id="address" class="form-control"
|
||||
placeholder="주소를 입력하세요" aria-label="주소" value="${dto.address }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">사업자등록번호</span>
|
||||
<input type="text" name="registrationNumber" id="registrationNumber" class="form-control"
|
||||
placeholder="사업자등록번호를 입력하세요" aria-label="사업자등록번호" value="${dto.registrationNumber }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon5">email</span>
|
||||
<input type="text" name="email" id="email" class="form-control"
|
||||
placeholder="Email주소를 입력하세요" aria-label="email" value="${dto.email }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon6">대표번호</span>
|
||||
<input type="text" name="presidentTelephone" id="presidentTelephone" class="form-control"
|
||||
placeholder="대표번호를 입력하세요" aria-label="대표번호" value="${dto.presidentTelephone }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon7">거래처 담당자 이름</span>
|
||||
<input type="text" name="vendorManager" id="vendorManager" class="form-control"
|
||||
placeholder="거래처 담당자 이름을 입력하세요" aria-label="거래처 담당자 이름" value="${dto.vendorManager }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon8">거래처 담당자 연락 번호</span>
|
||||
<input type="text" name="vendorManagerTelephone" id="vendorManagerTelephone" class="form-control"
|
||||
placeholder="거래처 담당자 연락 번호를 입력하세요" aria-label="거래처 담당자 연락 번호" value="${dto.vendorManagerTelephone }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon9">주요품목</span>
|
||||
<input type="text" name="mainProduct" id="mainProduct" class="form-control"
|
||||
placeholder="주요품목을 입력하세요" aria-label="주요품목" value="${dto.mainProduct }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-success" id="submitBtn">생성</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
$("#submitBtn").on("click", function () {
|
||||
var managerId = $("#managerId").val();
|
||||
|
||||
var name = $("#name").val();
|
||||
var presidentName = $("#presidentName").val();
|
||||
var address = $("#address").val();
|
||||
var registrationNumber = $("#registrationNumber").val();
|
||||
var email = $("#email").val();
|
||||
var presidentTelephone = $("#presidentTelephone").val();
|
||||
var vendorManager = $("#vendorManager").val();
|
||||
var vendorManagerTelephone = $("#vendorManagerTelephone").val();
|
||||
var mainProduct = $("#mainProduct").val();
|
||||
var activation = $("#activation").val();
|
||||
|
||||
if (!name) {
|
||||
alert("업체명을 입력해야 합니다.");
|
||||
$("#name").focus();
|
||||
return false;
|
||||
}
|
||||
if (!presidentName) {
|
||||
alert("대표자명을 입력해야 합니다.");
|
||||
$("#presidentName").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!address) {
|
||||
alert("주소를 입력해야 합니다.");
|
||||
$("#address").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!registrationNumber) {
|
||||
alert("사업자등록번호를 입력해야 합니다.");
|
||||
$("#registrationNumber").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!email) {
|
||||
alert("Email을 입력해야 합니다.");
|
||||
$("#email").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!presidentTelephone) {
|
||||
alert("대표번호를 입력해야 합니다.");
|
||||
$("#presidentTelephone").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vendorManager) {
|
||||
alert("거래처 담당자 이름을 입력해야 합니다.");
|
||||
$("#vendorManager").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vendorManagerTelephone) {
|
||||
alert("거래처 담당자 연락 번호를 입력해야 합니다.");
|
||||
$("#vendorManagerTelephone").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mainProduct) {
|
||||
alert("주요품목을 입력해야 합니다.");
|
||||
$("#mainProduct").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/vendor/create_process",
|
||||
type: "post",
|
||||
data: {
|
||||
"managerId": managerId,
|
||||
|
||||
"name": name,
|
||||
"presidentName": presidentName,
|
||||
"address": address,
|
||||
"registrationNumber": registrationNumber,
|
||||
"email": email,
|
||||
"presidentTelephone": presidentTelephone,
|
||||
"vendorManager": vendorManager,
|
||||
"vendorManagerTelephone": vendorManagerTelephone,
|
||||
"mainProduct": mainProduct,
|
||||
"activation" : activation
|
||||
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("거래처가 생성되었습니다.");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "name";
|
||||
input.value = name;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
window.location.href = "/vendor/list";
|
||||
} else {
|
||||
alert("거래처 생성에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$("#cancelBtn").on("click", function () {
|
||||
$(location).attr("href", "/vendor/list");
|
||||
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
203
src/main/webapp/WEB-INF/views/vendor/list.jsp
vendored
Normal file
203
src/main/webapp/WEB-INF/views/vendor/list.jsp
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>거래처 관리</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>거래처 관리</h1>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="body">
|
||||
<div class="container-fluid">
|
||||
<div class="col-12">
|
||||
<form>
|
||||
<div class="input-group mb-3 w-30 col-centered">
|
||||
<div class="w-25">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
<option value="0">업체명</option>
|
||||
<option value="1">대표번호</option>
|
||||
<option value="2">거래처 담당자</option>
|
||||
<option value="3">거래처 담당자 전화번호</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
|
||||
<!-- 페이징작업용 -->
|
||||
<input type="hidden" id="searchn1" value="${searchn}">
|
||||
<input type="hidden" id="search1" value="${search}">
|
||||
<!-- 페이징작업용 -->
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row row-table">
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>업체명</th>
|
||||
<th>대표번호</th>
|
||||
<th>거래처 담당자</th>
|
||||
<th>거래처 담당자 전화번호</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${vlist }" var="dto">
|
||||
<tr class="detailTr col-5" data-id="${dto.id}" >
|
||||
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td class="col-1">${dto.name }</td>
|
||||
<td class="col-1">${dto.presidentTelephone }</td>
|
||||
<td class="col-1">${dto.vendorManager }</td>
|
||||
<td class="col-1">${dto.vendorManagerTelephone }</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row row-buttons">
|
||||
<div class="col-3 text-start">
|
||||
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
|
||||
<button type="button" class="btn btn-success" id="uploadExcel">업로드</button>
|
||||
<button type="button" class="btn btn-success" id="download">다운로드</button>
|
||||
</div>
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="col-3 text-end">
|
||||
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||
</div>
|
||||
</div><!-- row row-buttons -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
//POST방식으로 create폼화면 출력
|
||||
$("#createButton").on("click",function(){
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/create";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
});
|
||||
|
||||
$("body").on("click", ".detailTr", function(){
|
||||
var id = $(this).data("id");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
});
|
||||
|
||||
//검색기능
|
||||
$("#searchBtn").on("click",function(){
|
||||
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/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 pageingFunction(clickedId){
|
||||
var searchn1 = $("#searchn1").val();
|
||||
var search1 = $("#search1").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/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();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
181
src/main/webapp/WEB-INF/views/vendor/read.jsp
vendored
Normal file
181
src/main/webapp/WEB-INF/views/vendor/read.jsp
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>거래처 상세페이지</title>
|
||||
<style type="text/css">
|
||||
.header {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
|
||||
<div class="row">
|
||||
<h1>거래처 상세페이지</h1>
|
||||
<div class="col-10" style="text-align: right">
|
||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container" style="text-align: center">
|
||||
<form id="createForm">
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
<input type="hidden" class="form-control" aria-label="id" id="id" value="${One.id }" readonly>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">업체명</span>
|
||||
<input type="text" class="form-control" aria-label="창고명" value="${One.name }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">대표자명</span>
|
||||
<input type="text" class="form-control" aria-label="용적" value="${One.presidentName }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">주소</span>
|
||||
<input type="text" class="form-control" aria-label="적재량" value="${One.address }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">사업자등록번호</span>
|
||||
<input type="text" class="form-control" aria-label="적재량" value="${One.registrationNumber }"
|
||||
readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon5">email</span>
|
||||
<input type="text" class="form-control" aria-label="적재량" value="${One.email }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon6">대표번호</span>
|
||||
<input type="text" class="form-control" aria-label="적재량" value="${One.presidentTelephone }"
|
||||
readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon7">거래처 담당자 이름</span>
|
||||
<input type="text" class="form-control" aria-label="적재량" value="${One.vendorManager }" readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon8">거래처 담당자 연락 번호</span>
|
||||
<input type="text" class="form-control" aria-label="적재량" value="${One.vendorManagerTelephone }"
|
||||
readonly>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon9">주요품목</span>
|
||||
<input type="text" class="form-control" aria-label="적재량" value="${One.mainProduct }" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="col-10" style="text-align: right">
|
||||
<button type="button" class="btn btn-primary" id="checkBtn">확인</button>
|
||||
<button type="button" class="btn btn-warning" id="modifyBtn">
|
||||
수정
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal fade" id="yes_no_modal_vendor_delete" tabindex="-1" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="yesNoModalLabel">삭제 하시겠습니까?</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
<button id="modal_yes_button_vendor_delete" type="button" class="modal_yes btn btn-primary">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#checkBtn").on("click", function () {
|
||||
$(location).attr("href", "/vendor/list");
|
||||
})//checkBtn click
|
||||
|
||||
$("#modifyBtn").on("click", function () {
|
||||
var id = $("#id").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/update";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
})//modifyBtn click
|
||||
|
||||
|
||||
yesNoModal.yesFunction = deleteVendorFunction;
|
||||
|
||||
|
||||
function deleteVendorFunction() {
|
||||
var id = $("#id").val();
|
||||
$.ajax({
|
||||
url: "/vendor/delete",
|
||||
type: "delete",
|
||||
data: {
|
||||
"id": id
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("삭제되었습니다.");
|
||||
$(location).attr("href", "/vendor/list");
|
||||
} else {
|
||||
alert("정상적으로 삭제되지 않았습니다..");
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
}//deleteCategoryFunction
|
||||
|
||||
const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_vendor_delete");
|
||||
|
||||
$("#yes_no_modal_show").on("click", function () {
|
||||
yesNoModalBootStrap.show();
|
||||
});
|
||||
|
||||
$("#modal_yes_button_vendor_delete").on("click", function () {
|
||||
yesNoModal.yesFunction();
|
||||
yesNoModalBootStrap.hide();
|
||||
});
|
||||
|
||||
});//ready
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
263
src/main/webapp/WEB-INF/views/vendor/update.jsp
vendored
Normal file
263
src/main/webapp/WEB-INF/views/vendor/update.jsp
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>창고 정보 수정페이지</title>
|
||||
<style>
|
||||
.body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.col-centered {
|
||||
margin: 0 auto;
|
||||
float: none;
|
||||
}
|
||||
|
||||
.col-margin-left-32 {
|
||||
margin-left: 32%;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>창고 정보 수정페이지</h1>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container" style="text-align: center">
|
||||
<form id="createForm">
|
||||
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: center;">
|
||||
|
||||
<input type="hidden" id="id" value="${dto.id }">
|
||||
<input type='hidden' id="managerId" value="15b68e54-b0f0-11ee-935d-0242ac110006"/>
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">업체명</span>
|
||||
<input type="text" name="name" id="name" class="form-control"
|
||||
placeholder="업체명을 입력하세요" aria-label="업체명" value="${dto.name }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<!-- 설명만 있는 입력 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">대표자명</span>
|
||||
<input type="text" name="presidentName" id="presidentName" class="form-control"
|
||||
placeholder="대표자명을 입력하세요" aria-label="대표자명" value="${dto.presidentName }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">주소</span>
|
||||
<input type="text" name="address" id="address" class="form-control"
|
||||
placeholder="주소를 입력하세요" aria-label="주소" value="${dto.address }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">사업자등록번호</span>
|
||||
<input type="text" name="registrationNumber" id="registrationNumber" class="form-control"
|
||||
placeholder="사업자등록번호를 입력하세요" aria-label="사업자등록번호" value="${dto.registrationNumber }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon5">email</span>
|
||||
<input type="text" name="email" id="email" class="form-control"
|
||||
placeholder="Email주소를 입력하세요" aria-label="email" value="${dto.email }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon6">대표번호</span>
|
||||
<input type="text" name="presidentTelephone" id="presidentTelephone" class="form-control"
|
||||
placeholder="대표번호를 입력하세요" aria-label="대표번호" value="${dto.presidentTelephone }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon7">거래처 담당자 이름</span>
|
||||
<input type="text" name="vendorManager" id="vendorManager" class="form-control"
|
||||
placeholder="거래처 담당자 이름을 입력하세요" aria-label="거래처 담당자 이름" value="${dto.vendorManager }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon8">거래처 담당자 연락 번호</span>
|
||||
<input type="text" name="vendorManagerTelephone" id="vendorManagerTelephone" class="form-control"
|
||||
placeholder="거래처 담당자 연락 번호를 입력하세요" aria-label="거래처 담당자 연락 번호" value="${dto.vendorManagerTelephone }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon9">주요품목</span>
|
||||
<input type="text" name="mainProduct" id="mainProduct" class="form-control"
|
||||
placeholder="주요품목을 입력하세요" aria-label="주요품목" value="${dto.mainProduct }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 ">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-primary" id="updateBtn">수정 완료</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#updateBtn").on("click", function () {
|
||||
var id = $("#id").val();
|
||||
|
||||
var managerId = $("#managerId").val();
|
||||
|
||||
var name = $("#name").val();
|
||||
var presidentName = $("#presidentName").val();
|
||||
var address = $("#address").val();
|
||||
var registrationNumber = $("#registrationNumber").val();
|
||||
var email = $("#email").val();
|
||||
var presidentTelephone = $("#presidentTelephone").val();
|
||||
var vendorManager = $("#vendorManager").val();
|
||||
var vendorManagerTelephone = $("#vendorManagerTelephone").val();
|
||||
var mainProduct = $("#mainProduct").val();
|
||||
var activation = $("#activation").val();
|
||||
|
||||
if (!name) {
|
||||
alert("업체명을 입력해야 합니다.");
|
||||
$("#name").focus();
|
||||
return false;
|
||||
}
|
||||
if (!presidentName) {
|
||||
alert("대표자명을 입력해야 합니다.");
|
||||
$("#presidentName").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!address) {
|
||||
alert("주소를 입력해야 합니다.");
|
||||
$("#address").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!registrationNumber) {
|
||||
alert("사업자등록번호를 입력해야 합니다.");
|
||||
$("#registrationNumber").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!email) {
|
||||
alert("Email을 입력해야 합니다.");
|
||||
$("#email").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!presidentTelephone) {
|
||||
alert("대표번호를 입력해야 합니다.");
|
||||
$("#presidentTelephone").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vendorManager) {
|
||||
alert("거래처 담당자 이름을 입력해야 합니다.");
|
||||
$("#vendorManager").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vendorManagerTelephone) {
|
||||
alert("거래처 담당자 연락 번호를 입력해야 합니다.");
|
||||
$("#vendorManagerTelephone").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mainProduct) {
|
||||
alert("주요품목을 입력해야 합니다.");
|
||||
$("#mainProduct").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: "/vendor/update_process",
|
||||
type: "put",
|
||||
data: {
|
||||
"id": id,
|
||||
"managerId": managerId,
|
||||
|
||||
"name": name,
|
||||
"presidentName": presidentName,
|
||||
"address": address,
|
||||
"registrationNumber": registrationNumber,
|
||||
"email": email,
|
||||
"presidentTelephone": presidentTelephone,
|
||||
"vendorManager": vendorManager,
|
||||
"vendorManagerTelephone": vendorManagerTelephone,
|
||||
"mainProduct": mainProduct,
|
||||
"activation" : activation
|
||||
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("거래처를 수정하였습니다.");
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
} else {
|
||||
alert("거래처 수정에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
});//updateBtn
|
||||
|
||||
$("#cancelBtn").on("click", function () {
|
||||
var id = $("#id").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/vendor/read";
|
||||
form.method = "POST";
|
||||
document.body.appendChild(form);
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "hidden";
|
||||
input.name = "id";
|
||||
input.value = id;
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
})
|
||||
});//ready
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,25 +1,26 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>창고 생성</title>
|
||||
<style>
|
||||
.body{
|
||||
.body {
|
||||
text-align: center;
|
||||
}
|
||||
.col-centered{
|
||||
|
||||
.col-centered {
|
||||
margin: 0 auto;
|
||||
float: none;
|
||||
}
|
||||
.col-margin-left-32{
|
||||
|
||||
.col-margin-left-32 {
|
||||
margin-left: 32%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -34,9 +35,10 @@
|
||||
<div class="col-12" style="text-align: center;">
|
||||
|
||||
|
||||
<-- 세션 만들어지고 value 수정-->
|
||||
<%-- 세션 만들어지고 value 수정--%>
|
||||
<input type='hidden' id="managerId" value="e9882095-aeb2-11ee-935d-0242ac110006">
|
||||
|
||||
<input type='hidden' id="currentCapacity" value="0">
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
@@ -75,28 +77,29 @@
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
|
||||
$("#submitBtn").on("click", function(){
|
||||
$("#submitBtn").on("click", function () {
|
||||
var managerId = $("#managerId").val();
|
||||
var name = $("#name").val();
|
||||
var capacity = $("#capacity").val();
|
||||
var address = $("#address").val();
|
||||
var currentCapacity = $("#currentCapacity").val();
|
||||
var activation = $("#activation").val();
|
||||
|
||||
if(!name){
|
||||
if (!name) {
|
||||
alert("창고명을 입력해야 합니다.");
|
||||
$("#name").focus();
|
||||
return false;
|
||||
}
|
||||
if(!capacity){
|
||||
if (!capacity) {
|
||||
alert("중분류를 입력해야 합니다.");
|
||||
$("#capacity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!address){
|
||||
if (!address) {
|
||||
alert("중분류를 입력해야 합니다.");
|
||||
$("#address").focus();
|
||||
return false;
|
||||
@@ -107,14 +110,16 @@
|
||||
url: "/warehouse/create_process",
|
||||
type: "post",
|
||||
data: {
|
||||
"managerId" : managerId,
|
||||
"managerId": managerId,
|
||||
"name": name,
|
||||
"capacity": capacity,
|
||||
"address": address
|
||||
"address": address,
|
||||
"currentCapacity": currentCapacity,
|
||||
"activation": activation
|
||||
|
||||
},
|
||||
datatype:"json"
|
||||
}).done(function(data) {
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("창고가 생성되었습니다.");
|
||||
|
||||
@@ -130,27 +135,25 @@
|
||||
form.appendChild(input);
|
||||
|
||||
form.submit();
|
||||
|
||||
window.location.href = "/warehouse/list";
|
||||
} else {
|
||||
alert("창고 생성에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$("#cancelBtn").on("click", function(){
|
||||
$("#cancelBtn").on("click", function () {
|
||||
$(location).attr("href", "/warehouse/list");
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="row">
|
||||
<div class="container-fluid">
|
||||
<div class="col-12">
|
||||
<form action="list">
|
||||
<form>
|
||||
<div class="input-group mb-3 w-30 col-centered">
|
||||
<div class="w-25">
|
||||
<select class="form-select" name="searchn" id="searchn">
|
||||
@@ -62,11 +62,11 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${wlist }" var="dto">
|
||||
<tr class="detailTr" data-id="${dto.id}">
|
||||
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td>${dto.name }</td>
|
||||
<td>${dto.capacity }</td>
|
||||
<td>${dto.currentCapacity }</td>
|
||||
<tr class="detailTr col-4" data-id="${dto.id}">
|
||||
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td class="col-1">${dto.name }</td>
|
||||
<td class="col-1">${dto.capacity }</td>
|
||||
<td class="col-1">${dto.currentCapacity }</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
@@ -85,24 +85,29 @@
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
<a href="javascript:void(0);" class="page-link"
|
||||
onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
<a href="javascript:void(0);" class="page-link "
|
||||
onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
<c:if test="${end < totalPages }">
|
||||
<li class="page-item">
|
||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||
<a href="javascript:void(0);" class="page-link"
|
||||
onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="col-3 text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="window.location.href='/warehouse/create'">생성</button>
|
||||
<button type="button" class="btn btn-primary"
|
||||
onclick="window.location.href='/warehouse/create'">생성
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,7 +140,7 @@
|
||||
});
|
||||
|
||||
//검색기능
|
||||
$("#searchBtn").on("click",function(){
|
||||
$("#searchBtn").on("click", function () {
|
||||
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
@@ -169,7 +174,7 @@
|
||||
|
||||
});//ready
|
||||
|
||||
function pageingFunction(clickedId){
|
||||
function pageingFunction(clickedId) {
|
||||
var searchn1 = $("#searchn1").val();
|
||||
var search1 = $("#search1").val();
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${wlist }" var="dto">
|
||||
<tr class="detailTr" data-id="${dto.id}">
|
||||
<tr class="detailTr">
|
||||
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
||||
<td>${dto.name }</td>
|
||||
<td>${dto.quantity }</td>
|
||||
@@ -172,10 +172,10 @@
|
||||
|
||||
|
||||
|
||||
yesNoModal.yesFunction = deleteCategoryFunction;
|
||||
yesNoModal.yesFunction = deleteWarehouseFunction;
|
||||
|
||||
|
||||
function deleteCategoryFunction(){
|
||||
function deleteWarehouseFunction(){
|
||||
var id = $("#id").val();
|
||||
$.ajax({
|
||||
url: "/warehouse/delete",
|
||||
|
||||
Reference in New Issue
Block a user