Skip to content

Commit

Permalink
합치기 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
shoqying committed Dec 19, 2024
1 parent 40aee5c commit 16bc0a6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public Map<String, Object> scanPOST(@RequestBody Map<String, Object> payload,
}

try {
rService.ReceivingStatusToComplete(businessId, barcode, receivingShipmentNo);
rService.ReceivingStatusToComplete(businessId, barcode, receivingShipmentNo, orderItemId);
int remainingStock = rService.increseStockByBarcode(businessId, barcode, receivingShipmentNo, orderItemId);
int reservedQuantity = rService.decreaseReservedQuantity(businessId, barcode, receivingShipmentNo, orderItemId);
ProductVO product = rService.productNameBarcode(businessId, barcode, receivingShipmentNo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public interface ReceivingDAO {
public ProductVO selectProductNameBarcode(int businessId, String barcode, Integer receivingShipmentNo) throws Exception;

// 수량 없을시 완료상태로 변경
public void updateReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo) throws Exception;
public void updateReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo, int orderItemId) throws Exception;

// 입출고 번호를 누를시 스캔으로가서 특정 리스트 보여주기
public List<ReceivingShipmentVO> selectReceivingShipmentNo(int businessId, Integer receivingShipmentNo, int orderItemId) throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ public ProductVO selectProductNameBarcode(int businessId, String barcode, Intege
}

@Override
public void updateReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo) throws Exception {
public void updateReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo, int orderItemId) throws Exception {
logger.info("updateReceivingStatusToComplete() 호출");
Map<String, Object> params = new HashMap<>();
params.put("businessId", businessId);
params.put("barcode", barcode);
params.put("receivingShipmentNo", receivingShipmentNo);
params.put("orderItemId", orderItemId);
sqlSession.update(NAMESPACE + "updateReceivingStatusToComplete", params);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public interface ReceivingService {
public ProductVO productNameBarcode(int businessId, String barcode, Integer receivingShipmentNo) throws Exception;

// 수량 없을시 완료상태로 변경
public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo) throws Exception;
public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo, int orderItemId) 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 @@ -122,10 +122,10 @@ public ProductVO productNameBarcode(int businessId, String barcode, Integer rece
}

@Override
public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo) {
public void ReceivingStatusToComplete(int businessId, String barcode, Integer receivingShipmentNo, int orderItemId) {
try {
// MyBatis 매퍼 호출
rdao.updateReceivingStatusToComplete(businessId, barcode, receivingShipmentNo);
rdao.updateReceivingStatusToComplete(businessId, barcode, receivingShipmentNo, orderItemId);
// opService.processInboundAfterInspection(orderId, completedItems);
} catch (Exception e) {
// 예외 처리
Expand Down
2 changes: 1 addition & 1 deletion stockMate/src/main/resources/mappers/OrderMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
#{productId},
#{warehouseId},
#{quantity},
#{quantity}
#{quantity},
#{unitPrice},
#{remarks},
NOW()
Expand Down
6 changes: 4 additions & 2 deletions stockMate/src/main/resources/mappers/receivingMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ WHERE r.transaction_type = 'INBOUND'
JOIN stocks s on o.product_id = s.product_id
JOIN receiving_shipment r on r.stock_id = s.stock_id AND r.order_item_id = o.order_item_id
SET s.total_quantity = s.total_quantity + 1,
s.reserved_quantity = s.reserved_quantity -1,
o.change_quantity = o.change_quantity -1
WHERE p.product_barcode = #{barcode}
AND s.business_id = #{businessId}
Expand Down Expand Up @@ -288,12 +287,15 @@ AND r.order_item_id = #{orderItemId}
JOIN products p ON r.product_id = p.product_id
JOIN stocks s ON s.product_id = p.product_id
JOIN order_items o ON s.product_id = o.product_id
SET r.status = 'COMPLETED'
SET r.status = 'COMPLETED',
s.reserved_quantity = s.reserved_quantity - o.quantity
WHERE p.product_barcode = #{barcode}
AND o.change_quantity = 0
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 16bc0a6

Please sign in to comment.