Compare commits

...

9 Commits

Author SHA1 Message Date
caixiang
6e08ff6482 Merge branch 'master' of http://git.picaiba.com/CaiXiang/cigs4 2023-02-24 09:11:53 +08:00
caixiang
a50849affc mark 2023-02-24 09:11:23 +08:00
caixiang
161b5b5be4 Merge branch 'yanyang' of http://git.picaiba.com/CaiXiang/cigs4
# Conflicts:
#	ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxServiceBiz.java
#	ym-packing/src/main/java/com/cnbm/packing/service/WoPackagingBoxSubstrateServiceBiz.java
#	ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java
2023-02-24 08:47:56 +08:00
caixiang
6d3b1e9cbb commit for pull 2023-02-24 08:46:36 +08:00
caixiang
384b1a3d54 Merge branch 'yanyang' of http://git.picaiba.com/CaiXiang/cigs4 2023-02-23 14:28:24 +08:00
caixiang
16f3cd5d30 commit for pull 2023-02-23 14:28:05 +08:00
caixiang
1ebe39b60a Merge branch 'yanyang' of http://git.picaiba.com/CaiXiang/cigs4
# Conflicts:
#	ym-packing/pom.xml
2023-02-22 20:49:04 +08:00
caixiang
4d1a58b8c7 commit for pull 2023-02-22 20:48:15 +08:00
caixiang
4535677c93 Merge branch 'yanyang' of http://git.picaiba.com/CaiXiang/cigs4
# Conflicts:
#	ym-packing/pom.xml
2023-02-22 16:01:21 +08:00
34 changed files with 1497 additions and 25 deletions

View File

@ -54,12 +54,14 @@ spring:
##多数据源的配置需要引用renren-dynamic-datasource
dynamic:
datasource:
slave1:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root
password: 1qaz@WSX3edc$RFV
slave2:
# ## 本mes系统
# slave1:
# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
# username: root
# password: 1qaz@WSX3edc$RFV
## camline系统
camline:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://mysql.picaiba.com:30307/mt_cigs4?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: root

View File

