cl
2024-09-06 91b54fc007c9e82087738048d3b767c9645a6aec
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
@@ -1,5 +1,7 @@
package com.jcdm.main.bs.formulaChild.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
@@ -51,9 +53,11 @@
    @GetMapping("/unfinishedProcess")
    public AjaxResult unfinishedProcess(BsFormulaChildInfo bsFormulaChildInfo)
    {
        String thoroughfare = Constants.thoroughfareMap.get(bsFormulaChildInfo.getProcessesCode());//获取通道
        try {
            String str = "MOZU1."+bsFormulaChildInfo.getProcessesCode()+".RecordDataDone";
            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(bsFormulaChildInfo.getRecordDataDone()).build());
//            String str = "MOZU1."+bsFormulaChildInfo.getProcessesCode()+".RecordDataDone";
//            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(bsFormulaChildInfo.getRecordDataDone()).build());
            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare+"."+bsFormulaChildInfo.getProcessesCode()+".RecordDataDone").value(bsFormulaChildInfo.getRecordDataDone()).build());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
@@ -105,9 +109,20 @@
//                stepNumber = Integer.valueOf(filteredList.get(filteredList.size()-1).getStepSort())+1;
//            }
            String thoroughfare = Constants.thoroughfareMap.get(bsFormulaChildInfo.getLocationCode());//获取通道
            String thoroughfare = Constants.thoroughfareMap.get(bsFormulaChildInfo.getProcessesCode());//获取通道
            String str = thoroughfare+"."+bsFormulaChildInfo.getProcessesCode()+".MESScrew";
            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(stepNumber).build());
            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(stepNumber).build());//拧紧步骤
            if("OP230".equals(bsFormulaChildInfo.getProcessesCode())){
                //所有进站将进站时间写给PLC
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String currentDate = dateFormat.format(new Date());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + bsFormulaChildInfo.getProcessesCode() + ".StartTime").value(currentDate).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + bsFormulaChildInfo.getProcessesCode() + ".SNCode").value(bsFormulaChildInfo.getSfcBarcode()).build());
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + bsFormulaChildInfo.getProcessesCode() + ".RecordDataDone").value(11).build());
            }else if("OP220".equals(bsFormulaChildInfo.getProcessesCode())){
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + bsFormulaChildInfo.getProcessesCode() + ".RecordDataDone").value(11).build());
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
@@ -124,7 +139,7 @@
        List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>()
                .eq(BsFormulaChildInfo::getProductCode,bsFormulaChildInfo.getProductCode())
                .eq(BsFormulaChildInfo::getProcessesCode,bsFormulaChildInfo.getProcessesCode())
                .orderByAsc(BsFormulaChildInfo::getStepSort)
//                .orderByAsc(BsFormulaChildInfo::getStepSort)
        );
        if (CollUtil.isNotEmpty(list)){
            List<BsFormulaChildInfo> collect1 = list.stream().filter(x -> Constants.OK.equals(x.getResults())).collect(Collectors.toList());