mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
#update
stock/create.jsp stock/list.jsp WarehouseController.java WarehouseMapper.xml WarehouseService.java #insert warehouse/create.jsp warehouse/list.jsp
This commit is contained in:
@@ -27,7 +27,7 @@ public class WarehouseController {
|
|||||||
|
|
||||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||||
List<Object> dto = service.list(searchn, search, perPage);
|
List<Object> dto = service.list(searchn, search, perPage);
|
||||||
m.addAttribute("list", dto);
|
m.addAttribute("wlist", dto);
|
||||||
|
|
||||||
int pageNum = 4;//보여질 페이지 번호 수
|
int pageNum = 4;//보여질 페이지 번호 수
|
||||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||||
@@ -78,7 +78,7 @@ public class WarehouseController {
|
|||||||
@GetMapping("/warehouse/create")
|
@GetMapping("/warehouse/create")
|
||||||
public String create()
|
public String create()
|
||||||
{
|
{
|
||||||
return "stock/create";
|
return "warehouse/create";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,10 @@ public class WarehouseService {
|
|||||||
|
|
||||||
public int count(int searchn, String search) {
|
public int count(int searchn, String search) {
|
||||||
|
|
||||||
System.out.println(searchn+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);
|
||||||
m.put("start", 0);
|
|
||||||
m.put("perPage", 10000);
|
|
||||||
return mapper.count(m);
|
return mapper.count(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,27 +6,26 @@
|
|||||||
|
|
||||||
<!-- select -->
|
<!-- select -->
|
||||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||||
select count(*) from warehouse left join account on warehouse.manager_id = account.id
|
select count(*) from warehouse
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> warehouse.activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> warehouse.activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> warehouse.activation = 1 and warehouse.capacity like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> warehouse.activation = 1 and warehouse.capacity like concat('%',#{search},'%') </when>
|
||||||
<when test="searchn == 3"> warehouse.activation = 1 and warehouse.current_capacity like concat('%',#{search},'%')</when>
|
<when test="searchn == 2"> warehouse.activation = 1 and warehouse.current_capacity like concat('%',#{search},'%')</when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
order by stock.id desc limit #{start}, #{perPage}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto">
|
<select id="list" parameterType="map" resultType="Object">
|
||||||
select * from warehouse left join account on warehouse.manager_id = account.id
|
select * from warehouse
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> warehouse.activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> warehouse.activation = 1 and warehouse.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> warehouse.activation = 1 and warehouse.capacity like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> warehouse.activation = 1 and warehouse.capacity like concat('%',#{search},'%') </when>
|
||||||
<when test="searchn == 3"> warehouse.activation = 1 and warehouse.current_capacity like concat('%',#{search},'%')</when>
|
<when test="searchn == 2"> warehouse.activation = 1 and warehouse.current_capacity like concat('%',#{search},'%')</when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
order by stock.id desc limit #{start}, #{perPage}
|
order by warehouse.id desc limit #{start}, #{perPage}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="warehouseOne" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
<select id="warehouseOne" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||||
@@ -46,8 +45,8 @@
|
|||||||
|
|
||||||
<!-- insert -->
|
<!-- insert -->
|
||||||
<insert id="createWarehouse" parameterType="com.no1.wms.warehouse.WarehouseDto">
|
<insert id="createWarehouse" parameterType="com.no1.wms.warehouse.WarehouseDto">
|
||||||
insert into warehouse (id, warehouse_id, product_id, quantity, activation)
|
insert into warehouse (id, name, capacity, current_capacity, address, activation)
|
||||||
values ((UUID), #{dto.warehouse_id}, #{dto.product_id}, #{dto.quantity}, 1)
|
values (UUID(), #{dto.name}, #{dto.capacity}, 0, #{dto.address}, 1)
|
||||||
</insert>
|
</insert>
|
||||||
<!-- insert -->
|
<!-- insert -->
|
||||||
|
|
||||||
|
|||||||
@@ -26,23 +26,28 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</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 align: center" id="search_modal_content">
|
<div class="modal fade" id="search_modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||||
<div class="modal-header">
|
<div class="modal-dialog modal-dialog-centered modal-xl" >
|
||||||
<h1 class="modal-title fs-5 col-" id="searchModalLabel">재고명 검색</h1>
|
<div class="modal-content" id="search_modal_content">
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<div class="modal-header">
|
||||||
</div>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script src="../../utils.js" type="text/javascript"></script>
|
<script src="utils.js" type="text/javascript"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
//검색 팝업 모달 관련
|
//검색 팝업 모달 관련
|
||||||
const searchModalBootStrap = new bootstrap.Modal("#search_modal");
|
const searchModalBootStrap = new bootstrap.Modal("#search_modal");
|
||||||
$("#search_modal_show_button").on("click", function(){
|
$("#search_modal_show_button").on("click", function(){
|
||||||
@@ -55,6 +60,9 @@
|
|||||||
function hideSearchModal(){
|
function hideSearchModal(){
|
||||||
searchModalBootStrap.hide();
|
searchModalBootStrap.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//검색 팝업 모달 관련 끝
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src="../../utils.js" type="text/javascript"></script>
|
<script src="utils.js" type="text/javascript"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
150
src/main/webapp/WEB-INF/views/warehouse/create.jsp
Normal file
150
src/main/webapp/WEB-INF/views/warehouse/create.jsp
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<%@ 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 style="text-align: center">
|
||||||
|
<form id="createForm">
|
||||||
|
<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" 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="capacity" id="capacity" class="form-control"
|
||||||
|
placeholder="용적을 입력하세요" aria-label="용적" value="${dto.capacity }"
|
||||||
|
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>
|
||||||
|
</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 name = $("#name").val();
|
||||||
|
var capacity = $("#capacity").val();
|
||||||
|
var address = $("#address").val();
|
||||||
|
|
||||||
|
if(!name){
|
||||||
|
alert("창고명을 입력해야 합니다.");
|
||||||
|
$("#name").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!capacity){
|
||||||
|
alert("중분류를 입력해야 합니다.");
|
||||||
|
$("#capacity").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!address){
|
||||||
|
alert("중분류를 입력해야 합니다.");
|
||||||
|
$("#address").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/warehouse/create_process",
|
||||||
|
type: "post",
|
||||||
|
data: {
|
||||||
|
"name": name,
|
||||||
|
"capacity": capacity,
|
||||||
|
"address": address,
|
||||||
|
"activation": true
|
||||||
|
},
|
||||||
|
datatype:"json"
|
||||||
|
}).done(function(data) {
|
||||||
|
if (data == true) {
|
||||||
|
alert("창고가 생성되었습니다.");
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/warehouse/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();
|
||||||
|
} else {
|
||||||
|
alert("창고 생성에 실패하였습니다.");
|
||||||
|
}
|
||||||
|
}).fail(function() {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function() {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#cancelBtn").on("click", function(){
|
||||||
|
$(location).attr("href", "/warehouse/list");
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
99
src/main/webapp/WEB-INF/views/warehouse/list.jsp
Normal file
99
src/main/webapp/WEB-INF/views/warehouse/list.jsp
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<%@ 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>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="body">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
<h1>창고 리스트</h1>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="col-12">
|
||||||
|
<form action="warehouseSearch">
|
||||||
|
<div class="input-group mb-3 w-30 col-centered">
|
||||||
|
<div class="w-25">
|
||||||
|
<select class="form-select">
|
||||||
|
<option selected="selected" value="0">창고명</option>
|
||||||
|
<option value="1">용량</option>
|
||||||
|
<option value="2">적재량</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" name="warehouseSearch" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="button-addon2 searchBtn">검색</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="${wlist }" var="dto">
|
||||||
|
<tr class="detailTr" data-w_id="${dto.id}" >
|
||||||
|
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
|
<td><a href="read/${dto.id }">
|
||||||
|
${dto.name }</a></td>
|
||||||
|
<td>${dto.capacity }</td>
|
||||||
|
<td>${dto.current_capacity }</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-buttons">
|
||||||
|
<div class="col-6 d-flex justify-content-center">
|
||||||
|
<div>
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<a href="list.jsp?p=${begin - 1 }">이전</a>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<a href="list.jsp?p=${i }">${i }</a>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<a href="list.jsp?p=${end + 1 }">다음</a>
|
||||||
|
</c:if>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 text-end">
|
||||||
|
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$("#createButton").on("click", function() {
|
||||||
|
window.location.href = "/warehouse/create";
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user