|
|
|
@@ -14,8 +14,10 @@ import org.apache.poi.ss.util.CellRangeAddress |
|
|
|
import org.apache.poi.ss.util.WorkbookUtil |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook |
|
|
|
import org.springframework.beans.factory.annotation.Value |
|
|
|
import org.springframework.http.* |
|
|
|
import org.springframework.web.bind.annotation.* |
|
|
|
import org.springframework.web.server.ResponseStatusException |
|
|
|
import java.io.ByteArrayOutputStream |
|
|
|
import java.io.InputStream |
|
|
|
import java.time.LocalDate |
|
|
|
@@ -33,7 +35,13 @@ class ReportController( |
|
|
|
private val reportService: ReportService, |
|
|
|
private val m18BomShopSyncReportService: M18BomShopSyncReportService, |
|
|
|
private val shopOrderReplenishmentReportService: ShopOrderReplenishmentReportService, |
|
|
|
@Value("\${fpsms.demo-mode:false}") private val demoMode: Boolean, |
|
|
|
) { |
|
|
|
private fun refuseIfDemo() { |
|
|
|
if (demoMode) { |
|
|
|
throw ResponseStatusException(HttpStatus.FORBIDDEN, "Unavailable in demo mode") |
|
|
|
} |
|
|
|
} |
|
|
|
private data class ExcelStyles( |
|
|
|
val title: XSSFCellStyle, |
|
|
|
val subtitle: XSSFCellStyle, |
|
|
|
@@ -1238,18 +1246,21 @@ class ReportController( |
|
|
|
@RequestParam(required = false) syncDateEnd: String?, |
|
|
|
@RequestParam(required = false) finishedItemCode: String?, |
|
|
|
@RequestParam(required = false) syncStatus: String?, |
|
|
|
): Map<String, Any> = |
|
|
|
m18BomShopSyncReportService.searchBomShopSyncHistoryReport( |
|
|
|
): Map<String, Any> { |
|
|
|
refuseIfDemo() |
|
|
|
return m18BomShopSyncReportService.searchBomShopSyncHistoryReport( |
|
|
|
syncDateStart = syncDateStart, |
|
|
|
syncDateEnd = syncDateEnd, |
|
|
|
finishedItemCode = finishedItemCode, |
|
|
|
syncStatus = syncStatus, |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/bom-shop-sync-history") |
|
|
|
fun getBomShopSyncHistoryReportPost( |
|
|
|
@RequestBody(required = false) req: ReportItemFilterRequest?, |
|
|
|
): Map<String, Any> { |
|
|
|
refuseIfDemo() |
|
|
|
val r = req ?: ReportItemFilterRequest() |
|
|
|
return m18BomShopSyncReportService.searchBomShopSyncHistoryReport( |
|
|
|
syncDateStart = r.syncDateStart, |
|
|
|
@@ -1301,6 +1312,7 @@ class ReportController( |
|
|
|
@RequestParam receiptDate: String, |
|
|
|
@RequestParam(required = false, defaultValue = "json") format: String, |
|
|
|
): Any { |
|
|
|
refuseIfDemo() |
|
|
|
val rows = reportService.searchGrnPreviewM18(receiptDate) |
|
|
|
if (format.equals("csv", ignoreCase = true)) { |
|
|
|
val headers = listOf( |
|
|
|
|