@ -23,6 +23,16 @@
<artifactId>ym-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-s7</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-dynamic-datasource</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
@ -33,10 +43,5 @@
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cnbm</groupId>
<artifactId>ym-dynamic-datasource</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,437 @@
package com.cnbm.packing.dispatch;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Plc2MesVar;
import com.cnbm.packing.dispatch.enums.kuka.step2.Step2Mes2PlcVar;
import com.cnbm.packing.dispatch.enums.kuka.step2.Step2Plc2MesVar;
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Plc2MesVar;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.service.*;
import com.cnbm.s7.s7connector.enmuc.S7Client;
import com.cnbm.s7.s7connector.type.PlcVar;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2022/12/23 12:33
*/
@Component
@Order(value = 1)
public class KukaJoinThread implements ApplicationRunner {
private static final Logger logger = LoggerFactory.getLogger(KukaJoinThread.class);
@Autowired
DynamicDataSourceService service;
@Autowired
WoPowerLevelServiceBiz levelServiceBiz;
@Autowired
WoCompensationPowerServiceBiz compensationPowerServiceBiz;
@Autowired
WoPackagingBoxSubstrateServiceBiz substrateServiceBiz;
@Autowired
WoPackagingBoxServiceBiz boxServiceBiz;
public KukaJoinThread(){
this.kukaStep1 = Executors.newScheduledThreadPool(1);
this.kukaStep2 = Executors.newScheduledThreadPool(1);
this.kukaStep3 = Executors.newScheduledThreadPool(1);
}
private ScheduledExecutorService kukaStep1;
private ScheduledExecutorService kukaStep2;
private ScheduledExecutorService kukaStep3;
/**
* return
* 成功 返回相应的object对象
* 失败 返回null
* */
private Object read(S7Client s7Client,Step1Plc2MesVar var) {
try {
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
}catch (Exception e){
logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage());
e.printStackTrace();
return null;
}
}
private void write(S7Client s7Client, Step1Mes2PlcVar var, Object newValue) {
if(var.getType().equals(PlcVar.STRING_Array)){
String[] s = (String[])newValue;
String[] ss = (String[])newValue;
if(s.length > var.getLength() ){
ss = new String[var.getLength()];
for(int i=0;i< var.getLength();i++){
ss[i] = s[i];
}
}
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
}else {
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
}
}
private Object read(S7Client s7Client, Step2Plc2MesVar var) {
try {
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
}catch (Exception e){
logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage());
e.printStackTrace();
return null;
}
}
private void write(S7Client s7Client, Step2Mes2PlcVar var, Object newValue) {
if(var.getType().equals(PlcVar.STRING_Array)){
String[] s = (String[])newValue;
String[] ss = (String[])newValue;
if(s.length > var.getLength() ){
ss = new String[var.getLength()];
for(int i=0;i< var.getLength();i++){
ss[i] = s[i];
}
}
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
}else {
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
}
}
private Object read(S7Client s7Client, Step3Plc2MesVar var) {
try {
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
}catch (Exception e){
logger.error("host:"+s7Client.getHost()+" ; read 操作出现问题: "+e.getMessage());
e.printStackTrace();
return null;
}
}
private void write(S7Client s7Client, Step3Mes2PlcVar var, Object newValue) {
if(var.getType().equals(PlcVar.STRING_Array)){
String[] s = (String[])newValue;
String[] ss = (String[])newValue;
if(s.length > var.getLength() ){
ss = new String[var.getLength()];
for(int i=0;i< var.getLength();i++){
ss[i] = s[i];
}
}
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),ss);
}else {
s7Client.write(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getStrSize(), var.getType(),newValue);
}
}
public String getBoxId(String sapMaterial){
Integer todayBoxNum = service.getTodayBoxNum();
String nowTime = DateUtil.format(new Date(), "yyMMdd");
String res = "301"+sapMaterial+nowTime+todayBoxNum;
return res;
}
@Override
public void run(ApplicationArguments args) throws Exception {
// kukaStep1.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// logger.info("");
// logger.info("================= 现在开始执行 过程一 任务 ==================");
// Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
// if(subArrived != 1){
// logger.info("失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
//
// //. 从plc 中获取 subId lineNum
// String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
//
// //. MES 业务
// //=============== MES 业务 开始 =================
// //1. 从comline数据库中获取 实际pmpp
// float pmppBySubId = service.getPMPPBySubId(subId);
// //2. 匹配和计算补偿功率
// float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
// //3. 依据补偿功率获取工艺参数并且把这些工艺参数传给kuka
// WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,Integer.valueOf(argByPMPP.getPowerClass()));
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,argByPMPP.getLableVoc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,argByPMPP.getLableIsc());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,argByPMPP.getLableVmpp());
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
//
//
// //4. 把基板录到数据库
// WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
// woPackagingBoxSubstrate.setLineBody(lineNum);
// woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass());
// woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
// woPackagingBoxSubstrate.setWoSubstrateId(subId);
//
// //5. 从camline那里获取可变字段
// CamlineExtendArgDTO extendArgFromCamline = service.getExtendArgFromCamline(subId);
// woPackagingBoxSubstrate.setLastUpdateTime(extendArgFromCamline.getLastUpdateTime());
// woPackagingBoxSubstrate.setPmpp(actualPMPP);
// woPackagingBoxSubstrate.setOrderName(extendArgFromCamline.getOrderName());
// woPackagingBoxSubstrate.setBinclassFl1(extendArgFromCamline.getBinclassFl1());
// woPackagingBoxSubstrate.setBinclassFl2(extendArgFromCamline.getBinclassFl2());
// woPackagingBoxSubstrate.setEtaFl1(extendArgFromCamline.getEtaFl1());
// woPackagingBoxSubstrate.setEtaFl2(extendArgFromCamline.getEtaFl2());
// woPackagingBoxSubstrate.setFfFl1(extendArgFromCamline.getFfFl1());
// woPackagingBoxSubstrate.setFfFl2(extendArgFromCamline.getFfFl2());
// woPackagingBoxSubstrate.setImppFl1(extendArgFromCamline.getImppFl1());
// woPackagingBoxSubstrate.setImppFl2(extendArgFromCamline.getImppFl2());
// woPackagingBoxSubstrate.setInsolflashcontrolFl1(extendArgFromCamline.getInsolflashcontrolFl1());
// woPackagingBoxSubstrate.setInsolflashcontrolFl2(extendArgFromCamline.getInsolflashcontrolFl2());
// woPackagingBoxSubstrate.setInsolmppFl1(extendArgFromCamline.getInsolmppFl1());
// woPackagingBoxSubstrate.setInsolmppFl2(extendArgFromCamline.getInsolmppFl2());
// woPackagingBoxSubstrate.setInsolvocFl1(extendArgFromCamline.getInsolvocFl1());
// woPackagingBoxSubstrate.setInsolvocFl2(extendArgFromCamline.getInsolvocFl2());
// woPackagingBoxSubstrate.setInsolFl1(extendArgFromCamline.getInsolFl1());
// woPackagingBoxSubstrate.setInsolFl2(extendArgFromCamline.getInsolFl2());
// woPackagingBoxSubstrate.setIscFl1(extendArgFromCamline.getIscFl1());
// woPackagingBoxSubstrate.setIscFl2(extendArgFromCamline.getIscFl2());
// woPackagingBoxSubstrate.setMeasTimeFl1(extendArgFromCamline.getMeasTimeFl1());
// woPackagingBoxSubstrate.setMeasTimeFl2(extendArgFromCamline.getMeasTimeFl2());
// woPackagingBoxSubstrate.setPmppFl1(extendArgFromCamline.getPmppFl1());
// woPackagingBoxSubstrate.setPmppFl2(extendArgFromCamline.getPmppFl2());
// woPackagingBoxSubstrate.setTcellFl1(extendArgFromCamline.getTcellFl1());
// woPackagingBoxSubstrate.setTcellFl2(extendArgFromCamline.getTcellFl2());
// woPackagingBoxSubstrate.setTmonicellFl1(extendArgFromCamline.getTmonicellFl1());
// woPackagingBoxSubstrate.setTmonicellFl2(extendArgFromCamline.getTmonicellFl2());
// woPackagingBoxSubstrate.setUmppFl1(extendArgFromCamline.getUmppFl1());
// woPackagingBoxSubstrate.setUmppFl2(extendArgFromCamline.getUmppFl2());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl1());
// woPackagingBoxSubstrate.setUocFl1(extendArgFromCamline.getUocFl2());
//
// substrateServiceBiz.insert(woPackagingBoxSubstrate);
// //=============== MES 业务 结束 =================
//
// //. 当MES完成任务后把MesToPlc.SubArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true);
//
// //. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, false);
// if(subArrived2 != 1){
// logger.info("失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
// logger.info("采集到的基板id : "+subId);
// logger.info("================= 过程一 任务成功完成 ==================");
// logger.info("");
//
//
// }
// },1,1, TimeUnit.SECONDS);
//
//
// kukaStep2.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// logger.info("");
// logger.info("================= 现在开始执行 过程二 任务 ==================");
// Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
// if(shelfIsFull != 1){
// logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
// }
//
// //. 从plc 中获取 subIdList lineNum
// String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
//// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step2Plc2MesVar.LineNum);
//
//
// //. MES 业务
// //=============== MES 业务 开始 =================
// //1.MES 生成BoxId
// if(subIdList.length<=0){
// logger.info("失败"+" --- "+"从plc里面获取到的基板列表 为空");
// }
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
// String boxId = getBoxId(bySubId.getSapMaterial());
// //2. 依次update 基板表把boxId 赋予这些基板
// for(int i=0;i<subIdList.length;i++){
// substrateServiceBiz.updatePackagingBoxIdByWoSubstrateId(boxId,subIdList[i]);
// }
// //3.去camline数据库 查询此基板ID 对应的订单
// String orderNameBySubId = service.getOrderNameBySubId(subIdList[0]);
// //4. box信息录入到box表
// WoPackagingBox woPackagingBox = new WoPackagingBox();
// woPackagingBox.setBoxNo(boxId);
// woPackagingBox.setPackagingTime(LocalDateTime.now());
// woPackagingBox.setPowerLevel(bySubId.getPowerLevel());
// woPackagingBox.setLineBody(bySubId.getLineBody());
// woPackagingBox.setSapMaterial(bySubId.getSapMaterial());
// woPackagingBox.setOrderNum(orderNameBySubId);
// //1-手动模式2-自动模式
// woPackagingBox.setModel(2);
// boxServiceBiz.insert(woPackagingBox);
// //=============== MES 业务 结束 =================
//
// //. 把生成的BoxId 告诉kuka
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,boxId);
//
// //. 当MES完成任务后把MesToPlc.ShelfIsFullFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,true);
//
// //. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
// if(subArrived2 != 1){
// logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
// logger.info("================= 过程二 任务成功完成 ==================");
// logger.info("");
//
// }
// },1,1, TimeUnit.SECONDS);
//
//
// kukaStep3.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// //调度开始
// logger.info("");
// logger.info("================= 现在开始执行 过程三 任务 ==================");
// Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
// if(shelfIsFull != 1){
// logger.info("失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// }
//
// //. 从plc 中获取 subIdList lineNum
// String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
//
//
// //. MES 业务
// //=============== MES 业务 开始 =================
// //1. box信息录入到box表
// boxServiceBiz.updateIsArrivedByBoxNo(1,boxId);
// //=============== MES 业务 结束 =================
//
//
// //. 当MES完成任务后把MesToPlc.ShelfIsFullArrivedFinish变量置为true告诉plc我操作完成了
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
//
// //. mes 监控 到PlcToMes.SubArrived==false就把MesToPlc.SubArrivedFinish置为false
// Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
// if(subArrived2 != 1){
// logger.info("失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
// }
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
// logger.info("================= 过程三 任务成功完成 ==================");
// logger.info("");
//
// }
// },1,1, TimeUnit.SECONDS);
}
/**
*
* arg:
* Step1Plc2MesVar 参数类型
* targetValue 目的值
* return:
* 2 s7 访问异常;
* 1 成功;
* */
private Integer waitingForTarget(Step1Plc2MesVar var, Boolean targetValue) {
Integer res = 0;
while (true){
try {
Boolean now = (Boolean) read(S7Client.S7_KUKA,var);
if(targetValue.equals(now)){
res = 1;
break;
}
Thread.sleep(200);
}catch (Exception e){
logger.info("S7 数据采集 异常。");
res = 2;
break;
}
}
return res;
}
/**
*
* arg:
* Step2Plc2MesVar 参数类型
* targetValue 目的值
* return:
* 2 s7 访问异常;
* 1 成功;
* */
private Integer waitingForTarget(Step2Plc2MesVar var, Boolean targetValue) {
Integer res = 0;
while (true){
try {
Boolean now = (Boolean) read(S7Client.S7_KUKA,var);
if(targetValue.equals(now)){
res = 1;
break;
}
Thread.sleep(200);
}catch (Exception e){
logger.info("S7 数据采集 异常。");
res = 2;
break;
}
}
return res;
}
/**
*
* arg:
* Step3Plc2MesVar 参数类型
* targetValue 目的值
* return:
* 2 s7 访问异常;
* 1 成功;
* */
private Integer waitingForTarget(Step3Plc2MesVar var, Boolean targetValue) {
Integer res = 0;
while (true){
try {
Boolean now = (Boolean) read(S7Client.S7_KUKA,var);
if(targetValue.equals(now)){
res = 1;
break;
}
Thread.sleep(200);
}catch (Exception e){
logger.info("S7 数据采集 异常。");
res = 2;
break;
}
}
return res;
}
}

