From 1e123568c2f561013f5636e45dc0db30b17a3517 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 10 九月 2026 16:39:26 +0800
Subject: [PATCH] feat(basic): 添加产品条码功能并完善生产统计报表

---
 src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java |  130 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 120 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java b/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
index e7a07e2..f917efa 100644
--- a/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
+++ b/src/main/java/com/ruoyi/technology/controller/TechnologyBomController.java
@@ -1,18 +1,128 @@
 package com.ruoyi.technology.controller;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.technology.bean.dto.BomImportDto;
+import com.ruoyi.technology.bean.dto.BomKitCheckDto;
+import com.ruoyi.technology.bean.dto.TechnologyBomDto;
+import com.ruoyi.technology.bean.vo.BomKitCheckItemVo;
+import com.ruoyi.technology.bean.vo.TechnologyBomVo;
+import com.ruoyi.technology.pojo.TechnologyBom;
+import com.ruoyi.technology.service.TechnologyBomService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
-/**
- * <p>
- * BOM琛� 鍓嶇鎺у埗鍣�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-20 10:05:55
- */
+import java.util.List;
+
 @RestController
 @RequestMapping("/technologyBom")
+@RequiredArgsConstructor
+@Tag(name = "鍩虹BOM")
 public class TechnologyBomController {
 
+    private final TechnologyBomService technologyBomService;
+
+    @GetMapping("/listPage")
+    @Log(title = "Technology BOM page", businessType = BusinessType.OTHER)
+    @Operation(summary = "BOM鍒嗛〉鏌ヨ")
+    public R<IPage<TechnologyBomVo>> listPage(Page<TechnologyBomDto> page, TechnologyBomDto technologyBomDto) {
+        return R.ok(technologyBomService.listPage(page, technologyBomDto));
+    }
+
+    @PostMapping("/add")
+    @Log(title = "Add technology BOM", businessType = BusinessType.INSERT)
+    @Operation(summary = "鏂板BOM")
+    public R add(@RequestBody TechnologyBom technologyBom) {
+        return technologyBomService.add(technologyBom);
+    }
+
+    @PutMapping("/update")
+    @Log(title = "Update technology BOM", businessType = BusinessType.UPDATE)
+    @Operation(summary = "淇敼BOM")
+    public R update(@RequestBody TechnologyBom technologyBom) {
+        return technologyBomService.update(technologyBom);
+    }
+
+    @DeleteMapping("/batchDelete")
+    @Log(title = "Delete technology BOM", businessType = BusinessType.DELETE)
+    @Operation(summary = "鎵归噺鍒犻櫎BOM")
+    public R batchDelete(@RequestBody List<Long> ids) {
+        return R.ok(technologyBomService.batchDelete(ids));
+    }
+
+    @GetMapping("/getByModel")
+    @Log(title = "List BOM by model", businessType = BusinessType.OTHER)
+    @Operation(summary = "鏍规嵁瑙勬牸鏌ヨBOM")
+    public R<List<TechnologyBomVo>> getByModel(Long productModelId) {
+        return R.ok(technologyBomService.listByModel(productModelId));
+    }
+
+    @PostMapping("/uploadBom")
+    @PreAuthorize("@ss.hasPermi('product:bom:import')")
+    @Log(title = "鏍规嵁Excel瀵煎叆BOM", businessType = BusinessType.IMPORT)
+    @Operation(summary = "鏍规嵁Excel瀵煎叆BOM")
+    public R uploadBom(@RequestParam("file") MultipartFile file) {
+        return technologyBomService.uploadBom(file);
+    }
+
+    @PostMapping("/exportBom")
+    @PreAuthorize("@ss.hasPermi('product:bom:export')")
+    @Operation(summary = "瀵煎嚭BOM鏂囦欢")
+    @Log(title = "瀵煎嚭BOM鏂囦欢", businessType = BusinessType.EXPORT)
+    public void exportBom(HttpServletResponse response, @RequestParam Long bomId) {
+        technologyBomService.exportBom(response, bomId);
+    }
+
+    @GetMapping("/downloadTemplate")
+    @Log(title = "涓嬭浇BOM瀵煎叆妯℃澘", businessType = BusinessType.EXPORT)
+    @Operation(summary = "涓嬭浇BOM瀵煎叆妯℃澘")
+    public void importTemplate(HttpServletResponse response) {
+        ExcelUtil<BomImportDto> excelUtil = new ExcelUtil<>(BomImportDto.class);
+        excelUtil.importTemplateExcel(response, "BOM瀵煎叆妯℃澘");
+    }
+
+    @PostMapping("/copy")
+    @Log(title = "Copy technology BOM", businessType = BusinessType.INSERT)
+    @Operation(summary = "澶嶅埗BOM")
+    public R copy(@RequestBody TechnologyBom technologyBom) {
+        return technologyBomService.copy(technologyBom);
+    }
+
+    @PostMapping("/kitCheck")
+    @Operation(summary = "BOM榻愬鍒嗘瀽锛堥渶姹傚睍寮�+搴撳瓨姣斿锛�")
+    public R<List<BomKitCheckItemVo>> kitCheck(@RequestBody BomKitCheckDto dto) {
+        return R.ok(technologyBomService.kitCheck(dto));
+    }
+
+    @PostMapping("/kitCheck/export")
+    @Log(title = "Export BOM kit check", businessType = BusinessType.EXPORT)
+    @Operation(summary = "BOM榻愬鍒嗘瀽瀵煎嚭Excel")
+    public void exportKitCheck(HttpServletResponse response, @RequestBody BomKitCheckDto dto) {
+        List<BomKitCheckItemVo> list = technologyBomService.kitCheck(dto);
+        ExcelUtil<BomKitCheckItemVo> util = new ExcelUtil<>(BomKitCheckItemVo.class);
+        util.exportExcel(response, list, "BOM榻愬鍒嗘瀽");
+    }
+
+    @PostMapping("/kitCheck/generateDemand")
+    @Log(title = "Generate procurement demand", businessType = BusinessType.INSERT)
+    @Operation(summary = "榻愬缂哄彛鐢熸垚閲囪喘闇�姹�")
+    public R generateDemand(@RequestBody BomKitCheckDto dto) {
+        return technologyBomService.generateProcurementDemand(dto);
+    }
+
+    @PutMapping("/changeStatus")
+    @Log(title = "Change BOM status", businessType = BusinessType.UPDATE)
+    @Operation(summary = "BOM鍚敤/鍋滅敤锛堝惎鐢ㄨ嚜鍔ㄥ仠鐢ㄥ悓瑙勬牸鍏跺畠鐗堟湰锛�")
+    public R changeStatus(@RequestBody TechnologyBom technologyBom) {
+        return technologyBomService.changeStatus(technologyBom.getId(), technologyBom.getStatus());
+    }
 }

--
Gitblit v1.9.3