Compare commits
	
		
			31 Commits
		
	
	
		
			d518ce3d19
			...
			cicd
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ce721696fa | |||
|  | 41207394e5 | ||
|  | 14745366be | ||
| cade1cc1b9 | |||
| 8c0e43d9f7 | |||
| d44034c1db | |||
| 56b8b82fc2 | |||
|  | 31bc287207 | ||
|  | bb8986c98d | ||
| 76cef5fc05 | |||
| 94a7b76157 | |||
| 74dd845b13 | |||
| 58adaa3c59 | |||
|  | fed8f82ff0 | ||
|  | cdc06bd733 | ||
|  | 6e08ff6482 | ||
|  | a50849affc | ||
|  | 161b5b5be4 | ||
|  | 6d3b1e9cbb | ||
| fa783cda84 | |||
| e8629b9ced | |||
|  | 384b1a3d54 | ||
|  | 16f3cd5d30 | ||
| 2cd68b93bf | |||
| 5f409dfdf7 | |||
|  | 1ebe39b60a | ||
|  | 4d1a58b8c7 | ||
| d853cb8409 | |||
| 7a6fffbf21 | |||
| de085053b8 | |||
|  | 4535677c93 | 
| @@ -11,16 +11,16 @@ steps: | ||||
|   - name: dockerconfig | ||||
|     path: /root/.docker | ||||
|   commands: | ||||
|   - docker build -t harbor.picaiba.com/kszny/mes-api:1.0.0-india ./ && docker push harbor.picaiba.com/kszny/mes-api:1.0.0-india | ||||
|   - docker build -t harbor.picaiba.com/kszny/mes-api:1.0.0-cigs4 ./ && docker push harbor.picaiba.com/kszny/mes-api:1.0.0-cigs4 | ||||
|  | ||||
| - name: deploy | ||||
|   image: harbor.picaiba.com/tools/kubectl | ||||
|   commands: | ||||
|   - echo "172.27.0.20 lb.kubesphere.local" >> /etc/hosts | ||||
|   - sleep 1 | ||||
|   - kubectl scale --replicas=0 deployment/mes-api -n mes-india | ||||
|   - kubectl scale --replicas=0 deployment/mes-api -n mes-cigs4 | ||||
|   - sleep 3 | ||||
|   - kubectl scale --replicas=1 deployment/mes-api -n mes-india | ||||
|   - kubectl scale --replicas=1 deployment/mes-api -n mes-cigs4 | ||||
|   depends_on: | ||||
|   - build | ||||
|  | ||||
| @@ -34,6 +34,6 @@ volumes: | ||||
|      | ||||
| trigger: | ||||
|   branch: | ||||
|   - porject/yd-monitor | ||||
|   - master | ||||
|   event: | ||||
|   - push | ||||
|   | ||||
| @@ -49,7 +49,7 @@ ENV TZ="Asia/Shanghai" | ||||
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||||
| # 定义一些环境变量,方便环境变量传参 | ||||
| ENV JVM_OPTS="" | ||||
| ENV JAVA_OPTS="-Dspring.profiles.active=dev" | ||||
| ENV JAVA_OPTS="" | ||||
| # 指定暴露的端口,起到说明的作用,不指定也会暴露对应端口 | ||||
| EXPOSE 8080 | ||||
| # 启动 jar 的命令 | ||||
|   | ||||
| @@ -72,6 +72,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { | ||||
|                         "/swagger-ui/**", | ||||
|                         "/webjars/**", | ||||
|                         "/websocket/**", | ||||
|                         "/test/**", | ||||
|                         "/**/expert", | ||||
|                         "/captcha", | ||||
|                         "druid/**").anonymous() | ||||
| //                .antMatchers("/testCors").hasAuthority("system:dept:list222") | ||||
|   | ||||
| @@ -54,13 +54,21 @@ spring: | ||||
| ##多数据源的配置,需要引用renren-dynamic-datasource | ||||
| dynamic: | ||||
|   datasource: | ||||
|     slave1: | ||||
| #    ## 本mes系统 | ||||
| #    slave1: | ||||
| #      driver-class-name: com.mysql.cj.jdbc.Driver | ||||
| #      url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true | ||||
| #      username: root | ||||
| #      password: 1qaz@WSX3edc$RFV | ||||
|     ## camline系统 | ||||
|     camline: | ||||
|       driver-class-name: com.mysql.cj.jdbc.Driver | ||||
|       url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true | ||||
|       username: root | ||||
|       password: 1qaz@WSX3edc$RFV | ||||
|     slave2: | ||||
|       driver-class-name: com.mysql.cj.jdbc.Driver | ||||
|       url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true | ||||
|       username: root | ||||
|       password: 1qaz@WSX3edc$RFV | ||||
| # | ||||
| #    camline: | ||||
| #      driver-class-name: com.mysql.cj.jdbc.Driver | ||||
| #      url: jdbc:mysql://10.0.1.23:3306/synapse?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true | ||||
| #      username: offline_data | ||||
| #      password: tpvmfab4 | ||||
| @@ -33,7 +33,7 @@ spring: | ||||
|       enabled: true | ||||
|   redis: | ||||
|     database: 6 | ||||
|     host: redis.picaiba.com | ||||
|     host: 192.168.0.135 | ||||
|     port: 6380 | ||||
|     password: '@WSXcde3'   # 密码(默认为空) | ||||
|     timeout: 6000ms  # 连接超时时长(毫秒) | ||||
|   | ||||
							
								
								
									
										428
									
								
								ym-gateway/src/main/resources/logback.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										428
									
								
								ym-gateway/src/main/resources/logback.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,428 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> | ||||
