春风项目四线(合箱线、总装线)
yyt
2024-02-17 f7a99591d83efd59af37b257e30d12f10291f4ef
更新OPCUA
已修改5个文件
105 ■■■■■ 文件已修改
jcdm-admin/src/main/resources/application-druid.yml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/init/OpcusConfigInit.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/IDaPassingStationCollectionService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/impl/DaPassingStationCollectionServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-admin/src/main/resources/application-druid.yml
@@ -15,10 +15,18 @@
        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
        druid:
            # 主库数据源
#            master:
#                url: jdbc:sqlserver://192.168.0.189:1433;DataBaseName=Jcdm041-Mes
#                username: sa
#                password: JCDM@2023
            master:
                url: jdbc:sqlserver://192.168.0.189:1433;DataBaseName=Jcdm041-Mes
                username: sa
                password: JCDM@2023
                 url: jdbc:sqlserver://127.0.0.1:1433;DataBaseName=Jcdm041-Mes
                 username: sa
                 password: sam@123456
#            master:
#                 url: jdbc:sqlserver://127.0.0.1:1433;DataBaseName=Jcdm041-Mes
#                 username: dt
#                 password: dtroot
            # 从库数据源
            slave:
                # 从数据源开关/默认关闭
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java
@@ -88,4 +88,68 @@
                break;
        }
    }
    public void SNRetrieval(String Node, String value) throws Exception {
        String[] parts = Node.split("[.]");
        if(value=="1") {
            //SN号检索
            ClientHandler clientHandler=new ClientHandler();
            NodeEntity SN_node= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".SNCode").value("").type("").build();
            String SNCode=clientHandler.read(SN_node);
            String a=daPassingStationCollectionService.SelectSN(SNCode);
            // 1:OK可生产 2:NG不可生产 3:NG可返工 4:PC检索失败(无记录)5:PC检索失败(软件)
            NodeEntity node1= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".CodeCheckFeed").value(a).type("short").build();
            Boolean out1=clientHandler.write(node1);
            DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
            PassingStationCollection.setSfcCode(SNCode);
            PassingStationCollection.setLocationCode(parts[1]);
            PassingStationCollection.setInboundTime(new Date());
            daPassingStationCollectionService.insertDaPassingStationCollection(PassingStationCollection);
        }
    }
    public void SaveData(String Node, String value) throws Exception {
        String[] parts = Node.split("[.]");
        if(value=="1") {
            //采集数据最终保存
            ClientHandler clientHandler=new ClientHandler();
            NodeEntity SN_node= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".SNCode").value("").type("").build();
            String SNCode=clientHandler.read(SN_node);
            List<DaCollectionParamConf> b;
            DaCollectionParamConf daCollectionParamConf=new DaCollectionParamConf();
            daCollectionParamConf.setGatherAddress(parts[0]+"."+parts[1]);
            b=collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf);
            List<NodeId> nodeId = b.stream().map(info -> {
                NodeId nodeid = new NodeId(2,info.getGatherAddress());
                return nodeid;
            }).collect(Collectors.toList());
            List<DataValue> s=readValues(nodeId);
            //保存PLC采集数据
            for(int i=0;i<nodeId.size();i++)
            {
                DaParamCollection Config=new DaParamCollection();
                Config.setParamCode(nodeId.get(i).getIdentifier().toString().split("[.]")[2]);
                Config.setLocationCode(nodeId.get(i).getIdentifier().toString().split("[.]")[1]);
                Config.setParamValue(s.get(i).getValue().getValue().toString());
                Config.setSfcCode(SNCode);
                Config.setParamName(b.get(i).getGatherAddress());
                daParamCollectionService.insertDaParamCollection(Config);
            }
            //更新出站时间,计算节拍。
            DaPassingStationCollection PSC=new DaPassingStationCollection();
            PSC.setSfcCode(SNCode);
            List<DaPassingStationCollection> LPSC=daPassingStationCollectionService.selectDaPassingStationCollectionList(PSC);
            if(LPSC != null && LPSC.size() > 0){
                LPSC.get(0).setOutboundTime(new Date());
                LPSC.get(0).setCollectionTime(new Date());
                LPSC.get(0).setBeatTime(Long.toString(Math.abs(new Date().getTime() - LPSC.get(0).getInboundTime().getTime())));
                daPassingStationCollectionService.updateDaPassingStationCollection(LPSC.get(0));
            }
            //请求最终保存反馈:1 保存完成 2 保存失败 3 保存失败,数据位超长
            NodeEntity node1= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".SaveFeedLast").value("1").type("short").build();
            Boolean out1=clientHandler.write(node1);
        }
    }
}
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/init/OpcusConfigInit.java
@@ -25,7 +25,8 @@
    public void run(String... args) throws Exception {
        try {
            DaOpcuaConfig daOpcuaConfig=new DaOpcuaConfig();
            daOpcuaConfig.setSubscribe("Y"); //设置查询条件,是否订阅状态为Y的所有数据.
            daOpcuaConfig.setSubscribe("Y"); //设置查询条件,订阅状态的所有数据.
            daOpcuaConfig.setState(Long.valueOf("0")); //设置查询条件,正常状态.
            List<DaOpcuaConfig> nodeslist=daOpcuaConfigService.selectDaOpcuaConfigList(daOpcuaConfig);
            clientHandler.connect();
            if (nodeslist != null && nodeslist.size() > 0) {
jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/IDaPassingStationCollectionService.java
@@ -72,4 +72,12 @@
    public int deleteDaPassingStationCollectionById(Long id);
    void insertRepairRecordByIds(DaPassingStationCollection daPassingStationCollection);
    /**
     * SN检索
     *
     * @param SNcode 产品SN
     * @return 结果
     */
    public String SelectSN(String SNcode);
}
jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/impl/DaPassingStationCollectionServiceImpl.java
@@ -222,4 +222,20 @@
            rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord);
        }
    }
    @Override
    public String SelectSN(String SNcode){
        return "1";
//        --订单排产
//        select * from bs_order_scheduling where engine_no='2V91Y-F RA182118'
//
//        --工艺路线子表信息
//        select * from bs_technology_route_child_info where route_code='H_191S'
//
//        --返修数据
//        select * from rm_repair_record where box_code='2V91Y-F RA182118'
//
//        --过站采集
//        select * from da_passing_station_collection --where sfc_code='2V91Y-F RA182118'
    }
}