This commit is contained in:
sungsu
2024-01-17 17:03:28 +09:00
parent ccd7d743d8
commit 9c91eb41cb
17 changed files with 1903 additions and 78 deletions

View File

@@ -0,0 +1,200 @@
package com.no1.wms.out;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
import java.util.Map;
@Controller
@Slf4j
@RequestMapping("/out")
public class ProductOutController {
@Autowired
ProductOutService service;
// 출고 리스트 출력
@GetMapping("/list")
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
@RequestParam(name = "search", defaultValue = "") String search,
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
int count = service.count(searchn, search);
int perPage = 10; // 한 페이지에 보일 글의 갯수
int startRow = (page - 1) * perPage;
//스톡서비스로 재고 리스트 출력 메서트 작성
List<Map<String, Object>> dto = service.list(searchn, search, startRow ,perPage);
m.addAttribute("olist", dto);
m.addAttribute("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.addAttribute("searchn", searchn);
m.addAttribute("search", search);
m.addAttribute("begin", begin);
m.addAttribute("end", end);
m.addAttribute("pageNum", pageNum);
m.addAttribute("totalPages", totalPages);
m.addAttribute("p" , page);
System.out.println("테스트 : : " + m);
return "out/list";
}
// 재고 상세페이지
@PostMapping("/read")
public String read(@RequestParam String id, Model m) {
//스톡서비스로 재고 상세페이지 출력 메서드 작성
Map<String, Object> dto = service.outOne(id);
m.addAttribute("dto", dto);
return "out/read";
}
// 수정 - 폼
@PostMapping("/update")
public String update(String id, Model m) {
Map<String, Object> dto = service.outOne(id);
m.addAttribute("dto", dto);
return "out/update";
}
// 수정 프로세스
@PutMapping("/update_process")
@ResponseBody
public boolean updateProcess(ProductOutDto dto) {
int i = service.outUpdate(dto);
if (i == 1) {
return true;
} else {
return false;
}
}
// 생성 폼
@PostMapping("/create")
public String create() {
return "out/create";
}
// 생성 - Ajax
@PostMapping("/create_process")
@ResponseBody
public boolean createProcess(ProductOutDto dto) {
System.out.println("테스트 : : " + dto);
int i = service.createOut(dto);
if (i != 0) {
return true;
} else {
return false;
}
}
// 삭제
@DeleteMapping("/delete")
@ResponseBody
public int delete(ProductOutDto dto) {
System.out.println("데이터 :: " + dto);
int i = service.deleteOut(dto);
return i;
}
//즉시 출고
@PutMapping("/outNow")
@ResponseBody
public boolean outNow(ProductOutDto dto) {
int i = service.outNowUpdate(dto);
if (i != 0) {
service.updateWarehouseDeleteStock(dto);
return true;
} else {
return false;
}
}
@PostMapping("/show_modal")
public ModelAndView showModal(@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 = 5; // 한 페이지에 보일 글의 갯수
int startRow = (page - 1) * perPage;
List<Map<String, Object>> list = null;
int count = 0;
//테스트
System.out.println("name : " + name);
System.out.println("list : " + list);
System.out.println("count : " + count);
System.out.println("mav : " + mav);
//테스트
// 모달 선택
if(name.equals("stock_product_warehouse")){
list = service.stockSelect(searchn, search, startRow, perPage);
count = service.stockCount(searchn, search);
}else if(name.equals("warehouse_capacity_currentCapacity")) {
}
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);
//테스트
System.out.println("name : " + name);
System.out.println("list : " + list);
System.out.println("count : " + count);
System.out.println("mav : " + mav);
//테스트
return mav;
}
}

View File

@@ -0,0 +1,29 @@
package com.no1.wms.out;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProductOutDto {
private String id;
private String product_id;
private int quantity;
private String expected_delivery_date;
private String delivery_date;
private String warehouse_id;
private String manager_id;
private String note;
private int activation;
}

View File

@@ -0,0 +1,46 @@
package com.no1.wms.out;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface ProductOutMapper {
int count(Map<String, Object> m);//검색 글 갯수
List<Map<String, Object>> list(Map<String, Object> m);
int outUpdate(ProductOutDto dto);
int updateStock(ProductOutDto dto);
int updateWarehouse(ProductOutDto dto);
int outNowUpdate(ProductOutDto dto);
int updateWarehousePlus(ProductOutDto dto);
int updateWarehouseDeleteStock(ProductOutDto dto);
int createOut(ProductOutDto dto);
Map<String, Object> outOne(String id);
int deleteOut(ProductOutDto dto);
int outNow(ProductOutDto dto);
List<Map<String, Object>> stockSelect(Map<String, Object> m);
int stockCount(Map<String, Object> m);//검색 글 갯수
}

View File

