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:
@@ -240,7 +240,7 @@ public class ExcelDownlodeUtils {
|
||||
cell = row.createCell(2);
|
||||
cell.setCellValue((String) dto.get("warehouseName"));
|
||||
cell = row.createCell(3);
|
||||
cell.setCellValue((String) dto.get("quantity"));
|
||||
cell.setCellValue((int) dto.get("quantity"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@@ -79,13 +80,7 @@ public class InController {
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(InDto dto) {
|
||||
int i = inService.createProcess(dto);
|
||||
int j = inService.createProcess2(dto);
|
||||
if (i == 1 & i == j) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return inService.chechAndUpdateOrCreateProcessForCreate(dto);
|
||||
}
|
||||
|
||||
@PostMapping("/read")
|
||||
@@ -115,13 +110,9 @@ public class InController {
|
||||
// 수정 - Ajax
|
||||
@PutMapping("/update_process")
|
||||
@ResponseBody
|
||||
public boolean update_process(InDto dto) {
|
||||
int i = inService.updateById(dto);
|
||||
if (i == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
public boolean updateProcess(InDto dto) {
|
||||
return inService.chechAndUpdateProcess(dto);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -172,14 +163,14 @@ public class InController {
|
||||
@RequestParam(name = "p", defaultValue = "1") int page,
|
||||
@RequestParam String name, String product_id, ModelAndView mav){
|
||||
|
||||
int perPage = 9; // 한 페이지에 보일 글의 갯수
|
||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<Map<String, Object>> list = null;
|
||||
int count = 0;
|
||||
|
||||
list = stockservice.warehousesSelect(searchn, search, startRow, perPage, product_id);
|
||||
count = stockservice.warehouseCount(searchn, search, product_id);
|
||||
list = stockservice.warehousesSelect(searchn, search, startRow, perPage);
|
||||
count = stockservice.warehouseCount(searchn, search);
|
||||
|
||||
|
||||
mav.addObject("list", list);
|
||||
@@ -206,7 +197,11 @@ public class InController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ResponseBody
|
||||
public boolean delete(String id) {
|
||||
return inService.deactivateById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,5 +13,13 @@ public interface InMapper {
|
||||
int createProcess2(InDto dto);
|
||||
InDto selectById (String id);
|
||||
int updateById(InDto dto);
|
||||
|
||||
int checkIfExistsStock(InDto dto);
|
||||
int updateStockProcess(InDto dto);
|
||||
int createStockProcess(InDto dto);
|
||||
int currntStockQuantity(InDto dto);
|
||||
int currntInQuantity(InDto dto);
|
||||
int updateStockProcessForUpdate(InDto dto);
|
||||
int deactivateById(String id);
|
||||
String selectWarehouseQuantity(String warehouseId);
|
||||
int updateWarehouseQuantity(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,121 @@ public class InService {
|
||||
return mapper.updateById(dto);
|
||||
}
|
||||
|
||||
public int checkIfExistsStock(InDto dto) {
|
||||
return mapper.checkIfExistsStock(dto);
|
||||
}
|
||||
|
||||
public int updateStockProcess(InDto dto) {
|
||||
return mapper.updateStockProcess(dto);
|
||||
}
|
||||
|
||||
public int createStockProcess(InDto dto) {
|
||||
return mapper.createStockProcess(dto);
|
||||
}
|
||||
|
||||
//createProcess
|
||||
public boolean chechAndUpdateOrCreateProcessForCreate(InDto dto) {
|
||||
|
||||
|
||||
|
||||
int j = mapper.checkIfExistsStock(dto);
|
||||
if(j == 1) {
|
||||
int k = mapper.updateStockProcess(dto);
|
||||
if(k == 1) {
|
||||
int i = mapper.createProcess(dto);
|
||||
if(i == k) {
|
||||
//System.out.println("같아서 합침");
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}else if(j == 0) {
|
||||
int k = mapper.createStockProcess(dto);
|
||||
if(k == 1) {
|
||||
int i = mapper.createProcess(dto);
|
||||
if(i == k) {
|
||||
//System.out.println("달라서 새로만듬");
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//updateProcess
|
||||
public boolean chechAndUpdateProcess(InDto dto) {
|
||||
int j = mapper.checkIfExistsStock(dto);//재고에 동일한 창고, 제품이 있는지
|
||||
if(j == 1) {//재고에 동일한 창고, 제품이 있다면
|
||||
int currentStockQuantity = mapper.currntStockQuantity(dto);//현재 재고의 개수
|
||||
int changeInQuantity = Integer.parseInt(dto.getQuantity());//변경된 입고의 개수
|
||||
int currentInQuantity = mapper.currntInQuantity(dto);//기존의 입고의 개수
|
||||
int modifiedStockQuantity = currentStockQuantity + changeInQuantity - currentInQuantity;//수정된 재고의 개수
|
||||
if(currentStockQuantity == modifiedStockQuantity) {//현재 재고의 개수와 변한 재고의 개수가 같다면
|
||||
int i = mapper.updateById(dto);//재고는 놔두고 입고만 업데이트 한다
|
||||
if(i == 1) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}else{//현재 재고의 개수보다 변한 재고의 개수가 더 크거나 작다면
|
||||
int i = mapper.updateById(dto); // 입고를 먼저 업데이트하고
|
||||
dto.setQuantity(modifiedStockQuantity+"");// 변경 개수를 적용하여
|
||||
int k = mapper.updateStockProcessForUpdate(dto); // 재고테이블에 반영한다.
|
||||
if (i == k) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}//else
|
||||
}else {// 재고에 동일 재품 동일 창고가 없다면 오류발생.
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean deactivateById(String id) {
|
||||
InDto dto = mapper.selectById(id);
|
||||
int j = mapper.checkIfExistsStock(dto);//재고에 동일한 창고, 제품이 있는지
|
||||
if(j == 1) {
|
||||
int currentStockQuantity = mapper.currntStockQuantity(dto);//스톡의 재고수
|
||||
int deactivateInQuantity = Integer.parseInt(dto.getQuantity());//in의 재고수
|
||||
if(currentStockQuantity >= deactivateInQuantity) {//스톡의 재고수가 in의 재고수보다 많을 때
|
||||
mapper.deactivateById(id);// 입고 비활성화
|
||||
int modifiedStockQuantity = currentStockQuantity - deactivateInQuantity;
|
||||
dto.setQuantity(modifiedStockQuantity+"");// 변경 개수를 적용하여
|
||||
int k = mapper.updateStockProcessForUpdate(dto); // 재고테이블에 반영한다.
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
//사용하지 않음.
|
||||
public void updateWarehouse(InDto dto) {
|
||||
String warehouseId = dto.getId();
|
||||
String updateValue = mapper.selectWarehouseQuantity(warehouseId);
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("warehouseId", warehouseId);
|
||||
m.put("updateValue", updateValue);
|
||||
mapper.updateWarehouseQuantity(m);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ProductOutController {
|
||||
@ResponseBody
|
||||
public int delete(ProductOutDto dto) {
|
||||
System.out.println("데이터 :: " + dto);
|
||||
int i = service.deleteOut(dto);
|
||||
int i = service.outNow(dto);
|
||||
|
||||
return i;
|
||||
}
|
||||
@@ -130,13 +130,10 @@ public class ProductOutController {
|
||||
@PutMapping("/outNow")
|
||||
@ResponseBody
|
||||
public boolean outNow(ProductOutDto dto) {
|
||||
int i = service.outNowUpdate(dto);
|
||||
if (i != 0) {
|
||||
service.updateWarehouseDeleteStock(dto);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
service.outNowUpdate(dto);
|
||||
service.updateWarehouseDeleteStock(dto);
|
||||
service.stockQuantityUpdate(dto);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,4 +26,6 @@ public class ProductOutDto {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.no1.wms.out;
|
||||
|
||||
import com.no1.wms.stock.StockDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -26,6 +27,8 @@ public interface ProductOutMapper {
|
||||
|
||||
int updateWarehouseDeleteStock(ProductOutDto dto);
|
||||
|
||||
int stockQuantityUpdate(ProductOutDto dto);
|
||||
|
||||
int createOut(ProductOutDto dto);
|
||||
|
||||
Map<String, Object> outOne(String id);
|
||||
@@ -43,4 +46,5 @@ public interface ProductOutMapper {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.no1.wms.out;
|
||||
|
||||
import com.no1.wms.stock.StockDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -73,6 +74,10 @@ public class ProductOutService {
|
||||
return mapper.updateWarehouseDeleteStock(dto);
|
||||
}
|
||||
|
||||
public int stockQuantityUpdate(ProductOutDto dto) {
|
||||
return mapper.stockQuantityUpdate(dto);
|
||||
}
|
||||
|
||||
public int deleteOut(ProductOutDto dto) {
|
||||
return mapper.deleteOut(dto);
|
||||
}
|
||||
@@ -103,6 +108,5 @@ public class ProductOutService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ public class PlanInController {
|
||||
|
||||
@GetMapping("/list")
|
||||
public ModelAndView list(ModelAndView mav,@RequestParam(defaultValue = "0") int searchn, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "1") int page){
|
||||
int perPage = 10;
|
||||
int perPage = 15;
|
||||
int startRow = (page - 1) * perPage;
|
||||
int count = planinservice.count(searchn, search, startRow, perPage);
|
||||
int count = planinservice.count(searchn, search);
|
||||
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@ public class PlanInController {
|
||||
|
||||
|
||||
|
||||
|
||||
//스톡서비스로 재고 리스트 출력 메서트 작성
|
||||
List<PlanInDto> list = planinservice.selectAll(searchn, search, startRow, perPage);
|
||||
HashMap<String, Integer> map = new HashMap<>();
|
||||
for( int i = 0 ; i < list.size(); ++i){
|
||||
|
||||
@@ -21,12 +21,10 @@ public class PlanInService {
|
||||
}
|
||||
|
||||
|
||||
int count(int searchn, String search, int start, int perPage){
|
||||
int count(int searchn, String search){
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,14 +146,9 @@ public class StockController {
|
||||
// 생성 - Ajax
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public boolean createProcess(StockDto dto) {
|
||||
int i = service.createStock(dto);
|
||||
if (i != 0) {
|
||||
service.updateWarehousePlus(dto);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
public int createProcess(StockDto dto) {
|
||||
int c = service.checkandUpdateOrCreateProcess(dto);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,10 +167,10 @@ public class StockController {
|
||||
@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, String product_id,
|
||||
@RequestParam(name = "p", defaultValue = "1") int page,
|
||||
@RequestParam String name, ModelAndView mav){
|
||||
|
||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||
int perPage = 9; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
|
||||
List<Map<String, Object>> list = null;
|
||||
@@ -193,10 +188,9 @@ public class StockController {
|
||||
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 ,product_id);
|
||||
count = service.warehouseCount(searchn, search ,product_id);
|
||||
list = service.warehousesSelect(searchn, search, startRow, perPage);
|
||||
count = service.warehouseCount(searchn, search);
|
||||
}
|
||||
|
||||
mav.addObject("list", list);
|
||||
|
||||
mav.addObject("start", startRow + 1);
|
||||
@@ -230,9 +224,10 @@ public class StockController {
|
||||
|
||||
|
||||
// 리스트 다운로드
|
||||
@GetMapping("/stock/downloadExcelList")
|
||||
@GetMapping("/downloadExcelList")
|
||||
public void downlodeExcelList(HttpServletResponse response) {
|
||||
List<Map<String, Object>> dto = service.selectAll();
|
||||
System.out.println("엑셀 출력 확인 : : " + dto);
|
||||
String excelFileName = "재고 파일";
|
||||
String sheetName = "재고";
|
||||
String[] columnName = {"제품명","카테고리","창고","재고수"};
|
||||
@@ -241,7 +236,7 @@ public class StockController {
|
||||
};
|
||||
|
||||
//서식 다운로드
|
||||
@GetMapping("/stock/downloadStockForm")
|
||||
@GetMapping("/downloadStockForm")
|
||||
public void downlodeStockForm (HttpServletResponse response) throws IOException {
|
||||
String stockFormName = "재고 데이터 입력 서식.xlsx";
|
||||
excelDownlodeUtils.downlodeExcelForm(response, stockFormName);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.no1.wms.stock;
|
||||
|
||||
import com.no1.wms.in.InDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -44,5 +45,11 @@ public interface StockMapper {
|
||||
|
||||
|
||||
|
||||
int checkIfExistsStock(StockDto dto);
|
||||
int updateStockProcess(StockDto dto);
|
||||
int createStockProcess(StockDto dto);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,21 +16,21 @@ public class StockService {
|
||||
|
||||
public int count(int searchn, String search) {
|
||||
|
||||
System.out.println(searchn+search);
|
||||
System.out.println(searchn + search);
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
return mapper.count(m);
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> list(int searchn, String search, int start, int perPage){
|
||||
public List<Map<String, Object>> list(int searchn, String search, int start, int perPage) {
|
||||
|
||||
System.out.println(searchn+search);
|
||||
System.out.println(searchn + search);
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
@@ -43,21 +43,21 @@ public class StockService {
|
||||
|
||||
public int count2(int searchn, String search) {
|
||||
|
||||
System.out.println(searchn+search);
|
||||
System.out.println(searchn + search);
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
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){
|
||||
public List<Map<String, Object>> list2(int searchn, String search, int start, int perPage) {
|
||||
|
||||
System.out.println(searchn+search);
|
||||
System.out.println(searchn + search);
|
||||
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("start", start);
|
||||
m.put("perPage", perPage);
|
||||
@@ -83,15 +83,15 @@ public class StockService {
|
||||
return mapper.updateStock(dto);
|
||||
}
|
||||
|
||||
public int updateWarehouse(StockDto dto){
|
||||
public int updateWarehouse(StockDto dto) {
|
||||
return mapper.updateWarehouse(dto);
|
||||
}
|
||||
|
||||
public int updateWarehousePlus(StockDto dto){
|
||||
public int updateWarehousePlus(StockDto dto) {
|
||||
return mapper.updateWarehousePlus(dto);
|
||||
}
|
||||
|
||||
public int updateWarehouseDeleteStock(StockDto dto){
|
||||
public int updateWarehouseDeleteStock(StockDto dto) {
|
||||
return mapper.updateWarehouseDeleteStock(dto);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class StockService {
|
||||
}
|
||||
|
||||
|
||||
public List<Map<String, Object>> productSelect(int searchn, String search, int start, int perPage){
|
||||
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);
|
||||
@@ -115,32 +115,30 @@ public class StockService {
|
||||
public int productCount(int searchn, String search) {
|
||||
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
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, String product_id){
|
||||
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);
|
||||
m.put("product_id", product_id);
|
||||
|
||||
List<Map<String, Object>> warehouseresult = mapper.warehouseSelect(m);
|
||||
|
||||
return warehouseresult;
|
||||
}
|
||||
|
||||
public int warehouseCount(int searchn, String search, String product_id) {
|
||||
public int warehouseCount(int searchn, String search) {
|
||||
|
||||
|
||||
Map<String,Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn",searchn);
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
m.put("searchn", searchn);
|
||||
m.put("search", search);
|
||||
m.put("product_id", product_id);
|
||||
return mapper.warehouseCount(m);
|
||||
}
|
||||
|
||||
@@ -149,5 +147,17 @@ public class StockService {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//createProcess
|
||||
public int checkandUpdateOrCreateProcess(StockDto dto){
|
||||
mapper.updateWarehousePlus(dto);
|
||||
int j = mapper.checkIfExistsStock(dto);
|
||||
if (j == 1){
|
||||
mapper.updateStockProcess(dto);
|
||||
return 1;
|
||||
}else{
|
||||
mapper.createStockProcess(dto);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,15 +2,22 @@ package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.excel.ExcelDownlodeUtils;
|
||||
import com.no1.wms.excel.ExcelRequestManager;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -146,4 +153,61 @@ public class VendorController {
|
||||
String vendorFormName = "거래처 데이터 입력 서식.xlsx";
|
||||
excelDownlodeUtils.downlodeExcelForm(response, vendorFormName);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@PostMapping("/vendor/uplodeExcel")
|
||||
public String uploadExcel(@ModelAttribute("dto") VendorDto dto , RedirectAttributes redirectAttributes, final MultipartHttpServletRequest multiRequest,
|
||||
HttpServletRequest request, ModelMap model) {
|
||||
|
||||
Map<String, Object> resMap = new HashMap<>();
|
||||
|
||||
|
||||
try {
|
||||
|
||||
ExcelRequestManager em = new ExcelRequestManager();
|
||||
|
||||
// 멀티파트 요청 객체에서 파일 맵을 가져옴
|
||||
final Map<String, MultipartFile> files = multiRequest.getFileMap();
|
||||
//초기화
|
||||
List<HashMap<String,String>> apply =null;
|
||||
|
||||
//엑셀파일 가져와서 저장 및 읽기
|
||||
//변수는 멀티파트 요청 객체의 파일맵, 저장할 엑셀파일명 이름에 추가할 숫자(그냥 0으로 해도 됨)
|
||||
//마찬가지로 엑셀파일 명 이름에 추가할 문자열, uplode폴더에 들어갈 폴더명(카테고리같은 파트 이름으로 해주세요)
|
||||
//폴더가 없으면 자동생성되게 해뒀습니다.
|
||||
//마지막으로 HttpServletRequest
|
||||
apply = em.parseExcelSpringMultiPart(files, "테스트파일", 0, "", "category", request);
|
||||
|
||||
for (int i = 0; i < apply.size(); i++) {
|
||||
|
||||
|
||||
dto.setName(apply.get(i).get("nsme"));
|
||||
dto.setPresident_name(apply.get(i).get("president_name"));
|
||||
dto.setAddress(apply.get(i).get("address"));
|
||||
dto.setRegistration_number(apply.get(i).get("registration_number"));
|
||||
dto.setEmail(apply.get(i).get("email"));
|
||||
dto.setPresident_telephone(apply.get(i).get("president_telephone"));
|
||||
dto.setVendor_manager(apply.get(i).get("vendor_manager"));
|
||||
dto.setVendor_manager_telephone(apply.get(i).get("vendor_manager_telephone"));
|
||||
dto.setMain_product(apply.get(i).get("main_product"));
|
||||
dto.setManager_id(apply.get(i).get("manager_id"));
|
||||
dto.setActivation(true);
|
||||
|
||||
service.createProcess(dto);
|
||||
|
||||
}
|
||||
|
||||
resMap.put("res", "ok");
|
||||
resMap.put("msg", "업로드 성공");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.toString());
|
||||
resMap.put("res", "error");
|
||||
resMap.put("msg", "업로드 실패");
|
||||
}
|
||||
|
||||
redirectAttributes.addFlashAttribute("resMap", resMap);
|
||||
|
||||
return "redirect:/vendor/list";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.category.CategoryDto;
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -19,6 +20,7 @@ public interface VendorMapper {
|
||||
int updateVendor(VendorDto dto);
|
||||
|
||||
int createVendor(VendorDto dto);
|
||||
int createProcess(VendorDto dto);
|
||||
|
||||
int deleteVendor(String id);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.no1.wms.vendor;
|
||||
|
||||
import com.no1.wms.warehouse.WarehouseDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -49,6 +48,9 @@ public class VendorService {
|
||||
public int createVendor(VendorDto dto) {
|
||||
return mapper.createVendor(dto);
|
||||
}
|
||||
public int createProcess(VendorDto dto) {
|
||||
return mapper.createProcess(dto);
|
||||
}
|
||||
|
||||
|
||||
public int deleteVendor(String id) {
|
||||
|
||||
@@ -68,9 +68,6 @@ public class WarehouseController {
|
||||
WarehouseDto One = service.One(id);
|
||||
m.addAttribute("One", One);
|
||||
|
||||
|
||||
|
||||
|
||||
int perPage = 5; // 한 페이지에 보일 글의 갯수
|
||||
int startRow = (page - 1) * perPage;
|
||||
m.addAttribute("start", startRow + 1);
|
||||
@@ -78,8 +75,8 @@ public class WarehouseController {
|
||||
int warehouseOneCount = service.warehouseOneCount(searchn, search, id);
|
||||
List<Map<String, Object>> dto = service.warehouseOne(searchn, search, id, startRow, perPage);
|
||||
m.addAttribute("wlist", dto);
|
||||
System.out.println("list ::" + dto);
|
||||
|
||||
System.out.println("list ::" + dto);
|
||||
log.debug("dto테스트 :: " + dto);
|
||||
|
||||
int pageNum = 5;//보여질 페이지 번호 수
|
||||
|
||||
@@ -38,11 +38,14 @@
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createProcess" parameterType="InDto">
|
||||
INSERT INTO product_in (id, product_id, in_date, quantity, warehouse_id, manager_id, note, activation)
|
||||
VALUES (UUID(), #{product_id}, #{in_date}, #{quantity}, #{warehouse_id}, #{manager_id}, #{note}, 1)
|
||||
INSERT INTO product_in (id, product_id, in_date, quantity, warehouse_id, manager_id, note, activation)
|
||||
VALUES (UUID(), #{product_id}, #{in_date}, #{quantity}, #{warehouse_id}, #{manager_id}, #{note}, 1)
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="createStockProcess" parameterType="InDto">
|
||||
INSERT INTO stock (id, warehouse_id, product_id, quantity, activation)
|
||||
VALUES (UUID(), #{warehouse_id}, #{product_id}, #{quantity}, 1)
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- update -->
|
||||
@@ -53,12 +56,29 @@
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deactivateById" parameterType="String">
|
||||
UPDATE product_in
|
||||
SET activation = 0
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateStockProcessForUpdate" parameterType="InDto">
|
||||
UPDATE stock
|
||||
SET quantity = #{quantity}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</update>
|
||||
|
||||
<update id="updateStockProcess" parameterType="InDto">
|
||||
UPDATE stock
|
||||
SET quantity = quantity + #{quantity}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</update>
|
||||
|
||||
<update id="updateWarehouseQuantity" parameterType="Map">
|
||||
update warehouse set current_capacity = #{updateValue} where id = #{warehouseId} and activation = 1
|
||||
</update>
|
||||
|
||||
<!-- delete -->
|
||||
|
||||
<!-- select -->
|
||||
<select id="count" parameterType="map" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
@@ -141,19 +161,29 @@
|
||||
|
||||
<select id="checkIfExistsStock" resultType="int" parameterType="InDto">
|
||||
SELECT COUNT(*) FROM stock
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</select>
|
||||
|
||||
<update id="updateStockProcess" parameterType="InDto">
|
||||
UPDATE stock
|
||||
SET quantity = quantity + #{quantity}
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id}
|
||||
</update>
|
||||
|
||||
<insert id="createStockProcess" parameterType="InDto">
|
||||
INSERT INTO stock (id, warehouse_id, product_id, quantity, activation)
|
||||
VALUES (UUID(), #{warehouse_id}, #{product_id}, #{quantity}, 1)
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<select id="currntStockQuantity" parameterType="InDto" resultType="int">
|
||||
SELECT quantity
|
||||
FROM stock
|
||||
WHERE warehouse_id = #{warehouse_id} AND product_id = #{product_id} and activation = 1
|
||||
</select>
|
||||
|
||||
<select id="currntInQuantity" parameterType="InDto" resultType="int">
|
||||
SELECT quantity
|
||||
FROM product_in
|
||||
WHERE id = #{id} and activation = 1
|
||||
</select>
|
||||
|
||||
<select id="selectWarehouseQuantity" parameterType="String" resultType="String">
|
||||
select sum(quantity) from stock where warehouse_id = #{warehouseId} and activation = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,8 +66,9 @@
|
||||
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 1"> plan.activation = 1 and pn like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> plan.activation = 1 and plan.group_number like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 0"> plan.activation = 1 and plan.view_group_number like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 1"> plan.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> plan.activation = 1 and plan.quantity like concat(#{search})</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by plan.view_group_number desc limit #{start}, #{perPage}
|
||||
|
||||
@@ -37,10 +37,11 @@
|
||||
|
||||
|
||||
<select id="outOne" parameterType="Map" resultType="Map">
|
||||
select o.id as id, p.name as product_name, p.kan_code, o.quantity, w.name as warehouse_name, w.id as warehouse_id, p.id as product_id, o.expected_delivery_date, o.delivery_date, o.note
|
||||
select o.id as id, p.name as product_name, p.kan_code, o.quantity as outQuantity, s.quantity as stockQuantity, w.name as warehouse_name, w.id as warehouse_id, p.id as product_id, o.expected_delivery_date, o.delivery_date, o.note
|
||||
from product_out o
|
||||
left join warehouse w on o.warehouse_id = w.id
|
||||
left join product p on o.product_id = p.id
|
||||
left join warehouse w on o.warehouse_id = w.id
|
||||
left join stock s on o.product_id = s.product_id and o.warehouse_id = s.warehouse_id
|
||||
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
@@ -119,6 +120,12 @@
|
||||
set quantity = #{quantity}, expected_delivery_date = #{expected_delivery_date}, delivery_date = #{delivery_date}
|
||||
where id = #{id};
|
||||
</update>
|
||||
|
||||
<update id="stockQuantityUpdate" parameterType="com.no1.wms.out.ProductOutDto">
|
||||
update stock
|
||||
set quantity = quantity - #{quantity}
|
||||
where product_id = #{product_id} and warehouse_id = #{warehouse_id};
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
@@ -136,4 +143,9 @@
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -27,6 +27,7 @@
|
||||
<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>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
@@ -44,6 +45,7 @@
|
||||
<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>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by s.id desc limit #{start}, #{perPage}
|
||||
@@ -62,6 +64,7 @@
|
||||
<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>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
@@ -79,13 +82,22 @@
|
||||
<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>
|
||||
<when test="searchn == 3">s.activation = 1 and w.name 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
|
||||
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,
|
||||
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
@@ -98,7 +110,6 @@
|
||||
<select id="productSelect" parameterType="Map" resultType="Map">
|
||||
SELECT p.id as productId, name, company_name, cls_Nm_4, p.kan_code
|
||||
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>
|
||||
@@ -113,7 +124,6 @@
|
||||
<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>
|
||||
@@ -125,15 +135,18 @@
|
||||
</select>
|
||||
|
||||
<select id="warehouseSelect" parameterType="Map" resultType="Map">
|
||||
select w.id as warehouseId, w.name as warehouseName, capacity, current_capacity ,address
|
||||
select w.id as warehouseId,
|
||||
w.name as warehouseName,
|
||||
capacity,
|
||||
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity ,
|
||||
address
|
||||
from warehouse w
|
||||
left join stock s on s.warehouse_id = w.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by w.name desc limit #{start}, #{perPage}
|
||||
@@ -142,13 +155,12 @@
|
||||
<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.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> (s.product_id <> #{product_id} or s.product_id is null) and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 0"> w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and address like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
@@ -198,4 +210,24 @@
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="checkIfExistsStock" resultType="int" parameterType="com.no1.wms.stock.StockDto">
|
||||
SELECT COUNT(*) FROM stock
|
||||
WHERE warehouse_id = #{warehouseId} AND product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<update id="updateStockProcess" parameterType="com.no1.wms.stock.StockDto">
|
||||
UPDATE stock
|
||||
SET quantity = quantity + #{quantity}
|
||||
WHERE warehouse_id = #{warehouseId} AND product_id = #{productId}
|
||||
</update>
|
||||
|
||||
<insert id="createStockProcess" parameterType="com.no1.wms.stock.StockDto">
|
||||
INSERT INTO stock (id, warehouse_id, product_id, quantity, activation)
|
||||
VALUES (UUID(), #{warehouseId}, #{productId}, #{quantity}, 1)
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -5,7 +5,7 @@
|
||||
<mapper namespace="com.no1.wms.vendor.VendorMapper">
|
||||
|
||||
<select id="selectAll" resultType="VendorDto">
|
||||
select
|
||||
select id,
|
||||
name,
|
||||
president_name,
|
||||
address,
|
||||
@@ -14,7 +14,9 @@
|
||||
president_telephone,
|
||||
vendor_manager,
|
||||
vendor_manager_telephone,
|
||||
main_products
|
||||
main_product,
|
||||
manager_id,
|
||||
activation
|
||||
|
||||
from vendor;
|
||||
</select>
|
||||
@@ -108,7 +110,12 @@
|
||||
<!-- 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})
|
||||
values (UUID(), #{name}, #{president_name}, #{address}, #{registration_number}, #{email}, #{president_telephone}, #{vendor_manager}, #{vendor_manager_telephone}, #{main_product}, #{manager_id}, 1)
|
||||
</insert>
|
||||
|
||||
<insert id="createProcess" 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}, 1)
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
select count(w.id)
|
||||
|
||||
from warehouse w
|
||||
|
||||
@@ -20,9 +20,11 @@
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity
|
||||
|
||||
from warehouse w
|
||||
SELECT w.id,
|
||||
w.name,
|
||||
w.capacity,
|
||||
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
|
||||
FROM warehouse w
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
@@ -35,7 +37,7 @@
|
||||
</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
|
||||
select w.id, w.name, w.capacity, (SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity, w.address
|
||||
|
||||
from warehouse w
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto">
|
||||
<tr class="detailTr" data-kan_code="${dto.kan_code}" >
|
||||
<td>${dto.cls_nm_1 }</td>
|
||||
<td>${dto.cls_nm_2 }</td>
|
||||
<td>${dto.cls_nm_3 }</td>
|
||||
<td>${dto.cls_nm_4 }</td>
|
||||
<td>${dto.kan_code }</td>
|
||||
<tr class="detailTr col-5" data-kan_code="${dto.kan_code}" >
|
||||
<td class="col-1">${dto.cls_nm_1 }</td>
|
||||
<td class="col-1">${dto.cls_nm_2 }</td>
|
||||
<td class="col-1">${dto.cls_nm_3 }</td>
|
||||
<td class="col-1">${dto.cls_nm_4 }</td>
|
||||
<td class="col-1">${dto.kan_code }</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
@@ -68,7 +68,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row row-buttons">
|
||||
<div class="col-3 text-start">
|
||||
<!-- <img alt="엑셀이미지" src="엑셀이미지"> -->
|
||||
<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="downlodeExcelForm">양식다운로드</button>
|
||||
|
||||
|
||||
@@ -101,25 +101,10 @@
|
||||
</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>
|
||||
<input type="file" name="file" id="file" accept=".xlsx, .xls"/>
|
||||
<button type="submit" class="btn btn-success" id="uploadExcel">업로드</button>
|
||||
</form><!-- uplodeExcleForm -->
|
||||
|
||||
</div><!-- row row-buttons -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
alert("삭제되었습니다.");
|
||||
$(location).attr("href", "/category/list");
|
||||
} else {
|
||||
alert("정상적으로 삭제되지 않았습니다..");
|
||||
alert("정상적으로 삭제되지 않았습니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
@@ -127,8 +127,6 @@
|
||||
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||
yesNoModal.yesFunction = deleteCategoryFunction;
|
||||
yesNoModalBootStrap.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="col-12" style="text-align: center;">
|
||||
<!-- 제품명 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">제품명</span>
|
||||
<span class="input-group-text" id="product_name_span">제품명</span>
|
||||
<input type="text" name="productName" id="productName" class="form-control"
|
||||
placeholder="제품명을 검색하세요" aria-label="제품명" value="${dto.productDto.name }"
|
||||
aria-describedby="basic-addon1" readonly>
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
<!-- 창고명 -->
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon1">창고명</span>
|
||||
<span class="input-group-text" id="warehouse_name_span">창고명</span>
|
||||
<input type="text" name="warehouse_name" id="warehouse_name" class="form-control"
|
||||
placeholder="창고를 검색하세요" aria-label="창고명" value="${dto.warehouseDto.name }"
|
||||
aria-describedby="basic-addon1" readonly>
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon3">입고날짜</span>
|
||||
<fmt:formatDate value="${dto.in_date}" pattern="yyyy-MM-dd HH:mm:ss" type="date" var="formattedDate" />
|
||||
<fmt:formatDate value="${dto.in_date}" pattern="yyyy-MM-dd'T'HH:mm" type="date" var="formattedDate" />
|
||||
<input type="datetime-local" id="in_date" name="in_date" class="form-control"
|
||||
placeholder="날짜을 입력하세요" aria-label="입고날짜" value="${formattedDate}"
|
||||
aria-describedby="basic-addon1">
|
||||
@@ -138,6 +138,10 @@
|
||||
var in_date = $("#in_date").val();
|
||||
var manager_id = $("#manager_id").val();
|
||||
var note = $("#note").val();
|
||||
var quantity = parseInt($("#quantity").val(), 10);
|
||||
var remainingcapacity = parseInt($("#remainingcapacity").val(), 10);
|
||||
|
||||
|
||||
|
||||
if(!product_id){
|
||||
alert("제품을 선택해야합니다.");
|
||||
@@ -153,6 +157,12 @@
|
||||
alert("창고을 선택해야합니다.");
|
||||
return false;
|
||||
}
|
||||
if (quantity > remainingcapacity) {
|
||||
alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!in_date){
|
||||
in_date = new Date();
|
||||
in_date = in_date.toISOString();
|
||||
@@ -170,7 +180,7 @@
|
||||
warehouse_id : warehouse_id,
|
||||
note : note
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
|
||||
$.ajax({
|
||||
url: "/in/create_process",
|
||||
|
||||
@@ -141,19 +141,85 @@
|
||||
});//body detailTr
|
||||
|
||||
|
||||
//검색기능
|
||||
$("#searchBtn").on("click",function(){
|
||||
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/in/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 pagingFunction(clickedId){
|
||||
var searchn1 = $("#searchn1").val();
|
||||
var search1 = $("#search1").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/in/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();
|
||||
|
||||
}//pagingFunction
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -113,6 +113,42 @@
|
||||
|
||||
});//ready
|
||||
|
||||
function deleteInFunction(){
|
||||
var id = $("#id").val();
|
||||
$.ajax({
|
||||
url: "/in/delete",
|
||||
type: "delete",
|
||||
data: {
|
||||
"id": id
|
||||
},
|
||||
datatype:"json"
|
||||
}).done(function(data) {
|
||||
if (data == true) {
|
||||
alert("삭제되었습니다.");
|
||||
$(location).attr("href", "/in/list");
|
||||
} else {
|
||||
alert("정상적으로 삭제되지 않았습니다.");
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
//
|
||||
});
|
||||
|
||||
}//deleteInFunction
|
||||
|
||||
|
||||
function goDelete(){
|
||||
yesNoModalTextDefine("입고 삭제", "해당 입고를 삭제하시겠습니까?");
|
||||
$("#yesNoModalLabel").text(yesNoModal.title);
|
||||
$("#yesNoModalBodyTextDiv").text(yesNoModal.body);
|
||||
yesNoModal.yesFunction = deleteInFunction;
|
||||
yesNoModalBootStrap.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchProductName"
|
||||
style="background-color:#FF5E5E;" type="button"
|
||||
onclick="showSearchModal_product('제품 검색','product')">검색</button>
|
||||
<input type='hidden' id="product_id" value="">
|
||||
<input type='hidden' id="product_id" value="${dto.product_id}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
@@ -52,7 +52,7 @@
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span class="input-group-text" id="basic-addon2">수량</span>
|
||||
<input type="number" name="quantity" id="quantity" class="form-control"
|
||||
value="${dto.quantity}" readonly>
|
||||
value="${dto.quantity}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
@@ -63,7 +63,7 @@
|
||||
<button class="btn btn-outline-secondary rounded-end" id="searchWarehouseName"
|
||||
style="background-color:#FF5E5E;" type="button"
|
||||
onclick="showSearchModal_warehouse('창고 검색','warehouse_capacity_currentCapacity')">검색</button>
|
||||
<input type='hidden' id="warehouse_id" value="">
|
||||
<input type='hidden' id="warehouse_id" value="${dto.warehouse_id}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
@@ -103,6 +103,7 @@
|
||||
|
||||
<c:set var="userData" value="${sessionScope.userData}" />
|
||||
<input type='hidden' id="manager_id" value="${userData.id}">
|
||||
<input type='hidden' id="id" value="${dto.id}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,11 +145,11 @@
|
||||
var in_date = $("#in_date").val();
|
||||
var manager_id = $("#manager_id").val();
|
||||
var note = $("#note").val();
|
||||
if(!name){
|
||||
alert("제품명을 입력해야 합니다.");
|
||||
$("#name").focus();
|
||||
return false;
|
||||
}
|
||||
var id = $("#id").val();
|
||||
var quantityAdjustment = parseInt($("#quantityAdjustment").val(), 10);
|
||||
var remainingcapacity = parseInt($("#remainingcapacity").val(), 10);
|
||||
|
||||
|
||||
if(!product_id){
|
||||
alert("제품을 선택해야합니다.");
|
||||
return false;
|
||||
@@ -163,6 +164,12 @@
|
||||
alert("창고을 선택해야합니다.");
|
||||
return false;
|
||||
}
|
||||
if (quantityAdjustment > remainingcapacity) {
|
||||
alert("적재 할 재고량이 재고량 한도를 넘을 수 없습니다.");
|
||||
$("#quantityAdjustment").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!in_date){
|
||||
in_date = new Date();
|
||||
in_date = in_date.toISOString();
|
||||
@@ -177,9 +184,10 @@
|
||||
in_date : in_date,
|
||||
manager_id : manager_id,
|
||||
warehouse_id : warehouse_id,
|
||||
note : note
|
||||
note : note,
|
||||
id : id
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
$.ajax({
|
||||
url: "/in/update_process",
|
||||
type: "put",
|
||||
@@ -207,6 +215,7 @@
|
||||
|
||||
} else {
|
||||
alert("입고 수정에 실패하였습니다.");
|
||||
console.log(data);
|
||||
}
|
||||
}).fail(function() {
|
||||
alert("오류가 발생했습니다.");
|
||||
@@ -216,41 +225,41 @@
|
||||
});//submitBtn
|
||||
|
||||
});//ready
|
||||
function showSearchModal(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.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)
|
||||
}
|
||||
});
|
||||
}
|
||||
function showSearchModal_product(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/in/show_modal_product', // 요청할 서버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)
|
||||
}
|
||||
});
|
||||
}//showSearchModal_products
|
||||
|
||||
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)
|
||||
}
|
||||
});
|
||||
}
|
||||
function showSearchModal_warehouse(title, val){
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/in/show_modal_warehouse', // 요청할 서버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)
|
||||
}
|
||||
});
|
||||
}//showSearchModal_warehouse
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -113,13 +113,13 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto">
|
||||
<tr class="detailTr" data-kan_code="${dto.kan_code}" >
|
||||
<td>${dto.cls_nm_1 }</td>
|
||||
<td>${dto.cls_nm_2 }</td>
|
||||
<td>${dto.cls_nm_3 }</td>
|
||||
<td>${dto.cls_nm_4 }</td>
|
||||
<td>${dto.kan_code }</td>
|
||||
<td><button data-tid="${dto.kan_code}" data-tname="${dto.cls_nm_4}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
<tr class="detailTr col-6" data-kan_code="${dto.kan_code}" >
|
||||
<td class="col-1">${dto.cls_nm_1 }</td>
|
||||
<td class="col-1">${dto.cls_nm_2 }</td>
|
||||
<td class="col-1">${dto.cls_nm_3 }</td>
|
||||
<td class="col-1">${dto.cls_nm_4 }</td>
|
||||
<td class="col-1">${dto.kan_code }</td>
|
||||
<td class="col-1"><button data-tid="${dto.kan_code}" data-tname="${dto.cls_nm_4}" class="btn btn-primary" onclick="onSelect(this)">선택</button></td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
});//submitBtn
|
||||
});//ready
|
||||
function _onSubmit(){
|
||||
if($("#file").val() == ""){
|
||||
if($("#file").val()){
|
||||
alert("이미지 파일을 업로드해주세요.");
|
||||
$("#file").focus();
|
||||
return false;
|
||||
|
||||
@@ -54,7 +54,10 @@
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='expected_delivery_date_label' class="input-group-text">출고 예정 날짜</span>
|
||||
<input type="text" id="expected_delivery_date" placeholder="yyyy-MM-dd">
|
||||
<fmt:formatDate value="${dto.expected_delivery_date}" pattern="yyyy-MM-dd" type="date" var="formattedDate" />
|
||||
<input type="date" id="expected_delivery_date" name="expected_delivery_date" class="form-control"
|
||||
placeholder="날짜을 입력하세요" aria-label="입고날짜" value="${formattedDate}"
|
||||
aria-describedby="basic-addon1" min="${today}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
@@ -108,14 +111,14 @@
|
||||
|
||||
$("#submitBtn").on("click", function () {
|
||||
var product_id = $("#product_id").val();
|
||||
var quantity = $("#quantity").val();
|
||||
var quantity = parseInt($("#quantity").val(), 10);
|
||||
var expected_delivery_date = $("#expected_delivery_date").val();
|
||||
var delivery_date = $("#delivery_date").val();
|
||||
var warehouse_id = $("#warehouse_id").val();
|
||||
var manager_id = $("#manager_id").val();
|
||||
var note = $("#note").val();
|
||||
var activation = $("#activation").val();
|
||||
var shipment_quantity = $("#shipment_quantity").val();
|
||||
var shipment_quantity = parseInt($("#shipment_quantity").val(), 10);
|
||||
|
||||
|
||||
if (!product_id) {
|
||||
@@ -195,4 +198,9 @@
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var today = new Date().toISOString().split('T')[0];
|
||||
document.getElementById("expected_delivery_date").setAttribute('min', today);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
<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="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
|
||||
<option value="1" ${searchn == 1 ? 'selected' : ''}>창고명</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" name="search" id="search" class="form-control"
|
||||
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
|
||||
<input class="btn btn-info" type="submit" id="searchBtn" value="검색"/>
|
||||
|
||||
<!-- 페이징작업용 -->
|
||||
|
||||
@@ -37,8 +37,13 @@
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='quantity_name' class="input-group-text">출고량</span>
|
||||
<input readonly id="quantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.quantity}">
|
||||
<span id='stockQuantity_name' class="input-group-text">재고량</span>
|
||||
<input readonly id="stockQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.stockQuantity}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='outQuantity_name' class="input-group-text">출고량</span>
|
||||
<input readonly id="outQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.outQuantity}">
|
||||
</div>
|
||||
|
||||
<!--창고 관련 -->
|
||||
@@ -60,7 +65,7 @@
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='note_label' class="input-group-text">비고</span>
|
||||
<textarea readonly id="note" class="form-control" rows="5" value="${dto.note}"></textarea>
|
||||
<textarea readonly id="note" class="form-control" rows="5">${dto.note}</textarea>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -68,7 +73,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row col-12">
|
||||
<div class="col-6 ">
|
||||
<div class="col-6" id="onoff">
|
||||
<div class="w-40 col-centered" style="text-align: right">
|
||||
<button type="button" class="btn btn-danger" id="outNow">출고</button>
|
||||
</div>
|
||||
@@ -109,7 +114,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
<button id="modal_yes_button_outNow" type="button" class="modal_yes btn btn-primary">삭제</button>
|
||||
<button id="modal_yes_button_outNow" type="button" class="modal_yes btn btn-primary">출고</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -137,6 +142,13 @@
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
var deliveryDate = $("#delivery_date").val();
|
||||
|
||||
// '출고 날짜' 입력 필드에 값이 있다면, '출고' 버튼을 숨깁니다.
|
||||
if (deliveryDate) {
|
||||
$("#outNow").hide();
|
||||
}
|
||||
|
||||
$("#modifyBtn").on("click", function () {
|
||||
var id = $("#id").val();
|
||||
|
||||
@@ -207,16 +219,28 @@
|
||||
|
||||
function outNowUpdate() {
|
||||
var id = $("#id").val();
|
||||
var stockQuantity = parseInt($("#stockQuantity").val(), 10);
|
||||
var outQuantity = parseInt($("#outQuantity").val(), 10);
|
||||
var product_id = $("#product_id").val()
|
||||
var warehouse_id = $("#warehouse_id").val();
|
||||
var expected_delivery_date = $("#expected_delivery_date").val();
|
||||
// 현재 날짜와 시간을 얻기
|
||||
var now = new Date();
|
||||
var delivery_date = now.toISOString().slice(0, 19).replace('T', ' ');
|
||||
|
||||
if (outQuantity > stockQuantity) {
|
||||
alert("출고량이 재고량을 넘을 수 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/out/outNow",
|
||||
type: "put",
|
||||
data: {
|
||||
"id": id,
|
||||
"quantity": outQuantity,
|
||||
"product_id":product_id,
|
||||
"warehouse_id": warehouse_id,
|
||||
"expected_delivery_date": expected_delivery_date,
|
||||
"delivery_date": delivery_date
|
||||
},
|
||||
|
||||
@@ -34,10 +34,14 @@
|
||||
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='shipment_quantity_label' class="input-group-text">출고량</span>
|
||||
<input id="quantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.quantity}">
|
||||
<span id='stockQuantity_name' class="input-group-text">재고량</span>
|
||||
<input readonly id="stockQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.stockQuantity}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='outQuantity_name' class="input-group-text">출고량</span>
|
||||
<input readonly id="outQuantity" type="text" class="form-control" placeholder="수량을 입력하세요" value="${dto.outQuantity}">
|
||||
</div>
|
||||
|
||||
|
||||
<!--창고 관련 -->
|
||||
@@ -49,17 +53,20 @@
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='expected_delivery_date_label' class="input-group-text">출고 예정 날짜</span>
|
||||
<input type="text" id="expected_delivery_date" placeholder="yyyy-MM-dd" value="${dto.expected_delivery_date}">
|
||||
<fmt:formatDate value="${dto.expected_delivery_date}" pattern="yyyy-MM-dd" type="date" var="formattedDate" />
|
||||
<input type="date" id="expected_delivery_date" name="expected_delivery_date" class="form-control"
|
||||
placeholder="날짜을 입력하세요" aria-label="입고날짜" value="${formattedDate}"
|
||||
aria-describedby="basic-addon1">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='delivery_date_label' class="input-group-text">출고 날짜</span>
|
||||
<input type="text" id="delivery_date" placeholder="" readonly value="${dto.expected_delivery_date}">
|
||||
<input type="text" id="delivery_date" placeholder="" readonly value="${dto.delivery_date}">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='note_label' class="input-group-text">비고</span>
|
||||
<textarea id="note" class="form-control" rows="5" value="${note}"></textarea>
|
||||
<textarea id="note" class="form-control" rows="5">${dto.note}</textarea>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -103,13 +110,17 @@
|
||||
$("#updateBtn").on("click", function () {
|
||||
var id = $("#id").val();
|
||||
var product_id = $("#product_id").val();
|
||||
var quantity = $("#quantity").val();
|
||||
var stockQuantity = parseInt($("#stockQuantity").val(), 10);
|
||||
var outQuantity = parseInt($("#outQuantity").val(), 10);
|
||||
var expected_delivery_date = $("#expected_delivery_date").val();
|
||||
var warehouse_id = $("#warehouse_id").val();
|
||||
var note = $("#note").val();
|
||||
var activation = $("#activation").val();
|
||||
|
||||
|
||||
if (outQuantity > stockQuantity) {
|
||||
alert("출고량이 재고량을 넘을 수 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!product_id) {
|
||||
alert("제품을 선택해야 합니다.");
|
||||
@@ -130,7 +141,7 @@
|
||||
"expected_delivery_date":expected_delivery_date,
|
||||
"note":note,
|
||||
"warehouse_id": warehouse_id,
|
||||
"quantity": quantity,
|
||||
"quantity": outQuantity,
|
||||
"activation": activation,
|
||||
|
||||
|
||||
|
||||
@@ -41,11 +41,21 @@
|
||||
</div>
|
||||
<div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 att">
|
||||
<form class="d-inline" id="search_form">
|
||||
<select name="searchn">
|
||||
<option <c:if test="${searchn == 0}">selected="selected"</c:if> value="0">그룹번호</option>
|
||||
<option <c:if test="${searchn == 1}">selected="selected"</c:if> value="1">제품명</option>
|
||||
<option <c:if test="${searchn == 2}">selected="selected"</c:if> value="2">수량</option>
|
||||
</select>
|
||||
<input type="text" name="search" maxlength="50" value="${search}"/>
|
||||
<button type="submit" class="btn btn-primary" >검색</button>
|
||||
<input id="pPage" hidden type="text" name="page">
|
||||
</form>
|
||||
<button style="float: right;" class="btn btn-primary" type="submit" id="btn_create" onclick="goCreate() ">생성</button>
|
||||
</div>
|
||||
<div class="col-12 m-0">
|
||||
|
||||
@@ -7,116 +7,117 @@
|
||||
</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="showSearchModals2('창고 검색','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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ulTag">
|
||||
<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 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="showSearchModals2('창고 검색','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="" 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="재고량"
|
||||
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>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function showSearchModals(title, val){
|
||||
function showSearchModals(title, val) {
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
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) { // 결과 성공 콜백함수
|
||||
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) {
|
||||
error: function (request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showSearchModals2(title, val){
|
||||
function showSearchModals2(title, val) {
|
||||
$("#searchModalLabel").text(title);
|
||||
const data = { name : val};
|
||||
var product_id = $("#product_id").val();
|
||||
const data = {name: val};
|
||||
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/stock/show_modal', // 요청할 서버url
|
||||
dataType : 'html', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : {"product_id" : product_id},data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
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) {
|
||||
error: function (request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
@@ -129,9 +130,18 @@
|
||||
$("#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();
|
||||
var quantity = parseInt($("#quantity").val(), 10);
|
||||
var remainingcapacity = parseInt($("#remainingcapacity").val(), 10);
|
||||
|
||||
console.log("Quantity:", quantity);
|
||||
console.log("Remaining Capacity:", remainingcapacity);
|
||||
|
||||
if (quantity > remainingcapacity) {
|
||||
alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!product_id) {
|
||||
alert("제품을 선택해야 합니다.");
|
||||
@@ -150,12 +160,6 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if (quantity > remainingcapacity) {
|
||||
alert("적재 할 재고량이 잔여 용량을 넘을 수 없습니다.");
|
||||
$("#quantity").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/stock/create_process",
|
||||
type: "post",
|
||||
@@ -168,8 +172,13 @@
|
||||
},
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("재고 정보가 생성되었습니다.");
|
||||
if (data != 0) {
|
||||
if (data == 1) {
|
||||
alert("기존 재고에 추가되었습니다.");
|
||||
} else {
|
||||
alert("재고 정보가 생성되었습니다.");
|
||||
}
|
||||
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/stock/read";
|
||||
|
||||
@@ -48,13 +48,14 @@
|
||||
<div class="input-group mb-3 w-30 col-centered">
|
||||
<div class="w-25">
|
||||
<select class="form-select" name="searchn1" id="searchn1">
|
||||
<option value="0">제품명</option>
|
||||
<option value="1">카테고리</option>
|
||||
<option value="2">재고수</option>
|
||||
<option value="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
|
||||
<option value="1" ${searchn == 1 ? 'selected' : ''}>카테고리</option>
|
||||
<option value="2" ${searchn == 2 ? 'selected' : ''}>재고수</option>
|
||||
<option value="3" ${searchn == 3 ? 'selected' : ''}>창고명</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search1" name="search" class="form-control"
|
||||
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
|
||||
<!-- 페이징작업용 -->
|
||||
@@ -98,7 +99,6 @@
|
||||
<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="downlodeStockForm">서식 다운로드</button>
|
||||
<button type="button" class="btn btn-success" id="downlodeExcelList">리스트 다운로드</button>
|
||||
</div>
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
@@ -147,13 +147,14 @@
|
||||
<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>
|
||||
<option value="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
|
||||
<option value="1" ${searchn == 1 ? 'selected' : ''}>카테고리</option>
|
||||
<option value="2" ${searchn == 2 ? 'selected' : ''}>재고수</option>
|
||||
<option value="3" ${searchn == 3 ? 'selected' : ''}>창고명</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search2" name="search" class="form-control"
|
||||
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn2">검색</button>
|
||||
|
||||
<!-- 페이징작업용 -->
|
||||
@@ -175,6 +176,7 @@
|
||||
<th>제품명</th>
|
||||
<th>카테고리</th>
|
||||
<th>재고수</th>
|
||||
<th>창고</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -184,6 +186,7 @@
|
||||
<td class="col-1">${dto.productName }</td>
|
||||
<td class="col-1">${dto.cls_nm_4 }</td>
|
||||
<td class="col-1">${dto.quantity }</td>
|
||||
<td class="col-1">${dto.warehouseName}</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
@@ -195,7 +198,6 @@
|
||||
<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="downlodeStockForm2">서식 다운로드</button>
|
||||
<button type="button" class="btn btn-success" id="downlodeExcelList2">리스트 다운로드</button>
|
||||
</div>
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<!--창고 관련 -->
|
||||
<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 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>
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3 w-40 col-centered">
|
||||
<span id='RemainingCapacity_label' class="input-group-text">재고량 한도</span>
|
||||
<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>
|
||||
|
||||
@@ -120,9 +120,9 @@
|
||||
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();
|
||||
var quantityAdjustment = parseInt($("#quantityAdjustment").val(), 10);
|
||||
var remainingcapacity = parseInt($("#remainingcapacity").val(), 10);
|
||||
|
||||
|
||||
if (!product_id) {
|
||||
|
||||
34
src/main/webapp/WEB-INF/views/vendor/list.jsp
vendored
34
src/main/webapp/WEB-INF/views/vendor/list.jsp
vendored
@@ -18,13 +18,13 @@
|
||||
<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>
|
||||
<option value="0" ${searchn == 0 ? 'selected' : ''}>업체명</option>
|
||||
<option value="1" ${searchn == 1 ? 'selected' : ''}>대표번호</option>
|
||||
<option value="2" ${searchn == 2 ? 'selected' : ''}>거래처 담당자</option>
|
||||
<option value="3" ${searchn == 3 ? 'selected' : ''}>거래처 담당자 전화번호</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
<input type="text" id="search" name="search" class="form-control" aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
|
||||
<!-- 페이징작업용 -->
|
||||
@@ -69,8 +69,7 @@
|
||||
<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="upload">업로드</button>
|
||||
<button type="button" class="btn btn-success" id="downlodeExcelForm">서식 다운로드</button>
|
||||
<button type="button" class="btn btn-success" id="downlodeExcelForm">양식 다운로드</button>
|
||||
<button type="button" class="btn btn-success" id="downlodeExcelList">리스트 다운로드</button>
|
||||
</div>
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
@@ -99,6 +98,14 @@
|
||||
<button type="button" class="btn btn-primary" id="createButton">생성</button>
|
||||
</div>
|
||||
</div><!-- row row-buttons -->
|
||||
|
||||
|
||||
<form name="uplodeExcleForm" id="uplodeExcleForm" method="post" onsubmit="return _onSubmit();" action="/vendor/uplodeExcel" enctype="multipart/form-data" class="form-horizontal">
|
||||
<input type="file" name="file" id="file" accept=".xlsx, .xls"/>
|
||||
<button type="submit" class="btn btn-success" id="uploadExcel">업로드</button>
|
||||
</form><!-- uplodeExcleForm -->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -215,6 +222,19 @@
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function _onSubmit(){
|
||||
|
||||
if($("#file").val() == ""){
|
||||
alert("파일을 업로드해주세요.");
|
||||
$("#file").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -30,13 +30,13 @@
|
||||
<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="0" ${searchn == 0 ? 'selected' : ''}>창고명</option>
|
||||
<option value="1" ${searchn == 1 ? 'selected' : ''}>용량</option>
|
||||
<option value="2" ${searchn == 2 ? 'selected' : ''}>적재량</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" name="search" id="search" class="form-control"
|
||||
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
aria-label="Text input with dropdown button" value="${search}" placeholder="검색어를 입력하세요">
|
||||
<button class="btn btn-info" type="button" id="searchBtn">검색</button>
|
||||
|
||||
<!-- 페이징작업용 -->
|
||||
|
||||
@@ -53,14 +53,21 @@
|
||||
<div class="input-group mb-3 w-30 col-centered">
|
||||
<div class="w-25">
|
||||
<select class="form-select" id="searchn">
|
||||
<option value="0">제품명</option>
|
||||
<option value="1">재고수</option>
|
||||
<option value="0" ${searchn == 0 ? 'selected' : ''}>제품명</option>
|
||||
<option value="1" ${searchn == 1 ? 'selected' : ''}>재고수</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type=hidden id="id" value="${One.id}">
|
||||
<input type="text" name="search" class="form-control" id="search"
|
||||
aria-label="Text input with dropdown button" placeholder="검색어를 입력하세요">
|
||||
<input class="btn btn-info" type="submit" id="searchBtn" value="검색"/>
|
||||
aria-label="Text input with dropdown button" value="${search}" 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>
|
||||
@@ -98,21 +105,26 @@
|
||||
<div class="col-6 d-flex justify-content-center">
|
||||
<nev>
|
||||
<ul class="pagination">
|
||||
|
||||
<c:if test="${begin > pageNum }">
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="read?p=${begin - 1 }"><</a>
|
||||
<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 class="page-link " href="read?p=${i }">${i }</a>
|
||||
<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 class="page-link" href="read?p=${end + 1 }">></a>
|
||||
<a href="javascript:void(0);" class="page-link"
|
||||
onclick="pageingFunction(this.id)" id="${end + 1 }">></a>
|
||||
</li>
|
||||
</c:if>
|
||||
|
||||
</ul>
|
||||
</nev>
|
||||
</div>
|
||||
@@ -138,7 +150,8 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
<button id="modal_yes_button_warehouse_delete" type="button" class="modal_yes btn btn-primary">삭제</button>
|
||||
<button id="modal_yes_button_warehouse_delete" type="button" class="modal_yes btn btn-primary">삭제
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -150,7 +163,7 @@
|
||||
$(location).attr("href", "/warehouse/list");
|
||||
})//checkBtn click
|
||||
|
||||
$("#modifyBtn").on("click", function() {
|
||||
$("#modifyBtn").on("click", function () {
|
||||
var id = $("#id").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
@@ -169,13 +182,10 @@
|
||||
})//modifyBtn click
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
yesNoModal.yesFunction = deleteWarehouseFunction;
|
||||
|
||||
|
||||
function deleteWarehouseFunction(){
|
||||
function deleteWarehouseFunction() {
|
||||
var id = $("#id").val();
|
||||
$.ajax({
|
||||
url: "/warehouse/delete",
|
||||
@@ -183,65 +193,138 @@
|
||||
data: {
|
||||
"id": id
|
||||
},
|
||||
datatype:"json"
|
||||
}).done(function(data) {
|
||||
datatype: "json"
|
||||
}).done(function (data) {
|
||||
if (data == true) {
|
||||
alert("삭제되었습니다.");
|
||||
$(location).attr("href", "/warehouse/list");
|
||||
} else {
|
||||
alert("정상적으로 삭제되지 않았습니다..");
|
||||
}
|
||||
}).fail(function() {
|
||||
}).fail(function () {
|
||||
alert("오류가 발생했습니다.");
|
||||
}).always(function() {
|
||||
}).always(function () {
|
||||
//
|
||||
});
|
||||
|
||||
}//deleteCategoryFunction
|
||||
|
||||
const yesNoModalBootStrap = new bootstrap.Modal("#yes_no_modal_delete");
|
||||
$("#yes_no_modal_show").on("click", function(){
|
||||
$("#yes_no_modal_show").on("click", function () {
|
||||
yesNoModalBootStrap.show();
|
||||
});
|
||||
|
||||
$("#modal_yes_button_warehouse_delete").on("click", function(){
|
||||
$("#modal_yes_button_warehouse_delete").on("click", function () {
|
||||
yesNoModal.yesFunction();
|
||||
yesNoModalBootStrap.hide();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 검색 버튼 클릭 시 Ajax로 검색 결과를 갱신
|
||||
$("#searchBtn").click(function () {
|
||||
var search = $("#search").val();
|
||||
// $("#searchBtn").click(function () {
|
||||
// var search = $("#search").val();
|
||||
// var searchn = $("#searchn").val();
|
||||
// var id = $("#id").val();
|
||||
// var p = $("#p").val();
|
||||
//
|
||||
// $.ajax({
|
||||
// url: "warehouse/read.jsp",
|
||||
// method: "POST",
|
||||
// data: {
|
||||
// search: search,
|
||||
// searchn: searchn,
|
||||
// id: id,
|
||||
// p: p
|
||||
//
|
||||
// },
|
||||
// success: function (result) {
|
||||
// // 검색 결과를 받아와서 결과를 보여주는 영역 업데이트
|
||||
// $("#searchResults").html(result);
|
||||
// },
|
||||
// error: function () {
|
||||
// alert("검색 중 오류가 발생했습니다.");
|
||||
// }
|
||||
// });
|
||||
//
|
||||
//검색기능
|
||||
$("#searchBtn").on("click", function () {
|
||||
|
||||
var searchn = $("#searchn").val();
|
||||
var search = $("#search").val();
|
||||
var id = $("#id").val();
|
||||
|
||||
$.ajax({
|
||||
url: "read.jsp",
|
||||
method: "POST",
|
||||
data: {
|
||||
search: search,
|
||||
searchn: searchn,
|
||||
id: id
|
||||
var form = document.createElement("form");
|
||||
form.action = "/warehouse/read";
|
||||
form.method = "post";
|
||||
|
||||
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);
|
||||
|
||||
var input4 = document.createElement("input");
|
||||
input4.type = "hidden";
|
||||
input4.name = "id";
|
||||
input4.value = id;
|
||||
form.appendChild(input4);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
|
||||
},
|
||||
success: function (result) {
|
||||
// 검색 결과를 받아와서 결과를 보여주는 영역 업데이트
|
||||
$("#searchResults").html(result);
|
||||
},
|
||||
error: function () {
|
||||
alert("검색 중 오류가 발생했습니다.");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});//ready
|
||||
|
||||
function pageingFunction(clickedId) {
|
||||
var searchn1 = $("#searchn1").val();
|
||||
var search1 = $("#search1").val();
|
||||
var id = $("#id").val();
|
||||
|
||||
var form = document.createElement("form");
|
||||
form.action = "/warehouse/read";
|
||||
form.method = "post";
|
||||
|
||||
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);
|
||||
|
||||
var input4 = document.createElement("input");
|
||||
input4.type = "hidden";
|
||||
input4.name = "id";
|
||||
input4.value = id;
|
||||
form.appendChild(input4);
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user