From d70f19adcd45fd68b6ee0448c9fab70b754e7495 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Thu, 6 Apr 2023 15:26:01 +0800 Subject: [PATCH 1/6] commit for pull --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 185a4bd..3ce7b96 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,11 @@ - Maven3.0+ - MySQL8.0 - redis6.0+ -
\ No newline at end of file +
+ + +**切换到现场环境** +- gateway 下的 application.yml 改redis地址 改成10.0.1.249那个 +- gateway 下的 application-dev.yml 选用 “MySQL-local” 和 “camline系统 - local” 这两个 +- packaging 下的 KukaJoinThread 要把 三个启动线程放开(kukaStep1.scheduleAtFixedRate、kukaStep2.scheduleAtFixedRate、kukaStep3.scheduleAtFixedRate) +
\ No newline at end of file From 72aae5c4393f0c6681455bf0b5ea00e171b6288e Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Fri, 12 May 2023 16:21:41 +0800 Subject: [PATCH 2/6] commit for pull --- .../src/main/java/com/cnbm/dispatch/KukaJoinThread.java | 8 ++++++-- .../com/cnbm/packing/controller/PrintModelController.java | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java b/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java index d34116b..a26c3aa 100644 --- a/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java +++ b/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java @@ -192,7 +192,7 @@ public class KukaJoinThread implements ApplicationRunner { String powerLevel = substrateServiceBiz.getBySubId(subIds[i]).getPowerLevel(); if(!powerLevel.equals(correctLevel)){ - errMsg+="基板ID:"+subIds[i]+" 档位:"+powerLevel+", "; + errMsg += "基板ID:"+subIds[i]+" 档位:"+powerLevel+", "; res = true; } } @@ -203,6 +203,7 @@ public class KukaJoinThread implements ApplicationRunner { return res; } + @Override public void run(ApplicationArguments args) throws Exception { @@ -343,7 +344,10 @@ public class KukaJoinThread implements ApplicationRunner { logger.info("BOXID生成Event-------获取到基板列表:"+ Arrays.toString(subIdList)+",基板数量:"+listSize); WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]); - logger.info("bySubId"+ bySubId.toString()); + if(bySubId==null){ + logger.info("BOXID生成Event-------数据库中 无subId:"+ subIdList[0]); + } + //如果我们系统中找不到这块基板那么就去camline里面找 if(bySubId == null){ diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/PrintModelController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/PrintModelController.java index 42c02e5..88456be 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/PrintModelController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/PrintModelController.java @@ -58,6 +58,7 @@ public class PrintModelController { return new Result>().ok(page); } + @GetMapping("{id}") @ApiOperation("信息") @PreAuthorize("@ex.hasAuthority('packing:printModel:info')") From 1704b2c37b088b6551d487d37b05248fa0b3fdd8 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Fri, 18 Aug 2023 14:22:53 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E5=90=8E=E7=BB=AD=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ym-gateway/src/main/resources/logback.xml | 88 +- .../com/cnbm/dispatch/KukaEvent1Thread.java | 420 ++++++ .../com/cnbm/dispatch/KukaEvent2Thread.java | 424 ++++++ .../com/cnbm/dispatch/KukaEvent3Thread.java | 360 ++++++ .../com/cnbm/dispatch/KukaJoinThread.java | 1144 +++++++++-------- .../enums/kuka/step1/Step1Mes2PlcVar.java | 3 - .../java/com/cnbm/dispatchDDJ/DDJ1Task.java | 294 +++++ .../dispatchDDJ/constant/QGSConstant.java | 16 + .../dispatchDDJ/entity/DDJInfoCallBack.java | 24 + .../com/cnbm/dispatchDDJ/entity/TaskDTO.java | 39 + .../com/cnbm/dispatchDDJ/enums/CodeEnum.java | 15 + .../enums/ddj/ddj1/DDJPlc2WcsVar.java | 110 ++ .../enums/ddj/ddj1/DDJWcs2PlcVar.java | 101 ++ .../enums/ddj/ddj2/DDJPlc2WcsVar.java | 110 ++ .../enums/ddj/ddj2/DDJWcs2PlcVar.java | 101 ++ .../enums/ddj/ddj3/DDJPlc2WcsVar.java | 110 ++ .../enums/ddj/ddj3/DDJWcs2PlcVar.java | 101 ++ .../enums/ddj/ddj4/DDJPlc2WcsVar.java | 110 ++ .../enums/ddj/ddj4/DDJWcs2PlcVar.java | 101 ++ .../cnbm/dispatchDDJ/interfaces/Listener.java | 10 + .../interfaces/RuntimeEQErrListener.java | 31 + .../java/com/cnbm/dispatchDDJ/main/main.java | 25 + .../dispatchDDJ/taskPool/QGSThreadPool.java | 42 + .../packing/controller/TestController.java | 48 +- ym-s7/pom.xml | 1 + .../cnbm/s7/s7connector/enmuc/S7Client.java | 5 +- .../s7connector/enmuc/S7ParamErrorCode.java | 1 + .../exception/S7CheckResultException.java | 13 + 28 files changed, 3273 insertions(+), 574 deletions(-) create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/KukaEvent1Thread.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/KukaEvent2Thread.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/KukaEvent3Thread.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/DDJ1Task.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/Listener.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java diff --git a/ym-gateway/src/main/resources/logback.xml b/ym-gateway/src/main/resources/logback.xml index 9107c9c..5d3e3f5 100644 --- a/ym-gateway/src/main/resources/logback.xml +++ b/ym-gateway/src/main/resources/logback.xml @@ -15,6 +15,7 @@ + @@ -193,6 +194,81 @@ DENY + + + ${logging.eventlog}/event1/kuka-event1-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/kuka-event1-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + 999 + 200GB + + + + info + ACCEPT + DENY + + + + + ${logging.eventlog}/event2/kuka-event2-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/kuka-event2-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + 999 + 200GB + + + + info + ACCEPT + DENY + + + + + ${logging.eventlog}/event3/kuka-event3-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/kuka-event3-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + 999 + 200GB + + + + info + ACCEPT + DENY + + + + + @@ -405,7 +481,17 @@ - + + + + + + + + + + + diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/KukaEvent1Thread.java b/ym-packing/src/main/java/com/cnbm/dispatch/KukaEvent1Thread.java new file mode 100644 index 0000000..6276ca6 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatch/KukaEvent1Thread.java @@ -0,0 +1,420 @@ +package com.cnbm.dispatch; + +import cn.hutool.core.date.DateUtil; +import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar; +import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar; +import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar; +import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar; +import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar; +import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar; +import com.cnbm.packing.dto.CamlineExtendArgDTO; +import com.cnbm.packing.dto.CamlineSubIdDTO; +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.text.DecimalFormat; +import java.text.Format; +import java.time.LocalDateTime; +import java.util.Arrays; +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 KukaEvent1Thread implements ApplicationRunner { + private static final Logger logger = LoggerFactory.getLogger("EVENT1"); + + @Autowired + DynamicDataSourceService service; + @Autowired + WoPowerLevelServiceBiz levelServiceBiz; + + @Autowired + WoCompensationPowerServiceBiz compensationPowerServiceBiz; + + @Autowired + WoPackagingBoxSubstrateServiceBiz substrateServiceBiz; + + @Autowired + WoPackagingBoxServiceBiz boxServiceBiz; + + public KukaEvent1Thread(){ + this.kukaStep1 = Executors.newScheduledThreadPool(1); + } + + private ScheduledExecutorService kukaStep1; + + + + + /** + * 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i 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()+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; - } - - public String removeKG(String str){ - return str.substring(0,17); - } - - public static void main(String[] args) { - Integer a = 102; - Format f1 = new DecimalFormat("000"); - System.out.println(f1.format(a)); - } - public String formateString(Integer a){ - Format f1 = new DecimalFormat("000"); - return f1.format(a); - } - - //return true 出现混档了,return false 没有出现混档 - private boolean isMixLevel(String[] subIds,Integer size){ - String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); - String errMsg = "以下基板ID出现混档:"; - boolean res = false; - for(int i=0;i 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 (Throwable e){ +// logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); +// 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 (Throwable e){ +// logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); +// 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()+1; +// String nowTime = DateUtil.format(new Date(), "yyMMdd"); +// +// todayBoxNum+=500; +// logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); +// 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 = "444"+sapMaterial+nowTime+mixBoxError; +// logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); +// +// return res; +// } +// +// public String removeKG(String str){ +// return str.substring(0,17); +// } +// +// public static void main(String[] args) { +// Integer a = 102; +// Format f1 = new DecimalFormat("000"); +// System.out.println(f1.format(a)); +// } +// public String formateString(Integer a){ +// Format f1 = new DecimalFormat("000"); +// return f1.format(a); +// } +// +// //return true 出现混档了,return false 没有出现混档 +// private boolean isMixLevel(String[] subIds,Integer size){ +// String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); +// String errMsg = "以下基板ID出现混档:"; +// boolean res = false; +// for(int i=0;i linkTestRecvListeners = new CopyOnWriteArrayList<>(); + + @Override + public void addRuntimeEQErrListener(RuntimeEQErrListener lstnr) { + linkTestRecvListeners.add(lstnr); + } + + + public void executeLinktestRecvTask(Integer errCode) { + for (RuntimeEQErrListener listener : linkTestRecvListeners) { + listener.received(errCode); + } + } + + +// public void run() { +// CompletableFuture.supplyAsync(() -> { +// System.out.println(""); +// System.out.println("开始执行 ddj1 调度任务 开始 "+ Thread.currentThread().hashCode()); +// executeLinktestRecvTask(1); +// +// System.out.println("开始执行 ddj1 调度任务 结束"+ Thread.currentThread().hashCode()); +// return 1; +// }, QGSThreadPool.ddj1ExecutorService).whenComplete((data, error) -> { +// System.out.println("data:" + data+ Thread.currentThread().hashCode()); +// if (error != null) { +// System.out.println(error); +// } +// }); +// } + + + /* * + * + * status + * 10 初始值 + * -2 s7 数据采集失败 + * 100 任务成功完成 + * 101 任务被人为取消,取消的原因看 content + * */ + public void run(){ + CompletableFuture.supplyAsync(() -> { + logger.info(""); + logger.info("================= 现在开始执行 DDJ1 任务 : "+ taskDTO.toString()+" =================="); + + //构建结果类 + DDJInfoCallBack build = new DDJInfoCallBack(); + build.setStatus(10); + + build.setTaskId(taskDTO.getMissionID()); + //调度逻辑 ------------------------------------- 开始 ------------------------------------- + //todo 这里待定,当出现脱机或者 故障的时候 怎么的一个形式告知 wms + //步骤1 WCS监听 PlcToWcs.Operate_Mode 是否为 1 , ( 1 = 联机 ) + Integer operateMode = waitingForTarget(DDJPlc2WcsVar.Operate_Mode, 1); + if(operateMode!=1){ + logger.info("失败"+" --- "+"步骤1. WCS监听 DDJPlc2WcsVar.Operate_Mode 是否 等于 1 失败"); + build.setContent("失败,步骤1,监听数据异常"); + build.setStatus(-2); + return build; + } + logger.info("成功"+" --- "+"步骤1. WCS监听 DDJPlc2WcsVar.Operate_Mode 等于 1 "); + + + //步骤2 WCS监听 PlcToWcs.Mission_State 是否为 0 , ( 0 = 空闲 ) + Integer missionState = waitingForTarget(DDJPlc2WcsVar.Mission_State, 0); + if(missionState!=1){ + logger.info("失败"+" --- "+"步骤2. WCS监听 PlcToWcs.Mission_State 是否 等于 0 失败"); + build.setContent("失败,步骤2,监听数据异常"); + build.setStatus(-2); + return build; + } + logger.info("成功"+" --- "+"步骤2. WCS监听 PlcToWcs.Mission_State 等于 0 "); + + //步骤3 WCS下发任务 + issueTask(); + logger.info("成功"+" --- "+"步骤3. WCS 下发任务 "); + + + //步骤4 WCS启动任务(WcsToPlc.Command_No 置为 1 ) + write(s7Client,DDJWcs2PlcVar.Command_No,1); + logger.info("成功"+" --- "+"步骤4. WCS启动任务(WcsToPlc.Command_No 置为 1 )成功 "); + + + //步骤5 WCS 监控PlcToWcs.Mission_State ==2 监控任务是否完成 + Integer missionState2 = waitingForTargetAndLoggerError(DDJPlc2WcsVar.Mission_State,DDJPlc2WcsVar.Operate_Mode, 2); + if(missionState2!=1){ + logger.info("失败"+" --- "+"步骤5. WCS 监控PlcToWcs.Mission_State ==2 监控任务是否完成"); + build.setContent("失败,步骤5,监听数据异常"); + build.setStatus(-2); + return build; + } + logger.info("成功"+" --- "+"步骤5. WCS 监控PlcToWcs.Mission_State ==2 "); + + //步骤6 WCS 把 Command_No 置为 2(重置操作) + write(s7Client,DDJWcs2PlcVar.Command_No,2); + logger.info("成功"+" --- "+"步骤6. WCS 把 Command_No 置为 2(重置操作) "); + build.setStatus(100); + build.setContent("任务成功完成"); + //调度逻辑 ------------------------------------- 结束 + + + return build; + }, QGSThreadPool.ddj1ExecutorService).whenComplete(new BiConsumer() { + //任务完成以后把结果返回给 第调用者 + @Override + public void accept(DDJInfoCallBack agvInfoCallBack, Throwable throwable) { + if(throwable!=null){ + logger.info("whenComplete throwable is " + throwable.getMessage()); + }else { + logger.info("任务执行完成,现在wcs把 结果:"+agvInfoCallBack.toString()+", 推送给wms"); + HttpUtil.post(QGSConstant.wmsUrl, JSONObject.toJSONString(agvInfoCallBack)); + logger.info("================= 任务结束 : "+ taskDTO.toString()+" =================="); + logger.info(""); + + } + } + }); + + } + + + + + /** + * desc: 下发任务给电控 + * return: + * true 成功 + * false 失败 + * */ + private void issueTask() { + write(s7Client,DDJWcs2PlcVar.Mission_Type, taskDTO.getMissionType()); + + write(s7Client,DDJWcs2PlcVar.From_Row, taskDTO.getFromRow()); + write(s7Client,DDJWcs2PlcVar.From_Layer, taskDTO.getFromLayer()); + write(s7Client,DDJWcs2PlcVar.From_List, taskDTO.getFromList()); + write(s7Client,DDJWcs2PlcVar.To_Row, taskDTO.getToRow()); + write(s7Client,DDJWcs2PlcVar.To_List, taskDTO.getToList()); + write(s7Client,DDJWcs2PlcVar.To_Layer, taskDTO.getToLayer()); + + write(s7Client,DDJWcs2PlcVar.Goods_Size, taskDTO.getGoodsSiZe()); + write(s7Client,DDJWcs2PlcVar.Coordinate_conversion, taskDTO.getCoordinateConversion()); + write(s7Client,DDJWcs2PlcVar.Mission_ID, taskDTO.getMissionID()); + write(s7Client,DDJWcs2PlcVar.Pallet_Num, taskDTO.getPalletNum()); + } + + /** + * + * arg: + * RGV1Plc2WcsVarEnum 参数类型 + * targetValue 目的值 + * return: + * 2 opc 访问异常; + * 1 成功; + * */ + private Integer waitingForTarget(DDJPlc2WcsVar var, Integer targetValue) { + Integer res = 0; + while (true){ + try { + Integer now = (Integer) read(s7Client,var); + if(targetValue.equals(now)){ + res = 1; + break; + } + Thread.sleep(200); + }catch (Exception e){ + logger.info("S7 数据采集 异常。"); + res = 2; + break; + } + } + return res; + } + + private Integer waitingForTargetAndOperaMode(DDJPlc2WcsVar var, Integer targetValue) { + Integer res = 0; + while (true){ + try { + Integer now = (Integer) read(s7Client,var); + if(targetValue.equals(now)){ + res = 1; + break; + } + Thread.sleep(200); + }catch (Exception e){ + logger.info("S7 数据采集 异常。"); + res = 2; + break; + } + } + return res; + } + + private Integer waitingForTargetAndLoggerError(DDJPlc2WcsVar var,DDJPlc2WcsVar var2, Integer targetValue) { + Integer res = 0; + while (true){ + try { + Integer now = (Integer) read(s7Client,var); + Integer operateMode = (Integer) read(s7Client,var2); + if(targetValue.equals(now)){ + res = 1; + break; + } + if(operateMode.equals(2)){ + Integer faultNo = (Integer) read(s7Client,DDJPlc2WcsVar.Fault_No); + logger.info("步骤5 DDJ在运行的时候出现 fault, fault no = "+faultNo); + //调用上层的 回调方法 开始 + executeLinktestRecvTask(faultNo); + //调用上层的 回调方法 结束 + Thread.sleep(10000); + } + Thread.sleep(200); + }catch (Exception e){ + logger.info("S7 数据采集 异常。"); + res = 2; + break; + } + } + return res; + } + + + /** + * return + * 成功: 返回相应的object对象 + * 失败: 返回null + * */ + private Object read(S7Client s7Client, DDJPlc2WcsVar 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, DDJWcs2PlcVar 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); + } + } + + +} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java new file mode 100644 index 0000000..3ad7b13 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java @@ -0,0 +1,16 @@ +package com.cnbm.dispatchDDJ.constant; + +/** + * @Author: 蔡翔 + * @Date: 2019/11/3 11:30 + * @Version 1.0 + */ +public class QGSConstant { + public static final Object LOCK = new Object(); + + public static final Long deadLineTime = 300000L; + + //wms 需提供 post 接口 + public static final String wmsUrl = "http://localhost:8089/wms-qy/work/wcs2wms/taskcallback"; +} + diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java new file mode 100644 index 0000000..dd8329a --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java @@ -0,0 +1,24 @@ +package com.cnbm.dispatchDDJ.entity; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + *

