Merge remote-tracking branch 'origin/master'

This commit is contained in:
sungsu
2024-01-19 09:54:41 +09:00
25 changed files with 907 additions and 59 deletions

View File

@@ -1,5 +1,64 @@
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";
}
}

View File

@@ -1,5 +1,46 @@
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 {
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;
}

View File

@@ -1,5 +1,12 @@
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);
}

View File

@@ -1,5 +1,37 @@
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);
};//카운터
}

View File

@@ -12,10 +12,12 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.multipart.MultipartFile;
import com.no1.wms.account.AccountDto;
@@ -29,13 +31,16 @@ public class MypageController {
@Autowired
ImgService imgService;
@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");
//System.out.println(dto.getId());
AccountDto list = accountService.selectById(dto);
m.addAttribute("list", list);
@@ -88,9 +93,9 @@ public class MypageController {
}
@PostMapping("/mypage/uplodeImg")
public String imgFileUplode(HttpServletRequest request, MultipartFile file) {
public String imgFileUplode(HttpServletRequest request,HttpSession session , MultipartFile file) {
//System.out.println(file);
HttpSession session = request.getSession();
//HttpSession session = request.getSession();
AccountDto dto = (AccountDto) session.getAttribute("userData");
String fileName = dto.getId();
//System.out.println(fileName);

View File

@@ -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<ProductDto> 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<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");
}
}

View File

@@ -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;

View File

@@ -15,4 +15,8 @@ public interface PlanInMapper {
int count(Map<String, Object> m);
List<PlanInDto> selectById(PlanInDto dto);
int deleteById(PlanInDto dto);
void insert(PlanInDto dto);
}

View File

@@ -33,4 +33,11 @@ public class PlanInService {
List<PlanInDto> selectById(PlanInDto dto){
return mapper.selectById(dto);
}
int deleteById(PlanInDto dto){
return mapper.deleteById(dto);
}
void insert(PlanInDto dto){
mapper.insert(dto);
}
}

View File

@@ -3,6 +3,7 @@ package com.no1.wms.price;
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.product.ProductDto;
@@ -21,6 +22,7 @@ public class PriceDto {
private String id;//id
private String price;//가격
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date registration_date;//등록날짜
private String manager_id;//담당자
private String product_id; //제품 아이디

View File

@@ -2,6 +2,9 @@ package com.no1.wms.product;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.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.CategoryService;
import com.no1.wms.price.PriceDto;
@@ -30,6 +35,9 @@ public class ProductController {
CategoryService categoryService;
@Autowired
VendorService service;
@Autowired
AccountService accountService;
/*
@GetMapping("list")
@@ -81,7 +89,7 @@ public class ProductController {
// 생성 - 폼
@PostMapping("/create")
public String create() {
public String create() {
return "/product/create";
}

View File

@@ -3,6 +3,7 @@ package com.no1.wms.product;
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.authority.AuthorityDto;
@@ -27,6 +28,7 @@ public class ProductDto {
private String company_name = "미지정";//회사명
private String kan_code;//분류코드
private String vendor_id;//거래처 id
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date registration_date;//등록날짜
private String manager_id;//담당자
private boolean activation;//활성화