mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,23 +1,32 @@
|
|||||||
package com.no1.wms.category;
|
package com.no1.wms.category;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
import com.no1.wms.excel.ExcelUtils;
|
import com.no1.wms.excel.ExcelRequestManager;
|
||||||
|
import com.no1.wms.excel.ExcelDownlodeUtils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -28,16 +37,15 @@ public class CategoryController {
|
|||||||
CategoryService categoryService;
|
CategoryService categoryService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ExcelUtils excelUtils;
|
ExcelDownlodeUtils excelDownlodeUtils;
|
||||||
|
|
||||||
//테스트
|
//테스트
|
||||||
@GetMapping("/category/test")
|
@GetMapping("/category/test")
|
||||||
public String testPage(Model m) {
|
public String testPage(Model m, HttpServletRequest request) {
|
||||||
List<CategoryDto> dto = categoryService.selectAllCategory();
|
|
||||||
m.addAttribute("dto", dto);
|
|
||||||
|
|
||||||
return "category/test";
|
return "category/test";
|
||||||
}
|
};
|
||||||
|
|
||||||
// 카테고리 리스트 출력
|
// 카테고리 리스트 출력
|
||||||
@GetMapping("/category/list")
|
@GetMapping("/category/list")
|
||||||
@@ -77,7 +85,7 @@ public class CategoryController {
|
|||||||
//List<CategoryDto> dto = categoryService.categoryList(page);
|
//List<CategoryDto> dto = categoryService.categoryList(page);
|
||||||
//m.addAttribute("list", dto);
|
//m.addAttribute("list", dto);
|
||||||
return "category/list";
|
return "category/list";
|
||||||
}
|
};
|
||||||
|
|
||||||
// 상세페이지
|
// 상세페이지
|
||||||
@PostMapping("/category/read")
|
@PostMapping("/category/read")
|
||||||
@@ -86,13 +94,13 @@ public class CategoryController {
|
|||||||
CategoryDto dto = categoryService.selectByKanCode(kan_code);
|
CategoryDto dto = categoryService.selectByKanCode(kan_code);
|
||||||
m.addAttribute("dto", dto);
|
m.addAttribute("dto", dto);
|
||||||
return "category/read";
|
return "category/read";
|
||||||
}
|
};
|
||||||
|
|
||||||
// 생성 - 폼
|
// 생성 - 폼
|
||||||
@PostMapping("/category/create")
|
@PostMapping("/category/create")
|
||||||
public String create() {
|
public String create() {
|
||||||
return "category/create";
|
return "category/create";
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// 생성 - Ajax
|
// 생성 - Ajax
|
||||||
@@ -105,7 +113,7 @@ public class CategoryController {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 수정 - 폼
|
// 수정 - 폼
|
||||||
@PostMapping("/category/update")
|
@PostMapping("/category/update")
|
||||||
@@ -113,7 +121,7 @@ public class CategoryController {
|
|||||||
CategoryDto dto = categoryService.selectByKanCode(kan_code);
|
CategoryDto dto = categoryService.selectByKanCode(kan_code);
|
||||||
m.addAttribute("dto", dto);
|
m.addAttribute("dto", dto);
|
||||||
return "category/update";
|
return "category/update";
|
||||||
}
|
};
|
||||||
// 수정 - Ajax
|
// 수정 - Ajax
|
||||||
|
|
||||||
@PutMapping("/category/update_process")
|
@PutMapping("/category/update_process")
|
||||||
@@ -126,7 +134,7 @@ public class CategoryController {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 삭제
|
// 삭제
|
||||||
@DeleteMapping("/category/delete")
|
@DeleteMapping("/category/delete")
|
||||||
@@ -138,18 +146,18 @@ public class CategoryController {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// 엑셀다운로드테스트
|
// 엑셀다운로드테스트
|
||||||
@GetMapping("/category/download")
|
@GetMapping("/category/downloadTest")
|
||||||
public void downloadExcel(HttpServletResponse response) {
|
public void downloadExcelTest(HttpServletResponse response) {
|
||||||
List<CategoryDto> dto = categoryService.selectAllCategory();
|
List<CategoryDto> dto = categoryService.selectAllCategory();
|
||||||
String excelFileName = "카테고리 테스트 파일";
|
String excelFileName = "카테고리 테스트 파일";
|
||||||
String sheetName = "카테고리";
|
String sheetName = "카테고리";
|
||||||
String[] columnName = {"KAN_CODE","대분류","중분류","소분류","세분류"};
|
String[] columnName = {"KAN_CODE","대분류","중분류","소분류","세분류"};
|
||||||
excelUtils.downloadCategoryExcelFile(excelFileName, response, sheetName, columnName, dto);
|
excelDownlodeUtils.downloadCategoryExcelFile(excelFileName, response, sheetName, columnName, dto);
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
// KAN코드 중복확인 메서드
|
// KAN코드 중복확인 메서드
|
||||||
@PostMapping("/category/checkKancode")
|
@PostMapping("/category/checkKancode")
|
||||||
@@ -157,7 +165,7 @@ public class CategoryController {
|
|||||||
public String chackKancode(String kan_code) {
|
public String chackKancode(String kan_code) {
|
||||||
String checkkan = categoryService.kanCheck(kan_code);
|
String checkkan = categoryService.kanCheck(kan_code);
|
||||||
return checkkan;
|
return checkkan;
|
||||||
}
|
};
|
||||||
|
|
||||||
//카테고리 검색 모달
|
//카테고리 검색 모달
|
||||||
@GetMapping("/category/categorysearch")
|
@GetMapping("/category/categorysearch")
|
||||||
@@ -192,9 +200,69 @@ public class CategoryController {
|
|||||||
m.addAttribute("p" , page);
|
m.addAttribute("p" , page);
|
||||||
|
|
||||||
return "modal/categorysearch";
|
return "modal/categorysearch";
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//서식 다운로드
|
||||||
|
@GetMapping("/category/downlodeCategoryForm")
|
||||||
|
public void downlodeCategoryForm (HttpServletResponse response) throws IOException{
|
||||||
|
String categoryFormName = "카테고리 데이터 입력 서식.xlsx";
|
||||||
|
excelDownlodeUtils.downlodeExcelForm(response, categoryFormName);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/category/uplodeExcel")
|
||||||
|
public String uploadExcel(@ModelAttribute("dto") CategoryDto 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.setKan_code(apply.get(i).get("cell_0"));
|
||||||
|
dto.setCls_nm_1(apply.get(i).get("cell_1"));
|
||||||
|
dto.setCls_nm_2(apply.get(i).get("cell_2"));
|
||||||
|
dto.setCls_nm_3(apply.get(i).get("cell_3"));
|
||||||
|
dto.setCls_nm_4(apply.get(i).get("cell_4"));
|
||||||
|
dto.setActivation(true);
|
||||||
|
|
||||||
|
categoryService.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:/category/list";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.no1.wms.category;
|
|||||||
import org.apache.ibatis.type.Alias;
|
import org.apache.ibatis.type.Alias;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@@ -16,5 +17,6 @@ public class CategoryDto {
|
|||||||
private String cls_nm_2;
|
private String cls_nm_2;
|
||||||
private String cls_nm_3;
|
private String cls_nm_3;
|
||||||
private String cls_nm_4;
|
private String cls_nm_4;
|
||||||
private boolean activation;
|
@Builder.Default
|
||||||
|
private Boolean activation = true;
|
||||||
}
|
}
|
||||||
|
|||||||
17
src/main/java/com/no1/wms/excel/EgovWebUtil.java
Normal file
17
src/main/java/com/no1/wms/excel/EgovWebUtil.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.no1.wms.excel;
|
||||||
|
|
||||||
|
//../을 통해 부모디렉토리로 이동하는 방법을 막기 위한 보안
|
||||||
|
public class EgovWebUtil {
|
||||||
|
public static String filePathBlackList(String value) {
|
||||||
|
String returnValue = value;
|
||||||
|
if (returnValue == null || returnValue.trim().equals("")) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
returnValue = returnValue.replaceAll("\\.\\./", "");
|
||||||
|
returnValue = returnValue.replaceAll("\\.\\.\\\\", "");
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,16 +1,21 @@
|
|||||||
package com.no1.wms.excel;
|
package com.no1.wms.excel;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.no1.wms.category.CategoryDto;
|
import com.no1.wms.category.CategoryDto;
|
||||||
@@ -19,8 +24,12 @@ import com.no1.wms.category.CategoryDto;
|
|||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ExcelUtils {
|
public class ExcelDownlodeUtils {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//마지막 List<CategoryDto> dto 이부분을 수정해서 만들어야함.
|
||||||
public void downloadCategoryExcelFile(String excelFileName, HttpServletResponse response,
|
public void downloadCategoryExcelFile(String excelFileName, HttpServletResponse response,
|
||||||
String sheetName, String[] columnName, List<CategoryDto> dto) {
|
String sheetName, String[] columnName, List<CategoryDto> dto) {
|
||||||
String fileName = "";
|
String fileName = "";
|
||||||
@@ -32,7 +41,7 @@ public class ExcelUtils {
|
|||||||
response.setContentType("ms-vnd/excel");
|
response.setContentType("ms-vnd/excel");
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";");
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\";");
|
||||||
|
|
||||||
Workbook workbook = new HSSFWorkbook();
|
Workbook workbook = new XSSFWorkbook();
|
||||||
Sheet sheet = workbook.createSheet(sheetName);
|
Sheet sheet = workbook.createSheet(sheetName);
|
||||||
|
|
||||||
Row row = null;
|
Row row = null;
|
||||||
@@ -45,6 +54,7 @@ public class ExcelUtils {
|
|||||||
cell.setCellValue(columnName[i]);
|
cell.setCellValue(columnName[i]);
|
||||||
}
|
}
|
||||||
rowNum += 1;
|
rowNum += 1;
|
||||||
|
|
||||||
//수정부분
|
//수정부분
|
||||||
makeCategoryBody(dto,row,sheet,cell,rowNum);
|
makeCategoryBody(dto,row,sheet,cell,rowNum);
|
||||||
|
|
||||||
@@ -77,5 +87,43 @@ public class ExcelUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//엑셀 폼 파일 다운로드
|
||||||
|
//엑셀 폼은 직접 만들어서 src/main/webapp/excelfiles/excelform 이 경로의 폴더안에 넣으면 됩니다.
|
||||||
|
//확장자는 .xlsx로 해주세요.
|
||||||
|
//매개변수는 HttpServletResponse response와 파일명 String을 넣으면 되고 파일명은 한글도 가능합니다.
|
||||||
|
public void downlodeExcelForm(HttpServletResponse response, String formName) throws IOException {
|
||||||
|
String excelfilesDirectory = "src/main/webapp/excelfiles/excelform/";
|
||||||
|
|
||||||
|
|
||||||
|
File file = new File(excelfilesDirectory+formName);
|
||||||
|
|
||||||
|
try( FileInputStream fis = new FileInputStream(file);
|
||||||
|
BufferedInputStream bis = new BufferedInputStream(fis);
|
||||||
|
OutputStream out = response.getOutputStream()){
|
||||||
|
String encodedFilename = URLEncoder.encode(formName, "UTF-8").replaceAll("\\+", "%20");
|
||||||
|
|
||||||
|
response.addHeader("Content-Disposition", "attachment;filename=\""+encodedFilename+"\"");
|
||||||
|
response.setContentType("application/vnd.ms-excel");
|
||||||
|
// 응답 크기 명시
|
||||||
|
response.setContentLength((int)file.length());
|
||||||
|
int read = 0;
|
||||||
|
while((read = bis.read()) != -1) {
|
||||||
|
out.write(read);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}catch(IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
110
src/main/java/com/no1/wms/excel/ExcelManagerXlsx.java
Normal file
110
src/main/java/com/no1/wms/excel/ExcelManagerXlsx.java
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
package com.no1.wms.excel;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.CellType;
|
||||||
|
import org.apache.poi.ss.usermodel.DateUtil;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
|
public class ExcelManagerXlsx {
|
||||||
|
|
||||||
|
private static ExcelManagerXlsx excelXlsxMng;
|
||||||
|
|
||||||
|
public ExcelManagerXlsx() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ExcelManagerXlsx getInstance() {
|
||||||
|
if (excelXlsxMng == null) {
|
||||||
|
excelXlsxMng = new ExcelManagerXlsx();
|
||||||
|
}
|
||||||
|
return excelXlsxMng;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HashMap<String, String>> getListXlsxRead(String excel) throws Exception {
|
||||||
|
|
||||||
|
List<HashMap<String, String>> list = new ArrayList<HashMap<String,String>>();
|
||||||
|
File file = new File( excel );
|
||||||
|
if( !file.exists() || !file.isFile() || !file.canRead() ) {
|
||||||
|
throw new IOException( excel );
|
||||||
|
}
|
||||||
|
XSSFWorkbook wb = new XSSFWorkbook( new FileInputStream(file) );
|
||||||
|
|
||||||
|
//xls시 이용
|
||||||
|
//HSSFWorkbook wb = new HSSFWorkbook ( new FileInputStream(file) );
|
||||||
|
|
||||||
|
int sheetIndex = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 모든 시트 순회
|
||||||
|
for( int i=0; i<1; i++ ) {
|
||||||
|
XSSFSheet sheet = wb.getSheetAt(sheetIndex);
|
||||||
|
for( Row row : sheet ) {
|
||||||
|
// 첫 번째 시트만 사용
|
||||||
|
if(row.getRowNum() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<String, String> hMap = new HashMap<String, String>();
|
||||||
|
String valueStr = "";
|
||||||
|
|
||||||
|
int cellLength = (int) row.getLastCellNum();///
|
||||||
|
|
||||||
|
for (int j = 0; j < row.getLastCellNum(); j++) {
|
||||||
|
Cell cell = row.getCell(j);
|
||||||
|
|
||||||
|
if (cell == null || cell.getCellType() == CellType.BLANK) {
|
||||||
|
valueStr = "";
|
||||||
|
}else{
|
||||||
|
switch(cell.getCellType()){
|
||||||
|
case STRING :
|
||||||
|
valueStr = cell.getStringCellValue();
|
||||||
|
break;
|
||||||
|
case NUMERIC : // 날짜 형식이든 숫자 형식이든 다 CELL_TYPE_NUMERIC으로 인식함.
|
||||||
|
if(DateUtil.isCellDateFormatted(cell)){ // 날짜 유형의 데이터일 경우,
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREA);
|
||||||
|
String formattedStr = dateFormat.format(cell.getDateCellValue());
|
||||||
|
valueStr = formattedStr;
|
||||||
|
break;
|
||||||
|
}else{ //숫자 데이터일 경우,
|
||||||
|
Double numericCellValue = cell.getNumericCellValue();
|
||||||
|
if(Math.floor(numericCellValue) == numericCellValue){ // 소수점 이하를 버린 값이 원래의 값과 같다면,,
|
||||||
|
valueStr = numericCellValue.intValue() + ""; // int형으로 소수점 이하 버리고 String으로 데이터 담는다.
|
||||||
|
}else{
|
||||||
|
valueStr = numericCellValue + "";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOLEAN :
|
||||||
|
valueStr = cell.getBooleanCellValue() + "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 엑셀의 열 인덱스와 함께 값 매핑
|
||||||
|
hMap.put("cell_"+j ,valueStr);
|
||||||
|
|
||||||
|
}
|
||||||
|
// 결과 리스트에 추가
|
||||||
|
list.add(hMap);
|
||||||
|
}
|
||||||
|
sheetIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
86
src/main/java/com/no1/wms/excel/ExcelRequestManager.java
Normal file
86
src/main/java/com/no1/wms/excel/ExcelRequestManager.java
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
package com.no1.wms.excel;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
public class ExcelRequestManager {
|
||||||
|
|
||||||
|
public List<HashMap<String, String>> parseExcelSpringMultiPart
|
||||||
|
(Map<String, MultipartFile> files , String KeyStr, int fileKeyParam,String atchFileId ,String storePath,HttpServletRequest request) throws Exception{
|
||||||
|
List<HashMap<String, String>> list = null;
|
||||||
|
int fileKey = fileKeyParam;
|
||||||
|
|
||||||
|
String storePathString = "";
|
||||||
|
String atchFileIdString = "";
|
||||||
|
|
||||||
|
String folder = request.getServletContext().getRealPath("/");
|
||||||
|
|
||||||
|
if ("".equals(storePath) || storePath == null) {
|
||||||
|
storePathString = folder+"/excelfiles/upload/";
|
||||||
|
} else {
|
||||||
|
storePathString = folder+"/excelfiles/upload/"+storePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!"".equals(atchFileId) || atchFileId != null) {
|
||||||
|
atchFileIdString = atchFileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
File saveFolder = new File(EgovWebUtil.filePathBlackList(storePathString));
|
||||||
|
|
||||||
|
//폴더 없으면 생성
|
||||||
|
if (!saveFolder.exists() || saveFolder.isFile()) {
|
||||||
|
saveFolder.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<Entry<String, MultipartFile>> itr = files.entrySet().iterator();
|
||||||
|
MultipartFile file;
|
||||||
|
String filePath = "";
|
||||||
|
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
//파일 이름을 가져오는데 파일이 여러개일 경우
|
||||||
|
Entry<String, MultipartFile> entry = itr.next();
|
||||||
|
|
||||||
|
file = entry.getValue();
|
||||||
|
String orginFileName = file.getOriginalFilename();
|
||||||
|
|
||||||
|
if ("".equals(orginFileName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//파일의 확장자
|
||||||
|
int index = orginFileName.lastIndexOf(".");
|
||||||
|
String fileExt = orginFileName.substring(index + 1);
|
||||||
|
//파일의 이름 정하기 지정한 KeyStr값과 시간 값과 fileKey를 넣어서 만듬
|
||||||
|
String newName = KeyStr + getTimeStamp() + fileKey;
|
||||||
|
|
||||||
|
if (!"".equals(orginFileName)) {
|
||||||
|
filePath = storePathString + File.separator + newName+"."+fileExt;
|
||||||
|
file.transferTo(new File(EgovWebUtil.filePathBlackList(filePath)));
|
||||||
|
}
|
||||||
|
list = ExcelManagerXlsx.getInstance().getListXlsxRead(filePath);
|
||||||
|
|
||||||
|
fileKey++;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getTimeStamp() {
|
||||||
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
|
Date currentDate = new Date(currentTimeMillis);
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
||||||
|
String formattedTimeStamp = dateFormat.format(currentDate);
|
||||||
|
return formattedTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -166,4 +166,6 @@ public class PriceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
import com.no1.wms.category.CategoryDto;
|
import com.no1.wms.category.CategoryDto;
|
||||||
import com.no1.wms.category.CategoryService;
|
import com.no1.wms.category.CategoryService;
|
||||||
import com.no1.wms.price.PriceDto;
|
import com.no1.wms.price.PriceDto;
|
||||||
|
import com.no1.wms.vendor.VendorDto;
|
||||||
|
import com.no1.wms.vendor.VendorService;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/product")
|
@RequestMapping("/product")
|
||||||
@@ -26,6 +28,8 @@ public class ProductController {
|
|||||||
ProductService productService;
|
ProductService productService;
|
||||||
@Autowired
|
@Autowired
|
||||||
CategoryService categoryService;
|
CategoryService categoryService;
|
||||||
|
@Autowired
|
||||||
|
VendorService service;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@@ -141,7 +145,7 @@ public class ProductController {
|
|||||||
@RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) {
|
@RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) {
|
||||||
int count = categoryService.count(searchn, search);
|
int count = categoryService.count(searchn, search);
|
||||||
|
|
||||||
int perPage = 10; // 한 페이지에 보일 글의 개수
|
int perPage =9; // 한 페이지에 보일 글의 개수
|
||||||
int startRow = (page - 1) * perPage;
|
int startRow = (page - 1) * perPage;
|
||||||
|
|
||||||
List<CategoryDto> dto = categoryService.categoryList2(searchn, search, startRow ,perPage);
|
List<CategoryDto> dto = categoryService.categoryList2(searchn, search, startRow ,perPage);
|
||||||
@@ -171,6 +175,44 @@ public class ProductController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/show_modal2")
|
||||||
|
public ModelAndView vendorShowModal(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||||
|
@RequestParam(name = "search", defaultValue = "") String search,
|
||||||
|
@RequestParam(name = "p", defaultValue = "1") int page, ModelAndView m, String name) {
|
||||||
|
|
||||||
|
int count = service.count(searchn, search);
|
||||||
|
|
||||||
|
int perPage = 9; // 한 페이지에 보일 글의 갯수
|
||||||
|
int startRow = (page - 1) * perPage;
|
||||||
|
|
||||||
|
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||||
|
List<VendorDto> dto = service.list(searchn, search, startRow ,perPage);
|
||||||
|
|
||||||
|
|
||||||
|
m.addObject("vlist", dto);
|
||||||
|
m.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;
|
||||||
|
}
|
||||||
|
m.addObject("searchn", searchn);
|
||||||
|
m.addObject("search", search);
|
||||||
|
m.addObject("begin", begin);
|
||||||
|
m.addObject("end", end);
|
||||||
|
m.addObject("pageNum", pageNum);
|
||||||
|
m.addObject("totalPages", totalPages);
|
||||||
|
m.addObject("p" , page);
|
||||||
|
m.setViewName(name);
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,101 +1,223 @@
|
|||||||
package com.no1.wms.stock;
|
package com.no1.wms.stock;
|
||||||
|
|
||||||
|
|
||||||
|
import com.no1.wms.vendor.VendorDto;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@RequestMapping("/stock")
|
||||||
public class StockController {
|
public class StockController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
StockService service;
|
StockService service;
|
||||||
|
|
||||||
// 재고 리스트 출력
|
// 탭 1 재고 리스트 출력
|
||||||
@GetMapping("stock/list")
|
@GetMapping("/list")
|
||||||
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
public String list(@RequestParam(name = "searchn", defaultValue = "0") int searchn,
|
||||||
@RequestParam(name = "search", defaultValue = "") String search,
|
@RequestParam(name = "search", defaultValue = "") String search,
|
||||||
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
@RequestParam(name = "p", defaultValue = "1") int page, Model m) {
|
||||||
int count = service.count(searchn, search);
|
int count = service.count(searchn, search);
|
||||||
|
|
||||||
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
int perPage = 10; // 한 페이지에 보일 글의 갯수
|
||||||
int startRow = (page - 1) * perPage;
|
int startRow = (page - 1) * perPage;
|
||||||
|
|
||||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||||
List<Object> dto = service.list(searchn, search, perPage);
|
List<Map<String, Object>> dto = service.list(searchn, search, startRow ,perPage);
|
||||||
m.addAttribute("list", dto);
|
m.addAttribute("slist", dto);
|
||||||
|
|
||||||
int pageNum = 4;//보여질 페이지 번호 수
|
m.addAttribute("start", startRow + 1);
|
||||||
|
|
||||||
|
int pageNum = 5;//보여질 페이지 번호 수
|
||||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||||
|
|
||||||
int begin = (page - 1) / pageNum * pageNum + 1;
|
int begin = (page - 1) / pageNum * pageNum + 1;
|
||||||
int end = begin + pageNum - 1;
|
int end = begin + pageNum - 1;
|
||||||
if (end > totalPages) {
|
if (end > totalPages) {
|
||||||
end = totalPages;
|
end = totalPages;
|
||||||
}
|
}
|
||||||
|
m.addAttribute("searchn", searchn);
|
||||||
|
m.addAttribute("search", search);
|
||||||
m.addAttribute("begin", begin);
|
m.addAttribute("begin", begin);
|
||||||
m.addAttribute("end", end);
|
m.addAttribute("end", end);
|
||||||
m.addAttribute("pageNum", pageNum);
|
m.addAttribute("pageNum", pageNum);
|
||||||
m.addAttribute("totalPages", totalPages);
|
m.addAttribute("totalPages", totalPages);
|
||||||
|
m.addAttribute("p" , page);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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";
|
return "stock/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 재고 상세페이지
|
// 재고 상세페이지
|
||||||
@PostMapping("stock/read/{id}")
|
@PostMapping("/read")
|
||||||
public String read(@PathVariable String id, Model m) {
|
public String read(@RequestParam String id, Model m) {
|
||||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||||
StockDto dto = service.stockOne(id);
|
Map<String, Object> dto = service.stockOne(id);
|
||||||
m.addAttribute("dto", dto);
|
m.addAttribute("dto", dto);
|
||||||
return "stock/read/";
|
return "stock/read";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 수정 - 폼
|
// 수정 - 폼
|
||||||
@GetMapping("/stock/update/{id}")
|
@PostMapping("/update")
|
||||||
public String update(@PathVariable String id, Model m) {
|
public String update(String id, Model m) {
|
||||||
StockDto dto = service.stockOne(id);
|
Map<String, Object> dto = service.stockOne(id);
|
||||||
m.addAttribute("dto", dto);
|
m.addAttribute("dto", dto);
|
||||||
return "stock/update";
|
return "stock/update";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 수정 프로세스
|
// 수정 프로세스
|
||||||
@PutMapping("/board/update_process")
|
@PutMapping("/update_process")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String updateProcess(StockDto dto) {
|
public boolean updateProcess(StockDto dto) {
|
||||||
service.updateStock(dto);
|
|
||||||
return "redirect:list";
|
int i = service.updateStock(dto);
|
||||||
|
if (i == 1) {
|
||||||
|
service.updateWarehouse(dto);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 생성 폼
|
// 생성 폼
|
||||||
@GetMapping ("/stock/create")
|
@PostMapping("/create")
|
||||||
public String create()
|
public String create() {
|
||||||
{
|
|
||||||
return "stock/create";
|
return "stock/create";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 생성 프로세스
|
// 생성 - Ajax
|
||||||
@PostMapping("/stock/create_process")
|
@PostMapping("/create_process")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String createProcess(StockDto dto) {
|
public boolean createProcess(StockDto dto) {
|
||||||
service.createStock(dto);
|
int i = service.createStock(dto);
|
||||||
return "redirect:list";// 글목록
|
if (i != 0) {
|
||||||
|
service.updateWarehousePlus(dto);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 삭제
|
// 삭제
|
||||||
@DeleteMapping("/stock/delete")
|
@DeleteMapping("/delete")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public int delete(String id) {
|
public int delete(StockDto dto) {
|
||||||
int i = service.deleteBoard(id);
|
System.out.println("데이터 :: " + dto);
|
||||||
|
int i = service.deleteStock(dto);
|
||||||
|
service.updateWarehouseDeleteStock(dto);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@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("product_category_company_search")){
|
||||||
|
list = service.productSelect(searchn, search, startRow, perPage);
|
||||||
|
count = service.productCount(searchn, search);
|
||||||
|
}else if(name.equals("warehouse_capacity_currentCapacity")) {
|
||||||
|
list = service.warehousesSelect(searchn, search, startRow, perPage);
|
||||||
|
count = service.warehouseCount(searchn, search);
|
||||||
|
}
|
||||||
|
|
||||||
|
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("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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
package com.no1.wms.stock;
|
package com.no1.wms.stock;
|
||||||
|
|
||||||
|
import com.no1.wms.product.ProductDto;
|
||||||
|
import com.no1.wms.warehouse.WarehouseDto;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class StockDto {
|
public class StockDto {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private int warehouseId;
|
private String warehouseId;
|
||||||
private int productId;
|
private String productId;
|
||||||
private int quantity;
|
private int quantity;
|
||||||
private boolean activation;
|
private boolean activation;
|
||||||
|
|
||||||
|
private int quantityAdjustment;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,17 +10,37 @@ import java.util.Map;
|
|||||||
public interface StockMapper {
|
public interface StockMapper {
|
||||||
|
|
||||||
int count(Map<String, Object> m);//검색 글 갯수
|
int count(Map<String, Object> m);//검색 글 갯수
|
||||||
|
|
||||||
List<Object> list(Map<String, Object> m);
|
List<Map<String, Object>> list(Map<String, Object> m);
|
||||||
// List<StockDto> list(Map<String, Object> m);
|
|
||||||
|
|
||||||
|
int count2(Map<String, Object> m);//검색 글 갯수
|
||||||
|
|
||||||
|
List<Map<String, Object>> list2(Map<String, Object> m);
|
||||||
|
|
||||||
|
|
||||||
int updateStock(StockDto dto);
|
int updateStock(StockDto dto);
|
||||||
|
|
||||||
|
int updateWarehouse(StockDto dto);
|
||||||
|
|
||||||
|
int updateWarehousePlus(StockDto dto);
|
||||||
|
|
||||||
|
int updateWarehouseDeleteStock(StockDto dto);
|
||||||
|
|
||||||
int createStock(StockDto dto);
|
int createStock(StockDto dto);
|
||||||
|
|
||||||
StockDto stockOne(String id);
|
|
||||||
|
|
||||||
int deleteStock(String id);
|
Map<String, Object> stockOne(String id);
|
||||||
|
|
||||||
|
int deleteStock(StockDto dto);
|
||||||
|
|
||||||
|
List<Map<String, Object>> productSelect(Map<String, Object> m);
|
||||||
|
|
||||||
|
int productCount(Map<String, Object> m);//검색 글 갯수
|
||||||
|
|
||||||
|
List<Map<String, Object>> warehouseSelect(Map<String, Object> m);
|
||||||
|
|
||||||
|
int warehouseCount(Map<String, Object> m);//검색 글 갯수
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.no1.wms.stock;
|
package com.no1.wms.stock;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -8,6 +9,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class StockService {
|
public class StockService {
|
||||||
@Autowired
|
@Autowired
|
||||||
StockMapper mapper;
|
StockMapper mapper;
|
||||||
@@ -19,13 +21,11 @@ public class StockService {
|
|||||||
Map<String,Object> m = new HashMap<String, Object>();
|
Map<String,Object> m = new HashMap<String, Object>();
|
||||||
m.put("searchn",searchn);
|
m.put("searchn",searchn);
|
||||||
m.put("search", search);
|
m.put("search", search);
|
||||||
m.put("start", 0);
|
|
||||||
m.put("perPage", 10000);
|
|
||||||
return mapper.count(m);
|
return mapper.count(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Object> list(int searchn, String search, int start){
|
public List<Map<String, Object>> list(int searchn, String search, int start, int perPage){
|
||||||
|
|
||||||
System.out.println(searchn+search);
|
System.out.println(searchn+search);
|
||||||
|
|
||||||
@@ -33,14 +33,43 @@ public class StockService {
|
|||||||
m.put("searchn",searchn);
|
m.put("searchn",searchn);
|
||||||
m.put("search", search);
|
m.put("search", search);
|
||||||
m.put("start", start);
|
m.put("start", start);
|
||||||
m.put("perPage", 10);
|
m.put("perPage", perPage);
|
||||||
|
|
||||||
return mapper.list(m);
|
List<Map<String, Object>> result = mapper.list(m);
|
||||||
|
log.debug("warehouseOne테스트 :: " + result);
|
||||||
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int count2(int searchn, String search) {
|
||||||
|
|
||||||
|
System.out.println(searchn+search);
|
||||||
|
|
||||||
|
Map<String,Object> m = new HashMap<String, Object>();
|
||||||
|
m.put("searchn",searchn);
|
||||||
|
m.put("search", search);
|
||||||
|
return mapper.count2(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Map<String, Object>> list2(int searchn, String search, int start, int perPage){
|
||||||
|
|
||||||
|
System.out.println(searchn+search);
|
||||||
|
|
||||||
|
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.list2(m);
|
||||||
|
log.debug("warehouseOne테스트 :: " + result);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Map<String, Object> stockOne(String id) {
|
||||||
public StockDto stockOne(String id) {
|
|
||||||
return mapper.stockOne(id);
|
return mapper.stockOne(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +83,65 @@ public class StockService {
|
|||||||
return mapper.updateStock(dto);
|
return mapper.updateStock(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int updateWarehouse(StockDto dto){
|
||||||
public int deleteBoard(String id) {
|
return mapper.updateWarehouse(dto);
|
||||||
return mapper.deleteStock(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int updateWarehousePlus(StockDto dto){
|
||||||
|
return mapper.updateWarehousePlus(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateWarehouseDeleteStock(StockDto dto){
|
||||||
|
return mapper.updateWarehouseDeleteStock(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int deleteStock(StockDto dto) {
|
||||||
|
return mapper.deleteStock(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Map<String, Object>> productSelect(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.productSelect(m);
|
||||||
|
|
||||||
|
return productresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int productCount(int searchn, String search) {
|
||||||
|
|
||||||
|
|
||||||
|
Map<String,Object> m = new HashMap<String, Object>();
|
||||||
|
m.put("searchn",searchn);
|
||||||
|
m.put("search", search);
|
||||||
|
return mapper.productCount(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> warehousesSelect(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>> warehouseresult = mapper.warehouseSelect(m);
|
||||||
|
|
||||||
|
return warehouseresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int warehouseCount(int searchn, String search) {
|
||||||
|
|
||||||
|
|
||||||
|
Map<String,Object> m = new HashMap<String, Object>();
|
||||||
|
m.put("searchn",searchn);
|
||||||
|
m.put("search", search);
|
||||||
|
return mapper.warehouseCount(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
124
src/main/java/com/no1/wms/vendor/VendorController.java
vendored
Normal file
124
src/main/java/com/no1/wms/vendor/VendorController.java
vendored
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
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.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@Slf4j
|
||||||
|
public class VendorController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
VendorService service;
|
||||||
|
|
||||||
|
// 재고 리스트 출력
|
||||||
|
@GetMapping("vendor/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<VendorDto> dto = service.list(searchn, search, startRow ,perPage);
|
||||||
|
|
||||||
|
|
||||||
|
m.addAttribute("vlist", 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);
|
||||||
|
|
||||||
|
return "vendor/list";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 재고 상세페이지
|
||||||
|
@PostMapping("vendor/read")
|
||||||
|
public String read(String id, Model m) {
|
||||||
|
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||||
|
|
||||||
|
VendorDto One = service.vendorOne(id);
|
||||||
|
System.out.println("one :: " + One);
|
||||||
|
log.debug("One테스트 :: " + One);
|
||||||
|
|
||||||
|
m.addAttribute("One", One);
|
||||||
|
|
||||||
|
return "vendor/read";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 수정 - 폼
|
||||||
|
@PostMapping("/vendor/update")
|
||||||
|
public String update(String id, Model m) {
|
||||||
|
VendorDto dto = service.vendorOne(id);
|
||||||
|
m.addAttribute("dto", dto);
|
||||||
|
return "vendor/update";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 수정 프로세스
|
||||||
|
@PutMapping("/vendor/update_process")
|
||||||
|
@ResponseBody
|
||||||
|
public boolean updateProcess(VendorDto dto) {
|
||||||
|
|
||||||
|
int i = service.updateVendor(dto);
|
||||||
|
if (i == 1) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 생성 폼
|
||||||
|
@PostMapping("/vendor/create")
|
||||||
|
public String create()
|
||||||
|
{
|
||||||
|
return "vendor/create";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 생성 프로세스
|
||||||
|
@PostMapping("/vendor/create_process")
|
||||||
|
@ResponseBody
|
||||||
|
public boolean createProcess(VendorDto dto) {
|
||||||
|
int i = service.createVendor(dto);
|
||||||
|
if (i == 1) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 삭제
|
||||||
|
@DeleteMapping("/vendor/delete")
|
||||||
|
@ResponseBody
|
||||||
|
public int delete(String id) {
|
||||||
|
int i = service.deleteVendor(id);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
54
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
54
src/main/java/com/no1/wms/vendor/VendorDto.java
vendored
@@ -1,27 +1,27 @@
|
|||||||
package com.no1.wms.vendor;
|
package com.no1.wms.vendor;
|
||||||
|
|
||||||
import org.apache.ibatis.type.Alias;
|
import org.apache.ibatis.type.Alias;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
|
||||||
@Alias("VendorDto")
|
@Alias("VendorDto")
|
||||||
public class VendorDto {
|
public class VendorDto {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private String president_name;
|
private String president_name;
|
||||||
private String address;
|
private String address;
|
||||||
private String registration_number;
|
private String registration_number;
|
||||||
private String email;
|
private String email;
|
||||||
private String president_telephone;
|
private String president_telephone;
|
||||||
private String vendor_manager;
|
private String vendor_manager;
|
||||||
private String vendor_manager_telephone;
|
private String vendor_manager_telephone;
|
||||||
private String main_product;
|
private String main_product;
|
||||||
private String manager_id;
|
private String manager_id;
|
||||||
private boolean activation;
|
private boolean activation;
|
||||||
}
|
}
|
||||||
|
|||||||
26
src/main/java/com/no1/wms/vendor/VendorMapper.java
vendored
Normal file
26
src/main/java/com/no1/wms/vendor/VendorMapper.java
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.no1.wms.vendor;
|
||||||
|
|
||||||
|
import com.no1.wms.warehouse.WarehouseDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface VendorMapper {
|
||||||
|
|
||||||
|
List<VendorDto> list(Map<String, Object> m);
|
||||||
|
|
||||||
|
int count(Map<String, Object> m);//검색 글 갯수
|
||||||
|
|
||||||
|
VendorDto vendorOne(String id);
|
||||||
|
|
||||||
|
int updateVendor(VendorDto dto);
|
||||||
|
|
||||||
|
int createVendor(VendorDto dto);
|
||||||
|
|
||||||
|
int deleteVendor(String id);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
57
src/main/java/com/no1/wms/vendor/VendorService.java
vendored
Normal file
57
src/main/java/com/no1/wms/vendor/VendorService.java
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class VendorService {
|
||||||
|
@Autowired
|
||||||
|
VendorMapper 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<VendorDto> list(int searchn, String search, int start, int perPage) {
|
||||||
|
|
||||||
|
System.out.println(searchn + search);
|
||||||
|
|
||||||
|
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.list(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VendorDto vendorOne(String id) {
|
||||||
|
return mapper.vendorOne(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateVendor(VendorDto dto) {
|
||||||
|
return mapper.updateVendor(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int createVendor(VendorDto dto) {
|
||||||
|
return mapper.createVendor(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int deleteVendor(String id) {
|
||||||
|
return mapper.deleteVendor(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,10 @@ public class WarehouseController {
|
|||||||
|
|
||||||
m.addAttribute("wlist", dto);
|
m.addAttribute("wlist", dto);
|
||||||
m.addAttribute("start", startRow + 1);
|
m.addAttribute("start", startRow + 1);
|
||||||
|
|
||||||
|
//테스트
|
||||||
|
System.out.println("list" + dto);
|
||||||
|
//테스트
|
||||||
|
|
||||||
int pageNum = 5;//보여질 페이지 번호 수
|
int pageNum = 5;//보여질 페이지 번호 수
|
||||||
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
int totalPages = count / perPage + (count % perPage > 0 ? 1 : 0); // 전체 페이지 수
|
||||||
@@ -42,6 +46,8 @@ public class WarehouseController {
|
|||||||
if (end > totalPages) {
|
if (end > totalPages) {
|
||||||
end = totalPages;
|
end = totalPages;
|
||||||
}
|
}
|
||||||
|
m.addAttribute("searchn", searchn);
|
||||||
|
m.addAttribute("search", search);
|
||||||
m.addAttribute("begin", begin);
|
m.addAttribute("begin", begin);
|
||||||
m.addAttribute("end", end);
|
m.addAttribute("end", end);
|
||||||
m.addAttribute("pageNum", pageNum);
|
m.addAttribute("pageNum", pageNum);
|
||||||
@@ -60,19 +66,16 @@ public class WarehouseController {
|
|||||||
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
//스톡서비스로 재고 상세페이지 출력 메서드 작성
|
||||||
|
|
||||||
WarehouseDto One = service.One(id);
|
WarehouseDto One = service.One(id);
|
||||||
System.out.println("one :: " + One);
|
|
||||||
log.debug("Osne테스트 :: " + One);
|
|
||||||
|
|
||||||
m.addAttribute("One", One);
|
m.addAttribute("One", One);
|
||||||
|
|
||||||
int warehouseOneCount = service.warehouseOneCount(searchn, search, id);
|
|
||||||
|
|
||||||
log.debug("warehouseOneCount테스트 :: " + warehouseOneCount);
|
|
||||||
|
|
||||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||||
int startRow = (page - 1) * perPage;
|
int startRow = (page - 1) * perPage;
|
||||||
m.addAttribute("start", startRow + 1);
|
m.addAttribute("start", startRow + 1);
|
||||||
|
|
||||||
|
int warehouseOneCount = service.warehouseOneCount(searchn, search, id);
|
||||||
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
|
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
|
||||||
m.addAttribute("wlist", dto);
|
m.addAttribute("wlist", dto);
|
||||||
System.out.println("list ::" + dto);
|
System.out.println("list ::" + dto);
|
||||||
@@ -86,6 +89,8 @@ public class WarehouseController {
|
|||||||
if (end > totalPages) {
|
if (end > totalPages) {
|
||||||
end = totalPages;
|
end = totalPages;
|
||||||
}
|
}
|
||||||
|
m.addAttribute("searchn", searchn);
|
||||||
|
m.addAttribute("search", search);
|
||||||
m.addAttribute("begin", begin);
|
m.addAttribute("begin", begin);
|
||||||
m.addAttribute("end", end);
|
m.addAttribute("end", end);
|
||||||
m.addAttribute("pageNum", pageNum);
|
m.addAttribute("pageNum", pageNum);
|
||||||
@@ -130,9 +135,13 @@ public class WarehouseController {
|
|||||||
// 생성 프로세스
|
// 생성 프로세스
|
||||||
@PostMapping("/warehouse/create_process")
|
@PostMapping("/warehouse/create_process")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String createProcess(WarehouseDto dto) {
|
public boolean createProcess(WarehouseDto dto) {
|
||||||
service.createWarehouse(dto);
|
int i = service.createWarehouse(dto);
|
||||||
return "redirect:list";// 글목록
|
if (i == 1) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,55 +3,188 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="com.no1.wms.stock.StockMapper">
|
<mapper namespace="com.no1.wms.stock.StockMapper">
|
||||||
|
|
||||||
<!-- select -->
|
|
||||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
|
||||||
select count(*) from stock left join warehouse on stock.warehouse_id = warehouse.id left join product on stock.product_id = product.id left join product_category on product.kan_code = product_category.kan_code
|
|
||||||
<where>
|
|
||||||
<choose>
|
|
||||||
<when test="searchn == 0"> stock.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
|
||||||
<when test="searchn == 1"> stock.activation = 1 and product_category.cls_Nm_4 like concat('%',#{search},'%') </when>
|
|
||||||
</choose>
|
|
||||||
</where>
|
|
||||||
order by stock.id desc limit #{start}, #{perPage}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="list" parameterType="map" resultType="java.lang.Integer">
|
<!-- select -->
|
||||||
select * from stock left join warehouse on stock.warehouse_id = warehouse.id left join product on stock.product_id = product.id left join product_category on product.kan_code = product_category.kan_code
|
<select id="count" parameterType="Map" resultType="java.lang.Integer">
|
||||||
<where>
|
select count(s.id)
|
||||||
<choose>
|
|
||||||
<when test="searchn == 0"> stock.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
|
||||||
<when test="searchn == 1"> stock.activation = 1 and product_category.cls_Nm_4 like concat('%',#{search},'%') </when>
|
|
||||||
</choose>
|
|
||||||
</where>
|
|
||||||
order by stock.id desc limit #{start}, #{perPage}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="stockOne" parameterType="String" resultType="com.no1.wms.stock.StockDto">
|
|
||||||
selct * from stock where id = #{id}
|
|
||||||
</select>
|
|
||||||
<!-- select -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- update -->
|
|
||||||
<update id="updateStock" parameterType="com.no1.wms.stock.StockDto">
|
|
||||||
update stock
|
|
||||||
set quantity = #{dto.quantity}
|
|
||||||
where id = #{dto.id}
|
|
||||||
</update>
|
|
||||||
<!-- update -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- insert -->
|
|
||||||
<insert id="createStock" parameterType="com.no1.wms.stock.StockDto">
|
|
||||||
insert into stock (id, warehouse_id, product_id, quantity, activation)
|
|
||||||
values (#{dto.id}, #{dto.warehouse_id}, #{dto.product_id}, #{dto.quantity}, 1)
|
|
||||||
</insert>
|
|
||||||
<!-- insert -->
|
|
||||||
|
|
||||||
<!-- delete -->
|
from stock s
|
||||||
<delete id="deleteStock" parameterType="String">
|
left join warehouse w on s.warehouse_id = w.id
|
||||||
delete from stock where no = #{id}
|
left join product p on s.product_id = p.id
|
||||||
</delete>
|
left join product_category c on p.kan_code = c.kan_code
|
||||||
<!-- delete -->
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="list" parameterType="Map" resultType="Map">
|
||||||
|
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName
|
||||||
|
|
||||||
|
from stock s
|
||||||
|
left join warehouse w on s.warehouse_id = w.id
|
||||||
|
left join product p on s.product_id = p.id
|
||||||
|
left join product_category c on p.kan_code = c.kan_code
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
order by s.id desc limit #{start}, #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="count2" parameterType="Map" resultType="java.lang.Integer">
|
||||||
|
select count(s.id)
|
||||||
|
|
||||||
|
from stock s
|
||||||
|
left join warehouse w on s.warehouse_id = w.id
|
||||||
|
left join product p on s.product_id = p.id
|
||||||
|
left join product_category c on p.kan_code = c.kan_code
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="list2" parameterType="Map" resultType="Map">
|
||||||
|
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName
|
||||||
|
|
||||||
|
from stock s
|
||||||
|
left join warehouse w on s.warehouse_id = w.id
|
||||||
|
left join product p on s.product_id = p.id
|
||||||
|
left join product_category c on p.kan_code = c.kan_code
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
order by s.id desc limit #{start}, #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="stockOne" parameterType="Map" resultType="Map">
|
||||||
|
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName, p.company_name, w.address, w.capacity, w.current_capacity
|
||||||
|
|
||||||
|
from stock s
|
||||||
|
left join warehouse w on s.warehouse_id = w.id
|
||||||
|
left join product p on s.product_id = p.id
|
||||||
|
left join product_category c on p.kan_code = c.kan_code
|
||||||
|
|
||||||
|
where s.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="productSelect" parameterType="Map" resultType="Map">
|
||||||
|
SELECT p.id as productId, name, company_name, cls_Nm_4
|
||||||
|
FROM product p
|
||||||
|
LEFT JOIN stock s ON s.product_id = p.id
|
||||||
|
left join product_category c on p.kan_code = c.kan_code
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> s.id IS NULL and p.activation = 1 and name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> s.id IS NULL and p.activation = 1 and cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 2"> s.id IS NULL and p.activation = 1 and company_name like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
order by name desc limit #{start}, #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="productCount" parameterType="Map" resultType="java.lang.Integer">
|
||||||
|
SELECT count(name)
|
||||||
|
FROM product p
|
||||||
|
LEFT JOIN stock s ON s.product_id = p.id
|
||||||
|
left join product_category c on p.kan_code = c.kan_code
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> s.id IS NULL and p.activation = 1 and name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> s.id IS NULL and p.activation = 1 and cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 2"> s.id IS NULL and p.activation = 1 and company_name like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="warehouseSelect" parameterType="Map" resultType="Map">
|
||||||
|
select w.id as warehouseId, w.name as warehouseName, capacity, current_capacity ,address
|
||||||
|
from warehouse w
|
||||||
|
left join stock s on s.warehouse_id = w.id
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
order by w.name desc limit #{start}, #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="warehouseCount" parameterType="Map" resultType="java.lang.Integer">
|
||||||
|
select count(w.id)
|
||||||
|
from warehouse w
|
||||||
|
left join stock s on s.warehouse_id = w.id
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<!-- select -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- update -->
|
||||||
|
<update id="updateStock" parameterType="com.no1.wms.stock.StockDto">
|
||||||
|
update stock
|
||||||
|
set warehouse_id = #{warehouseId}, quantity = #{quantityAdjustment}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateWarehousePlus" parameterType="com.no1.wms.stock.StockDto">
|
||||||
|
update warehouse w
|
||||||
|
left join stock s on w.id = s.warehouse_id
|
||||||
|
set w.current_capacity = w.current_capacity + #{quantity}
|
||||||
|
where w.id = #{warehouseId};
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateWarehouse" parameterType="com.no1.wms.stock.StockDto">
|
||||||
|
update warehouse w
|
||||||
|
left join stock s on w.id = s.warehouse_id
|
||||||
|
set w.current_capacity = w.current_capacity + (#{quantityAdjustment} - #{quantity})
|
||||||
|
where w.id = #{warehouseId};
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.stock.StockDto">
|
||||||
|
update warehouse
|
||||||
|
set current_capacity = current_capacity - #{quantity}
|
||||||
|
where id = #{warehouseId};
|
||||||
|
</update>
|
||||||
|
<!-- update -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- insert -->
|
||||||
|
<insert id="createStock" parameterType="com.no1.wms.stock.StockDto">
|
||||||
|
insert into stock (id, warehouse_id, product_id, quantity, activation)
|
||||||
|
values (UUID(), #{warehouseId}, #{productId}, #{quantity}, #{activation})
|
||||||
|
</insert>
|
||||||
|
<!-- insert -->
|
||||||
|
|
||||||
|
<!-- delete -->
|
||||||
|
<delete id="deleteStock" parameterType="com.no1.wms.stock.StockDto">
|
||||||
|
delete
|
||||||
|
from stock
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
|
<!-- delete -->
|
||||||
</mapper>
|
</mapper>
|
||||||
106
src/main/resources/mappers/VendorMapper.xml
Normal file
106
src/main/resources/mappers/VendorMapper.xml
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.no1.wms.vendor.VendorMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||||
|
select count(name)
|
||||||
|
|
||||||
|
from vendor
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> activation = 1 and name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> activation = 1 and president_telephone like concat('%',#{search},'%') </when>
|
||||||
|
<when test="searchn == 2"> activation = 1 and vendor_manager like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 3"> activation = 1 and vendor_manager_telephone like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="list" parameterType="map" resultType="VendorDto">
|
||||||
|
select id,
|
||||||
|
name,
|
||||||
|
president_name,
|
||||||
|
address,
|
||||||
|
registration_number,
|
||||||
|
email,
|
||||||
|
president_telephone,
|
||||||
|
vendor_manager,
|
||||||
|
vendor_manager_telephone,
|
||||||
|
main_product,
|
||||||
|
manager_id,
|
||||||
|
activation
|
||||||
|
|
||||||
|
from vendor
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="searchn == 0"> activation = 1 and name like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 1"> activation = 1 and president_telephone like concat('%',#{search},'%') </when>
|
||||||
|
<when test="searchn == 2"> activation = 1 and vendor_manager like concat('%',#{search},'%')</when>
|
||||||
|
<when test="searchn == 3"> activation = 1 and vendor_manager_telephone like concat('%',#{search},'%')</when>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
order by name desc limit #{start}, #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="vendorOne" parameterType="String" resultType="VendorDto">
|
||||||
|
select id,
|
||||||
|
name,
|
||||||
|
president_name,
|
||||||
|
address,
|
||||||
|
registration_number,
|
||||||
|
email,
|
||||||
|
president_telephone,
|
||||||
|
vendor_manager,
|
||||||
|
vendor_manager_telephone,
|
||||||
|
main_product,
|
||||||
|
manager_id,
|
||||||
|
activation
|
||||||
|
|
||||||
|
from vendor
|
||||||
|
|
||||||
|
where id = #{id}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- select -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- update -->
|
||||||
|
<update id="updateVendor" parameterType="VendorDto">
|
||||||
|
update vendor
|
||||||
|
set name = #{name},
|
||||||
|
president_name = #{president_name},
|
||||||
|
address = #{address},
|
||||||
|
registration_number = #{registration_number},
|
||||||
|
email = #{email},
|
||||||
|
president_telephone = #{president_telephone},
|
||||||
|
vendor_manager = #{vendor_manager},
|
||||||
|
vendor_manager_telephone = #{vendor_manager_telephone},
|
||||||
|
main_product = #{main_product},
|
||||||
|
manager_id = #{manager_id},
|
||||||
|
activation = #{activation}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
<!-- update -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- insert -->
|
||||||
|
<insert id="createVendor" parameterType="VendorDto">
|
||||||
|
insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation)
|
||||||
|
values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, #{activation})
|
||||||
|
</insert>
|
||||||
|
<!-- insert -->
|
||||||
|
|
||||||
|
<!-- delete -->
|
||||||
|
<delete id="deleteVendor" parameterType="String">
|
||||||
|
delete from vendor where id = #{id}
|
||||||
|
</delete>
|
||||||
|
<!-- delete -->
|
||||||
|
</mapper>
|
||||||
@@ -31,7 +31,15 @@
|
|||||||
<when test="searchn == 2"> w.activation = 1 and w.current_capacity like concat('%',#{search},'%')</when>
|
<when test="searchn == 2"> w.activation = 1 and w.current_capacity like concat('%',#{search},'%')</when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
order by w.id desc limit #{start}, #{perPage}
|
order by w.name ASC limit #{start}, #{perPage}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||||
|
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
||||||
|
|
||||||
|
from warehouse w
|
||||||
|
|
||||||
|
where w.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="warehouseOne" parameterType="Map" resultType="Map">
|
<select id="warehouseOne" parameterType="Map" resultType="Map">
|
||||||
@@ -43,8 +51,8 @@
|
|||||||
|
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
@@ -61,19 +69,12 @@
|
|||||||
|
|
||||||
<where>
|
<where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchn == 0"> w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||||
<when test="searchn == 1"> w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
|
||||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
|
||||||
|
|
||||||
from warehouse w
|
|
||||||
|
|
||||||
where w.id = #{dto.id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- select -->
|
<!-- select -->
|
||||||
|
|
||||||
@@ -84,13 +85,14 @@
|
|||||||
set capacity = #{capacity}, name = #{name}, address = #{address}
|
set capacity = #{capacity}, name = #{name}, address = #{address}
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- update -->
|
<!-- update -->
|
||||||
|
|
||||||
|
|
||||||
<!-- insert -->
|
<!-- insert -->
|
||||||
<insert id="createWarehouse" parameterType="com.no1.wms.warehouse.WarehouseDto">
|
<insert id="createWarehouse" parameterType="com.no1.wms.warehouse.WarehouseDto">
|
||||||
insert into warehouse (id, name, capacity, current_capacity as currentCapacity, manager_id as managerId, address, activation)
|
insert into warehouse (id, name, capacity, current_capacity, manager_id, address, activation)
|
||||||
values (UUID(), #{dto.name}, #{dto.capacity}, 0, #{dto.managerId}, #{dto.address}, 1)
|
values (UUID(), #{name}, #{capacity}, #{currentCapacity}, #{managerId}, #{address}, #{activation})
|
||||||
</insert>
|
</insert>
|
||||||
<!-- insert -->
|
<!-- insert -->
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,9 @@
|
|||||||
<div class="row row-buttons">
|
<div class="row row-buttons">
|
||||||
<div class="col-3 text-start">
|
<div class="col-3 text-start">
|
||||||
<!-- <img alt="엑셀이미지" src="엑셀이미지"> -->
|
<!-- <img alt="엑셀이미지" src="엑셀이미지"> -->
|
||||||
<button type="button" class="btn btn-success" id="uploadExcel">업로드</button>
|
<button type="button" class="btn btn-success" id="downlodeExcelForm">양식다운로드</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 d-flex justify-content-center">
|
<div class="col-6 d-flex justify-content-center">
|
||||||
<nav>
|
<nav>
|
||||||
@@ -97,6 +99,28 @@
|
|||||||
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- row row-buttons -->
|
</div><!-- row row-buttons -->
|
||||||
|
<div class="row row-buttons">
|
||||||
|
<form name="uplodeExcleForm" id="uplodeExcleForm" method="post" onsubmit="return _onSubmit();" action="/category/uplodeExcel" enctype="multipart/form-data" class="form-horizontal">
|
||||||
|
<div class="col-4 text-start">
|
||||||
|
<table id="datatable-scroller" class="table table-bordered tbl_Form">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th class="active" style="text-align:right"><label class="control-label" for="">파일 업로드</label></th>
|
||||||
|
<td>
|
||||||
|
<input type="file" name="file" id="file" accept=".xlsx, .xls"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 text-start">
|
||||||
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
|
<button type="submit" class="btn btn-success" id="uploadExcel">업로드</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form><!-- uplodeExcleForm -->
|
||||||
|
</div><!-- row row-buttons -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -113,6 +137,16 @@
|
|||||||
document.body.appendChild(form);
|
document.body.appendChild(form);
|
||||||
form.submit();
|
form.submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#downlodeExcelForm").on("click",function(){
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/category/downlodeCategoryForm";
|
||||||
|
form.method = "GET";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("body").on("click", ".detailTr", function(){
|
$("body").on("click", ".detailTr", function(){
|
||||||
var kan_code = $(this).data("kan_code");
|
var kan_code = $(this).data("kan_code");
|
||||||
@@ -166,8 +200,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var msg = "${resMap.msg}";
|
||||||
|
if (msg != "") alert(msg);
|
||||||
|
|
||||||
});//ready
|
});//ready
|
||||||
|
|
||||||
|
|
||||||
function pagingFunction(clickedId){
|
function pagingFunction(clickedId){
|
||||||
var searchn1 = $("#searchn1").val();
|
var searchn1 = $("#searchn1").val();
|
||||||
var search1 = $("#search1").val();
|
var search1 = $("#search1").val();
|
||||||
@@ -196,7 +235,27 @@
|
|||||||
|
|
||||||
document.body.appendChild(form);
|
document.body.appendChild(form);
|
||||||
form.submit();
|
form.submit();
|
||||||
}
|
|
||||||
|
}//pagingFunction
|
||||||
|
|
||||||
|
|
||||||
|
function _onSubmit(){
|
||||||
|
|
||||||
|
if($("#file").val() == ""){
|
||||||
|
alert("파일을 업로드해주세요.");
|
||||||
|
$("#file").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<h1>제품 카테고리 상세페이지</h1>
|
<h1>제품 카테고리 상세페이지</h1>
|
||||||
<div class="col-10" style="text-align: right;">
|
<div class="col-10" style="text-align: right;">
|
||||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show_button">삭제</button>
|
<button type="button" class="btn btn-danger" onclick="goDelete()">삭제</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,8 +91,6 @@
|
|||||||
form.submit();
|
form.submit();
|
||||||
|
|
||||||
})//modifyBtn click
|
})//modifyBtn click
|
||||||
|
|
||||||
yesNoModal.yesFunction = deleteCategoryFunction;
|
|
||||||
});//ready
|
});//ready
|
||||||
|
|
||||||
|
|
||||||
@@ -123,6 +121,15 @@
|
|||||||
}//deleteCategoryFunction
|
}//deleteCategoryFunction
|
||||||
|
|
||||||
|
|
||||||
|
function goDelete(){
|
||||||
|
yesNoModalTextDefine("카테고리 삭제", "해당 카테고리를 삭제하시겠습니까?");
|
||||||
|
$("#yesNoModalLabel").text(yesNoModal.title);
|
||||||
|
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||||
|
yesNoModal.yesFunction = deleteCategoryFunction;
|
||||||
|
yesNoModalBootStrap.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,77 +5,54 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>test상세페이지</title>
|
<title>test상세페이지</title>
|
||||||
<style type="text/css">
|
|
||||||
.col-centered{
|
|
||||||
margin: 0 auto;
|
|
||||||
float: none;
|
|
||||||
}
|
|
||||||
.col-margin-left-32{
|
|
||||||
margin-left: 32%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<div class="row row-buttons">
|
||||||
test success
|
<form name="uplodeExcleForm" id="uplodeExcleForm" method="post" onsubmit="return _onSubmit();" action="/category/uplodeExcel" enctype="multipart/form-data" class="form-horizontal">
|
||||||
<br>
|
<div class="col-4 text-start">
|
||||||
<hr>
|
<table id="datatable-scroller" class="table table-bordered tbl_Form">
|
||||||
<c:forEach items="${dto }" var="item">
|
<tbody>
|
||||||
${item.kan_code} : ${item.cls_nm_1} > ${item.cls_nm_2} > ${item.cls_nm_3} > ${item.cls_nm_4}<br>
|
<tr>
|
||||||
활성화 : ${item.activation}<br>
|
<th class="active" style="text-align:right"><label class="control-label" for="">파일 업로드</label></th>
|
||||||
<hr>
|
<td>
|
||||||
</c:forEach>
|
<input type="file" name="file" id="file" accept=".xlsx, .xls"/>
|
||||||
코드테스트 버튼 :
|
</td>
|
||||||
<div class="input-group mb-3 w-40 col-centered">
|
</tr>
|
||||||
<input type="text" name="kan_code" id="kan_code" class="form-control"
|
</tbody>
|
||||||
placeholder="KAN 분류코드" aria-label="KAN 분류코드"
|
|
||||||
aria-describedby="button-addon2">
|
</table>
|
||||||
<button class="btn btn-outline-secondary" id="checkKan"
|
</div>
|
||||||
style="background-color: #FF5E5E;" type="button" id="button-addon2">중복확인</button>
|
<div class="col-4 text-start">
|
||||||
</div>
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<button type="submit" class="btn btn-success" id="uploadExcel">업로드</button>
|
||||||
<script>
|
</div>
|
||||||
$(document).ready(function() {
|
</div>
|
||||||
$("#checkKan").on("click", function() {
|
</form><!-- uplodeExcleForm -->
|
||||||
// 중복 클릭 방지를 위해 버튼을 비활성화
|
</div><!-- row row-buttons -->
|
||||||
$("#checkKan").prop("disabled", true);
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script>
|
||||||
let kanCode = $("#kan_code").val();
|
|
||||||
|
|
||||||
if (!kanCode) {
|
|
||||||
alert("KAN 분류코드를 입력하세요.");
|
|
||||||
$("#kan_code").focus();
|
|
||||||
// 버튼 다시 활성화
|
|
||||||
$("#checkKan").prop("disabled", false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: "/category/checkKancode",
|
|
||||||
type: "post",
|
|
||||||
data: {"kan_code": kanCode},
|
|
||||||
datatype:"text"
|
|
||||||
}).done(function(data) {
|
|
||||||
if (data == "") {
|
|
||||||
$("#checkKan").css("background-color", "#4CAF50"); // 파란색 배경으로 변경
|
|
||||||
$("#checkKan").text("사용가능"); // 버튼 텍스트 변경
|
|
||||||
|
|
||||||
$("#checkKan").append("<input type='hidden' id='kan_chack' value='1'>");
|
|
||||||
} else {
|
|
||||||
$("#checkKan").css("background-color", "#FF5E5E"); // 원래의 빨간색 배경으로 변경
|
|
||||||
$("#checkKan").text("사용불가"); // 버튼 텍스트 변경
|
|
||||||
}
|
|
||||||
}).fail(function() {
|
|
||||||
alert("오류가 발생했습니다.");
|
|
||||||
}).always(function() {
|
|
||||||
// Ajax 요청 완료 후 버튼 다시 활성화
|
|
||||||
$("#checkKan").prop("disabled", false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
|
||||||
|
var msg = "${resMap.msg}";
|
||||||
|
if (msg != "") alert(msg);
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
function _onSubmit(){
|
||||||
|
|
||||||
|
if($("#file").val() == ""){
|
||||||
|
alert("파일을 업로드해주세요.");
|
||||||
|
$("#file").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
32
src/main/webapp/WEB-INF/views/main.jsp
Normal file
32
src/main/webapp/WEB-INF/views/main.jsp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Insert title here</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<!-- 첫 번째 공간 -->
|
||||||
|
달력
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<!-- 두 번째 공간 -->
|
||||||
|
로고
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<!-- 세 번째 공간 -->
|
||||||
|
부족한 재고
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<!-- 네 번째 공간 -->
|
||||||
|
개시판(공지사항)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function onSearch(){
|
|
||||||
//
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSelectAuth(tag){
|
function onSelect(tag){
|
||||||
const $tag = $(tag);
|
const $tag = $(tag);
|
||||||
const tid = $tag.data('tid');
|
const tid = $tag.data('tid');
|
||||||
const name = $tag.data('tname');
|
const name = $tag.data('tname');
|
||||||
@@ -14,7 +11,70 @@
|
|||||||
$("#cls_nm_4").val(name);
|
$("#cls_nm_4").val(name);
|
||||||
$("#kan_code").val(tid);
|
$("#kan_code").val(tid);
|
||||||
hideSearchModal();
|
hideSearchModal();
|
||||||
}
|
}//onSelect
|
||||||
|
|
||||||
|
function pagingFunction(clickedId){
|
||||||
|
var title = "분류 검색";
|
||||||
|
var val = "category";
|
||||||
|
var searchn = $("#searchn1").val();
|
||||||
|
var search = $("#search1").val();
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
const data = { name : val,
|
||||||
|
searchn : searchn,
|
||||||
|
search : search,
|
||||||
|
p : parseInt(clickedId)
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/product/show_modal', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}//pagingFunction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#searchBtn").on("click", function(){
|
||||||
|
var title = "분류 검색";
|
||||||
|
var val = "category";
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
|
||||||
|
const data = { name : val,
|
||||||
|
searchn : searchn,
|
||||||
|
search : search,
|
||||||
|
p : 1
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/product/show_modal', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})//searchBtn
|
||||||
|
|
||||||
|
});//ready
|
||||||
</script>
|
</script>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -59,11 +119,32 @@
|
|||||||
<td>${dto.cls_nm_3 }</td>
|
<td>${dto.cls_nm_3 }</td>
|
||||||
<td>${dto.cls_nm_4 }</td>
|
<td>${dto.cls_nm_4 }</td>
|
||||||
<td>${dto.kan_code }</td>
|
<td>${dto.kan_code }</td>
|
||||||
<td><button data-tid="${dto.kan_code}" data-tname="${dto.cls_nm_4}" class="btn btn-primary" onclick="onSelectAuth(this)">선택</button></td>
|
<td><button data-tid="${dto.kan_code}" data-tname="${dto.cls_nm_4}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link " onclick="pagingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
71
src/main/webapp/WEB-INF/views/modal/price.jsp
Normal file
71
src/main/webapp/WEB-INF/views/modal/price.jsp
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<%@ 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"%>
|
||||||
|
<script>
|
||||||
|
function onSearch(){
|
||||||
|
//
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSelect(tag){
|
||||||
|
const $tag = $(tag);
|
||||||
|
const tid = $tag.data('tid');
|
||||||
|
const name = $tag.data('tname');
|
||||||
|
|
||||||
|
<!-- 수정해야할 부분 -->
|
||||||
|
$("#productName").val(name);
|
||||||
|
$("#product_id").val(tid);
|
||||||
|
hideSearchModal();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div id="div_auth_search" class="text-end">
|
||||||
|
<div class="input-group mb-3 w-50 col-centered">
|
||||||
|
<div class="w-30">
|
||||||
|
<select class="form-select" name="searchn" id="searchn">
|
||||||
|
<option selected="selected" value="0">제품명</option>
|
||||||
|
<option value="1">가격</option>
|
||||||
|
<option value="2">등록날짜</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
<input type="hidden" id="searchn1" value="${searchn}">
|
||||||
|
<input type="hidden" id="search1" value="${search}">
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>번호</th>
|
||||||
|
<th>제품명</th>
|
||||||
|
<th>가격</th>
|
||||||
|
<th>등록날짜</th>
|
||||||
|
<th>담당자</th>
|
||||||
|
<th>선택</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${list }" var="dto">
|
||||||
|
<tr class="detailTr" data-product_id="${dto.id}" >
|
||||||
|
<td>${status.count }</td>
|
||||||
|
<td>${dto.productDto.name }</td>
|
||||||
|
<td>${dto.price }</td>
|
||||||
|
<td><fmt:formatDate value="${dto.registration_date }"
|
||||||
|
dateStyle="short" /></td>
|
||||||
|
<td>${dto.accountDto.name }</td>
|
||||||
|
<!-- 수정해야할 부분 -->
|
||||||
|
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function onSearch(){
|
|
||||||
//
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSelectAuth(tag){
|
function onSelect(tag){
|
||||||
const $tag = $(tag);
|
const $tag = $(tag);
|
||||||
const tid = $tag.data('tid');
|
const tid = $tag.data('tid');
|
||||||
const name = $tag.data('tname');
|
const name = $tag.data('tname');
|
||||||
@@ -15,7 +12,67 @@
|
|||||||
$("#productName").val(name);
|
$("#productName").val(name);
|
||||||
$("#product_id").val(tid);
|
$("#product_id").val(tid);
|
||||||
hideSearchModal();
|
hideSearchModal();
|
||||||
}
|
}//onSelect
|
||||||
|
|
||||||
|
function pagingFunction(clickedId){
|
||||||
|
var title = "제품 검색";
|
||||||
|
var val = "product";
|
||||||
|
var searchn = $("#searchn1").val();
|
||||||
|
var search = $("#search1").val();
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
const data = { name : val,
|
||||||
|
searchn : searchn,
|
||||||
|
search : search,
|
||||||
|
p : parseInt(clickedId)
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/price/show_modal', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}//pagingFunction
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#searchBtn").on("click", function(){
|
||||||
|
var title = "제품 검색";
|
||||||
|
var val = "product";
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
|
||||||
|
const data = { name : val,
|
||||||
|
searchn : searchn,
|
||||||
|
search : search,
|
||||||
|
p : 1
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/price/show_modal', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})//searchBtn
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -62,11 +119,32 @@
|
|||||||
<td><fmt:formatDate value="${dto.registration_date }"
|
<td><fmt:formatDate value="${dto.registration_date }"
|
||||||
dateStyle="short" /></td>
|
dateStyle="short" /></td>
|
||||||
<td>${dto.accountDto.name }</td>
|
<td>${dto.accountDto.name }</td>
|
||||||
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelectAuth(this)">선택</button></td>
|
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link " onclick="pagingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function onSelect(tag) {
|
||||||
|
const $tag = $(tag);
|
||||||
|
|
||||||
|
const tname = $tag.data('tname');
|
||||||
|
const tid = $tag.data('tid');
|
||||||
|
const tcategory = $tag.data('tcategory');
|
||||||
|
const tcompany_name = $tag.data('tcompany_name');
|
||||||
|
|
||||||
|
$("#stock_pro_name").val(tname);
|
||||||
|
$("#product_id").val(tid);
|
||||||
|
$("#stock_category_name").val(tcategory);
|
||||||
|
$("#stock_company_name_name").val(tcompany_name);
|
||||||
|
|
||||||
|
hideSearchModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// 검색 기능
|
||||||
|
$("#searchBtn").on("click", function () {
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/stock/show_modal",
|
||||||
|
data: {
|
||||||
|
searchn: searchn,
|
||||||
|
search: search,
|
||||||
|
p: 1,
|
||||||
|
name: "product_category_company_search"
|
||||||
|
},
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function pageingFunction(clickedId) {
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/stock/show_modal",
|
||||||
|
data: {
|
||||||
|
searchn: searchn,
|
||||||
|
search: search,
|
||||||
|
p: clickedId,
|
||||||
|
name: "product_category_company_search"
|
||||||
|
},
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div id="div_product_category_company_search" class="text-end">
|
||||||
|
<div class="input-group mb-3 w-50 col-centered">
|
||||||
|
<div class="w-30">
|
||||||
|
<select class="form-select" name="searchn" id="searchn">
|
||||||
|
<option value="0">제품명</option>
|
||||||
|
<option value="1">카테고리</option>
|
||||||
|
<option value="2">제조사</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="search" name="search" class="form-control" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
<input type="hidden" id="searchn1" value="${searchn}">
|
||||||
|
<input type="hidden" id="search1" value="${search}">
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-centered">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th class="col-1"></th>
|
||||||
|
<th class="col-3">제품</th>
|
||||||
|
<th class="col-3">카테고리</th>
|
||||||
|
<th class="col-3">제조사</th>
|
||||||
|
<th class="col-1"></th>
|
||||||
|
<th class="col-1"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${list }" var="dto">
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>${dto.name }</td>
|
||||||
|
<td>${dto.cls_Nm_4 }</td>
|
||||||
|
<td>${dto.company_name }</td>
|
||||||
|
<td>
|
||||||
|
<button data-tid="${dto.productId}"
|
||||||
|
data-tname="${dto.name}"
|
||||||
|
data-tcategory="${dto.cls_Nm_4}"
|
||||||
|
data-tcompany_name="${dto.company_name}"
|
||||||
|
class="btn btn-primary" onclick="onSelect(this)">선택
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="row row-buttons">
|
||||||
|
|
||||||
|
<div class="col-12 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||||
|
id="${begin - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link "
|
||||||
|
onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||||
|
id="${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><!-- row row-buttons -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
147
src/main/webapp/WEB-INF/views/modal/vendor.jsp
Normal file
147
src/main/webapp/WEB-INF/views/modal/vendor.jsp
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<%@ 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"%>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function onSelect(tag){
|
||||||
|
const $tag = $(tag);
|
||||||
|
const tid = $tag.data('tid');
|
||||||
|
const name = $tag.data('tname');
|
||||||
|
|
||||||
|
$("#vendor").val(name);
|
||||||
|
$("#vendor_id").val(tid);
|
||||||
|
hideSearchModal();
|
||||||
|
}//onSelect
|
||||||
|
|
||||||
|
function pagingFunction(clickedId){
|
||||||
|
var title = "거래처 검색";
|
||||||
|
var val = "vendor";
|
||||||
|
var searchn = $("#searchn1").val();
|
||||||
|
var search = $("#search1").val();
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
const data = { name : val,
|
||||||
|
searchn : searchn,
|
||||||
|
search : search,
|
||||||
|
p : parseInt(clickedId)
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/product/show_modal2', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}//pagingFunction
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#searchBtn").on("click", function(){
|
||||||
|
var title = "거래처 검색";
|
||||||
|
var val = "vendor";
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
|
||||||
|
const data = { name : val,
|
||||||
|
searchn : searchn,
|
||||||
|
search : search,
|
||||||
|
p : 1
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/product/show_modal2', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})//searchBtn
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div id="div_auth_search" class="text-end">
|
||||||
|
<div class="input-group mb-3 w-50 col-centered">
|
||||||
|
<div class="w-30">
|
||||||
|
<select class="form-select" name="searchn" id="searchn">
|
||||||
|
<option selected="selected" value="0">업체명</option>
|
||||||
|
<option value="1">업체명</option>
|
||||||
|
<option value="2">거래처 담당자</option>
|
||||||
|
<option value="3">거래처 담당자 전화번호</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
<input type="hidden" id="searchn1" value="${searchn}">
|
||||||
|
<input type="hidden" id="search1" value="${search}">
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>번호</th>
|
||||||
|
<th>업체명</th>
|
||||||
|
<th>대표번호</th>
|
||||||
|
<th>거래처 담당자</th>
|
||||||
|
<th>거래처 담당자 전화번호</th>
|
||||||
|
<th>선택</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${vlist }" var="dto">
|
||||||
|
<tr class="detailTr" data-product_id="${dto.id}" >
|
||||||
|
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
|
<td>${dto.name }</td>
|
||||||
|
<td>${dto.president_telephone }</td>
|
||||||
|
<td>${dto.vendor_manager }</td>
|
||||||
|
<td>${dto.vendor_manager_telephone }</td>
|
||||||
|
<td><button data-tid="${dto.id}" data-tname="${dto.name}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link " onclick="pagingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pagingFunction(this.id)" id="${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function onSelect(tag) {
|
||||||
|
const $tag = $(tag);
|
||||||
|
|
||||||
|
const id = $tag.data('id');
|
||||||
|
const name = $tag.data('name');
|
||||||
|
const address = $tag.data('address');
|
||||||
|
const capacity = $tag.data('capacity');
|
||||||
|
const remainingcapacity = $tag.data('remainingcapacity');
|
||||||
|
|
||||||
|
|
||||||
|
$("#warehouse_id").val(id);
|
||||||
|
$("#warehouse_name").val(name);
|
||||||
|
$("#Address_name").val(address);
|
||||||
|
$("#Capacity_name").val(capacity);
|
||||||
|
$("#remainingcapacity").val(remainingcapacity);
|
||||||
|
|
||||||
|
hideSearchModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// 검색 기능
|
||||||
|
$("#searchBtn").on("click", function () {
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/stock/show_modal",
|
||||||
|
data: {
|
||||||
|
searchn: searchn,
|
||||||
|
search: search,
|
||||||
|
p: 1,
|
||||||
|
name: "warehouse_capacity_currentCapacity"
|
||||||
|
},
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function pageingFunction(clickedId) {
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/stock/show_modal",
|
||||||
|
data: {
|
||||||
|
searchn: searchn,
|
||||||
|
search: search,
|
||||||
|
p: clickedId,
|
||||||
|
name: "warehouse_capacity_currentCapacity"
|
||||||
|
},
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container" id="pageingData">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div id="div_warehouse_capacity_currentCapacity" class="text-end">
|
||||||
|
<div class="input-group mb-3 w-50 col-centered">
|
||||||
|
<div class="w-30">
|
||||||
|
<select class="form-select" name="searchn" id="searchn">
|
||||||
|
<option value="0">창고명</option>
|
||||||
|
<option value="1">지역</option>
|
||||||
|
<option value="2">용적</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="search" name="search" class="form-control" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th class="col-1"></th>
|
||||||
|
<th class="col-2">창고명</th>
|
||||||
|
<th class="col-2">지역</th>
|
||||||
|
<th class="col-2">용적</th>
|
||||||
|
<th class="col-2">잔여 용량</th>
|
||||||
|
<th class="col-1"></th>
|
||||||
|
<th class="col-1"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${list }" var="dto">
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td>${dto.warehouseName }</td>
|
||||||
|
<td>${dto.address }</td>
|
||||||
|
<td>${dto.capacity }</td>
|
||||||
|
<td>${dto.capacity - dto.current_capacity }</td>
|
||||||
|
<td>
|
||||||
|
<button data-id="${dto.warehouseId}"
|
||||||
|
data-name="${dto.warehouseName}"
|
||||||
|
data-address="${dto.address}"
|
||||||
|
data-capacity="${dto.capacity}"
|
||||||
|
data-remainingcapacity="${dto.capacity - dto.current_capacity }"
|
||||||
|
class="btn btn-primary" onclick="onSelect(this)">선택
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="row row-buttons">
|
||||||
|
|
||||||
|
<div class="col-12 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||||
|
id="${begin - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link "
|
||||||
|
onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)"
|
||||||
|
id="${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><!-- row row-buttons -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<h1>제품 상세페이지</h1>
|
<h1>제품 상세페이지</h1>
|
||||||
<div class="col-10" style="text-align: right;">
|
<div class="col-10" style="text-align: right;">
|
||||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show_button">삭제</button>
|
<button type="button" class="btn btn-danger" onclick="goDelete()">삭제</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -118,6 +118,16 @@
|
|||||||
});
|
});
|
||||||
}//deletePriceFunction
|
}//deletePriceFunction
|
||||||
|
|
||||||
|
function goDelete(){
|
||||||
|
yesNoModalTextDefine("제품가격 삭제", "해당 제품가격을 삭제하시겠습니까?");
|
||||||
|
$("#yesNoModalLabel").text(yesNoModal.title);
|
||||||
|
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||||
|
yesNoModal.yesFunction = deletePriceFunction;
|
||||||
|
yesNoModalBootStrap.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -57,17 +57,15 @@
|
|||||||
<span class="input-group-text" id="basic-addon4">거래처</span>
|
<span class="input-group-text" id="basic-addon4">거래처</span>
|
||||||
<input type="text" name="vendor" id="vendor" class="form-control"
|
<input type="text" name="vendor" id="vendor" class="form-control"
|
||||||
placeholder="거래처를 입력하세요" aria-label="거래처"
|
placeholder="거래처를 입력하세요" aria-label="거래처"
|
||||||
aria-describedby="button-addon2">
|
aria-describedby="button-addon2" readonly>
|
||||||
<button class="btn btn-outline-secondary rounded-end" id="searchVendor"
|
<button class="btn btn-outline-secondary rounded-end" id="searchVendor"
|
||||||
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal2('거래처 검색','vendor')">검색</button>
|
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal2('거래처 검색','vendor')">검색</button>
|
||||||
<input type='hidden' id='searchVendorChack' value='0'>
|
<input type='hidden' id="vendor_id" value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 추후 수정 -->
|
<!-- 추후 수정 -->
|
||||||
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006">
|
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006">
|
||||||
<input type='hidden' id="vendor_id" value="52f16bb8-aeb9-11ee-935d-0242ac110006">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 추후 수정 -->
|
<!-- 추후 수정 -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -190,7 +188,7 @@
|
|||||||
const data = { name : val};
|
const data = { name : val};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'post', // 타입 (get, post, put 등등)
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
url : '/category/show_modal', // 요청할 서버url
|
url : '/product/show_modal2', // 요청할 서버url
|
||||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
data : data,
|
data : data,
|
||||||
success : function(result) { // 결과 성공 콜백함수
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<h1>제품 상세페이지</h1>
|
<h1>제품 상세페이지</h1>
|
||||||
<div class="col-10" style="text-align: right;">
|
<div class="col-10" style="text-align: right;">
|
||||||
<button type="button" class="btn btn-danger" id="yes_no_modal_show_button">삭제</button>
|
<button type="button" class="btn btn-danger" onclick="goDelete()">삭제</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -128,7 +128,15 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
}//deleteProductFunction
|
}//deleteProductFunction
|
||||||
|
function goDelete(){
|
||||||
|
yesNoModalTextDefine("제품 삭제", "해당 제품을 삭제하시겠습니까?");
|
||||||
|
$("#yesNoModalLabel").text(yesNoModal.title);
|
||||||
|
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||||
|
yesNoModal.yesFunction = deleteProductFunction;
|
||||||
|
yesNoModalBootStrap.show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -42,15 +42,15 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-3 w-40 col-centered">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span class="input-group-text" id="basic-addon4">거래처</span>
|
<span class="input-group-text" id="basic-addon4">거래처</span>
|
||||||
<input type="text" class="form-control" name="newVendor" placeholder="거래처를 입력해도 바뀌는 건 없습니다."
|
<input type="text" name="vendor" id="vendor" class="form-control"
|
||||||
aria-label="거래처" id="vendor" value="${dto.vendorDto.name }">
|
placeholder="거래처를 입력하세요" aria-label="거래처"
|
||||||
|
aria-describedby="button-addon2" value="${dto.vendorDto.name }" readonly>
|
||||||
<button class="btn btn-outline-secondary rounded-end" id="searchVendor"
|
<button class="btn btn-outline-secondary rounded-end" id="searchVendor"
|
||||||
style="background-color:#FF5E5E;" type="button" >검색</button>
|
style="background-color:#FF5E5E;" type="button" onclick="showSearchModal2('거래처 검색','vendor')">검색</button>
|
||||||
<input type='hidden' id='searchVendorChack' value='0'>
|
<input type='hidden' id="vendor_id" value="${dto.vendor_id }">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-3 w-40 col-centered">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
<span class="input-group-text" id="basic-addon5">등록날짜</span>
|
<span class="input-group-text" id="basic-addon5">등록날짜</span>
|
||||||
@@ -61,9 +61,7 @@
|
|||||||
<input type='hidden' id="id" value="${dto.id }">
|
<input type='hidden' id="id" value="${dto.id }">
|
||||||
<!-- 추후 수정 -->
|
<!-- 추후 수정 -->
|
||||||
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006">
|
<input type='hidden' id="manager_id" value="83bdda69-ae95-11ee-935d-0242ac110006">
|
||||||
<input type='hidden' id="vendor_id" value="${dto.vendor_id }">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 추후 수정 -->
|
<!-- 추후 수정 -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -188,7 +186,24 @@
|
|||||||
alert(error)
|
alert(error)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}//showSearchModal
|
||||||
|
function showSearchModal2(title, val){
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
const data = { name : val};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/product/show_modal2', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}//showSearchModal2
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,68 +1,186 @@
|
|||||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<div class="mt-5 mb-5 text-center">
|
||||||
<html>
|
<h1>재고 생성</h1>
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>재고 생성</title>
|
|
||||||
<style type="text/css">
|
|
||||||
.header {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class = "container" >
|
|
||||||
<div class="header">
|
|
||||||
<h1>재고 관리 생성</h1>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class = "row">
|
|
||||||
<div class = "col-6">
|
|
||||||
<form>
|
|
||||||
<input type="text" name="search" maxlength="50" readonly/>
|
|
||||||
<input type="submit" class="btn btn-primary" id = "search_modal_show_button" value="검색" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="container" style="text-align: center">
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
|
||||||
|
<input type='hidden' id="activation" value="1">
|
||||||
|
|
||||||
|
|
||||||
|
<!--제품 관련 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Product_label' class="input-group-text">제품</span>
|
||||||
|
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색">
|
||||||
|
<input hidden name="ProductName" id="product_id" value="${dto.product_id}">
|
||||||
|
<button id="product_search_button" class="btn-primary btn" onclick="showSearchModals('제품 검색','product_category_company_search')">검색</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||||
|
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||||
|
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--창고 관련 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||||
|
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색">
|
||||||
|
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouse_id}">
|
||||||
|
<button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Address_label' class="input-group-text">주소</span>
|
||||||
|
<input readonly id="Address_name" type="text" class="form-control" placeholder="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Capacity_label' class="input-group-text">용적</span>
|
||||||
|
<input readonly id="Capacity_name" type="text" class="form-control" placeholder="">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='RemainingCapacity_label' class="input-group-text">잔여 용량</span>
|
||||||
|
<input readonly id="remainingcapacity" type="text" placeholder="" value="${dto.capacity - dto.current_capacity}" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--적재할 상품의 재고수-->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon4">재고량</span>
|
||||||
|
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||||
|
placeholder="재고량을 입력하세요" aria-label="재고량" value="${dto.quantity }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="modal fade" id="search_modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog modal-dialog-centered modal-xl" >
|
|
||||||
<div class="modal-content" id="search_modal_content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h1 class="modal-title fs-5" id="searchModalLabel">재고명 검색</h1>
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body" id="search_modal_body">
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 ">
|
||||||
|
<div class="w-40 col-centered" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-success" id="submitBtn">생성</button>
|
||||||
|
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
<script src="utils.js" type="text/javascript"></script>
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
function showSearchModals(title, val){
|
||||||
//검색 팝업 모달 관련
|
$("#searchModalLabel").text(title);
|
||||||
const searchModalBootStrap = new bootstrap.Modal("#search_modal");
|
const data = { name : val};
|
||||||
$("#search_modal_show_button").on("click", function(){
|
$.ajax({
|
||||||
searchModalBootStrap.show();
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
});
|
url : '/stock/show_modal', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
/*
|
data : data,
|
||||||
* 검색 팝업 모달 닫는 함수
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
*/
|
$("#search_modal_body").html(result);
|
||||||
function hideSearchModal(){
|
searchModalBootStrap.show();
|
||||||
searchModalBootStrap.hide();
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//검색 팝업 모달 관련 끝
|
$(document).ready(function () {
|
||||||
</script>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
$("#submitBtn").on("click", function () {
|
||||||
|
var product_id = $("#product_id").val();
|
||||||
|
var warehouse_id = $("#warehouse_id").val();
|
||||||
|
var quantity = $("#quantity").val();
|
||||||
|
var activation = $("#activation").val();
|
||||||
|
var remainingcapacity = $("#remainingcapacity").val();
|
||||||
|
|
||||||
|
if (!product_id) {
|
||||||
|
alert("제품을 선택해야 합니다.");
|
||||||
|
$("#product_id").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!warehouse_id) {
|
||||||
|
alert("적재할 창고를 선택해야 합니다.");
|
||||||
|
$("#warehouse_id").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!quantity) {
|
||||||
|
alert("재고량를 입력해야 합니다.");
|
||||||
|
$("#quantity").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quantity > remainingcapacity) {
|
||||||
|
alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다.");
|
||||||
|
$("#quantity").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/stock/create_process",
|
||||||
|
type: "post",
|
||||||
|
data: {
|
||||||
|
"productId": product_id,
|
||||||
|
"warehouseId": warehouse_id,
|
||||||
|
"quantity": quantity,
|
||||||
|
"activation": activation
|
||||||
|
|
||||||
|
},
|
||||||
|
datatype: "json"
|
||||||
|
}).done(function (data) {
|
||||||
|
if (data == true) {
|
||||||
|
alert("재고 정보가 생성되었습니다.");
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/read";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "name";
|
||||||
|
input.value = name;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
window.location.href = "/stock/list";
|
||||||
|
} else {
|
||||||
|
alert("재고 정보 생성에 실패하였습니다.");
|
||||||
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function () {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#cancelBtn").on("click", function () {
|
||||||
|
$(location).attr("href", "/stock/list");
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -1,121 +1,388 @@
|
|||||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>재고 리스트</title>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<style type="text/css">
|
<script src="base.js"></script>
|
||||||
.header {
|
<link rel="stylesheet" href="base.css">
|
||||||
text-align: center;
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||||
}
|
<script src="https://unpkg.com/feather-icons"></script>
|
||||||
</style>
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>재고 관리</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
<div class="header">
|
<h1>재고 관리</h1>
|
||||||
<h1>재고 리스트</h1>
|
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<!--탭키명 -->
|
|
||||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
|
||||||
<li class="nav-item" role="presentation">
|
|
||||||
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">
|
|
||||||
재고
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" role="presentation">
|
|
||||||
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">
|
|
||||||
부족한 재고
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="tab-content" id="myTabContent">
|
|
||||||
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
|
||||||
<div id="search" align="center">
|
|
||||||
<form action="search">
|
|
||||||
<select name="searchn">
|
|
||||||
<option value="0">제품명</option>
|
|
||||||
<option value="1">카테고리</option>
|
|
||||||
</select>
|
|
||||||
<input type="text" name="search" maxlength="50"/>
|
|
||||||
<input type="submit" class="btn btn-primary" value="검색" />
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--재고 리스트 -->
|
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||||
<c:if test="${count != 0 }">
|
<li class="nav-item" role="presentation">
|
||||||
<table align="center">
|
<button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">재고</button>
|
||||||
<tr>
|
</li>
|
||||||
<th>번호</th>
|
<li class="nav-item" role="presentation">
|
||||||
<th>제품명</th>
|
<button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">부족한 재고</button>
|
||||||
<th>창고명</th>
|
</li>
|
||||||
</tr>
|
</ul>
|
||||||
<c:forEach items="${list}" var="stock">
|
<div class="tab-content" id="myTabContent">
|
||||||
<tr>
|
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
||||||
<td><a href ="read/${stock.id}">${stock.id}</a></td>
|
<div class="container-fluid">
|
||||||
<td>${stock.product_name }</td>
|
<div class="col-12">
|
||||||
<td>${stock.warehouse_name }</td>
|
<form>
|
||||||
</tr>
|
<div class="input-group mb-3 w-30 col-centered">
|
||||||
</c:forEach>
|
<div class="w-25">
|
||||||
</table>
|
<select class="form-select" name="searchn" id="searchn">
|
||||||
|
<option value="0">제품명</option>
|
||||||
|
<option value="1">카테고리</option>
|
||||||
|
<option value="2">재고수</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||||
|
|
||||||
<!-- 엑셀 다운로드-->
|
<!-- 페이징작업용 -->
|
||||||
<div class="excelButton" align="left">
|
<input type="hidden" id="searchn1" value="${searchn}">
|
||||||
<button id="excelButton" value="excelButton">다운로드</button>
|
<input type="hidden" id="search1" value="${search}">
|
||||||
</div>
|
<!-- 페이징작업용 -->
|
||||||
<div id="page" align="center">
|
|
||||||
<c:if test="${begin > pageNum }">
|
|
||||||
<a href="list?p=${begin-1 }">[<]</a>
|
|
||||||
</c:if>
|
|
||||||
<c:forEach begin="${begin }" end="${end}" var="i">
|
|
||||||
<a href="list?p=${i}">${i}</a>
|
|
||||||
</c:forEach>
|
|
||||||
<c:if test="${end < totalPages }">
|
|
||||||
<a href="list?p=${end+1}">[>]</a>
|
|
||||||
</c:if>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="createButton" align="right">
|
</div>
|
||||||
<button id="createButton" href="create">생성</button>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-table">
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>번호</th>
|
||||||
|
<th>제품명</th>
|
||||||
|
<th>카테고리</th>
|
||||||
|
<th>재고수</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${slist }" var="dto">
|
||||||
|
<tr class="detailTr col-5" data-id="${dto.id}" >
|
||||||
|
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
|
<td class="col-1">${dto.productName }</td>
|
||||||
|
<td class="col-1">${dto.cls_nm_4 }</td>
|
||||||
|
<td class="col-1">${dto.quantity}</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-buttons">
|
||||||
|
<div class="col-3 text-start">
|
||||||
|
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
|
||||||
|
<button type="button" class="btn btn-success" id="download">다운로드</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 text-end">
|
||||||
|
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||||
|
</div>
|
||||||
|
</div><!-- row row-buttons -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--탭내용 2-->
|
||||||
|
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="col-12">
|
||||||
|
<form>
|
||||||
|
<div class="input-group mb-3 w-30 col-centered">
|
||||||
|
<div class="w-25">
|
||||||
|
<select class="form-select" name="searchn" id="searchn2">
|
||||||
|
<option value="0">제품명</option>
|
||||||
|
<option value="1">카테고리</option>
|
||||||
|
<option value="2">재고수</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="search2" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="searchBtn2">검색</button>
|
||||||
|
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
<input type="hidden" id="searchn22" value="${searchn2}">
|
||||||
|
<input type="hidden" id="search22" value="${search2}">
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-table">
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>번호</th>
|
||||||
|
<th>제품명</th>
|
||||||
|
<th>카테고리</th>
|
||||||
|
<th>재고수</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${slist2 }" var="dto">
|
||||||
|
<tr class="detailTr col-5" data-id="${dto.id}" >
|
||||||
|
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
|
<td class="col-1">${dto.productName }</td>
|
||||||
|
<td class="col-1">${dto.cls_nm_4 }</td>
|
||||||
|
<td class="col-1">${dto.quantity }</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-buttons">
|
||||||
|
<div class="col-3 text-start">
|
||||||
|
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
|
||||||
|
<button type="button" class="btn btn-success" id="download2">다운로드</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
|
||||||
|
<c:if test="${begin2 > pageNum2 }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction2(this.id)" id="${begin2 - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin2 }" end="${end2 }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p2 == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction2(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end2 < totalPages2 }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction2(this.id)" id="${end2 + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 text-end">
|
||||||
|
<button type="button" class="btn btn-primary" id="createButton2">생성</button>
|
||||||
|
</div>
|
||||||
|
</div><!-- row row-buttons -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</c:if>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
|
|
||||||
탭2 내용
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
</body>
|
|
||||||
|
|
||||||
<script src="utils.js" type="text/javascript"></script>
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
//POST방식으로 create폼화면 출력
|
||||||
|
|
||||||
/*엑셀 다운로드 클릭 펑션 */
|
//탭 1 생성 버튼
|
||||||
$("#excelButton").click(function(){
|
$("#createButton").on("click",function(){
|
||||||
const columns = [
|
var form = document.createElement("form");
|
||||||
{name: '번호', key: 'id'},
|
form.action = "/stock/create";
|
||||||
{name: '제품명', key: 'product_name'},
|
form.method = "POST";
|
||||||
{name: '창고명', key: 'warehouse_name'},
|
document.body.appendChild(form);
|
||||||
{name: '재고수', key: 'quantity'},
|
form.submit();
|
||||||
{name: '카테고리', key: 'cls_Nm_4'}
|
});
|
||||||
|
|
||||||
];
|
//탭 2 생성 버튼
|
||||||
|
$("#createButton2").on("click",function(){
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/create";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
});
|
||||||
|
|
||||||
exportExcel(e, 'sheet', columns, list, 'stock');
|
$("body").on("click", ".detailTr", function(){
|
||||||
})
|
var id = $(this).data("id");
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/read";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "id";
|
||||||
|
input.value = id;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//탭 1 검색기능
|
||||||
|
$("#searchBtn").on("click",function(){
|
||||||
|
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/list";
|
||||||
|
form.method = "get";
|
||||||
|
|
||||||
|
var input1 = document.createElement("input");
|
||||||
|
input1.type = "hidden";
|
||||||
|
input1.name = "searchn";
|
||||||
|
input1.value = searchn;
|
||||||
|
form.appendChild(input1);
|
||||||
|
|
||||||
|
var input2 = document.createElement("input");
|
||||||
|
input2.type = "hidden";
|
||||||
|
input2.name = "search";
|
||||||
|
input2.value = search;
|
||||||
|
form.appendChild(input2);
|
||||||
|
|
||||||
|
var input3 = document.createElement("input");
|
||||||
|
input3.type = "hidden";
|
||||||
|
input3.name = "p";
|
||||||
|
input3.value = 1;
|
||||||
|
form.appendChild(input3);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//탭 2 검색기능
|
||||||
|
$("#searchBtn2").on("click",function(){
|
||||||
|
|
||||||
|
var searchn = $("#searchn2").val();
|
||||||
|
var search = $("#search2").val();
|
||||||
|
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/list2";
|
||||||
|
form.method = "get";
|
||||||
|
|
||||||
|
var input1 = document.createElement("input");
|
||||||
|
input1.type = "hidden";
|
||||||
|
input1.name = "searchn";
|
||||||
|
input1.value = searchn;
|
||||||
|
form.appendChild(input1);
|
||||||
|
|
||||||
|
var input2 = document.createElement("input");
|
||||||
|
input2.type = "hidden";
|
||||||
|
input2.name = "search";
|
||||||
|
input2.value = search;
|
||||||
|
form.appendChild(input2);
|
||||||
|
|
||||||
|
var input3 = document.createElement("input");
|
||||||
|
input3.type = "hidden";
|
||||||
|
input3.name = "p";
|
||||||
|
input3.value = 1;
|
||||||
|
form.appendChild(input3);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
|
||||||
|
|
||||||
|
//탭 1 페이징
|
||||||
|
function pageingFunction(clickedId){
|
||||||
|
var searchn1 = $("#searchn1").val();
|
||||||
|
var search1 = $("#search1").val();
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/list";
|
||||||
|
form.method = "get";
|
||||||
|
|
||||||
|
var input1 = document.createElement("input");
|
||||||
|
input1.type = "hidden";
|
||||||
|
input1.name = "searchn";
|
||||||
|
input1.value = searchn1;
|
||||||
|
form.appendChild(input1);
|
||||||
|
|
||||||
|
var input2 = document.createElement("input");
|
||||||
|
input2.type = "hidden";
|
||||||
|
input2.name = "search";
|
||||||
|
input2.value = search1;
|
||||||
|
form.appendChild(input2);
|
||||||
|
|
||||||
|
var input3 = document.createElement("input");
|
||||||
|
input3.type = "hidden";
|
||||||
|
input3.name = "p";
|
||||||
|
input3.value = clickedId;
|
||||||
|
form.appendChild(input3);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//탭 2 페이징
|
||||||
|
function pageingFunction2(clickedId){
|
||||||
|
var searchn2 = $("#searchn22").val();
|
||||||
|
var search2 = $("#search22").val();
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/list2";
|
||||||
|
form.method = "get";
|
||||||
|
|
||||||
|
var input1 = document.createElement("input");
|
||||||
|
input1.type = "hidden";
|
||||||
|
input1.name = "searchn";
|
||||||
|
input1.value = searchn2;
|
||||||
|
form.appendChild(input1);
|
||||||
|
|
||||||
|
var input2 = document.createElement("input");
|
||||||
|
input2.type = "hidden";
|
||||||
|
input2.name = "search";
|
||||||
|
input2.value = search2;
|
||||||
|
form.appendChild(input2);
|
||||||
|
|
||||||
|
var input3 = document.createElement("input");
|
||||||
|
input3.type = "hidden";
|
||||||
|
input3.name = "p";
|
||||||
|
input3.value = clickedId;
|
||||||
|
form.appendChild(input3);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</body>
|
||||||
|
</html>
|
||||||
190
src/main/webapp/WEB-INF/views/stock/read.jsp
Normal file
190
src/main/webapp/WEB-INF/views/stock/read.jsp
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
<%@ 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" %>
|
||||||
|
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
<h1>재고 상세페이지</h1>
|
||||||
|
<div class="col-10" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-danger" id="yes_no_modal_show">삭제</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="container" style="text-align: center">
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
<input type="hidden" class="form-control" aria-label="id" id="id" value="${dto.id}" readonly>
|
||||||
|
<input type='hidden' id="activation" value="1">
|
||||||
|
|
||||||
|
|
||||||
|
<!--제품 관련 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Product_label' class="input-group-text">제품</span>
|
||||||
|
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색" value="${dto.productName}">
|
||||||
|
<input hidden name="ProductName" id="product_id" value="${dto.productId}">
|
||||||
|
<%-- <button id="product_search_button" class="btn-primary btn" onclick="showSearchModals('제품 검색','product_category_company_search')">검색</button>--%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||||
|
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="" value="${dto.cls_nm_4}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||||
|
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="" value="${dto.company_name}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--창고 관련 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||||
|
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색" value="${dto.warehouseName}">
|
||||||
|
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouseId}">
|
||||||
|
<%-- <button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>--%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Address_label' class="input-group-text">주소</span>
|
||||||
|
<input readonly id="Address_name" type="text" class="form-control" placeholder="" value="${dto.address}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Capacity_label' class="input-group-text">용적</span>
|
||||||
|
<input readonly id="Capacity_name" type="text" class="form-control" placeholder="" value="${dto.capacity}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--적재할 상품의 재고수-->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon4">재고량</span>
|
||||||
|
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||||
|
placeholder="재고량을 입력하세요" aria-label="재고량" value="${dto.quantity }"
|
||||||
|
aria-describedby="basic-addon1" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 ">
|
||||||
|
<div class="w-40 col-centered" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-success" id="checkBtn">확인</button>
|
||||||
|
<button type="button" class="btn btn-secondary" id="modifyBtn">수정</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="yes_no_modal_stock_delete" tabindex="-1" aria-labelledby="exampleModalLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5" id="yesNoModalLabel">삭제 하시겠습니까?</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||||
|
<button id="modal_yes_button_stock_delete" type="button" class="modal_yes btn btn-primary">삭제</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function showSearchModals(title, val){
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
const data = { name : val};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/stock/show_modal', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#modifyBtn").on("click", function () {
|
||||||
|
var id = $("#id").val();
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/update";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "id";
|
||||||
|
input.value = id;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#checkBtn").on("click", function () {
|
||||||
|
$(location).attr("href", "/stock/list");
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
yesNoModal.yesFunction1 = deleteStockFunction;
|
||||||
|
|
||||||
|
function deleteStockFunction() {
|
||||||
|
var id = $("#id").val();
|
||||||
|
var warehouse_id = $("#warehouse_id").val();
|
||||||
|
var quantity = $("#quantity").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/stock/delete",
|
||||||
|
type: "delete",
|
||||||
|
data: {
|
||||||
|
"id": id,
|
||||||
|
"warehouseId": warehouse_id,
|
||||||
|
"quantity" : quantity
|
||||||
|
},
|
||||||
|
datatype: "json"
|
||||||
|
}).done(function (data) {
|
||||||
|
if (data == true) {
|
||||||
|
alert("삭제되었습니다.");
|
||||||
|
$(location).attr("href", "/stock/list");
|
||||||
|
} else {
|
||||||
|
alert("정상적으로 삭제되지 않았습니다..");
|
||||||
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function () {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
|
||||||
|
}//deleteCategoryFunction
|
||||||
|
|
||||||
|
const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_stock_delete");
|
||||||
|
|
||||||
|
$("#yes_no_modal_show").on("click", function () {
|
||||||
|
yesNoModalBootStrap.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#modal_yes_button_stock_delete").on("click", function () {
|
||||||
|
console.log("삭제 버튼 클릭 이벤트 실행");
|
||||||
|
yesNoModal.yesFunction1();
|
||||||
|
yesNoModalBootStrap.hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
200
src/main/webapp/WEB-INF/views/stock/update.jsp
Normal file
200
src/main/webapp/WEB-INF/views/stock/update.jsp
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
<%@ 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" %>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
<h1>재고 수정</h1>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="container" style="text-align: center">
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
|
||||||
|
<input type="hidden" class="form-control" aria-label="id" id="id" value="${dto.id }" readonly>
|
||||||
|
<input type='hidden' id="activation" value="1">
|
||||||
|
|
||||||
|
|
||||||
|
<!--제품 관련 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Product_label' class="input-group-text">제품</span>
|
||||||
|
<input readonly id="stock_pro_name" type="text" class="form-control" placeholder="제품 검색" value="${dto.productName}">
|
||||||
|
<input hidden name="ProductName" id="product_id" value="${dto.productId}">
|
||||||
|
<%-- <button id="product_search_button" class="btn-primary btn" onclick="showSearchModals('제품 검색','product_category_company_search')">검색</button>--%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Category_label' class="input-group-text">카테고리</span>
|
||||||
|
<input readonly id="stock_category_name" type="text" class="form-control" placeholder="" value="${dto.cls_nm_4}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Company_name_label' class="input-group-text">제조사</span>
|
||||||
|
<input readonly id="stock_company_name_name" type="text" class="form-control" placeholder="" value="${dto.company_name}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--창고 관련 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Warehouse_label' class="input-group-text">창고</span>
|
||||||
|
<input readonly id="warehouse_name" type="text" class="form-control" placeholder="창고 검색" value="${dto.company_name}">
|
||||||
|
<input hidden name="product_id" id="warehouse_id" value="${dto.warehouseId}">
|
||||||
|
<%-- <button id="Warehouse_search_button" class="btn-primary btn" onclick="showSearchModals('창고 검색','warehouse_capacity_currentCapacity')">검색</button>--%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Address_label' class="input-group-text">주소</span>
|
||||||
|
<input readonly id="Address_name" type="text" class="form-control" placeholder="" value="${dto.address}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='Capacity_label' class="input-group-text">용적</span>
|
||||||
|
<input readonly id="Capacity_name" type="text" class="form-control" placeholder="" value="${dto.capacity}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span id='RemainingCapacity_label' class="input-group-text">재고량 한도</span>
|
||||||
|
<input readonly id="remainingcapacity" type="text" placeholder="" value="${dto.capacity - dto.current_capacity + dto.quantity}" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--적재할 상품의 재고수-->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon4">기존 재고량</span>
|
||||||
|
<input type="text" name="quantity" id="quantity" class="form-control"
|
||||||
|
placeholder="재고량을 입력하세요" aria-label="재고량" value="${dto.quantity }" readonly
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon5">수정 할 재고량</span>
|
||||||
|
<input type="text" name="quantity" id="quantityAdjustment" class="form-control"
|
||||||
|
placeholder="재고량을 입력하세요" aria-label="재고량"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 ">
|
||||||
|
<div class="w-40 col-centered" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-success" id="updateBtn">수정 완료</button>
|
||||||
|
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function showSearchModals(title, val){
|
||||||
|
$("#searchModalLabel").text(title);
|
||||||
|
const data = { name : val};
|
||||||
|
$.ajax({
|
||||||
|
type : 'post', // 타입 (get, post, put 등등)
|
||||||
|
url : '/stock/show_modal', // 요청할 서버url
|
||||||
|
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||||
|
data : data,
|
||||||
|
success : function(result) { // 결과 성공 콜백함수
|
||||||
|
$("#search_modal_body").html(result);
|
||||||
|
searchModalBootStrap.show();
|
||||||
|
},
|
||||||
|
error : function(request, status, error) {
|
||||||
|
alert(error)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#updateBtn").on("click", function () {
|
||||||
|
var product_id = $("#product_id").val();
|
||||||
|
var warehouse_id = $("#warehouse_id").val();
|
||||||
|
var quantity = $("#quantity").val();
|
||||||
|
var activation = $("#activation").val();
|
||||||
|
var remainingcapacity = $("#remainingcapacity").val();
|
||||||
|
var id = $("#id").val();
|
||||||
|
var quantityAdjustment = $("#quantityAdjustment").val();
|
||||||
|
|
||||||
|
|
||||||
|
if (!product_id) {
|
||||||
|
alert("제품을 선택해야 합니다.");
|
||||||
|
$("#product_id").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!warehouse_id) {
|
||||||
|
alert("적재할 창고를 선택해야 합니다.");
|
||||||
|
$("#warehouse_id").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!quantity) {
|
||||||
|
alert("재고량를 입력해야 합니다.");
|
||||||
|
$("#quantity").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quantity > remainingcapacity) {
|
||||||
|
alert("적재 할 재고량이 재고량 한도를 넘을 수 없습니다.");
|
||||||
|
$("#quantity").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/stock/update_process",
|
||||||
|
type: "put",
|
||||||
|
data: {
|
||||||
|
"id": id,
|
||||||
|
"warehouseId": warehouse_id,
|
||||||
|
"quantity": quantity,
|
||||||
|
"activation": activation,
|
||||||
|
"quantityAdjustment": quantityAdjustment
|
||||||
|
|
||||||
|
},
|
||||||
|
datatype: "json"
|
||||||
|
}).done(function (data) {
|
||||||
|
if (data == true) {
|
||||||
|
alert("재고 정보가 수정되었습니다.");
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/stock/read";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "name";
|
||||||
|
input.value = name;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
window.location.href = "/stock/list";
|
||||||
|
} else {
|
||||||
|
alert("재고 정보 수정에 실패하였습니다.");
|
||||||
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function () {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#cancelBtn").on("click", function () {
|
||||||
|
$(location).attr("href", "/stock/list");
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
253
src/main/webapp/WEB-INF/views/vendor/create.jsp
vendored
Normal file
253
src/main/webapp/WEB-INF/views/vendor/create.jsp
vendored
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
<%@ 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" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>거래처 생성</title>
|
||||||
|
<style>
|
||||||
|
.body {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-centered {
|
||||||
|
margin: 0 auto;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-margin-left-32 {
|
||||||
|
margin-left: 32%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
<h1>거래처 생성</h1>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="container" style="text-align: center">
|
||||||
|
<form id="createForm">
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
|
||||||
|
<%-- 세션 만들어지고 value 수정--%>
|
||||||
|
|
||||||
|
<input type='hidden' id="manager_id" value="15b68e54-b0f0-11ee-935d-0242ac110006"/>
|
||||||
|
<input type='hidden' id="activation" value="1">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon1">업체명</span>
|
||||||
|
<input type="text" name="name" id="name" class="form-control"
|
||||||
|
placeholder="업체명을 입력하세요" aria-label="업체명" value="${dto.name }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
<!-- 설명만 있는 입력 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon2">대표자명</span>
|
||||||
|
<input type="text" name="president_name" id="president_name" class="form-control"
|
||||||
|
placeholder="대표자명을 입력하세요" aria-label="대표자명" value="${dto.president_name }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon3">주소</span>
|
||||||
|
<input type="text" name="address" id="address" class="form-control"
|
||||||
|
placeholder="주소를 입력하세요" aria-label="주소" value="${dto.address }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon4">사업자등록번호</span>
|
||||||
|
<input type="text" name="registration_number" id="registration_number" class="form-control"
|
||||||
|
placeholder="사업자등록번호를 입력하세요" aria-label="사업자등록번호" value="${dto.registration_number }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon5">email</span>
|
||||||
|
<input type="text" name="email" id="email" class="form-control"
|
||||||
|
placeholder="Email주소를 입력하세요" aria-label="email" value="${dto.email }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon6">대표번호</span>
|
||||||
|
<input type="text" name="president_telephone" id="president_telephone" class="form-control"
|
||||||
|
placeholder="대표번호를 입력하세요" aria-label="대표번호" value="${dto.president_telephone }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon7">거래처 담당자 이름</span>
|
||||||
|
<input type="text" name="vendor_manager" id="vendor_manager" class="form-control"
|
||||||
|
placeholder="거래처 담당자 이름을 입력하세요" aria-label="거래처 담당자 이름" value="${dto.vendor_manager }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon8">거래처 담당자 연락 번호</span>
|
||||||
|
<input type="text" name="vendor_manager_telephone" id="vendor_manager_telephone" class="form-control"
|
||||||
|
placeholder="거래처 담당자 연락 번호를 입력하세요" aria-label="거래처 담당자 연락 번호" value="${dto.vendor_manager_telephone }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon9">주요품목</span>
|
||||||
|
<input type="text" name="main_product" id="main_product" class="form-control"
|
||||||
|
placeholder="주요품목을 입력하세요" aria-label="주요품목" value="${dto.main_product }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 ">
|
||||||
|
<div class="w-40 col-centered" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-success" id="submitBtn">생성</button>
|
||||||
|
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
|
||||||
|
$("#submitBtn").on("click", function () {
|
||||||
|
var managerId = $("#manager_id").val();
|
||||||
|
|
||||||
|
var name = $("#name").val();
|
||||||
|
var president_name = $("#president_name").val();
|
||||||
|
var address = $("#address").val();
|
||||||
|
var registration_number = $("#registration_number").val();
|
||||||
|
var email = $("#email").val();
|
||||||
|
var president_telephone = $("#president_telephone").val();
|
||||||
|
var vendor_manager = $("#vendor_manager").val();
|
||||||
|
var vendor_manager_telephone = $("#vendor_manager_telephone").val();
|
||||||
|
var main_product = $("#main_product").val();
|
||||||
|
var activation = $("#activation").val();
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
alert("업체명을 입력해야 합니다.");
|
||||||
|
$("#name").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!presidentName) {
|
||||||
|
alert("대표자명을 입력해야 합니다.");
|
||||||
|
$("#president_name").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!address) {
|
||||||
|
alert("주소를 입력해야 합니다.");
|
||||||
|
$("#address").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!registrationNumber) {
|
||||||
|
alert("사업자등록번호를 입력해야 합니다.");
|
||||||
|
$("#registration_number").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!email) {
|
||||||
|
alert("Email을 입력해야 합니다.");
|
||||||
|
$("#email").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!presidentTelephone) {
|
||||||
|
alert("대표번호를 입력해야 합니다.");
|
||||||
|
$("#president_telephone").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vendorManager) {
|
||||||
|
alert("거래처 담당자 이름을 입력해야 합니다.");
|
||||||
|
$("#vendor_manager").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vendorManagerTelephone) {
|
||||||
|
alert("거래처 담당자 연락 번호를 입력해야 합니다.");
|
||||||
|
$("#vendor_manager_telephone").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mainProduct) {
|
||||||
|
alert("주요품목을 입력해야 합니다.");
|
||||||
|
$("#main_product").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/vendor/create_process",
|
||||||
|
type: "post",
|
||||||
|
data: {
|
||||||
|
"manager_id": manager_id,
|
||||||
|
|
||||||
|
"name": name,
|
||||||
|
"president_name": president_name,
|
||||||
|
"address": address,
|
||||||
|
"registration_number": registration_number,
|
||||||
|
"email": email,
|
||||||
|
"president_telephone": president_telephone,
|
||||||
|
"vendor_manager": vendor_manager,
|
||||||
|
"vendor_manager_telephone": vendor_manager_telephone,
|
||||||
|
"main_product": main_product,
|
||||||
|
"activation" : activation
|
||||||
|
|
||||||
|
},
|
||||||
|
datatype: "json"
|
||||||
|
}).done(function (data) {
|
||||||
|
if (data == true) {
|
||||||
|
alert("거래처가 생성되었습니다.");
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/read";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "name";
|
||||||
|
input.value = name;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
window.location.href = "/vendor/list";
|
||||||
|
} else {
|
||||||
|
alert("거래처 생성에 실패하였습니다.");
|
||||||
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function () {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#cancelBtn").on("click", function () {
|
||||||
|
$(location).attr("href", "/vendor/list");
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
203
src/main/webapp/WEB-INF/views/vendor/list.jsp
vendored
Normal file
203
src/main/webapp/WEB-INF/views/vendor/list.jsp
vendored
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8"%>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>거래처 관리</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
<h1>거래처 관리</h1>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="body">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="col-12">
|
||||||
|
<form>
|
||||||
|
<div class="input-group mb-3 w-30 col-centered">
|
||||||
|
<div class="w-25">
|
||||||
|
<select class="form-select" name="searchn" id="searchn">
|
||||||
|
<option value="0">업체명</option>
|
||||||
|
<option value="1">대표번호</option>
|
||||||
|
<option value="2">거래처 담당자</option>
|
||||||
|
<option value="3">거래처 담당자 전화번호</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||||
|
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||||
|
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
<input type="hidden" id="searchn1" value="${searchn}">
|
||||||
|
<input type="hidden" id="search1" value="${search}">
|
||||||
|
<!-- 페이징작업용 -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-table">
|
||||||
|
<div class="col-12">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="table-dark">
|
||||||
|
<tr>
|
||||||
|
<th>번호</th>
|
||||||
|
<th>업체명</th>
|
||||||
|
<th>대표번호</th>
|
||||||
|
<th>거래처 담당자</th>
|
||||||
|
<th>거래처 담당자 전화번호</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<c:forEach items="${vlist }" var="dto">
|
||||||
|
<tr class="detailTr col-5" data-id="${dto.id}" >
|
||||||
|
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
|
<td class="col-1">${dto.name }</td>
|
||||||
|
<td class="col-1">${dto.president_telephone }</td>
|
||||||
|
<td class="col-1">${dto.vendor_manager }</td>
|
||||||
|
<td class="col-1">${dto.vendor_manager_telephone }</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row row-buttons">
|
||||||
|
<div class="col-3 text-start">
|
||||||
|
<img width="50" height="50" src="https://img.icons8.com/color/48/ms-excel.png" alt="ms-excel"/>
|
||||||
|
<button type="button" class="btn btn-success" id="uploadExcel">업로드</button>
|
||||||
|
<button type="button" class="btn btn-success" id="download">다운로드</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 d-flex justify-content-center">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
|
||||||
|
<c:if test="${begin > pageNum }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
|
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
|
</li>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${end < totalPages }">
|
||||||
|
<li class="page-item">
|
||||||
|
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||||
|
</li>
|
||||||
|
</c:if>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 text-end">
|
||||||
|
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||||
|
</div>
|
||||||
|
</div><!-- row row-buttons -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
//POST방식으로 create폼화면 출력
|
||||||
|
$("#createButton").on("click",function(){
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/create";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("body").on("click", ".detailTr", function(){
|
||||||
|
var id = $(this).data("id");
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/read";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "id";
|
||||||
|
input.value = id;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//검색기능
|
||||||
|
$("#searchBtn").on("click",function(){
|
||||||
|
|
||||||
|
var searchn = $("#searchn").val();
|
||||||
|
var search = $("#search").val();
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/list";
|
||||||
|
form.method = "get";
|
||||||
|
|
||||||
|
var input1 = document.createElement("input");
|
||||||
|
input1.type = "hidden";
|
||||||
|
input1.name = "searchn";
|
||||||
|
input1.value = searchn;
|
||||||
|
form.appendChild(input1);
|
||||||
|
|
||||||
|
var input2 = document.createElement("input");
|
||||||
|
input2.type = "hidden";
|
||||||
|
input2.name = "search";
|
||||||
|
input2.value = search;
|
||||||
|
form.appendChild(input2);
|
||||||
|
|
||||||
|
var input3 = document.createElement("input");
|
||||||
|
input3.type = "hidden";
|
||||||
|
input3.name = "p";
|
||||||
|
input3.value = 1;
|
||||||
|
form.appendChild(input3);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
function pageingFunction(clickedId){
|
||||||
|
var searchn1 = $("#searchn1").val();
|
||||||
|
var search1 = $("#search1").val();
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/list";
|
||||||
|
form.method = "get";
|
||||||
|
|
||||||
|
var input1 = document.createElement("input");
|
||||||
|
input1.type = "hidden";
|
||||||
|
input1.name = "searchn";
|
||||||
|
input1.value = searchn1;
|
||||||
|
form.appendChild(input1);
|
||||||
|
|
||||||
|
var input2 = document.createElement("input");
|
||||||
|
input2.type = "hidden";
|
||||||
|
input2.name = "search";
|
||||||
|
input2.value = search1;
|
||||||
|
form.appendChild(input2);
|
||||||
|
|
||||||
|
var input3 = document.createElement("input");
|
||||||
|
input3.type = "hidden";
|
||||||
|
input3.name = "p";
|
||||||
|
input3.value = clickedId;
|
||||||
|
form.appendChild(input3);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
181
src/main/webapp/WEB-INF/views/vendor/read.jsp
vendored
Normal file
181
src/main/webapp/WEB-INF/views/vendor/read.jsp
vendored
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>거래처 상세페이지</title>
|
||||||
|
<style type="text/css">
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<h1>거래처 상세페이지</h1>
|
||||||
|
<div class="col-10" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-danger" id="yes_no_modal_show">삭제</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="container" style="text-align: center">
|
||||||
|
<form id="createForm">
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
|
||||||
|
<input type="hidden" class="form-control" aria-label="id" id="id" value="${One.id }" readonly>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon1">업체명</span>
|
||||||
|
<input type="text" class="form-control" aria-label="창고명" value="${One.name }" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon2">대표자명</span>
|
||||||
|
<input type="text" class="form-control" aria-label="용적" value="${One.president_name }" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon3">주소</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.address }" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon4">사업자등록번호</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.registration_number }"
|
||||||
|
readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon5">email</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.email }" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon6">대표번호</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.president_telephone }"
|
||||||
|
readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon7">거래처 담당자 이름</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.vendor_manager }" readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon8">거래처 담당자 연락 번호</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.vendor_manager_telephone }"
|
||||||
|
readonly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon9">주요품목</span>
|
||||||
|
<input type="text" class="form-control" aria-label="적재량" value="${One.main_product }" readonly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
<div class="col-10" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-primary" id="checkBtn">확인</button>
|
||||||
|
<button type="button" class="btn btn-warning" id="modifyBtn">
|
||||||
|
수정
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="yes_no_modal_vendor_delete" tabindex="-1" aria-labelledby="exampleModalLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h1 class="modal-title fs-5" id="yesNoModalLabel">삭제 하시겠습니까?</h1>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||||
|
<button id="modal_yes_button_vendor_delete" type="button" class="modal_yes btn btn-primary">삭제</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#checkBtn").on("click", function () {
|
||||||
|
$(location).attr("href", "/vendor/list");
|
||||||
|
})//checkBtn click
|
||||||
|
|
||||||
|
$("#modifyBtn").on("click", function () {
|
||||||
|
var id = $("#id").val();
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/update";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "id";
|
||||||
|
input.value = id;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
})//modifyBtn click
|
||||||
|
|
||||||
|
|
||||||
|
yesNoModal.yesFunction = deleteVendorFunction;
|
||||||
|
|
||||||
|
|
||||||
|
function deleteVendorFunction() {
|
||||||
|
var id = $("#id").val();
|
||||||
|
$.ajax({
|
||||||
|
url: "/vendor/delete",
|
||||||
|
type: "delete",
|
||||||
|
data: {
|
||||||
|
"id": id
|
||||||
|
},
|
||||||
|
datatype: "json"
|
||||||
|
}).done(function (data) {
|
||||||
|
if (data == true) {
|
||||||
|
alert("삭제되었습니다.");
|
||||||
|
$(location).attr("href", "/vendor/list");
|
||||||
|
} else {
|
||||||
|
alert("정상적으로 삭제되지 않았습니다..");
|
||||||
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function () {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
|
||||||
|
}//deleteCategoryFunction
|
||||||
|
|
||||||
|
const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_vendor_delete");
|
||||||
|
|
||||||
|
$("#yes_no_modal_show").on("click", function () {
|
||||||
|
yesNoModalBootStrap.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#modal_yes_button_vendor_delete").on("click", function () {
|
||||||
|
yesNoModal.yesFunction();
|
||||||
|
yesNoModalBootStrap.hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
});//ready
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
263
src/main/webapp/WEB-INF/views/vendor/update.jsp
vendored
Normal file
263
src/main/webapp/WEB-INF/views/vendor/update.jsp
vendored
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
<%@ 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" %>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>창고 정보 수정페이지</title>
|
||||||
|
<style>
|
||||||
|
.body {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-centered {
|
||||||
|
margin: 0 auto;
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-margin-left-32 {
|
||||||
|
margin-left: 32%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="mt-5 mb-5 text-center">
|
||||||
|
<h1>창고 정보 수정페이지</h1>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="container" style="text-align: center">
|
||||||
|
<form id="createForm">
|
||||||
|
|
||||||
|
<div class="ulTag">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12" style="text-align: center;">
|
||||||
|
|
||||||
|
<input type="hidden" id="id" value="${dto.id }">
|
||||||
|
<input type='hidden' id="manager_id" value="15b68e54-b0f0-11ee-935d-0242ac110006"/>
|
||||||
|
<input type='hidden' id="activation" value="1">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon1">업체명</span>
|
||||||
|
<input type="text" name="name" id="name" class="form-control"
|
||||||
|
placeholder="업체명을 입력하세요" aria-label="업체명" value="${dto.name }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
<!-- 설명만 있는 입력 -->
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon2">대표자명</span>
|
||||||
|
<input type="text" name="president_name" id="president_name" class="form-control"
|
||||||
|
placeholder="대표자명을 입력하세요" aria-label="대표자명" value="${dto.president_name }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon3">주소</span>
|
||||||
|
<input type="text" name="address" id="address" class="form-control"
|
||||||
|
placeholder="주소를 입력하세요" aria-label="주소" value="${dto.address }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon4">사업자등록번호</span>
|
||||||
|
<input type="text" name="registration_number" id="registration_number" class="form-control"
|
||||||
|
placeholder="사업자등록번호를 입력하세요" aria-label="사업자등록번호" value="${dto.registration_number }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon5">email</span>
|
||||||
|
<input type="text" name="email" id="email" class="form-control"
|
||||||
|
placeholder="Email주소를 입력하세요" aria-label="email" value="${dto.email }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon6">대표번호</span>
|
||||||
|
<input type="text" name="president_telephone" id="president_telephone" class="form-control"
|
||||||
|
placeholder="대표번호를 입력하세요" aria-label="대표번호" value="${dto.president_telephone }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon7">거래처 담당자 이름</span>
|
||||||
|
<input type="text" name="vendor_manager" id="vendor_manager" class="form-control"
|
||||||
|
placeholder="거래처 담당자 이름을 입력하세요" aria-label="거래처 담당자 이름" value="${dto.vendor_manager }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon8">거래처 담당자 연락 번호</span>
|
||||||
|
<input type="text" name="vendor_manager_telephone" id="vendor_manager_telephone" class="form-control"
|
||||||
|
placeholder="거래처 담당자 연락 번호를 입력하세요" aria-label="거래처 담당자 연락 번호" value="${dto.vendor_manager_telephone }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
|
<span class="input-group-text" id="basic-addon9">주요품목</span>
|
||||||
|
<input type="text" name="main_product" id="main_product" class="form-control"
|
||||||
|
placeholder="주요품목을 입력하세요" aria-label="주요품목" value="${dto.main_product }"
|
||||||
|
aria-describedby="basic-addon1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 ">
|
||||||
|
<div class="w-40 col-centered" style="text-align: right">
|
||||||
|
<button type="button" class="btn btn-primary" id="updateBtn">수정 완료</button>
|
||||||
|
<button type="button" class="btn btn-secondary" id="cancelBtn">취소</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#updateBtn").on("click", function () {
|
||||||
|
var id = $("#id").val();
|
||||||
|
|
||||||
|
var manager_id = $("#manager_id").val();
|
||||||
|
|
||||||
|
var name = $("#name").val();
|
||||||
|
var president_name = $("#president_name").val();
|
||||||
|
var address = $("#address").val();
|
||||||
|
var registration_number = $("#registration_number").val();
|
||||||
|
var email = $("#email").val();
|
||||||
|
var president_telephone = $("#president_telephone").val();
|
||||||
|
var vendor_manager = $("#vendor_manager").val();
|
||||||
|
var vendor_manager_telephone = $("#vendor_manager_telephone").val();
|
||||||
|
var main_product = $("#main_product").val();
|
||||||
|
var activation = $("#activation").val();
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
alert("업체명을 입력해야 합니다.");
|
||||||
|
$("#name").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!president_name) {
|
||||||
|
alert("대표자명을 입력해야 합니다.");
|
||||||
|
$("#president_name").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!address) {
|
||||||
|
alert("주소를 입력해야 합니다.");
|
||||||
|
$("#address").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!registration_number) {
|
||||||
|
alert("사업자등록번호를 입력해야 합니다.");
|
||||||
|
$("#registration_number").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!email) {
|
||||||
|
alert("Email을 입력해야 합니다.");
|
||||||
|
$("#email").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!president_telephone) {
|
||||||
|
alert("대표번호를 입력해야 합니다.");
|
||||||
|
$("#presidentTelephone").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vendor_manager) {
|
||||||
|
alert("거래처 담당자 이름을 입력해야 합니다.");
|
||||||
|
$("#vendor_manager").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vendor_manager_telephone) {
|
||||||
|
alert("거래처 담당자 연락 번호를 입력해야 합니다.");
|
||||||
|
$("#vendor_manager_telephone").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!main_product) {
|
||||||
|
alert("주요품목을 입력해야 합니다.");
|
||||||
|
$("#main_product").focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/vendor/update_process",
|
||||||
|
type: "put",
|
||||||
|
data: {
|
||||||
|
"id": id,
|
||||||
|
"manager_id": manager_id,
|
||||||
|
|
||||||
|
"name": name,
|
||||||
|
"president_name": president_name,
|
||||||
|
"address": address,
|
||||||
|
"registration_number": registration_number,
|
||||||
|
"email": email,
|
||||||
|
"president_telephone": president_telephone,
|
||||||
|
"vendor_manager": vendor_manager,
|
||||||
|
"vendor_manager_telephone": vendor_manager_telephone,
|
||||||
|
"main_product": main_product,
|
||||||
|
"activation" : activation
|
||||||
|
|
||||||
|
},
|
||||||
|
datatype: "json"
|
||||||
|
}).done(function (data) {
|
||||||
|
if (data == true) {
|
||||||
|
alert("거래처를 수정하였습니다.");
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/read";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "id";
|
||||||
|
input.value = id;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
alert("거래처 수정에 실패하였습니다.");
|
||||||
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
alert("오류가 발생했습니다.");
|
||||||
|
}).always(function () {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
|
||||||
|
});//updateBtn
|
||||||
|
|
||||||
|
$("#cancelBtn").on("click", function () {
|
||||||
|
var id = $("#id").val();
|
||||||
|
|
||||||
|
var form = document.createElement("form");
|
||||||
|
form.action = "/vendor/read";
|
||||||
|
form.method = "POST";
|
||||||
|
document.body.appendChild(form);
|
||||||
|
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = "id";
|
||||||
|
input.value = id;
|
||||||
|
form.appendChild(input);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
})
|
||||||
|
});//ready
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,25 +1,26 @@
|
|||||||
<%@ page contentType="text/html; charset=UTF-8"%>
|
<%@ page contentType="text/html; charset=UTF-8" %>
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>창고 생성</title>
|
<title>창고 생성</title>
|
||||||
<style>
|
<style>
|
||||||
.body{
|
.body {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.col-centered{
|
|
||||||
|
.col-centered {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
float: none;
|
float: none;
|
||||||
}
|
}
|
||||||
.col-margin-left-32{
|
|
||||||
|
.col-margin-left-32 {
|
||||||
margin-left: 32%;
|
margin-left: 32%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -34,9 +35,10 @@
|
|||||||
<div class="col-12" style="text-align: center;">
|
<div class="col-12" style="text-align: center;">
|
||||||
|
|
||||||
|
|
||||||
<-- 세션 만들어지고 value 수정-->
|
<%-- 세션 만들어지고 value 수정--%>
|
||||||
<input type='hidden' id="managerId" value="e9882095-aeb2-11ee-935d-0242ac110006">
|
<input type='hidden' id="managerId" value="e9882095-aeb2-11ee-935d-0242ac110006">
|
||||||
|
<input type='hidden' id="currentCapacity" value="0">
|
||||||
|
<input type='hidden' id="activation" value="1">
|
||||||
|
|
||||||
|
|
||||||
<div class="input-group mb-3 w-40 col-centered">
|
<div class="input-group mb-3 w-40 col-centered">
|
||||||
@@ -75,28 +77,29 @@
|
|||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
|
||||||
|
$("#submitBtn").on("click", function () {
|
||||||
$("#submitBtn").on("click", function(){
|
|
||||||
var managerId = $("#managerId").val();
|
var managerId = $("#managerId").val();
|
||||||
var name = $("#name").val();
|
var name = $("#name").val();
|
||||||
var capacity = $("#capacity").val();
|
var capacity = $("#capacity").val();
|
||||||
var address = $("#address").val();
|
var address = $("#address").val();
|
||||||
|
var currentCapacity = $("#currentCapacity").val();
|
||||||
|
var activation = $("#activation").val();
|
||||||
|
|
||||||
if(!name){
|
if (!name) {
|
||||||
alert("창고명을 입력해야 합니다.");
|
alert("창고명을 입력해야 합니다.");
|
||||||
$("#name").focus();
|
$("#name").focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!capacity){
|
if (!capacity) {
|
||||||
alert("중분류를 입력해야 합니다.");
|
alert("중분류를 입력해야 합니다.");
|
||||||
$("#capacity").focus();
|
$("#capacity").focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!address){
|
if (!address) {
|
||||||
alert("중분류를 입력해야 합니다.");
|
alert("중분류를 입력해야 합니다.");
|
||||||
$("#address").focus();
|
$("#address").focus();
|
||||||
return false;
|
return false;
|
||||||
@@ -107,14 +110,16 @@
|
|||||||
url: "/warehouse/create_process",
|
url: "/warehouse/create_process",
|
||||||
type: "post",
|
type: "post",
|
||||||
data: {
|
data: {
|
||||||
"managerId" : managerId,
|
"managerId": managerId,
|
||||||
"name": name,
|
"name": name,
|
||||||
"capacity": capacity,
|
"capacity": capacity,
|
||||||
"address": address
|
"address": address,
|
||||||
|
"currentCapacity": currentCapacity,
|
||||||
|
"activation": activation
|
||||||
|
|
||||||
},
|
},
|
||||||
datatype:"json"
|
datatype: "json"
|
||||||
}).done(function(data) {
|
}).done(function (data) {
|
||||||
if (data == true) {
|
if (data == true) {
|
||||||
alert("창고가 생성되었습니다.");
|
alert("창고가 생성되었습니다.");
|
||||||
|
|
||||||
@@ -130,27 +135,25 @@
|
|||||||
form.appendChild(input);
|
form.appendChild(input);
|
||||||
|
|
||||||
form.submit();
|
form.submit();
|
||||||
|
|
||||||
|
window.location.href = "/warehouse/list";
|
||||||
} else {
|
} else {
|
||||||
alert("창고 생성에 실패하였습니다.");
|
alert("창고 생성에 실패하였습니다.");
|
||||||
}
|
}
|
||||||
}).fail(function() {
|
}).fail(function () {
|
||||||
alert("오류가 발생했습니다.");
|
alert("오류가 발생했습니다.");
|
||||||
}).always(function() {
|
}).always(function () {
|
||||||
//
|
//
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#cancelBtn").on("click", function(){
|
$("#cancelBtn").on("click", function () {
|
||||||
$(location).attr("href", "/warehouse/list");
|
$(location).attr("href", "/warehouse/list");
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<form action="list">
|
<form>
|
||||||
<div class="input-group mb-3 w-30 col-centered">
|
<div class="input-group mb-3 w-30 col-centered">
|
||||||
<div class="w-25">
|
<div class="w-25">
|
||||||
<select class="form-select" name="searchn" id="searchn">
|
<select class="form-select" name="searchn" id="searchn">
|
||||||
@@ -62,11 +62,11 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<c:forEach items="${wlist }" var="dto">
|
<c:forEach items="${wlist }" var="dto">
|
||||||
<tr class="detailTr" data-id="${dto.id}">
|
<tr class="detailTr col-4" data-id="${dto.id}">
|
||||||
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
<td class="col-1">${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
<td>${dto.name }</td>
|
<td class="col-1">${dto.name }</td>
|
||||||
<td>${dto.capacity }</td>
|
<td class="col-1">${dto.capacity }</td>
|
||||||
<td>${dto.currentCapacity }</td>
|
<td class="col-1">${dto.currentCapacity }</td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -85,24 +85,29 @@
|
|||||||
|
|
||||||
<c:if test="${begin > pageNum }">
|
<c:if test="${begin > pageNum }">
|
||||||
<li class="page-item">
|
<li class="page-item">
|
||||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
<a href="javascript:void(0);" class="page-link"
|
||||||
|
onclick="pageingFunction(this.id)" id="${begin - 1 }"><</a>
|
||||||
</li>
|
</li>
|
||||||
</c:if>
|
</c:if>
|
||||||
<c:forEach begin="${begin }" end="${end }" var="i">
|
<c:forEach begin="${begin }" end="${end }" var="i">
|
||||||
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
<li class="page-item <c:if test="${p == i}"> active </c:if>">
|
||||||
<a href="javascript:void(0);" class="page-link " onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
<a href="javascript:void(0);" class="page-link "
|
||||||
|
onclick="pageingFunction(this.id); return false;" id="${i }">${i }</a>
|
||||||
</li>
|
</li>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
<c:if test="${end < totalPages }">
|
<c:if test="${end < totalPages }">
|
||||||
<li class="page-item">
|
<li class="page-item">
|
||||||
<a href="javascript:void(0);" class="page-link" onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
<a href="javascript:void(0);" class="page-link"
|
||||||
|
onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||||
</li>
|
</li>
|
||||||
</c:if>
|
</c:if>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 text-end">
|
<div class="col-3 text-end">
|
||||||
<button type="button" class="btn btn-primary" onclick="window.location.href='/warehouse/create'">생성</button>
|
<button type="button" class="btn btn-primary"
|
||||||
|
onclick="window.location.href='/warehouse/create'">생성
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -135,7 +140,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//검색기능
|
//검색기능
|
||||||
$("#searchBtn").on("click",function(){
|
$("#searchBtn").on("click", function () {
|
||||||
|
|
||||||
var searchn = $("#searchn").val();
|
var searchn = $("#searchn").val();
|
||||||
var search = $("#search").val();
|
var search = $("#search").val();
|
||||||
@@ -169,7 +174,7 @@
|
|||||||
|
|
||||||
});//ready
|
});//ready
|
||||||
|
|
||||||
function pageingFunction(clickedId){
|
function pageingFunction(clickedId) {
|
||||||
var searchn1 = $("#searchn1").val();
|
var searchn1 = $("#searchn1").val();
|
||||||
var search1 = $("#search1").val();
|
var search1 = $("#search1").val();
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<c:forEach items="${wlist }" var="dto">
|
<c:forEach items="${wlist }" var="dto">
|
||||||
<tr class="detailTr" data-id="${dto.id}">
|
<tr class="detailTr">
|
||||||
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
<td>${start} <c:set var="start" value="${start +1 }"/></td>
|
||||||
<td>${dto.name }</td>
|
<td>${dto.name }</td>
|
||||||
<td>${dto.quantity }</td>
|
<td>${dto.quantity }</td>
|
||||||
@@ -172,10 +172,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
yesNoModal.yesFunction = deleteCategoryFunction;
|
yesNoModal.yesFunction = deleteWarehouseFunction;
|
||||||
|
|
||||||
|
|
||||||
function deleteCategoryFunction(){
|
function deleteWarehouseFunction(){
|
||||||
var id = $("#id").val();
|
var id = $("#id").val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/warehouse/delete",
|
url: "/warehouse/delete",
|
||||||
|
|||||||
BIN
src/main/webapp/excelfiles/excelform/카테고리 데이터 입력 서식.xlsx
Normal file
BIN
src/main/webapp/excelfiles/excelform/카테고리 데이터 입력 서식.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user