Skip to content

Commit

Permalink
임시 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
shoqying committed Dec 18, 2024
1 parent 29c4149 commit dacec94
Show file tree
Hide file tree
Showing 16 changed files with 211 additions and 558 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ public String insert3POST(HttpServletRequest request) throws Exception {

// http://localhost:8088/receiving/scan
@RequestMapping(value = "/scan", method = RequestMethod.GET)
public String scanGET(HttpServletRequest request) throws Exception {
public void scanGET(HttpServletRequest request, Model model,
@RequestParam(value = "receivingShipmentNo", required = false) Integer receivingShipmentNo) throws Exception {
logger.info("scanGET() 호출");

// 세션에서 userId 가져오기
Expand All @@ -214,8 +215,10 @@ public String scanGET(HttpServletRequest request) throws Exception {
// userId로 사용자 정보 조회
UserVO user = uService.getUserById(userId);
int businessId = user.getBusinessId();

return "/receiving/scan";

List<ReceivingShipmentVO> rsn = rService.getReceivingShipmentNo(businessId, receivingShipmentNo);

model.addAttribute("rsn", rsn);
}

// http://localhost:8088/receiving/scan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ public interface ReceivingDAO {

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

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

} // ReceivingDAO end
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ public void updateReceivingStatusToComplete(int businessId, String barcode) thro
sqlSession.update(NAMESPACE + "updateReceivingStatusToComplete", params);

}

@Override
public List<ReceivingShipmentVO> selectReceivingShipmentNo(int businessId, Integer receivingShipmentNo) throws Exception {
logger.info("selecttReceivingShipmentNo() 호출");
Map<String, Object> params = new HashMap<>();
params.put("businessId", businessId);
params.put("receivingShipmentNo", receivingShipmentNo);
return sqlSession.selectList(NAMESPACE + "getReceivingShipmentNo", params);
}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public interface ReceivingService {

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

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


} // ReceivingService end
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class ReceivingServiceImpl implements ReceivingService {
@Inject
private ReceivingDAO rdao;

// @Inject
// private OrderProcessor opService;


// 메인 입고 리스트
@Override
Expand Down Expand Up @@ -110,11 +113,19 @@ public void ReceivingStatusToComplete(int businessId, String barcode) {
try {
// MyBatis 매퍼 호출
rdao.updateReceivingStatusToComplete(businessId, barcode);
// opService.processInboundAfterInsepection;
} catch (Exception e) {
// 예외 처리
logger.error("입고 상태 업데이트 오류: " + e.getMessage());
}
}

@Override
public List<ReceivingShipmentVO> getReceivingShipmentNo(int businessId, Integer receivingShipmentNo) throws Exception {
logger.info("getReceivingShipmentNo() 호출");

return rdao.selectReceivingShipmentNo(businessId, receivingShipmentNo);
}



Expand Down
53 changes: 34 additions & 19 deletions stockMate/src/main/resources/mappers/receivingMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ INSERT INTO receiving_shipment (
warehouse_id,
created_by
)
SELECT
SELECT DISTINCT
ord.order_type,
'PENDING',
p.product_id,
Expand All @@ -61,19 +61,12 @@ WHERE NOT EXISTS (
AND rs.product_id = p.product_id
AND rs.order_item_id = o.order_item_id
AND rs.stock_id = s.stock_id
)
GROUP BY
p.product_id,
o.order_item_id,
s.stock_id,
o.warehouse_id,
u.created_by,
ord.order_type;
);
</insert>

<!-- 오늘 입고 예정 리스트 -->
<select id="getReceivingList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -95,7 +88,7 @@ GROUP BY

<!-- 어제 입고 리스트 -->
<select id="getYesterdayReceivingList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -117,7 +110,7 @@ GROUP BY

<!-- 그저께 입고 리스트 -->
<select id="getTDBYReceivingList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -139,7 +132,7 @@ GROUP BY

<!-- 입고 내역 히스토리 -->
<select id="getReceivingHistoryList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -162,7 +155,7 @@ GROUP BY

<!-- 입고 내역 검색 -->
<select id="getHistoryByDateRange" parameterType="map" resultMap="receivingShipmentMap">
SELECT
SELECT DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand Down Expand Up @@ -219,11 +212,11 @@ GROUP BY

<!-- 입출고 모든 개수 카운트 -->
<select id="getTotalCount" resultType="int">
select count(*)
from receiving_shipment r
JOIN users u on u.created_by = r.created_by
where transaction_type = 'INBOUND'
AND u.business_id = #{businessId}
SELECT COUNT(DISTINCT r.receiving_shipment_no)
FROM receiving_shipment r
JOIN users u ON u.created_by = r.created_by
WHERE r.transaction_type = 'INBOUND'
AND u.business_id = 1;
</select>

<!-- receiving scan을 위한 매퍼 -->
Expand Down Expand Up @@ -281,4 +274,26 @@ GROUP BY
</update>
<!-- receiving scan을 위한 매퍼 -->

<!-- 입고 내역 히스토리 -->
<select id="getReceivingShipmentNo" resultMap="receivingShipmentMap">
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
r.status,
r.product_id,
p.product_name,
p.product_description,
r.change_quantity,
p.product_price,
r.warehouse_id,
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 transaction_type = 'INBOUND' AND u.business_id = #{businessId}
AND r.receiving_shipment_no = #{receivingShipmentNo}
</select>

</mapper>
33 changes: 13 additions & 20 deletions stockMate/src/main/resources/mappers/shipmentMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ INSERT INTO receiving_shipment (
warehouse_id,
created_by
)
SELECT
SELECT DISTINCT
ord.order_type,
'PENDING',
p.product_id,
Expand All @@ -61,19 +61,12 @@ WHERE NOT EXISTS (
AND rs.product_id = p.product_id
AND rs.order_item_id = o.order_item_id
AND rs.stock_id = s.stock_id
)
GROUP BY
p.product_id,
o.order_item_id,
s.stock_id,
o.warehouse_id,
u.created_by,
ord.order_type;
);
</insert>