View File

@ -0,0 +1,15 @@
package com.cnbm.packing.dispatch.enums;
/**
* @Author: 蔡翔
* @Date: 2019/10/14 10:07
* @Version 1.0
*/
public interface CodeEnum {
Integer getNamespace();
String getIdentity();
String getType();
String getName();
String getDesc();
void set(String name,Integer nameSpace,String identity);
}

View File

@ -0,0 +1,93 @@
package com.cnbm.packing.dispatch.enums.kuka.step1;
import com.cnbm.s7.s7connector.api.DaveArea;
import com.cnbm.s7.s7connector.type.PlcVar;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/21 19:35
*/
public enum Step1Mes2PlcVar {
SubArrivedFinish("SubArrivedFinish", PlcVar.BOOL,1, DaveArea.DB,2000,26,0),
dLable_Pnom("dLable_Pnom", PlcVar.DINT,1, DaveArea.DB,2000,28,0),
dLable_Voc("dLable_Voc", PlcVar.REAL,1, DaveArea.DB,2000,32,0),
dLable_Isc("dLable_Isc", PlcVar.REAL,1, DaveArea.DB,2000,36,0),
dLable_Vmpp("dLable_Vmpp", PlcVar.REAL,1, DaveArea.DB,2000,40,0),
dLable_Impp("dLable_Vmpp", PlcVar.REAL,1, DaveArea.DB,2000,44,0),
;
private String name;
private DaveArea area;
private Integer areaNumber;
private Integer byteOffset;
private Integer bitOffset;
private PlcVar type;
//length = 1代表 非数组;;; length > 1 代表数组 ;; 注意 length这个参数 是实际plc中 数组的长度和read操作相关
//如果是String 类型不用填length 只需要填string类型的起始位置就行了我会自己去取数据长度也就是说这里的length并不是string 的长度
private Integer length;
//这个字段只是给 字符串变量 字符串数组 , 这个字段是plc中设置的最大String长度
private Integer strSize;
Step1Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = 0;
}
Step1Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = strSize;
}
public Integer getStrSize() {
return strSize;
}
public void setStrSize(Integer strSize) {
this.strSize = strSize;
}
public String getName() {
return name;
}
public DaveArea getArea() {
return area;
}
public Integer getAreaNumber() {
return areaNumber;
}
public Integer getBitOffset() {
return bitOffset;
}
public Integer getByteOffset() {
return byteOffset;
}
public PlcVar getType() {
return type;
}
public Integer getLength() {
return length;
}
}

