mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 12:13:33 +09:00
#update
This commit is contained in:
@@ -240,7 +240,7 @@ public class ExcelDownlodeUtils {
|
||||
cell = row.createCell(2);
|
||||
cell.setCellValue((String) dto.get("warehouseName"));
|
||||
cell = row.createCell(3);
|
||||
cell.setCellValue((String) dto.get("quantity"));
|
||||
cell.setCellValue((int) dto.get("quantity"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ProductOutController {
|
||||
@ResponseBody
|
||||
public int delete(ProductOutDto dto) {
|
||||
System.out.println("데이터 :: " + dto);
|
||||
int i = service.deleteOut(dto);
|
||||
int i = service.outNow(dto);
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -130,13 +130,10 @@ public class ProductOutController {
|
||||
@PutMapping("/outNow")
|
||||
@ResponseBody
|
||||
public boolean outNow(ProductOutDto dto) {
|
||||
int i = service.outNowUpdate(dto);
|
||||
if (i != 0) {
|
||||
service.updateWarehouseDeleteStock(dto);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
service.outNowUpdate(dto);
|
||||
service.updateWarehouseDeleteStock(dto);
|
||||
service.stockQuantityUpdate(dto);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ public interface ProductOutMapper {
|
||||
int updateWarehousePlus(ProductOutDto dto);
|
||||
|
||||
int updateWarehouseDeleteStock(ProductOutDto dto);
|
||||
|
||||
int stockQuantityUpdate(ProductOutDto dto);
|
||||
|
||||
int createOut(ProductOutDto dto);
|
||||
|
||||
|
||||
@@ -73,6 +73,11 @@ public class ProductOutService {
|
||||
return mapper.updateWarehouseDeleteStock(dto);
|
||||
}
|
||||
|
||||
public int stockQuantityUpdate(ProductOutDto dto){
|
||||
return mapper.stockQuantityUpdate(dto);
|
||||
}
|
||||
|
||||
|
||||
public int deleteOut(ProductOutDto dto) {
|
||||
return mapper.deleteOut(dto);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class StockController {
|
||||
list = service.warehousesSelect(searchn, search, startRow, perPage ,product_id);
|
||||
count = service.warehouseCount(searchn, search ,product_id);
|
||||
}
|
||||
|
||||
System.out.println("테스트 :: "+ product_id);
|
||||
mav.addObject("list", list);
|
||||
|
||||
mav.addObject("start", startRow + 1);
|
||||
@@ -230,9 +230,10 @@ public class StockController {
|
||||
|
||||
|
||||
// 리스트 다운로드
|
||||
@GetMapping("/stock/downloadExcelList")
|
||||
@GetMapping("/downloadExcelList")
|
||||
public void downlodeExcelList(HttpServletResponse response) {
|
||||
List<Map<String, Object>> dto = service.selectAll();
|
||||
System.out.println("엑셀 출력 확인 : : " + dto);
|
||||
String excelFileName = "재고 파일";
|
||||
String sheetName = "재고";
|
||||
String[] columnName = {"제품명","카테고리","창고","재고수"};
|
||||
@@ -241,7 +242,7 @@ public class StockController {
|
||||
};
|
||||
|
||||
//서식 다운로드
|
||||
@GetMapping("/stock/downloadStockForm")
|
||||
@GetMapping("/downloadStockForm")
|
||||
public void downlodeStockForm (HttpServletResponse response) throws IOException {
|
||||
String stockFormName = "재고 데이터 입력 서식.xlsx";
|
||||
excelDownlodeUtils.downlodeExcelForm(response, stockFormName);
|
||||
|
||||
@@ -2,15 +2,22 @@ package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.excel.ExcelDownlodeUtils;
|
||||
import com.no1.wms.excel.ExcelRequestManager;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
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.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -146,4 +153,61 @@ public class VendorController {
|
||||
String vendorFormName = "거래처 데이터 입력 서식.xlsx";
|
||||
excelDownlodeUtils.downlodeExcelForm(response, vendorFormName);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@PostMapping("/vendor/uplodeExcel")
|
||||
public String uploadExcel(@ModelAttribute("dto") VendorDto dto , RedirectAttributes redirectAttributes, final MultipartHttpServletRequest multiRequest,
|
||||
HttpServletRequest request, ModelMap model) {
|
||||
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
|
||||
|
||||
try {
|
||||
|
||||
ExcelRequestManager em = new ExcelRequestManager();
|
||||
|
||||
// 멀티파트 요청 객체에서 파일 맵을 가져옴
|
||||
final Map<String, MultipartFile> files = multiRequest.getFileMap();
|
||||
//초기화
|
||||
List<HashMap<String,String>> apply =null;
|
||||
|
||||
//엑셀파일 가져와서 저장 및 읽기
|
||||
//변수는 멀티파트 요청 객체의 파일맵, 저장할 엑셀파일명 이름에 추가할 숫자(그냥 0으로 해도 됨)
|
||||
//마찬가지로 엑셀파일 명 이름에 추가할 문자열, uplode폴더에 들어갈 폴더명(카테고리같은 파트 이름으로 해주세요)
|
||||
//폴더가 없으면 자동생성되게 해뒀습니다.
|
||||
//마지막으로 HttpServletRequest
|
||||
apply = em.parseExcelSpringMultiPart(files, "테스트파일", 0, "", "category", request);
|
||||
|
||||
for (int i = 0; i < apply.size(); i++) {
|
||||
|
||||
|
||||
dto.setName(apply.get(i).get("nsme"));
|
||||
dto.setPresident_name(apply.get(i).get("president_name"));
|
||||
dto.setAddress(apply.get(i).get("address"));
|
||||
dto.setRegistration_number(apply.get(i).get("registration_number"));
|
||||
dto.setEmail(apply.get(i).get("email"));
|
||||
dto.setPresident_telephone(apply.get(i).get("president_telephone"));
|
||||
dto.setVendor_manager(apply.get(i).get("vendor_manager"));
|
||||
dto.setVendor_manager_telephone(apply.get(i).get("vendor_manager_telephone"));
|
||||
dto.setMain_product(apply.get(i).get("main_product"));
|
||||
dto.setManager_id(apply.get(i).get("manager_id"));
|
||||
dto.setActivation(true);
|
||||
|
||||
service.createProcess(dto);
|
||||
|
||||
}
|
||||
|
||||
resMap.put("res", "ok");
|
||||
resMap.put("msg", "업로드 성공");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.toString());
|
||||
resMap.put("res", "error");
|
||||
resMap.put("msg", "업로드 실패");
|
||||
}
|
||||
|
||||
redirectAttributes.addFlashAttribute("resMap", resMap);
|
||||
|
||||
return "redirect:/vendor/list";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -19,6 +20,7 @@ public interface VendorMapper {
|
||||
int updateVendor(VendorDto dto);
|
||||
|
||||
int createVendor(VendorDto dto);
|
||||
int createProcess(VendorDto dto);
|
||||
|
||||
int deleteVendor(String id);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -49,6 +48,9 @@ public class VendorService {
|
||||
public int createVendor(VendorDto dto) {
|
||||
return mapper.createVendor(dto);
|
||||
}
|
||||
public int createProcess(VendorDto dto) {
|
||||
return mapper.createProcess(dto);
|
||||
}
|
||||
|
||||
|
||||
public int deleteVendor(String id) {
|
||||
|
||||
Reference in New Issue
Block a user