This commit is contained in:
sungsu
2024-01-21 23:25:34 +09:00
parent 75b5155ee7
commit c4776ac8a2
22 changed files with 215 additions and 72 deletions

View File

@@ -240,7 +240,7 @@ public class ExcelDownlodeUtils {
cell = row.createCell(2); cell = row.createCell(2);
cell.setCellValue((String) dto.get("warehouseName")); cell.setCellValue((String) dto.get("warehouseName"));
cell = row.createCell(3); cell = row.createCell(3);
cell.setCellValue((String) dto.get("quantity")); cell.setCellValue((int) dto.get("quantity"));
} }
} }

View File

@@ -120,7 +120,7 @@ public class ProductOutController {
@ResponseBody @ResponseBody
public int delete(ProductOutDto dto) { public int delete(ProductOutDto dto) {
System.out.println("데이터 :: " + dto); System.out.println("데이터 :: " + dto);
int i = service.deleteOut(dto); int i = service.outNow(dto);
return i; return i;
} }
@@ -130,13 +130,10 @@ public class ProductOutController {
@PutMapping("/outNow") @PutMapping("/outNow")
@ResponseBody @ResponseBody
public boolean outNow(ProductOutDto dto) { public boolean outNow(ProductOutDto dto) {
int i = service.outNowUpdate(dto); service.outNowUpdate(dto);
if (i != 0) {
service.updateWarehouseDeleteStock(dto); service.updateWarehouseDeleteStock(dto);
service.stockQuantityUpdate(dto);
return true; return true;
} else {
return false;
}
} }

View File

@@ -26,6 +26,8 @@ public interface ProductOutMapper {
int updateWarehouseDeleteStock(ProductOutDto dto); int updateWarehouseDeleteStock(ProductOutDto dto);
int stockQuantityUpdate(ProductOutDto dto);
int createOut(ProductOutDto dto); int createOut(ProductOutDto dto);
Map<String, Object> outOne(String id); Map<String, Object> outOne(String id);

View File

@@ -73,6 +73,11 @@ public class ProductOutService {
return mapper.updateWarehouseDeleteStock(dto); return mapper.updateWarehouseDeleteStock(dto);
} }
public int stockQuantityUpdate(ProductOutDto dto){
return mapper.stockQuantityUpdate(dto);
}
public int deleteOut(ProductOutDto dto) { public int deleteOut(ProductOutDto dto) {
return mapper.deleteOut(dto); return mapper.deleteOut(dto);
} }

View File

@@ -196,7 +196,7 @@ public class StockController {
list = service.warehousesSelect(searchn, search, startRow, perPage ,product_id); list = service.warehousesSelect(searchn, search, startRow, perPage ,product_id);
count = service.warehouseCount(searchn, search ,product_id); count = service.warehouseCount(searchn, search ,product_id);
} }
System.out.println("테스트 :: "+ product_id);
mav.addObject("list", list); mav.addObject("list", list);
mav.addObject("start", startRow + 1); mav.addObject("start", startRow + 1);
@@ -230,9 +230,10 @@ public class StockController {
// 리스트 다운로드 // 리스트 다운로드
@GetMapping("/stock/downloadExcelList") @GetMapping("/downloadExcelList")
public void downlodeExcelList(HttpServletResponse response) { public void downlodeExcelList(HttpServletResponse response) {
List<Map<String, Object>> dto = service.selectAll(); List<Map<String, Object>> dto = service.selectAll();
System.out.println("엑셀 출력 확인 : : " + dto);
String excelFileName = "재고 파일"; String excelFileName = "재고 파일";
String sheetName = "재고"; String sheetName = "재고";
String[] columnName = {"제품명","카테고리","창고","재고수"}; String[] columnName = {"제품명","카테고리","창고","재고수"};
@@ -241,7 +242,7 @@ public class StockController {
}; };
//서식 다운로드 //서식 다운로드
@GetMapping("/stock/downloadStockForm") @GetMapping("/downloadStockForm")
public void downlodeStockForm (HttpServletResponse response) throws IOException { public void downlodeStockForm (HttpServletResponse response) throws IOException {
String stockFormName = "재고 데이터 입력 서식.xlsx"; String stockFormName = "재고 데이터 입력 서식.xlsx";
excelDownlodeUtils.downlodeExcelForm(response, stockFormName); excelDownlodeUtils.downlodeExcelForm(response, stockFormName);

View File

@@ -2,15 +2,22 @@ package com.no1.wms.vendor;
import com.no1.wms.category.CategoryDto; import com.no1.wms.category.CategoryDto;
import com.no1.wms.excel.ExcelDownlodeUtils; import com.no1.wms.excel.ExcelDownlodeUtils;
import com.no1.wms.excel.ExcelRequestManager;
import com.no1.wms.warehouse.WarehouseDto; import com.no1.wms.warehouse.WarehouseDto;
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.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -146,4 +153,61 @@ public class VendorController {
String vendorFormName = "거래처 데이터 입력 서식.xlsx"; String vendorFormName = "거래처 데이터 입력 서식.xlsx";
excelDownlodeUtils.downlodeExcelForm(response, vendorFormName); excelDownlodeUtils.downlodeExcelForm(response, vendorFormName);
}; };
@PostMapping("/vendor/uplodeExcel")
public String uploadExcel(@ModelAttribute("dto") VendorDto dto , RedirectAttributes redirectAttributes, final MultipartHttpServletRequest multiRequest,
HttpServletRequest request, ModelMap model) {
Map<String, Object> resMap = new HashMap<>();
try {
ExcelRequestManager em = new ExcelRequestManager();
// 멀티파트 요청 객체에서 파일 맵을 가져옴
final Map<String, MultipartFile> files = multiRequest.getFileMap();
//초기화
List<HashMap<String,String>> apply =null;
//엑셀파일 가져와서 저장 및 읽기
//변수는 멀티파트 요청 객체의 파일맵, 저장할 엑셀파일명 이름에 추가할 숫자(그냥 0으로 해도 됨)
//마찬가지로 엑셀파일 명 이름에 추가할 문자열, uplode폴더에 들어갈 폴더명(카테고리같은 파트 이름으로 해주세요)
//폴더가 없으면 자동생성되게 해뒀습니다.
//마지막으로 HttpServletRequest
apply = em.parseExcelSpringMultiPart(files, "테스트파일", 0, "", "category", request);
for (int i = 0; i < apply.size(); i++) {
dto.setName(apply.get(i).get("nsme"));
dto.setPresident_name(apply.get(i).get("president_name"));
dto.setAddress(apply.get(i).get("address"));
dto.setRegistration_number(apply.get(i).get("registration_number"));
dto.setEmail(apply.get(i).get("email"));
dto.setPresident_telephone(apply.get(i).get("president_telephone"));
dto.setVendor_manager(apply.get(i).get("vendor_manager"));
dto.setVendor_manager_telephone(apply.get(i).get("vendor_manager_telephone"));
dto.setMain_product(apply.get(i).get("main_product"));
dto.setManager_id(apply.get(i).get("manager_id"));
dto.setActivation(true);
service.createProcess(dto);
}
resMap.put("res", "ok");
resMap.put("msg", "업로드 성공");
} catch (Exception e) {
System.out.println(e.toString());
resMap.put("res", "error");
resMap.put("msg", "업로드 실패");
}
redirectAttributes.addFlashAttribute("resMap", resMap);
return "redirect:/vendor/list";
};
} }

View File

@@ -1,5 +1,6 @@
package com.no1.wms.vendor; package com.no1.wms.vendor;
import com.no1.wms.category.CategoryDto;
import com.no1.wms.warehouse.WarehouseDto; import com.no1.wms.warehouse.WarehouseDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@@ -19,6 +20,7 @@ public interface VendorMapper {
int updateVendor(VendorDto dto); int updateVendor(VendorDto dto);
int createVendor(VendorDto dto); int createVendor(VendorDto dto);
int createProcess(VendorDto dto);
int deleteVendor(String id); int deleteVendor(String id);

View File

@@ -1,6 +1,5 @@
package com.no1.wms.vendor; package com.no1.wms.vendor;
import com.no1.wms.warehouse.WarehouseDto;
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;
@@ -49,6 +48,9 @@ public class VendorService {
public int createVendor(VendorDto dto) { public int createVendor(VendorDto dto) {
return mapper.createVendor(dto); return mapper.createVendor(dto);
} }
public int createProcess(VendorDto dto) {
return mapper.createProcess(dto);
}
public int deleteVendor(String id) { public int deleteVendor(String id) {

View File

@@ -119,6 +119,12 @@
set quantity = #{quantity}, 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 stock
set quantity = quantity - #{quantity}
where product_id = #{product_id} and warehouse_id = #{warehouse_id};
</update>
<!-- update --> <!-- update -->

View File

@@ -27,6 +27,7 @@
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when> <when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when> <when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when> <when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose> </choose>
</where> </where>
</select> </select>
@@ -44,6 +45,7 @@
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when> <when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when> <when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when> <when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose> </choose>
</where> </where>
order by s.id desc limit #{start}, #{perPage} order by s.id desc limit #{start}, #{perPage}
@@ -62,6 +64,7 @@
<when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when> <when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when> <when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
<when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when> <when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose> </choose>
</where> </where>
</select> </select>
@@ -79,13 +82,22 @@
<when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when> <when test="searchn == 0"> quantity &lt;= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when> <when test="searchn == 1"> quantity &lt;= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
<when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when> <when test="searchn == 2"> quantity &lt;= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose> </choose>
</where> </where>
order by s.id desc limit #{start}, #{perPage} order by s.id desc limit #{start}, #{perPage}
</select> </select>
<select id="stockOne" parameterType="Map" resultType="Map"> <select id="stockOne" parameterType="Map" resultType="Map">
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName, p.company_name, w.address, w.capacity, w.current_capacity select s.id as id,
s.warehouse_id as warehouseId,
s.product_id as productId, s.quantity,
p.name as productName,
p.kan_code, c.cls_nm_4, w.name as warehouseName,
p.company_name,
w.address,
w.capacity,
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
from stock s from stock s
left join warehouse w on s.warehouse_id = w.id left join warehouse w on s.warehouse_id = w.id
@@ -125,7 +137,11 @@
</select> </select>
<select id="warehouseSelect" parameterType="Map" resultType="Map"> <select id="warehouseSelect" parameterType="Map" resultType="Map">
select w.id as warehouseId, w.name as warehouseName, capacity, current_capacity ,address select w.id as warehouseId,
w.name as warehouseName,
capacity,
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity ,
address
from warehouse w from warehouse w
left join stock s on s.warehouse_id = w.id left join stock s on s.warehouse_id = w.id

View File

@@ -5,7 +5,7 @@
<mapper namespace="com.no1.wms.vendor.VendorMapper"> <mapper namespace="com.no1.wms.vendor.VendorMapper">
<select id="selectAll" resultType="VendorDto"> <select id="selectAll" resultType="VendorDto">
select select id,
name, name,
president_name, president_name,
address, address,
@@ -14,7 +14,9 @@
president_telephone, president_telephone,
vendor_manager, vendor_manager,
vendor_manager_telephone, vendor_manager_telephone,
main_products main_product,
manager_id,
activation
from vendor; from vendor;
</select> </select>
@@ -108,7 +110,12 @@
<!-- insert --> <!-- insert -->
<insert id="createVendor" parameterType="VendorDto"> <insert id="createVendor" parameterType="VendorDto">
insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation) insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation)
values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, #{activation}) values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, 1)
</insert>
<insert id="createProcess" parameterType="VendorDto">
insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation)
values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, 1)
</insert> </insert>
<!-- insert --> <!-- insert -->

View File

@@ -6,7 +6,7 @@
<select id="count" parameterType="map" resultType="java.lang.Integer"> <select id="count" parameterType="map" resultType="java.lang.Integer">
select count(*) select count(w.id)
from warehouse w from warehouse w
@@ -20,9 +20,11 @@
</select> </select>
<select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto"> <select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto">
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity SELECT w.id,
w.name,
from warehouse w w.capacity,
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
FROM warehouse w
<where> <where>
<choose> <choose>

View File

@@ -108,14 +108,14 @@
$("#submitBtn").on("click", function () { $("#submitBtn").on("click", function () {
var product_id = $("#product_id").val(); var product_id = $("#product_id").val();
var quantity = $("#quantity").val(); var quantity = parseInt($("#quantity").val(), 10);
var expected_delivery_date = $("#expected_delivery_date").val(); var expected_delivery_date = $("#expected_delivery_date").val();
var delivery_date = $("#delivery_date").val(); var delivery_date = $("#delivery_date").val();
var warehouse_id = $("#warehouse_id").val(); var warehouse_id = $("#warehouse_id").val();
var manager_id = $("#manager_id").val(); var manager_id = $("#manager_id").val();
var note = $("#note").val(); var note = $("#note").val();
var activation = $("#activation").val(); var activation = $("#activation").val();
var shipment_quantity = $("#shipment_quantity").val(); var shipment_quantity = parseInt($("#shipment_quantity").val(), 10);
if (!product_id) { if (!product_id) {

View File

@@ -30,12 +30,12 @@
<div class="input-group mb-3 w-30 col-centered"> <div class="input-group mb-3 w-30 col-centered">
<div class="w-25"> <div class="w-25">
<select class="form-select" name="searchn" id="searchn"> <select class="form-select" name="searchn" id="searchn">
<option value="0">제품명</option> <option value="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
<option value="1">창고명</option> <option value="1" ${searchn == 1 ? 'selected' : ''}>창고명</option>
</select> </select>
</div> </div>
<input type="text" name="search" id="search" class="form-control" <input type="text" name="search" id="search" class="form-control"
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요"> aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
<input class="btn btn-info" type="submit" id="searchBtn" value="검색"/> <input class="btn btn-info" type="submit" id="searchBtn" value="검색"/>
<!-- 페이징작업용 --> <!-- 페이징작업용 -->

View File

@@ -60,7 +60,7 @@
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='note_label' class="input-group-text">비고</span> <span id='note_label' class="input-group-text">비고</span>
<textarea readonly id="note" class="form-control" rows="5" value="${dto.note}"></textarea> <textarea readonly id="note" class="form-control" rows="5">${dto.note}</textarea>
</div> </div>
@@ -68,7 +68,7 @@
</div> </div>
</div> </div>
<div class="row col-12"> <div class="row col-12">
<div class="col-6 "> <div class="col-6" id="onoff">
<div class="w-40 col-centered" style="text-align: right"> <div class="w-40 col-centered" style="text-align: right">
<button type="button" class="btn btn-danger" id="outNow">출고</button> <button type="button" class="btn btn-danger" id="outNow">출고</button>
</div> </div>
@@ -109,7 +109,7 @@
</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_outNow" type="button" class="modal_yes btn btn-primary">삭제</button> <button id="modal_yes_button_outNow" type="button" class="modal_yes btn btn-primary">출고</button>
</div> </div>
</div> </div>
</div> </div>
@@ -137,6 +137,13 @@
$(document).ready(function () { $(document).ready(function () {
var deliveryDate = $("#delivery_date").val();
// '출고 날짜' 입력 필드에 값이 있다면, '출고' 버튼을 숨깁니다.
if (deliveryDate) {
$("#outNow").hide();
}
$("#modifyBtn").on("click", function () { $("#modifyBtn").on("click", function () {
var id = $("#id").val(); var id = $("#id").val();
@@ -207,6 +214,9 @@
function outNowUpdate() { function outNowUpdate() {
var id = $("#id").val(); var id = $("#id").val();
var quantity = $("#quantity").val();
var product_id = $("#product_id").val()
var warehouse_id = $("#warehouse_id").val();
var expected_delivery_date = $("#expected_delivery_date").val(); var expected_delivery_date = $("#expected_delivery_date").val();
// 현재 날짜와 시간을 얻기 // 현재 날짜와 시간을 얻기
var now = new Date(); var now = new Date();
@@ -217,6 +227,9 @@
type: "put", type: "put",
data: { data: {
"id": id, "id": id,
"quantity": quantity,
"product_id":product_id,
"warehouse_id": warehouse_id,
"expected_delivery_date": expected_delivery_date, "expected_delivery_date": expected_delivery_date,
"delivery_date": delivery_date "delivery_date": delivery_date
}, },

View File

@@ -59,7 +59,7 @@
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='note_label' class="input-group-text">비고</span> <span id='note_label' class="input-group-text">비고</span>
<textarea id="note" class="form-control" rows="5" value="${note}"></textarea> <textarea id="note" class="form-control" rows="5">${dto.note}</textarea>
</div> </div>

View File

@@ -54,7 +54,7 @@
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='RemainingCapacity_label' class="input-group-text">잔여 용량</span> <span id='RemainingCapacity_label' class="input-group-text">잔여 용량</span>
<input readonly id="remainingcapacity" type="text" placeholder="" value="${dto.capacity - dto.current_capacity}" class="form-control"> <input readonly id="remainingcapacity" type="text" placeholder="" class="form-control">
</div> </div>
@@ -62,13 +62,15 @@
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span class="input-group-text" id="basic-addon4">재고량</span> <span class="input-group-text" id="basic-addon4">재고량</span>
<input type="text" name="quantity" id="quantity" class="form-control" <input type="text" name="quantity" id="quantity" class="form-control"
placeholder="재고량을 입력하세요" aria-label="재고량" value="${dto.quantity }" placeholder="재고량을 입력하세요" aria-label="재고량"
aria-describedby="basic-addon1"> aria-describedby="basic-addon1">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -103,15 +105,16 @@
} }
function showSearchModals2(title, val){ function showSearchModals2(title, val){
$("#searchModalLabel").text(title);
const data = { name : val};
var product_id = $("#product_id").val(); var product_id = $("#product_id").val();
$("#searchModalLabel").text(title);
const data = { name : val,
product_id :product_id};
$.ajax({ $.ajax({
type : 'post', // 타입 (get, post, put 등등) type : 'post', // 타입 (get, post, put 등등)
url : '/stock/show_modal', // 요청할 서버url url : '/stock/show_modal', // 요청할 서버url
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등) dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
data : {"product_id" : product_id},data, data : data,
success : function(result) { // 결과 성공 콜백함수 success : function(result) { // 결과 성공 콜백함수
$("#search_modal_body").html(result); $("#search_modal_body").html(result);
searchModalBootStrap.show(); searchModalBootStrap.show();
@@ -129,9 +132,18 @@
$("#submitBtn").on("click", function () { $("#submitBtn").on("click", function () {
var product_id = $("#product_id").val(); var product_id = $("#product_id").val();
var warehouse_id = $("#warehouse_id").val(); var warehouse_id = $("#warehouse_id").val();
var quantity = $("#quantity").val();
var activation = $("#activation").val(); var activation = $("#activation").val();
var remainingcapacity = $("#remainingcapacity").val(); var quantity = parseInt($("#quantity").val(), 10);
var remainingcapacity = parseInt($("#remainingcapacity").val(), 10);
console.log("Quantity:", quantity);
console.log("Remaining Capacity:", remainingcapacity);
if (quantity > remainingcapacity) {
alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다.");
$("#quantity").focus();
return false;
}
if (!product_id) { if (!product_id) {
alert("제품을 선택해야 합니다."); alert("제품을 선택해야 합니다.");
@@ -150,12 +162,6 @@
return false; return false;
} }
if (quantity > remainingcapacity) {
alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다.");
$("#quantity").focus();
return false;
}
$.ajax({ $.ajax({
url: "/stock/create_process", url: "/stock/create_process",
type: "post", type: "post",

View File

@@ -48,13 +48,14 @@
<div class="input-group mb-3 w-30 col-centered"> <div class="input-group mb-3 w-30 col-centered">
<div class="w-25"> <div class="w-25">
<select class="form-select" name="searchn1" id="searchn1"> <select class="form-select" name="searchn1" id="searchn1">
<option value="0">제품명</option> <option value="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
<option value="1">카테고리</option> <option value="1" ${searchn == 1 ? 'selected' : ''}>카테고리</option>
<option value="2">재고수</option> <option value="2" ${searchn == 2 ? 'selected' : ''}>재고수</option>
<option value="3" ${searchn == 3 ? 'selected' : ''}>창고명</option>
</select> </select>
</div> </div>
<input type="text" id="search1" name="search" class="form-control" <input type="text" id="search1" name="search" class="form-control"
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요"> aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
<button class="btn btn-info" type="button" id="searchBtn">검색</button> <button class="btn btn-info" type="button" id="searchBtn">검색</button>
<!-- 페이징작업용 --> <!-- 페이징작업용 -->
@@ -98,7 +99,6 @@
<div class="row row-buttons"> <div class="row row-buttons">
<div class="col-3 text-start"> <div class="col-3 text-start">
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/> <img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
<button type="button" class="btn btn-success" id="downlodeStockForm">서식 다운로드</button>
<button type="button" class="btn btn-success" id="downlodeExcelList">리스트 다운로드</button> <button type="button" class="btn btn-success" id="downlodeExcelList">리스트 다운로드</button>
</div> </div>
<div class="col-6 d-flex justify-content-center"> <div class="col-6 d-flex justify-content-center">
@@ -147,13 +147,14 @@
<div class="input-group mb-3 w-30 col-centered"> <div class="input-group mb-3 w-30 col-centered">
<div class="w-25"> <div class="w-25">
<select class="form-select" name="searchn" id="searchn2"> <select class="form-select" name="searchn" id="searchn2">
<option value="0">제품명</option> <option value="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
<option value="1">카테고리</option> <option value="1" ${searchn == 1 ? 'selected' : ''}>카테고리</option>
<option value="2">재고수</option> <option value="2" ${searchn == 2 ? 'selected' : ''}>재고수</option>
<option value="3" ${searchn == 3 ? 'selected' : ''}>창고명</option>
</select> </select>
</div> </div>
<input type="text" id="search2" name="search" class="form-control" <input type="text" id="search2" name="search" class="form-control"
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요"> aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
<button class="btn btn-info" type="button" id="searchBtn2">검색</button> <button class="btn btn-info" type="button" id="searchBtn2">검색</button>
<!-- 페이징작업용 --> <!-- 페이징작업용 -->
@@ -195,7 +196,6 @@
<div class="row row-buttons"> <div class="row row-buttons">
<div class="col-3 text-start"> <div class="col-3 text-start">
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/> <img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
<button type="button" class="btn btn-success" id="downlodeStockForm2">서식 다운로드</button>
<button type="button" class="btn btn-success" id="downlodeExcelList2">리스트 다운로드</button> <button type="button" class="btn btn-success" id="downlodeExcelList2">리스트 다운로드</button>
</div> </div>
<div class="col-6 d-flex justify-content-center"> <div class="col-6 d-flex justify-content-center">

View File

@@ -39,7 +39,7 @@
<!--창고 관련 --> <!--창고 관련 -->
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='Warehouse_label' class="input-group-text">창고</span> <span id='Warehouse_label' class="input-group-text">창고</span>
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색" value="${dto.company_name}"> <input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색" value="${dto.warehouseName}">
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouseId}"> <input hidden name="product_id" id="warehouse_id" value="${dto.warehouseId}">
<%-- <button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>--%> <%-- <button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>--%>
</div> </div>
@@ -55,7 +55,7 @@
</div> </div>
<div class="input-group mb-3 w-40 col-centered"> <div class="input-group mb-3 w-40 col-centered">
<span id='RemainingCapacity_label' class="input-group-text">재고량 한도</span> <span id='RemainingCapacity_label' class="input-group-text">수정 가능한 재고량 한도</span>
<input readonly id="remainingcapacity" type="text" placeholder="" value="${dto.capacity - dto.current_capacity + dto.quantity}" class="form-control"> <input readonly id="remainingcapacity" type="text" placeholder="" value="${dto.capacity - dto.current_capacity + dto.quantity}" class="form-control">
</div> </div>
@@ -120,9 +120,9 @@
var warehouse_id = $("#warehouse_id").val(); var warehouse_id = $("#warehouse_id").val();
var quantity = $("#quantity").val(); var quantity = $("#quantity").val();
var activation = $("#activation").val(); var activation = $("#activation").val();
var remainingcapacity = $("#remainingcapacity").val();
var id = $("#id").val(); var id = $("#id").val();
var quantityAdjustment = $("#quantityAdjustment").val(); var quantityAdjustment = parseInt($("#quantityAdjustment").val(), 10);
var remainingcapacity = parseInt($("#remainingcapacity").val(), 10);
if (!product_id) { if (!product_id) {

View File

@@ -18,13 +18,13 @@
<div class="input-group mb-3 w-30 col-centered"> <div class="input-group mb-3 w-30 col-centered">
<div class="w-25"> <div class="w-25">
<select class="form-select" name="searchn" id="searchn"> <select class="form-select" name="searchn" id="searchn">
<option value="0">업체명</option> <option value="0" ${searchn == 0 ? 'selected' : ''}>업체명</option>
<option value="1">대표번호</option> <option value="1" ${searchn == 1 ? 'selected' : ''}>대표번호</option>
<option value="2">거래처 담당자</option> <option value="2" ${searchn == 2 ? 'selected' : ''}>거래처 담당자</option>
<option value="3">거래처 담당자 전화번호</option> <option value="3" ${searchn == 3 ? 'selected' : ''}>거래처 담당자 전화번호</option>
</select> </select>
</div> </div>
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요"> <input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
<button class="btn btn-info" type="button" id="searchBtn">검색</button> <button class="btn btn-info" type="button" id="searchBtn">검색</button>
<!-- 페이징작업용 --> <!-- 페이징작업용 -->
@@ -69,8 +69,7 @@
<div class="row row-buttons"> <div class="row row-buttons">
<div class="col-3 text-start"> <div class="col-3 text-start">
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/> <img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
<button type="button" class="btn btn-success" id="upload">업로드</button> <button type="button" class="btn btn-success" id="downlodeExcelForm">양식 다운로드</button>
<button type="button" class="btn btn-success" id="downlodeExcelForm">서식 다운로드</button>
<button type="button" class="btn btn-success" id="downlodeExcelList">리스트 다운로드</button> <button type="button" class="btn btn-success" id="downlodeExcelList">리스트 다운로드</button>
</div> </div>
<div class="col-6 d-flex justify-content-center"> <div class="col-6 d-flex justify-content-center">
@@ -99,6 +98,14 @@
<button type="button" class="btn btn-primary" id="createButton">생성</button> <button type="button" class="btn btn-primary" id="createButton">생성</button>
</div> </div>
</div><!-- row row-buttons --> </div><!-- row row-buttons -->
<form name="uplodeExcleForm" id="uplodeExcleForm" method="post" onsubmit="return _onSubmit();" action="/vendor/uplodeExcel" enctype="multipart/form-data" class="form-horizontal">
<input type="file" name="file" id="file" accept=".xlsx, .xls"/>
<button type="submit" class="btn btn-success" id="uploadExcel">업로드</button>
</form><!-- uplodeExcleForm -->
</div> </div>
</div> </div>
@@ -215,6 +222,19 @@
document.body.appendChild(form); document.body.appendChild(form);
form.submit(); form.submit();
} }
function _onSubmit(){
if($("#file").val() == ""){
alert("파일을 업로드해주세요.");
$("#file").focus();
return false;
}
return true;
}
</script> </script>
</body> </body>
</html> </html>

View File

@@ -30,13 +30,13 @@
<div class="input-group mb-3 w-30 col-centered"> <div class="input-group mb-3 w-30 col-centered">
<div class="w-25"> <div class="w-25">
<select class="form-select" name="searchn" id="searchn"> <select class="form-select" name="searchn" id="searchn">
<option value="0">창고명</option> <option value="0" ${searchn == 0 ? 'selected' : ''}>창고명</option>
<option value="1">용량</option> <option value="1" ${searchn == 1 ? 'selected' : ''}>용량</option>
<option value="2">적재량</option> <option value="2" ${searchn == 2 ? 'selected' : ''}>적재량</option>
</select> </select>
</div> </div>
<input type="text" name="search" id="search" class="form-control" <input type="text" name="search" id="search" class="form-control"
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요"> aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
<button class="btn btn-info" type="button" id="searchBtn">검색</button> <button class="btn btn-info" type="button" id="searchBtn">검색</button>
<!-- 페이징작업용 --> <!-- 페이징작업용 -->

View File

@@ -53,13 +53,13 @@
<div class="input-group mb-3 w-30 col-centered"> <div class="input-group mb-3 w-30 col-centered">
<div class="w-25"> <div class="w-25">
<select class="form-select" id="searchn"> <select class="form-select" id="searchn">
<option value="0">제품명</option> <option value="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
<option value="1">재고수</option> <option value="1" ${searchn == 1 ? 'selected' : ''}>재고수</option>
</select> </select>
</div> </div>
<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" placeholder="검색어를 입력하세요"> aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
<input class="btn btn-info" type="submit" id="searchBtn" value="검색"/> <input class="btn btn-info" type="submit" id="searchBtn" value="검색"/>
</div> </div>