View File

@ -0,0 +1,89 @@
package com.cnbm.packing.dispatch.enums.kuka.step1;
import com.cnbm.s7.s7connector.api.DaveArea;
import com.cnbm.s7.s7connector.type.PlcVar;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/21 19:35
*/
public enum Step1Plc2MesVar {
SubArrivedToMes("SubArrivedToMes", PlcVar.BOOL,1, DaveArea.DB,2000,0,0),
SubIdToMes("SubIdToMes",PlcVar.STRING,1,DaveArea.DB,2000,2,0,20),
LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,24,0),
;
private String name;
private DaveArea area;
private Integer areaNumber;
private Integer byteOffset;
private Integer bitOffset;
private PlcVar type;
//length = 1代表 非数组;;; length > 1 代表数组 ;; 注意 length这个参数 是实际plc中 数组的长度和read操作相关
//如果是String 类型不用填length 只需要填string类型的起始位置就行了我会自己去取数据长度也就是说这里的length并不是string 的长度
private Integer length;
//这个字段只是给 字符串变量 字符串数组 , 这个字段是plc中设置的最大String长度
private Integer strSize;
Step1Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = 0;
}
Step1Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = strSize;
}
public Integer getStrSize() {
return strSize;
}
public void setStrSize(Integer strSize) {
this.strSize = strSize;
}
public String getName() {
return name;
}
public DaveArea getArea() {
return area;
}
public Integer getAreaNumber() {
return areaNumber;
}
public Integer getBitOffset() {
return bitOffset;
}
public Integer getByteOffset() {
return byteOffset;
}
public PlcVar getType() {
return type;
}
public Integer getLength() {
return length;
}
}

View File

@ -0,0 +1,88 @@
package com.cnbm.packing.dispatch.enums.kuka.step2;
import com.cnbm.s7.s7connector.api.DaveArea;
import com.cnbm.s7.s7connector.type.PlcVar;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/21 19:35
*/
public enum Step2Mes2PlcVar {
//心跳变量这个可以要求电控同事加一个不和业务关联只用于通讯
BoxId("BoxId",PlcVar.STRING,1,DaveArea.DB,2000,714,0,20),
ShelfIsFullFinish("ShelfIsFullFinish",PlcVar.BOOL,1,DaveArea.DB,2000,712,0),
;
private String name;
private DaveArea area;
private Integer areaNumber;
private Integer byteOffset;
private Integer bitOffset;
private PlcVar type;
//length = 1代表 非数组;;; length > 1 代表数组 ;; 注意 length这个参数 是实际plc中 数组的长度和read操作相关
//如果是String 类型不用填length 只需要填string类型的起始位置就行了我会自己去取数据长度也就是说这里的length并不是string 的长度
private Integer length;
//这个字段只是给 字符串变量 字符串数组 , 这个字段是plc中设置的最大String长度
private Integer strSize;
Step2Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = 0;
}
Step2Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = strSize;
}
public Integer getStrSize() {
return strSize;
}
public void setStrSize(Integer strSize) {
this.strSize = strSize;
}
public String getName() {
return name;
}
public DaveArea getArea() {
return area;
}
public Integer getAreaNumber() {
return areaNumber;
}
public Integer getBitOffset() {
return bitOffset;
}
public Integer getByteOffset() {
return byteOffset;
}
public PlcVar getType() {
return type;
}
public Integer getLength() {
return length;
}
}

View File

@ -0,0 +1,89 @@
package com.cnbm.packing.dispatch.enums.kuka.step2;
import com.cnbm.s7.s7connector.api.DaveArea;
import com.cnbm.s7.s7connector.type.PlcVar;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/21 19:35
*/
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.BOOL,1, DaveArea.DB,2000,710,0),
;
private String name;
private DaveArea area;
private Integer areaNumber;
private Integer byteOffset;
private Integer bitOffset;
private PlcVar type;
//length = 1代表 非数组;;; length > 1 代表数组 ;; 注意 length这个参数 是实际plc中 数组的长度和read操作相关
//如果是String 类型不用填length 只需要填string类型的起始位置就行了我会自己去取数据长度也就是说这里的length并不是string 的长度
private Integer length;
//这个字段只是给 字符串变量 字符串数组 , 这个字段是plc中设置的最大String长度
private Integer strSize;
Step2Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = 0;
}
Step2Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = strSize;
}
public Integer getStrSize() {
return strSize;
}
public void setStrSize(Integer strSize) {
this.strSize = strSize;
}
public String getName() {
return name;
}
public DaveArea getArea() {
return area;
}
public Integer getAreaNumber() {
return areaNumber;
}
public Integer getBitOffset() {
return bitOffset;
}
public Integer getByteOffset() {
return byteOffset;
}
public PlcVar getType() {
return type;
}
public Integer getLength() {
return length;
}
}

View File

