-
admin
2024-05-09 06713afdb80bc876ffc6a09442049a08eb8a2364
提交 | 用户 | 时间
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      */
06713a 111     @GetMapping("/jrmUpdateResults")
A 112     public AjaxResult jrmUpdateResults(BsFormulaChildInfo bsFormulaChildInfo)
113     {
114         return bsFormulaChildInfoService.jrmUpdateResults(bsFormulaChildInfo);
115     }
116
117     /**
118      * 扫码确认
119      */
2c7661 120     @GetMapping("/yzUpdateResults")
A 121     public AjaxResult yzUpdateResults(BsFormulaChildInfo bsFormulaChildInfo)
122     {
123         return bsFormulaChildInfoService.yzUpdateResults(bsFormulaChildInfo);
124     }
125
126     /**
e57a89 127      * 放行请空状态
128      */
129     @GetMapping("/workpieceRelease")
130     public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo)
131     {
132         return bsFormulaChildInfoService.workpieceRelease(bsFormulaChildInfo);
133     }
134
135     /**
b77303 136      * 拧紧后更新对应数据
137      */
138     @GetMapping("/updateTighteningFormula")
139     public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo)
140     {
141         return bsFormulaChildInfoService.updateTighteningFormula(bsFormulaChildInfo);
142     }
143
144     /**
2c7661 145      * 拧紧后更新对应数据
A 146      */
147     @GetMapping("/yzUpdateTighteningFormula")
148     public AjaxResult yzUpdateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo)
149     {
150         return bsFormulaChildInfoService.yzUpdateTighteningFormula(bsFormulaChildInfo);
151     }
152
153     /**
e57a89 154      * 导出配方配置子信息列表
155      */
156     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
157     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
158     @PostMapping("/export")
159     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
160     {
161         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
162         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
163         util.exportExcel(response, list, "配方配置子信息数据");
164     }
165
166     /**
167      * 获取配方配置子信息详细信息
168      */
169     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
170     @GetMapping(value = "/{id}")
171     public AjaxResult getInfo(@PathVariable("id") Long id)
172     {
173         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
174     }
175
176     /**
177      * 新增配方配置子信息
178      */
179     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
180     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
181     @PostMapping
182     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
183     {
184         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
185     }
186
187     /**
188      * 修改配方配置子信息
189      */
190     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
191     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
192     @PutMapping
193     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
194     {
195         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
196     }
197
198     /**
199      * 删除配方配置子信息
200      */
201     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
202     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
203     @DeleteMapping("/{ids}")
204     public AjaxResult remove(@PathVariable Long[] ids)
205     {
206         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
207     }
208 }