Compare commits

..

4 Commits

Author SHA1 Message Date
caixiang
c37f25a874 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4
# Conflicts:
#	ym-packing/src/main/java/com/cnbm/packing/controller/WoPackagingBoxSubstrateController.java
#	ym-packing/src/main/java/com/cnbm/packing/mapper/WoPackagingBoxSubstrateMapper.java
2023-03-17 12:41:54 +08:00
caixiang
78c9cbd686 查询模组档位统计分布图 修改 2023-03-17 12:39:56 +08:00
caixiang
ee0bd67011 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-03-08 13:03:21 +08:00
caixiang
4d8f2bfe74 commit for pull 2023-03-08 13:03:13 +08:00
21 changed files with 864 additions and 322 deletions

View File

@ -82,9 +82,11 @@ public class JwtUtil {
public static void main(String[] args) throws Exception {
// String jwt = createJWT("123");
Claims claims = parseJWT("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI5OWNhNGJhMjg5ZjU0OTVjODE5YTM0N2ExZmNlZjc0YSIsInN1YiI6IjEyMyIsImlzcyI6IndoeSIsImlhdCI6MTY1NDc1OTg5NiwiZXhwIjoxNjU0NzYzNDk2fQ.CTgS6yQjfXSGPJUTu-_rqjkh_KB_F9SzPThFfnvB5yg");
Claims claims = parseJWT("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkNTQxODQ5NjNjMWM0NzgzOTA0ZDAwZGI1ZmNkNWU3NiIsInN1YiI6IjEwNjcyNDY4NzU4MDAwMDAwMDEiLCJpc3MiOiJ3aHkiLCJpYXQiOjE2Nzg5MzE1MjAsImV4cCI6MTY3ODkzNTEyMH0.2we9FhhFU2Qvx2fvywqmA8A1qs0mbdXvr8T2CjJUz7o");
String subject = claims.getSubject();
System.out.println(subject);
System.out.println(claims.toString());
// System.out.println(claims);
}

View File

@ -33,8 +33,8 @@ spring:
enabled: true
redis:
database: 6
#host: 127.0.0.1
host: 10.0.1.249
host: 127.0.0.1
#host: 10.0.1.249
#host: 192.168.0.102
port: 6379
password: '' # 密码(默认为空)

View File

@ -14,9 +14,9 @@
<!-- <property name="logging.pathmq" value="C:/qgs_logger/mq" />-->
<!-- <property name="logging.eqlog" value="C:/qgs_logger/s7" />-->
<property name="logging.eqlog" value="/usr/local/logger/EQCommunicationLog" />
<property name="logging.packing" value="/usr/local/logger/Packing" />
<property name="logging.pathwork" value="/usr/local/logger/Working" />
<property name="logging.eqlog" value="/var/log/logger/EQCommunicationLog" />
<property name="logging.packing" value="/var/log/logger/Packing" />
<property name="logging.pathwork" value="/var/log/logger/Working" />
<!--0. 日志格式和颜色渲染 -->

View File

@ -184,11 +184,11 @@ public class KukaJoinThread implements ApplicationRunner {
}
//return true 出现混档了return false 没有出现混档
private boolean isMixLevel(String[] subIds){
private boolean isMixLevel(String[] subIds,Integer size){
String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel();
String errMsg = "以下基板ID出现混档";
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();
if(!powerLevel.equals(correctLevel)){
@ -199,254 +199,259 @@ public class KukaJoinThread implements ApplicationRunner {
if(res){
logger.error(errMsg);
}
return res;
}
@Override
public void run(ApplicationArguments args) throws Exception {
kukaStep1.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
//调度开始
// logger.info("");
// logger.info("================= 现在开始执行 过程一 任务 ==================");
Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
if(subArrived != 1){
logger.info("标签打印Event--- 失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
}
//. 从plc 中获取 subId lineNum
String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
//把基板ID字符串的空格去掉因为plc中设置的20位但实际基板ID就是17位因为带空格去数据库查询 有问题的
subId = removeKG(subId);
//. MES 业务
//=============== MES 业务 开始 =================
//1. 从comline数据库中获取 实际pmpp
float pmppActual = service.getPMPPBySubId(subId);
//2. 匹配和计算补偿功率
float pmppCompensation = compensationPowerServiceBiz.calculCompensationPMPP(pmppActual,lineNum);
//3. 依据补偿功率获取工艺参数并且把这些工艺参数传给kuka
WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(pmppCompensation, lineNum);
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
logger.info("标签打印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. 把基板录到数据库
WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
woPackagingBoxSubstrate.setLineBody(lineNum);
woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
woPackagingBoxSubstrate.setWoSubstrateId(subId);
woPackagingBoxSubstrate.setActualPmpp(pmppActual);
woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now());
woPackagingBoxSubstrate.setPmpp(pmppCompensation);
//5. 从camline那里获取可变字段
CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
logger.info("标签打印Event--- 基板ID: "+subId+", 从camline获取PID16~PID22 的实测数据 成功, 数据内容:"+extendArgFromCamline.toString());
woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
substrateServiceBiz.insert(woPackagingBoxSubstrate);
logger.info("标签打印Event--- 基板ID: "+subId+", 录入数据库成功");
//=============== MES 业务 结束 =================
//. 当MES完成任务后把MesToPlc.SubArrivedFinish变量置为true告诉plc我操作完成了
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish置为true 成功");
//. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
if(subArrived2 != 1){
logger.info("标签打印Event--- 失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
}
write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish置为 false 成功, Event1 成功结束");
}catch (Throwable e){
logger.info("标签打印Event--- :"+e.getMessage());
}
}
},1,1, TimeUnit.SECONDS);
kukaStep2.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
//调度开始
Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
if(shelfIsFull != 1){
logger.info("BOXID生成Event-------失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
}
//. 从plc 中获取 subIdList lineNum
String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
Integer listSize = (Integer)read(S7Client.S7_KUKA,Step2Plc2MesVar.PackageNumberSet);
//. MES 业务
//=============== MES 业务 开始 =================
//1.MES 生成BoxId
if(subIdList.length<=0){
logger.info("BOXID生成Event-------失败"+" --- "+"从plc里面获取到的基板列表 为空");
throw new Exception("BOXID生成Event-------kuka机械手 取到了空箱");
}
//真实的基板ID 就是17位的plc读取过来有空格要把后面3位空格去掉就行了
for(int i=0;i<subIdList.length;i++){
subIdList[i] = removeKG(subIdList[i]);
}
logger.info("BOXID生成Event-------获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize);
WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
//如果我们系统中找不到这块基板那么就去camline里面找
if(bySubId == null){
//todo
CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
bySubId = new WoPackagingBoxSubstrate();
bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
bySubId.setLineBody(2);
}
//校验是否存在混档位情况
String boxId = "";
if(isMixLevel(subIdList)){
//出现混档
boxId = getBoxId(bySubId.getSapMaterial());
}else {
//正常情况
boxId = getErrorBoxId(bySubId.getSapMaterial());
}
logger.info("BOXID生成Event-------mes 生成的boxId :"+ boxId);
//2. 依次update 基板表把boxId 赋予这些基板
for(int i=0;i<listSize;i++){
substrateServiceBiz.updatePackagingBoxIdAndSlotByWoSubstrateId(boxId,(i+1),subIdList[i]);
}
//3.去camline数据库 查询此基板ID 对应的订单
String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
//4. box信息录入到box表
WoPackagingBox woPackagingBox = new WoPackagingBox();
woPackagingBox.setBoxNo(boxId);
woPackagingBox.setSubstrateQuantity(listSize);
woPackagingBox.setPackagingTime(LocalDateTime.now());
woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
woPackagingBox.setLineBody(bySubId.getLineBody());
woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
woPackagingBox.setOrderNum(orderNameBySubId);
//1-手动模式2-自动模式
woPackagingBox.setModel(2);
woPackagingBox.setCreateTime(LocalDateTime.now());
boxServiceBiz.insert(woPackagingBox);
logger.info("BOXID生成Event-------boxId :"+ boxId+"写入数据库成功");
//=============== MES 业务 结束 =================
//. 把生成的BoxId 告诉kuka
write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功");
//. 当MES完成任务后把MesToPlc.ShelfIsFullFinish变量置为true告诉plc我操作完成了
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功");
//. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
if(subArrived2 != 1){
logger.info("BOXID生成Event-------失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
}
write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束");
}catch (Throwable e){
logger.info("BOXID生成Event------- :" + e.getMessage());
}
}
},1,1, TimeUnit.SECONDS);
kukaStep3.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try {
//调度开始
Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
if(shelfIsFull != 1){
logger.info("装箱单打印Event------失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
}
//. 从plc 中获取 subIdList lineNum
String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
logger.info("装箱单打印Event------到达站台的boxId :"+boxId);
//. MES 业务
//=============== MES 业务 开始 =================
//1. box信息录入到box表
boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
logger.info("装箱单打印Event------boxId :"+boxId+"更新数据库成功");
//=============== MES 业务 结束 =================
//. 当MES完成任务后把MesToPlc.ShelfIsFullArrivedFinish变量置为true告诉plc我操作完成了
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
logger.info("装箱单打印Event------boxId :"+boxId+" ShelfIsFullArrivedFinish置为true 成功");
//. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
if(subArrived2 != 1){
logger.info("装箱单打印Event------失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
}
logger.info("装箱单打印Event------boxId :"+boxId+" 监听到subArrived=false 成功");
write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
logger.info("装箱单打印Event------boxId :"+boxId+" Even3 成功");
}catch (Throwable e){
logger.info("装箱单打印Event------"+e.getMessage());
}
}
},1,1, TimeUnit.SECONDS);
//
// kukaStep1.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// try {
//
// //调度开始
//// logger.info("");
//// logger.info("================= 现在开始执行 过程一 任务 ==================");
// Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
// if(subArrived != 1){
// logger.info("标签打印Event--- 失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
//
// //. 从plc 中获取 subId lineNum
// String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
// //把基板ID字符串的空格去掉因为plc中设置的20位但实际基板ID就是17位因为带空格去数据库查询 有问题的
// subId = removeKG(subId);
//
// //. MES 业务
// //=============== MES 业务 开始 =================
// //1. 从comline数据库中获取 实际pmpp
// float pmppActual = service.getPMPPBySubId(subId);
// //2. 匹配和计算补偿功率
// float pmppCompensation = compensationPowerServiceBiz.calculCompensationPMPP(pmppActual,lineNum);
// //3. 依据补偿功率获取工艺参数并且把这些工艺参数传给kuka
// WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(pmppCompensation, lineNum);
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
// logger.info("标签打印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. 把基板录到数据库
// WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
// woPackagingBoxSubstrate.setLineBody(lineNum);
// woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
// woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
// woPackagingBoxSubstrate.setWoSubstrateId(subId);
// woPackagingBoxSubstrate.setActualPmpp(pmppActual);
// woPackagingBoxSubstrate.setCreateTime(LocalDateTime.now());
// woPackagingBoxSubstrate.setPmpp(pmppCompensation);
//
//
// //5. 从camline那里获取可变字段
// CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
// logger.info("标签打印Event--- 基板ID: "+subId+", 从camline获取PID16~PID22 的实测数据 成功, 数据内容:"+extendArgFromCamline.toString());
// woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
//
// woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
// woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
// woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
// woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
// woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
// woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
// woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
// woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
// woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
// woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
// woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
// woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
// woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
// woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
// woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
// woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
// woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
// woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
// woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
// woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
// woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
// woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
// woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
// woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
// woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
// woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
// woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
// woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
// woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
//
// substrateServiceBiz.insert(woPackagingBoxSubstrate);
// logger.info("标签打印Event--- 基板ID: "+subId+", 录入数据库成功");
// //=============== MES 业务 结束 =================
//
// //. 当MES完成任务后把MesToPlc.SubArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
// logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish置为true 成功");
// //. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
// if(subArrived2 != 1){
// logger.info("标签打印Event--- 失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
//
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
// logger.info("标签打印Event--- 基板ID: "+subId+", SubArrivedFinish置为 false 成功, Event1 成功结束");
//
// }catch (Throwable e){
// e.printStackTrace();
// logger.info("标签打印Event--- 出现异常 :"+e.toString());
// }
// }
// },1,1, TimeUnit.SECONDS);
//
// kukaStep2.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// try {
//
// //调度开始
// Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
// if(shelfIsFull != 1){
// logger.info("BOXID生成Event-------失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
// }
//
// //. 从plc 中获取 subIdList lineNum
// String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
// Integer listSize = (Integer)read(S7Client.S7_KUKA,Step2Plc2MesVar.PackageNumberSet)-1;
//
//
// //. MES 业务
// //=============== MES 业务 开始 =================
// //1.MES 生成BoxId
// if(subIdList.length<=0){
// logger.info("BOXID生成Event-------失败"+" --- "+"从plc里面获取到的基板列表 为空");
// throw new Exception("BOXID生成Event-------kuka机械手 取到了空箱");
// }
// //真实的基板ID 就是17位的plc读取过来有空格要把后面3位空格去掉就行了
// for(int i=0;i<subIdList.length;i++){
// subIdList[i] = removeKG(subIdList[i]);
// }
// logger.info("BOXID生成Event-------获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize);
//
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
// logger.info("bySubId"+ bySubId.toString());
// //如果我们系统中找不到这块基板那么就去camline里面找
// if(bySubId == null){
//
// //todo
// CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIdList[0]);
// bySubId = new WoPackagingBoxSubstrate();
// bySubId.setPowerLevel(subIdByCamline.getPowerLevel());
// bySubId.setSapMaterial(subIdByCamline.getSapMaterial());
// bySubId.setLineBody(2);
// }
//
// //校验是否存在混档位情况
// String boxId = "";
// if(isMixLevel(subIdList,listSize)){
// //出现混档
// boxId = getErrorBoxId(bySubId.getSapMaterial());
// }else {
// //正常情况
// boxId = getBoxId(bySubId.getSapMaterial());
// }
//
// logger.info("BOXID生成Event-------mes 生成的boxId :"+ boxId);
// //2. 依次update 基板表把boxId 赋予这些基板
// for(int i=0;i<listSize;i++){
// substrateServiceBiz.updatePackagingBoxIdAndSlotByWoSubstrateId(boxId,(i+1),subIdList[i]);
// }
// //3.去camline数据库 查询此基板ID 对应的订单
// String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
// //4. box信息录入到box表
// WoPackagingBox woPackagingBox = new WoPackagingBox();
// woPackagingBox.setBoxNo(boxId);
// woPackagingBox.setSubstrateQuantity(listSize);
// woPackagingBox.setPackagingTime(LocalDateTime.now());
// woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
// woPackagingBox.setLineBody(bySubId.getLineBody());
// woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
// woPackagingBox.setOrderNum(orderNameBySubId);
// //1-手动模式2-自动模式
// woPackagingBox.setModel(2);
// woPackagingBox.setCreateTime(LocalDateTime.now());
// woPackagingBox.setPackagingTime(LocalDateTime.now());
// boxServiceBiz.insert(woPackagingBox);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"写入数据库成功");
// //=============== MES 业务 结束 =================
//
// //. 把生成的BoxId 告诉kuka
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功");
//
// //. 当MES完成任务后把MesToPlc.ShelfIsFullFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功");
// //. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
// if(subArrived2 != 1){
// logger.info("BOXID生成Event-------失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
// logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束");
// }catch (Throwable e){
// e.printStackTrace();
// logger.info("BOXID生成Event------- 出现异常:" + e.toString());
// }
// }
// },1,1, TimeUnit.SECONDS);
//
// kukaStep3.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// try {
//
// //调度开始
// Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
// if(shelfIsFull != 1){
// logger.info("装箱单打印Event------失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// }
//
// //. 从plc 中获取 subIdList lineNum
// String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
// logger.info("装箱单打印Event------到达站台的boxId :"+boxId);
//
// //. MES 业务
// //=============== MES 业务 开始 =================
// //1. box信息录入到box表
// boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
// logger.info("装箱单打印Event------boxId :"+boxId+"更新数据库成功");
// //=============== MES 业务 结束 =================
//
//
// //. 当MES完成任务后把MesToPlc.ShelfIsFullArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
// logger.info("装箱单打印Event------boxId :"+boxId+" ShelfIsFullArrivedFinish置为true 成功");
// //. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
// if(subArrived2 != 1){
// logger.info("装箱单打印Event------失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// }
// logger.info("装箱单打印Event------boxId :"+boxId+" 监听到subArrived=false 成功");
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
// logger.info("装箱单打印Event------boxId :"+boxId+" Even3 成功");
// }catch (Throwable e){
// e.printStackTrace();
// logger.info("装箱单打印Event 出现异常------"+e.toString());
// }
//
// }
// },1,1, TimeUnit.SECONDS);
}

