这个提交包含在:
caixiang 2023-02-24 14:21:25 +08:00
父节点 6e08ff6482
当前提交 cdc06bd733
共有 6 个文件被更改,包括 553 次插入200 次删除

查看文件

@ -65,4 +65,10 @@ dynamic:
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
password: 1qaz@WSX3edc$RFV
camline:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.0.1.23:3306/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: offline_data
password: tpvmfab4

查看文件

@ -0,0 +1,323 @@
<?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" />
<!--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-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>
<!-- 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>-->
<!-- &lt;!&ndash;日志文档保留天数&ndash;&gt;-->
<!-- <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>
<!-- 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>-->
<!-- &lt;!&ndash;日志文档保留天数&ndash;&gt;-->
<!-- <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>
<!--
<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.packing.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>
<!-- 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>

查看文件

@ -1,24 +1,54 @@
package com.cnbm.packing.controller;
import com.cnbm.common.constant.Constant;
import com.cnbm.packing.service.DynamicDataSourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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.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);
@Autowired
DynamicDataSourceService service;
@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("get2")
public Result<Integer> get2(){
return new Result<Integer>().ok(2);
@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);

查看文件

@ -25,6 +25,7 @@ import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@ -157,199 +158,190 @@ public class KukaJoinThread implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
// kukaStep1.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
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);
//
// //. 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);
// logger.info("采集到的基板id : "+subId);
// logger.info("================= 过程一 任务成功完成 ==================");
// logger.info("");
//
//
// }
// },1,1, TimeUnit.SECONDS);
//
//
// kukaStep2.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// logger.info("");
// logger.info("================= 现在开始执行 过程二 任务 ==================");
// 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);
//
//
// //. MES 业务
// //=============== MES 业务 开始 =================
// //1.MES 生成BoxId
// if(subIdList.length<=0){
// logger.info("失败"+" --- "+"从plc里面获取到的基板列表 为空");
// }
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
// String boxId = getBoxId(bySubId.getSapMaterial());
// //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);
// logger.info("================= 过程二 任务成功完成 ==================");
// logger.info("");
//
// }
// },1,1, TimeUnit.SECONDS);
//
//
// kukaStep3.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// logger.info("");
// logger.info("================= 现在开始执行 过程三 任务 ==================");
// 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);
//
//
// //. 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);
// logger.info("================= 过程三 任务成功完成 ==================");
// logger.info("");
//
// }
// },1,1, TimeUnit.SECONDS);
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);
}

查看文件

@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Arrays;
/**
@ -17,6 +18,7 @@ import java.time.LocalDateTime;
@Data
@ApiModel(value = "camline 查询对象")
public class CamlineExtendArgDTO implements Serializable {
private static final long serialVersionUID = 1L;
private LocalDateTime lastUpdateTime;