mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,5 +1,64 @@
|
|||||||
package com.no1.wms.in;
|
package com.no1.wms.in;
|
||||||
|
|
||||||
public class InController {
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/in")
|
||||||
|
public class InController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
InService inService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
//@ResponseBody
|
||||||
|
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 = inService.count(searchn, search);
|
||||||
|
|
||||||
|
int perPage = 15;
|
||||||
|
int startRow = (page - 1) * perPage;
|
||||||
|
|
||||||
|
List<InDto> dto = inService.inList(searchn, search, startRow, perPage);
|
||||||
|
|
||||||
|
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("list", dto);
|
||||||
|
m.addAttribute("start", startRow + 1);
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
return "/in/list";
|
||||||
|
|
||||||
|
}
|
||||||
|
@PostMapping("/create")
|
||||||
|
public String create() {
|
||||||
|
return "in/create";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,46 @@
|
|||||||
package com.no1.wms.in;
|
package com.no1.wms.in;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.apache.ibatis.type.Alias;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import com.no1.wms.account.AccountDto;
|
||||||
|
import com.no1.wms.planin.PlanInDto;
|
||||||
|
import com.no1.wms.product.ProductDto;
|
||||||
|
import com.no1.wms.warehouse.WarehouseDto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Alias("InDto")
|
||||||
public class InDto {
|
public class InDto {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String group_number;
|
||||||
|
private String product_id;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date in_date;
|
||||||
|
private String quantity;
|
||||||
|
private String warehouse_id;
|
||||||
|
private String manager_id;
|
||||||
|
private String note;
|
||||||
|
private boolean activation;//활성화
|
||||||
|
private int latest_price;
|
||||||
|
|
||||||
|
private PlanInDto planInDto;
|
||||||
|
private ProductDto productDto;
|
||||||
|
private WarehouseDto warehouseDto;
|
||||||
|
private AccountDto accountDto;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
package com.no1.wms.in;
|
package com.no1.wms.in;
|
||||||
|
|
||||||
public class InMapper {
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface InMapper {
|
||||||
|
List<InDto> inList(Map<String, Object> m);
|
||||||
|
int count(Map<String, Object> m);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,37 @@
|
|||||||
package com.no1.wms.in;
|
package com.no1.wms.in;
|
||||||
|
|
||||||
public class InService {
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class InService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
InMapper mapper;
|
||||||
|
|
||||||
|
public List<InDto> inList(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);
|
||||||
|
|
||||||
|
return mapper.inList(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
};//카운터
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.no1.wms.account.AccountDto;
|
import com.no1.wms.account.AccountDto;
|
||||||
@@ -29,13 +31,16 @@ public class MypageController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ImgService imgService;
|
ImgService imgService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/mypage")
|
@GetMapping("/mypage")
|
||||||
public String mypage(Model m, HttpServletRequest request) {
|
public String mypage(Model m, HttpSession session) {
|
||||||
|
|
||||||
HttpSession session = request.getSession();
|
//HttpSession session = request.getSession();
|
||||||
AccountDto dto = (AccountDto) session.getAttribute("userData");
|
AccountDto dto = (AccountDto) session.getAttribute("userData");
|
||||||
|
|
||||||
|
//System.out.println(dto.getId());
|
||||||
|
|
||||||
AccountDto list = accountService.selectById(dto);
|
AccountDto list = accountService.selectById(dto);
|
||||||
m.addAttribute("list", list);
|
m.addAttribute("list", list);
|
||||||
|
|
||||||
@@ -88,9 +93,9 @@ public class MypageController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/mypage/uplodeImg")
|
@PostMapping("/mypage/uplodeImg")
|
||||||
public String imgFileUplode(HttpServletRequest request, MultipartFile file) {
|
public String imgFileUplode(HttpServletRequest request,HttpSession session , MultipartFile file) {
|
||||||
//System.out.println(file);
|
//System.out.println(file);
|
||||||
HttpSession session = request.getSession();
|
//HttpSession session = request.getSession();
|
||||||
AccountDto dto = (AccountDto) session.getAttribute("userData");
|
AccountDto dto = (AccountDto) session.getAttribute("userData");
|
||||||
String fileName = dto.getId();
|
String fileName = dto.getId();
|
||||||
//System.out.println(fileName);
|
//System.out.println(fileName);
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
package com.no1.wms.planin;
|
package com.no1.wms.planin;
|
||||||
|
|
||||||
import java.util.List;
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.gson.Gson;
|
||||||
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.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import com.no1.wms.product.ProductDto;
|
import com.no1.wms.product.ProductDto;
|
||||||
@@ -92,7 +94,7 @@ public class PlanInController {
|
|||||||
|
|
||||||
// 입고예정추가
|
// 입고예정추가
|
||||||
@PostMapping("/planin_add")
|
@PostMapping("/planin_add")
|
||||||
public ModelAndView insert(ModelAndView mav, ProductDto dto)
|
public ModelAndView add(ModelAndView mav, ProductDto dto)
|
||||||
{
|
{
|
||||||
List<ProductDto> list = productservice.productList(0, "", 0, 10000);
|
List<ProductDto> list = productservice.productList(0, "", 0, 10000);
|
||||||
//list
|
//list
|
||||||
@@ -104,5 +106,47 @@ public class PlanInController {
|
|||||||
mav.setViewName("planin_add");
|
mav.setViewName("planin_add");
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/planin_edit")
|
||||||
|
public ModelAndView edit(ModelAndView mav, ProductDto dto)
|
||||||
|
{
|
||||||
|
List<ProductDto> list = productservice.productList(0, "", 0, 10000);
|
||||||
|
//list
|
||||||
|
//ProductDto (0)
|
||||||
|
//ProductDto (1)
|
||||||
|
//ProductDto (2)
|
||||||
|
mav.addObject("list", list);
|
||||||
|
|
||||||
|
mav.setViewName("planin_edit");
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/planin_update_process")
|
||||||
|
@ResponseBody
|
||||||
|
public String updateProcess(@RequestBody List<Map<String, Object>> list, Gson gson, PlanInDto dto) throws JsonProcessingException, ParseException {
|
||||||
|
|
||||||
|
dto.setGroupNumber((String) list.get(0).get("groupNumber"));
|
||||||
|
|
||||||
|
planinservice.deleteById(dto);
|
||||||
|
|
||||||
|
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
|
|
||||||
|
for(int i = 0; i < list.size(); ++i){
|
||||||
|
Map<String, Object> data = list.get(i);
|
||||||
|
PlanInDto newDto = new PlanInDto();
|
||||||
|
newDto.setGroupNumber((String) data.get("groupNumber"));
|
||||||
|
newDto.setDate( format.parse((String) data.get("date")));
|
||||||
|
newDto.setQuantity((Integer) data.get("quantity"));
|
||||||
|
newDto.setProductId((String)data.get("productId"));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return gson.toJson("s");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ public class PlanInDto {
|
|||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date date;
|
private Date date;
|
||||||
private String vendorId;
|
|
||||||
private String managerId;
|
private String managerId;
|
||||||
private String warehouseId;
|
private String warehouseId;
|
||||||
private String qrHash;
|
private String qrHash;
|
||||||
|
|||||||
@@ -15,4 +15,8 @@ public interface PlanInMapper {
|
|||||||
int count(Map<String, Object> m);
|
int count(Map<String, Object> m);
|
||||||
|
|
||||||
List<PlanInDto> selectById(PlanInDto dto);
|
List<PlanInDto> selectById(PlanInDto dto);
|
||||||
|
|
||||||
|
int deleteById(PlanInDto dto);
|
||||||
|
|
||||||
|
void insert(PlanInDto dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,11 @@ public class PlanInService {
|
|||||||
List<PlanInDto> selectById(PlanInDto dto){
|
List<PlanInDto> selectById(PlanInDto dto){
|
||||||
return mapper.selectById(dto);
|
return mapper.selectById(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int deleteById(PlanInDto dto){
|
||||||
|
return mapper.deleteById(dto);
|
||||||
|
}
|
||||||
|
void insert(PlanInDto dto){
|
||||||
|
mapper.insert(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.no1.wms.price;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.apache.ibatis.type.Alias;
|
import org.apache.ibatis.type.Alias;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import com.no1.wms.account.AccountDto;
|
import com.no1.wms.account.AccountDto;
|
||||||
import com.no1.wms.product.ProductDto;
|
import com.no1.wms.product.ProductDto;
|
||||||
@@ -21,6 +22,7 @@ public class PriceDto {
|
|||||||
|
|
||||||
private String id;//id
|
private String id;//id
|
||||||
private String price;//가격
|
private String price;//가격
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date registration_date;//등록날짜
|
private Date registration_date;//등록날짜
|
||||||
private String manager_id;//담당자
|
private String manager_id;//담당자
|
||||||
private String product_id; //제품 아이디
|
private String product_id; //제품 아이디
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.no1.wms.product;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
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;
|
||||||
@@ -14,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import com.no1.wms.account.AccountDto;
|
||||||
|
import com.no1.wms.account.AccountService;
|
||||||
import com.no1.wms.category.CategoryDto;
|
import com.no1.wms.category.CategoryDto;
|
||||||
import com.no1.wms.category.CategoryService;
|
import com.no1.wms.category.CategoryService;
|
||||||
import com.no1.wms.price.PriceDto;
|
import com.no1.wms.price.PriceDto;
|
||||||
@@ -30,6 +35,9 @@ public class ProductController {
|
|||||||
CategoryService categoryService;
|
CategoryService categoryService;
|
||||||
@Autowired
|
@Autowired
|
||||||
VendorService service;
|
VendorService service;
|
||||||
|
@Autowired
|
||||||
|
AccountService accountService;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@@ -81,7 +89,7 @@ public class ProductController {
|
|||||||
|
|
||||||
// 생성 - 폼
|
// 생성 - 폼
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public String create() {
|
public String create() {
|
||||||
return "/product/create";
|
return "/product/create";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.no1.wms.product;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.apache.ibatis.type.Alias;
|
import org.apache.ibatis.type.Alias;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import com.no1.wms.account.AccountDto;
|
import com.no1.wms.account.AccountDto;
|
||||||
import com.no1.wms.authority.AuthorityDto;
|
import com.no1.wms.authority.AuthorityDto;
|
||||||
@@ -27,6 +28,7 @@ public class ProductDto {
|
|||||||
private String company_name = "미지정";//회사명
|
private String company_name = "미지정";//회사명
|
||||||
private String kan_code;//분류코드
|
private String kan_code;//분류코드
|
||||||
private String vendor_id;//거래처 id
|
private String vendor_id;//거래처 id
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date registration_date;//등록날짜
|
private Date registration_date;//등록날짜
|
||||||
private String manager_id;//담당자
|
private String manager_id;//담당자
|
||||||
private boolean activation;//활성화
|
private boolean activation;//활성화
|
||||||
|
|||||||
140
src/main/resources/mappers/InMapper.xml
Normal file
140
src/main/resources/mappers/InMapper.xml
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
<?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.in.InMapper">
|
||||||
|
<resultMap id="inResultMap" type="InDto">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="group_number" property="group_number" />
|
||||||
|
<result column="product_id" property="product_id" />
|
||||||
|
<result column="in_date" property="in_date" />
|
||||||
|
<result column="quantity" property="quantity" />
|
||||||
|
<result column="warehouse_id" property="warehouse_id" />
|
||||||
|
<result column="manager_id" property="manager_id" />
|
||||||
|
<result column="note" property="note" />
|
||||||
|
<result column="activation" property="activation" />
|
||||||
|
<result column="latest_price" property="latest_price" />
|
||||||
|
<!-- join -->
|
||||||
|
<association property="planInDto" javaType="PlanInDto">
|
||||||
|
<id column="groupNumber" property="groupNumber" />
|
||||||
|
<id column="productId" property="productId" />
|
||||||
|
<result column="view_group_number" property="viewGroupNumber" />
|
||||||
|
</association>
|
||||||
|
<association property="productDto" javaType="ProductDto">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="product_name" property="name" />
|
||||||
|
</association>
|
||||||
|
<association property="warehouseDto" javaType="WarehouseDto">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="warehouse_name" property="name" />
|
||||||
|
</association>
|
||||||
|
<association property="accountDto" javaType="AccountDto">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="account_name" property="name" />
|
||||||
|
</association>
|
||||||
|
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- insert -->
|
||||||
|
|
||||||
|
<!-- update -->
|
||||||
|
|
||||||
|
<!-- delete -->
|
||||||
|
|
||||||
|
<!-- select -->
|
||||||
|
<select id="count" parameterType="map" resultType="int">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
|
||||||
|
FROM
|
||||||
|
product_in as proin
|
||||||
|
left join plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
|
||||||
|
left join product as pro on proin.product_id = pro.id
|
||||||
|
left join warehouse as w on proin.warehouse_id = w.id
|
||||||
|
left join account as a on proin.manager_id = a.id
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0">
|
||||||
|
proin.activation = 1 and proin.product_id IN (SELECT id FROM product WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 1">
|
||||||
|
proin.activation = 1 AND proin.in_date LIKE CONCAT('%',#{search},'%')
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 2">
|
||||||
|
proin.activation = 1 AND proin.manager_id IN (SELECT id FROM account WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 3">
|
||||||
|
proin.activation = 1 AND proin.group_number LIKE CONCAT('%',#{search},'%')
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="inList2" parameterType="map" resultMap="inResultMap">
|
||||||
|
SELECT
|
||||||
|
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,
|
||||||
|
pro.name as product_name,
|
||||||
|
w.name as warehouse_name,
|
||||||
|
a.name as account_name
|
||||||
|
|
||||||
|
FROM
|
||||||
|
product_in as proin
|
||||||
|
left join plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
|
||||||
|
left join product as pro on proin.product_id = pro.id
|
||||||
|
left join warehouse as w on proin.warehouse_id = w.id
|
||||||
|
left join account as a on proin.manager_id = a.id
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0">
|
||||||
|
proin.activation = 1 and proin.product_id IN (SELECT id FROM product WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 1">
|
||||||
|
proin.activation = 1 AND proin.in_date LIKE CONCAT('%',#{search},'%')
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 2">
|
||||||
|
proin.activation = 1 AND proin.manager_id IN (SELECT id FROM account WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 3">
|
||||||
|
proin.activation = 1 AND proin.group_number LIKE CONCAT('%',#{search},'%')
|
||||||
|
</when>
|
||||||
|
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
ORDER BY proin.in_date LIMIT #{start} , #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="inList" parameterType="map" resultMap="inResultMap">
|
||||||
|
SELECT
|
||||||
|
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,
|
||||||
|
planin.view_group_number,
|
||||||
|
pro.name as product_name,
|
||||||
|
w.name as warehouse_name,
|
||||||
|
a.name as account_name,
|
||||||
|
(SELECT price FROM prices WHERE product_id = proin.product_id ORDER BY registration_date DESC LIMIT 1) as latest_price
|
||||||
|
FROM
|
||||||
|
product_in as proin
|
||||||
|
LEFT JOIN plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
|
||||||
|
LEFT JOIN product as pro on proin.product_id = pro.id
|
||||||
|
LEFT JOIN warehouse as w on proin.warehouse_id = w.id
|
||||||
|
LEFT JOIN account as a on proin.manager_id = a.id
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0">
|
||||||
|
proin.activation = 1 and proin.product_id IN (SELECT id FROM product WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 1">
|
||||||
|
proin.activation = 1 AND proin.in_date LIKE CONCAT('%',#{search},'%')
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 2">
|
||||||
|
proin.activation = 1 AND proin.manager_id IN (SELECT id FROM account WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||||
|
</when>
|
||||||
|
<when test="searchn == 3">
|
||||||
|
proin.activation = 1 AND proin.group_number LIKE CONCAT('%',#{search},'%')
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
ORDER BY proin.in_date LIMIT #{start} , #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
<id column="product_id" property="productId" />
|
<id column="product_id" property="productId" />
|
||||||
<result column="quantity" property="quantity"/>
|
<result column="quantity" property="quantity"/>
|
||||||
<result column="date" property="date"/>
|
<result column="date" property="date"/>
|
||||||
<result column="vendor_id" property="vendorId"/>
|
|
||||||
<result column="manager_id" property="managerId"/>
|
<result column="manager_id" property="managerId"/>
|
||||||
<result column="warehouse_id" property="warehouseId"/>
|
<result column="warehouse_id" property="warehouseId"/>
|
||||||
<result column="qr_hash" property="qrHash"/>
|
<result column="qr_hash" property="qrHash"/>
|
||||||
@@ -37,24 +36,24 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="selectById" resultMap="planInResultMap" parameterType="planInDto">
|
<select id="selectById" resultMap="planInResultMap" parameterType="planInDto">
|
||||||
SELECT
|
SELECT
|
||||||
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.vendor_id, plan.manager_id,
|
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.manager_id,
|
||||||
plan.warehouse_id, plan.qr_hash, plan.url, plan.clear, plan.vendor_date, plan.other, plan.activation, plan.view_group_number,
|
plan.warehouse_id, plan.qr_hash, plan.url, plan.clear, plan.vendor_date, plan.other, plan.activation, plan.view_group_number,
|
||||||
product.id p_id, product.name p_name, acc.id acc_id, acc.name acc_name, vendor.id v_id, vendor.name v_name,
|
product.id p_id, product.name p_name, acc.id acc_id, acc.name acc_name, vendor.id v_id, vendor.name v_name,
|
||||||
warehouse.id w_id, warehouse.name w_name, product_category.kan_code p_kan, product_category.cls_Nm_4 ca_name
|
warehouse.id w_id, warehouse.name w_name, product_category.kan_code p_kan, product_category.cls_Nm_4 ca_name
|
||||||
from plan_In plan join account acc join vendor join warehouse join product join product_category
|
from plan_In plan join account acc join vendor join warehouse join product join product_category
|
||||||
on plan.product_id = product.id and plan.vendor_id = vendor.id and plan.manager_id = acc.id
|
on plan.product_id = product.id and product.vendor_id = vendor.id and plan.manager_id = acc.id
|
||||||
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
||||||
where plan.group_number = #{groupNumber}
|
where plan.group_number = #{groupNumber}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAll" resultMap="planInResultMap" parameterType="map">
|
<select id="selectAll" resultMap="planInResultMap" parameterType="map">
|
||||||
SELECT
|
SELECT
|
||||||
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.vendor_id, plan.manager_id,
|
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.manager_id,
|
||||||
plan.warehouse_id, plan.qr_hash, plan.url, plan.clear, plan.vendor_date, plan.other, plan.activation, plan.view_group_number,
|
plan.warehouse_id, plan.qr_hash, plan.url, plan.clear, plan.vendor_date, plan.other, plan.activation, plan.view_group_number,
|
||||||
product.id p_id, product.name p_name, acc.id acc_id, acc.name acc_name, vendor.id v_id, vendor.name v_name,
|
product.id p_id, product.name p_name, acc.id acc_id, acc.name acc_name, vendor.id v_id, vendor.name v_name,
|
||||||
warehouse.id w_id, warehouse.name w_name, product_category.kan_code p_kan, product_category.cls_Nm_4 ca_name
|
warehouse.id w_id, warehouse.name w_name, product_category.kan_code p_kan, product_category.cls_Nm_4 ca_name
|
||||||
from plan_In plan join account acc join vendor join warehouse join product join product_category
|
from plan_In plan join account acc join vendor join warehouse join product join product_category
|
||||||
on plan.product_id = product.id and plan.vendor_id = vendor.id and plan.manager_id = acc.id
|
on plan.product_id = product.id and product.vendor_id = vendor.id and plan.manager_id = acc.id
|
||||||
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 1"> plan.activation = 1 and pn like concat('%',#{search},'%')</when>
|
<when test="searchn == 1"> plan.activation = 1 and pn like concat('%',#{search},'%')</when>
|
||||||
@@ -68,13 +67,13 @@
|
|||||||
insert into plan_In
|
insert into plan_In
|
||||||
(
|
(
|
||||||
group_number, product_id, quantity, date,
|
group_number, product_id, quantity, date,
|
||||||
vendor_id, manager_id, warehouse_id, qr_hash,
|
manager_id, warehouse_id, qr_hash,
|
||||||
url, clear, vendor_date, other, activation, view_group_number
|
url, clear, vendor_date, other, activation, view_group_number
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
UUID(), #{productId}, #{quantity},
|
UUID(), #{productId}, #{quantity},
|
||||||
#{date}, #{vendorId},
|
#{date},
|
||||||
#{managerId},#{warehouseId},#{qrHash},
|
#{managerId},#{warehouseId},#{qrHash},
|
||||||
#{url},#{clear}, #{vendor_date},
|
#{url},#{clear}, #{vendor_date},
|
||||||
#{other},#{activation}, (select MAX(c.group_number)+1 as cnt
|
#{other},#{activation}, (select MAX(c.group_number)+1 as cnt
|
||||||
@@ -87,7 +86,6 @@
|
|||||||
update plan_In SET
|
update plan_In SET
|
||||||
quantity = #{quantity},
|
quantity = #{quantity},
|
||||||
date = #{date},
|
date = #{date},
|
||||||
vendor_id = #{vendorId},
|
|
||||||
manager_id = #{managerId},
|
manager_id = #{managerId},
|
||||||
warehouse_id = #{warehouseId},
|
warehouse_id = #{warehouseId},
|
||||||
qr_hash = #{qrHash},
|
qr_hash = #{qrHash},
|
||||||
@@ -116,4 +114,7 @@
|
|||||||
</where>
|
</where>
|
||||||
) t
|
) t
|
||||||
</select>
|
</select>
|
||||||
|
<delete id="deleteById" parameterType="planInDto">
|
||||||
|
delete from plan_In WHERE group_number = #{groupNumber}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<!-- update -->
|
<!-- update -->
|
||||||
<update id="updateById" parameterType="PriceDto">
|
<update id="updateById" parameterType="PriceDto">
|
||||||
UPDATE prices
|
UPDATE prices
|
||||||
SET price = #{price}, registration_date = CURDATE()
|
SET price = #{price}, manager_id = #{manager_id}, registration_date = CURDATE()
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY p.registration_date LIMIT #{start} , #{perPage}
|
ORDER BY p.registration_date desc LIMIT #{start} , #{perPage}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="count2" parameterType="map" resultType="int">
|
<select id="count2" parameterType="map" resultType="int">
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
|
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY p.registration_date LIMIT #{start} , #{perPage}
|
ORDER BY p.registration_date desc LIMIT #{start} , #{perPage}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
73
src/main/webapp/WEB-INF/views/in/create.jsp
Normal file
73
src/main/webapp/WEB-INF/views/in/create.jsp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<%@ 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>
|
||||||
|
<style>
|
||||||
|
.col-centered{
|
||||||
|
margin: 0 auto;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
<h1>입고 추가</h1>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<form id="createForm">
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12" style="text-align: center;">
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon1">제품명</span>
|
||||||
|
<input type="text" name="productName" id="productName" class="form-control"
|
||||||
|
placeholder="제품명을 검색하세요" aria-label="제품명" value="${dto.productDto.name }"
|
||||||
|
aria-describedby="basic-addon1" readonly>
|
||||||
|
<button class="btn btn-outline-secondary rounded-end" id="searchProductName"
|
||||||
|
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal('제품 검색','product')" >검색</button>
|
||||||
|
<input type='hidden' id="product_id" value="">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- 설명만 있는 입력 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon2">가격</span>
|
||||||
|
<input type="number" name="price" id="price" class="form-control"
|
||||||
|
placeholder="가격을 입력하세요" aria-label="가격" value="${dto.price }"
|
||||||
|
aria-describedby="basic-addon1" disable><!-- 여기서부터 작업 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<c:set var="userData" value="${sessionScope.userData}" />
|
||||||
|
<input type='hidden' id="manager_id" value="${userData.id }">
|
||||||
|
</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>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
136
src/main/webapp/WEB-INF/views/in/list.jsp
Normal file
136
src/main/webapp/WEB-INF/views/in/list.jsp
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<%@ 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>Insert title here</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 selected="selected" value="0">제품명</option>
|
||||||
|
<option value="1">입고날짜</option>
|
||||||
|
<option value="2">담당자</option>
|
||||||
|
<option value="3">입고예정그룹번호</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>
|
||||||
|
<th>입고날짜</th>
|
||||||
|
<th>담당자</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${list }" var="dto" varStatus="status">
|
||||||
|
<tr class="detailTr" data-id="${dto.id }" >
|
||||||
|
<td>${status.count }</td>
|
||||||
|
<td>${dto.productDto.name }</td>
|
||||||
|
<td>${dto.latest_price }</td>
|
||||||
|
<td>${dto.quantity }</td>
|
||||||
|
<td>${dto.planInDto.viewGroupNumber }</td>
|
||||||
|
<td><fmt:formatDate value="${dto.in_date}" pattern="yyyy-MM-dd" type="date"/></td>
|
||||||
|
<td>${dto.accountDto.name }</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-buttons">
|
||||||
|
<div class="col-3 text-start">
|
||||||
|
</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="pagingFunction(this.id)" id="${begin - 1 }"><</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="pagingFunction(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="pagingFunction(this.id)" id="${end + 1 }">></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 = "/in/create";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
});//createButton
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -3,21 +3,40 @@
|
|||||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function goDown(target){
|
function goDown(target){
|
||||||
console.log(target);
|
const $target = $(target);
|
||||||
const $target = $(this);
|
const name= $target.data("name");
|
||||||
const name= $target.data("name");
|
const catname = $target.data("catname");
|
||||||
const catname = $target.data("catname");
|
const vendor = $target.data("vendor");
|
||||||
const vendor = $target.data("vendor");
|
const id = $target.data("id");
|
||||||
const id = $target.data("id");
|
|
||||||
|
|
||||||
$("#input_category").val(catname);
|
|
||||||
$("#input_vendor").val(vendor);
|
|
||||||
$("#input_id").val(id);
|
|
||||||
$("#input_name").val(name);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$("#input_category").val(catname);
|
||||||
|
$("#input_vendor").val(vendor);
|
||||||
|
$("#input_id").val(id);
|
||||||
|
$("#input_name").val(name);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function goTable(){
|
||||||
|
const data= {};
|
||||||
|
|
||||||
|
data.name = $("#input_name").val();
|
||||||
|
data.category = $("#input_category").val();
|
||||||
|
data.id = $("#input_id").val();
|
||||||
|
data.vendor = $("#input_vendor").val();
|
||||||
|
data.date = $("#input_date").val();
|
||||||
|
data.num = $("#input_num").val();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
addToTable(data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
hideSearchModal();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -72,7 +91,7 @@ function goDown(target){
|
|||||||
<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-addon2">제품명</span>
|
<span class="input-group-text" id="basic-addon2">제품명</span>
|
||||||
<input
|
<input
|
||||||
id='input_name' type="text" class="form-control" placeholder="제품명""
|
id='input_name' type="text" class="form-control" placeholder="제품명"
|
||||||
aria-label="제품명" value="" readonly>
|
aria-label="제품명" value="" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -96,6 +115,7 @@ function goDown(target){
|
|||||||
id='input_date' type="date" class="form-control" placeholder="날짜"
|
id='input_date' type="date" class="form-control" placeholder="날짜"
|
||||||
aria-label="날짜" value="">
|
aria-label="날짜" value="">
|
||||||
</div>
|
</div>
|
||||||
|
<input hidden id="input_id">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
153
src/main/webapp/WEB-INF/views/modal/planin_edit.jsp
Normal file
153
src/main/webapp/WEB-INF/views/modal/planin_edit.jsp
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<%@ 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" %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
function goDown(target){
|
||||||
|
const $target = $(target);
|
||||||
|
const name= $target.data("name");
|
||||||
|
const catname = $target.data("catname");
|
||||||
|
const vendor = $target.data("vendor");
|
||||||
|
const id = $target.data("id");
|
||||||
|
const vendorId = $target.data("vendorid");
|
||||||
|
|
||||||
|
$("#input_category").val(catname);
|
||||||
|
$("#input_vendor").val(vendor);
|
||||||
|
$("#input_id").val(id);
|
||||||
|
$("#input_name").val(name);
|
||||||
|
$("#id_vendor_id").val(vendorId);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function editData(){
|
||||||
|
|
||||||
|
$("#input_name").val(modalData.name);
|
||||||
|
$("#input_category").val(modalData.category);
|
||||||
|
$("#input_id").val(modalData.id);
|
||||||
|
$("#input_vendor").val(modalData.vendor);
|
||||||
|
$("#input_date").val(modalData.date);
|
||||||
|
$("#input_num").val(modalData.num);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function goTable(){
|
||||||
|
const data= {};
|
||||||
|
|
||||||
|
data.name = $("#input_name").val();
|
||||||
|
data.category = $("#input_category").val();
|
||||||
|
data.id = $("#input_id").val();
|
||||||
|
data.vendor = $("#input_vendor").val();
|
||||||
|
data.date = $("#input_date").val();
|
||||||
|
data.num = $("#input_num").val();
|
||||||
|
|
||||||
|
editToTable(data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
hideSearchModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>제품명</th>
|
||||||
|
<th>회사명</th>
|
||||||
|
<th>분류</th>
|
||||||
|
<th>거래처</th>
|
||||||
|
<th>등록날짜</th>
|
||||||
|
<th>선택</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${list }" var="dto">
|
||||||
|
<tr class="detailTr" data-product_id="${dto.id}" >
|
||||||
|
<td>${dto.name }</td>
|
||||||
|
<td>${dto.company_name }</td>
|
||||||
|
<td>${dto.categoryDto.cls_nm_4 }</td>
|
||||||
|
<td>${dto.vendorDto.name }</td>
|
||||||
|
<td><fmt:formatDate value="${dto.registration_date }"
|
||||||
|
dateStyle="short" /></td>
|
||||||
|
<td><button type="button" class="btn btn-warning" data-id = "${dto.id}"
|
||||||
|
data-name = "${dto.name}" data-catname = "${dto.categoryDto.cls_nm_4 }"
|
||||||
|
data-vendor = "${dto.vendorDto.name}" onclick= "goDown(this)"
|
||||||
|
>확인</button></td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<hr>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<form>
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12" style="text-align: center;">
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon1">제품카테고리</span>
|
||||||
|
<input
|
||||||
|
id='input_category' type="text" class="form-control" placeholder="제품카테고리"
|
||||||
|
aria-label="제품카테고리" value="" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon2">제품명</span>
|
||||||
|
<input
|
||||||
|
id='input_name' type="text" class="form-control" placeholder="제품명"
|
||||||
|
aria-label="제품명" value="" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon3">수량</span>
|
||||||
|
<input
|
||||||
|
id='input_num' type="number" min="0" class="form-control" placeholder="수량"
|
||||||
|
aria-label="수량" value="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon4">공급업체</span>
|
||||||
|
<input
|
||||||
|
id='input_vendor' type="text" class="form-control" placeholder="공급업체"
|
||||||
|
aria-label="공급업체" value="" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon5">날짜</span>
|
||||||
|
<input
|
||||||
|
id='input_date' type="date" class="form-control" placeholder="날짜"
|
||||||
|
aria-label="날짜" value="">
|
||||||
|
</div>
|
||||||
|
<input hidden id="input_id" type="text" value="">
|
||||||
|
|
||||||
|
</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" onclick='goTable()'>수정 완료</button>
|
||||||
|
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form id="form" action='/plan_in/read' method="post">
|
||||||
|
<input name="groupNumber" id="groupId" hidden>
|
||||||
|
<input name="productId" id="productId" hidden>
|
||||||
|
</form>
|
||||||
@@ -120,6 +120,7 @@
|
|||||||
<input type="text" class="form-control" id="position" name="position" value="${list.positionDto.name }" readonly>
|
<input type="text" class="form-control" id="position" name="position" value="${list.positionDto.name }" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr style="width: 700px;">
|
<hr style="width: 700px;">
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col-md-2"></div>
|
<div class="col-md-2"></div>
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
let modalData = {};
|
||||||
|
let $selectedTr;
|
||||||
|
|
||||||
function showSearchModal(title){
|
function showSearchModal(title){
|
||||||
$("#searchModalLabel").text(title);
|
$("#searchModalLabel").text(title);
|
||||||
const data = { };
|
const data = { };
|
||||||
@@ -21,6 +23,111 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function showSearchModalEdit(title, target){
|
||||||
|
$selectedTr = $($(target).parent('td').parent("tr"));
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
const data = { };
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/plan_in/planin_edit', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
const tds = $selectedTr.find("td");
|
||||||
|
|
||||||
|
modalData.name = $(tds[0]).text();
|
||||||
|
modalData.category = $(tds[1]).text();
|
||||||
|
modalData.id = $selectedTr.data("productid");
|
||||||
|
modalData.vendor = $(tds[3]).text();
|
||||||
|
modalData.date = $(tds[4]).text();
|
||||||
|
modalData.num = $(tds[2]).text();
|
||||||
|
|
||||||
|
editData();
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addToTable(data){
|
||||||
|
const $addTr = $("#id_add_tr");
|
||||||
|
|
||||||
|
const $newTr = $($("#id_table_body tr")[0]).clone();
|
||||||
|
|
||||||
|
//데이터 세팅 부분
|
||||||
|
$newTr.data("productid", data.id);
|
||||||
|
const tds = $newTr.find("td");
|
||||||
|
$(tds[0]).text(data.name);
|
||||||
|
$(tds[1]).text(data.category);
|
||||||
|
$(tds[2]).text(data.num);
|
||||||
|
$(tds[3]).text(data.vendor);
|
||||||
|
$(tds[4]).text(data.date);
|
||||||
|
|
||||||
|
|
||||||
|
$addTr.detach().appendTo("#form");
|
||||||
|
|
||||||
|
$("#id_table_body").append($newTr);
|
||||||
|
|
||||||
|
$addTr.detach().appendTo("#id_table_body");
|
||||||
|
}
|
||||||
|
|
||||||
|
function editToTable(data){
|
||||||
|
|
||||||
|
const $newTr = $selectedTr;
|
||||||
|
|
||||||
|
//데이터 세팅 부분
|
||||||
|
$newTr.data("productid", data.id);
|
||||||
|
const tds = $newTr.find("td");
|
||||||
|
$(tds[0]).text(data.name);
|
||||||
|
$(tds[1]).text(data.category);
|
||||||
|
$(tds[2]).text(data.num);
|
||||||
|
$(tds[3]).text(data.vendor);
|
||||||
|
$(tds[4]).text(data.date);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function deleteTable(target){
|
||||||
|
$($(target).parent('td').parent("tr")).remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
function goSave(){
|
||||||
|
const list = [];
|
||||||
|
|
||||||
|
const $trs = $(".group_tr");
|
||||||
|
|
||||||
|
$trs.each(function(index, item){
|
||||||
|
let data = {};
|
||||||
|
const $tr = $(item);
|
||||||
|
const tds = $tr.find("td");
|
||||||
|
data.groupNumber = $tr.data("groupn");
|
||||||
|
data.productId = $tr.data("productid");
|
||||||
|
data.date = $(tds[4]).text();
|
||||||
|
data.quantity = $(tds[2]).text();
|
||||||
|
list.push(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/plan_in/planin_update_process', // 요청할 서버url
|
||||||
|
data : JSON.stringify(list),
|
||||||
|
dataType : 'json',
|
||||||
|
contentType: "application/json; charset=utf-8",
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
console.log(result);
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -43,7 +150,7 @@
|
|||||||
<thead class="table-dark">
|
<thead class="table-dark">
|
||||||
<tr><th>제품 카테고리</th><th>제품명</th><th>수량</th><th>공급업체</th><th>날짜</th><th>수정/삭제</th></tr>
|
<tr><th>제품 카테고리</th><th>제품명</th><th>수량</th><th>공급업체</th><th>날짜</th><th>수정/삭제</th></tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody id="id_table_body">
|
||||||
<c:forEach items="${list }" var="dto" varStatus="status">
|
<c:forEach items="${list }" var="dto" varStatus="status">
|
||||||
<tr class="group_tr" data-groupn="${dto.groupNumber}" data-productid="${dto.productId}">
|
<tr class="group_tr" data-groupn="${dto.groupNumber}" data-productid="${dto.productId}">
|
||||||
<td>${dto.caName}</td>
|
<td>${dto.caName}</td>
|
||||||
@@ -51,10 +158,11 @@
|
|||||||
<td>${dto.quantity}</td>
|
<td>${dto.quantity}</td>
|
||||||
<td>${dto.vendorDto.name}</td>
|
<td>${dto.vendorDto.name}</td>
|
||||||
<td><fmt:formatDate value="${dto.date}" pattern="yyyy-MM-dd" type="date"/></td>
|
<td><fmt:formatDate value="${dto.date}" pattern="yyyy-MM-dd" type="date"/></td>
|
||||||
<td><button type="submit" class="btn btn-warning" >수정</button><button type="submit" class="btn btn-danger" >삭제</button><td>
|
<td><button type="button" class="btn btn-warning" onclick="showSearchModalEdit('입고 예정 추가', this)">수정</button>
|
||||||
|
<button type="button" class="btn btn-danger" onclick="deleteTable(this)" >삭제</button><td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
<tr>
|
<tr id="id_add_tr">
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@@ -66,6 +174,14 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<button class="btn-primary btn" onclick="goSave()">저장</button>
|
||||||
|
<form method="get" class="d-inline" action="/plan_in/list">
|
||||||
|
<button class="btn-primary btn" type="submit">취소</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form id="form" action='/plan_in/read' method="post">
|
<form id="form" action='/plan_in/read' method="post">
|
||||||
<input name="groupNumber" id="groupId" hidden>
|
<input name="groupNumber" id="groupId" hidden>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|||||||
@@ -55,8 +55,7 @@
|
|||||||
<td>${status.count }</td>
|
<td>${status.count }</td>
|
||||||
<td>${dto.productDto.name }</td>
|
<td>${dto.productDto.name }</td>
|
||||||
<td>${dto.price }</td>
|
<td>${dto.price }</td>
|
||||||
<td><fmt:formatDate value="${dto.registration_date }"
|
<td><fmt:formatDate value="${dto.registration_date}" pattern="yyyy-MM-dd" type="date"/></td>
|
||||||
dateStyle="short" /></td>
|
|
||||||
<td>${dto.accountDto.name }</td>
|
<td>${dto.accountDto.name }</td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|||||||
@@ -58,8 +58,7 @@
|
|||||||
<td>${dto.company_name }</td>
|
<td>${dto.company_name }</td>
|
||||||
<td>${dto.categoryDto.cls_nm_4 }</td>
|
<td>${dto.categoryDto.cls_nm_4 }</td>
|
||||||
<td>${dto.vendorDto.name }</td>
|
<td>${dto.vendorDto.name }</td>
|
||||||
<td><fmt:formatDate value="${dto.registration_date }"
|
<td><fmt:formatDate value="${dto.registration_date}" pattern="yyyy-MM-dd" type="date"/></td>
|
||||||
dateStyle="short" /></td>
|
|
||||||
<td>${dto.accountDto.name }</td>
|
<td>${dto.accountDto.name }</td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|||||||
Reference in New Issue
Block a user