@ -0,0 +1,87 @@
package com.cnbm.packing.dispatch.enums.kuka.step3;
import com.cnbm.s7.s7connector.api.DaveArea;
import com.cnbm.s7.s7connector.type.PlcVar;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/21 19:35
*/
public enum Step3Mes2PlcVar {
//心跳变量这个可以要求电控同事加一个不和业务关联只用于通讯
ShelfIsFullArrivedFinish("ShelfIsFullArrivedFinish", PlcVar.BOOL,1, DaveArea.DB,2000,762,0),
;
private String name;
private DaveArea area;
private Integer areaNumber;
private Integer byteOffset;
private Integer bitOffset;
private PlcVar type;
//length = 1代表 非数组;;; length > 1 代表数组 ;; 注意 length这个参数 是实际plc中 数组的长度和read操作相关
//如果是String 类型不用填length 只需要填string类型的起始位置就行了我会自己去取数据长度也就是说这里的length并不是string 的长度
private Integer length;
//这个字段只是给 字符串变量 字符串数组 , 这个字段是plc中设置的最大String长度
private Integer strSize;
Step3Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = 0;
}
Step3Mes2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = strSize;
}
public Integer getStrSize() {
return strSize;
}
public void setStrSize(Integer strSize) {
this.strSize = strSize;
}
public String getName() {
return name;
}
public DaveArea getArea() {
return area;
}
public Integer getAreaNumber() {
return areaNumber;
}
public Integer getBitOffset() {
return bitOffset;
}
public Integer getByteOffset() {
return byteOffset;
}
public PlcVar getType() {
return type;
}
public Integer getLength() {
return length;
}
}

View File

@ -0,0 +1,90 @@
package com.cnbm.packing.dispatch.enums.kuka.step3;
import com.cnbm.s7.s7connector.api.DaveArea;
import com.cnbm.s7.s7connector.type.PlcVar;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/21 19:35
*/
public enum Step3Plc2MesVar {
//心跳变量这个可以要求电控同事加一个不和业务关联只用于通讯
ShelfIsFullArrived("ShelfIsFullArrived", PlcVar.BOOL,1, DaveArea.DB,2000,736,0),
BoxId("BoxId",PlcVar.STRING,60,DaveArea.DB,2000,738,0,20),
LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,760,0),
;
private String name;
private DaveArea area;
private Integer areaNumber;
private Integer byteOffset;
private Integer bitOffset;
private PlcVar type;
//length = 1代表 非数组;;; length > 1 代表数组 ;; 注意 length这个参数 是实际plc中 数组的长度和read操作相关
//如果是String 类型不用填length 只需要填string类型的起始位置就行了我会自己去取数据长度也就是说这里的length并不是string 的长度
private Integer length;
//这个字段只是给 字符串变量 字符串数组 , 这个字段是plc中设置的最大String长度
private Integer strSize;
Step3Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = 0;
}
Step3Plc2MesVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
this.name = name;
this.type = type;
this.length = length;
this.area = area;
this.areaNumber = areaNumber;
this.byteOffset = byteOffset;
this.bitOffset = bitOffset;
this.strSize = strSize;
}
public Integer getStrSize() {
return strSize;
}
public void setStrSize(Integer strSize) {
this.strSize = strSize;
}
public String getName() {
return name;
}
public DaveArea getArea() {
return area;
}
public Integer getAreaNumber() {
return areaNumber;
}
public Integer getBitOffset() {
return bitOffset;
}
public Integer getByteOffset() {
return byteOffset;
}
public PlcVar getType() {
return type;
}
public Integer getLength() {
return length;
}
}

View File

@ -0,0 +1,85 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 打印标签模板表
*
* @author codeGenerator
* @since 2023-02-20
*/
@Data
@ApiModel(value = "camline 查询对象")
public class CamlineExtendArgDTO implements Serializable {
private static final long serialVersionUID = 1L;
private LocalDateTime lastUpdateTime;
private float pmpp;
private String orderName;
private Long binclassFl1;
private Long binclassFl2;
private Float etaFl1;
private Float etaFl2;
private Float ffFl1;
private Float ffFl2;
private Float imppFl1;
private Float imppFl2;
private Float insolflashcontrolFl1;
private Float insolflashcontrolFl2;
private Float insolmppFl1;
private Float insolmppFl2;
private Float insolvocFl1;
private Float insolvocFl2;
private Float insolFl1;
private Float insolFl2;
private Float iscFl1;
private Float iscFl2;
private LocalDateTime measTimeFl1;
private LocalDateTime measTimeFl2;
private Float pmppFl1;
private Float pmppFl2;
private Float tcellFl1;
private Float tcellFl2;
private Float tmonicellFl1;
private Float tmonicellFl2;
private Float umppFl1;
private Float umppFl2;
private Float uocFl1;
private Float uocFl2;
}

View File

@ -0,0 +1,21 @@
package com.cnbm.packing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/22 16:48
*/
@Data
@ApiModel(value = "补偿功率 计算系数")
public class CompensationPowerXSDTO implements Serializable {
private static final long serialVersionUID = 1L;
private float a;
private float b;
}

View File

@ -0,0 +1,29 @@
package com.cnbm.packing.mapper;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 机台表
*
* @author codeGenerator
* @since 2023-02-15
*/
@Mapper
public interface CamlineMapper {
float getByid(@Param("subId") String subId);
//从camline 系统获取实际pmpp
float getPMPPBySubId(@Param("subId") String subId);
String getOrderNameBySubId(@Param("subId") String subId);
CamlineExtendArgDTO getExtendArgFromCamline(@Param("subId") String subId);
Integer getTodayBoxNum();
}

View File

