mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 12:13:33 +09:00
입고 전체적으로 수정
This commit is contained in:
@@ -8,6 +8,7 @@ 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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -17,6 +18,8 @@ import com.no1.wms.price.PriceDto;
|
||||
import com.no1.wms.product.ProductDto;
|
||||
import com.no1.wms.product.ProductService;
|
||||
import com.no1.wms.stock.StockService;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import com.no1.wms.warehouse.WarehouseService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/in")
|
||||
@@ -28,6 +31,8 @@ public class InController {
|
||||
ProductService productService;
|
||||
@Autowired
|
||||
StockService stockservice;
|
||||
@Autowired
|
||||
WarehouseService warehouseService;
|
||||
|
||||
@GetMapping("/list")
|
||||
//@ResponseBody
|
||||
@@ -70,24 +75,54 @@ public class InController {
|
||||
return "in/create";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(PriceDto dto) {
|
||||
public boolean createProcess(InDto dto) {
|
||||
int i = inService.createProcess(dto);
|
||||
if (i == 1) {
|
||||
int j = inService.createProcess2(dto);
|
||||
if (i == 1 & i == j) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@PostMapping("/read")
|
||||
public String read(String id, Model m) {
|
||||
InDto dto = inService.selectById(id);
|
||||
String productId = dto.getProduct_id();
|
||||
ProductDto pDto = productService.selectById(productId);
|
||||
m.addAttribute("pDto", pDto);
|
||||
m.addAttribute("dto", dto);
|
||||
return "in/read";
|
||||
}
|
||||
|
||||
// 수정 폼
|
||||
@PostMapping("/update")
|
||||
public String update(String id, Model m) {
|
||||
InDto dto = inService.selectById(id);
|
||||
String productId = dto.getProduct_id();
|
||||
String warehouseId = dto.getWarehouse_id();
|
||||
ProductDto pDto = productService.selectById(productId);
|
||||
WarehouseDto wDto = warehouseService.One(warehouseId);
|
||||
m.addAttribute("wDto", wDto);
|
||||
m.addAttribute("pDto", pDto);
|
||||
m.addAttribute("dto", dto);
|
||||
return "in/update";
|
||||
}
|
||||
|
||||
// 수정 - Ajax
|
||||
@PutMapping("/update_process")
|
||||
@ResponseBody
|
||||
public boolean update_process(InDto dto) {
|
||||
int i = inService.updateById(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -132,46 +167,44 @@ public class InController {
|
||||
}
|
||||
|
||||
@PostMapping("/show_modal_warehouse")
|
||||
public ModelAndView warehouseShowModal(@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){
|
||||
public ModelAndView warehouseShowModal(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||
@RequestParam(name = "search", defaultValue = "") String search,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page,
|
||||
@RequestParam String name, String product_id, ModelAndView mav){
|
||||
|
||||
int perPage = 9; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
int perPage = 9; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<Map<String, Object>> list = null;
|
||||
int count = 0;
|
||||
|
||||
list = stockservice.warehousesSelect(searchn, search, startRow, perPage);
|
||||
count = stockservice.warehouseCount(searchn, search);
|
||||
|
||||
List<Map<String, Object>> list = null;
|
||||
int count = 0;
|
||||
|
||||
mav.addObject("list", list);
|
||||
list = stockservice.warehousesSelect(searchn, search, startRow, perPage, product_id);
|
||||
count = stockservice.warehouseCount(searchn, search, product_id);
|
||||
|
||||
mav.addObject("start", startRow + 1);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||
mav.addObject("list", list);
|
||||
|
||||
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.addObject("start", startRow + 1);
|
||||
|
||||
mav.setViewName(name);
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ import lombok.NoArgsConstructor;
|
||||
public class InDto {
|
||||
|
||||
private String id;
|
||||
private String group_number;
|
||||
@Builder.Default
|
||||
private String group_number = null;
|
||||
private String product_id;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date in_date;
|
||||
|
||||
@@ -9,4 +9,9 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface InMapper {
|
||||
List<InDto> inList(Map<String, Object> m);
|
||||
int count(Map<String, Object> m);
|
||||
int createProcess(InDto dto);
|
||||
int createProcess2(InDto dto);
|
||||
InDto selectById (String id);
|
||||
int updateById(InDto dto);
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,21 @@ public class InService {
|
||||
return mapper.count(m);
|
||||
};//카운터
|
||||
|
||||
public int createProcess(InDto dto) {
|
||||
return mapper.createProcess(dto);
|
||||
}
|
||||
|
||||
public int createProcess2(InDto dto) {
|
||||
return mapper.createProcess2(dto);
|
||||
}
|
||||
|
||||
public InDto selectById (String id) {
|
||||
return mapper.selectById(id);
|
||||
}
|
||||
|
||||
public int updateById(InDto dto) {
|
||||
return mapper.updateById(dto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user