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