Skip to content

Commit

Permalink
Merge pull request #409 from beyond-sw-camp/feat/salesOrder/situation
Browse files Browse the repository at this point in the history
feat: Frontend - 주문서 현황 조회 기능 추가
  • Loading branch information
catnine11 authored Jan 2, 2025
2 parents b197ac5 + 2bc0b64 commit 8ba1aa5
Show file tree
Hide file tree
Showing 13 changed files with 465 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.Getter;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Getter
public class QuotationSituationExcelDTO {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package error.pirate.backend.quotation.query.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.time.LocalDate;

@Getter
@AllArgsConstructor
public class QuotationSituationResponse {
private LocalDate quotationQuotationDate;
private String quotationName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public ResponseEntity<SalesOrderResponse> readSalesOrder(

@GetMapping("/situation")
@Operation(summary = "주문서 현황 조회")
public ResponseEntity<SalesOrderSituationResponse> readSalesOrderSituation(
public ResponseEntity<List<SalesOrderSituationResponse>> readSalesOrderSituation(
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
@RequestParam(required = false) String clientName) {
Expand Down Expand Up @@ -88,6 +88,24 @@ public ResponseEntity<byte[]> readSalesOrderExcel(
.body(salesOrderQueryService.readSalesOrderExcel(startDate, endDate, clientName, salesOrderStatus));
}

@GetMapping("/situation/excel")
@Operation(summary = "주문서 현황 엑셀 다운로드")
public ResponseEntity<byte[]> readSalesOrderSituationExcel(
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
@RequestParam(required = false) String clientName) {

HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + URLEncoder.encode(
new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + "_주문서_현황.xlsx"
, StandardCharsets.UTF_8));

return ResponseEntity.ok()
.headers(httpHeaders)
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(salesOrderQueryService.readSalesOrderSituationExcel(startDate, endDate, clientName));
}

/* 이미 작업지시가 등록된 주문서 물품 조회 */
@GetMapping("/{salesOrderSeq}/registered-items")
@Operation(summary = "작업지시가 등록된 주문서 물품 조회")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package error.pirate.backend.salesOrder.query.dto;

import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;

@Getter @Setter
public class SalesOrderSituationDTO {
private Long salesOrderSeq;
@Getter
public class SalesOrderSituationExcelDTO {
private LocalDate salesOrderOrderDate;
private String salesOrderName;
private Integer salesOrderTotalQuantity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package error.pirate.backend.salesOrder.query.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;
import java.time.LocalDate;

@Getter
@AllArgsConstructor
public class SalesOrderSituationResponse {
private List<SalesOrderSituationDTO> salesOrderSituationList;
private LocalDate salesOrderOrderDate;
private String salesOrderName;
private Integer salesOrderTotalQuantity;
private Integer salesOrderExtendedPrice;
private String clientName;
private String salesOrderNote;

private String salesOrderOrderMonte;
private Integer salesOrderMonthPrice;
private Integer salesOrderMonthQuantity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ List<SalesOrderItemDTO> selectSalesOrderItem(
@Param("salesOrderSeq") Long salesOrderSeq);

// 주문서 현황 조회
List<SalesOrderSituationDTO> selectSalesOrderSituation(
List<SalesOrderSituationResponse> selectSalesOrderSituation(
@Param("startDate") LocalDate startDate,
@Param("endDate") LocalDate endDate,
@Param("clientName") String clientName);
Expand All @@ -54,6 +54,12 @@ ArrayList<Object> selectSalesOrderExcel(
@Param("clientName") String clientName,
@Param("salesOrderStatus") List<SalesOrderStatus> salesOrderStatus);

// 주문서 현황 엑셀 다운로드
ArrayList<Object> selectSalesOrderSituationExcel(
@Param("startDate") LocalDate startDate,
@Param("endDate") LocalDate endDate,
@Param("clientName") String clientName);

// 작업지시서가 등록된 주문서 품목 조회
List<Long> selectRegisteredItemSeqsBySalesOrderSeq(@Param("salesOrderSeq") Long salesOrderSeq);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ public SalesOrderResponse readSalesOrder(Long salesOrderSeq) {
}

// 주문서 현황 조회
public SalesOrderSituationResponse readSalesOrderSituation(
public List<SalesOrderSituationResponse> readSalesOrderSituation(
LocalDate startDate, LocalDate endDate, String clientName) {

// 주문서 현황 조회
return new SalesOrderSituationResponse(salesOrderMapper.selectSalesOrderSituation(
startDate, endDate, clientName));
return salesOrderMapper.selectSalesOrderSituation(startDate, endDate, clientName);
}

// 주문서 품목 값 확인
Expand All @@ -81,6 +80,15 @@ public byte[] readSalesOrderExcel(
);
}

// 주문서 현황 엑셀 다운로드
public byte[] readSalesOrderSituationExcel(LocalDate startDate, LocalDate endDate, String clientName) {

return excelDownBody.writeCells(
new String[] {"주문일", "이름", "총 수량", "총 가격", "거래처", "비고"},
salesOrderMapper.selectSalesOrderSituationExcel(startDate, endDate, clientName)
);
}

// 작업지시가 등록된 주문서 물품 조회
public List<Long> readRegisteredItems(Long salesOrderSeq) {
return salesOrderMapper.selectRegisteredItemSeqsBySalesOrderSeq(salesOrderSeq);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,20 @@
</select>

<!-- 주문서 현황 조회 -->
<select id="selectSalesOrderSituation" resultType="error.pirate.backend.salesOrder.query.dto.SalesOrderSituationDTO">
<select id="selectSalesOrderSituation" resultType="error.pirate.backend.salesOrder.query.dto.SalesOrderSituationResponse">
SELECT
tb_sales_order.sales_order_seq,
tb_sales_order.sales_order_order_date,
tb_sales_order.sales_order_name,
tb_sales_order.sales_order_total_quantity,
tb_sales_order.sales_order_extended_price,
tb_client.client_name,
tb_sales_order.sales_order_note
tb_sales_order.sales_order_note,
DATE_FORMAT(tb_sales_order.sales_order_order_date, '%Y-%m') as sales_order_order_month,
IFNULL(SUM(tb_sales_order.sales_order_extended_price), 0) as sales_order_month_price,
IFNULL(SUM(tb_sales_order.sales_order_total_quantity), 0) as sales_order_month_quantity
FROM tb_sales_order
JOIN tb_client USING (client_seq)
WHERE TRUE
WHERE tb_sales_order.sales_order_status NOT IN ("DELETE")
<if test="startDate != null"><![CDATA[
AND #{startDate} <= tb_sales_order.sales_order_order_date
]]></if>
Expand All @@ -116,6 +118,9 @@
<if test="clientName != null">
AND tb_client.client_name LIKE CONCAT('%', #{clientName}, '%')
</if>
GROUP BY
DATE_FORMAT(tb_sales_order.sales_order_order_date, '%Y-%m'),
tb_sales_order.sales_order_order_date WITH ROLLUP;
</select>

<!-- 주문서 품목 값 확인 -->
Expand Down Expand Up @@ -165,6 +170,29 @@
</if>
</select>

<!-- 주문서 현황 엑셀 다운로드 -->
<select id="selectSalesOrderSituationExcel" resultType="error.pirate.backend.salesOrder.query.dto.SalesOrderSituationExcelDTO">
SELECT
tb_sales_order.sales_order_order_date,
tb_sales_order.sales_order_name,
tb_sales_order.sales_order_total_quantity,
tb_sales_order.sales_order_extended_price,
tb_client.client_name,
tb_sales_order.sales_order_note
FROM tb_sales_order
JOIN tb_client USING (client_seq)
WHERE tb_sales_order.sales_order_status NOT IN ("DELETE")
<if test="startDate != null"><![CDATA[
AND #{startDate} <= tb_sales_order.sales_order_order_date
]]></if>
<if test="endDate != null"><![CDATA[
AND #{endDate} >= tb_sales_order.sales_order_order_date
]]></if>
<if test="clientName != null">
AND tb_client.client_name LIKE CONCAT('%', #{clientName}, '%')
</if>
</select>

<!-- 작업지시서가 등록된 주문서 물품 조회 -->
<select id="selectRegisteredItemSeqsBySalesOrderSeq" resultType="Long">
SELECT soi.sales_order_item_seq
Expand Down
4 changes: 2 additions & 2 deletions SCM/frontend/src/components/common/SideMenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const toggleSubMenu = (subMenu) => {
<li>
<RouterLink class="content-item" to="/quotation">견적서 조회</RouterLink>
<RouterLink class="content-item" to="/quotation/input">견적서 등록</RouterLink>
<RouterLink class="content-item" to="">견적서 현황</RouterLink>
<RouterLink class="content-item" to="/quotation/situation">견적서 현황</RouterLink>
</li>
</ul>
</li>
Expand All @@ -87,7 +87,7 @@ const toggleSubMenu = (subMenu) => {
<li>
<RouterLink class="content-item" to="/sales-order">주문서 조회</RouterLink>
<RouterLink class="content-item" to="/sales-order/input">주문서 등록</RouterLink>
<RouterLink class="content-item" to="">주문서 현황</RouterLink>
<RouterLink class="content-item" to="/sales-order/situation">주문서 현황</RouterLink>
</li>
</ul>
</li>
Expand Down
79 changes: 39 additions & 40 deletions SCM/frontend/src/components/quotation/QuotationSituation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,60 +141,59 @@ function search() {
</div>
</div>
<div class="col-md-9">
<div class="d-flex justify-content-end mt-3">
<b-button @click="excelDown()" variant="light" size="sm" class="button ms-2 mb-3">엑셀 다운로드</b-button>
<b-button @click="printTable()" variant="light" size="sm" class="button ms-2 mb-3">인쇄</b-button>
</div>
<div class="d-flex justify-content-end mt-3">
<b-button @click="excelDown()" variant="light" size="sm" class="button ms-2 mb-3">엑셀 다운로드</b-button>
<b-button @click="printTable()" variant="light" size="sm" class="button ms-2 mb-3">인쇄</b-button>
</div>
<div id="print-area-quotation-situation" class="content">
<div class="table-container">
<!-- 테이블 -->
<table>
<thead>
<tr>
<th>번호</th>
<th>견적일</th>
<th>이름</th>
<th>총 수량</th>
<th>총 가격</th>
<th>거래처</th>
<th>비고</th>
</tr>
</thead>
<tr>
<th>번호</th>
<th>견적일</th>
<th>이름</th>
<th>총 수량</th>
<th>총 가격</th>
<th>거래처</th>
<th>비고</th>
</tr>
</thead>
<tbody v-if="quotationSituationList.length > 0">
<!-- 필터링된 결과 및 월별 합계 출력 -->
<template v-for="(quotationSituation, index) in quotationSituationList" :key="index">
<tr v-if="quotationSituation.quotationQuotationDate">
<td>{{ index + 1 }}</td>
<td>{{ dayjs(quotationSituation.quotationQuotationDate).format('YYYY/MM/DD') }}</td>
<td>{{ quotationSituation.quotationName }}</td>
<td>{{ quotationSituation.quotationTotalQuantity !== null ? quotationSituation.quotationTotalQuantity.toLocaleString() : '0' }}</td>
<td> ₩ {{ quotationSituation.quotationExtendedPrice !== null ? quotationSituation.quotationExtendedPrice.toLocaleString() : '0' }}</td>
<td>{{ quotationSituation.clientName }}</td>
<td>{{ quotationSituation.quotationNote !== null ? quotationSituation.quotationNote : '-' }}</td>
</tr>
<tr v-else class="monthly-total">
<td></td>
<td>{{ quotationSituation.quotationQuotationMonth }}</td>
<td></td>
<td>{{ quotationSituation.quotationMonthQuantity.toLocaleString() }}</td>
<td> ₩ {{ quotationSituation.quotationMonthPrice.toLocaleString() }}</td>
<td></td>
<td></td>
</tr>
<tr v-if="quotationSituation.quotationQuotationDate">
<td>{{ index + 1 }}</td>
<td>{{ dayjs(quotationSituation.quotationQuotationDate).format('YYYY/MM/DD') }}</td>
<td>{{ quotationSituation.quotationName }}</td>
<td>{{ quotationSituation.quotationTotalQuantity !== null ? quotationSituation.quotationTotalQuantity.toLocaleString() : '0' }}</td>
<td> ₩ {{ quotationSituation.quotationExtendedPrice !== null ? quotationSituation.quotationExtendedPrice.toLocaleString() : '0' }}</td>
<td>{{ quotationSituation.clientName }}</td>
<td>{{ quotationSituation.quotationNote !== null ? quotationSituation.quotationNote : '-' }}</td>
</tr>
<tr v-else class="monthly-total">
<td></td>
<td>{{ quotationSituation.quotationQuotationMonth }}</td>
<td></td>
<td>{{ quotationSituation.quotationMonthQuantity.toLocaleString() }}</td>
<td> ₩ {{ quotationSituation.quotationMonthPrice.toLocaleString() }}</td>
<td></td>
<td></td>
</tr>
</template>

</tbody>
<tbody v-else>
<tr>
<td colspan="6">해당 검색조건에 부합한 견적서가 존재하지 않습니다</td>
</tr>
<tr>
<td colspan="6">해당 검색조건에 부합한 견적서가 존재하지 않습니다</td>
</tr>
</tbody>
<!-- 총합 -->
<tfoot v-if="quotationSituationTotal">
<tr>
<td colspan="5">총합</td>
<td colspan="2">₩ {{ quotationSituationTotal.quotationMonthPrice ? quotationSituationTotal.quotationMonthPrice.toLocaleString() : null }}</td>
</tr>
<tr>
<td colspan="5">총합</td>
<td colspan="2">₩ {{ quotationSituationTotal.quotationMonthPrice ? quotationSituationTotal.quotationMonthPrice.toLocaleString() : null }}</td>
</tr>
</tfoot>
</table>
</div>
Expand Down
Loading

0 comments on commit 8ba1aa5

Please sign in to comment.