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;
import com.no1.wms.stock.StockDto;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -45,4 +46,5 @@ public interface ProductOutMapper {
}

View File

@@ -1,5 +1,6 @@
package com.no1.wms.out;
import com.no1.wms.stock.StockDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -73,11 +74,10 @@ public class ProductOutService {
return mapper.updateWarehouseDeleteStock(dto);
}
public int stockQuantityUpdate(ProductOutDto dto){
public int stockQuantityUpdate(ProductOutDto dto) {
return mapper.stockQuantityUpdate(dto);
}
public int deleteOut(ProductOutDto 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);
m.addAttribute("One", One);
int perPage = 5; // 한 페이지에 보일 글의 갯수
int startRow = (page - 1) * perPage;
m.addAttribute("start", startRow + 1);
@@ -78,8 +75,8 @@ public class WarehouseController {
int warehouseOneCount = service.warehouseOneCount(searchn, search, id);
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
m.addAttribute("wlist", dto);
System.out.println("list ::" + dto);
System.out.println("list ::" + dto);
log.debug("dto테스트 :: " + dto);
int pageNum = 5;//보여질 페이지 번호 수

View File

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

View File

@@ -54,7 +54,10 @@
<div class="input-group mb-3 w-40 col-centered">
<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 class="input-group mb-3 w-40 col-centered">
@@ -195,4 +198,9 @@
});
</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",
data: {
"id": id,
"outQuantity": outQuantity,
"quantity": outQuantity,
"product_id":product_id,
"warehouse_id": warehouse_id,
"expected_delivery_date": expected_delivery_date,

View File

@@ -53,12 +53,15 @@
<div class="input-group mb-3 w-40 col-centered">
<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 class="input-group mb-3 w-40 col-centered">
<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 class="input-group mb-3 w-40 col-centered">

View File

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

View File

@@ -60,7 +60,14 @@
<input type=hidden id="id" value="${One.id}">
<input type="text" name="search" class="form-control" id="search"
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>
@@ -98,21 +105,26 @@
<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>
<a href="javascript:void(0);" class="page-link"
onclick="pageingFunction(this.id)" id="${begin - 1 }">&lt;</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>
<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 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>
</c:if>
</ul>
</nev>
</div>
@@ -138,7 +150,8 @@
</div>
<div class="modal-footer">
<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>
@@ -150,7 +163,7 @@
$(location).attr("href", "/warehouse/list");
})//checkBtn click
$("#modifyBtn").on("click", function() {
$("#modifyBtn").on("click", function () {
var id = $("#id").val();
var form = document.createElement("form");
@@ -169,13 +182,10 @@
})//modifyBtn click
yesNoModal.yesFunction = deleteWarehouseFunction;
function deleteWarehouseFunction(){
function deleteWarehouseFunction() {
var id = $("#id").val();
$.ajax({
url: "/warehouse/delete",
@@ -183,65 +193,138 @@
data: {
"id": id
},
datatype:"json"
}).done(function(data) {
datatype: "json"
}).done(function (data) {
if (data == true) {
alert("삭제되었습니다.");
$(location).attr("href", "/warehouse/list");
} else {
alert("정상적으로 삭제되지 않았습니다..");
}
}).fail(function() {
}).fail(function () {
alert("오류가 발생했습니다.");
}).always(function() {
}).always(function () {
//
});
}//deleteCategoryFunction
const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_delete");
$("#yes_no_modal_show").on("click", function(){
$("#yes_no_modal_show").on("click", function () {
yesNoModalBootStrap.show();
});
$("#modal_yes_button_warehouse_delete").on("click", function(){
$("#modal_yes_button_warehouse_delete").on("click", function () {
yesNoModal.yesFunction();
yesNoModalBootStrap.hide();
});
// 검색 버튼 클릭 시 Ajax로 검색 결과를 갱신
$("#searchBtn").click(function () {
var search = $("#search").val();
// $("#searchBtn").click(function () {
// var search = $("#search").val();
// var searchn = $("#searchn").val();
// var id = $("#id").val();
// var p = $("#p").val();
//
// $.ajax({
// url: "warehouse/read.jsp",
// method: "POST",
// data: {
// search: search,
// searchn: searchn,
// id: id,
// p: p
//
// },
// success: function (result) {
// // 검색 결과를 받아와서 결과를 보여주는 영역 업데이트
// $("#searchResults").html(result);
// },
// error: function () {
// alert("검색 중 오류가 발생했습니다.");
// }
// });
//
//검색기능
$("#searchBtn").on("click", function () {
var searchn = $("#searchn").val();
var search = $("#search").val();
var id = $("#id").val();
$.ajax({
url: "read.jsp",
method: "POST",
data: {
search: search,
searchn: searchn,
id: id
var form = document.createElement("form");
form.action = "/warehouse/read";
form.method = "post";
},
success: function (result) {
// 검색 결과를 받아와서 결과를 보여주는 영역 업데이트
$("#searchResults").html(result);
},
error: function () {
alert("검색 중 오류가 발생했습니다.");
var input1 = document.createElement("input");
input1.type = "hidden";
input1.name = "searchn";
input1.value = searchn;
form.appendChild(input1);
var input2 = document.createElement("input");
input2.type = "hidden";
input2.name = "search";
input2.value = search;
form.appendChild(input2);
var input3 = document.createElement("input");
input3.type = "hidden";
input3.name = "p";
input3.value = 1;
form.appendChild(input3);
var input4 = document.createElement("input");
input4.type = "hidden";
input4.name = "id";
input4.value = id;
form.appendChild(input4);
document.body.appendChild(form);
form.submit();
});
});
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>