@ -1,9 +1,12 @@
package com.cnbm.packing.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoCompensationPowerDTO;
import com.cnbm.packing.entity.WoCompensationPower;
import com.cnbm.packing.param.CompensationQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -17,5 +20,6 @@ import java.util.List;
public interface WoCompensationPowerMapper extends BaseDao<WoCompensationPower> {
List<WoCompensationPowerDTO> list();
CompensationPowerXSDTO getConffBySubIdAndLineBody(@Param("param") CompensationQueryParam param);
}

View File

@ -24,4 +24,6 @@ public interface WoPackagingBoxMapper extends BaseDao<WoPackagingBox> {
List<WoPackagingBoxDTO> list();
int updateIsArrivedByBoxNo(@Param("isArrived") Integer isArrived, @Param("boxNo") String boxNo);
}

View File

@ -1,4 +1,5 @@
package com.cnbm.packing.mapper;
import org.apache.ibatis.annotations.Param;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
@ -12,5 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface WoPackagingBoxSubstrateMapper extends BaseDao<WoPackagingBoxSubstrate> {
WoPackagingBoxSubstrate getOneByWoSubstrateId(@Param("woSubstrateId") String woSubstrateId);
int updatePackagingBoxIdByWoSubstrateId(@Param("packagingBoxId") String packagingBoxId, @Param("woSubstrateId") String woSubstrateId);
}

View File

@ -1,9 +1,12 @@
package com.cnbm.packing.mapper;
import com.cnbm.common.dao.BaseDao;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.param.CompensationQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -18,4 +21,7 @@ public interface WoPowerLevelMapper extends BaseDao<WoPowerLevel> {
List<WoPowerLevelDTO> list();
WoPowerLevel getPowerLevelByLineBodyAndPMPP(@Param("param") CompensationQueryParam param);
}

View File

@ -0,0 +1,16 @@
package com.cnbm.packing.param;
import io.swagger.models.auth.In;
import lombok.Data;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/15 19:05
*/
@Data
public class CompensationQueryParam {
private float pmpp;
private Integer lineBody;
}

View File

@ -0,0 +1,50 @@
package com.cnbm.packing.service;
import com.cnbm.dynamic.datasource.annotation.DataSource;
import com.cnbm.packing.dto.CamlineExtendArgDTO;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.mapper.CamlineMapper;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/15 14:19
*/
@Service
public class DynamicDataSourceService {
@Autowired
CamlineMapper mapper;
@Autowired
WoPowerLevelServiceBiz powerLevelServiceBiz;
public Integer getTodayBoxNum(){
return mapper.getTodayBoxNum();
}
@DataSource("camline")
@Transactional
public float getPMPPBySubId(String subId){
return mapper.getPMPPBySubId(subId);
}
@DataSource("camline")
@Transactional
public String getOrderNameBySubId(String subId){
return mapper.getOrderNameBySubId(subId);
}
@DataSource("camline")
@Transactional
public CamlineExtendArgDTO getExtendArgFromCamline(String subId){
return mapper.getExtendArgFromCamline(subId);
}
}

View File

@ -2,6 +2,7 @@ package com.cnbm.packing.service;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoCompensationPowerDTO;
import com.cnbm.packing.entity.WoCompensationPower;
@ -16,6 +17,7 @@ import java.util.Map;
*/
public interface WoCompensationPowerServiceBiz extends CrudService<WoCompensationPower, WoCompensationPowerDTO> {
PageData<WoCompensationPowerDTO> page (Map<String, Object> params);
WoCompensationPowerDTO get(Long id);
@ -27,5 +29,7 @@ public interface WoCompensationPowerServiceBiz extends CrudService<WoCompensatio
void delete(Long[] ids);
List<WoCompensationPowerDTO> list();
float calculCompensationPMPP(float pmpp, Integer lineBody);
}

View File

@ -4,7 +4,6 @@ import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxSubstrateDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import java.util.List;
@ -31,5 +30,7 @@ public interface WoPackagingBoxServiceBiz extends CrudService<WoPackagingBox, Wo
List<WoPackagingBoxDTO> list();
WoPackagingBoxDTO printList(Long id);
int updateIsArrivedByBoxNo(Integer isArrived, String boxNo);
}

View File

@ -33,5 +33,7 @@ public interface WoPackagingBoxSubstrateServiceBiz extends CrudService<WoPackagi
void replaceSubstrate(ChangePackingBoxDTO[] dtos);
void insertSubstrateManual(ChangePackingBoxDTO dto);
WoPackagingBoxSubstrate getBySubId(String subId);
int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId,String woSubstrateId);
}

View File

@ -27,5 +27,6 @@ public interface WoPowerLevelServiceBiz extends CrudService<WoPowerLevel, WoPowe
void delete(Long[] ids);
List<WoPowerLevelDTO> list();
WoPowerLevel getArgByPMPP(float pmpp, Integer lineBody);
}

View File

@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.CompensationPowerXSDTO;
import com.cnbm.packing.dto.WoCompensationPowerDTO;
import com.cnbm.packing.entity.WoCompensationPower;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoCompensationPowerMapper;
import com.cnbm.packing.param.CompensationQueryParam;
import com.cnbm.packing.service.WoCompensationPowerServiceBiz;
import lombok.var;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -86,5 +89,21 @@ public class WoCompensationPowerServiceBizImpl extends CrudServiceImpl<WoCompens
List<WoCompensationPowerDTO> list = mapper.list();
return list;
}
@Override
public float calculCompensationPMPP(float pmpp, Integer lineBody) {
CompensationQueryParam compensationQueryParam = new CompensationQueryParam();
compensationQueryParam.setPmpp(pmpp);
compensationQueryParam.setLineBody(lineBody);
CompensationPowerXSDTO conffBySubIdAndLineBody = mapper.getConffBySubIdAndLineBody(compensationQueryParam);
float res = pmpp*conffBySubIdAndLineBody.getA()+conffBySubIdAndLineBody.getB();
return res;
}
public WoCompensationPowerMapper getMapper() {
return mapper;
}
}

