cl
2024-08-05 8c09d8b5a15ec8205d32dc80db30b4cca39938d1
修改采集参数
已修改2个文件
59 ■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
@@ -68,7 +68,8 @@
    {
        String productNum = "";
        try {
            String str = "MOZU1."+bsFormulaChildInfo.getLocationCode()+".ModuleCode";
            String thoroughfare = Constants.thoroughfareMap.get(bsFormulaChildInfo.getLocationCode());
            String str = thoroughfare+"."+bsFormulaChildInfo.getLocationCode()+".SNCode";
            Object productNumObject = miloService.readFromOpcUa(str).getValue();
            if(ObjectUtil.isNotNull(productNumObject)){
                productNum = productNumObject.toString();
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -109,7 +109,7 @@
            if (Constants.RECORD_DATA.equals(tab)) {  //出入站
                if (Constants.ONE.equals(valueString)) {//入站
                    if(Constants.OP040_OP160.contains(device)){
                        Object snCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".snCode").getValue();
                        Object snCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue();
                        if (ObjectUtil.isNull(snCodeObjcet)){
                            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build());
                        }else{
@@ -124,32 +124,36 @@
                        miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(recordDataDone).build());
                    }
                } else if(Constants.TWO.equals(valueString)){//出站
                    Integer result = 21;
                    //先判断是否有产品SN
                    Object snCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue();
                    Object orderObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".WorkOrderNumber").getValue();
                    if (ObjectUtil.isNull(snCodeObjcet)){
                        result = 25;//未获取要生产的工单,请联系管理员
                    }else{
                        String snCode = snCodeObjcet.toString();//产品SN
                        String orderNumber = orderObjcet.toString();//工单号
                        Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//站状态地址
                        if (ObjectUtil.isNotNull(stationStatusObjcet)){
                            String stationStatus = stationStatusObjcet.toString();
                            if(Constants.OP010.equals(device)) {
                                updateOrderStatus(snCode, "3");//OP010工位更新工单状态为执行中
                                reportFactoryMes(snCode, device, format.format(new Date()));//工厂MES报工
                        if(Constants.OP040_OP160.contains(device)){//人工工位
                            WebSocketUsers.sendMessageToUserByText(map.get(device), "END");
                        }else{//自动工位
                            //先判断是否有产品SN
                            Object snCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue();
                            Object orderObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".WorkOrderNumber").getValue();
                            if (ObjectUtil.isNull(snCodeObjcet)){
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(25).build());
                            }else {
                                Integer result = 21;
                                String snCode = snCodeObjcet.toString();//产品SN
                                String orderNumber = orderObjcet.toString();//工单号
                                Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//站状态地址
                                if (ObjectUtil.isNotNull(stationStatusObjcet)) {
                                    String stationStatus = stationStatusObjcet.toString();
                                    if (Constants.OP010.equals(device)) {
                                        updateOrderStatus(snCode, "3");//OP010工位更新工单状态为执行中
                                        reportFactoryMes(snCode, device, format.format(new Date()));//工厂MES报工
                                    }
                                    result = savePassingStation(thoroughfare, device, snCode, orderNumber, stationStatus);//保存过站
                                    if (result == 21) {
                                        result = saveParamCollection(device, snCode, orderNumber, stationStatus);//保存参数,发送工厂MES
                                    }
                                } else {
                                    result = 23;
                                    log.info("读取到工位{}StationStatus数据:{},返回RecordDataDone的值为{}", device, "IS NULL!", result);
                                }
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build());
                            }
                            result = savePassingStation(thoroughfare, device,snCode,orderNumber,stationStatus);//保存过站
                            if(result == 21) {
                                result = saveParamCollection(device,snCode,orderNumber,stationStatus);//保存参数,发送工厂MES
                            }
                        }else{
                            result = 23;
                            log.info("读取到工位{}StationStatus数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result);
                        }
                    }
                    miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build());
                }
            }else if (Constants.RECORD_SN.equals(tab)){//请求产品序列号
                if (Constants.ONE.equals(valueString)){
@@ -361,7 +365,7 @@
            }
            //下发产品SN和工单号
            if(!productNum.isEmpty() && !orderNum.isEmpty()){
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".SNCode").value(productNum).build());
                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(orderNum).build());
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(11).build());
            }