diff --git a/src/main/java/com/no1/wms/planin/PlanInController.java b/src/main/java/com/no1/wms/planin/PlanInController.java index 5f348b7..c07b6c2 100644 --- a/src/main/java/com/no1/wms/planin/PlanInController.java +++ b/src/main/java/com/no1/wms/planin/PlanInController.java @@ -1,14 +1,16 @@ 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.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -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.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import com.no1.wms.product.ProductDto; @@ -92,7 +94,7 @@ public class PlanInController { // 입고예정추가 @PostMapping("/planin_add") - public ModelAndView insert(ModelAndView mav, ProductDto dto) + public ModelAndView add(ModelAndView mav, ProductDto dto) { List list = productservice.productList(0, "", 0, 10000); //list @@ -104,5 +106,47 @@ public class PlanInController { mav.setViewName("planin_add"); return mav; } - + + + @PostMapping("/planin_edit") + public ModelAndView edit(ModelAndView mav, ProductDto dto) + { + List 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> 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 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"); + + } + } diff --git a/src/main/java/com/no1/wms/planin/PlanInDto.java b/src/main/java/com/no1/wms/planin/PlanInDto.java index d19244a..2af9db0 100644 --- a/src/main/java/com/no1/wms/planin/PlanInDto.java +++ b/src/main/java/com/no1/wms/planin/PlanInDto.java @@ -27,7 +27,6 @@ public class PlanInDto { private Integer quantity; @DateTimeFormat(pattern = "yyyy-MM-dd") private Date date; - private String vendorId; private String managerId; private String warehouseId; private String qrHash; diff --git a/src/main/java/com/no1/wms/planin/PlanInMapper.java b/src/main/java/com/no1/wms/planin/PlanInMapper.java index 524f285..9eae396 100644 --- a/src/main/java/com/no1/wms/planin/PlanInMapper.java +++ b/src/main/java/com/no1/wms/planin/PlanInMapper.java @@ -15,4 +15,8 @@ public interface PlanInMapper { int count(Map m); List selectById(PlanInDto dto); + + int deleteById(PlanInDto dto); + + void insert(PlanInDto dto); } diff --git a/src/main/java/com/no1/wms/planin/PlanInService.java b/src/main/java/com/no1/wms/planin/PlanInService.java index dd0201b..81a408a 100644 --- a/src/main/java/com/no1/wms/planin/PlanInService.java +++ b/src/main/java/com/no1/wms/planin/PlanInService.java @@ -33,4 +33,11 @@ public class PlanInService { List selectById(PlanInDto dto){ return mapper.selectById(dto); } + + int deleteById(PlanInDto dto){ + return mapper.deleteById(dto); + } + void insert(PlanInDto dto){ + mapper.insert(dto); + } } diff --git a/src/main/resources/mappers/PlainInMapper.xml b/src/main/resources/mappers/PlainInMapper.xml index 28af62b..b5c191d 100644 --- a/src/main/resources/mappers/PlainInMapper.xml +++ b/src/main/resources/mappers/PlainInMapper.xml @@ -7,7 +7,6 @@ - @@ -37,24 +36,24 @@ + + delete from plan_In WHERE group_number = #{groupNumber} + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/modal/planin_add.jsp b/src/main/webapp/WEB-INF/views/modal/planin_add.jsp index a00f335..2acc59f 100644 --- a/src/main/webapp/WEB-INF/views/modal/planin_add.jsp +++ b/src/main/webapp/WEB-INF/views/modal/planin_add.jsp @@ -3,21 +3,40 @@ <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> @@ -72,7 +91,7 @@ function goDown(target){
제품명
@@ -96,6 +115,7 @@ function goDown(target){ id='input_date' type="date" class="form-control" placeholder="날짜" aria-label="날짜" value=""> + diff --git a/src/main/webapp/WEB-INF/views/modal/planin_edit.jsp b/src/main/webapp/WEB-INF/views/modal/planin_edit.jsp new file mode 100644 index 0000000..4c57756 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/modal/planin_edit.jsp @@ -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" %> + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
제품명회사명분류거래처등록날짜선택
${dto.name }${dto.company_name }${dto.categoryDto.cls_nm_4 }${dto.vendorDto.name }
+
+
+
+
+
+
+
+
+
+
+
+ 제품카테고리 + +
+ +
+ 제품명 + +
+ +
+ 수량 + +
+ +
+ 공급업체 + +
+ +
+ 날짜 + +
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+ + +
diff --git a/src/main/webapp/WEB-INF/views/planin/update.jsp b/src/main/webapp/WEB-INF/views/planin/update.jsp index edb21e4..3d214fd 100644 --- a/src/main/webapp/WEB-INF/views/planin/update.jsp +++ b/src/main/webapp/WEB-INF/views/planin/update.jsp @@ -3,7 +3,9 @@ <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
@@ -43,7 +150,7 @@ 제품 카테고리제품명수량공급업체날짜수정/삭제 - + ${dto.caName} @@ -51,10 +158,11 @@ ${dto.quantity} ${dto.vendorDto.name} - + + - + @@ -66,6 +174,14 @@
+
+
+ +
+ +
+
+