Skip to content

Commit

Permalink
Merge branch 'develop' into stock_05
Browse files Browse the repository at this point in the history
  • Loading branch information
in27sung authored Dec 16, 2024
2 parents 86bd1a5 + e5f7f1d commit ab79d96
Show file tree
Hide file tree
Showing 35 changed files with 2,660 additions and 937 deletions.
16 changes: 14 additions & 2 deletions stockMate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@
<artifactId>mysql-connector-j</artifactId>
<version>8.0.32</version>
</dependency>

<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
Expand Down Expand Up @@ -228,7 +234,7 @@
<version>3.0.0</version>
</dependency>

<dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.3</version>
Expand Down Expand Up @@ -266,12 +272,18 @@
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.3</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${org.springframework-version}</version>
</dependency>

<dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

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.UserService;
Expand Down Expand Up @@ -202,7 +204,7 @@ public String insert3POST(HttpServletRequest request) throws Exception {

// http://localhost:8088/receiving/scan
@RequestMapping(value = "/scan", method = RequestMethod.GET)
public String scanneGET(HttpServletRequest request) throws Exception {
public String scanGET(HttpServletRequest request) throws Exception {
logger.info("scanGET() 호출");

// 세션에서 userId 가져오기
Expand All @@ -219,7 +221,8 @@ public String scanneGET(HttpServletRequest request) throws Exception {
// http://localhost:8088/receiving/scan
@RequestMapping(value = "/scan", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> scannePOST(@RequestBody Map<String, String> bar, Model model, HttpServletRequest request) throws Exception {
public Map<String, Object> scanPOST(@RequestBody Map<String, String> bar, Model model,
HttpServletRequest request) throws Exception {
logger.info("scanPOST() 호출");

// 세션에서 userId 가져오기
Expand All @@ -241,10 +244,16 @@ public Map<String, Object> scannePOST(@RequestBody Map<String, String> bar, Mode
}

try {
rService.ReceivingStatusToComplete(businessId, barcode);
int remainingStock = rService.increseStockByBarcode(businessId, barcode);
int reservedQuantity = rService.decreaseReservedQuantity(businessId, barcode);
ProductVO product = rService.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", "유효하지 않은 바코드입니다.");
Expand All @@ -256,7 +265,23 @@ public Map<String, Object> scannePOST(@RequestBody Map<String, String> bar, Mode
return response;
}


// http://localhost:8088/receiving/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 "/receiving/allScan";
}



Expand Down
Loading

0 comments on commit ab79d96

Please sign in to comment.