现场修改

This commit is contained in:
liuhanqing
2026-02-03 09:26:42 +08:00
parent ce29fad83e
commit 6152646e1b
9 changed files with 134 additions and 70 deletions

View File

@@ -165,6 +165,10 @@ public class ScheduleThread {
if (plcDdj1ReadCustomThread!=null){ if (plcDdj1ReadCustomThread!=null){
plcDdj1ReadCustomThread.getThread().start(); plcDdj1ReadCustomThread.getThread().start();
}
if (plcDdj2ReadCustomThread!=null){
plcDdj2ReadCustomThread.getThread().start();
} }
if (plcDdj4ReadCustomThread!=null){ if (plcDdj4ReadCustomThread!=null){
plcDdj4ReadCustomThread.getThread().start(); plcDdj4ReadCustomThread.getThread().start();
@@ -186,6 +190,10 @@ public class ScheduleThread {
if (ddj1CustomThread!=null){ if (ddj1CustomThread!=null){
ddj1CustomThread.thread.start(); ddj1CustomThread.thread.start();
}
if (ddj2CustomThread!=null){
ddj2CustomThread.thread.start();
} }
if (ddj4CustomThread!=null){ if (ddj4CustomThread!=null){
ddj4CustomThread.thread.start(); ddj4CustomThread.thread.start();

View File

@@ -125,7 +125,7 @@ public class PlcDdjRead extends Thread {
} }
void closeServer() { void closeServer() {
if (readWriteNet != null) { if (siemensS7Net != null) {
siemensS7Net.ConnectClose(); siemensS7Net.ConnectClose();
} }
setIsConnect(false); setIsConnect(false);

View File

@@ -150,8 +150,8 @@ public class PlcSsjRead implements Runnable {
} }
void closeServer() { void closeServer() {
if (readWriteNet != null) { if (siemensS7Net != null) {
readWriteNet.ConnectClose(); siemensS7Net.ConnectClose();
} }
setIsConnect(false); setIsConnect(false);
} }

View File

@@ -48,9 +48,14 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
public Map<String, List<Integer>> roadwayMap = new HashMap<>(); public Map<String, List<Integer>> roadwayMap = new HashMap<>();
private PlcDdjRead plcDdjRead; private PlcDdjRead plcDdjRead;
private PlcSsjRead plcSsjRead; private PlcSsjRead plcSsjRead;
//称重 ip port
public Map<String, String> czRoadwayMap = new HashMap<>(); public Map<String, String> czRoadwayMap = new HashMap<>();
//超重DB块
public Map<String, String> czOverMap = new HashMap<>();
//出库任务信号DB块
public Map<String, String> outJobMap = new HashMap<>();
public BaseDdjThread(PlcDdjRead plcDdjRead, PlcSsjRead plcSsjRead) { public BaseDdjThread(PlcDdjRead plcDdjRead, PlcSsjRead plcSsjRead) {
this.plcDdjRead = plcDdjRead; this.plcDdjRead = plcDdjRead;
this.plcSsjRead = plcSsjRead; this.plcSsjRead = plcSsjRead;
@@ -113,10 +118,10 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, msgDdj.getId()); DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, msgDdj.getId());
if (ddjDeviceExecutionQueue != null && ddjDeviceExecutionQueue.getDdjxf().equals("1") && (ddjDeviceExecutionQueue.getRwlx().equals(DDJ_RWLX_3) || ddjDeviceExecutionQueue.getRwlx().equals(DDJ_RWLX_4))) { if (ddjDeviceExecutionQueue != null && ddjDeviceExecutionQueue.getDdjxf().equals("1") && (ddjDeviceExecutionQueue.getRwlx().equals(DDJ_RWLX_3) || ddjDeviceExecutionQueue.getRwlx().equals(DDJ_RWLX_4))) {
DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ddjDeviceExecutionQueue.getSpare2());
SendData by1 = new SendData(Tools.INT, 1); SendData by1 = new SendData(Tools.INT, 1);
byte[] sendData = Tools.sendData(by1); byte[] sendData = Tools.sendData(by1);
plcSsjRead.writeToSsJ(deviceSsj.getPlcDbWriteAddress(),sendData); String dbWrite = outJobMap.get(ddjDeviceExecutionQueue.getSpare2());
plcSsjRead.writeToSsJ(dbWrite, sendData);
}//else if (ddjDeviceExecutionQueue !=null){ }//else if (ddjDeviceExecutionQueue !=null){
// DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ddjDeviceExecutionQueue.getSpare2()); // DeviceSsj deviceSsj = PlcSsjRead.deviceSsjMap.get(ddjDeviceExecutionQueue.getSpare2());
// SendData by1 = new SendData(Tools.INT,0); // SendData by1 = new SendData(Tools.INT,0);
@@ -382,8 +387,9 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
String[] split = czDeviceIpPort.split(":"); String[] split = czDeviceIpPort.split(":");
String weight = CheckWeight.sendWeight(split[0], Convert.toInt(split[1])); String weight = CheckWeight.sendWeight(split[0], Convert.toInt(split[1]));
Double aDouble = Convert.toDouble(weight); Double aDouble = Convert.toDouble(weight);
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(ssj.getTaskNo()), ddj.getId()); DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(taskNo), ddj.getId());
if (ObjUtil.isNull(ddjQueue) && aDouble > 0) { if (ObjUtil.isNull(ddjQueue)) {
if (aDouble > 0 && aDouble < 1500) {
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue(); DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID()); ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
ddjDeviceExecutionQueue.setRwh(Convert.toLong(ssj.getTaskNo())); ddjDeviceExecutionQueue.setRwh(Convert.toLong(ssj.getTaskNo()));
@@ -404,8 +410,28 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
ddjDeviceExecutionQueue.setSpare1("0"); ddjDeviceExecutionQueue.setSpare1("0");
ddjDeviceExecutionQueue.setSpare3(Convert.toStr(weight)); ddjDeviceExecutionQueue.setSpare3(Convert.toStr(weight));
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue); ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
} /*else if (aDouble>=1500) {
//写入超重信号
SendData by1 = new SendData(Tools.INT,1);
byte[] sendData = Tools.sendData(by1);
String dbWrite = czOverMap.get(ssj.getDeviceCode());
int i = plcSsjRead.writeToSsJ(dbWrite, sendData);
if (i==1){
log.info("写入 设备:{} 超重信号DB块:{}",ssj.getDeviceCode(),dbWrite);
} }
}*/
} }
}/*else {
//写入超重默认信号 0
SendData by1 = new SendData(Tools.INT,0);
byte[] sendData = Tools.sendData(by1);
String dbWrite = czOverMap.get(ssj.getDeviceCode());
int i = plcSsjRead.writeToSsJ(dbWrite, sendData);
if (i==1){
log.info("写入 设备:{} 默认信号DB块:{}",ssj.getDeviceCode(),dbWrite);
}
}*/
} }
} }
@@ -431,8 +457,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
ddjTaskFinish(rwh, ddj.getId(), 2); ddjTaskFinish(rwh, ddj.getId(), 2);
} else if (ddjDeviceExecutionQueue.getRwlx() == 1) { } else if (ddjDeviceExecutionQueue.getRwlx() == 1) {
if (hczt == 0) { if (hczt == 0) {
//回传完成信号 ddjTaskFinish(ddj.getRwh(), ddj.getId(), 2);
ddjTaskFinish(rwh, ddj.getId(), 2);
} }
} }
} }
@@ -533,6 +558,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5) { if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5) {
DdjDeviceExecutionQueue ddjDeviceExecutionRunningQueueParam = new DdjDeviceExecutionQueue(); DdjDeviceExecutionQueue ddjDeviceExecutionRunningQueueParam = new DdjDeviceExecutionQueue();
ddjDeviceExecutionRunningQueueParam.setDdjxf("1"); ddjDeviceExecutionRunningQueueParam.setDdjxf("1");
ddjDeviceExecutionRunningQueueParam.setDevId(ddj.getId());
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues1 = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionRunningQueueParam); List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues1 = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionRunningQueueParam);
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues1)) { if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues1)) {

View File

@@ -70,6 +70,16 @@ public class Ddj1Thread extends BaseDdjThread {
czRoadwayMap.put("L2007", "172.19.50.73:4001"); czRoadwayMap.put("L2007", "172.19.50.73:4001");
czRoadwayMap.put("L2008", "172.19.50.74:4001"); czRoadwayMap.put("L2008", "172.19.50.74:4001");
czOverMap.put("L2001", "DB502.12");
czOverMap.put("L2002", "DB502.26");
czOverMap.put("L2007", "DB502.96");
czOverMap.put("L2008", "DB502.110");
outJobMap.put("L2001", "DB502.10");
outJobMap.put("L2002", "DB502.24");
outJobMap.put("L2007", "DB502.94");
outJobMap.put("L2008", "DB502.108");
log.info("Ddj1Thread init"); log.info("Ddj1Thread init");

View File

@@ -25,42 +25,58 @@ public class Ddj2Thread extends BaseDdjThread {
@Override @Override
public void init() { public void init() {
/*super.init(); super.init();
ddjCodeList = new HashMap<>(); ddjCodeList = new HashMap<>();
ssjList = new HashMap<>(); ssjList = new HashMap<>();
ArrayList<MsgDdj> ddjCodes = new ArrayList<>(); ArrayList<String> ddjCodes = new ArrayList<>();
ddjCodes.add(PlcDdjRead.deviceDdjMap.get("ddj2")); ddjCodes.add("ddj2");
ddjCodeList.put("ddj", ddjCodes); ddjCodeList.put("ddj", ddjCodes);
ArrayList<DeviceSsj> roadSsjList = new ArrayList<>(); ArrayList<String> roadSsjList = new ArrayList<>();
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2003")); roadSsjList.add("L2003");
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2004")); roadSsjList.add("L2004");
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2009")); roadSsjList.add("L2009");
roadSsjList.add(PlcSsjRead.deviceSsjMap.get("L2010")); roadSsjList.add("L2010");
ssjList.put("roadSsjList", roadSsjList); ssjList.put("roadSsjList", roadSsjList);
ArrayList<DeviceSsj> outSsj1 = new ArrayList<>(); ArrayList<String> outSsj1 = new ArrayList<>();
outSsj1.add(PlcSsjRead.deviceSsjMap.get("L2003")); outSsj1.add("L2003");
ssjList.put("outSsj1", outSsj1); ssjList.put("outSsj1", outSsj1);
ArrayList<DeviceSsj> outSsj2 = new ArrayList<>(); ArrayList<String> outSsj2 = new ArrayList<>();
outSsj2.add(PlcSsjRead.deviceSsjMap.get("L2004")); outSsj2.add("L2004");
ssjList.put("outSsj2", outSsj2); ssjList.put("outSsj2", outSsj2);
ArrayList<DeviceSsj> outSsj3 = new ArrayList<>(); ArrayList<String> outSsj3 = new ArrayList<>();
outSsj3.add(PlcSsjRead.deviceSsjMap.get("L2009")); outSsj3.add("L2009");
ssjList.put("outSsj3", outSsj3); ssjList.put("outSsj3", outSsj3);
ArrayList<DeviceSsj> outSsj4 = new ArrayList<>(); ArrayList<String> outSsj4 = new ArrayList<>();
outSsj4.add(PlcSsjRead.deviceSsjMap.get("L2010")); outSsj4.add("L2010");
ssjList.put("outSsj4", outSsj4); ssjList.put("outSsj4", outSsj4);
//初始化巷道口 排 列 层 //初始化巷道口 排 列 层
roadwayMap.put("L2003", Arrays.asList(3, 1, 1)); roadwayMap.put("L2003", Arrays.asList(1, 0, 1));
roadwayMap.put("L2004", Arrays.asList(4, 1, 1)); roadwayMap.put("L2004", Arrays.asList(2, 0, 1));
roadwayMap.put("L2009", Arrays.asList(3, 22, 1)); roadwayMap.put("L2009", Arrays.asList(1, 20, 1));
roadwayMap.put("L2010", Arrays.asList(4, 22, 1)); roadwayMap.put("L2010", Arrays.asList(2, 20, 1));
roadwayRollback.put("L2003", 84); roadwayRollback.put("L2003", 84);
roadwayRollback.put("L2004", 85); roadwayRollback.put("L2004", 85);
roadwayRollback.put("L2009", 86); roadwayRollback.put("L2009", 86);
roadwayRollback.put("L2010", 87); roadwayRollback.put("L2010", 87);
//初始化称重设备连接ip port
czRoadwayMap.put("L2003", "172.19.50.75:4001");
czRoadwayMap.put("L2004", "172.19.50.76:4001");
czRoadwayMap.put("L2009", "172.19.50.77:4001");
czRoadwayMap.put("L2010","172.19.50.78:4001");
log.info("Ddj2Thread init");*/ czOverMap.put("L2003", "DB502.12");
czOverMap.put("L2004", "DB502.26");
czOverMap.put("L2009", "DB502.96");
czOverMap.put("L2010", "DB502.110");
outJobMap.put("L2003", "DB502.38");
outJobMap.put("L2004", "DB502.52");
outJobMap.put("L2009", "DB502.122");
outJobMap.put("L2010", "DB502.136");
log.info("Ddj2Thread init");
} }

View File

@@ -53,6 +53,13 @@ public class Ddj4Thread extends BaseDdjThread {
//初始化称重设备连接ip port //初始化称重设备连接ip port
czRoadwayMap.put("L1001", "172.19.40.203:4001"); czRoadwayMap.put("L1001", "172.19.40.203:4001");
czRoadwayMap.put("L1002", "172.19.40.202:4001"); czRoadwayMap.put("L1002", "172.19.40.202:4001");
czOverMap.put("L1001", "DB502.12");
czOverMap.put("L1002", "DB502.26");
outJobMap.put("L1001", "DB502.10");
outJobMap.put("L1002", "DB502.24");
log.info("Ddj4Thread init"); log.info("Ddj4Thread init");
} }

View File

@@ -50,11 +50,8 @@ public class CheckWeight {
} }
public static void main(String[] args) { public static void main(String[] args) {
/*CheckWeight checkWeight = new CheckWeight(); CheckWeight checkWeight = new CheckWeight();
System.out.println(checkWeight.sendWeight("172.19.40.203", 4001)); System.out.println(checkWeight.sendWeight("172.19.50.75", 4001));
System.out.println(checkWeight.sendWeight("172.19.40.202", 4001));*/
Double aDouble = Convert.toDouble("-000019");
System.out.println(aDouble);
} }
} }

View File

@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</if> </if>
</where> </where>
order by scsj asc order by rwlx desc,scsj asc
</select> </select>
<select id="selectDdjDeviceExecutionQueueByUuid" parameterType="String" resultMap="DdjDeviceExecutionQueueResult"> <select id="selectDdjDeviceExecutionQueueByUuid" parameterType="String" resultMap="DdjDeviceExecutionQueueResult">