yanyang #10
@ -11,16 +11,16 @@ steps:
|
|||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
path: /root/.docker
|
path: /root/.docker
|
||||||
commands:
|
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
|
- name: deploy
|
||||||
image: harbor.picaiba.com/tools/kubectl
|
image: harbor.picaiba.com/tools/kubectl
|
||||||
commands:
|
commands:
|
||||||
- echo "172.27.0.20 lb.kubesphere.local" >> /etc/hosts
|
- echo "172.27.0.20 lb.kubesphere.local" >> /etc/hosts
|
||||||
- sleep 1
|
- sleep 1
|
||||||
- kubectl scale --replicas=0 deployment/mes-api -n mes-india
|
- kubectl scale --replicas=0 deployment/mes-api -n mes-cigs4
|
||||||
- sleep 3
|
- sleep 3
|
||||||
- kubectl scale --replicas=1 deployment/mes-api -n mes-india
|
- kubectl scale --replicas=1 deployment/mes-api -n mes-cigs4
|
||||||
depends_on:
|
depends_on:
|
||||||
- build
|
- build
|
||||||
|
|
||||||
@ -34,6 +34,6 @@ volumes:
|
|||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- porject/yd-monitor
|
- master
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
@ -49,7 +49,7 @@ ENV TZ="Asia/Shanghai"
|
|||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
# 定义一些环境变量,方便环境变量传参
|
# 定义一些环境变量,方便环境变量传参
|
||||||
ENV JVM_OPTS=""
|
ENV JVM_OPTS=""
|
||||||
ENV JAVA_OPTS="-Dspring.profiles.active=dev"
|
ENV JAVA_OPTS=""
|
||||||
# 指定暴露的端口,起到说明的作用,不指定也会暴露对应端口
|
# 指定暴露的端口,起到说明的作用,不指定也会暴露对应端口
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
# 启动 jar 的命令
|
# 启动 jar 的命令
|
||||||
|
@ -7,6 +7,10 @@ import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar;
|
|||||||
import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar;
|
import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar;
|
||||||
import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
|
import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
|
||||||
import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar;
|
import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar;
|
||||||
|
import com.cnbm.packing.dto.CamlineExtendArgDTO;
|
||||||
|
import com.cnbm.packing.entity.WoPackagingBox;
|
||||||
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
||||||
|
import com.cnbm.packing.entity.WoPowerLevel;
|
||||||
import com.cnbm.packing.service.*;
|
import com.cnbm.packing.service.*;
|
||||||
import com.cnbm.s7.s7connector.enmuc.S7Client;
|
import com.cnbm.s7.s7connector.enmuc.S7Client;
|
||||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||||
@ -18,6 +22,8 @@ import org.springframework.boot.ApplicationRunner;
|
|||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
@ -153,196 +159,188 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
kukaStep1.scheduleAtFixedRate(new Runnable() {
|
kukaStep1.scheduleAtFixedRate(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
logger.info("================= 现在开始执行 过程一 任务 ==================");
|
//调度开始
|
||||||
|
// 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());
|
||||||
|
logger.info("采集到 基板ID: "+subId+", 线边号:"+lineNum+",dLable_Pnom: "+argByPMPP.getPowerClass() +",dLable_Voc: "+argByPMPP.getLableVoc()+",dLable_Isc: "+argByPMPP.getLableIsc()+",dLable_Vmpp: "+argByPMPP.getLableVmpp()+",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);
|
},1,1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
|
||||||
|
kukaStep2.scheduleAtFixedRate(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//调度开始
|
||||||
|
|
||||||
// kukaStep1.scheduleAtFixedRate(new Runnable() {
|
Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
|
||||||
// @Override
|
if(shelfIsFull != 1){
|
||||||
// public void run() {
|
logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
|
||||||
// //调度开始
|
}
|
||||||
//// logger.info("");
|
|
||||||
//// logger.info("================= 现在开始执行 过程一 任务 ==================");
|
//一. 从plc 中获取 subIdList 和 lineNum
|
||||||
// Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
|
String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
|
||||||
// if(subArrived != 1){
|
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step2Plc2MesVar.LineNum);
|
||||||
// logger.info("失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
logger.info("获取到基板列表:"+ Arrays.toString(subIdList));
|
||||||
// }
|
|
||||||
//
|
//二. MES 业务
|
||||||
// //一. 从plc 中获取 subId 和 lineNum
|
//=============== MES 业务 开始 =================
|
||||||
// String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
|
//1.MES 生成BoxId
|
||||||
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
|
if(subIdList.length<=0){
|
||||||
// logger.info("采集到 基板ID: "+subId+", 线边号:"+lineNum);
|
logger.info("失败"+" --- "+"从plc里面获取到的基板列表 为空");
|
||||||
//
|
}
|
||||||
// //二. MES 业务
|
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
|
||||||
// //=============== MES 业务 开始 =================
|
String boxId = getBoxId(bySubId.getSapMaterial());
|
||||||
// //1. 从comline数据库中获取 实际pmpp
|
logger.info("mes 生成的boxId :"+ boxId);
|
||||||
// float pmppBySubId = service.getPMPPBySubId(subId);
|
//2. 依次update 基板表,把boxId 赋予这些基板
|
||||||
// //2. 匹配和计算补偿功率
|
for(int i=0;i<subIdList.length;i++){
|
||||||
// float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
|
substrateServiceBiz.updatePackagingBoxIdByWoSubstrateId(boxId,subIdList[i]);
|
||||||
// //3. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
|
}
|
||||||
// WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
|
//3.去camline数据库 查询此基板ID 对应的订单
|
||||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
|
String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
|
||||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
|
//4. box信息录入到box表
|
||||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
|
WoPackagingBox woPackagingBox = new WoPackagingBox();
|
||||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
|
woPackagingBox.setBoxNo(boxId);
|
||||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
|
woPackagingBox.setPackagingTime(LocalDateTime.now());
|
||||||
//
|
woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
|
||||||
//
|
woPackagingBox.setLineBody(bySubId.getLineBody());
|
||||||
//
|
woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
|
||||||
// //4. 把基板录到数据库
|
woPackagingBox.setOrderNum(orderNameBySubId);
|
||||||
// WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
|
//1-手动模式,2-自动模式
|
||||||
// woPackagingBoxSubstrate.setLineBody(lineNum);
|
woPackagingBox.setModel(2);
|
||||||
// woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
|
woPackagingBox.setCreateTime(LocalDateTime.now());
|
||||||
// woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
|
boxServiceBiz.insert(woPackagingBox);
|
||||||
// woPackagingBoxSubstrate.setWoSubstrateId(subId);
|
//=============== MES 业务 结束 =================
|
||||||
//
|
|
||||||
// //5. 从camline那里获取可变字段
|
//三. 把生成的BoxId 告诉kuka
|
||||||
// CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
|
write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
|
||||||
// woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
|
|
||||||
// woPackagingBoxSubstrate.setPmpp(actualPMPP);
|
//四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了
|
||||||
// woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
|
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
|
||||||
// woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
|
|
||||||
// woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
|
//四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
||||||
// woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
|
Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
|
||||||
// woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
|
if(subArrived2 != 1){
|
||||||
// woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
|
logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||||
// woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
|
}
|
||||||
// woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
|
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
||||||
// woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
|
}
|
||||||
// woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
|
},1,1, TimeUnit.SECONDS);
|
||||||
// woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
|
|
||||||
// woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
|
|
||||||
// woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
|
kukaStep3.scheduleAtFixedRate(new Runnable() {
|
||||||
// woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
|
@Override
|
||||||
// woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
|
public void run() {
|
||||||
// woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
|
//调度开始
|
||||||
// woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
|
Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
|
||||||
// woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
|
if(shelfIsFull != 1){
|
||||||
// woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
|
logger.info("失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
||||||
// woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
|
}
|
||||||
// woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
|
|
||||||
// woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
|
//一. 从plc 中获取 subIdList 和 lineNum
|
||||||
// woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
|
String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
|
||||||
// woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
|
Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
|
||||||
// woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
|
logger.info("到达站台的boxId :"+boxId);
|
||||||
// woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
|
|
||||||
// woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
|
//二. MES 业务
|
||||||
// woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
|
//=============== MES 业务 开始 =================
|
||||||
// woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
|
//1. box信息录入到box表
|
||||||
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
|
boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
|
||||||
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
|
//=============== MES 业务 结束 =================
|
||||||
//
|
|
||||||
// substrateServiceBiz.insert(woPackagingBoxSubstrate);
|
|
||||||
// //=============== MES 业务 结束 =================
|
//四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了
|
||||||
//
|
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
|
||||||
// //三. 当MES完成任务后,把MesToPlc.SubArrivedFinish变量置为true,告诉plc,我操作完成了
|
|
||||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
|
//四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
||||||
//
|
Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
|
||||||
// //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
if(subArrived2 != 1){
|
||||||
// Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
|
logger.info("失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
||||||
// if(subArrived2 != 1){
|
}
|
||||||
// logger.info("失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
|
||||||
// }
|
|
||||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
|
|
||||||
// }
|
}
|
||||||
// },1,1, TimeUnit.SECONDS);
|
},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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar;
|
|||||||
import com.cnbm.packing.service.DynamicDataSourceService;
|
import com.cnbm.packing.service.DynamicDataSourceService;
|
||||||
import com.cnbm.s7.entity.R;
|
import com.cnbm.s7.entity.R;
|
||||||
import com.cnbm.s7.s7connector.enmuc.S7Client;
|
import com.cnbm.s7.s7connector.enmuc.S7Client;
|
||||||
|
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@ -20,6 +21,7 @@ import com.cnbm.common.utils.Result;
|
|||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -124,6 +126,34 @@ public class TestController {
|
|||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
BigDecimal voc = new BigDecimal(59.799);
|
||||||
|
System.out.println(Float.valueOf(voc.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/testWrite")
|
||||||
|
public R testWrite() {
|
||||||
|
BigDecimal voc = new BigDecimal(59.799);
|
||||||
|
BigDecimal isc = new BigDecimal(3.799);
|
||||||
|
BigDecimal vmpp = new BigDecimal(46.799);
|
||||||
|
BigDecimal impp = new BigDecimal(3.0799);
|
||||||
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,new Integer(1));
|
||||||
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,voc);
|
||||||
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,isc);
|
||||||
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,vmpp);
|
||||||
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,impp);
|
||||||
|
|
||||||
|
|
||||||
|
write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,"12345678901111111111");
|
||||||
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
|
||||||
|
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
||||||
|
|
||||||
|
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
|
||||||
|
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
@PostMapping("/testlogger")
|
@PostMapping("/testlogger")
|
||||||
public R testlogger() {
|
public R testlogger() {
|
||||||
logger.info("test logger");
|
logger.info("test logger");
|
||||||
@ -159,4 +189,51 @@ public class TestController {
|
|||||||
return new Result<String>().ok(service.getExtendArgFromCamline(subId.toString()).toString());
|
return new Result<String>().ok(service.getExtendArgFromCamline(subId.toString()).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 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 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ public enum S7Client {
|
|||||||
);
|
);
|
||||||
return type.toObject(read);
|
return type.toObject(read);
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Throwable e) {
|
||||||
throw new S7CheckResultException("read errMsg : "+e.getMessage());
|
throw new S7CheckResultException("read errMsg : "+e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ public enum S7Client {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}catch (Exception e) {
|
}catch (Throwable e) {
|
||||||
throw new S7CheckResultException("write errMsg : "+e.getMessage());
|
throw new S7CheckResultException("write errMsg : "+e.getMessage());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user