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