View File

@ -3,14 +3,10 @@ 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.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.dto.WoPackagingBoxDTO;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBox;
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
import com.cnbm.packing.entity.WoPowerLevel;
@ -39,10 +35,8 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
@Autowired
private WoPackagingBoxMapper mapper;
@Autowired
private WoPackagingBoxSubstrateMapper substrateMapper;
@Override
public QueryWrapper<WoPackagingBox> getWrapper(Map<String, Object> params){
@ -124,5 +118,9 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
dto.setSubstrateList(woPackagingBoxSubstrateList);
return dto;
}
@Override
public int updateIsArrivedByBoxNo(Integer isArrived, String boxNo) {
return mapper.updateIsArrivedByBoxNo(isArrived,boxNo);
}
}

View File

@ -18,6 +18,7 @@ import com.cnbm.packing.mapper.WoPackagingBoxSubstrateMapper;
import com.cnbm.packing.service.ChangePackagingBoxHistoryServiceBiz;
import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.omg.CORBA.PRIVATE_MEMBER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -38,7 +39,6 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
@Autowired
private ChangePackagingBoxHistoryServiceBiz changePackagingBoxHistoryService;
@Autowired
private WoPackagingBoxSubstrateMapper mapper;
@ -54,6 +54,8 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
return wrapper;
}
@Override
public PageData<WoPackagingBoxSubstrateDTO> page (Map<String, Object> params){
IPage<WoPackagingBoxSubstrate> page = baseDao.selectPage(
@ -175,4 +177,13 @@ public class WoPackagingBoxSubstrateServiceBizImpl extends CrudServiceImpl<WoPac
}
}
@Override
public WoPackagingBoxSubstrate getBySubId(String subId) {
return mapper.getOneByWoSubstrateId(subId);
}
@Override
public int updatePackagingBoxIdByWoSubstrateId(String packagingBoxId, String woSubstrateId) {
return mapper.updatePackagingBoxIdByWoSubstrateId(packagingBoxId,woSubstrateId);
}
}

View File

@ -9,6 +9,7 @@ import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.packing.dto.WoPowerLevelDTO;
import com.cnbm.packing.entity.WoPowerLevel;
import com.cnbm.packing.mapper.WoPowerLevelMapper;
import com.cnbm.packing.param.CompensationQueryParam;
import com.cnbm.packing.service.WoPowerLevelServiceBiz;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -87,4 +88,11 @@ public class WoPowerLevelServiceBizImpl extends CrudServiceImpl<WoPowerLevelMapp
return list;
}
@Override
public WoPowerLevel getArgByPMPP(float pmpp, Integer lineBody) {
CompensationQueryParam compensationQueryParam = new CompensationQueryParam();
compensationQueryParam.setLineBody(lineBody);
compensationQueryParam.setPmpp(pmpp);
return mapper.getPowerLevelByLineBodyAndPMPP(compensationQueryParam);
}
}

View File

@ -0,0 +1,21 @@
package com.cnbm.packing.vo;
import cn.hutool.core.date.DateUtil;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @Desc: ""
* @Author: caixiang
* @DATE: 2023/2/15 16:32
*/
@Data
public class ComlinePMPP {
private String machineName;
private Long platformId;
private LocalDateTime createTime;
}

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.packing.mapper.CamlineMapper">
<resultMap id="ResultMap" type="com.cnbm.packing.vo.ComlinePMPP">
<result column="machine_name" property="machineName" />
<result column="platform_id" property="platformId" />
<result column="create_time" property="createTime" />
</resultMap>
<resultMap id="ResultAMap" type="com.cnbm.packing.dto.CamlineExtendArgDTO">
<result column="LAST_UPDATE_TIME" property="lastUpdateTime" />
<result column="PMPP" property="pmpp" />
<result column="ORDER_NAME" property="orderName" />
<result column="BINCLASS_FL1" property="binclassFl1" />
<result column="BINCLASS_FL2" property="binclassFl2" />
<result column="ETA_FL1" property="etaFl1" />
<result column="ETA_FL2" property="etaFl2" />
<result column="FF_FL1" property="ffFl1" />
<result column="FF_FL2" property="ffFl2" />
<result column="IMPP_FL1" property="imppFl1" />
<result column="IMPP_FL2" property="imppFl2" />
<result column="InsolFlashControl_FL1" property="insolflashcontrolFl1" />
<result column="InsolFlashControl_FL2" property="insolflashcontrolFl2" />
<result column="InsolMPP_FL1" property="insolmppFl1" />
<result column="InsolMPP_FL2" property="insolmppFl2" />
<result column="InsolVoc_FL1" property="insolvocFl1" />
<result column="InsolVoc_FL2" property="insolvocFl2" />
<result column="Insol_FL1" property="insolFl1" />
<result column="Insol_FL2" property="insolFl2" />
<result column="ISC_FL1" property="iscFl1" />
<result column="ISC_FL2" property="iscFl2" />
<result column="MEAS_TIME_FL1" property="measTimeFl1" />
<result column="MEAS_TIME_FL2" property="measTimeFl2" />
<result column="PMPP_FL1" property="pmppFl1" />
<result column="PMPP_FL2" property="pmppFl2" />
<result column="Tcell_FL1" property="tcellFl1" />
<result column="Tcell_FL2" property="tcellFl2" />
<result column="Tmonicell_FL1" property="tmonicellFl1" />
<result column="Tmonicell_FL2" property="tmonicellFl2" />
<result column="UMPP_FL1" property="umppFl1" />
<result column="UMPP_FL2" property="umppFl2" />
<result column="UOC_FL1" property="uocFl1" />
<result column="UOC_FL2" property="uocFl2" />
</resultMap>
<select id="getByid" resultType="float">
select pd.pmpp from process_data pd
where pd.arg_name = #{subId}
ORDER BY
pd.create_time DESC
LIMIT 1
</select>
<select id="getPMPPBySubId" resultType="float">
SELECT
flc.PMPP
FROM
ue_flasher_data_calc flc
LEFT JOIN e_tracking_unit tu ON flc.mainid = tu.id
WHERE
flc.PMPP != 0
and
tu.name=#{subId} -- 查特定基板功率
ORDER BY
flc.LAST_UPDATE_TIME DESC
LIMIT 1
</select>
<select id="getExtendArgFromCamline" resultMap="ResultAMap">
SELECT
eo.`NAME` as ORDER_NAME,
flr.LAST_UPDATE_TIME,
flr.BINCLASS_FL1,-- 1为 PID16 电池相关信息
flr.BINCLASS_FL2,-- 2为 PID22 电池相关信息
flr.ETA_FL1,
flr.ETA_FL2,
flr.FF_FL1,
flr.FF_FL2,
flr.IMPP_FL1,
flr.IMPP_FL2,
flr.InsolFlashControl_FL1,
flr.InsolFlashControl_FL2,
flr.InsolMPP_FL1,
flr.InsolMPP_FL2,
flr.InsolVoc_FL1,
flr.InsolVoc_FL2,
flr.Insol_FL1,
flr.Insol_FL2,
flr.ISC_FL1,
flr.ISC_FL2,
flr.MEAS_TIME_FL1,
flr.MEAS_TIME_FL2,
flr.PMPP_FL1,-- pid16实测PMPP
flr.PMPP_FL2,-- pid22实测PMPP
flr.Tcell_FL1,
flr.Tcell_FL2,
flr.Tmonicell_FL1,
flr.Tmonicell_FL2,
flr.UMPP_FL1,
flr.UMPP_FL2,
flr.UOC_FL1,
flr.UOC_FL2,
flc.PMPP -- 补偿后功率,用我们的
FROM
ue_flasher_data_raw flr
LEFT JOIN e_tracking_unit tu ON flr.mainid = tu.id
LEFT JOIN ue_flasher_data_calc flc ON flc.mainid = tu.id
LEFT JOIN er_order eo ON tu.ORDER_ID = eo.ID
WHERE
flr.PMPP_FL2 != 0
and
tu.name=#{subId}
GROUP BY
tu.`NAME`
ORDER BY
flr.LAST_UPDATE_TIME DESC
LIMIT 1
</select>
<select id="getOrderNameBySubId" resultType="string">
SELECT
eorder.name
FROM
e_tracking_unit tu
LEFT JOIN er_order eorder ON tu.order_id = eorder.id
WHERE
tu.name=#{subId} -- 依据基板id 查询对应的订单名
ORDER BY
tu.LAST_UPDATE_TIME DESC
LIMIT 1
</select>
<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')
</select>
</mapper>

