Compare commits
4 Commits
eda15da1a9
...
c37f25a874
Author | SHA1 | Date | |
---|---|---|---|
|
c37f25a874 | ||
|
78c9cbd686 | ||
|
ee0bd67011 | ||
|
4d8f2bfe74 |
@ -82,9 +82,11 @@ public class JwtUtil {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
// String jwt = createJWT("123");
|
// String jwt = createJWT("123");
|
||||||
Claims claims = parseJWT("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI5OWNhNGJhMjg5ZjU0OTVjODE5YTM0N2ExZmNlZjc0YSIsInN1YiI6IjEyMyIsImlzcyI6IndoeSIsImlhdCI6MTY1NDc1OTg5NiwiZXhwIjoxNjU0NzYzNDk2fQ.CTgS6yQjfXSGPJUTu-_rqjkh_KB_F9SzPThFfnvB5yg");
|
Claims claims = parseJWT("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkNTQxODQ5NjNjMWM0NzgzOTA0ZDAwZGI1ZmNkNWU3NiIsInN1YiI6IjEwNjcyNDY4NzU4MDAwMDAwMDEiLCJpc3MiOiJ3aHkiLCJpYXQiOjE2Nzg5MzE1MjAsImV4cCI6MTY3ODkzNTEyMH0.2we9FhhFU2Qvx2fvywqmA8A1qs0mbdXvr8T2CjJUz7o");
|
||||||
String subject = claims.getSubject();
|
String subject = claims.getSubject();
|
||||||
System.out.println(subject);
|
System.out.println(subject);
|
||||||
|
|
||||||
|
System.out.println(claims.toString());
|
||||||
// System.out.println(claims);
|
// System.out.println(claims);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ spring:
|
|||||||
enabled: true
|
enabled: true
|
||||||
redis:
|
redis:
|
||||||
database: 6
|
database: 6
|
||||||
#host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
host: 10.0.1.249
|
#host: 10.0.1.249
|
||||||
#host: 192.168.0.102
|
#host: 192.168.0.102
|
||||||
port: 6379
|
port: 6379
|
||||||
password: '' # 密码(默认为空)
|
password: '' # 密码(默认为空)
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
<!-- <property name="logging.pathmq" value="C:/qgs_logger/mq" />-->
|
<!-- <property name="logging.pathmq" value="C:/qgs_logger/mq" />-->
|
||||||
<!-- <property name="logging.eqlog" value="C:/qgs_logger/s7" />-->
|
<!-- <property name="logging.eqlog" value="C:/qgs_logger/s7" />-->
|
||||||
|
|
||||||
<property name="logging.eqlog" value="/usr/local/logger/EQCommunicationLog" />
|
<property name="logging.eqlog" value="/var/log/logger/EQCommunicationLog" />
|
||||||
<property name="logging.packing" value="/usr/local/logger/Packing" />
|
<property name="logging.packing" value="/var/log/logger/Packing" />
|
||||||
<property name="logging.pathwork" value="/usr/local/logger/Working" />
|
<property name="logging.pathwork" value="/var/log/logger/Working" />
|
||||||
|
|
||||||
|
|
||||||
<!--0. 日志格式和颜色渲染 -->
|
<!--0. 日志格式和颜色渲染 -->
|
||||||
|
@ -184,11 +184,11 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//return true 出现混档了,return false 没有出现混档
|
//return true 出现混档了,return false 没有出现混档
|
||||||
private boolean isMixLevel(String[] subIds){
|
private boolean isMixLevel(String[] subIds,Integer size){
|
||||||
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
|
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
|
||||||
String errMsg = "以下基板ID出现混档:";
|
String errMsg = "以下基板ID出现混档:";
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
for(int i=1;i<subIds.length;i++){
|
for(int i=0;i<size;i++){
|
||||||
String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel();
|
String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel();
|
||||||
|
|
||||||
if(!powerLevel.equals(correctLevel)){
|
if(!powerLevel.equals(correctLevel)){
|
||||||
@ -199,254 +199,259 @@ public class KukaJoinThread implements ApplicationRunner {
|
|||||||
if(res){
|
if(res){
|
||||||
logger.error(errMsg);
|
logger.error(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
//
|
||||||
kukaStep1.scheduleAtFixedRate(new Runnable() {
|
// kukaStep1.scheduleAtFixedRate(new Runnable() {
|
||||||
@Override
|
// @Override
|
||||||
public void run() {
|
// public void run() {
|
||||||
try {
|
// try {
|
||||||
|
//
|
||||||
//调度开始
|
// //调度开始
|
||||||
// logger.info("");
|
//// logger.info("");
|
||||||
// logger.info("================= 现在开始执行 过程一 任务 ==================");
|
//// logger.info("================= 现在开始执行 过程一 任务 ==================");
|
||||||
Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
|
// Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
|
||||||
if(subArrived != 1){
|
// if(subArrived != 1){
|
||||||
logger.info("标签打印Event--- 失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
// logger.info("标签打印Event--- 失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 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);
|
||||||
//把基板ID字符串的空格去掉,因为plc中设置的20位,但实际基板ID就是17位,因为带空格去数据库查询 有问题的。
|
// //把基板ID字符串的空格去掉,因为plc中设置的20位,但实际基板ID就是17位,因为带空格去数据库查询 有问题的。
|
||||||
subId = removeKG(subId);
|
// subId = removeKG(subId);
|
||||||
|
//
|
||||||
//二. MES 业务
|
// //二. MES 业务
|
||||||
//=============== MES 业务 开始 =================
|
// //=============== MES 业务 开始 =================
|
||||||
//1. 从comline数据库中获取 实际pmpp
|
// //1. 从comline数据库中获取 实际pmpp
|
||||||
float pmppActual = service.getPMPPBySubId(subId);
|
// float pmppActual = service.getPMPPBySubId(subId);
|
||||||
//2. 匹配和计算补偿功率
|
// //2. 匹配和计算补偿功率
|
||||||
float pmppCompensation = compensationPowerServiceBiz.calculCompensationPMPP(pmppActual,lineNum);
|
// float pmppCompensation = compensationPowerServiceBiz.calculCompensationPMPP(pmppActual,lineNum);
|
||||||
//3. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
|
// //3. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
|
||||||
WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(pmppCompensation, lineNum);
|
// WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(pmppCompensation, lineNum);
|
||||||
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(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());
|
||||||
logger.info("标签打印Event--- 采集到 基板ID: "+subId+", 线边号:"+lineNum+",从camline 获取到实际pmpp"+pmppActual+",计算后 补偿功率:"+pmppCompensation+",dLable_Pnom: "+argByPMPP.getPowerClass() +",dLable_Voc: "+argByPMPP.getLableVoc()+",dLable_Isc: "+argByPMPP.getLableIsc()+",dLable_Vmpp: "+argByPMPP.getLableVmpp()+",dLable_Impp: "+argByPMPP.getLableImpp());
|
// logger.info("标签打印Event--- 采集到 基板ID: "+subId+", 线边号:"+lineNum+",从camline 获取到实际pmpp"+pmppActual+",计算后 补偿功率:"+pmppCompensation+",dLable_Pnom: "+argByPMPP.getPowerClass() +",dLable_Voc: "+argByPMPP.getLableVoc()+",dLable_Isc: "+argByPMPP.getLableIsc()+",dLable_Vmpp: "+argByPMPP.getLableVmpp()+",dLable_Impp: "+argByPMPP.getLableImpp());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
//4. 把基板录到数据库
|
// //4. 把基板录到数据库
|
||||||
WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
|
// WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
|
||||||
woPackagingBoxSubstrate.setLineBody(lineNum);
|
// woPackagingBoxSubstrate.setLineBody(lineNum);
|
||||||
woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
|
// woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
|
||||||
woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
|
// woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
|
||||||
woPackagingBoxSubstrate.setWoSubstrateId(subId);
|
// woPackagingBoxSubstrate.setWoSubstrateId(subId);
|
||||||
woPackagingBoxSubstrate.setActualPmpp(pmppActual);
|
// woPackagingBoxSubstrate.setActualPmpp(pmppActual);
|
||||||
woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now());
|
// woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now());
|
||||||
woPackagingBoxSubstrate.setPmpp(pmppCompensation);
|
// woPackagingBoxSubstrate.setPmpp(pmppCompensation);
|
||||||
|
//
|
||||||
|
//
|
||||||
//5. 从camline那里获取可变字段
|
// //5. 从camline那里获取可变字段
|
||||||
CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
|
// CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
|
||||||
logger.info("标签打印Event--- 基板ID: "+subId+", 从camline获取PID16~PID22 的实测数据 成功, 数据内容:"+extendArgFromCamline.toString());
|
// logger.info("标签打印Event--- 基板ID: "+subId+", 从camline获取PID16~PID22 的实测数据 成功, 数据内容:"+extendArgFromCamline.toString());
|
||||||
woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
|
// woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
|
||||||
|
//
|
||||||
woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
|
// woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
|
||||||
woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
|
// woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
|
||||||
woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
|
// woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
|
||||||
woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
|
// woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
|
||||||
woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
|
// woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
|
||||||
woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
|
// woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
|
||||||
woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
|
// woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
|
||||||
woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
|
// woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
|
||||||
woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
|
// woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
|
||||||
woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
|
// woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
|
||||||
woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
|
// woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
|
||||||
woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
|
// woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
|
||||||
woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
|
// woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
|
||||||
woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
|
// woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
|
||||||
woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
|
// woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
|
||||||
woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
|
// woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
|
||||||
woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
|
// woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
|
||||||
woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
|
// woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
|
||||||
woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
|
// woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
|
||||||
woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
|
// woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
|
||||||
woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
|
// woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
|
||||||
woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
|
// woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
|
||||||
woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
|
// woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
|
||||||
woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
|
// woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
|
||||||
woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
|
// woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
|
||||||
woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
|
// woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
|
||||||
woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
|
// woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
|
||||||
woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
|
// woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
|
||||||
woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
|
// woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
|
||||||
woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
|
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
|
||||||
woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
|
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
|
||||||
|
//
|
||||||
substrateServiceBiz.insert(woPackagingBoxSubstrate);
|
// substrateServiceBiz.insert(woPackagingBoxSubstrate);
|
||||||
logger.info("标签打印Event--- 基板ID: "+subId+", 录入数据库成功");
|
// logger.info("标签打印Event--- 基板ID: "+subId+", 录入数据库成功");
|
||||||
//=============== MES 业务 结束 =================
|
// //=============== MES 业务 结束 =================
|
||||||
|
//
|
||||||
//三. 当MES完成任务后,把MesToPlc.SubArrivedFinish变量置为true,告诉plc,我操作完成了
|
// //三. 当MES完成任务后,把MesToPlc.SubArrivedFinish变量置为true,告诉plc,我操作完成了
|
||||||
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
|
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
|
||||||
logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish,置为true 成功");
|
// logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish,置为true 成功");
|
||||||
//四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
// //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
||||||
Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
|
// Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
|
||||||
if(subArrived2 != 1){
|
// if(subArrived2 != 1){
|
||||||
logger.info("标签打印Event--- 失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
// logger.info("标签打印Event--- 失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
|
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
|
||||||
logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish,置为 false 成功, Event1 成功结束");
|
// logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish,置为 false 成功, Event1 成功结束");
|
||||||
|
//
|
||||||
}catch (Throwable e){
|
// }catch (Throwable e){
|
||||||
logger.info("标签打印Event--- :"+e.getMessage());
|
// e.printStackTrace();
|
||||||
}
|
// logger.info("标签打印Event--- 出现异常 :"+e.toString());
|
||||||
}
|
// }
|
||||||
},1,1, TimeUnit.SECONDS);
|
// }
|
||||||
|
// },1,1, TimeUnit.SECONDS);
|
||||||
kukaStep2.scheduleAtFixedRate(new Runnable() {
|
//
|
||||||
@Override
|
// kukaStep2.scheduleAtFixedRate(new Runnable() {
|
||||||
public void run() {
|
// @Override
|
||||||
try {
|
// public void run() {
|
||||||
|
// try {
|
||||||
//调度开始
|
//
|
||||||
Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
|
// //调度开始
|
||||||
if(shelfIsFull != 1){
|
// Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
|
||||||
logger.info("BOXID生成Event-------失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
|
// if(shelfIsFull != 1){
|
||||||
}
|
// logger.info("BOXID生成Event-------失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
|
||||||
|
// }
|
||||||
//一. 从plc 中获取 subIdList 和 lineNum
|
//
|
||||||
String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
|
// //一. 从plc 中获取 subIdList 和 lineNum
|
||||||
Integer listSize = (Integer)read(S7Client.S7_KUKA,Step2Plc2MesVar.PackageNumberSet);
|
// String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
|
||||||
|
// Integer listSize = (Integer)read(S7Client.S7_KUKA,Step2Plc2MesVar.PackageNumberSet)-1;
|
||||||
//二. MES 业务
|
//
|
||||||
//=============== MES 业务 开始 =================
|
//
|
||||||
//1.MES 生成BoxId
|
// //二. MES 业务
|
||||||
if(subIdList.length<=0){
|
// //=============== MES 业务 开始 =================
|
||||||
logger.info("BOXID生成Event-------失败"+" --- "+"从plc里面获取到的基板列表 为空");
|
// //1.MES 生成BoxId
|
||||||
throw new Exception("BOXID生成Event-------kuka机械手 取到了空箱");
|
// if(subIdList.length<=0){
|
||||||
}
|
// logger.info("BOXID生成Event-------失败"+" --- "+"从plc里面获取到的基板列表 为空");
|
||||||
//真实的基板ID 就是17位的,plc读取过来,有空格,要把后面3位空格去掉就行了。
|
// throw new Exception("BOXID生成Event-------kuka机械手 取到了空箱");
|
||||||
for(int i=0;i<subIdList.length;i++){
|
// }
|
||||||
subIdList[i] = removeKG(subIdList[i]);
|
// //真实的基板ID 就是17位的,plc读取过来,有空格,要把后面3位空格去掉就行了。
|
||||||
}
|
// for(int i=0;i<subIdList.length;i++){
|
||||||
logger.info("BOXID生成Event-------获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize);
|
// subIdList[i] = removeKG(subIdList[i]);
|
||||||
|
// }
|
||||||
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
|
// logger.info("BOXID生成Event-------获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize);
|
||||||
//如果我们系统中找不到这块基板那么就去camline里面找
|
//
|
||||||
if(bySubId == null){
|
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
|
||||||
//todo
|
// logger.info("bySubId"+ bySubId.toString());
|
||||||
CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
|
// //如果我们系统中找不到这块基板那么就去camline里面找
|
||||||
bySubId = new WoPackagingBoxSubstrate();
|
// if(bySubId == null){
|
||||||
bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
|
//
|
||||||
bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
|
// //todo
|
||||||
bySubId.setLineBody(2);
|
// CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
|
||||||
}
|
// bySubId = new WoPackagingBoxSubstrate();
|
||||||
|
// bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
|
||||||
//校验是否存在混档位情况
|
// bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
|
||||||
String boxId = "";
|
// bySubId.setLineBody(2);
|
||||||
if(isMixLevel(subIdList)){
|
// }
|
||||||
//出现混档
|
//
|
||||||
boxId = getBoxId(bySubId.getSapMaterial());
|
// //校验是否存在混档位情况
|
||||||
}else {
|
// String boxId = "";
|
||||||
//正常情况
|
// if(isMixLevel(subIdList,listSize)){
|
||||||
boxId = getErrorBoxId(bySubId.getSapMaterial());
|
// //出现混档
|
||||||
}
|
// boxId = getErrorBoxId(bySubId.getSapMaterial());
|
||||||
|
// }else {
|
||||||
|
// //正常情况
|
||||||
|
// boxId = getBoxId(bySubId.getSapMaterial());
|
||||||
|
// }
|
||||||
logger.info("BOXID生成Event-------mes 生成的boxId :"+ boxId);
|
//
|
||||||
//2. 依次update 基板表,把boxId 赋予这些基板
|
// logger.info("BOXID生成Event-------mes 生成的boxId :"+ boxId);
|
||||||
for(int i=0;i<listSize;i++){
|
// //2. 依次update 基板表,把boxId 赋予这些基板
|
||||||
substrateServiceBiz.updatePackagingBoxIdAndSlotByWoSubstrateId(boxId,(i+1),subIdList[i]);
|
// for(int i=0;i<listSize;i++){
|
||||||
}
|
// substrateServiceBiz.updatePackagingBoxIdAndSlotByWoSubstrateId(boxId,(i+1),subIdList[i]);
|
||||||
//3.去camline数据库 查询此基板ID 对应的订单
|
// }
|
||||||
String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
|
// //3.去camline数据库 查询此基板ID 对应的订单
|
||||||
//4. box信息录入到box表
|
// String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
|
||||||
WoPackagingBox woPackagingBox = new WoPackagingBox();
|
// //4. box信息录入到box表
|
||||||
woPackagingBox.setBoxNo(boxId);
|
// WoPackagingBox woPackagingBox = new WoPackagingBox();
|
||||||
woPackagingBox.setSubstrateQuantity(listSize);
|
// woPackagingBox.setBoxNo(boxId);
|
||||||
woPackagingBox.setPackagingTime(LocalDateTime.now());
|
// woPackagingBox.setSubstrateQuantity(listSize);
|
||||||
woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
|
// woPackagingBox.setPackagingTime(LocalDateTime.now());
|
||||||
woPackagingBox.setLineBody(bySubId.getLineBody());
|
// woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
|
||||||
woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
|
// woPackagingBox.setLineBody(bySubId.getLineBody());
|
||||||
woPackagingBox.setOrderNum(orderNameBySubId);
|
// woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
|
||||||
//1-手动模式,2-自动模式
|
// woPackagingBox.setOrderNum(orderNameBySubId);
|
||||||
woPackagingBox.setModel(2);
|
// //1-手动模式,2-自动模式
|
||||||
woPackagingBox.setCreateTime(LocalDateTime.now());
|
// woPackagingBox.setModel(2);
|
||||||
boxServiceBiz.insert(woPackagingBox);
|
// woPackagingBox.setCreateTime(LocalDateTime.now());
|
||||||
logger.info("BOXID生成Event-------boxId :"+ boxId+"写入数据库成功");
|
// woPackagingBox.setPackagingTime(LocalDateTime.now());
|
||||||
//=============== MES 业务 结束 =================
|
// boxServiceBiz.insert(woPackagingBox);
|
||||||
|
// logger.info("BOXID生成Event-------boxId :"+ boxId+"写入数据库成功");
|
||||||
//三. 把生成的BoxId 告诉kuka
|
// //=============== MES 业务 结束 =================
|
||||||
write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
|
//
|
||||||
logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功");
|
// //三. 把生成的BoxId 告诉kuka
|
||||||
|
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
|
||||||
//四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了
|
// logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功");
|
||||||
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
|
//
|
||||||
logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功");
|
// //四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了
|
||||||
//四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
|
||||||
Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
|
// logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功");
|
||||||
if(subArrived2 != 1){
|
// //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
||||||
logger.info("BOXID生成Event-------失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
// Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
|
||||||
}
|
// if(subArrived2 != 1){
|
||||||
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
// logger.info("BOXID生成Event-------失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||||
logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束");
|
// }
|
||||||
}catch (Throwable e){
|
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
||||||
logger.info("BOXID生成Event------- :" + e.getMessage());
|
// logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束");
|
||||||
}
|
// }catch (Throwable e){
|
||||||
}
|
// e.printStackTrace();
|
||||||
},1,1, TimeUnit.SECONDS);
|
// logger.info("BOXID生成Event------- 出现异常:" + e.toString());
|
||||||
|
// }
|
||||||
kukaStep3.scheduleAtFixedRate(new Runnable() {
|
// }
|
||||||
@Override
|
// },1,1, TimeUnit.SECONDS);
|
||||||
public void run() {
|
//
|
||||||
try {
|
// kukaStep3.scheduleAtFixedRate(new Runnable() {
|
||||||
|
// @Override
|
||||||
//调度开始
|
// public void run() {
|
||||||
Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
|
// try {
|
||||||
if(shelfIsFull != 1){
|
//
|
||||||
logger.info("装箱单打印Event------失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
// //调度开始
|
||||||
}
|
// Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
|
||||||
|
// if(shelfIsFull != 1){
|
||||||
//一. 从plc 中获取 subIdList 和 lineNum
|
// logger.info("装箱单打印Event------失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
||||||
String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
|
// }
|
||||||
Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
|
//
|
||||||
logger.info("装箱单打印Event------到达站台的boxId :"+boxId);
|
// //一. 从plc 中获取 subIdList 和 lineNum
|
||||||
|
// String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
|
||||||
//二. MES 业务
|
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
|
||||||
//=============== MES 业务 开始 =================
|
// logger.info("装箱单打印Event------到达站台的boxId :"+boxId);
|
||||||
//1. box信息录入到box表
|
//
|
||||||
boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
|
// //二. MES 业务
|
||||||
logger.info("装箱单打印Event------boxId :"+boxId+"更新数据库成功");
|
// //=============== MES 业务 开始 =================
|
||||||
//=============== MES 业务 结束 =================
|
// //1. box信息录入到box表
|
||||||
|
// boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
|
||||||
|
// logger.info("装箱单打印Event------boxId :"+boxId+"更新数据库成功");
|
||||||
//四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了
|
// //=============== MES 业务 结束 =================
|
||||||
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
|
//
|
||||||
logger.info("装箱单打印Event------boxId :"+boxId+", ShelfIsFullArrivedFinish置为true 成功");
|
//
|
||||||
//四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
// //四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了
|
||||||
Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
|
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
|
||||||
if(subArrived2 != 1){
|
// logger.info("装箱单打印Event------boxId :"+boxId+", ShelfIsFullArrivedFinish置为true 成功");
|
||||||
logger.info("装箱单打印Event------失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
// //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
||||||
}
|
// Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
|
||||||
logger.info("装箱单打印Event------boxId :"+boxId+", 监听到subArrived=false 成功");
|
// if(subArrived2 != 1){
|
||||||
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
|
// logger.info("装箱单打印Event------失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
||||||
logger.info("装箱单打印Event------boxId :"+boxId+", Even3 成功");
|
// }
|
||||||
}catch (Throwable e){
|
// logger.info("装箱单打印Event------boxId :"+boxId+", 监听到subArrived=false 成功");
|
||||||
logger.info("装箱单打印Event------"+e.getMessage());
|
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
|
||||||
}
|
// logger.info("装箱单打印Event------boxId :"+boxId+", Even3 成功");
|
||||||
|
// }catch (Throwable e){
|
||||||
}
|
// e.printStackTrace();
|
||||||
},1,1, TimeUnit.SECONDS);
|
// logger.info("装箱单打印Event 出现异常------"+e.toString());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// },1,1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public enum Step2Plc2MesVar {
|
|||||||
ShelfIsFull("ShelfIsFull", PlcVar.BOOL,1, DaveArea.DB,2000,48,0),
|
ShelfIsFull("ShelfIsFull", PlcVar.BOOL,1, DaveArea.DB,2000,48,0),
|
||||||
SubIdList("SubIdList",PlcVar.STRING_Array,30,DaveArea.DB,2000,50,0,20),
|
SubIdList("SubIdList",PlcVar.STRING_Array,30,DaveArea.DB,2000,50,0,20),
|
||||||
LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,710,0),
|
LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,710,0),
|
||||||
PackageNumberSet("PackageNumberSet", PlcVar.UINT,1, DaveArea.DB,2000,766,0),
|
PackageNumberSet("PackageNumberSet", PlcVar.UINT,1, DaveArea.DB,2000,764,0),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.cnbm.packing.controller;
|
package com.cnbm.packing.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.cnbm.admin.annotation.LogOperation;
|
import com.cnbm.admin.annotation.LogOperation;
|
||||||
import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
|
import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
|
||||||
import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar;
|
import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar;
|
||||||
@ -11,11 +13,14 @@ import com.cnbm.packing.dto.CamlineSubIdDTO;
|
|||||||
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
|
import com.cnbm.packing.dto.CamlineSubIdForImportDTO;
|
||||||
import com.cnbm.packing.dto.PowerReportDTO;
|
import com.cnbm.packing.dto.PowerReportDTO;
|
||||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
||||||
|
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
|
||||||
import com.cnbm.packing.param.PowerReportQueryParam;
|
import com.cnbm.packing.param.PowerReportQueryParam;
|
||||||
|
import com.cnbm.packing.param.SubIdQueryParam;
|
||||||
import com.cnbm.packing.service.DynamicDataSourceService;
|
import com.cnbm.packing.service.DynamicDataSourceService;
|
||||||
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
||||||
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
|
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
|
||||||
import com.cnbm.packing.vo.PowerReportVo;
|
import com.cnbm.packing.vo.PowerReportVo;
|
||||||
|
import com.cnbm.packing.vo.SubIdPageVo;
|
||||||
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 com.cnbm.s7.s7connector.type.PlcVar;
|
||||||
@ -26,15 +31,19 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.cnbm.common.utils.Result;
|
import com.cnbm.common.utils.Result;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.validation.groups.Default;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.Format;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -58,6 +67,10 @@ public class TestController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
WoPackagingBoxServiceBiz boxServiceBiz;
|
WoPackagingBoxServiceBiz boxServiceBiz;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
WoPackagingBoxSubstrateMapper subMapper;
|
||||||
|
|
||||||
|
|
||||||
private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
|
private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
|
||||||
try {
|
try {
|
||||||
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
||||||
@ -120,6 +133,16 @@ public class TestController {
|
|||||||
System.out.println(Step2Plc2MesVar.SubIdList.getName()+" : "+Arrays.toString(s));
|
System.out.println(Step2Plc2MesVar.SubIdList.getName()+" : "+Arrays.toString(s));
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/subPageMapper")
|
||||||
|
@ApiOperation(value = "基板表 left join box表 分页查询")
|
||||||
|
|
||||||
|
public com.cnbm.packing.vo.R<IPage<SubIdPageVo>> subPageMapper(@Validated({Default.class}) @RequestBody SubIdQueryParam param) {
|
||||||
|
|
||||||
|
return boxServiceBiz.subIdPage(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/forImport")
|
@PostMapping("/forImport")
|
||||||
public R forImport() throws UnsupportedEncodingException, ParseException {
|
public R forImport() throws UnsupportedEncodingException, ParseException {
|
||||||
List<CamlineSubIdForImportDTO> alllCamlineSubForImp = service.getAlllCamlineSubForImp();
|
List<CamlineSubIdForImportDTO> alllCamlineSubForImp = service.getAlllCamlineSubForImp();
|
||||||
@ -135,6 +158,74 @@ public class TestController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/forTestMix")
|
||||||
|
public R forTestMix() throws UnsupportedEncodingException, ParseException {
|
||||||
|
String[] s = new String[20];
|
||||||
|
s[0]= "30110012303021614";
|
||||||
|
s[1]= "30110012303022415";
|
||||||
|
s[2]= "30110012303022801";
|
||||||
|
s[3]= "30110012303040003";
|
||||||
|
s[4]= "30110012303030488";
|
||||||
|
s[5]= "30110012303020247";
|
||||||
|
s[6]= "30110012303021008";
|
||||||
|
s[7]= "30110012303022434";
|
||||||
|
s[8]= "30110012303012878";
|
||||||
|
s[9]= "30110012302281212";
|
||||||
|
s[10]= "30110012302281213";
|
||||||
|
s[11]= "30110012302281215";
|
||||||
|
s[12]= "30110012302271160";
|
||||||
|
s[13]= "30110012302271154";
|
||||||
|
s[14]= "30110012303050321";
|
||||||
|
s[15]= "30110012303050331";
|
||||||
|
s[16]= "30110012303020036";
|
||||||
|
s[17]= "30110012303022606";
|
||||||
|
s[18]= "30110012303030009";
|
||||||
|
s[19]= "30110012303021795";
|
||||||
|
System.out.println(isMixLevel(s));;
|
||||||
|
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(s[0]);
|
||||||
|
System.out.println(bySubId.getSapMaterial());
|
||||||
|
System.out.println(getErrorBoxId(bySubId.getSapMaterial()));
|
||||||
|
System.out.println(getBoxId(bySubId.getSapMaterial()));
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
public String formateString(Integer a){
|
||||||
|
Format f1 = new DecimalFormat("000");
|
||||||
|
return f1.format(a);
|
||||||
|
}
|
||||||
|
public String getBoxId(String sapMaterial){
|
||||||
|
Integer todayBoxNum = service.getTodayBoxNum()+1;
|
||||||
|
String nowTime = DateUtil.format(new Date(), "yyMMdd");
|
||||||
|
|
||||||
|
todayBoxNum+=500;
|
||||||
|
String res = "301"+sapMaterial+nowTime+formateString(todayBoxNum);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
public String getErrorBoxId(String sapMaterial){
|
||||||
|
|
||||||
|
String nowTime = DateUtil.format(new Date(), "yyMMdd");
|
||||||
|
String mixBoxError = "001";
|
||||||
|
String res = "Err"+sapMaterial+nowTime+mixBoxError;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
private boolean isMixLevel(String[] subIds){
|
||||||
|
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
|
||||||
|
String errMsg = "以下基板ID出现混档:";
|
||||||
|
boolean res = false;
|
||||||
|
for(int i=1;i<subIds.length;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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/testReadAll")
|
@PostMapping("/testReadAll")
|
||||||
|
@ -36,9 +36,11 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,33 +127,72 @@ public class WoPackagingBoxSubstrateController {
|
|||||||
return new Result<Long>().ok(dto.getId());
|
return new Result<Long>().ok(dto.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询模组档位统计分布图powerReportTY")
|
||||||
|
@LogOperation("查询模组档位统计分布图powerReportTY")
|
||||||
|
@PostMapping("/powerReportTY")
|
||||||
|
public Result<Boolean> powerReportTY(@RequestBody PowerReportQueryParam queryParam){
|
||||||
|
List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam);
|
||||||
|
System.out.println(powerReportDTOS);
|
||||||
|
return new Result<Boolean>().ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("查询模组档位统计分布图")
|
@ApiOperation("查询模组档位统计分布图")
|
||||||
@LogOperation("查询模组档位统计分布图")
|
@LogOperation("查询模组档位统计分布图")
|
||||||
@PostMapping("/powerReport")
|
@PostMapping("/powerReport")
|
||||||
public Result<PowerReportVo> powerReport(@RequestBody PowerReportQueryParam queryParam){
|
public Result<PowerReportVo> powerReport(@RequestBody PowerReportQueryParam queryParam){
|
||||||
List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam);
|
List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam);
|
||||||
System.out.println(powerReportDTOS.toString());
|
System.out.println(powerReportDTOS.toString());
|
||||||
|
List<PowerReportDTO> powerReportList = new ArrayList<>();
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"115",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"120",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"125",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"130",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"135",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"140",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"145",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"150",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"155",0f,"0%"));
|
||||||
|
powerReportList.add(new PowerReportDTO(0,"160",0f,"0%"));
|
||||||
|
|
||||||
|
|
||||||
|
for(PowerReportDTO power : powerReportList){
|
||||||
|
for(PowerReportDTO inner : powerReportDTOS){
|
||||||
|
if(Objects.equals(power.getSubLevel(), inner.getSubLevel())){
|
||||||
|
power.setProportion(inner.getProportion());
|
||||||
|
power.setSubNum(inner.getSubNum());
|
||||||
|
power.setSumPMPP(inner.getSumPMPP());
|
||||||
|
power.setSubLevel(inner.getSubLevel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(powerReportList.toString());
|
||||||
PowerReportVo powerReportVo = new PowerReportVo();
|
PowerReportVo powerReportVo = new PowerReportVo();
|
||||||
Float totalLevelPower = new Float(0);
|
Float totalLevelPower = new Float(0);
|
||||||
Float totalCompensatePower = new Float(0);
|
Float totalCompensatePower = new Float(0);
|
||||||
Float diversePower = new Float(0);
|
Float diversePower = new Float(0);
|
||||||
Integer totalSubNum = 0;
|
Integer totalSubNum = 0;
|
||||||
for(PowerReportDTO power : powerReportDTOS){
|
for(PowerReportDTO power : powerReportList){
|
||||||
Integer subLevel = Integer.valueOf(power.getSubLevel());
|
Integer subLevel = Integer.valueOf(power.getSubLevel());
|
||||||
Integer subNum = power.getSubNum();
|
Integer subNum = power.getSubNum();
|
||||||
|
if(power.getSumPMPP()==null){
|
||||||
|
return new Result<PowerReportVo>().error("基板等级:"+subLevel+",基板数量:"+subNum+", 的总和为null");
|
||||||
|
}
|
||||||
Float sumPMPP = power.getSumPMPP();
|
Float sumPMPP = power.getSumPMPP();
|
||||||
totalLevelPower += subLevel*subNum;
|
totalLevelPower += subLevel*subNum;
|
||||||
totalCompensatePower += sumPMPP*subNum;
|
totalCompensatePower += sumPMPP*subNum;
|
||||||
totalSubNum+= subNum;
|
totalSubNum+= subNum;
|
||||||
}
|
}
|
||||||
for(PowerReportDTO power : powerReportDTOS){
|
for(PowerReportDTO power : powerReportList){
|
||||||
Float prop = (Float.valueOf(power.getSubNum())/Float.valueOf(totalSubNum))*100;
|
Float prop = (Float.valueOf(power.getSubNum())/Float.valueOf(totalSubNum))*100;
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
String propS = df.format(prop)+"%";
|
String propS = df.format(prop)+"%";
|
||||||
power.setProportion(propS);
|
power.setProportion(propS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
diversePower = totalCompensatePower - totalLevelPower;
|
diversePower = totalCompensatePower - totalLevelPower;
|
||||||
powerReportVo.setPowerReports(powerReportDTOS);
|
powerReportVo.setPowerReports(powerReportList);
|
||||||
powerReportVo.setDiversePower(diversePower);
|
powerReportVo.setDiversePower(diversePower);
|
||||||
powerReportVo.setTotalCompensatePower(totalCompensatePower);
|
powerReportVo.setTotalCompensatePower(totalCompensatePower);
|
||||||
powerReportVo.setTotalLevelPower(totalLevelPower);
|
powerReportVo.setTotalLevelPower(totalLevelPower);
|
||||||
|
@ -31,4 +31,13 @@ public class PowerReportDTO implements Serializable {
|
|||||||
@ApiModelProperty(value = "占比(百分比)")
|
@ApiModelProperty(value = "占比(百分比)")
|
||||||
private String proportion;
|
private String proportion;
|
||||||
|
|
||||||
|
public PowerReportDTO() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public PowerReportDTO(Integer subNum, String subLevel, Float sumPMPP, String proportion) {
|
||||||
|
this.subNum = subNum;
|
||||||
|
this.subLevel = subLevel;
|
||||||
|
this.sumPMPP = sumPMPP;
|
||||||
|
this.proportion = proportion;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,7 +1,11 @@
|
|||||||
package com.cnbm.packing.mapper;
|
package com.cnbm.packing.mapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.cnbm.packing.dto.PowerReportDTO;
|
import com.cnbm.packing.dto.PowerReportDTO;
|
||||||
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
|
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
|
||||||
import com.cnbm.packing.param.PowerReportQueryParam;
|
import com.cnbm.packing.param.PowerReportQueryParam;
|
||||||
|
import com.cnbm.packing.param.SubIdQueryParam;
|
||||||
|
import com.cnbm.packing.vo.SubIdPageVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import com.cnbm.common.dao.BaseDao;
|
import com.cnbm.common.dao.BaseDao;
|
||||||
@ -29,4 +33,7 @@ public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSub
|
|||||||
List<String> orderNameList();
|
List<String> orderNameList();
|
||||||
|
|
||||||
List<WoPackagingBoxSubstrateDTO> substrateList(Map<String, Object> params);
|
List<WoPackagingBoxSubstrateDTO> substrateList(Map<String, Object> params);
|
||||||
|
List<WoPackagingBoxSubstrateDTO> substrateList(@Param("woSubstrateId") String woSubstrateId);
|
||||||
|
|
||||||
|
IPage<SubIdPageVo> subIdPage(Page<?> page, @Param("param") SubIdQueryParam param);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.cnbm.packing.param;
|
package com.cnbm.packing.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -11,10 +12,11 @@ import java.time.LocalDateTime;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class PowerReportQueryParam {
|
public class PowerReportQueryParam {
|
||||||
|
//@JsonFormat(shape=JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime begin;
|
private LocalDateTime begin;
|
||||||
|
//@JsonFormat(shape= JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime end;
|
private LocalDateTime end;
|
||||||
private String orderName;
|
private String orderName;
|
||||||
|
|
||||||
private Integer model;
|
private Integer model;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.cnbm.packing.param;
|
||||||
|
|
||||||
|
import com.cnbm.packing.vo.BasePageParam;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Desc: ""
|
||||||
|
* @Author: caixiang
|
||||||
|
* @DATE: 2023/2/15 19:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubIdQueryParam extends BasePageParam {
|
||||||
|
private String boxNo;
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package com.cnbm.packing.service;
|
package com.cnbm.packing.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
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.CrudService;
|
import com.cnbm.common.service.CrudService;
|
||||||
import com.cnbm.packing.dto.IdVo;
|
import com.cnbm.packing.dto.IdVo;
|
||||||
@ -8,6 +10,9 @@ import com.cnbm.packing.dto.WoPackagingBoxDTO;
|
|||||||
import com.cnbm.packing.entity.WoPackagingBox;
|
import com.cnbm.packing.entity.WoPackagingBox;
|
||||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
||||||
import com.cnbm.packing.param.PowerReportQueryParam;
|
import com.cnbm.packing.param.PowerReportQueryParam;
|
||||||
|
import com.cnbm.packing.param.SubIdQueryParam;
|
||||||
|
import com.cnbm.packing.vo.R;
|
||||||
|
import com.cnbm.packing.vo.SubIdPageVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -49,4 +54,6 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
|
|||||||
|
|
||||||
List<PowerReportDTO> powerReport(PowerReportQueryParam queryParam);
|
List<PowerReportDTO> powerReport(PowerReportQueryParam queryParam);
|
||||||
List<String> orderNameList();
|
List<String> orderNameList();
|
||||||
|
|
||||||
|
R<IPage<SubIdPageVo>> subIdPage(SubIdQueryParam param);
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ 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.admin.utils.BaseSupportUtils;
|
import com.cnbm.admin.utils.BaseSupportUtils;
|
||||||
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;
|
||||||
@ -15,8 +16,11 @@ import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
|||||||
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
|
import com.cnbm.packing.mapper.WoPackagingBoxMapper;
|
||||||
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
|
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
|
||||||
import com.cnbm.packing.param.PowerReportQueryParam;
|
import com.cnbm.packing.param.PowerReportQueryParam;
|
||||||
|
import com.cnbm.packing.param.SubIdQueryParam;
|
||||||
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
|
||||||
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
|
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
|
||||||
|
import com.cnbm.packing.vo.R;
|
||||||
|
import com.cnbm.packing.vo.SubIdPageVo;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -236,4 +240,12 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
|
|||||||
public List<String> orderNameList() {
|
public List<String> orderNameList() {
|
||||||
return substrateMapper.orderNameList();
|
return substrateMapper.orderNameList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<IPage<SubIdPageVo>> subIdPage(SubIdQueryParam param) {
|
||||||
|
IPage<SubIdPageVo> iPage = substrateMapper.subIdPage(
|
||||||
|
new Page<>(param.getCurrent(), param.getSize()),
|
||||||
|
param);
|
||||||
|
return R.ok(iPage);
|
||||||
|
}
|
||||||
}
|
}
|
105
ym-packing/src/main/java/com/cnbm/packing/vo/ApiErrorCode.java
Normal file
105
ym-packing/src/main/java/com/cnbm/packing/vo/ApiErrorCode.java
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018.
|
||||||
|
* http://www.ulabcare.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cnbm.packing.vo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* REST API 错误码
|
||||||
|
*
|
||||||
|
* @author jiff
|
||||||
|
* @date 2018/11/1
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public enum ApiErrorCode implements IErrorCode {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功
|
||||||
|
*/
|
||||||
|
SUCCESSFUL(CODE_SUCCESSFUL, "成功"),
|
||||||
|
/**
|
||||||
|
* 失败
|
||||||
|
*/
|
||||||
|
FAILED(CODE_FAILED, "失败"),
|
||||||
|
/**
|
||||||
|
* 无效的请求参数
|
||||||
|
*/
|
||||||
|
//INVALID_PARAMETER(CODE_INVALID_PARAMETER, "无效的请求参数"),
|
||||||
|
INVALID_PARAMETER(CODE_INVALID_PARAMETER, "Invalid request parameter"),
|
||||||
|
/**
|
||||||
|
* 数据未授权
|
||||||
|
*/
|
||||||
|
FORBIDDEN_DATA(CODE_FORBIDDEN_DATA, "数据未授权"),
|
||||||
|
/**
|
||||||
|
* 用户已存在
|
||||||
|
*/
|
||||||
|
USER_EXISTENT(CODE_USER_EXISTENT, "用户已存在"),
|
||||||
|
/**
|
||||||
|
* 用户不存在
|
||||||
|
*/
|
||||||
|
//USER_NON_EXISTENT(CODE_USER_NON_EXISTENT, "用户不存在"),
|
||||||
|
USER_NON_EXISTENT(CODE_USER_NON_EXISTENT, "User does not exist"),
|
||||||
|
/**
|
||||||
|
* 用户已停用
|
||||||
|
*/
|
||||||
|
USER_DISABLED(CODE_FAILED, "用户已停用"),
|
||||||
|
/**
|
||||||
|
* 用户不存在或密码错误
|
||||||
|
*/
|
||||||
|
USER_NON_EXISTENT_OR_INVALID_PASSWORD(CODE_FAILED, "The user does not exist or the password is wrong"),
|
||||||
|
//USER_NON_EXISTENT_OR_INVALID_PASSWORD(CODE_FAILED, "用户不存在或密码错误"),
|
||||||
|
/**
|
||||||
|
* 密码错误
|
||||||
|
*/
|
||||||
|
//INVALID_PASSWORD(CODE_FAILED, "密码错误"),
|
||||||
|
INVALID_PASSWORD(CODE_FAILED, "Wrong password"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电话号码不能为空
|
||||||
|
*/
|
||||||
|
MOBILE_IS_EMPTY(CODE_FAILED, "手机号码不能为空"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户未登录
|
||||||
|
*/
|
||||||
|
UNAUTHORIZED(CODE_UNAUTHORIZED, "用户未登录"),
|
||||||
|
/**
|
||||||
|
* 用户未授权
|
||||||
|
*/
|
||||||
|
FORBIDDEN(CODE_FORBIDDEN, "用户未授权");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String msg;
|
||||||
|
|
||||||
|
ApiErrorCode(final int code, final String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApiErrorCode fromCode(int code) {
|
||||||
|
ApiErrorCode[] apiErrorCodes = ApiErrorCode.values();
|
||||||
|
for (ApiErrorCode apiErrorCode : apiErrorCodes) {
|
||||||
|
if (apiErrorCode.getCode() == code) {
|
||||||
|
return apiErrorCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format(" ErrorCode:{code=%s, msg=%s} ", code, msg);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.cnbm.packing.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页入参基础类
|
||||||
|
*
|
||||||
|
* @author Mr.ZhangShi
|
||||||
|
* @date 2018/11/6 11:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class BasePageParam extends BaseParam {
|
||||||
|
@ApiModelProperty(value = "当前页", required = true, example = "1")
|
||||||
|
@NotNull(message = "页码不能为空")
|
||||||
|
@Range(min = 1, message = "页码必须大于等于1")
|
||||||
|
private Integer current;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "每页显示条数", required = true, example = "10")
|
||||||
|
@NotNull(message = "每页显示条数不能为空")
|
||||||
|
@Range(min = 1, max = 1000, message = "每页显示条数范围需在1-1000之间")
|
||||||
|
private Integer size;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "启用状态", notes = "0 、停用,1、启用", example = "1")
|
||||||
|
@Range(min = 0, max = 1, message = "启用状态只能为0或1")
|
||||||
|
private Integer enabled;
|
||||||
|
}
|
19
ym-packing/src/main/java/com/cnbm/packing/vo/BaseParam.java
Normal file
19
ym-packing/src/main/java/com/cnbm/packing/vo/BaseParam.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018.
|
||||||
|
* http://www.ulabcare.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cnbm.packing.vo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口请求参数基类
|
||||||
|
*
|
||||||
|
* @author jiff
|
||||||
|
* @date 2018/11/1
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class BaseParam implements Serializable {
|
||||||
|
|
||||||
|
}
|
63
ym-packing/src/main/java/com/cnbm/packing/vo/IErrorCode.java
Normal file
63
ym-packing/src/main/java/com/cnbm/packing/vo/IErrorCode.java
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018.
|
||||||
|
* http://www.ulabcare.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cnbm.packing.vo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* api错误码定义
|
||||||
|
*
|
||||||
|
* @author jiff
|
||||||
|
* @date 2018/11/1
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public interface IErrorCode {
|
||||||
|
/**
|
||||||
|
* 成功
|
||||||
|
*/
|
||||||
|
int CODE_SUCCESSFUL = 0;
|
||||||
|
/**
|
||||||
|
* 失败
|
||||||
|
*/
|
||||||
|
int CODE_FAILED = 1;
|
||||||
|
/**
|
||||||
|
* 无效的请求参数
|
||||||
|
*/
|
||||||
|
int CODE_INVALID_PARAMETER = 2;
|
||||||
|
/**
|
||||||
|
* 数据未授权
|
||||||
|
*/
|
||||||
|
int CODE_FORBIDDEN_DATA = 9;
|
||||||
|
/**
|
||||||
|
* 用户已存在
|
||||||
|
*/
|
||||||
|
int CODE_USER_EXISTENT = 10;
|
||||||
|
/**
|
||||||
|
* 用户不存在
|
||||||
|
*/
|
||||||
|
int CODE_USER_NON_EXISTENT = 11;
|
||||||
|
/**
|
||||||
|
* 用户未登录
|
||||||
|
*/
|
||||||
|
int CODE_UNAUTHORIZED = 401;
|
||||||
|
/**
|
||||||
|
* 用户未授权
|
||||||
|
*/
|
||||||
|
int CODE_FORBIDDEN = 403;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误编码:0、成功 否则失败
|
||||||
|
*
|
||||||
|
* @return 错误码:0、成功 否则失败
|
||||||
|
*/
|
||||||
|
int getCode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误描述
|
||||||
|
*
|
||||||
|
* @return 错误描述
|
||||||
|
*/
|
||||||
|
String getMsg();
|
||||||
|
}
|
102
ym-packing/src/main/java/com/cnbm/packing/vo/R.java
Normal file
102
ym-packing/src/main/java/com/cnbm/packing/vo/R.java
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018.
|
||||||
|
* http://www.ulabcare.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cnbm.packing.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理结果类
|
||||||
|
*
|
||||||
|
* @param <T> 返回的数据类型
|
||||||
|
* @author jiff
|
||||||
|
* @date 2018/11/7
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString
|
||||||
|
@ApiModel("处理结果类")
|
||||||
|
@Accessors
|
||||||
|
public class R<T> implements Serializable {
|
||||||
|
@NonNull
|
||||||
|
@ApiModelProperty(value = "结果码", example = "0")
|
||||||
|
private int code = IErrorCode.CODE_SUCCESSFUL;
|
||||||
|
@ApiModelProperty(value = "结果说明", example = "成功")
|
||||||
|
private String msg;
|
||||||
|
@ApiModelProperty(value = "业务数据")
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public R<T> code(int code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public R<T> msg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public R<T> data(T data) {
|
||||||
|
this.data = data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean ok() {
|
||||||
|
return code == IErrorCode.CODE_SUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> failed() {
|
||||||
|
return failed("系统错误!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> failed(String msg) {
|
||||||
|
return failed(ApiErrorCode.FAILED.getCode(), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> failed(int code, String msg) {
|
||||||
|
return failed(code, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> failed(int code, String msg, T data) {
|
||||||
|
return r(code == ApiErrorCode.SUCCESSFUL.getCode() ? ApiErrorCode.FAILED.getCode() : code, msg, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> failed(IErrorCode errorCode) {
|
||||||
|
return r(errorCode, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> r(IErrorCode errorCode, T data) {
|
||||||
|
return r(errorCode.getCode(), errorCode.getMsg(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> r(int code, String msg, T data) {
|
||||||
|
return new R<T>().code(code).msg(msg).data(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> unauthorized() {
|
||||||
|
return failed(ApiErrorCode.UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> forbidden() {
|
||||||
|
return failed(ApiErrorCode.FORBIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> ok(T data) {
|
||||||
|
return new R<T>().data(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> R<T> ok(String msg, T data) {
|
||||||
|
return new R<T>().msg(msg).data(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.cnbm.packing.vo;
|
||||||
|
|
||||||
|
import com.cnbm.packing.dto.PowerReportDTO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Desc: ""
|
||||||
|
* @Author: caixiang
|
||||||
|
* @DATE: 2023/3/6 9:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubIdPageVo {
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private String subId;
|
||||||
|
private String boxNo;
|
||||||
|
}
|
@ -154,70 +154,61 @@
|
|||||||
LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID
|
LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID
|
||||||
WHERE
|
WHERE
|
||||||
tu.NAME IN (
|
tu.NAME IN (
|
||||||
'30110012302272191',
|
'30110012303050629',
|
||||||
'30110012302131618',
|
'30110012302272118',
|
||||||
'30110012303012944',
|
'30110012303050331',
|
||||||
'30110012303020207',
|
'30110012303050321',
|
||||||
'30110012302241261',
|
'30110012303030164',
|
||||||
'30110012302241398',
|
'30110012303023000',
|
||||||
'30110012302230861',
|
'30110012303011203',
|
||||||
'30110012302233064',
|
'30110012303012089',
|
||||||
'30110012302281480',
|
'30110012303011487',
|
||||||
'30110012302282683',
|
'30110012302271154',
|
||||||
'30110012302240071',
|
'30110012302283324',
|
||||||
'30110012302250901',
|
'30110012303030787',
|
||||||
'30110012303011030',
|
'30110012303050373',
|
||||||
'30110012302250913',
|
'30110012303022841',
|
||||||
'30110012302270254',
|
'30110012303021008',
|
||||||
'30110012302092199',
|
'30110012303030325',
|
||||||
'30110012303020200',
|
'30110012302283810',
|
||||||
'30110012303012545',
|
'30110012303011490',
|
||||||
'30110012302142542',
|
'30110012303022163',
|
||||||
'30110012302232978',
|
'30110012303012695',
|
||||||
'30110012303020850',
|
'30110012303010372',
|
||||||
'30110012303020177',
|
'30110012303020247',
|
||||||
'30110012302250223',
|
'30110012303022801',
|
||||||
'30110012302232990',
|
'30110012303022407',
|
||||||
'30110012303013332',
|
'30110012303012915',
|
||||||
'30110012302232986',
|
'30110012303022996',
|
||||||
'30110012302232985',
|
'30110012303022721',
|
||||||
'30110012302284455',
|
'30110012303040003',
|
||||||
'30110012302233312',
|
'30110012303023102',
|
||||||
'30110012303020358',
|
'30110012302281213',
|
||||||
'30110012302282341',
|
'30110012303022204',
|
||||||
'30110012303020199',
|
'30110012302281212',
|
||||||
'30110012302272331',
|
'30110012303022970',
|
||||||
'30110012303021196',
|
'30110012303022415',
|
||||||
'30110012302233336',
|
'30110012303050341',
|
||||||
'30110012303020006',
|
'30110012303022434',
|
||||||
'30110012302242395',
|
'30110012302271569',
|
||||||
'30110012302233328',
|
'30110012303030505',
|
||||||
'30110012303012521',
|
'30110012303021276',
|
||||||
'30110012302233506',
|
'30110012302280295',
|
||||||
'30110012302242632',
|
'30110012303022166',
|
||||||
'30110012302233332',
|
'30110012303022299',
|
||||||
'30110012302232981',
|
'30110012303020988',
|
||||||
'30110012303020183',
|
'30110012302271160',
|
||||||
'30110012302283758',
|
'30110012302281215',
|
||||||
'30110012302280081',
|
'30110012303050537',
|
||||||
'30110012303020128',
|
'30110012302272052',
|
||||||
'30110012302241074',
|
'30110012303011213',
|
||||||
'30110012303020008',
|
'30110012303030488',
|
||||||
'30110012303020088',
|
'30110012303021614',
|
||||||
'30110012302232982',
|
'30110012303012878',
|
||||||
'30110012303012916',
|
'30110012302242962',
|
||||||
'30110012302230019',
|
'30110012303030608',
|
||||||
'30110012302271634',
|
'30110012303012697',
|
||||||
'30110012302251127',
|
'30110012303020737'
|
||||||
'30110012302230021',
|
|
||||||
'30110012303010971',
|
|
||||||
'30110012302251123',
|
|
||||||
'30110012302140610'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
and flc.PMPP != 0
|
and flc.PMPP != 0
|
||||||
GROUP BY tu.`NAME`
|
GROUP BY tu.`NAME`
|
||||||
@ -239,7 +230,10 @@
|
|||||||
<select id="getTodayBoxNum" resultType="java.lang.Integer">
|
<select id="getTodayBoxNum" resultType="java.lang.Integer">
|
||||||
select count(1)
|
select count(1)
|
||||||
from t_wo_packaging_box twpb
|
from t_wo_packaging_box twpb
|
||||||
where twpb.CREATE_TIME BETWEEN DATE_FORMAT(NOW(),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(NOW(),'%Y-%m-%d 23:59:59')
|
where
|
||||||
|
twpb.CREATE_TIME BETWEEN DATE_FORMAT(NOW(),'%Y-%m-%d 00:00:00') AND DATE_FORMAT(NOW(),'%Y-%m-%d 23:59:59')
|
||||||
|
and
|
||||||
|
twpb.model = 2
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,11 @@
|
|||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="ResultMap" type="com.cnbm.packing.vo.SubIdPageVo">
|
||||||
|
<result column="CREATE_TIME" property="createTime" />
|
||||||
|
<result column="SUB_ID" property="subId" />
|
||||||
|
<result column="BOX_NO" property="boxNo" />
|
||||||
|
</resultMap>
|
||||||
<update id="updatePackagingBoxIdAndSlotByWoSubstrateId">
|
<update id="updatePackagingBoxIdAndSlotByWoSubstrateId">
|
||||||
update t_wo_packaging_box_substrate
|
update t_wo_packaging_box_substrate
|
||||||
set PACKAGING_BOX_ID = #{packagingBoxId,jdbcType=VARCHAR},
|
set PACKAGING_BOX_ID = #{packagingBoxId,jdbcType=VARCHAR},
|
||||||
@ -139,5 +143,17 @@
|
|||||||
order by twpb.CREATE_TIME desc
|
order by twpb.CREATE_TIME desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="subIdPage" resultMap="ResultMap">
|
||||||
|
SELECT
|
||||||
|
twpb.BOX_NO ,twpbs.WO_SUBSTRATE_ID as SUB_ID ,twpb.CREATE_TIME
|
||||||
|
FROM T_WO_PACKAGING_BOX_SUBSTRATE twpbs
|
||||||
|
LEFT JOIN T_WO_PACKAGING_BOX twpb ON twpbs.PACKAGING_BOX_ID = twpb.BOX_NO
|
||||||
|
<where>
|
||||||
|
<if test="param.boxNo != null">
|
||||||
|
twpb.BOX_NO = #{param.boxNo}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user