提交 | 用户 | 时间
|
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; |
a320dc
|
10 |
import com.kangaroohy.milo.model.ReadWriteEntity; |
A |
11 |
import com.kangaroohy.milo.service.MiloService; |
e57a89
|
12 |
import org.springframework.security.access.prepost.PreAuthorize; |
懒 |
13 |
import org.springframework.beans.factory.annotation.Autowired; |
|
14 |
import org.springframework.web.bind.annotation.GetMapping; |
|
15 |
import org.springframework.web.bind.annotation.PostMapping; |
|
16 |
import org.springframework.web.bind.annotation.PutMapping; |
|
17 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
18 |
import org.springframework.web.bind.annotation.PathVariable; |
|
19 |
import org.springframework.web.bind.annotation.RequestBody; |
|
20 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
21 |
import org.springframework.web.bind.annotation.RestController; |
|
22 |
import com.jcdm.common.annotation.Log; |
|
23 |
import com.jcdm.common.core.controller.BaseController; |
|
24 |
import com.jcdm.common.core.domain.AjaxResult; |
|
25 |
import com.jcdm.common.enums.BusinessType; |
|
26 |
import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo; |
|
27 |
import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService; |
|
28 |
import com.jcdm.common.utils.poi.ExcelUtil; |
|
29 |
import com.jcdm.common.core.page.TableDataInfo; |
|
30 |
|
|
31 |
/** |
|
32 |
* 配方配置子信息Controller |
|
33 |
* |
|
34 |
* @author ruimin |
|
35 |
* @date 2023-12-26 |
|
36 |
*/ |
|
37 |
@RestController |
|
38 |
@RequestMapping("/bs/formulaChild") |
|
39 |
public class BsFormulaChildInfoController extends BaseController |
|
40 |
{ |
|
41 |
@Autowired |
|
42 |
private IBsFormulaChildInfoService bsFormulaChildInfoService; |
|
43 |
|
a320dc
|
44 |
@Autowired |
A |
45 |
private MiloService miloService; |
|
46 |
|
|
47 |
/** |
|
48 |
* 扫码确认 |
|
49 |
*/ |
|
50 |
@GetMapping("/fistSetpNumber") |
bdb404
|
51 |
public AjaxResult fistSetpNumber(BsFormulaChildInfo bsFormulaChildInfo) |
a320dc
|
52 |
{ |
bdb404
|
53 |
// try { |
A |
54 |
// String str = "PACK."+bsFormulaChildInfo.getProcessesCode()+".MStepNumber"; |
|
55 |
// miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(1).build()); |
|
56 |
// } catch (Exception e) { |
|
57 |
// throw new RuntimeException(e); |
|
58 |
// } |
|
59 |
Integer stepNumber = 1; |
a320dc
|
60 |
try { |
bdb404
|
61 |
List<BsFormulaChildInfo> op260 = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>().eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getProcessesCode())); |
A |
62 |
List<BsFormulaChildInfo> filteredList = op260.stream() |
|
63 |
.filter(obj -> obj.getResults() != null && !obj.getResults().isEmpty()) |
|
64 |
.collect(Collectors.toList()); |
|
65 |
if(filteredList.size() > 0){ |
|
66 |
stepNumber = Integer.valueOf(filteredList.get(filteredList.size()-1).getStepSort())+1; |
|
67 |
} |
|
68 |
|
a320dc
|
69 |
String str = "PACK."+bsFormulaChildInfo.getProcessesCode()+".MStepNumber"; |
bdb404
|
70 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(stepNumber).build()); |
a320dc
|
71 |
} catch (Exception e) { |
A |
72 |
throw new RuntimeException(e); |
|
73 |
} |
bdb404
|
74 |
return AjaxResult.success(stepNumber); |
a320dc
|
75 |
} |
A |
76 |
|
e57a89
|
77 |
/** |
懒 |
78 |
* 查询配方配置子信息列表 |
|
79 |
*/ |
0caf87
|
80 |
@GetMapping("/noPageListFormulaChild") |
懒 |
81 |
public TableDataInfo noPageListFormulaChild(BsFormulaChildInfo bsFormulaChildInfo) |
|
82 |
{ |
a320dc
|
83 |
|
0caf87
|
84 |
List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() |
懒 |
85 |
.eq(BsFormulaChildInfo::getProductCode,bsFormulaChildInfo.getProductCode()) |
|
86 |
.eq(BsFormulaChildInfo::getProcessesCode,bsFormulaChildInfo.getProcessesCode())); |
6a462f
|
87 |
if (CollUtil.isNotEmpty(list)){ |
W |
88 |
List<BsFormulaChildInfo> collect1 = list.stream().filter(x -> Constants.OK.equals(x.getResults())).collect(Collectors.toList()); |
|
89 |
List<BsFormulaChildInfo> collect2 = list.stream().filter(x -> !Constants.OK.equals(x.getResults())).collect(Collectors.toList()); |
|
90 |
list = collect1; |
|
91 |
list.addAll(collect2); |
|
92 |
} |
0caf87
|
93 |
for (BsFormulaChildInfo formulaChildInfo : list) { |
懒 |
94 |
// formulaChildInfo.setSort(formulaChildInfo.getStepSort()); |
|
95 |
// formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement()); |
|
96 |
// formulaChildInfo.setImg(formulaChildInfo.getOperationSteps()); |
|
97 |
if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){ |
|
98 |
if(formulaChildInfo.getCollectData().contains("[")){ |
|
99 |
String data = formulaChildInfo.getCollectData(); |
|
100 |
data = data.replace("[", "").replace("]", "").replace(" ", ""); |
|
101 |
String[] tightenDataParts = data.split(","); |
|
102 |
formulaChildInfo.setCollectData("扭矩"+tightenDataParts[0]+"角度"+tightenDataParts[1]+"扭矩结果"+tightenDataParts[2]+"角度结果"+tightenDataParts[3]); |
|
103 |
} |
|
104 |
} |
|
105 |
} |
|
106 |
return getDataTable(list); |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* 查询配方配置子信息列表 |
|
111 |
*/ |
e57a89
|
112 |
@PreAuthorize("@ss.hasPermi('bs:formulaChild:list')") |
懒 |
113 |
@GetMapping("/list") |
|
114 |
public TableDataInfo list(BsFormulaChildInfo bsFormulaChildInfo) |
|
115 |
{ |
|
116 |
startPage(); |
|
117 |
List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo); |
|
118 |
for (BsFormulaChildInfo formulaChildInfo : list) { |
|
119 |
formulaChildInfo.setSort(formulaChildInfo.getStepSort()); |
|
120 |
formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement()); |
|
121 |
formulaChildInfo.setImg(formulaChildInfo.getOperationSteps()); |
b77303
|
122 |
if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){ |
懒 |
123 |
if(formulaChildInfo.getCollectData().contains("[")){ |
|
124 |
String data = formulaChildInfo.getCollectData(); |
|
125 |
data = data.replace("[", "").replace("]", "").replace(" ", ""); |
|
126 |
String[] tightenDataParts = data.split(","); |
|
127 |
formulaChildInfo.setCollectData("扭矩"+tightenDataParts[0]+"角度"+tightenDataParts[1]+"扭矩结果"+tightenDataParts[2]+"角度结果"+tightenDataParts[3]); |
|
128 |
} |
|
129 |
} |
e57a89
|
130 |
} |
懒 |
131 |
return getDataTable(list); |
|
132 |
} |
|
133 |
|
b77303
|
134 |
// /** |
懒 |
135 |
// * 检查是否可以放行 |
|
136 |
// */ |
|
137 |
// @GetMapping("/releaseCheck") |
|
138 |
// public AjaxResult releaseCheck(BsFormulaChildInfo bsFormulaChildInfo) |
|
139 |
// { |
|
140 |
// List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck(bsFormulaChildInfo); |
|
141 |
// return AjaxResult.success(i.size()); |
|
142 |
// } |
e57a89
|
143 |
|
懒 |
144 |
/** |
|
145 |
* 扫码确认 |
|
146 |
*/ |
|
147 |
@GetMapping("/updateResults") |
|
148 |
public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) |
|
149 |
{ |
|
150 |
return bsFormulaChildInfoService.updateResults(bsFormulaChildInfo); |
|
151 |
} |
|
152 |
|
|
153 |
/** |
2c7661
|
154 |
* 扫码确认 |
A |
155 |
*/ |
06713a
|
156 |
@GetMapping("/jrmUpdateResults") |
A |
157 |
public AjaxResult jrmUpdateResults(BsFormulaChildInfo bsFormulaChildInfo) |
|
158 |
{ |
|
159 |
return bsFormulaChildInfoService.jrmUpdateResults(bsFormulaChildInfo); |
|
160 |
} |
|
161 |
|
|
162 |
/** |
|
163 |
* 扫码确认 |
|
164 |
*/ |
2c7661
|
165 |
@GetMapping("/yzUpdateResults") |
A |
166 |
public AjaxResult yzUpdateResults(BsFormulaChildInfo bsFormulaChildInfo) |
|
167 |
{ |
|
168 |
return bsFormulaChildInfoService.yzUpdateResults(bsFormulaChildInfo); |
|
169 |
} |
|
170 |
|
|
171 |
/** |
e57a89
|
172 |
* 放行请空状态 |
懒 |
173 |
*/ |
|
174 |
@GetMapping("/workpieceRelease") |
|
175 |
public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) |
|
176 |
{ |
|
177 |
return bsFormulaChildInfoService.workpieceRelease(bsFormulaChildInfo); |
|
178 |
} |
|
179 |
|
|
180 |
/** |
8cfe20
|
181 |
* 放行请空状态 |
A |
182 |
*/ |
bdb404
|
183 |
@GetMapping("/checkMaterialCode") |
A |
184 |
public AjaxResult checkMaterialCode(BsFormulaChildInfo bsFormulaChildInfo) |
|
185 |
{ |
|
186 |
return bsFormulaChildInfoService.checkMaterialCode(bsFormulaChildInfo); |
|
187 |
} |
|
188 |
|
|
189 |
/** |
|
190 |
* 放行请空状态 |
|
191 |
*/ |
8cfe20
|
192 |
@GetMapping("/clearWorkpieceRelease") |
A |
193 |
public AjaxResult clearWorkpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) |
|
194 |
{ |
|
195 |
return bsFormulaChildInfoService.clearWorkpieceRelease(bsFormulaChildInfo); |
|
196 |
} |
|
197 |
|
|
198 |
/** |
|
199 |
* 放行请空状态 |
|
200 |
*/ |
|
201 |
@GetMapping("/jrmWorkpieceRelease") |
|
202 |
public AjaxResult jrmWorkpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) |
|
203 |
{ |
|
204 |
return bsFormulaChildInfoService.jrmWorkpieceRelease(bsFormulaChildInfo); |
|
205 |
} |
|
206 |
|
|
207 |
/** |
b77303
|
208 |
* 拧紧后更新对应数据 |
懒 |
209 |
*/ |
|
210 |
@GetMapping("/updateTighteningFormula") |
|
211 |
public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) |
|
212 |
{ |
|
213 |
return bsFormulaChildInfoService.updateTighteningFormula(bsFormulaChildInfo); |
|
214 |
} |
|
215 |
|
|
216 |
/** |
2c7661
|
217 |
* 拧紧后更新对应数据 |
A |
218 |
*/ |
|
219 |
@GetMapping("/yzUpdateTighteningFormula") |
|
220 |
public AjaxResult yzUpdateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) |
|
221 |
{ |
|
222 |
return bsFormulaChildInfoService.yzUpdateTighteningFormula(bsFormulaChildInfo); |
|
223 |
} |
|
224 |
|
|
225 |
/** |
e57a89
|
226 |
* 导出配方配置子信息列表 |
懒 |
227 |
*/ |
|
228 |
@PreAuthorize("@ss.hasPermi('bs:formulaChild:export')") |
|
229 |
@Log(title = "配方配置子信息", businessType = BusinessType.EXPORT) |
|
230 |
@PostMapping("/export") |
|
231 |
public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo) |
|
232 |
{ |
|
233 |
List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo); |
|
234 |
ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class); |
|
235 |
util.exportExcel(response, list, "配方配置子信息数据"); |
|
236 |
} |
|
237 |
|
|
238 |
/** |
|
239 |
* 获取配方配置子信息详细信息 |
|
240 |
*/ |
|
241 |
@PreAuthorize("@ss.hasPermi('bs:formulaChild:query')") |
|
242 |
@GetMapping(value = "/{id}") |
|
243 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
244 |
{ |
|
245 |
return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id)); |
|
246 |
} |
|
247 |
|
|
248 |
/** |
|
249 |
* 新增配方配置子信息 |
|
250 |
*/ |
|
251 |
@PreAuthorize("@ss.hasPermi('bs:formulaChild:add')") |
|
252 |
@Log(title = "配方配置子信息", businessType = BusinessType.INSERT) |
|
253 |
@PostMapping |
|
254 |
public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo) |
|
255 |
{ |
|
256 |
return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo)); |
|
257 |
} |
|
258 |
|
|
259 |
/** |
|
260 |
* 修改配方配置子信息 |
|
261 |
*/ |
|
262 |
@PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')") |
|
263 |
@Log(title = "配方配置子信息", businessType = BusinessType.UPDATE) |
|
264 |
@PutMapping |
|
265 |
public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo) |
|
266 |
{ |
|
267 |
return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo)); |
|
268 |
} |
|
269 |
|
|
270 |
/** |
|
271 |
* 删除配方配置子信息 |
|
272 |
*/ |
|
273 |
@PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')") |
|
274 |
@Log(title = "配方配置子信息", businessType = BusinessType.DELETE) |
|
275 |
@DeleteMapping("/{ids}") |
|
276 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
277 |
{ |
|
278 |
return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids)); |
|
279 |
} |
|
280 |
} |