From ac79dfd8d661dbe166553ff80fbdbfee64e8134e Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 28 四月 2026 16:02:20 +0800
Subject: [PATCH] feat(production): 添加工序ID字段支持
---
src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java | 34 +++++++++++++++++++++++++++++-----
1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java b/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java
index 973f9de..94a5cb7 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java
@@ -1,14 +1,17 @@
package com.ruoyi.production.controller;
+import com.ruoyi.framework.web.domain.R;
import com.ruoyi.production.dto.SaveProductionPrintOrderDto;
import com.ruoyi.production.pojo.ProductionPrintOrder;
import com.ruoyi.production.service.ProductionPrintOrderService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import lombok.SneakyThrows;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
/**
* @author buhuazhen
@@ -24,8 +27,29 @@
private final ProductionPrintOrderService productionPrintOrderService;
@PostMapping("/save")
- public void save(@RequestBody SaveProductionPrintOrderDto dto){
+ public R save(@RequestBody SaveProductionPrintOrderDto dto) {
productionPrintOrderService.save(dto);
+ return R.ok();
}
+
+ @PostMapping("/getByProductWordId/{id}")
+ public ProductionPrintOrder getByProductWordId(@PathVariable Long id) {
+ return productionPrintOrderService.getByProductWordId(id);
+ }
+
+ @PostMapping("/export/{id}")
+ @SneakyThrows
+ public void export(@PathVariable Long id, HttpServletResponse response) {
+ byte[] bytes = productionPrintOrderService.exportPrintExcelByWordId(id);
+ String fileName = "鍗板埛瀹氬嵃鍗�.xlsx";
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setCharacterEncoding("utf-8");
+ // 瑙e喅涓枃鏂囦欢鍚嶄贡鐮�
+ response.setHeader("Content-Disposition",
+ "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
+ ServletOutputStream out = response.getOutputStream();
+ out.write(bytes);
+ out.flush();
+ }
}
--
Gitblit v1.9.3