This commit is contained in:
sungsu
2024-01-22 18:11:01 +09:00
parent a53c6b9602
commit 70a5906299
10 changed files with 156 additions and 55 deletions

View File

@@ -26,4 +26,6 @@ public class ProductOutDto {
} }

View File

@@ -1,5 +1,6 @@
package com.no1.wms.out; package com.no1.wms.out;
import com.no1.wms.stock.StockDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
@@ -45,4 +46,5 @@ public interface ProductOutMapper {
} }

View File

@@ -1,5 +1,6 @@
package com.no1.wms.out; package com.no1.wms.out;
import com.no1.wms.stock.StockDto;
import lombok.extern.slf4j.Slf4j; 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;
@@ -77,7 +78,6 @@ public class ProductOutService {
return mapper.stockQuantityUpdate(dto); return mapper.stockQuantityUpdate(dto);
} }
public int deleteOut(ProductOutDto dto) { public int deleteOut(ProductOutDto dto) {
return mapper.deleteOut(dto); return mapper.deleteOut(dto);
} }
@@ -108,6 +108,5 @@ public class ProductOutService {
} }
} }

View File

@@ -68,9 +68,6 @@ public class WarehouseController {
WarehouseDto One = service.One(id); WarehouseDto One = service.One(id);
m.addAttribute("One", One); m.addAttribute("One", One);
int perPage = 5; // 한 페이지에 보일 글의 갯수 int perPage = 5; // 한 페이지에 보일 글의 갯수
int startRow = (page - 1) * perPage; int startRow = (page - 1) * perPage;
m.addAttribute("start", startRow + 1); m.addAttribute("start", startRow + 1);
@@ -78,8 +75,8 @@ public class WarehouseController {
int warehouseOneCount = service.warehouseOneCount(searchn, search, id); int warehouseOneCount = service.warehouseOneCount(searchn, search, id);
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage); List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
m.addAttribute("wlist", dto); m.addAttribute("wlist", dto);
System.out.println("list ::" + dto);
System.out.println("list ::" + dto);
log.debug("dto테스트 :: " + dto); log.debug("dto테스트 :: " + dto);
int pageNum = 5;//보여질 페이지 번호 수 int pageNum = 5;//보여질 페이지 번호 수

View File

@@ -104,7 +104,7 @@
<update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.out.ProductOutDto"> <update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.out.ProductOutDto">
update warehouse update warehouse
set current_capacity = current_capacity - #{outQuantity} set current_capacity = current_capacity - #{quantity}
where id = #{warehouse_id}; where id = #{warehouse_id};
</update> </update>
@@ -117,13 +117,13 @@
<update id="outNowUpdate" parameterType="com.no1.wms.out.ProductOutDto"> <update id="outNowUpdate" parameterType="com.no1.wms.out.ProductOutDto">
update product_out update product_out
set quantity = #{outQuantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date} set quantity = #{quantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date}
where id = #{id}; where id = #{id};
</update> </update>
<update id="stockQuantityUpdate" parameterType="com.no1.wms.out.ProductOutDto"> <update id="stockQuantityUpdate" parameterType="com.no1.wms.out.ProductOutDto">
update stock update stock
set quantity = quantity - #{outQuantity} set quantity = quantity - #{quantity}
where product_id = #{product_id} and warehouse_id = #{warehouse_id}; where product_id = #{product_id} and warehouse_id = #{warehouse_id};
</update> </update>
<!-- update --> <!-- update -->
@@ -143,4 +143,9 @@
where id = #{id} where id = #{id}
</delete> </delete>
<!-- delete --> <!-- delete -->
</mapper> </mapper>

View File

@@ -54,7 +54,10 @@
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='expected_delivery_date_label' class="input-group-text">출고 예정 날짜</span> <span id='expected_delivery_date_label' class="input-group-text">출고 예정 날짜</span>
<input type="text" id="expected_delivery_date" placeholder="yyyy-MM-dd"> <fmt:formatDate value="${dto.expected_delivery_date}" pattern="yyyy-MM-dd" type="date" var="formattedDate" />
<input type="date" id="expected_delivery_date" name="expected_delivery_date" class="form-control"
placeholder="날짜을 입력하세요" aria-label="입고날짜" value="${formattedDate}"
aria-describedby="basic-addon1" min="${today}">
</div> </div>
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
@@ -195,4 +198,9 @@
}); });
</script> </script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var today = new Date().toISOString().split('T')[0];
document.getElementById("expected_delivery_date").setAttribute('min', today);
});
</script>