@@ -0,0 +1,108 @@
package com.no1.wms.out;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class ProductOutService {
@Autowired
ProductOutMapper mapper;
public int count(int searchn, String search) {
Map<String,Object> m = new HashMap<String, Object>();
m.put("searchn",searchn);
m.put("search", search);
return mapper.count(m);
}
public List<Map<String, Object>> list(int searchn, String search, int start, int perPage){
Map<String, Object> m = new HashMap<String, Object>();
m.put("searchn",searchn);
m.put("search", search);
m.put("start", start);
m.put("perPage", perPage);
List<Map<String, Object>> result = mapper.list(m);
return result;
}
public Map<String, Object> outOne(String id) {
return mapper.outOne(id);
}
public int createOut(ProductOutDto dto) {
return mapper.createOut(dto);
}
public int outUpdate(ProductOutDto dto) {
return mapper.outUpdate(dto);
}
public int updateStock(ProductOutDto dto) {
return mapper.updateStock(dto);
}
public int updateWarehouse(ProductOutDto dto){
return mapper.updateWarehouse(dto);
}
public int outNowUpdate(ProductOutDto dto){
return mapper.outNowUpdate(dto);}
public int updateWarehousePlus(ProductOutDto dto){
return mapper.updateWarehousePlus(dto);
}
public int updateWarehouseDeleteStock(ProductOutDto dto){
return mapper.updateWarehouseDeleteStock(dto);
}
public int deleteOut(ProductOutDto dto) {
return mapper.deleteOut(dto);
}
public int outNow(ProductOutDto dto) {
return mapper.outNow(dto);
}
public List<Map<String, Object>> stockSelect(int searchn, String search, int start, int perPage){
Map<String, Object> m = new HashMap<String, Object>();
m.put("searchn", searchn);
m.put("search", search);
m.put("start", start);
m.put("perPage", perPage);
List<Map<String, Object>> productresult = mapper.stockSelect(m);
return productresult;
}
public int stockCount(int searchn, String search) {
Map<String,Object> m = new HashMap<String, Object>();
m.put("searchn",searchn);
m.put("search", search);
return mapper.stockCount(m);
}
}

View File

