From cf65d0a608b21f07dc50a98b864dfe47def4f86b Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 23 三月 2026 17:12:37 +0800
Subject: [PATCH] fix:1.产品删除 2.原材料展示 3.菜单优化 4.区分角色编辑删除
---
src/main/java/com/ruoyi/stock/controller/StockInRecordController.java | 40 +++++++++++++++++++++++++++-------------
1 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java b/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
index 0c6fa02..98e9e39 100644
--- a/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
+++ b/src/main/java/com/ruoyi/stock/controller/StockInRecordController.java
@@ -7,22 +7,28 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.stock.dto.StockInRecordDto;
import com.ruoyi.stock.service.StockInRecordService;
+import com.ruoyi.stock.word.WeighbridgeDocGenerator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
-@Api(tags = "閲囪喘鍏ュ簱")
+@Api(tags = "鍏ュ簱")
@RequestMapping("/stockInRecord")
public class StockInRecordController {
@Autowired
private StockInRecordService stockInRecordService;
+ @Autowired
+ private WeighbridgeDocGenerator weighbridgeDocGenerator;
- @GetMapping("/listPageByProduction")
+
+ @GetMapping("/listPage")
@Log(title = "鐢熶骇鍏ュ簱-鍏ュ簱绠$悊-鍒楄〃", businessType = BusinessType.OTHER)
@ApiOperation(value = "鍏ュ簱绠$悊鍒楄〃")
public AjaxResult listPage(Page page, StockInRecordDto stockInRecordDto) {
@@ -30,25 +36,33 @@
return AjaxResult.success(result);
}
- @PostMapping("")
- @Log(title = "鍏ュ簱绠$悊-鏂板鍏ュ簱", businessType = BusinessType.INSERT)
- public AjaxResult add(@RequestBody StockInRecordDto stockInRecordDto) {
- return AjaxResult.success(stockInRecordService.add(stockInRecordDto));
- }
-
- @PutMapping("/{id}")
- @Log(title = "鍏ュ簱绠$悊-鏇存柊鍏ュ簱", businessType = BusinessType.UPDATE)
- public AjaxResult update(@PathVariable("id") Long id, @RequestBody StockInRecordDto stockInRecordDto) {
- return AjaxResult.success(stockInRecordService.update(id, stockInRecordDto));
+ @PostMapping("/editStockInStock")
+ @PreAuthorize("@ss.hasPermi('receipt_edit')")
+ @ApiOperation("缂栬緫鍏ュ簱璁板綍")
+ public AjaxResult editStockInStock(@RequestBody StockInRecordDto stockInRecordDto) {
+ if (stockInRecordDto.getId() == null) {
+ return AjaxResult.error("鍏ュ簱璁板綍ID涓嶈兘涓虹┖");
+ }
+ stockInRecordDto.setStockInNum(stockInRecordDto.getNetWeight());
+ String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
+ stockInRecordDto.setWeighbridgeDocPath(absoluteDocPath);
+ return AjaxResult.success(stockInRecordService.updateById(stockInRecordDto));
}
@DeleteMapping("")
+ @PreAuthorize("@ss.hasPermi('receipt_cancel')")
@Log(title = "鍏ュ簱绠$悊-鍒犻櫎鍏ュ簱", businessType = BusinessType.DELETE)
public AjaxResult delete(@RequestBody List<Long> ids) {
- if(CollectionUtils.isEmpty(ids)){
+ if (CollectionUtils.isEmpty(ids)) {
return AjaxResult.error("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
}
return AjaxResult.success(stockInRecordService.batchDelete(ids));
}
+ @PostMapping("/exportStockInRecord")
+ @ApiOperation("瀵煎嚭鍏ュ簱璁板綍")
+ public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) {
+ stockInRecordService.exportStockInRecord(response, stockInRecordDto);
+ }
+
}
--
Gitblit v1.9.3