提交 | 用户 | 时间
|
e57a89
|
1 |
package com.jcdm.main.bs.formulaChild.service.impl; |
懒 |
2 |
|
5316c5
|
3 |
import java.util.ArrayList; |
b64ed2
|
4 |
import java.util.Date; |
e57a89
|
5 |
import java.util.List; |
3c2299
|
6 |
import java.util.Map; |
7bee80
|
7 |
import java.util.stream.Collectors; |
e57a89
|
8 |
|
d545f1
|
9 |
import cn.hutool.core.util.StrUtil; |
7bee80
|
10 |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
懒 |
11 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
0ce25f
|
12 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
e57a89
|
13 |
import com.jcdm.common.core.domain.AjaxResult; |
懒 |
14 |
import com.jcdm.common.utils.DateUtils; |
3c2299
|
15 |
import com.jcdm.framework.websocket.WebSocketUsers; |
b64ed2
|
16 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
懒 |
17 |
import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; |
a320dc
|
18 |
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
32483a
|
19 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
懒 |
20 |
import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; |
a320dc
|
21 |
import com.jcdm.main.da.testDeviceInterface.service.IDaTestDeviceInterfaceService; |
3c2299
|
22 |
import com.kangaroohy.milo.model.ReadWriteEntity; |
懒 |
23 |
import com.kangaroohy.milo.service.MiloService; |
b77303
|
24 |
import org.aspectj.weaver.loadtime.Aj; |
e57a89
|
25 |
import org.springframework.beans.factory.annotation.Autowired; |
懒 |
26 |
import org.springframework.stereotype.Service; |
|
27 |
import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper; |
|
28 |
import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo; |
|
29 |
import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService; |
3c2299
|
30 |
|
懒 |
31 |
import javax.websocket.Session; |
e57a89
|
32 |
|
懒 |
33 |
/** |
|
34 |
* 配方配置子信息Service业务层处理 |
|
35 |
* |
|
36 |
* @author ruimin |
|
37 |
* @date 2023-12-26 |
|
38 |
*/ |
|
39 |
@Service |
0ce25f
|
40 |
public class BsFormulaChildInfoServiceImpl extends ServiceImpl<BsFormulaChildInfoMapper,BsFormulaChildInfo> implements IBsFormulaChildInfoService |
e57a89
|
41 |
{ |
懒 |
42 |
@Autowired |
|
43 |
private BsFormulaChildInfoMapper bsFormulaChildInfoMapper; |
b64ed2
|
44 |
|
懒 |
45 |
@Autowired |
63b254
|
46 |
private IBsFormulaChildInfoService bsFormulaChildInfoService; |
懒 |
47 |
|
|
48 |
@Autowired |
b64ed2
|
49 |
private DaParamCollectionMapper daParamCollectionMapper; |
3c2299
|
50 |
|
懒 |
51 |
@Autowired |
|
52 |
private MiloService miloService; |
32483a
|
53 |
|
懒 |
54 |
@Autowired |
|
55 |
private DaPassingStationCollectionMapper daPassingStationCollectionMapper; |
a320dc
|
56 |
|
A |
57 |
@Autowired |
|
58 |
private IDaTestDeviceInterfaceService daTestDeviceInterfaceService; |
|
59 |
|
|
60 |
@Autowired |
|
61 |
private IDaParamCollectionService daParamCollectionService; |
3c2299
|
62 |
|
懒 |
63 |
Map<String, Session> map = WebSocketUsers.getUsers(); |
e57a89
|
64 |
|
懒 |
65 |
/** |
|
66 |
* 查询配方配置子信息 |
|
67 |
* |
|
68 |
* @param id 配方配置子信息主键 |
|
69 |
* @return 配方配置子信息 |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public BsFormulaChildInfo selectBsFormulaChildInfoById(Long id) |
|
73 |
{ |
|
74 |
return bsFormulaChildInfoMapper.selectBsFormulaChildInfoById(id); |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* 查询配方配置子信息列表 |
|
79 |
* |
|
80 |
* @param bsFormulaChildInfo 配方配置子信息 |
|
81 |
* @return 配方配置子信息 |
|
82 |
*/ |
|
83 |
@Override |
|
84 |
public List<BsFormulaChildInfo> selectBsFormulaChildInfoList(BsFormulaChildInfo bsFormulaChildInfo) |
|
85 |
{ |
|
86 |
return bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo); |
|
87 |
} |
|
88 |
|
|
89 |
/** |
|
90 |
* 新增配方配置子信息 |
|
91 |
* |
|
92 |
* @param bsFormulaChildInfo 配方配置子信息 |
|
93 |
* @return 结果 |
|
94 |
*/ |
|
95 |
@Override |
|
96 |
public int insertBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo) |
|
97 |
{ |
|
98 |
bsFormulaChildInfo.setCreateTime(DateUtils.getNowDate()); |
|
99 |
return bsFormulaChildInfoMapper.insertBsFormulaChildInfo(bsFormulaChildInfo); |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* 修改配方配置子信息 |
|
104 |
* |
|
105 |
* @param bsFormulaChildInfo 配方配置子信息 |
|
106 |
* @return 结果 |
|
107 |
*/ |
|
108 |
@Override |
|
109 |
public int updateBsFormulaChildInfo(BsFormulaChildInfo bsFormulaChildInfo) |
|
110 |
{ |
|
111 |
bsFormulaChildInfo.setUpdateTime(DateUtils.getNowDate()); |
|
112 |
return bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo); |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* 批量删除配方配置子信息 |
|
117 |
* |
|
118 |
* @param ids 需要删除的配方配置子信息主键 |
|
119 |
* @return 结果 |
|
120 |
*/ |
|
121 |
@Override |
|
122 |
public int deleteBsFormulaChildInfoByIds(Long[] ids) |
|
123 |
{ |
|
124 |
return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoByIds(ids); |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* 删除配方配置子信息信息 |
|
129 |
* |
|
130 |
* @param id 配方配置子信息主键 |
|
131 |
* @return 结果 |
|
132 |
*/ |
|
133 |
@Override |
|
134 |
public int deleteBsFormulaChildInfoById(Long id) |
|
135 |
{ |
|
136 |
return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoById(id); |
|
137 |
} |
|
138 |
|
|
139 |
@Override |
|
140 |
public BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(String type,String productCode,String processesCode) { |
|
141 |
BsFormulaChildInfo info = new BsFormulaChildInfo(); |
|
142 |
info.setOperationType(type); |
|
143 |
info.setProcessesCode(processesCode); |
|
144 |
info.setProductCode(productCode); |
|
145 |
return bsFormulaChildInfoMapper.selectBsFormulaChildInfoByTypeTopOne(info); |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
b77303
|
149 |
public BsFormulaChildInfo getCount(String productCode, String processesCode) { |
懒 |
150 |
BsFormulaChildInfo info = new BsFormulaChildInfo(); |
|
151 |
info.setProcessesCode(processesCode); |
|
152 |
info.setProductCode(productCode); |
|
153 |
return bsFormulaChildInfoMapper.getCount(info); |
|
154 |
} |
|
155 |
|
|
156 |
@Override |
2c7661
|
157 |
public AjaxResult yzUpdateResults(BsFormulaChildInfo bsFormulaChildInfo) { |
A |
158 |
String result = ""; |
|
159 |
List<BsFormulaChildInfo> bsFormulaChildInfos = new ArrayList<>(); |
|
160 |
List<BsFormulaChildInfo> infos = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() |
|
161 |
.eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getLocationCode()) |
|
162 |
.eq(BsFormulaChildInfo::getProductCode, bsFormulaChildInfo.getProductCode()) |
|
163 |
.eq(BsFormulaChildInfo::getOperationType, "2") |
|
164 |
); |
|
165 |
for (BsFormulaChildInfo formulaChildInfo : infos) { |
|
166 |
if(bsFormulaChildInfo.getScanBarcode().contains(formulaChildInfo.getMaterialCode())){ |
|
167 |
bsFormulaChildInfos.add(formulaChildInfo); |
|
168 |
break; |
|
169 |
} |
|
170 |
} |
|
171 |
if(bsFormulaChildInfos.size()>0){ |
|
172 |
String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); |
|
173 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getScanBarcode()); |
|
174 |
bsFormulaChildInfos.get(0).setResults("OK"); |
|
175 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
|
176 |
bsFormulaChildInfo.setParamValue(bsFormulaChildInfo.getScanBarcode()); |
|
177 |
bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode()); |
|
178 |
bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode()); |
|
179 |
addParameterCollection(bsFormulaChildInfo); |
|
180 |
if (spareField4 != null && !spareField4.isEmpty()) { |
|
181 |
// 执行操作 |
|
182 |
if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ |
|
183 |
try { |
|
184 |
result = "3"; |
|
185 |
} catch (Exception e) { |
|
186 |
throw new RuntimeException(e); |
|
187 |
} |
|
188 |
} |
|
189 |
} |
|
190 |
}else { |
|
191 |
result = "1"; |
|
192 |
} |
|
193 |
return AjaxResult.success(result); |
|
194 |
} |
|
195 |
|
|
196 |
@Override |
|
197 |
public AjaxResult yzUpdateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) { |
|
198 |
String result = "1"; |
|
199 |
BsFormulaChildInfo getMaterTwo = new BsFormulaChildInfo(); |
|
200 |
getMaterTwo.setProcessesCode(bsFormulaChildInfo.getLocationCode()); |
|
201 |
getMaterTwo.setOperationType("2"); |
|
202 |
List<BsFormulaChildInfo> operationType = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(getMaterTwo); |
|
203 |
List<String> collect = operationType.stream().map(BsFormulaChildInfo::getResults).collect(Collectors.toList()); |
|
204 |
for (String s : collect) { |
|
205 |
if(s.equals("")){ |
|
206 |
return AjaxResult.error("扫描未完成,禁止拧紧操作!"); |
|
207 |
} |
|
208 |
} |
|
209 |
BsFormulaChildInfo listQuery = new BsFormulaChildInfo(); |
|
210 |
listQuery.setParamCode(bsFormulaChildInfo.getParamCode()); |
|
211 |
String paramCode = bsFormulaChildInfo.getTightenTheArray(); |
|
212 |
if(paramCode.contains("N")){ |
|
213 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); |
|
214 |
bsFormulaChildInfos.get(0).setResults("NG"); |
|
215 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); |
|
216 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
|
217 |
return AjaxResult.error("扫描结果NG,请重新扫描!"); |
|
218 |
}else { |
|
219 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); |
|
220 |
bsFormulaChildInfos.get(0).setResults("OK"); |
|
221 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); |
|
222 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
4a5f2a
|
223 |
|
A |
224 |
Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort()); |
|
225 |
try { |
a320dc
|
226 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber+1).build()); |
4a5f2a
|
227 |
} catch (Exception e) { |
A |
228 |
throw new RuntimeException(e); |
|
229 |
} |
|
230 |
|
2c7661
|
231 |
String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); |
A |
232 |
if (spareField4 != null && !spareField4.isEmpty()) { |
|
233 |
// 执行操作 |
|
234 |
if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ |
|
235 |
try { |
|
236 |
// WebSocketUsers.sendMessageToUserByText(map.get(bsFormulaChildInfo.getLocationCode()), "OUT"); |
|
237 |
result = "2"; |
|
238 |
} catch (Exception e) { |
|
239 |
throw new RuntimeException(e); |
|
240 |
} |
|
241 |
} |
|
242 |
} |
|
243 |
|
|
244 |
} |
|
245 |
return AjaxResult.success(result); |
|
246 |
} |
|
247 |
|
|
248 |
@Override |
06713a
|
249 |
public AjaxResult jrmUpdateResults(BsFormulaChildInfo bsFormulaChildInfo) { |
A |
250 |
String result = ""; |
|
251 |
List<BsFormulaChildInfo> bsFormulaChildInfos = new ArrayList<>(); |
|
252 |
List<BsFormulaChildInfo> infos = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() |
|
253 |
.eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getLocationCode()) |
|
254 |
.eq(BsFormulaChildInfo::getProductCode, bsFormulaChildInfo.getProductCode()) |
|
255 |
.eq(BsFormulaChildInfo::getOperationType, "2") |
d545f1
|
256 |
).stream().filter(x -> StrUtil.isBlank(x.getCollectData())).collect(Collectors.toList()); |
A |
257 |
|
|
258 |
|
06713a
|
259 |
for (BsFormulaChildInfo formulaChildInfo : infos) { |
A |
260 |
if(bsFormulaChildInfo.getScanBarcode().contains(formulaChildInfo.getMaterialCode())){ |
|
261 |
bsFormulaChildInfos.add(formulaChildInfo); |
|
262 |
break; |
|
263 |
} |
|
264 |
} |
|
265 |
if(bsFormulaChildInfos.size()>0){ |
|
266 |
String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); |
|
267 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getScanBarcode()); |
|
268 |
bsFormulaChildInfos.get(0).setResults("OK"); |
|
269 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
|
270 |
bsFormulaChildInfo.setParamValue(bsFormulaChildInfo.getScanBarcode()); |
|
271 |
bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode()); |
|
272 |
bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode()); |
|
273 |
jrmAddParameterCollection(bsFormulaChildInfo); |
|
274 |
|
|
275 |
if (spareField4 != null && !spareField4.isEmpty()) { |
|
276 |
// 执行操作 |
|
277 |
if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ |
|
278 |
try { |
|
279 |
result = "3"; |
1ccd69
|
280 |
// String strA = bsFormulaChildInfo.getLocationCode() + "A"; |
A |
281 |
// String strB = bsFormulaChildInfo.getLocationCode() + "B"; |
|
282 |
// miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+strA+".RecordDataDone").value(21).build()); |
|
283 |
// miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+strB+".RecordDataDone").value(21).build()); |
|
284 |
String locationCode = bsFormulaChildInfo.getLocationCode(); |
|
285 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+locationCode+".RecordDataDone").value(21).build()); |
06713a
|
286 |
} catch (Exception e) { |
A |
287 |
throw new RuntimeException(e); |
|
288 |
} |
|
289 |
} |
|
290 |
} |
|
291 |
}else { |
|
292 |
result = "1"; |
|
293 |
} |
|
294 |
return AjaxResult.success(result); |
|
295 |
} |
|
296 |
|
|
297 |
@Override |
b77303
|
298 |
public BsFormulaChildInfo releaseCheck(BsFormulaChildInfo bsFormulaChildInfo) { |
e57a89
|
299 |
return bsFormulaChildInfoMapper.releaseCheck(bsFormulaChildInfo); |
懒 |
300 |
} |
|
301 |
|
c5e9c5
|
302 |
//1-非本工位物料 2-正常扫描可继续下次 3-扫描结束已经是最后一位工步 |
e57a89
|
303 |
@Override |
懒 |
304 |
public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) { |
c5e9c5
|
305 |
String result = ""; |
5316c5
|
306 |
List<BsFormulaChildInfo> bsFormulaChildInfos = new ArrayList<>(); |
A |
307 |
List<BsFormulaChildInfo> infos = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() |
e70fb4
|
308 |
.eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getLocationCode()) |
A |
309 |
.eq(BsFormulaChildInfo::getProductCode, bsFormulaChildInfo.getProductCode()) |
5316c5
|
310 |
.eq(BsFormulaChildInfo::getOperationType, "2") |
e70fb4
|
311 |
); |
5316c5
|
312 |
for (BsFormulaChildInfo formulaChildInfo : infos) { |
A |
313 |
if(bsFormulaChildInfo.getScanBarcode().contains(formulaChildInfo.getMaterialCode())){ |
|
314 |
bsFormulaChildInfos.add(formulaChildInfo); |
|
315 |
break; |
|
316 |
} |
|
317 |
} |
e57a89
|
318 |
if(bsFormulaChildInfos.size()>0){ |
c5e9c5
|
319 |
String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); |
3c2299
|
320 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getScanBarcode()); |
e57a89
|
321 |
bsFormulaChildInfos.get(0).setResults("OK"); |
懒 |
322 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
49c784
|
323 |
bsFormulaChildInfo.setParamValue(bsFormulaChildInfo.getScanBarcode()); |
b64ed2
|
324 |
bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode()); |
49c784
|
325 |
bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode()); |
b64ed2
|
326 |
addParameterCollection(bsFormulaChildInfo); |
4a5f2a
|
327 |
|
A |
328 |
// Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort()); |
|
329 |
// try { |
|
330 |
// miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".StepNumber").value(stepNumber).build()); |
|
331 |
// } catch (Exception e) { |
|
332 |
// throw new RuntimeException(e); |
|
333 |
// } |
|
334 |
|
c5e9c5
|
335 |
if (spareField4 != null && !spareField4.isEmpty()) { |
懒 |
336 |
// 执行操作 |
|
337 |
if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ |
|
338 |
try { |
|
339 |
result = "3"; |
|
340 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".RecordDataDone").value(21).build()); |
|
341 |
} catch (Exception e) { |
|
342 |
throw new RuntimeException(e); |
|
343 |
} |
|
344 |
} |
|
345 |
} |
e57a89
|
346 |
}else { |
c5e9c5
|
347 |
result = "1"; |
e57a89
|
348 |
} |
c5e9c5
|
349 |
return AjaxResult.success(result); |
e57a89
|
350 |
} |
懒 |
351 |
|
b64ed2
|
352 |
public void addParameterCollection(BsFormulaChildInfo bsFormulaChildInfo){ |
懒 |
353 |
DaParamCollection daParamCollection = new DaParamCollection(); |
|
354 |
daParamCollection.setParamCode(bsFormulaChildInfo.getParamCode()); |
|
355 |
daParamCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo()); |
|
356 |
daParamCollection.setLocationCode(bsFormulaChildInfo.getLocationCode()); |
|
357 |
daParamCollection.setParamValue(bsFormulaChildInfo.getParamValue()); |
|
358 |
daParamCollection.setProductCode(bsFormulaChildInfo.getProductCode()); |
|
359 |
daParamCollection.setCollectionTime(new Date()); |
49c784
|
360 |
daParamCollection.setSfcCode(bsFormulaChildInfo.getSfcBarcode()); |
b64ed2
|
361 |
daParamCollectionMapper.insertDaParamCollection(daParamCollection); |
懒 |
362 |
} |
|
363 |
|
06713a
|
364 |
public void jrmAddParameterCollection(BsFormulaChildInfo bsFormulaChildInfo){ |
A |
365 |
String scanBarCode = bsFormulaChildInfo.getSfcBarcode(); |
|
366 |
String[] modeleSplit = scanBarCode.split(","); |
d545f1
|
367 |
// for (String modele : modeleSplit) { |
06713a
|
368 |
DaParamCollection daParamCollection = new DaParamCollection(); |
A |
369 |
daParamCollection.setParamCode(bsFormulaChildInfo.getParamCode()); |
|
370 |
daParamCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo()); |
|
371 |
daParamCollection.setLocationCode(bsFormulaChildInfo.getLocationCode()); |
|
372 |
daParamCollection.setParamValue(bsFormulaChildInfo.getParamValue()); |
|
373 |
daParamCollection.setProductCode(bsFormulaChildInfo.getProductCode()); |
|
374 |
daParamCollection.setCollectionTime(new Date()); |
d545f1
|
375 |
if(bsFormulaChildInfo.getParamCode().contains("B")){ |
A |
376 |
daParamCollection.setSfcCode(modeleSplit[1]); |
|
377 |
}else { |
|
378 |
daParamCollection.setSfcCode(modeleSplit[0]); |
|
379 |
} |
|
380 |
// daParamCollection.setSfcCode(modele); |
06713a
|
381 |
daParamCollectionMapper.insertDaParamCollection(daParamCollection); |
d545f1
|
382 |
// } |
06713a
|
383 |
|
A |
384 |
} |
|
385 |
|
e57a89
|
386 |
@Override |
懒 |
387 |
public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) { |
a320dc
|
388 |
daParamCollectionService.pushGeelycvMesFeedback(bsFormulaChildInfo.getProductBarcode(), bsFormulaChildInfo.getLocationCode()); |
63b254
|
389 |
List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() |
懒 |
390 |
.eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getLocationCode()) |
|
391 |
.eq(BsFormulaChildInfo::getProductCode, bsFormulaChildInfo.getProductCode())); |
|
392 |
for (BsFormulaChildInfo info : list) { |
e70fb4
|
393 |
info.setCollectData(""); |
63b254
|
394 |
info.setResults(""); |
懒 |
395 |
bsFormulaChildInfoService.saveOrUpdate(info); |
|
396 |
} |
e57a89
|
397 |
return AjaxResult.success(); |
懒 |
398 |
} |
b77303
|
399 |
|
懒 |
400 |
@Override |
|
401 |
public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) { |
7bee80
|
402 |
BsFormulaChildInfo getMaterTwo = new BsFormulaChildInfo(); |
懒 |
403 |
getMaterTwo.setProcessesCode(bsFormulaChildInfo.getLocationCode()); |
|
404 |
getMaterTwo.setOperationType("2"); |
|
405 |
List<BsFormulaChildInfo> operationType = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(getMaterTwo); |
|
406 |
List<String> collect = operationType.stream().map(BsFormulaChildInfo::getResults).collect(Collectors.toList()); |
|
407 |
for (String s : collect) { |
|
408 |
if(s.equals("")){ |
|
409 |
return AjaxResult.error("扫描未完成,禁止拧紧操作!"); |
|
410 |
} |
|
411 |
} |
b77303
|
412 |
BsFormulaChildInfo listQuery = new BsFormulaChildInfo(); |
懒 |
413 |
listQuery.setParamCode(bsFormulaChildInfo.getParamCode()); |
|
414 |
String paramCode = bsFormulaChildInfo.getTightenTheArray(); |
|
415 |
if(paramCode.contains("N")){ |
|
416 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); |
|
417 |
bsFormulaChildInfos.get(0).setResults("NG"); |
|
418 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); |
|
419 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
|
420 |
return AjaxResult.error("扫描结果NG,请重新扫描!"); |
|
421 |
}else { |
|
422 |
List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); |
|
423 |
bsFormulaChildInfos.get(0).setResults("OK"); |
|
424 |
bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); |
|
425 |
bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); |
4a5f2a
|
426 |
|
A |
427 |
Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort()); |
|
428 |
try { |
a320dc
|
429 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber+1).build()); |
4a5f2a
|
430 |
} catch (Exception e) { |
A |
431 |
throw new RuntimeException(e); |
|
432 |
} |
|
433 |
|
3c2299
|
434 |
String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); |
懒 |
435 |
if (spareField4 != null && !spareField4.isEmpty()) { |
|
436 |
// 执行操作 |
|
437 |
if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ |
|
438 |
try { |
32483a
|
439 |
// //更新过站记录表出站时间 |
懒 |
440 |
// DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); |
|
441 |
// daPassingStationCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo()); |
|
442 |
// List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
|
443 |
// daPassingStationCollections.get(0).setOutboundTime(new Date()); |
|
444 |
// daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollections.get(0)); |
b5fcd8
|
445 |
miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".RecordDataDone").value(21).build()); |
3c2299
|
446 |
WebSocketUsers.sendMessageToUserByText(map.get(bsFormulaChildInfo.getLocationCode()), "OUT"); |
懒 |
447 |
} catch (Exception e) { |
|
448 |
throw new RuntimeException(e); |
|
449 |
} |
|
450 |
} |
|
451 |
} |
|
452 |
|
b77303
|
453 |
} |
懒 |
454 |
return AjaxResult.success("扫描成功!"); |
|
455 |
} |
|
456 |
|
|
457 |
|
|
458 |
|
|
459 |
|
e57a89
|
460 |
} |