mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 12:13:24 +09:00
제품 모달 업데이트 가격 입고 생성 jsp업데이트 입고 컨트롤러 매퍼 리스트 업데이트
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.no1.wms.in;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -10,6 +11,12 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.no1.wms.price.PriceDto;
|
||||
import com.no1.wms.product.ProductDto;
|
||||
import com.no1.wms.product.ProductService;
|
||||
import com.no1.wms.stock.StockService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/in")
|
||||
@@ -17,6 +24,10 @@ public class InController {
|
||||
|
||||
@Autowired
|
||||
InService inService;
|
||||
@Autowired
|
||||
ProductService productService;
|
||||
@Autowired
|
||||
StockService stockservice;
|
||||
|
||||
@GetMapping("/list")
|
||||
//@ResponseBody
|
||||
@@ -59,6 +70,112 @@ public class InController {
|
||||
return "in/create";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(PriceDto dto) {
|
||||
int i = inService.createProcess(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//모달화면
|
||||
@PostMapping("/show_modal_product")
|
||||
public ModelAndView productShowModal(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) {
|
||||
int count = productService.count(searchn, search);
|
||||
|
||||
int perPage = 10; // 한 페이지에 보일 글의 개수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<ProductDto> dto = productService.productList(searchn, search, startRow ,perPage);
|
||||
|
||||
m.addObject("list", dto);
|
||||
m.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;
|
||||
}
|
||||
|
||||
m.addObject("searchn",searchn);
|
||||
m.addObject("search",search);
|
||||
m.addObject("begin", begin);
|
||||
m.addObject("end", end);
|
||||
m.addObject("pageNum", pageNum);
|
||||
m.addObject("totalPages", totalPages);
|
||||
m.addObject("p" , page);
|
||||
m.setViewName(name);
|
||||
return m;
|
||||
}
|
||||
|
||||
@PostMapping("/show_modal_warehouse")
|
||||
public ModelAndView warehouseShowModal(@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 = 9; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<Map<String, Object>> list = null;
|
||||
int count = 0;
|
||||
|
||||
list = stockservice.warehousesSelect(searchn, search, startRow, perPage);
|
||||
count = stockservice.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("searchn", searchn);
|
||||
mav.addObject("search", search);
|
||||
mav.addObject("begin", begin);
|
||||
mav.addObject("end", end);
|
||||
mav.addObject("pageNum", pageNum);
|
||||
mav.addObject("totalPages", totalPages);
|
||||
mav.addObject("p" , page);
|
||||
|
||||
mav.setViewName(name);
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -69,40 +69,7 @@
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="inList2" parameterType="map" resultMap="inResultMap">
|
||||
SELECT
|
||||
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,
|
||||
pro.name as product_name,
|
||||
w.name as warehouse_name,
|
||||
a.name as account_name
|
||||
|
||||
FROM
|
||||
product_in as proin
|
||||
left join plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
|
||||
left join product as pro on proin.product_id = pro.id
|
||||
left join warehouse as w on proin.warehouse_id = w.id
|
||||
left join account as a on proin.manager_id = a.id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">
|
||||
proin.activation = 1 and proin.product_id IN (SELECT id FROM product WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 1">
|
||||
proin.activation = 1 AND proin.in_date LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
<when test="searchn == 2">
|
||||
proin.activation = 1 AND proin.manager_id IN (SELECT id FROM account WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 3">
|
||||
proin.activation = 1 AND proin.group_number LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY proin.in_date LIMIT #{start} , #{perPage}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="inList" parameterType="map" resultMap="inResultMap">
|
||||
SELECT
|
||||
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,
|
||||
@@ -133,7 +100,7 @@
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY proin.in_date LIMIT #{start} , #{perPage}
|
||||
ORDER BY proin.in_date desc LIMIT #{start} , #{perPage}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<%@ 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>
|
||||
@@ -22,25 +23,84 @@
|
||||
<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="productName" id="productName" class="form-control"
|
||||
placeholder="제품명을 검색하세요" aria-label="제품명" value="${dto.productDto.name }"
|
||||
aria-describedby="basic-addon1" readonly>
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchProductName"
|
||||
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal('제품 검색','product')" >검색</button>
|
||||
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal_product('제품 검색','product')" >검색</button>
|
||||
<input type='hidden' id="product_id" value="">
|
||||
|
||||
</div>
|
||||
<!-- 설명만 있는 입력 -->
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">가격</span>
|
||||
<input type="number" name="price" id="price" class="form-control"
|
||||
placeholder="가격을 입력하세요" aria-label="가격" value="${dto.price }"
|
||||
aria-describedby="basic-addon1" disable><!-- 여기서부터 작업 -->
|
||||
<span id='company_name_span' class="input-group-text">회사명</span>
|
||||
<input readonly id="company_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='cls_Nm_4_span' class="input-group-text">분류</span>
|
||||
<input readonly id="cls_Nm_4" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='vendor_name_span' class="input-group-text">거래처</span>
|
||||
<input readonly id="vendor_name" type="text" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 수량 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">수량</span>
|
||||
<input type="number" name="quantity" id="quantity" class="form-control"
|
||||
placeholder="수량을 입력하세요" aria-label="수량" value="${dto.quantity }"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
<!-- 창고명 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">창고명</span>
|
||||
<input type="text" name="warehouse_name" id="warehouse_name" class="form-control"
|
||||
placeholder="창고를 검색하세요" aria-label="창고명" value="${dto.warehouseDto.name }"
|
||||
aria-describedby="basic-addon1" readonly>
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchWarehouseName"
|
||||
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal_warehouse('창고 검색','warehouse_capacity_currentCapacity')" >검색</button>
|
||||
<input type='hidden' id="warehouse_id" value="">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='address_span' 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_span' 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_span' class="input-group-text">잔여 용량</span>
|
||||
<input readonly id="remainingcapacity" type="text" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">입고날짜</span>
|
||||
<fmt:formatDate value="${dto.in_date}" pattern="yyyy-MM-dd HH:mm:ss" type="date" var="formattedDate" />
|
||||
<input type="datetime-local" id="in_date" name="in_date" class="form-control"
|
||||
placeholder="날짜을 입력하세요" aria-label="입고날짜" value="${formattedDate}"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
|
||||
<c:set var="userData" value="${sessionScope.userData}" />
|
||||
<input type='hidden' id="manager_id" value="${userData.id }">
|
||||
</div>
|
||||
@@ -49,7 +109,7 @@
|
||||
<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-success" id="submitBtn">추가</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,8 +118,107 @@
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#cancelBtn").on("click", function(){
|
||||
$(location).attr("href", "/in/list");
|
||||
|
||||
})//cancelBtn
|
||||
|
||||
$("#submitBtn").on("click",function(){
|
||||
var product_id = $("#product_id").val();
|
||||
var quantity = $("#quantity").val();
|
||||
var warehouse_id = $("#warehouse_id").val();
|
||||
var in_date = $("#in_date").val();
|
||||
var manager_id = $("#manager_id").val();
|
||||
|
||||
|
||||
if(!product_id){
|
||||
alert("제품을 선택해야합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!quantity){
|
||||
alert("수량을 입력해야 합니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
if(!warehouse_id){
|
||||
alert("창고을 선택해야합니다.");
|
||||
return false;
|
||||
}
|
||||
if(!in_date){
|
||||
in_date = new Date();
|
||||
}
|
||||
|
||||
const data = {
|
||||
product_id : product_id,
|
||||
quantity : quantity,
|
||||
in_date : in_date,
|
||||
manager_id : manager_id,
|
||||
warehouse_id : warehouse_id
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: "/in/create_process",
|
||||
type: "post",
|
||||
data: data,
|
||||
datatype:"json"
|
||||
}).done(function(data) {
|
||||
if (data == true) {
|
||||
alert("입고을 추가했습니다.");
|
||||
$(location).attr("href", "/price/list");
|
||||
} else {
|
||||
alert("입고 추가에 실패하였습니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
//
|
||||
});
|
||||
|
||||
});//submitBtn
|
||||
});//ready
|
||||
|
||||
|
||||
function showSearchModal_product(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/in/show_modal_product', // 요청할 서버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)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showSearchModal_warehouse(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/in/show_modal_warehouse', // 요청할 서버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>
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<th>가격</th>
|
||||
<th>수량</th>
|
||||
<th>입고예정그룹번호</th>
|
||||
<th>창고이름</th>
|
||||
<th>입고날짜</th>
|
||||
<th>담당자</th>
|
||||
</tr>
|
||||
@@ -59,7 +60,13 @@
|
||||
<td>${dto.productDto.name }</td>
|
||||
<td>${dto.latest_price }</td>
|
||||
<td>${dto.quantity }</td>
|
||||
<td>${dto.planInDto.viewGroupNumber }</td>
|
||||
<c:if test="${not empty dto.planInDto.viewGroupNumber}">
|
||||
<td>${dto.planInDto.viewGroupNumber}</td>
|
||||
</c:if>
|
||||
<c:if test="${empty dto.planInDto.viewGroupNumber}">
|
||||
<td></td>
|
||||
</c:if>
|
||||
<td>${dto.warehouseDto.name }</td>
|
||||
<td><fmt:formatDate value="${dto.in_date}" pattern="yyyy-MM-dd" type="date"/></td>
|
||||
<td>${dto.accountDto.name }</td>
|
||||
</tr>
|
||||
|
||||
@@ -8,9 +8,16 @@
|
||||
const $tag = $(tag);
|
||||
const tid = $tag.data('tid');
|
||||
const name = $tag.data('tname');
|
||||
const company_name = $tag.data('tcompany_name');
|
||||
const cls_nm_4 = $tag.data('tcls_nm_4');
|
||||
const vendor_name = $tag.data('tvendor_name');
|
||||
|
||||
|
||||
$("#productName").val(name);
|
||||
$("#product_id").val(tid);
|
||||
$("#company_name").val(company_name);
|
||||
$("#cls_Nm_4").val(cls_nm_4);
|
||||
$("#vendor_name").val(vendor_name);
|
||||
hideSearchModal();
|
||||
}//onSelect
|
||||
|
||||
@@ -119,7 +126,7 @@
|
||||
<td><fmt:formatDate value="${dto.registration_date }"
|
||||
dateStyle="short" /></td>
|
||||
<td>${dto.accountDto.name }</td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" data-tcompany_name="${dto.company_name }" data-tcls_nm_4="${dto.categoryDto.cls_nm_4 }" data-tvendor_name="${dto.vendorDto.name }"class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
|
||||
@@ -38,7 +38,23 @@
|
||||
<input type='hidden' id="product_id" value="">
|
||||
|
||||
</div>
|
||||
<!-- 설명만 있는 입력 -->
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='company_name_span' class="input-group-text">회사명</span>
|
||||
<input readonly id="company_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='cls_Nm_4_span' class="input-group-text">분류</span>
|
||||
<input readonly id="cls_Nm_4" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='vendor_name_span' class="input-group-text">거래처</span>
|
||||
<input readonly id="vendor_name" type="text" placeholder="" value="" class="form-control">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">가격</span>
|
||||
<input type="number" name="price" id="price" class="form-control"
|
||||
@@ -72,8 +88,8 @@ $(document).ready(function() {
|
||||
$("#submitBtn").on("click", function(){
|
||||
|
||||
var price = $("#price").val();
|
||||
var manager_id = $("#manager_id").val();// 수정해야함.
|
||||
var product_id = $("#product_id").val();// 수정해야함.
|
||||
var manager_id = $("#manager_id").val();
|
||||
var product_id = $("#product_id").val();
|
||||
|
||||
if(!price){
|
||||
alert("가격을 입력해야 합니다.");
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
|
||||
<div class="row">
|
||||
<h1>제품 상세페이지</h1>
|
||||
<h1>제품 가격 상세페이지</h1>
|
||||
<div class="col-10" style="text-align: right;">
|
||||
<button type="button" class="btn btn-danger" onclick="goDelete()">삭제</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user