This commit is contained in:
caixiang
2023-12-20 14:49:42 +08:00
parent 11b41b18f1
commit df116253ff
15 changed files with 1031 additions and 42 deletions

View File

@@ -158,12 +158,22 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
}
public String getErrorBoxId(String sapMaterial){
// public String getErrorBoxId(String sapMaterial){
//
// String nowTime = DateUtil.format(new Date(), "yyMMdd");
// String mixBoxError = "001";
// String res = "444"+sapMaterial+nowTime+mixBoxError +"02";
// logger.info("BOXID生成Event-------现在生成errBoxId sapMaterial: "+sapMaterial+"nowTime:"+nowTime);
//
// return res;
// }
public String getErrorBoxId(String sapMaterial){
Integer todayErrBoxNum = service.getTodayErrBoxNum()+1;
String nowTime = DateUtil.format(new Date(), "yyMMdd");
String mixBoxError = "001";
String res = "444"+sapMaterial+nowTime+mixBoxError;
logger.info("BOXID生成Event-------现在生成errBoxId sapMaterial: "+sapMaterial+"nowTime:"+nowTime);
String res = "444"+sapMaterial+nowTime+mixBoxError+"02"+todayErrBoxNum;
logger.info("BOXID生成Event-------现在生成errBoxId sapMaterial: "+sapMaterial+"nowTime:"+nowTime+",todayErrBoxNum:"+todayErrBoxNum);
return res;
}
@@ -183,12 +193,57 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
}
//return true 出现混档了return false 没有出现混档
// private boolean isMixLevel(String[] subIds,Integer size){
// String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
// String errMsg = "以下基板ID出现混档";
// boolean res = false;
// for(int i=0;i<size;i++){
// String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel();
//
// if(!powerLevel.equals(correctLevel)){
// errMsg += "基板ID:"+subIds[i]+" 档位:"+powerLevel+", ";
// res = true;
// }
// }
// if(res){
// logger.error(errMsg);
// }
//
// return res;
// }
private CamlineSubIdDTO getFromCamline(String subId){
return service.getSubIdByCamline(subId);
}
private boolean isMixLevel(String[] subIds,Integer size){
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIds[0]);
String correctLevel = null;
//如果 我们数据库没有 去camline 数据库里面取 -- 开始
if(bySubId == null){
logger.info("BOXID生成Event-------检查是否混箱时,发现数据库中 无subId"+ subIds[0]+"现在从camline 系统获取这个基板相关信息");
//todo
CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIds[0]);
logger.info("BOXID生成Event-------检查是否混箱时,发现数据库中 无subId"+ subIds[0]+"现在从camline 系统获取这个基板相关信息是:"+subIdByCamline);
correctLevel = subIdByCamline.getPowerLevel();
}else {
correctLevel = bySubId.getPowerLevel();
}
String errMsg = "以下基板ID出现混档";
boolean res = false;
for(int i=0;i<size;i++){
String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel();
WoPackagingBoxSubstrate innerSub = substrateServiceBiz.getBySubId(subIds[i]);
String powerLevel = null;
if(innerSub==null){
powerLevel = getFromCamline(subIds[i]).getPowerLevel();
}else {
powerLevel = innerSub.getPowerLevel();
}
if(!powerLevel.equals(correctLevel)){
errMsg += "基板ID:"+subIds[i]+" 档位:"+powerLevel+", ";
@@ -197,14 +252,13 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
}
if(res){
logger.error(errMsg);
}
return res;
}
@Override
public void run(ApplicationArguments args) throws Exception {
kukaStep2.scheduleAtFixedRate(new Runnable() {
@@ -251,14 +305,18 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
//如果我们系统中找不到这块基板那么就去camline里面找
// if(bySubId == null){
// logger.info("BOXID生成Event-------数据库中 无subId"+ subIdList[0]+"现在从camline 系统获取这个基板相关信息");
// //todo
// CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
// bySubId = new WoPackagingBoxSubstrate();
// bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
// bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
// bySubId.setLineBody(2);
// }
if(bySubId == null){
logger.info("BOXID生成Event-------数据库中 无subId"+ subIdList[0]+"现在从camline 系统获取这个基板相关信息");
//todo
CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
bySubId = new WoPackagingBoxSubstrate();
bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
bySubId.setLineBody(2);
logger.info("BOXID生成Event-------数据库中 无subId"+ subIdList[0]);
throw new Exception("BOXID生成Event-------数据库中 无subId"+ subIdList[0]);
}
@@ -266,15 +324,15 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
String boxId = "";
if(isMixLevel(subIdList,listSize)){
//出现混档
logger.info("BOXID生成Event-------subIdList :"+subIdList+"出现混档");
logger.info("BOXID生成Event-------subIdList :"+Arrays.asList(subIdList)+"出现混档");
boxId = getErrorBoxId(bySubId.getSapMaterial());
}else {
//正常情况
logger.info("BOXID生成Event-------subIdList :"+subIdList+"没有出现混档");
logger.info("BOXID生成Event-------subIdList :"+Arrays.asList(subIdList)+"没有出现混档");
boxId = getBoxId(bySubId.getSapMaterial());
}
logger.info("BOXID生成Event-------subIdList :"+subIdList+"isMixLevel 校验结束");
logger.info("BOXID生成Event-------subIdList :"+Arrays.asList(subIdList)+"isMixLevel 校验结束");
logger.info("BOXID生成Event-------mes 生成的boxId :"+ boxId);
//2. 依次update 基板表把boxId 赋予这些基板