View File

@ -19,10 +19,31 @@
<id column="update_time" property="updateTime" />
<id column="version" property="version" />
</resultMap>
<resultMap id="ResultMap" type="com.cnbm.packing.dto.CompensationPowerXSDTO">
<result column="a" property="a" />
<result column="b" property="b" />
</resultMap>
<select id="list" resultType="com.cnbm.packing.dto.WoCompensationPowerDTO">
select * from t_wo_compensation_power
order by id asc
</select>
<select id="getConffBySubIdAndLineBody" resultMap="ResultMap">
select
twcp.coefficient_a as a,twcp.coefficient_b as b
from t_wo_compensation_power twcp
where
twcp.valid = 1
<if test="param.lineBody != null">
and twcp.line_body = #{param.lineBody}
</if>
<if test="param.pmpp != null">
and twcp.actl_pmpp_high <![CDATA[ >= ]]> #{param.pmpp} and twcp.actl_pmpp_low <![CDATA[ <= ]]> #{param.pmpp}
</if>
</select>
</mapper>

View File

@ -38,5 +38,10 @@
select * from t_wo_packaging_box
order by id asc
</select>
<update id="updateIsArrivedByBoxNo">
update t_wo_packaging_box
set is_arrived = #{isArrived,jdbcType=NUMERIC}
where BOX_NO = #{boxNo,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -63,6 +63,20 @@
</where>
order by slot asc
</select>
<select id="getOneByWoSubstrateId" resultMap="WoPackagingBoxSubstrateMap">
select
*
from t_wo_packaging_box_substrate
where
valid = 1 and
WO_SUBSTRATE_ID = #{woSubstrateId,jdbcType=VARCHAR}
limit 1
</select>
<update id="updatePackagingBoxIdByWoSubstrateId">
update t_wo_packaging_box_substrate
set PACKAGING_BOX_ID = #{packagingBoxId,jdbcType=VARCHAR}
where WO_SUBSTRATE_ID = #{woSubstrateId,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -28,4 +28,18 @@
order by id asc
</select>
<select id="getPowerLevelByLineBodyAndPMPP" resultMap="WoPowerLevelMap">
select
*
from t_wo_power_level twpl
where
twpl.valid = 1
<if test="param.lineBody != null">
and twpl.line_body = #{param.lineBody}
</if>
<if test="param.pmpp != null">
and twpl.pmpp_high <![CDATA[ >= ]]> #{param.pmpp} and twpl.pmpp_low <![CDATA[ <= ]]> #{param.pmpp}
</if>
</select>
</mapper>

View File

@ -27,6 +27,7 @@ public enum S7Client {
// S7_1200("192.168.0.52",0,1,1,PlcVarActual.HeartBeatFor1200),
S7_15001("192.168.0.51",0,1,1),
S7_1500("192.168.0.51",0,1,1),
S7_KUKA("192.168.0.51",0,1,2),
//1500 机架-0 插槽-1
//后续 在这里扩展 多PLC应用
;