mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
#수정
stock/create.jsp StockService.java StockController.java
This commit is contained in:
@@ -146,9 +146,9 @@ public class StockController {
|
||||
// 생성 - Ajax
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(StockDto dto) {
|
||||
service.checkandUpdateOrCreateProcess(dto);
|
||||
return true;
|
||||
public int createProcess(StockDto dto) {
|
||||
int c = service.checkandUpdateOrCreateProcess(dto);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import com.no1.wms.in.InDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -149,15 +148,16 @@ public class StockService {
|
||||
|
||||
|
||||
//createProcess
|
||||
public boolean checkandUpdateOrCreateProcess(StockDto dto){
|
||||
public int checkandUpdateOrCreateProcess(StockDto dto){
|
||||
mapper.updateWarehousePlus(dto);
|
||||
int j = mapper.checkIfExistsStock(dto);
|
||||
if (j == 1){
|
||||
mapper.updateStockProcess(dto);
|
||||
return 1;
|
||||
}else{
|
||||
mapper.createStockProcess(dto);
|
||||
return 2;
|
||||
}
|
||||
mapper.updateWarehousePlus(dto);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,117 +7,117 @@
|
||||
</div>
|
||||
<hr>
|
||||
<div class="container" style="text-align: center">
|
||||
<div class="ulTag">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<!--제품 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Product_label' class="input-group-text">제품</span>
|
||||
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색">
|
||||
<input hidden name="ProductName" id="product_id" value="${dto.product_id}">
|
||||
<button id="product_search_button" class="btn-primary btn" onclick="showSearchModals('제품 검색','product_category_company_search')">검색</button>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
|
||||
<!--창고 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색">
|
||||
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouse_id}">
|
||||
<button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals2('창고 검색','warehouse_capacity_currentCapacity')">검색</button>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Address_label' 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_label' 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_label' class="input-group-text">잔여 용량</span>
|
||||
<input readonly id="remainingcapacity" type="text" placeholder="" class="form-control">
|
||||
</div>
|
||||
|
||||
|
||||
<!--적재할 상품의 재고수-->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">재고량</span>
|
||||
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||
placeholder="재고량을 입력하세요" aria-label="재고량"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ulTag">
|
||||
<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 class="col-12">
|
||||
|
||||
|
||||
<input type='hidden' id="activation" value="1">
|
||||
|
||||
|
||||
<!--제품 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Product_label' class="input-group-text">제품</span>
|
||||
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색">
|
||||
<input hidden name="ProductName" id="product_id" value="${dto.product_id}">
|
||||
<button id="product_search_button" class="btn-primary btn"
|
||||
onclick="showSearchModals('제품 검색','product_category_company_search')">검색
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="">
|
||||
</div>
|
||||
|
||||
|
||||
<!--창고 관련 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색">
|
||||
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouse_id}">
|
||||
<button id="Warehouse_search_button" class="btn-primary btn"
|
||||
onclick="showSearchModals2('창고 검색','warehouse_capacity_currentCapacity')">검색
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='Address_label' 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_label' 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_label' class="input-group-text">잔여 용량</span>
|
||||
<input readonly id="remainingcapacity" type="text" placeholder="" class="form-control">
|
||||
</div>
|
||||
|
||||
|
||||
<!--적재할 상품의 재고수-->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon4">재고량</span>
|
||||
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||
placeholder="재고량을 입력하세요" aria-label="재고량"
|
||||
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>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function showSearchModals(title, val){
|
||||
function showSearchModals(title, val) {
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
const data = {name: val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/stock/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
type: 'post', // 타입 (get, post, put 등등)
|
||||
url: '/stock/show_modal', // 요청할 서버url
|
||||
dataType: 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data: data,
|
||||
success: function (result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
error: function (request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showSearchModals2(title, val){
|
||||
function showSearchModals2(title, val) {
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
const data = {name: val};
|
||||
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/stock/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
type: 'post', // 타입 (get, post, put 등등)
|
||||
url: '/stock/show_modal', // 요청할 서버url
|
||||
dataType: 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data: data,
|
||||
success: function (result) { // 결과 성공 콜백함수
|
||||
$("#search_modal_body").html(result);
|
||||
searchModalBootStrap.show();
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
error: function (request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
@@ -172,8 +172,13 @@
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("재고 정보가 생성되었습니다.");
|
||||
if (data != 0) {
|
||||
if (data == 1) {
|
||||
alert("기존 재고에 추가되었습니다.");
|
||||
} else {
|
||||
alert("재고 정보가 생성되었습니다.");
|
||||
}
|
||||
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/read";
|
||||
|
||||
Reference in New Issue
Block a user