Merge branch 'master' of git.picaiba.com:CaiXiang/cigs4 into yanyang
This commit is contained in:
@@ -1,18 +1,12 @@
|
||||
package com.cnbm.packing.dispatch;
|
||||
package com.cnbm.dispatch;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Mes2PlcVar;
|
||||
import com.cnbm.packing.dispatch.enums.kuka.step1.Step1Plc2MesVar;
|
||||
import com.cnbm.packing.dispatch.enums.kuka.step2.Step2Mes2PlcVar;
|
||||
import com.cnbm.packing.dispatch.enums.kuka.step2.Step2Plc2MesVar;
|
||||
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Mes2PlcVar;
|
||||
import com.cnbm.packing.dispatch.enums.kuka.step3.Step3Plc2MesVar;
|
||||
import com.cnbm.packing.dto.CamlineExtendArgDTO;
|
||||
import com.cnbm.packing.dto.WoPowerLevelDTO;
|
||||
import com.cnbm.packing.entity.WoPackagingBox;
|
||||
import com.cnbm.packing.entity.WoPackagingBoxSubstrate;
|
||||
import com.cnbm.packing.entity.WoPowerLevel;
|
||||
import com.cnbm.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.service.*;
|
||||
import com.cnbm.s7.s7connector.enmuc.S7Client;
|
||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||
@@ -24,7 +18,6 @@ import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -157,12 +150,21 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
|
||||
kukaStep1.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("================= 现在开始执行 过程一 任务 ==================");
|
||||
}
|
||||
},1,1, TimeUnit.SECONDS);
|
||||
|
||||
|
||||
|
||||
// kukaStep1.scheduleAtFixedRate(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// //调度开始
|
||||
// logger.info("");
|
||||
// logger.info("================= 现在开始执行 过程一 任务 ==================");
|
||||
//// logger.info("");
|
||||
//// logger.info("================= 现在开始执行 过程一 任务 ==================");
|
||||
// Integer subArrived = waitingForTarget(Step1Plc2MesVar.SubArrivedToMes, true);
|
||||
// if(subArrived != 1){
|
||||
// logger.info("失败"+" --- "+" MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||
@@ -171,6 +173,7 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// //一. 从plc 中获取 subId 和 lineNum
|
||||
// String subId = (String) read(S7Client.S7_KUKA,Step1Plc2MesVar.SubIdToMes);
|
||||
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step1Plc2MesVar.LineNum);
|
||||
// logger.info("采集到 基板ID: "+subId+", 线边号:"+lineNum);
|
||||
//
|
||||
// //二. MES 业务
|
||||
// //=============== MES 业务 开始 =================
|
||||
@@ -187,6 +190,7 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.dLable_Impp,argByPMPP.getLableImpp());
|
||||
//
|
||||
//
|
||||
//
|
||||
// //4. 把基板录到数据库
|
||||
// WoPackagingBoxSubstrate woPackagingBoxSubstrate = new WoPackagingBoxSubstrate();
|
||||
// woPackagingBoxSubstrate.setLineBody(lineNum);
|
||||
@@ -242,11 +246,6 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// logger.info("失败"+" --- "+"MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||
// }
|
||||
// write(S7Client.S7_KUKA,Step1Mes2PlcVar.SubArrivedFinish,false);
|
||||
// logger.info("采集到的基板id : "+subId);
|
||||
// logger.info("================= 过程一 任务成功完成 ==================");
|
||||
// logger.info("");
|
||||
//
|
||||
//
|
||||
// }
|
||||
// },1,1, TimeUnit.SECONDS);
|
||||
//
|
||||
@@ -255,8 +254,7 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// //调度开始
|
||||
// logger.info("");
|
||||
// logger.info("================= 现在开始执行 过程二 任务 ==================");
|
||||
//
|
||||
// Integer shelfIsFull = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, true);
|
||||
// if(shelfIsFull != 1){
|
||||
// logger.info("失败"+" --- "+"MES监听 Step2Plc2MesVar.ShelfIsFull 是否 等于 1 失败");
|
||||
@@ -265,7 +263,7 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// //一. 从plc 中获取 subIdList 和 lineNum
|
||||
// String[] subIdList = (String[])read(S7Client.S7_KUKA,Step2Plc2MesVar.SubIdList);
|
||||
//// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step2Plc2MesVar.LineNum);
|
||||
//
|
||||
// logger.info("获取到基板列表:"+ Arrays.toString(subIdList));
|
||||
//
|
||||
// //二. MES 业务
|
||||
// //=============== MES 业务 开始 =================
|
||||
@@ -275,6 +273,7 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// }
|
||||
// WoPackagingBoxSubstrate bySubId = substrateServiceBiz.getBySubId(subIdList[0]);
|
||||
// String boxId = getBoxId(bySubId.getSapMaterial());
|
||||
// logger.info("mes 生成的boxId :"+ boxId);
|
||||
// //2. 依次update 基板表,把boxId 赋予这些基板
|
||||
// for(int i=0;i<subIdList.length;i++){
|
||||
// substrateServiceBiz.updatePackagingBoxIdByWoSubstrateId(boxId,subIdList[i]);
|
||||
@@ -306,9 +305,6 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// logger.info("失败"+" --- "+"步骤1. MES监听 Step1Plc2MesVar.SubArrivedToMes 是否 等于 1 失败");
|
||||
// }
|
||||
// write(S7Client.S7_KUKA,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
||||
// logger.info("================= 过程二 任务成功完成 ==================");
|
||||
// logger.info("");
|
||||
//
|
||||
// }
|
||||
// },1,1, TimeUnit.SECONDS);
|
||||
//
|
||||
@@ -317,8 +313,6 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// //调度开始
|
||||
// logger.info("");
|
||||
// logger.info("================= 现在开始执行 过程三 任务 ==================");
|
||||
// Integer shelfIsFull = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, true);
|
||||
// if(shelfIsFull != 1){
|
||||
// logger.info("失败"+" --- "+"MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
||||
@@ -327,7 +321,7 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// //一. 从plc 中获取 subIdList 和 lineNum
|
||||
// String boxId = (String)read(S7Client.S7_KUKA,Step3Plc2MesVar.BoxId);
|
||||
// Integer lineNum = (Integer) read(S7Client.S7_KUKA,Step3Plc2MesVar.LineNum);
|
||||
//
|
||||
// logger.info("到达站台的boxId :"+boxId);
|
||||
//
|
||||
// //二. MES 业务
|
||||
// //=============== MES 业务 开始 =================
|
||||
@@ -345,8 +339,7 @@ public class KukaJoinThread implements ApplicationRunner {
|
||||
// logger.info("失败"+" --- "+"步骤1. MES监听 Step3Plc2MesVar.ShelfIsFullArrived 是否 等于 1 失败");
|
||||
// }
|
||||
// write(S7Client.S7_KUKA,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
|
||||
// logger.info("================= 过程三 任务成功完成 ==================");
|
||||
// logger.info("");
|
||||
//
|
||||
//
|
||||
// }
|
||||
// },1,1, TimeUnit.SECONDS);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cnbm.packing.dispatch.enums;
|
||||
package com.cnbm.dispatch.enums;
|
||||
|
||||
/**
|
||||
* @Author: 蔡翔
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cnbm.packing.dispatch.enums.kuka.step1;
|
||||
package com.cnbm.dispatch.enums.kuka.step1;
|
||||
|
||||
import com.cnbm.s7.s7connector.api.DaveArea;
|
||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cnbm.packing.dispatch.enums.kuka.step1;
|
||||
package com.cnbm.dispatch.enums.kuka.step1;
|
||||
|
||||
import com.cnbm.s7.s7connector.api.DaveArea;
|
||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cnbm.packing.dispatch.enums.kuka.step2;
|
||||
package com.cnbm.dispatch.enums.kuka.step2;
|
||||
|
||||
import com.cnbm.s7.s7connector.api.DaveArea;
|
||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cnbm.packing.dispatch.enums.kuka.step2;
|
||||
package com.cnbm.dispatch.enums.kuka.step2;
|
||||
|
||||
import com.cnbm.s7.s7connector.api.DaveArea;
|
||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cnbm.packing.dispatch.enums.kuka.step3;
|
||||
package com.cnbm.dispatch.enums.kuka.step3;
|
||||
|
||||
import com.cnbm.s7.s7connector.api.DaveArea;
|
||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cnbm.packing.dispatch.enums.kuka.step3;
|
||||
package com.cnbm.dispatch.enums.kuka.step3;
|
||||
|
||||
import com.cnbm.s7.s7connector.api.DaveArea;
|
||||
import com.cnbm.s7.s7connector.type.PlcVar;
|
||||
@@ -1,24 +1,162 @@
|
||||
package com.cnbm.packing.controller;
|
||||
|
||||
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.service.DynamicDataSourceService;
|
||||
import com.cnbm.s7.entity.R;
|
||||
import com.cnbm.s7.s7connector.enmuc.S7Client;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.cnbm.common.utils.Result;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Author weihongyang
|
||||
* @Date 2022/6/24 8:57 AM
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/packing")
|
||||
@RequestMapping("/test")
|
||||
@Api(tags="测试接口")
|
||||
public class TestController {
|
||||
|
||||
@GetMapping("get")
|
||||
public Result<Integer> get(){
|
||||
return new Result<Integer>().ok(1);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
|
||||
@Autowired
|
||||
DynamicDataSourceService service;
|
||||
private Object read(S7Client s7Client,Step1Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
|
||||
try {
|
||||
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
||||
}catch (Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private Object read(S7Client s7Client,Step1Mes2PlcVar var) throws UnsupportedEncodingException, ParseException {
|
||||
try {
|
||||
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
||||
}catch (Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("get2")
|
||||
public Result<Integer> get2(){
|
||||
return new Result<Integer>().ok(2);
|
||||
private Object read(S7Client s7Client,Step2Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
|
||||
try {
|
||||
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
||||
}catch (Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private Object read(S7Client s7Client,Step2Mes2PlcVar var) throws UnsupportedEncodingException, ParseException {
|
||||
try {
|
||||
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
||||
}catch (Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Object read(S7Client s7Client,Step3Plc2MesVar var) throws UnsupportedEncodingException, ParseException {
|
||||
try {
|
||||
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
||||
}catch (Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private Object read(S7Client s7Client,Step3Mes2PlcVar var) throws UnsupportedEncodingException, ParseException {
|
||||
try {
|
||||
return s7Client.read(var.getArea(), var.getAreaNumber(), var.getByteOffset(), var.getBitOffset(), var.getLength(), var.getStrSize(), var.getType());
|
||||
}catch (Exception e){
|
||||
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
@PostMapping("/testlogger")
|
||||
public R testlogger() {
|
||||
logger.info("test logger");
|
||||
System.out.println("test logger");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("getPMPPBySubId")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
||||
})
|
||||
public Result<Float> getPMPPBySubId(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
Object subId = params.get("subId");
|
||||
return new Result<Float>().ok(service.getPMPPBySubId(subId.toString()));
|
||||
}
|
||||
@PostMapping("getOrderNameBySubId")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
||||
})
|
||||
public Result<String> getOrderNameBySubId(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
Object subId = params.get("subId");
|
||||
//service.getExtendArgFromCamline()
|
||||
return new Result<String>().ok(service.getOrderNameBySubId(subId.toString()));
|
||||
}
|
||||
|
||||
@PostMapping("getExtendArgFromCamline")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "subId", value = "基板ID", paramType = "query", required = true, dataTypeClass=Integer.class) ,
|
||||
})
|
||||
public Result<String> getExtendArgFromCamline(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
Object subId = params.get("subId");
|
||||
return new Result<String>().ok(service.getExtendArgFromCamline(subId.toString()).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@ApiModel(value = "camline 查询对象")
|
||||
public class CamlineExtendArgDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private LocalDateTime lastUpdateTime;
|
||||
|
||||
Reference in New Issue
Block a user