mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
#update
warehouse/list.jsp warehouse/read.jsp StockDto.java WarehouseController.java WarehouseDto.java WarehouseMapper.java WarehouseMapper.xml WarehouseService.java #insert warehouse/update.jsp
This commit is contained in:
@@ -6,8 +6,8 @@ import lombok.Data;
|
|||||||
public class StockDto {
|
public class StockDto {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private int warehouse_id;
|
private int warehouseId;
|
||||||
private int product_id;
|
private int productId;
|
||||||
private int quantity;
|
private int quantity;
|
||||||
private boolean activation;
|
private boolean activation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -20,6 +21,7 @@ public class WarehouseController {
|
|||||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||||
@RequestParam(name = "search", defaultValue = "") String search,
|
@RequestParam(name = "search", defaultValue = "") String search,
|
||||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||||
|
|
||||||
int count = service.count(searchn, search);
|
int count = service.count(searchn, search);
|
||||||
|
|
||||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||||
@@ -27,6 +29,8 @@ public class WarehouseController {
|
|||||||
|
|
||||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||||
List<WarehouseDto> dto = service.list(searchn, search, startRow ,perPage);
|
List<WarehouseDto> dto = service.list(searchn, search, startRow ,perPage);
|
||||||
|
|
||||||
|
|
||||||
m.addAttribute("wlist", dto);
|
m.addAttribute("wlist", dto);
|
||||||
m.addAttribute("start", startRow + 1);
|
m.addAttribute("start", startRow + 1);
|
||||||
|
|
||||||
@@ -50,19 +54,53 @@ public class WarehouseController {
|
|||||||
|
|
||||||
// 재고 상세페이지
|
// 재고 상세페이지
|
||||||
@PostMapping("warehouse/read")
|
@PostMapping("warehouse/read")
|
||||||
public String read(String id, Model m) {
|
public String read(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||||
|
@RequestParam(name = "search", defaultValue = "") String search,
|
||||||
|
@RequestParam(name = "p", defaultValue = "1") int page, String id, Model m) {
|
||||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||||
WarehouseDto dto = service.warehouseOne(id);
|
|
||||||
m.addAttribute("dto", dto);
|
WarehouseDto One = service.One(id);
|
||||||
return "warehouse/read/";
|
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);
|
||||||
|
|
||||||
|
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
|
||||||
|
m.addAttribute("wlist", dto);
|
||||||
|
System.out.println("list ::" + dto);
|
||||||
|
|
||||||
|
log.debug("dto테스트 :: " + dto);
|
||||||
|
|
||||||
|
int pageNum = 5;//보여질 페이지 번호 수
|
||||||
|
int totalPages = warehouseOneCount / perPage + (warehouseOneCount % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||||
|
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||||
|
int end = begin + pageNum - 1;
|
||||||
|
if (end > totalPages) {
|
||||||
|
end = totalPages;
|
||||||
|
}
|
||||||
|
m.addAttribute("begin", begin);
|
||||||
|
m.addAttribute("end", end);
|
||||||
|
m.addAttribute("pageNum", pageNum);
|
||||||
|
m.addAttribute("totalPages", totalPages);
|
||||||
|
m.addAttribute("p" , page);
|
||||||
|
|
||||||
|
return "warehouse/read";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 수정 - 폼
|
// 수정 - 폼
|
||||||
@GetMapping("/warehouse/update/{id}")
|
@GetMapping("/warehouse/update/{id}")
|
||||||
public String update(@PathVariable String id, Model m) {
|
public String update(@PathVariable String id, Model m) {
|
||||||
WarehouseDto dto = service.warehouseOne(id);
|
WarehouseDto dto = service.One(id);
|
||||||
m.addAttribute("dto", dto);
|
m.addAttribute("One", dto);
|
||||||
return "warehouse/update";
|
return "warehouse/update";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,26 @@
|
|||||||
package com.no1.wms.warehouse;
|
package com.no1.wms.warehouse;
|
||||||
|
|
||||||
|
import com.no1.wms.product.ProductDto;
|
||||||
|
import com.no1.wms.stock.StockDto;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class WarehouseDto {
|
public class WarehouseDto {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private int capacity;
|
private int capacity;
|
||||||
private int current_capacity;
|
private int currentCapacity;
|
||||||
private String manager_id;
|
private String managerId;
|
||||||
private String address;
|
private String address;
|
||||||
private boolean activation;
|
private boolean activation;
|
||||||
|
|
||||||
|
private List<ProductDto> productDto;
|
||||||
|
private List<StockDto> stockDto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,18 +9,21 @@ import java.util.Map;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface WarehouseMapper {
|
public interface WarehouseMapper {
|
||||||
|
|
||||||
|
List<WarehouseDto> list(Map<String, Object> m);
|
||||||
|
|
||||||
int count(Map<String, Object> m);//검색 글 갯수
|
int count(Map<String, Object> m);//검색 글 갯수
|
||||||
|
|
||||||
List<WarehouseDto> list(Map<String, Object> m);
|
List<Map<String, Object>> warehouseOne(Map<String, Object> m);
|
||||||
|
|
||||||
|
int warehouseOneCount(Map<String, Object> m);//검색 글 갯수
|
||||||
|
|
||||||
|
WarehouseDto One(String id);
|
||||||
|
|
||||||
int updateWarehouse(WarehouseDto dto);
|
int updateWarehouse(WarehouseDto dto);
|
||||||
|
|
||||||
int createWarehouse(WarehouseDto dto);
|
int createWarehouse(WarehouseDto dto);
|
||||||
|
|
||||||
WarehouseDto warehouseOne(String id);
|
|
||||||
|
|
||||||
int deleteWarehouse(String id);
|
int deleteWarehouse(String id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
package com.no1.wms.warehouse;
|
package com.no1.wms.warehouse;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.awt.color.ICC_ColorSpace;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class WarehouseService {
|
public class WarehouseService {
|
||||||
@Autowired
|
@Autowired
|
||||||
WarehouseMapper mapper;
|
WarehouseMapper mapper;
|
||||||
|
|
||||||
public int count(int searchn, String search) {
|
public int count(int searchn, String search) {
|
||||||
|
|
||||||
|
|
||||||
Map<String,Object> m = new HashMap<String, Object>();
|
Map<String,Object> m = new HashMap<String, Object>();
|
||||||
m.put("searchn",searchn);
|
m.put("searchn",searchn);
|
||||||
m.put("search", search);
|
m.put("search", search);
|
||||||
@@ -37,10 +39,36 @@ public class WarehouseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public WarehouseDto warehouseOne(String id) {
|
public List<Map<String, Object>> warehouseOne(int searchn, String search, String id, int start, int perPage) {
|
||||||
return mapper.warehouseOne(id);
|
|
||||||
|
Map<String, Object> m = new HashMap<String, Object>();
|
||||||
|
m.put("searchn",searchn);
|
||||||
|
m.put("search", search);
|
||||||
|
m.put("start", start);
|
||||||
|
m.put("perPage", perPage);
|
||||||
|
m.put("id" , id);
|
||||||
|
System.out.println(m);
|
||||||
|
|
||||||
|
List<Map<String, Object>> result = mapper.warehouseOne(m);
|
||||||
|
log.debug("warehouseOne테스트 :: " + result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int warehouseOneCount(int searchn, String search, String id){
|
||||||
|
|
||||||
|
Map<String,Object> m = new HashMap<String, Object>();
|
||||||
|
m.put("searchn",searchn);
|
||||||
|
m.put("search", search);
|
||||||
|
m.put("id", id);
|
||||||
|
|
||||||
|
log.debug("warehouseOneCount테스트 :: " + m);
|
||||||
|
|
||||||
|
return mapper.warehouseOneCount(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public WarehouseDto One(String id){
|
||||||
|
return mapper.One(id);
|
||||||
|
}
|
||||||
|
|
||||||
public int createWarehouse(WarehouseDto dto) {
|
public int createWarehouse(WarehouseDto dto) {
|
||||||
return mapper.createWarehouse(dto);
|
return mapper.createWarehouse(dto);
|
||||||
|
|||||||
@@ -4,33 +4,76 @@
|
|||||||
|
|
||||||
<mapper namespace="com.no1.wms.warehouse.WarehouseMapper">
|
<mapper namespace="com.no1.wms.warehouse.WarehouseMapper">
|
||||||
|
|
||||||
<!-- select -->
|
|
||||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||||
select count(*) from warehouse
|
select count(*)
|
||||||
|
|
||||||
|
from warehouse w
|
||||||
|
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> warehouse.activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> warehouse.activation = 1 and warehouse.capacity like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> w.activation = 1 and w.capacity like concat('%',#{search},'%') </when>
|
||||||
<when test="searchn == 2"> warehouse.activation = 1 and warehouse.current_capacity like concat('%',#{search},'%')</when>
|
<when test="searchn == 2"> w.activation = 1 and w.current_capacity like concat('%',#{search},'%')</when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto">
|
<select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||||
select * from warehouse
|
select *
|
||||||
|
|
||||||
|
from warehouse w
|
||||||
|
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> warehouse.activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> warehouse.activation = 1 and warehouse.capacity like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> w.activation = 1 and w.capacity like concat('%',#{search},'%') </when>
|
||||||
<when test="searchn == 2"> warehouse.activation = 1 and warehouse.current_capacity like concat('%',#{search},'%')</when>
|
<when test="searchn == 2"> w.activation = 1 and w.current_capacity like concat('%',#{search},'%')</when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
order by warehouse.id desc limit #{start}, #{perPage}
|
order by w.id desc limit #{start}, #{perPage}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="warehouseOne" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
<select id="warehouseOne" parameterType="Map" resultType="Map">
|
||||||
select * from warehouse where id = #{id}
|
select p.name, s.quantity, w.id
|
||||||
|
from warehouse w
|
||||||
|
LEFT JOIN stock s ON w.id = s.warehouse_id
|
||||||
|
LEFT JOIN product p ON s.product_id = p.id
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- order by p.id desc limit #{start}, #{perPage}-->
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="warehouseOneCount" parameterType="Map" resultType="java.lang.Integer">
|
||||||
|
select count(*)
|
||||||
|
|
||||||
|
from warehouse w
|
||||||
|
LEFT JOIN stock s ON w.id = s.warehouse_id
|
||||||
|
LEFT JOIN product p ON s.product_id = p.id
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<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 *
|
||||||
|
|
||||||
|
from warehouse w
|
||||||
|
|
||||||
|
where w.id = #{dto.id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- select -->
|
<!-- select -->
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +95,7 @@
|
|||||||
|
|
||||||
<!-- delete -->
|
<!-- delete -->
|
||||||
<delete id="deleteWarehouse" parameterType="String">
|
<delete id="deleteWarehouse" parameterType="String">
|
||||||
delete from warehouse where no = #{id}
|
delete from warehouse where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
<!-- delete -->
|
<!-- delete -->
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -1,15 +1,21 @@
|
|||||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>창고 리스트</title>
|
<title>창고 리스트</title>
|
||||||
|
<style>
|
||||||
|
.detailTr:hover {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container-fluid">
|
<div class="body">
|
||||||
<div class="body">
|
<div class="container-fluid">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="mt-5 mb-5 text-center">
|
<div class="mt-5 mb-5 text-center">
|
||||||
<h1>창고 리스트</h1>
|
<h1>창고 리스트</h1>
|
||||||
@@ -29,7 +35,8 @@
|
|||||||
<option value="2">적재량</option>
|
<option value="2">적재량</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
<input type="text" name="search" class="form-control"
|
||||||
|
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
<input class="btn btn-info" type="submit" id="button-addon2 searchBtn" value="검색"/>
|
<input class="btn btn-info" type="submit" id="button-addon2 searchBtn" value="검색"/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -50,11 +57,11 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<c:forEach items="${wlist }" var="dto">
|
<c:forEach items="${wlist }" var="dto">
|
||||||
<tr class="detailTr" data-id="${dto.id}" >
|
<tr class="detailTr" data-id="${dto.id}" )>
|
||||||
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
<td>${dto.name }</td>
|
<td>${dto.name }</td>
|
||||||
<td>${dto.capacity }</td>
|
<td>${dto.capacity }</td>
|
||||||
<td>${dto.current_capacity }</td>
|
<td>${dto.currentCapacity }</td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -98,18 +105,20 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
|
||||||
$("#createButton").on("click", function() {
|
|
||||||
window.location.href = "/warehouse/create";
|
$(document).ready(function () {
|
||||||
|
//POST방식으로 create폼화면 출력
|
||||||
|
$("#createButton").on("click", function () {
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/warehouse/create";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("body").on("click", ".detailTr", function () {
|
||||||
|
|
||||||
|
|
||||||
$("body").on("click", ".detailTr", function(){
|
|
||||||
var id = $(this).data("id");
|
var id = $(this).data("id");
|
||||||
|
|
||||||
var form = document.createElement("form");
|
var form = document.createElement("form");
|
||||||
@@ -125,6 +134,8 @@
|
|||||||
|
|
||||||
form.submit();
|
form.submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
});//ready
|
});//ready
|
||||||
</script>
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -13,28 +13,131 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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">삭제</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<form>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-group mb-3 w-40 col-4">
|
||||||
|
<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-4">
|
||||||
|
<span class="input-group-text" id="basic-addon2">용적</span>
|
||||||
|
<input type="text" class="form-control" aria-label="용적" value="${One.capacity }" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-4">
|
||||||
|
<span class="input-group-text" id="basic-addon3">적재량</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.currentCapacity }" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="col-12" id="search">
|
||||||
|
<form action="list">
|
||||||
|
<div class="input-group mb-3 w-30 col-centered">
|
||||||
|
<div class="w-25">
|
||||||
|
<select class="form-select" name="searchn">
|
||||||
|
<option value="0">제품명</option>
|
||||||
|
<option value="1">재고수</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" name="search" class="form-control"
|
||||||
|
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
|
<input class="btn btn-info" type="submit" id="button-addon2 searchBtn" value="검색"/>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row row-table">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>번호</th>
|
||||||
|
<th>제품명</th>
|
||||||
|
<th>재고수</th>
|
||||||
|
</tr>
|
||||||
|
</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.quantity }</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-buttons">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
</div>
|
|
||||||
<div class="mt-5 mb-5 col-6 text-center">
|
|
||||||
<h1>제품 카테고리 상세페이지</h1>
|
|
||||||
</div>
|
|
||||||
<div class="col-3">
|
|
||||||
<button type="button" class="btn btn-danger" id="deleteButton">삭제</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-6 d-flex justify-content-center">
|
||||||
|
<nev>
|
||||||
|
<ul class="pagination">
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="read?p=${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 class="page-link " href="read?p=${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a class="page-link" href="read?p=${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nev>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 ">
|
||||||
|
<div class="w-40 col-centered" 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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
$("#deleteButton").on("click", function() {
|
$("#checkBtn").on("click", function() {
|
||||||
|
$(location).attr("href", "/warehouse/list");
|
||||||
|
})//checkBtn click
|
||||||
|
|
||||||
var id = $(this).data("id");
|
|
||||||
|
$("#modifyBtn").on("click", function() {
|
||||||
|
var id = $("#id").val();
|
||||||
|
|
||||||
var form = document.createElement("form");
|
var form = document.createElement("form");
|
||||||
form.action = "/warehouse/list";
|
form.action = "/warehouse/update";
|
||||||
form.method = "POST";
|
form.method = "GET";
|
||||||
document.body.appendChild(form);
|
document.body.appendChild(form);
|
||||||
|
|
||||||
var input = document.createElement("input");
|
var input = document.createElement("input");
|
||||||
@@ -44,9 +147,28 @@
|
|||||||
form.appendChild(input);
|
form.appendChild(input);
|
||||||
|
|
||||||
form.submit();
|
form.submit();
|
||||||
});
|
|
||||||
|
})//modifyBtn click
|
||||||
|
|
||||||
});//ready
|
});//ready
|
||||||
|
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$("a[id]").click(function () {
|
||||||
|
let no = $(this).attr("id");// 글번호
|
||||||
|
$.ajax({
|
||||||
|
url: "/deleteWarehouse/delete",
|
||||||
|
data: "id=" + id,
|
||||||
|
method: "delete"
|
||||||
|
}
|
||||||
|
).done(function () {
|
||||||
|
alert("삭제되었습니다.");
|
||||||
|
location.href = "/warehouse/list";
|
||||||
|
})
|
||||||
|
return false;//하이퍼링크 이동 X
|
||||||
|
})//click
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
154
src/main/webapp/WEB-INF/views/warehouse/update.jsp
Normal file
154
src/main/webapp/WEB-INF/views/warehouse/update.jsp
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<%@ 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 style="text-align: center">
|
||||||
|
<form>
|
||||||
|
<%-- <div class="ulTag">--%>
|
||||||
|
<%-- <div class="row">--%>
|
||||||
|
<%-- <div class="col-12" style="text-align: center;">--%>
|
||||||
|
<%-- <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" placeholder="대분류" id="cls_nm_1"--%>
|
||||||
|
<%-- aria-label="대분류" value="${dto.cls_nm_1 }">--%>
|
||||||
|
<%-- </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" placeholder="중분류" id="cls_nm_2"--%>
|
||||||
|
<%-- aria-label="중분류" value="${dto.cls_nm_2 }">--%>
|
||||||
|
<%-- </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" placeholder="소분류" id="cls_nm_3"--%>
|
||||||
|
<%-- aria-label="소분류" value="${dto.cls_nm_3 }">--%>
|
||||||
|
<%-- </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" placeholder="세분류" id="cls_nm_4"--%>
|
||||||
|
<%-- aria-label="세분류" value="${dto.cls_nm_4 }">--%>
|
||||||
|
<%-- </div>--%>
|
||||||
|
|
||||||
|
<%-- <div class="input-group mb-3 w-40 col-centered">--%>
|
||||||
|
<%-- <span class="input-group-text" id="basic-addon5">KAN 코드</span> <input--%>
|
||||||
|
<%-- type="text" class="form-control" placeholder="KAN 코드"--%>
|
||||||
|
<%-- aria-label="KAN 코드" value="${dto.kan_code }" id="kan_code" 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-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 clsnm1 = $("#cls_nm_1").val();
|
||||||
|
// var clsnm2 = $("#cls_nm_2").val();
|
||||||
|
// var clsnm3 = $("#cls_nm_3").val();
|
||||||
|
// var clsnm4 = $("#cls_nm_4").val();
|
||||||
|
// var kan_code = $("#kan_code").val();
|
||||||
|
// if(!clsnm1){
|
||||||
|
// alert("대분류를 입력해야 합니다.");
|
||||||
|
// $("#cls_nm_1").focus();
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// if(!clsnm2){
|
||||||
|
// alert("중분류를 입력해야 합니다.");
|
||||||
|
// $("#cls_nm_2").focus();
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// if(!clsnm3){
|
||||||
|
// alert("소분류를 입력해야 합니다.");
|
||||||
|
// $("#cls_nm_3").focus();
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// if(!clsnm4){
|
||||||
|
// alert("세분류를 입력해야 합니다.");
|
||||||
|
// $("#cls_nm_4").focus();
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $.ajax({
|
||||||
|
// url: "/category/update_process",
|
||||||
|
// type: "put",
|
||||||
|
// data: {
|
||||||
|
// "cls_nm_1": clsnm1,
|
||||||
|
// "cls_nm_2": clsnm2,
|
||||||
|
// "cls_nm_3": clsnm3,
|
||||||
|
// "cls_nm_4": clsnm4,
|
||||||
|
// "kan_code": kan_code,
|
||||||
|
// "activation": true
|
||||||
|
// },
|
||||||
|
// datatype:"json"
|
||||||
|
// }).done(function(data) {
|
||||||
|
// if (data == true) {
|
||||||
|
// alert("카테고리를 수정하였습니다.");
|
||||||
|
//
|
||||||
|
// var form = document.createElement("form");
|
||||||
|
// form.action = "/category/read";
|
||||||
|
// form.method = "POST";
|
||||||
|
// document.body.appendChild(form);
|
||||||
|
//
|
||||||
|
// var input = document.createElement("input");
|
||||||
|
// input.type = "hidden";
|
||||||
|
// input.name = "kan_code";
|
||||||
|
// input.value = kan_code;
|
||||||
|
// form.appendChild(input);
|
||||||
|
//
|
||||||
|
// form.submit();
|
||||||
|
// } else {
|
||||||
|
// alert("카테고리 수정에 실패하였습니다.");
|
||||||
|
// }
|
||||||
|
// }).fail(function() {
|
||||||
|
// alert("오류가 발생했습니다.");
|
||||||
|
// }).always(function() {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// });//updateBtn
|
||||||
|
//
|
||||||
|
// $("#cancelBtn").on("click", function(){
|
||||||
|
// var kan_code = $("#kan_code").val();
|
||||||
|
//
|
||||||
|
// var form = document.createElement("form");
|
||||||
|
// form.action = "/category/read";
|
||||||
|
// form.method = "POST";
|
||||||
|
// document.body.appendChild(form);
|
||||||
|
//
|
||||||
|
// var input = document.createElement("input");
|
||||||
|
// input.type = "hidden";
|
||||||
|
// input.name = "kan_code";
|
||||||
|
// input.value = kan_code;
|
||||||
|
// form.appendChild(input);
|
||||||
|
//
|
||||||
|
// form.submit();
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user