@@ -3,9 +3,11 @@ package com.no1.wms.resetpassword;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/resetpassword")
@@ -15,6 +17,43 @@ public class ResetPasswordController {
@Autowired
ResetPasswordService resetPasswordService;
/*GetMapping("/list")
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
@RequestParam(name = "search", defaultValue = "") String search,
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
int count = resetPasswordService.count(searchn, search);
int perPage = 10; // 한 페이지에 보일 글의 갯수
int startRow = (page - 1) * perPage;
//스톡서비스로 재고 리스트 출력 메서트 작성
List<Map<String, Object>> dto = resetPasswordService.list(searchn, search, startRow ,perPage);
m.addAttribute("rlist", dto);
m.addAttribute("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.addAttribute("searchn", searchn);
m.addAttribute("search", search);
m.addAttribute("begin", begin);
m.addAttribute("end", end);
m.addAttribute("pageNum", pageNum);
m.addAttribute("totalPages", totalPages);
m.addAttribute("p" , page);
System.out.println("테스트 : : " + m);
return "out/list";
}*/
@PostMapping("/insert")
@ResponseBody
public String insert(ResetPasswordDto dto, Gson gson){

View File

@@ -22,78 +22,77 @@ public class StockController {
// 탭 1 재고 리스트 출력
@GetMapping("/list")
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
@RequestParam(name = "search", defaultValue = "") String search,
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
int count = service.count(searchn, search);
public String list(@RequestParam(name = "searchn1", defaultValue = "0") int searchn1,
@RequestParam(name = "search1", defaultValue = "") String search1,
@RequestParam(name = "p1", defaultValue = "1") int p1,
@RequestParam(name = "searchn2", defaultValue = "0") int searchn2,
@RequestParam(name = "search2", defaultValue = "") String search2,
@RequestParam(name = "p2", defaultValue = "1") int p2,
Model m) {
int count = service.count(searchn1, search1);
int perPage = 10; // 한 페이지에 보일 글의 갯수
int startRow = (page - 1) * perPage;
int perPage1 = 10; // 한 페이지에 보일 글의 갯수
int startRow1 = (p1 - 1) * perPage1;
//스톡서비스로 재고 리스트 출력 메서트 작성
List<Map<String, Object>> dto = service.list(searchn, search, startRow ,perPage);
m.addAttribute("slist", dto);
List<Map<String, Object>> dto1 = service.list(searchn1, search1, startRow1 ,perPage1);
m.addAttribute("slist1", dto1);
m.addAttribute("start", startRow + 1);
m.addAttribute("start1", startRow1 + 1);
int pageNum = 5;//보여질 페이지 번호 수
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
int pageNum1 = 5;//보여질 페이지 번호 수
int totalPages1 = count / perPage1 + (count % perPage1 > 0 ? 1 : 0); // 전체 페이지 수
int begin = (page - 1) / pageNum * pageNum + 1;
int end = begin + pageNum - 1;
if (end > totalPages) {
end = totalPages;
int begin1 = (p1 - 1) / pageNum1 * pageNum1 + 1;
int end1 = begin1 + pageNum1 - 1;
if (end1 > totalPages1) {
end1 = totalPages1;
}
m.addAttribute("searchn", searchn);
m.addAttribute("search", search);
m.addAttribute("begin", begin);
m.addAttribute("end", end);
m.addAttribute("pageNum", pageNum);
m.addAttribute("totalPages", totalPages);
m.addAttribute("p" , page);
m.addAttribute("searchn1", searchn1);
m.addAttribute("search1", search1);
m.addAttribute("begin1", begin1);
m.addAttribute("end1", end1);
m.addAttribute("pageNum1", pageNum1);
m.addAttribute("totalPages1", totalPages1);
m.addAttribute("p1" , p1);
//탭 2
int count2 = service.count2(searchn2, search2);
System.out.println("count2 ::" + count2);
int perPage2 = 10; // 한 페이지에 보일 글의 갯수
int startRow2 = (p2 - 1) * perPage2;
//스톡서비스로 재고 리스트 출력 메서트 작성
List<Map<String, Object>> dto2 = service.list2(searchn2, search2, startRow2 ,perPage2);
System.out.println("dto ::" + dto2);
m.addAttribute("slist2", dto2);
m.addAttribute("start2", startRow2 + 1);
int pageNum2 = 5;//보여질 페이지 번호 수
int totalPages2 = count2 / perPage2 + (count2 % perPage2 > 0 ? 1 : 0); // 전체 페이지 수
int begin2 = (p2 - 1) / pageNum2 * pageNum2 + 1;
int end2 = begin2 + pageNum2 - 1;
if (end2 > totalPages2) {
end2 = totalPages2;
}
m.addAttribute("searchn2", searchn2);
m.addAttribute("search2", search2);
m.addAttribute("begin2", begin2);
m.addAttribute("end2", end2);
m.addAttribute("pageNum2", pageNum2);
m.addAttribute("totalPages2", totalPages2);
m.addAttribute("p2" , p2);
return "stock/list";
}
// 탭 2 재고 리스트 출력
@GetMapping("/list2")
public String list2(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
@RequestParam(name = "search", defaultValue = "") String search,
@RequestParam(name = "p2", defaultValue = "1") int page, Model m) {
int count = service.count(searchn, search);
int perPage = 10; // 한 페이지에 보일 글의 갯수
int startRow = (page - 1) * perPage;
//스톡서비스로 재고 리스트 출력 메서트 작성
List<Map<String, Object>> dto = service.list(searchn, search, startRow ,perPage);
m.addAttribute("slist2", dto);
m.addAttribute("start2", 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.addAttribute("searchn2", searchn);
m.addAttribute("search2", search);
m.addAttribute("begin2", begin);
m.addAttribute("end2", end);
m.addAttribute("pageNum2", pageNum);
m.addAttribute("totalPages2", totalPages);
m.addAttribute("p2" , page);
return "stock/list";
}
// 재고 상세페이지
@@ -204,6 +203,8 @@ public class StockController {
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);

View File

@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.no1.wms.out.ProductOutMapper">
<!-- select -->
<select id="count" parameterType="Map" resultType="java.lang.Integer">
select count(o.id)
from product_out o
left join warehouse w on o.warehouse_id = w.id
left join product p on o.product_id = p.id
<where>
<choose>
<when test="searchn == 0">o.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1">o.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose>
</where>
</select>
<select id="list" parameterType="Map" resultType="Map">
select o.id, o.product_id, o.quantity, o.expected_delivery_date, o.delivery_date, o.warehouse_id, o.manager_id, o.note, o.activation, p.name as productName, w.name as warehouseName
from product_out o
left join warehouse w on o.warehouse_id = w.id
left join product p on o.product_id = p.id
<where>
<choose>
<when test="searchn == 0">o.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1">o.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose>
</where>
order by o.expected_delivery_date desc limit #{start}, #{perPage}
</select>
<select id="outOne" parameterType="Map" resultType="Map">
select o.id as id, p.name as product_name, p.kan_code, o.quantity, w.name as warehouse_name, w.id as warehouse_id, p.id as product_id, o.expected_delivery_date, o.delivery_date, o.note
from product_out o
left join warehouse w on o.warehouse_id = w.id
left join product p on o.product_id = p.id
where o.id = #{id}
</select>
<select id="stockSelect" parameterType="Map" resultType="Map">
select p.name as product_name, p.kan_code, s.quantity, w.name as warehouse_name, s.warehouse_id, s.product_id
from stock s
left join product p on s.product_id = p.id
left join warehouse w on s.warehouse_id = w.id
left join product_out o on s.product_id = o.id
<where>
<choose>
<when test="searchn == 0"> o.id IS NULL and p.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> o.id IS NULL and p.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose>
</where>
order by p.name desc limit #{start}, #{perPage}
</select>
<select id="stockCount" parameterType="Map" resultType="java.lang.Integer">
SELECT count(s.id)
from stock s
left join product p on s.product_id = p.id
left join warehouse w on s.warehouse_id = w.id
left join product_out o on s.product_id = o.id
<where>
<choose>
<when test="searchn == 0"> o.id IS NULL and p.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> o.id IS NULL and p.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose>
</where>
</select>
<!-- select -->
<!-- update -->
<update id="outUpdate" parameterType="com.no1.wms.out.ProductOutDto">
update product_out
set quantity = #{quantity}, expected_delivery_date = #{expected_delivery_date}, product_id = #{product_id}, warehouse_id = #{warehouse_id}, note = #{note}
where id = #{id};
</update>
<update id="updateWarehousePlus" parameterType="com.no1.wms.out.ProductOutDto">
update warehouse w
left join stock s on w.id = s.warehouse_id
set w.current_capacity = w.current_capacity + #{quantity}
where w.id = #{warehouseId};
</update>
<update id="updateWarehouse" parameterType="com.no1.wms.out.ProductOutDto">
update warehouse w
left join stock s on w.id = s.warehouse_id
set w.current_capacity = w.current_capacity + (#{quantityAdjustment} - #{quantity})
where w.id = #{warehouseId};
</update>
<update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.out.ProductOutDto">
update warehouse
set current_capacity = current_capacity - #{quantity}
where id = #{warehouse_id};
</update>
<update id="outNowWarehouseUpdate" parameterType="com.no1.wms.out.ProductOutDto">
update stock s
left join warehouse w on s.warehouse_id = w.id
set s.quantity = s.quantity - #{quantity}
where s.warehouse_id = #{warehouse_id};
</update>
<update id="outNowUpdate" parameterType="com.no1.wms.out.ProductOutDto">
update product_out
set quantity = #{quantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date}
where id = #{id};
</update>
<!-- update -->
<!-- insert -->
<insert id="createOut" parameterType="com.no1.wms.out.ProductOutDto">
insert into product_out (id, product_id, quantity, expected_delivery_date, delivery_date, warehouse_id, manager_id, note, activation)
values (UUID(), #{product_id}, #{quantity}, #{expected_delivery_date}, null, #{warehouse_id}, #{manager_id}, #{note}, #{activation});
</insert>
<!-- insert -->
<!-- delete -->
<delete id="outNow" parameterType="com.no1.wms.out.ProductOutDto">
delete
from product_out
where id = #{id}
</delete>
<!-- delete -->
</mapper>

View File

@@ -12,16 +12,39 @@
<result column="acc.name" property="name" />
</association>
</resultMap>
<insert id="insert" parameterType="resetPasswordDto">
insert into reset_password
(
id, account_id, note, date
)
(id, account_id, note, date)
VALUES
(
UUID(), (SELECT id from account where employee_number = #{employeeNumber} ), #{note}, NOW()
)
(UUID(), (SELECT id from account where employee_number = #{employeeNumber} ), #{note}, NOW())
</insert>
<select id="resetpasswordAll" resultMap="resetPasswordResultMap" parameterType="map">
SELECT
id, account_id, note, date, acc.id, acc.name, acc.mail, acc.employee_number
from reset_password rs join account acc on rs.account_id = acc.id
<where>
<choose>
<when test="searchn == 1"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
<when test="searchn == 0"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
</choose>
</where>
order by date desc limit #{start}, #{perPage}
</select>
<select id="count" resultMap="resetPasswordResultMap" parameterType="map">
SELECT
count(id)
<where>
<choose>
<when test="searchn == 1"> acc.activation = 1 and acc.name like concat('%',#{search},'%')</when>
<when test="searchn == 0"> acc.activation = 1 and acc.employee_number like concat('%',#{search},'%') </when>
</choose>
</where>
order by date desc limit #{start}, #{perPage}
</select>
<select id="selectAll" resultMap="resetPasswordResultMap" parameterType="map">
SELECT
id, account_id, note, date, acc.id, acc.name

View File

@@ -87,7 +87,7 @@
</select>
<select id="productSelect" parameterType="Map" resultType="Map">
SELECT p.id as productId, name, company_name, cls_Nm_4
SELECT p.id as productId, name, company_name, cls_Nm_4, p.kan_code
FROM product p
LEFT JOIN stock s ON s.product_id = p.id
left join product_category c on p.kan_code = c.kan_code
@@ -123,7 +123,8 @@
<where>
<choose>
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and address like concat('%',#{search},'%')</when>
<when test="searchn == 2"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
</choose>
</where>
order by w.name desc limit #{start}, #{perPage}
@@ -137,7 +138,8 @@
<where>
<choose>
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and address like concat('%',#{search},'%')</when>
<when test="searchn == 2"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
</choose>
</where>
</select>

View File

@@ -9,11 +9,13 @@
const tid = $tag.data('tid');
const tcategory = $tag.data('tcategory');
const tcompany_name = $tag.data('tcompany_name');
const tkan_code = $tag.data('kan_code');
$("#stock_pro_name").val(tname);
$("#product_id").val(tid);
$("#stock_category_name").val(tcategory);
$("#stock_company_name_name").val(tcompany_name);
$("#kan_code").val(tkan_code);
hideSearchModal();
}
@@ -46,8 +48,8 @@
function pageingFunction(clickedId) {
var searchn = $("#searchn").val();
var search = $("#search").val();
var searchn = $("#searchn1").val();
var search = $("#search1").val();
$.ajax({
type: "POST",
@@ -115,6 +117,7 @@
data-tname="${dto.name}"
data-tcategory="${dto.cls_Nm_4}"
data-tcompany_name="${dto.company_name}"
data-kan_code="${dto.kan_code}"
class="btn btn-primary" onclick="onSelect(this)">선택
</button>
</td>

View File

@@ -0,0 +1,163 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script>
function onSelect(tag) {
const $tag = $(tag);
const product_id = $tag.data('product_id');
const product_name = $tag.data('product_name');
const warehouse_id = $tag.data('warehouse_id');
const warehouse_name = $tag.data('warehouse_name');
const kan_code = $tag.data('kan_code');
const quantity = $tag.data('quantity');
$("#product_id").val(product_id);
$("#product_name").val(product_name);
$("#warehouse_id").val(warehouse_id);
$("#warehouse_name").val(warehouse_name);
$("#kan_code").val(kan_code);
$("#quantity").val(quantity);
hideSearchModal();
}
$(document).ready(function () {
// 검색 기능
$("#searchBtn").on("click", function () {
var searchn = $("#searchn").val();
var search = $("#search").val();
$.ajax({
type: "POST",
url: "/out/show_modal",
data: {
searchn: searchn,
search: search,
p: 1,
name: "stock_product_warehouse"
},
success: function (result) { // 결과 성공 콜백함수
$("#search_modal_body").html(result);
searchModalBootStrap.show();
},
error: function (request, status, error) {
alert(error)
}
});
});
});
function pageingFunction(clickedId) {
var searchn = $("#searchn1").val();
var search = $("#search1").val();
$.ajax({
type: "POST",
url: "/out/show_modal",
data: {
searchn: searchn,
search: search,
p: clickedId,
name: "stock_product_warehouse"
},
success: function (result) { // 결과 성공 콜백함수
$("#search_modal_body").html(result);
searchModalBootStrap.show();
},
error: function (request, status, error) {
alert(error)
}
});
}
</script>
<div class="container">
<div class="row">
<div class="col-12">
<div id="div_product_category_company_search" class="text-end">
<div class="input-group mb-3 w-50 col-centered">
<div class="w-30">
<select class="form-select" name="searchn" id="searchn">
<option value="0">제품명</option>
<option value="1">창고명</option>
</select>
</div>
<input type="text" id="search" name="search" class="form-control" placeholder="검색어를 입력하세요">
<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 class="col-11 col-centered">
<table class="table">
<thead class="table-dark">
<tr>
<th class="col-1"></th>
<th class="col-2">제품</th>
<th class="col-2">제품코드</th>
<th class="col-2">창고</th>
<th class="col-2">재고량</th>
<th class="col-1"></th>
<th class="col-1"></th>
</tr>
</thead>
<tbody>
<c:forEach items="${list }" var="dto">
<tr>
<td></td>
<td>${dto.product_name }</td>
<td>${dto.kan_code }</td>
<td>${dto.warehouse_name }</td>
<td>${dto.quantity }</td>
<td>
<button data-product_id="${dto.product_id}"
data-product_name="${dto.product_name}"
data-warehouse_id="${dto.warehouse_id}"
data-warehouse_name="${dto.warehouse_name}"
data-kan_code="${dto.kan_code}"
data-quantity="${dto.quantity}"
class="btn btn-primary" onclick="onSelect(this)">선택
</button>
</td>
<td></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<div class="row row-buttons">
<div class="col-12 d-flex justify-content-center">
<nav>
<ul class="pagination">
<c:if test="${begin > pageNum }">
<li class="page-item">
<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 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 href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
id="${end + 1 }">&gt;</a>
</li>
</c:if>
</ul>
</nav>
</div>
</div><!-- row row-buttons -->
</div>
</div>

View File

@@ -1,5 +1,6 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<body>
<script>
function onSelect(tag) {
@@ -22,7 +23,6 @@
}
$(document).ready(function () {
// 검색 기능
$("#searchBtn").on("click", function () {
@@ -51,15 +51,15 @@
function pageingFunction(clickedId) {
var searchn = $("#searchn").val();
var search = $("#search").val();
var searchn1 = $("#searchn1").val();
var search1 = $("#search1").val();
$.ajax({
type: "POST",
url: "/stock/show_modal",
data: {
searchn: searchn,
search: search,
searchn: searchn1,
search: search1,
p: clickedId,
name: "warehouse_capacity_currentCapacity"
},
@@ -76,6 +76,7 @@
</script>
<div class="container" id="pageingData">
<div class="row">
<div class="col-12">
@@ -91,6 +92,11 @@
<input type="text" id="search" name="search" class="form-control" placeholder="검색어를 입력하세요">
<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>
@@ -161,3 +167,4 @@
</div><!-- row row-buttons -->
</div>
</div>
</body>

View File

@@ -0,0 +1,196 @@
<%@ 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" %>
<div class="mt-5 mb-5 text-center">
<h1>출고 예정 생성</h1>
</div>
<hr>
<div class="container" style="text-align: center">
<div class="ulTag">
<div class="row">
<div class="col-12">
<input type='hidden' id="manager_id" value="83f11782-ae95-11ee-935d-0242ac110006">
<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="product_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('제품 검색','stock_product_warehouse')">검색
</button>
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='Category_label' class="input-group-text">제품 코드</span>
<input readonly id="kan_code" type="text" class="form-control" placeholder="">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='quantity_name' class="input-group-text">재고량</span>
<input readonly id="quantity" type="text" class="form-control" value="${dto.quantity}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='shipment_quantity_label' class="input-group-text">출고량</span>
<input id="shipment_quantity" 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="warehouse_id" id="warehouse_id" value="${dto.warehouse_id}">
</div>
<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">
</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>
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='note_label' class="input-group-text">비고</span>
<textarea id="note" class="form-control" rows="5"></textarea>
</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) {
$("#searchModalLabel").text(title);
const data = {name: val};
$.ajax({
type: 'post', // 타입 (get, post, put 등등)
url: '/out/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) {
alert(error)
}
});
}
$(document).ready(function () {
$("#submitBtn").on("click", function () {
var product_id = $("#product_id").val();
var quantity = $("#quantity").val();
var expected_delivery_date = $("#expected_delivery_date").val();
var delivery_date = $("#delivery_date").val();
var warehouse_id = $("#warehouse_id").val();
var manager_id = $("#manager_id").val();
var note = $("#note").val();
var activation = $("#activation").val();
var shipment_quantity = $("#shipment_quantity").val();
if (!product_id) {
alert("제품을 선택해야 합니다.");
$("#product_id").focus();
return false;
}
if (!expected_delivery_date) {
alert("출고 예정 날짜를 입력하세요.");
$("#expected_delivery_date").focus();
return false;
}
if (!quantity) {
alert("수량을 입력해야 합니다.");
$("#quantity").focus();
return false;
}
if (quantity < shipment_quantity) {
alert("출고수가 재고량보다 많을 수 없습니다.");
$("#quantity").focus();
return false;
}
$.ajax({
url: "/out/create_process",
type: "post",
data: {
"product_id": product_id,
"delivery_date":delivery_date,
"expected_delivery_date":expected_delivery_date,
"manager_id":manager_id,
"note":note,
"warehouse_id": warehouse_id,
"quantity": shipment_quantity,
"activation": activation
},
datatype: "json"
}).done(function (data) {
if (data == true) {
alert("재고 정보가 생성되었습니다.");
var form = document.createElement("form");
form.action = "/out/read";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "name";
input.value = name;
form.appendChild(input);
form.submit();
window.location.href = "/out/list";
} else {
alert("재고 정보 생성에 실패하였습니다.");
}
}).fail(function () {
alert("오류가 발생했습니다.");
}).always(function () {
//
});
})
$("#cancelBtn").on("click", function () {
$(location).attr("href", "/out/list");
})
});
</script>

View File

@@ -0,0 +1,219 @@
<%@ 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>
<meta charset="UTF-8">
<title>출고 리스트</title>
<style>
.detailTr:hover {
background-color: #f5f5f5;
cursor: pointer;
}
</style>
</head>
<body>
<div class="body">
<div class="container-fluid">
<div class="col-12">
<div class="mt-5 mb-5 text-center">
<h1>출고 관리 리스트</h1>
</div>
<div>
<hr>
</div>
<div class="row">
<div class="container-fluid">
<div class="col-12">
<form>
<div class="input-group mb-3 w-30 col-centered">
<div class="w-25">
<select class="form-select" name="searchn" id="searchn">
<option value="0">제품명</option>
<option value="1">창고명</option>
</select>
</div>
<input type="text" name="search" id="search" class="form-control"
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
<input class="btn btn-info" type="submit" id="searchBtn" value="검색"/>
<!-- 페이징작업용 -->
<input type="hidden" id="searchn1" value="${searchn}">
<input type="hidden" id="search1" value="${search}">
<!-- 페이징작업용 -->
</div>
</form>
</div>
</div>
<div class="container-fluid">
<div class="row row-table">
<div class="col-12">
<table class="table">
<thead class="table-dark">
<tr>
<th>번호</th>
<th>제품명</th>
<th>수량</th>
<th>창고명</th>
<th>출고 예정 날짜</th>
<th>출고 날짜</th>
<th>비고</th>
</tr>
</thead>
<tbody>
<c:forEach items="${olist }" var="dto">
<tr class="detailTr col-7" data-id="${dto.id}">
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
<td class="col-1">${dto.productName }</td>
<td class="col-1">${dto.quantity }</td>
<td class="col-1">${dto.warehouseName }</td>
<td class="col-1">${dto.expected_delivery_date }</td>
<td class="col-1">${dto.delivery_date }</td>
<td class="col-1">${dto.note }</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row row-buttons">
<div class="col-3">
</div>
<div class="col-6 d-flex justify-content-center">
<nav>
<ul class="pagination">
<c:if test="${begin > pageNum }">
<li class="page-item">
<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 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 href="javascript:void(0);" class="page-link"
onclick="pageingFunction(this.id)" id="${end + 1 }">&gt;</a>
</li>
</c:if>
</ul>
</nav>
</div>
<div class="col-3 text-end">
<button type="button" class="btn btn-primary" id="createButton">생성</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$("#createButton").on("click",function(){
var form = document.createElement("form");
form.action = "/out/create";
form.method = "POST";
document.body.appendChild(form);
form.submit();
});
$("body").on("click", ".detailTr", function () {
var id = $(this).data("id");
var form = document.createElement("form");
form.action = "/out/read";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "id";
input.value = id;
form.appendChild(input);
form.submit();
});
//검색기능
$("#searchBtn").on("click", function () {
var searchn = $("#searchn").val();
var search = $("#search").val();
var form = document.createElement("form");
form.action = "/out/list";
form.method = "get";
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);
document.body.appendChild(form);
form.submit();
});
});//ready
function pageingFunction(clickedId) {
var searchn1 = $("#searchn1").val();
var search1 = $("#search1").val();
var form = document.createElement("form");
form.action = "/out/list";
form.method = "get";
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);
document.body.appendChild(form);
form.submit();
}
</script>
</body>
</html>

View File

@@ -0,0 +1,260 @@
<%@ 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" %>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.min.css">
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.min.js"></script>
<div class="mt-5 mb-5 text-center">
<h1>출고 예정 상세페이지</h1>
<div class="col-10" style="text-align: right">
<button type="button" class="btn btn-danger" id="yes_no_modal_show">삭제</button>
</div>
</div>
<hr>
<div class="container" style="text-align: center">
<div class="ulTag">
<div class="row">
<div class="col-12">
<input type="hidden" class="form-control" aria-label="id" id="id" value="${dto.id}" readonly>
<!--제품 관련 -->
<div class="input-group mb-3 w-40 col-centered">
<span id='Product_label' class="input-group-text">제품</span>
<input readonly id="product_name" type="text" class="form-control" value="${dto.product_name}">
<input hidden name="ProductName" id="product_id" value="${dto.product_id}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='kan_code_label' class="input-group-text">제품 코드</span>
<input readonly id="kan_code" type="text" class="form-control" value="${dto.kan_code}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='quantity_name' class="input-group-text">출고량</span>
<input readonly id="quantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.quantity}">
</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" value="${dto.warehouse_name}">
<input hidden name="warehouse_id" id="warehouse_id" value="${dto.warehouse_id}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='expected_delivery_date_label' class="input-group-text">출고 예정 날짜</span>
<input readonly type="text" id="expected_delivery_date" value="${dto.expected_delivery_date}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='delivery_date_label' class="input-group-text">출고 날짜</span>
<input readonly type="text" id="delivery_date" value="${dto.delivery_date}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='note_label' class="input-group-text">비고</span>
<textarea readonly id="note" class="form-control" rows="5" value="${dto.note}"></textarea>
</div>
</div>
</div>
</div>
<div class="row col-12">
<div class="col-6 ">
<div class="w-40 col-centered" style="text-align: right">
<button type="button" class="btn btn-danger" id="outNow">출고</button>
</div>
</div>
<div class="col-6 ">
<div class="w-40 col-centered" style="text-align: left">
<button type="button" class="btn btn-success" id="checkBtn">확인</button>
<button type="button" class="btn btn-secondary" id="modifyBtn">수정</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="yes_no_modal_stock_delete" tabindex="-1" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="yesNoModalLabel">삭제 하시겠습니까?</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button id="modal_yes_button_stock_delete" type="button" class="modal_yes btn btn-primary">삭제</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="outNowModal" tabindex="-1" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="outNowLabel">출고하시겠습니까?</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-footer">
<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>
</div>
</div>
</div>
</div>
<script>
function showSearchModals(title, val){
$("#searchModalLabel").text(title);
const data = { name : val};
$.ajax({
type : 'post', // 타입 (get, post, put 등등)
url : '/out/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) {
alert(error)
}
});
}
$(document).ready(function () {
$("#modifyBtn").on("click", function () {
var id = $("#id").val();
var form = document.createElement("form");
form.action = "/out/update";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "id";
input.value = id;
form.appendChild(input);
form.submit();
})
$("#checkBtn").on("click", function () {
$(location).attr("href", "/out/list");
})
yesNoModal.yesFunction1 = deleteStockFunction;
function deleteStockFunction() {
var id = $("#id").val();
$.ajax({
url: "/out/delete",
type: "delete",
data: {
"id": id,
},
datatype: "json"
}).done(function (data) {
if (data == true) {
alert("삭제되었습니다.");
$(location).attr("href", "/out/list");
} else {
alert("정상적으로 삭제되지 않았습니다..");
}
}).fail(function () {
alert("오류가 발생했습니다.");
}).always(function () {
//
});
}//deleteCategoryFunction
const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_stock_delete");
$("#yes_no_modal_show").on("click", function () {
yesNoModalBootStrap.show();
});
$("#modal_yes_button_stock_delete").on("click", function () {
console.log("삭제 버튼 클릭 이벤트 실행");
yesNoModal.yesFunction1();
yesNoModalBootStrap.hide();
});
yesNoModal.yesFunction2 = outNowUpdate;
function outNowUpdate() {
var id = $("#id").val();
var expected_delivery_date = $("#expected_delivery_date").val();
// 현재 날짜와 시간을 얻기
var now = new Date();
var delivery_date = now.toISOString().slice(0, 19).replace('T', ' ');
$.ajax({
url: "/out/outNow",
type: "put",
data: {
"id": id,
"expected_delivery_date": expected_delivery_date,
"delivery_date": delivery_date
},
datatype: "json"
}).done(function (data) {
if (data == true) {
alert("출고 되었습니다.");
$(location).attr("href", "/out/list");
} else {
alert("정상적으로 출고되지 않았습니다..");
}
}).fail(function () {
alert("오류가 발생했습니다.");
}).always(function () {
//
});
}//deleteCategoryFunction
const outNowBootStrap = new bootstrap.Modal("#outNowModal");
$("#outNow").on("click", function () {
outNowBootStrap.show();
});
$("#modal_yes_button_outNow").on("click", function () {
console.log("삭제 버튼 클릭 이벤트 실행");
yesNoModal.yesFunction2();
yesNoModalBootStrap.hide();
});
});
</script>
<script>
$(function () {
// 달력을 표시할 input 요소에 대해 datepicker를 호출
$("#expected_delivery_date").datetimepicker(); // 예상 배송일에 대해 날짜 및 시간을 선택할 수 있게 함
$("#delivery_date").datetimepicker(); // 실제 배송일에 대해 날짜 및 시간을 선택할 수 있게 함
});
</script>

View File

@@ -0,0 +1,189 @@
<%@ 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" %>
<div class="mt-5 mb-5 text-center">
<h1>출고 예정 수정</h1>
</div>
<hr>
<div class="container" style="text-align: center">
<div class="ulTag">
<div class="row">
<div class="col-12">
<input type="hidden" id="id" value="${dto.id }">
<input type='hidden' id="manager_id" value="83f11782-ae95-11ee-935d-0242ac110006">
<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="product_name" type="text" class="form-control" placeholder="제품 검색" value="${dto.product_name}">
<input hidden name="ProductName" id="product_id" value="${dto.product_id}">
<button id="product_search_button" class="btn-primary btn"
onclick="showSearchModals('제품 검색','stock_product_warehouse')">검색
</button>
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='Category_label' class="input-group-text">제품 코드</span>
<input readonly id="kan_code" type="text" class="form-control" placeholder="" value="${dto.kan_code}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='shipment_quantity_label' class="input-group-text">출고량</span>
<input id="quantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.quantity}">
</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="창고 검색" value="${dto.warehouse_name}">
<input hidden name="warehouse_id" id="warehouse_id" value="${dto.warehouse_id}">
</div>
<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}">
</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}">
</div>
<div class="input-group mb-3 w-40 col-centered">
<span id='note_label' class="input-group-text">비고</span>
<textarea id="note" class="form-control" rows="5" value="${note}"></textarea>
</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-primary" id="updateBtn">수정 완료</button>
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
</div>
</div>
</div>
</div>
<script>
function showSearchModals(title, val) {
$("#searchModalLabel").text(title);
const data = {name: val};
$.ajax({
type: 'post', // 타입 (get, post, put 등등)
url: '/out/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) {
alert(error)
}
});
}
$(document).ready(function () {
$("#updateBtn").on("click", function () {
var id = $("#id").val();
var product_id = $("#product_id").val();
var quantity = $("#quantity").val();
var expected_delivery_date = $("#expected_delivery_date").val();
var warehouse_id = $("#warehouse_id").val();
var note = $("#note").val();
var activation = $("#activation").val();
if (!product_id) {
alert("제품을 선택해야 합니다.");
$("#product_id").focus();
return false;
}
if (!expected_delivery_date) {
alert("출고 예정 날짜를 입력하세요.");
$("#expected_delivery_date").focus();
return false;
}
$.ajax({
url: "/out/update_process",
type: "put",
data: {
"id": id,
"product_id": product_id,
"expected_delivery_date":expected_delivery_date,
"note":note,
"warehouse_id": warehouse_id,
"quantity": quantity,
"activation": activation,
},
datatype: "json"
}).done(function (data) {
if (data == true) {
alert("출고 정보가 수정되었습니다.");
var form = document.createElement("form");
form.action = "/out/read";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "name";
input.value = name;
form.appendChild(input);
form.submit();
window.location.href = "/out/list";
} else {
alert("출고 정보 수정에 실패하였습니다.");
}
}).fail(function () {
alert("오류가 발생했습니다.");
}).always(function () {
//
});
})
$("#cancelBtn").on("click", function () {
var id = $("#id").val();
var form = document.createElement("form");
form.action = "/out/read";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "id";
input.value = id;
form.appendChild(input);
form.submit();
})
});
</script>

View File

@@ -0,0 +1,201 @@
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>패스워드 초기화 요청</title>
</head>
<body>
<div class="mt-5 mb-5 text-center">
<h1>패스워드 초기화 요청</h1>
</div>
<hr>
<div class="body">
<div class="container-fluid">
<div class="col-12">
<form>
<div class="input-group mb-3 w-30 col-centered">
<div class="w-25">
<select class="form-select" name="searchn" id="searchn">
<option value="0">사원명</option>
<option value="1">아이디</option>
</select>
</div>
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
<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>
</form>
</div>
</div>
<div class="container-fluid">
<div class="row row-table">
<div class="col-12">
<table class="table">
<thead class="table-dark">
<tr>
<th>번호</th>
<th>사원명</th>
<th>아이디</th>
<th>요청사유</th>
<th></th>
</tr>
</thead>
<tbody>
<c:forEach items="${rlist }" var="dto">
<tr class="detailTr col-5" data-id="${dto.id}" >
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
<td class="col-1">${dto.name }</td>
<td class="col-1">${dto.president_telephone }</td>
<td class="col-1">${dto.vendor_manager }</td>
<td class="col-1">${dto.vendor_manager_telephone }</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row row-buttons">
<div class="col-3 text-start">
<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="uploadExcel">업로드</button>
<button type="button" class="btn btn-success" id="download">다운로드</button>
</div>
<div class="col-6 d-flex justify-content-center">
<nav>
<ul class="pagination">
<c:if test="${begin > pageNum }">
<li class="page-item">
<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 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 href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">&gt;</a>
</li>
</c:if>
</ul>
</nav>
</div>
<div class="col-3 text-end">
<button type="button" class="btn btn-primary" id="createButton">생성</button>
</div>
</div><!-- row row-buttons -->
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function(){
//POST방식으로 create폼화면 출력
$("#createButton").on("click",function(){
var form = document.createElement("form");
form.action = "/vendor/create";
form.method = "POST";
document.body.appendChild(form);
form.submit();
});
$("body").on("click", ".detailTr", function(){
var id = $(this).data("id");
var form = document.createElement("form");
form.action = "/vendor/read";
form.method = "POST";
document.body.appendChild(form);
var input = document.createElement("input");
input.type = "hidden";
input.name = "id";
input.value = id;
form.appendChild(input);
form.submit();
});
//검색기능
$("#searchBtn").on("click",function(){
var searchn = $("#searchn").val();
var search = $("#search").val();
var form = document.createElement("form");
form.action = "/vendor/list";
form.method = "get";
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);
document.body.appendChild(form);
form.submit();
});
});//ready
function pageingFunction(clickedId){
var searchn1 = $("#searchn1").val();
var search1 = $("#search1").val();
var form = document.createElement("form");
form.action = "/vendor/list";
form.method = "get";
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);
document.body.appendChild(form);
form.submit();
}
</script>
</body>
</html>