From 0be35ad21738fa852266b4d53170dff2a3a1cec6 Mon Sep 17 00:00:00 2001 From: shoqying Date: Tue, 17 Dec 2024 18:23:37 +0900 Subject: [PATCH] 123 --- .../controller/ShipmentController.java | 271 +++++++++++++- .../com/stockm8/persistence/ShipmentDAO.java | 48 ++- .../stockm8/persistence/ShipmentDAOImpl.java | 160 +++++++- .../com/stockm8/service/ShipmentService.java | 49 ++- .../stockm8/service/ShipmentServiceImpl.java | 122 +++++- .../main/resources/mappers/shipmentMapper.xml | 266 ++++++++++++- .../WEB-INF/views/receiving/allScan.jsp | 1 - .../WEB-INF/views/receiving/history.jsp | 2 +- .../webapp/WEB-INF/views/receiving/list.jsp | 8 +- .../webapp/WEB-INF/views/receiving/main.jsp | 2 +- .../webapp/WEB-INF/views/receiving/scan.jsp | 2 +- .../webapp/WEB-INF/views/receiving/search.jsp | 2 +- .../webapp/WEB-INF/views/shipment/allScan.jsp | 341 +++++++++++++++++ .../webapp/WEB-INF/views/shipment/history.jsp | 349 ++++++++++++++++++ .../webapp/WEB-INF/views/shipment/list.jsp | 41 ++ .../webapp/WEB-INF/views/shipment/main.jsp | 258 +++++++++++++ .../webapp/WEB-INF/views/shipment/scan.jsp | 341 +++++++++++++++++ .../webapp/WEB-INF/views/shipment/search.jsp | 348 +++++++++++++++++ 18 files changed, 2581 insertions(+), 30 deletions(-) create mode 100644 stockMate/src/main/webapp/WEB-INF/views/shipment/allScan.jsp create mode 100644 stockMate/src/main/webapp/WEB-INF/views/shipment/history.jsp create mode 100644 stockMate/src/main/webapp/WEB-INF/views/shipment/list.jsp create mode 100644 stockMate/src/main/webapp/WEB-INF/views/shipment/main.jsp create mode 100644 stockMate/src/main/webapp/WEB-INF/views/shipment/scan.jsp create mode 100644 stockMate/src/main/webapp/WEB-INF/views/shipment/search.jsp diff --git a/stockMate/src/main/java/com/stockm8/controller/ShipmentController.java b/stockMate/src/main/java/com/stockm8/controller/ShipmentController.java index 9232f4f..abc98ba 100644 --- a/stockMate/src/main/java/com/stockm8/controller/ShipmentController.java +++ b/stockMate/src/main/java/com/stockm8/controller/ShipmentController.java @@ -1,34 +1,291 @@ package com.stockm8.controller; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import javax.inject.Inject; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import com.stockm8.domain.vo.Criteria; +import com.stockm8.domain.vo.PageVO; +import com.stockm8.domain.vo.ProductVO; +import com.stockm8.domain.vo.ReceivingShipmentVO; +import com.stockm8.domain.vo.StockVO; +import com.stockm8.domain.vo.UserVO; import com.stockm8.service.ReceivingService; +import com.stockm8.service.ShipmentService; +import com.stockm8.service.UserService; @Controller @RequestMapping(value = "/shipment/*") - public class ShipmentController { private static final Logger logger = LoggerFactory.getLogger(ShipmentController.class); -// @Inject -// private ReceivingService rService; + @Inject + private ShipmentService sService; + + @Inject + private UserService uService; - // http://localhost:8088/receiving/main + // http://localhost:8088/shipment/main @RequestMapping(value = "/main", method = RequestMethod.GET) - public void mainGET() throws Exception { + public void mainGET(Model model, HttpServletRequest request) throws Exception { logger.info("mainGET() 호출"); - logger.info(""); + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + List ShipmentList = sService.getShipmentList(businessId); + logger.info(ShipmentList.size() + "개"); + + List YesterdayShipmentList = sService.getYesterdayShipmentList(businessId); + logger.info(YesterdayShipmentList.size() + "개"); + + List TDBYShipmentList = sService.getTDBYShipmentList(businessId); + logger.info(TDBYShipmentList.size() + "개"); + + model.addAttribute("ShipmentList", ShipmentList); + model.addAttribute("YesterdayShipmentList", YesterdayShipmentList); + model.addAttribute("TDBYShipmentList", TDBYShipmentList); + } + + // http://localhost:8088/shipment/history + @RequestMapping(value = "/history", method = RequestMethod.GET) + public void historyGET(@RequestParam(value = "startDate", required = false) String startDate, + @RequestParam(value = "endDate", required = false) String endDate, + @RequestParam(value = "keyword", required = false) String keyword, + Criteria cri, HttpServletRequest request, + Model model) throws Exception { + logger.info("historyGET() 호출"); + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + List ShipmentList; + + int totalCount = 0; + + ShipmentList = sService.getShipmentHistoryList(cri, businessId); + totalCount = sService.getTotalCount(businessId); // 전체 개수 + + PageVO pageVO = new PageVO(); + pageVO.setCri(cri); + pageVO.setTotalCount(totalCount); + model.addAttribute("pageVO", pageVO); + + logger.info(ShipmentList.size() + "개"); + model.addAttribute("ShipmentList", ShipmentList); + } + + // http://localhost:8088/shipment/search + @RequestMapping(value = "/search", method = RequestMethod.GET) + public void searchGET(@RequestParam(value = "startDate", required = false) String startDate, + @RequestParam(value = "endDate", required = false) String endDate, + @RequestParam(value = "keyword", required = false) String keyword, + Criteria cri, HttpServletRequest request, + Model model) throws Exception { + logger.info("searchGET() 호출"); + + List ShipmentList; + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + int totalCount = 0; + + // 날짜와 키워드가 모두 있는 경우 + if (startDate != null && endDate != null && keyword != null) { + ShipmentList = sService.getHistoryByDateRange(startDate, endDate, keyword, cri, businessId); + totalCount = sService.getTotalCountBySearch(startDate, endDate, keyword, businessId); + + } else if (keyword != null) { + ShipmentList = sService.getHistoryByDateRange(null, null, keyword, cri, businessId); + totalCount = sService.getTotalCountBySearch(null, null, keyword, businessId); + + } else if (startDate != null && endDate != null) { + ShipmentList = sService.getHistoryByDateRange(startDate, endDate, null, cri, businessId); + totalCount = sService.getTotalCountBySearch(startDate, endDate, null, businessId); + + } else { + ShipmentList = sService.getShipmentHistoryList(cri, businessId); + totalCount = sService.getTotalCount(businessId); // 전체 개수 + + } + + PageVO pageVO = new PageVO(); + pageVO.setCri(cri); + pageVO.setTotalCount(totalCount); + model.addAttribute("pageVO", pageVO); + + logger.info(ShipmentList.size() + "개"); + model.addAttribute("ShipmentList", ShipmentList); + } + + // 새로고침 + @RequestMapping(value = "/insert1", method = RequestMethod.POST) + public String insert1POST(HttpServletRequest request) throws Exception { + logger.info("insertPOST() 호출"); + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + sService.insertShipment(businessId); + return "redirect:/shipment/main"; } + // 새로고침 + @RequestMapping(value = "/insert2", method = RequestMethod.POST) + public String insert2POST(HttpServletRequest request) throws Exception { + logger.info("insertPOST() 호출"); + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + sService.insertShipment(businessId); + + return "redirect:/shipment/history"; + } + + // 새로고침 + @RequestMapping(value = "/insert3", method = RequestMethod.POST) + public String insert3POST(HttpServletRequest request) throws Exception { + logger.info("insertPOST() 호출"); + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + sService.insertShipment(businessId); + + return "redirect:/shipment/search"; + } + + // http://localhost:8088/shipment/scan + @RequestMapping(value = "/scan", method = RequestMethod.GET) + public String scanGET(HttpServletRequest request) throws Exception { + logger.info("scanGET() 호출"); + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + return "/shipment/scan"; + } + + // http://localhost:8088/shipment/scan + @RequestMapping(value = "/scan", method = RequestMethod.POST) + @ResponseBody + public Map scanPOST(@RequestBody Map bar, Model model, + HttpServletRequest request) throws Exception { + logger.info("scanPOST() 호출"); + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + // QR 코드 데이터 처리 로직 (예: 데이터 저장, 검증 등) + String barcode = bar.get("barcode"); + Map response = new HashMap(); + + if (userId == null) { + response.put("success", false); + response.put("message", "로그인 정보가 없습니다."); + return response; + } + + try { + sService.ShipmentStatusToComplete(businessId, barcode); + int remainingStock = sService.increseStockByBarcode(businessId, barcode); + int reservedQuantity = sService.decreaseReservedQuantity(businessId, barcode); + ProductVO product = sService.productNameBarcode(businessId, barcode); + if (remainingStock >= 0) { + response.put("success", true); + response.put("remainingStock", remainingStock); + response.put("reservedQuantity", reservedQuantity); + response.put("productName", product.getProductName()); + response.put("productPrice", product.getProductPrice()); + } else { + response.put("success", false); + response.put("message", "유효하지 않은 바코드입니다."); + } + } catch (Exception e) { + response.put("success", false); + response.put("message", e.getMessage()); + } + return response; + } + + // http://localhost:8088/shipment/allScan + @RequestMapping(value = "/allScan", method = RequestMethod.GET) + public String allScanGET(HttpServletRequest request) throws Exception { + logger.info("allScanGET() 호출"); + + // 세션에서 userId 가져오기 + HttpSession session = request.getSession(false); + Long userId = (session != null) ? (Long)session.getAttribute("userId") : null; + + // userId로 사용자 정보 조회 + UserVO user = uService.getUserById(userId); + int businessId = user.getBusinessId(); + + + + return "/shipment/allScan"; + } + + + -} // ReceivingController end +} // ShipmentController end \ No newline at end of file diff --git a/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAO.java b/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAO.java index 8c41a41..957fbf5 100644 --- a/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAO.java +++ b/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAO.java @@ -2,11 +2,53 @@ import java.util.List; +import com.stockm8.domain.vo.Criteria; +import com.stockm8.domain.vo.ProductVO; import com.stockm8.domain.vo.ReceivingShipmentVO; +import com.stockm8.domain.vo.StockVO; public interface ShipmentDAO { - // 출고 메인 오늘 들어올 리스트 - public List todayReceivingList() throws Exception; + // 입고 메인 오늘 들어올 리스트 + public List selectShipmentList(int businessId) throws Exception; + + // 입고 메인 오늘 들어올 리스트 + public List selectYesterdayShipmentList(int businessId) throws Exception; + + // 입고 메인 오늘 들어올 리스트 + public List selectTDBYShipmentList(int businessId) throws Exception; + + // 입고 내역 히스토리 + public List selectShipmentHistoryList(Criteria cri, int businessId) throws Exception; + + // 입고 내역 검색 + public List selectHistoryByDateRange(String startDate, String endDate, String keyword, Criteria cri, int businessId) throws Exception; -} // ReceivingDAO end + // 검색시 모든 리스트 개수 + public int selectTotalCountBySearch(String startDate, String endDate, String keyword, int businessId) throws Exception; + + // 리스트 모든 개수 + public int selectTotalCount(int businessId) throws Exception; + + // recevingShipment 테이블 insert + public void insertShipment(int businessId) throws Exception; + + // 바코드로 재고 조회 + public List selectQuantityCheckByBarcode(int businessId, String barcode) throws Exception; + + // 바코드로 재고 감소 + public int updateIncreseStock(int businessId, String barcode) throws Exception; + + // 바코드로 재고 감소 실시간 조회 + public int selectStockByBarcode(int businessId, String barcode) throws Exception; + + // 바코드 찍은 후 발주 수량 감소 + public int selectReservedQuantity(int businessId, String barcode) throws Exception; + + // 바코드 찍은 후 제품 이름 추출 + public ProductVO selectProductNameBarcode(int businessId, String barcode) throws Exception; + + // 수량 없을시 완료상태로 변경 + public void updateShipmentStatusToComplete(int businessId, String barcode) throws Exception; + +} // ShipmentDAO end \ No newline at end of file diff --git a/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAOImpl.java b/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAOImpl.java index 8500d49..ffdde3a 100644 --- a/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAOImpl.java +++ b/stockMate/src/main/java/com/stockm8/persistence/ShipmentDAOImpl.java @@ -1,21 +1,171 @@ package com.stockm8.persistence; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import javax.inject.Inject; + +import org.apache.ibatis.session.SqlSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; +import com.stockm8.domain.vo.Criteria; +import com.stockm8.domain.vo.ProductVO; import com.stockm8.domain.vo.ReceivingShipmentVO; +import com.stockm8.domain.vo.StockVO; +@Repository public class ShipmentDAOImpl implements ShipmentDAO { private static final Logger logger = LoggerFactory.getLogger(ShipmentDAOImpl.class); - // 출고 메인 오늘 들어올 리스트 - public List todayReceivingList() throws Exception { - logger.info("todayReceivingList() 실행"); + private static final String NAMESPACE = "com.stockm8.mappers.shipmentMapper."; + + // 디비 연결 객체 주입 + @Inject + private SqlSession sqlSession; + + // 입고 메인 오늘 들어올 리스트 + @Override + public List selectShipmentList(int businessId) throws Exception { + logger.info("selectShipmentList() 호출"); + + return sqlSession.selectList(NAMESPACE + "getShipmentList", businessId); + } + + // 입고 메인 오늘 들어올 리스트 + @Override + public List selectYesterdayShipmentList(int businessId) throws Exception { + logger.info("selectYesterdayShipmentList() 호출"); - return null; + return sqlSession.selectList(NAMESPACE + "getYesterdayShipmentList", businessId); + } + + // 입고 메인 오늘 들어올 리스트 + @Override + public List selectTDBYShipmentList(int businessId) throws Exception { + logger.info("selectTDBYShipmentList() 호출"); + + return sqlSession.selectList(NAMESPACE + "getTDBYShipmentList", businessId); + } + + // 입고 내역 히스토리 리스트 + @Override + public List selectShipmentHistoryList(Criteria cri, int businessId) throws Exception { + logger.info("selectShipmentHistoryList() 호출"); + + Map paramMap = new HashMap(); + paramMap.put("cri", cri); + paramMap.put("businessId", businessId); + + return sqlSession.selectList(NAMESPACE + "getShipmentHistoryList", paramMap); + } + + // 입고 내역 검색 + @Override + public List selectHistoryByDateRange(String startDate, String endDate, String keyword, Criteria cri, int businessId) throws Exception { + logger.info("selectHistoryByDateRange() 호출"); + + Map paramMap = new HashMap(); + paramMap.put("startDate", startDate); + paramMap.put("endDate", endDate); + paramMap.put("keyword", keyword); + paramMap.put("cri", cri); + paramMap.put("businessId", businessId); + + return sqlSession.selectList(NAMESPACE + "getHistoryByDateRange", paramMap); } -} // ReceivingDAOImpl end + @Override + public int selectTotalCountBySearch(String startDate, String endDate, String keyword, int businessId) throws Exception { + + Map paramMap = new HashMap<>(); + paramMap.put("startDate", startDate); + paramMap.put("endDate", endDate); + paramMap.put("keyword", keyword); + paramMap.put("businessId", businessId); + return sqlSession.selectOne(NAMESPACE + "getTotalCountBySearch", paramMap); + } + + @Override + public int selectTotalCount(int businessId) throws Exception { + logger.info("selectTotalCount() 호출"); + + return sqlSession.selectOne(NAMESPACE + "getTotalCount", businessId); + } + + @Override + public void insertShipment(int businessId) throws Exception { + logger.info("insertShipment() 호출"); + sqlSession.insert(NAMESPACE + "insertShipment", businessId); + } + + @Override + public List selectQuantityCheckByBarcode(int businessId, String barcode) throws Exception { + logger.info("selectShipment() 호출"); + Map paramMap = new HashMap(); + paramMap.put("businessId", businessId); + paramMap.put("barcode", barcode); + + return sqlSession.selectList(NAMESPACE + "selectQuantityCheckByBarcode", paramMap); + } + + @Override + public int updateIncreseStock(int businessId, String barcode) throws Exception { + logger.info("updateDecreaseStock() 호출"); + // 매개변수 묶기 + Map params = new HashMap<>(); + params.put("businessId", businessId); + params.put("barcode", barcode); + + // SQL 실행 + return sqlSession.update(NAMESPACE + "updateIncreseStock", params); + } + + @Override + public int selectStockByBarcode(int businessId, String barcode) throws Exception { + logger.info("selectStockByBarcode() 호출"); + Map params = new HashMap<>(); + params.put("businessId", businessId); + params.put("barcode", barcode); + return sqlSession.selectOne(NAMESPACE + "selectStockByBarcode", params); + } + + @Override + public int selectReservedQuantity(int businessId, String barcode) throws Exception { + logger.info("selectReservedQuantity() 호출"); + Map params = new HashMap<>(); + params.put("businessId", businessId); + params.put("barcode", barcode); + return sqlSession.selectOne(NAMESPACE + "selectReservedQuantity", params); + } + + @Override + public ProductVO selectProductNameBarcode(int businessId, String barcode) throws Exception { + logger.info("selectProductNameBarcode() 호출"); + Map params = new HashMap<>(); + params.put("businessId", businessId); + params.put("barcode", barcode); + return sqlSession.selectOne(NAMESPACE + "selectProductNameBarcode", params); + } + + @Override + public void updateShipmentStatusToComplete(int businessId, String barcode) throws Exception { + logger.info("updateShipmentStatusToComplete() 호출"); + Map params = new HashMap<>(); + params.put("businessId", businessId); + params.put("barcode", barcode); + sqlSession.update(NAMESPACE + "updateShipmentStatusToComplete", params); + + } + + + + + + + + +} // ShipmentDAOImpl end diff --git a/stockMate/src/main/java/com/stockm8/service/ShipmentService.java b/stockMate/src/main/java/com/stockm8/service/ShipmentService.java index ee35b11..52005c0 100644 --- a/stockMate/src/main/java/com/stockm8/service/ShipmentService.java +++ b/stockMate/src/main/java/com/stockm8/service/ShipmentService.java @@ -1,5 +1,52 @@ package com.stockm8.service; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; + +import com.stockm8.domain.vo.Criteria; +import com.stockm8.domain.vo.ProductVO; +import com.stockm8.domain.vo.ReceivingShipmentVO; +import com.stockm8.domain.vo.StockVO; + +@Mapper public interface ShipmentService { + + // 메인 입고 리스트 + public List getShipmentList(int businessId) throws Exception; + + // 메인 어제 입고 리스트 + public List getYesterdayShipmentList(int businessId) throws Exception; + + // 메인 그제 입고 리스트 + public List getTDBYShipmentList(int businessId) throws Exception; + + // 입고 내역 리스트 + public List getShipmentHistoryList(Criteria cri, int businessId) throws Exception; + + // 입고 내역 검색 + public List getHistoryByDateRange(String startDate, String endDate, String keyword, Criteria cri, int businessId) throws Exception; + + // 입고 내역 검색 + public int getTotalCountBySearch(String startDate, String endDate, String keyword, int businessId) throws Exception; + + // 글 모든 개수 + public int getTotalCount(int businessId) throws Exception; + + // rs 테이블 insert + public void insertShipment(int businessId) throws Exception; + + // 바코드 찍은 후 재고수량 증가 + public int increseStockByBarcode(int businessId, String barcode) throws Exception; + + // 바코드 찍은 후 발주 수량 감소 + public int decreaseReservedQuantity(int businessId, String barcode) throws Exception; + + // 바코드 찍은 후 제품 이름 추출 + public ProductVO productNameBarcode(int businessId, String barcode) throws Exception; + + // 수량 없을시 완료상태로 변경 + public void ShipmentStatusToComplete(int businessId, String barcode) throws Exception; + -} // ReceivingService end +} // ShipmentService end \ No newline at end of file diff --git a/stockMate/src/main/java/com/stockm8/service/ShipmentServiceImpl.java b/stockMate/src/main/java/com/stockm8/service/ShipmentServiceImpl.java index 9d7d85f..3ffb4bb 100644 --- a/stockMate/src/main/java/com/stockm8/service/ShipmentServiceImpl.java +++ b/stockMate/src/main/java/com/stockm8/service/ShipmentServiceImpl.java @@ -1,5 +1,125 @@ package com.stockm8.service; +import java.util.List; + +import javax.inject.Inject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.stockm8.domain.vo.Criteria; +import com.stockm8.domain.vo.ProductVO; +import com.stockm8.domain.vo.ReceivingShipmentVO; +import com.stockm8.domain.vo.StockVO; +import com.stockm8.persistence.ShipmentDAO; + +@Service public class ShipmentServiceImpl implements ShipmentService { + + private static final Logger logger = LoggerFactory.getLogger(ShipmentServiceImpl.class); + + @Inject + private ShipmentDAO sdao; + + + // 메인 입고 리스트 + @Override + public List getShipmentList(int businessId) throws Exception { + logger.info("getTodayShipmentList() 호출"); + return sdao.selectShipmentList(businessId); + } + + @Override + public List getYesterdayShipmentList(int businessId) throws Exception { + logger.info("getYesterdayShipmentList() 호출"); + return sdao.selectYesterdayShipmentList(businessId); + } + + @Override + public List getTDBYShipmentList(int businessId) throws Exception { + logger.info("getTDBYShipmentList() 호출"); + return sdao.selectTDBYShipmentList(businessId); + } + + @Override + public List getShipmentHistoryList(Criteria cri, int businessId) throws Exception { + logger.info("getShipmentHistoryList() 호출"); + return sdao.selectShipmentHistoryList(cri, businessId); + } + + @Override + public List getHistoryByDateRange(String startDate, String endDate, String keyword, Criteria cri, int businessId) throws Exception{ + logger.info("getHistoryByDateRange() 호출"); + return sdao.selectHistoryByDateRange(startDate, endDate, keyword, cri, businessId); + } + + @Override + public int getTotalCountBySearch(String startDate, String endDate, String keyword, int businessId) throws Exception { + logger.info("getTotalCountBySearch() 호출"); + return sdao.selectTotalCountBySearch(startDate, endDate, keyword, businessId); + } + + @Override + public int getTotalCount(int businessId) throws Exception { + logger.info("getTotalCount() 호출"); + return sdao.selectTotalCount(businessId); + } + + @Override + public void insertShipment(int businessId) throws Exception { + logger.info("insertShipment() 호출"); + sdao.insertShipment(businessId); + } + + + @Transactional + @Override + public int increseStockByBarcode(int businessId, String barcode) throws Exception { + logger.info("increseStockByBarcode() 호출"); + List stock = sdao.selectQuantityCheckByBarcode(businessId, barcode); + if (stock == null) { + return -1; // 유효하지 않은 바코드 + } + + int updatedRows = sdao.updateIncreseStock(businessId, barcode); + if (updatedRows > 0) { + return sdao.selectStockByBarcode(businessId, barcode); // 증가 후 남은 재고 반환 + } else { + throw new RuntimeException("재고 업데이트 실패"); + } + } + + @Override + public int decreaseReservedQuantity(int businessId, String barcode) throws Exception { + logger.info("decreaseReservedQuantity() 호출"); + + return sdao.selectReservedQuantity(businessId, barcode); + } + + @Override + public ProductVO productNameBarcode(int businessId, String barcode) throws Exception { + logger.info("productNameBarcode() 호출"); + + return sdao.selectProductNameBarcode(businessId, barcode); + } + + @Override + public void ShipmentStatusToComplete(int businessId, String barcode) { + try { + // MyBatis 매퍼 호출 + sdao.updateShipmentStatusToComplete(businessId, barcode); + } catch (Exception e) { + // 예외 처리 + logger.error("입고 상태 업데이트 오류: " + e.getMessage()); + } + } + + + + + + -} // ReceivingServiceImpl end +} // ShipmentServiceImpl end \ No newline at end of file diff --git a/stockMate/src/main/resources/mappers/shipmentMapper.xml b/stockMate/src/main/resources/mappers/shipmentMapper.xml index 6c32878..0717cdb 100644 --- a/stockMate/src/main/resources/mappers/shipmentMapper.xml +++ b/stockMate/src/main/resources/mappers/shipmentMapper.xml @@ -3,9 +3,267 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + + + + + + + + + + + + + + + + + + + + - + select + r.receiving_shipment_no, + r.transaction_type, + r.created_at, + r.status, + r.product_id, + p.product_name, + p.product_description, + r.change_quantity, + r.memo + from receiving_shipment r + join products p on r.product_id = p.product_id + join warehouses w on w.warehouse_id = r.warehouse_id + JOIN users u on u.created_by = r.created_by + where Date(r.created_at) = CURRENT_DATE and r.status = 'PENDING' and r.transaction_type = 'OUTBOUND' + AND u.business_id = #{businessId} + order by r.receiving_shipment_no desc + limit 0, 20 - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE stocks s + JOIN products p on p.product_id = s.product_id + SET s.total_quantity = s.total_quantity - 1, + s.reserved_quantity = s.reserved_quantity +1 + WHERE p.product_barcode = #{barcode} AND s.business_id = #{businessId} + AND s.reserved_quantity > 0 + + + + + + + + + + + + + UPDATE receiving_shipment r + JOIN products p ON r.product_id = p.product_id + JOIN stocks s ON s.product_id = p.product_id + SET r.status = 'COMPLETED' + WHERE p.product_barcode = #{barcode} + AND s.reserved_quantity = 1 + AND r.status = 'PENDING' + AND s.business_id = #{businessId}; + + + + diff --git a/stockMate/src/main/webapp/WEB-INF/views/receiving/allScan.jsp b/stockMate/src/main/webapp/WEB-INF/views/receiving/allScan.jsp index 023b0b6..6cf55b8 100644 --- a/stockMate/src/main/webapp/WEB-INF/views/receiving/allScan.jsp +++ b/stockMate/src/main/webapp/WEB-INF/views/receiving/allScan.jsp @@ -206,7 +206,6 @@ td { 입고 메인 입고 내역 대쉬보드 - 다중 스캔
diff --git a/stockMate/src/main/webapp/WEB-INF/views/receiving/history.jsp b/stockMate/src/main/webapp/WEB-INF/views/receiving/history.jsp index 31ea01a..d3207f4 100644 --- a/stockMate/src/main/webapp/WEB-INF/views/receiving/history.jsp +++ b/stockMate/src/main/webapp/WEB-INF/views/receiving/history.jsp @@ -239,7 +239,7 @@ tr:hover {

입고 내역

입고 메인 - 실시간 입고 + 입고 검수
diff --git a/stockMate/src/main/webapp/WEB-INF/views/receiving/list.jsp b/stockMate/src/main/webapp/WEB-INF/views/receiving/list.jsp index 929fbff..629ff75 100644 --- a/stockMate/src/main/webapp/WEB-INF/views/receiving/list.jsp +++ b/stockMate/src/main/webapp/WEB-INF/views/receiving/list.jsp @@ -7,7 +7,7 @@

스캔된 입출고 리스트

- +
@@ -23,8 +23,8 @@ \ No newline at end of file diff --git a/stockMate/src/main/webapp/WEB-INF/views/receiving/main.jsp b/stockMate/src/main/webapp/WEB-INF/views/receiving/main.jsp index edf7fc6..e8a3435 100644 --- a/stockMate/src/main/webapp/WEB-INF/views/receiving/main.jsp +++ b/stockMate/src/main/webapp/WEB-INF/views/receiving/main.jsp @@ -137,7 +137,7 @@

입고 메인

입고 내역 -실시간 입고 +입고 검수대쉬보드 diff --git a/stockMate/src/main/webapp/WEB-INF/views/receiving/scan.jsp b/stockMate/src/main/webapp/WEB-INF/views/receiving/scan.jsp index 023b0b6..9495587 100644 --- a/stockMate/src/main/webapp/WEB-INF/views/receiving/scan.jsp +++ b/stockMate/src/main/webapp/WEB-INF/views/receiving/scan.jsp @@ -206,7 +206,7 @@ td { 입고 메인입고 내역대쉬보드 - 다중 스캔 + 스캔 다중 입력
diff --git a/stockMate/src/main/webapp/WEB-INF/views/receiving/search.jsp b/stockMate/src/main/webapp/WEB-INF/views/receiving/search.jsp index b283067..4786088 100644 --- a/stockMate/src/main/webapp/WEB-INF/views/receiving/search.jsp +++ b/stockMate/src/main/webapp/WEB-INF/views/receiving/search.jsp @@ -239,7 +239,7 @@ tr:hover {

입고 내역

입고 메인 - 실시간 입고 + 입고 검수 diff --git a/stockMate/src/main/webapp/WEB-INF/views/shipment/allScan.jsp b/stockMate/src/main/webapp/WEB-INF/views/shipment/allScan.jsp new file mode 100644 index 0000000..a4623d7 --- /dev/null +++ b/stockMate/src/main/webapp/WEB-INF/views/shipment/allScan.jsp @@ -0,0 +1,341 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + +QR 코드 스캔 및 상품 정보 + + + + + + +
+

실시간 출고 관리 시스템

+ 출고 메인 + 출고 내역 + 대쉬보드 + 다중 스캔 +
+
+
+ + +
+
+

재고 정보가 여기에 표시됩니다.

+
+
+ + +
+ + +
+
+ +
상품 ID
+ + + + + + + + + +
상품명바코드단가수량
+ + + + diff --git a/stockMate/src/main/webapp/WEB-INF/views/shipment/history.jsp b/stockMate/src/main/webapp/WEB-INF/views/shipment/history.jsp new file mode 100644 index 0000000..a15e2d2 --- /dev/null +++ b/stockMate/src/main/webapp/WEB-INF/views/shipment/history.jsp @@ -0,0 +1,349 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> + + + + +출고 내역 + + + + +

출고 내역

+ 출고 메인 + 실시간 출고 +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
출고 번호입고 출고출고 일자출고 상태제품 번호제품명옵션명출고 수량수량 단위제품 단가창고 위치작업 메모
${vo.shipmentShipmentNo }${vo.transactionType } + + + 대기중 + + + 완료됨 + + + ${vo.status} + + + ${vo.productId }${vo.productName }${vo.productDescription }${vo.changeQuantity }${vo.transactionUnit }${vo.productPrice }${vo.warehouseId }${vo.memo }
+ +
+ + + + 검색 결과가 없습니다. + + + +
+ +
+ + + \ No newline at end of file diff --git a/stockMate/src/main/webapp/WEB-INF/views/shipment/list.jsp b/stockMate/src/main/webapp/WEB-INF/views/shipment/list.jsp new file mode 100644 index 0000000..e0f1f6a --- /dev/null +++ b/stockMate/src/main/webapp/WEB-INF/views/shipment/list.jsp @@ -0,0 +1,41 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + 입출고 리스트 + + +

스캔된 입출고 리스트

+ + + + + + + + + + + + +
상품 ID창고 ID수량거래 유형
+ + + + \ No newline at end of file diff --git a/stockMate/src/main/webapp/WEB-INF/views/shipment/main.jsp b/stockMate/src/main/webapp/WEB-INF/views/shipment/main.jsp new file mode 100644 index 0000000..581450e --- /dev/null +++ b/stockMate/src/main/webapp/WEB-INF/views/shipment/main.jsp @@ -0,0 +1,258 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> + + + + +출고 메인 + + + + + +

출고 메인

+ +출고 내역 +실시간 출고 +대쉬보드 +
+ +
+ + +

오늘 출고 리스트

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
출고 번호입고 출고출고 일자출고 상태제품 번호제품명옵션명출고 수량수량 단위작업 메모
${vo.shipmentShipmentNo}${vo.transactionType} + + 대기중 + 완료됨 + ${vo.status} + + ${vo.productId}${vo.productName}${vo.productDescription}${vo.changeQuantity}${vo.transactionUnit}${vo.memo}
+ + +

어제 출고 리스트

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
출고 번호입고 출고출고 일자출고 상태제품 번호제품명옵션명출고 수량수량 단위작업 메모
${vo.shipmentShipmentNo}${vo.transactionType} + + 대기중 + 완료됨 + ${vo.status} + + ${vo.productId}${vo.productName}${vo.productDescription}${vo.changeQuantity}${vo.transactionUnit}${vo.memo}
+ + +

그저께 출고 리스트

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
출고 번호입고 출고출고 일자출고 상태제품 번호제품명옵션명출고 수량수량 단위작업 메모
${vo.shipmentShipmentNo}${vo.transactionType} + + 대기중 + 완료됨 + ${vo.status} + + ${vo.productId}${vo.productName}${vo.productDescription}${vo.changeQuantity}${vo.transactionUnit}${vo.memo}
+ + + diff --git a/stockMate/src/main/webapp/WEB-INF/views/shipment/scan.jsp b/stockMate/src/main/webapp/WEB-INF/views/shipment/scan.jsp new file mode 100644 index 0000000..88c2ea9 --- /dev/null +++ b/stockMate/src/main/webapp/WEB-INF/views/shipment/scan.jsp @@ -0,0 +1,341 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + +QR 코드 스캔 및 상품 정보 + + + + + + +
+

실시간 출고 관리 시스템

+ 출고 메인 + 출고 내역 + 대쉬보드 + 스캔 다중 입력 +
+
+
+ + +
+
+

재고 정보가 여기에 표시됩니다.

+
+
+ + +
+ + +
+
+ + + + + + + + + + + +
상품명바코드단가수량
+ + + + diff --git a/stockMate/src/main/webapp/WEB-INF/views/shipment/search.jsp b/stockMate/src/main/webapp/WEB-INF/views/shipment/search.jsp new file mode 100644 index 0000000..e1b9c72 --- /dev/null +++ b/stockMate/src/main/webapp/WEB-INF/views/shipment/search.jsp @@ -0,0 +1,348 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> + + + + +출고 내역 + + + + +

출고 내역

+ 출고 메인 + 출고 검수 +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
출고 번호입고 출고출고 일자출고 상태제품 번호제품명옵션명출고 수량수량 단위제품 단가창고 위치작업 메모
${vo.shipmentShipmentNo }${vo.transactionType } + + + 대기중 + + + 완료됨 + + + ${vo.status} + + + ${vo.productId }${vo.productName }${vo.productDescription }${vo.changeQuantity }${vo.transactionUnit }${vo.productPrice }${vo.warehouseId }${vo.memo }
+ +
+ + + + 검색 결과가 없습니다. + + + +
+ +
+ + + \ No newline at end of file