Skip to content

Commit

Permalink
sadf
Browse files Browse the repository at this point in the history
  • Loading branch information
shoqying committed Dec 19, 2024
1 parent 5aaf140 commit 7b4d23e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ public Map<String, Object> scanPOST(@RequestBody Map<String, Object> payload,
// OrderService에 해당 메소드 추가 필요
int orderId = orderService.getOrderIdByOrderItemId(orderItemId);

rService.ReceivingStatusToComplete(businessId, barcode, receivingShipmentNo, orderId, completedItems);
rService.ReceivingStatusToComplete(businessId, barcode, receivingShipmentNo, orderItemId);


int remainingStock = rService.increseStockByBarcode(businessId, barcode, receivingShipmentNo, orderItemId);
int reservedQuantity = rService.decreaseReservedQuantity(businessId, barcode, receivingShipmentNo, orderItemId);
int reservedQuantity = rService.decreaseReservedQuantity(businessId, barcode, receivingShipmentNo, orderItemId, orderId, completedItems);
ProductVO product = rService.productNameBarcode(businessId, barcode, receivingShipmentNo);

if (reservedQuantity >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,14 @@ public interface ReceivingService {
public int increseStockByBarcode(int businessId, String barcode, Integer receivingShipmentNo, Integer orderItemId) throws Exception;

// 바코드 찍은 후 발주 수량 감소
public int decreaseReservedQuantity(int businessId, String barcode, Integer receivingShipmentNo, Integer orderItemId) throws Exception;
public int decreaseReservedQuantity(int businessId, String barcode, Integer receivingShipmentNo, Integer orderItemIdint, int orderId, List<OrderItemVO> completedItems) throws Exception;

// 바코드 찍은 후 제품 이름 추출
public ProductVO productNameBarcode(int businessId, String barcode, Integer receivingShipmentNo) throws Exception;

// 수량 없을시 완료상태로 변경

public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo,int orderId, List<OrderItemVO> completedItems) throws Exception;
public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo, int orderId) throws Exception;




// 입출고 번호를 누를시 스캔으로가서 특정 리스트 보여주기
public List<ReceivingShipmentVO> getReceivingShipmentNo(int businessId, Integer receivingShipmentNo, int rderItemId) throws Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public int increseStockByBarcode(int businessId, String barcode, Integer receivi
}

@Override
public int decreaseReservedQuantity(int businessId, String barcode, Integer receivingShipmentNo, Integer orderItemId) throws Exception {
public int decreaseReservedQuantity(int businessId, String barcode, Integer receivingShipmentNo, Integer orderItemId, int orderId, List<OrderItemVO> completedItems) throws Exception {
logger.info("decreaseReservedQuantity() 호출");

opService.processInboundAfterInspection(orderId, completedItems);
return rdao.selectReservedQuantity(businessId, barcode, receivingShipmentNo, orderItemId);
}

Expand All @@ -122,12 +122,11 @@ public ProductVO productNameBarcode(int businessId, String barcode, Integer rece
}

@Override
public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo,int orderId, List<OrderItemVO> completedItems) {
public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo, int orderId) {
try {
// MyBatis 매퍼 호출
rdao.updateReceivingStatusToComplete(businessId, barcode, receivingShipmentNo);
opService.processInboundAfterInspection(orderId, completedItems);

rdao.updateReceivingStatusToComplete(businessId, barcode, receivingShipmentNo, orderId);

} catch (Exception e) {
// 예외 처리
logger.error("입고 상태 업데이트 오류: " + e.getMessage());
Expand Down
5 changes: 2 additions & 3 deletions stockMate/src/main/resources/mappers/receivingMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SELECT DISTINCT
o.order_item_id,
s.stock_id,
o.warehouse_id,
u.created_by
#{createdBy}
FROM products p
JOIN order_items o ON o.product_id = p.product_id
JOIN stocks s ON s.product_id = p.product_id
Expand Down Expand Up @@ -290,12 +290,11 @@ AND r.order_item_id = #{orderItemId}
SET r.status = 'COMPLETED',
s.reserved_quantity = s.reserved_quantity - o.quantity
WHERE p.product_barcode = #{barcode}
AND o.change_quantity = 0
AND o.change_quantity = 1
AND r.status = 'PENDING'
AND s.business_id = #{businessId}
AND r.receiving_shipment_no = #{receivingShipmentNo}
AND r.order_item_id = #{orderItemId}
AND o.order_item_id = r.order_item_id;
</update>
<!-- receiving scan을 위한 매퍼 -->

Expand Down

0 comments on commit 7b4d23e

Please sign in to comment.