mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
#update
This commit is contained in:
200
src/main/java/com/no1/wms/out/ProductOutController.java
Normal file
200
src/main/java/com/no1/wms/out/ProductOutController.java
Normal 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;
|
||||
}
|
||||
}
|
||||
29
src/main/java/com/no1/wms/out/ProductOutDto.java
Normal file
29
src/main/java/com/no1/wms/out/ProductOutDto.java
Normal 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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
46
src/main/java/com/no1/wms/out/ProductOutMapper.java
Normal file
46
src/main/java/com/no1/wms/out/ProductOutMapper.java
Normal 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);//검색 글 갯수
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
108
src/main/java/com/no1/wms/out/ProductOutService.java
Normal file
108
src/main/java/com/no1/wms/out/ProductOutService.java
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user