View File

@@ -238,7 +238,7 @@
type: "put", type: "put",
data: { data: {
"id": id, "id": id,
"outQuantity": outQuantity, "quantity": outQuantity,
"product_id":product_id, "product_id":product_id,
"warehouse_id": warehouse_id, "warehouse_id": warehouse_id,
"expected_delivery_date": expected_delivery_date, "expected_delivery_date": expected_delivery_date,

View File

@@ -53,12 +53,15 @@
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='expected_delivery_date_label' class="input-group-text">출고 예정 날짜</span> <span id='expected_delivery_date_label' class="input-group-text">출고 예정 날짜</span>
<input type="text" id="expected_delivery_date" placeholder="yyyy-MM-dd" value="${dto.expected_delivery_date}"> <fmt:formatDate value="${dto.expected_delivery_date}" pattern="yyyy-MM-dd" type="date" var="formattedDate" />
<input type="date" id="expected_delivery_date" name="expected_delivery_date" class="form-control"
placeholder="날짜을 입력하세요" aria-label="입고날짜" value="${formattedDate}"
aria-describedby="basic-addon1">
</div> </div>
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='delivery_date_label' class="input-group-text">출고 날짜</span> <span id='delivery_date_label' class="input-group-text">출고 날짜</span>
<input type="text" id="delivery_date" placeholder="" readonly value="${dto.expected_delivery_date}"> <input type="text" id="delivery_date" placeholder="" readonly value="${dto.delivery_date}">
</div> </div>
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">

View File

@@ -176,6 +176,7 @@
<th>제품명</th> <th>제품명</th>
<th>카테고리</th> <th>카테고리</th>
<th>재고수</th> <th>재고수</th>
<th>창고</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -185,6 +186,7 @@
<td class="col-1">${dto.productName }</td> <td class="col-1">${dto.productName }</td>
<td class="col-1">${dto.cls_nm_4 }</td> <td class="col-1">${dto.cls_nm_4 }</td>
<td class="col-1">${dto.quantity }</td> <td class="col-1">${dto.quantity }</td>
<td class="col-1">${dto.warehouseName}</td>
</tr> </tr>
</c:forEach> </c:forEach>
</tbody> </tbody>

View File

@@ -60,7 +60,14 @@
<input type=hidden id="id" value="${One.id}"> <input type=hidden id="id" value="${One.id}">
<input type="text" name="search" class="form-control" id="search" <input type="text" name="search" class="form-control" id="search"
aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요"> aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
<input class="btn btn-info" type="submit" id="searchBtn" value="검색"/> <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>
@@ -98,21 +105,26 @@
<div class="col-6 d-flex justify-content-center"> <div class="col-6 d-flex justify-content-center">
<nev> <nev>
<ul class="pagination"> <ul class="pagination">
<c:if test="${begin > pageNum }"> <c:if test="${begin > pageNum }">
<li class="page-item"> <li class="page-item">
<a class="page-link" href="read?p=${begin - 1 }"><</a> <a href="javascript:void(0);" class="page-link"
onclick="pageingFunction(this.id)" id="${begin - 1 }">&lt;</a>
</li> </li>
</c:if> </c:if>
<c:forEach begin="${begin }" end="${end }" var="i"> <c:forEach begin="${begin }" end="${end }" var="i">
<li class="page-item <c:if test="${p == i}"> active </c:if>"> <li class="page-item <c:if test="${p == i}"> active </c:if>">
<a class="page-link " href="read?p=${i }">${i }</a> <a href="javascript:void(0);" class="page-link "
onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
</li> </li>
</c:forEach> </c:forEach>
<c:if test="${end < totalPages }"> <c:if test="${end < totalPages }">
<li class="page-item"> <li class="page-item">
<a class="page-link" href="read?p=${end + 1 }">></a> <a href="javascript:void(0);" class="page-link"
onclick="pageingFunction(this.id)" id="${end + 1 }">&gt;</a>
</li> </li>
</c:if> </c:if>
</ul> </ul>
</nev> </nev>
</div> </div>
@@ -138,7 +150,8 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button id="modal_yes_button_warehouse_delete" type="button" class="modal_yes btn btn-primary">삭제</button> <button id="modal_yes_button_warehouse_delete" type="button" class="modal_yes btn btn-primary">삭제
</button>
</div> </div>
</div> </div>
</div> </div>
@@ -169,9 +182,6 @@
})//modifyBtn click })//modifyBtn click
yesNoModal.yesFunction = deleteWarehouseFunction; yesNoModal.yesFunction = deleteWarehouseFunction;
@@ -210,38 +220,111 @@
}); });
// 검색 버튼 클릭 시 Ajax로 검색 결과를 갱신 // 검색 버튼 클릭 시 Ajax로 검색 결과를 갱신
$("#searchBtn").click(function () { // $("#searchBtn").click(function () {
var search = $("#search").val(); // var search = $("#search").val();
// var searchn = $("#searchn").val();
// var id = $("#id").val();
// var p = $("#p").val();
//
// $.ajax({
// url: "warehouse/read.jsp",
// method: "POST",
// data: {
// search: search,
// searchn: searchn,
// id: id,
// p: p
//
// },
// success: function (result) {
// // 검색 결과를 받아와서 결과를 보여주는 영역 업데이트
// $("#searchResults").html(result);
// },
// error: function () {
// alert("검색 중 오류가 발생했습니다.");
// }
// });
//
//검색기능
$("#searchBtn").on("click", function () {
var searchn = $("#searchn").val(); var searchn = $("#searchn").val();
var search = $("#search").val();
var id = $("#id").val(); var id = $("#id").val();
$.ajax({ var form = document.createElement("form");
url: "read.jsp", form.action = "/warehouse/read";
method: "POST", form.method = "post";
data: {
search: search,
searchn: searchn,
id: id
}, var input1 = document.createElement("input");
success: function (result) { input1.type = "hidden";
// 검색 결과를 받아와서 결과를 보여주는 영역 업데이트 input1.name = "searchn";
$("#searchResults").html(result); input1.value = searchn;
}, form.appendChild(input1);
error: function () {
alert("검색 중 오류가 발생했습니다."); var input2 = document.createElement("input");
input2.type = "hidden";
input2.name = "search";
input2.value = search;
form.appendChild(input2);
var input3 = document.createElement("input");
input3.type = "hidden";
input3.name = "p";
input3.value = 1;
form.appendChild(input3);
var input4 = document.createElement("input");
input4.type = "hidden";
input4.name = "id";
input4.value = id;
form.appendChild(input4);
document.body.appendChild(form);
form.submit();
});
});
function pageingFunction(clickedId) {
var searchn1 = $("#searchn1").val();
var search1 = $("#search1").val();
var id = $("#id").val();
var form = document.createElement("form");
form.action = "/warehouse/read";
form.method = "post";
var input1 = document.createElement("input");
input1.type = "hidden";
input1.name = "searchn";
input1.value = searchn1;
form.appendChild(input1);
var input2 = document.createElement("input");
input2.type = "hidden";
input2.name = "search";
input2.value = search1;
form.appendChild(input2);
var input3 = document.createElement("input");
input3.type = "hidden";
input3.name = "p";
input3.value = clickedId;
form.appendChild(input3);
var input4 = document.createElement("input");
input4.type = "hidden";
input4.name = "id";
input4.value = id;
form.appendChild(input4);
document.body.appendChild(form);
form.submit();
} }
});
});
});//ready
</script> </script>