<!-- 오늘 입고 예정 리스트 -->
<select id="getShipmentList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -95,7 +88,7 @@ GROUP BY

<!-- 어제 입고 리스트 -->
<select id="getYesterdayShipmentList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -117,7 +110,7 @@ GROUP BY

<!-- 그저께 입고 리스트 -->
<select id="getTDBYShipmentList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -139,7 +132,7 @@ GROUP BY

<!-- 입고 내역 히스토리 -->
<select id="getShipmentHistoryList" resultMap="receivingShipmentMap">
select
select DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand All @@ -162,7 +155,7 @@ GROUP BY

<!-- 입고 내역 검색 -->
<select id="getHistoryByDateRange" parameterType="map" resultMap="receivingShipmentMap">
SELECT
SELECT DISTINCT
r.receiving_shipment_no,
r.transaction_type,
r.created_at,
Expand Down Expand Up @@ -219,11 +212,11 @@ GROUP BY

<!-- 입출고 모든 개수 카운트 -->
<select id="getTotalCount" resultType="int">
select count(*)
from receiving_shipment r
JOIN users u on u.created_by = r.created_by
where transaction_type = 'OUTBOUND'
AND u.business_id = #{businessId}
SELECT COUNT(DISTINCT r.receiving_shipment_no)
FROM receiving_shipment r
JOIN users u ON u.created_by = r.created_by
WHERE r.transaction_type = 'OUTBOUND'
AND u.business_id = 1;
</select>

<!-- Shipment scan을 위한 매퍼 -->
Expand All @@ -240,7 +233,7 @@ GROUP BY
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
s.reserved_quantity = s.reserved_quantity -1
WHERE p.product_barcode = #{barcode} AND s.business_id = #{businessId}
AND s.reserved_quantity > 0
</update>
Expand Down
Loading

0 comments on commit dacec94

Please sign in to comment.