懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 package com.jcdm.main.bs.formulaChild.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
5 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.PostMapping;
9 import org.springframework.web.bind.annotation.PutMapping;
10 import org.springframework.web.bind.annotation.DeleteMapping;
11 import org.springframework.web.bind.annotation.PathVariable;
12 import org.springframework.web.bind.annotation.RequestBody;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController;
15 import com.jcdm.common.annotation.Log;
16 import com.jcdm.common.core.controller.BaseController;
17 import com.jcdm.common.core.domain.AjaxResult;
18 import com.jcdm.common.enums.BusinessType;
19 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
20 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
21 import com.jcdm.common.utils.poi.ExcelUtil;
22 import com.jcdm.common.core.page.TableDataInfo;
23
24 /**
25  * 配方配置子信息Controller
26  * 
27  * @author ruimin
28  * @date 2023-12-26
29  */
30 @RestController
31 @RequestMapping("/bs/formulaChild")
32 public class BsFormulaChildInfoController extends BaseController
33 {
34     @Autowired
35     private IBsFormulaChildInfoService bsFormulaChildInfoService;
36
37     /**
38      * 查询配方配置子信息列表
39      */
40     @PreAuthorize("@ss.hasPermi('bs:formulaChild:list')")
41     @GetMapping("/list")
42     public TableDataInfo list(BsFormulaChildInfo bsFormulaChildInfo)
43     {
44         startPage();
45         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
46         for (BsFormulaChildInfo formulaChildInfo : list) {
47             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
48             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
49             formulaChildInfo.setImg(formulaChildInfo.getOperationSteps());
50         }
51         return getDataTable(list);
52     }
53
54     /**
55      * 检查是否可以放行
56      */
57     @GetMapping("/releaseCheck")
58     public AjaxResult releaseCheck(BsFormulaChildInfo bsFormulaChildInfo)
59     {
60         List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck(bsFormulaChildInfo);
61         return AjaxResult.success(i.size());
62     }
63
64     /**
65      * 扫码确认
66      */
67     @GetMapping("/updateResults")
68     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo)
69     {
70         return bsFormulaChildInfoService.updateResults(bsFormulaChildInfo);
71     }
72
73     /**
74      * 放行请空状态
75      */
76     @GetMapping("/workpieceRelease")
77     public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo)
78     {
79         return bsFormulaChildInfoService.workpieceRelease(bsFormulaChildInfo);
80     }
81
82     /**
83      * 导出配方配置子信息列表
84      */
85     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
86     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
87     @PostMapping("/export")
88     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
89     {
90         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
91         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
92         util.exportExcel(response, list, "配方配置子信息数据");
93     }
94
95     /**
96      * 获取配方配置子信息详细信息
97      */
98     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
99     @GetMapping(value = "/{id}")
100     public AjaxResult getInfo(@PathVariable("id") Long id)
101     {
102         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
103     }
104
105     /**
106      * 新增配方配置子信息
107      */
108     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
109     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
110     @PostMapping
111     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
112     {
113         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
114     }
115
116     /**
117      * 修改配方配置子信息
118      */
119     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
120     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
121     @PutMapping
122     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
123     {
124         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
125     }
126
127     /**
128      * 删除配方配置子信息
129      */
130     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
131     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
132     @DeleteMapping("/{ids}")
133     public AjaxResult remove(@PathVariable Long[] ids)
134     {
135         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
136     }
137 }