From 4d1a58b8c799370f3b23c40bd2b56a21020e9630 Mon Sep 17 00:00:00 2001
From: caixiang <939387484@qq.com>
Date: Wed, 22 Feb 2023 20:48:15 +0800
Subject: [PATCH] commit for pull
---
ym-packing/pom.xml | 12 +-
.../cnbm/packing/dispatch/KukaJoinThread.java | 351 ++++++++++++++++++
.../cnbm/packing/dispatch/enums/CodeEnum.java | 15 +
.../enums/kuka/step1/Step1Mes2PlcVar.java | 93 +++++
.../enums/kuka/step1/Step1Plc2MesVar.java | 89 +++++
.../enums/kuka/step2/Step2Mes2PlcVar.java | 88 +++++
.../enums/kuka/step2/Step2Plc2MesVar.java | 89 +++++
.../enums/kuka/step3/Step3Mes2PlcVar.java | 87 +++++
.../enums/kuka/step3/Step3Plc2MesVar.java | 90 +++++
.../packing/dto/CompensationPowerXSDTO.java | 21 ++
.../cnbm/packing/mapper/CamlineMapper.java | 26 ++
.../mapper/WoCompensationPowerMapper.java | 6 +-
.../packing/mapper/WoPowerLevelMapper.java | 6 +
.../packing/param/CompensationQueryParam.java | 16 +
.../service/DynamicDataSourceService.java | 50 +++
.../WoCompensationPowerServiceBiz.java | 4 +
.../service/WoPowerLevelServiceBiz.java | 1 +
.../WoCompensationPowerServiceBizImpl.java | 21 +-
.../impl/WoPowerLevelServiceBizImpl.java | 8 +
.../java/com/cnbm/packing/vo/ComlinePMPP.java | 17 +
.../main/resources/mapper/CamlineMapper.xml | 56 +++
.../mapper/WoCompensationPowerMapper.xml | 21 ++
.../resources/mapper/WoPowerLevelMapper.xml | 14 +
.../cnbm/s7/s7connector/enmuc/S7Client.java | 1 +
24 files changed, 1179 insertions(+), 3 deletions(-)
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/CodeEnum.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Mes2PlcVar.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Plc2MesVar.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Mes2PlcVar.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Plc2MesVar.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Mes2PlcVar.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Plc2MesVar.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/dto/CompensationPowerXSDTO.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/param/CompensationQueryParam.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java
create mode 100644 ym-packing/src/main/java/com/cnbm/packing/vo/ComlinePMPP.java
create mode 100644 ym-packing/src/main/resources/mapper/CamlineMapper.xml
diff --git a/ym-packing/pom.xml b/ym-packing/pom.xml
index f2001c9..5e1b1b5 100644
--- a/ym-packing/pom.xml
+++ b/ym-packing/pom.xml
@@ -23,9 +23,19 @@
ym-common
1.0-SNAPSHOT
+
+
+
+
+
com.cnbm
- ym-core
+ ym-s7
+ 1.0-SNAPSHOT
+
+
+ com.cnbm
+ ym-dynamic-datasource
1.0-SNAPSHOT
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java
new file mode 100644
index 0000000..222a86d
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/KukaJoinThread.java
@@ -0,0 +1,351 @@
+package com.cnbm.packing.dispatch;
+
+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.WoPowerLevelDTO;
+import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
+import com.cnbm.packing.entity.WoPowerLevel;
+import com.cnbm.packing.service.DynamicDataSourceService;
+import com.cnbm.packing.service.WoCompensationPowerServiceBiz;
+import com.cnbm.packing.service.WoPackagingBoxSubstrateServiceBiz;
+import com.cnbm.packing.service.WoPowerLevelServiceBiz;
+import com.cnbm.s7.s7connector.enmuc.S7Client;
+import com.cnbm.s7.s7connector.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.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;
+
+ 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);
+ }
+ }
+
+
+
+ @Override
+ public void run(ApplicationArguments args) throws Exception {
+ kukaStep1.execute(new Runnable() {
+ @Override
+ public void run() {
+ while (true){
+ //read one
+// logger.info("过程一 : "+ Arrays.toString((String[])read(S7Client.S7_1500,PlcVarActual.SubIdArrays)));
+// try {
+// Thread.sleep(300);
+// } catch (InterruptedException e) {
+// throw new S7ParseDataException(e);
+// }
+// //write one
+// String[] toWrite = new String[60];
+// for(int i=0;i<60;i++){
+// toWrite[i] = RandomStringUtils.randomAlphanumeric(18);
+// }
+// try {
+// write(S7Client.S7_1500,PlcVarActual.SubIdArrays,toWrite);
+// } catch (Exception e) {
+// throw new S7ParseDataException(e);
+// }
+
+
+ }
+ }
+ });
+
+ kukaStep1.scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run() {
+ //调度开始
+ logger.info("");
+ logger.info("================= 现在开始执行 过程一 任务 ==================");
+ Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
+ if(subArrived != 1){
+ logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
+ }
+
+ //1. 从plc 中获取 subId 和 lineNum
+ String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
+ Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
+ //2. 从comline数据库中获取 实际pmpp
+ float pmppBySubId = service.getPMPPBySubId(subId);
+ //3. 匹配和计算补偿功率
+ float actualPMPP = compensationPowerServiceBiz.calculCompensationPMPP(pmppBySubId,lineNum);
+ //4. 依据补偿功率,获取工艺参数,并且把这些工艺参数传给kuka
+ WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(actualPMPP, lineNum);
+ write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,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());
+
+
+ //5. 把基板录到数据库
+ WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
+ woPackagingBoxSubstrate.setLineBody(1);
+ woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass().toString());
+ woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
+ woPackagingBoxSubstrate.setWoSubstrateId("sub123");
+
+ substrateServiceBiz.insert(woPackagingBoxSubstrate);
+
+
+
+ }
+ },1,1, TimeUnit.SECONDS);
+
+ kukaStep2.scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ String s = RandomUtil.randomString(5);
+ System.out.println("start + "+s+" : "+LocalDateTime.now());
+ Thread.sleep(3000);
+
+
+ //写业务代码
+ WoPowerLevel argByPMPP = levelServiceBiz.getArgByPMPP(2.1111f, 1);
+
+
+ WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
+ woPackagingBoxSubstrate.setLineBody(1);
+ woPackagingBoxSubstrate.setPowerLevel(argByPMPP.getPowerClass().toString());
+ woPackagingBoxSubstrate.setSapMaterial(argByPMPP.getSapMaterialNum());
+ woPackagingBoxSubstrate.setWoSubstrateId("sub123");
+
+ substrateServiceBiz.insert(woPackagingBoxSubstrate);
+
+ System.err.println(argByPMPP.toString());
+// service.salve3Get();
+ System.out.println("end "+ s +" : "+ LocalDateTime.now());
+ }catch (Throwable e){
+ //Error 和 Exception 都继承于Throwable ,所以当业务代码出现Error/Exception 都不会导致程序down掉
+ e.printStackTrace();
+ }
+ }
+ },1,1, TimeUnit.SECONDS);
+
+
+ kukaStep3.scheduleAtFixedRate(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ String s = RandomUtil.randomString(5);
+ System.out.println("start + "+s+" : "+LocalDateTime.now());
+ Thread.sleep(3000);
+
+
+ //写业务代码
+ service.salve1Get();
+// service.salve3Get();
+ System.out.println("end "+ s +" : "+ LocalDateTime.now());
+ }catch (Throwable e){
+ //Error 和 Exception 都继承于Throwable ,所以当业务代码出现Error/Exception 都不会导致程序down掉
+ e.printStackTrace();
+ }
+ }
+ },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;
+ }
+}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/CodeEnum.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/CodeEnum.java
new file mode 100644
index 0000000..a64f69a
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/CodeEnum.java
@@ -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);
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Mes2PlcVar.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Mes2PlcVar.java
new file mode 100644
index 0000000..9728601
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Mes2PlcVar.java
@@ -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;
+ }
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Plc2MesVar.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Plc2MesVar.java
new file mode 100644
index 0000000..3bd2f8c
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step1/Step1Plc2MesVar.java
@@ -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;
+ }
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Mes2PlcVar.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Mes2PlcVar.java
new file mode 100644
index 0000000..26a2a0c
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Mes2PlcVar.java
@@ -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;
+ }
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Plc2MesVar.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Plc2MesVar.java
new file mode 100644
index 0000000..5e4f5fe
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step2/Step2Plc2MesVar.java
@@ -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;
+ }
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Mes2PlcVar.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Mes2PlcVar.java
new file mode 100644
index 0000000..9b9162b
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Mes2PlcVar.java
@@ -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;
+ }
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Plc2MesVar.java b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Plc2MesVar.java
new file mode 100644
index 0000000..5982314
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dispatch/enums/kuka/step3/Step3Plc2MesVar.java
@@ -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;
+ }
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/dto/CompensationPowerXSDTO.java b/ym-packing/src/main/java/com/cnbm/packing/dto/CompensationPowerXSDTO.java
new file mode 100644
index 0000000..979d92b
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/dto/CompensationPowerXSDTO.java
@@ -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;
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java b/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java
new file mode 100644
index 0000000..30ab945
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/mapper/CamlineMapper.java
@@ -0,0 +1,26 @@
+package com.cnbm.packing.mapper;
+
+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);
+
+ Integer getTodayBoxNum();
+}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/mapper/WoCompensationPowerMapper.java b/ym-packing/src/main/java/com/cnbm/packing/mapper/WoCompensationPowerMapper.java
index 9a0e68e..834cd42 100644
--- a/ym-packing/src/main/java/com/cnbm/packing/mapper/WoCompensationPowerMapper.java
+++ b/ym-packing/src/main/java/com/cnbm/packing/mapper/WoCompensationPowerMapper.java
@@ -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 {
List list();
-
+
+ CompensationPowerXSDTO getConffBySubIdAndLineBody(@Param("param") CompensationQueryParam param);
}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/mapper/WoPowerLevelMapper.java b/ym-packing/src/main/java/com/cnbm/packing/mapper/WoPowerLevelMapper.java
index 971ca97..9a18a19 100644
--- a/ym-packing/src/main/java/com/cnbm/packing/mapper/WoPowerLevelMapper.java
+++ b/ym-packing/src/main/java/com/cnbm/packing/mapper/WoPowerLevelMapper.java
@@ -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 {
List list();
+ WoPowerLevel getPowerLevelByLineBodyAndPMPP(@Param("param") CompensationQueryParam param);
+
+
}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/param/CompensationQueryParam.java b/ym-packing/src/main/java/com/cnbm/packing/param/CompensationQueryParam.java
new file mode 100644
index 0000000..987e3d7
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/param/CompensationQueryParam.java
@@ -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;
+
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java b/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java
new file mode 100644
index 0000000..7215dc8
--- /dev/null
+++ b/ym-packing/src/main/java/com/cnbm/packing/service/DynamicDataSourceService.java
@@ -0,0 +1,50 @@
+package com.cnbm.packing.service;
+
+import com.cnbm.dynamic.datasource.annotation.DataSource;
+import com.cnbm.packing.dto.WoPowerLevelDTO;
+import com.cnbm.packing.mapper.CamlineMapper;
+
+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;
+
+
+ @Transactional
+ @DataSource("slave1")
+ public void salve1Get(){
+ WoPowerLevelDTO woPowerLevelDTO = powerLevelServiceBiz.get(Long.valueOf(1));
+ System.out.println(woPowerLevelDTO.toString());
+ }
+
+ public void getTodayBoxNum(){
+ Integer todayBoxNum = mapper.getTodayBoxNum();
+ System.out.println(todayBoxNum);
+ }
+
+ public float getPMPPBySubId(String subId){
+ return mapper.getPMPPBySubId(subId);
+ }
+
+
+
+ @DataSource("slave2")
+ @Transactional
+ public void salve3Get(){
+ float byid = mapper.getByid("LTWeight");
+ System.out.println(byid);
+ }
+}
diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/WoCompensationPowerServiceBiz.java b/ym-packing/src/main/java/com/cnbm/packing/service/WoCompensationPowerServiceBiz.java
index 9f4d381..25c8c92 100644
--- a/ym-packing/src/main/java/com/cnbm/packing/service/WoCompensationPowerServiceBiz.java
+++ b/ym-packing/src/main/java/com/cnbm/packing/service/WoCompensationPowerServiceBiz.java
@@ -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 {
+
PageData page (Map params);
WoCompensationPowerDTO get(Long id);
@@ -27,5 +29,7 @@ public interface WoCompensationPowerServiceBiz extends CrudService list();
+
+ float calculCompensationPMPP(float pmpp, Integer lineBody);
}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/WoPowerLevelServiceBiz.java b/ym-packing/src/main/java/com/cnbm/packing/service/WoPowerLevelServiceBiz.java
index c845a92..b591726 100644
--- a/ym-packing/src/main/java/com/cnbm/packing/service/WoPowerLevelServiceBiz.java
+++ b/ym-packing/src/main/java/com/cnbm/packing/service/WoPowerLevelServiceBiz.java
@@ -27,5 +27,6 @@ public interface WoPowerLevelServiceBiz extends CrudService list();
+ WoPowerLevel getArgByPMPP(float pmpp, Integer lineBody);
}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoCompensationPowerServiceBizImpl.java b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoCompensationPowerServiceBizImpl.java
index 9e42234..596b763 100644
--- a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoCompensationPowerServiceBizImpl.java
+++ b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoCompensationPowerServiceBizImpl.java
@@ -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 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;
+ }
}
\ No newline at end of file
diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPowerLevelServiceBizImpl.java b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPowerLevelServiceBizImpl.java
index 82ddbeb..80fab47 100644
--- a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPowerLevelServiceBizImpl.java
+++ b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPowerLevelServiceBizImpl.java
@@ -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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ym-packing/src/main/resources/mapper/WoCompensationPowerMapper.xml b/ym-packing/src/main/resources/mapper/WoCompensationPowerMapper.xml
index ff6a097..8433fdc 100644
--- a/ym-packing/src/main/resources/mapper/WoCompensationPowerMapper.xml
+++ b/ym-packing/src/main/resources/mapper/WoCompensationPowerMapper.xml
@@ -19,10 +19,31 @@
+
+
+
+
+
+
+
diff --git a/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml b/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml
index 58448fb..15beb02 100644
--- a/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml
+++ b/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml
@@ -28,4 +28,18 @@
order by id asc
+
+
diff --git a/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7Client.java b/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7Client.java
index 9234962..5155527 100644
--- a/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7Client.java
+++ b/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7Client.java
@@ -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应用。
;