-
admin
2024-04-29 2c7661d0bca739a9b403cdd420d2b91eb77470e6
提交 | 用户 | 时间
e57a89 1 package com.jcdm.main.bs.formulaChild.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
0caf87 5
6 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
e57a89 7 import org.springframework.security.access.prepost.PreAuthorize;
8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.GetMapping;
10 import org.springframework.web.bind.annotation.PostMapping;
11 import org.springframework.web.bind.annotation.PutMapping;
12 import org.springframework.web.bind.annotation.DeleteMapping;
13 import org.springframework.web.bind.annotation.PathVariable;
14 import org.springframework.web.bind.annotation.RequestBody;
15 import org.springframework.web.bind.annotation.RequestMapping;
16 import org.springframework.web.bind.annotation.RestController;
17 import com.jcdm.common.annotation.Log;
18 import com.jcdm.common.core.controller.BaseController;
19 import com.jcdm.common.core.domain.AjaxResult;
20 import com.jcdm.common.enums.BusinessType;
21 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
22 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
23 import com.jcdm.common.utils.poi.ExcelUtil;
24 import com.jcdm.common.core.page.TableDataInfo;
25
26 /**
27  * 配方配置子信息Controller
28  * 
29  * @author ruimin
30  * @date 2023-12-26
31  */
32 @RestController
33 @RequestMapping("/bs/formulaChild")
34 public class BsFormulaChildInfoController extends BaseController
35 {
36     @Autowired
37     private IBsFormulaChildInfoService bsFormulaChildInfoService;
38
39     /**
40      * 查询配方配置子信息列表
41      */
0caf87 42     @GetMapping("/noPageListFormulaChild")
43     public TableDataInfo noPageListFormulaChild(BsFormulaChildInfo bsFormulaChildInfo)
44     {
45         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>()
46                 .eq(BsFormulaChildInfo::getProductCode,bsFormulaChildInfo.getProductCode())
47                 .eq(BsFormulaChildInfo::getProcessesCode,bsFormulaChildInfo.getProcessesCode()));
48         for (BsFormulaChildInfo formulaChildInfo : list) {
49 //            formulaChildInfo.setSort(formulaChildInfo.getStepSort());
50 //            formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
51 //            formulaChildInfo.setImg(formulaChildInfo.getOperationSteps());
52             if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){
53                 if(formulaChildInfo.getCollectData().contains("[")){
54                     String data = formulaChildInfo.getCollectData();
55                     data = data.replace("[", "").replace("]", "").replace(" ", "");
56                     String[] tightenDataParts = data.split(",");
57                     formulaChildInfo.setCollectData("扭矩"+tightenDataParts[0]+"角度"+tightenDataParts[1]+"扭矩结果"+tightenDataParts[2]+"角度结果"+tightenDataParts[3]);
58                 }
59             }
60         }
61         return getDataTable(list);
62     }
63
64     /**
65      * 查询配方配置子信息列表
66      */
e57a89 67     @PreAuthorize("@ss.hasPermi('bs:formulaChild:list')")
68     @GetMapping("/list")
69     public TableDataInfo list(BsFormulaChildInfo bsFormulaChildInfo)
70     {
71         startPage();
72         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
73         for (BsFormulaChildInfo formulaChildInfo : list) {
74             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
75             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
76             formulaChildInfo.setImg(formulaChildInfo.getOperationSteps());
b77303 77             if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){
78                 if(formulaChildInfo.getCollectData().contains("[")){
79                     String data = formulaChildInfo.getCollectData();
80                     data = data.replace("[", "").replace("]", "").replace(" ", "");
81                     String[] tightenDataParts = data.split(",");
82                     formulaChildInfo.setCollectData("扭矩"+tightenDataParts[0]+"角度"+tightenDataParts[1]+"扭矩结果"+tightenDataParts[2]+"角度结果"+tightenDataParts[3]);
83                 }
84             }
e57a89 85         }
86         return getDataTable(list);
87     }
88
b77303 89 //    /**
90 //     * 检查是否可以放行
91 //     */
92 //    @GetMapping("/releaseCheck")
93 //    public AjaxResult releaseCheck(BsFormulaChildInfo bsFormulaChildInfo)
94 //    {
95 //        List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck(bsFormulaChildInfo);
96 //        return AjaxResult.success(i.size());
97 //    }
e57a89 98
99     /**
100      * 扫码确认
101      */
102     @GetMapping("/updateResults")
103     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo)
104     {
105         return bsFormulaChildInfoService.updateResults(bsFormulaChildInfo);
106     }
107
108     /**
2c7661 109      * 扫码确认
A 110      */
111     @GetMapping("/yzUpdateResults")
112     public AjaxResult yzUpdateResults(BsFormulaChildInfo bsFormulaChildInfo)
113     {
114         return bsFormulaChildInfoService.yzUpdateResults(bsFormulaChildInfo);
115     }
116
117     /**
e57a89 118      * 放行请空状态
119      */
120     @GetMapping("/workpieceRelease")
121     public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo)
122     {
123         return bsFormulaChildInfoService.workpieceRelease(bsFormulaChildInfo);
124     }
125
126     /**
b77303 127      * 拧紧后更新对应数据
128      */
129     @GetMapping("/updateTighteningFormula")
130     public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo)
131     {
132         return bsFormulaChildInfoService.updateTighteningFormula(bsFormulaChildInfo);
133     }
134
135     /**
2c7661 136      * 拧紧后更新对应数据
A 137      */
138     @GetMapping("/yzUpdateTighteningFormula")
139     public AjaxResult yzUpdateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo)
140     {
141         return bsFormulaChildInfoService.yzUpdateTighteningFormula(bsFormulaChildInfo);
142     }
143
144     /**
e57a89 145      * 导出配方配置子信息列表
146      */
147     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
148     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
149     @PostMapping("/export")
150     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
151     {
152         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
153         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
154         util.exportExcel(response, list, "配方配置子信息数据");
155     }
156
157     /**
158      * 获取配方配置子信息详细信息
159      */
160     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
161     @GetMapping(value = "/{id}")
162     public AjaxResult getInfo(@PathVariable("id") Long id)
163     {
164         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
165     }
166
167     /**
168      * 新增配方配置子信息
169      */
170     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
171     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
172     @PostMapping
173     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
174     {
175         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
176     }
177
178     /**
179      * 修改配方配置子信息
180      */
181     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
182     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
183     @PutMapping
184     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
185     {
186         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
187     }
188
189     /**
190      * 删除配方配置子信息
191      */
192     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
193     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
194     @DeleteMapping("/{ids}")
195     public AjaxResult remove(@PathVariable Long[] ids)
196     {
197         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
198     }
199 }