commit for pull
This commit is contained in:
parent
1ebe39b60a
commit
16f3cd5d30
@ -54,12 +54,14 @@ spring:
|
|||||||
##多数据源的配置,需要引用renren-dynamic-datasource
|
##多数据源的配置,需要引用renren-dynamic-datasource
|
||||||
dynamic:
|
dynamic:
|
||||||
datasource:
|
datasource:
|
||||||
slave1:
|
# ## 本mes系统
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
# slave1:
|
||||||
url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
username: root
|
# url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||||
password: 1qaz@WSX3edc$RFV
|
# username: root
|
||||||
slave2:
|
# password: 1qaz@WSX3edc$RFV
|
||||||
|
## camline系统
|
||||||
|
camline:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
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
|
url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||||
username: root
|
username: root
|
||||||
|
@ -43,6 +43,5 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
>>>>>>>>> Temporary merge branch 2
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -1,5 +1,6 @@
|
|||||||
package com.cnbm.packing.dispatch;
|
package com.cnbm.packing.dispatch;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
|
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
|
||||||
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Plc2MesVar;
|
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Plc2MesVar;
|
||||||
@ -8,12 +9,10 @@ import com.cnbm.packing.dispatch.enums.kuka.step2.Step2Plc2MesVar;
|
|||||||
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
|
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
|
||||||
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Plc2MesVar;
|
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Plc2MesVar;
|
||||||
import com.cnbm.packing.dto.WoPowerLevelDTO;
|
import com.cnbm.packing.dto.WoPowerLevelDTO;
|
||||||
|
import com.cnbm.packing.entity.WoPackagingBox;
|
||||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
||||||
import com.cnbm.packing.entity.WoPowerLevel;
|
import com.cnbm.packing.entity.WoPowerLevel;
|
||||||
import com.cnbm.packing.service.DynamicDataSourceService;
|
import com.cnbm.packing.service.*;
|
||||||
import com.cnbm.packing.service.WoCompensationPowerServiceBiz;
|
|
||||||
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
|
|
||||||
import com.cnbm.packing.service.WoPowerLevelServiceBiz;
|
|
||||||
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;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -25,6 +24,7 @@ import org.springframework.core.annotation.Order;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -50,6 +50,9 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
@Autowired
|
@Autowired
|
||||||
WoPackagingBoxSubstrateServiceBiz substrateServiceBiz;
|
WoPackagingBoxSubstrateServiceBiz substrateServiceBiz;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
WoPackagingBoxServiceBiz boxServiceBiz;
|
||||||
|
|
||||||
public KukaJoinThread(){
|
public KukaJoinThread(){
|
||||||
this.kukaStep1 = Executors.newScheduledThreadPool(1);
|
this.kukaStep1 = Executors.newScheduledThreadPool(1);
|
||||||
this.kukaStep2 = Executors.newScheduledThreadPool(1);
|
this.kukaStep2 = Executors.newScheduledThreadPool(1);
|
||||||
@ -60,6 +63,8 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
private ScheduledExecutorService kukaStep2;
|
private ScheduledExecutorService kukaStep2;
|
||||||
private ScheduledExecutorService kukaStep3;
|
private ScheduledExecutorService kukaStep3;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return
|
* return
|
||||||
* 成功: 返回相应的object对象
|
* 成功: 返回相应的object对象
|
||||||
@ -141,33 +146,39 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
kukaStep1.execute(new Runnable() {
|
kukaStep1.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (true){
|
// while (true){
|
||||||
//read one
|
// //read one
|
||||||
// logger.info("过程一 : "+ Arrays.toString((String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays)));
|
//// logger.info("过程一 : "+ Arrays.toString((String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays)));
|
||||||
// try {
|
//// try {
|
||||||
// Thread.sleep(300);
|
//// Thread.sleep(300);
|
||||||
// } catch (InterruptedException e) {
|
//// } catch (InterruptedException e) {
|
||||||
// throw new S7ParseDataException(e);
|
//// throw new S7ParseDataException(e);
|
||||||
|
//// }
|
||||||
|
//// //write one
|
||||||
|
//// String[] toWrite = new String[60];
|
||||||
|
//// for(int i=0;i<60;i++){
|
||||||
|
//// toWrite[i] = RandomStringUtils.randomAlphanumeric(18);
|
||||||
|
//// }
|
||||||
|
//// try {
|
||||||
|
//// write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite);
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// throw new S7ParseDataException(e);
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//
|
||||||
// }
|
// }
|
||||||
// //write one
|
|
||||||
// String[] toWrite = new String[60];
|
|
||||||
// for(int i=0;i<60;i++){
|
|
||||||
// toWrite[i] = RandomStringUtils.randomAlphanumeric(18);
|
|
||||||
// }
|
|
||||||
// try {
|
|
||||||
// write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// throw new S7ParseDataException(e);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -182,64 +193,111 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
//1. 从plc 中获取 subId 和 lineNum
|
//一. 从plc 中获取 subId 和 lineNum
|
||||||
String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
|
String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
|
||||||
Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
|
Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
|
||||||
//2. 从comline数据库中获取 实际pmpp
|
|
||||||
|
//二. MES 业务
|
||||||
|
//=============== MES 业务 开始 =================
|
||||||
|
//1. 从comline数据库中获取 实际pmpp
|
||||||
float pmppBySubId = service.getPMPPBySubId(subId);
|
float pmppBySubId = service.getPMPPBySubId(subId);
|
||||||
//3. 匹配和计算补偿功率
|
//2. 匹配和计算补偿功率
|
||||||
float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
|
float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
|
||||||
//4. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
|
//3. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
|
||||||
WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
|
WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
|
||||||
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,argByPMPP.getPowerClass());
|
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_Voc,argByPMPP.getLableVoc());
|
||||||
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
|
||||||
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
|
||||||
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
|
||||||
|
|
||||||
|
//4. 从camline那里获取可变字段
|
||||||
|
|
||||||
//5. 把基板录到数据库
|
|
||||||
|
//4. 把基板录到数据库
|
||||||
WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
|
WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
|
||||||
woPackagingBoxSubstrate.setLineBody(1);
|
woPackagingBoxSubstrate.setLineBody(lineNum);
|
||||||
woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass().toString());
|
woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
|
||||||
woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
|
woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
|
||||||
woPackagingBoxSubstrate.setWoSubstrateId("sub123");
|
woPackagingBoxSubstrate.setWoSubstrateId(subId);
|
||||||
|
|
||||||
substrateServiceBiz.insert(woPackagingBoxSubstrate);
|
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("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||||
|
}
|
||||||
|
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
|
||||||
|
logger.info("================= 过程一 任务成功完成 ==================");
|
||||||
|
logger.info("");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},1,1, TimeUnit.SECONDS);
|
},1,1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
|
||||||
kukaStep2.scheduleAtFixedRate(new Runnable() {
|
kukaStep2.scheduleAtFixedRate(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
//调度开始
|
||||||
String s = RandomUtil.randomString(5);
|
logger.info("");
|
||||||
System.out.println("start + "+s+" : "+LocalDateTime.now());
|
logger.info("================= 现在开始执行 过程二 任务 ==================");
|
||||||
Thread.sleep(3000);
|
Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
|
||||||
|
if(shelfIsFull != 1){
|
||||||
|
logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
|
||||||
//写业务代码
|
|
||||||
WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(2.1111f, 1);
|
|
||||||
|
|
||||||
|
|
||||||
WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
|
|
||||||
woPackagingBoxSubstrate.setLineBody(1);
|
|
||||||
woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass().toString());
|
|
||||||
woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
|
|
||||||
woPackagingBoxSubstrate.setWoSubstrateId("sub123");
|
|
||||||
|
|
||||||
substrateServiceBiz.insert(woPackagingBoxSubstrate);
|
|
||||||
|
|
||||||
System.err.println(argByPMPP.toString());
|
|
||||||
// service.salve3Get();
|
|
||||||
System.out.println("end "+ s +" : "+ LocalDateTime.now());
|
|
||||||
}catch (Throwable e){
|
|
||||||
//Error 和 Exception 都继承于Throwable ,所以当业务代码出现Error/Exception 都不会导致程序down掉
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//一. 从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());
|
||||||
|
//todo box表新增一个 orderNum 字段
|
||||||
|
//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);
|
},1,1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
@ -247,23 +305,79 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
kukaStep3.scheduleAtFixedRate(new Runnable() {
|
kukaStep3.scheduleAtFixedRate(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
//调度开始
|
||||||
String s = RandomUtil.randomString(5);
|
logger.info("");
|
||||||
System.out.println("start + "+s+" : "+LocalDateTime.now());
|
logger.info("================= 现在开始执行 过程三 任务 ==================");
|
||||||
Thread.sleep(3000);
|
Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
|
||||||
|
if(shelfIsFull != 1){
|
||||||
|
logger.info("失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
||||||
//写业务代码
|
|
||||||
service.salve1Get();
|
|
||||||
// service.salve3Get();
|
|
||||||
System.out.println("end "+ s +" : "+ LocalDateTime.now());
|
|
||||||
}catch (Throwable e){
|
|
||||||
//Error 和 Exception 都继承于Throwable ,所以当业务代码出现Error/Exception 都不会导致程序down掉
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//一. 从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);
|
},1,1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
// kukaStep2.scheduleAtFixedRate(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// try {
|
||||||
|
// String s = RandomUtil.randomString(5);
|
||||||
|
// System.out.println("start + "+s+" : "+LocalDateTime.now());
|
||||||
|
// Thread.sleep(3000);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId("sub123");
|
||||||
|
// System.out.println("bySubId:"+ bySubId.toString());
|
||||||
|
//
|
||||||
|
// String boxId = getBoxId(bySubId.getSapMaterial());
|
||||||
|
// System.out.println("boxId:"+ boxId.toString());
|
||||||
|
//
|
||||||
|
// //2. 依次update 基板表,把boxId 赋予这些基板
|
||||||
|
// substrateServiceBiz.updatePackagingBoxIdByWoSubstrateId(boxId,"sub123");
|
||||||
|
// //3.去camline数据库 查询此基板ID 对应的订单
|
||||||
|
// //String orderNameBySubId = service.getOrderNameBySubId("sub123");
|
||||||
|
// //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());
|
||||||
|
// //todo box表新增一个 orderNum 字段
|
||||||
|
// //1-手动模式,2-自动模式
|
||||||
|
// woPackagingBox.setModel(2);
|
||||||
|
// boxServiceBiz.insert(woPackagingBox);
|
||||||
|
// }catch (Throwable e){
|
||||||
|
// //Error 和 Exception 都继承于Throwable ,所以当业务代码出现Error/Exception 都不会导致程序down掉
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },1,1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,5 +22,7 @@ public interface CamlineMapper {
|
|||||||
|
|
||||||
String getOrderNameBySubId(@Param("subId") String subId);
|
String getOrderNameBySubId(@Param("subId") String subId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Integer getTodayBoxNum();
|
Integer getTodayBoxNum();
|
||||||
}
|
}
|
@ -24,4 +24,6 @@ public interface WoPackagingBoxMapper extends BaseDao<WoPackagingBox> {
|
|||||||
|
|
||||||
List<WoPackagingBoxDTO> list();
|
List<WoPackagingBoxDTO> list();
|
||||||
|
|
||||||
|
int updateIsArrivedByBoxNo(@Param("isArrived") Integer isArrived, @Param("boxNo") String boxNo);
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
package com.cnbm.packing.mapper;
|
package com.cnbm.packing.mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import com.cnbm.common.dao.BaseDao;
|
import com.cnbm.common.dao.BaseDao;
|
||||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
||||||
@ -12,5 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> {
|
public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> {
|
||||||
|
WoPackagingBoxSubstrate getOneByWoSubstrateId(@Param("woSubstrateId") String woSubstrateId);
|
||||||
|
|
||||||
|
int updatePackagingBoxIdByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("woSubstrateId") String woSubstrateId);
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import com.cnbm.dynamic.datasource.annotation.DataSource;
|
|||||||
import com.cnbm.packing.dto.WoPowerLevelDTO;
|
import com.cnbm.packing.dto.WoPowerLevelDTO;
|
||||||
import com.cnbm.packing.mapper.CamlineMapper;
|
import com.cnbm.packing.mapper.CamlineMapper;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -23,28 +24,20 @@ public class DynamicDataSourceService {
|
|||||||
WoPowerLevelServiceBiz powerLevelServiceBiz;
|
WoPowerLevelServiceBiz powerLevelServiceBiz;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getTodayBoxNum(){
|
||||||
|
return mapper.getTodayBoxNum();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DataSource("camline")
|
||||||
@Transactional
|
@Transactional
|
||||||
@DataSource("slave1")
|
|
||||||
public void salve1Get(){
|
|
||||||
WoPowerLevelDTO woPowerLevelDTO = powerLevelServiceBiz.get(Long.valueOf(1));
|
|
||||||
System.out.println(woPowerLevelDTO.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getTodayBoxNum(){
|
|
||||||
Integer todayBoxNum = mapper.getTodayBoxNum();
|
|
||||||
System.out.println(todayBoxNum);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPMPPBySubId(String subId){
|
public float getPMPPBySubId(String subId){
|
||||||
return mapper.getPMPPBySubId(subId);
|
return mapper.getPMPPBySubId(subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DataSource("camline")
|
||||||
|
|
||||||
@DataSource("slave2")
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void salve3Get(){
|
public String getOrderNameBySubId(String subId){
|
||||||
float byid = mapper.getByid("LTWeight");
|
return mapper.getOrderNameBySubId(subId);
|
||||||
System.out.println(byid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.cnbm.common.service.CrudService;
|
|||||||
import com.cnbm.packing.dto.WoPackagingBoxDTO;
|
import com.cnbm.packing.dto.WoPackagingBoxDTO;
|
||||||
import com.cnbm.packing.dto.WoPackagingBoxDTO;
|
import com.cnbm.packing.dto.WoPackagingBoxDTO;
|
||||||
import com.cnbm.packing.entity.WoPackagingBox;
|
import com.cnbm.packing.entity.WoPackagingBox;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -29,4 +30,5 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
|
|||||||
|
|
||||||
List<WoPackagingBoxDTO> list();
|
List<WoPackagingBoxDTO> list();
|
||||||
|
|
||||||
|
int updateIsArrivedByBoxNo(Integer isArrived, String boxNo);
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import com.cnbm.common.page.PageData;
|
|||||||
import com.cnbm.common.service.CrudService;
|
import com.cnbm.common.service.CrudService;
|
||||||
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
|
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
|
||||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -33,4 +34,6 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi
|
|||||||
|
|
||||||
void batchInsert(WoPackagingBoxSubstrateDTO[] lists);
|
void batchInsert(WoPackagingBoxSubstrateDTO[] lists);
|
||||||
|
|
||||||
|
WoPackagingBoxSubstrate getBySubId(String subId);
|
||||||
|
int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId,String woSubstrateId);
|
||||||
}
|
}
|
@ -3,17 +3,11 @@ package com.cnbm.packing.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
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.page.PageData;
|
||||||
import com.cnbm.common.service.impl.CrudServiceImpl;
|
import com.cnbm.common.service.impl.CrudServiceImpl;
|
||||||
import com.cnbm.common.utils.ConvertUtils;
|
import com.cnbm.common.utils.ConvertUtils;
|
||||||
import com.cnbm.packing.dto.WoPackagingBoxDTO;
|
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.WoPackagingBox;
|
|
||||||
import com.cnbm.packing.entity.WoPowerLevel;
|
|
||||||
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
|
|
||||||
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
|
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
|
||||||
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -109,5 +103,8 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) {
|
||||||
|
return mapper.updateIsArrivedByBoxNo(isArrived,boxNo);
|
||||||
|
}
|
||||||
}
|
}
|
@ -162,4 +162,13 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WoPackagingBoxSubstrate getBySubId(String subId) {
|
||||||
|
return woPackagingBoxSubstrateMapper.getOneByWoSubstrateId(subId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId, String woSubstrateId) {
|
||||||
|
return woPackagingBoxSubstrateMapper.updatePackagingBoxIdByWoSubstrateId(packagingBoxId,woSubstrateId);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,8 +1,10 @@
|
|||||||
package com.cnbm.packing.vo;
|
package com.cnbm.packing.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Desc: ""
|
* @Desc: ""
|
||||||
@ -14,4 +16,6 @@ public class ComlinePMPP {
|
|||||||
private String machineName;
|
private String machineName;
|
||||||
private Long platformId;
|
private Long platformId;
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,12 @@
|
|||||||
|
|
||||||
<select id="getPMPPBySubId" resultType="float">
|
<select id="getPMPPBySubId" resultType="float">
|
||||||
SELECT
|
SELECT
|
||||||
-- tu.`NAME`,-- DMC(就是基板ID/模组ID)
|
flc.PMPP
|
||||||
-- flr.LAST_UPDATE_TIME,
|
|
||||||
flr.PMPP_FL2
|
|
||||||
FROM
|
FROM
|
||||||
ue_flasher_data_raw flr
|
ue_flasher_data_calc flc
|
||||||
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
|
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
|
||||||
WHERE
|
WHERE
|
||||||
flr.PMPP != 0
|
flc.PMPP != 0
|
||||||
and
|
and
|
||||||
tu.name=#{subId} -- 查特定基板功率
|
tu.name=#{subId} -- 查特定基板功率
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
@ -37,5 +37,10 @@
|
|||||||
select * from t_wo_packaging_box
|
select * from t_wo_packaging_box
|
||||||
order by id asc
|
order by id asc
|
||||||
</select>
|
</select>
|
||||||
|
<update id="updateIsArrivedByBoxNo">
|
||||||
|
update t_wo_packaging_box
|
||||||
|
set is_arrived = #{isArrived,jdbcType=NUMERIC}
|
||||||
|
where BOX_NO = #{boxNo,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -24,6 +24,20 @@
|
|||||||
select * from t_wo_packaging_box_substrate
|
select * from t_wo_packaging_box_substrate
|
||||||
order by id asc
|
order by id asc
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user