View File

@ -15,7 +15,7 @@ public enum Step2Plc2MesVar {
ShelfIsFull("ShelfIsFull", PlcVar.BOOL,1, DaveArea.DB,2000,48,0),
SubIdList("SubIdList",PlcVar.STRING_Array,30,DaveArea.DB,2000,50,0,20),
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),
;

View File

@ -1,5 +1,7 @@
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.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
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.PowerReportDTO;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.param.SubIdQueryParam;
import com.cnbm.packing.service.DynamicDataSourceService;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
import com.cnbm.packing.vo.PowerReportVo;
import com.cnbm.packing.vo.SubIdPageVo;
import com.cnbm.s7.entity.R;
import com.cnbm.s7.s7connector.enmuc.S7Client;
import com.cnbm.s7.s7connector.type.PlcVar;
@ -26,15 +31,19 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.cnbm.common.utils.Result;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.groups.Default;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.Format;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -58,6 +67,10 @@ public class TestController {
@Autowired
WoPackagingBoxServiceBiz boxServiceBiz;
@Autowired
WoPackagingBoxSubstrateMapper subMapper;
private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
try {
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));
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")
public R forImport() throws UnsupportedEncodingException, ParseException {
List<CamlineSubIdForImportDTO> alllCamlineSubForImp = service.getAlllCamlineSubForImp();
@ -135,6 +158,74 @@ public class TestController {
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")

View File

@ -36,9 +36,11 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
@ -125,33 +127,72 @@ public class WoPackagingBoxSubstrateController {
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("查询模组档位统计分布图")
@LogOperation("查询模组档位统计分布图")
@PostMapping("/powerReport")
public Result<PowerReportVo> powerReport(@RequestBody PowerReportQueryParam queryParam){
List<PowerReportDTO> powerReportDTOS = boxServiceBiz.powerReport(queryParam);
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();
Float totalLevelPower = new Float(0);
Float totalCompensatePower = new Float(0);
Float diversePower = new Float(0);
Integer totalSubNum = 0;
for(PowerReportDTO power : powerReportDTOS){
for(PowerReportDTO power : powerReportList){
Integer subLevel = Integer.valueOf(power.getSubLevel());
Integer subNum = power.getSubNum();
if(power.getSumPMPP()==null){
return new Result<PowerReportVo>().error("基板等级:"+subLevel+",基板数量:"+subNum+", 的总和为null");
}
Float sumPMPP = power.getSumPMPP();
totalLevelPower += subLevel*subNum;
totalCompensatePower += sumPMPP*subNum;
totalSubNum+= subNum;
}
for(PowerReportDTO power : powerReportDTOS){
for(PowerReportDTO power : powerReportList){
Float prop = (Float.valueOf(power.getSubNum())/Float.valueOf(totalSubNum))*100;
DecimalFormat df = new DecimalFormat("0.00");
String propS = df.format(prop)+"%";
power.setProportion(propS);
}
diversePower = totalCompensatePower - totalLevelPower;
powerReportVo.setPowerReports(powerReportDTOS);
powerReportVo.setPowerReports(powerReportList);
powerReportVo.setDiversePower(diversePower);
powerReportVo.setTotalCompensatePower(totalCompensatePower);
powerReportVo.setTotalLevelPower(totalLevelPower);

View File

@ -31,4 +31,13 @@ public class PowerReportDTO implements Serializable {
@ApiModelProperty(value = "占比(百分比)")
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;
}
}

View File

@ -1,7 +1,11 @@
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.WoPackagingBoxSubstrateDTO;
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 com.cnbm.common.dao.BaseDao;
@ -29,4 +33,7 @@ public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSub
List<String> orderNameList();
List<WoPackagingBoxSubstrateDTO> substrateList(Map<String, Object> params);
List<WoPackagingBoxSubstrateDTO> substrateList(@Param("woSubstrateId") String woSubstrateId);
IPage<SubIdPageVo> subIdPage(Page<?> page, @Param("param") SubIdQueryParam param);
}

View File

@ -1,5 +1,6 @@
package com.cnbm.packing.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
@ -11,10 +12,11 @@ import java.time.LocalDateTime;
*/
@Data
public class PowerReportQueryParam {
//@JsonFormat(shape=JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime begin;
//@JsonFormat(shape= JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime end;
private String orderName;
private Integer model;
}

View File

@ -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;
}

View File

@ -1,5 +1,7 @@
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.service.CrudService;
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.WoPackagingBoxSubstrate;
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 java.time.LocalDateTime;
@ -49,4 +54,6 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
List<PowerReportDTO> powerReport(PowerReportQueryParam queryParam);
List<String> orderNameList();
R<IPage<SubIdPageVo>> subIdPage(SubIdQueryParam param);
}

View File

@ -3,6 +3,7 @@ package com.cnbm.packing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.common.page.PageData;
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.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.param.PowerReportQueryParam;
import com.cnbm.packing.param.SubIdQueryParam;
import com.cnbm.packing.service.WoPackagingBoxServiceBiz;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -236,4 +240,12 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
public List<String> 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);
}
}

