cl
2024-07-07 e0c9c69431934041c303ef4c08295de64cd80a49
修改参数采集
已修改4个文件
51 ■■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/constant/Constants.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
@@ -53,7 +53,7 @@
    {
        String productNum = "";
        try {
            String str = "MOZU1."+bsFormulaChildInfo.getLocationCode()+".MES_ModuleCode";
            String str = "MOZU1."+bsFormulaChildInfo.getLocationCode()+".ModuleCode";
            Object productNumObject = miloService.readFromOpcUa(str).getValue();
            if(ObjectUtil.isNotNull(productNumObject)){
                productNum = productNumObject.toString();
jcdm-main/src/main/java/com/jcdm/main/constant/Constants.java
@@ -9,7 +9,9 @@
    public static final String OUT_BOUND_TIME_CODE = "PAT_INT";
    public static final String SUCCESS = "success";
    public static final List<String> OP020_OP090 = new ArrayList<>();
    public static final List<String> OP020_OP090 = new ArrayList<>();//电芯工位
    public static final List<String> OP100_OP150 = new ArrayList<>();//人工工位
    public static final String NG = "2";
    public static final String UN_PASS= "不合格";
@@ -35,6 +37,7 @@
    public static final String OP090= "M1OP090";
    public static final String OP100_1= "M1OP100-1";
    public static final String OP100_2= "M1OP100-2";
    public static final String OP150= "M1OP150";
    public static final Integer INT_ONE= 1;
    public static final Integer INT_TWO= 2;
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
@@ -48,7 +48,7 @@
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //分段010-065段
        //分段010-090段 电芯工位
        Constants.OP020_OP090.add(Constants.OP020);
        Constants.OP020_OP090.add(Constants.OP030);
        Constants.OP020_OP090.add(Constants.OP040);
@@ -56,6 +56,11 @@
        Constants.OP020_OP090.add(Constants.OP060);
        Constants.OP020_OP090.add(Constants.OP090);
        //人工工位
        Constants.OP100_OP150.add(Constants.OP100_1);
        Constants.OP100_OP150.add(Constants.OP100_2);
        //Constants.OP100_OP150.add(Constants.OP150);
        OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
                miloService,
                daPassingStationCollectionService,
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -145,10 +145,9 @@
                            }
                        } else if(Constants.OP100_1.equals(device) || Constants.OP100_2.equals(device)){
                            //1、进站PLC给产品类型,MES读取产品类型
                            ReadWriteEntity productTypeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType");//产品类型
                            if (ObjectUtil.isNotNull(productTypeRead.getValue())){
                                String productType = productTypeRead.getValue().toString();
                            Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//产品类型
                            if (ObjectUtil.isNotNull(productTypeObjcet)){
                                String productType = productTypeObjcet.toString();//产品类型
                                CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
                                    //调用工厂MES,保存到数据库,并且将工单传给PLC (目前临时用该方法)
                                    receivingWorkOrders(thoroughfare, device);
@@ -156,7 +155,6 @@
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build());
                                log.info("写入到工位{}的RecordDataDone数据:{}",device,11);
                            }else{
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build());
                            }
@@ -185,11 +183,11 @@
                            }
                            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build());
                            log.info("写入到工位{}的RecordDataDone数据:{}",device,result);
                        } else if (Constants.OP100_1.equals(device) || Constants.OP100_2.equals(device)){
                        } else if (Constants.OP100_OP150.contains(device)){//人工工位
                            WebSocketUsers.sendMessageToUserByText(map.get(device), "END");
                        } else {
                            Integer result = 21;
                            Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//产品类型
                            Object modulCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCode").getValue();
                            if (ObjectUtil.isNull(modulCodeObjcet) && modulCodeObjcet.toString().trim().isEmpty()){
                                result = 23;
@@ -234,8 +232,8 @@
                String productNum = orderList.get(0).getProductNum();//模组码
                String orderNum = orderList.get(0).getWorkOrderNo();
                //下发产品模组码
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".MES_ModuleCode").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".MES_WorkOrderNumber").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(productNum).build());
                //miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build());
                //更新工单状态为执行中
@@ -477,6 +475,9 @@
                    String paramValue = "";
                    if (ObjectUtil.isNotNull(readWriteEntityList.get(i).getValue())){
                        paramValue = readWriteEntityList.get(i).getValue().toString();//参数值
                        if("DATE".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){
                            paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString();
                        }
                    }
                    daParamCollection.setParamValue(paramValue);//参数值
                    daParamCollection.setLocationCode(device);//工位
@@ -490,7 +491,7 @@
                    childVO.setItemValue(paramValue);//参数值
                    childVO.setItemText(list.get(i).getCollectParameterName());
                    childVO.setCheckResult("1");
                    childVO.setCheckTime(new Date().toString());
                    childVO.setCheckTime(format.format(new Date()));
                    mesList.add(childVO);
                }
@@ -591,7 +592,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl1.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList1.add(childVO);
                    }
@@ -619,7 +620,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl2.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList2.add(childVO);
                    }
                }
@@ -645,7 +646,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl3.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList3.add(childVO);
                    }
                }
@@ -671,7 +672,7 @@
                        childVO.setItemValue(paramValue);//参数值
                        childVO.setItemText(confColl4.get(i).getParameterSetName());
                        childVO.setCheckResult("1");
                        childVO.setCheckTime(new Date().toString());
                        childVO.setCheckTime(format.format(new Date()));
                        mesChildList4.add(childVO);
                    }
                }
@@ -688,9 +689,9 @@
                                String paramValue = "";
                                if (ObjectUtil.isNotNull(paramCollectionList0.get(j).getValue())) {
                                    paramValue = paramCollectionList0.get(j).getValue().toString();//参数值
                                }
                                if(confColl0.get(j).getCollectParameterName().contains("时间") && !"".equals(paramValue)){
                                    paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString();
                                    if("DATE".equals(confColl0.get(j).getCollectParameterType()) && !paramValue.isEmpty()){
                                        paramValue = TimeUtil.test(TimeUtil.stringProcessing(paramValue));
                                    }
                                }
                                daParamCollection.setParamValue(paramValue);//参数值
                                daParamCollection.setLocationCode(device);//工位
@@ -704,7 +705,7 @@
                                childVO.setItemValue(paramValue);//参数值
                                childVO.setItemText(confColl0.get(j).getParameterSetName());
                                childVO.setCheckResult("1");
                                childVO.setCheckTime(new Date().toString());
                                childVO.setCheckTime(format.format(new Date()));
                                mesChildList0.add(childVO);
                            }
                        }