| <!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> | ||||
| <!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。 | ||||
|                  当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> | ||||
| <!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> | ||||
| <configuration  scan="true" scanPeriod="10 seconds"> | ||||
|     <contextName>logback-spring</contextName> | ||||
|  | ||||
|     <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> | ||||
|  | ||||
| <!--    <property name="logging.pathwork" value="C:/qgs_logger/work" />--> | ||||
| <!--    <property name="logging.pathopc" value="C:/qgs_logger/opc" />--> | ||||
| <!--    <property name="logging.pathmq" value="C:/qgs_logger/mq" />--> | ||||
| <!--    <property name="logging.eqlog" value="C:/qgs_logger/s7" />--> | ||||
|  | ||||
|     <property name="logging.eqlog" value="/usr/local/logger/EQCommunicationLog" /> | ||||
|     <property name="logging.packing" value="/usr/local/logger/Packing" /> | ||||
|  | ||||
|  | ||||
|  | ||||
|     <!--0. 日志格式和颜色渲染 --> | ||||
|     <!-- 彩色日志依赖的渲染类 --> | ||||
|     <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> | ||||
|     <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> | ||||
|     <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> | ||||
|     <!-- 彩色日志格式 --> | ||||
|     <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> | ||||
|     <!--1. 输出到控制台--> | ||||
|     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||||
|  | ||||
|         <encoder> | ||||
|             <Pattern>${CONSOLE_LOG_PATTERN}</Pattern> | ||||
|             <!-- 设置字符集 --> | ||||
|             <charset>UTF-8</charset> | ||||
|         </encoder> | ||||
|  | ||||
|  | ||||
|         <!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> | ||||
|         <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | ||||
|             <level>info</level> | ||||
|         </filter> | ||||
|  | ||||
|     </appender> | ||||
|  | ||||
|     <!--2. 输出到文档--> | ||||
|     <!-- 2.1 level为 DEBUG 日志,时间滚动输出  --> | ||||
|     <appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.pathwork}/debug/work-log-debug.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 设置字符集 --> | ||||
|         </encoder> | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.pathwork}/work-log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|  | ||||
|         <!-- 此日志文档只记录debug级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>debug</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="EQ_COMM_LOG_DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.eqlog}/debug/s7-log-debug.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 设置字符集 --> | ||||
|         </encoder> | ||||
|  | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.eqlog}/s7-eq-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|  | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录debug级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>debug</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="PACKING_LOG_DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.packing}/debug/packing-log-debug.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 设置字符集 --> | ||||
|         </encoder> | ||||
|  | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.packing}/packing-log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|  | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录debug级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>debug</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|  | ||||
|  | ||||
|     <!-- 2.2 level为 INFO 日志,时间滚动输出  --> | ||||
|     <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.pathwork}/info/work-log-info.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> | ||||
|         </encoder> | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.pathwork}/work-log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录info级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>info</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="EQ_COMM_LOG_INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.eqlog}/info/s7-eq-info.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> | ||||
|         </encoder> | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.eqlog}/s7-eq-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|  | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录info级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>info</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="PACKING_LOG_INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.packing}/info/packing-log-info.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> | ||||
|         </encoder> | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.packing}/packing-log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|  | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录info级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>info</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|  | ||||
|     <!-- 2.3 level为 WARN 日志,时间滚动输出  --> | ||||
|     <appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.pathwork}/warn/work-log-warn.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||||
|         </encoder> | ||||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | ||||
| <!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">--> | ||||
| <!--            <fileNamePattern>${logging.pathwork}/work-log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>--> | ||||
| <!--            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">--> | ||||
| <!--                <maxFileSize>100MB</maxFileSize>--> | ||||
| <!--            </timeBasedFileNamingAndTriggeringPolicy>--> | ||||
| <!--            <!–日志文档保留天数–>--> | ||||
| <!--            <maxHistory>999</maxHistory>--> | ||||
| <!--        </rollingPolicy>--> | ||||
|  | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.pathwork}/work-log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录warn级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>warn</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="EQ_COMM_LOG_WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.eqlog}/warn/s7-log-warn.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||||
|         </encoder> | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.eqlog}/s7-log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|  | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录warn级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>warn</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="PACKING_LOG_WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.packing}/warn/packing-log-warn.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||||
|         </encoder> | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.packing}/packing-log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|  | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|         <!-- 此日志文档只记录warn级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>warn</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|  | ||||
|     <!-- 2.4 level为 ERROR 日志,时间滚动输出  --> | ||||
|     <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.pathwork}/error/work-log-error.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||||
|         </encoder> | ||||
|         <!-- 日志记录器的滚动策略,按日期,按大小记录 --> | ||||
| <!--        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">--> | ||||
| <!--            <fileNamePattern>${logging.pathwork}/work-log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>--> | ||||
| <!--            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">--> | ||||
| <!--                <maxFileSize>100MB</maxFileSize>--> | ||||
| <!--            </timeBasedFileNamingAndTriggeringPolicy>--> | ||||
| <!--            <!–日志文档保留天数–>--> | ||||
| <!--            <maxHistory>999</maxHistory>--> | ||||
| <!--        </rollingPolicy>--> | ||||
|  | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.pathwork}/work-log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|  | ||||
|         <!-- 此日志文档只记录ERROR级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>ERROR</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="EQ_COMM_LOG_ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.eqlog}/error/s7-log-error.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||||
|         </encoder> | ||||
|  | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.eqlog}/s7-log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|  | ||||
|         <!-- 此日志文档只记录ERROR级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>ERROR</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|     <appender name="PACKING_LOG_ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||||
|         <!-- 正在记录的日志文档的路径及文档名 --> | ||||
|         <file>${logging.packing}/error/packing-log-error.log</file> | ||||
|         <!--日志文档输出格式--> | ||||
|         <encoder> | ||||
|             <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> | ||||
|             <charset>UTF-8</charset> <!-- 此处设置字符集 --> | ||||
|         </encoder> | ||||
|  | ||||
|         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||||
|             <!-- rollover daily --> | ||||
|             <fileNamePattern>${logging.packing}/packing-log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> | ||||
|             <!-- each file should be at most 100MB, keep 60 days worth of history, but at most 20GB --> | ||||
|             <maxFileSize>100MB</maxFileSize> | ||||
|             <maxHistory>999</maxHistory> | ||||
|             <totalSizeCap>200GB</totalSizeCap> | ||||
|         </rollingPolicy> | ||||
|  | ||||
|         <!-- 此日志文档只记录ERROR级别的 --> | ||||
|         <filter class="ch.qos.logback.classic.filter.LevelFilter"> | ||||
|             <level>ERROR</level> | ||||
|             <onMatch>ACCEPT</onMatch> | ||||
|             <onMismatch>DENY</onMismatch> | ||||
|         </filter> | ||||
|     </appender> | ||||
|  | ||||
|     <!-- | ||||
|         <logger>用来设置某一个包或者具体的某一个类的日志打印级别、 | ||||
|         以及指定<appender>。<logger>仅有一个name属性, | ||||
|         一个可选的level和一个可选的addtivity属性。 | ||||
|         name:用来指定受此logger约束的某一个包或者具体的某一个类。 | ||||
|         level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, | ||||
|               还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。 | ||||
|               如果未设置此属性,那么当前logger将会继承上级的级别。 | ||||
|         addtivity:是否向上级logger传递打印信息。默认是true。 | ||||
|         <logger name="org.springframework.web" level="info"/> | ||||
|         <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/> | ||||
|     --> | ||||
|  | ||||
|     <!-- | ||||
|         使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作: | ||||
|         第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息 | ||||
|         第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别: | ||||
|         【logging.level.org.mybatis=debug logging.level.dao=debug】 | ||||
|      --> | ||||
|  | ||||
|     <!-- | ||||
|         root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性 | ||||
|         level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF, | ||||
|         不能设置为INHERITED或者同义词NULL。默认是DEBUG | ||||
|         可以包含零个或多个元素,标识这个appender将会添加到这个logger。 | ||||
|     --> | ||||
|  | ||||
|     <!-- name就是包名,这个包下的 所有logger 输出就以下配置(这里的logger只会输出代码里 你指定打印的log ) --> | ||||
|  | ||||
|     <logger name="com.cnbm.dispatch" additivity="false"> | ||||
|         <appender-ref ref="EQ_COMM_LOG_DEBUG_FILE" /> | ||||
|         <appender-ref ref="EQ_COMM_LOG_INFO_FILE" /> | ||||
|         <appender-ref ref="EQ_COMM_LOG_WARN_FILE" /> | ||||
|         <appender-ref ref="EQ_COMM_LOG_ERROR_FILE" /> | ||||
|     </logger> | ||||
|  | ||||
|     <logger name="com.cnbm.packing" additivity="false"> | ||||
|         <appender-ref ref="PACKING_LOG_DEBUG_FILE" /> | ||||
|         <appender-ref ref="PACKING_LOG_INFO_FILE" /> | ||||
|         <appender-ref ref="PACKING_LOG_WARN_FILE" /> | ||||
|         <appender-ref ref="PACKING_LOG_ERROR_FILE" /> | ||||
|     </logger> | ||||
|  | ||||
|     <!--    work这个目录 是所有控制台信息 + 第三方jar包 输出的信息  --> | ||||
|     <root level="info"> | ||||
|         <appender-ref ref="CONSOLE" /> | ||||
|         <appender-ref ref="DEBUG_FILE" /> | ||||
|         <appender-ref ref="INFO_FILE" /> | ||||
|         <appender-ref ref="WARN_FILE" /> | ||||
|         <appender-ref ref="ERROR_FILE" /> | ||||
|     </root> | ||||
|  | ||||
|     <!-- 4.2 生产环境:输出到文档 | ||||
|     <springProfile name="pro"> | ||||
|         <root level="info"> | ||||
|             <appender-ref ref="CONSOLE" /> | ||||
|             <appender-ref ref="DEBUG_FILE" /> | ||||
|             <appender-ref ref="INFO_FILE" /> | ||||
|             <appender-ref ref="ERROR_FILE" /> | ||||
|             <appender-ref ref="WARN_FILE" /> | ||||
|         </root> | ||||
|     </springProfile> --> | ||||
| </configuration> | ||||
| @@ -31,7 +31,7 @@ import java.util.Map; | ||||
|  * 包装箱表  前端控制器 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-22 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/code/woPackagingBox") | ||||
|   | ||||
| @@ -31,7 +31,7 @@ import java.util.Map; | ||||
|  * 包装箱基板关联表 ( 基板表 )  前端控制器 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-21 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/code/woPackagingBoxSubstrate") | ||||
|   | ||||
| @@ -31,7 +31,7 @@ import java.util.Map; | ||||
|  * 功率等级 表  前端控制器 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-20 | ||||
|  * @since  2023-02-22 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/code/woPowerLevel") | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import java.math.BigDecimal; | ||||
|  * 包装箱表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-22 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| @Data | ||||
| @ApiModel(value = "包装箱表DTO对象") | ||||
| @@ -26,7 +26,7 @@ public class WoPackagingBoxDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "ID") | ||||
| 	private Long id; | ||||
|  | ||||
| 	@ApiModelProperty(value = "订单ID") | ||||
| 	@ApiModelProperty(value = "订单ID(舍弃)") | ||||
| 	private Long orderId; | ||||
|  | ||||
| 	@ApiModelProperty(value = "工单ID(舍弃啊)") | ||||
| @@ -110,4 +110,7 @@ public class WoPackagingBoxDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "是否到达包装台,1=到达;2=未达到") | ||||
| 	private Integer isArrived; | ||||
|  | ||||
| 	@ApiModelProperty(value = "订单号") | ||||
| 	private String orderNum; | ||||
|  | ||||
| } | ||||
| @@ -14,7 +14,7 @@ import java.math.BigDecimal; | ||||
|  * 包装箱基板关联表 ( 基板表 ) | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-21 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| @Data | ||||
| @ApiModel(value = "包装箱基板关联表 ( 基板表 )DTO对象") | ||||
| @@ -71,4 +71,103 @@ public class WoPackagingBoxSubstrateDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "功率等级") | ||||
| 	private String powerLevel; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private LocalDateTime lastUpdateTime; | ||||
|  | ||||
| 	@ApiModelProperty(value = "补偿pmpp") | ||||
| 	private Float pmpp; | ||||
|  | ||||
| 	@ApiModelProperty(value = "订单名") | ||||
| 	private String orderName; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Long binclassFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Long binclassFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float etaFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float etaFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float ffFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float ffFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float imppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float imppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolflashcontrolFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolflashcontrolFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolmppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolmppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolvocFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolvocFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float iscFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float iscFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private LocalDateTime measTimeFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private LocalDateTime measTimeFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float pmppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float pmppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tcellFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tcellFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tmonicellFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tmonicellFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float umppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float umppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float uocFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float uocFl2; | ||||
|  | ||||
| } | ||||
| @@ -14,7 +14,7 @@ import java.math.BigDecimal; | ||||
|  * 功率等级 表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-20 | ||||
|  * @since  2023-02-22 | ||||
|  */ | ||||
| @Data | ||||
| @ApiModel(value = "功率等级 表DTO对象") | ||||
| @@ -27,7 +27,7 @@ public class WoPowerLevelDTO implements Serializable { | ||||
| 	private Long id; | ||||
|  | ||||
| 	@ApiModelProperty(value = "功率等级名称,(现场人员手动录入)") | ||||
| 	private Integer powerClass; | ||||
| 	private String powerClass; | ||||
|  | ||||
| 	@ApiModelProperty(value = "pmpp_low,(现场人员手动录入)") | ||||
| 	private Float pmppLow; | ||||
| @@ -38,7 +38,7 @@ public class WoPowerLevelDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "物料号,(现场人员手动录入)") | ||||
| 	private String sapMaterialNum; | ||||
|  | ||||
| 	@ApiModelProperty(value = "线体,1=F ; 2=S (用于过程1比对,和包装打印)(设备传给我们的)") | ||||
| 	@ApiModelProperty(value = "线体,1=F ; 2=S (用于过程1比对,和包装打印)(设备传给我们的)(一个功率等级可能对应多个线体)") | ||||
| 	private Integer lineBody; | ||||
|  | ||||
| 	@ApiModelProperty(value = "lable_voc,(手动录入)") | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import lombok.Data; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-22 | ||||
|  * @since 2023-02-23 | ||||
|  */ | ||||
| @Data | ||||
| @TableName("t_wo_packaging_box") | ||||
| @@ -26,7 +26,7 @@ public class WoPackagingBox implements Serializable { | ||||
|     @ApiModelProperty("ID") | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty("订单ID") | ||||
|     @ApiModelProperty("订单ID(舍弃)") | ||||
|     private Long orderId; | ||||
|  | ||||
|     @ApiModelProperty("工单ID(舍弃啊)") | ||||
| @@ -111,6 +111,9 @@ public class WoPackagingBox implements Serializable { | ||||
|     @ApiModelProperty("是否到达包装台,1=到达;2=未达到") | ||||
|     private Integer isArrived; | ||||
|  | ||||
|     @ApiModelProperty("订单号") | ||||
|     private String orderNum; | ||||
|  | ||||
|  | ||||
|     public static final String ID = "ID"; | ||||
|  | ||||
| @@ -170,4 +173,6 @@ public class WoPackagingBox implements Serializable { | ||||
|  | ||||
|     public static final String IS_ARRIVED = "is_arrived"; | ||||
|  | ||||
|     public static final String ORDER_NUM = "ORDER_NUM"; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -14,7 +14,7 @@ import lombok.Data; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-21 | ||||
|  * @since 2023-02-23 | ||||
|  */ | ||||
| @Data | ||||
| @TableName("t_wo_packaging_box_substrate") | ||||
| @@ -72,6 +72,74 @@ public class WoPackagingBoxSubstrate implements Serializable { | ||||
|     @ApiModelProperty("功率等级") | ||||
|     private String powerLevel; | ||||
|  | ||||
|     private LocalDateTime lastUpdateTime; | ||||
|  | ||||
|     @ApiModelProperty("补偿pmpp") | ||||
|     private Float pmpp; | ||||
|  | ||||
|     @ApiModelProperty("订单名") | ||||
|     private String orderName; | ||||
|  | ||||
|     private Long binclassFl1; | ||||
|  | ||||
|     private Long binclassFl2; | ||||
|  | ||||
|     private Float etaFl1; | ||||
|  | ||||
|     private Float etaFl2; | ||||
|  | ||||
|     private Float ffFl1; | ||||
|  | ||||
|     private Float ffFl2; | ||||
|  | ||||
|     private Float imppFl1; | ||||
|  | ||||
|     private Float imppFl2; | ||||
|  | ||||
|     private Float insolflashcontrolFl1; | ||||
|  | ||||
|     private Float insolflashcontrolFl2; | ||||
|  | ||||
|     private Float insolmppFl1; | ||||
|  | ||||
|     private Float insolmppFl2; | ||||
|  | ||||
|     private Float insolvocFl1; | ||||
|  | ||||
|     private Float insolvocFl2; | ||||
|  | ||||
|     private Float insolFl1; | ||||
|  | ||||
|     private Float insolFl2; | ||||
|  | ||||
|     private Float iscFl1; | ||||
|  | ||||
|     private Float iscFl2; | ||||
|  | ||||
|     private LocalDateTime measTimeFl1; | ||||
|  | ||||
|     private LocalDateTime measTimeFl2; | ||||
|  | ||||
|     private Float pmppFl1; | ||||
|  | ||||
|     private Float pmppFl2; | ||||
|  | ||||
|     private Float tcellFl1; | ||||
|  | ||||
|     private Float tcellFl2; | ||||
|  | ||||
|     private Float tmonicellFl1; | ||||
|  | ||||
|     private Float tmonicellFl2; | ||||
|  | ||||
|     private Float umppFl1; | ||||
|  | ||||
|     private Float umppFl2; | ||||
|  | ||||
|     private Float uocFl1; | ||||
|  | ||||
|     private Float uocFl2; | ||||
|  | ||||
|  | ||||
|     public static final String ID = "ID"; | ||||
|  | ||||
| @@ -105,4 +173,70 @@ public class WoPackagingBoxSubstrate implements Serializable { | ||||
|  | ||||
|     public static final String POWER_LEVEL = "POWER_LEVEL"; | ||||
|  | ||||
|     public static final String LAST_UPDATE_TIME = "LAST_UPDATE_TIME"; | ||||
|  | ||||
|     public static final String PMPP = "PMPP"; | ||||
|  | ||||
|     public static final String ORDER_NAME = "ORDER_NAME"; | ||||
|  | ||||
|     public static final String BINCLASS_FL1 = "BINCLASS_FL1"; | ||||
|  | ||||
|     public static final String BINCLASS_FL2 = "BINCLASS_FL2"; | ||||
|  | ||||
|     public static final String ETA_FL1 = "ETA_FL1"; | ||||
|  | ||||
|     public static final String ETA_FL2 = "ETA_FL2"; | ||||
|  | ||||
|     public static final String FF_FL1 = "FF_FL1"; | ||||
|  | ||||
|     public static final String FF_FL2 = "FF_FL2"; | ||||
|  | ||||
|     public static final String IMPP_FL1 = "IMPP_FL1"; | ||||
|  | ||||
|     public static final String IMPP_FL2 = "IMPP_FL2"; | ||||
|  | ||||
|     public static final String INSOLFLASHCONTROL_FL1 = "InsolFlashControl_FL1"; | ||||
|  | ||||
|     public static final String INSOLFLASHCONTROL_FL2 = "InsolFlashControl_FL2"; | ||||
|  | ||||
|     public static final String INSOLMPP_FL1 = "InsolMPP_FL1"; | ||||
|  | ||||
|     public static final String INSOLMPP_FL2 = "InsolMPP_FL2"; | ||||
|  | ||||
|     public static final String INSOLVOC_FL1 = "InsolVoc_FL1"; | ||||
|  | ||||
|     public static final String INSOLVOC_FL2 = "InsolVoc_FL2"; | ||||
|  | ||||
|     public static final String INSOL_FL1 = "Insol_FL1"; | ||||
|  | ||||
|     public static final String INSOL_FL2 = "Insol_FL2"; | ||||
|  | ||||
|     public static final String ISC_FL1 = "ISC_FL1"; | ||||
|  | ||||
|     public static final String ISC_FL2 = "ISC_FL2"; | ||||
|  | ||||
|     public static final String MEAS_TIME_FL1 = "MEAS_TIME_FL1"; | ||||
|  | ||||
|     public static final String MEAS_TIME_FL2 = "MEAS_TIME_FL2"; | ||||
|  | ||||
|     public static final String PMPP_FL1 = "PMPP_FL1"; | ||||
|  | ||||
|     public static final String PMPP_FL2 = "PMPP_FL2"; | ||||
|  | ||||
|     public static final String TCELL_FL1 = "Tcell_FL1"; | ||||
|  | ||||
|     public static final String TCELL_FL2 = "Tcell_FL2"; | ||||
|  | ||||
|     public static final String TMONICELL_FL1 = "Tmonicell_FL1"; | ||||
|  | ||||
|     public static final String TMONICELL_FL2 = "Tmonicell_FL2"; | ||||
|  | ||||
|     public static final String UMPP_FL1 = "UMPP_FL1"; | ||||
|  | ||||
|     public static final String UMPP_FL2 = "UMPP_FL2"; | ||||
|  | ||||
|     public static final String UOC_FL1 = "UOC_FL1"; | ||||
|  | ||||
|     public static final String UOC_FL2 = "UOC_FL2"; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import lombok.Data; | ||||
|  * </p> | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-20 | ||||
|  * @since 2023-02-22 | ||||
|  */ | ||||
| @Data | ||||
| @TableName("t_wo_power_level") | ||||
| @@ -28,7 +28,7 @@ public class WoPowerLevel implements Serializable { | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty("功率等级名称,(现场人员手动录入)") | ||||
|     private Integer powerClass; | ||||
|     private String powerClass; | ||||
|  | ||||
|     @ApiModelProperty("pmpp_low,(现场人员手动录入)") | ||||
|     private Float pmppLow; | ||||
| @@ -39,7 +39,7 @@ public class WoPowerLevel implements Serializable { | ||||
|     @ApiModelProperty("物料号,(现场人员手动录入)") | ||||
|     private String sapMaterialNum; | ||||
|  | ||||
|     @ApiModelProperty("线体,1=F ; 2=S (用于过程1比对,和包装打印)(设备传给我们的)") | ||||
|     @ApiModelProperty("线体,1=F ; 2=S (用于过程1比对,和包装打印)(设备传给我们的)(一个功率等级可能对应多个线体)") | ||||
|     private Integer lineBody; | ||||
|  | ||||
|     @ApiModelProperty("lable_voc,(手动录入)") | ||||
|   | ||||
| @@ -12,13 +12,13 @@ import java.util.Date; | ||||
|  * 包装箱表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-22 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| @Data | ||||
| public class WoPackagingBoxExcel { | ||||
|     @Excel(name = "ID") | ||||
|     private Long id; | ||||
|     @Excel(name = "订单ID") | ||||
|     @Excel(name = "订单ID(舍弃)") | ||||
|     private Long orderId; | ||||
|     @Excel(name = "工单ID(舍弃啊)") | ||||
|     private Long workOrderId; | ||||
| @@ -74,5 +74,7 @@ public class WoPackagingBoxExcel { | ||||
|     private Integer model; | ||||
|     @Excel(name = "是否到达包装台,1=到达;2=未达到") | ||||
|     private Integer isArrived; | ||||
|     @Excel(name = "订单号") | ||||
|     private String orderNum; | ||||
|  | ||||
| } | ||||
| @@ -12,7 +12,7 @@ import java.util.Date; | ||||
|  * 包装箱基板关联表 ( 基板表 ) | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-21 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| @Data | ||||
| public class WoPackagingBoxSubstrateExcel { | ||||
| @@ -48,5 +48,71 @@ public class WoPackagingBoxSubstrateExcel { | ||||
|     private Integer lineBody; | ||||
|     @Excel(name = "功率等级") | ||||
|     private String powerLevel; | ||||
|     @Excel(name = "") | ||||
|     private LocalDateTime lastUpdateTime; | ||||
|     @Excel(name = "补偿pmpp") | ||||
|     private Float pmpp; | ||||
|     @Excel(name = "订单名") | ||||
|     private String orderName; | ||||
|     @Excel(name = "") | ||||
|     private Long binclassFl1; | ||||
|     @Excel(name = "") | ||||
|     private Long binclassFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float etaFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float etaFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float ffFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float ffFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float imppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float imppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolflashcontrolFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolflashcontrolFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolmppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolmppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolvocFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolvocFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float iscFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float iscFl2; | ||||
|     @Excel(name = "") | ||||
|     private LocalDateTime measTimeFl1; | ||||
|     @Excel(name = "") | ||||
|     private LocalDateTime measTimeFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float pmppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float pmppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float tcellFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float tcellFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float tmonicellFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float tmonicellFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float umppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float umppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float uocFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float uocFl2; | ||||
|  | ||||
| } | ||||
| @@ -12,21 +12,21 @@ import java.util.Date; | ||||
|  * 功率等级 表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-20 | ||||
|  * @since  2023-02-22 | ||||
|  */ | ||||
| @Data | ||||
| public class WoPowerLevelExcel { | ||||
|     @Excel(name = "ID") | ||||
|     private Long id; | ||||
|     @Excel(name = "功率等级名称,(现场人员手动录入)") | ||||
|     private Integer powerClass; | ||||
|     private String powerClass; | ||||
|     @Excel(name = "pmpp_low,(现场人员手动录入)") | ||||
|     private Float pmppLow; | ||||
|     @Excel(name = "pmpp_high,(现场人员手动录入)") | ||||
|     private Float pmppHigh; | ||||
|     @Excel(name = "物料号,(现场人员手动录入)") | ||||
|     private String sapMaterialNum; | ||||
|     @Excel(name = "线体,1=F ; 2=S (用于过程1比对,和包装打印)(设备传给我们的)") | ||||
|     @Excel(name = "线体,1=F ; 2=S (用于过程1比对,和包装打印)(设备传给我们的)(一个功率等级可能对应多个线体)") | ||||
|     private Integer lineBody; | ||||
|     @Excel(name = "lable_voc,(手动录入)") | ||||
|     private BigDecimal lableVoc; | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper; | ||||
|  * 包装箱表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-22 | ||||
|  * @since 2023-02-23 | ||||
|  */ | ||||
| @Mapper | ||||
| public interface WoPackagingBoxMapper extends BaseDao<WoPackagingBox> { | ||||
|   | ||||
| @@ -31,6 +31,7 @@ | ||||
|             <id column="LINE_BODY" property="lineBody" /> | ||||
|             <id column="model" property="model" /> | ||||
|             <id column="is_arrived" property="isArrived" /> | ||||
|             <id column="ORDER_NUM" property="orderNum" /> | ||||
|     </resultMap> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper; | ||||
|  * 包装箱基板关联表 ( 基板表 ) | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-21 | ||||
|  * @since 2023-02-23 | ||||
|  */ | ||||
| @Mapper | ||||
| public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> { | ||||
|   | ||||
| @@ -18,6 +18,39 @@ | ||||
|             <id column="SAP_MATERIAL" property="sapMaterial" /> | ||||
|             <id column="LINE_BODY" property="lineBody" /> | ||||
|             <id column="POWER_LEVEL" property="powerLevel" /> | ||||
|             <id column="LAST_UPDATE_TIME" property="lastUpdateTime" /> | ||||
|             <id column="PMPP" property="pmpp" /> | ||||
|             <id column="ORDER_NAME" property="orderName" /> | ||||
|             <id column="BINCLASS_FL1" property="binclassFl1" /> | ||||
|             <id column="BINCLASS_FL2" property="binclassFl2" /> | ||||
|             <id column="ETA_FL1" property="etaFl1" /> | ||||
|             <id column="ETA_FL2" property="etaFl2" /> | ||||
|             <id column="FF_FL1" property="ffFl1" /> | ||||
|             <id column="FF_FL2" property="ffFl2" /> | ||||
|             <id column="IMPP_FL1" property="imppFl1" /> | ||||
|             <id column="IMPP_FL2" property="imppFl2" /> | ||||
|             <id column="InsolFlashControl_FL1" property="insolflashcontrolFl1" /> | ||||
|             <id column="InsolFlashControl_FL2" property="insolflashcontrolFl2" /> | ||||
|             <id column="InsolMPP_FL1" property="insolmppFl1" /> | ||||
|             <id column="InsolMPP_FL2" property="insolmppFl2" /> | ||||
|             <id column="InsolVoc_FL1" property="insolvocFl1" /> | ||||
|             <id column="InsolVoc_FL2" property="insolvocFl2" /> | ||||
|             <id column="Insol_FL1" property="insolFl1" /> | ||||
|             <id column="Insol_FL2" property="insolFl2" /> | ||||
|             <id column="ISC_FL1" property="iscFl1" /> | ||||
|             <id column="ISC_FL2" property="iscFl2" /> | ||||
|             <id column="MEAS_TIME_FL1" property="measTimeFl1" /> | ||||
|             <id column="MEAS_TIME_FL2" property="measTimeFl2" /> | ||||
|             <id column="PMPP_FL1" property="pmppFl1" /> | ||||
|             <id column="PMPP_FL2" property="pmppFl2" /> | ||||
|             <id column="Tcell_FL1" property="tcellFl1" /> | ||||
|             <id column="Tcell_FL2" property="tcellFl2" /> | ||||
|             <id column="Tmonicell_FL1" property="tmonicellFl1" /> | ||||
|             <id column="Tmonicell_FL2" property="tmonicellFl2" /> | ||||
|             <id column="UMPP_FL1" property="umppFl1" /> | ||||
|             <id column="UMPP_FL2" property="umppFl2" /> | ||||
|             <id column="UOC_FL1" property="uocFl1" /> | ||||
|             <id column="UOC_FL2" property="uocFl2" /> | ||||
|     </resultMap> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper; | ||||
|  * 功率等级 表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-20 | ||||
|  * @since 2023-02-22 | ||||
|  */ | ||||
| @Mapper | ||||
| public interface WoPowerLevelMapper extends BaseDao<WoPowerLevel> { | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| -- 菜单初始SQL | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1627855073022648322, 1067246875800000035, '包装箱基板关联表 ( 基板表 )', 'packing/woPackagingBoxSubstrate', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627855073022648323, 1627855073022648322, '查看', NULL, 'packing:woPackagingBoxSubstrate:page,packing:woPackagingBoxSubstrate:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627855073022648324, 1627855073022648322, '新增', NULL, 'packing:woPackagingBoxSubstrate:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627855073022648325, 1627855073022648322, '修改', NULL, 'packing:woPackagingBoxSubstrate:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627855073022648326, 1627855073022648322, '删除', NULL, 'packing:woPackagingBoxSubstrate:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627855073022648327, 1627855073022648322, '导出', NULL, 'packing:woPackagingBoxSubstrate:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1628638869145812994, 1067246875800000035, '包装箱基板关联表 ( 基板表 )', 'code/woPackagingBoxSubstrate', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812995, 1628638869145812994, '查看', NULL, 'code:woPackagingBoxSubstrate:page,code:woPackagingBoxSubstrate:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812996, 1628638869145812994, '新增', NULL, 'code:woPackagingBoxSubstrate:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812997, 1628638869145812994, '修改', NULL, 'code:woPackagingBoxSubstrate:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812998, 1628638869145812994, '删除', NULL, 'code:woPackagingBoxSubstrate:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628638869145812999, 1628638869145812994, '导出', NULL, 'code:woPackagingBoxSubstrate:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| -- 菜单初始SQL | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1628230581925277697, 1067246875800000035, '包装箱表', 'code/woPackagingBox', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628230581925277698, 1628230581925277697, '查看', NULL, 'code:woPackagingBox:page,code:woPackagingBox:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628230581925277699, 1628230581925277697, '新增', NULL, 'code:woPackagingBox:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628230581925277700, 1628230581925277697, '修改', NULL, 'code:woPackagingBox:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628230581925277701, 1628230581925277697, '删除', NULL, 'code:woPackagingBox:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628230581925277702, 1628230581925277697, '导出', NULL, 'code:woPackagingBox:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1628589985438695426, 1067246875800000035, '包装箱表', 'code/woPackagingBox', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628589985438695427, 1628589985438695426, '查看', NULL, 'code:woPackagingBox:page,code:woPackagingBox:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628589985438695428, 1628589985438695426, '新增', NULL, 'code:woPackagingBox:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628589985438695429, 1628589985438695426, '修改', NULL, 'code:woPackagingBox:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628589985438695430, 1628589985438695426, '删除', NULL, 'code:woPackagingBox:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628589985438695431, 1628589985438695426, '导出', NULL, 'code:woPackagingBox:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| -- 菜单初始SQL | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1627486255993688065, 1067246875800000035, '功率等级 表', 'packing/woPowerLevel', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627486255993688066, 1627486255993688065, '查看', NULL, 'packing:woPowerLevel:page,packing:woPowerLevel:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627486255993688067, 1627486255993688065, '新增', NULL, 'packing:woPowerLevel:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627486255993688068, 1627486255993688065, '修改', NULL, 'packing:woPowerLevel:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627486255993688069, 1627486255993688065, '删除', NULL, 'packing:woPowerLevel:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1627486255993688070, 1627486255993688065, '导出', NULL, 'packing:woPowerLevel:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date)VALUES (1628374086450421761, 1067246875800000035, '功率等级 表', 'code/woPowerLevel', NULL, 0, 'icon-desktop', 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628374086450421762, 1628374086450421761, '查看', NULL, 'code:woPowerLevel:page,code:woPowerLevel:info', 1, NULL, 0, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628374086450421763, 1628374086450421761, '新增', NULL, 'code:woPowerLevel:save', 1, NULL, 1, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628374086450421764, 1628374086450421761, '修改', NULL, 'code:woPowerLevel:update', 1, NULL, 2, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628374086450421765, 1628374086450421761, '删除', NULL, 'code:woPowerLevel:delete', 1, NULL, 3, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
| INSERT INTO sys_menu(id, pid, name, url, permissions, type, icon, sort, creator, create_date, updater, update_date) VALUES (1628374086450421766, 1628374086450421761, '导出', NULL, 'code:woPowerLevel:export', 1, NULL, 4, 1067246875800000001, now(), 1067246875800000001, now()); | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.WoPackagingBox; | ||||
|  * 包装箱表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-22 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, WoPackagingBoxDTO> { | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.WoPackagingBoxSubstrate; | ||||
|  * 包装箱基板关联表 ( 基板表 ) | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-21 | ||||
|  * @since  2023-02-23 | ||||
|  */ | ||||
| public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagingBoxSubstrate, WoPackagingBoxSubstrateDTO> { | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.WoPowerLevel; | ||||
|  * 功率等级 表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-20 | ||||
|  * @since  2023-02-22 | ||||
|  */ | ||||
| public interface WoPowerLevelServiceBiz extends CrudService<WoPowerLevel, WoPowerLevelDTO> { | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import java.util.Map; | ||||
|  * 包装箱表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-22 | ||||
|  * @since 2023-02-23 | ||||
|  */ | ||||
| @Service | ||||
| public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBoxMapper, WoPackagingBox, WoPackagingBoxDTO> implements WoPackagingBoxServiceBiz { | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import java.util.Map; | ||||
|  * 包装箱基板关联表 ( 基板表 ) | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-21 | ||||
|  * @since 2023-02-23 | ||||
|  */ | ||||
| @Service | ||||
| public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPackagingBoxSubstrateMapper, WoPackagingBoxSubstrate, WoPackagingBoxSubstrateDTO> implements WoPackagingBoxSubstrateServiceBiz { | ||||
|   | ||||
| @@ -15,7 +15,7 @@ import java.util.Map; | ||||
|  * 功率等级 表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-20 | ||||
|  * @since 2023-02-22 | ||||
|  */ | ||||
| @Service | ||||
| public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapper, WoPowerLevel, WoPowerLevelDTO> implements WoPowerLevelServiceBiz { | ||||
|   | ||||
| @@ -23,6 +23,16 @@ | ||||
|             <artifactId>ym-common</artifactId> | ||||
|             <version>1.0-SNAPSHOT</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>com.cnbm</groupId> | ||||
|             <artifactId>ym-s7</artifactId> | ||||
|             <version>1.0-SNAPSHOT</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>com.cnbm</groupId> | ||||
|             <artifactId>ym-dynamic-datasource</artifactId> | ||||
|             <version>1.0-SNAPSHOT</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.springframework.security</groupId> | ||||
|             <artifactId>spring-security-core</artifactId> | ||||
| @@ -33,10 +43,5 @@ | ||||
|             <version>1.0-SNAPSHOT</version> | ||||
|             <scope>compile</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>com.cnbm</groupId> | ||||
|             <artifactId>ym-dynamic-datasource</artifactId> | ||||
|             <version>1.0-SNAPSHOT</version> | ||||
|         </dependency> | ||||
|     </dependencies> | ||||
| </project> | ||||
							
								
								
									
										430
									
								
								ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										430
									
								
								ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,430 @@ | ||||
| package com.cnbm.dispatch; | ||||
|  | ||||
| import cn.hutool.core.date.DateUtil; | ||||
| import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar; | ||||
| import com.cnbm.packing.service.*; | ||||
| import com.cnbm.s7.s7connector.enmuc.S7Client; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.boot.ApplicationArguments; | ||||
| import org.springframework.boot.ApplicationRunner; | ||||
| import org.springframework.core.annotation.Order; | ||||
| import org.springframework.stereotype.Component; | ||||
|  | ||||
| import java.util.Date; | ||||
| import java.util.concurrent.Executors; | ||||
| import java.util.concurrent.ScheduledExecutorService; | ||||
| import java.util.concurrent.TimeUnit; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2022/12/23 12:33 | ||||
|  */ | ||||
| @Component | ||||
| @Order(value = 1) | ||||
| public class KukaJoinThread implements ApplicationRunner { | ||||
|     private static final Logger logger = LoggerFactory.getLogger(KukaJoinThread.class); | ||||
|  | ||||
|     @Autowired | ||||
|     DynamicDataSourceService service; | ||||
|     @Autowired | ||||
|     WoPowerLevelServiceBiz levelServiceBiz; | ||||
|  | ||||
|     @Autowired | ||||
|     WoCompensationPowerServiceBiz compensationPowerServiceBiz; | ||||
|  | ||||
|     @Autowired | ||||
|     WoPackagingBoxSubstrateServiceBiz substrateServiceBiz; | ||||
|  | ||||
|     @Autowired | ||||
|     WoPackagingBoxServiceBiz boxServiceBiz; | ||||
|  | ||||
|     public KukaJoinThread(){ | ||||
|         this.kukaStep1 = Executors.newScheduledThreadPool(1); | ||||
|         this.kukaStep2 = Executors.newScheduledThreadPool(1); | ||||
|         this.kukaStep3 = Executors.newScheduledThreadPool(1); | ||||
|     } | ||||
|  | ||||
|     private ScheduledExecutorService kukaStep1; | ||||
|     private ScheduledExecutorService kukaStep2; | ||||
|     private ScheduledExecutorService kukaStep3; | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * return | ||||
|      *          成功: 返回相应的object对象 | ||||
|      *          失败: 返回null | ||||
|      * */ | ||||
|     private Object read(S7Client s7Client,Step1Plc2MesVar var) { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|             logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage()); | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|     private void write(S7Client s7Client, Step1Mes2PlcVar var, Object newValue) { | ||||
|         if(var.getType().equals(PlcVar.STRING_Array)){ | ||||
|             String[] s = (String[])newValue; | ||||
|             String[] ss = (String[])newValue; | ||||
|             if(s.length > var.getLength() ){ | ||||
|                 ss = new String[var.getLength()]; | ||||
|                 for(int i=0;i< var.getLength();i++){ | ||||
|                     ss[i] = s[i]; | ||||
|                 } | ||||
|             } | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss); | ||||
|         }else { | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Object read(S7Client s7Client, Step2Plc2MesVar var) { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|             logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage()); | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|     private void write(S7Client s7Client, Step2Mes2PlcVar var, Object newValue) { | ||||
|         if(var.getType().equals(PlcVar.STRING_Array)){ | ||||
|             String[] s = (String[])newValue; | ||||
|             String[] ss = (String[])newValue; | ||||
|             if(s.length > var.getLength() ){ | ||||
|                 ss = new String[var.getLength()]; | ||||
|                 for(int i=0;i< var.getLength();i++){ | ||||
|                     ss[i] = s[i]; | ||||
|                 } | ||||
|             } | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss); | ||||
|         }else { | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Object read(S7Client s7Client, Step3Plc2MesVar var) { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|             logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage()); | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|     private void write(S7Client s7Client, Step3Mes2PlcVar var, Object newValue) { | ||||
|         if(var.getType().equals(PlcVar.STRING_Array)){ | ||||
|             String[] s = (String[])newValue; | ||||
|             String[] ss = (String[])newValue; | ||||
|             if(s.length > var.getLength() ){ | ||||
|                 ss = new String[var.getLength()]; | ||||
|                 for(int i=0;i< var.getLength();i++){ | ||||
|                     ss[i] = s[i]; | ||||
|                 } | ||||
|             } | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss); | ||||
|         }else { | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public String getBoxId(String sapMaterial){ | ||||
|         Integer todayBoxNum = service.getTodayBoxNum(); | ||||
|         String nowTime = DateUtil.format(new Date(), "yyMMdd"); | ||||
|         String res = "301"+sapMaterial+nowTime+todayBoxNum; | ||||
|         return res; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void run(ApplicationArguments args) throws Exception { | ||||
|  | ||||
| //        kukaStep1.scheduleAtFixedRate(new Runnable() { | ||||
| //            @Override | ||||
| //            public void run() { | ||||
| //                logger.info("=================  现在开始执行 过程一 任务   =================="); | ||||
| //            } | ||||
| //        },1,1, TimeUnit.SECONDS); | ||||
|  | ||||
|  | ||||
|  | ||||
| //        kukaStep1.scheduleAtFixedRate(new Runnable() { | ||||
| //            @Override | ||||
| //            public void run() { | ||||
| //                //调度开始 | ||||
| ////                logger.info(""); | ||||
| ////                logger.info("=================  现在开始执行 过程一 任务   =================="); | ||||
| //                Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true); | ||||
| //                if(subArrived != 1){ | ||||
| //                    logger.info("失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败"); | ||||
| //                } | ||||
| // | ||||
| //                //一. 从plc 中获取 subId 和 lineNum | ||||
| //                String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes); | ||||
| //                Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum); | ||||
| //                logger.info("采集到 基板ID: "+subId+", 线边号:"+lineNum); | ||||
| // | ||||
| //                //二. MES 业务 | ||||
| //                //===============           MES 业务 开始         ================= | ||||
| //                //1. 从comline数据库中获取 实际pmpp | ||||
| //                float pmppBySubId = service.getPMPPBySubId(subId); | ||||
| //                //2. 匹配和计算补偿功率 | ||||
| //                float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum); | ||||
| //                //3. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka | ||||
| //                WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum); | ||||
| //                write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass())); | ||||
| //                write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc()); | ||||
| //                write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc()); | ||||
| //                write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp()); | ||||
| //                write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp()); | ||||
| // | ||||
| // | ||||
| // | ||||
| //                //4. 把基板录到数据库 | ||||
| //                WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate(); | ||||
| //                woPackagingBoxSubstrate.setLineBody(lineNum); | ||||
| //                woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass()); | ||||
| //                woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum()); | ||||
| //                woPackagingBoxSubstrate.setWoSubstrateId(subId); | ||||
| // | ||||
| //                //5. 从camline那里获取可变字段 | ||||
| //                CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId); | ||||
| //                woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime()); | ||||
| //                woPackagingBoxSubstrate.setPmpp(actualPMPP); | ||||
| //                woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName()); | ||||
| //                woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1()); | ||||
| //                woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2()); | ||||
| //                woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1()); | ||||
| //                woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2()); | ||||
| //                woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1()); | ||||
| //                woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2()); | ||||
| //                woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1()); | ||||
| //                woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2()); | ||||
| //                woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1()); | ||||
| //                woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2()); | ||||
| //                woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1()); | ||||
| //                woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2()); | ||||
| //                woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1()); | ||||
| //                woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2()); | ||||
| //                woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1()); | ||||
| //                woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2()); | ||||
| //                woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1()); | ||||
| //                woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2()); | ||||
| //                woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1()); | ||||
| //                woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2()); | ||||
| //                woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1()); | ||||
| //                woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2()); | ||||
| //                woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1()); | ||||
| //                woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2()); | ||||
| //                woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1()); | ||||
| //                woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2()); | ||||
| //                woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1()); | ||||
| //                woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2()); | ||||
| //                woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1()); | ||||
| //                woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2()); | ||||
| // | ||||
| //                substrateServiceBiz.insert(woPackagingBoxSubstrate); | ||||
| //                //===============           MES 业务 结束         ================= | ||||
| // | ||||
| //                //三. 当MES完成任务后,把MesToPlc.SubArrivedFinish变量置为true,告诉plc,我操作完成了 | ||||
| //                write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true); | ||||
| // | ||||
| //                //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false | ||||
| //                Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false); | ||||
| //                if(subArrived2 != 1){ | ||||
| //                    logger.info("失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败"); | ||||
| //                } | ||||
| //                write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false); | ||||
| //            } | ||||
| //        },1,1, TimeUnit.SECONDS); | ||||
| // | ||||
| // | ||||
| //        kukaStep2.scheduleAtFixedRate(new Runnable() { | ||||
| //            @Override | ||||
| //            public void run() { | ||||
| //                //调度开始 | ||||
| // | ||||
| //                Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true); | ||||
| //                if(shelfIsFull != 1){ | ||||
| //                    logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败"); | ||||
| //                } | ||||
| // | ||||
| //                //一. 从plc 中获取 subIdList 和 lineNum | ||||
| //                String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList); | ||||
| ////                Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step2Plc2MesVar.LineNum); | ||||
| //                logger.info("获取到基板列表:"+ Arrays.toString(subIdList)); | ||||
| // | ||||
| //                //二. MES 业务 | ||||
| //                //===============           MES 业务 开始         ================= | ||||
| //                //1.MES 生成BoxId | ||||
| //                if(subIdList.length<=0){ | ||||
| //                    logger.info("失败"+" --- "+"从plc里面获取到的基板列表 为空"); | ||||
| //                } | ||||
| //                WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]); | ||||
| //                String boxId = getBoxId(bySubId.getSapMaterial()); | ||||
| //                logger.info("mes 生成的boxId :"+ boxId); | ||||
| //                //2. 依次update 基板表,把boxId 赋予这些基板 | ||||
| //                for(int i=0;i<subIdList.length;i++){ | ||||
| //                    substrateServiceBiz.updatePackagingBoxIdByWoSubstrateId(boxId,subIdList[i]); | ||||
| //                } | ||||
| //                //3.去camline数据库 查询此基板ID 对应的订单 | ||||
| //                String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]); | ||||
| //                //4. box信息录入到box表 | ||||
| //                WoPackagingBox woPackagingBox = new WoPackagingBox(); | ||||
| //                woPackagingBox.setBoxNo(boxId); | ||||
| //                woPackagingBox.setPackagingTime(LocalDateTime.now()); | ||||
| //                woPackagingBox.setPowerLevel(bySubId.getPowerLevel()); | ||||
| //                woPackagingBox.setLineBody(bySubId.getLineBody()); | ||||
| //                woPackagingBox.setSapMaterial(bySubId.getSapMaterial()); | ||||
| //                woPackagingBox.setOrderNum(orderNameBySubId); | ||||
| //                //1-手动模式,2-自动模式 | ||||
| //                woPackagingBox.setModel(2); | ||||
| //                boxServiceBiz.insert(woPackagingBox); | ||||
| //                //===============           MES 业务 结束         ================= | ||||
| // | ||||
| //                //三. 把生成的BoxId 告诉kuka | ||||
| //                write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId); | ||||
| // | ||||
| //                //四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了 | ||||
| //                write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true); | ||||
| // | ||||
| //                //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false | ||||
| //                Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false); | ||||
| //                if(subArrived2 != 1){ | ||||
| //                    logger.info("失败"+" --- "+"步骤1.  MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败"); | ||||
| //                } | ||||
| //                write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false); | ||||
| //            } | ||||
| //        },1,1, TimeUnit.SECONDS); | ||||
| // | ||||
| // | ||||
| //        kukaStep3.scheduleAtFixedRate(new Runnable() { | ||||
| //            @Override | ||||
| //            public void run() { | ||||
| //                //调度开始 | ||||
| //                Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true); | ||||
| //                if(shelfIsFull != 1){ | ||||
| //                    logger.info("失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败"); | ||||
| //                } | ||||
| // | ||||
| //                //一. 从plc 中获取 subIdList 和 lineNum | ||||
| //                String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId); | ||||
| //                Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum); | ||||
| //                logger.info("到达站台的boxId :"+boxId); | ||||
| // | ||||
| //                //二. MES 业务 | ||||
| //                //===============           MES 业务 开始         ================= | ||||
| //                //1. box信息录入到box表 | ||||
| //                boxServiceBiz.updateIsArrivedByBoxNo(1,boxId); | ||||
| //                //===============           MES 业务 结束         ================= | ||||
| // | ||||
| // | ||||
| //                //四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了 | ||||
| //                write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true); | ||||
| // | ||||
| //                //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false | ||||
| //                Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false); | ||||
| //                if(subArrived2 != 1){ | ||||
| //                    logger.info("失败"+" --- "+"步骤1.  MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败"); | ||||
| //                } | ||||
| //                write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false); | ||||
| // | ||||
| // | ||||
| //            } | ||||
| //        },1,1, TimeUnit.SECONDS); | ||||
|  | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * | ||||
|      * arg: | ||||
|      *      Step1Plc2MesVar 参数类型 | ||||
|      *      targetValue        目的值 | ||||
|      * return: | ||||
|      *      2 s7 访问异常; | ||||
|      *      1 成功; | ||||
|      * */ | ||||
|     private Integer waitingForTarget(Step1Plc2MesVar var, Boolean targetValue) { | ||||
|         Integer res = 0; | ||||
|         while (true){ | ||||
|             try { | ||||
|                 Boolean now = (Boolean) read(S7Client.S7_KUKA,var); | ||||
|                 if(targetValue.equals(now)){ | ||||
|                     res = 1; | ||||
|                     break; | ||||
|                 } | ||||
|                 Thread.sleep(200); | ||||
|             }catch (Exception e){ | ||||
|                 logger.info("S7 数据采集 异常。"); | ||||
|                 res = 2; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         return res; | ||||
|     } | ||||
|     /** | ||||
|      * | ||||
|      * arg: | ||||
|      *      Step2Plc2MesVar 参数类型 | ||||
|      *      targetValue        目的值 | ||||
|      * return: | ||||
|      *      2 s7 访问异常; | ||||
|      *      1 成功; | ||||
|      * */ | ||||
|     private Integer waitingForTarget(Step2Plc2MesVar var, Boolean targetValue) { | ||||
|         Integer res = 0; | ||||
|         while (true){ | ||||
|             try { | ||||
|                 Boolean now = (Boolean) read(S7Client.S7_KUKA,var); | ||||
|                 if(targetValue.equals(now)){ | ||||
|                     res = 1; | ||||
|                     break; | ||||
|                 } | ||||
|                 Thread.sleep(200); | ||||
|             }catch (Exception e){ | ||||
|                 logger.info("S7 数据采集 异常。"); | ||||
|                 res = 2; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         return res; | ||||
|     } | ||||
|     /** | ||||
|      * | ||||
|      * arg: | ||||
|      *      Step3Plc2MesVar 参数类型 | ||||
|      *      targetValue        目的值 | ||||
|      * return: | ||||
|      *      2 s7 访问异常; | ||||
|      *      1 成功; | ||||
|      * */ | ||||
|     private Integer waitingForTarget(Step3Plc2MesVar var, Boolean targetValue) { | ||||
|         Integer res = 0; | ||||
|         while (true){ | ||||
|             try { | ||||
|                 Boolean now = (Boolean) read(S7Client.S7_KUKA,var); | ||||
|                 if(targetValue.equals(now)){ | ||||
|                     res = 1; | ||||
|                     break; | ||||
|                 } | ||||
|                 Thread.sleep(200); | ||||
|             }catch (Exception e){ | ||||
|                 logger.info("S7 数据采集 异常。"); | ||||
|                 res = 2; | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         return res; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,15 @@ | ||||
| package com.cnbm.dispatch.enums; | ||||
|  | ||||
| /** | ||||
|  * @Author: 蔡翔 | ||||
|  * @Date: 2019/10/14 10:07 | ||||
|  * @Version 1.0 | ||||
|  */ | ||||
| public interface CodeEnum { | ||||
|     Integer getNamespace(); | ||||
|     String getIdentity(); | ||||
|     String getType(); | ||||
|     String getName(); | ||||
|     String getDesc(); | ||||
|     void set(String name,Integer nameSpace,String identity); | ||||
| } | ||||
| @@ -0,0 +1,93 @@ | ||||
| package com.cnbm.dispatch.enums.kuka.step1; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/21 19:35 | ||||
|  */ | ||||
| public enum Step1Mes2PlcVar { | ||||
|     SubArrivedFinish("SubArrivedFinish", PlcVar.BOOL,1, DaveArea.DB,2000,26,0), | ||||
|  | ||||
|     dLable_Pnom("dLable_Pnom", PlcVar.DINT,1, DaveArea.DB,2000,28,0), | ||||
|     dLable_Voc("dLable_Voc", PlcVar.REAL,1, DaveArea.DB,2000,32,0), | ||||
|     dLable_Isc("dLable_Isc", PlcVar.REAL,1, DaveArea.DB,2000,36,0), | ||||
|     dLable_Vmpp("dLable_Vmpp", PlcVar.REAL,1, DaveArea.DB,2000,40,0), | ||||
|     dLable_Impp("dLable_Vmpp", PlcVar.REAL,1, DaveArea.DB,2000,44,0), | ||||
|  | ||||
|  | ||||
|  | ||||
|     ; | ||||
|  | ||||
|     private String name; | ||||
|     private DaveArea area; | ||||
|     private Integer areaNumber; | ||||
|     private Integer byteOffset; | ||||
|     private Integer bitOffset; | ||||
|     private PlcVar type; | ||||
|     //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度,和read操作相关 | ||||
|     //如果是String 类型不用填length 只需要填string类型的起始位置就行了,我会自己去取数据长度(也就是说这里的length并不是string 的长度)。 | ||||
|     private Integer length; | ||||
|  | ||||
|     //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度 | ||||
|     private Integer strSize; | ||||
|  | ||||
|     Step1Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = 0; | ||||
|     } | ||||
|     Step1Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public Integer getStrSize() { | ||||
|         return strSize; | ||||
|     } | ||||
|  | ||||
|     public void setStrSize(Integer strSize) { | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public DaveArea getArea() { | ||||
|         return area; | ||||
|     } | ||||
|  | ||||
|     public Integer getAreaNumber() { | ||||
|         return areaNumber; | ||||
|     } | ||||
|  | ||||
|     public Integer getBitOffset() { | ||||
|         return bitOffset; | ||||
|     } | ||||
|  | ||||
|     public Integer getByteOffset() { | ||||
|         return byteOffset; | ||||
|     } | ||||
|  | ||||
|     public PlcVar getType() { | ||||
|         return type; | ||||
|     } | ||||
|  | ||||
|     public Integer getLength() { | ||||
|         return length; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,89 @@ | ||||
| package com.cnbm.dispatch.enums.kuka.step1; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/21 19:35 | ||||
|  */ | ||||
| public enum Step1Plc2MesVar { | ||||
|  | ||||
|     SubArrivedToMes("SubArrivedToMes", PlcVar.BOOL,1, DaveArea.DB,2000,0,0), | ||||
|     SubIdToMes("SubIdToMes",PlcVar.STRING,1,DaveArea.DB,2000,2,0,20), | ||||
|     LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,24,0), | ||||
|  | ||||
|  | ||||
|     ; | ||||
|  | ||||
|     private String name; | ||||
|     private DaveArea area; | ||||
|     private Integer areaNumber; | ||||
|     private Integer byteOffset; | ||||
|     private Integer bitOffset; | ||||
|     private PlcVar type; | ||||
|     //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度,和read操作相关 | ||||
|     //如果是String 类型不用填length 只需要填string类型的起始位置就行了,我会自己去取数据长度(也就是说这里的length并不是string 的长度)。 | ||||
|     private Integer length; | ||||
|  | ||||
|     //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度 | ||||
|     private Integer strSize; | ||||
|  | ||||
|     Step1Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = 0; | ||||
|     } | ||||
|     Step1Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public Integer getStrSize() { | ||||
|         return strSize; | ||||
|     } | ||||
|  | ||||
|     public void setStrSize(Integer strSize) { | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public DaveArea getArea() { | ||||
|         return area; | ||||
|     } | ||||
|  | ||||
|     public Integer getAreaNumber() { | ||||
|         return areaNumber; | ||||
|     } | ||||
|  | ||||
|     public Integer getBitOffset() { | ||||
|         return bitOffset; | ||||
|     } | ||||
|  | ||||
|     public Integer getByteOffset() { | ||||
|         return byteOffset; | ||||
|     } | ||||
|  | ||||
|     public PlcVar getType() { | ||||
|         return type; | ||||
|     } | ||||
|  | ||||
|     public Integer getLength() { | ||||
|         return length; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,88 @@ | ||||
| package com.cnbm.dispatch.enums.kuka.step2; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/21 19:35 | ||||
|  */ | ||||
| public enum Step2Mes2PlcVar { | ||||
|  | ||||
|     //心跳变量(这个可以要求电控同事加一个,不和业务关联,只用于通讯) | ||||
|     BoxId("BoxId",PlcVar.STRING,1,DaveArea.DB,2000,714,0,20), | ||||
|     ShelfIsFullFinish("ShelfIsFullFinish",PlcVar.BOOL,1,DaveArea.DB,2000,712,0), | ||||
|  | ||||
|     ; | ||||
|  | ||||
|     private String name; | ||||
|     private DaveArea area; | ||||
|     private Integer areaNumber; | ||||
|     private Integer byteOffset; | ||||
|     private Integer bitOffset; | ||||
|     private PlcVar type; | ||||
|     //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度,和read操作相关 | ||||
|     //如果是String 类型不用填length 只需要填string类型的起始位置就行了,我会自己去取数据长度(也就是说这里的length并不是string 的长度)。 | ||||
|     private Integer length; | ||||
|  | ||||
|     //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度 | ||||
|     private Integer strSize; | ||||
|  | ||||
|     Step2Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = 0; | ||||
|     } | ||||
|     Step2Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public Integer getStrSize() { | ||||
|         return strSize; | ||||
|     } | ||||
|  | ||||
|     public void setStrSize(Integer strSize) { | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public DaveArea getArea() { | ||||
|         return area; | ||||
|     } | ||||
|  | ||||
|     public Integer getAreaNumber() { | ||||
|         return areaNumber; | ||||
|     } | ||||
|  | ||||
|     public Integer getBitOffset() { | ||||
|         return bitOffset; | ||||
|     } | ||||
|  | ||||
|     public Integer getByteOffset() { | ||||
|         return byteOffset; | ||||
|     } | ||||
|  | ||||
|     public PlcVar getType() { | ||||
|         return type; | ||||
|     } | ||||
|  | ||||
|     public Integer getLength() { | ||||
|         return length; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,89 @@ | ||||
| package com.cnbm.dispatch.enums.kuka.step2; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/21 19:35 | ||||
|  */ | ||||
| public enum Step2Plc2MesVar { | ||||
|  | ||||
|     //心跳变量(这个可以要求电控同事加一个,不和业务关联,只用于通讯) | ||||
|  | ||||
|     ShelfIsFull("ShelfIsFull", PlcVar.BOOL,1, DaveArea.DB,2000,48,0), | ||||
|     SubIdList("SubIdList",PlcVar.STRING_Array,30,DaveArea.DB,2000,50,0,20), | ||||
|     LineNum("LineNum", PlcVar.BOOL,1, DaveArea.DB,2000,710,0), | ||||
|     ; | ||||
|  | ||||
|     private String name; | ||||
|     private DaveArea area; | ||||
|     private Integer areaNumber; | ||||
|     private Integer byteOffset; | ||||
|     private Integer bitOffset; | ||||
|     private PlcVar type; | ||||
|     //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度,和read操作相关 | ||||
|     //如果是String 类型不用填length 只需要填string类型的起始位置就行了,我会自己去取数据长度(也就是说这里的length并不是string 的长度)。 | ||||
|     private Integer length; | ||||
|  | ||||
|     //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度 | ||||
|     private Integer strSize; | ||||
|  | ||||
|     Step2Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = 0; | ||||
|     } | ||||
|     Step2Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public Integer getStrSize() { | ||||
|         return strSize; | ||||
|     } | ||||
|  | ||||
|     public void setStrSize(Integer strSize) { | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public DaveArea getArea() { | ||||
|         return area; | ||||
|     } | ||||
|  | ||||
|     public Integer getAreaNumber() { | ||||
|         return areaNumber; | ||||
|     } | ||||
|  | ||||
|     public Integer getBitOffset() { | ||||
|         return bitOffset; | ||||
|     } | ||||
|  | ||||
|     public Integer getByteOffset() { | ||||
|         return byteOffset; | ||||
|     } | ||||
|  | ||||
|     public PlcVar getType() { | ||||
|         return type; | ||||
|     } | ||||
|  | ||||
|     public Integer getLength() { | ||||
|         return length; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,87 @@ | ||||
| package com.cnbm.dispatch.enums.kuka.step3; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/21 19:35 | ||||
|  */ | ||||
| public enum Step3Mes2PlcVar { | ||||
|  | ||||
|     //心跳变量(这个可以要求电控同事加一个,不和业务关联,只用于通讯) | ||||
|     ShelfIsFullArrivedFinish("ShelfIsFullArrivedFinish", PlcVar.BOOL,1, DaveArea.DB,2000,762,0), | ||||
|  | ||||
|     ; | ||||
|  | ||||
|     private String name; | ||||
|     private DaveArea area; | ||||
|     private Integer areaNumber; | ||||
|     private Integer byteOffset; | ||||
|     private Integer bitOffset; | ||||
|     private PlcVar type; | ||||
|     //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度,和read操作相关 | ||||
|     //如果是String 类型不用填length 只需要填string类型的起始位置就行了,我会自己去取数据长度(也就是说这里的length并不是string 的长度)。 | ||||
|     private Integer length; | ||||
|  | ||||
|     //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度 | ||||
|     private Integer strSize; | ||||
|  | ||||
|     Step3Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = 0; | ||||
|     } | ||||
|     Step3Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public Integer getStrSize() { | ||||
|         return strSize; | ||||
|     } | ||||
|  | ||||
|     public void setStrSize(Integer strSize) { | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public DaveArea getArea() { | ||||
|         return area; | ||||
|     } | ||||
|  | ||||
|     public Integer getAreaNumber() { | ||||
|         return areaNumber; | ||||
|     } | ||||
|  | ||||
|     public Integer getBitOffset() { | ||||
|         return bitOffset; | ||||
|     } | ||||
|  | ||||
|     public Integer getByteOffset() { | ||||
|         return byteOffset; | ||||
|     } | ||||
|  | ||||
|     public PlcVar getType() { | ||||
|         return type; | ||||
|     } | ||||
|  | ||||
|     public Integer getLength() { | ||||
|         return length; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,90 @@ | ||||
| package com.cnbm.dispatch.enums.kuka.step3; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/21 19:35 | ||||
|  */ | ||||
| public enum Step3Plc2MesVar { | ||||
|  | ||||
|     //心跳变量(这个可以要求电控同事加一个,不和业务关联,只用于通讯) | ||||
|  | ||||
|     ShelfIsFullArrived("ShelfIsFullArrived", PlcVar.BOOL,1, DaveArea.DB,2000,736,0), | ||||
|     BoxId("BoxId",PlcVar.STRING,60,DaveArea.DB,2000,738,0,20), | ||||
|     LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,760,0), | ||||
|  | ||||
|     ; | ||||
|  | ||||
|     private String name; | ||||
|     private DaveArea area; | ||||
|     private Integer areaNumber; | ||||
|     private Integer byteOffset; | ||||
|     private Integer bitOffset; | ||||
|     private PlcVar type; | ||||
|     //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度,和read操作相关 | ||||
|     //如果是String 类型不用填length 只需要填string类型的起始位置就行了,我会自己去取数据长度(也就是说这里的length并不是string 的长度)。 | ||||
|     private Integer length; | ||||
|  | ||||
|     //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度 | ||||
|     private Integer strSize; | ||||
|  | ||||
|     Step3Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = 0; | ||||
|     } | ||||
|     Step3Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){ | ||||
|         this.name = name; | ||||
|         this.type = type; | ||||
|         this.length = length; | ||||
|         this.area = area; | ||||
|         this.areaNumber = areaNumber; | ||||
|         this.byteOffset = byteOffset; | ||||
|         this.bitOffset = bitOffset; | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public Integer getStrSize() { | ||||
|         return strSize; | ||||
|     } | ||||
|  | ||||
|     public void setStrSize(Integer strSize) { | ||||
|         this.strSize = strSize; | ||||
|     } | ||||
|  | ||||
|     public String getName() { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     public DaveArea getArea() { | ||||
|         return area; | ||||
|     } | ||||
|  | ||||
|     public Integer getAreaNumber() { | ||||
|         return areaNumber; | ||||
|     } | ||||
|  | ||||
|     public Integer getBitOffset() { | ||||
|         return bitOffset; | ||||
|     } | ||||
|  | ||||
|     public Integer getByteOffset() { | ||||
|         return byteOffset; | ||||
|     } | ||||
|  | ||||
|     public PlcVar getType() { | ||||
|         return type; | ||||
|     } | ||||
|  | ||||
|     public Integer getLength() { | ||||
|         return length; | ||||
|     } | ||||
| } | ||||
| @@ -52,7 +52,7 @@ public class ChangePackagingBoxHistoryController { | ||||
|         @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class), | ||||
|         @ApiImplicitParam(name = "type", value = "类型,1=加入包装箱;2=移除包装箱;3=换箱", paramType = "query", dataTypeClass=Integer.class) | ||||
|     }) | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:page')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:page')") | ||||
|     public Result<PageData<ChangePackagingBoxHistoryDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         PageData<ChangePackagingBoxHistoryDTO> page = changePackagingBoxHistoryService.page(params); | ||||
|  | ||||
| @@ -61,7 +61,7 @@ public class ChangePackagingBoxHistoryController { | ||||
|  | ||||
|     @GetMapping("{id}") | ||||
|     @ApiOperation("信息") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:info')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:info')") | ||||
|     public Result<ChangePackagingBoxHistoryDTO> get(@PathVariable("id") Long id){ | ||||
|         ChangePackagingBoxHistoryDTO data = changePackagingBoxHistoryService.get(id); | ||||
|  | ||||
| @@ -71,7 +71,7 @@ public class ChangePackagingBoxHistoryController { | ||||
|     @PostMapping | ||||
|     @ApiOperation("保存") | ||||
|     @LogOperation("保存") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:save')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:save')") | ||||
|     public Result<Long> save(@RequestBody ChangePackagingBoxHistoryDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
| @@ -84,7 +84,7 @@ public class ChangePackagingBoxHistoryController { | ||||
|     @PutMapping | ||||
|     @ApiOperation("修改") | ||||
|     @LogOperation("修改") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:update')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:update')") | ||||
|     public Result<Long> update(@RequestBody ChangePackagingBoxHistoryDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
| @@ -97,7 +97,7 @@ public class ChangePackagingBoxHistoryController { | ||||
|     @DeleteMapping | ||||
|     @ApiOperation("删除") | ||||
|     @LogOperation("删除") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:delete')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:delete')") | ||||
|     public Result delete(@RequestBody Long[] ids){ | ||||
|         //效验数据 | ||||
|         AssertUtils.isArrayEmpty(ids, "id"); | ||||
| @@ -110,7 +110,7 @@ public class ChangePackagingBoxHistoryController { | ||||
|     @GetMapping("export") | ||||
|     @ApiOperation("导出") | ||||
|     @LogOperation("导出") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:changePackagingBoxHistory:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<ChangePackagingBoxHistoryDTO> list = changePackagingBoxHistoryService.list(params); | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.*; | ||||
| import springfox.documentation.annotations.ApiIgnore; | ||||
|  | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| @@ -48,9 +47,11 @@ public class PrintModelController { | ||||
|         @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||
|         @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||
|         @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class), | ||||
|         @ApiImplicitParam(name = "name", value = "标签名称", paramType = "query", dataTypeClass = String.class) | ||||
|         @ApiImplicitParam(name = "name", value = "标签名称", paramType = "query", dataTypeClass = String.class), | ||||
|         @ApiImplicitParam(name = "type", value = "类型,0:模组标签,1:等级标签", paramType = "query", dataTypeClass = Integer.class), | ||||
|         @ApiImplicitParam(name = "lineBody", value = "线体,1=F ; 2=S", paramType = "query", dataTypeClass = Integer.class) | ||||
|     }) | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:printModel:page')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:printModel:page')") | ||||
|     public Result<PageData<PrintModelDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         PageData<PrintModelDTO> page = printModelService.page(params); | ||||
|  | ||||
| @@ -59,7 +60,7 @@ public class PrintModelController { | ||||
|  | ||||
|     @GetMapping("{id}") | ||||
|     @ApiOperation("信息") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:printModel:info')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:printModel:info')") | ||||
|     public Result<PrintModelDTO> get(@PathVariable("id") Long id){ | ||||
|         PrintModelDTO data = printModelService.get(id); | ||||
|  | ||||
| @@ -69,7 +70,7 @@ public class PrintModelController { | ||||
|     @PostMapping | ||||
|     @ApiOperation("保存") | ||||
|     @LogOperation("保存") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:printModel:save')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:printModel:save')") | ||||
|     public Result<Long> save(@RequestBody PrintModelDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
| @@ -82,7 +83,7 @@ public class PrintModelController { | ||||
|     @PutMapping | ||||
|     @ApiOperation("修改") | ||||
|     @LogOperation("修改") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:printModel:update')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:printModel:update')") | ||||
|     public Result<Long> update(@RequestBody PrintModelDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
| @@ -95,7 +96,7 @@ public class PrintModelController { | ||||
|     @DeleteMapping | ||||
|     @ApiOperation("删除") | ||||
|     @LogOperation("删除") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:printModel:delete')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:printModel:delete')") | ||||
|     public Result delete(@RequestBody Long[] ids){ | ||||
|         //效验数据 | ||||
|         AssertUtils.isArrayEmpty(ids, "id"); | ||||
| @@ -108,7 +109,7 @@ public class PrintModelController { | ||||
|     @GetMapping("export") | ||||
|     @ApiOperation("导出") | ||||
|     @LogOperation("导出") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:printModel:export')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:printModel:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<PrintModelDTO> list = printModelService.list(params); | ||||
|  | ||||
| @@ -116,16 +117,14 @@ public class PrintModelController { | ||||
|     } | ||||
|      | ||||
|     @PostMapping(value = "list") | ||||
|     @ApiOperation(value = "获取班组列表") | ||||
|     @LogOperation("获取班组列表") | ||||
|     @ApiOperation(value = "获取打印标签模板列表") | ||||
|     public List<PrintModelDTO> list() { return printModelService.list(); } | ||||
|  | ||||
|     @PostMapping(value = "get-packing") | ||||
|     @PostMapping(value = "getCode") | ||||
|     @ApiOperation(value = "获取标签编码") | ||||
|     @LogOperation("获取标签编码") | ||||
|     private Result<String> getCode() { | ||||
|         String packing = printModelService.getCode(); | ||||
|         return new Result<String>().ok(packing); | ||||
|     public Result<String> getCode() { | ||||
|         String code = printModelService.getCode(); | ||||
|         return new Result<String>().ok(code); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -1,24 +1,162 @@ | ||||
| package com.cnbm.packing.controller; | ||||
|  | ||||
| import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar; | ||||
| import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar; | ||||
| import com.cnbm.packing.service.DynamicDataSourceService; | ||||
| import com.cnbm.s7.entity.R; | ||||
| import com.cnbm.s7.s7connector.enmuc.S7Client; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import com.cnbm.common.utils.Result; | ||||
| import springfox.documentation.annotations.ApiIgnore; | ||||
|  | ||||
| import java.io.UnsupportedEncodingException; | ||||
| import java.text.ParseException; | ||||
| import java.util.Map; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * @Author weihongyang | ||||
|  * @Date 2022/6/24 8:57 AM | ||||
|  * @Version 1.0 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/packing") | ||||
| @RequestMapping("/test") | ||||
| @Api(tags="测试接口") | ||||
| public class TestController { | ||||
|  | ||||
|     @GetMapping("get") | ||||
|     public Result<Integer> get(){ | ||||
|         return new Result<Integer>().ok(1); | ||||
|     private static final Logger logger = LoggerFactory.getLogger(TestController.class); | ||||
|     @Autowired | ||||
|     DynamicDataSourceService service; | ||||
|     private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|  | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|     private Object read(S7Client s7Client,Step1Mes2PlcVar var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|  | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @PostMapping("get2") | ||||
|     public Result<Integer> get2(){ | ||||
|         return new Result<Integer>().ok(2); | ||||
|     private Object read(S7Client s7Client,Step2Plc2MesVar var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|  | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|     private Object read(S7Client s7Client,Step2Mes2PlcVar var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|  | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Object read(S7Client s7Client,Step3Plc2MesVar var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|  | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|     private Object read(S7Client s7Client,Step3Mes2PlcVar var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|  | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/testReadAll") | ||||
|     public R testReadAll() throws UnsupportedEncodingException, ParseException { | ||||
|         for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){ | ||||
|             logger.info(read(S7Client.S7_KUKA,actual).toString()); | ||||
|             System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); | ||||
|         } | ||||
|         for(Step1Mes2PlcVar actual:Step1Mes2PlcVar.values()){ | ||||
|             logger.info(read(S7Client.S7_KUKA,actual).toString()); | ||||
|             System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); | ||||
|         } | ||||
|  | ||||
|         for(Step2Plc2MesVar actual:Step2Plc2MesVar.values()){ | ||||
|             logger.info(read(S7Client.S7_KUKA,actual).toString()); | ||||
|             System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); | ||||
|         } | ||||
|         for(Step2Mes2PlcVar actual:Step2Mes2PlcVar.values()){ | ||||
|             logger.info(read(S7Client.S7_KUKA,actual).toString()); | ||||
|             System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); | ||||
|         } | ||||
|  | ||||
|         for(Step3Plc2MesVar actual:Step3Plc2MesVar.values()){ | ||||
|             logger.info(read(S7Client.S7_KUKA,actual).toString()); | ||||
|             System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); | ||||
|         } | ||||
|         for(Step3Mes2PlcVar actual:Step3Mes2PlcVar.values()){ | ||||
|             logger.info(read(S7Client.S7_KUKA,actual).toString()); | ||||
|             System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); | ||||
|         } | ||||
|         return R.ok(); | ||||
|     } | ||||
|     @PostMapping("/testlogger") | ||||
|     public R testlogger() { | ||||
|         logger.info("test logger"); | ||||
|         System.out.println("test logger"); | ||||
|         return R.ok(); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @PostMapping("getPMPPBySubId") | ||||
|     @ApiImplicitParams({ | ||||
|             @ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||
|     }) | ||||
|     public Result<Float> getPMPPBySubId(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         Object subId = params.get("subId"); | ||||
|         return new Result<Float>().ok(service.getPMPPBySubId(subId.toString())); | ||||
|     } | ||||
|     @PostMapping("getOrderNameBySubId") | ||||
|     @ApiImplicitParams({ | ||||
|             @ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||
|     }) | ||||
|     public Result<String> getOrderNameBySubId(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         Object subId = params.get("subId"); | ||||
|         //service.getExtendArgFromCamline() | ||||
|         return new Result<String>().ok(service.getOrderNameBySubId(subId.toString())); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("getExtendArgFromCamline") | ||||
|     @ApiImplicitParams({ | ||||
|             @ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||
|     }) | ||||
|     public Result<String> getExtendArgFromCamline(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         Object subId = params.get("subId"); | ||||
|         return new Result<String>().ok(service.getExtendArgFromCamline(subId.toString()).toString()); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -49,7 +49,7 @@ public class WoCompensationPowerController { | ||||
|         @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class), | ||||
|         @ApiImplicitParam(name = "lineBody", value = "线体", paramType = "query", dataTypeClass = Integer.class) | ||||
|     }) | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:page')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:page')") | ||||
|     public Result<PageData<WoCompensationPowerDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         PageData<WoCompensationPowerDTO> page = woCompensationPowerService.page(params); | ||||
|  | ||||
| @@ -58,7 +58,7 @@ public class WoCompensationPowerController { | ||||
|  | ||||
|     @GetMapping("{id}") | ||||
|     @ApiOperation("信息") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:info')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:info')") | ||||
|     public Result<WoCompensationPowerDTO> get(@PathVariable("id") Long id){ | ||||
|         WoCompensationPowerDTO data = woCompensationPowerService.get(id); | ||||
|  | ||||
| @@ -68,7 +68,7 @@ public class WoCompensationPowerController { | ||||
|     @PostMapping | ||||
|     @ApiOperation("保存") | ||||
|     @LogOperation("保存") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:save')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:save')") | ||||
|     public Result<Long> save(@RequestBody WoCompensationPowerDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
| @@ -81,7 +81,7 @@ public class WoCompensationPowerController { | ||||
|     @PutMapping | ||||
|     @ApiOperation("修改") | ||||
|     @LogOperation("修改") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:update')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:update')") | ||||
|     public Result<Long> update(@RequestBody WoCompensationPowerDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
| @@ -94,7 +94,7 @@ public class WoCompensationPowerController { | ||||
|     @DeleteMapping | ||||
|     @ApiOperation("删除") | ||||
|     @LogOperation("删除") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:delete')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:delete')") | ||||
|     public Result delete(@RequestBody Long[] ids){ | ||||
|         //效验数据 | ||||
|         AssertUtils.isArrayEmpty(ids, "id"); | ||||
| @@ -107,7 +107,7 @@ public class WoCompensationPowerController { | ||||
|     @GetMapping("export") | ||||
|     @ApiOperation("导出") | ||||
|     @LogOperation("导出") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:export')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woCompensationPower:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<WoCompensationPowerDTO> list = woCompensationPowerService.list(params); | ||||
|  | ||||
| @@ -116,7 +116,6 @@ public class WoCompensationPowerController { | ||||
|  | ||||
|     @PostMapping(value = "list") | ||||
|     @ApiOperation(value = "获取基板补偿功率") | ||||
|     @LogOperation("获取基板补偿功率") | ||||
|     public List<WoCompensationPowerDTO> list() { return woCompensationPowerService.list(); } | ||||
|  | ||||
| } | ||||
| @@ -10,7 +10,7 @@ import com.cnbm.common.validator.ValidatorUtils; | ||||
| import com.cnbm.common.validator.group.AddGroup; | ||||
| import com.cnbm.common.validator.group.DefaultGroup; | ||||
| import com.cnbm.common.validator.group.UpdateGroup; | ||||
| import com.cnbm.packing.dto.PrintModelDTO; | ||||
| import com.cnbm.packing.dto.IdVo; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxDTO; | ||||
| import com.cnbm.packing.excel.WoPackagingBoxExcel; | ||||
| import com.cnbm.packing.service.WoPackagingBoxServiceBiz; | ||||
| @@ -56,7 +56,7 @@ public class WoPackagingBoxController { | ||||
|         @ApiImplicitParam(name = "printStatus", value = "打印状态:0、未打印,1、已打印", paramType = "query", dataTypeClass = Integer.class), | ||||
|         @ApiImplicitParam(name = "model", value = "模式,1-手动模式;2-自动模式", paramType = "query", dataTypeClass = Integer.class) | ||||
|     }) | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:page')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:page')") | ||||
|     public Result<PageData<WoPackagingBoxDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         PageData<WoPackagingBoxDTO> page = woPackagingBoxService.page(params); | ||||
|  | ||||
| @@ -65,7 +65,7 @@ public class WoPackagingBoxController { | ||||
|  | ||||
|     @GetMapping("{id}") | ||||
|     @ApiOperation("信息") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:info')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:info')") | ||||
|     public Result<WoPackagingBoxDTO> get(@PathVariable("id") Long id){ | ||||
|         WoPackagingBoxDTO data = woPackagingBoxService.get(id); | ||||
|  | ||||
| @@ -75,20 +75,18 @@ public class WoPackagingBoxController { | ||||
|     @PostMapping | ||||
|     @ApiOperation("保存") | ||||
|     @LogOperation("保存") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:save')") | ||||
|     public Result<Long> save(@RequestBody WoPackagingBoxDTO dto){ | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:save')") | ||||
|     public IdVo save(@RequestBody WoPackagingBoxDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
|  | ||||
|         woPackagingBoxService.save(dto); | ||||
|  | ||||
|         return new Result<Long>().ok(dto.getId()); | ||||
|         return woPackagingBoxService.add(dto); | ||||
|     } | ||||
|  | ||||
|     @PutMapping | ||||
|     @ApiOperation("修改") | ||||
|     @LogOperation("修改") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:update')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:update')") | ||||
|     public Result<Long> update(@RequestBody WoPackagingBoxDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
| @@ -101,7 +99,7 @@ public class WoPackagingBoxController { | ||||
|     @DeleteMapping | ||||
|     @ApiOperation("删除") | ||||
|     @LogOperation("删除") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:delete')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:delete')") | ||||
|     public Result delete(@RequestBody Long[] ids){ | ||||
|         //效验数据 | ||||
|         AssertUtils.isArrayEmpty(ids, "id"); | ||||
| @@ -114,7 +112,7 @@ public class WoPackagingBoxController { | ||||
|     @GetMapping("export") | ||||
|     @ApiOperation("导出") | ||||
|     @LogOperation("导出") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:export')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBox:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<WoPackagingBoxDTO> list = woPackagingBoxService.list(params); | ||||
|  | ||||
| @@ -123,7 +121,15 @@ public class WoPackagingBoxController { | ||||
|  | ||||
|     @PostMapping(value = "list") | ||||
|     @ApiOperation(value = "获取列表") | ||||
|     @LogOperation("获取列表") | ||||
|     public List<WoPackagingBoxDTO> list() { return woPackagingBoxService.list(); } | ||||
|  | ||||
|     @PostMapping(value = "printList/{id}") | ||||
|     @ApiOperation(value = "包装箱打印列表") | ||||
|     public Result<WoPackagingBoxDTO> printList(@PathVariable("id") Long id) { | ||||
|  | ||||
|         WoPackagingBoxDTO data = woPackagingBoxService.printList(id); | ||||
|  | ||||
|         return new Result<WoPackagingBoxDTO>().ok(data); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -12,6 +12,7 @@ import com.cnbm.common.validator.ValidatorUtils; | ||||
| import com.cnbm.common.validator.group.AddGroup; | ||||
| import com.cnbm.common.validator.group.DefaultGroup; | ||||
| import com.cnbm.common.validator.group.UpdateGroup; | ||||
| import com.cnbm.packing.dto.ChangePackingBoxDTO; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; | ||||
| import com.cnbm.packing.entity.WoPackagingBox; | ||||
| import com.cnbm.packing.entity.WoPackagingBoxSubstrate; | ||||
| @@ -63,7 +64,7 @@ public class WoPackagingBoxSubstrateController { | ||||
|         @ApiImplicitParam(name = "packagingBoxId", value = "包装箱ID,BoxId", paramType = "query", dataTypeClass = String.class), | ||||
|         @ApiImplicitParam(name = "woSubstrateId", value = "基板ID(关联T_SUBSTRATE表)", paramType = "query", dataTypeClass = String.class) | ||||
|     }) | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:page')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:page')") | ||||
|     public Result<PageData<WoPackagingBoxSubstrateDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         PageData<WoPackagingBoxSubstrateDTO> page = woPackagingBoxSubstrateService.page(params); | ||||
|  | ||||
| @@ -72,7 +73,7 @@ public class WoPackagingBoxSubstrateController { | ||||
|  | ||||
|     @GetMapping("{id}") | ||||
|     @ApiOperation("信息") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:info')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:info')") | ||||
|     public Result<WoPackagingBoxSubstrateDTO> get(@PathVariable("id") Long id){ | ||||
|         WoPackagingBoxSubstrateDTO data = woPackagingBoxSubstrateService.get(id); | ||||
|  | ||||
| @@ -82,7 +83,7 @@ public class WoPackagingBoxSubstrateController { | ||||
|     @PostMapping | ||||
|     @ApiOperation("保存") | ||||
|     @LogOperation("保存") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:save')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:save')") | ||||
|     public Result<Long> save(@RequestBody WoPackagingBoxSubstrateDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
| @@ -95,7 +96,7 @@ public class WoPackagingBoxSubstrateController { | ||||
|     @PutMapping | ||||
|     @ApiOperation("修改") | ||||
|     @LogOperation("修改") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:update')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:update')") | ||||
|     public Result<Long> update(@RequestBody WoPackagingBoxSubstrateDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
| @@ -108,7 +109,7 @@ public class WoPackagingBoxSubstrateController { | ||||
|     @DeleteMapping | ||||
|     @ApiOperation("删除") | ||||
|     @LogOperation("删除") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:delete')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:delete')") | ||||
|     public Result delete(@RequestBody Long[] ids){ | ||||
|         //效验数据 | ||||
|         AssertUtils.isArrayEmpty(ids, "id"); | ||||
| @@ -121,17 +122,17 @@ public class WoPackagingBoxSubstrateController { | ||||
|     @GetMapping("export") | ||||
|     @ApiOperation("导出") | ||||
|     @LogOperation("导出") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:export')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingBoxSubstrate:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<WoPackagingBoxSubstrateDTO> list = woPackagingBoxSubstrateService.list(params); | ||||
|  | ||||
|         ExcelUtils.exportExcelToTarget(response, null, list, WoPackagingBoxSubstrateExcel.class); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("removeSubstrate") | ||||
|     @PostMapping("removeSubstrate/{id}") | ||||
|     @ApiOperation("移箱") | ||||
|     @LogOperation("移箱") | ||||
|     public Result removeSubstrate(@RequestBody Long id){ | ||||
|     public Result removeSubstrate(@PathVariable("id") Long id){ | ||||
|  | ||||
|         woPackagingBoxSubstrateService.removeSubstrate(id); | ||||
|  | ||||
| @@ -141,12 +142,12 @@ public class WoPackagingBoxSubstrateController { | ||||
|     @PostMapping("insertSubstrate") | ||||
|     @ApiOperation("合箱") | ||||
|     @LogOperation("合箱") | ||||
|     public Result insertSubstrate(@RequestBody WoPackagingBoxSubstrateDTO dto){ | ||||
|     public Result insertSubstrate(@RequestBody ChangePackingBoxDTO dto){ | ||||
|  | ||||
|         String woSubstrateId = dto.getWoSubstrateId(); | ||||
|         //验证模组是否存在 | ||||
|         QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper1 = new QueryWrapper<>(); | ||||
|         substrateQueryWrapper1.eq(StringUtils.isNotBlank(woSubstrateId), "woSubstrateId", woSubstrateId); | ||||
|         substrateQueryWrapper1.eq(StringUtils.isNotBlank(woSubstrateId), WoPackagingBoxSubstrate.WO_SUBSTRATE_ID, woSubstrateId); | ||||
|         if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper1 )== 0){ | ||||
|             return new Result().error(1,"该模组不存在,请重新输入"); | ||||
|         } | ||||
| @@ -158,8 +159,8 @@ public class WoPackagingBoxSubstrateController { | ||||
|  | ||||
|         //验证slot是否被占用 | ||||
|         QueryWrapper<WoPackagingBoxSubstrate> substrateQueryWrapper2 = new QueryWrapper<>(); | ||||
|         substrateQueryWrapper2.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), "packagingBoxId", dto.getPackagingBoxId()); | ||||
|         substrateQueryWrapper2.eq(ObjectUtils.isNotNull(dto.getSlot()), "slot", dto.getSlot()); | ||||
|         substrateQueryWrapper2.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, dto.getPackagingBoxId()); | ||||
|         substrateQueryWrapper2.eq(ObjectUtils.isNotNull(dto.getSlot()), WoPackagingBoxSubstrate.SLOT, dto.getSlot()); | ||||
|         if(woPackagingBoxSubstrateMapper.selectCount(substrateQueryWrapper2) != 0){ | ||||
|             return new Result().error(1,"该slot已被占用"); | ||||
|         } | ||||
| @@ -167,10 +168,10 @@ public class WoPackagingBoxSubstrateController { | ||||
|         //验证该模组的线体、功率等级是否BoxID的线体、功率等级一致,一致,保存成功,数据发生更新。不一致,则显示保存失败,数据不发生更新 | ||||
|         String packagingBoxId = dto.getPackagingBoxId(); | ||||
|         QueryWrapper<WoPackagingBox> boxQueryWrapper = new QueryWrapper<>(); | ||||
|         boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), "boxNo", packagingBoxId); | ||||
|         boxQueryWrapper.eq(StringUtils.isNotBlank(packagingBoxId), WoPackagingBox.BOX_NO, packagingBoxId); | ||||
|         WoPackagingBox box = woPackagingBoxMapper.selectList(boxQueryWrapper).get(0); | ||||
|  | ||||
|         if((substrate.getLineBody()==box.getLineBody()) && (substrate.getPowerLevel()==box.getPowerLevel()) ) | ||||
|         if((substrate.getLineBody()==box.getLineBody()) && (substrate.getPowerLevel().equals(box.getPowerLevel())) ) | ||||
|         { | ||||
|             dto.setId(substrate.getId()); | ||||
|             woPackagingBoxSubstrateService.insertSubstrate(dto); | ||||
| @@ -184,7 +185,7 @@ public class WoPackagingBoxSubstrateController { | ||||
|     @PostMapping("replaceSubstrate") | ||||
|     @ApiOperation("换箱") | ||||
|     @LogOperation("换箱") | ||||
|     public Result replaceSubstrate(@RequestBody WoPackagingBoxSubstrateDTO[] dtos){ | ||||
|     public Result replaceSubstrate(@RequestBody ChangePackingBoxDTO[] dtos){ | ||||
|  | ||||
|         woPackagingBoxSubstrateService.replaceSubstrate(dtos); | ||||
|  | ||||
| @@ -193,12 +194,11 @@ public class WoPackagingBoxSubstrateController { | ||||
|  | ||||
|     @PostMapping("slotValidation") | ||||
|     @ApiOperation("slot是否占用验证") | ||||
|     @LogOperation("slot是否占用验证") | ||||
|     public boolean slotValidation(@RequestBody WoPackagingBoxSubstrateDTO dto){ | ||||
|     public boolean slotValidation(@RequestBody ChangePackingBoxDTO dto){ | ||||
|  | ||||
|         QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), "packagingBoxId", dto.getPackagingBoxId()); | ||||
|         wrapper.eq(ObjectUtils.isNotNull(dto.getSlot()), "slot", dto.getSlot()); | ||||
|         wrapper.eq(StringUtils.isNotBlank(dto.getPackagingBoxId()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, dto.getPackagingBoxId()); | ||||
|         wrapper.eq(ObjectUtils.isNotNull(dto.getSlot()), WoPackagingBoxSubstrate.SLOT, dto.getSlot()); | ||||
|         if(woPackagingBoxSubstrateMapper.selectCount(wrapper) == 0){ | ||||
|             return true; | ||||
|         } | ||||
| @@ -207,12 +207,12 @@ public class WoPackagingBoxSubstrateController { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @PostMapping("batchInsert") | ||||
|     @PostMapping("insertSubstrateManual") | ||||
|     @ApiOperation("手动装箱") | ||||
|     @LogOperation("手动装箱") | ||||
|     public Result batchInsert(@RequestBody WoPackagingBoxSubstrateDTO[] lists){ | ||||
|     public Result insertSubstrateManual(@RequestBody ChangePackingBoxDTO dto){ | ||||
|  | ||||
|         woPackagingBoxSubstrateService.batchInsert(lists); | ||||
|         woPackagingBoxSubstrateService.insertSubstrateManual(dto); | ||||
|  | ||||
|         return new Result(); | ||||
|     } | ||||
|   | ||||
| @@ -1,7 +1,6 @@ | ||||
| package com.cnbm.packing.controller; | ||||
|  | ||||
| import com.cnbm.admin.annotation.LogOperation; | ||||
| import com.cnbm.admin.enums.WhetherEnum; | ||||
| import com.cnbm.common.constant.Constant; | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.utils.ExcelUtils; | ||||
| @@ -12,17 +11,13 @@ import com.cnbm.common.validator.group.AddGroup; | ||||
| import com.cnbm.common.validator.group.DefaultGroup; | ||||
| import com.cnbm.common.validator.group.UpdateGroup; | ||||
|  | ||||
| import com.cnbm.packing.dto.WoPackagingBoxDTO; | ||||
| import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO; | ||||
| import com.cnbm.packing.entity.WoPackagingBox; | ||||
| import com.cnbm.packing.excel.WoPackagingPrintHistoryExcel; | ||||
| import com.cnbm.packing.service.WoPackagingBoxServiceBiz; | ||||
| import com.cnbm.packing.service.WoPackagingPrintHistoryServiceBiz; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| @@ -46,8 +41,6 @@ import java.util.Map; | ||||
| public class WoPackagingPrintHistoryController { | ||||
|     @Autowired | ||||
|     private WoPackagingPrintHistoryServiceBiz woPackagingPrintHistoryService; | ||||
|     @Autowired | ||||
|     private WoPackagingBoxServiceBiz woPackagingBoxServiceBiz; | ||||
|  | ||||
|  | ||||
|     @GetMapping("page") | ||||
| @@ -61,7 +54,7 @@ public class WoPackagingPrintHistoryController { | ||||
|         @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class), | ||||
|         @ApiImplicitParam(name = "boxNo", value = "包装箱编号", paramType = "query", dataTypeClass = String.class) | ||||
|     }) | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:page')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:page')") | ||||
|     public Result<PageData<WoPackagingPrintHistoryDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         PageData<WoPackagingPrintHistoryDTO> page = woPackagingPrintHistoryService.page(params); | ||||
|  | ||||
| @@ -70,7 +63,7 @@ public class WoPackagingPrintHistoryController { | ||||
|  | ||||
|     @GetMapping("{id}") | ||||
|     @ApiOperation("信息") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:info')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:info')") | ||||
|     public Result<WoPackagingPrintHistoryDTO> get(@PathVariable("id") Long id){ | ||||
|         WoPackagingPrintHistoryDTO data = woPackagingPrintHistoryService.get(id); | ||||
|  | ||||
| @@ -80,7 +73,7 @@ public class WoPackagingPrintHistoryController { | ||||
|     @PostMapping | ||||
|     @ApiOperation("保存") | ||||
|     @LogOperation("保存") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:save')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:save')") | ||||
|     public Result<Long> save(@RequestBody WoPackagingPrintHistoryDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
| @@ -93,7 +86,7 @@ public class WoPackagingPrintHistoryController { | ||||
|     @PutMapping | ||||
|     @ApiOperation("修改") | ||||
|     @LogOperation("修改") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:update')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:update')") | ||||
|     public Result<Long> update(@RequestBody WoPackagingPrintHistoryDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
| @@ -106,7 +99,7 @@ public class WoPackagingPrintHistoryController { | ||||
|     @DeleteMapping | ||||
|     @ApiOperation("删除") | ||||
|     @LogOperation("删除") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:delete')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:delete')") | ||||
|     public Result delete(@RequestBody Long[] ids){ | ||||
|         //效验数据 | ||||
|         AssertUtils.isArrayEmpty(ids, "id"); | ||||
| @@ -119,38 +112,21 @@ public class WoPackagingPrintHistoryController { | ||||
|     @GetMapping("export") | ||||
|     @ApiOperation("导出") | ||||
|     @LogOperation("导出") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:export')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPackagingPrintHistory:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<WoPackagingPrintHistoryDTO> list = woPackagingPrintHistoryService.list(params); | ||||
|  | ||||
|         ExcelUtils.exportExcelToTarget(response, null, list, WoPackagingPrintHistoryExcel.class); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("print") | ||||
|     @ApiOperation("打印") | ||||
|     @LogOperation("打印") | ||||
|     public Result<Long> print(@RequestBody Long id) { | ||||
|     @PostMapping("print/{id}") | ||||
|     @ApiOperation("打印记录新增") | ||||
|     @LogOperation("打印记录新增") | ||||
|     public Result<Long> print(@PathVariable("id") Long id) { | ||||
|  | ||||
|         WoPackagingBoxDTO woPackagingBox = woPackagingBoxServiceBiz.get(id); | ||||
|         woPackagingPrintHistoryService.print(id); | ||||
|  | ||||
|         WoPackagingPrintHistoryDTO woPackagingPrintHistory = new WoPackagingPrintHistoryDTO(); | ||||
|         BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory); | ||||
|         woPackagingPrintHistory.setId(null); | ||||
|         woPackagingPrintHistory.setPrintTime(LocalDateTime.now()); | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(woPackagingPrintHistory, AddGroup.class, DefaultGroup.class); | ||||
|         woPackagingPrintHistoryService.save(woPackagingPrintHistory); | ||||
|         //更新包装箱表中打印状态和时间 | ||||
|         woPackagingBox.setPrintTime(woPackagingPrintHistory.getPrintTime()); | ||||
|         if(woPackagingBox.getPrintStatus()==0){ | ||||
|             woPackagingBox.setPrintCount(1); | ||||
|             woPackagingBox.setPrintStatus(WhetherEnum.YES.getValue()); | ||||
|         } | ||||
|         else{ | ||||
|         woPackagingBox.setPrintCount(woPackagingBox.getPrintCount()+1); | ||||
|         } | ||||
|  | ||||
|         return new Result<Long>().ok(woPackagingPrintHistory.getId()); | ||||
|         return new Result(); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -49,7 +49,7 @@ public class WoPowerLevelController { | ||||
|         @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class), | ||||
|         @ApiImplicitParam(name = "lineBody", value = "线体", paramType = "query", dataTypeClass = Integer.class) | ||||
|     }) | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:page')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:page')") | ||||
|     public Result<PageData<WoPowerLevelDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||
|         PageData<WoPowerLevelDTO> page = woPowerLevelService.page(params); | ||||
|  | ||||
| @@ -58,7 +58,7 @@ public class WoPowerLevelController { | ||||
|  | ||||
|     @GetMapping("{id}") | ||||
|     @ApiOperation("信息") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:info')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:info')") | ||||
|     public Result<WoPowerLevelDTO> get(@PathVariable("id") Long id){ | ||||
|         WoPowerLevelDTO data = woPowerLevelService.get(id); | ||||
|  | ||||
| @@ -68,7 +68,7 @@ public class WoPowerLevelController { | ||||
|     @PostMapping | ||||
|     @ApiOperation("保存") | ||||
|     @LogOperation("保存") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:save')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:save')") | ||||
|     public Result<Long> save(@RequestBody WoPowerLevelDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); | ||||
| @@ -81,7 +81,7 @@ public class WoPowerLevelController { | ||||
|     @PutMapping | ||||
|     @ApiOperation("修改") | ||||
|     @LogOperation("修改") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:update')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:update')") | ||||
|     public Result<Long> update(@RequestBody WoPowerLevelDTO dto){ | ||||
|         //效验数据 | ||||
|         ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); | ||||
| @@ -94,7 +94,7 @@ public class WoPowerLevelController { | ||||
|     @DeleteMapping | ||||
|     @ApiOperation("删除") | ||||
|     @LogOperation("删除") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:delete')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:delete')") | ||||
|     public Result delete(@RequestBody Long[] ids){ | ||||
|         //效验数据 | ||||
|         AssertUtils.isArrayEmpty(ids, "id"); | ||||
| @@ -107,7 +107,7 @@ public class WoPowerLevelController { | ||||
|     @GetMapping("export") | ||||
|     @ApiOperation("导出") | ||||
|     @LogOperation("导出") | ||||
| //    @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:export')") | ||||
|     @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:export')") | ||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||
|         List<WoPowerLevelDTO> list = woPowerLevelService.list(params); | ||||
|  | ||||
| @@ -116,7 +116,6 @@ public class WoPowerLevelController { | ||||
|  | ||||
|     @PostMapping(value = "list") | ||||
|     @ApiOperation(value = "获取功率等级") | ||||
|     @LogOperation("获取功率等级") | ||||
|     public List<WoPowerLevelDTO> list() { return woPowerLevelService.list(); } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,87 @@ | ||||
| package com.cnbm.packing.dto; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serializable; | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.Arrays; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * 打印标签模板表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since  2023-02-20 | ||||
|  */ | ||||
| @Data | ||||
| @ApiModel(value = "camline 查询对象") | ||||
| public class CamlineExtendArgDTO implements Serializable { | ||||
|  | ||||
| 	private static final long serialVersionUID = 1L; | ||||
|  | ||||
| 	private LocalDateTime lastUpdateTime; | ||||
| 	private float pmpp; | ||||
| 	private String orderName; | ||||
| 	private Long binclassFl1; | ||||
|  | ||||
| 	private Long binclassFl2; | ||||
|  | ||||
| 	private Float etaFl1; | ||||
|  | ||||
| 	private Float etaFl2; | ||||
|  | ||||
| 	private Float ffFl1; | ||||
|  | ||||
| 	private Float ffFl2; | ||||
|  | ||||
| 	private Float imppFl1; | ||||
|  | ||||
| 	private Float imppFl2; | ||||
|  | ||||
| 	private Float insolflashcontrolFl1; | ||||
|  | ||||
| 	private Float insolflashcontrolFl2; | ||||
|  | ||||
| 	private Float insolmppFl1; | ||||
|  | ||||
| 	private Float insolmppFl2; | ||||
|  | ||||
| 	private Float insolvocFl1; | ||||
|  | ||||
| 	private Float insolvocFl2; | ||||
|  | ||||
| 	private Float insolFl1; | ||||
|  | ||||
| 	private Float insolFl2; | ||||
|  | ||||
| 	private Float iscFl1; | ||||
|  | ||||
| 	private Float iscFl2; | ||||
|  | ||||
| 	private LocalDateTime measTimeFl1; | ||||
|  | ||||
| 	private LocalDateTime measTimeFl2; | ||||
|  | ||||
| 	private Float pmppFl1; | ||||
|  | ||||
| 	private Float pmppFl2; | ||||
|  | ||||
| 	private Float tcellFl1; | ||||
|  | ||||
| 	private Float tcellFl2; | ||||
|  | ||||
| 	private Float tmonicellFl1; | ||||
|  | ||||
| 	private Float tmonicellFl2; | ||||
|  | ||||
| 	private Float umppFl1; | ||||
|  | ||||
| 	private Float umppFl2; | ||||
|  | ||||
| 	private Float uocFl1; | ||||
|  | ||||
| 	private Float uocFl2; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,25 @@ | ||||
| package com.cnbm.packing.dto; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serializable; | ||||
| import java.util.List; | ||||
|  | ||||
| @Data | ||||
| @ApiModel(value = "包装箱与基板关联变化对象") | ||||
| public class ChangePackingBoxDTO implements Serializable { | ||||
|  | ||||
|     @ApiModelProperty(value = "WoPackagingBoxSubstrate.id") | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty(value = "包装箱ID,BoxId") | ||||
|     private String packagingBoxId; | ||||
|  | ||||
|     @ApiModelProperty(value = "基板ID") | ||||
|     private String woSubstrateId; | ||||
|  | ||||
|     @ApiModelProperty(value = "箱中位置") | ||||
|     private Integer slot; | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| package com.cnbm.packing.dto; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serializable; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/22 16:48 | ||||
|  */ | ||||
| @Data | ||||
| @ApiModel(value = "补偿功率 计算系数") | ||||
| public class CompensationPowerXSDTO implements Serializable { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     private float a; | ||||
|     private float b; | ||||
| } | ||||
							
								
								
									
										32
									
								
								ym-packing/src/main/java/com/cnbm/packing/dto/IdVo.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								ym-packing/src/main/java/com/cnbm/packing/dto/IdVo.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| /* | ||||
|  * Copyright (c) 2018. | ||||
|  * http://www.ulabcare.com | ||||
|  */ | ||||
|  | ||||
| package com.cnbm.packing.dto; | ||||
|  | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Builder; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import lombok.experimental.Accessors; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * 主键对象 | ||||
|  * | ||||
|  * @author jiff | ||||
|  * @date 2018/11/7 | ||||
|  * @since 1.0 | ||||
|  */ | ||||
| @EqualsAndHashCode(callSuper = false) | ||||
| @Accessors(chain = true) | ||||
| @Data | ||||
| @Builder | ||||
| @ApiModel("主键视图对象") | ||||
| public class IdVo { | ||||
|     @ApiModelProperty(value = "主键", required = true, example = "1", notes = "根据实际接口返回不同对象的主键") | ||||
|     private Long id; | ||||
| } | ||||
| @@ -1,5 +1,6 @@ | ||||
| package com.cnbm.packing.dto; | ||||
|  | ||||
| import com.cnbm.packing.entity.WoPackagingBoxSubstrate; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
| @@ -8,6 +9,7 @@ import java.io.Serializable; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| import java.math.BigDecimal; | ||||
| import java.util.List; | ||||
|  | ||||
|  | ||||
| /** | ||||
| @@ -110,4 +112,10 @@ public class WoPackagingBoxDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "是否到达包装台,1=到达;2=未达到") | ||||
| 	private Integer isArrived; | ||||
|  | ||||
| 	@ApiModelProperty(value = "订单号") | ||||
| 	private String orderNum; | ||||
|  | ||||
| 	@ApiModelProperty(value = "基板列表") | ||||
| 	private List<WoPackagingBoxSubstrate> substrateList;; | ||||
|  | ||||
| } | ||||
| @@ -71,4 +71,103 @@ public class WoPackagingBoxSubstrateDTO implements Serializable { | ||||
| 	@ApiModelProperty(value = "功率等级") | ||||
| 	private String powerLevel; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private LocalDateTime lastUpdateTime; | ||||
|  | ||||
| 	@ApiModelProperty(value = "补偿pmpp") | ||||
| 	private Float pmpp; | ||||
|  | ||||
| 	@ApiModelProperty(value = "订单名") | ||||
| 	private String orderName; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Long binclassFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Long binclassFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float etaFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float etaFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float ffFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float ffFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float imppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float imppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolflashcontrolFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolflashcontrolFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolmppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolmppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolvocFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolvocFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float insolFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float iscFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float iscFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private LocalDateTime measTimeFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private LocalDateTime measTimeFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float pmppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float pmppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tcellFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tcellFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tmonicellFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float tmonicellFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float umppFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float umppFl2; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float uocFl1; | ||||
|  | ||||
| 	@ApiModelProperty(value = "") | ||||
| 	private Float uocFl2; | ||||
|  | ||||
| } | ||||
| @@ -27,7 +27,7 @@ public class WoPowerLevelDTO implements Serializable { | ||||
| 	private Long id; | ||||
|  | ||||
| 	@ApiModelProperty(value = "功率等级名称,(现场人员手动录入)") | ||||
| 	private Integer powerClass; | ||||
| 	private String powerClass; | ||||
|  | ||||
| 	@ApiModelProperty(value = "pmpp_low,(现场人员手动录入)") | ||||
| 	private Float pmppLow; | ||||
|   | ||||
| @@ -111,6 +111,9 @@ public class WoPackagingBox implements Serializable { | ||||
|     @ApiModelProperty("是否到达包装台,1=到达;2=未达到") | ||||
|     private Integer isArrived; | ||||
|  | ||||
|     @ApiModelProperty("订单号") | ||||
|     private String orderNum; | ||||
|  | ||||
|  | ||||
|     public static final String ID = "ID"; | ||||
|  | ||||
| @@ -170,4 +173,6 @@ public class WoPackagingBox implements Serializable { | ||||
|  | ||||
|     public static final String IS_ARRIVED = "is_arrived"; | ||||
|  | ||||
|     public static final String ORDER_NUM = "ORDER_NUM"; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -72,6 +72,74 @@ public class WoPackagingBoxSubstrate implements Serializable { | ||||
|     @ApiModelProperty("功率等级") | ||||
|     private String powerLevel; | ||||
|  | ||||
|     private LocalDateTime lastUpdateTime; | ||||
|  | ||||
|     @ApiModelProperty("补偿pmpp") | ||||
|     private Float pmpp; | ||||
|  | ||||
|     @ApiModelProperty("订单名") | ||||
|     private String orderName; | ||||
|  | ||||
|     private Long binclassFl1; | ||||
|  | ||||
|     private Long binclassFl2; | ||||
|  | ||||
|     private Float etaFl1; | ||||
|  | ||||
|     private Float etaFl2; | ||||
|  | ||||
|     private Float ffFl1; | ||||
|  | ||||
|     private Float ffFl2; | ||||
|  | ||||
|     private Float imppFl1; | ||||
|  | ||||
|     private Float imppFl2; | ||||
|  | ||||
|     private Float insolflashcontrolFl1; | ||||
|  | ||||
|     private Float insolflashcontrolFl2; | ||||
|  | ||||
|     private Float insolmppFl1; | ||||
|  | ||||
|     private Float insolmppFl2; | ||||
|  | ||||
|     private Float insolvocFl1; | ||||
|  | ||||
|     private Float insolvocFl2; | ||||
|  | ||||
|     private Float insolFl1; | ||||
|  | ||||
|     private Float insolFl2; | ||||
|  | ||||
|     private Float iscFl1; | ||||
|  | ||||
|     private Float iscFl2; | ||||
|  | ||||
|     private LocalDateTime measTimeFl1; | ||||
|  | ||||
|     private LocalDateTime measTimeFl2; | ||||
|  | ||||
|     private Float pmppFl1; | ||||
|  | ||||
|     private Float pmppFl2; | ||||
|  | ||||
|     private Float tcellFl1; | ||||
|  | ||||
|     private Float tcellFl2; | ||||
|  | ||||
|     private Float tmonicellFl1; | ||||
|  | ||||
|     private Float tmonicellFl2; | ||||
|  | ||||
|     private Float umppFl1; | ||||
|  | ||||
|     private Float umppFl2; | ||||
|  | ||||
|     private Float uocFl1; | ||||
|  | ||||
|     private Float uocFl2; | ||||
|  | ||||
|  | ||||
|     public static final String ID = "ID"; | ||||
|  | ||||
| @@ -105,4 +173,71 @@ public class WoPackagingBoxSubstrate implements Serializable { | ||||
|  | ||||
|     public static final String POWER_LEVEL = "POWER_LEVEL"; | ||||
|  | ||||
|     public static final String LAST_UPDATE_TIME = "LAST_UPDATE_TIME"; | ||||
|  | ||||
|     public static final String PMPP = "PMPP"; | ||||
|  | ||||
|     public static final String ORDER_NAME = "ORDER_NAME"; | ||||
|  | ||||
|     public static final String BINCLASS_FL1 = "BINCLASS_FL1"; | ||||
|  | ||||
|     public static final String BINCLASS_FL2 = "BINCLASS_FL2"; | ||||
|  | ||||
|     public static final String ETA_FL1 = "ETA_FL1"; | ||||
|  | ||||
|     public static final String ETA_FL2 = "ETA_FL2"; | ||||
|  | ||||
|     public static final String FF_FL1 = "FF_FL1"; | ||||
|  | ||||
|     public static final String FF_FL2 = "FF_FL2"; | ||||
|  | ||||
|     public static final String IMPP_FL1 = "IMPP_FL1"; | ||||
|  | ||||
|     public static final String IMPP_FL2 = "IMPP_FL2"; | ||||
|  | ||||
|     public static final String INSOLFLASHCONTROL_FL1 = "InsolFlashControl_FL1"; | ||||
|  | ||||
|     public static final String INSOLFLASHCONTROL_FL2 = "InsolFlashControl_FL2"; | ||||
|  | ||||
|     public static final String INSOLMPP_FL1 = "InsolMPP_FL1"; | ||||
|  | ||||
|     public static final String INSOLMPP_FL2 = "InsolMPP_FL2"; | ||||
|  | ||||
|     public static final String INSOLVOC_FL1 = "InsolVoc_FL1"; | ||||
|  | ||||
|     public static final String INSOLVOC_FL2 = "InsolVoc_FL2"; | ||||
|  | ||||
|     public static final String INSOL_FL1 = "Insol_FL1"; | ||||
|  | ||||
|     public static final String INSOL_FL2 = "Insol_FL2"; | ||||
|  | ||||
|     public static final String ISC_FL1 = "ISC_FL1"; | ||||
|  | ||||
|     public static final String ISC_FL2 = "ISC_FL2"; | ||||
|  | ||||
|     public static final String MEAS_TIME_FL1 = "MEAS_TIME_FL1"; | ||||
|  | ||||
|     public static final String MEAS_TIME_FL2 = "MEAS_TIME_FL2"; | ||||
|  | ||||
|     public static final String PMPP_FL1 = "PMPP_FL1"; | ||||
|  | ||||
|     public static final String PMPP_FL2 = "PMPP_FL2"; | ||||
|  | ||||
|     public static final String TCELL_FL1 = "Tcell_FL1"; | ||||
|  | ||||
|     public static final String TCELL_FL2 = "Tcell_FL2"; | ||||
|  | ||||
|     public static final String TMONICELL_FL1 = "Tmonicell_FL1"; | ||||
|  | ||||
|     public static final String TMONICELL_FL2 = "Tmonicell_FL2"; | ||||
|  | ||||
|     public static final String UMPP_FL1 = "UMPP_FL1"; | ||||
|  | ||||
|     public static final String UMPP_FL2 = "UMPP_FL2"; | ||||
|  | ||||
|     public static final String UOC_FL1 = "UOC_FL1"; | ||||
|  | ||||
|     public static final String UOC_FL2 = "UOC_FL2"; | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -28,7 +28,7 @@ public class WoPowerLevel implements Serializable { | ||||
|     private Long id; | ||||
|  | ||||
|     @ApiModelProperty("功率等级名称,(现场人员手动录入)") | ||||
|     private Integer powerClass; | ||||
|     private String powerClass; | ||||
|  | ||||
|     @ApiModelProperty("pmpp_low,(现场人员手动录入)") | ||||
|     private Float pmppLow; | ||||
|   | ||||
| @@ -74,5 +74,7 @@ public class WoPackagingBoxExcel { | ||||
|     private Integer model; | ||||
|     @Excel(name = "是否到达包装台,1=到达;2=未达到") | ||||
|     private Integer isArrived; | ||||
|     @Excel(name = "订单号") | ||||
|     private String orderNum; | ||||
|  | ||||
| } | ||||
| @@ -48,5 +48,72 @@ public class WoPackagingBoxSubstrateExcel { | ||||
|     private Integer lineBody; | ||||
|     @Excel(name = "功率等级") | ||||
|     private String powerLevel; | ||||
|     @Excel(name = "") | ||||
|     private LocalDateTime lastUpdateTime; | ||||
|     @Excel(name = "补偿pmpp") | ||||
|     private Float pmpp; | ||||
|     @Excel(name = "订单名") | ||||
|     private String orderName; | ||||
|     @Excel(name = "") | ||||
|     private Long binclassFl1; | ||||
|     @Excel(name = "") | ||||
|     private Long binclassFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float etaFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float etaFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float ffFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float ffFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float imppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float imppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolflashcontrolFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolflashcontrolFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolmppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolmppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolvocFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolvocFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float insolFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float insolFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float iscFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float iscFl2; | ||||
|     @Excel(name = "") | ||||
|     private LocalDateTime measTimeFl1; | ||||
|     @Excel(name = "") | ||||
|     private LocalDateTime measTimeFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float pmppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float pmppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float tcellFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float tcellFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float tmonicellFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float tmonicellFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float umppFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float umppFl2; | ||||
|     @Excel(name = "") | ||||
|     private Float uocFl1; | ||||
|     @Excel(name = "") | ||||
|     private Float uocFl2; | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -19,7 +19,7 @@ public class WoPowerLevelExcel { | ||||
|     @Excel(name = "ID") | ||||
|     private Long id; | ||||
|     @Excel(name = "功率等级名称,(现场人员手动录入)") | ||||
|     private Integer powerClass; | ||||
|     private String powerClass; | ||||
|     @Excel(name = "pmpp_low,(现场人员手动录入)") | ||||
|     private Float pmppLow; | ||||
|     @Excel(name = "pmpp_high,(现场人员手动录入)") | ||||
|   | ||||
| @@ -0,0 +1,29 @@ | ||||
| package com.cnbm.packing.mapper; | ||||
|  | ||||
| import com.cnbm.packing.dto.CamlineExtendArgDTO; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 机台表 | ||||
|  * | ||||
|  * @author codeGenerator | ||||
|  * @since 2023-02-15 | ||||
|  */ | ||||
| @Mapper | ||||
| public interface CamlineMapper { | ||||
|  | ||||
|     float getByid(@Param("subId") String subId); | ||||
|  | ||||
|  | ||||
|     //从camline 系统获取实际pmpp | ||||
|     float getPMPPBySubId(@Param("subId") String subId); | ||||
|  | ||||
|     String getOrderNameBySubId(@Param("subId") String subId); | ||||
|  | ||||
|     CamlineExtendArgDTO getExtendArgFromCamline(@Param("subId") String subId); | ||||
|  | ||||
|     Integer getTodayBoxNum(); | ||||
| } | ||||
| @@ -1,9 +1,12 @@ | ||||
| package com.cnbm.packing.mapper; | ||||
|  | ||||
| import com.cnbm.common.dao.BaseDao; | ||||
| import com.cnbm.packing.dto.CompensationPowerXSDTO; | ||||
| import com.cnbm.packing.dto.WoCompensationPowerDTO; | ||||
| import com.cnbm.packing.entity.WoCompensationPower; | ||||
| import com.cnbm.packing.param.CompensationQueryParam; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| @@ -17,5 +20,6 @@ import java.util.List; | ||||
| public interface WoCompensationPowerMapper extends BaseDao<WoCompensationPower> { | ||||
|  | ||||
|     List<WoCompensationPowerDTO> list(); | ||||
|      | ||||
|  | ||||
|     CompensationPowerXSDTO getConffBySubIdAndLineBody(@Param("param") CompensationQueryParam param); | ||||
| } | ||||
| @@ -24,4 +24,6 @@ public interface WoPackagingBoxMapper extends BaseDao<WoPackagingBox> { | ||||
|  | ||||
|     List<WoPackagingBoxDTO> list(); | ||||
|  | ||||
|     int updateIsArrivedByBoxNo(@Param("isArrived") Integer isArrived, @Param("boxNo") String boxNo); | ||||
|  | ||||
| } | ||||
| @@ -1,4 +1,5 @@ | ||||
| package com.cnbm.packing.mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import com.cnbm.common.dao.BaseDao; | ||||
| import com.cnbm.packing.entity.WoPackagingBoxSubstrate; | ||||
| @@ -12,5 +13,7 @@ import org.apache.ibatis.annotations.Mapper; | ||||
|  */ | ||||
| @Mapper | ||||
| public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> { | ||||
| 	 | ||||
|     WoPackagingBoxSubstrate getOneByWoSubstrateId(@Param("woSubstrateId") String woSubstrateId); | ||||
|  | ||||
|     int updatePackagingBoxIdByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("woSubstrateId") String woSubstrateId); | ||||
| } | ||||
| @@ -1,9 +1,12 @@ | ||||
| package com.cnbm.packing.mapper; | ||||
|  | ||||
| import com.cnbm.common.dao.BaseDao; | ||||
| import com.cnbm.packing.dto.CompensationPowerXSDTO; | ||||
| import com.cnbm.packing.dto.WoPowerLevelDTO; | ||||
| import com.cnbm.packing.entity.WoPowerLevel; | ||||
| import com.cnbm.packing.param.CompensationQueryParam; | ||||
| import org.apache.ibatis.annotations.Mapper; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| @@ -18,4 +21,7 @@ public interface WoPowerLevelMapper extends BaseDao<WoPowerLevel> { | ||||
|  | ||||
|     List<WoPowerLevelDTO> list(); | ||||
|  | ||||
|     WoPowerLevel getPowerLevelByLineBodyAndPMPP(@Param("param") CompensationQueryParam param); | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,16 @@ | ||||
| package com.cnbm.packing.param; | ||||
|  | ||||
| import io.swagger.models.auth.In; | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/15 19:05 | ||||
|  */ | ||||
| @Data | ||||
| public class CompensationQueryParam { | ||||
|     private float pmpp; | ||||
|     private Integer lineBody; | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,50 @@ | ||||
| package com.cnbm.packing.service; | ||||
|  | ||||
| import com.cnbm.dynamic.datasource.annotation.DataSource; | ||||
| import com.cnbm.packing.dto.CamlineExtendArgDTO; | ||||
| import com.cnbm.packing.dto.WoPowerLevelDTO; | ||||
| import com.cnbm.packing.mapper.CamlineMapper; | ||||
|  | ||||
| import io.swagger.models.auth.In; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/15 14:19 | ||||
|  */ | ||||
| @Service | ||||
| public class DynamicDataSourceService { | ||||
|     @Autowired | ||||
|     CamlineMapper mapper; | ||||
|     @Autowired | ||||
|     WoPowerLevelServiceBiz powerLevelServiceBiz; | ||||
|  | ||||
|  | ||||
|     public Integer getTodayBoxNum(){ | ||||
|         return mapper.getTodayBoxNum(); | ||||
|     } | ||||
|  | ||||
|     @DataSource("camline") | ||||
|     @Transactional | ||||
|     public float getPMPPBySubId(String subId){ | ||||
|         return mapper.getPMPPBySubId(subId); | ||||
|     } | ||||
|  | ||||
|     @DataSource("camline") | ||||
|     @Transactional | ||||
|     public String getOrderNameBySubId(String subId){ | ||||
|         return mapper.getOrderNameBySubId(subId); | ||||
|     } | ||||
|  | ||||
|     @DataSource("camline") | ||||
|     @Transactional | ||||
|     public CamlineExtendArgDTO getExtendArgFromCamline(String subId){ | ||||
|         return mapper.getExtendArgFromCamline(subId); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -2,6 +2,7 @@ package com.cnbm.packing.service; | ||||
|  | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.CrudService; | ||||
| import com.cnbm.packing.dto.CompensationPowerXSDTO; | ||||
| import com.cnbm.packing.dto.WoCompensationPowerDTO; | ||||
| import com.cnbm.packing.entity.WoCompensationPower; | ||||
|  | ||||
| @@ -16,6 +17,7 @@ import java.util.Map; | ||||
|  */ | ||||
| public interface WoCompensationPowerServiceBiz extends CrudService<WoCompensationPower, WoCompensationPowerDTO> { | ||||
|  | ||||
|  | ||||
|     PageData<WoCompensationPowerDTO> page (Map<String, Object> params); | ||||
|  | ||||
|     WoCompensationPowerDTO get(Long id); | ||||
| @@ -27,5 +29,7 @@ public interface WoCompensationPowerServiceBiz extends CrudService<WoCompensatio | ||||
|     void delete(Long[] ids); | ||||
|  | ||||
|     List<WoCompensationPowerDTO> list(); | ||||
|  | ||||
|     float calculCompensationPMPP(float pmpp, Integer lineBody); | ||||
|      | ||||
| } | ||||
| @@ -2,7 +2,7 @@ package com.cnbm.packing.service; | ||||
|  | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.CrudService; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxDTO; | ||||
| import com.cnbm.packing.dto.IdVo; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxDTO; | ||||
| import com.cnbm.packing.entity.WoPackagingBox; | ||||
|  | ||||
| @@ -21,12 +21,16 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo | ||||
|  | ||||
|     WoPackagingBoxDTO get(Long id); | ||||
|  | ||||
|     void save(WoPackagingBoxDTO dto); | ||||
|     IdVo add(WoPackagingBoxDTO dto); | ||||
|  | ||||
|     void update(WoPackagingBoxDTO dto); | ||||
|  | ||||
|     void delete(Long[] ids); | ||||
|  | ||||
|     List<WoPackagingBoxDTO> list(); | ||||
|      | ||||
|  | ||||
|     WoPackagingBoxDTO printList(Long id); | ||||
|  | ||||
|  | ||||
|     int updateIsArrivedByBoxNo(Integer isArrived, String boxNo); | ||||
| } | ||||
| @@ -2,6 +2,7 @@ package com.cnbm.packing.service; | ||||
|  | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.CrudService; | ||||
| import com.cnbm.packing.dto.ChangePackingBoxDTO; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; | ||||
| import com.cnbm.packing.entity.WoPackagingBoxSubstrate; | ||||
|  | ||||
| @@ -27,10 +28,12 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi | ||||
|  | ||||
|     void removeSubstrate(Long id); | ||||
|  | ||||
|     void insertSubstrate(WoPackagingBoxSubstrateDTO dto); | ||||
|     void insertSubstrate(ChangePackingBoxDTO dto); | ||||
|  | ||||
|     void replaceSubstrate(WoPackagingBoxSubstrateDTO[] dtos); | ||||
|     void replaceSubstrate(ChangePackingBoxDTO[] dtos); | ||||
|  | ||||
|     void batchInsert(WoPackagingBoxSubstrateDTO[] lists); | ||||
|      | ||||
|     void insertSubstrateManual(ChangePackingBoxDTO dto); | ||||
|  | ||||
|     WoPackagingBoxSubstrate getBySubId(String subId); | ||||
|     int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId,String woSubstrateId); | ||||
| } | ||||
| @@ -27,5 +27,7 @@ public interface WoPackagingPrintHistoryServiceBiz extends CrudService<WoPackagi | ||||
|     void delete(Long[] ids); | ||||
|  | ||||
|     List<WoPackagingPrintHistoryDTO> list(); | ||||
|  | ||||
|     void print(Long id); | ||||
|      | ||||
| } | ||||
| @@ -27,5 +27,6 @@ public interface WoPowerLevelServiceBiz extends CrudService<WoPowerLevel, WoPowe | ||||
|     void delete(Long[] ids); | ||||
|  | ||||
|     List<WoPowerLevelDTO> list(); | ||||
|     WoPowerLevel getArgByPMPP(float pmpp, Integer lineBody); | ||||
|  | ||||
| } | ||||
| @@ -2,6 +2,7 @@ package com.cnbm.packing.service.impl; | ||||
|  | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | ||||
| import com.cnbm.admin.utils.CodeGeneratorHelper; | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.impl.CrudServiceImpl; | ||||
| @@ -37,6 +38,14 @@ public class PrintModelServiceBizImpl extends CrudServiceImpl<PrintModelMapper, | ||||
|  | ||||
|         QueryWrapper<PrintModel> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.like(StringUtils.isNotBlank(name), PrintModel.NAME, name); | ||||
|         if(params.get("type")!=null) { | ||||
|             Integer type = Integer.parseInt(params.get("type").toString()); | ||||
|             wrapper.eq(ObjectUtils.isNotNull(type), PrintModel.TYPE, type); | ||||
|         } | ||||
|         if(params.get("lineBody")!=null) { | ||||
|             Integer lineBody = Integer.parseInt(params.get("lineBody").toString()); | ||||
|             wrapper.eq(ObjectUtils.isNotNull(lineBody), PrintModel.LINE_BODY, lineBody); | ||||
|         } | ||||
|  | ||||
|         return wrapper; | ||||
|     } | ||||
|   | ||||
| @@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.impl.CrudServiceImpl; | ||||
| import com.cnbm.common.utils.ConvertUtils; | ||||
| import com.cnbm.packing.dto.CompensationPowerXSDTO; | ||||
| import com.cnbm.packing.dto.WoCompensationPowerDTO; | ||||
| import com.cnbm.packing.entity.WoCompensationPower; | ||||
| import com.cnbm.packing.entity.WoPowerLevel; | ||||
| import com.cnbm.packing.mapper.WoCompensationPowerMapper; | ||||
| import com.cnbm.packing.param.CompensationQueryParam; | ||||
| import com.cnbm.packing.service.WoCompensationPowerServiceBiz; | ||||
| import lombok.var; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| @@ -86,5 +89,21 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens | ||||
|         List<WoCompensationPowerDTO> list = mapper.list(); | ||||
|         return list; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     @Override | ||||
|     public float calculCompensationPMPP(float pmpp, Integer lineBody) { | ||||
|         CompensationQueryParam compensationQueryParam = new CompensationQueryParam(); | ||||
|         compensationQueryParam.setPmpp(pmpp); | ||||
|         compensationQueryParam.setLineBody(lineBody); | ||||
|  | ||||
|  | ||||
|         CompensationPowerXSDTO conffBySubIdAndLineBody = mapper.getConffBySubIdAndLineBody(compensationQueryParam); | ||||
|         float res = pmpp*conffBySubIdAndLineBody.getA()+conffBySubIdAndLineBody.getB(); | ||||
|         return res; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public WoCompensationPowerMapper getMapper() { | ||||
|         return mapper; | ||||
|     } | ||||
| } | ||||
| @@ -3,18 +3,15 @@ package com.cnbm.packing.service.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.impl.CrudServiceImpl; | ||||
| import com.cnbm.common.utils.ConvertUtils; | ||||
| import com.cnbm.packing.dto.IdVo; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxDTO; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxDTO; | ||||
| import com.cnbm.packing.dto.WoPowerLevelDTO; | ||||
| import com.cnbm.packing.entity.WoPackagingBox; | ||||
| import com.cnbm.packing.entity.WoPackagingBox; | ||||
| import com.cnbm.packing.entity.WoPowerLevel; | ||||
| import com.cnbm.packing.mapper.WoPackagingBoxMapper; | ||||
| import com.cnbm.packing.entity.WoPackagingBoxSubstrate; | ||||
| import com.cnbm.packing.mapper.WoPackagingBoxMapper; | ||||
| import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; | ||||
| import com.cnbm.packing.service.WoPackagingBoxServiceBiz; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -37,7 +34,8 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox | ||||
|  | ||||
|     @Autowired | ||||
|     private WoPackagingBoxMapper mapper; | ||||
|      | ||||
|     @Autowired | ||||
|     private WoPackagingBoxSubstrateMapper substrateMapper; | ||||
|     @Override | ||||
|     public QueryWrapper<WoPackagingBox> getWrapper(Map<String, Object> params){ | ||||
|  | ||||
| @@ -52,11 +50,11 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox | ||||
|             Integer lineBody = Integer.parseInt(params.get("lineBody").toString()); | ||||
|             wrapper.eq(ObjectUtils.isNotNull(lineBody), WoPackagingBox.LINE_BODY, lineBody); | ||||
|         } | ||||
|         if(params.get("lineBody")!=null) { | ||||
|         if(params.get("printStatus")!=null) { | ||||
|             Integer printStatus = Integer.parseInt(params.get("printStatus").toString()); | ||||
|             wrapper.eq(ObjectUtils.isNotNull(printStatus), WoPackagingBox.PRINT_STATUS, printStatus); | ||||
|         } | ||||
|         if(params.get("lineBody")!=null) { | ||||
|         if(params.get("model")!=null) { | ||||
|             Integer model = Integer.parseInt(params.get("model").toString()); | ||||
|             wrapper.eq(ObjectUtils.isNotNull(model), WoPackagingBox.MODEL, model); | ||||
|         } | ||||
| @@ -82,9 +80,10 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox | ||||
|  | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void save(WoPackagingBoxDTO dto) { | ||||
|     public IdVo add(WoPackagingBoxDTO dto) { | ||||
|         WoPackagingBox entity = ConvertUtils.sourceToTarget(dto, WoPackagingBox.class); | ||||
|         insert(entity); | ||||
|         return IdVo.builder().id(entity.getId()).build(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -109,5 +108,19 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox | ||||
|         return list; | ||||
|     } | ||||
|  | ||||
|      | ||||
|     @Override | ||||
|     public WoPackagingBoxDTO printList(Long id) { | ||||
|         WoPackagingBox entity = baseDao.selectById(id); | ||||
|         WoPackagingBoxDTO dto = ConvertUtils.sourceToTarget(entity, WoPackagingBoxDTO.class); | ||||
|         QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo()); | ||||
|         List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper); | ||||
|         dto.setSubstrateList(woPackagingBoxSubstrateList); | ||||
|         return dto; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) { | ||||
|         return mapper.updateIsArrivedByBoxNo(isArrived,boxNo); | ||||
|     } | ||||
| } | ||||
| @@ -1,6 +1,7 @@ | ||||
| package com.cnbm.packing.service.impl; | ||||
|  | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.impl.CrudServiceImpl; | ||||
| @@ -8,6 +9,7 @@ import com.cnbm.common.utils.ConvertUtils; | ||||
| import com.cnbm.common.validator.ValidatorUtils; | ||||
| import com.cnbm.common.validator.group.AddGroup; | ||||
| import com.cnbm.common.validator.group.DefaultGroup; | ||||
| import com.cnbm.packing.dto.ChangePackingBoxDTO; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO; | ||||
| import com.cnbm.packing.entity.ChangePackagingBoxHistory; | ||||
| import com.cnbm.packing.entity.WoPackagingBoxSubstrate; | ||||
| @@ -16,6 +18,7 @@ import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper; | ||||
| import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz; | ||||
| import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.omg.CORBA.PRIVATE_MEMBER; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
| @@ -36,12 +39,8 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|  | ||||
|     @Autowired | ||||
|     private ChangePackagingBoxHistoryServiceBiz changePackagingBoxHistoryService; | ||||
|      | ||||
|     @Resource | ||||
|     private WoPackagingBoxMapper woPackagingBoxMapper; | ||||
|  | ||||
|     @Resource | ||||
|     private WoPackagingBoxSubstrateMapper woPackagingBoxSubstrateMapper; | ||||
|     @Autowired | ||||
|     private WoPackagingBoxSubstrateMapper mapper; | ||||
|  | ||||
|     @Override | ||||
|     public QueryWrapper<WoPackagingBoxSubstrate> getWrapper(Map<String, Object> params){ | ||||
| @@ -55,6 +54,8 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|         return wrapper; | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public PageData<WoPackagingBoxSubstrateDTO> page (Map<String, Object> params){ | ||||
|         IPage<WoPackagingBoxSubstrate> page = baseDao.selectPage( | ||||
| @@ -104,14 +105,19 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|         changePackagingBoxHistory.setType(2); | ||||
|         changePackagingBoxHistoryService.insert(changePackagingBoxHistory); | ||||
|         //模组从该包装箱中移出,该模组变为未绑定BoxID的模组 | ||||
|         entity.setPackagingBoxId(null); | ||||
|         entity.setSlot(null); | ||||
|         updateById(entity); | ||||
|         UpdateWrapper<WoPackagingBoxSubstrate> wrapper = new UpdateWrapper<>(); | ||||
|         wrapper.set(WoPackagingBoxSubstrate.PACKAGING_BOX_ID,null); | ||||
|         wrapper.set(WoPackagingBoxSubstrate.SLOT,null); | ||||
|         wrapper.eq(WoPackagingBoxSubstrate.ID,entity.getId()); | ||||
|         update(entity,wrapper); | ||||
| //        entity.setPackagingBoxId(""); | ||||
| //        entity.setSlot(null); | ||||
| //        updateById(entity); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void insertSubstrate(WoPackagingBoxSubstrateDTO dto) { | ||||
|     public void insertSubstrate(ChangePackingBoxDTO dto) { | ||||
|         WoPackagingBoxSubstrate entity = baseDao.selectById(dto.getId()); | ||||
|         //合箱写入包装箱拆合箱历史表 | ||||
|         ChangePackagingBoxHistory changePackagingBoxHistory = new ChangePackagingBoxHistory(); | ||||
| @@ -129,14 +135,14 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|  | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void replaceSubstrate(WoPackagingBoxSubstrateDTO[] dtos) { | ||||
|         for(WoPackagingBoxSubstrateDTO dto : dtos){ | ||||
|     public void replaceSubstrate(ChangePackingBoxDTO[] dtos) { | ||||
|         for(ChangePackingBoxDTO dto : dtos){ | ||||
|             WoPackagingBoxSubstrate entity = baseDao.selectById(dto.getId()); | ||||
|             //换箱写入包装箱拆合箱历史表 | ||||
|             ChangePackagingBoxHistory changePackagingBoxHistory = new ChangePackagingBoxHistory(); | ||||
|             changePackagingBoxHistory.setSubstrateId(dto.getWoSubstrateId()); | ||||
|             changePackagingBoxHistory.setTargetBoxNo(entity.getPackagingBoxId()); | ||||
|             changePackagingBoxHistory.setTargetSlot(entity.getSlot()); | ||||
|             changePackagingBoxHistory.setSubstrateId(entity.getWoSubstrateId()); | ||||
|             changePackagingBoxHistory.setSourceBoxNo(entity.getPackagingBoxId()); | ||||
|             changePackagingBoxHistory.setSourceSlot(entity.getSlot()); | ||||
|             changePackagingBoxHistory.setTargetBoxNo(dto.getPackagingBoxId()); | ||||
|             changePackagingBoxHistory.setTargetSlot(dto.getSlot()); | ||||
|             changePackagingBoxHistory.setType(3); | ||||
| @@ -150,9 +156,18 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|  | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void batchInsert(WoPackagingBoxSubstrateDTO[] lists) { | ||||
|         for(WoPackagingBoxSubstrateDTO dto:lists){ | ||||
|             if(dto.getWoSubstrateId()==null){ | ||||
|     public void insertSubstrateManual(ChangePackingBoxDTO dto) { | ||||
|  | ||||
|         QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>(); | ||||
|         wrapper.eq(StringUtils.isNotBlank(dto.getWoSubstrateId()),WoPackagingBoxSubstrate.WO_SUBSTRATE_ID,dto.getWoSubstrateId()); | ||||
|         if(mapper.selectCount(wrapper)>0 && StringUtils.isNotBlank(dto.getWoSubstrateId())) { | ||||
|             WoPackagingBoxSubstrate substrate = mapper.selectList(wrapper).get(0); | ||||
|             substrate.setPackagingBoxId(dto.getPackagingBoxId()); | ||||
|             updateById(substrate); | ||||
|         } | ||||
|         else{ | ||||
|             //模组ID有时为空,用户会输入”无码“ | ||||
|             if(dto.getWoSubstrateId()==null) { | ||||
|                 dto.setWoSubstrateId("无码"); | ||||
|             } | ||||
|             //效验数据 | ||||
| @@ -162,4 +177,13 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public WoPackagingBoxSubstrate getBySubId(String subId) { | ||||
|         return mapper.getOneByWoSubstrateId(subId); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId, String woSubstrateId) { | ||||
|         return mapper.updatePackagingBoxIdByWoSubstrateId(packagingBoxId,woSubstrateId); | ||||
|     } | ||||
| } | ||||
| @@ -3,9 +3,14 @@ package com.cnbm.packing.service.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | ||||
| import com.cnbm.admin.enums.WhetherEnum; | ||||
| import com.cnbm.common.page.PageData; | ||||
| import com.cnbm.common.service.impl.CrudServiceImpl; | ||||
| import com.cnbm.common.utils.ConvertUtils; | ||||
| import com.cnbm.common.validator.ValidatorUtils; | ||||
| import com.cnbm.common.validator.group.AddGroup; | ||||
| import com.cnbm.common.validator.group.DefaultGroup; | ||||
| import com.cnbm.packing.dto.WoPackagingBoxDTO; | ||||
| import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO; | ||||
| import com.cnbm.packing.dto.WoPackagingPrintHistoryDTO; | ||||
| import com.cnbm.packing.entity.WoPackagingBox; | ||||
| @@ -13,8 +18,10 @@ import com.cnbm.packing.entity.WoPackagingPrintHistory; | ||||
| import com.cnbm.packing.entity.WoPackagingPrintHistory; | ||||
| import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper; | ||||
| import com.cnbm.packing.mapper.WoPackagingPrintHistoryMapper; | ||||
| import com.cnbm.packing.service.WoPackagingBoxServiceBiz; | ||||
| import com.cnbm.packing.service.WoPackagingPrintHistoryServiceBiz; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
| @@ -36,6 +43,9 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|     @Autowired | ||||
|     private WoPackagingPrintHistoryMapper mapper; | ||||
|  | ||||
|     @Autowired | ||||
|     private WoPackagingBoxServiceBiz woPackagingBoxServiceBiz; | ||||
|  | ||||
|     @Override | ||||
|     public QueryWrapper<WoPackagingPrintHistory> getWrapper(Map<String, Object> params){ | ||||
|         LocalDateTime startTime = (LocalDateTime) params.get("startTime"); | ||||
| @@ -92,5 +102,28 @@ public class WoPackagingPrintHistoryServiceBizImpl extends CrudServiceImpl<WoPac | ||||
|         return list; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void print(Long id) { | ||||
|  | ||||
|         WoPackagingBoxDTO woPackagingBox = woPackagingBoxServiceBiz.get(id); | ||||
|  | ||||
|         WoPackagingPrintHistory woPackagingPrintHistory = new WoPackagingPrintHistory(); | ||||
|         BeanUtils.copyProperties(woPackagingBox, woPackagingPrintHistory); | ||||
|         woPackagingPrintHistory.setId(null); | ||||
|         woPackagingPrintHistory.setPrintTime(LocalDateTime.now()); | ||||
|         insert(woPackagingPrintHistory); | ||||
|         //更新包装箱表中打印状态和时间 | ||||
|         woPackagingBox.setPrintTime(woPackagingPrintHistory.getPrintTime()); | ||||
|         if(woPackagingBox.getPrintStatus()==0){ | ||||
|             woPackagingBox.setPrintCount(1); | ||||
|             woPackagingBox.setPrintStatus(1); | ||||
|         } | ||||
|         else{ | ||||
|             woPackagingBox.setPrintCount(woPackagingBox.getPrintCount()+1); | ||||
|         } | ||||
|         woPackagingBoxServiceBiz.update(woPackagingBox); | ||||
|     } | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -9,6 +9,7 @@ import com.cnbm.common.utils.ConvertUtils; | ||||
| import com.cnbm.packing.dto.WoPowerLevelDTO; | ||||
| import com.cnbm.packing.entity.WoPowerLevel; | ||||
| import com.cnbm.packing.mapper.WoPowerLevelMapper; | ||||
| import com.cnbm.packing.param.CompensationQueryParam; | ||||
| import com.cnbm.packing.service.WoPowerLevelServiceBiz; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -87,4 +88,11 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp | ||||
|         return list; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public WoPowerLevel getArgByPMPP(float pmpp, Integer lineBody) { | ||||
|         CompensationQueryParam compensationQueryParam = new CompensationQueryParam(); | ||||
|         compensationQueryParam.setLineBody(lineBody); | ||||
|         compensationQueryParam.setPmpp(pmpp); | ||||
|         return mapper.getPowerLevelByLineBodyAndPMPP(compensationQueryParam); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,21 @@ | ||||
| package com.cnbm.packing.vo; | ||||
|  | ||||
| import cn.hutool.core.date.DateUtil; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.Date; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2023/2/15 16:32 | ||||
|  */ | ||||
| @Data | ||||
| public class ComlinePMPP { | ||||
|     private String machineName; | ||||
|     private Long platformId; | ||||
|     private LocalDateTime createTime; | ||||
|  | ||||
|  | ||||
| } | ||||
							
								
								
									
										141
									
								
								ym-packing/src/main/resources/mapper/CamlineMapper.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								ym-packing/src/main/resources/mapper/CamlineMapper.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,141 @@ | ||||
| <?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.cnbm.packing.mapper.CamlineMapper"> | ||||
|  | ||||
|     <resultMap id="ResultMap" type="com.cnbm.packing.vo.ComlinePMPP"> | ||||
|         <result column="machine_name" property="machineName" /> | ||||
|         <result column="platform_id" property="platformId" /> | ||||
|         <result column="create_time" property="createTime" /> | ||||
|     </resultMap> | ||||
|     <resultMap id="ResultAMap" type="com.cnbm.packing.dto.CamlineExtendArgDTO"> | ||||
|         <result column="LAST_UPDATE_TIME" property="lastUpdateTime" /> | ||||
|         <result column="PMPP" property="pmpp" /> | ||||
|         <result column="ORDER_NAME" property="orderName" /> | ||||
|         <result column="BINCLASS_FL1" property="binclassFl1" /> | ||||
|         <result column="BINCLASS_FL2" property="binclassFl2" /> | ||||
|         <result column="ETA_FL1" property="etaFl1" /> | ||||
|         <result column="ETA_FL2" property="etaFl2" /> | ||||
|         <result column="FF_FL1" property="ffFl1" /> | ||||
|         <result column="FF_FL2" property="ffFl2" /> | ||||
|         <result column="IMPP_FL1" property="imppFl1" /> | ||||
|         <result column="IMPP_FL2" property="imppFl2" /> | ||||
|         <result column="InsolFlashControl_FL1" property="insolflashcontrolFl1" /> | ||||
|         <result column="InsolFlashControl_FL2" property="insolflashcontrolFl2" /> | ||||
|         <result column="InsolMPP_FL1" property="insolmppFl1" /> | ||||
|         <result column="InsolMPP_FL2" property="insolmppFl2" /> | ||||
|         <result column="InsolVoc_FL1" property="insolvocFl1" /> | ||||
|         <result column="InsolVoc_FL2" property="insolvocFl2" /> | ||||
|         <result column="Insol_FL1" property="insolFl1" /> | ||||
|         <result column="Insol_FL2" property="insolFl2" /> | ||||
|         <result column="ISC_FL1" property="iscFl1" /> | ||||
|         <result column="ISC_FL2" property="iscFl2" /> | ||||
|         <result column="MEAS_TIME_FL1" property="measTimeFl1" /> | ||||
|         <result column="MEAS_TIME_FL2" property="measTimeFl2" /> | ||||
|         <result column="PMPP_FL1" property="pmppFl1" /> | ||||
|         <result column="PMPP_FL2" property="pmppFl2" /> | ||||
|         <result column="Tcell_FL1" property="tcellFl1" /> | ||||
|         <result column="Tcell_FL2" property="tcellFl2" /> | ||||
|         <result column="Tmonicell_FL1" property="tmonicellFl1" /> | ||||
|         <result column="Tmonicell_FL2" property="tmonicellFl2" /> | ||||
|         <result column="UMPP_FL1" property="umppFl1" /> | ||||
|         <result column="UMPP_FL2" property="umppFl2" /> | ||||
|         <result column="UOC_FL1" property="uocFl1" /> | ||||
|         <result column="UOC_FL2" property="uocFl2" /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <select id="getByid" resultType="float"> | ||||
|         select pd.pmpp from process_data pd | ||||
|         where pd.arg_name = #{subId} | ||||
|         ORDER BY | ||||
|             pd.create_time DESC | ||||
|         LIMIT 1 | ||||
|     </select> | ||||
|  | ||||
|     <select id="getPMPPBySubId" resultType="float"> | ||||
|         SELECT | ||||
|             flc.PMPP | ||||
|         FROM | ||||
|             ue_flasher_data_calc flc | ||||
|             LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id | ||||
|         WHERE | ||||
|             flc.PMPP != 0 | ||||
|             and | ||||
|             tu.name=#{subId} -- 查特定基板功率 | ||||
|         ORDER BY | ||||
|             flc.LAST_UPDATE_TIME DESC | ||||
|             LIMIT 1 | ||||
|     </select> | ||||
|  | ||||
|     <select id="getExtendArgFromCamline" resultMap="ResultAMap"> | ||||
|         SELECT | ||||
|             eo.`NAME` as ORDER_NAME, | ||||
|             flr.LAST_UPDATE_TIME, | ||||
|             flr.BINCLASS_FL1,-- 1为 PID16 电池相关信息 | ||||
|             flr.BINCLASS_FL2,-- 2为 PID22 电池相关信息 | ||||
|             flr.ETA_FL1, | ||||
|             flr.ETA_FL2, | ||||
|             flr.FF_FL1, | ||||
|             flr.FF_FL2, | ||||
|             flr.IMPP_FL1, | ||||
|             flr.IMPP_FL2, | ||||
|             flr.InsolFlashControl_FL1, | ||||
|             flr.InsolFlashControl_FL2, | ||||
|             flr.InsolMPP_FL1, | ||||
|             flr.InsolMPP_FL2, | ||||
|             flr.InsolVoc_FL1, | ||||
|             flr.InsolVoc_FL2, | ||||
|             flr.Insol_FL1, | ||||
|             flr.Insol_FL2, | ||||
|             flr.ISC_FL1, | ||||
|             flr.ISC_FL2, | ||||
|             flr.MEAS_TIME_FL1, | ||||
|             flr.MEAS_TIME_FL2, | ||||
|             flr.PMPP_FL1,-- pid16实测PMPP | ||||
|             flr.PMPP_FL2,-- pid22实测PMPP | ||||
|             flr.Tcell_FL1, | ||||
|             flr.Tcell_FL2, | ||||
|             flr.Tmonicell_FL1, | ||||
|             flr.Tmonicell_FL2, | ||||
|             flr.UMPP_FL1, | ||||
|             flr.UMPP_FL2, | ||||
|             flr.UOC_FL1, | ||||
|             flr.UOC_FL2, | ||||
|             flc.PMPP -- 补偿后功率,用我们的 | ||||
|  | ||||
|         FROM | ||||
|             ue_flasher_data_raw flr | ||||
|                 LEFT JOIN e_tracking_unit tu ON flr.mainid = tu.id | ||||
|                 LEFT JOIN ue_flasher_data_calc flc ON flc.mainid = tu.id | ||||
|                 LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID | ||||
|         WHERE | ||||
|             flr.PMPP_FL2 != 0 | ||||
|             and | ||||
|             tu.name=#{subId} | ||||
|         GROUP BY | ||||
|             tu.`NAME` | ||||
|         ORDER BY | ||||
|             flr.LAST_UPDATE_TIME DESC | ||||
|         LIMIT 1 | ||||
|     </select> | ||||
|  | ||||
|     <select id="getOrderNameBySubId" resultType="string"> | ||||
|         SELECT | ||||
|             eorder.name | ||||
|         FROM | ||||
|             e_tracking_unit tu | ||||
|                 LEFT JOIN er_order eorder ON tu.order_id = eorder.id | ||||
|         WHERE | ||||
|             tu.name=#{subId} -- 依据基板id 查询对应的订单名 | ||||
|         ORDER BY | ||||
|             tu.LAST_UPDATE_TIME DESC | ||||
|             LIMIT 1 | ||||
|     </select> | ||||
|  | ||||
|     <select id="getTodayBoxNum" resultType="java.lang.Integer"> | ||||
|         select count(1) | ||||
|         from t_wo_packaging_box twpb | ||||
|         where twpb.CREATE_TIME BETWEEN DATE_FORMAT(NOW(),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(NOW(),'%Y-%m-%d 23:59:59') | ||||
|     </select> | ||||
|  | ||||
|  | ||||
| </mapper> | ||||
| @@ -19,10 +19,31 @@ | ||||
|             <id column="update_time" property="updateTime" /> | ||||
|             <id column="version" property="version" /> | ||||
|     </resultMap> | ||||
|     <resultMap id="ResultMap" type="com.cnbm.packing.dto.CompensationPowerXSDTO"> | ||||
|         <result column="a" property="a" /> | ||||
|         <result column="b" property="b" /> | ||||
|     </resultMap> | ||||
|  | ||||
|  | ||||
|     <select id="list" resultType="com.cnbm.packing.dto.WoCompensationPowerDTO"> | ||||
|         select * from t_wo_compensation_power | ||||
|         order by id asc | ||||
|     </select> | ||||
|  | ||||
|     <select id="getConffBySubIdAndLineBody" resultMap="ResultMap"> | ||||
|         select | ||||
|             twcp.coefficient_a as a,twcp.coefficient_b as b | ||||
|         from t_wo_compensation_power twcp | ||||
|         where | ||||
|             twcp.valid = 1 | ||||
|  | ||||
|           <if test="param.lineBody != null"> | ||||
|               and twcp.line_body = #{param.lineBody} | ||||
|           </if> | ||||
|           <if test="param.pmpp != null"> | ||||
|               and twcp.actl_pmpp_high <![CDATA[ >= ]]> #{param.pmpp} and  twcp.actl_pmpp_low <![CDATA[ <= ]]> #{param.pmpp} | ||||
|           </if> | ||||
|  | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -31,11 +31,17 @@ | ||||
|             <id column="LINE_BODY" property="lineBody" /> | ||||
|             <id column="model" property="model" /> | ||||
|             <id column="is_arrived" property="isArrived" /> | ||||
|             <id column="ORDER_NUM" property="orderNum" /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <select id="list" resultType="com.cnbm.packing.dto.WoPackagingBoxDTO"> | ||||
|         select * from t_wo_packaging_box | ||||
|         order by id asc | ||||
|     </select> | ||||
|     <update id="updateIsArrivedByBoxNo"> | ||||
|         update t_wo_packaging_box | ||||
|         set is_arrived = #{isArrived,jdbcType=NUMERIC} | ||||
|         where BOX_NO = #{boxNo,jdbcType=VARCHAR} | ||||
|     </update> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -18,12 +18,65 @@ | ||||
|             <id column="SAP_MATERIAL" property="sapMaterial" /> | ||||
|             <id column="LINE_BODY" property="lineBody" /> | ||||
|             <id column="POWER_LEVEL" property="powerLevel" /> | ||||
|             <id column="LAST_UPDATE_TIME" property="lastUpdateTime" /> | ||||
|             <id column="PMPP" property="pmpp" /> | ||||
|             <id column="ORDER_NAME" property="orderName" /> | ||||
|             <id column="BINCLASS_FL1" property="binclassFl1" /> | ||||
|             <id column="BINCLASS_FL2" property="binclassFl2" /> | ||||
|             <id column="ETA_FL1" property="etaFl1" /> | ||||
|             <id column="ETA_FL2" property="etaFl2" /> | ||||
|             <id column="FF_FL1" property="ffFl1" /> | ||||
|             <id column="FF_FL2" property="ffFl2" /> | ||||
|             <id column="IMPP_FL1" property="imppFl1" /> | ||||
|             <id column="IMPP_FL2" property="imppFl2" /> | ||||
|             <id column="InsolFlashControl_FL1" property="insolflashcontrolFl1" /> | ||||
|             <id column="InsolFlashControl_FL2" property="insolflashcontrolFl2" /> | ||||
|             <id column="InsolMPP_FL1" property="insolmppFl1" /> | ||||
|             <id column="InsolMPP_FL2" property="insolmppFl2" /> | ||||
|             <id column="InsolVoc_FL1" property="insolvocFl1" /> | ||||
|             <id column="InsolVoc_FL2" property="insolvocFl2" /> | ||||
|             <id column="Insol_FL1" property="insolFl1" /> | ||||
|             <id column="Insol_FL2" property="insolFl2" /> | ||||
|             <id column="ISC_FL1" property="iscFl1" /> | ||||
|             <id column="ISC_FL2" property="iscFl2" /> | ||||
|             <id column="MEAS_TIME_FL1" property="measTimeFl1" /> | ||||
|             <id column="MEAS_TIME_FL2" property="measTimeFl2" /> | ||||
|             <id column="PMPP_FL1" property="pmppFl1" /> | ||||
|             <id column="PMPP_FL2" property="pmppFl2" /> | ||||
|             <id column="Tcell_FL1" property="tcellFl1" /> | ||||
|             <id column="Tcell_FL2" property="tcellFl2" /> | ||||
|             <id column="Tmonicell_FL1" property="tmonicellFl1" /> | ||||
|             <id column="Tmonicell_FL2" property="tmonicellFl2" /> | ||||
|             <id column="UMPP_FL1" property="umppFl1" /> | ||||
|             <id column="UMPP_FL2" property="umppFl2" /> | ||||
|             <id column="UOC_FL1" property="uocFl1" /> | ||||
|             <id column="UOC_FL2" property="uocFl2" /> | ||||
|     </resultMap> | ||||
|  | ||||
|     <select id="list" resultType="com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO"> | ||||
|         select * from t_wo_packaging_box_substrate | ||||
|         order by id asc | ||||
|         <where> | ||||
|             valid = 1 | ||||
|             <if test="packagingBoxId != null"> | ||||
|                 and PACKAGING_BOX_ID = #{packagingBoxId} | ||||
|             </if> | ||||
|         </where> | ||||
|         order by slot asc | ||||
|     </select> | ||||
|     <select id="getOneByWoSubstrateId" resultMap="WoPackagingBoxSubstrateMap"> | ||||
|         select | ||||
|         * | ||||
|         from t_wo_packaging_box_substrate | ||||
|         where | ||||
|         valid = 1 and | ||||
|         WO_SUBSTRATE_ID = #{woSubstrateId,jdbcType=VARCHAR} | ||||
|         limit 1 | ||||
|     </select> | ||||
|     <update id="updatePackagingBoxIdByWoSubstrateId"> | ||||
|         update t_wo_packaging_box_substrate | ||||
|         set PACKAGING_BOX_ID = #{packagingBoxId,jdbcType=VARCHAR} | ||||
|         where WO_SUBSTRATE_ID = #{woSubstrateId,jdbcType=VARCHAR} | ||||
|     </update> | ||||
|  | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -28,4 +28,18 @@ | ||||
|         order by id asc | ||||
|     </select> | ||||
|  | ||||
|     <select id="getPowerLevelByLineBodyAndPMPP" resultMap="WoPowerLevelMap"> | ||||
|         select | ||||
|         * | ||||
|         from t_wo_power_level twpl | ||||
|         where | ||||
|         twpl.valid = 1 | ||||
|         <if test="param.lineBody != null"> | ||||
|             and twpl.line_body = #{param.lineBody} | ||||
|         </if> | ||||
|         <if test="param.pmpp != null"> | ||||
|             and twpl.pmpp_high <![CDATA[ >= ]]> #{param.pmpp} and  twpl.pmpp_low <![CDATA[ <= ]]> #{param.pmpp} | ||||
|         </if> | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
|   | ||||
| @@ -1,270 +0,0 @@ | ||||
| package com.cnbm.s7.controller; | ||||
|  | ||||
| import com.cnbm.s7.entity.R; | ||||
| import com.cnbm.s7.entity.AGVInfoCallBack; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.enmuc.PlcVarActual; | ||||
|  | ||||
|  | ||||
| import com.cnbm.s7.s7connector.enmuc.S7Client; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import java.io.UnsupportedEncodingException; | ||||
| import java.text.ParseException; | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
| import java.util.Random; | ||||
|  | ||||
| @RestController | ||||
| @RequestMapping("/s7") | ||||
| public class S7DemoController { | ||||
|     private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class); | ||||
|  | ||||
| //    @Autowired | ||||
| //    InfluxDBClient influxDBClient; | ||||
| // | ||||
| //    @PostMapping("/insert") | ||||
| //    public void insert() throws InterruptedException { | ||||
| //        Event event = new Event(); | ||||
| //        event.setTime(Instant.now()); | ||||
| //        event.setTransationId("asasd11"); | ||||
| //        event.setArgName("argName11"); | ||||
| //        event.setArgValue(7d); | ||||
| //        Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEventSSS"); | ||||
| //        influxDBClient.makeWriteApi().writePoint(asProcessCompleteEvent); | ||||
| //    } | ||||
|  | ||||
|     @PostMapping(value = "testFor") | ||||
|     private void testFor(@RequestBody AGVInfoCallBack agvInfoCallBack) { | ||||
|  | ||||
|         System.out.println(agvInfoCallBack.toString()); | ||||
|     } | ||||
|  | ||||
|     //demo1 | ||||
|     @PostMapping("/testReadAll") | ||||
|     public R testReadAll() throws UnsupportedEncodingException, ParseException { | ||||
|         for(PlcVarActual actual:PlcVarActual.values()){ | ||||
|             System.out.println(read(S7Client.S7_1500,actual)); | ||||
|         } | ||||
|         return R.ok(); | ||||
|     } | ||||
| //    public Point insert(Event event, String measurement){ | ||||
| //        Point point = Point.measurement(measurement) | ||||
| //                .addTag("transationId", event.getTransationId()) | ||||
| //                .addTag("argName", event.getArgName()) | ||||
| //                .addField("argValue", event.getArgValue()) | ||||
| //                .time(event.getTime().toEpochMilli(), WritePrecision.MS); | ||||
| //        return point; | ||||
| //    } | ||||
|     //demo2 | ||||
|     @PostMapping("/readTest") | ||||
|     public R getTestForS7() throws UnsupportedEncodingException, ParseException { | ||||
|         Boolean heartBeat = (Boolean)read(S7Client.S7_1500,PlcVarActual.HeartBeat); | ||||
|         String ddtl = (String)read(S7Client.S7_1500,PlcVarActual.DTL); | ||||
|         List<Character> characters = (List<Character>)read(S7Client.S7_1500,PlcVarActual.CharArrays); | ||||
|  | ||||
|         List<Boolean> booleans = (List<Boolean>)read(S7Client.S7_1500,PlcVarActual.BooleanArrays); | ||||
|  | ||||
|         String stri = (String)read(S7Client.S7_1500,PlcVarActual.STRING1); | ||||
|  | ||||
|         return R.ok().put("res",heartBeat).put("characters",characters).put("ddtl",ddtl).put("bools",booleans).put("str",stri); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @PostMapping("/readTest2") | ||||
|     public R getTest2ForS7() throws Exception { | ||||
| //        List<Character> characters = (List<Character>)read(PlcVarActual.CharArrays,S7Client.S7_1500); | ||||
| // | ||||
| //        List<Boolean> booleans = (List<Boolean>)read(PlcVarActual.BooleanArrays,S7Client.S7_1500); | ||||
| //        String stri = (String)read(PlcVarActual.STRING1,S7Client.S7_1500); | ||||
| // | ||||
| //        return R.ok().put("res",heartBeat).put("characters",characters).put("ddtl",ddtl).put("bools",booleans).put("str",stri); | ||||
|         String con = "1233ADSDA"; | ||||
|         write(S7Client.S7_1500,PlcVarActual.STRING1, con); | ||||
|         String read = (String)read(S7Client.S7_1500,PlcVarActual.STRING1); | ||||
|         String sub0 = (String)read(S7Client.S7_1500,PlcVarActual.SUBID0); | ||||
|  | ||||
|  | ||||
|         return R.ok().put("str",read).put("sub0",sub0); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/testWriteBooleanArray") | ||||
|     public R testWriteBooleanArray() throws Exception { | ||||
|  | ||||
|         List<Boolean> string = (List<Boolean>)read(S7Client.S7_1500,PlcVarActual.BooleanArrays1200); | ||||
|         System.out.println(); | ||||
|         boolean[] res = new boolean[15]; | ||||
|         res[0] = false; | ||||
|         res[1] = true; | ||||
|         res[2] = false; | ||||
|         res[3] = true; | ||||
|         res[4] = false; | ||||
|         res[5] = true; | ||||
|         res[6] = false; | ||||
|         res[7] = false; | ||||
|         res[8] = false; | ||||
|         res[9] = true; | ||||
|         res[10] = false; | ||||
|         res[11] = false; | ||||
|         res[12] = true; | ||||
|         res[13] = false; | ||||
|         res[14] = true; | ||||
|         write(S7Client.S7_1500,PlcVarActual.BooleanArrays1200, res); | ||||
|         System.out.println(); | ||||
|         return R.ok(); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/testForString") | ||||
|     public R testForStrings() throws Exception { | ||||
|         //测试结果 l => 66ms | ||||
|         long l = System.currentTimeMillis(); | ||||
|         String[] subs = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays); | ||||
|         long l1 = System.currentTimeMillis(); | ||||
|  | ||||
|         long dl = System.currentTimeMillis(); | ||||
|         String string = (String)read(S7Client.S7_1500,PlcVarActual.STRING1); | ||||
|         long dl1 = System.currentTimeMillis(); | ||||
|  | ||||
|         String[] toWrite = new String[60]; | ||||
|         for(int i=0;i<60;i++){ | ||||
|             int i1 = new Random().nextInt(100); | ||||
|             toWrite[i] = "2212"+ i1; | ||||
|         } | ||||
|         ////测试结果 c => 57ms | ||||
|         long c1 = System.currentTimeMillis(); | ||||
|         write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite); | ||||
|         long c2 = System.currentTimeMillis(); | ||||
|         String s = "cai xiang"; | ||||
|         write(S7Client.S7_1500,PlcVarActual.STRING1,s); | ||||
|  | ||||
|         String string2 = (String)read(S7Client.S7_1500,PlcVarActual.STRING1); | ||||
|         String[] subs2 = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays); | ||||
|  | ||||
|         return R.ok().put("l",(l1-l)).put("c",(c2-c1)).put("dl",(dl1-dl)); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/testForString1200") | ||||
|     public R testForString1200() throws Exception { | ||||
|         //测试结果 l => 66ms | ||||
|         long l = System.currentTimeMillis(); | ||||
|         String[] subs = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays1200);   //65ms | ||||
|         long l1 = System.currentTimeMillis(); | ||||
|         //System.out.println(Arrays.toString(subs)); | ||||
|  | ||||
|         String[] toWrite = new String[63]; | ||||
|         for(int i=0;i<63;i++){ | ||||
|             //int i1 = new Random().nextInt(100); | ||||
|             toWrite[i] = "abcd-"+ i; | ||||
|         } | ||||
|         ////测试结果 c => 57ms | ||||
|         long c1 = System.currentTimeMillis(); | ||||
|         write(S7Client.S7_1500,PlcVarActual.SubIdArrays1200,toWrite); | ||||
|         long c2 = System.currentTimeMillis(); | ||||
|  | ||||
|         String[] subs2 = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays1200); | ||||
|         logger.info("正常测试: l:"+(l1-l)+"c:"+(c2-c1)+";;read1:"+Arrays.toString(subs)+";;read2:"+Arrays.toString(subs2)); | ||||
|  | ||||
|         return R.ok().put("l",(l1-l)).put("c",(c2-c1)); | ||||
|     } | ||||
|  | ||||
|     @PostMapping("/testForString1500") | ||||
|     public R testForString1500() throws Exception { | ||||
|         //测试结果 l => 66ms | ||||
|         long l = System.currentTimeMillis(); | ||||
|         String[] subs = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays);      //25ms | ||||
|         long l1 = System.currentTimeMillis(); | ||||
|         System.out.println(Arrays.toString(subs)); | ||||
|         String[] toWrite = new String[63]; | ||||
|         for(int i=0;i<63;i++){ | ||||
|             //int i1 = new Random().nextInt(100); | ||||
|             toWrite[i] = "abcd-"+ i; | ||||
|         } | ||||
|         ////测试结果 c => 57ms | ||||
|         long c1 = System.currentTimeMillis(); | ||||
|         write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite); | ||||
|         long c2 = System.currentTimeMillis(); | ||||
|  | ||||
|  | ||||
|         String[] subs2 = (String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays); | ||||
|  | ||||
|         return R.ok().put("l",(l1-l)).put("c",(c2-c1)); | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     @PostMapping("/testFor1200") | ||||
|     public R testFor1200() throws Exception { | ||||
|         //Object subs = read(PlcVarActual.INT1200, S7Client.S7_1500); | ||||
|         Object read = read(S7Client.S7_1500, PlcVarActual.SubIdArrays1200); | ||||
|  | ||||
|         String[] toWrite = new String[60]; | ||||
|         for(int i=0;i<60;i++){ | ||||
|             int i1 = new Random().nextInt(100); | ||||
|             toWrite[i] = "2212"+ i1; | ||||
|         } | ||||
|         write(S7Client.S7_1500,PlcVarActual.SubIdArrays1200,toWrite); | ||||
|  | ||||
|         Object read2 = read(S7Client.S7_1500, PlcVarActual.SubIdArrays1200); | ||||
|         return R.ok(); | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     //PlcVarActual 到时候改成你们的 xxxPlcToWcs 或者 xxxWcsToPlc | ||||
|     /** | ||||
|      * return | ||||
|      *          成功: 返回相应的object对象 | ||||
|      *          失败: 返回null | ||||
|      * */ | ||||
|     private Object read(S7Client s7Client,PlcVarActual var) throws UnsupportedEncodingException, ParseException { | ||||
|         try { | ||||
|             return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType()); | ||||
|         }catch (Exception e){ | ||||
|             logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage()); | ||||
|             e.printStackTrace(); | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
|     private void write(S7Client s7Client,PlcVarActual var,Object newValue) throws Exception { | ||||
|         if(var.getType().equals(PlcVar.STRING_Array)){ | ||||
|             String[] s = (String[])newValue; | ||||
|             String[] ss = (String[])newValue; | ||||
|             if(s.length > var.getLength() ){ | ||||
|                 ss = new String[var.getLength()]; | ||||
|                 for(int i=0;i< var.getLength();i++){ | ||||
|                     ss[i] = s[i]; | ||||
|                 } | ||||
|             } | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss); | ||||
|         }else { | ||||
|             s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| //    //demo3 | ||||
| //    @PostMapping("/writeTest") | ||||
| //    public R writeTest() throws PlcConnectionException, UnsupportedEncodingException { | ||||
| //        write(S7Client.S7_1500,PlcVarActual.HeartBeat, false); | ||||
| // | ||||
| //        char[] charArrays_content = new char[2]; | ||||
| //        charArrays_content[0] = '1'; | ||||
| //        charArrays_content[1] = 'c'; | ||||
| //        write( S7Client.S7_1500,PlcVarActual.CharArrays, charArrays_content); | ||||
| // | ||||
| //        boolean[] boolArrays_content = new boolean[2]; | ||||
| //        boolArrays_content[0] = true; | ||||
| //        boolArrays_content[1] = false; | ||||
| //        write(S7Client.S7_1500,PlcVarActual.BooleanArrays, boolArrays_content); | ||||
| // | ||||
| //        String str = "你好啊aa"; | ||||
| //        //todo string 的读写有问题 待会看看 | ||||
| //        write(S7Client.S7_1500,PlcVarActual.STRING1, str); | ||||
| //        return R.ok().put("res",true); | ||||
| //    } | ||||
|  | ||||
| } | ||||
| @@ -1,233 +0,0 @@ | ||||
| package com.cnbm.s7.s7connector; | ||||
|  | ||||
| import cn.hutool.core.util.ByteUtil; | ||||
|  | ||||
| import java.math.BigInteger; | ||||
| import java.util.Stack; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2021/12/10 11:22 | ||||
|  */ | ||||
| public class Main2 { | ||||
|     public static byte[] double2Bytes(double d) { | ||||
|         long value = Double.doubleToRawLongBits(d); | ||||
|         byte[] byteRet = new byte[8]; | ||||
|         for (int i = 0; i < 8; i++) { | ||||
|             byteRet[i] = (byte) ((value >> 8 * i) & 0xff); | ||||
|         } | ||||
|         return byteRet; | ||||
|     } | ||||
|     /** | ||||
|      * 1个字节byte[] 转成有符号的short | ||||
|      * */ | ||||
|     public static Integer toInt(byte bytes) { | ||||
|         return Integer.valueOf(Byte.toString(bytes)); | ||||
|     } | ||||
|     public static Integer toUInt(byte bytes) { | ||||
|         return Integer.valueOf(Byte.toUnsignedInt(bytes)); | ||||
|     } | ||||
|  | ||||
|     public static void main(String[] args) { | ||||
|  | ||||
|  | ||||
|         byte[] bytes = new byte[2]; | ||||
|         bytes[0] = -1; //内部是 补码形式存在  //todo 搞清楚 补码和原码什么时候转化 | ||||
|         bytes[1] = -111; | ||||
|         //-1 原码 1000 0001 ;;-1 补码 1111 1111 | ||||
|         //1000 0001  1110 1111  //原码形式 | ||||
|         //1111 1111  1001 0001  //补码形式,在计算机内部是以补码形式存储的,当赋值给2个字节后是无符号整形的 要强制转化成short类型后,如果之前首位是1 就会被java强制转化成补码 | ||||
|         //1000 0000  0110 1111  // | ||||
|         //1+16+128+256+512+1024+2048+4096+4096*2+4096*3+4096*4 | ||||
|         //1024*(63) | ||||
|  | ||||
|         //1000 0000  0110 1111  //-111 | ||||
|         System.out.println(toInt(bytes[0])); | ||||
|         System.out.println(toUInt(bytes[0])); | ||||
|         System.out.println(toInt(bytes[1])); | ||||
|         System.out.println(toUInt(bytes[1])); | ||||
|  | ||||
|         System.out.println("无符号 "+(bytes[1] & 0xff | (bytes[0] & 0xff) << Byte.SIZE)); | ||||
|         System.out.println("有符号 "+(short)(bytes[1] & 0xff | (bytes[0] & 0xff) << Byte.SIZE)); | ||||
|  | ||||
| //        //byte类型的数字要&0xff再赋值给int类型,其本质原因就是想保持二进制补码的一致性。  0xff 其实就是0000 0000 0000 0000 0000 0000 1111 0100 | ||||
|         short l = 0; | ||||
|         l<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 | ||||
|         //注意: 移位并不会增加原来字节长度,被挤掉的数据就没了,而且是以补码的形式移动的。 | ||||
|         l |= (bytes[0] & 0xff); //和上面也是一样的  l = l | (b[i]&0xff)    // 255  补码 1111 1111 | ||||
|  | ||||
|         l<<=7; | ||||
|         l<<=1; | ||||
|         //l<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 | ||||
|         l |= (bytes[1] & 0xff); //和上面也是一样的  l = l | (b[i]&0xff) | ||||
|  | ||||
|  | ||||
|         short c = 0; | ||||
|         c<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 | ||||
|         //注意: 移位并不会增加原来字节长度,被挤掉的数据就没了,而且是以补码的形式移动的。 | ||||
|         c |= ((byte)1 & 0xff); //和上面也是一样的  l = l | (b[i]&0xff)    // 255  补码 1111 1111 | ||||
|  | ||||
|         c<<=7; | ||||
|         c<<=1; | ||||
|         //l<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 | ||||
|         c |= ((byte)2 & 0xff); //和上面也是一样的  l = l | (b[i]&0xff) | ||||
|  | ||||
|  | ||||
|         byte bb = -1; | ||||
|         bb<<=8; | ||||
|         System.out.println(bb); | ||||
|         System.out.println(l); | ||||
|         System.out.println(Byte.valueOf((byte) 0x81));  //有符号  因为0x81 会自动被java 转成byte,而byte会以补码 有符号的形式存在 | ||||
|         System.out.println(0x81);                       //无符号 | ||||
|  | ||||
|  | ||||
|         byte[] lrealBuffer = new byte[8]; | ||||
|         Number lrealNumber = new Double(-12.1); | ||||
|         byte[] bytesss = ByteUtil.numberToBytes(lrealNumber); | ||||
|         Number intNumber = new Integer(-12); | ||||
|         byte[] bytessss = ByteUtil.numberToBytes(intNumber); | ||||
|  | ||||
|         Integer s = new Integer(-999); | ||||
|         byte b = s.byteValue(); | ||||
|         System.out.println(); | ||||
|     } | ||||
|  | ||||
|     public static double bytes2Double(byte[] arr) { | ||||
|         long value = 0; | ||||
|         for (int i = 0; i < 8; i++) { | ||||
|             value |= ((long) (arr[i] & 0xff)) << (8 * i); | ||||
|         } | ||||
|         return Double.longBitsToDouble(value); | ||||
|     } | ||||
|  | ||||
|     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[]转为各种进制的字符串 | ||||
|      * @param bytes byte[] | ||||
|      * @param radix 基数可以转换进制的范围,从Character.MIN_RADIX到Character.MAX_RADIX,超出范围后变为10进制 | ||||
|      * @return 转换后的字符串 | ||||
|      */ | ||||
|     public static String binary(byte[] bytes, int radix){ | ||||
|         return new BigInteger(1, bytes).toString(radix);// 这里的1代表正数 | ||||
|     } | ||||
|  | ||||
|     public static String byteToBit(byte b) { | ||||
|         return "" | ||||
|                 + (byte) ((b >> 7) & 0x1) + (byte) ((b >> 6) & 0x1) | ||||
|                 + (byte) ((b >> 5) & 0x1) + (byte) ((b >> 4) & 0x1) +"," | ||||
|                 + (byte) ((b >> 3) & 0x1) + (byte) ((b >> 2) & 0x1) | ||||
|                 + (byte) ((b >> 1) & 0x1) + (byte) ((b >> 0) & 0x1); | ||||
|     } | ||||
|  | ||||
|     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 byte[] int2byte(int s){ | ||||
|         byte[] b = new byte[2]; | ||||
|         for(int i = 0; i < 4; i++){ | ||||
|             int offset = 16 - (i+1)*8; //因为byte占4个字节,所以要计算偏移量 | ||||
|             b[i] = (byte)((s >> offset)&0xff); //把32位分为4个8位进行分别存储 | ||||
|         } | ||||
|         return b; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public static int byte2int(byte[] b){ | ||||
|         int l = 0; | ||||
|         for (int i = 0; i < 4; i++) { | ||||
|             l<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 | ||||
|             l |= (b[i] & 0xff); //和上面也是一样的  l = l | (b[i]&0xff) | ||||
|         } | ||||
|         return l; | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * int到byte[](byte数组4个字节) | ||||
|      * @param i | ||||
|      * @return | ||||
|      */ | ||||
|     public static byte[] intToByteArray(int i) { | ||||
|         byte[] result = new byte[4]; | ||||
|         //由高位到低位 | ||||
|         result[0] = (byte)((i >> 24) & 0xFF); | ||||
|         result[1] = (byte)((i >> 16) & 0xFF); //如果查过128 那么会被java自动转成负数 | ||||
|         result[2] = (byte)((i >> 8) & 0xFF); | ||||
|         result[3] = (byte)(i & 0xFF); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 4个字节的byte[]转int | ||||
|      * @param | ||||
|      * @return | ||||
|      */ | ||||
|     public static Integer byteArrayToInt(byte[] in) { | ||||
|         byte[] bytes = new byte[4]; | ||||
|  | ||||
|         //如果传进来数组不满足4个字节,自动填充 | ||||
|         if(in.length>4){ | ||||
|             return null; | ||||
|         }else if(in.length!=4){ | ||||
|             Stack<Byte> st = new Stack<Byte>(); | ||||
|             int c = 4-in.length; | ||||
|             in = invert(in); | ||||
|             for(int i=0;i<in.length;i++){ | ||||
|                 st.push(in[i]); | ||||
|             } | ||||
|             for(int i=0;i<c;i++){ | ||||
|                 st.push(Byte.valueOf((byte) 0)); | ||||
|             } | ||||
|             for(int i=0;i<4;i++){ | ||||
|                 bytes[i] = st.pop(); | ||||
|             } | ||||
|         }else { | ||||
|             bytes = in; | ||||
|         } | ||||
|  | ||||
|         int value=0; | ||||
|         //由高位到低位 | ||||
|         for(int i = 0; i < 4; i++) { | ||||
|             int shift= (4-1-i) * 8; | ||||
|             value +=(bytes[i] & 0x000000FF) << shift;//往高位游 | ||||
|         } | ||||
|         return value; | ||||
|     } | ||||
|  | ||||
|     public static Integer byteToUSInt(byte bytes) { | ||||
|         int value=0; | ||||
|         value +=(bytes & 0xFF); | ||||
|         return value; | ||||
|     } | ||||
|     public static Integer byteToSInt(byte bytes) { | ||||
|         return Byte.valueOf(bytes).intValue(); | ||||
|     } | ||||
|  | ||||
|     public static byte[] invert(byte[] a){ | ||||
|         byte[] b = new byte[a.length]; | ||||
|         Stack<Byte> st = new Stack<Byte>(); | ||||
|         for(int i=0;i<a.length;i++){ | ||||
|             st.push(a[i]); | ||||
|         } | ||||
|         for(int i=0;i<a.length;i++){ | ||||
|             b[i] = st.pop(); | ||||
|         } | ||||
|         return b; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -1,294 +0,0 @@ | ||||
| package com.cnbm.s7.s7connector; | ||||
|  | ||||
| import java.io.UnsupportedEncodingException; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2021/12/10 10:17 | ||||
|  */ | ||||
| public class MainForRead { | ||||
|  | ||||
|     /** | ||||
|      * 将byte转换为一个长度为8的boolean数组(每bit代表一个boolean值) | ||||
|      * | ||||
|      * @param b byte, return(将数组翻转过来) | ||||
|      * @return boolean数组 | ||||
|      */ | ||||
|  | ||||
|     public static boolean[] getBooleanArray(byte b,boolean returns) { | ||||
|  | ||||
|         boolean[] array = new boolean[8]; | ||||
|  | ||||
|         for (int i = 7; i >= 0; i--) { //对于byte的每bit进行判定 | ||||
|  | ||||
|             array[i] = (b & 1) == 1; //判定byte的最后一位是否为1,若为1,则是true;否则是false | ||||
|  | ||||
|             b = (byte) (b >> 1); //将byte右移一位 | ||||
|  | ||||
|         } | ||||
|         if(returns){ | ||||
|             boolean[] array1 = new boolean[8]; | ||||
|             array1[0] = array[7]; | ||||
|             array1[1] = array[6]; | ||||
|             array1[2] = array[5]; | ||||
|             array1[3] = array[4]; | ||||
|             array1[4] = array[3]; | ||||
|             array1[5] = array[2]; | ||||
|             array1[6] = array[1]; | ||||
|             array1[7] = array[0]; | ||||
|             array = array1; | ||||
|         } | ||||
|  | ||||
|         return array; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     public static void main(String[] args) throws UnsupportedEncodingException { | ||||
|         //1000 0101 | ||||
|         //1010 0001 | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
| //    public static void main(String[] args) throws Exception { | ||||
| //        //前言: | ||||
| //        //DB3.1.1  中间那个1是byte区,后面那个1 是bit | ||||
| //        //缺陷: 不支持 DB3.1.1 | ||||
| // | ||||
| //        //Create connection | ||||
| ////        S7Connector connector = | ||||
| ////                S7ConnectorFactory | ||||
| ////                        .buildTCPConnector() | ||||
| ////                        .withHost("192.168.0.51") | ||||
| ////                        .withRack(0) //optional   rack 是机架号 | ||||
| ////                        .withSlot(0) //optional   slot 是插槽号 | ||||
| ////                        .build(); | ||||
| // | ||||
| //        S7Connector connector = S7Client.S7_1500.getConnector(); | ||||
| // | ||||
| //        //            // [0] | ||||
| ////            byte[] bool = connector.read(DaveArea.DB, 3, 1, 3266,0); | ||||
| ////            byte[] bool2 = connector.read(DaveArea.DB, 3, 1, 3266,1); | ||||
| ////            System.out.println("DB3.0-bool : " + ByteUtils.toBoolean(bool)); | ||||
| ////            System.out.println("DB3.0-bool2 : " + ByteUtils.toBoolean(bool2)); | ||||
| // | ||||
| // | ||||
| // | ||||
| //            //bool3  =>  [1]    0000  0001 ==>  1000 0000       10....... | ||||
| //            //bool3  =>  [3]    0000  0011 ==>  1100 0000       11....... | ||||
| //            //bool3  =>  [10]   0000  1010 ==>  0101 0000       0101..... | ||||
| //            //bool3  =>  [25]   0001  1001 ==>  1001 1000       10011.... | ||||
| //        byte[] bool3 = connector.read(DaveArea.DB, 3, 1, 3267); | ||||
| //        System.out.println("DB3.0-bool3 : " + ByteUtils.toBoolean(bool3)); | ||||
| // | ||||
| //        byte[] boolArrays = connector.read(DaveArea.DB, 3, 11, 3262); | ||||
| //        List<Boolean> booleans = ByteUtils.toBoolArray(boolArrays); | ||||
| //        System.out.println("DB3.830-boolArrays : " +booleans ); | ||||
| // | ||||
| //        byte[] boolArrays14 = connector.read(DaveArea.DB, 3, 16, 3264); | ||||
| //        List<Boolean> booleans14 = ByteUtils.toBoolArray(boolArrays14); | ||||
| //        System.out.println("DB3.3268-boolArrays : " +booleans14 ); | ||||
| // | ||||
| //            // | ||||
| ////            byte[] bool4 = connector.read(DaveArea.DB, 3, 1, 0); | ||||
| ////            System.out.println("DB3.0-bool3 : " + ByteUtils.toBoolean(bool3)); | ||||
| // | ||||
| //// | ||||
| //// | ||||
| ////        //非常规 | ||||
| ////        { | ||||
| ////            //注意1: | ||||
| ////            //lreal 要小端(拿到字节流要翻转一下) | ||||
| ////            //参数一:读取方式,一般默认是DB区域块 | ||||
| ////            //参数二:区域块编号 | ||||
| ////            //参数三:区域数据类型大小,int 2字节,real 4字节 | ||||
| ////            //参数四:区域偏移量 | ||||
| ////            //[-64, 40, 51, 51, 51, 51, 51, 51]    -64==0xc0(要翻转一下才能用) | ||||
| ////            //1100 0000  0010 1000  0011 0011  0011 0011  0011 0011  0011 0011  0011 0011  0011 0011 | ||||
| //// | ||||
| ////            byte[] lreal = connector.read(DaveArea.DB, 3, 8, 26,0); | ||||
| ////            System.out.println("DB3.26-lreal : "+ ByteUtils.forLReal(lreal)); | ||||
| //// | ||||
| ////            byte[] real = connector.read(DaveArea.DB, 3, 4, 22,0); | ||||
| ////            System.out.println("DB3.22-real : "+ ByteUtils.forReal(real)); | ||||
| //// | ||||
| ////        } | ||||
| // | ||||
| ////        { | ||||
| ////            //data 是有符号的双字节 | ||||
| ////            //注意2: | ||||
| ////            //[2, -38] 就就代表1990-1-1 因为这就是其实位置。 后续位置要1990+n的       D#1992-01-01 | ||||
| ////            //[4, 72]    1993-1-1 | ||||
| ////            //0000 0100  0100 1000    72+1024=1096   1990-1-1 + 1096(天) = 1993-1-1 | ||||
| ////            byte[] date = connector.read(DaveArea.DB, 3, 2, 42); | ||||
| //////            System.out.println("DB3.42-DATE : "+addDate("1990-01-01",byte2short(date))); | ||||
| ////            Long aLong = Long.valueOf(ByteUtils.toInt(date[0], date[1]).toString()); | ||||
| ////            System.out.println("DB3.42-DATE : "+ByteUtils.addDate("1990-01-01",aLong)); | ||||
| ////        } | ||||
| //// | ||||
| ////        { | ||||
| ////            //[7, -78, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0]  DTL#1970-01-01-00:00:00    1998-1-1 星期五 0.0.0.0 | ||||
| ////            //0000 0111  (1100 1110)=>(1011 0010  178)   178+256+512+1024=1970 | ||||
| ////            //(注意:第二个字节是负数要转成补码形式表示(因为在通行传输中 字节是原码形式传输的,但是java中long int byte... 都是以补码形式保存的 java帮你自动保存了其实这是不对的所以你要转换一下) 参考https://blog.csdn.net/csdn_ds/article/details/79106006) | ||||
| ////            //[7, -68, 1, 21, 2, 0, 0, 0, 0, 0, 0, 0] | ||||
| ////            //0000 0111  (1100 0100)=>(1011 1100 188)  188+256+512+1024=1980 | ||||
| ////            byte[] dtl = connector.read(DaveArea.DB, 3, 12, 44); | ||||
| ////            byte[] year = new byte[2]; | ||||
| ////            year[0] = dtl[0]; | ||||
| ////            year[1] = dtl[1]; | ||||
| ////            byte[] month = new byte[1]; | ||||
| ////            month[0] = dtl[2]; | ||||
| //////            System.out.println("DB3.12-DTL : " + byteArrayByteUtils.toUInt(year)+"-"+byteArrayByteUtils.toUInt(month)); | ||||
| ////            System.out.println("DB3.44-DTL : " + ByteUtils.toInt(year[0],year[1])+"-"+ByteUtils.toInt(month[0])); | ||||
| ////        } | ||||
| //// | ||||
| ////        { | ||||
| ////            //[59, -102, -55, -1]    T#11D_13H_46M_39S_999MS | ||||
| ////            //0011 1011 | ||||
| ////            byte[] time = connector.read(DaveArea.DB, 3, 4, 34); | ||||
| ////            System.out.println("DB3.34-time : " + ByteUtils.toInt(time[0],time[1],time[2],time[3]) +" ms"); | ||||
| ////        } | ||||
| //// | ||||
| ////        //常规 | ||||
| ////        { | ||||
| ////            // [0] | ||||
| ////            byte[] bool = connector.read(DaveArea.DB, 3, 1, 0); | ||||
| ////            System.out.println("DB3.0-bool : " + ByteUtils.toBoolean(bool)); | ||||
| //// | ||||
| ////            //todo  就像这种情况的话,这个工具就无法读取了。。。。  这个后续可以改他的源码 就是addrees(Byte/Bit)那里  后续再说好了。 | ||||
| ////            byte[] bool2 = connector.read(DaveArea.DB, 3, 1, 3266); | ||||
| ////            System.out.println("DB3.3266-bool : " + ByteUtils.toBoolean(bool2)); | ||||
| //// | ||||
| //// | ||||
| ////            //byte 目前读取以 有符号的十进制 | ||||
| ////            //[8] | ||||
| ////            //[-63] | ||||
| ////            //1011 1111 | ||||
| ////            byte[] byteOne = connector.read(DaveArea.DB, 3, 1, 1); | ||||
| ////            System.out.println("DB3.1-byteOne-有符号 : " + ByteUtils.toInt(byteOne[0]));   //有符号 整形 | ||||
| //// | ||||
| ////            System.out.println("DB3.1-byteOne-无符号 : " + ByteUtils.toUInt(byteOne[0]));  //无符号 整形 | ||||
| //// | ||||
| //// | ||||
| ////            // [0, 5]  word 可 2/8/16进制  可无符号 可有符号,就看你真没用 | ||||
| ////            byte[] word = connector.read(DaveArea.DB, 3, 2, 2); | ||||
| ////            System.out.println("DB3.2-word : " + ByteUtils.toInt(word[0],word[1])); | ||||
| //// | ||||
| ////            // [-1, -1, -1, -4] 把java自动转换成byte类型 的补码形式 ,如果电控变量是这个要问下他是无符号还是有符号的。 | ||||
| ////            // [FF, FF, FF, FC] 原码 | ||||
| ////            byte[] dword = connector.read(DaveArea.DB, 3, 4, 4); | ||||
| ////            System.out.println("DB3.4-dword : " + ByteUtils.toInt(dword[0],dword[1],dword[2],dword[3]));  //带符号的 整形 | ||||
| //// | ||||
| ////            //[11] | ||||
| ////            byte[] usint = connector.read(DaveArea.DB, 3, 1, 8); | ||||
| ////            System.out.println("DB3.8-usint : " + ByteUtils.toUInt(usint[0])); | ||||
| //// | ||||
| ////            byte[] sint = connector.read(DaveArea.DB, 3, 1, 9); | ||||
| ////            System.out.println("DB3.9-sint : " + ByteUtils.toInt(sint[0])); | ||||
| //// | ||||
| ////            byte[] uint = connector.read(DaveArea.DB, 3, 2, 10); | ||||
| ////            System.out.println("DB3.10-uint : " + ByteUtils.toUInt(uint[0],uint[1])); | ||||
| //// | ||||
| ////            //[-1, -111]  -111 | ||||
| ////            //[-1, -64]   -64 | ||||
| ////            //[-4, 25]    -999 | ||||
| ////            byte[] ints = connector.read(DaveArea.DB, 3, 2, 12); | ||||
| ////            System.out.println("DB3.12-ints : " + ByteUtils.toInt(ints[0],ints[1])); | ||||
| //// | ||||
| ////            byte[] dint = connector.read(DaveArea.DB, 3, 4, 14); | ||||
| ////            System.out.println("DB3.14-dint : " + ByteUtils.toInt(dint[0],dint[1],dint[2],dint[3])); | ||||
| //// | ||||
| ////            byte[] udint = connector.read(DaveArea.DB, 3, 4, 18); | ||||
| ////            System.out.println("DB3.18-udint : " + ByteUtils.toUInt(udint[0],udint[1],udint[2],udint[3])); | ||||
| //// | ||||
| ////            //plc 中char 是1个字节   注意char 和 wchar 都是ascii码格式的。 | ||||
| ////            byte[] chars = connector.read(DaveArea.DB, 3, 1, 58); | ||||
| ////            Character charss = ByteUtils.toChar(chars); | ||||
| ////            System.out.println("DB3.58-char : " + charss); | ||||
| ////            //plc 中wchar 是2个字节 | ||||
| ////            byte[] wchar = connector.read(DaveArea.DB, 3, 2, 60); | ||||
| ////            Character wchars =ByteUtils.toChar(wchar); | ||||
| ////            System.out.println("DB3.60-wchar : " + wchars); | ||||
| //// | ||||
| ////            //n+2 个字节 (这里的n 就是实际content的字节数 如 "123"=> n=3 ;; "@123"  ==> n=4) | ||||
| ////            //[-2, 4, 64, 65, 83, 68]  @ASD   前面-2 4两个字节就是上面的2字节 是无用的 | ||||
| ////            //-2 代表 字符串中存储最大的总字节数 ;  4代表字符数  后面跟着的 是内容(最多256个字节) | ||||
| ////            byte[] str = connector.read(DaveArea.DB, 3, 6, 62); | ||||
| ////            String string = ByteUtils.toStr(str); | ||||
| ////            System.out.println("DB3.62-str : " +string ); | ||||
| //// | ||||
| ////        } | ||||
| //// | ||||
| ////        { | ||||
| ////            try { | ||||
| ////                //byte 占用一个字节,如果是数组的话,就读取2个(要事先知道,点表规定数组长度),实际就是读取 DB3.830 | ||||
| ////                //bytes = byteLength * arrayLength     举例:1(byteLength) * 2(arrayLength) =2(bytes) | ||||
| ////                byte[] boolArrays = connector.read(DaveArea.DB, 3, 2, 830); | ||||
| ////                List<Boolean> booleans = ByteUtils.toBoolArray(boolArrays); | ||||
| ////                System.out.println("DB3.830-boolArrays : " +booleans ); | ||||
| //// | ||||
| ////                byte[] byteArrays = connector.read(DaveArea.DB, 3, 2, 832); | ||||
| ////                List<Byte> bytes = ByteUtils.toByteArray(byteArrays); | ||||
| ////                System.out.println("DB3.832-byteArrays : " +bytes ); | ||||
| //// | ||||
| ////                byte[] charArrays = connector.read(DaveArea.DB, 3, 2, 834); | ||||
| ////                List<Character> chars = ByteUtils.toCharArray(charArrays); | ||||
| ////                System.out.println("DB3.834-charArrays : " +chars ); | ||||
| //// | ||||
| ////                byte[] wordArrays = connector.read(DaveArea.DB, 3, 4, 836); | ||||
| ////                List<Integer> words = ByteUtils.toWordArray(wordArrays); | ||||
| ////                System.out.println("DB3.836-wordArrays : " +words ); | ||||
| //// | ||||
| ////                byte[] dwordArrays = connector.read(DaveArea.DB, 3, 8, 840); | ||||
| ////                List<Integer> dwords = ByteUtils.toDWordArray(dwordArrays); | ||||
| ////                System.out.println("DB3.840-dwordArrays : " +dwords ); | ||||
| //// | ||||
| ////                byte[] sintArrays = connector.read(DaveArea.DB, 3, 2, 852); | ||||
| ////                List<Integer> sints = ByteUtils.toSIntArray(sintArrays); | ||||
| ////                System.out.println("DB3.852-sintArrays : " +sints ); | ||||
| //// | ||||
| ////                byte[] intArrays = connector.read(DaveArea.DB, 3, 4, 848); | ||||
| ////                List<Integer> ints = ByteUtils.toIntArray(intArrays); | ||||
| ////                System.out.println("DB3.848-intArrays : " +ints ); | ||||
| //// | ||||
| ////                byte[] dintArrays = connector.read(DaveArea.DB, 3, 8, 854); | ||||
| ////                List<Integer> dints = ByteUtils.toDIntArray(dintArrays); | ||||
| ////                System.out.println("DB3.852-dintArrays : " +dints); | ||||
| //// | ||||
| //// | ||||
| ////                byte[] usintArrays = connector.read(DaveArea.DB, 3, 3, 3240); | ||||
| ////                List<Integer> usints = ByteUtils.toUSIntArray(usintArrays); | ||||
| ////                System.out.println("DB3.3240-usintArrays : " +usints ); | ||||
| //// | ||||
| ////                byte[] uintArrays = connector.read(DaveArea.DB, 3, 6, 3256); | ||||
| ////                List<Integer> uints = ByteUtils.toUIntArray(uintArrays); | ||||
| ////                System.out.println("DB3.3256-uintArrays : " +uints ); | ||||
| //// | ||||
| ////                byte[] udintArrays = connector.read(DaveArea.DB, 3, 12, 3244); | ||||
| ////                List<Long> udints = ByteUtils.toUDIntArray(udintArrays); | ||||
| ////                System.out.println("DB3.852-udintArrays : " +udints); | ||||
| ////            }catch (Exception e){ | ||||
| ////                e.printStackTrace(); | ||||
| ////            } | ||||
| //// | ||||
| ////        }; | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| // | ||||
| //        //Write to DB100 10 bytes | ||||
| // | ||||
| // | ||||
| // | ||||
| //        //connector.write(DaveArea.DB, 3, 830, byteArrays); | ||||
| // | ||||
| //        //Close connection | ||||
| // | ||||
| //        //connector.close(); | ||||
| //    } | ||||
| // | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -1,70 +0,0 @@ | ||||
| package com.cnbm.s7.s7connector; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.api.S7Connector; | ||||
| import com.cnbm.s7.s7connector.api.utils.ByteUtils; | ||||
| import com.cnbm.s7.s7connector.enmuc.S7Client; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2021/12/10 10:17 | ||||
|  */ | ||||
| public class MainForReadDemo { | ||||
|     public static void main(String[] args) throws Exception { | ||||
|  | ||||
| //        //1200 部分 | ||||
| //        S7Connector connector1200 = S7Client.S7_1200.getConnector(); | ||||
| // | ||||
| //        byte[] bool3_1200 = connector1200.read(DaveArea.DB, 1, 1, 0); | ||||
| //        System.out.println("DB1-bool3_1200 : " + ByteUtils.toBoolean(bool3_1200)); | ||||
| ////        byte[] bool4_1200 = connector1200.read(DaveArea.DB, 3, 1, 3267,5,PlcVar.BOOL.getTransportSize()); | ||||
| ////        System.out.println("DB1-bool4_1200 : " + ByteUtils.toBoolean(bool4_1200)); | ||||
|  | ||||
|         //1500 部分 | ||||
|         S7Connector connector1500 = S7Client.S7_1500.getConnector(); | ||||
| //        byte[] bool11 = connector1500.read(DaveArea.DB, 3, 1, 3267); | ||||
| //        //30110012105301115 | ||||
| //        //[18, 17, 51, 48, 49, 49, 48, 48, 49, 50, 49, 48, 53, 51, 48, 49, 49, 49, 53, 0] | ||||
| //        //          3   0 | ||||
| //        byte[] str1500 = connector1500.read(DaveArea.DB, 3, 20, 3270); | ||||
| //        byte[] str15001 = connector1500.read(DaveArea.DB, 3, 20, 3290); | ||||
| //        byte[] bool1 = connector1500.read(DaveArea.DB, 3, 1, 3267,4, PlcVar.BOOL.getTransportSize()); | ||||
| //        String str1500s = ByteUtils.toStr(str1500); | ||||
| //        System.out.println("DB3.0-str1500 : " + str1500s); | ||||
| //        System.out.println("DB3.0-bool1 : " + ByteUtils.toBoolean(bool1)); | ||||
|  | ||||
|  | ||||
|  | ||||
|         //String | ||||
|         //write | ||||
|         String one = "12111"; | ||||
|         byte[] bytes1 = ByteUtils.strToBytes(one, 18); | ||||
|         connector1500.write(DaveArea.DB,3,3270,bytes1); | ||||
|  | ||||
|         //read | ||||
|         byte[] str_1500 = connector1500.read(DaveArea.DB, 3, 20, 3270); | ||||
|         String string = ByteUtils.toStr(str_1500); | ||||
|         System.out.println(string); | ||||
|  | ||||
|  | ||||
|         //StringArray | ||||
|         //write | ||||
|         String[] src = new String[3]; | ||||
|         src[0]= "1"; | ||||
|         src[1]= "30110012105301117222"; | ||||
|         src[2]= "3"; | ||||
|         byte[] bytes = ByteUtils.strArrayToBytes(src, 18); | ||||
|         connector1500.write(DaveArea.DB,3,3270,bytes); | ||||
|  | ||||
|         //read | ||||
|         byte[] strList_1500 = connector1500.read(DaveArea.DB, 3, 60, 3270); | ||||
|         String[] strings = ByteUtils.toStrArray(strList_1500, 3, 18); | ||||
|         System.out.println(strings); | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -1,391 +0,0 @@ | ||||
| package com.cnbm.s7.s7connector; | ||||
|  | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.api.S7Connector; | ||||
| import com.cnbm.s7.s7connector.api.factory.S7ConnectorFactory; | ||||
| import com.cnbm.s7.s7connector.api.utils.ByteUtils; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|  | ||||
| import java.io.ByteArrayOutputStream; | ||||
| import java.io.IOException; | ||||
| import java.text.ParseException; | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * @Desc: "" | ||||
|  * @Author: caixiang | ||||
|  * @DATE: 2021/12/10 10:17 | ||||
|  */ | ||||
| public class MainForWrite { | ||||
|     public static void main(String[] args) throws Exception { | ||||
|         //Create connection | ||||
|         S7Connector connector = | ||||
|                 S7ConnectorFactory | ||||
|                         .buildTCPConnector() | ||||
|                         .withHost("192.168.0.51") | ||||
|                         .withRack(0) //optional     rack 是机架号 | ||||
|                         .withSlot(0) //optional     slot 是插槽号 | ||||
|                         .build(); | ||||
|  | ||||
|  | ||||
|         { | ||||
|             connector.write(DaveArea.DB, 3, 3266,1,ByteUtils.boolToBytes(true), PlcVar.BOOL); | ||||
| //            byte[] bool = connector.read(DaveArea.DB, 3, 1, 3266,1); | ||||
| //            Boolean b = (Boolean)PlcVar.BOOL.toObject(bool); | ||||
| //            System.out.println("DB3.3266.1-boolean : " + b); | ||||
|  | ||||
|         } | ||||
|  | ||||
|  | ||||
|         //非常规 | ||||
|         { | ||||
|             //注意1: | ||||
|             //lreal 要小端(拿到字节流要翻转一下) | ||||
|             //参数一:读取方式,一般默认是DB区域块 | ||||
|             //参数二:区域块编号 | ||||
|             //参数三:区域数据类型大小,int 2字节,real 4字节 | ||||
|             //参数四:区域偏移量 | ||||
|             //[-64, 40, 51, 51, 51, 51, 51, 51]    -64==0xc0(要翻转一下才能用) | ||||
|             //1100 0000  0010 1000  0011 0011  0011 0011  0011 0011  0011 0011  0011 0011  0011 0011 | ||||
|  | ||||
|  | ||||
|  | ||||
| //            byte[] lreal_content = ByteUtils.lrealToBytes(Double.parseDouble("-111.1")); | ||||
|             byte[] lreal_content = PlcVar.LREAL.toBytes(-121.1); | ||||
|             connector.write(DaveArea.DB, 3, 26,lreal_content); | ||||
|             byte[] lreal = connector.read(DaveArea.DB, 3, 8, 26); | ||||
| //            Double aDouble = ByteUtils.lrealbytesToDouble(lreal); | ||||
|             Double ad = (Double)PlcVar.LREAL.toObject(lreal); | ||||
|             System.out.println("DB3.26-lreal : "+ ad); | ||||
|  | ||||
|             //byte[] real_content = ByteUtils.realToBytes(Float.valueOf("-11.2")); | ||||
|             byte[] real_content = PlcVar.REAL.toBytes(-12.1); | ||||
|             connector.write(DaveArea.DB, 3, 22,real_content); | ||||
|             byte[] real = connector.read(DaveArea.DB, 3, 4, 22); | ||||
|             //ByteUtils.realbytesToFloat(real) | ||||
|             Float o = (Float)PlcVar.REAL.toObject(real); | ||||
|             System.out.println("DB3.22-real : "+ o); | ||||
|  | ||||
|         } | ||||
|  | ||||
|         { | ||||
|  | ||||
|             //data 是有符号的双字节 | ||||
|             //注意2: | ||||
|             //[2, -38] 就就代表1990-1-1 因为这就是其实位置。 后续位置要1990+n的       D#1992-01-01 | ||||
|             //[4, 72]    1993-1-1 | ||||
|             //0000 0100  0100 1000    72+1024=1096   1990-1-1 + 1096(天) = 1993-1-1 | ||||
|             byte[] date = connector.read(DaveArea.DB, 3, 2, 42); | ||||
| //            System.out.println("DB3.42-DATE : "+addDate("1990-01-01",byte2short(date))); | ||||
| //            Long aLong = Long.valueOf(ByteUtils.toInt(date[0], date[1]).toString()); | ||||
| //            String s = ByteUtils.addDate("1990-01-01", aLong); | ||||
|             String s = (String) PlcVar.DATE.toObject(date); | ||||
|             System.out.println("DB3.42-DATE : "+s); | ||||
|         } | ||||
|  | ||||
|         { | ||||
|             //[7, -78, 1, 1, 5, 0, 0, 0, 0, 0, 0, 0]  DTL#1970-01-01-00:00:00    1998-1-1 星期五 0.0.0.0 | ||||
|             //0000 0111  (1100 1110)=>(1011 0010  178)   178+256+512+1024=1970 | ||||
|             //(注意:第二个字节是负数要转成补码形式表示(因为在通行传输中 字节是原码形式传输的,但是java中long int byte... 都是以补码形式保存的 java帮你自动保存了其实这是不对的所以你要转换一下) 参考https://blog.csdn.net/csdn_ds/article/details/79106006) | ||||
|             //[7, -68, 1, 21, 2, 0, 0, 0, 0, 0, 0, 0] | ||||
|             //0000 0111  (1100 0100)=>(1011 1100 188)  188+256+512+1024=1980 | ||||
|             byte[] dtl = connector.read(DaveArea.DB, 3, 12, 44); | ||||
| //            byte[] year = new byte[2]; | ||||
| //            year[0] = dtl[0]; | ||||
| //            year[1] = dtl[1]; | ||||
| //            Integer yearInt = ByteUtils.toInt(year[0], year[1]); | ||||
| //            Integer monthInt = ByteUtils.toInt(dtl[2]); | ||||
| //            Integer dayInt = ByteUtils.toInt(dtl[3]); | ||||
| //            Integer worddayInt = ByteUtils.toInt(dtl[4]); | ||||
| //            Integer hourInt = ByteUtils.toInt(dtl[5]); | ||||
| //            Integer minuInt = ByteUtils.toInt(dtl[6]); | ||||
| //            Integer secondInt = ByteUtils.toInt(dtl[7]); | ||||
|  | ||||
|  | ||||
| //            System.out.println("DB3.12-DTL : " + byteArrayByteUtils.toUInt(year)+"-"+byteArrayByteUtils.toUInt(month)); | ||||
|             String o = (String)PlcVar.DTL.toObject(dtl); | ||||
|             System.out.println("DB3.44-DTL : " + o ); | ||||
|         } | ||||
|  | ||||
|         { | ||||
|             //[59, -102, -55, -1]    T#11D_13H_46M_39S_999MS | ||||
|             //0011 1011 | ||||
|             byte[] time = connector.read(DaveArea.DB, 3, 4, 34); | ||||
| //            Integer integer = ByteUtils.toInt(time[0], time[1], time[2], time[3]); | ||||
|             Integer i = (Integer) PlcVar.TIME.toObject(time); | ||||
|             System.out.println("DB3.34-time : " + i +" ms"); | ||||
|         } | ||||
|  | ||||
|         //常规 | ||||
|  | ||||
|         //int 相关(sint、int、dint 。。 usint、uint、udint) | ||||
|         { | ||||
|             //[11]   //[9] ==>2304 | ||||
| //            byte[] usint_content = ByteUtils.usintToBytes(9); | ||||
|  | ||||
|             byte[] usint_content = PlcVar.USINT.toBytes(9); | ||||
|             connector.write(DaveArea.DB, 3, 8,usint_content); | ||||
|             byte[] usint = connector.read(DaveArea.DB, 3, 1, 8); | ||||
| //            Integer integer = ByteUtils.toUInt(usint[0]); | ||||
|             Integer integer = (Integer) PlcVar.USINT.toObject(usint); | ||||
|             System.out.println("DB3.8-usint : " + integer); | ||||
|  | ||||
| //            byte[] bytes = ByteUtils.sintToBytes(-9); | ||||
|             byte[] bytes = PlcVar.SINT.toBytes(-9); | ||||
|             connector.write(DaveArea.DB, 3, 9,bytes); | ||||
|             byte[] sint = connector.read(DaveArea.DB, 3, 1, 9); | ||||
| //            Integer integer1 = ByteUtils.toInt(sint[0]); | ||||
|             Integer integer1 = (Integer) PlcVar.SINT.toObject(usint); | ||||
|             System.out.println("DB3.9-sint : " + integer1); | ||||
|  | ||||
| //            byte[] unit_content = ByteUtils.uintToBytes(9); | ||||
|             byte[] unit_content = PlcVar.UINT.toBytes(9); | ||||
|             connector.write(DaveArea.DB, 3, 10,unit_content); | ||||
|             byte[] uint = connector.read(DaveArea.DB, 3, 2, 10); | ||||
|             System.out.println("DB3.10-uint : " + ByteUtils.toUInt(uint[0],uint[1])); | ||||
|  | ||||
|             //[-1, -111]  -111 | ||||
|             //[-1, -64]   -64 | ||||
|             //[-4, 25]    -999 | ||||
|             //byte[] bytes1 = ByteUtils.intToBytes(-99); | ||||
|             byte[] bytes1 = PlcVar.INT.toBytes(-99); | ||||
|             connector.write(DaveArea.DB, 3, 12,bytes1); | ||||
|             byte[] ints = connector.read(DaveArea.DB, 3, 2, 12); | ||||
|             System.out.println("DB3.12-ints : " + ByteUtils.toInt(ints[0],ints[1])); | ||||
|  | ||||
|  | ||||
| //            byte[] bytes2 = ByteUtils.dintToBytes(-999); | ||||
|             byte[] bytes2 = PlcVar.DINT.toBytes(-999); | ||||
|             connector.write(DaveArea.DB, 3, 14,bytes2); | ||||
|             byte[] dint = connector.read(DaveArea.DB, 3, 4, 14); | ||||
|             System.out.println("DB3.14-dint : " + ByteUtils.toInt(dint[0],dint[1],dint[2],dint[3])); | ||||
|  | ||||
| //            byte[] bytes3 = ByteUtils.udintToBytes(99); | ||||
|  | ||||
|             byte[] bytes3 = PlcVar.UDINT.toBytes(99); | ||||
|             connector.write(DaveArea.DB, 3, 18,bytes3); | ||||
|             byte[] udint = connector.read(DaveArea.DB, 3, 4, 18); | ||||
|             System.out.println("DB3.18-udint : " + ByteUtils.toUInt(udint[0],udint[1],udint[2],udint[3])); | ||||
|  | ||||
|         } | ||||
|  | ||||
|         { | ||||
|             // [0] | ||||
| //            byte[] bytes = ByteUtils.boolToBytes(false); | ||||
|             byte[] bytes = PlcVar.BOOL.toBytes(false); | ||||
|             connector.write(DaveArea.DB, 3, 0,bytes); | ||||
|             byte[] bool = connector.read(DaveArea.DB, 3, 1, 0); | ||||
|             System.out.println("DB3.0-boolean : " + ByteUtils.toBoolean(bool)); | ||||
|  | ||||
|             //byte 目前读取以 有符号的十进制 | ||||
|             //[8] | ||||
|             //[-63] | ||||
|             //1011 1111 | ||||
| //            byte[] setbytes = ByteUtils.setbytes(Byte.valueOf((byte) 0xFF)); | ||||
|             byte[] setbytes = PlcVar.BYTE.toBytes((byte)0xFF); | ||||
|             connector.write(DaveArea.DB, 3, 1,setbytes); | ||||
|             byte[] byteOne = connector.read(DaveArea.DB, 3, 1, 1); | ||||
|             System.out.println("DB3.1-byteOne-有符号 : " + ByteUtils.toInt(byteOne[0]));   //有符号 整形 | ||||
|             System.out.println("DB3.1-byteOne-无符号 : " + ByteUtils.toUInt(byteOne[0]));  //无符号 整形 | ||||
|  | ||||
|  | ||||
|             // [0, 5]  word 可 2/8/16进制  可无符号 可有符号,就看你真没用 | ||||
| //            byte[] bytes1 = ByteUtils.wordToBytes(Short.valueOf("-55")); | ||||
|             byte[] bytes1 = PlcVar.WORD.toBytes(-55); | ||||
|             connector.write(DaveArea.DB, 3, 2,bytes1); | ||||
|             byte[] word = connector.read(DaveArea.DB, 3, 2, 2); | ||||
|             System.out.println("DB3.2-word : " + ByteUtils.toInt(word[0],word[1])); | ||||
|  | ||||
|             // [-1, -1, -1, -4] 把java自动转换成byte类型 的补码形式 ,如果电控变量是这个要问下他是无符号还是有符号的。 | ||||
|             // [FF, FF, FF, FC] 原码 | ||||
|             byte[] bytes2 = PlcVar.DWORD.toBytes(-99); | ||||
|             connector.write(DaveArea.DB, 3, 4,bytes2); | ||||
|             byte[] dword = connector.read(DaveArea.DB, 3, 4, 4); | ||||
|             System.out.println("DB3.4-dword : " + ByteUtils.toInt(dword[0],dword[1],dword[2],dword[3]));  //带符号的 整形 | ||||
|  | ||||
|  | ||||
|             //plc 中char 是1个字节   注意char 和 wchar 都是ascii码格式的。 | ||||
| //            byte[] bytes3 = ByteUtils.charToBytes('b'); | ||||
|             byte[] bytes3 = PlcVar.CHAR.toBytes('b'); | ||||
|             connector.write(DaveArea.DB, 3, 58,bytes3); | ||||
|             byte[] chars = connector.read(DaveArea.DB, 3, 1, 58); | ||||
|             System.out.println("DB3.58-char : " + ByteUtils.toChar(chars)); | ||||
|  | ||||
|             //plc 中wchar 是2个字节    '菜' =》[-125, -36] | ||||
| //            byte[] bytes4 = ByteUtils.wcharToBytes('菜'); | ||||
|             byte[] bytes4 = PlcVar.WCHAR.toBytes('翔'); | ||||
|             connector.write(DaveArea.DB, 3, 60,bytes4); | ||||
|             byte[] wchar = connector.read(DaveArea.DB, 3, 2, 60); | ||||
|             System.out.println("DB3.60-wchar : " + ByteUtils.toChar(wchar)); | ||||
|  | ||||
|             //n+2 个字节 (这里的n 就是实际content的字节数 如 "123"=> n=3 ;; "@123"  ==> n=4) | ||||
|             //[-2, 4, 64, 65, 83, 68]  @ASD   前面-2 4两个字节就是上面的2字节 是无用的 | ||||
|             //-2 代表 字符串中存储最大的总字节数 ;  4代表字符数  后面跟着的 是内容(最多256个字节) | ||||
|  | ||||
|             //[-2, 4, 64, 65, 83, 68]  @ASD | ||||
|             //[-2, 4, 64, 64, 64, 64]  @ASD | ||||
|             //读取字符串 要事先知道长度,否则可能读取的字符串长度不完整 | ||||
|             String s = "你好啊呢"; | ||||
| //            byte[] str_content = ByteUtils.strToBytes(s); | ||||
| //            byte[] str_content = PlcVar.STRING.toBytes(s); | ||||
| //            connector.write(DaveArea.DB, 3, 62 , str_content); | ||||
|             //byte[] str = connector.read(DaveArea.DB, 3, str_content.length, 62); | ||||
|             //[-2, 6, -60, -29, -70, -61] | ||||
|             //[-2, 8, -53, -58, -75, -60] | ||||
|             byte[] str = connector.read(DaveArea.DB, 3, 10, 62); | ||||
|             String string = ByteUtils.toStr(str); | ||||
|             System.out.println("DB3.62-str : " +string ); | ||||
|             //下面这种方式读取字符串,,是指定长度的, | ||||
|             //byte[] str2 = connector.read(DaveArea.DB, 3, 7, 62); | ||||
|  | ||||
|         } | ||||
|  | ||||
|         { | ||||
|             //byte 占用一个字节,如果是数组的话,就读取2个(要事先知道,点表规定数组长度),实际就是读取 DB3.830 | ||||
|             //bytes = byteLength * arrayLength     举例:1(byteLength) * 2(arrayLength) =2(bytes) | ||||
|             boolean[] booleanArray = new boolean[2]; | ||||
|             booleanArray[0] = true; | ||||
|             booleanArray[1] = true; | ||||
| //            byte[] bytes1 = ByteUtils.booleanArrayToBytes(booleanArray); | ||||
|             byte[] bytes1 = PlcVar.BOOL_Array.toBytes(booleanArray); | ||||
|             connector.write(DaveArea.DB, 3, 830 , bytes1); | ||||
|             byte[] boolArrays = connector.read(DaveArea.DB, 3, 2, 830); | ||||
| //            List<Boolean> booleans = ByteUtils.toBoolArray(boolArrays); | ||||
|             List<Boolean> booleans = (List<Boolean>) PlcVar.BOOL_Array.toObject(boolArrays); | ||||
|             System.out.println("DB3.830-boolArrays : " +booleans ); | ||||
|  | ||||
|  | ||||
|             //注意 write的长度,要和plc中定义的长度要一致 | ||||
|             byte[] write_byteArrays = new byte[2]; | ||||
|             write_byteArrays[0] = 1; | ||||
|             write_byteArrays[1] = 2; | ||||
|             byte[] bytes2 = PlcVar.BYTE_Array.toBytes(write_byteArrays); | ||||
|             connector.write(DaveArea.DB, 3, 832 , bytes2); | ||||
|             byte[] byteArrays = connector.read(DaveArea.DB, 3, 2, 832); | ||||
| //            List<Byte> bytes = ByteUtils.toByteArray(byteArrays); | ||||
|             List<Byte> bytes = (List<Byte>) PlcVar.BYTE_Array.toObject(boolArrays); | ||||
|             System.out.println("DB3.832-byteArrays : " +bytes ); | ||||
|  | ||||
|  | ||||
|             short[] shortArrays_content = new short[2]; | ||||
|             shortArrays_content[0] = 1; | ||||
|             shortArrays_content[1] = -1; | ||||
| //            byte[] bytes4 = ByteUtils.wordArrayToBytes(shortArrays_content); | ||||
|             byte[] bytes4 = PlcVar.WORD_Array.toBytes(shortArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 836 ,bytes4); | ||||
|             byte[] wordArrays = connector.read(DaveArea.DB, 3, 4, 836); | ||||
|             List<Integer> words = ByteUtils.toWordArray(wordArrays); | ||||
|             System.out.println("DB3.836-wordArrays : " +words ); | ||||
|  | ||||
|             int[] intArrays_content = new int[2]; | ||||
|             intArrays_content[0] = 1; | ||||
|             intArrays_content[1] = -1; | ||||
| //            byte[] bytes5 = ByteUtils.dwordArrayToBytes(intArrays_content); | ||||
|             byte[] bytes5 = PlcVar.DWORD_Array.toBytes(intArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 840 ,bytes5); | ||||
|             byte[] dwordArrays = connector.read(DaveArea.DB, 3, 8, 840); | ||||
|             List<Integer> dwords = ByteUtils.toDWordArray(dwordArrays); | ||||
|             System.out.println("DB3.840-dwordArrays : " +dwords ); | ||||
|  | ||||
|  | ||||
|             char[] charArrays_content = new char[2]; | ||||
|             charArrays_content[0] = '1'; | ||||
|             charArrays_content[1] = 'b'; | ||||
| //            byte[] bytes3 = ByteUtils.charArrayToBytes(charArrays_content); | ||||
|             byte[] bytes3 = PlcVar.CHAR_Array.toBytes(charArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 834 ,bytes3); | ||||
|             byte[] charArrays = connector.read(DaveArea.DB, 3, 2, 834); | ||||
|             List<Character> chars = ByteUtils.toCharArray(charArrays); | ||||
|             System.out.println("DB3.834-charArrays : " +chars ); | ||||
|  | ||||
|  | ||||
|             int[] sintArrays_content = new int[2]; | ||||
|             sintArrays_content[0] = 1; | ||||
|             sintArrays_content[1] = -1; | ||||
| //            byte[] bytes6 = ByteUtils.sintArrayToBytes(sintArrays_content); | ||||
|             byte[] bytes6 = PlcVar.SINT_Array.toBytes(sintArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 852 ,bytes6); | ||||
|             byte[] sintArrays = connector.read(DaveArea.DB, 3, 2, 852); | ||||
|             List<Integer> sints = ByteUtils.toSIntArray(sintArrays); | ||||
|             System.out.println("DB3.852-sintArrays : " +sints ); | ||||
|  | ||||
|  | ||||
|             int[] iintArrays_content = new int[2]; | ||||
|             iintArrays_content[0] = 12; | ||||
|             iintArrays_content[1] = -21; | ||||
| //            byte[] bytes7 = ByteUtils.intArrayToBytes(iintArrays_content); | ||||
|             byte[] bytes7 = PlcVar.INT_Array.toBytes(iintArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 848 ,bytes7); | ||||
|             byte[] intArrays = connector.read(DaveArea.DB, 3, 4, 848); | ||||
|             List<Integer> ints = ByteUtils.toIntArray(intArrays); | ||||
|             System.out.println("DB3.848-intArrays : " +ints ); | ||||
|  | ||||
|  | ||||
|             //todo here | ||||
|             int[] dintArrays_content = new int[2]; | ||||
|             dintArrays_content[0] = 12; | ||||
|             dintArrays_content[1] = -21; | ||||
|             //ByteUtils.dintArrayToBytes(dintArrays_content) | ||||
|             byte[] bytes11 =PlcVar.DINT_Array.toBytes(dintArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 854 ,bytes11); | ||||
|             byte[] dintArrays = connector.read(DaveArea.DB, 3, 8, 854); | ||||
|             List<Integer> dints = ByteUtils.toDIntArray(dintArrays); | ||||
|             System.out.println("DB3.852-dintArrays : " +dints); | ||||
|  | ||||
|  | ||||
|             int[] uintArrays_content = new int[3]; | ||||
|             uintArrays_content[0] = 12; | ||||
|             uintArrays_content[1] = 99; | ||||
|             uintArrays_content[2] = 1; | ||||
|             //byte[] bytes9 = ByteUtils.uintArrayToBytes(uintArrays_content); | ||||
|             byte[] bytes9 = PlcVar.UINT_Array.toBytes(uintArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 3256 ,bytes9); | ||||
|             byte[] uintArrays = connector.read(DaveArea.DB, 3, 6, 3256); | ||||
|             List<Integer> uints = ByteUtils.toUIntArray(uintArrays); | ||||
|             System.out.println("DB3.3256-uintArrays : " +uints ); | ||||
|  | ||||
|  | ||||
|  | ||||
|             int[] usintArrays_content = new int[3]; | ||||
|             usintArrays_content[0] = 12; | ||||
|             usintArrays_content[1] = 99; | ||||
|             usintArrays_content[2] = 1; | ||||
| //            byte[] bytes8 = ByteUtils.usintArrayToBytes(usintArrays_content); | ||||
|             byte[] bytes8 = PlcVar.USINT_Array.toBytes(usintArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 3240 ,bytes8); | ||||
|             byte[] usintArrays = connector.read(DaveArea.DB, 3, 3, 3240); | ||||
|             List<Integer> usints = ByteUtils.toUSIntArray(usintArrays); | ||||
|             System.out.println("DB3.3240-usintArrays : " +usints ); | ||||
|  | ||||
|  | ||||
|             int[] udintArrays_content = new int[3]; | ||||
|             udintArrays_content[0] = 12; | ||||
|             udintArrays_content[1] = 99; | ||||
|             udintArrays_content[2] = 1; | ||||
| //            byte[] bytes10 = ByteUtils.udintArrayToBytes(udintArrays_content); | ||||
|             byte[] bytes10 = PlcVar.UDINT_Array.toBytes(udintArrays_content); | ||||
|             connector.write(DaveArea.DB, 3, 3244 ,bytes10); | ||||
|             byte[] udintArrays = connector.read(DaveArea.DB, 3, 12, 3244); | ||||
|             List<Long> udints = ByteUtils.toUDIntArray(udintArrays); | ||||
|             System.out.println("DB3.852-udintArrays : " +udints); | ||||
|  | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|         //Write to DB100 10 bytes | ||||
|  | ||||
|  | ||||
|  | ||||
|         //connector.write(DaveArea.DB, 3, 830, byteArrays); | ||||
|  | ||||
|         //Close connection | ||||
|         connector.close(); | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -25,8 +25,9 @@ public enum S7Client { | ||||
|     //TODO 步骤1  这里是配置多PLC 的,,,有多个plc 就在这里配置一个枚举类 | ||||
|     //1500    西门子200smart、1200、1500默认的 机架号=0  槽位号=1;  300/400 默认的  机架-0  插槽-2 | ||||
| //    S7_1200("192.168.0.52",0,1,1,PlcVarActual.HeartBeatFor1200), | ||||
|     S7_15001("192.168.0.51",0,1,1), | ||||
|     S7_1500("192.168.0.51",0,1,1), | ||||
| //    S7_15001("192.168.0.51",0,1,1), | ||||
| //    S7_1500("192.168.0.51",0,1,1), | ||||
|     S7_KUKA("10.10.3.158",0,1,1), | ||||
|     //1500  机架-0  插槽-1 | ||||
|     //后续 在这里扩展 多PLC应用。 | ||||
|     ; | ||||
|   | ||||
| @@ -15,11 +15,9 @@ limitations under the License. | ||||
| */ | ||||
| package com.cnbm.s7.s7connector.impl; | ||||
|  | ||||
| import com.cnbm.s7.controller.S7DemoController; | ||||
| import com.cnbm.s7.s7connector.api.DaveArea; | ||||
| import com.cnbm.s7.s7connector.api.S7Connector; | ||||
| import com.cnbm.s7.s7connector.exception.S7CheckResultException; | ||||
| import com.cnbm.s7.s7connector.exception.S7Exception; | ||||
| import com.cnbm.s7.s7connector.impl.nodave.Nodave; | ||||
| import com.cnbm.s7.s7connector.impl.nodave.S7Connection; | ||||
| import com.cnbm.s7.s7connector.type.PlcVar; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user