Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
| | | <component name="FacetManager">
|
| | | <facet type="web" name="Web">
|
| | | <configuration>
|
| | | <webroots />
|
| | | <sourceRoots>
|
| | | <root url="file://$MODULE_DIR$/src/main/java" />
|
| | | <root url="file://$MODULE_DIR$/src/main/resources" />
|
| | | </sourceRoots>
|
| | | </configuration>
|
| | | </facet>
|
| | | <facet type="Spring" name="Spring">
|
| | | <configuration />
|
| | | </facet>
|
| | | </component>
|
| | | <module type="JAVA_MODULE" version="4">
|
| | | <component name="MavenCustomPomFilePath">
|
| | | <option name="mavenPomFileUrl" value="file://$MODULE_DIR$/effective-pom.xml" />
|
| | | </component>
|
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
| | | <output url="file://$MODULE_DIR$/target/classes" />
|
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" />
|
| | | <content url="file://$MODULE_DIR$/src/main/java">
|
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
| | | </content>
|
| | | <content url="file://$MODULE_DIR$/src/main/resources">
|
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
| | | </content>
|
| | | <content url="file://$MODULE_DIR$/src/test/java">
|
| | | <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
| | | </content>
|
| | | <output url="file://$MODULE_DIR$/../../../Documents/HangZhouMes/TemperingGlassModule/target/classes" />
|
| | | <output-test url="file://$MODULE_DIR$/../../../Documents/HangZhouMes/TemperingGlassModule/target/test-classes" />
|
| | | <exclude-output />
|
| | | <orderEntry type="inheritedJdk" />
|
| | | <orderEntry type="sourceFolder" forTests="false" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.10" level="project" />
|
| | | <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.10" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.33" level="project" />
|
| | | <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.56" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.56" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.56" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.3.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.13" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.1.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.70" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.3.1.RELEASE" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.33" level="project" />
|
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.20" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.22" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.5.9" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.5.9" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.5.9" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.5.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.4.7" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:2.4.7" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:9.1" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.9.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.9.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.15" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.8.4" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.3.1" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-test-autoconfigure:2.3.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.auth0:java-jwt:3.10.3" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.12.6" level="project" />
|
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: commons-codec:commons-codec:1.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.assertj:assertj-core:3.19.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.4.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.3" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:dynamic-datasource-spring-boot-starter:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.github.xingshuangs:iot-communication:1.4.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.netty:netty-all:4.1.36.Final" level="project" />
|
| | | </component>
|
| | | </module> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
| | | <component name="FacetManager">
|
| | | <facet type="web" name="Web">
|
| | | <configuration>
|
| | | <webroots />
|
| | | </configuration>
|
| | | </facet>
|
| | | <facet type="Spring" name="Spring">
|
| | | <configuration />
|
| | | </facet>
|
| | | </component>
|
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
| | | <output url="file://$MODULE_DIR$/target/classes" />
|
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" />
|
| | | <content url="file://$MODULE_DIR$">
|
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
| | | <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
| | | <excludeFolder url="file://$MODULE_DIR$/target" />
|
| | | </content>
|
| | | <output url="file://$MODULE_DIR$/../../../Documents/HangZhouMes/TemperingGlassModule/target/classes" />
|
| | | <output-test url="file://$MODULE_DIR$/../../../Documents/HangZhouMes/TemperingGlassModule/target/test-classes" />
|
| | | <content url="file://$MODULE_DIR$" />
|
| | | <orderEntry type="inheritedJdk" />
|
| | | <orderEntry type="sourceFolder" forTests="false" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.10" level="project" />
|
| | | <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.10" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.17.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.17.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.33" level="project" />
|
| | | <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.28" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.56" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.56" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.56" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.3.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.13" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.1.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.70" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.3.1.RELEASE" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.33" level="project" />
|
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.20" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.22" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.5.9" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.5.9" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.5.9" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.5.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.4.7" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:2.4.7" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:9.1" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.7.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:3.9.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.22" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.22" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.2" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:3.9.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.15" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.8.4" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.3.1" level="project" />
|
| | | <orderEntry type="library" scope="TEST" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-test-autoconfigure:2.3.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.auth0:java-jwt:3.10.3" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.12.6" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.12.6" level="project" />
|
| | | <orderEntry type="library" scope="RUNTIME" name="Maven: commons-codec:commons-codec:1.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.assertj:assertj-core:3.19.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.4.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.3" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.baomidou:dynamic-datasource-spring-boot-starter:3.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.20" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-core:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.2.0.Final" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.9.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.20" level="project" />
|
| | | <orderEntry type="library" name="Maven: com.github.xingshuangs:iot-communication:1.4.2" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-cache:2.5.9" level="project" />
|
| | | <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.15" level="project" />
|
| | | <orderEntry type="library" name="Maven: io.netty:netty-all:4.1.36.Final" level="project" />
|
| | | </component>
|
| | | </module> |
| | |
| | | // export default { |
| | | // serverUrl: "localhost:8083/api/loadGlass", |
| | | // serverUrl2: "localhost:8085" |
| | | // //serverUrl:"res.abeim.cn" |
| | | // } |
| | | export default { |
| | | serverUrl: "localhost:88/api", |
| | | serverUrl: "localhost:88/api/loadGlass", |
| | | //serverUrl: "localhost:88/api/", |
| | | serverUrl2: "localhost:8085" |
| | | //serverUrl:"res.abeim.cn" |
| | | } |
| | |
| | | import {useRouter} from 'vue-router' |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import userInfo from '@/stores/userInfo' |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {ref, watch} from "vue" |
| | | import deepClone from "@/utils/deepClone" |
| | | import request from '@/utils/request' |
| | | import {ElMessage} from 'element-plus' |
| | | import {ref, watch} from 'vue' |
| | | import deepClone from '@/utils/deepClone' |
| | | |
| | | const store = userInfo() |
| | | |
| | |
| | | // store.createWebSocket(); |
| | | function quit() { |
| | | userStore.$patch({ |
| | | user: null |
| | | user: null, |
| | | }) |
| | | router.push("/login") |
| | | router.push('/login') |
| | | } |
| | | |
| | | |
| | | //提取模块列表 |
| | | //提取菜单模块列表 |
| | | let menuList = $ref([]) |
| | | request.get('/loadGlass/menu/sysMenu/list').then((res) => { |
| | | if (res.code == 200) { |
| | |
| | | } |
| | | }) |
| | | |
| | | //获取菜单列表 |
| | | // let menuItemList = $ref([]) |
| | | // request.get('/menuItem').then((res) => { |
| | | // if (res.code == 200) { |
| | | // menuItemList = deepClone(res.data) |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // router.push('/login') |
| | | // } |
| | | // }) |
| | | |
| | | const menu = ref(null) |
| | | let indexKey = ref(null) |
| | | |
| | |
| | | indexKey.value = key |
| | | } |
| | | |
| | | watch(indexKey, (newVal, oldVal) => { |
| | | watch( |
| | | indexKey, |
| | | (newVal, oldVal) => { |
| | | if (oldVal !== newVal && oldVal !== null) { |
| | | menu.value.close(oldVal) |
| | | } |
| | |
| | | //return false |
| | | }) |
| | | |
| | | |
| | | let openFlag = $ref(null) |
| | | //原始菜单打开 |
| | | const openMenu = (menuID) => { |
| | |
| | | openFlag = menuID |
| | | } |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <el-container> |
| | | <el-header > |
| | | <div style="height: 100%;width: 100%;display: flex;background-color: #fff;"> |
| | | <img src="../assets/northGlass.ico" alt="" style="max-width: 100%;max-height: 100%"> |
| | | <img src="../assets/northGlass.ico" |
| | | alt="" |
| | | style="max-width: 100%;max-height: 100%"> |
| | | <h3 style="margin: 1rem ;font-weight: bold;width: 20vw;"> 欢迎{{ user }}使用北玻MES系统!</h3> |
| | | <span style="height: 70%;width: 78vw;margin-top: 1rem;"> |
| | | <el-button class="sys-quit" @click="quit" round> |
| | | <el-icon size="large"><SwitchButton size=""/></el-icon> |
| | | <el-button class="sys-quit" |
| | | @click="quit" |
| | | round> |
| | | <el-icon size="large"> |
| | | <SwitchButton size=""/>退出 |
| | | </el-icon> |
| | | </el-button> |
| | | </span> |
| | | </div> |
| | |
| | | background-color: #eee; |
| | | height: 100%; |
| | | } |
| | | |
| | | .el-container{ |
| | | height: 100vh; |
| | | width: 99vw |
| | | width: 99vw; |
| | | } |
| | | |
| | | *{ |
| | | padding: 0; |
| | | margin: 0; |
| | | } |
| | | |
| | | :deep(.sys-quit){ |
| | | float: right; |
| | | margin-right: 1rem; |
| | | width: 5rem; |
| | | } |
| | | |
| | | /* 横线 */ |
| | | #line{ |
| | | float:right; |
| | |
| | | position: relative; |
| | | text-align: center; |
| | | } |
| | | |
| | | :deep(span){ |
| | | margin-right: 0; |
| | | |
| | | } |
| | | |
| | | .el-collapse{ |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | #main{ |
| | | width: 99%; |
| | | float: right; |
| | |
| | | font-size: 16px; |
| | | padding-left: 15px; |
| | | padding-right: 2px; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | ul { |
| | |
| | | } |
| | | |
| | | ul li { |
| | | |
| | | height: 28px; |
| | | line-height: 30px; |
| | | /* background: rgb(128, 128, 128); */ |
| | |
| | | font-size: 14px; |
| | | } |
| | | ul li a:hover { |
| | | |
| | | color: #1087ff; |
| | | } |
| | | |
| | |
| | | opacity: 0.8; */ |
| | | margin-bottom:2px; |
| | | } |
| | | |
| | | .item a{ |
| | | width: 138px; |
| | | height: 35px; |
| | |
| | | position: relative; |
| | | font-weight: bold; |
| | | overflow: hidden; |
| | | |
| | | } |
| | | |
| | | .menu_title:hover { |
| | |
| | | text-align: center; |
| | | } |
| | | |
| | | |
| | | |
| | | /* 动画效果 */ |
| | | .enter-x-left { |
| | | z-index: 9; |
| | |
| | | transform: translateX(-50px); |
| | | transition: all 0.3s ease; |
| | | } |
| | | |
| | | .enter-x-left:nth-child(1){ |
| | | animation-delay: 0.1s; |
| | | } |
| | | |
| | | .enter-x-left:nth-child(2){ |
| | | animation-delay: 0.2s; |
| | | } |
| | | |
| | | .enter-x-left:nth-child(3) { |
| | | animation-delay: 0.3s; |
| | | } |
| | | |
| | | .enter-x-left:nth-child(4){ |
| | | animation-delay: 0.4s; |
| | | } |
| | |
| | | transform: translateX(0); |
| | | } |
| | | } |
| | | |
| | | |
| | | </style> |
| | |
| | | https: false, |
| | | proxy: { |
| | | '/api': { |
| | | target: 'http://localhost:8080/mesModuleTools', |
| | | target: 'http://localhost:88/', |
| | | changeOrigin: true, |
| | | rewrite: (path) => path.replace(/^\/api/, '/'), |
| | | }, |
| | | '/api2': { |
| | | target: 'http://localhost:8085/mesModuleTools', |
| | | changeOrigin: true, |
| | | pathRewrite: { |
| | | '^/api2': '', |
| | | }, |
| | | }, |
| | | // '/api2': { |
| | | // target: 'http://localhost:8085/mesModuleTools', |
| | | // changeOrigin: true, |
| | | // pathRewrite: { |
| | | // '^/api2': '', |
| | | // }, |
| | | // }, |
| | | }, |
| | | }, |
| | | configureServer: ({ middlewares }) => { |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>common</artifactId> |
| | | <packaging>pom</packaging> |
| | | <modules> |
| | | <module>servicebase</module> |
| | | <module>springsecurity</module> |
| | | </modules> |
| | | <properties> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | </properties> |
| | | <dependencies> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-openfeign</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!-- mybatis-plus--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.2.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>dynamic-datasource-spring-boot-starter</artifactId> |
| | | <version>3.2.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.8</version> |
| | | </dependency> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore --> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpcore</artifactId> |
| | | <version>4.4.12</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>commons-lang</groupId> |
| | | <artifactId>commons-lang</artifactId> |
| | | <version>2.6</version> |
| | | </dependency> |
| | | |
| | | <!-- 导入mysql驱动 --> |
| | | <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <version>8.0.17</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>javax.servlet</groupId> |
| | | <artifactId>servlet-api</artifactId> |
| | | <version>2.5</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>javax.validation</groupId> |
| | | <artifactId>validation-api</artifactId> |
| | | <version>2.0.1.Final</version> |
| | | </dependency> |
| | | |
| | | <!--代码生成工具--> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-generator</artifactId> |
| | | <version>3.4.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>2.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid</artifactId> |
| | | <version>1.1.8</version> |
| | | </dependency> |
| | | |
| | | <!-- 数据库设计文档生成工具--> |
| | | <dependency> |
| | | <groupId>cn.smallbun.screw</groupId> |
| | | <artifactId>screw-core</artifactId> |
| | | <version>1.0.5</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <!-- 2.0~2.2 Knife4j 2.0.0 ~ 2.0.6--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.xiaoymin</groupId>--> |
| | | <!-- <artifactId>knife4j-spring-boot-starter</artifactId>--> |
| | | <!-- <version>2.0.6</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>2.7.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>2.7.0</version> |
| | | </dependency> |
| | | |
| | | <!--hutool java验证方法类--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.4.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.xingshuangs</groupId> |
| | | <artifactId>iot-communication</artifactId> |
| | | <version>1.4.2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.33</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | |
| | | </project> |
| | |
| | | |
| | | <artifactId>servicebase</artifactId> |
| | | |
| | | <!-- <dependencies>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.yulichang</groupId>--> |
| | | <!-- <artifactId>mybatis-plus-join</artifactId>--> |
| | | <!-- <version>1.1.6</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- </dependencies>--> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.github.yulichang</groupId> |
| | | <artifactId>mybatis-plus-join</artifactId> |
| | | <version>1.1.6</version> |
| | | </dependency> |
| | | </dependencies> |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | |
| | | /** |
| | | * @author zhoush |
| | | * @Date 2024/1/26 13:44 |
| | | */ |
| | | |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | |
| | | /** |
| | | * 添加分页插件 |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.ParameterBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.schema.ModelRef; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.service.Parameter; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhan_py |
| | | * @Date 2024/1/26 16:11 |
| | | * Swagger2配置信息 |
| | | */ |
| | | @Configuration |
| | | public class Swagger2Config { |
| | | |
| | | @Bean |
| | | public Docket webApiConfig() { |
| | | List<Parameter> pars = new ArrayList<>(); |
| | | ParameterBuilder tokenPar = new ParameterBuilder(); |
| | | tokenPar.name("userId") |
| | | .description("用户token") |
| | | //.defaultValue(JwtHelper.createToken(1L, "admin")) |
| | | .defaultValue("1") |
| | | .modelRef(new ModelRef("string")) |
| | | .parameterType("header") |
| | | .required(false) |
| | | .build(); |
| | | pars.add(tokenPar.build()); |
| | | |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .groupName("webApi") |
| | | .apiInfo(webApiInfo()) |
| | | .select() |
| | | //只显示api路径下的页面 |
| | | .apis(RequestHandlerSelectors.basePackage("com.mes")) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .globalOperationParameters(pars); |
| | | } |
| | | |
| | | @Bean |
| | | public Docket adminApiConfig() { |
| | | List<Parameter> pars = new ArrayList<>(); |
| | | ParameterBuilder tokenPar = new ParameterBuilder(); |
| | | tokenPar.name("adminId") |
| | | .description("用户token") |
| | | .defaultValue("1") |
| | | .modelRef(new ModelRef("string")) |
| | | .parameterType("header") |
| | | .required(false) |
| | | .build(); |
| | | pars.add(tokenPar.build()); |
| | | |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .groupName("adminApi") |
| | | .apiInfo(adminApiInfo()) |
| | | .select() |
| | | //只显示admin路径下的页面 |
| | | .apis(RequestHandlerSelectors.basePackage("com.mes")) |
| | | .paths(PathSelectors.any()) |
| | | .build() |
| | | .globalOperationParameters(pars); |
| | | } |
| | | |
| | | private ApiInfo webApiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("网站-API文档") |
| | | .description("本文档描述了mes网站微服务接口定义") |
| | | .version("1.0") |
| | | .contact(new Contact("zhan_py", "", "")) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo adminApiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("后台管理系统-API文档") |
| | | .description("本文档描述了mes后台系统服务接口定义") |
| | | .version("1.0") |
| | | .contact(new Contact("zhan_py", "", "")) |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.exception; |
| | | |
| | | import com.mes.utils.Result; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | /** |
| | | * @author zhoush |
| | | * @Date 2024/1/26 15:31 |
| | | */ |
| | | @ControllerAdvice |
| | | @Slf4j |
| | | public class GlobalExceptionHandler { |
| | | /** |
| | | * 如果是serviceExcaption,则调用该方法 |
| | | */ |
| | | @ExceptionHandler(ServiceException.class) |
| | | @ResponseBody |
| | | public Result handle(ServiceException se) { |
| | | return Result.error(se.getCode(), se.getMessage()); |
| | | } |
| | | |
| | | @ExceptionHandler(Exception.class) |
| | | @ResponseBody |
| | | public Result<Object> error(Exception e) { |
| | | e.printStackTrace(); |
| | | return Result.error(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.exception; |
| | | |
| | | import com.mes.utils.ResultCodeEnum; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public class ServiceException extends RuntimeException { |
| | | private Integer code; |
| | | |
| | | public ServiceException(ResultCodeEnum resultCodeEnum, String msg) { |
| | | super(msg); |
| | | this.code = resultCodeEnum.getCode(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Component |
| | | public class MyMetaObjectHandler implements MetaObjectHandler { |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | //属性名称,不是字段名称 |
| | | this.setFieldValByName("gmtCreate", new Date(), metaObject); |
| | | this.setFieldValByName("gmtModified", new Date(), metaObject); |
| | | } |
| | | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("gmtModified", new Date(), metaObject); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.device; |
| | | |
| | | import com.mes.tools.InitUtil; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class PLCAutoMes extends Thread { |
| | | |
| | | // 用于存储应用程序的配置信息 |
| | | private Configuration config; |
| | | private static InitUtil initUtil; |
| | | |
| | | |
| | | // 单例实例 |
| | | private static PLCAutoMes instance; |
| | | private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath(); |
| | | private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath(); |
| | | private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath(); |
| | | // private static String PlcParameter = PLCAutomaticParameterSettingReview2.class |
| | | // .getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | // private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json") |
| | | // .getPath(); |
| | | // private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json") |
| | | // .getPath(); |
| | | private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath(); |
| | | // private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath(); |
| | | |
| | | // 调用initword方法 |
| | | |
| | | // |
| | | // public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm); |
| | | public static PlcParameterObject PlcMesObject = initUtil.initword(PlcMes); |
| | | public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead); |
| | | public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe); |
| | | |
| | | // 私有构造函数 |
| | | public PLCAutoMes() throws IOException { |
| | | |
| | | initUtil = new InitUtil(); |
| | | } |
| | | |
| | | // 获取单例实例 |
| | | public static synchronized PLCAutoMes getInstance() throws IOException { |
| | | if (instance == null) { |
| | | instance = new PLCAutoMes(); |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // System.out.println(jsonFilePath); |
| | | |
| | | // readAndUpdateWordValues(PlcReadObject); |
| | | InitUtil.readAndUpdateWordValues(PlcMesObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | |
| | | // readAndUpdateWordValues(plcStateObject); |
| | | // int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); |
| | | // System.out.println(index); |
| | | // PlcMesObject.getPlcParameter("AddStart").getAddress(index); |
| | | // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index)); |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("FeedID"); |
| | | addresses.add("AddStart"); |
| | | // System.out.println(addresses); |
| | | // System.out.println(PlcMesObject.getPlcParameterValues(addresses)); |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("FeedID"); |
| | | addresses2.add("FeedCarStatus"); |
| | | |
| | | // System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.device; |
| | | |
| | | public class PlcBitInfo { |
| | | |
| | | public PlcBitInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private Boolean value; |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Boolean getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(Boolean value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | if (stringdatas.length < 2) |
| | | return null; |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | return null; |
| | | dbwindex += index / 8; |
| | | bitindex += index % 8; |
| | | return stringdatas[0] + "." + dbwindex + "." + bitindex; |
| | | } |
| | | |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.device; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcBitObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcBitInfo> plcBitList; |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcBitInfo> getBitList() { |
| | | return plcBitList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcBitInfo getPlcBit(String codeid) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | if (plcbitInfo.getCodeId().equals(codeid)) |
| | | return plcbitInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<Boolean> getPlcBitValues(List<String> codeids) { |
| | | List<Boolean> arrayList = new ArrayList<>(); |
| | | if (plcBitList != null) { |
| | | Map<String, Boolean> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (codeids.contains(plcBitInfo.getCodeId().toString())) { |
| | | resultMap.put(plcBitInfo.getCodeId().toString(), plcBitInfo.getValue()); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | Boolean value = resultMap.get(codeId); |
| | | if (value != null) { |
| | | arrayList.add(value); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (plcBitInfo.getCodeId().equals(codeId)) { |
| | | int index = plcBitInfo.getAddressIndex(); |
| | | String address = plcBitInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcBit(PlcBitInfo param) { |
| | | if (plcBitList != null) |
| | | plcBitList.add(param); |
| | | else { |
| | | plcBitList = new ArrayList<PlcBitInfo>(); |
| | | plcBitList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcBitList(List<Boolean> plcValueArray) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | plcbitInfo.setValue(plcValueArray.get(plcbitInfo.getAddressIndex())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.device; |
| | | |
| | | public class PlcParameterInfo { |
| | | public PlcParameterInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private String value; |
| | | |
| | | // // 写入 参数值 |
| | | // private String writeValue; |
| | | |
| | | // 参数单位 |
| | | private String unit; |
| | | |
| | | // 参数值转换系数 |
| | | private int ratio; |
| | | |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | // 参数地址位长度 |
| | | private int addressLength; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | // public String getWriteValue() { |
| | | // return this.writeValue; |
| | | // } |
| | | |
| | | // public void setWriteValue(String writeValue) { |
| | | // this.writeValue = writeValue; |
| | | // } |
| | | |
| | | public String getUnit() { |
| | | return this.unit; |
| | | } |
| | | |
| | | public void setUnit(String unit) { |
| | | this.unit = unit; |
| | | } |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | |
| | | public int getAddressLength() { |
| | | return this.addressLength; |
| | | } |
| | | |
| | | public void setAddressLength(int addresslength) { |
| | | this.addressLength = addresslength; |
| | | } |
| | | |
| | | public int getRatio() { |
| | | return this.ratio; |
| | | } |
| | | |
| | | public void setRatio(int ratio) { |
| | | this.ratio = ratio; |
| | | } |
| | | |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | int addressLength = this.addressLength; |
| | | if (addressLength < 2) { |
| | | return null; |
| | | } |
| | | |
| | | if (addressLength == 2) { |
| | | int wordindex = index; |
| | | |
| | | return stringdatas[0] + "." + wordindex; |
| | | } |
| | | if (addressLength == 14) { |
| | | int wordindex = index; |
| | | int newIndex = wordindex + 13; |
| | | return stringdatas[0] + "." + wordindex + "-" + newIndex; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public int getPlcAddress() { |
| | | |
| | | return addressIndex; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return getAddress(this.addressIndex); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.device; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcParameterObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcParameterInfo> plcParameterList; |
| | | |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcParameterInfo> getPlcParameterList() { |
| | | return plcParameterList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcParameterInfo getPlcParameter(String codeid) { |
| | | if (plcParameterList != null) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeid)) |
| | | return plcParameterInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeids 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<String> getPlcParameterValues(List<String> codeids) { |
| | | List<String> arrayList = new ArrayList<>(); |
| | | if (plcParameterList != null) { |
| | | Map<String, PlcParameterInfo> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (codeids.contains(plcParameterInfo.getCodeId())) { |
| | | resultMap.put(plcParameterInfo.getCodeId(), plcParameterInfo); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | PlcParameterInfo plcParameterInfo = resultMap.get(codeId); |
| | | if (plcParameterInfo != null) { |
| | | arrayList.add(plcParameterInfo.getValue()); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeId)) { |
| | | int index = plcParameterInfo.getAddressIndex(); |
| | | String address = plcParameterInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcParameter(PlcParameterInfo param) { |
| | | if (plcParameterList != null) |
| | | plcParameterList.add(param); |
| | | else { |
| | | plcParameterList = new ArrayList<PlcParameterInfo>(); |
| | | plcParameterList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcParameterList(byte[] plcValueArray) { |
| | | if (plcParameterList != null) { |
| | | |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | |
| | | byte[] valueList = new byte[plcParameterInfo.getAddressLength()]; |
| | | |
| | | // System.out.println(plcParameterInfo.getAddressLength()); |
| | | |
| | | for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) { |
| | | Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]); |
| | | |
| | | } |
| | | if (plcParameterInfo.getAddressLength() == 2) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2short(valueList))); |
| | | } else if (plcParameterInfo.getAddressLength() == 14) { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } else { |
| | | String valuestr = new String(valueList); |
| | | plcParameterInfo.setValue(valuestr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * short类型转byte[] |
| | | * |
| | | * @param s short类型值 |
| | | */ |
| | | public static byte[] short2byte(short s) { |
| | | byte[] b = new byte[2]; |
| | | for (int i = 0; i < 2; i++) { |
| | | int offset = 16 - (i + 1) * 8; //因为byte占4个字节,所以要计算偏移量 |
| | | b[i] = (byte) ((s >> offset) & 0xff); //把16位分为2个8位进行分别存储 |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * byte[]类型转short |
| | | * |
| | | * @param b byte[]类型值 |
| | | */ |
| | | public static short byte2short(byte[] b) { |
| | | short l = 0; |
| | | for (int i = 0; i < 2; i++) { |
| | | l <<= 8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 |
| | | l |= (b[i] & 0xff); //和上面也是一样的 l = l | (b[i]&0xff) |
| | | } |
| | | return l; |
| | | } |
| | | |
| | | public static String byteToHexString(byte[] bytes) { |
| | | |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | return str; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/userinfo/optimize-detail") |
| | | public class OptimizeDetailController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.pp.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/userinfo/optimize-layout") |
| | | public class OptimizeLayoutController { |
| | | |
| | | } |
| | | |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
New file |
| | |
| | | package com.mes.pp.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class OptimizeDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String projectNo; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String processId; |
| | | |
| | | /** |
| | | * 层 |
| | | */ |
| | | private Integer layer; |
| | | |
| | | /** |
| | | * 序号 |
| | | */ |
| | | private Integer orderSort; |
| | | |
| | | /** |
| | | * 版图id |
| | | */ |
| | | private Integer stockId; |
| | | |
| | | /** |
| | | * 版图序 |
| | | */ |
| | | private Integer stockNumber; |
| | | |
| | | /** |
| | | * 图号 |
| | | */ |
| | | private Integer graphNo; |
| | | |
| | | /** |
| | | * 小片编号 |
| | | */ |
| | | private String glassId; |
| | | |
| | | /** |
| | | * 小片ID |
| | | */ |
| | | private Integer polysId; |
| | | |
| | | /** |
| | | * 小片宽(加磨量) |
| | | */ |
| | | private Double pWidth; |
| | | |
| | | /** |
| | | * 小片高(加磨量) |
| | | */ |
| | | private Double pHeight; |
| | | |
| | | /** |
| | | * 小片宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 小片高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Double xAxis; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Double yAxis; |
| | | |
| | | /** |
| | | * 钢化版图编号(架号) |
| | | */ |
| | | private Integer heatLayoutId; |
| | | |
| | | private String h; |
| | | |
| | | private String g; |
| | | |
| | | private String r; |
| | | |
| | | private String glassPoint; |
| | | |
| | | @TableField("intRemark") |
| | | private Integer intremark; |
| | | |
| | | @TableField("strRemark") |
| | | private String strremark; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class OptimizeLayout implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String projectNo; |
| | | |
| | | /** |
| | | * 原片ID |
| | | */ |
| | | private Integer stockId; |
| | | |
| | | private Double width; |
| | | |
| | | private Double height; |
| | | |
| | | private Double realwidth; |
| | | |
| | | private Double realheight; |
| | | |
| | | /** |
| | | * 切裁率 |
| | | */ |
| | | private String usageRate; |
| | | |
| | | /** |
| | | * 物料编码 |
| | | */ |
| | | private String stockCode; |
| | | |
| | | /** |
| | | * 上修边 |
| | | */ |
| | | private String upTrim; |
| | | |
| | | /** |
| | | * 下 |
| | | */ |
| | | private String downTrim; |
| | | |
| | | /** |
| | | * 左 |
| | | */ |
| | | private String leftTrim; |
| | | |
| | | /** |
| | | * 右 |
| | | */ |
| | | private String rightTrim; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer count; |
| | | |
| | | /** |
| | | * 小片数 |
| | | */ |
| | | private String glassCount; |
| | | |
| | | /** |
| | | * 小片面积 |
| | | */ |
| | | private String glassArea; |
| | | |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | private Integer creater; |
| | | |
| | | private Date createTime; |
| | | |
| | | @TableField("intRemark") |
| | | private Integer intremark; |
| | | |
| | | @TableField("strRemark") |
| | | private String strremark; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class OptimizeProject implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增:<优化-工程> |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工程编号 |
| | | */ |
| | | private String projectNo; |
| | | |
| | | /** |
| | | * 工程项目名 |
| | | */ |
| | | private String projectName; |
| | | |
| | | /** |
| | | * 玻璃膜系 |
| | | */ |
| | | private String glassType; |
| | | |
| | | /** |
| | | * 玻璃厚度 |
| | | */ |
| | | private String glassThickness; |
| | | |
| | | /** |
| | | * 工程种类 |
| | | */ |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 状态: -2删除; -1默认; 1流程卡创建; 2第一次优化保存; 10钢化推荐创建保存; 20优化结果保存 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 总数 |
| | | */ |
| | | private Integer glassTotal; |
| | | |
| | | /** |
| | | * 总面积 |
| | | */ |
| | | private Double glassTotalArea; |
| | | |
| | | /** |
| | | * 流程卡数量 |
| | | */ |
| | | private Integer processQty; |
| | | |
| | | /** |
| | | * 循环落架数 |
| | | */ |
| | | private Integer guidance; |
| | | |
| | | /** |
| | | * 第一次使用原料数 |
| | | */ |
| | | private Integer fristStockQty; |
| | | |
| | | /** |
| | | * 第一次平均切裁率 |
| | | */ |
| | | private String fristCutPct; |
| | | |
| | | /** |
| | | * 使用的原料数 |
| | | */ |
| | | private Integer rawStockQty; |
| | | |
| | | /** |
| | | * 使用的原料面积 |
| | | */ |
| | | private String rawStockArea; |
| | | |
| | | /** |
| | | * 平均切裁率 |
| | | */ |
| | | private String avgCutPct; |
| | | |
| | | /** |
| | | * 有效切裁率 |
| | | */ |
| | | private String validCutPct; |
| | | |
| | | /** |
| | | * 尾片切裁率 |
| | | */ |
| | | private String lastCutPct; |
| | | |
| | | /** |
| | | * g混排程度 |
| | | */ |
| | | private String chaosPct; |
| | | |
| | | /** |
| | | * g最大装载率 |
| | | */ |
| | | private String maxLoadPct; |
| | | |
| | | /** |
| | | * g最大面积 |
| | | */ |
| | | private String maxArea; |
| | | |
| | | /** |
| | | * g最大数量 |
| | | */ |
| | | private Integer maxQty; |
| | | |
| | | /** |
| | | * g上片宽 |
| | | */ |
| | | private Float loadWidth; |
| | | |
| | | /** |
| | | * g上片长 |
| | | */ |
| | | private Float loadLength; |
| | | |
| | | /** |
| | | * x间隔 |
| | | */ |
| | | private Float xSpace; |
| | | |
| | | /** |
| | | * y间隔 |
| | | */ |
| | | private Float ySpace; |
| | | |
| | | /** |
| | | * g平均装载率 |
| | | */ |
| | | private Float loadRate; |
| | | |
| | | /** |
| | | * 流程卡集合 |
| | | */ |
| | | private String processCards; |
| | | |
| | | /** |
| | | * g总炉数 |
| | | */ |
| | | private Integer furnacesQty; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | private String creater; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 预留,使用需注明 |
| | | */ |
| | | @TableField("intRemark") |
| | | private Integer intremark; |
| | | |
| | | /** |
| | | * 预留,使用需注明 |
| | | */ |
| | | @TableField("strRemark") |
| | | private String strremark; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Mapper |
| | | public interface OptimizeDetailMapper extends BaseMapper<OptimizeDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.pp.entity.OptimizeLayout; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Mapper |
| | | public interface OptimizeLayoutMapper extends BaseMapper<OptimizeLayout> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface OptimizeDetailService extends IService<OptimizeDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.pp.entity.OptimizeLayout; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface OptimizeLayoutService extends IService<OptimizeLayout> { |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查询可领取的任务工程信息 |
| | | * |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> listByState(OptimizeRequest optimizeRequest); |
| | | |
| | | /** |
| | | * 查询保存到原片使用详情表的数据 |
| | | * |
| | | * @return |
| | | */ |
| | | List<OptimizeProject> saveProject(OptimizeRequest optimizeRequest); |
| | | |
| | | /** |
| | | * 将工程信息保存到原片使用详情表 |
| | | * |
| | | * @return |
| | | */ |
| | | void insetProject(OptimizeProject glass); |
New file |
| | |
| | | package com.mes.pp.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import com.mes.pp.mapper.OptimizeDetailMapper; |
| | | import com.mes.pp.service.OptimizeDetailService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Service |
| | | @DS("pp") |
| | | public class OptimizeDetailServiceImpl extends ServiceImpl<OptimizeDetailMapper, OptimizeDetail> implements OptimizeDetailService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.pp.service.impl; |
| | | |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.pp.entity.OptimizeLayout; |
| | | import com.mes.pp.mapper.OptimizeLayoutMapper; |
| | | import com.mes.pp.service.OptimizeLayoutService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Service |
| | | @DS("pp") |
| | | public class OptimizeLayoutServiceImpl extends ServiceImpl<OptimizeLayoutMapper, OptimizeLayout> implements OptimizeLayoutService { |
| | | |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/26 9:01 |
| | | * @Description: |
| | | */ |
| | | |
| | | import cn.smallbun.screw.core.Configuration; |
| | | import cn.smallbun.screw.core.engine.EngineConfig; |
| | | import cn.smallbun.screw.core.engine.EngineFileType; |
| | | import cn.smallbun.screw.core.engine.EngineTemplateType; |
| | | import cn.smallbun.screw.core.execute.DocumentationExecute; |
| | | import cn.smallbun.screw.core.process.ProcessConfig; |
| | | import com.zaxxer.hikari.HikariConfig; |
| | | import com.zaxxer.hikari.HikariDataSource; |
| | | |
| | | import javax.sql.DataSource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class DatabaseDesignDocUtil { |
| | | |
| | | public static void main(String[] args) { |
| | | documentGeneration(); |
| | | } |
| | | |
| | | /** |
| | | * 文档生成 |
| | | */ |
| | | public static void documentGeneration() { |
| | | //数据源 |
| | | HikariConfig hikariConfig = new HikariConfig(); |
| | | hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); |
| | | hikariConfig.setJdbcUrl("jdbc:mysql://10.153.19.150:3306/hangzhoumes" + "?serverTimezone=GMT%2B8"); |
| | | hikariConfig.setUsername("root"); |
| | | hikariConfig.setPassword("beibo.123/"); |
| | | //设置可以获取tables remarks信息 |
| | | hikariConfig.addDataSourceProperty("useInformationSchema", "true"); |
| | | hikariConfig.setMinimumIdle(2); |
| | | hikariConfig.setMaximumPoolSize(5); |
| | | DataSource dataSource = new HikariDataSource(hikariConfig); |
| | | //生成配置 |
| | | EngineConfig engineConfig = EngineConfig.builder() |
| | | //生成文件路径 |
| | | .fileOutputDir("E:\\项目\\项目文档\\杭州利来1") |
| | | //打开目录 |
| | | .openOutputDir(true) |
| | | //文件类型 |
| | | .fileType(EngineFileType.WORD) |
| | | //生成模板实现 |
| | | .produceType(EngineTemplateType.freemarker) |
| | | //自定义文件名称 |
| | | .fileName("杭州利来数据库文档").build(); |
| | | |
| | | //忽略表 |
| | | List<String> ignoreTableName = new ArrayList<>(); |
| | | ignoreTableName.add("test_user"); |
| | | ignoreTableName.add("test_group"); |
| | | //忽略表前缀 |
| | | ArrayList<String> ignorePrefix = new ArrayList<>(); |
| | | ignorePrefix.add("test_"); |
| | | //忽略表后缀 |
| | | ArrayList<String> ignoreSuffix = new ArrayList<>(); |
| | | ignoreSuffix.add("_test"); |
| | | ProcessConfig processConfig = ProcessConfig.builder() |
| | | //指定生成逻辑、当存在指定表、指定表前缀、指定表后缀时,将生成指定表,其余表不生成、并跳过忽略表配置 |
| | | //根据名称指定表生成 |
| | | .designatedTableName(new ArrayList<>()) |
| | | //根据表前缀生成 |
| | | .designatedTablePrefix(new ArrayList<>()) |
| | | //根据表后缀生成 |
| | | .designatedTableSuffix(new ArrayList<>()) |
| | | //忽略表名 |
| | | .ignoreTableName(ignoreTableName) |
| | | //忽略表前缀 |
| | | .ignoreTablePrefix(ignorePrefix) |
| | | //忽略表后缀 |
| | | .ignoreTableSuffix(ignoreSuffix).build(); |
| | | //配置 |
| | | Configuration config = Configuration.builder() |
| | | //版本 |
| | | .version("1.0.0") |
| | | //描述 |
| | | .description("数据库设计文档生成") |
| | | //数据源 |
| | | .dataSource(dataSource) |
| | | //生成配置 |
| | | .engineConfig(engineConfig) |
| | | //生成配置 |
| | | .produceConfig(processConfig) |
| | | .build(); |
| | | //执行生成 |
| | | new DocumentationExecute(config).execute(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.device.PlcBitInfo; |
| | | import com.mes.device.PlcBitObject; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.FileReader; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | public class InitUtil { |
| | | //初始化word |
| | | public static PlcParameterObject initword(String jsonFilePath) { |
| | | try { |
| | | FileReader fileReader = new FileReader(jsonFilePath); |
| | | BufferedReader bufferedReader = new BufferedReader(fileReader); |
| | | |
| | | StringBuilder content = new StringBuilder(); |
| | | String line; |
| | | |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | | content.append(line); |
| | | } |
| | | |
| | | bufferedReader.close(); |
| | | fileReader.close(); |
| | | |
| | | JSONObject jsonfileobj = new JSONObject(content.toString()); |
| | | JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor"); |
| | | PlcParameterObject plcParameterObject = new PlcParameterObject(); |
| | | plcParameterObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址 |
| | | plcParameterObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度 |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject parameterObj = jsonArray.getJSONObject(i); |
| | | PlcParameterInfo plcParameterInfo = new PlcParameterInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例 |
| | | String codeid = parameterObj.getStr("codeId"); |
| | | plcParameterInfo.setCodeId(codeid); |
| | | plcParameterInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex"))); |
| | | //plcParameterInfo.setRatio(Integer.valueOf(parameterObj.getStr("ratio"))); |
| | | plcParameterInfo.setAddressLength(Integer.valueOf(parameterObj.getStr("addressLenght"))); |
| | | plcParameterInfo.setUnit(parameterObj.getStr("unit")); |
| | | plcParameterObject.addPlcParameter(plcParameterInfo); |
| | | } |
| | | // byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02}; |
| | | // byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength()); |
| | | // plcParameterObject.setPlcParameterList(getplcvlues); |
| | | |
| | | return plcParameterObject; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //初始化bit |
| | | public static PlcBitObject initbit(String jsonFilePath) { |
| | | PlcBitObject plcBitObject = new PlcBitObject(); |
| | | |
| | | try { |
| | | FileReader fileReader = new FileReader(jsonFilePath); |
| | | BufferedReader bufferedReader = new BufferedReader(fileReader); |
| | | |
| | | StringBuilder content = new StringBuilder(); |
| | | String line; |
| | | |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | | content.append(line); |
| | | } |
| | | |
| | | bufferedReader.close(); |
| | | fileReader.close(); |
| | | |
| | | JSONObject jsonfileobj = new JSONObject(content.toString()); |
| | | JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor"); |
| | | plcBitObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址 |
| | | plcBitObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度 |
| | | |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject parameterObj = jsonArray.getJSONObject(i); |
| | | |
| | | PlcBitInfo plcBitInfo = new PlcBitInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例 |
| | | String codeid = parameterObj.getStr("codeId"); |
| | | plcBitInfo.setCodeId(codeid); |
| | | plcBitInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex"))); |
| | | |
| | | plcBitObject.addPlcBit(plcBitInfo); |
| | | } |
| | | System.out.println(""); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //Boolean[] values1 = { false, true, true, true, false, false, true, false, |
| | | // false, true ,true }; |
| | | // List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1)); |
| | | |
| | | // List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength()); |
| | | // plcBitObject.setPlcBitList(getplcvlues); |
| | | return plcBitObject; |
| | | } |
| | | |
| | | // |
| | | public static void readAndUpdateBitValues(PlcBitObject plcBitObject) { |
| | | |
| | | Boolean[] values1 = {false, true, true, true, false, false, true, false, |
| | | false, true, true}; |
| | | List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1)); |
| | | //List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength()); |
| | | plcBitObject.setPlcBitList(getplcvlues); |
| | | } |
| | | |
| | | |
| | | public static void readAndUpdateWordValues(PlcParameterObject plcParameterObject) { |
| | | |
| | | byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x03}; |
| | | // byte[] getplcvlues = MockS7PLC.getInstance().readByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength()); |
| | | plcParameterObject.setPlcParameterList(getplcvlues); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class S7control { |
| | | |
| | | S7PLC s7PLC; // PLC通讯类实例 |
| | | |
| | | public S7control(EPlcType plcType, String ip, int port, int rack, int slot) { |
| | | if (s7PLC == null) { |
| | | s7PLC = new S7PLC(plcType, ip, port, 0, 0); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 关闭西门子s7通讯连接 |
| | | */ |
| | | public void CloseS7client() { |
| | | if (s7PLC == null) { |
| | | s7PLC.close(); |
| | | } |
| | | s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * s7通讯连接状态 |
| | | */ |
| | | public boolean CheckConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个word |
| | | * |
| | | * @param address 地址 |
| | | * @param data word的值 |
| | | */ |
| | | public void WriteWord(String address, short data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeInt16(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteWord(String address, List<Short> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 16); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addInt16(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个Bit |
| | | * |
| | | * @param address 地址 |
| | | * @param data Bit的值 |
| | | */ |
| | | public void WriteBit(String address, Boolean data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeBoolean(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas bit的值 |
| | | */ |
| | | public void WriteBit(List<String> address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < address.size(); i++) { |
| | | addressWrite.addBoolean(address.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteBit(String address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 1); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addBoolean(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个byte |
| | | * |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | s7PLC.writeByte(address, datas); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(List<String> address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | try { |
| | | return s7PLC.readInt16(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | | |
| | | // 可以解析出地址中的数字部分,并转换为整数 |
| | | return 0; |
| | | } |
| | | |
| | | private String getAddressFromIndex(int index) { |
| | | |
| | | // 整数转换为地址格式的字符串 |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个word |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | |
| | | try { |
| | | return s7PLC.readByte(address, count); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 按bit位 0 flase 1 true 读取结果 |
| | | * |
| | | * @param addresslist 地址集 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(List<String> addresslist) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | return s7PLC.readBoolean(addresslist); |
| | | } |
| | | |
| | | //读取不连续地址bit |
| | | public List<Boolean> readBits(List<String> addressList) { |
| | | if (s7PLC == null || addressList.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | List<Boolean> values = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | boolean value = s7PLC.readBoolean(address); |
| | | values.add(value); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | return values; |
| | | } |
| | | |
| | | |
| | | //读取String |
| | | public List<String> readStrings(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //不连续地址写入Word |
| | | public void WriteWord(List<String> address, List<Short> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < address.size(); i++) { |
| | | String addr = address.get(i); |
| | | short data = datas.get(i); |
| | | |
| | | if (addr.contains("-")) { |
| | | outmesid(String.valueOf(data), addr); // 单独处理带破折号的地址 |
| | | } else { |
| | | s7PLC.writeInt16(addr, data); // 将数据写入单个地址 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //字符串写入 |
| | | public void outmesid(String data, String addr) { |
| | | // System.out.println("outmesid: " + data); |
| | | List<Byte> glassidlist = new ArrayList<>(); |
| | | String[] parts = addr.split("-"); |
| | | if (parts.length == 2) { |
| | | addr = parts[0]; // 只保留 "-" 前面的部分 |
| | | } |
| | | for (char iditem : data.toCharArray()) { |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | WriteByte(addr, bytes); |
| | | } |
| | | |
| | | //读取不连续word |
| | | public List<Short> readWords(List<String> addresses) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | try { |
| | | |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | } |
| | | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | //读取时间 |
| | | public Long readtime(String address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | return s7PLC.readTime(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void writetime(String address, long datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | |
| | | s7PLC.writeTime(address, datas); // 将数据写入单个地址 |
| | | } |
| | | |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 从指定的地址开始 连续按bit位读取 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 长度 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | List<String> addresslist = GetAddressList(address, count, 1); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | ; |
| | | |
| | | |
| | | private List<String> GetAddressList(String address, int count, int addedbit) { |
| | | List<String> addresslist = new ArrayList<String>(); |
| | | |
| | | String[] stringdatas = address.trim().split("\\."); |
| | | if (stringdatas.length < 2 || !address.startsWith("DB")) { |
| | | return null; |
| | | } |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 2) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | } else if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | addresslist.add(address); |
| | | for (int i = 0; i < count - 1; i++) { |
| | | |
| | | int bitcurrent = bitindex + addedbit; |
| | | if (bitcurrent > 7) { |
| | | dbwindex += bitcurrent / 8; |
| | | bitindex = 0; |
| | | } else { |
| | | bitindex = bitcurrent; |
| | | } |
| | | |
| | | String endstr = stringdatas.length == 3 ? "." + bitindex : ""; |
| | | addresslist.add(stringdatas[0] + "." + dbwindex + endstr); |
| | | } |
| | | return addresslist; |
| | | } |
| | | } |
| | |
| | | * 原片使用情况表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | private Long id; |
| | | |
| | | /** |
| | | * 工程号 |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | |
| | | |
| | | public final class MD5 { |
| | | |
| | | public static String encrypt(String strSrc) { |
| | | try { |
| | | char hexChars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', |
| | | '9', 'a', 'b', 'c', 'd', 'e', 'f'}; |
| | | byte[] bytes = strSrc.getBytes(); |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | md.update(bytes); |
| | | bytes = md.digest(); |
| | | int j = bytes.length; |
| | | char[] chars = new char[j * 2]; |
| | | int k = 0; |
| | | for (int i = 0; i < bytes.length; i++) { |
| | | byte b = bytes[i]; |
| | | chars[k++] = hexChars[b >>> 4 & 0xf]; |
| | | chars[k++] = hexChars[b & 0xf]; |
| | | } |
| | | return new String(chars); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("MD5加密出错!!+" + e); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(MD5.encrypt("111111")); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.http.HttpStatus; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/8 15:46 |
| | | * @Description: |
| | | */ |
| | | public class ResponseUtil { |
| | | |
| | | public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8"; |
| | | |
| | | public static void out(HttpServletResponse response, Result r) { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setContentType(APPLICATION_JSON_UTF8_VALUE); |
| | | try { |
| | | mapper.writeValue(response.getWriter(), r); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class Result<T> { |
| | | private Integer code; |
| | | private String message; |
| | | private T data; |
| | | |
| | | private Result() { |
| | | |
| | | } |
| | | |
| | | public static <T> Result<T> build(Integer code, String message, T data) { |
| | | Result<T> result = new Result<T>(); |
| | | result.setCode(code); |
| | | result.setMessage(message); |
| | | if (data != null) { |
| | | result.setData(data); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static <T> Result<T> build(ResultCodeEnum resultCodeEnum, T data) { |
| | | Result<T> result = new Result<T>(); |
| | | result.setCode(resultCodeEnum.getCode()); |
| | | result.setMessage(resultCodeEnum.getMessage()); |
| | | if (data != null) { |
| | | result.setData(data); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public static <T> Result<T> success() { |
| | | return build(ResultCodeEnum.SUCCESS, null); |
| | | } |
| | | |
| | | public static <T> Result<T> success(T data) { |
| | | return build(ResultCodeEnum.SUCCESS.getCode(), "", data); |
| | | } |
| | | |
| | | |
| | | public static Result error(Integer code, String msg) { |
| | | return build(code, msg, null); |
| | | } |
| | | |
| | | public static <T> Result<T> error(T data) { |
| | | return build(ResultCodeEnum.FAIL.getCode(), "", data); |
| | | } |
| | | |
| | | public static <T> Result<T> error() { |
| | | return build(ResultCodeEnum.FAIL.getCode(), "服务器发生异常", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.utils; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author zhoush |
| | | */ |
| | | |
| | | @Getter |
| | | public enum ResultCodeEnum { |
| | | |
| | | SUCCESS(200, "成功"), |
| | | FAIL(201, "失败"), |
| | | SERVICE_ERROR(2012, "服务异常"), |
| | | DATA_ERROR(204, "数据异常"), |
| | | ILLEGAL_REQUEST(205, "非法请求"), |
| | | REPEAT_SUBMIT(206, "重复提交"), |
| | | |
| | | LOGIN_AUTH(208, "未登陆"), |
| | | PERMISSION(209, "没有权限"), |
| | | |
| | | |
| | | ; |
| | | |
| | | private Integer code; |
| | | |
| | | private String message; |
| | | |
| | | ResultCodeEnum(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | } |
New file |
| | |
| | | ________ ________ ___ _____________ ____ |
| | | `MMMMMMMb. 68b `MMMMMMMb. `MMb dMM'`MMMMMMMMM 6MMMMb\ |
| | | MM `Mb Y89 MM `Mb MMM. ,PMM MM \ 6M' ` |
| | | MM MM ____ ___ MM MM _____ M`Mb d'MM MM MM |
| | | MM .M9 6MMMMb `MM MM .M9 6MMMMMb M YM. ,P MM MM , YM. |
| | | MMMMMMM( 6M' `Mb MM MMMMMMM( 6M' `Mb M `Mb d' MM MMMMMMM YMMMMb |
| | | MM `Mb MM MM MM MM `Mb MM MM M YM.P MM MM ` `Mb |
| | | MM MM MMMMMMMM MM MM MM MM MM M `Mb' MM MM MM |
| | | MM MM MM MM MM MM MM MM M YP MM MM MM |
| | | MM .M9 YM d9 MM MM .M9 YM. ,M9 68b M `' MM MM / L ,M9 |
| | | _MMMMMMM9' YMMMM9 _MM__MMMMMMM9' YMMMMM9 Y89 _M_ _MM__MMMMMMMMM MYMMMM9 |
| | | |
| | | // _ooOoo_ // |
| | | // o8888888o // |
| | | // 88" . "88 // |
| | | // (| ^_^ |) // |
| | | // O\ = /O // |
| | | // ____/`---'\____ // |
| | | // .' \\| |// `. // |
| | | // / \\||| : |||// \ // |
| | | // / _||||| -:- |||||- \ // |
| | | // | | \\\ - /// | | // |
| | | // | \_| ''\---/'' | | // |
| | | // \ .-\__ `-` ___/-. / // |
| | | // ___`. .' /--.--\ `. . ___ // |
| | | // ."" '< `.___\_<|>_/___.' >'"". // |
| | | // | | : `- \`.;`\ _ /`;.`/ - ` : | | // |
| | | // \ \ `-. \_ __\ /__ _/ .-` / / // |
| | | // ========`-.____`-.___\_____/___.-`____.-'======== // |
| | | // `=---=' // |
| | | // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // |
| | | // 佛祖保佑 永不宕机 永无BUG // |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>common</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>springsecurity</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>servicebase</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <!-- Spring Security依赖 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-security</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | <version>0.9.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import com.mes.common.utils.FastJsonRedisSerializer; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 19:13 |
| | | * @Description: |
| | | */ |
| | | @Configuration |
| | | public class RedisConfig { |
| | | |
| | | @Bean |
| | | @SuppressWarnings(value = {"unchecked", "rawtypes"}) |
| | | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) { |
| | | RedisTemplate<Object, Object> template = new RedisTemplate<>(); |
| | | template.setConnectionFactory(connectionFactory); |
| | | |
| | | FastJsonRedisSerializer serializer = new FastJsonRedisSerializer(Object.class); |
| | | |
| | | // 使用StringRedisSerializer来序列化和反序列化redis的key值 |
| | | template.setKeySerializer(new StringRedisSerializer()); |
| | | template.setValueSerializer(serializer); |
| | | |
| | | // Hash的key也采用StringRedisSerializer的序列化方式 |
| | | template.setHashKeySerializer(new StringRedisSerializer()); |
| | | template.setHashValueSerializer(serializer); |
| | | |
| | | template.afterPropertiesSet(); |
| | | return template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | |
| | | import com.mes.common.filter.JwtAuthenticationTokenFilter; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
| | | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | import org.springframework.security.config.http.SessionCreationPolicy; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | |
| | | @Configuration |
| | | //@EnableWebSecurity |
| | | @EnableGlobalMethodSecurity(prePostEnabled = true) |
| | | public class TokenWebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | @Autowired |
| | | private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; |
| | | |
| | | @Bean |
| | | public PasswordEncoder passwordEncoder() { |
| | | return new BCryptPasswordEncoder(); |
| | | } |
| | | |
| | | /** |
| | | * 配置过滤规则 |
| | | */ |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | http |
| | | //关闭csrf |
| | | .csrf().disable() |
| | | //不通过Session获取SecurityContext |
| | | .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) |
| | | .and() |
| | | .authorizeRequests() |
| | | // 对于登录接口 允许匿名访问 |
| | | .antMatchers("/userinfo/login").anonymous() |
| | | .antMatchers("/hello").permitAll() |
| | | // 除上面外的所有请求全部需要鉴权认证 |
| | | .anyRequest().permitAll(); |
| | | // http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); |
| | | } |
| | | |
| | | @Bean |
| | | @Override |
| | | public AuthenticationManager authenticationManagerBean() throws Exception { |
| | | return super.authenticationManagerBean(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.filter; |
| | | |
| | | import com.mes.common.utils.JwtUtil; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.menu.mapper.SysMenuMapper; |
| | | import com.mes.userinfo.entity.LoginUser; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.filter.OncePerRequestFilter; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/10 9:42 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { |
| | | // 此处解释为什么不去实现Filter接口,因为在某些情况下会过滤两次,执行两次Filter里面的方法,所以我们选择继承SpringSecurity中的OncePerRequestFilter |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private SysMenuMapper menuMapper; |
| | | |
| | | @Override |
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { |
| | | //获取token |
| | | String token = request.getHeader("token"); |
| | | if (!StringUtils.hasText(token)) { |
| | | //放行 |
| | | filterChain.doFilter(request, response); |
| | | return; // 此处加上return好处是后面结果返回的时候就不会再走一遍此过滤器的方法了 |
| | | } |
| | | //解析token |
| | | String userid; |
| | | try { |
| | | Claims claims = JwtUtil.parseJWT(token); |
| | | userid = claims.getSubject(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("token非法"); |
| | | } |
| | | //从redis中获取用户信息 |
| | | String redisKey = "login:" + userid; |
| | | LoginUser loginUser = redisUtil.getCacheObject(redisKey); |
| | | if (Objects.isNull(loginUser)) { |
| | | throw new RuntimeException("用户未登录"); |
| | | } |
| | | //存入SecurityContextHolder,以供后面的过滤器使用 |
| | | List<String> permissionKeyList = menuMapper.selectPermsByUserId(Long.parseLong(userid)); |
| | | List<GrantedAuthority> authorities = permissionKeyList.stream(). |
| | | map(SimpleGrantedAuthority::new) |
| | | .collect(Collectors.toList()); |
| | | UsernamePasswordAuthenticationToken authenticationToken = |
| | | new UsernamePasswordAuthenticationToken(loginUser, null, authorities); |
| | | SecurityContextHolder.getContext().setAuthentication(authenticationToken); |
| | | //放行 |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.mes.common.utils.WebUtils; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.security.access.AccessDeniedException; |
| | | import org.springframework.security.web.access.AccessDeniedHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/12 10:38 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | public class AccessDeniedHandlerImpl implements AccessDeniedHandler { |
| | | @Override |
| | | public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { |
| | | Result result = Result.error(HttpStatus.FORBIDDEN.value(), "权限不足"); |
| | | String json = JSON.toJSONString(result); |
| | | WebUtils.renderString(response, json); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.handler; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.mes.common.utils.WebUtils; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.web.AuthenticationEntryPoint; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/12 10:38 |
| | | * @Description: |
| | | */ |
| | | @Component |
| | | public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint { |
| | | @Override |
| | | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { |
| | | Result result = Result.error(HttpStatus.UNAUTHORIZED.value(), "认证失败请重新登录"); |
| | | String json = JSON.toJSONString(result); |
| | | WebUtils.renderString(response, json); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.parser.ParserConfig; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.fasterxml.jackson.databind.JavaType; |
| | | import com.fasterxml.jackson.databind.type.TypeFactory; |
| | | import org.springframework.data.redis.serializer.RedisSerializer; |
| | | import org.springframework.data.redis.serializer.SerializationException; |
| | | |
| | | import java.nio.charset.Charset; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/11 15:28 |
| | | * @Description: |
| | | */ |
| | | public class FastJsonRedisSerializer<T> implements RedisSerializer<T> { |
| | | |
| | | public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); |
| | | |
| | | private Class<T> clazz; |
| | | |
| | | static { |
| | | ParserConfig.getGlobalInstance().setAutoTypeSupport(true); |
| | | } |
| | | |
| | | public FastJsonRedisSerializer(Class<T> clazz) { |
| | | super(); |
| | | this.clazz = clazz; |
| | | } |
| | | |
| | | @Override |
| | | public byte[] serialize(T t) throws SerializationException { |
| | | if (t == null) { |
| | | return new byte[0]; |
| | | } |
| | | return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); |
| | | } |
| | | |
| | | @Override |
| | | public T deserialize(byte[] bytes) throws SerializationException { |
| | | if (bytes == null || bytes.length <= 0) { |
| | | return null; |
| | | } |
| | | String str = new String(bytes, DEFAULT_CHARSET); |
| | | |
| | | return JSON.parseObject(str, clazz); |
| | | } |
| | | |
| | | |
| | | protected JavaType getJavaType(Class<?> clazz) { |
| | | return TypeFactory.defaultInstance().constructType(clazz); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | |
| | | import io.jsonwebtoken.Claims; |
| | | import io.jsonwebtoken.JwtBuilder; |
| | | import io.jsonwebtoken.Jwts; |
| | | import io.jsonwebtoken.SignatureAlgorithm; |
| | | |
| | | import javax.crypto.SecretKey; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.util.Base64; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 19:15 |
| | | * @Description: |
| | | */ |
| | | public class JwtUtil { |
| | | |
| | | //有效期为 |
| | | public static final Long JWT_TTL = 60 * 60 * 1000L;// 60 * 60 *1000 一个小时 |
| | | //设置秘钥明文 |
| | | public static final String JWT_KEY = "sangeng"; |
| | | |
| | | public static String getUUID() { |
| | | String token = UUID.randomUUID().toString().replaceAll("-", ""); |
| | | return token; |
| | | } |
| | | |
| | | /** |
| | | * 生成jtw |
| | | * |
| | | * @param subject token中要存放的数据(json格式) |
| | | * @return |
| | | */ |
| | | public static String createJWT(String subject) { |
| | | JwtBuilder builder = getJwtBuilder(subject, null, getUUID());// 设置过期时间 |
| | | return builder.compact(); |
| | | } |
| | | |
| | | /** |
| | | * 生成jtw |
| | | * |
| | | * @param subject token中要存放的数据(json格式) |
| | | * @param ttlMillis token超时时间 |
| | | * @return |
| | | */ |
| | | public static String createJWT(String subject, Long ttlMillis) { |
| | | JwtBuilder builder = getJwtBuilder(subject, ttlMillis, getUUID());// 设置过期时间 |
| | | return builder.compact(); |
| | | } |
| | | |
| | | private static JwtBuilder getJwtBuilder(String subject, Long ttlMillis, String uuid) { |
| | | SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; |
| | | SecretKey secretKey = generalKey(); |
| | | long nowMillis = System.currentTimeMillis(); |
| | | Date now = new Date(nowMillis); |
| | | if (ttlMillis == null) { |
| | | ttlMillis = JwtUtil.JWT_TTL; |
| | | } |
| | | long expMillis = nowMillis + ttlMillis; |
| | | Date expDate = new Date(expMillis); |
| | | return Jwts.builder() |
| | | .setId(uuid) //唯一的ID |
| | | .setSubject(subject) // 主题 可以是JSON数据 |
| | | .setIssuer("sg") // 签发者 |
| | | .setIssuedAt(now) // 签发时间 |
| | | .signWith(signatureAlgorithm, secretKey) //使用HS256对称加密算法签名, 第二个参数为秘钥 |
| | | .setExpiration(expDate); |
| | | } |
| | | |
| | | /** |
| | | * 创建token |
| | | * |
| | | * @param id |
| | | * @param subject |
| | | * @param ttlMillis |
| | | * @return |
| | | */ |
| | | public static String createJWT(String id, String subject, Long ttlMillis) { |
| | | JwtBuilder builder = getJwtBuilder(subject, ttlMillis, id);// 设置过期时间 |
| | | return builder.compact(); |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | String token = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJjYWM2ZDVhZi1mNjVlLTQ0MDAtYjcxMi0zYWEwOGIyOTIwYjQiLCJzdWIiOiJzZyIsImlzcyI6InNnIiwiaWF0IjoxNjM4MTA2NzEyLCJleHAiOjE2MzgxMTAzMTJ9.JVsSbkP94wuczb4QryQbAke3ysBDIL5ou8fWsbt_ebg"; |
| | | Claims claims = parseJWT(token); |
| | | System.out.println(claims); |
| | | } |
| | | |
| | | /** |
| | | * 生成加密后的秘钥 secretKey |
| | | * |
| | | * @return |
| | | */ |
| | | public static SecretKey generalKey() { |
| | | byte[] encodedKey = Base64.getDecoder().decode(JwtUtil.JWT_KEY); |
| | | SecretKey key = new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES"); |
| | | return key; |
| | | } |
| | | |
| | | /** |
| | | * 解析 |
| | | * |
| | | * @param jwt |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static Claims parseJWT(String jwt) throws Exception { |
| | | SecretKey secretKey = generalKey(); |
| | | return Jwts.parser() |
| | | .setSigningKey(secretKey) |
| | | .parseClaimsJws(jwt) |
| | | .getBody(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.BoundSetOperations; |
| | | import org.springframework.data.redis.core.HashOperations; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * spring redis 工具类 |
| | | **/ |
| | | @Component |
| | | public class RedisUtil { |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value) { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | } |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | * @param timeout 时间 |
| | | * @param timeUnit 时间颗粒度 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) { |
| | | redisTemplate.opsForValue().set(key, value, timeout, timeUnit); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout) { |
| | | return expire(key, timeout, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @param unit 时间单位 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout, final TimeUnit unit) { |
| | | return redisTemplate.expire(key, timeout, unit); |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象。 |
| | | * |
| | | * @param key 缓存键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> T getCacheObject(final String key) { |
| | | ValueOperations<String, T> operation = redisTemplate.opsForValue(); |
| | | return operation.get(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除单个对象 |
| | | * |
| | | * @param key |
| | | */ |
| | | public boolean deleteObject(final String key) { |
| | | return redisTemplate.delete(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除集合对象 |
| | | * |
| | | * @param collection 多个对象 |
| | | * @return |
| | | */ |
| | | public long deleteObject(final Collection collection) { |
| | | return redisTemplate.delete(collection); |
| | | } |
| | | |
| | | /** |
| | | * 缓存List数据 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param dataList 待缓存的List数据 |
| | | * @return 缓存的对象 |
| | | */ |
| | | public <T> long setCacheList(final String key, final List<T> dataList) { |
| | | Long count = redisTemplate.opsForList().rightPushAll(key, dataList); |
| | | return count == null ? 0 : count; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的list对象 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> List<T> getCacheList(final String key) { |
| | | return redisTemplate.opsForList().range(key, 0, -1); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Set |
| | | * |
| | | * @param key 缓存键值 |
| | | * @param dataSet 缓存的数据 |
| | | * @return 缓存数据的对象 |
| | | */ |
| | | public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) { |
| | | BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); |
| | | Iterator<T> it = dataSet.iterator(); |
| | | while (it.hasNext()) { |
| | | setOperation.add(it.next()); |
| | | } |
| | | return setOperation; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的set |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Set<T> getCacheSet(final String key) { |
| | | return redisTemplate.opsForSet().members(key); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Map |
| | | * |
| | | * @param key |
| | | * @param dataMap |
| | | */ |
| | | public <T> void setCacheMap(final String key, final Map<String, T> dataMap) { |
| | | if (dataMap != null) { |
| | | redisTemplate.opsForHash().putAll(key, dataMap); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的Map |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Map<String, T> getCacheMap(final String key) { |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } |
| | | |
| | | /** |
| | | * 往Hash中存入数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @param value 值 |
| | | */ |
| | | public <T> void setCacheMapValue(final String key, final String hKey, final T value) { |
| | | redisTemplate.opsForHash().put(key, hKey, value); |
| | | } |
| | | |
| | | /** |
| | | * 获取Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @return Hash中的对象 |
| | | */ |
| | | public <T> T getCacheMapValue(final String key, final String hKey) { |
| | | HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); |
| | | return opsForHash.get(key, hKey); |
| | | } |
| | | |
| | | /** |
| | | * 删除Hash中的数据 |
| | | * |
| | | * @param key |
| | | * @param hkey |
| | | */ |
| | | public void delCacheMapValue(final String key, final String hkey) { |
| | | HashOperations hashOperations = redisTemplate.opsForHash(); |
| | | hashOperations.delete(key, hkey); |
| | | } |
| | | |
| | | /** |
| | | * 获取多个Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKeys Hash键集合 |
| | | * @return Hash对象集合 |
| | | */ |
| | | public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) { |
| | | return redisTemplate.opsForHash().multiGet(key, hKeys); |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象列表 |
| | | * |
| | | * @param pattern 字符串前缀 |
| | | * @return 对象列表 |
| | | */ |
| | | public Collection<String> keys(final String pattern) { |
| | | return redisTemplate.keys(pattern); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common.utils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 19:16 |
| | | * @Description: |
| | | */ |
| | | public class WebUtils { |
| | | /** |
| | | * 将字符串渲染到客户端 |
| | | * |
| | | * @param response 渲染对象 |
| | | * @param string 待渲染的字符串 |
| | | * @return null |
| | | */ |
| | | public static String renderString(HttpServletResponse response, String string) { |
| | | try { |
| | | response.setStatus(200); |
| | | response.setContentType("application/json"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.getWriter().print(string); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | //package com.mes.config; |
| | | // |
| | | // |
| | | //import com.mes.filter.TokenAuthFilter; |
| | | //import com.mes.filter.TokenLoginFilter; |
| | | //import com.mes.security.DefaultPasswordEncoder; |
| | | //import com.mes.security.TokenLogoutHandler; |
| | | //import com.mes.security.TokenManager; |
| | | //import com.mes.security.UnauthEntryPoint; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.context.annotation.Configuration; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; |
| | | //import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
| | | //import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| | | //import org.springframework.security.config.annotation.web.builders.WebSecurity; |
| | | //import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
| | | //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | //import org.springframework.security.core.userdetails.UserDetailsService; |
| | | // |
| | | //@Configuration |
| | | //@EnableWebSecurity |
| | | //@EnableGlobalMethodSecurity(prePostEnabled = true) |
| | | //public class TokenWebSecurityConfig extends WebSecurityConfigurerAdapter { |
| | | // |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // private DefaultPasswordEncoder defaultPasswordEncoder; |
| | | // private UserDetailsService userDetailsService; |
| | | // |
| | | // @Autowired |
| | | // public TokenWebSecurityConfig(UserDetailsService userDetailsService, DefaultPasswordEncoder defaultPasswordEncoder, |
| | | // TokenManager tokenManager, RedisTemplate redisTemplate) { |
| | | // this.userDetailsService = userDetailsService; |
| | | // this.defaultPasswordEncoder = defaultPasswordEncoder; |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 配置设置 |
| | | // * @param http |
| | | // * @throws Exception |
| | | // */ |
| | | // //设置退出的地址和token,redis操作地址 |
| | | // @Override |
| | | // protected void configure(HttpSecurity http) throws Exception { |
| | | // http.exceptionHandling() |
| | | // .authenticationEntryPoint(new UnauthEntryPoint())//没有权限访问 |
| | | // .and().csrf().disable() |
| | | // .authorizeRequests() |
| | | // .anyRequest().authenticated() |
| | | // .and().logout().logoutUrl("/admin/acl/index/logout")//退出路径 |
| | | // .addLogoutHandler(new TokenLogoutHandler(tokenManager,redisTemplate)).and() |
| | | // .addFilter(new TokenLoginFilter(authenticationManager(), tokenManager, redisTemplate)) |
| | | // .addFilter(new TokenAuthFilter(authenticationManager(), tokenManager, redisTemplate)).httpBasic(); |
| | | // } |
| | | // |
| | | // //调用userDetailsService和密码处理 |
| | | // @Override |
| | | // public void configure(AuthenticationManagerBuilder auth) throws Exception { |
| | | // auth.userDetailsService(userDetailsService).passwordEncoder(defaultPasswordEncoder); |
| | | // } |
| | | // //不进行认证的路径,可以直接访问 |
| | | // @Override |
| | | // public void configure(WebSecurity web) throws Exception { |
| | | // web.ignoring().antMatchers("/api/**"); |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.mes.entity; |
| | | // |
| | | //import lombok.Data; |
| | | //import org.springframework.security.core.GrantedAuthority; |
| | | //import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | //import org.springframework.security.core.userdetails.UserDetails; |
| | | //import org.springframework.util.StringUtils; |
| | | // |
| | | //import java.util.ArrayList; |
| | | //import java.util.Collection; |
| | | //import java.util.List; |
| | | // |
| | | //@Data |
| | | //public class SecurityUser implements UserDetails { |
| | | // |
| | | // //当前登录用户 |
| | | // private transient User currentUserInfo; |
| | | // |
| | | // //当前权限 |
| | | // private List<String> permissionValueList; |
| | | // |
| | | // public SecurityUser() { |
| | | // } |
| | | // |
| | | // public SecurityUser(User user) { |
| | | // if (user != null) { |
| | | // this.currentUserInfo = user; |
| | | // } |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Collection<? extends GrantedAuthority> getAuthorities() { |
| | | // Collection<GrantedAuthority> authorities = new ArrayList<>(); |
| | | // for(String permissionValue : permissionValueList) { |
| | | // if(StringUtils.isEmpty(permissionValue)) continue; |
| | | // SimpleGrantedAuthority authority = new SimpleGrantedAuthority(permissionValue); |
| | | // authorities.add(authority); |
| | | // } |
| | | // |
| | | // return authorities; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public String getPassword() { |
| | | // return currentUserInfo.getPassword(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public String getUsername() { |
| | | // return currentUserInfo.getUsername(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isAccountNonExpired() { |
| | | // return true; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isAccountNonLocked() { |
| | | // return true; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isCredentialsNonExpired() { |
| | | // return true; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public boolean isEnabled() { |
| | | // return true; |
| | | // } |
| | | //} |
| | | // |
New file |
| | |
| | | //package com.mes.entity; |
| | | // |
| | | //import io.swagger.annotations.ApiModel; |
| | | //import io.swagger.annotations.ApiModelProperty; |
| | | //import lombok.Data; |
| | | // |
| | | //import java.io.Serializable; |
| | | // |
| | | //@Data |
| | | //@ApiModel(description = "用户实体类") |
| | | //public class User implements Serializable { |
| | | // |
| | | // private static final long serialVersionUID = 1L; |
| | | // |
| | | // @ApiModelProperty(value = "微信openid") |
| | | // private String username; |
| | | // |
| | | // @ApiModelProperty(value = "密码") |
| | | // private String password; |
| | | // |
| | | // @ApiModelProperty(value = "昵称") |
| | | // private String nickName; |
| | | // |
| | | // @ApiModelProperty(value = "用户头像") |
| | | // private String salt; |
| | | // |
| | | // @ApiModelProperty(value = "用户签名") |
| | | // private String token; |
| | | // |
| | | //} |
| | | // |
New file |
| | |
| | | //package com.mes.filter; |
| | | // |
| | | //import com.mes.security.TokenManager; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.authentication.AuthenticationManager; |
| | | //import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | //import org.springframework.security.core.GrantedAuthority; |
| | | //import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | //import org.springframework.security.core.context.SecurityContextHolder; |
| | | //import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; |
| | | // |
| | | //import javax.servlet.FilterChain; |
| | | //import javax.servlet.ServletException; |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | //import java.util.ArrayList; |
| | | //import java.util.Collection; |
| | | //import java.util.List; |
| | | // |
| | | //public class TokenAuthFilter extends BasicAuthenticationFilter { |
| | | // |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // public TokenAuthFilter(AuthenticationManager authenticationManager,TokenManager tokenManager,RedisTemplate redisTemplate) { |
| | | // super(authenticationManager); |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // } |
| | | // |
| | | // @Override |
| | | // protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { |
| | | // //获取当前认证成功用户权限信息 |
| | | // UsernamePasswordAuthenticationToken authRequest = getAuthentication(request); |
| | | // //判断如果有权限信息,放到权限上下文中 |
| | | // if(authRequest != null) { |
| | | // SecurityContextHolder.getContext().setAuthentication(authRequest); |
| | | // } |
| | | // chain.doFilter(request,response); |
| | | // } |
| | | // |
| | | // private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request) { |
| | | // //从header获取token |
| | | // String token = request.getHeader("token"); |
| | | // if(token != null) { |
| | | // //从token获取用户名 |
| | | // String username = tokenManager.getUserInfoFromToken(token); |
| | | // //从redis获取对应权限列表 |
| | | // List<String> permissionValueList = (List<String>)redisTemplate.opsForValue().get(username); |
| | | // Collection<GrantedAuthority> authority = new ArrayList<>(); |
| | | // for(String permissionValue : permissionValueList) { |
| | | // SimpleGrantedAuthority auth = new SimpleGrantedAuthority(permissionValue); |
| | | // authority.add(auth); |
| | | // } |
| | | // return new UsernamePasswordAuthenticationToken(username,token,authority); |
| | | // } |
| | | // return null; |
| | | // } |
| | | // |
| | | //} |
New file |
| | |
| | | //package com.mes.filter; |
| | | // |
| | | //import com.fasterxml.jackson.databind.ObjectMapper; |
| | | //import com.mes.utils.Result; |
| | | //import com.mes.entity.SecurityUser; |
| | | //import com.mes.entity.User; |
| | | //import com.mes.security.TokenManager; |
| | | //import com.mes.utils.ResponseUtil; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.authentication.AuthenticationManager; |
| | | //import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | //import org.springframework.security.core.Authentication; |
| | | //import org.springframework.security.core.AuthenticationException; |
| | | //import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| | | //import org.springframework.security.web.util.matcher.AntPathRequestMatcher; |
| | | // |
| | | //import javax.servlet.FilterChain; |
| | | //import javax.servlet.ServletException; |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | //import java.util.ArrayList; |
| | | // |
| | | //public class TokenLoginFilter extends UsernamePasswordAuthenticationFilter { |
| | | // |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // private AuthenticationManager authenticationManager; |
| | | // |
| | | // public TokenLoginFilter(AuthenticationManager authenticationManager, TokenManager tokenManager, RedisTemplate redisTemplate) { |
| | | // this.authenticationManager = authenticationManager; |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // this.setPostOnly(false); |
| | | // this.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/admin/acl/login","POST")); |
| | | // } |
| | | // |
| | | // //1 获取表单提交用户名和密码 |
| | | // @Override |
| | | // public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) |
| | | // throws AuthenticationException { |
| | | // //获取表单提交数据 |
| | | // try { |
| | | // User user = new ObjectMapper().readValue(request.getInputStream(), User.class); |
| | | // return authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(user.getUsername(),user.getPassword(), |
| | | // new ArrayList<>())); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // throw new RuntimeException(); |
| | | // } |
| | | // } |
| | | // |
| | | // //2 认证成功调用的方法 |
| | | // @Override |
| | | // protected void successfulAuthentication(HttpServletRequest request, |
| | | // HttpServletResponse response, FilterChain chain, Authentication authResult) |
| | | // throws IOException, ServletException { |
| | | // //认证成功,得到认证成功之后用户信息 |
| | | // SecurityUser user = (SecurityUser)authResult.getPrincipal(); |
| | | // //根据用户名生成token |
| | | // String token = tokenManager.createToken(user.getCurrentUserInfo().getUsername()); |
| | | // //把用户名称和用户权限列表放到redis |
| | | // redisTemplate.opsForValue().set(user.getCurrentUserInfo().getUsername(),user.getPermissionValueList()); |
| | | // //返回token |
| | | // ResponseUtil.out(response, Result.success(token)); |
| | | // } |
| | | // |
| | | // //3 认证失败调用的方法 |
| | | // @Override |
| | | // protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) |
| | | // throws IOException, ServletException { |
| | | // ResponseUtil.out(response, Result.error()); |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.mes.menu.controller; |
| | | |
| | | |
| | | import com.mes.menu.entity.SysMenu; |
| | | import com.mes.menu.service.SysMenuService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @ApiModel("获取菜单信息") |
| | | @RestController |
| | | @RequestMapping("/menu/sysMenu") |
| | | public class SysMenuController { |
| | | |
| | | @Autowired |
| | | SysMenuService sysMenuService; |
| | | |
| | | @ApiOperation("获取用户有权限的所有菜单") |
| | | @GetMapping("/list") |
| | | public Result<List<SysMenu>> getMenuTree() { |
| | | return Result.success(sysMenuService.getMenuTree()); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.menu.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-13 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class SysMenu implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 父id |
| | | */ |
| | | private Integer parentId; |
| | | |
| | | /** |
| | | * 模块名称 |
| | | */ |
| | | private String menuName; |
| | | |
| | | /** |
| | | * 图标 |
| | | */ |
| | | private String icon; |
| | | |
| | | /** |
| | | * 地址 |
| | | */ |
| | | private String url; |
| | | |
| | | /** |
| | | * 语言类型 |
| | | */ |
| | | private String languageType; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private String listSort; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 子菜单 |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<SysMenu> children; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.menu.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.menu.entity.SysMenu; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysMenuMapper extends BaseMapper<SysMenu> { |
| | | |
| | | List<String> selectPermsByUserId(long parseLong); |
| | | } |
New file |
| | |
| | | package com.mes.menu.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.menu.entity.SysMenu; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysMenuService extends IService<SysMenu> { |
| | | |
| | | List<SysMenu> getMenuTree(); |
| | | } |
New file |
| | |
| | | package com.mes.menu.service.impl; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.menu.entity.SysMenu; |
| | | import com.mes.menu.mapper.SysMenuMapper; |
| | | import com.mes.menu.service.SysMenuService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 菜单表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService { |
| | | |
| | | @Override |
| | | public List<SysMenu> getMenuTree() { |
| | | List<SysMenu> menuList = this.baseMapper.selectList(null); |
| | | return create(menuList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将数据库中查询出来的list集合传入此方法即可获得排成树形结构的list集合 |
| | | * |
| | | * @param lists |
| | | * @return |
| | | */ |
| | | public List<SysMenu> create(List<SysMenu> lists) { |
| | | List<SysMenu> deptTreeList = lists.stream() |
| | | .filter(item -> item.getParentId() == 0) |
| | | .map(item -> { |
| | | item.setChildren(getChildren(item, lists)); |
| | | return item; |
| | | }).collect(Collectors.toList()); |
| | | return deptTreeList; |
| | | } |
| | | |
| | | /** |
| | | * 此方法将被递归调用 |
| | | * |
| | | * @param menu |
| | | * @param menus |
| | | * @return |
| | | */ |
| | | private List<SysMenu> getChildren(SysMenu menu, List<SysMenu> menus) { |
| | | List<SysMenu> res = menus.stream() |
| | | .filter(item -> item.getParentId().equals(menu.getId())) |
| | | .map(item -> { |
| | | item.setChildren(getChildren(item, menus)); |
| | | return item; |
| | | }).collect(Collectors.toList()); |
| | | log.info("菜单树:{}", JSONUtil.toJsonStr(res)); |
| | | return res; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/role/sys-role") |
| | | public class SysRoleController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.role.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/role/sys-role-menu") |
| | | public class SysRoleMenuController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.role.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class SysRole implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | private String name; |
| | | |
| | | /** |
| | | * 角色权限字符串 |
| | | */ |
| | | private String roleKey; |
| | | |
| | | /** |
| | | * 角色状态(0正常 1停用) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 删除标志 |
| | | */ |
| | | private Integer delFlag; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class SysRoleMenu implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @TableId(value = "role_id", type = IdType.AUTO) |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 菜单id |
| | | */ |
| | | private Long menuId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.role.entity.SysRole; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysRoleMapper extends BaseMapper<SysRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> { |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.role.mapper.SysRoleMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.role.mapper.SysRoleMenuMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.mes.role.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysRoleMenuService extends IService<SysRoleMenu> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.role.entity.SysRole; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysRoleService extends IService<SysRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.role.entity.SysRoleMenu; |
| | | import com.mes.role.mapper.SysRoleMenuMapper; |
| | | import com.mes.role.service.SysRoleMenuService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements SysRoleMenuService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.role.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.role.entity.SysRole; |
| | | import com.mes.role.mapper.SysRoleMapper; |
| | | import com.mes.role.service.SysRoleService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService { |
| | | |
| | | } |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import com.mes.utils.MD5; |
| | | //import org.springframework.security.crypto.password.PasswordEncoder; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //@Component |
| | | //public class DefaultPasswordEncoder implements PasswordEncoder { |
| | | // |
| | | // public DefaultPasswordEncoder() { |
| | | // this(-1); |
| | | // } |
| | | // public DefaultPasswordEncoder(int strength) { |
| | | // } |
| | | // //进行MD5加密 |
| | | // @Override |
| | | // public String encode(CharSequence charSequence) { |
| | | // return MD5.encrypt(charSequence.toString()); |
| | | // } |
| | | // //进行密码比对 |
| | | // @Override |
| | | // public boolean matches(CharSequence charSequence, String encodedPassword) { |
| | | // return encodedPassword.equals(MD5.encrypt(charSequence.toString())); |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import com.mes.utils.Result; |
| | | //import com.mes.utils.ResponseUtil; |
| | | //import org.springframework.data.redis.core.RedisTemplate; |
| | | //import org.springframework.security.core.Authentication; |
| | | //import org.springframework.security.web.authentication.logout.LogoutHandler; |
| | | // |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | // |
| | | ////退出处理器 |
| | | //public class TokenLogoutHandler implements LogoutHandler { |
| | | // private TokenManager tokenManager; |
| | | // private RedisTemplate redisTemplate; |
| | | // |
| | | // public TokenLogoutHandler(TokenManager tokenManager,RedisTemplate redisTemplate) { |
| | | // this.tokenManager = tokenManager; |
| | | // this.redisTemplate = redisTemplate; |
| | | // } |
| | | // @Override |
| | | // public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { |
| | | // //1 从header里面获取token |
| | | // //2 token不为空,移除token,从redis删除token |
| | | // String token = request.getHeader("token"); |
| | | // if(token != null) { |
| | | // //移除 |
| | | // tokenManager.removeToken(token); |
| | | // //从token获取用户名 |
| | | // String username = tokenManager.getUserInfoFromToken(token); |
| | | // redisTemplate.delete(username); |
| | | // } |
| | | // ResponseUtil.out(response, Result.success()); |
| | | // } |
| | | //} |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import io.jsonwebtoken.CompressionCodecs; |
| | | //import io.jsonwebtoken.Jwts; |
| | | //import io.jsonwebtoken.SignatureAlgorithm; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import java.util.Date; |
| | | // |
| | | //@Component |
| | | //public class TokenManager { |
| | | // //token有效时长 |
| | | // private long tokenEcpiration = 24*60*60*1000; |
| | | // //编码秘钥 |
| | | // private String tokenSignKey = "123456"; |
| | | // //1 使用jwt根据用户名生成token |
| | | // public String createToken(String username) { |
| | | // String token = Jwts.builder().setSubject(username) |
| | | // .setExpiration(new Date(System.currentTimeMillis()+tokenEcpiration)) |
| | | // .signWith(SignatureAlgorithm.HS512, tokenSignKey).compressWith(CompressionCodecs.GZIP).compact(); |
| | | // return token; |
| | | // } |
| | | // //2 根据token字符串得到用户信息 |
| | | // public String getUserInfoFromToken(String token) { |
| | | // String userinfo = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token).getBody().getSubject(); |
| | | // return userinfo; |
| | | // } |
| | | // //3 删除token |
| | | // public void removeToken(String token) { } |
| | | //} |
New file |
| | |
| | | //package com.mes.security; |
| | | // |
| | | //import com.mes.utils.Result; |
| | | //import com.mes.utils.ResponseUtil; |
| | | //import org.springframework.security.core.AuthenticationException; |
| | | //import org.springframework.security.web.AuthenticationEntryPoint; |
| | | // |
| | | //import javax.servlet.ServletException; |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import javax.servlet.http.HttpServletResponse; |
| | | //import java.io.IOException; |
| | | // |
| | | //public class UnauthEntryPoint implements AuthenticationEntryPoint { |
| | | // @Override |
| | | // public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException { |
| | | // ResponseUtil.out(httpServletResponse, Result.error()); |
| | | // } |
| | | //} |
New file |
| | |
| | | package com.mes.userinfo.controller; |
| | | |
| | | |
| | | import com.mes.userinfo.entity.SysUser; |
| | | import com.mes.userinfo.service.SysUserService; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/userinfo") |
| | | public class SysUserController { |
| | | |
| | | @Autowired |
| | | private SysUserService sysUserService; |
| | | |
| | | @PostMapping("/login") |
| | | public Result login(@RequestBody SysUser user) { |
| | | return sysUserService.login(user); |
| | | } |
| | | |
| | | @GetMapping("/hello") |
| | | public Result hello() { |
| | | return Result.success("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJlZjMyMjQ4NDcyODE0ZWFlYWRlOTBkYmZjYWFlZmNmZSIsInN1YiI6IjEiLCJpc3MiOiJzZyIsImlhdCI6MTcxMjkwMjI0NCwiZXhwIjoxNzEyOTA1ODQ0fQ.DlJkhkiwjZSqprdLzKaTB3yuyxGukerKeF0FbJK_6HY"); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.userinfo.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/userinfo/sys-user-role") |
| | | public class SysUserRoleController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.userinfo.entity; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/11 15:46 |
| | | * @Description: |
| | | */ |
| | | public class LoginUser implements UserDetails { |
| | | |
| | | |
| | | private SysUser user; |
| | | |
| | | /** |
| | | * 存储权限信息 |
| | | */ |
| | | @JSONField(serialize = false) |
| | | private List<String> permissions; |
| | | |
| | | /** |
| | | * 存储SpringSecurity调用getAuthorities()方法获取的权限信息的集合 |
| | | */ |
| | | @JSONField(serialize = false) |
| | | private List<GrantedAuthority> authorities; |
| | | |
| | | |
| | | public LoginUser() { |
| | | } |
| | | |
| | | public LoginUser(SysUser user, List<String> permissions) { |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | } |
| | | |
| | | public SysUser getUser() { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(SysUser user) { |
| | | this.user = user; |
| | | } |
| | | |
| | | @Override |
| | | public Collection<? extends GrantedAuthority> getAuthorities() { |
| | | |
| | | // 优化为只需要第一次获取的时候进行遍历,后面再用就会从authorities这个成员变量中获取了,不会再进行Stream循环遍历了 |
| | | if (authorities != null) { |
| | | return authorities; |
| | | } |
| | | //把permissions中字符串类型的权限信息转换成GrantedAuthority对象存入authorities中 |
| | | authorities = permissions.stream(). |
| | | map(SimpleGrantedAuthority::new) |
| | | .collect(Collectors.toList()); |
| | | return authorities; |
| | | } |
| | | |
| | | @Override |
| | | public String getPassword() { |
| | | return user.getPassword(); |
| | | } |
| | | |
| | | @Override |
| | | public String getUsername() { |
| | | return user.getUserName(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonLocked() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCredentialsNonExpired() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class SysUser implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 用户名 |
| | | */ |
| | | private String userName; |
| | | |
| | | /** |
| | | * 昵称 |
| | | */ |
| | | private String nickName; |
| | | |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * 账号状态(0正常 1停用) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 头像 |
| | | */ |
| | | private String avatar; |
| | | |
| | | /** |
| | | * 用户类型(0管理员,1普通用户) |
| | | */ |
| | | private String userType; |
| | | |
| | | /** |
| | | * 删除标志 |
| | | */ |
| | | private Integer delFlag; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class SysUserRole implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @TableId(value = "user_id", type = IdType.AUTO) |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 角色id |
| | | */ |
| | | private Long roleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.userinfo.entity.SysUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysUserMapper extends BaseMapper<SysUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.userinfo.entity.SysUserRole; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Mapper |
| | | public interface SysUserRoleMapper extends BaseMapper<SysUserRole> { |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.userinfo.mapper.SysUserMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.userinfo.mapper.SysUserRoleMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.mes.userinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.userinfo.entity.SysUserRole; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysUserRoleService extends IService<SysUserRole> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.userinfo.entity.SysUser; |
| | | import com.mes.utils.Result; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | public interface SysUserService extends IService<SysUser> { |
| | | |
| | | Result login(SysUser user); |
| | | |
| | | Result logout(); |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.userinfo.entity.SysUserRole; |
| | | import com.mes.userinfo.mapper.SysUserRoleMapper; |
| | | import com.mes.userinfo.service.SysUserRoleService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.utils.JwtUtil; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.menu.mapper.SysMenuMapper; |
| | | import com.mes.userinfo.entity.LoginUser; |
| | | import com.mes.userinfo.entity.SysUser; |
| | | import com.mes.userinfo.mapper.SysUserMapper; |
| | | import com.mes.userinfo.service.SysUserService; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | | * 用户表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Service |
| | | public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService, UserDetailsService { |
| | | |
| | | @Autowired |
| | | private AuthenticationManager authenticationManager; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private SysMenuMapper sysMenuMapper; |
| | | |
| | | @Override |
| | | public Result login(SysUser user) { |
| | | UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUserName(), user.getPassword()); |
| | | Authentication authenticate = authenticationManager.authenticate(authenticationToken); |
| | | if (Objects.isNull(authenticate)) { |
| | | throw new RuntimeException("用户名或密码错误"); |
| | | } |
| | | //使用userid生成token |
| | | LoginUser loginUser = (LoginUser) authenticate.getPrincipal(); |
| | | String userId = loginUser.getUser().getId().toString(); |
| | | String jwt = JwtUtil.createJWT(userId); |
| | | //authenticate存入redis |
| | | redisUtil.setCacheObject("login:" + userId, loginUser); |
| | | //把token响应给前端 |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("token", jwt); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @Override |
| | | public Result logout() { |
| | | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); |
| | | LoginUser loginUser = (LoginUser) authentication.getPrincipal(); |
| | | Long userid = loginUser.getUser().getId(); |
| | | redisUtil.deleteObject("login:" + userid); |
| | | return Result.success("退出成功"); |
| | | } |
| | | |
| | | @Override |
| | | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
| | | LambdaQueryWrapper<SysUser> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(SysUser::getUserName, username); |
| | | SysUser user = this.baseMapper.selectOne(lqw); |
| | | //判断是否为空 |
| | | if (Objects.isNull(user)) { |
| | | throw new RuntimeException("用户名或密码错误"); |
| | | } |
| | | //查询权限信息 |
| | | List<String> perms = sysMenuMapper.selectPermsByUserId(user.getId()); |
| | | |
| | | return new LoginUser(user, perms); |
| | | } |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8089 |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | application: |
| | | name: security |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | port: 6379 |
| | | password: |
| | | session: |
| | | store-type: redis |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.menu.mapper.SysMenuMapper"> |
| | | |
| | | <select id="selectPermsByUserId" resultType="java.lang.String"> |
| | | SELECT DISTINCT m.perms |
| | | FROM sys_user_role ur |
| | | LEFT JOIN sys_role r ON ur.role_id = r.id |
| | | LEFT JOIN sys_role_menu rm ON ur.role_id = rm.role_id |
| | | LEFT JOIN sys_menu m ON m.id = rm.menu_id |
| | | WHERE user_id = #{userid} |
| | | AND r.status = 0 |
| | | AND m.status = 0 |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>gateway</artifactId> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <dependencies> |
| | | <!-- 服务注册/发现--> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-gateway</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/28 11:21 |
| | | * @Description: |
| | | */ |
| | | @SpringBootApplication |
| | | @EnableDiscoveryClient |
| | | public class GateWayApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(GateWayApplication.class, args); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.cors.CorsConfiguration; |
| | | import org.springframework.web.cors.reactive.CorsWebFilter; |
| | | import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/25 14:13 |
| | | * @Description: |
| | | */ |
| | | @Configuration |
| | | public class MyCorsConfig { |
| | | @Bean |
| | | public CorsWebFilter corsFilter() { |
| | | |
| | | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
| | | CorsConfiguration corsConfiguration = new CorsConfiguration(); |
| | | //允许哪些头跨域 |
| | | corsConfiguration.addAllowedHeader("*"); |
| | | // 允许哪些方式跨域 get post delete 等方式 |
| | | corsConfiguration.addAllowedMethod("*"); |
| | | //允许哪些请求来源跨域 * 任意来源 |
| | | corsConfiguration.addAllowedOrigin("*"); |
| | | // 是否允许携带cooker跨域 |
| | | corsConfiguration.setAllowCredentials(true); |
| | | //注册跨越配置 /**配置请求路径 |
| | | source.registerCorsConfiguration("/**", corsConfiguration); |
| | | return new CorsWebFilter(source); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 88 |
| | | spring: |
| | | application: |
| | | name: gateway |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | gateway: |
| | | discovery: |
| | | locator: |
| | | enabled: true |
| | | routes: |
| | | - id: cacheGlass |
| | | uri: lb://cacheGlass |
| | | predicates: |
| | | - Path=/api/cacheGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: cacheVerticalGlass |
| | | uri: lb://cacheVerticalGlass |
| | | predicates: |
| | | - Path=/api/cacheVerticalGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: loadGlass |
| | | uri: lb://loadGlass |
| | | predicates: |
| | | - Path=/api/loadGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: temperingGlass |
| | | uri: lb://temperingGlass |
| | | predicates: |
| | | - Path=/api/temperingGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | - id: unLoadGlass |
| | | uri: lb://unLoadGlass |
| | | predicates: |
| | | - Path=/api/unLoadGlass/** |
| | | filters: |
| | | - StripPrefix=2 |
| | | |
| | | # - id: unLoadGlass |
| | | # uri: lb://unLoadGlass |
| | | # predicates: |
| | | # - Path=/unLoadGlass/** |
| | | # filters: |
| | | # - RewritePath=/unLoadGlass/(?<segment>.*), /$\{segment} |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>cacheGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.yulichang</groupId> |
| | | <artifactId>mybatis-plus-join</artifactId> |
| | | <version>1.1.6</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.yulichang</groupId>--> |
| | | <!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>--> |
| | | <!-- </dependency>--> |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | import com.mes.edgstoragecage.service.*; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/25 10:49 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @MapperScan("com.mes.*.mapper") |
| | | @EnableDiscoveryClient |
| | | @EnableSwagger2 |
| | | public class CacheGlassModuleApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(CacheGlassModuleApplication.class, args); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import static com.mes.common.InitUtil.readAndUpdateWordValues; |
| | | |
| | | public class PLCAutoMes extends Thread { |
| | | |
| | | // // 用于存储应用程序的配置信息 |
| | | // private Configuration config; |
| | | private static InitUtil initUtil; |
| | | // public static PlcParameterObject PlcMesObject; |
| | | // public static PlcParameterObject PlcReadObject; |
| | | // public static PlcParameterObject PlcframeObject; |
| | | |
| | | // // 创建一个自定义的 S7 控制器消息处理器对象 |
| | | // MessageHandler customS7Control = new MessageHandler(); |
| | | |
| | | // 单例实例 |
| | | private static PLCAutoMes instance; |
| | | // private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath(); |
| | | private static String PlcAlbania = PLCAutoMes.class.getResource("/JsonFile/PlcAlbania.json").getPath(); |
| | | // private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath(); |
| | | // private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath(); |
| | | // private static String PlcParameter = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | |
| | | // private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json").getPath(); |
| | | |
| | | // private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json").getPath(); |
| | | |
| | | // private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath(); |
| | | // private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath(); |
| | | |
| | | // 调用initword方法 |
| | | |
| | | // public static PlcParameterObject plcParameterObject = initUtil.initword(PlcParameter); |
| | | // public static PlcBitObject plcPlcTest = initUtil.initbit(PlcTest); |
| | | // public static PlcBitObject plcBitObject = initUtil.initbit(PlcSign); |
| | | // public static PlcParameterObject plcStateObject= initUtil.initword(PlcState); |
| | | // public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm); |
| | | public static PlcParameterObject PlcMesObject = InitUtil.initword(PlcAlbania); |
| | | // public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead); |
| | | // public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe); |
| | | |
| | | // 私有构造函数 |
| | | public PLCAutoMes() throws IOException { |
| | | //config = new Configuration("config.properties"); |
| | | initUtil = new InitUtil(); |
| | | } |
| | | |
| | | // 获取单例实例 |
| | | public static synchronized PLCAutoMes getInstance() throws IOException { |
| | | if (instance == null) { |
| | | instance = new PLCAutoMes(); |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // System.out.println(jsonFilePath); |
| | | |
| | | //readAndUpdateWordValues(PlcReadObject); |
| | | readAndUpdateWordValues(PlcMesObject); |
| | | //readAndUpdateWordValues(PlcframeObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | |
| | | // readAndUpdateWordValues(plcStateObject); |
| | | // int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); |
| | | // // System.out.println(index); |
| | | // PlcMesObject.getPlcParameter("AddStart").getAddress(index); |
| | | // // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index)); |
| | | // List<String> addresses = new ArrayList<>(); |
| | | // addresses.add("FeedID"); |
| | | // addresses.add("AddStart"); |
| | | // // System.out.println(addresses); |
| | | // // System.out.println(PlcMesObject.getPlcParameterValues(addresses)); |
| | | // List<String> addresses2 = new ArrayList<>(); |
| | | // addresses2.add("FeedID"); |
| | | // addresses2.add("FeedCarStatus"); |
| | | |
| | | //System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | |
| | | public class PlcBitInfo { |
| | | |
| | | public PlcBitInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private Boolean value; |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Boolean getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(Boolean value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | if (stringdatas.length < 2) |
| | | return null; |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | return null; |
| | | dbwindex += index / 8; |
| | | bitindex += index % 8; |
| | | return stringdatas[0] + "." + dbwindex + "." + bitindex; |
| | | } |
| | | |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcBitObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcBitInfo> plcBitList; |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcBitInfo> getBitList() { |
| | | return plcBitList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcBitInfo getPlcBit(String codeid) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | if (plcbitInfo.getCodeId().equals(codeid)) |
| | | return plcbitInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<Boolean> getPlcBitValues(List<String> codeids) { |
| | | List<Boolean> arrayList = new ArrayList<>(); |
| | | if (plcBitList != null) { |
| | | Map<String, Boolean> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (codeids.contains(plcBitInfo.getCodeId().toString())) { |
| | | resultMap.put(plcBitInfo.getCodeId().toString(), plcBitInfo.getValue()); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | Boolean value = resultMap.get(codeId); |
| | | if (value != null) { |
| | | arrayList.add(value); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcBitInfo plcBitInfo : plcBitList) { |
| | | if (plcBitInfo.getCodeId().equals(codeId)) { |
| | | int index = plcBitInfo.getAddressIndex(); |
| | | String address = plcBitInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcBit(PlcBitInfo param) { |
| | | if (plcBitList != null) |
| | | plcBitList.add(param); |
| | | else { |
| | | plcBitList = new ArrayList<PlcBitInfo>(); |
| | | plcBitList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcBitList(List<Boolean> plcValueArray) { |
| | | if (plcBitList != null) { |
| | | for (PlcBitInfo plcbitInfo : plcBitList) { |
| | | plcbitInfo.setValue(plcValueArray.get(plcbitInfo.getAddressIndex())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | public class PlcParameterInfo { |
| | | public PlcParameterInfo(String startAddress) { |
| | | this.startAddress = startAddress; |
| | | } |
| | | |
| | | private String startAddress; |
| | | // 参数标识 |
| | | private String codeId; |
| | | |
| | | // 参数名称 |
| | | private String name; |
| | | |
| | | // 读取 参数值 |
| | | private String value; |
| | | |
| | | // // 写入 参数值 |
| | | // private String writeValue; |
| | | |
| | | // 参数单位 |
| | | private String unit; |
| | | |
| | | // 参数值转换系数 |
| | | private int ratio; |
| | | |
| | | // 参数地址 |
| | | private int addressIndex; |
| | | |
| | | // 参数地址位长度 |
| | | private int addressLength; |
| | | |
| | | public String getCodeId() { |
| | | return this.codeId; |
| | | } |
| | | |
| | | public void setCodeId(String codeId) { |
| | | this.codeId = codeId; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | // public String getWriteValue() { |
| | | // return this.writeValue; |
| | | // } |
| | | |
| | | // public void setWriteValue(String writeValue) { |
| | | // this.writeValue = writeValue; |
| | | // } |
| | | |
| | | public String getUnit() { |
| | | return this.unit; |
| | | } |
| | | |
| | | public void setUnit(String unit) { |
| | | this.unit = unit; |
| | | } |
| | | |
| | | public int getAddressIndex() { |
| | | return this.addressIndex; |
| | | } |
| | | |
| | | public void setAddressIndex(int addressindex) { |
| | | this.addressIndex = addressindex; |
| | | } |
| | | |
| | | public int getAddressLength() { |
| | | return this.addressLength; |
| | | } |
| | | |
| | | public void setAddressLength(int addresslength) { |
| | | this.addressLength = addresslength; |
| | | } |
| | | |
| | | public int getRatio() { |
| | | return this.ratio; |
| | | } |
| | | |
| | | public void setRatio(int ratio) { |
| | | this.ratio = ratio; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取地址 |
| | | * |
| | | * @param index 索引地址 |
| | | */ |
| | | public String getAddress(int index) { |
| | | String[] stringdatas = this.startAddress.trim().split("\\."); |
| | | int addressLength = this.addressLength; |
| | | if (addressLength < 2) { |
| | | return null; |
| | | } |
| | | |
| | | if (addressLength == 2) { |
| | | int wordindex = index; |
| | | |
| | | return stringdatas[0] + "." + wordindex; |
| | | } |
| | | if (addressLength == 14) { |
| | | int wordindex = index; |
| | | //int newIndex = wordindex + 13; |
| | | return stringdatas[0] + "." + wordindex; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public int getPlcAddress() { |
| | | |
| | | return addressIndex; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return getAddress(this.addressIndex); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class PlcParameterObject { |
| | | |
| | | // 该模块数据类型,数据起始位置 |
| | | private String plcAddressBegin; |
| | | // 数据地址长度:第一参数到最后一个参数的长度 |
| | | private int plcAddressLength; |
| | | private ArrayList<PlcParameterInfo> plcParameterList; |
| | | |
| | | /** |
| | | * @return 数据区开始地址 |
| | | */ |
| | | public String getPlcAddressBegin() { |
| | | return plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @param plcAddressBegin 设置数据区开始地址 |
| | | */ |
| | | public void setPlcAddressBegin(String plcAddressBegin) { |
| | | this.plcAddressBegin = plcAddressBegin; |
| | | } |
| | | |
| | | /** |
| | | * @return 数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public int getPlcAddressLength() { |
| | | return plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准) |
| | | */ |
| | | public void setPlcAddressLength(int plcAddressLength) { |
| | | this.plcAddressLength = plcAddressLength; |
| | | } |
| | | |
| | | /** |
| | | * @return 获取参数实例集合 |
| | | */ |
| | | public ArrayList<PlcParameterInfo> getPlcParameterList() { |
| | | return plcParameterList; |
| | | } |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeid 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public PlcParameterInfo getPlcParameter(String codeid) { |
| | | if (plcParameterList != null) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeid)) |
| | | return plcParameterInfo; |
| | | } |
| | | return null; |
| | | } else |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据参数标识 获取某个参数实例 |
| | | * |
| | | * @param codeids 参数标识 |
| | | * @return 获取某个参数实例 |
| | | */ |
| | | public List<String> getPlcParameterValues(List<String> codeids) { |
| | | List<String> arrayList = new ArrayList<>(); |
| | | if (plcParameterList != null) { |
| | | Map<String, PlcParameterInfo> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序 |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (codeids.contains(plcParameterInfo.getCodeId())) { |
| | | resultMap.put(plcParameterInfo.getCodeId(), plcParameterInfo); |
| | | } |
| | | } |
| | | for (String codeId : codeids) { // 按照传入参数的顺序遍历 |
| | | PlcParameterInfo plcParameterInfo = resultMap.get(codeId); |
| | | if (plcParameterInfo != null) { |
| | | arrayList.add(plcParameterInfo.getValue()); |
| | | } else { |
| | | arrayList.add(null); // 如果找不到对应的值,添加 null |
| | | } |
| | | } |
| | | } |
| | | return arrayList; |
| | | } |
| | | |
| | | |
| | | public List<String> getAddressListByCodeId(List<String> codeIdList) { |
| | | List<String> addressList = new ArrayList<>(); |
| | | for (String codeId : codeIdList) { |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | if (plcParameterInfo.getCodeId().equals(codeId)) { |
| | | int index = plcParameterInfo.getAddressIndex(); |
| | | String address = plcParameterInfo.getAddress(index); |
| | | if (address != null) { |
| | | addressList.add(address); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return addressList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加参数实例 |
| | | * |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcParameter(PlcParameterInfo param) { |
| | | if (plcParameterList != null) |
| | | plcParameterList.add(param); |
| | | else { |
| | | plcParameterList = new ArrayList<PlcParameterInfo>(); |
| | | plcParameterList.add(param); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据PLC返回的数据 给参数实例赋值 |
| | | * |
| | | * @param plcValueArray PLC读取回来的byte类型数据集合 |
| | | */ |
| | | public void setPlcParameterList(byte[] plcValueArray) { |
| | | if (plcParameterList != null) { |
| | | |
| | | for (PlcParameterInfo plcParameterInfo : plcParameterList) { |
| | | |
| | | byte[] valueList = new byte[plcParameterInfo.getAddressLength()]; |
| | | |
| | | // System.out.println(plcParameterInfo.getAddressLength()); |
| | | |
| | | for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) { |
| | | Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]); |
| | | |
| | | } |
| | | if (plcParameterInfo.getAddressLength() == 2) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2short(valueList))); |
| | | } else if (plcParameterInfo.getAddressLength() == 14) { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } else { |
| | | String valuestr = new String(valueList); |
| | | plcParameterInfo.setValue(valuestr); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * short类型转byte[] |
| | | * |
| | | * @param s short类型值 |
| | | */ |
| | | public static byte[] short2byte(short s) { |
| | | byte[] b = new byte[2]; |
| | | for (int i = 0; i < 2; i++) { |
| | | int offset = 16 - (i + 1) * 8; //因为byte占4个字节,所以要计算偏移量 |
| | | b[i] = (byte) ((s >> offset) & 0xff); //把16位分为2个8位进行分别存储 |
| | | } |
| | | return b; |
| | | } |
| | | |
| | | /** |
| | | * byte[]类型转short |
| | | * |
| | | * @param b byte[]类型值 |
| | | */ |
| | | public static short byte2short(byte[] b) { |
| | | short l = 0; |
| | | for (int i = 0; i < 2; i++) { |
| | | l <<= 8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 |
| | | l |= (b[i] & 0xff); //和上面也是一样的 l = l | (b[i]&0xff) |
| | | } |
| | | return l; |
| | | } |
| | | |
| | | public static String byteToHexString(byte[] bytes) { |
| | | |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | return str; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.controller; |
| | | |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageServiceImpl; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.impl.TaskCacheServiceImpl; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.awt.image.ImageProducer; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/edgStorageCage") |
| | | public class EdgStorageCageController { |
| | | |
| | | @Autowired |
| | | private EdgStorageCageServiceImpl edgStorageCageServiceImpl; |
| | | |
| | | |
| | | //查询磨边缓存理片笼内详情 |
| | | @PostMapping("/selectEdgStorageCage") |
| | | @ResponseBody |
| | | public Result selectEdgStorageCage () { |
| | | List<Map> list=edgStorageCageServiceImpl.selectEdgStorageCages(); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | //添加磨边缓存理片笼信息 功能:笼内绑定玻璃 |
| | | @PostMapping("/insertEdgStorageCage") |
| | | @ResponseBody |
| | | public Result insertEdgStorageCage(@RequestBody EdgStorageCage edgStorageCage) { |
| | | boolean isSucess=edgStorageCageServiceImpl.updateEdgStorageCage(edgStorageCage); |
| | | return Result.build(200,"添加成功",1); |
| | | } |
| | | //修改磨边缓存理片笼信息 功能:对笼内栅格进行【启用/禁用】/ 【更换】笼内栅格玻璃信息 |
| | | @PostMapping("/updateEdgStorageCage") |
| | | @ResponseBody |
| | | public Result updateEdgStorageCage(@RequestBody EdgStorageCage edgStorageCage) { |
| | | boolean isSucess=edgStorageCageServiceImpl.updateEdgStorageCage(edgStorageCage); |
| | | return Result.build(200,"更换成功",1); |
| | | } |
| | | |
| | | //删除磨边缓存理片笼信息 功能:对笼内栅格玻璃进行【清除】 |
| | | @PostMapping("/deleteEdgStorageCage") |
| | | @ResponseBody |
| | | public Result deleteEdgStorageCage(@RequestBody EdgStorageCage edgStorageCage) { |
| | | boolean isSucess=edgStorageCageServiceImpl.updateEdgStorageCage(edgStorageCage); |
| | | return Result.build(200,"删除成功",1); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.edgstoragecage.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/edgStorageCageDetails") |
| | | public class EdgStorageCageDetailsController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.edgstoragecage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class EdgStorageCage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 磨边前理片笼表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private String enableState; |
| | | |
| | | /** |
| | | * 剩余 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class EdgStorageCageDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 磨边前理片笼详情表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private Integer glassId; |
| | | |
| | | /** |
| | | * 小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 磨前宽 |
| | | */ |
| | | private Double edgWidth; |
| | | |
| | | /** |
| | | * 磨前高 |
| | | */ |
| | | private Double edgHeight; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * 原片顺序 |
| | | */ |
| | | private Integer patternSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.mapper; |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageDetailsMapper extends MPJBaseMapper<EdgStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageMapper extends MPJBaseMapper<EdgStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageDetailsService extends IService<EdgStorageCageDetails> { |
| | | |
| | | /** |
| | | * 识别 破损/拿走 |
| | | * @param glassid |
| | | * @param ControlsId |
| | | * @return |
| | | */ |
| | | boolean identWorn(String glassid,int ControlsId); |
| | | //获取 切割当前版图 |
| | | List<Map> selectCutTerritory(); |
| | | //获取 工程下的当前版图 |
| | | List<Map> selectCurrentCutTerritory(String current); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface EdgStorageCageService extends IService<EdgStorageCage> { |
| | | |
| | | //查询笼内空格 |
| | | List<Map> selectCacheEmpty(); |
| | | |
| | | //查询笼内出片顺序详情 |
| | | List<Map> selectCacheOut(); |
| | | |
| | | //查询笼内详情 |
| | | List<Map> selectEdgStorageCages(); |
| | | |
| | | //修改理片笼内信息 |
| | | boolean updateEdgStorageCage(EdgStorageCage edgStorageCage); |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.taskcache.mapper.HangzhouMesMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class EdgStorageCageDetailsServiceImpl extends ServiceImpl<EdgStorageCageDetailsMapper, EdgStorageCageDetails> implements EdgStorageCageDetailsService { |
| | | //获取全部数据 |
| | | @Autowired |
| | | private EdgStorageCageDetailsMapper edgStorageCageDetailsMapper; |
| | | |
| | | //识别 破损/拿走 |
| | | public boolean identWorn(String glassid, int ControlsId) { |
| | | List<EdgStorageCageDetails> edgStorageCageDetails = edgStorageCageDetailsMapper.selectList(new QueryWrapper<EdgStorageCageDetails>().eq("glassid", glassid)); |
| | | if (edgStorageCageDetails.size() == 1) { |
| | | edgStorageCageDetailsMapper.update(edgStorageCageDetails.get(0), new QueryWrapper<EdgStorageCageDetails>().eq("glassid", glassid)); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //获取 切割当前版图 |
| | | @Override |
| | | public List<Map> selectCutTerritory() { |
| | | List<Map> list = edgStorageCageDetailsMapper.selectJoinList( |
| | | Map.class, new MPJQueryWrapper<EdgStorageCageDetails>().selectAll(EdgStorageCageDetails.class) |
| | | .select("escd.glass_id", "escd.flow_card_id", "escd.width", "escd.height") |
| | | .leftJoin("glass_info gi on t.layout_sequence=gi.pattern_sequence and t.engineering_id=gi.engineer_id") |
| | | .leftJoin("edg_storage_cage_details escd on gi.id=escd.glass_id") |
| | | .eq("state", 1) |
| | | .orderByAsc("t.layout_sequence") |
| | | ); |
| | | return list; |
| | | } |
| | | |
| | | //获取 工程下的当前版图 |
| | | @Override |
| | | public List<Map> selectCurrentCutTerritory(String current) { |
| | | List<Map> list = edgStorageCageDetailsMapper.selectJoinList( |
| | | Map.class, new MPJQueryWrapper<EdgStorageCageDetails>().selectAll(EdgStorageCageDetails.class) |
| | | .select("escd.glass_id", "escd.flow_card_id", "escd.width", "escd.height") |
| | | .leftJoin("glass_info gi on t.layout_sequence=gi.pattern_sequence and t.engineering_id=gi.engineer_id") |
| | | .leftJoin("edg_storage_cage_details escd on gi.id=escd.glass_id") |
| | | .eq("t.engineering_id", current) |
| | | .orderByAsc("t.layout_sequence") |
| | | ); |
| | | return list; |
| | | } |
| | | |
| | | ; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class EdgStorageCageServiceImpl extends ServiceImpl<EdgStorageCageMapper, EdgStorageCage> implements EdgStorageCageService { |
| | | |
| | | @Autowired |
| | | EdgStorageCageMapper edgStorageCageMapper; |
| | | @Autowired |
| | | EdgStorageCageDetailsMapper edgStorageCageDetailsMapper; |
| | | @Autowired |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | |
| | | @Override |
| | | //查询笼内空格 |
| | | public List<Map> selectCacheEmpty(){ |
| | | List<Map> map=edgStorageCageMapper.selectJoinList( |
| | | Map.class,new MPJQueryWrapper<EdgStorageCage>().selectAll(EdgStorageCage.class) |
| | | .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | .leftJoin("edg_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | .isNull("escd.slot") |
| | | ); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | //查询笼内出片任务 按钢化版图号+版图内序号 |
| | | public List<Map> selectCacheOut(){ |
| | | List<Map> list= upPattenUsageMapper.selectJoinList( |
| | | Map.class,new MPJQueryWrapper<UpPattenUsage>().selectAll(UpPattenUsage.class) |
| | | .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | .leftJoin("edg_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | .isNotNull("escd.slot") |
| | | .orderByAsc("escd.tempering_layout_id","escd.tempering_feed_sequence") |
| | | ); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | //理片缓存详情 |
| | | public List<Map> selectEdgStorageCages(){ |
| | | List<Map> map=edgStorageCageMapper.selectJoinList( |
| | | Map.class,new MPJQueryWrapper<EdgStorageCage>().selectAll(EdgStorageCage.class) |
| | | .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | .leftJoin("edg_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | ); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | //修改理片笼内信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | public boolean updateEdgStorageCage(EdgStorageCage edgStorageCage){ |
| | | edgStorageCageMapper.updateById(edgStorageCage); |
| | | return true; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.controller; |
| | | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.mes.glassinfo.service.impl.GlassInfoServiceImpl; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/glassInfo") |
| | | public class GlassInfoController { |
| | | |
| | | @Autowired |
| | | private GlassInfoServiceImpl GlassInfoServiceImpl; |
| | | |
| | | @PostMapping("/selectId") // 查询切割版图信息-根据 工程号 |
| | | @ResponseBody |
| | | public Result selectId(String ProcessId) { |
| | | List<GlassInfo> list = GlassInfoServiceImpl.selectId(ProcessId); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | |
| | | @PostMapping("/selectAll") // 查询切割版图信息-根据 工程号 |
| | | @ResponseBody |
| | | public Result selectAll() { |
| | | List<GlassInfo> list = GlassInfoServiceImpl.selectAll(); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | |
| | | @PostMapping("/selectFlowCardId") // 查询切割版图信息-根据 工程号 |
| | | @ResponseBody |
| | | public Result selectFlowCardId(String flowCardId) { |
| | | List<GlassInfo> list = GlassInfoServiceImpl.selectFlowCardId(flowCardId); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.glassinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class GlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 玻璃信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 磨前宽 |
| | | */ |
| | | private Double edgWidth; |
| | | |
| | | /** |
| | | * 磨前高 |
| | | */ |
| | | private Double edgHeight; |
| | | |
| | | /** |
| | | * 是否配片 |
| | | */ |
| | | private Integer ismultiple; |
| | | |
| | | /** |
| | | * 配片最大宽 |
| | | */ |
| | | private Double maxWidth; |
| | | |
| | | /** |
| | | * 配片最大高 |
| | | */ |
| | | private Double maxHeight; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 原片顺序 |
| | | */ |
| | | private Integer patternSequence; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
| | | */ |
| | | private Integer ruleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface GlassInfoMapper extends BaseMapper<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface GlassInfoService extends IService<GlassInfo> { |
| | | |
| | | public List<GlassInfo> selectAll(); |
| | | public List<GlassInfo> selectId(String glassId); |
| | | public List<GlassInfo> selectFlowCardId(String flowCardId); |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class GlassInfoServiceImpl extends ServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService { |
| | | |
| | | @Autowired |
| | | GlassInfoMapper glassInfoMapper; |
| | | |
| | | //根据ID 获取小片数据 |
| | | @Override |
| | | public List<GlassInfo> selectId(String glassId){ |
| | | return glassInfoMapper.selectList(new QueryWrapper<GlassInfo>().eq("id",glassId)); |
| | | }; |
| | | |
| | | //获取全部小片数据 |
| | | @Override |
| | | public List<GlassInfo> selectAll(){ |
| | | return glassInfoMapper.selectList(null); |
| | | }; |
| | | |
| | | //根据工程 获取小片数据 |
| | | @Override |
| | | public List<GlassInfo> selectFlowCardId(String flowCardId){ |
| | | return glassInfoMapper.selectList(new QueryWrapper<GlassInfo>().eq("flowCardId",flowCardId)); |
| | | }; |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.controller; |
| | | |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageDetailsServiceImpl; |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageServiceImpl; |
| | | import com.mes.taskcache.service.HangzhoumesService; |
| | | import com.mes.taskcache.service.PpService; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/taskCache") |
| | | public class TaskCacheController { |
| | | |
| | | @Autowired |
| | | private EdgStorageCageServiceImpl edgStorageCageServiceImpl; |
| | | |
| | | @Autowired |
| | | private EdgStorageCageDetailsServiceImpl edgStorageCageDetailsServiceImpl; |
| | | |
| | | @Autowired |
| | | private HangzhoumesService hangzhoumesService; |
| | | |
| | | @PostMapping("/cutTerritory") // 查询切割版图信息-根据 工程号 |
| | | @ResponseBody |
| | | public Result cutTerritory(String current) { |
| | | List<Map> h = edgStorageCageDetailsServiceImpl.selectCurrentCutTerritory(current); |
| | | return Result.build(200,"成功",h); |
| | | } |
| | | |
| | | @PostMapping("/currentCutTerritory") // 识别显示 当前版图 |
| | | @ResponseBody |
| | | public Result currentCutTerritory() { |
| | | List<Map> h = edgStorageCageDetailsServiceImpl.selectCutTerritory(); |
| | | return Result.build(200,"成功",h); |
| | | } |
| | | |
| | | @PostMapping("/selectCutTerritory") // 识别显示 特定版图 |
| | | @ResponseBody |
| | | public Result selectCutTerritory(String TerritoryId) { |
| | | List<Map> h = edgStorageCageDetailsServiceImpl.selectCutTerritory(); |
| | | return Result.build(200,"成功",h); |
| | | } |
| | | |
| | | @PostMapping("/identControls") // 识别操作: 破损/拿走 参数(ID,功能[0:破损,1:拿走]) |
| | | @ResponseBody |
| | | public Result identControls(@RequestParam(name = "identId", required = false) String identId,@RequestParam(name = "controlsId", required = false) int controlsId) { |
| | | |
| | | boolean issucess = edgStorageCageDetailsServiceImpl.identWorn(identId,controlsId); |
| | | return Result.build(200,"成功",issucess); |
| | | } |
| | | |
| | | @PostMapping("/selectCageInfo") // 查询笼内信息 |
| | | @ResponseBody |
| | | public Result selectCageInfo(String ProcessId) { |
| | | List<Map> h = hangzhoumesService.SelectCageInfo(); |
| | | return Result.build(200,"成功",h); |
| | | } |
| | | |
| | | @PostMapping("/selectEdgTask") //磨边任务 |
| | | @ResponseBody |
| | | public Result selectEdgTask(String ProcessId) { |
| | | List<Map> EdgTasks = hangzhoumesService.SelectEdgInfo("1"); |
| | | return Result.build(200,"成功",EdgTasks); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.taskcache.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("task_cache") |
| | | public class TaskCache { |
| | | private String ID;//任务编号 |
| | | private String startcell;//起始 |
| | | private String endcell;//结束 |
| | | private String tasktype;//任务类型 |
| | | private String taskstauts;//任务状态 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.mapper; |
| | | |
| | | |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import org.apache.ibatis.annotations.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface HangzhouMesMapper { |
| | | |
| | | // 玻璃信息 按ID查询 |
| | | @Select("select * from `glass_info` where id=#{id}") |
| | | GlassInfo selectGlassId(String id); |
| | | |
| | | // 查询磨边信息 |
| | | @Select("select * from task_cache where task_type='2' and task_stauts='2' and end_cell=#{EndCell}") |
| | | List<Map> selectEdgInfo(String EndCell); |
| | | |
| | | // 查询笼子内空闲 |
| | | @Select("select escd.* from edg_storage_cage as esc LEFT JOIN edg_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is null order by escd.slot") |
| | | List<EdgStorageCageDetails> selectCacheLeisure(); |
| | | |
| | | // 查询笼子内出片任务 |
| | | @Select("select escd.* from edg_storage_cage as esc LEFT JOIN edg_storage_cage_details as escd on esc.slot=escd.slot WHERE escd.slot IS NOT NULL order by escd.tempering_layout_id,escd.tempering_feed_sequence") |
| | | List<EdgStorageCageDetails> selectCacheOut(); |
| | | |
| | | // 查询笼子内信息 |
| | | @Select("select esc.*,escd.id as detailsID,escd.device_id as details_device_id,escd.glass_id,escd.sequence,escd.flow_card_id,escd.glass_type,escd.width,escd.height,escd.thickness,escd.edg_width,escd.edg_height,escd.tempering_layout_id,escd.tempering_feed_sequence,escd.pattern_sequence,escd.state,escd.gap from edg_storage_cage as esc LEFT JOIN edg_storage_cage_details as escd on esc.slot=escd.slot order by esc.slot") |
| | | List<Map> selectCachInfo(); |
| | | |
| | | // 查询可进此片玻璃的栅格号 |
| | | @Select("select escd.* from edg_storage_cage as esc LEFT JOIN edg_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null escd.tempering_layout_id=#{tempering_layout_id} and escd.tempering_feed_sequence<#{tempering_feed_sequence} and esc.remain_width-#{width}>0 order by escd.tempering_feed_sequence") |
| | | List<EdgStorageCageDetails> selectIsExistIntoCache(Integer tempering_layout_id, Integer tempering_feed_sequence, double width); |
| | | |
| | | // 查询可进此片玻璃的栅格号 |
| | | @Select("select escd.* from edg_storage_cage as esc LEFT JOIN edg_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null escd.tempering_layout_id<#{tempering_layout_id} and esc.remain_width-#{width}>0 order by escd.tempering_layout_id desc,escd.tempering_feed_sequence") |
| | | List<EdgStorageCageDetails> selectIsExistIntoCache(Integer tempering_layout_id, double width); |
| | | |
| | | // 查询全部任务 |
| | | @Select("select * from task_cache") |
| | | List<TaskCache> selectCacheInfoAll(); |
| | | |
| | | // 查询进片任务 |
| | | @Select("select * from task_cache where task_type='1' and task_stauts='0'") |
| | | List<TaskCache> selectInputCacheInfo(); |
| | | |
| | | // 查询出片任务 |
| | | @Select("select * from task_cache where task_type='2' and task_stauts='0'") |
| | | List<TaskCache> selectOutCacheInfo(); |
| | | |
| | | // 查询 A09 或 A10 最新的一片 出片任务 |
| | | @Select("select * from task_cache where task_type='2' and task_stauts='2' and end_cell=#{EndCell} limit 1") |
| | | GlassInfo selectLastOutCacheInfo(String EndCell); |
| | | |
| | | // 修改笼子内信息 |
| | | @Update("update") |
| | | Integer updateCache(@Param("id") Integer id, @Param("order_id") String order_id); |
| | | |
| | | // 添加理片任务 |
| | | @Insert("INSERT into task_cache VALUES(#{id},#{start},#{end},#{type},0)") |
| | | Integer insertCacheTask(String id, String start, String end, String type); |
| | | |
| | | // |
| | | // @Insert("INSERT `order`(order_id)VALUES(#{order_id})") |
| | | // Integer insert(Order order); |
| | | // |
| | | // @Delete("delete from `order` where id=#{id}") |
| | | // Integer deleteById(@Param("id") Integer id); |
| | | // |
| | | // @Update("update `order` set order_id=#{order_id} where id=#{id}") |
| | | // Integer update(@Param("id") Integer id,@Param("order_id") String order_id); |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.mapper; |
| | | |
| | | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | // |
| | | //@DS("pp") |
| | | @Mapper |
| | | public interface PpMapper { |
| | | |
| | | // // 钢化按工程查询 |
| | | // @Select("select * from `v_optimize_heat_layout` where project_no=#{projeceid} ") |
| | | // List<Tempered> selectTemperedTerritory(String projeceid); |
| | | |
| | | // 切割版图 按工程,版图编号查询 |
| | | @Select("select * from optimize_detail where project_no=#{projeceid} and stock_id=#{TerritoryId}") |
| | | List<Map> selectCutTerritory(String projeceid, String TerritoryId); |
| | | |
| | | // 切割版图 按工程查询 |
| | | @Select("select * from optimize_detail where project_no=#{projeceid} ") |
| | | List<Map> selectCutTerritory(String projeceid); |
| | | |
| | | // |
| | | // @Insert("INSERT `order`(order_id)VALUES(#{order_id})") |
| | | // Integer insert(Order order); |
| | | // |
| | | // @Delete("delete from `order` where id=#{id}") |
| | | // Integer deleteById(@Param("id") Integer id); |
| | | // |
| | | // @Update("update `order` set order_id=#{order_id} where id=#{id}") |
| | | // Integer update(@Param("id") Integer id,@Param("order_id") String order_id); |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TaskCacheMapper extends BaseMapper<TaskCache> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.service; |
| | | |
| | | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.taskcache.mapper.HangzhouMesMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class HangzhoumesService { |
| | | |
| | | @Autowired |
| | | private HangzhouMesMapper hangzhouMesMapper; |
| | | |
| | | //根据编号 查找玻璃小片信息 |
| | | public GlassInfo getUserInfo(String process_id) { |
| | | return hangzhouMesMapper.selectGlassId(process_id); |
| | | } |
| | | |
| | | //理片缓存 笼内信息 |
| | | public List<Map> SelectCageInfo() { |
| | | return hangzhouMesMapper.selectCachInfo(); |
| | | } |
| | | |
| | | //磨边小片信息 |
| | | public List<Map> SelectEdgInfo(String line) { |
| | | return hangzhouMesMapper.selectEdgInfo(line); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | // } |
| | | // } |
| | | // } |
| | | //理片 进 |
| | | public boolean processInto(String Number){ |
| | | //查询消息队列里的玻璃 |
| | | GlassInfo GlassInfo=hangzhouMesMapper.selectGlassId(Number); |
| | | PlcParameterObject plcmes= PLCAutoMes.PlcMesObject; |
| | | if(GlassInfo!=null){//存在此玻璃编号 |
| | | //同钢化版图内的栅格号 |
| | | List<EdgStorageCageDetails> list=hangzhouMesMapper.selectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getTemperingFeedSequence(),GlassInfo.getWidth()); |
| | | //空栅格号 |
| | | if (list.size()==0) { |
| | | list=hangzhouMesMapper.selectCacheLeisure(); |
| | | } |
| | | //小于此玻璃钢化版图序号的栅格号 |
| | | if(list.size()==0){ |
| | | list=hangzhouMesMapper.selectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getWidth()); |
| | | } |
| | | if(list.size()>0){ |
| | | //存在空格 |
| | | //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) |
| | | //2.回复 1进片 |
| | | EdgStorageCageDetails item=list.get(0); |
| | | hangzhouMesMapper.insertCacheTask(GlassInfo.getId()+"","0",item.getSlot()+"","1"); |
| | | // //理片 进 |
| | | // public boolean processInto(String Number){ |
| | | // //查询消息队列里的玻璃 |
| | | // GlassInfo GlassInfo=hangzhouMesMapper.selectGlassId(Number); |
| | | // PlcParameterObject plcmes= PLCAutoMes.PlcMesObject; |
| | | // if(GlassInfo!=null){//存在此玻璃编号 |
| | | // //同钢化版图内的栅格号 |
| | | // List<EdgStorageCageDetails> list=hangzhouMesMapper.selectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getTemperingFeedSequence(),GlassInfo.getWidth()); |
| | | // //空栅格号 |
| | | // if (list.size()==0) { |
| | | // list=hangzhouMesMapper.selectCacheLeisure(); |
| | | // } |
| | | // //小于此玻璃钢化版图序号的栅格号 |
| | | // if(list.size()==0){ |
| | | // list=hangzhouMesMapper.selectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getWidth()); |
| | | // } |
| | | // if(list.size()>0){ |
| | | // //存在空格 |
| | | // //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) |
| | | // //2.回复 1进片 |
| | | // EdgStorageCageDetails item=list.get(0); |
| | | // hangzhouMesMapper.insertCacheTask(GlassInfo.getId()+"","0",item.getSlot()+"","1"); |
| | | // S7object.getinstance().plccontrol.WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | return true; |
| | | } |
| | | |
| | | }else{ |
| | | // ID编号不存在 不处理/回复PLC 进行报警提示 |
| | | } |
| | | //返回结果 |
| | | return false; |
| | | } |
| | | // return true; |
| | | // } |
| | | // |
| | | // }else{ |
| | | // // ID编号不存在 不处理/回复PLC 进行报警提示 |
| | | // } |
| | | // //返回结果 |
| | | // return false; |
| | | // } |
| | | // //理片 出 |
| | | // public boolean processOut(){ |
| | | // //查询任务 |
New file |
| | |
| | | package com.mes.taskcache.service; |
| | | |
| | | |
| | | import com.mes.taskcache.mapper.HangzhouMesMapper; |
| | | import com.mes.taskcache.mapper.PpMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class PpService { |
| | | |
| | | @Autowired |
| | | private PpMapper selectInfoMapper; |
| | | @Autowired |
| | | private HangzhouMesMapper hangzhouMesMapper; |
| | | |
| | | // public GlassInfo getUserInfo(String process_id){ |
| | | // return hangzhouMesMapper.selectGlassId(process_id); |
| | | // } |
| | | |
| | | // public List<Tempered> selectTemperedTerritory(String process_id){ |
| | | // return selectInfoMapper.selectTemperedTerritory(process_id); |
| | | // } |
| | | |
| | | //切割版图 当前识别版图 |
| | | public List<Map> selectCutTerritory() { |
| | | //得到要显示的 工程ID 以及版图ID |
| | | //1.在Hangzhoumes数据库里 得到目前已经 领取但未完成的 工程ID集合 |
| | | //2.拿工程集合去PP数据库里 得到对应的小片集合 |
| | | //3.拿对应的小片集合 与 缓存任务表进行对比 查找下一版图显示 |
| | | String process_id = "P24032204"; |
| | | String territory_id = "1"; |
| | | return selectInfoMapper.selectCutTerritory(process_id, territory_id); |
| | | } |
| | | |
| | | //切割版图 根据工程号查询 所有版图小片数据 |
| | | public List<Map> selectCutTerritory(String process_id) { |
| | | return selectInfoMapper.selectCutTerritory(process_id); |
| | | } |
| | | |
| | | //切割版图 根据工程号,版图编号查询 版图编号里所有小片数据 |
| | | public List<Map> selectCutTerritory(String process_id, String TerritoryId) { |
| | | return selectInfoMapper.selectCutTerritory(process_id, TerritoryId); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.taskcache.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TaskCacheService extends IService<TaskCache> { |
| | | |
| | | //添加理片笼任务 |
| | | boolean insertTaskCache(TaskCache taskCache); |
| | | |
| | | //查询磨边任务 |
| | | List<TaskCache> selectEdgInfo(String line); |
| | | |
| | | //查询理片任务 |
| | | List<TaskCache> selectCacheInfo(); |
| | | |
| | | //查询全部任务 |
| | | List<TaskCache> selectAll(); |
| | | |
| | | //查询进片任务 |
| | | List<TaskCache> selectInputTaskCache(); |
| | | |
| | | //查询出片任务 |
| | | List<TaskCache> selectOutTaskCache(); |
| | | |
| | | //查询 A09 或 A10 最新的一片 出片任务 |
| | | List<TaskCache> selectLastOutCacheInfo(String line); |
| | | } |
New file |
| | |
| | | package com.mes.taskcache.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.taskcache.mapper.TaskCacheMapper; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class TaskCacheServiceImpl extends ServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | |
| | | @Autowired |
| | | GlassInfoMapper glassInfoMapper; |
| | | @Autowired |
| | | TaskCacheMapper taskCacheMapper; |
| | | //添加理片笼任务 |
| | | @Override |
| | | public boolean insertTaskCache(TaskCache taskCache){ |
| | | taskCacheMapper.insert(taskCache); |
| | | return true; |
| | | } |
| | | //查询磨边任务 |
| | | @Override |
| | | public List<TaskCache> selectEdgInfo(String line) { |
| | | return taskCacheMapper.selectList(new QueryWrapper<TaskCache>().eq("endcell",line)); |
| | | } |
| | | //查询待理片工作的任务 |
| | | @Override |
| | | public List<TaskCache> selectCacheInfo(){ |
| | | return taskCacheMapper.selectList(new QueryWrapper<TaskCache>().eq("taskstauts",0)); |
| | | } |
| | | //查询全部任务 |
| | | @Override |
| | | public List<TaskCache> selectAll() { |
| | | return taskCacheMapper.selectList(null); |
| | | } |
| | | //查询待进片任务 |
| | | @Override |
| | | public List<TaskCache> selectInputTaskCache(){ |
| | | return taskCacheMapper.selectList(new QueryWrapper<TaskCache>().eq("taskstauts",0).eq("tasktype",1)); |
| | | } |
| | | |
| | | //查询待出片任务 |
| | | @Override |
| | | public List<TaskCache> selectOutTaskCache(){ |
| | | return taskCacheMapper.selectList(new QueryWrapper<TaskCache>().eq("taskstauts",0).eq("tasktype",2)); |
| | | } |
| | | |
| | | //查询 A09 或 A10 最新的一片 出片任务 |
| | | @Override |
| | | public List<TaskCache> selectLastOutCacheInfo(String line){ |
| | | return taskCacheMapper.selectList(new QueryWrapper<TaskCache>().eq("endcell",line).eq("taskstauts",1).orderByDesc("ID")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.controller; |
| | | |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageDetailsServiceImpl; |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageServiceImpl; |
| | | import com.mes.taskcache.service.HangzhoumesService; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/taskCache") |
| | | public class uppattenusageController { |
| | | |
| | | @Autowired |
| | | private EdgStorageCageServiceImpl edgStorageCageServiceImpl; |
| | | |
| | | @Autowired |
| | | private EdgStorageCageDetailsServiceImpl edgStorageCageDetailsServiceImpl; |
| | | |
| | | @Autowired |
| | | private HangzhoumesService hangzhoumesService; |
| | | |
| | | |
| | | @PostMapping("/selectEdgTask") //磨边任务 |
| | | @ResponseBody |
| | | public Result selectEdgTask(String ProcessId) { |
| | | List<Map> EdgTasks = hangzhoumesService.SelectEdgInfo("1"); |
| | | return Result.build(200,"成功",EdgTasks); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.uppattenusage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data //lombok 简写java代码 实体类的get与set |
| | | @TableName("`up_patten_usage`") |
| | | public class UpPattenUsage { |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id;//原片使用情况表id |
| | | private Integer engineeringid;//工程号 |
| | | private Integer filmsid;//膜系id |
| | | private Double width;//宽 |
| | | private Double height;//高 |
| | | private Double thickness;//厚度 |
| | | private Integer layoutsequence;//原片版图片序 |
| | | private Integer state;//状态 |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpPattenUsageMapper extends MPJBaseMapper<UpPattenUsage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpPattenUsageService extends IService<UpPattenUsage> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service.impl; |
| | | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class UpPattenUsageServiceImpl extends ServiceImpl<UpPattenUsageMapper, UpPattenUsage> implements UpPattenUsageService { |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8081 |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | application: |
| | | name: cacheGlass |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | port: 6379 |
| | | password: 123456 |
| | | session: |
| | | store-type: redis |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.edgstoragecage.service.impl.EdgStorageCageServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/27 16:37 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = CacheGlassModuleApplication.class) |
| | | public class CacheGlassModuleApplicationTest { |
| | | |
| | | @Autowired |
| | | EdgStorageCageServiceImpl edgStorageCageServiceImpl; |
| | | |
| | | @Test |
| | | public void testFindPath() { |
| | | log.info("完整路径:{}", Arrays.asList("123")); |
| | | } |
| | | |
| | | @Test |
| | | public void testCacheGlass() { |
| | | List<Map> map= edgStorageCageServiceImpl.selectEdgStorageCages(); |
| | | log.info("笼内信息:{}", Arrays.asList(map)); |
| | | } |
| | | @Test |
| | | public void testselectCacheEmpty() { |
| | | List<Map> map= edgStorageCageServiceImpl.selectCacheEmpty(); |
| | | log.info("笼内空格:{}", Arrays.asList(map)); |
| | | } |
| | | @Test |
| | | public void testScan() { |
| | | List<Map> map= edgStorageCageServiceImpl.selectEdgStorageCages(); |
| | | log.info("切割当前版图信息:{}", Arrays.asList(map)); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>cacheVerticalGlass</artifactId> |
| | | <dependencies> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.yulichang</groupId> |
| | | <artifactId>mybatis-plus-join</artifactId> |
| | | <version>1.1.6</version> |
| | | </dependency> |
| | | </dependencies> |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/3/25 10:49 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class CacheVerticalClassModuleApplication { |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(CacheVerticalClassModuleApplication.class, args); |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @ApiModel("理片笼信息") |
| | | @RestController |
| | | @RequestMapping("/bigStorageCage") |
| | | public class BigStorageCageController { |
| | | |
| | | @Autowired |
| | | private BigStorageCageService bigStorageCageService; |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | |
| | | @ApiOperation("理片笼信息") |
| | | @GetMapping("/bigStorageCage") |
| | | public List<BigStorageCage> querybigStorageCageDetail() { |
| | | return bigStorageCageService.querybigStorageCageDetail(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @ApiModel(description = "理片笼详情") |
| | | @RestController |
| | | @RequestMapping("/bigStorageCageDetails") |
| | | public class BigStorageCageDetailsController { |
| | | |
| | | @Autowired |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | |
| | | @ApiOperation("理片笼详情") |
| | | @PostMapping("/bigStorageCageDetails") |
| | | public List<BigStorageCageDetails> bigStorageCageDetails() { |
| | | return bigStorageCageDetailsService.list(); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.bigstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 大理片笼表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private String enableState; |
| | | |
| | | /** |
| | | * 剩余宽度 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | @TableField(exist = false) |
| | | private List<BigStorageCageDetails> bigStorageCageDetails; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCageDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 大理片笼详情表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private String glassId; |
| | | |
| | | /** |
| | | * 小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import feign.Param; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageDetailsMapper extends BaseMapper<BigStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageMapper extends BaseMapper<BigStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageDetailsService extends IService<BigStorageCageDetails> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageService extends IService<BigStorageCage> { |
| | | |
| | | void updateRemainWidth(int Slot); |
| | | |
| | | BigStorageCageDetails feedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails); |
| | | |
| | | boolean outGlass(); |
| | | |
| | | List<BigStorageCage> querybigStorageCageDetail(); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class BigStorageCageDetailsServiceImpl extends ServiceImpl<BigStorageCageDetailsMapper, BigStorageCageDetails> implements BigStorageCageDetailsService { |
| | | @Resource |
| | | private BigStorageCageMapper bigStorageCageMapper; |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class BigStorageCageServiceImpl extends ServiceImpl<BigStorageCageMapper, BigStorageCage> implements BigStorageCageService { |
| | | @Resource |
| | | private BigStorageCageMapper bigStorageCageMapper; |
| | | |
| | | @Resource |
| | | private BigStorageCageDetailsMapper bigStorageCageDetailsMapper; |
| | | |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | |
| | | @Override |
| | | public BigStorageCageDetails feedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails) { |
| | | |
| | | log.info("1、查询理片笼内片序+1等于当前玻璃片序的玻璃"); |
| | | LambdaQueryWrapper<BigStorageCageDetails> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .eq(BigStorageCageDetails::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence() + 1); |
| | | BigStorageCageDetails layoutSlotInfo; |
| | | layoutSlotInfo= bigStorageCageDetailsMapper.selectOne(wrapper); |
| | | |
| | | BeanUtils.copyProperties(glassInfo, bigStorageCageDetails); |
| | | |
| | | log.info("2、查询理片笼内片序+1等于当前玻璃片序的玻璃的结果不为空时"); |
| | | if (layoutSlotInfo.getSlot() != null) { |
| | | bigStorageCageDetails.setSlot(layoutSlotInfo.getSlot()); |
| | | } else { |
| | | log.info("3、查询理片笼内片序+1等于当前玻璃片序的玻璃的结果为空时获取当前玻璃版图id是否存在理片笼内"); |
| | | LambdaQueryWrapper<BigStorageCageDetails> BigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | BigStorageCageDetailslambdaQueryWrapper |
| | | .select(BigStorageCageDetails::getTemperingLayoutId); |
| | | layoutSlotInfo = bigStorageCageDetailsMapper.selectOne(BigStorageCageDetailslambdaQueryWrapper); |
| | | |
| | | if(layoutSlotInfo != null){ |
| | | log.info("4、获取笼子内适合的格子"); |
| | | BigStorageCage bigStorageCage=bigStorageCageSlot(layoutSlotInfo.getDeviceId()); |
| | | bigStorageCageDetails.setSlot(bigStorageCage.getSlot()); |
| | | }else{ |
| | | log.info("5、获取每个笼子版图id的个数"); |
| | | QueryWrapper<BigStorageCageDetails> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("a.device_id", "COUNT(DISTINCT b.tempering_layout_id) AS layoutCount") |
| | | .groupBy("a.device_id") |
| | | .apply("LEFT JOIN (SELECT device_id, tempering_layout_id FROM big_storage_cage_details) b ON a.device_id = b.device_id AND a.slot = b.slot") |
| | | .orderByAsc("layoutCount") |
| | | .orderByAsc("a.device_id"); |
| | | List<Map<String, Object>> BigStorageCageDetailsCount= bigStorageCageDetailsMapper.selectMaps(queryWrapper); |
| | | |
| | | log.info("5、查询笼子内是否有合适的格子"); |
| | | for (Map<String, Object> map : BigStorageCageDetailsCount) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | int deviceId = Integer.parseInt(entry.getKey()); |
| | | BigStorageCage bigStorageCage=bigStorageCageSlot(deviceId); |
| | | if(bigStorageCage!=null){ |
| | | bigStorageCageDetails.setSlot(bigStorageCage.getSlot()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | log.info("6、当找到合适的格子时添加玻璃到笼子表"); |
| | | if (bigStorageCageDetails.getSlot() != null) { |
| | | bigStorageCageDetails.setState(0); |
| | | bigStorageCageDetailsMapper.insert(bigStorageCageDetails); |
| | | updateRemainWidth(bigStorageCageDetails.getSlot()) ; |
| | | } |
| | | return bigStorageCageDetails; |
| | | } |
| | | |
| | | //获取笼子内的空格子 |
| | | private BigStorageCage bigStorageCageSlot(Integer deviceId) { |
| | | LambdaQueryWrapper<BigStorageCage> bigStorageCageWrapper=new LambdaQueryWrapper<>(); |
| | | bigStorageCageWrapper |
| | | .eq(BigStorageCage::getRemainWidth,"5000") |
| | | .eq(BigStorageCage::getEnableState,"0") |
| | | .eq(BigStorageCage::getDeviceId,deviceId) |
| | | .orderByAsc(BigStorageCage::getSlot) |
| | | .last("LIMIT 1"); |
| | | return bigStorageCageMapper.selectOne(bigStorageCageWrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean outGlass() { |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.list(); |
| | | log.info("1、查询钢化小片任务表是否有待出玻璃"+temperingGlassInfoList.size()); |
| | | |
| | | if(temperingGlassInfoList!=null){ |
| | | temperingGlassInfoService.addOutTask(temperingGlassInfoList); |
| | | log.info("2、添加任务到任务表"); |
| | | return true; |
| | | }else{ |
| | | log.info("3、没有可出的玻璃时获取是否有小片到齐的版图"); |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | bigStorageCageDetailslambdaQueryWrapper |
| | | .select(BigStorageCageDetails::getTemperingLayoutId) |
| | | .groupBy(BigStorageCageDetails::getTemperingLayoutId); |
| | | List<Map<String, Object>> temperingLayoutIdList = bigStorageCageDetailsMapper.selectMaps(bigStorageCageDetailslambdaQueryWrapper); |
| | | for (Map<String, Object> map : temperingLayoutIdList) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String layoutId = entry.getKey().substring(0, entry.getKey().indexOf('-')); |
| | | String layoutNum = entry.getKey().substring(entry.getKey().indexOf('-') + 1); |
| | | if (layoutNum.equals(entry.getValue())) { |
| | | //4、添加此钢化版图id所有小片小片到钢化小片表 |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //计算格子剩余宽度 |
| | | @Override |
| | | public void updateRemainWidth(int slot) { |
| | | log.info("获取该格子内玻璃信息,计算格子剩余宽度"); |
| | | Integer width = 5000; |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList = Collections.singletonList(bigStorageCageDetailsMapper.selectById(slot)); |
| | | for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList |
| | | ) { |
| | | width -= Integer.parseInt(bigStorageCageDetails.getWidth().toString()) + bigStorageCageDetails.getGap(); |
| | | } |
| | | //修改格子剩余宽度 |
| | | BigStorageCage bigStorageCage = new BigStorageCage(); |
| | | bigStorageCage.setRemainWidth(width); |
| | | UpdateWrapper<BigStorageCage> bigStorageCageWrapper = new UpdateWrapper<>(); |
| | | bigStorageCageWrapper.eq("remain_width", width); |
| | | bigStorageCageMapper.update(bigStorageCage, bigStorageCageWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageCage> querybigStorageCageDetail() { |
| | | //1、获取大理片笼信息 |
| | | List<BigStorageCage> bigStorageCages = bigStorageCageMapper.selectList(null); |
| | | log.info("1、获取大理片笼信息完成,获取到的数据{}", bigStorageCages.size()); |
| | | //2获取理片笼所有信息 |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList = bigStorageCageDetailsMapper.selectList(null); |
| | | Map<Integer, List<BigStorageCageDetails>> listMap = bigStorageCageDetailsList.stream().collect(Collectors.groupingBy(BigStorageCageDetails::getSlot)); |
| | | for (BigStorageCage bigStorageCage : bigStorageCages) { |
| | | List<BigStorageCageDetails> bigStorageCageDetails = listMap.get(bigStorageCage.getSlot()); |
| | | bigStorageCage.setBigStorageCageDetails(bigStorageCageDetails); |
| | | } |
| | | return bigStorageCages; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.controller; |
| | | |
| | | |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @ApiModel("进片任务信息") |
| | | @RestController |
| | | @RequestMapping("/userinfo/big-storage-cage-feed-task") |
| | | public class BigStorageCageFeedTaskController { |
| | | |
| | | @Autowired |
| | | private BigStorageCageFeedTaskService bigStorageCageFeedTaskService; |
| | | @ApiOperation("进片任务信息") |
| | | @GetMapping("/querybigStorageCageTask") |
| | | public List<BigStorageCageFeedTask> querybigStorageCageFeedTask(int taskState) { |
| | | return bigStorageCageFeedTaskService.querybigStorageCageFeedTask(taskState); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.userinfo.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @ApiModel("出片任务信息") |
| | | @RestController |
| | | @RequestMapping("/userinfo/big-storage-cage-out-task") |
| | | public class BigStorageCageOutTaskController { |
| | | |
| | | @Autowired |
| | | private BigStorageCageOutTaskService bigStorageCageOutTaskService; |
| | | @ApiOperation("进片任务信息") |
| | | @GetMapping("/querybigStorageCageTask") |
| | | public List<BigStorageCageOutTask> querybigStorageCageOutTask(int taskState) { |
| | | return bigStorageCageOutTaskService.querybigStorageCageOutTask(taskState); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.bigstoragetask.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCageFeedTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | private Integer tragetSlot; |
| | | |
| | | private Integer taskType; |
| | | |
| | | private Integer taskState; |
| | | |
| | | private Integer line; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstoragetask.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCageOutTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | private Integer startSlot; |
| | | |
| | | private Integer endSlot; |
| | | |
| | | private Integer trainNumber; |
| | | |
| | | private Integer serialNumber; |
| | | |
| | | private Integer taskState; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstoragetask.mapper; |
| | | |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface BigStorageCageFeedTaskMapper extends BaseMapper<BigStorageCageFeedTask> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstoragetask.mapper; |
| | | |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface BigStorageCageOutTaskMapper extends BaseMapper<BigStorageCageOutTask> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.bigstoragetask.service; |
| | | |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface BigStorageCageFeedTaskService extends IService<BigStorageCageFeedTask> { |
| | | |
| | | void addFeedTask(BigStorageCageDetails slotInfo, Integer plcFeedReqLine, int taskType); |
| | | |
| | | List<BigStorageCageFeedTask> querybigStorageCageFeedTask(int taskState); |
| | | } |
New file |
| | |
| | | package com.mes.bigstoragetask.service; |
| | | |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface BigStorageCageOutTaskService extends IService<BigStorageCageOutTask> { |
| | | |
| | | List<BigStorageCageOutTask> querybigStorageCageOutTask(int taskState); |
| | | |
| | | void updateOutTask(); |
| | | |
| | | void deleteOutTask(Long taskId); |
| | | } |
New file |
| | |
| | | package com.mes.bigstoragetask.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper; |
| | | import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import net.bytebuddy.matcher.FilterableList; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Service |
| | | public class BigStorageCageFeedTaskServiceImpl extends ServiceImpl<BigStorageCageFeedTaskMapper, BigStorageCageFeedTask> implements BigStorageCageFeedTaskService { |
| | | |
| | | @Override |
| | | public void addFeedTask(BigStorageCageDetails slotInfo, Integer plcFeedReqLine, int taskType){ |
| | | BigStorageCageFeedTask bigStorageCageFeedTask=new BigStorageCageFeedTask(); |
| | | bigStorageCageFeedTask.setId(slotInfo.getId()); |
| | | bigStorageCageFeedTask.setTaskState(0); |
| | | bigStorageCageFeedTask.setLine(plcFeedReqLine); |
| | | bigStorageCageFeedTask.setTragetSlot(slotInfo.getSlot()); |
| | | bigStorageCageFeedTask.setTaskType(taskType); |
| | | baseMapper.insert(bigStorageCageFeedTask); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageCageFeedTask> querybigStorageCageFeedTask(int taskState){ |
| | | LambdaQueryWrapper<BigStorageCageFeedTask> getFeedTaskWrapper=new LambdaQueryWrapper<>(); |
| | | getFeedTaskWrapper.eq(BigStorageCageFeedTask::getTaskState,1); |
| | | return baseMapper.selectList(getFeedTaskWrapper); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.bigstoragetask.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageOutTaskMapper; |
| | | import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class BigStorageCageOutTaskServiceImpl extends ServiceImpl<BigStorageCageOutTaskMapper, BigStorageCageOutTask> implements BigStorageCageOutTaskService { |
| | | |
| | | @Resource |
| | | TemperingGlassInfoMapper temperingGlassInfoMapper; |
| | | @Resource |
| | | BigStorageCageOutTaskMapper bigStorageCageOutTaskMapper; |
| | | @Resource |
| | | BigStorageCageDetailsMapper bigStorageCageDetailsMapper; |
| | | @Override |
| | | public List<BigStorageCageOutTask> querybigStorageCageOutTask(int taskState){ |
| | | log.info("根据传入的任务状态查询任务信息:"+taskState); |
| | | LambdaQueryWrapper<BigStorageCageOutTask> getOutTaskWrapper=new LambdaQueryWrapper<>(); |
| | | getOutTaskWrapper.eq(BigStorageCageOutTask::getTaskState,taskState); |
| | | return baseMapper.selectList(getOutTaskWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void updateOutTask(){ |
| | | List<BigStorageCageOutTask> bigStorageCageOutTaskList=querybigStorageCageOutTask(1); |
| | | log.info("查询任务表是否有已完成的出片任务"+bigStorageCageOutTaskList.size()); |
| | | for (BigStorageCageOutTask bigStorageCageOutTask:bigStorageCageOutTaskList |
| | | ) { |
| | | deleteOutTask(bigStorageCageOutTask.getId()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteOutTask(Long taskId){ |
| | | log.info("根据任务id修改钢化小片表状态,删除已完成的出片任务,删除笼子表玻璃"); |
| | | temperingGlassInfoMapper.deleteById(taskId); |
| | | bigStorageCageOutTaskMapper.deleteById(taskId); |
| | | bigStorageCageDetailsMapper.deleteById(taskId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.component; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; |
| | | import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; |
| | | import com.mes.edgstoragetask.service.TaskCacheService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | public class PlcStorageCage extends Thread { |
| | | |
| | | @Autowired |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Autowired |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private BigStorageCageFeedTaskService bigStorageCageFeedTaskService; |
| | | @Autowired |
| | | private BigStorageCageOutTaskService bigStorageCageOutTaskService; |
| | | @Autowired |
| | | private TaskCacheService taskCacheService; |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | try { |
| | | Thread.sleep(300); |
| | | boolean bigStorageCageFullAlarm=false; |
| | | |
| | | String plcD01FeedReq = "0"; |
| | | String plcD04FeedReq = "0"; |
| | | String plcFeedGlassid = "111"; |
| | | String plcFeedReqLine="0"; |
| | | if("1".equals(plcD01FeedReq)){ |
| | | plcFeedReqLine="1"; |
| | | }else { |
| | | //plc任务发送字0 |
| | | } |
| | | if("1".equals(plcD04FeedReq)){ |
| | | plcFeedReqLine="2"; |
| | | }else { |
| | | //plc任务发送字0 |
| | | } |
| | | |
| | | if (!("0".equals(plcFeedReqLine))) { |
| | | log.info("1、Plc进片请求时"); |
| | | BigStorageCageDetails bigStorageCageDetails = new BigStorageCageDetails(); |
| | | GlassInfo glassInfo = glassInfoService.getById(plcFeedGlassid); |
| | | log.info("2、根据玻璃id获取玻璃信息"+glassInfo); |
| | | BigStorageCageDetails slotInfo = bigStorageCageService.feedGlass(glassInfo, bigStorageCageDetails); |
| | | if (slotInfo != null) { |
| | | int taskType=taskCacheService.judgeTasktype(); |
| | | log.info("3、查询任务表判断当前任务类型为上车等到还是上车启动"+taskType); |
| | | bigStorageCageFeedTaskService.addFeedTask(slotInfo,Integer.parseInt(plcFeedReqLine),taskType); |
| | | log.info("4、添加任务到任务表"); |
| | | //plc任务发送字1 |
| | | bigStorageCageFullAlarm=false; |
| | | }else{ |
| | | //理片笼爆笼报警 |
| | | bigStorageCageFullAlarm=true; |
| | | } |
| | | }else{ |
| | | List<BigStorageCageFeedTask> bigStorageCageFeedTaskList=bigStorageCageFeedTaskService.querybigStorageCageFeedTask(1); |
| | | log.info("5、查询任务表是否有已经完成的进片任务"+bigStorageCageFeedTaskList.size()); |
| | | for (BigStorageCageFeedTask bigStorageCageFeedTask:bigStorageCageFeedTaskList |
| | | ) { |
| | | BigStorageCageDetails bigStorageCageDetails=new BigStorageCageDetails(); |
| | | bigStorageCageDetails.setId(bigStorageCageFeedTask.getId()); |
| | | bigStorageCageDetails.setState(1); |
| | | bigStorageCageDetailsService.updateById(bigStorageCageDetails); |
| | | log.info("6、修改理片笼详情玻璃状态"); |
| | | bigStorageCageFeedTaskService.removeById(bigStorageCageFeedTask); |
| | | log.info("7、删除已经完成的进片任务"); |
| | | } |
| | | } |
| | | |
| | | //出片请求 |
| | | String plcOutReq = "0"; |
| | | boolean result = false; |
| | | if ("1".equals(plcOutReq)) { |
| | | result=bigStorageCageService.outGlass(); |
| | | log.info("8、出片请求时调用出片接口"+result); |
| | | if (result) { |
| | | //plc任务发送字1 |
| | | } |
| | | }else{ |
| | | bigStorageCageOutTaskService.updateOutTask(); |
| | | //plc任务发送字0 |
| | | } |
| | | |
| | | //显示剩余空格子 |
| | | |
| | | //报警信息 |
| | | jsonObject.append("bigStorageCageFullAlarm", bigStorageCageFullAlarm); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.userinfo.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/userinfo/task-cache") |
| | | public class TaskCacheController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.edgstoragetask.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TaskCache implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID编号 |
| | | */ |
| | | @TableId("ID") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 起始 |
| | | */ |
| | | private String startCell; |
| | | |
| | | /** |
| | | * 目标 |
| | | */ |
| | | private String endCell; |
| | | |
| | | /** |
| | | * 任务类型 1:进 2:出 |
| | | */ |
| | | private String taskType; |
| | | |
| | | /** |
| | | * 任务状态 0 未开始 1已完成 |
| | | */ |
| | | private String taskStauts; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragetask.mapper; |
| | | |
| | | import com.mes.edgstoragetask.entity.TaskCache; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface TaskCacheMapper extends BaseMapper<TaskCache> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragetask.service; |
| | | |
| | | import com.mes.edgstoragetask.entity.TaskCache; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | public interface TaskCacheService extends IService<TaskCache> { |
| | | |
| | | int judgeTasktype(); |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragetask.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper; |
| | | import com.mes.edgstoragetask.entity.TaskCache; |
| | | import com.mes.edgstoragetask.mapper.TaskCacheMapper; |
| | | import com.mes.edgstoragetask.service.TaskCacheService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @Qualifier("") |
| | | @Service |
| | | public class TaskCacheServiceImpl extends ServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | @Resource |
| | | private BigStorageCageFeedTaskMapper bigStorageCageFeedTaskMapper; |
| | | @Override |
| | | public int judgeTasktype(){ |
| | | //判断根据当前卧转立任务与磨边线任务判断是否启动卧转立 |
| | | // for (int i=1;i<=2;i++){ |
| | | // //查询卧转立当前任务 |
| | | // int width=5000; |
| | | // int num=0; |
| | | // List<BigStorageCageFeedTask> bgStorageCageFeedTask =bigStorageCageFeedTaskMapper.(); |
| | | // //查询磨边线当前任务 |
| | | // LambdaQueryWrapper<TaskCache> taskCacheWrapper=new LambdaQueryWrapper<>(); |
| | | // taskCacheWrapper.eq(TaskCache::getTaskStauts,"0"); |
| | | // List<TaskCache> taskCacheList=taskCacheService.list(taskCacheWrapper); |
| | | // //判断当前线路还需要再上几片才能满足小车宽度 |
| | | // for (TaskCache taskCache:taskCacheList |
| | | // ) { |
| | | // if(taskCache.getId().equals("1")){ |
| | | // //进片车宽度减去小片宽度 |
| | | // } |
| | | // } |
| | | // //片数小于等于2时另一条线卧转立启动 |
| | | // log.info("发送卧转立启动信号"); |
| | | // } |
| | | return 0; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/glassInfo") |
| | | public class GlassInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.glassinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class GlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 玻璃信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 磨前宽 |
| | | */ |
| | | private Double edgWidth; |
| | | |
| | | /** |
| | | * 磨前高 |
| | | */ |
| | | private Double edgHeight; |
| | | |
| | | /** |
| | | * 是否配片 |
| | | */ |
| | | private Integer ismultiple; |
| | | |
| | | /** |
| | | * 配片最大宽 |
| | | */ |
| | | private Double maxWidth; |
| | | |
| | | /** |
| | | * 配片最大高 |
| | | */ |
| | | private Double maxHeight; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 原片顺序 |
| | | */ |
| | | private Integer patternSequence; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Long engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
| | | */ |
| | | private Integer ruleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface GlassInfoMapper extends BaseMapper<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface GlassInfoService extends IService<GlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.service.impl; |
| | | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class GlassInfoServiceImpl extends ServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/temperingGlassInfo") |
| | | public class TemperingGlassInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.temperingglass.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TemperingGlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 钢化小片信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface TemperingGlassInfoMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface TemperingGlassInfoService extends IService<TemperingGlassInfo> { |
| | | |
| | | public void addOutTask(List<TemperingGlassInfo> temperingGlassInfoList); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class TemperingGlassInfoServiceImpl extends ServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | |
| | | @Override |
| | | public void addOutTask(List<TemperingGlassInfo> temperingGlassInfoList) { |
| | | double carWidth=5000; |
| | | double gap=50; |
| | | //写入任务到任务表 |
| | | for (TemperingGlassInfo temperingGlassInfo:temperingGlassInfoList |
| | | ) { |
| | | log.info("1、当出片车宽度大于玻璃宽度时"); |
| | | if((carWidth-temperingGlassInfo.getWidth())>0){ |
| | | carWidth-=temperingGlassInfo.getWidth()-gap; |
| | | log.info("2、添加刚小片表信息到任务表"); |
| | | temperingGlassInfo.setState(1); |
| | | baseMapper.updateById(temperingGlassInfo); |
| | | log.info("3、添加刚小片表信息到任务表"); |
| | | BigStorageCageOutTask bigStorageCageOutTask =new BigStorageCageOutTask(); |
| | | bigStorageCageOutTask.setId(temperingGlassInfo.getId()); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8082 |
| | | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false |
| | | username: root |
| | | password: beibo.123/ |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | application: |
| | | name: cacheVerticalGlass |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | port: 6379 |
| | | password: 123456 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>loadGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>servicebase</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/8 13:26 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class LoadGlassModuleApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(LoadGlassModuleApplication.class, args); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.tools.S7control; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | } |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7object getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7object.class) { |
| | | if (instance == null) { |
| | | instance = new S7object(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/upPattenUsage") |
| | | public class UpPattenUsageController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.glassinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class UpPattenUsage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 原片使用情况表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineeringId; |
| | | |
| | | /** |
| | | * 膜系id |
| | | */ |
| | | private Integer filmsId; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 原片版图片序 |
| | | */ |
| | | private Integer layoutSequence; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.glassinfo.entity.UpPattenUsage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpPattenUsageMapper extends BaseMapper<UpPattenUsage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.glassinfo.entity.UpPattenUsage; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface UpPattenUsageService extends IService<UpPattenUsage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.glassinfo.entity.UpPattenUsage; |
| | | import com.mes.glassinfo.mapper.UpPattenUsageMapper; |
| | | import com.mes.glassinfo.service.UpPattenUsageService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class UpPattenUsageServiceImpl extends ServiceImpl<UpPattenUsageMapper, UpPattenUsage> implements UpPattenUsageService { |
| | | |
| | | } |
| | |
| | | package com.mes.workstation.controller; |
| | | |
| | | |
| | | import com.mes.utils.Result; |
| | | import com.mes.workstation.entity.GlassInfo; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import com.mes.workstation.service.UpWorkstationService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public void updateGlassMessage(@RequestBody UpWorkstation upwork) { |
| | | upWorkstationService.updateGlassMessage(upwork); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("开始上片任务") |
| | | @PostMapping("/selectPriority") //开始上片任务 |
New file |
| | |
| | | package com.mes.workstation.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class GlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 玻璃信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 磨前宽 |
| | | */ |
| | | private Double edgWidth; |
| | | |
| | | /** |
| | | * 磨前高 |
| | | */ |
| | | private Double edgHeight; |
| | | |
| | | /** |
| | | * 是否配片 |
| | | */ |
| | | private Integer ismultiple; |
| | | |
| | | /** |
| | | * 配片最大宽 |
| | | */ |
| | | private Double maxWidth; |
| | | |
| | | /** |
| | | * 配片最大高 |
| | | */ |
| | | private Double maxHeight; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 原片顺序 |
| | | */ |
| | | private Integer patternSequence; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Long engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
| | | */ |
| | | private Integer ruleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.workstation.entity; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author wu |
| | | */ |
| | | @Data |
| | | public class UpWorkSequence { |
| | | |
| | | private int sequence; |
| | | |
| | | private int number; |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.workstation.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class UpWorkstation implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 上片工位表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工位号 |
| | | */ |
| | | private Integer workstationId; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private Integer enableState; |
| | | |
| | | /** |
| | | * 工作状态 |
| | | */ |
| | | private Integer workState; |
| | | |
| | | /** |
| | | * 原片宽 |
| | | */ |
| | | private Double patternWidth; |
| | | |
| | | /** |
| | | * 原片高 |
| | | */ |
| | | private Double patternHeigth; |
| | | |
| | | /** |
| | | * 原片厚度 |
| | | */ |
| | | private Double patternThickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsId; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer number; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.workstation.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface LoadGlassMapper extends BaseMapper<UpWorkstation> { |
| | | //判断优先工位吸片 |
| | | @Select("select b.layout_sequence,a.number from up_workstation a left join up_patten_usage b " + |
| | | "on a.pattern_width=b.width and a.pattern_heigth=b.width " + |
| | | "and a.pattern_thickness=b.thickness where a.workstation_id=#{id}") |
| | | Map<String, Object> selectPriority(int id); |
| | | |
| | | } |
| | |
| | | package com.mes.workstation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | /** |
| | | * 增加人工输入的工位玻璃信息 |
| | | * |
| | | * @param upwork |
| | | */ |
| | | void updateGlassMessage(UpWorkstation upwork); |
| | |
| | | package com.mes.workstation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | //import com.mes.common.S7object; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.workstation.entity.UpWorkSequence; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import com.mes.workstation.mapper.UpWorkstationMapper; |
| | | import com.mes.workstation.service.UpWorkstationService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
New file |
| | |
| | | server: |
| | | port: 8083 |
| | | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | pp: |
| | | url: jdbc:mysql://10.153.19.150:3306/pp?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | application: |
| | | name: loadGlass |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | port: 6379 |
| | | password: 123456 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.pp.entity.OptimizeDetail; |
| | | import com.mes.pp.service.OptimizeDetailService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/16 9:46 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = LoadGlassModuleApplication.class) |
| | | public class ApplicationTest { |
| | | |
| | | |
| | | @Resource |
| | | OptimizeDetailService optimizationDetailService; |
| | | |
| | | @Test |
| | | public void test() { |
| | | List<OptimizeDetail> list = optimizationDetailService.list(); |
| | | System.out.println("获取记录数:" + list.size()); |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>temperingGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>servicebase</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/8 13:26 |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class TemperingGlassModuleApplication { |
| | | public static void main(String[] args) { |
| | | try { |
| | | SpringApplication.run(TemperingGlassModuleApplication.class, args); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.controller; |
| | | |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingOverService; |
| | | import com.mes.temperingglass.service.TemperingService; |
| | | import com.mes.utils.Result; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @RestController |
| | | @RequestMapping("/temperingGlassInfo") |
| | | |
| | | // TidyUpGlassModule 钢化模块 |
| | | public class TemperingGlassInfoController { |
| | | |
| | | @Autowired |
| | | TemperingService temperingService; |
| | | |
| | | @Autowired |
| | | private TemperingOverService temperingOverService; |
| | | |
| | | @PostMapping("/SelectWaitingGlass") // 查询钢化等片中的版图信息,状态为1的为已到,状态为0的为等待中 |
| | | @ResponseBody |
| | | public Result SelectWaitingGlass(@RequestParam(name = "ProcessId", required = false) String ProcessId) { |
| | | List<TemperingGlassInfo> glass = temperingService.SelectWaitingGlass(); |
| | | System.out.println(glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @GetMapping("/SelectIntoGlass") // 查询进炉中的钢化等片中的版图信息,状态全为1的为已到。 |
| | | @ResponseBody |
| | | public Result SelectIntoGlass(String ProcessId) { |
| | | List<TemperingGlassInfo> glass = temperingService.SelectIntoGlass(); |
| | | System.out.println(glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @GetMapping("/SelectOutGlass") //钢化后显示出炉的版图信息 |
| | | @ResponseBody |
| | | public Result SelectOutGlass(String ProcessId) { |
| | | List<TemperingGlassInfo> glass = temperingOverService.SelectOutGlass(); |
| | | System.out.println(glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineerId; |
| | | private Long engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
New file |
| | |
| | | package com.mes.temperingglass.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class TemperingGlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 钢化小片信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TemperingGlassInfoMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface TemperingMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | |
| | | //查询该玻璃的尺寸和坐标 |
| | | //@Select("select *from glass_info where id=#{glassid};") |
| | | //GlassInfo SelectGlass(String glassid); |
| | | //是否可以发送进炉信号 |
| | | @Select("select count(*) from glass_info where id=#{glassid};") |
| | | int SelectTempering(String glassid); |
| | | |
| | | //查询等待中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,count(state)state from tempering_glass_info GROUP BY flowcard_id,state)b on a.flowcard_id=b.flowcard_id where b.state=2") |
| | | List<TemperingGlassInfo> SelectWaitingGlass(); |
| | | |
| | | //查询进炉中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=1)b on a.flowcard_id=b.flowcard_id where b.state1=1") |
| | | List<TemperingGlassInfo> SelectInGlass(); |
| | | |
| | | //查询钢化后的钢化版图信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=2)b on a.flowcard_id=b.flowcard_id where b.state1=2") |
| | | List<TemperingGlassInfo> SelectOutGlass(); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface TemperingGlassInfoService extends IService<TemperingGlassInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TemperingOverService { |
| | | private final TemperingMapper temperingMapper; |
| | | |
| | | //PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | public TemperingOverService(TemperingMapper temperingMapper) { |
| | | this.temperingMapper = temperingMapper; |
| | | } |
| | | |
| | | //接收出炉信号和炉号 |
| | | public String SelectOutSignal() { |
| | | |
| | | //S7control.getinstance().WriteWord("出炉信号", (short)1); |
| | | return "GlassInfo"; |
| | | } |
| | | |
| | | //发送确认收到信号 |
| | | public void OverSignal() { |
| | | //S7control.getinstance().WriteWord("确认字", (short)1); |
| | | } |
| | | |
| | | //显示钢化出炉后的版图信息 |
| | | public List<TemperingGlassInfo> SelectOutGlass() { |
| | | return temperingMapper.SelectOutGlass(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service; |
| | | //import com.mes.temperingglass.entity.GlassInfo; |
| | | |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingMapper; |
| | | import com.mes.tools.S7control; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TemperingService { |
| | | |
| | | private final TemperingMapper temperingMapper; |
| | | private S7control s7control; |
| | | |
| | | public TemperingService(TemperingMapper temperingMapper) { |
| | | this.temperingMapper = temperingMapper; |
| | | } |
| | | |
| | | // //接收id返回坐标和数据 |
| | | // public GlassInfo SelectOutGlass (String glassid) { |
| | | // GlassInfo GlassInfo = temperingMapper.SelectGlass(glassid); |
| | | // return GlassInfo; |
| | | // } |
| | | //发送坐标信息 |
| | | public void SendCoordinate(short glassX, short glassY) { |
| | | s7control.WriteWord("DB100.10", glassX); |
| | | s7control.WriteWord("DB100.10", glassY); |
| | | } |
| | | |
| | | //判断是否可以发送进炉信号 |
| | | public int SelectTempering(String glassid) { |
| | | int tempering = temperingMapper.SelectTempering(glassid); |
| | | if (tempering == 1) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | //发送进炉信号 |
| | | public void SendIntoGlass(short start) { |
| | | s7control.WriteWord("DB100.10", start); |
| | | } |
| | | |
| | | //接受完成字回复确认字 |
| | | public void SendIntoGlass() { |
| | | s7control.WriteWord("DB100.10", (short) 1); |
| | | } |
| | | |
| | | //显示等待中的版图 |
| | | public List<TemperingGlassInfo> SelectWaitingGlass() { |
| | | List<TemperingGlassInfo> WaitingGlass = temperingMapper.SelectWaitingGlass(); |
| | | return WaitingGlass; |
| | | } |
| | | |
| | | //显示正在进炉的版图 |
| | | public List<TemperingGlassInfo> SelectIntoGlass() { |
| | | List<TemperingGlassInfo> IntoGlass = temperingMapper.SelectInGlass(); |
| | | return IntoGlass; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class TemperingGlassInfoServiceImpl extends ServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8084 |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | application: |
| | | name: temperingGlass |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | port: 6379 |
| | | password: 123456 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>moduleService</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>unLoadGlass</artifactId> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>5.2.4</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.code.gson</groupId> |
| | | <artifactId>gson</artifactId> |
| | | <version>2.8.9</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.github.yulichang</groupId> |
| | | <artifactId>mybatis-plus-join</artifactId> |
| | | <version>1.2.4</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/7 14:36RRRR |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class UnLoadGlassApplication { |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication springApplication = new SpringApplication(UnLoadGlassApplication.class); |
| | | ConfigurableApplicationContext applicationContext = springApplication.run(args); |
| | | WebSocketServer.setApplicationContext(applicationContext); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import static com.mes.tools.InitUtil.readAndUpdateWordValues; |
| | | |
| | | public class PLCAutoMes extends Thread { |
| | | |
| | | // 用于存储应用程序的配置信息 |
| | | private Configuration config; |
| | | private static InitUtil initUtil; |
| | | |
| | | |
| | | // 单例实例 |
| | | private static PLCAutoMes instance; |
| | | private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath(); |
| | | private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath(); |
| | | private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath(); |
| | | // private static String PlcParameter = PLCAutomaticParameterSettingReview2.class |
| | | // .getResource("/JsonFile/PlcParameter.json").getPath(); |
| | | // private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json") |
| | | // .getPath(); |
| | | // private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json") |
| | | // .getPath(); |
| | | private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath(); |
| | | // private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath(); |
| | | |
| | | // 调用initword方法 |
| | | |
| | | // |
| | | // public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm); |
| | | public static PlcParameterObject PlcMesObject = initUtil.initword(PlcMes); |
| | | public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead); |
| | | public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe); |
| | | |
| | | // 私有构造函数 |
| | | public PLCAutoMes() throws IOException { |
| | | |
| | | initUtil = new InitUtil(); |
| | | } |
| | | |
| | | // 获取单例实例 |
| | | public static synchronized PLCAutoMes getInstance() throws IOException { |
| | | if (instance == null) { |
| | | instance = new PLCAutoMes(); |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // System.out.println(jsonFilePath); |
| | | |
| | | // readAndUpdateWordValues(PlcReadObject); |
| | | readAndUpdateWordValues(PlcMesObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | // readAndUpdateWordValues(PlcframeObject); |
| | | |
| | | // readAndUpdateWordValues(plcStateObject); |
| | | // int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex(); |
| | | // System.out.println(index); |
| | | // PlcMesObject.getPlcParameter("AddStart").getAddress(index); |
| | | // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index)); |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("FeedID"); |
| | | addresses.add("AddStart"); |
| | | // System.out.println(addresses); |
| | | // System.out.println(PlcMesObject.getPlcParameterValues(addresses)); |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("FeedID"); |
| | | addresses2.add("FeedCarStatus"); |
| | | |
| | | // System.out.println(PlcReadObject.getPlcParameterValues(addresses2)); |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.downworkstation.service.DownGlassLogic; |
| | | import com.mes.tools.WebSocketServer; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.function.Supplier; |
| | | |
| | | @Component |
| | | public class Plchome extends Thread { |
| | | private int i = 1; |
| | | private static final Logger log = LogManager.getLogger(Plchome.class); |
| | | |
| | | private final Supplier<DownGlassLogic> plcServiceSupplier; |
| | | |
| | | public Plchome() { |
| | | this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(DownGlassLogic.class); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | i++; |
| | | Thread.sleep(100); |
| | | DownGlassLogic plcService = plcServiceSupplier.get(); |
| | | // plcService.performPlcActions(); |
| | | //plcService.unloadpush(); |
| | | |
| | | //当下片任务表状态为1时候将数据插入到下片玻璃信息表 |
| | | plcService.insertdownglassinfo(); |
| | | |
| | | |
| | | //当机械手任务表中状态为1 更新已经落架数量,并且把下片任务表的那条记录删掉 工位表流程卡绑定了架子 |
| | | plcService.downWorkstation(); |
| | | |
| | | |
| | | } catch (InterruptedException e) { |
| | | Thread.currentThread().interrupt(); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | // System.out.println(arraylist6); |
| | | jsonObject.append("data", 1); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | log.info("准备向 WebSocket 服务器发送消息: {}", jsonObject.toString()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class S7control { |
| | | |
| | | S7PLC s7PLC; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7control instance = null; |
| | | |
| | | private S7control() { |
| | | if (s7PLC == null) |
| | | s7PLC = new S7PLC(plcType, ip, port, 0, 0); |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7control getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7control.class) { |
| | | if (instance == null) { |
| | | instance = new S7control(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | /** |
| | | * 关闭西门子s7通讯连接 |
| | | */ |
| | | public void CloseS7client() { |
| | | if (s7PLC == null) |
| | | s7PLC.close(); |
| | | s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * s7通讯连接状态 |
| | | */ |
| | | public boolean CheckConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个word |
| | | * |
| | | * @param address 地址 |
| | | * @param data word的值 |
| | | */ |
| | | public void WriteWord(String address, short data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeInt16(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteWord(String address, List<Short> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 16); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addInt16(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个Bit |
| | | * |
| | | * @param address 地址 |
| | | * @param data Bit的值 |
| | | */ |
| | | public void WriteBit(String address, Boolean data) { |
| | | if (s7PLC == null) |
| | | return; |
| | | s7PLC.writeBoolean(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas bit的值 |
| | | */ |
| | | public void WriteBit(List<String> address, List<Boolean> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < address.size(); i++) { |
| | | addressWrite.addBoolean(address.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteBit(String address, List<Boolean> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 1); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addBoolean(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个byte |
| | | * |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | s7PLC.writeByte(address, datas); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(List<String> address) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | |
| | | try { |
| | | return s7PLC.readInt16(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | | |
| | | // 可以解析出地址中的数字部分,并转换为整数 |
| | | return 0; |
| | | } |
| | | |
| | | private String getAddressFromIndex(int index) { |
| | | |
| | | // 整数转换为地址格式的字符串 |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个word |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | |
| | | try { |
| | | return s7PLC.readByte(address, count); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 按bit位 0 flase 1 true 读取结果 |
| | | * |
| | | * @param addresslist 地址集 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(List<String> addresslist) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | return s7PLC.readBoolean(addresslist); |
| | | } |
| | | |
| | | //读取不连续地址bit |
| | | public List<Boolean> readBits(List<String> addressList) { |
| | | if (s7PLC == null || addressList.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | List<Boolean> values = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | boolean value = s7PLC.readBoolean(address); |
| | | values.add(value); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | return values; |
| | | } |
| | | |
| | | |
| | | //读取String |
| | | public List<String> readStrings(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public List<String> readStringsandword(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | if (address.contains("-")) { |
| | | address = address.substring(0, address.indexOf("-")); |
| | | |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | |
| | | } else { |
| | | Short value = s7PLC.readInt16(address); |
| | | result.add(value.toString()); |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //不连续地址写入Word |
| | | public void WriteWord(List<String> address, List<Short> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | for (int i = 0; i < address.size(); i++) { |
| | | String addr = address.get(i); |
| | | short data = datas.get(i); |
| | | |
| | | if (addr.contains("-")) { |
| | | outmesid(String.valueOf(data), addr); // 单独处理带破折号的地址 |
| | | } else { |
| | | s7PLC.writeInt16(addr, data); // 将数据写入单个地址 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //字符串写入 |
| | | public void outmesid(String data, String addr) { |
| | | // System.out.println("outmesid: " + data); |
| | | List<Byte> glassidlist = new ArrayList<>(); |
| | | String[] parts = addr.split("-"); |
| | | if (parts.length == 2) { |
| | | addr = parts[0]; // 只保留 "-" 前面的部分 |
| | | } |
| | | for (char iditem : data.toCharArray()) { |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | S7control.getinstance().WriteByte(addr, bytes); |
| | | } |
| | | |
| | | //读取不连续word |
| | | public List<Short> readWords(List<String> addresses) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | try { |
| | | |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | } |
| | | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | //读取时间 |
| | | public Long readtime(String address) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | try { |
| | | return s7PLC.readTime(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void writetime(String address, long datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | |
| | | s7PLC.writeTime(address, datas); // 将数据写入单个地址 |
| | | } |
| | | |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 从指定的地址开始 连续按bit位读取 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 长度 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | List<String> addresslist = GetAddressList(address, count, 1); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | ; |
| | | |
| | | |
| | | public void writeString(String addr, String data) { |
| | | s7PLC.writeString(addr, data); |
| | | } |
| | | |
| | | |
| | | private List<String> GetAddressList(String address, int count, int addedbit) { |
| | | List<String> addresslist = new ArrayList<String>(); |
| | | |
| | | String[] stringdatas = address.trim().split("\\."); |
| | | if (stringdatas.length < 2 || !address.startsWith("DB")) |
| | | return null; |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 2) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | } else if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | return null; |
| | | |
| | | addresslist.add(address); |
| | | for (int i = 0; i < count - 1; i++) { |
| | | |
| | | int bitcurrent = bitindex + addedbit; |
| | | if (bitcurrent > 7) { |
| | | dbwindex += bitcurrent / 8; |
| | | bitindex = 0; |
| | | } else |
| | | bitindex = bitcurrent; |
| | | |
| | | String endstr = stringdatas.length == 3 ? "." + bitindex : ""; |
| | | addresslist.add(stringdatas[0] + "." + dbwindex + endstr); |
| | | } |
| | | return addresslist; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.config; |
| | | |
| | | import com.mes.common.Plchome; |
| | | import com.mes.device.PLCAutoMes; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | @Order(1) |
| | | |
| | | public class AppRunnerConfig implements ApplicationRunner { |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // TODO Auto-generated method stub |
| | | // |
| | | System.out.println("启动完成"); |
| | | |
| | | |
| | | new PLCAutoMes().start(); |
| | | |
| | | new Plchome().start(); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RestController |
| | | @RequestMapping("/downGlassInfo") |
| | | public class DownGlassInfoController { |
| | | |
| | | |
| | | // Other endpoints can be added for CRUD operations |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.controller; |
| | | |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Api(tags = "下料任务") |
| | | @RestController |
| | | @RequestMapping("/downGlassTask") |
| | | public class DownGlassTaskController { |
| | | |
| | | //todo: 实例代码 待删除 |
| | | @ApiOperation("测试") |
| | | @GetMapping("/index") |
| | | public String index() { |
| | | return "hello world"; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downglassinfo.entity; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @Component |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownGlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片玻璃信息表id |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | |
| | | private String Filmsid; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownGlassTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 起始 |
| | | */ |
| | | private String startCell; |
| | | |
| | | /** |
| | | * 目标 |
| | | */ |
| | | private String endCell; |
| | | |
| | | /** |
| | | * 任务类型 1:进 2:出 |
| | | */ |
| | | private String taskType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsid; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 任务状态 0 未开始 1正在进行 2完成 |
| | | */ |
| | | private Integer taskStauts; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Repository |
| | | public interface DownGlassInfoMapper extends BaseMapper<DownGlassInfo> { |
| | | |
| | | // @Select("SELECT MAX(sequence) FROM down_glass_info WHERE flow_card_id = #{flowCardId} LIMIT 1") |
| | | // Integer getMaxSequenceByFlowCardId(@Param("flowCardId") String flowCardId); |
| | | //// |
| | | // @Delete("delete from down_glass_task where flow_card_id = #{flowCardId}") |
| | | // void deletetask(@Param("flowCardId") String flowCardId); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownGlassTaskMapper extends BaseMapper<DownGlassTask> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | |
| | | public interface DownGlassInfoService extends IService<DownGlassInfo> { |
| | | |
| | | |
| | | Integer getMaxSequenceByFlowCardId(String flowCardId); |
| | | |
| | | void insertDownGlassInfo(DownGlassInfo downGlassInfo); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownGlassTaskService extends IService<DownGlassTask> { |
| | | |
| | | List<DownGlassTask> getUnloadingTaskState(); |
| | | |
| | | void updateTaskStateToZero(String flowCardId); |
| | | |
| | | void deleteTask(String flowCardId); |
| | | |
| | | DownGlassTask selectLastOutCacheInfo(String endCell); |
| | | |
| | | Integer insertCacheTask(int id, String start, String end, String type, double width, double height, String filmsId, double thickness, String flowCardId); |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { |
| | | |
| | | // 根据流程卡号查询最大序号 |
| | | @Override |
| | | public Integer getMaxSequenceByFlowCardId(String flowCardId) { |
| | | QueryWrapper<DownGlassInfo> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("flow_card_id", flowCardId); |
| | | queryWrapper.orderByDesc("sequence"); // 按照序号倒序排序 |
| | | queryWrapper.select("sequence").last("LIMIT 1"); // 选择最大序号并限制结果为1条记录 |
| | | DownGlassInfo downGlassInfo = baseMapper.selectOne(queryWrapper); |
| | | if (downGlassInfo != null) { |
| | | return downGlassInfo.getSequence(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public void insertDownGlassInfo(DownGlassInfo downGlassInfo) { |
| | | baseMapper.insert(downGlassInfo); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downglassinfo.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.mapper.DownGlassTaskMapper; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class DownGlassTaskServiceImpl extends ServiceImpl<DownGlassTaskMapper, DownGlassTask> implements DownGlassTaskService { |
| | | |
| | | |
| | | @Override |
| | | public List<DownGlassTask> getUnloadingTaskState() { |
| | | QueryWrapper<DownGlassTask> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_stauts", 1); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTaskStateToZero(String flowCardId) { |
| | | UpdateWrapper<DownGlassTask> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("task_stauts", 0).eq("flow_card_id", flowCardId); |
| | | baseMapper.update(null, updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteTask(String flowCardId) { |
| | | LambdaQueryWrapper<DownGlassTask> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DownGlassTask::getFlowCardId, flowCardId); |
| | | |
| | | baseMapper.delete(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public DownGlassTask selectLastOutCacheInfo(String endCell) { |
| | | QueryWrapper<DownGlassTask> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_type", "2") |
| | | .eq("task_status", "2") |
| | | .eq("end_cell", endCell) |
| | | .last("LIMIT 1"); |
| | | |
| | | return baseMapper.selectOne(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insertCacheTask(int id, String start, String end, String type, double width, double height, String filmsId, double thickness, String flowCardId) { |
| | | DownGlassTask glassInfo = new DownGlassTask(); |
| | | glassInfo.setId(id); |
| | | glassInfo.setStartCell(start); |
| | | glassInfo.setEndCell(end); |
| | | glassInfo.setTaskType(type); |
| | | glassInfo.setWidth(width); |
| | | glassInfo.setHeight(height); |
| | | glassInfo.setFilmsid(filmsId); |
| | | glassInfo.setThickness(thickness); |
| | | glassInfo.setFlowCardId(flowCardId); |
| | | glassInfo.setTaskStauts(0); // 默认任务状态为0 |
| | | |
| | | int rows = baseMapper.insert(glassInfo); |
| | | return rows > 0 ? rows : null; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/downStorageCage") |
| | | public class DownStorageCageController { |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downstorage.controller; |
| | | |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RestController |
| | | @RequestMapping("/down-storage-cage-details") |
| | | public class DownStorageCageDetailsController { |
| | | |
| | | @Autowired |
| | | private DownStorageCageDetailsService downStorageCageDetailsService; |
| | | |
| | | @PostMapping("/add") |
| | | public String addDownStorageCageDetails(@RequestBody DownStorageCageDetails details) { |
| | | downStorageCageDetailsService.addDownStorageCageDetails(details); |
| | | return "Details added successfully"; |
| | | } |
| | | |
| | | // Other CRUD operations can be defined here |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownStorageCage implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片前理片笼表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private String enableState; |
| | | |
| | | /** |
| | | * 剩余 |
| | | */ |
| | | private Integer remainWidth; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownStorageCageDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片前理片笼明细表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | private Integer glassId; |
| | | |
| | | /** |
| | | * 小片在格内的顺序 |
| | | */ |
| | | private Integer sequence; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | |
| | | /** |
| | | * 膜系id |
| | | */ |
| | | private int filmsid; |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * 玻璃间隙 |
| | | */ |
| | | private Integer gap; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import org.apache.ibatis.annotations.Insert; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Mapper |
| | | public interface DownStorageCageDetailsMapper extends BaseMapper<DownStorageCageDetails> { |
| | | // |
| | | // @Select("select * from `glass_info` where id=#{id}") |
| | | // GlassInfo SelectGlassId(String id); |
| | | // 查询笼子内空闲 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is null order by escd.slot") |
| | | List<DownStorageCageDetails> SelectCacheLeisure(); |
| | | |
| | | // 查询符合工位的出片玻璃 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot left join down_workstation as dw on escd.flow_card_id=dw.flow_card_id WHERE escd.slot IS NOT NULL and dw.workstation_id BETWEEN #{start} and #{end} order by escd.tempering_layout_id,escd.tempering_feed_sequence") |
| | | List<DownStorageCageDetails> SelectCacheOut(int start, int end); |
| | | |
| | | // 查询笼子内信息 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot order by esc.slot") |
| | | List<DownStorageCageDetails> SelectCachInfo(); |
| | | |
| | | // 查询可进此片玻璃的栅格号 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null and escd.tempering_layout_id=#{tempering_layout_id} and escd.tempering_feed_sequence<#{tempering_feed_sequence} and esc.remain_width-#{width}>0 order by escd.tempering_feed_sequence") |
| | | List<DownStorageCageDetails> SelectIsExistIntoCache(Integer tempering_layout_id, Integer tempering_feed_sequence, |
| | | double width); |
| | | |
| | | // 查询可进此片玻璃的栅格号 |
| | | @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null escd.tempering_layout_id<#{tempering_layout_id} and esc.remain_width-#{width}>0 order by escd.tempering_layout_id desc,escd.tempering_feed_sequence") |
| | | List<DownStorageCageDetails> SelectIsExistIntoCache(Integer tempering_layout_id, double width); |
| | | |
| | | // // 查询全部任务 |
| | | // @Select("select * from down_glass_task") |
| | | // List<DownGlassTask> SelectCacheInfoAll(); |
| | | // |
| | | // // 查询进片任务 |
| | | // @Select("select * from down_glass_task where task_type='1' and task_stauts='0'") |
| | | // List<DownGlassTask> SelectInputCacheInfo(); |
| | | // |
| | | // // 查询出片任务 |
| | | // @Select("select * from down_glass_task where task_type='2' and task_stauts='0'") |
| | | // List<DownGlassTask> SelectOutCacheInfo(); |
| | | |
| | | // 查询 A06 或 A11 最新的一片 出片任务 |
| | | // @Select("select * from down_glass_task where task_type='2' and task_stauts='2' and end_cell=#{EndCell} limit 1") |
| | | // GlassInfo SelectLastOutCacheInfo(String EndCell); |
| | | |
| | | // 修改笼子内信息 |
| | | // @Update("update") |
| | | // Integer UpdateCache(@Param("id") Integer id, @Param("order_id") String order_id); |
| | | |
| | | // 添加下片任务 |
| | | @Insert("INSERT into down_glass_task VALUES(#{id},#{start},#{end},#{type},0,)") |
| | | Integer insertCacheTask(String id, String start, String end, String type, double width, double height, Integer filmsId, double thickness, String flowCardId); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownStorageCageMapper extends BaseMapper<DownStorageCage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service; |
| | | |
| | | import com.mes.common.PLCAutoMes; |
| | | import com.mes.common.S7control; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Service |
| | | public class DownGlassCacheLogic { |
| | | @Autowired |
| | | private DownStorageCageDetailsMapper selectInfo; |
| | | private GlassInfoService GlassInfoService; |
| | | private DownStorageCageDetailsService downStorageCageDetailsService; |
| | | private DownGlassTaskService downGlassTaskService; |
| | | |
| | | /** |
| | | * @param Number //识别逻辑 不交互 |
| | | */ |
| | | |
| | | public void identify(String Number) { |
| | | //查询任务 |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); |
| | | String s = S7control.getinstance().ReadWord("DB14.26", 1).get(0) + ""; |
| | | boolean isexist = isExist(Number); |
| | | if (isexist) { |
| | | //存在逻辑 1.添加信息 2.回复PLC存在 |
| | | //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); |
| | | } else { |
| | | //不存在逻辑 1.回复PLC不存在 |
| | | //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2); |
| | | } |
| | | } |
| | | |
| | | //下片前理片 |
| | | public static final String RESULT_IN = "1"; |
| | | public static final String RESULT_OUT = "2"; |
| | | public static final String RESULT_IN_OUT = "3"; |
| | | |
| | | public void process() { |
| | | String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + ""; |
| | | String number = S7control.getinstance().ReadWord("DB14.2", 1).get(0) + ""; |
| | | |
| | | // 进片请求 |
| | | if (RESULT_IN.equals(result)) { |
| | | processInto(number); |
| | | } |
| | | // 出片请求 |
| | | else if (RESULT_OUT.equals(result)) { |
| | | processOut(); |
| | | } |
| | | // 进出片请求 |
| | | else if (RESULT_IN_OUT.equals(result)) { |
| | | // 先出后进 |
| | | if (!processOut()) { |
| | | processInto(number); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return //下片前理片 进 |
| | | */ |
| | | |
| | | public boolean processInto(String Number) { |
| | | GlassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class); |
| | | //按id查询玻璃信息表里的玻璃 |
| | | GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number); |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | //存在此玻璃编号 |
| | | if (GlassInfo != null) { |
| | | //同钢化版图内的栅格号 |
| | | List<DownStorageCageDetails> list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getTemperingFeedSequence(), GlassInfo.getWidth()); |
| | | //空栅格号 |
| | | if (list.size() == 0) { |
| | | list = selectInfo.SelectCacheLeisure(); |
| | | } |
| | | //小于此玻璃钢化版图序号的栅格号 |
| | | if (list.size() == 0) { |
| | | list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getWidth()); |
| | | } |
| | | if (list.size() > 0) { |
| | | //存在空格 |
| | | //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) |
| | | //2.回复 1进片 |
| | | DownStorageCageDetails item = list.get(0); |
| | | selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId()); |
| | | |
| | | S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); |
| | | return true; |
| | | } |
| | | |
| | | } else { |
| | | // ID编号不存在 不处理/回复PLC 进行报警提示 |
| | | } |
| | | //返回结果 |
| | | return false; |
| | | } |
| | | |
| | | //理片 出 |
| | | public boolean processOut() { |
| | | // 查询任务 |
| | | String G06 = S7control.getinstance().ReadWord("DB14.56", 1).get(0) + ""; |
| | | String G11 = S7control.getinstance().ReadWord("DB14.58", 1).get(0) + ""; |
| | | String G13 = S7control.getinstance().ReadWord("DB14.58", 1).get(0) + ""; |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | List<DownStorageCageDetails> list = selectInfo.SelectCacheOut(1, 5); |
| | | List<DownStorageCageDetails> list2 = selectInfo.SelectCacheOut(6, 10); |
| | | List<DownStorageCageDetails> list3 = selectInfo.SelectCacheOut(1, 10); |
| | | |
| | | // 按照顺序符合前端出片 |
| | | if (!list.isEmpty()) { |
| | | DownStorageCageDetails item = list.get(0); |
| | | if (G06.equals("0") && G11.equals("1")) { |
| | | // 出到 G06 |
| | | selectInfo.insertCacheTask(item.getGlassId() + "", "0", "06", "2", item.getWidth(), item.getHeight(), item.getFilmsid(), item.getThickness(), item.getFlowCardId()); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "1"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | } |
| | | // 按照顺序符合后端出片 |
| | | } else if (!list2.isEmpty()) { |
| | | DownStorageCageDetails item2 = list2.get(0); |
| | | if (G06.equals("1") && G11.equals("0")) { |
| | | // 出到 G11 |
| | | selectInfo.insertCacheTask(item2.getGlassId() + "", "0", "11", "2", item2.getWidth(), item2.getHeight(), item2.getFilmsid(), item2.getThickness(), item2.getFlowCardId()); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "2"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | } |
| | | // 超出尺寸优先人工出片 人工处理 |
| | | } else if (!list3.isEmpty()) { |
| | | DownStorageCageDetails item3 = list3.get(0); |
| | | if (item3.getHeight() >= 3440 && item3.getWidth() >= 1440) { |
| | | |
| | | String endcell = "06"; |
| | | String SendEndcell = "1"; |
| | | |
| | | selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId()); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | // 返回结果 |
| | | return false; |
| | | } |
| | | |
| | | //查询是否绑定架子 |
| | | // public boolean selectFlowCardId(String FlowCardId){ |
| | | // |
| | | // } |
| | | |
| | | /** |
| | | * @param Number //磨边 不交互 理片和磨边机自己交互 |
| | | */ |
| | | |
| | | public void processMb(String Number) { |
| | | //按id查询玻璃信息表里的玻璃 |
| | | GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number); |
| | | PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; |
| | | if (GlassInfo != null) { |
| | | //发送任务 ID 长 宽 厚 倒角 工艺功能等 |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.22").getAddress(), "N10000"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.24").getAddress(), "1000"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.26").getAddress(), "800"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "60"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.30").getAddress(), "2"); |
| | | S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); |
| | | } |
| | | //返回结果 |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return 查询消息队列里此玻璃ID的数据 |
| | | */ |
| | | public boolean selectMessageId(String Number) { |
| | | //查询是否存在 |
| | | |
| | | GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number); |
| | | if (GlassInfo == null) { |
| | | //返回 不存在 |
| | | return false; |
| | | |
| | | } |
| | | //返回 存在 |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return 删除消息队列里此玻璃ID的数据 |
| | | */ |
| | | |
| | | public boolean deleteMessageId(String Number) { |
| | | //查询是否存在 |
| | | GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number); |
| | | if (GlassInfo == null) { |
| | | //返回 不存在 |
| | | return false; |
| | | } |
| | | //返回 存在 |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param Number |
| | | * @return //是否存在此编号玻璃 |
| | | */ |
| | | public boolean isExist(String Number) { |
| | | //查询是否存在 |
| | | GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number); |
| | | if (GlassInfo == null) { |
| | | //返回 不存在 |
| | | return false; |
| | | } |
| | | //返回 存在 |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downstorage.service; |
| | | |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | |
| | | public interface DownStorageCageDetailsService { |
| | | |
| | | void addDownStorageCageDetails(DownStorageCageDetails details); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownStorageCageService extends IService<DownStorageCage> { |
| | | public List<Map> gettask(); |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService { |
| | | |
| | | @Override |
| | | public void addDownStorageCageDetails(DownStorageCageDetails details) { |
| | | this.save(details); |
| | | } |
| | | |
| | | |
| | | // Other business methods can be implemented here |
| | | } |
New file |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { |
| | | @Autowired |
| | | private DownStorageCageMapper downStorageCageMapper; |
| | | |
| | | @Override |
| | | public List<Map> gettask() { |
| | | downStorageCageMapper.selectList(null); |
| | | // downStorageCageMapper.selectJoin(); |
| | | return null; |
| | | } |
| | | |
| | | ; |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.controller; |
| | | |
| | | |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/unLoadGlass") |
| | | public class DownWorkstationController { |
| | | |
| | | @Autowired |
| | | private DownWorkstationService downWorkstationService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | |
| | | @GetMapping("/getone") |
| | | public ResponseEntity<?> getOneDownWorkstations() { |
| | | try { |
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1, 5); |
| | | // 构建符合预期格式的响应数据 |
| | | Map<String, Object> responseData = new HashMap<>(); |
| | | responseData.put("code", 200); |
| | | responseData.put("msg", "成功"); |
| | | responseData.put("data", data); |
| | | // 返回 ResponseEntity 对象,包含响应数据和状态码 |
| | | return ResponseEntity.ok(responseData); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | // 如果出现异常,返回错误信息 |
| | | Map<String, Object> errorResponse = new HashMap<>(); |
| | | errorResponse.put("code", 500); |
| | | errorResponse.put("msg", "服务器内部错误"); |
| | | return ResponseEntity.status(500).body(errorResponse); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/gettwo") |
| | | public List<DownWorkstation> gettwoDownWorkstations() { |
| | | return downWorkstationService.getoneDownWorkstations(6, 10); |
| | | } |
| | | |
| | | @GetMapping("/getflowCardId") |
| | | public ResponseEntity<Map<String, Object>> getflowCardId() { |
| | | Map<String, Object> responseData = new HashMap<>(); |
| | | try { |
| | | List<Map<String, Object>> data = glassInfoService.getFlowCardId(); |
| | | responseData.put("code", 200); |
| | | responseData.put("msg", "成功"); |
| | | responseData.put("data", data); |
| | | return ResponseEntity.ok(responseData); |
| | | } catch (Exception e) { |
| | | responseData.put("code", 500); |
| | | responseData.put("msg", "失败"); |
| | | responseData.put("data", null); |
| | | return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData); |
| | | } |
| | | } |
| | | |
| | | |
| | | //绑定架子 |
| | | @PostMapping("/updateFlowCardId") |
| | | public ResponseEntity<Map<String, Object>> updateFlowCardId(@RequestBody Map<String, Object> requestData) { |
| | | // 从 requestData 中获取传入的 flowCardId |
| | | String flowCardId = (String) requestData.get("flowCardId"); |
| | | int workstationId = (int) requestData.get("workstationId"); |
| | | |
| | | // 查询对应 flowCardId 的玻璃信息总数量 |
| | | int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId); |
| | | |
| | | // 更新 down_workstation 表中的总数量 |
| | | downWorkstationService.updateFlowCardIdAndCount(flowCardId, glassInfoCount, workstationId); |
| | | |
| | | // 构建响应数据 |
| | | Map<String, Object> responseData = new HashMap<>(); |
| | | responseData.put("message", "updated successfully"); |
| | | responseData.put("code", 200); |
| | | // 返回处理结果 |
| | | return ResponseEntity.ok(responseData); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/clear") |
| | | public ResponseEntity<Map<String, Object>> clearWorkstationInfo(@RequestBody Map<String, Object> requestData) { |
| | | // 调用 DownWorkstationService 中的方法清除指定工位ID的信息 |
| | | int workstationId = (int) requestData.get("workstationId"); |
| | | |
| | | int totalWorkstations = downWorkstationService.getTotalQuantity(workstationId); |
| | | int downWorkstations = downWorkstationService.getRacksNumber(workstationId); |
| | | |
| | | |
| | | if (downWorkstations == totalWorkstations) { |
| | | downWorkstationService.clearFlowCardId(workstationId); |
| | | Map<String, Object> responseData = new HashMap<>(); |
| | | responseData.put("message", "cleared successfully"); |
| | | responseData.put("code", 200); |
| | | // 返回处理结果 |
| | | return ResponseEntity.ok(responseData); |
| | | } else { |
| | | // 如果总数量和落架数量不一致,返回错误响应 |
| | | Map<String, Object> errorResponse = new HashMap<>(); |
| | | errorResponse.put("message", "Total workstations count does not match down workstations count."); |
| | | errorResponse.put("code", 400); |
| | | return ResponseEntity.badRequest().body(errorResponse); |
| | | } |
| | | |
| | | |
| | | // 构建响应数据 |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downworkstation.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/downWorkstationTask") |
| | | public class DownWorkstationTaskController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.downworkstation.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownWorkstation implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 下片工位表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工位id |
| | | */ |
| | | private Integer workstationId; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 启用状态 |
| | | */ |
| | | private Integer enableState; |
| | | |
| | | /** |
| | | * 工作状态 |
| | | */ |
| | | private Integer workState; |
| | | |
| | | |
| | | @TableField("total_quantity") |
| | | private Integer totalquantity; |
| | | |
| | | @TableField("racks_number") |
| | | private Integer Racksnumber; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class DownWorkstationTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private String filmsid; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | | |
| | | /** |
| | | * 任务状态 |
| | | */ |
| | | private Integer state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Mapper |
| | | |
| | | @Repository |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | @DS("hangzhoumes") // 指定使用 hangzhoumes 数据源 |
| | | |
| | | public interface DownWorkstationMapper extends BaseMapper<DownWorkstation> { |
| | | |
| | | |
| | | //查询工位表和任务表中状态为1的流程卡号和已落架数量 |
| | | @Select("SELECT dwt.flow_card_id,dw.id,dw.racks_number FROM down_workstation_task dwt JOIN down_workstation dw ON dwt.flow_card_id = dw.flow_card_id WHERE dwt.state = 1 LIMIT 1") |
| | | List<DownWorkstation> selectdownWorkstationstate(); |
| | | |
| | | |
| | | // @Select("SELECT flow_card_id,filmsid,width,height,thickness FROM down_glass_task WHERE task_stauts = 1;") |
| | | // List<DownGlassTask> selectunloadingtaskstate(); |
| | | //更新落架数量 |
| | | // @Update("UPDATE down_workstation SET racks_number = #{racksNumber} " + |
| | | // "WHERE flow_card_id = #{flowCardId}") |
| | | // void update_racks_number(@Param("flowCardId") String flowCardId, |
| | | // @Param("racksNumber") Integer racksNumber); |
| | | |
| | | //插入机械任务表 |
| | | // @Insert("INSERT INTO down_workstation_task (flow_card_id, width, height, thickness, filmsid,state) " + |
| | | // "VALUES (#{flowCardId}, #{width}, #{height}, #{thickness}, #{filmsid},1)") |
| | | // void insertdownWorkstationtask(DownGlassInfo downGlassInfo); |
| | | |
| | | //根据工位id更新实体类接收的数据 |
| | | // @Update("UPDATE down_workstation SET width = #{width}, height = #{height}, flow_card_id = #{flowCardId} WHERE workstation_id = #{workstationId}") |
| | | // void updateFlowCardId(DownWorkstation downWorkstation); |
| | | |
| | | |
| | | // @Update("UPDATE down_workstation_task SET state = 0 WHERE flow_card_id = #{flowCardId}") |
| | | // void update_task_state_to_zero(@Param("flowCardId") String flowCardId); |
| | | |
| | | |
| | | // @Select("SELECT * FROM down_workstation WHERE workstation_id BETWEEN #{startId} AND #{endId}") |
| | | // List<DownWorkstation> getDownWorkstationsInRange(@Param("startId") int startId, @Param("endId") int endId); |
| | | |
| | | |
| | | // @Select("SELECT DISTINCT flowcard_id from glass_info") |
| | | // @ResultType(Map.class) |
| | | // List<Map<String, Object>> getflowCardId(); |
| | | |
| | | // @Update("UPDATE down_workstation SET flow_card_id = NULL, total_quantity = 0, racks_number = 0 WHERE workstation_id = #{workstationId}") |
| | | // void clearFlowCardInfoByWorkstationId(@Param("workstationId") int workstationId); |
| | | |
| | | // 获取总数量 |
| | | // @Select("SELECT total_quantity FROM down_workstation WHERE workstation_id = #{workstationId}") |
| | | // int getTotalQuantity(@Param("workstationId") int workstationId); |
| | | |
| | | // 获取落架数量 |
| | | // @Select("SELECT racks_number FROM down_workstation WHERE workstation_id = #{workstationId}") |
| | | // int getRacksNumber(@Param("workstationId") int workstationId); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownWorkstationTaskMapper extends BaseMapper<DownWorkstationTask> { |
| | | |
| | | List<DownWorkstationTask> selectList(); |
| | | |
| | | DownWorkstation selectdownWorkstationstate(); |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service; |
| | | |
| | | import com.mes.common.PLCAutoMes; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.mapper.DownWorkstationMapper; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.Data; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Service |
| | | public class DownGlassLogic { |
| | | @Autowired |
| | | private DownGlassInfo downGlassInfo; |
| | | private DownWorkstation downWorkstation; |
| | | private DownGlassInfoMapper downGlassInfoMapper; |
| | | private DownGlassInfoService downGlassInfoService; |
| | | private DownGlassTaskService downGlassTaskService; |
| | | private DownWorkstationMapper downWorkstationMapper; |
| | | private DownWorkstationService downWorkstationService; |
| | | private DownWorkstationTaskService downWorkstationTaskService; |
| | | PlcParameterObject plcread = PLCAutoMes.PlcReadObject; |
| | | /** |
| | | * // 机械手1PLC请求字 |
| | | */ |
| | | String robot1PLCrequestword = plcread.getPlcParameter("A01Position").getValue(); |
| | | /** |
| | | * // 机械手2PLC请求字 |
| | | */ |
| | | String robot2PLCrequestword = plcread.getPlcParameter("A01Position").getValue(); |
| | | /** |
| | | * // 玻璃id |
| | | */ |
| | | String glassID = plcread.getPlcParameter("A01Position").getValue(); |
| | | String glasswidth = plcread.getPlcParameter("A01Position").getValue(); |
| | | String glassheight = plcread.getPlcParameter("A01Position").getValue(); |
| | | // |
| | | String glassthickness = plcread.getPlcParameter("A01Position").getValue(); |
| | | String pLcwancheng = plcread.getPlcParameter("A01Position").getValue(); |
| | | |
| | | /** |
| | | * // 存放待处理的玻璃信息 |
| | | */ |
| | | private List<DownGlassInfo> glassList; |
| | | /** |
| | | * 存放玻璃放置在缓存笼中的详细信息 |
| | | */ |
| | | private List<DownStorageCageDetails> cageDetailsList; |
| | | |
| | | /** |
| | | * //当下片任务表状态为1时候将数据插入到下片玻璃信息表 |
| | | */ |
| | | |
| | | public void insertdownglassinfo() { |
| | | |
| | | |
| | | downWorkstationMapper = WebSocketServer.applicationContext.getBean(DownWorkstationMapper.class); |
| | | downWorkstationService = WebSocketServer.applicationContext.getBean(DownWorkstationService.class); |
| | | downWorkstationTaskService = WebSocketServer.applicationContext.getBean(DownWorkstationTaskService.class); |
| | | downGlassInfoService = WebSocketServer.applicationContext.getBean(DownGlassInfoService.class); |
| | | downGlassInfoMapper = WebSocketServer.applicationContext.getBean(DownGlassInfoMapper.class); |
| | | downGlassTaskService = WebSocketServer.applicationContext.getBean(DownGlassTaskService.class); |
| | | List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState(); |
| | | // |
| | | |
| | | |
| | | if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) { |
| | | |
| | | // |
| | | |
| | | for (DownGlassTask downGlassInfo : taskdownGlassInf) { |
| | | // 创建新的 DownGlassInfo 对象并设置相关属性 |
| | | DownGlassInfo newdownGlassInfo = new DownGlassInfo(); |
| | | |
| | | newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId()); |
| | | Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId()); |
| | | // 初始化顺序字段值 |
| | | int sequence = maxSequence != null ? maxSequence + 1 : 1; |
| | | |
| | | newdownGlassInfo.setWidth(downGlassInfo.getWidth()); |
| | | newdownGlassInfo.setHeight(downGlassInfo.getHeight()); |
| | | newdownGlassInfo.setThickness(downGlassInfo.getThickness()); |
| | | newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid()); |
| | | // 设置顺序字段值 |
| | | newdownGlassInfo.setSequence(sequence); |
| | | |
| | | // 插入数据到下片玻璃信息表 |
| | | downGlassInfoService.insertDownGlassInfo(newdownGlassInfo); |
| | | //插入数据到机械手任务表 |
| | | |
| | | downWorkstationTaskService.insertdownWorkstationtask(newdownGlassInfo); |
| | | //更新下片任务表状态为0 |
| | | downGlassTaskService.updateTaskStateToZero(downGlassInfo.getFlowCardId()); |
| | | |
| | | sequence++; // 递增顺序字段值 |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * //当机械手任务表中状态为1,工位表流程卡绑定了架子 更新已经落架数量,并且把下片任务表的对应记录删掉 |
| | | */ |
| | | |
| | | public void downWorkstation() { |
| | | |
| | | |
| | | try { |
| | | //查询下片工位表中架子是否绑定了流程卡号 工位表和任务表中状态为1的流程卡号和已落架数量 |
| | | List<DownWorkstation> taskdownWorkstation = downWorkstationMapper.selectdownWorkstationstate(); |
| | | if (taskdownWorkstation != null && !taskdownWorkstation.isEmpty()) { |
| | | //,如果已经绑定则更新已落架数量,并且删除下片任务表中的记录 |
| | | for (DownWorkstation downWorkstation : taskdownWorkstation) { |
| | | //更新下片工位表中已落架数量 |
| | | downWorkstationService.updateracksnumber(downWorkstation.getFlowCardId(), downWorkstation.getRacksnumber() + 1); |
| | | //更新机械任务表中状态为0 |
| | | downWorkstationTaskService.updateTaskStateToZero(downWorkstation.getFlowCardId()); |
| | | //删除下片任务表中的记录 |
| | | downGlassTaskService.deleteTask(downWorkstation.getFlowCardId()); |
| | | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | // 打印异常信息 |
| | | e.printStackTrace(); |
| | | // 或者可以进行其他异常处理,比如记录日志或者返回特定的错误信息 |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param downWorkstation // 满架拉走 清除流程卡信息 |
| | | */ |
| | | |
| | | // public void clearFlowCardId(DownWorkstation downWorkstation) { |
| | | // |
| | | // downWorkstationMapper.clearFlowCardId(downWorkstation); |
| | | // } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface DownWorkstationService extends IService<DownWorkstation> { |
| | | |
| | | List<DownWorkstation> getoneDownWorkstations(int startId, int endId); |
| | | |
| | | int getTotalQuantity(int workstationId); |
| | | |
| | | int getRacksNumber(int workstationId); |
| | | |
| | | void clearFlowCardId(int workstationId); |
| | | |
| | | void updateracksnumber(String flowCardId, int racksnumber); |
| | | |
| | | |
| | | int updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | public interface DownWorkstationTaskService extends IService<DownWorkstationTask> { |
| | | void insertdownWorkstationtask(DownGlassInfo downGlassInfo); |
| | | |
| | | void updateTaskStateToZero(String flowCardId); |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import com.mes.downworkstation.mapper.DownWorkstationMapper; |
| | | import com.mes.downworkstation.mapper.DownWorkstationTaskMapper; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class DownWorkstationServiceImpl extends ServiceImpl<DownWorkstationMapper, DownWorkstation> implements DownWorkstationService { |
| | | |
| | | @Autowired |
| | | private DownWorkstationMapper downWorkstationMapper; |
| | | private DownWorkstationTaskMapper downWorkstationTaskMapper; |
| | | |
| | | |
| | | // @Override |
| | | // public List<DownWorkstation> gettwoDownWorkstations() { |
| | | // return downWorkstationMapper.getDownWorkstationsInRange(6,10); |
| | | // } |
| | | //获取总数量 |
| | | @Override |
| | | public int getTotalQuantity(int workstationId) { |
| | | QueryWrapper<DownWorkstation> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("total_quantity") |
| | | .eq("workstation_id", workstationId); |
| | | |
| | | DownWorkstation result = baseMapper.selectOne(queryWrapper); |
| | | return result != null ? result.getTotalquantity() : 0; |
| | | } |
| | | |
| | | // @Override |
| | | // public int getTotalQuantity(int workstationId) { |
| | | // Integer totalQuantity = downWorkstationMapper.getTotalQuantity(workstationId); |
| | | // return totalQuantity != null ? totalQuantity : 0; |
| | | // } |
| | | |
| | | // @Override |
| | | // public int getRacksNumber(int workstationId) { |
| | | // Integer racksNumber = downWorkstationMapper.getRacksNumber(workstationId); |
| | | // return racksNumber != null ? racksNumber : 0; |
| | | // } |
| | | //根据条件获取落架数量 |
| | | @Override |
| | | public int getRacksNumber(int workstationId) { |
| | | QueryWrapper<DownWorkstation> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("racks_number") |
| | | .eq("workstation_id", workstationId); |
| | | |
| | | DownWorkstation result = baseMapper.selectOne(queryWrapper); |
| | | return result != null ? result.getRacksnumber() : 0; |
| | | } |
| | | |
| | | //根据条件获取工位玻璃信息 |
| | | @Override |
| | | public List<DownWorkstation> getoneDownWorkstations(int startId, int endId) { |
| | | QueryWrapper<DownWorkstation> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.between("workstation_id", startId, endId); |
| | | |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | |
| | | // |
| | | |
| | | |
| | | @Override |
| | | public void updateracksnumber(String flowCardId, int racksNumber) { |
| | | UpdateWrapper<DownWorkstation> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("racks_number", racksNumber).eq("flow_card_id", flowCardId); |
| | | baseMapper.update(null, updateWrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId) { |
| | | UpdateWrapper<DownWorkstation> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("total_quantity", glassInfoCount) |
| | | .set("flow_card_id", flowCardId) |
| | | .eq("workstation_id", workstationId); |
| | | |
| | | return baseMapper.update(null, updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void clearFlowCardId(int workstationId) { |
| | | UpdateWrapper<DownWorkstation> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("flow_card_id", null) |
| | | .set("total_quantity", 0) |
| | | .set("racks_number", 0) |
| | | .eq("workstation_id", workstationId); |
| | | |
| | | baseMapper.update(null, updateWrapper); |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public void crossDatabaseQuery() { |
| | | // 从 MySQL 数据库中查询数据,只返回一条符合条件的数据 |
| | | DownWorkstation downWorkstation = downWorkstationTaskMapper.selectdownWorkstationstate(); |
| | | |
| | | // 从 SQL Server 数据库中查询数据 |
| | | List<DownWorkstationTask> downWorkstationTasks = downWorkstationTaskMapper.selectList(); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.downworkstation.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import com.mes.downworkstation.mapper.DownWorkstationTaskMapper; |
| | | import com.mes.downworkstation.service.DownWorkstationTaskService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | public class DownWorkstationTaskServiceImpl extends ServiceImpl<DownWorkstationTaskMapper, DownWorkstationTask> implements DownWorkstationTaskService { |
| | | |
| | | |
| | | public void insertdownWorkstationtask(DownGlassInfo downGlassInfo) { |
| | | DownWorkstationTask entity = new DownWorkstationTask(); |
| | | entity.setFlowCardId(downGlassInfo.getFlowCardId()); |
| | | entity.setWidth(downGlassInfo.getWidth()); |
| | | entity.setHeight(downGlassInfo.getHeight()); |
| | | entity.setThickness(downGlassInfo.getThickness()); |
| | | entity.setFilmsid(downGlassInfo.getFilmsid()); |
| | | entity.setState(1); |
| | | |
| | | baseMapper.insert(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTaskStateToZero(String flowCardId) { |
| | | UpdateWrapper<DownWorkstationTask> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("state", 0).eq("flow_card_id", flowCardId); |
| | | |
| | | baseMapper.update(null, updateWrapper); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/glassInfo") |
| | | public class GlassInfoController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.mes.glassinfo.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class GlassInfo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 玻璃信息表id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 流程卡 |
| | | */ |
| | | private String flowcardId; |
| | | |
| | | /** |
| | | * 流程卡玻璃类型 |
| | | */ |
| | | private Integer glassType; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | private Double width; |
| | | |
| | | /** |
| | | * 高 |
| | | */ |
| | | private Double height; |
| | | |
| | | /** |
| | | * 厚度 |
| | | */ |
| | | private Double thickness; |
| | | |
| | | /** |
| | | * 膜系 |
| | | */ |
| | | private Integer filmsid; |
| | | |
| | | /** |
| | | * 磨前宽 |
| | | */ |
| | | private Double edgWidth; |
| | | |
| | | /** |
| | | * 磨前高 |
| | | */ |
| | | private Double edgHeight; |
| | | |
| | | /** |
| | | * 是否配片 |
| | | */ |
| | | private Integer ismultiple; |
| | | |
| | | /** |
| | | * 配片最大宽 |
| | | */ |
| | | private Double maxWidth; |
| | | |
| | | /** |
| | | * 配片最大高 |
| | | */ |
| | | private Double maxHeight; |
| | | |
| | | /** |
| | | * 钢化是否接受横放 |
| | | */ |
| | | private Integer ishorizontal; |
| | | |
| | | /** |
| | | * 原片顺序 |
| | | */ |
| | | private Integer patternSequence; |
| | | |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * x坐标 |
| | | */ |
| | | private Integer xCoordinate; |
| | | |
| | | /** |
| | | * y坐标 |
| | | */ |
| | | private Integer yCoordinate; |
| | | |
| | | /** |
| | | * 旋转角度(逆时针) |
| | | */ |
| | | private Integer angle; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private Integer engineerId; |
| | | |
| | | /** |
| | | * 生产规则id |
| | | */ |
| | | private Integer ruleId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import org.mapstruct.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Mapper |
| | | public interface GlassInfoMapper extends BaseMapper<GlassInfo> { |
| | | |
| | | |
| | | // @Select("SELECT COUNT(*) FROM glass_info WHERE flowcard_id = #{flowCardId}") |
| | | // int getGlassInfoCountByFlowCardId(@Param("flowCardId") String flowCardId); |
| | | |
| | | // @Update("UPDATE down_workstation SET total_quantity = #{glassInfoCount},flow_card_id=#{flowCardId} WHERE workstation_id = #{workstationId}") |
| | | // int updateFlowCardIdAndCount(@Param("flowCardId") String flowCardId, @Param("glassInfoCount") int glassInfoCount,@Param("workstationId")int workstationId); |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.glassinfo.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface GlassInfoService extends IService<GlassInfo> { |
| | | |
| | | int getGlassInfoCountByFlowCardId(String flowCardId); |
| | | |
| | | List<Map<String, Object>> getFlowCardId(); |
| | | |
| | | GlassInfo selectGlassId(String id); |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class GlassInfoServiceImpl extends ServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService { |
| | | |
| | | private GlassInfoMapper glassInfoMapper; |
| | | |
| | | @Autowired |
| | | public GlassInfoServiceImpl(GlassInfoMapper glassInfoMapper) { |
| | | this.glassInfoMapper = glassInfoMapper; |
| | | } |
| | | |
| | | @Override |
| | | public int getGlassInfoCountByFlowCardId(String flowCardId) { |
| | | QueryWrapper<GlassInfo> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("flowcard_id", flowCardId); |
| | | |
| | | return baseMapper.selectCount(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getFlowCardId() { |
| | | return baseMapper.selectMaps(new QueryWrapper<GlassInfo>().select("DISTINCT flowcard_id")); |
| | | } |
| | | |
| | | @Override |
| | | public GlassInfo selectGlassId(String id) { |
| | | QueryWrapper<GlassInfo> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("id", id); |
| | | |
| | | return baseMapper.selectOne(queryWrapper); |
| | | } |
| | | |
| | | |
| | | // public void updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId) { |
| | | // int rowsAffected = glassInfoMapper.updateFlowCardIdAndCount(flowCardId, glassInfoCount, workstationId); |
| | | // if (rowsAffected > 0) { |
| | | // System.out.println("更新架子上流程卡 ID 和数量成功"); |
| | | // } else { |
| | | // System.out.println("更新架子上流程卡 ID 和数量失败"); |
| | | // } |
| | | // } |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * @author SNG-012 |
| | | * <p> |
| | | * Configuration 类用于加载配置文件并提供访问配置项的方法。 |
| | | */ |
| | | public class Configuration { |
| | | |
| | | /** |
| | | * // Properties 对象,用于存储配置文件中的键值对。 |
| | | */ |
| | | private Properties properties; |
| | | |
| | | /** |
| | | * @param fileName |
| | | * @throws IOException // 构造函数,根据传入的文件名加载配置文件。 |
| | | */ |
| | | |
| | | public Configuration(String fileName) throws IOException { |
| | | // 使用类加载器获取资源文件的输入流。 |
| | | InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName); |
| | | // 如果输入流为null,表示未找到文件,抛出FileNotFoundException。 |
| | | if (inputStream == null) { |
| | | throw new FileNotFoundException("Property file '" + fileName + "' not found in the classpath"); |
| | | } |
| | | // 实例化Properties对象。 |
| | | properties = new Properties(); |
| | | // 从输入流加载配置项。 |
| | | properties.load(inputStream); |
| | | } |
| | | |
| | | /** |
| | | * @param key |
| | | * @return // 根据配置项的键获取其对应的值。 |
| | | */ |
| | | |
| | | public String getProperty(String key) { |
| | | return properties.getProperty(key); |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | import com.google.gson.Gson; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | |
| | | public class ExcelToJsonConverter { |
| | | |
| | | public static void main(String[] args) { |
| | | String excelFilePath = "src/main/resources/JsonFile/alarm.xlsx"; |
| | | String sheetName = "Sheet1"; |
| | | int addressColumnIndex = 0; |
| | | int nameColumnIndex = 1; |
| | | |
| | | //int unitColumnIndex = 2; |
| | | String outputFilePath = "src/main/resources/JsonFile/PlcAlarm.json"; |
| | | |
| | | try (Workbook workbook = new XSSFWorkbook(new FileInputStream(excelFilePath))) { |
| | | Sheet sheet = workbook.getSheet(sheetName); |
| | | |
| | | List<LinkedHashMap<String, Object>> jsonList = new ArrayList<>(); |
| | | |
| | | Iterator<Row> rowIterator = sheet.iterator(); |
| | | // Skip the header row |
| | | if (rowIterator.hasNext()) { |
| | | rowIterator.next(); |
| | | } |
| | | |
| | | int plcAddressLength = 0; // 记录所有 addressLenght 的和 |
| | | int addressIndex = 0; // 自增的地址索引 |
| | | while (rowIterator.hasNext()) { |
| | | Row row = rowIterator.next(); |
| | | |
| | | Cell nameCell = row.getCell(nameColumnIndex); |
| | | Cell addressCell = row.getCell(addressColumnIndex); |
| | | // Cell unitCell = row.getCell(unitColumnIndex); |
| | | |
| | | String name = nameCell.getStringCellValue(); |
| | | String address = addressCell.getStringCellValue(); |
| | | // String unit = unitCell.getStringCellValue(); |
| | | |
| | | // String addressIndex = extractAddressIndex(address); |
| | | |
| | | LinkedHashMap<String, Object> jsonObject = new LinkedHashMap<>(); |
| | | jsonObject.put("codeId", name); |
| | | jsonObject.put("addressIndex", addressIndex); |
| | | |
| | | int addressLength = 0; |
| | | if (address.contains("~")) { |
| | | addressLength = 14; |
| | | } else { |
| | | addressLength = 2; |
| | | } |
| | | // jsonObject.put("addressLenght", String.valueOf(addressLength)); |
| | | |
| | | //jsonObject.put("unit", unit); |
| | | |
| | | plcAddressLength += addressLength; |
| | | |
| | | jsonList.add(jsonObject); |
| | | addressIndex++; |
| | | } |
| | | |
| | | LinkedHashMap<String, Object> resultObject = new LinkedHashMap<>(); |
| | | resultObject.put("plcAddressBegin", "DB100.0"); |
| | | resultObject.put("plcAddressLenght", String.valueOf(plcAddressLength)); |
| | | // resultObject.put("dataType", "word"); |
| | | resultObject.put("dataType", "bit"); |
| | | resultObject.put("parameteInfor", jsonList); |
| | | |
| | | Gson gson = new Gson(); |
| | | String jsonOutput = gson.toJson(resultObject); |
| | | |
| | | try (FileWriter fileWriter = new FileWriter(outputFilePath)) { |
| | | fileWriter.write(jsonOutput); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | private static String extractAddressIndex(String address) { |
| | | // Assuming the address format is "DB103.DBW0" or "DB103.DBB100~DBB113" |
| | | if (address.startsWith("DB") && address.contains(".DBW")) { |
| | | int startIndex = address.indexOf(".DBW") + 4; |
| | | int endIndex = address.length(); |
| | | return address.substring(startIndex, endIndex); |
| | | } else if (address.startsWith("DB") && address.contains(".DBB")) { |
| | | int startIndex2 = address.indexOf(".DBB") + 4; |
| | | int endIndex2 = address.indexOf("~"); |
| | | return address.substring(startIndex2, endIndex2); |
| | | } |
| | | return ""; |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.tools; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.websocket.*; |
| | | import javax.websocket.server.PathParam; |
| | | import javax.websocket.server.ServerEndpoint; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | @ServerEndpoint(value = "/api/talk/{username}") |
| | | @Component("webSocketServer") |
| | | public class WebSocketServer { |
| | | |
| | | // @Autowired |
| | | // HomeMapper homeMapper; |
| | | |
| | | public static ConfigurableApplicationContext applicationContext; |
| | | |
| | | // 解决无法注入mapper问题 //使用方法 |
| | | // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class); |
| | | public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) { |
| | | WebSocketServer.applicationContext = configurableApplicationContext; |
| | | } |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class); |
| | | private List<String> messages; |
| | | /** |
| | | * 记录当前在线连接数 |
| | | */ |
| | | public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>(); |
| | | |
| | | String username; |
| | | Session session; |
| | | |
| | | public WebSocketServer() { |
| | | this.messages = new ArrayList<>(); |
| | | } |
| | | |
| | | /** |
| | | * 连接建立成功调用的方法 |
| | | */ |
| | | @OnOpen |
| | | public void onOpen(Session session, @PathParam("username") String username) { |
| | | this.username = username; |
| | | this.session = session; |
| | | List<WebSocketServer> webSocketServers = sessionMap.get(username); |
| | | if (webSocketServers == null) { |
| | | ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>(); |
| | | arrayListwebserver.add(this); |
| | | sessionMap.put(username, arrayListwebserver); |
| | | } else { |
| | | webSocketServers.add(this); |
| | | } |
| | | |
| | | log.info("有新用户加入,username={}, 当前在线人数为:{}", username, sessionMap.get(username).size()); |
| | | |
| | | // JSONObject result = new JSONObject(); |
| | | // JSONArray array = new JSONArray(); |
| | | // result.set("users", array); |
| | | // for (Object key : sessionMap.keySet()) { |
| | | // JSONObject jsonObject = new JSONObject(); |
| | | // jsonObject.set("username", key); |
| | | // array.add(jsonObject); |
| | | // } |
| | | |
| | | // sendAllMessage(JSONUtil.toJsonStr(result)); // 后台发送消息给所有的客户端 |
| | | } |
| | | |
| | | /** |
| | | * 连接关闭调用的方法 |
| | | */ |
| | | @OnClose |
| | | public void onClose(Session session, @PathParam("username") String username) { |
| | | List<WebSocketServer> webSocketServers = sessionMap.get(username); |
| | | ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>(); |
| | | if (webSocketServers.size() > 1) { |
| | | for (WebSocketServer webSocketServer : webSocketServers) { |
| | | if (webSocketServer != this) { |
| | | arrayListwebserver.add(webSocketServer); |
| | | } |
| | | } |
| | | sessionMap.put(username, arrayListwebserver); |
| | | log.info("移除username={}一名用户session, {}的当前在线人数为:{}", username, username, sessionMap.get(username).size()); |
| | | } else { |
| | | sessionMap.remove(username); |
| | | log.info("移除username={}一名用户session, {}连接关闭, 当前连接数为:{}", username, username, sessionMap.size()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 收到客户端消息后调用的方法 |
| | | * 后台收到客户端发送过来的消息 |
| | | * onMessage 是一个消息的中转站 |
| | | * 接受 浏览器端 socket.send 发送过来的 json数据 |
| | | * |
| | | * @param message 客户端发送过来的消息 |
| | | */ |
| | | @OnMessage |
| | | public void onMessage(String message, Session session, @PathParam("username") String username) { |
| | | log.info("服务端收到用户username={}的消息:{}", username, message); |
| | | JSONObject obj = JSONUtil.parseObj(message); |
| | | String text = obj.getStr("data"); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.set("message", text); |
| | | this.messages.add(text); |
| | | this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject) |
| | | |
| | | } |
| | | |
| | | @OnError |
| | | public void onError(Session session, Throwable error) { |
| | | log.error("发生错误"); |
| | | error.printStackTrace(); |
| | | } |
| | | |
| | | /** |
| | | * 服务端发送消息给客户端 |
| | | */ |
| | | public void sendMessage(String message) { |
| | | try { |
| | | // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message); |
| | | this.session.getBasicRemote().sendText(message); |
| | | } catch (Exception e) { |
| | | log.error("服务端发送消息给客户端失败", e); |
| | | } |
| | | } |
| | | |
| | | // /** |
| | | // * 服务端发送消息给所有客户端 |
| | | // */ |
| | | // public void sendAllMessage(String message) { |
| | | // try { |
| | | // for (WebSocketServer webSocketServer : sessionMap.values()) { |
| | | // // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message); |
| | | // webSocketServer.sendMessage(message); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // log.error("服务端发送消息给客户端失败", e); |
| | | // } |
| | | // } |
| | | |
| | | public List<String> getMessages() { |
| | | return messages; |
| | | |
| | | } |
| | | |
| | | public void clearMessages() { |
| | | messages.clear(); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin": "DB104.0.0", |
| | | "plcAddressLenght": "91", |
| | | "dataType": "bit", |
| | | "parameteInfor": [ |
| | | { |
| | | "codeId": "D01VFDerror", |
| | | "addressIndex": 0 |
| | | }, |
| | | { |
| | | "codeId": "D02VFDerror", |
| | | "addressIndex": 1 |
| | | }, |
| | | { |
| | | "codeId": "D03VFDerror", |
| | | "addressIndex": 2 |
| | | }, |
| | | { |
| | | "codeId": "D04VFDerror", |
| | | "addressIndex": 3 |
| | | }, |
| | | { |
| | | "codeId": "D05VFDerror", |
| | | "addressIndex": 4 |
| | | }, |
| | | { |
| | | "codeId": "D06VFDerror", |
| | | "addressIndex": 5 |
| | | }, |
| | | { |
| | | "codeId": "B01VFDerror", |
| | | "addressIndex": 6 |
| | | }, |
| | | { |
| | | "codeId": "B02VFDerror", |
| | | "addressIndex": 7 |
| | | }, |
| | | { |
| | | "codeId": "A01VFDerror", |
| | | "addressIndex": 8 |
| | | }, |
| | | { |
| | | "codeId": "A02VFDerror", |
| | | "addressIndex": 9 |
| | | }, |
| | | { |
| | | "codeId": "A01servoturnerror", |
| | | "addressIndex": 10 |
| | | }, |
| | | { |
| | | "codeId": "A02servoturnerror", |
| | | "addressIndex": 11 |
| | | }, |
| | | { |
| | | "codeId": "A01servotravelerror", |
| | | "addressIndex": 12 |
| | | }, |
| | | { |
| | | "codeId": "A02servotravelerror", |
| | | "addressIndex": 13 |
| | | }, |
| | | { |
| | | "codeId": "B01servotravelerror", |
| | | "addressIndex": 14 |
| | | }, |
| | | { |
| | | "codeId": "B02servotravelerror", |
| | | "addressIndex": 15 |
| | | }, |
| | | { |
| | | "codeId": "D01DECerror", |
| | | "addressIndex": 16 |
| | | }, |
| | | { |
| | | "codeId": "D01poserror", |
| | | "addressIndex": 17 |
| | | }, |
| | | { |
| | | "codeId": "D02DECerror", |
| | | "addressIndex": 18 |
| | | }, |
| | | { |
| | | "codeId": "D02poserror", |
| | | "addressIndex": 19 |
| | | }, |
| | | { |
| | | "codeId": "D03DECerror", |
| | | "addressIndex": 20 |
| | | }, |
| | | { |
| | | "codeId": "D03poserror", |
| | | "addressIndex": 21 |
| | | }, |
| | | { |
| | | "codeId": "D04DECerror", |
| | | "addressIndex": 22 |
| | | }, |
| | | { |
| | | "codeId": "D04poserror", |
| | | "addressIndex": 23 |
| | | }, |
| | | { |
| | | "codeId": "D05DECerror", |
| | | "addressIndex": 24 |
| | | }, |
| | | { |
| | | "codeId": "D05poserror", |
| | | "addressIndex": 25 |
| | | }, |
| | | { |
| | | "codeId": "D06DECerror", |
| | | "addressIndex": 26 |
| | | }, |
| | | { |
| | | "codeId": "D06poserror", |
| | | "addressIndex": 27 |
| | | }, |
| | | { |
| | | "codeId": "A01DECerror", |
| | | "addressIndex": 28 |
| | | }, |
| | | { |
| | | "codeId": "A01poserror", |
| | | "addressIndex": 29 |
| | | }, |
| | | { |
| | | "codeId": "A02DECerror", |
| | | "addressIndex": 30 |
| | | }, |
| | | { |
| | | "codeId": "A02poserror", |
| | | "addressIndex": 31 |
| | | }, |
| | | { |
| | | "codeId": "B01INDECerror", |
| | | "addressIndex": 32 |
| | | }, |
| | | { |
| | | "codeId": "B01INposerror", |
| | | "addressIndex": 33 |
| | | }, |
| | | { |
| | | "codeId": "B01OUTDECerror", |
| | | "addressIndex": 34 |
| | | }, |
| | | { |
| | | "codeId": "B01OUTposerror", |
| | | "addressIndex": 35 |
| | | }, |
| | | { |
| | | "codeId": "B02INDECerror", |
| | | "addressIndex": 36 |
| | | }, |
| | | { |
| | | "codeId": "B02INposerror", |
| | | "addressIndex": 37 |
| | | }, |
| | | { |
| | | "codeId": "B02OUTDECerror", |
| | | "addressIndex": 38 |
| | | }, |
| | | { |
| | | "codeId": "B02OUTposerror", |
| | | "addressIndex": 39 |
| | | }, |
| | | { |
| | | "codeId": "D01Scanglassexceedinglimit", |
| | | "addressIndex": 40 |
| | | }, |
| | | { |
| | | "codeId": "emergencystopalarm", |
| | | "addressIndex": 41 |
| | | }, |
| | | { |
| | | "codeId": "Moreglassthanknown", |
| | | "addressIndex": 42 |
| | | }, |
| | | { |
| | | "codeId": "lessglassthanknown", |
| | | "addressIndex": 43 |
| | | }, |
| | | { |
| | | "codeId": "D01conveyortimeoutalarm", |
| | | "addressIndex": 44 |
| | | }, |
| | | { |
| | | "codeId": "D02conveyortimeoutalarm", |
| | | "addressIndex": 45 |
| | | }, |
| | | { |
| | | "codeId": "D03conveyortimeoutalarm", |
| | | "addressIndex": 46 |
| | | }, |
| | | { |
| | | "codeId": "D04conveyortimeoutalarm", |
| | | "addressIndex": 47 |
| | | }, |
| | | { |
| | | "codeId": "D05conveyortimeoutalarm", |
| | | "addressIndex": 48 |
| | | }, |
| | | { |
| | | "codeId": "D06conveyortimeoutalarm", |
| | | "addressIndex": 49 |
| | | }, |
| | | { |
| | | "codeId": "A01conveyortimeoutalarm", |
| | | "addressIndex": 50 |
| | | }, |
| | | { |
| | | "codeId": "A02conveyortimeoutalarm", |
| | | "addressIndex": 51 |
| | | }, |
| | | { |
| | | "codeId": "B01conveyortimeoutalarm", |
| | | "addressIndex": 52 |
| | | }, |
| | | { |
| | | "codeId": "B02conveyortimeoutalarm", |
| | | "addressIndex": 53 |
| | | }, |
| | | { |
| | | "codeId": "A01conveyorLeftsafetyalarm", |
| | | "addressIndex": 54 |
| | | }, |
| | | { |
| | | "codeId": "A01conveyorrightsafetyalarm", |
| | | "addressIndex": 55 |
| | | }, |
| | | { |
| | | "codeId": "A02conveyorLeftsafetyalarm", |
| | | "addressIndex": 56 |
| | | }, |
| | | { |
| | | "codeId": "A02conveyorrightsafetyalarm", |
| | | "addressIndex": 57 |
| | | }, |
| | | { |
| | | "codeId": "1#buffersafetyalarm", |
| | | "addressIndex": 58 |
| | | }, |
| | | { |
| | | "codeId": "2#buffersafetyalarm", |
| | | "addressIndex": 59 |
| | | }, |
| | | { |
| | | "codeId": "3#buffersafetyalarm", |
| | | "addressIndex": 60 |
| | | }, |
| | | { |
| | | "codeId": "4#buffersafetyalarm", |
| | | "addressIndex": 61 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRrightinposerror", |
| | | "addressIndex": 62 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRleftinposerror", |
| | | "addressIndex": 63 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRleftinposerror", |
| | | "addressIndex": 64 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRleftdecerror", |
| | | "addressIndex": 65 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRrightdecerror", |
| | | "addressIndex": 66 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRrightinposerror", |
| | | "addressIndex": 67 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRleftinposerror", |
| | | "addressIndex": 68 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRleftdecerror", |
| | | "addressIndex": 69 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRrightdecerror", |
| | | "addressIndex": 70 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRrightinposerror", |
| | | "addressIndex": 71 |
| | | }, |
| | | { |
| | | "codeId": "A01servoturnhomed", |
| | | "addressIndex": 72 |
| | | }, |
| | | { |
| | | "codeId": "A02servoturnhomed", |
| | | "addressIndex": 73 |
| | | }, |
| | | { |
| | | "codeId": "A01servotravelhomed", |
| | | "addressIndex": 74 |
| | | }, |
| | | { |
| | | "codeId": "A02servotravelhomed", |
| | | "addressIndex": 75 |
| | | }, |
| | | { |
| | | "codeId": "B01servotravelhomed", |
| | | "addressIndex": 76 |
| | | }, |
| | | { |
| | | "codeId": "B02servotravelhomed", |
| | | "addressIndex": 77 |
| | | }, |
| | | { |
| | | "codeId": "resetDelay", |
| | | "addressIndex": 78 |
| | | }, |
| | | { |
| | | "codeId": "A01travelNegativelimit", |
| | | "addressIndex": 79 |
| | | }, |
| | | { |
| | | "codeId": "A01travelPositivelimit", |
| | | "addressIndex": 80 |
| | | }, |
| | | { |
| | | "codeId": "A01turnuplimit", |
| | | "addressIndex": 81 |
| | | }, |
| | | { |
| | | "codeId": "A01turndownlimit", |
| | | "addressIndex": 82 |
| | | }, |
| | | { |
| | | "codeId": "A02travelNegativelimit", |
| | | "addressIndex": 83 |
| | | }, |
| | | { |
| | | "codeId": "A02travelPositivelimit", |
| | | "addressIndex": 84 |
| | | }, |
| | | { |
| | | "codeId": "A02turnuplimit", |
| | | "addressIndex": 85 |
| | | }, |
| | | { |
| | | "codeId": "A02turndownlimit", |
| | | "addressIndex": 86 |
| | | }, |
| | | { |
| | | "codeId": "B01travelNegativelimit", |
| | | "addressIndex": 87 |
| | | }, |
| | | { |
| | | "codeId": "B01travelPositivelimit", |
| | | "addressIndex": 88 |
| | | }, |
| | | { |
| | | "codeId": "B02travelNegativelimit", |
| | | "addressIndex": 89 |
| | | }, |
| | | { |
| | | "codeId": "B02travelPositivelimit", |
| | | "addressIndex": 90 |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB105.0", |
| | | "plcAddressLenght":"12", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "OutActivate", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "Addgoal", |
| | | "addressIndex":"2", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "AddLength", |
| | | "addressIndex":"4", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "AddWidth", |
| | | "addressIndex":"6", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "AddCount", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "OutStart", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB100.0", |
| | | "plcAddressLenght":"198", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "conveyorVelocity(Max)", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "conveyorVelocity(AutoFAST)", |
| | | "addressIndex":"2", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "conveyorVelocity(AutoSLOW)", |
| | | "addressIndex":"4", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "conveyorVelocity(Manual)", |
| | | "addressIndex":"6", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "A01A02TURNJOGVelocity", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "A01A02TRAVELJOGVelocity", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "B01B02TRAVELJOGVelocity", |
| | | "addressIndex":"12", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "A01A02TURNPOSVelocityAUTO", |
| | | "addressIndex":"14", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "A01TURNPOSVelocitymanual", |
| | | "addressIndex":"16", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "A01A02TRAVELPOSVelocityAUTO", |
| | | "addressIndex":"18", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "A01TRAVELPOSVelocitymanual", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "B01B02TRAVELPOSVelocityAUTO", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "B01TRAVELPOSVelocitymanual", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "A01A02conveyorVelocity(Max)", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A01A02conveyorVelocity(AutoFAST)", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A01A02conveyorVelocity(AutoSLOW)", |
| | | "addressIndex":"30", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01B02conveyorVelocity(Manual)", |
| | | "addressIndex":"32", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01B02conveyorVelocity(Max)", |
| | | "addressIndex":"34", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01B02conveyorVelocity(AutoFAST)", |
| | | "addressIndex":"36", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01B02conveyorVelocity(AutoSLOW)", |
| | | "addressIndex":"38", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01B02conveyorVelocity(Manual)", |
| | | "addressIndex":"40", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "gridspacing", |
| | | "addressIndex":"42", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A01Spliceaddresssetting", |
| | | "addressIndex":"44", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A02Spliceaddresssetting", |
| | | "addressIndex":"46", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A011#gridaddress", |
| | | "addressIndex":"48", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0122#gridaddress", |
| | | "addressIndex":"50", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0143#gridaddress", |
| | | "addressIndex":"52", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0164#gridaddress", |
| | | "addressIndex":"54", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0185#gridaddress", |
| | | "addressIndex":"56", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A01106#gridaddress", |
| | | "addressIndex":"58", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A01127#gridaddress", |
| | | "addressIndex":"60", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A01148#gridaddress", |
| | | "addressIndex":"62", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A01169#gridaddress", |
| | | "addressIndex":"64", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A01190#gridaddress", |
| | | "addressIndex":"66", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A021#gridaddress", |
| | | "addressIndex":"68", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0222#gridaddress", |
| | | "addressIndex":"70", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0243#gridaddress", |
| | | "addressIndex":"72", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0264#gridaddress", |
| | | "addressIndex":"74", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A0285#gridaddress", |
| | | "addressIndex":"76", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A02106#gridaddress", |
| | | "addressIndex":"78", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A02127#gridaddress", |
| | | "addressIndex":"80", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A02148#gridaddress", |
| | | "addressIndex":"82", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A02169#gridaddress", |
| | | "addressIndex":"84", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A02190#gridaddress", |
| | | "addressIndex":"86", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B011#gridaddress", |
| | | "addressIndex":"88", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B0122#gridaddress", |
| | | "addressIndex":"90", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B0143#gridaddress", |
| | | "addressIndex":"92", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B0164#gridaddress", |
| | | "addressIndex":"94", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B0185#gridaddress", |
| | | "addressIndex":"96", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B02106#gridaddress", |
| | | "addressIndex":"98", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B02127#gridaddress", |
| | | "addressIndex":"100", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B02148#gridaddress", |
| | | "addressIndex":"102", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B02169#gridaddress", |
| | | "addressIndex":"104", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "B02190#gridaddress", |
| | | "addressIndex":"106", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm" |
| | | }, |
| | | { |
| | | "codeId": "A01Targetgrid(Manual)", |
| | | "addressIndex":"108", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": " A02Targetgrid(Manual)", |
| | | "addressIndex":"110", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "B01Targetgrid(Manual)", |
| | | "addressIndex":"112", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "B02Targetgrid(Manual)", |
| | | "addressIndex":"114", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "A01turnTargetAngle(Manual)", |
| | | "addressIndex":"116", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A02turnTargetAngle(Manual)", |
| | | "addressIndex":"118", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A01turnAngle1", |
| | | "addressIndex":"120", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A01turnAngle2", |
| | | "addressIndex":"122", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A01turnAngle3", |
| | | "addressIndex":"124", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A01turnAngle4", |
| | | "addressIndex":"126", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A02turnAngle1", |
| | | "addressIndex":"128", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A02turnAngle2", |
| | | "addressIndex":"130", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A02turnAngle3", |
| | | "addressIndex":"132", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "A02turnAngle4", |
| | | "addressIndex":"134", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"°" |
| | | }, |
| | | { |
| | | "codeId": "Minimumglasslength", |
| | | "addressIndex":"136", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Minimumglassheight", |
| | | "addressIndex":"138", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Maximumglasslength", |
| | | "addressIndex":"140", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Maximumglassheight", |
| | | "addressIndex":"142", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "A01cellsGlassNum", |
| | | "addressIndex":"144", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "A02cellsGlassNum", |
| | | "addressIndex":"146", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "A01ID", |
| | | "addressIndex":"148", |
| | | "addressLenght":"14", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "A02ID", |
| | | "addressIndex":"162", |
| | | "addressLenght":"14", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "A02TRAVELPOSVelocitymanual", |
| | | "addressIndex":"176", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "B02TRAVELPOSVelocitymanual", |
| | | "addressIndex":"178", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Startingpositionofthefeedca", |
| | | "addressIndex":"180", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Targetpositionofthefeedcar", |
| | | "addressIndex":"182", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Lengthofincomingglass", |
| | | "addressIndex":"184", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Widthofincomingglass", |
| | | "addressIndex":"186", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, |
| | | { |
| | | "codeId": "Startingpositionoftheexitcar", |
| | | "addressIndex":"188", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | }, { |
| | | "codeId": "Exitcartargetposition", |
| | | "addressIndex":"190", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | } |
| | | , { |
| | | "codeId": "A02TURNPOSVelocitymanual", |
| | | "addressIndex":"192", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | } |
| | | , { |
| | | "codeId": "A01delayTime", |
| | | "addressIndex":"194", |
| | | "addressLenght":"2", |
| | | "ratio":"1" |
| | | |
| | | } |
| | | |
| | | |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin": "DB106.0", |
| | | "plcAddressLenght": "66", |
| | | "dataType": "word", |
| | | "parameteInfor": [{ |
| | | "codeId": "A01Position", |
| | | "addressIndex": "0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A01FlipPosition", |
| | | "addressIndex": "2", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A01QuestStartPosition", |
| | | "addressIndex": "4", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A01EndPosition", |
| | | "addressIndex": "6", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "FeedCarStatus", |
| | | "addressIndex": "8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A02QuestOver", |
| | | "addressIndex": "10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A02Position", |
| | | "addressIndex": "12", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A02FlipPosition", |
| | | "addressIndex": "14", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A02QuestStartPosition", |
| | | "addressIndex": "16", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A02EndPosition", |
| | | "addressIndex": "18", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "ExitCarStatus", |
| | | "addressIndex": "20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A02QuestOver", |
| | | "addressIndex": "22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "FeedRequest", |
| | | "addressIndex": "24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "FeedID", |
| | | "addressIndex": "26", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01Position", |
| | | "addressIndex": "40", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01QuestPosition", |
| | | "addressIndex": "42", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01CurrentTaskMode", |
| | | "addressIndex": "44", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01CarStatus", |
| | | "addressIndex": "46", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01CarTaskStatus", |
| | | "addressIndex": "48", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B02Position", |
| | | "addressIndex": "50", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B02CarCurrentTask", |
| | | "addressIndex": "52", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B02CurrentTaskMode", |
| | | "addressIndex": "54", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B02CarStatus", |
| | | "addressIndex": "56", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B02CarSaskStatus", |
| | | "addressIndex": "58", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B01CompleteTheReport", |
| | | "addressIndex": "60", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "B02CompleteTheReport", |
| | | "addressIndex": "62", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "OutRequest", |
| | | "addressIndex": "64", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin": "DB102.0.0", |
| | | "plcAddressLenght": "112", |
| | | "dataType": "bit", |
| | | "parameteInfor": [ |
| | | { |
| | | "codeId": "D01.SRdec", |
| | | "addressIndex": 0 |
| | | }, |
| | | { |
| | | "codeId": "D01.SRinpos", |
| | | "addressIndex": 1 |
| | | }, |
| | | { |
| | | "codeId": "D02.SRdec", |
| | | "addressIndex": 2 |
| | | }, |
| | | { |
| | | "codeId": "D02.SRinpos", |
| | | "addressIndex": 3 |
| | | }, |
| | | { |
| | | "codeId": "D03.SRinto", |
| | | "addressIndex": 4 |
| | | }, |
| | | { |
| | | "codeId": "D03.SRdec", |
| | | "addressIndex": 5 |
| | | }, |
| | | { |
| | | "codeId": "D03.SRinpos", |
| | | "addressIndex": 6 |
| | | }, |
| | | { |
| | | "codeId": "D04.SRdec", |
| | | "addressIndex": 7 |
| | | }, |
| | | { |
| | | "codeId": "D04.SRinpos", |
| | | "addressIndex": 8 |
| | | }, |
| | | { |
| | | "codeId": "D05.SRdec", |
| | | "addressIndex": 9 |
| | | }, |
| | | { |
| | | "codeId": "D05.SRinpos", |
| | | "addressIndex": 10 |
| | | }, |
| | | { |
| | | "codeId": "D06.SRdec", |
| | | "addressIndex": 11 |
| | | }, |
| | | { |
| | | "codeId": "D06.SRinpos", |
| | | "addressIndex": 12 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRindec", |
| | | "addressIndex": 13 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRininpos", |
| | | "addressIndex": 14 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRoutdec", |
| | | "addressIndex": 15 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRoutinpos", |
| | | "addressIndex": 16 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRturnon", |
| | | "addressIndex": 17 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRturnoff", |
| | | "addressIndex": 18 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRup", |
| | | "addressIndex": 19 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRdown", |
| | | "addressIndex": 20 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRoutdec", |
| | | "addressIndex": 21 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRoutinpos", |
| | | "addressIndex": 22 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRindec", |
| | | "addressIndex": 23 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRininpos", |
| | | "addressIndex": 24 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRturnon", |
| | | "addressIndex": 25 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRturnoff", |
| | | "addressIndex": 26 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRup", |
| | | "addressIndex": 27 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRdown", |
| | | "addressIndex": 28 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRinsafety", |
| | | "addressIndex": 29 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRoutsafety", |
| | | "addressIndex": 30 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRinsafety", |
| | | "addressIndex": 31 |
| | | }, |
| | | { |
| | | "codeId": "SB.start(+)", |
| | | "addressIndex": 32 |
| | | }, |
| | | { |
| | | "codeId": "SB.stop(-)", |
| | | "addressIndex": 33 |
| | | }, |
| | | { |
| | | "codeId": "SB.reset", |
| | | "addressIndex": 34 |
| | | }, |
| | | { |
| | | "codeId": "SB.auto/manul", |
| | | "addressIndex": 35 |
| | | }, |
| | | { |
| | | "codeId": "D01.SB.confirm", |
| | | "addressIndex": 36 |
| | | }, |
| | | { |
| | | "codeId": "SB.emg", |
| | | "addressIndex": 37 |
| | | }, |
| | | { |
| | | "codeId": "D01.SB.start", |
| | | "addressIndex": 38 |
| | | }, |
| | | { |
| | | "codeId": "D06.SB.start", |
| | | "addressIndex": 39 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRoutsafety", |
| | | "addressIndex": 40 |
| | | }, |
| | | { |
| | | "codeId": "SafetyDoor.requset", |
| | | "addressIndex": 41 |
| | | }, |
| | | { |
| | | "codeId": "SafetyDoor.confirm", |
| | | "addressIndex": 42 |
| | | }, |
| | | { |
| | | "codeId": "SafetyDoor.reset", |
| | | "addressIndex": 43 |
| | | }, |
| | | { |
| | | "codeId": "Sspce", |
| | | "addressIndex": 44 |
| | | }, |
| | | { |
| | | "codeId": "Sspce", |
| | | "addressIndex": 45 |
| | | }, |
| | | { |
| | | "codeId": "Sspce", |
| | | "addressIndex": 46 |
| | | }, |
| | | { |
| | | "codeId": "Sspce", |
| | | "addressIndex": 47 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRleftdec", |
| | | "addressIndex": 48 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRleftinpos", |
| | | "addressIndex": 49 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRleftsafety", |
| | | "addressIndex": 50 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRrightdec", |
| | | "addressIndex": 51 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRrightinpos", |
| | | "addressIndex": 52 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRrightsafety", |
| | | "addressIndex": 53 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRturnhome", |
| | | "addressIndex": 54 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRturnup", |
| | | "addressIndex": 55 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRturndown", |
| | | "addressIndex": 56 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRtravelhome", |
| | | "addressIndex": 57 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRtravelleftdec", |
| | | "addressIndex": 58 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRtravelleftlimit", |
| | | "addressIndex": 59 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRtravelrightdec", |
| | | "addressIndex": 60 |
| | | }, |
| | | { |
| | | "codeId": "A01.SRtravelrightlimit", |
| | | "addressIndex": 61 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 62 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 63 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRleftdec", |
| | | "addressIndex": 64 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRleftinpos", |
| | | "addressIndex": 65 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRleftsafety", |
| | | "addressIndex": 66 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRrightdec", |
| | | "addressIndex": 67 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRrightinpos", |
| | | "addressIndex": 68 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRrightsafety", |
| | | "addressIndex": 69 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRturnhome", |
| | | "addressIndex": 70 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRturnup", |
| | | "addressIndex": 71 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRturndown", |
| | | "addressIndex": 72 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRtravelhome", |
| | | "addressIndex": 73 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRtravelleftdec", |
| | | "addressIndex": 74 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRtravelleftlimit", |
| | | "addressIndex": 75 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRtravelrightdec", |
| | | "addressIndex": 76 |
| | | }, |
| | | { |
| | | "codeId": "A02.SRtravelrightlimit", |
| | | "addressIndex": 77 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 78 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 79 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRorigin", |
| | | "addressIndex": 80 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRleftlimit", |
| | | "addressIndex": 81 |
| | | }, |
| | | { |
| | | "codeId": "B01.SRrightlimit", |
| | | "addressIndex": 82 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRorigin", |
| | | "addressIndex": 83 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRleftlimit", |
| | | "addressIndex": 84 |
| | | }, |
| | | { |
| | | "codeId": "B02.SRrightlimit", |
| | | "addressIndex": 85 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 86 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 87 |
| | | }, |
| | | { |
| | | "codeId": "LED.red", |
| | | "addressIndex": 88 |
| | | }, |
| | | { |
| | | "codeId": "LED.green", |
| | | "addressIndex": 89 |
| | | }, |
| | | { |
| | | "codeId": "LED.yellow", |
| | | "addressIndex": 90 |
| | | }, |
| | | { |
| | | "codeId": "D01.LED.green", |
| | | "addressIndex": 91 |
| | | }, |
| | | { |
| | | "codeId": "D06.LED.green", |
| | | "addressIndex": 92 |
| | | }, |
| | | { |
| | | "codeId": "B01.YV.turn", |
| | | "addressIndex": 93 |
| | | }, |
| | | { |
| | | "codeId": "B01.YV.updown", |
| | | "addressIndex": 94 |
| | | }, |
| | | { |
| | | "codeId": "B01.YV.gassing", |
| | | "addressIndex": 95 |
| | | }, |
| | | { |
| | | "codeId": "B02.YV.turn", |
| | | "addressIndex": 96 |
| | | }, |
| | | { |
| | | "codeId": "B02.YV.updown", |
| | | "addressIndex": 97 |
| | | }, |
| | | { |
| | | "codeId": "B02.YV.gassing", |
| | | "addressIndex": 98 |
| | | }, |
| | | { |
| | | "codeId": "SafetyDoor.Led", |
| | | "addressIndex": 99 |
| | | }, |
| | | { |
| | | "codeId": "SafetyDoor.open", |
| | | "addressIndex": 100 |
| | | }, |
| | | { |
| | | "codeId": "D01SB.confirm", |
| | | "addressIndex": 101 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 102 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 103 |
| | | }, |
| | | { |
| | | "codeId": "A01oilPump", |
| | | "addressIndex": 104 |
| | | }, |
| | | { |
| | | "codeId": "A01motorCtr", |
| | | "addressIndex": 105 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 106 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 107 |
| | | }, |
| | | { |
| | | "codeId": "A02oilPump", |
| | | "addressIndex": 108 |
| | | }, |
| | | { |
| | | "codeId": "A02motorCtr", |
| | | "addressIndex": 109 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 110 |
| | | }, |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 111 |
| | | } |
| | | , |
| | | { |
| | | "codeId": "space", |
| | | "addressIndex": 111 |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin": "DB103.0", |
| | | "plcAddressLenght": "258", |
| | | "dataType": "word", |
| | | "parameteInfor": [ |
| | | { |
| | | "codeId": "D01.State", |
| | | "addressIndex": "0", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D02.State", |
| | | "addressIndex": "2", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B01.State", |
| | | "addressIndex": "4", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B02.State", |
| | | "addressIndex": "6", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01.State", |
| | | "addressIndex": "8", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02.State", |
| | | "addressIndex": "10", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D03.State", |
| | | "addressIndex": "12", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D04.State", |
| | | "addressIndex": "14", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D05.State", |
| | | "addressIndex": "16", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D06.State", |
| | | "addressIndex": "18", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01tavelActualPosition", |
| | | "addressIndex": "20", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01turnActualangle", |
| | | "addressIndex": "22", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02tavelActualPosition", |
| | | "addressIndex": "24", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02turnActualangle", |
| | | "addressIndex": "26", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B01tavelActualPosition", |
| | | "addressIndex": "28", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B02tavelActualPosition", |
| | | "addressIndex": "30", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01CurrentGrid", |
| | | "addressIndex": "32", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02CurrentGrid", |
| | | "addressIndex": "34", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B01CurrentGrid", |
| | | "addressIndex": "36", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B01TargetGrid", |
| | | "addressIndex": "38", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B02CurrentGrid", |
| | | "addressIndex": "40", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B02TargetGrid", |
| | | "addressIndex": "42", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D01ID", |
| | | "addressIndex": "44", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D02ID", |
| | | "addressIndex": "58", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D03ID", |
| | | "addressIndex": "72", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D04ID", |
| | | "addressIndex": "86", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D05ID", |
| | | "addressIndex": "100", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "D06ID", |
| | | "addressIndex": "114", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01ID1", |
| | | "addressIndex": "128", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01ID2", |
| | | "addressIndex": "142", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02ID1", |
| | | "addressIndex": "156", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02ID2", |
| | | "addressIndex": "170", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B01ID1", |
| | | "addressIndex": "184", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B01ID2", |
| | | "addressIndex": "198", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B02ID1", |
| | | "addressIndex": "212", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B02ID2", |
| | | "addressIndex": "226", |
| | | "addressLenght": "14", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01conveyorFaultcodes", |
| | | "addressIndex": "240", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01turnservoFaultcodes", |
| | | "addressIndex": "242", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A01travelservoFaultcodes", |
| | | "addressIndex": "244", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02conveyorFaultcodes", |
| | | "addressIndex": "246", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02turnservoFaultcodes", |
| | | "addressIndex": "248", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "A02travelservoFaultcodes", |
| | | "addressIndex": "250", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B01travelservoFaultcodes", |
| | | "addressIndex": "252", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | }, |
| | | { |
| | | "codeId": "B02travelservoFaultcodes", |
| | | "addressIndex": "254", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "Scanningguns", |
| | | "addressIndex": "256", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "Frameid", |
| | | "addressIndex": "270", |
| | | "addressLenght": "2", |
| | | "unit": "" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin": "DB101.0.0", |
| | | "plcAddressLenght": "93", |
| | | "dataType": "bit", |
| | | "parameteInfor": [ |
| | | { |
| | | "codeId": "D01VFDconveyor", |
| | | "addressIndex": 0 |
| | | }, |
| | | { |
| | | "codeId": "D02VFDconveyor", |
| | | "addressIndex": 1 |
| | | }, |
| | | { |
| | | "codeId": "D03VFDconveyor", |
| | | "addressIndex": 2 |
| | | }, |
| | | { |
| | | "codeId": "D04VFDconveyor", |
| | | "addressIndex": 3 |
| | | }, |
| | | { |
| | | "codeId": "D05VFDconveyor", |
| | | "addressIndex": 4 |
| | | }, |
| | | { |
| | | "codeId": "D06VFDconveyor", |
| | | "addressIndex": 5 |
| | | }, |
| | | { |
| | | "codeId": "A01VFDconveyor", |
| | | "addressIndex": 6 |
| | | }, |
| | | { |
| | | "codeId": "A02VFDconveyor", |
| | | "addressIndex": 7 |
| | | }, |
| | | { |
| | | "codeId": "B01VFDconveyor", |
| | | "addressIndex": 8 |
| | | }, |
| | | { |
| | | "codeId": "B02VFDconveyor", |
| | | "addressIndex": 9 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETURN", |
| | | "addressIndex": 10 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETURN", |
| | | "addressIndex": 11 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETRAVEL", |
| | | "addressIndex": 12 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETRAVEL", |
| | | "addressIndex": 13 |
| | | }, |
| | | { |
| | | "codeId": "B01SERVETRAVEL", |
| | | "addressIndex": 14 |
| | | }, |
| | | { |
| | | "codeId": "B02SERVETRAVEL", |
| | | "addressIndex": 15 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETURNPOS", |
| | | "addressIndex": 16 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETURNPOS", |
| | | "addressIndex": 17 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETRAVELPOS", |
| | | "addressIndex": 18 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETRAVELPOS", |
| | | "addressIndex": 19 |
| | | }, |
| | | { |
| | | "codeId": "B01SERVETRAVELPOS", |
| | | "addressIndex": 20 |
| | | }, |
| | | { |
| | | "codeId": "B02SERVETRAVELPOS", |
| | | "addressIndex": 21 |
| | | }, |
| | | { |
| | | "codeId": "B01YVTURN", |
| | | "addressIndex": 22 |
| | | }, |
| | | { |
| | | "codeId": "B01YVUPDOWN", |
| | | "addressIndex": 23 |
| | | }, |
| | | { |
| | | "codeId": "B02YVTURN", |
| | | "addressIndex": 24 |
| | | }, |
| | | { |
| | | "codeId": "B02YVUPDOWN", |
| | | "addressIndex": 25 |
| | | }, |
| | | { |
| | | "codeId": "B01YVGassing", |
| | | "addressIndex": 26 |
| | | }, |
| | | { |
| | | "codeId": "B02YVGassing", |
| | | "addressIndex": 27 |
| | | }, |
| | | { |
| | | "codeId": "A01VFDconveyorreverse", |
| | | "addressIndex": 28 |
| | | }, |
| | | { |
| | | "codeId": "A02VFDconveyorreverse", |
| | | "addressIndex": 29 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETURNreset", |
| | | "addressIndex": 30 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETURNhome", |
| | | "addressIndex": 31 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETRAVELreset", |
| | | "addressIndex": 32 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETURNreset", |
| | | "addressIndex": 33 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETURNhome", |
| | | "addressIndex": 34 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETRAVELreset", |
| | | "addressIndex": 35 |
| | | }, |
| | | { |
| | | "codeId": "B01SERVETRAVELreset", |
| | | "addressIndex": 36 |
| | | }, |
| | | { |
| | | "codeId": "B01SERVETRAVELhome", |
| | | "addressIndex": 37 |
| | | }, |
| | | { |
| | | "codeId": "B02SERVETRAVELreset", |
| | | "addressIndex": 38 |
| | | }, |
| | | { |
| | | "codeId": "B02SERVETRAVELhome", |
| | | "addressIndex": 39 |
| | | }, |
| | | { |
| | | "codeId": "Manualstoragestartup", |
| | | "addressIndex": 40 |
| | | }, |
| | | { |
| | | "codeId": "Manualoutputstartup", |
| | | "addressIndex": 41 |
| | | }, |
| | | { |
| | | "codeId": "A01oilpump", |
| | | "addressIndex": 42 |
| | | }, |
| | | { |
| | | "codeId": "A02oilpump", |
| | | "addressIndex": 43 |
| | | }, |
| | | { |
| | | "codeId": "A01get1#gridaddress", |
| | | "addressIndex": 44 |
| | | }, |
| | | { |
| | | "codeId": "A01get22#gridaddress", |
| | | "addressIndex": 45 |
| | | }, |
| | | { |
| | | "codeId": "A01get43#gridaddress", |
| | | "addressIndex": 46 |
| | | }, |
| | | { |
| | | "codeId": "A01get64#gridaddress", |
| | | "addressIndex": 47 |
| | | }, |
| | | { |
| | | "codeId": "A01get85#gridaddress", |
| | | "addressIndex": 48 |
| | | }, |
| | | { |
| | | "codeId": "A01get106#gridaddress", |
| | | "addressIndex": 49 |
| | | }, |
| | | { |
| | | "codeId": "A01get127#gridaddress", |
| | | "addressIndex": 50 |
| | | }, |
| | | { |
| | | "codeId": "A01get148#gridaddress", |
| | | "addressIndex": 51 |
| | | }, |
| | | { |
| | | "codeId": "A01get169#gridaddress", |
| | | "addressIndex": 52 |
| | | }, |
| | | { |
| | | "codeId": "A02get190#gridaddress", |
| | | "addressIndex": 53 |
| | | }, |
| | | { |
| | | "codeId": "A02get1#gridaddress", |
| | | "addressIndex": 54 |
| | | }, |
| | | { |
| | | "codeId": "A02get22#gridaddress", |
| | | "addressIndex": 55 |
| | | }, |
| | | { |
| | | "codeId": "A02get43#gridaddress", |
| | | "addressIndex": 56 |
| | | }, |
| | | { |
| | | "codeId": "A02get64#gridaddress", |
| | | "addressIndex": 57 |
| | | }, |
| | | { |
| | | "codeId": "A02get85#gridaddress", |
| | | "addressIndex": 58 |
| | | }, |
| | | { |
| | | "codeId": "A02get106#gridaddress", |
| | | "addressIndex": 59 |
| | | }, |
| | | { |
| | | "codeId": "A02get127#gridaddress", |
| | | "addressIndex": 60 |
| | | }, |
| | | { |
| | | "codeId": "A02get148#gridaddress", |
| | | "addressIndex": 61 |
| | | }, |
| | | { |
| | | "codeId": "A02get169#gridaddress", |
| | | "addressIndex": 62 |
| | | }, |
| | | { |
| | | "codeId": "A02get190#gridaddress", |
| | | "addressIndex": 63 |
| | | }, |
| | | { |
| | | "codeId": "B01get1#gridaddress", |
| | | "addressIndex": 64 |
| | | }, |
| | | { |
| | | "codeId": "B01get22#gridaddress", |
| | | "addressIndex": 65 |
| | | }, |
| | | { |
| | | "codeId": "B01get43#gridaddress", |
| | | "addressIndex": 66 |
| | | }, |
| | | { |
| | | "codeId": "B01get64#gridaddress", |
| | | "addressIndex": 67 |
| | | }, |
| | | { |
| | | "codeId": "B01get85#gridaddress", |
| | | "addressIndex": 68 |
| | | }, |
| | | { |
| | | "codeId": "B02get106#gridaddress", |
| | | "addressIndex": 69 |
| | | }, |
| | | { |
| | | "codeId": "B02get127#gridaddress", |
| | | "addressIndex": 70 |
| | | }, |
| | | { |
| | | "codeId": "B02get148#gridaddress", |
| | | "addressIndex": 71 |
| | | }, |
| | | { |
| | | "codeId": "B02get169#gridaddress", |
| | | "addressIndex": 72 |
| | | }, |
| | | { |
| | | "codeId": "B02get190#gridaddress", |
| | | "addressIndex": 73 |
| | | }, |
| | | { |
| | | "codeId": "D01IDClean", |
| | | "addressIndex": 74 |
| | | }, |
| | | { |
| | | "codeId": "D02IDClean", |
| | | "addressIndex": 75 |
| | | }, |
| | | { |
| | | "codeId": "D03IDClean", |
| | | "addressIndex": 76 |
| | | }, |
| | | { |
| | | "codeId": "D04IDClean", |
| | | "addressIndex": 77 |
| | | }, |
| | | { |
| | | "codeId": "D05IDClean", |
| | | "addressIndex": 78 |
| | | }, |
| | | { |
| | | "codeId": "D06IDClean", |
| | | "addressIndex": 79 |
| | | }, |
| | | { |
| | | "codeId": "A01IDClean", |
| | | "addressIndex": 80 |
| | | }, |
| | | { |
| | | "codeId": "A02IDClean", |
| | | "addressIndex": 81 |
| | | }, |
| | | { |
| | | "codeId": "B01IDClean", |
| | | "addressIndex": 82 |
| | | }, |
| | | { |
| | | "codeId": "B02IDClean", |
| | | "addressIndex": 83 |
| | | }, |
| | | { |
| | | "codeId": "abort/resumeTasks", |
| | | "addressIndex": 84 |
| | | }, |
| | | { |
| | | "codeId": "A01SERVETRAVELhome", |
| | | "addressIndex": 85 |
| | | }, |
| | | { |
| | | "codeId": "A02SERVETRAVELhome", |
| | | "addressIndex": 86 |
| | | }, |
| | | { |
| | | "codeId": "A01A02travelHoming", |
| | | "addressIndex": 87 |
| | | }, |
| | | { |
| | | "codeId": "A01halfAutoSelect", |
| | | "addressIndex": 88 |
| | | }, |
| | | { |
| | | "codeId": "A02halfAutoSelect", |
| | | "addressIndex": 89 |
| | | }, |
| | | { |
| | | "codeId": "A02abortTasks", |
| | | "addressIndex": 90 |
| | | }, |
| | | { |
| | | "codeId": "emgHMI", |
| | | "addressIndex": 91 |
| | | }, |
| | | { |
| | | "codeId": "Scanningmethod", |
| | | "addressIndex": 92 |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB17.0", |
| | | "plcAddressLenght":"40", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "E01id", |
| | | "addressIndex":"0", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "E01Quest", |
| | | "addressIndex":"16", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "E01Reply", |
| | | "addressIndex":"18", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "J01Quest", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "J01id", |
| | | "addressIndex":"22", |
| | | "addressLenght":"14", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | }, |
| | | { |
| | | "codeId": "J01TurnGo", |
| | | "addressIndex":"38", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"mm/S" |
| | | } |
| | | |
| | | |
| | | ] |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8085 |
| | | |
| | | spring: |
| | | datasource: |
| | | dynamic: |
| | | primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | server-addr: 10.153.19.150:8848 |
| | | application: |
| | | name: unLoadGlass |
| | | redis: |
| | | database: 0 |
| | | host: 10.153.19.150 |
| | | port: 6379 |
| | | password: 123456 |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | # 设置 MyBatis 日志级别为 ERROR |
| | | logging: |
| | | level: |
| | | com: |
| | | baomidou: |
| | | mybatisplus=ERROR: |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>moduleService</artifactId> |
| | | <packaging>pom</packaging> |
| | | <modules> |
| | | <module>CacheGlassModule</module> |
| | | <module>CacheVerticalGlassModule</module> |
| | | <module>LoadGlassModule</module> |
| | | <module>TemperingGlassModule</module> |
| | | <module>UnLoadGlassModule</module> |
| | | </modules> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | </properties> |
| | | <dependencies> |
| | | <!--web 需要启动项目--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity-engine-core</artifactId> |
| | | <version>2.0</version> |
| | | </dependency> |
| | | |
| | | <!--依赖服务的工具类--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.mes</groupId>--> |
| | | <!-- <artifactId>common</artifactId>--> |
| | | <!-- <version>1.0-SNAPSHOT</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <artifactId>servicebase</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <artifactId>springsecurity</artifactId> |
| | | <groupId>com.mes</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <!--开发者工具--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <groupId>com.mes</groupId> |
| | | <artifactId>hangzhoumesParent</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <modules> |
| | | <module>common</module> |
| | | <module>moduleService</module> |
| | | <module>gateway</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |
| | | <parent> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-parent</artifactId> |
| | | <version>2.1.8.RELEASE</version> |
| | | </parent> |
| | | |
| | | <properties> |
| | | <!-- 跳过测试 --> |
| | | <skipTests>true</skipTests> |
| | | </properties> |
| | | |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-dependencies</artifactId> |
| | | <version>Greenwich.SR3</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-alibaba-dependencies</artifactId> |
| | | <version>2.1.0.RELEASE</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>nexus-aliyun</id> |
| | | <name>Nexus aliyun</name> |
| | | <layout>default</layout> |
| | | <url>https://maven.aliyun.com/repository/public</url> |
| | | <snapshots> |
| | | <enabled>false</enabled> |
| | | </snapshots> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | </repository> |
| | | <repository> |
| | | <id>spring</id> |
| | | <url>https://maven.aliyun.com/repository/spring</url> |
| | | <releases> |
| | | <enabled>true</enabled> |
| | | </releases> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | 1、本项目是基于SpringBoot+Mybatis-plus+Mysql+Vue+ElementUI+Maven+Nginx的项目,目录结果结构如下: |
| | | |
| | | ├─src |
| | | ├─com 插件生成的代码,用于各自开发使用 |
| | | │ └─mes |
| | | ├─common 公共模块 |
| | | │ ├─src |
| | | └─moduleService |
| | | ├─-CacheGlassModule |
| | | ├─-CacheVerticalGlassModule |
| | | ├─-LoadGlassModule |
| | | ├─-TemperingGlassModule |
| | | └─-UnLoadGlassModule |
| | | |
| | | 2、运行项目: 1、启动项目:启动各自模块启动类 例如:CacheGlassModuleApplication.java#main() |
| | | 2、访问项目: 3、项目地址:http://localhost:8081/mesModuleCache/doc.html#/home |
| | | 4、项目说明: 本界面为Api文档,公开人员用于调试 3、项目说明: 1、项目分为公共模块common,业务模块moduleService。 2、common模块中包含公共的类,例如:公共的实体类、拦截器、工具类、常量类、异常处理等。 |
| | | 3、moduleService中包含各个业务模块,每个业务模块中包含一个启动类,开发人员需要开发各自负责的业务模块。 4、com目录下的文件为插件生成的代码,用于各自开发使用。用完删除即可,避免影响开发。 |