cl
6 天以前 076112ac1d106e64e625c54f2fbb32dc0eafea42
修改采集内容
已修改2个文件
61 ■■■■■ 文件已修改
jcdm-admin/src/main/resources/application-druid.yml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-admin/src/main/resources/application-druid.yml
@@ -18,12 +18,12 @@
            master:
#                url: jdbc:sqlserver://192.168.0.189:1433;DataBaseName=Jcdm042-Mes
#                url: jdbc:sqlserver://183.134.244.158:1433;DataBaseName=Jcdm042-Mes
                url: jdbc:sqlserver://127.0.0.1:1433;DataBaseName=Jcdm042-Mes-module
                url: jdbc:sqlserver://192.168.0.189:1433;DataBaseName=Jcdm042-Mes-module
                username: sa
#                password: JCDM@2023
                password: JCDM@2023
#                password: admin@123
#                password: 1!deshine
                password: 123456
#                password: 123456
            # 从库数据源
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -122,6 +122,22 @@
                        miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ScanerResult1").value(scanResult).build());
                        log.info("写入到工位{}的ScanerResult1数据:{}",device,scanResult);
                    }
                }else if (Constants.RECORD_SN.equals(tab)){//请求下发模组码9
                    if (Constants.ONE.equals(valueString)){
                        if (Constants.OP070.equals(device)){
                            List<WorkOrder> orderList = workOrderService.list().stream()
                                    .sorted(Comparator.comparing(WorkOrder::getCreateTime).reversed())
                                    .collect(Collectors.toList());
                            if (CollUtil.isNotEmpty(orderList)){
                                String productNum = orderList.get(0).getProductNum();//模组码
                                //OP070下发产品模组码
                                miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build());
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build());
                            }else{
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(2).build());//没有要生产的工单
                            }
                        }
                    }
                }else if (Constants.RECORD_DATA.equals(tab)){//出入站
                    if (Constants.ONE.equals(valueString)){//入站
                        //1:告知MES托盘已到站,请求下发进站状态
@@ -155,15 +171,15 @@
                            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(21).build());
                            log.info("写入到工位{}的RecordDataDone数据:{}",device,21);
                        }else if (Constants.OP020_OP065.contains(device)){
                            String result = "21";
                            Integer result = 21;
                            //读取电芯码
                            List<String> cellCodeList = readCellCodeList(thoroughfare, device);
                            if(ObjectUtil.isNull(cellCodeList) && cellCodeList.size() != 4){
                                result = "23";
                                result = 23;
                                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(23).build());
                            }else{
                                result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站
                                if(result.equals("21")) {
                                if(result==21) {
                                    result = saveParamCollection(thoroughfare, device,cellCodeList);//保存参数,发送工厂MES
                                }
                            }
@@ -171,15 +187,15 @@
                            log.info("写入到工位{}的RecordDataDone数据:{}",device,result);
                        } else if (Constants.OP100_1.equals(device) || Constants.OP100_2.equals(device)){
                            //下发刻码信息-为模组码
                            ProductOrderQuery query = new ProductOrderQuery();
                            /*ProductOrderQuery query = new ProductOrderQuery();
                            query.setSiteCode("3983");
                            query.setStationCode(device);
                            query.setStationCode(device);*/
                            List<WorkOrder> collect = workOrderService.list().stream()
                                    .sorted(Comparator.comparing(WorkOrder::getCreateTime).reversed())
                                    .collect(Collectors.toList());
                            if (CollUtil.isNotEmpty(collect)){
                            /*if (CollUtil.isNotEmpty(collect)){
                                query.setProductNum(collect.get(0).getProductNum());
                            }
                            }*/
//                            ProductOrderVO vo = daPassingStationCollectionService.queryMessFromLine(query);
                            ProductOrderVO vo = new ProductOrderVO();
                            ProductOrderChild child = new ProductOrderChild();
@@ -289,16 +305,7 @@
                            log.info("写入到工位{}的RecordDataDone数据:{}",device,21);
                        }
                    }
                } else if (Constants.RECORD_SN.equals(tab)){
                    if (Constants.ONE.equals(valueString)){
                        if (Constants.OP070.equals(device)){
                            //OP070下发产品模组码
                            String string = UUID.randomUUID().toString();
                            miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(string).build());
                            miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build());
                        }
                    }
                } else if (Constants.RECORD_CHECK_CODE_1.equals(tab)) {
                }  else if (Constants.RECORD_CHECK_CODE_1.equals(tab)) {
                    if (Constants.OP100_1.equals(device)){
                        //钢带条码校验--发送给工厂mes
                        miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ScanerResult11").value(11).build());
@@ -352,8 +359,8 @@
     * @return list
     * @throws Exception e
     */
    private static String savePassingStation(String thoroughfare, String device,List<String> cellCodeList){
        String result = "21";
    private static Integer savePassingStation(String thoroughfare, String device,List<String> cellCodeList){
        Integer result = 21;
        try {
            //读进站时间
@@ -364,7 +371,7 @@
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
                startTime = sdf.parse(stringStartTime);
            }else{
                result = "23";
                result = 23;
                log.info("读取到工位{}的StartTime数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result);
            }
@@ -377,7 +384,7 @@
                    stationStatus = Constants.UN_PASS;
                }
            }else{
                result = "23";
                result = 23;
                log.info("读取到工位{}StationStatuss数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result);
            }
@@ -393,7 +400,7 @@
                    passingStationCollection.setCollectionTime(new Date());//采集时间
                    passingList.add(passingStationCollection);
                }else{
                    result = "23";
                    result = 23;
                    log.info("读取到工位{}CellCode数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result);
                }
            }
@@ -417,8 +424,8 @@
     * @return list
     * @throws Exception e
     */
    private static String saveParamCollection(String thoroughfare, String device,List<String> cellCodeList){
        String result = "21";//返回结果
    private static Integer saveParamCollection(String thoroughfare, String device,List<String> cellCodeList){
        Integer result = 21;//返回结果
        List<List<ChildVO>> mesList = new ArrayList<>();//存储4个电芯的发送给MES的值
        try {