View 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);
}
}

View File

@ -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;
}

View 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 {
}

View 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();
}

View 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);
}
}

View File

@ -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;
}

View File

@ -154,70 +154,61 @@
LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID
WHERE
tu.NAME IN (
'30110012302272191',
'30110012302131618',
'30110012303012944',
'30110012303020207',
'30110012302241261',
'30110012302241398',
'30110012302230861',
'30110012302233064',
'30110012302281480',
'30110012302282683',
'30110012302240071',
'30110012302250901',
'30110012303011030',
'30110012302250913',
'30110012302270254',
'30110012302092199',
'30110012303020200',
'30110012303012545',
'30110012302142542',
'30110012302232978',
'30110012303020850',
'30110012303020177',
'30110012302250223',
'30110012302232990',
'30110012303013332',
'30110012302232986',
'30110012302232985',
'30110012302284455',
'30110012302233312',
'30110012303020358',
'30110012302282341',
'30110012303020199',
'30110012302272331',
'30110012303021196',
'30110012302233336',
'30110012303020006',
'30110012302242395',
'30110012302233328',
'30110012303012521',
'30110012302233506',
'30110012302242632',
'30110012302233332',
'30110012302232981',
'30110012303020183',
'30110012302283758',
'30110012302280081',
'30110012303020128',
'30110012302241074',
'30110012303020008',
'30110012303020088',
'30110012302232982',
'30110012303012916',
'30110012302230019',
'30110012302271634',
'30110012302251127',
'30110012302230021',
'30110012303010971',
'30110012302251123',
'30110012302140610'
'30110012303050629',
'30110012302272118',
'30110012303050331',
'30110012303050321',
'30110012303030164',
'30110012303023000',
'30110012303011203',
'30110012303012089',
'30110012303011487',
'30110012302271154',
'30110012302283324',
'30110012303030787',
'30110012303050373',
'30110012303022841',
'30110012303021008',
'30110012303030325',
'30110012302283810',
'30110012303011490',
'30110012303022163',
'30110012303012695',
'30110012303010372',
'30110012303020247',
'30110012303022801',
'30110012303022407',
'30110012303012915',
'30110012303022996',
'30110012303022721',
'30110012303040003',
'30110012303023102',
'30110012302281213',
'30110012303022204',
'30110012302281212',
'30110012303022970',
'30110012303022415',
'30110012303050341',
'30110012303022434',
'30110012302271569',
'30110012303030505',
'30110012303021276',
'30110012302280295',
'30110012303022166',
'30110012303022299',
'30110012303020988',
'30110012302271160',
'30110012302281215',
'30110012303050537',
'30110012302272052',
'30110012303011213',
'30110012303030488',
'30110012303021614',
'30110012303012878',
'30110012302242962',
'30110012303030608',
'30110012303012697',
'30110012303020737'
)
and flc.PMPP != 0
GROUP BY tu.`NAME`
@ -239,7 +230,10 @@
<select id="getTodayBoxNum" resultType="java.lang.Integer">
select count(1)
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>

View File

@ -80,7 +80,11 @@
limit 1
</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 t_wo_packaging_box_substrate
set PACKAGING_BOX_ID = #{packagingBoxId,jdbcType=VARCHAR},
@ -139,5 +143,17 @@
order by twpb.CREATE_TIME desc
</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>