-
懒羊羊
2024-03-27 054a699a156ca607e95f220b364136d42a19ab0f
提交 | 用户 | 时间
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());
b77303 50             if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){
51                 if(formulaChildInfo.getCollectData().contains("[")){
52                     String data = formulaChildInfo.getCollectData();
53                     data = data.replace("[", "").replace("]", "").replace(" ", "");
54                     String[] tightenDataParts = data.split(",");
55                     formulaChildInfo.setCollectData("扭矩"+tightenDataParts[0]+"角度"+tightenDataParts[1]+"扭矩结果"+tightenDataParts[2]+"角度结果"+tightenDataParts[3]);
56                 }
57             }
e57a89 58         }
59         return getDataTable(list);
60     }
61
b77303 62 //    /**
63 //     * 检查是否可以放行
64 //     */
65 //    @GetMapping("/releaseCheck")
66 //    public AjaxResult releaseCheck(BsFormulaChildInfo bsFormulaChildInfo)
67 //    {
68 //        List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck(bsFormulaChildInfo);
69 //        return AjaxResult.success(i.size());
70 //    }
e57a89 71
72     /**
73      * 扫码确认
74      */
75     @GetMapping("/updateResults")
76     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo)
77     {
78         return bsFormulaChildInfoService.updateResults(bsFormulaChildInfo);
79     }
80
81     /**
82      * 放行请空状态
83      */
84     @GetMapping("/workpieceRelease")
85     public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo)
86     {
87         return bsFormulaChildInfoService.workpieceRelease(bsFormulaChildInfo);
88     }
89
90     /**
b77303 91      * 拧紧后更新对应数据
92      */
93     @GetMapping("/updateTighteningFormula")
94     public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo)
95     {
96         return bsFormulaChildInfoService.updateTighteningFormula(bsFormulaChildInfo);
97     }
98
99     /**
e57a89 100      * 导出配方配置子信息列表
101      */
102     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
103     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
104     @PostMapping("/export")
105     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
106     {
107         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
108         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
109         util.exportExcel(response, list, "配方配置子信息数据");
110     }
111
112     /**
113      * 获取配方配置子信息详细信息
114      */
115     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
116     @GetMapping(value = "/{id}")
117     public AjaxResult getInfo(@PathVariable("id") Long id)
118     {
119         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
120     }
121
122     /**
123      * 新增配方配置子信息
124      */
125     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
126     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
127     @PostMapping
128     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
129     {
130         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
131     }
132
133     /**
134      * 修改配方配置子信息
135      */
136     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
137     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
138     @PutMapping
139     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
140     {
141         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
142     }
143
144     /**
145      * 删除配方配置子信息
146      */
147     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
148     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
149     @DeleteMapping("/{ids}")
150     public AjaxResult remove(@PathVariable Long[] ids)
151     {
152         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
153     }
154 }