+ * 表 + *

+ * + * @author caixiang + * @since 2022-05-31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class DDJInfoCallBack implements Serializable { + + private static final long serialVersionUID = 1L; + private Integer status; + private String content; + private Integer taskId; +} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java new file mode 100644 index 0000000..2188fba --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java @@ -0,0 +1,39 @@ +package com.cnbm.dispatchDDJ.entity; + +import lombok.Data; + +/** + * @Desc: "" + * @Author: caixiang + * @DATE: 2021/11/9 20:50 + */ +@Data +public class TaskDTO { + //任务类型 + private Integer missionType; + + //起点-排 + private Integer fromRow; + //起点-列 + private Integer fromList; + //起点-层 + private Integer fromLayer; + + //终点-排 + private Integer toRow; + //终点-列 + private Integer toList; + //终点-层 + private Integer toLayer; + + //货物尺寸 + private Integer goodsSiZe; + //坐标转换 + private Integer coordinateConversion; + + //任务号 + private Integer missionID; + + //条码值 + private Integer palletNum; +} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java new file mode 100644 index 0000000..d0c4dee --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java @@ -0,0 +1,15 @@ +package com.cnbm.dispatchDDJ.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/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java new file mode 100644 index 0000000..307f9a3 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java @@ -0,0 +1,110 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj1; + +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 DDJPlc2WcsVar { + + Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), + Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), + Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), + Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), + Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), + Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), + Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), + Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), + Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), + Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), + Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), + Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; + + DDJPlc2WcsVar(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; + } + DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java new file mode 100644 index 0000000..2d90354 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java @@ -0,0 +1,101 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj1; + +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 DDJWcs2PlcVar { + + Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), + Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), + Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), + Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), + Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), + Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), + Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), + //todo 条码值 要写长度 + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; + + DDJWcs2PlcVar(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; + } + DDJWcs2PlcVar(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/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java new file mode 100644 index 0000000..04ed891 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java @@ -0,0 +1,110 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj2; + +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 DDJPlc2WcsVar { + + Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), + Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), + Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), + Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), + Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), + Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), + Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), + Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), + Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), + Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), + Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), + Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; + + DDJPlc2WcsVar(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; + } + DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java new file mode 100644 index 0000000..ea833d4 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java @@ -0,0 +1,101 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj2; + +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 DDJWcs2PlcVar { + + Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), + Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), + Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), + Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), + Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), + Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), + Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), + //todo 条码值 要写长度 + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; + + DDJWcs2PlcVar(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; + } + DDJWcs2PlcVar(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/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java new file mode 100644 index 0000000..5562ac7 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java @@ -0,0 +1,110 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj3; + +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 DDJPlc2WcsVar { + + Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), + Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), + Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), + Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), + Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), + Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), + Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), + Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), + Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), + Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), + Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), + Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; + + DDJPlc2WcsVar(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; + } + DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java new file mode 100644 index 0000000..fbd5b9c --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java @@ -0,0 +1,101 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj3; + +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 DDJWcs2PlcVar { + + Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), + Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), + Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), + Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), + Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), + Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), + Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), + //todo 条码值 要写长度 + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; + + DDJWcs2PlcVar(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; + } + DDJWcs2PlcVar(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/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java new file mode 100644 index 0000000..25a992c --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java @@ -0,0 +1,110 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj4; + +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 DDJPlc2WcsVar { + + Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), + Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), + Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), + Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), + Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), + Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), + Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), + Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), + Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), + Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), + Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), + Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; + + DDJPlc2WcsVar(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; + } + DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java new file mode 100644 index 0000000..b3ea34b --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java @@ -0,0 +1,101 @@ +package com.cnbm.dispatchDDJ.enums.ddj.ddj4; + +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 DDJWcs2PlcVar { + + Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), + Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), + Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), + From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), + From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), + From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), + To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), + To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), + To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), + Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), + Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), + Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), + Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), + Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), + //todo 条码值 要写长度 + Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; + + DDJWcs2PlcVar(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; + } + DDJWcs2PlcVar(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/dispatchDDJ/interfaces/Listener.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/Listener.java new file mode 100644 index 0000000..4cb298e --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/Listener.java @@ -0,0 +1,10 @@ +package com.cnbm.dispatchDDJ.interfaces; + +/** + * @Desc: "" + * @Author: caixiang + * @DATE: 2023-07-28 14:54 + */ +public interface Listener { + public void addRuntimeEQErrListener(RuntimeEQErrListener errCode); +} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java new file mode 100644 index 0000000..320cf62 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java @@ -0,0 +1,31 @@ +package com.cnbm.dispatchDDJ.interfaces; + + + + + +import java.util.EventListener; + +/** + * SecsMessage receive Listener. + * + *

+ * This interface is used in {@link #()}
+ * Receive-Message is only Primary-Message.
+ *

+ * + * @author kenta-shimizu + */ +public interface RuntimeEQErrListener extends EventListener { + + /** + * Putter Received Primary-Message. + * + *

+ * Not accept {@code null}.
+ *

+ * + * @param only Primary-Message + */ + public void received(Integer errCode); +} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java new file mode 100644 index 0000000..d7ebeff --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java @@ -0,0 +1,25 @@ +package com.cnbm.dispatchDDJ.main; + +import com.cnbm.dispatchDDJ.DDJ1Task; +import com.cnbm.dispatchDDJ.entity.TaskDTO; +import com.cnbm.s7.s7connector.enmuc.S7Client; +import io.lettuce.core.ScriptOutputType; + +import java.util.concurrent.ExecutionException; + +/** + * @Desc: "" + * @Author: caixiang + * @DATE: 2023-07-28 15:08 + */ +public class main { + public static void main(String[] args) throws ExecutionException, InterruptedException { + DDJ1Task ddj1Task = new DDJ1Task(); + ddj1Task.addRuntimeEQErrListener(errCode -> { + //当设备运行过程中出现告警了,会调用这个函数(可能会重复调用) + //调度程序不会因为 出现告警 就终止此次任务,会等待人工解决告警,然后设备返回给我successCode + System.out.println("errCode : "+errCode); + }); + ddj1Task.run(); + } +} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java new file mode 100644 index 0000000..bea8955 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java @@ -0,0 +1,42 @@ +package com.cnbm.dispatchDDJ.taskPool; + +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @Author: 蔡翔 + * @Date: 2019/9/23 9:32 + * @Version 1.0 + */ +public class QGSThreadPool { + public static AtomicInteger threadCount = new AtomicInteger(); + public static ThreadPoolExecutor executor = new ThreadPoolExecutor( + 200, //核心线程数 + 400, //最大线程数。 + 1L, // 空闲线程存活时间 (这里是一分钟) + TimeUnit.MINUTES, // 空闲线程存货的时间单位 + new ArrayBlockingQueue<>(200), //一个指定上限的的阻塞队列,这个队列中存放着待执行的任务 + new ThreadFactory() { + // 自定义一个线程工厂来给线程池里面的线程取名字 + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "threadPool-opc-" + threadCount.incrementAndGet()); + } + }, + new RejectedExecutionHandler() { + // 自定义一个拒绝处理策略,安慰被线程池拒之门外的任务 + @Override + public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { + System.out.println("opc read err:"+r); + } + } + ); + public static ExecutorService ddj1ExecutorService = Executors.newSingleThreadExecutor(); + public static ExecutorService ddj2ExecutorService = Executors.newSingleThreadExecutor(); + public static ExecutorService ddj3ExecutorService = Executors.newSingleThreadExecutor(); + public static ExecutorService ddj4ExecutorService = Executors.newSingleThreadExecutor(); + + /*public ExecutorService getExecutor(){ + return this.executor; + }*/ +} diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java index b09fea2..24cab80 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java @@ -2,7 +2,6 @@ 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; import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar; @@ -11,16 +10,13 @@ import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar; import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar; import com.cnbm.packing.dto.CamlineSubIdDTO; import com.cnbm.packing.dto.CamlineSubIdForImportDTO; -import com.cnbm.packing.dto.PowerReportDTO; import com.cnbm.packing.dto.WoCompensationPowerDTO; 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; @@ -130,7 +126,7 @@ public class TestController { } @PostMapping("/forString") public R forString() throws UnsupportedEncodingException, ParseException { - String[] s = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList); + String[] s = (String[])read(S7Client.S7_DDJ1,Step2Plc2MesVar.SubIdList); System.out.println(Step2Plc2MesVar.SubIdList.getName()+" : "+Arrays.toString(s)); return R.ok(); } @@ -241,30 +237,30 @@ public class TestController { @PostMapping("/testReadAll") public R testReadAll() throws UnsupportedEncodingException, ParseException { for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){ - logger.info(read(S7Client.S7_KUKA,actual).toString()); - System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); + logger.info(read(S7Client.S7_DDJ1,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ1,actual).toString()); } for(Step1Mes2PlcVar actual:Step1Mes2PlcVar.values()){ - logger.info(read(S7Client.S7_KUKA,actual).toString()); - System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); + logger.info(read(S7Client.S7_DDJ1,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ1,actual).toString()); } for(Step2Plc2MesVar actual:Step2Plc2MesVar.values()){ - logger.info(read(S7Client.S7_KUKA,actual).toString()); - System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); + logger.info(read(S7Client.S7_DDJ1,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ1,actual).toString()); } for(Step2Mes2PlcVar actual:Step2Mes2PlcVar.values()){ - logger.info(read(S7Client.S7_KUKA,actual).toString()); - System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); + logger.info(read(S7Client.S7_DDJ1,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ1,actual).toString()); } for(Step3Plc2MesVar actual:Step3Plc2MesVar.values()){ - logger.info(read(S7Client.S7_KUKA,actual).toString()); - System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); + logger.info(read(S7Client.S7_DDJ1,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ1,actual).toString()); } for(Step3Mes2PlcVar actual:Step3Mes2PlcVar.values()){ - logger.info(read(S7Client.S7_KUKA,actual).toString()); - System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_KUKA,actual).toString()); + logger.info(read(S7Client.S7_DDJ1,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ1,actual).toString()); } return R.ok(); } @@ -280,32 +276,32 @@ public class TestController { BigDecimal isc = new BigDecimal(3.799); BigDecimal vmpp = new BigDecimal(46.799); BigDecimal impp = new BigDecimal(3.0799); - write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Pnom,new Integer(1)); + write(S7Client.S7_DDJ1,Step1Mes2PlcVar.dLable_Pnom,new Integer(1)); System.out.println(Step1Mes2PlcVar.dLable_Pnom.getName()+" : "+1); - write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Voc,voc); + write(S7Client.S7_DDJ1,Step1Mes2PlcVar.dLable_Voc,voc); System.out.println(Step1Mes2PlcVar.dLable_Voc.getName()+" : "+voc.toPlainString()); - write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Isc,isc); + write(S7Client.S7_DDJ1,Step1Mes2PlcVar.dLable_Isc,isc); System.out.println(Step1Mes2PlcVar.dLable_Isc.getName()+" : "+isc.toPlainString()); - write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Vmpp,vmpp); + write(S7Client.S7_DDJ1,Step1Mes2PlcVar.dLable_Vmpp,vmpp); System.out.println(Step1Mes2PlcVar.dLable_Vmpp.getName()+" : "+vmpp.toPlainString()); - write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,impp); + write(S7Client.S7_DDJ1,Step1Mes2PlcVar.dLable_Impp,impp); System.out.println(Step1Mes2PlcVar.dLable_Impp.getName()+" : "+impp.toPlainString()); - write(S7Client.S7_KUKA,Step2Mes2PlcVar.BoxId,"12345678901111111111"); + write(S7Client.S7_DDJ1,Step2Mes2PlcVar.BoxId,"12345678901111111111"); System.out.println(Step2Mes2PlcVar.BoxId.getName()+" : "+"12345678901111111111"); - write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,true); + write(S7Client.S7_DDJ1,Step1Mes2PlcVar.SubArrivedFinish,true); System.out.println(Step1Mes2PlcVar.SubArrivedFinish.getName()+" : "+"true"); - write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false); + write(S7Client.S7_DDJ1,Step2Mes2PlcVar.ShelfIsFullFinish,false); System.out.println(Step2Mes2PlcVar.ShelfIsFullFinish.getName()+" : "+"false"); - write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true); + write(S7Client.S7_DDJ1,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true); System.out.println(Step3Mes2PlcVar.ShelfIsFullArrivedFinish.getName()+" : "+"true"); diff --git a/ym-s7/pom.xml b/ym-s7/pom.xml index 6145cba..dd7cc87 100644 --- a/ym-s7/pom.xml +++ b/ym-s7/pom.xml @@ -36,5 +36,6 @@ + \ No newline at end of file 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 468a855..9406f4d 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,7 +27,10 @@ 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("10.10.3.158",0,1,2), + S7_DDJ1("10.10.3.158",0,1,2), + S7_DDJ2("10.10.3.158",0,1,2), + S7_DDJ3("10.10.3.158",0,1,2), + S7_DDJ4("10.10.3.158",0,1,2), //1500 机架-0 插槽-1 //后续 在这里扩展 多PLC应用。 ; diff --git a/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7ParamErrorCode.java b/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7ParamErrorCode.java index 5271f2c..240a70d 100644 --- a/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7ParamErrorCode.java +++ b/ym-s7/src/main/java/com/cnbm/s7/s7connector/enmuc/S7ParamErrorCode.java @@ -27,6 +27,7 @@ import java.util.Map; */ public enum S7ParamErrorCode { + ERROR_0x0000((short) 0x0000, "No error"), ERROR_0x0110((short) 0x0110, "Invalid block number"), ERROR_0x0111((short) 0x0111, "Invalid request length"), diff --git a/ym-s7/src/main/java/com/cnbm/s7/s7connector/exception/S7CheckResultException.java b/ym-s7/src/main/java/com/cnbm/s7/s7connector/exception/S7CheckResultException.java index e7ca0de..1c79fc1 100644 --- a/ym-s7/src/main/java/com/cnbm/s7/s7connector/exception/S7CheckResultException.java +++ b/ym-s7/src/main/java/com/cnbm/s7/s7connector/exception/S7CheckResultException.java @@ -15,6 +15,8 @@ limitations under the License. */ package com.cnbm.s7.s7connector.exception; +import io.swagger.models.auth.In; + /** * The Class S7Exception is an exception related to S7 Communication */ @@ -23,6 +25,17 @@ public final class S7CheckResultException extends RuntimeException { /** The Constant serialVersionUID. */ private static final long serialVersionUID = -4761415733559374116L; + public static void main(String[] args) { + + try { + String str = null; + + str.substring(0,17); + }catch (Throwable e){ + e.printStackTrace(); + System.out.println("标签打印Event--- 出现异常 :"+e.toString()); + } + } /** * Instantiates a new s7 exception. */ From 4e10024bc80be275ec53a07b044fd9f5ab0e247c Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Tue, 24 Oct 2023 14:35:28 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E1=E7=BA=BF=EF=BC=8C?= =?UTF-8?q?=E6=98=AF=E4=BB=8E2=E7=BA=BF=E5=B9=B3=E7=A7=BB=E8=BF=87?= =?UTF-8?q?=E5=8E=BB=E7=9A=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +- ym-gateway/src/main/resources/logback.xml | 119 +++- .../com/cnbm/dispatch/KukaJoinThread.java | 601 ------------------ .../KukaEvent1ThreadLine1.java} | 16 +- .../dispatch/line1/KukaEvent2ThreadLine1.java | 423 ++++++++++++ .../KukaEvent3ThreadLine1.java} | 20 +- .../dispatch/line2/KukaEvent1ThreadLine2.java | 418 ++++++++++++ .../KukaEvent2ThreadLine2.java} | 15 +- .../dispatch/line2/KukaEvent3ThreadLine2.java | 354 +++++++++++ .../java/com/cnbm/dispatchDDJ/DDJ1Task.java | 294 --------- .../dispatchDDJ/constant/QGSConstant.java | 16 - .../dispatchDDJ/entity/DDJInfoCallBack.java | 24 - .../com/cnbm/dispatchDDJ/entity/TaskDTO.java | 39 -- .../com/cnbm/dispatchDDJ/enums/CodeEnum.java | 15 - .../enums/ddj/ddj1/DDJPlc2WcsVar.java | 110 ---- .../enums/ddj/ddj1/DDJWcs2PlcVar.java | 101 --- .../enums/ddj/ddj2/DDJPlc2WcsVar.java | 110 ---- .../enums/ddj/ddj2/DDJWcs2PlcVar.java | 101 --- .../enums/ddj/ddj3/DDJPlc2WcsVar.java | 110 ---- .../enums/ddj/ddj3/DDJWcs2PlcVar.java | 101 --- .../enums/ddj/ddj4/DDJPlc2WcsVar.java | 110 ---- .../enums/ddj/ddj4/DDJWcs2PlcVar.java | 101 --- .../cnbm/dispatchDDJ/interfaces/Listener.java | 10 - .../interfaces/RuntimeEQErrListener.java | 31 - .../java/com/cnbm/dispatchDDJ/main/main.java | 25 - .../dispatchDDJ/taskPool/QGSThreadPool.java | 42 -- .../controller/WoPowerLevelController.java | 2 - .../cnbm/s7/s7connector/enmuc/S7Client.java | 7 +- 28 files changed, 1329 insertions(+), 1991 deletions(-) delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java rename ym-packing/src/main/java/com/cnbm/dispatch/{KukaEvent1Thread.java => line1/KukaEvent1ThreadLine1.java} (98%) create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent2ThreadLine1.java rename ym-packing/src/main/java/com/cnbm/dispatch/{KukaEvent3Thread.java => line1/KukaEvent3ThreadLine1.java} (96%) create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent1ThreadLine2.java rename ym-packing/src/main/java/com/cnbm/dispatch/{KukaEvent2Thread.java => line2/KukaEvent2ThreadLine2.java} (98%) create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent3ThreadLine2.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/DDJ1Task.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/Listener.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java delete mode 100644 ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java diff --git a/pom.xml b/pom.xml index ff07845..66fe715 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,10 @@ 4.13.2 4.2.2 1.2.9 - 3.5.1 + + + 3.5.3 + 4.0 11.2.0.3 3.12.0 diff --git a/ym-gateway/src/main/resources/logback.xml b/ym-gateway/src/main/resources/logback.xml index 5d3e3f5..d10c69c 100644 --- a/ym-gateway/src/main/resources/logback.xml +++ b/ym-gateway/src/main/resources/logback.xml @@ -194,9 +194,10 @@ DENY
- + + - ${logging.eventlog}/event1/kuka-event1-log-info.log + ${logging.eventlog}/line2/event1/kuka-event1-log-info.log %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n @@ -204,7 +205,7 @@ - ${logging.eventlog}/kuka-event1-log-info-%d{yyyy-MM-dd}.%i.log + ${logging.eventlog}/line2/kuka-event1-log-info-%d{yyyy-MM-dd}.%i.log 100MB @@ -218,9 +219,9 @@ DENY - + - ${logging.eventlog}/event2/kuka-event2-log-info.log + ${logging.eventlog}/line2/event2/kuka-event2-log-info.log %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n @@ -228,7 +229,7 @@ - ${logging.eventlog}/kuka-event2-log-info-%d{yyyy-MM-dd}.%i.log + ${logging.eventlog}/line2/kuka-event2-log-info-%d{yyyy-MM-dd}.%i.log 100MB @@ -242,9 +243,9 @@ DENY - + - ${logging.eventlog}/event3/kuka-event3-log-info.log + ${logging.eventlog}/line2/event3/kuka-event3-log-info.log %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n @@ -252,7 +253,7 @@ - ${logging.eventlog}/kuka-event3-log-info-%d{yyyy-MM-dd}.%i.log + ${logging.eventlog}/line2/kuka-event3-log-info-%d{yyyy-MM-dd}.%i.log 100MB @@ -266,9 +267,82 @@ DENY + + + + + ${logging.eventlog}/line1/event1/kuka-event1-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/line1/kuka-event1-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + 999 + 200GB + + + + info + ACCEPT + DENY + + + + + ${logging.eventlog}/line1/event2/kuka-event2-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/line1/kuka-event2-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + 999 + 200GB + + + + info + ACCEPT + DENY + + + + + ${logging.eventlog}/line1/event3/kuka-event3-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/line1/kuka-event3-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + 999 + 200GB + + + + info + ACCEPT + DENY + + + @@ -481,15 +555,30 @@ - - + + + - - + + - - + + + + + + + + + + + + + + + + diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java b/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java deleted file mode 100644 index 4eb4f59..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatch/KukaJoinThread.java +++ /dev/null @@ -1,601 +0,0 @@ -//package com.cnbm.dispatch; -// -//import cn.hutool.core.date.DateUtil; -//import com.cnbm.dispatch.enums.kuka.step1.Step1Mes2PlcVar; -//import com.cnbm.dispatch.enums.kuka.step1.Step1Plc2MesVar; -//import com.cnbm.dispatch.enums.kuka.step2.Step2Mes2PlcVar; -//import com.cnbm.dispatch.enums.kuka.step2.Step2Plc2MesVar; -//import com.cnbm.dispatch.enums.kuka.step3.Step3Mes2PlcVar; -//import com.cnbm.dispatch.enums.kuka.step3.Step3Plc2MesVar; -//import com.cnbm.packing.dto.CamlineExtendArgDTO; -//import com.cnbm.packing.dto.CamlineSubIdDTO; -//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.text.DecimalFormat; -//import java.text.Format; -//import java.time.LocalDateTime; -//import java.util.Arrays; -//import java.util.Date; -//import java.util.concurrent.Executors; -//import java.util.concurrent.ScheduledExecutorService; -//import java.util.concurrent.TimeUnit; -// -///** -// * @Desc: "test 待测试" -// * @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); -// private static final Logger loggerEvent1 = LoggerFactory.getLogger("EVENT1"); -// private static final Logger loggerEvent2 = LoggerFactory.getLogger("EVENT2"); -// private static final Logger loggerEvent3 = LoggerFactory.getLogger("EVENT3"); -// -// @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 (Throwable e){ -// logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); -// 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 (Throwable e){ -// logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); -// 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 (Throwable e){ -// logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); -// 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()+1; -// String nowTime = DateUtil.format(new Date(), "yyMMdd"); -// -// todayBoxNum+=500; -// logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); -// 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 = "444"+sapMaterial+nowTime+mixBoxError; -// logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); -// -// return res; -// } -// -// public String removeKG(String str){ -// return str.substring(0,17); -// } -// -// public static void main(String[] args) { -// Integer a = 102; -// Format f1 = new DecimalFormat("000"); -// System.out.println(f1.format(a)); -// } -// public String formateString(Integer a){ -// Format f1 = new DecimalFormat("000"); -// return f1.format(a); -// } -// -// //return true 出现混档了,return false 没有出现混档 -// private boolean isMixLevel(String[] subIds,Integer size){ -// String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); -// String errMsg = "以下基板ID出现混档:"; -// boolean res = false; -// for(int i=0;i 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i linkTestRecvListeners = new CopyOnWriteArrayList<>(); - - @Override - public void addRuntimeEQErrListener(RuntimeEQErrListener lstnr) { - linkTestRecvListeners.add(lstnr); - } - - - public void executeLinktestRecvTask(Integer errCode) { - for (RuntimeEQErrListener listener : linkTestRecvListeners) { - listener.received(errCode); - } - } - - -// public void run() { -// CompletableFuture.supplyAsync(() -> { -// System.out.println(""); -// System.out.println("开始执行 ddj1 调度任务 开始 "+ Thread.currentThread().hashCode()); -// executeLinktestRecvTask(1); -// -// System.out.println("开始执行 ddj1 调度任务 结束"+ Thread.currentThread().hashCode()); -// return 1; -// }, QGSThreadPool.ddj1ExecutorService).whenComplete((data, error) -> { -// System.out.println("data:" + data+ Thread.currentThread().hashCode()); -// if (error != null) { -// System.out.println(error); -// } -// }); -// } - - - /* * - * - * status - * 10 初始值 - * -2 s7 数据采集失败 - * 100 任务成功完成 - * 101 任务被人为取消,取消的原因看 content - * */ - public void run(){ - CompletableFuture.supplyAsync(() -> { - logger.info(""); - logger.info("================= 现在开始执行 DDJ1 任务 : "+ taskDTO.toString()+" =================="); - - //构建结果类 - DDJInfoCallBack build = new DDJInfoCallBack(); - build.setStatus(10); - - build.setTaskId(taskDTO.getMissionID()); - //调度逻辑 ------------------------------------- 开始 ------------------------------------- - //todo 这里待定,当出现脱机或者 故障的时候 怎么的一个形式告知 wms - //步骤1 WCS监听 PlcToWcs.Operate_Mode 是否为 1 , ( 1 = 联机 ) - Integer operateMode = waitingForTarget(DDJPlc2WcsVar.Operate_Mode, 1); - if(operateMode!=1){ - logger.info("失败"+" --- "+"步骤1. WCS监听 DDJPlc2WcsVar.Operate_Mode 是否 等于 1 失败"); - build.setContent("失败,步骤1,监听数据异常"); - build.setStatus(-2); - return build; - } - logger.info("成功"+" --- "+"步骤1. WCS监听 DDJPlc2WcsVar.Operate_Mode 等于 1 "); - - - //步骤2 WCS监听 PlcToWcs.Mission_State 是否为 0 , ( 0 = 空闲 ) - Integer missionState = waitingForTarget(DDJPlc2WcsVar.Mission_State, 0); - if(missionState!=1){ - logger.info("失败"+" --- "+"步骤2. WCS监听 PlcToWcs.Mission_State 是否 等于 0 失败"); - build.setContent("失败,步骤2,监听数据异常"); - build.setStatus(-2); - return build; - } - logger.info("成功"+" --- "+"步骤2. WCS监听 PlcToWcs.Mission_State 等于 0 "); - - //步骤3 WCS下发任务 - issueTask(); - logger.info("成功"+" --- "+"步骤3. WCS 下发任务 "); - - - //步骤4 WCS启动任务(WcsToPlc.Command_No 置为 1 ) - write(s7Client,DDJWcs2PlcVar.Command_No,1); - logger.info("成功"+" --- "+"步骤4. WCS启动任务(WcsToPlc.Command_No 置为 1 )成功 "); - - - //步骤5 WCS 监控PlcToWcs.Mission_State ==2 监控任务是否完成 - Integer missionState2 = waitingForTargetAndLoggerError(DDJPlc2WcsVar.Mission_State,DDJPlc2WcsVar.Operate_Mode, 2); - if(missionState2!=1){ - logger.info("失败"+" --- "+"步骤5. WCS 监控PlcToWcs.Mission_State ==2 监控任务是否完成"); - build.setContent("失败,步骤5,监听数据异常"); - build.setStatus(-2); - return build; - } - logger.info("成功"+" --- "+"步骤5. WCS 监控PlcToWcs.Mission_State ==2 "); - - //步骤6 WCS 把 Command_No 置为 2(重置操作) - write(s7Client,DDJWcs2PlcVar.Command_No,2); - logger.info("成功"+" --- "+"步骤6. WCS 把 Command_No 置为 2(重置操作) "); - build.setStatus(100); - build.setContent("任务成功完成"); - //调度逻辑 ------------------------------------- 结束 - - - return build; - }, QGSThreadPool.ddj1ExecutorService).whenComplete(new BiConsumer() { - //任务完成以后把结果返回给 第调用者 - @Override - public void accept(DDJInfoCallBack agvInfoCallBack, Throwable throwable) { - if(throwable!=null){ - logger.info("whenComplete throwable is " + throwable.getMessage()); - }else { - logger.info("任务执行完成,现在wcs把 结果:"+agvInfoCallBack.toString()+", 推送给wms"); - HttpUtil.post(QGSConstant.wmsUrl, JSONObject.toJSONString(agvInfoCallBack)); - logger.info("================= 任务结束 : "+ taskDTO.toString()+" =================="); - logger.info(""); - - } - } - }); - - } - - - - - /** - * desc: 下发任务给电控 - * return: - * true 成功 - * false 失败 - * */ - private void issueTask() { - write(s7Client,DDJWcs2PlcVar.Mission_Type, taskDTO.getMissionType()); - - write(s7Client,DDJWcs2PlcVar.From_Row, taskDTO.getFromRow()); - write(s7Client,DDJWcs2PlcVar.From_Layer, taskDTO.getFromLayer()); - write(s7Client,DDJWcs2PlcVar.From_List, taskDTO.getFromList()); - write(s7Client,DDJWcs2PlcVar.To_Row, taskDTO.getToRow()); - write(s7Client,DDJWcs2PlcVar.To_List, taskDTO.getToList()); - write(s7Client,DDJWcs2PlcVar.To_Layer, taskDTO.getToLayer()); - - write(s7Client,DDJWcs2PlcVar.Goods_Size, taskDTO.getGoodsSiZe()); - write(s7Client,DDJWcs2PlcVar.Coordinate_conversion, taskDTO.getCoordinateConversion()); - write(s7Client,DDJWcs2PlcVar.Mission_ID, taskDTO.getMissionID()); - write(s7Client,DDJWcs2PlcVar.Pallet_Num, taskDTO.getPalletNum()); - } - - /** - * - * arg: - * RGV1Plc2WcsVarEnum 参数类型 - * targetValue 目的值 - * return: - * 2 opc 访问异常; - * 1 成功; - * */ - private Integer waitingForTarget(DDJPlc2WcsVar var, Integer targetValue) { - Integer res = 0; - while (true){ - try { - Integer now = (Integer) read(s7Client,var); - if(targetValue.equals(now)){ - res = 1; - break; - } - Thread.sleep(200); - }catch (Exception e){ - logger.info("S7 数据采集 异常。"); - res = 2; - break; - } - } - return res; - } - - private Integer waitingForTargetAndOperaMode(DDJPlc2WcsVar var, Integer targetValue) { - Integer res = 0; - while (true){ - try { - Integer now = (Integer) read(s7Client,var); - if(targetValue.equals(now)){ - res = 1; - break; - } - Thread.sleep(200); - }catch (Exception e){ - logger.info("S7 数据采集 异常。"); - res = 2; - break; - } - } - return res; - } - - private Integer waitingForTargetAndLoggerError(DDJPlc2WcsVar var,DDJPlc2WcsVar var2, Integer targetValue) { - Integer res = 0; - while (true){ - try { - Integer now = (Integer) read(s7Client,var); - Integer operateMode = (Integer) read(s7Client,var2); - if(targetValue.equals(now)){ - res = 1; - break; - } - if(operateMode.equals(2)){ - Integer faultNo = (Integer) read(s7Client,DDJPlc2WcsVar.Fault_No); - logger.info("步骤5 DDJ在运行的时候出现 fault, fault no = "+faultNo); - //调用上层的 回调方法 开始 - executeLinktestRecvTask(faultNo); - //调用上层的 回调方法 结束 - Thread.sleep(10000); - } - Thread.sleep(200); - }catch (Exception e){ - logger.info("S7 数据采集 异常。"); - res = 2; - break; - } - } - return res; - } - - - /** - * return - * 成功: 返回相应的object对象 - * 失败: 返回null - * */ - private Object read(S7Client s7Client, DDJPlc2WcsVar 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, DDJWcs2PlcVar 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); - } - } - - -} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java deleted file mode 100644 index 3ad7b13..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/constant/QGSConstant.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.cnbm.dispatchDDJ.constant; - -/** - * @Author: 蔡翔 - * @Date: 2019/11/3 11:30 - * @Version 1.0 - */ -public class QGSConstant { - public static final Object LOCK = new Object(); - - public static final Long deadLineTime = 300000L; - - //wms 需提供 post 接口 - public static final String wmsUrl = "http://localhost:8089/wms-qy/work/wcs2wms/taskcallback"; -} - diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java deleted file mode 100644 index dd8329a..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/DDJInfoCallBack.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.cnbm.dispatchDDJ.entity; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - *

- * 表 - *

- * - * @author caixiang - * @since 2022-05-31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -public class DDJInfoCallBack implements Serializable { - - private static final long serialVersionUID = 1L; - private Integer status; - private String content; - private Integer taskId; -} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java deleted file mode 100644 index 2188fba..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/entity/TaskDTO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.cnbm.dispatchDDJ.entity; - -import lombok.Data; - -/** - * @Desc: "" - * @Author: caixiang - * @DATE: 2021/11/9 20:50 - */ -@Data -public class TaskDTO { - //任务类型 - private Integer missionType; - - //起点-排 - private Integer fromRow; - //起点-列 - private Integer fromList; - //起点-层 - private Integer fromLayer; - - //终点-排 - private Integer toRow; - //终点-列 - private Integer toList; - //终点-层 - private Integer toLayer; - - //货物尺寸 - private Integer goodsSiZe; - //坐标转换 - private Integer coordinateConversion; - - //任务号 - private Integer missionID; - - //条码值 - private Integer palletNum; -} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java deleted file mode 100644 index d0c4dee..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/CodeEnum.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.cnbm.dispatchDDJ.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/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java deleted file mode 100644 index 307f9a3..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJPlc2WcsVar.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj1; - -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 DDJPlc2WcsVar { - - Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), - Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), - Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), - Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), - Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), - Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), - Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), - Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), - Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), - Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), - Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), - Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; - - DDJPlc2WcsVar(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; - } - DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java deleted file mode 100644 index 2d90354..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj1/DDJWcs2PlcVar.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj1; - -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 DDJWcs2PlcVar { - - Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), - Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), - Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), - Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), - Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), - Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), - Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), - //todo 条码值 要写长度 - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; - - DDJWcs2PlcVar(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; - } - DDJWcs2PlcVar(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/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java deleted file mode 100644 index 04ed891..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJPlc2WcsVar.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj2; - -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 DDJPlc2WcsVar { - - Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), - Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), - Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), - Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), - Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), - Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), - Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), - Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), - Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), - Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), - Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), - Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; - - DDJPlc2WcsVar(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; - } - DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java deleted file mode 100644 index ea833d4..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj2/DDJWcs2PlcVar.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj2; - -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 DDJWcs2PlcVar { - - Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), - Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), - Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), - Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), - Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), - Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), - Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), - //todo 条码值 要写长度 - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; - - DDJWcs2PlcVar(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; - } - DDJWcs2PlcVar(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/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java deleted file mode 100644 index 5562ac7..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJPlc2WcsVar.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj3; - -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 DDJPlc2WcsVar { - - Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), - Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), - Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), - Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), - Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), - Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), - Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), - Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), - Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), - Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), - Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), - Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; - - DDJPlc2WcsVar(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; - } - DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java deleted file mode 100644 index fbd5b9c..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj3/DDJWcs2PlcVar.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj3; - -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 DDJWcs2PlcVar { - - Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), - Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), - Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), - Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), - Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), - Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), - Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), - //todo 条码值 要写长度 - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; - - DDJWcs2PlcVar(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; - } - DDJWcs2PlcVar(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/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java deleted file mode 100644 index 25a992c..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJPlc2WcsVar.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj4; - -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 DDJPlc2WcsVar { - - Operate_Mode("Operate_Mode", PlcVar.INT,1, DaveArea.DB,2,0,0), - Mission_State("Mission_State",PlcVar.INT,1,DaveArea.DB,2,2,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,2,4,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,2,6,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,2,8,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,2,10,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,2,12,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,2,14,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,2,16,0), - Act_Pos_X("Act_Pos_X", PlcVar.DINT,1, DaveArea.DB,2,18,0), - Act_Pos_Y("Act_Pos_Y", PlcVar.DINT,1, DaveArea.DB,2,22,0), - Act_Speed_X("Act_Speed_X", PlcVar.DINT,1, DaveArea.DB,2,26,0), - Act_Speed_Y("Act_Speed_Y", PlcVar.DINT,1, DaveArea.DB,2,30,0), - Status_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,2,34,0), - Status_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,2,35,0), - Fault_No("Fault_No", PlcVar.INT,1, DaveArea.DB,2,36,0), - Now_List("Now_List", PlcVar.INT,1, DaveArea.DB,2,38,0), - Now_Layer("Now_Layer", PlcVar.INT,1, DaveArea.DB,2,40,0), - Mission_ID("Act_Pos_X", PlcVar.INT,1, DaveArea.DB,2,42,0), - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,2,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; - - DDJPlc2WcsVar(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; - } - DDJPlc2WcsVar(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/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java deleted file mode 100644 index b3ea34b..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/enums/ddj/ddj4/DDJWcs2PlcVar.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.cnbm.dispatchDDJ.enums.ddj.ddj4; - -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 DDJWcs2PlcVar { - - Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0), - Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0), - Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0), - From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0), - From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0), - From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0), - To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0), - To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0), - To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0), - Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0), - Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0), - Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0), - Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0), - Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0), - //todo 条码值 要写长度 - Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,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; - - DDJWcs2PlcVar(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; - } - DDJWcs2PlcVar(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/dispatchDDJ/interfaces/Listener.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/Listener.java deleted file mode 100644 index 4cb298e..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/Listener.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.cnbm.dispatchDDJ.interfaces; - -/** - * @Desc: "" - * @Author: caixiang - * @DATE: 2023-07-28 14:54 - */ -public interface Listener { - public void addRuntimeEQErrListener(RuntimeEQErrListener errCode); -} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java deleted file mode 100644 index 320cf62..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/interfaces/RuntimeEQErrListener.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.cnbm.dispatchDDJ.interfaces; - - - - - -import java.util.EventListener; - -/** - * SecsMessage receive Listener. - * - *

- * This interface is used in {@link #()}
- * Receive-Message is only Primary-Message.
- *

- * - * @author kenta-shimizu - */ -public interface RuntimeEQErrListener extends EventListener { - - /** - * Putter Received Primary-Message. - * - *

- * Not accept {@code null}.
- *

- * - * @param only Primary-Message - */ - public void received(Integer errCode); -} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java deleted file mode 100644 index d7ebeff..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/main/main.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.cnbm.dispatchDDJ.main; - -import com.cnbm.dispatchDDJ.DDJ1Task; -import com.cnbm.dispatchDDJ.entity.TaskDTO; -import com.cnbm.s7.s7connector.enmuc.S7Client; -import io.lettuce.core.ScriptOutputType; - -import java.util.concurrent.ExecutionException; - -/** - * @Desc: "" - * @Author: caixiang - * @DATE: 2023-07-28 15:08 - */ -public class main { - public static void main(String[] args) throws ExecutionException, InterruptedException { - DDJ1Task ddj1Task = new DDJ1Task(); - ddj1Task.addRuntimeEQErrListener(errCode -> { - //当设备运行过程中出现告警了,会调用这个函数(可能会重复调用) - //调度程序不会因为 出现告警 就终止此次任务,会等待人工解决告警,然后设备返回给我successCode - System.out.println("errCode : "+errCode); - }); - ddj1Task.run(); - } -} diff --git a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java b/ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java deleted file mode 100644 index bea8955..0000000 --- a/ym-packing/src/main/java/com/cnbm/dispatchDDJ/taskPool/QGSThreadPool.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.cnbm.dispatchDDJ.taskPool; - -import java.util.concurrent.*; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * @Author: 蔡翔 - * @Date: 2019/9/23 9:32 - * @Version 1.0 - */ -public class QGSThreadPool { - public static AtomicInteger threadCount = new AtomicInteger(); - public static ThreadPoolExecutor executor = new ThreadPoolExecutor( - 200, //核心线程数 - 400, //最大线程数。 - 1L, // 空闲线程存活时间 (这里是一分钟) - TimeUnit.MINUTES, // 空闲线程存货的时间单位 - new ArrayBlockingQueue<>(200), //一个指定上限的的阻塞队列,这个队列中存放着待执行的任务 - new ThreadFactory() { - // 自定义一个线程工厂来给线程池里面的线程取名字 - @Override - public Thread newThread(Runnable r) { - return new Thread(r, "threadPool-opc-" + threadCount.incrementAndGet()); - } - }, - new RejectedExecutionHandler() { - // 自定义一个拒绝处理策略,安慰被线程池拒之门外的任务 - @Override - public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { - System.out.println("opc read err:"+r); - } - } - ); - public static ExecutorService ddj1ExecutorService = Executors.newSingleThreadExecutor(); - public static ExecutorService ddj2ExecutorService = Executors.newSingleThreadExecutor(); - public static ExecutorService ddj3ExecutorService = Executors.newSingleThreadExecutor(); - public static ExecutorService ddj4ExecutorService = Executors.newSingleThreadExecutor(); - - /*public ExecutorService getExecutor(){ - return this.executor; - }*/ -} diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPowerLevelController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPowerLevelController.java index bed78dd..cb66219 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/WoPowerLevelController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/WoPowerLevelController.java @@ -52,7 +52,6 @@ public class WoPowerLevelController { @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:page')") public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = woPowerLevelService.page(params); - return new Result>().ok(page); } @@ -61,7 +60,6 @@ public class WoPowerLevelController { @PreAuthorize("@ex.hasAuthority('packing:woPowerLevel:info')") public Result get(@PathVariable("id") Long id){ WoPowerLevelDTO data = woPowerLevelService.get(id); - return new Result().ok(data); } 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 9406f4d..e43cbf1 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,10 +27,13 @@ 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), + + //1线 S7_DDJ1("10.10.3.158",0,1,2), + + //2线 S7_DDJ2("10.10.3.158",0,1,2), - S7_DDJ3("10.10.3.158",0,1,2), - S7_DDJ4("10.10.3.158",0,1,2), + //1500 机架-0 插槽-1 //后续 在这里扩展 多PLC应用。 ; From 11b41b18f1608704bc9e92814178b326dad80d60 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Thu, 26 Oct 2023 09:11:22 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E1=E7=BA=BF=EF=BC=8C?= =?UTF-8?q?=E6=98=AF=E4=BB=8E2=E7=BA=BF=E5=B9=B3=E7=A7=BB=E8=BF=87?= =?UTF-8?q?=E5=8E=BB=E7=9A=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dispatch/line2/KukaEvent2ThreadLine2.java | 16 +++++----- .../dispatch/line2/KukaEvent3ThreadLine2.java | 14 ++++----- .../packing/controller/TestController.java | 31 +++++++++++++++++++ .../cnbm/s7/s7connector/enmuc/S7Client.java | 7 +++-- 4 files changed, 50 insertions(+), 18 deletions(-) diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent2ThreadLine2.java b/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent2ThreadLine2.java index 7070f45..7db852a 100644 --- a/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent2ThreadLine2.java +++ b/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent2ThreadLine2.java @@ -224,8 +224,8 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner { } //一. 从plc 中获取 subIdList 和 lineNum - String[] subIdList = (String[])read(S7Client.S7_DDJ1,Step2Plc2MesVar.SubIdList); - Integer listSize = (Integer)read(S7Client.S7_DDJ1,Step2Plc2MesVar.PackageNumberSet)-1; + String[] subIdList = (String[])read(S7Client.S7_DDJ2,Step2Plc2MesVar.SubIdList); + Integer listSize = (Integer)read(S7Client.S7_DDJ2,Step2Plc2MesVar.PackageNumberSet)-1; //二. MES 业务 @@ -301,11 +301,11 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner { //=============== MES 业务 结束 ================= //三. 把生成的BoxId 告诉kuka - write(S7Client.S7_DDJ1,Step2Mes2PlcVar.BoxId,boxId); + write(S7Client.S7_DDJ2,Step2Mes2PlcVar.BoxId,boxId); logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功"); //四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了 - write(S7Client.S7_DDJ1,Step2Mes2PlcVar.ShelfIsFullFinish,true); + write(S7Client.S7_DDJ2,Step2Mes2PlcVar.ShelfIsFullFinish,true); logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功"); //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false); @@ -314,7 +314,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner { }else if(subArrived2 == 2){ throw new Exception("MES 监听值出现异常。"); } - write(S7Client.S7_DDJ1,Step2Mes2PlcVar.ShelfIsFullFinish,false); + write(S7Client.S7_DDJ2,Step2Mes2PlcVar.ShelfIsFullFinish,false); logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束"); logger.info("================================== 现在开始执行 过程二 任务( 结束 ) ==================================="); logger.info(""); @@ -342,7 +342,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner { while (true){ try { - Boolean now = (Boolean) read(S7Client.S7_DDJ1,var); + Boolean now = (Boolean) read(S7Client.S7_DDJ2,var); //注意:即使now为null ,这里也不会抛出异常,这里很容易产生 空轮询。 if(now == null){ throw new Exception(""); @@ -373,7 +373,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner { Integer res = 0; while (true){ try { - Boolean now = (Boolean) read(S7Client.S7_DDJ1,var); + Boolean now = (Boolean) read(S7Client.S7_DDJ2,var); if(now == null){ throw new Exception(""); } @@ -403,7 +403,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner { Integer res = 0; while (true){ try { - Boolean now = (Boolean) read(S7Client.S7_DDJ1,var); + Boolean now = (Boolean) read(S7Client.S7_DDJ2,var); if(now == null){ throw new Exception(""); } diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent3ThreadLine2.java b/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent3ThreadLine2.java index 3f8f5a3..049f413 100644 --- a/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent3ThreadLine2.java +++ b/ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent3ThreadLine2.java @@ -216,8 +216,8 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner { } //一. 从plc 中获取 subIdList 和 lineNum - String boxId = (String)read(S7Client.S7_DDJ1,Step3Plc2MesVar.BoxId); - Integer lineNum = (Integer) read(S7Client.S7_DDJ1,Step3Plc2MesVar.LineNum); + String boxId = (String)read(S7Client.S7_DDJ2,Step3Plc2MesVar.BoxId); + Integer lineNum = (Integer) read(S7Client.S7_DDJ2,Step3Plc2MesVar.LineNum); if(boxId == null){ logger.info("装箱单打印Event-------失败"+" --- "+"从plc里面获取到的boxId 为null"); throw new Exception("装箱单打印Event-------boxId 为null"); @@ -233,7 +233,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner { //四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了 - write(S7Client.S7_DDJ1,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true); + write(S7Client.S7_DDJ2,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true); logger.info("装箱单打印Event------boxId :"+boxId+", ShelfIsFullArrivedFinish置为true 成功"); //四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false); @@ -243,7 +243,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner { throw new Exception("MES 监听值出现异常。"); } logger.info("装箱单打印Event------boxId :"+boxId+", 监听到subArrived=false 成功"); - write(S7Client.S7_DDJ1,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false); + write(S7Client.S7_DDJ2,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false); logger.info("装箱单打印Event------boxId :"+boxId+", Even3 成功"); logger.info("================================== 现在开始执行 过程三 任务( 结束 ) ==================================="); @@ -273,7 +273,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner { while (true){ try { - Boolean now = (Boolean) read(S7Client.S7_DDJ1,var); + Boolean now = (Boolean) read(S7Client.S7_DDJ2,var); //注意:即使now为null ,这里也不会抛出异常,这里很容易产生 空轮询。 if(now == null){ throw new Exception(""); @@ -304,7 +304,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner { Integer res = 0; while (true){ try { - Boolean now = (Boolean) read(S7Client.S7_DDJ1,var); + Boolean now = (Boolean) read(S7Client.S7_DDJ2,var); if(now == null){ throw new Exception(""); } @@ -334,7 +334,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner { Integer res = 0; while (true){ try { - Boolean now = (Boolean) read(S7Client.S7_DDJ1,var); + Boolean now = (Boolean) read(S7Client.S7_DDJ2,var); if(now == null){ throw new Exception(""); } diff --git a/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java index 24cab80..835a033 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java +++ b/ym-packing/src/main/java/com/cnbm/packing/controller/TestController.java @@ -265,6 +265,37 @@ public class TestController { return R.ok(); } + @PostMapping("/testReadAll2") + public R testReadAll2() throws UnsupportedEncodingException, ParseException { + for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){ + logger.info(read(S7Client.S7_DDJ2,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString()); + } + for(Step1Mes2PlcVar actual:Step1Mes2PlcVar.values()){ + logger.info(read(S7Client.S7_DDJ2,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString()); + } + + for(Step2Plc2MesVar actual:Step2Plc2MesVar.values()){ + logger.info(read(S7Client.S7_DDJ2,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString()); + } + for(Step2Mes2PlcVar actual:Step2Mes2PlcVar.values()){ + logger.info(read(S7Client.S7_DDJ2,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString()); + } + + for(Step3Plc2MesVar actual:Step3Plc2MesVar.values()){ + logger.info(read(S7Client.S7_DDJ2,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString()); + } + for(Step3Mes2PlcVar actual:Step3Mes2PlcVar.values()){ + logger.info(read(S7Client.S7_DDJ2,actual).toString()); + System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString()); + } + return R.ok(); + } + public static void main(String[] args) { BigDecimal voc = new BigDecimal(59.799); System.out.println(Float.valueOf(voc.toString())); 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 e43cbf1..f669d14 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 @@ -29,12 +29,13 @@ public enum S7Client { // S7_1500("192.168.0.51",0,1,1), //1线 - S7_DDJ1("10.10.3.158",0,1,2), - + //S7_DDJ1("10.10.3.152",0,1,2), + S7_DDJ1("10.10.3.152",0,1,2), //2线 S7_DDJ2("10.10.3.158",0,1,2), - //1500 机架-0 插槽-1 + +//1500 机架-0 插槽-1 //后续 在这里扩展 多PLC应用。 ; private String host; From df116253ffcda72367bf7927fc99782fbba62ff1 Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Wed, 20 Dec 2023 14:49:42 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ym-gateway/src/main/resources/logback.xml | 60 ++++ .../enums/kuka/step1/Step1Plc2MesVar.java | 1 - .../enums/kuka/step4/Step4Mes2PlcVar.java | 90 ++++++ .../enums/kuka/step4/Step4Plc2MesVar.java | 87 +++++ .../dispatch/line1/KukaEvent1ThreadLine1.java | 2 - .../dispatch/line1/KukaEvent2ThreadLine1.java | 105 ++++-- .../dispatch/line1/KukaEvent4ThreadLine1.java | 306 ++++++++++++++++++ .../dispatch/line2/KukaEvent2ThreadLine2.java | 92 +++++- .../dispatch/line2/KukaEvent4ThreadLine2.java | 306 ++++++++++++++++++ .../cnbm/packing/mapper/CamlineMapper.java | 1 + .../service/DynamicDataSourceService.java | 4 + .../main/resources/mapper/CamlineMapper.xml | 12 + .../mapper/WoCompensationPowerMapper.xml | 4 +- .../resources/mapper/WoPowerLevelMapper.xml | 1 + .../cnbm/s7/s7connector/enmuc/S7Client.java | 2 +- 15 files changed, 1031 insertions(+), 42 deletions(-) create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step4/Step4Mes2PlcVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step4/Step4Plc2MesVar.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent4ThreadLine1.java create mode 100644 ym-packing/src/main/java/com/cnbm/dispatch/line2/KukaEvent4ThreadLine2.java diff --git a/ym-gateway/src/main/resources/logback.xml b/ym-gateway/src/main/resources/logback.xml index d10c69c..73a96a9 100644 --- a/ym-gateway/src/main/resources/logback.xml +++ b/ym-gateway/src/main/resources/logback.xml @@ -344,6 +344,57 @@
+ + + + ${logging.eventlog}/line1/event4/kuka-ngEvent-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/line1/kuka-ngEvent-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + 999 + 200GB + + + + info + ACCEPT + DENY + + + + + ${logging.eventlog}/line2/event4/kuka-ngEvent-log-info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${logging.eventlog}/line2/kuka-ngEvent-log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + 999 + 200GB + + + + info + ACCEPT + DENY + + + + @@ -567,6 +618,15 @@ + + + + + + + + + diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step1/Step1Plc2MesVar.java b/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step1/Step1Plc2MesVar.java index b131eec..7d5c38a 100644 --- a/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step1/Step1Plc2MesVar.java +++ b/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step1/Step1Plc2MesVar.java @@ -14,7 +14,6 @@ public enum Step1Plc2MesVar { SubIdToMes("SubIdToMes",PlcVar.STRING,1,DaveArea.DB,2000,2,0,20), LineNum("LineNum", PlcVar.UINT,1, DaveArea.DB,2000,24,0), - ; private String name; diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step4/Step4Mes2PlcVar.java b/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step4/Step4Mes2PlcVar.java new file mode 100644 index 0000000..66bb7cd --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step4/Step4Mes2PlcVar.java @@ -0,0 +1,90 @@ +package com.cnbm.dispatch.enums.kuka.step4; + +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 Step4Mes2PlcVar { + SubArrivedFinish("SubArrivedFinish", PlcVar.BOOL,1, DaveArea.DB,2001,24,0), + + dLable_Pnom("dLable_Pnom", PlcVar.DINT,1, DaveArea.DB,2001,26,0), + dLable_Voc("dLable_Voc", PlcVar.REAL,1, DaveArea.DB,2001,30,0), + dLable_Isc("dLable_Isc", PlcVar.REAL,1, DaveArea.DB,2001,34,0), + dLable_Vmpp("dLable_Vmpp", PlcVar.REAL,1, DaveArea.DB,2001,38,0), + dLable_Impp("dLable_Vmpp", PlcVar.REAL,1, DaveArea.DB,2001,42,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; + + Step4Mes2PlcVar(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; + } + Step4Mes2PlcVar(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/dispatch/enums/kuka/step4/Step4Plc2MesVar.java b/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step4/Step4Plc2MesVar.java new file mode 100644 index 0000000..1f3b518 --- /dev/null +++ b/ym-packing/src/main/java/com/cnbm/dispatch/enums/kuka/step4/Step4Plc2MesVar.java @@ -0,0 +1,87 @@ +package com.cnbm.dispatch.enums.kuka.step4; + +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 Step4Plc2MesVar { + + SubArrivedToMes("SubArrivedToMes", PlcVar.BOOL,1, DaveArea.DB,2001,0,0), + SubIdToMes("SubIdToMes",PlcVar.STRING,1,DaveArea.DB,2001,2,0,20), + + ; + + 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; + + Step4Plc2MesVar(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; + } + Step4Plc2MesVar(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/dispatch/line1/KukaEvent1ThreadLine1.java b/ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent1ThreadLine1.java index ee99a55..dda7ec0 100644 --- a/ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent1ThreadLine1.java +++ b/ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent1ThreadLine1.java @@ -261,7 +261,6 @@ public class KukaEvent1ThreadLine1 implements ApplicationRunner { 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()); @@ -320,7 +319,6 @@ public class KukaEvent1ThreadLine1 implements ApplicationRunner { } } },1,1, TimeUnit.SECONDS); - } /** diff --git a/ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent2ThreadLine1.java b/ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent2ThreadLine1.java index 2ff423e..709b2a7 100644 --- a/ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent2ThreadLine1.java +++ b/ym-packing/src/main/java/com/cnbm/dispatch/line1/KukaEvent2ThreadLine1.java @@ -152,18 +152,22 @@ public class KukaEvent2ThreadLine1 implements ApplicationRunner { String nowTime = DateUtil.format(new Date(), "yyMMdd"); todayBoxNum+=500; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(todayBoxNum)); logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); String res = "301"+sapMaterial+nowTime+formateString(todayBoxNum); return res; } - public String getErrorBoxId(String sapMaterial){ + + public String getErrorBoxId(String sapMaterial){ + Integer todayErrBoxNum = service.getTodayErrBoxNum()+1; String nowTime = DateUtil.format(new Date(), "yyMMdd"); String mixBoxError = "001"; - String res = "444"+sapMaterial+nowTime+mixBoxError; - logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + String res = "444"+sapMaterial+nowTime+mixBoxError+"01"+todayErrBoxNum; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayErrBoxNum:"+todayErrBoxNum); return res; } @@ -174,8 +178,10 @@ public class KukaEvent2ThreadLine1 implements ApplicationRunner { public static void main(String[] args) { Integer a = 102; + Integer b = 1; Format f1 = new DecimalFormat("000"); System.out.println(f1.format(a)); + System.out.println(f1.format(b)); } public String formateString(Integer a){ Format f1 = new DecimalFormat("000"); @@ -183,12 +189,68 @@ public class KukaEvent2ThreadLine1 implements ApplicationRunner { } //return true 出现混档了,return false 没有出现混档 +// private boolean isMixLevel(String[] subIds,Integer size){ +// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIds[0]); +// String correctLevel = null; +// String powerLevel = null; +// //如果 我们数据库没有 去camline 数据库里面取 -- 开始 +// if(bySubId == null){ +// logger.info("BOXID生成Event-------检查是否混箱时,发现数据库中 无subId:"+ subIds[0]+"现在从camline 系统获取这个基板相关信息"); +// //todo +// CamlineSubIdDTO subIdByCamline = service.getSubIdByCamline(subIds[0]); +// logger.info("BOXID生成Event-------检查是否混箱时,发现数据库中 无subId:"+ subIds[0]+"现在从camline 系统获取这个基板相关信息是:"+subIdByCamline); +// +// correctLevel = subIdByCamline.getPowerLevel(); +// powerLevel = subIdByCamline.getSapMaterial(); +// }else { +// correctLevel = bySubId.getPowerLevel(); +// powerLevel = bySubId.getSapMaterial(); +// } +// String errMsg = "以下基板ID出现混档:"; +// boolean res = false; +// for(int i=0;i 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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 (Throwable e){ + logger.info("host:"+s7Client.getHost()+" ; read 操作出现问题: {}",e.getMessage(),e); + 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()+1; + String nowTime = DateUtil.format(new Date(), "yyMMdd"); + + todayBoxNum+=500; + logger.info("BOXID生成Event-------现在生成boxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime+",todayBoxNum:"+formateString(todayBoxNum)); + 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 = "444"+sapMaterial+nowTime+mixBoxError; + logger.info("BOXID生成Event-------现在生成errBoxId ,sapMaterial: "+sapMaterial+",nowTime:"+nowTime); + + return res; + } + + public String removeKG(String str){ + return str.substring(0,17); + } + + public static void main(String[] args) { + Integer a = 102; + Format f1 = new DecimalFormat("000"); + System.out.println(f1.format(a)); + } + public String formateString(Integer a){ + Format f1 = new DecimalFormat("000"); + return f1.format(a); + } + + //return true 出现混档了,return false 没有出现混档 + private boolean isMixLevel(String[] subIds,Integer size){ + String correctLevel = substrateServiceBiz.getBySubId(subIds[0]).getPowerLevel(); + String errMsg = "以下基板ID出现混档:"; + boolean res = false; + for(int i=0;i + + + + \ 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 eb841ff..13641d8 100644 --- a/ym-packing/src/main/resources/mapper/WoCompensationPowerMapper.xml +++ b/ym-packing/src/main/resources/mapper/WoCompensationPowerMapper.xml @@ -6,7 +6,7 @@ - + @@ -43,7 +43,7 @@ and twcp.actl_pmpp_high ]]> #{param.pmpp} and twcp.actl_pmpp_low #{param.pmpp} - + limit 1 diff --git a/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml b/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml index 6974982..78dd952 100644 --- a/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml +++ b/ym-packing/src/main/resources/mapper/WoPowerLevelMapper.xml @@ -40,6 +40,7 @@ and twpl.pmpp_high ]]> #{param.pmpp} and twpl.pmpp_low #{param.pmpp} + limit 1 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 f669d14..0623712 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 @@ -30,7 +30,7 @@ public enum S7Client { //1线 //S7_DDJ1("10.10.3.152",0,1,2), - S7_DDJ1("10.10.3.152",0,1,2), + S7_DDJ1("10.10.3.154",0,1,2), //2线 S7_DDJ2("10.10.3.158",0,1,2),