测试过程问题修改
This commit is contained in:
@@ -79,7 +79,7 @@ public class DeviceSrgvController extends BaseController
|
|||||||
return toAjax(deviceSrgvService.insertDeviceSrgv(deviceSrgv));
|
return toAjax(deviceSrgvService.insertDeviceSrgv(deviceSrgv));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改四向小车设备表
|
* 修改四向小车设备表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('device:srgv:edit')")
|
@PreAuthorize("@ss.hasPermi('device:srgv:edit')")
|
||||||
|
|||||||
@@ -85,4 +85,7 @@ public interface MydoJobMapper
|
|||||||
void selectMydoJobOutside(HashMap<String, Object> map);
|
void selectMydoJobOutside(HashMap<String, Object> map);
|
||||||
|
|
||||||
List<MydoJob> selectOutJobList(@Param("theFloor") String floor);
|
List<MydoJob> selectOutJobList(@Param("theFloor") String floor);
|
||||||
|
|
||||||
|
List<MydoJob> selectInJobList(@Param("theFloor") String floor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,4 +88,6 @@ public interface IMydoJobService
|
|||||||
|
|
||||||
|
|
||||||
List<MydoJob> selectOutJobList(String floor);
|
List<MydoJob> selectOutJobList(String floor);
|
||||||
|
|
||||||
|
List<MydoJob> selectInJobList(String floor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.job.service.impl;
|
package com.ruoyi.job.service.impl;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -188,4 +189,9 @@ public class MydoJobServiceImpl implements IMydoJobService
|
|||||||
public List<MydoJob> selectOutJobList(String floor) {
|
public List<MydoJob> selectOutJobList(String floor) {
|
||||||
return mydoJobMapper.selectOutJobList(floor);
|
return mydoJobMapper.selectOutJobList(floor);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<MydoJob> selectInJobList(String floor) {
|
||||||
|
return mydoJobMapper.selectInJobList(floor);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,30 @@ public class ScheduleThread {
|
|||||||
log.info("调度服务执行成功");
|
log.info("调度服务执行成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreDestroy
|
||||||
|
public void destroy() {
|
||||||
|
try {
|
||||||
|
for (String key : threadMap.keySet()) {
|
||||||
|
CustomThread<?> ct = threadMap.get(key);
|
||||||
|
if (ct != null && ct.getRunnable() != null) {
|
||||||
|
setRunnableIsRun(ct.getRunnable(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String key : threadMap.keySet()) {
|
||||||
|
CustomThread<?> ct = threadMap.get(key);
|
||||||
|
if (ct != null && ct.getThread() != null) {
|
||||||
|
try {
|
||||||
|
ct.getThread().join(2000);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("调度服务销毁时停止线程异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调度初始化
|
* 调度初始化
|
||||||
*/
|
*/
|
||||||
@@ -120,19 +144,19 @@ public class ScheduleThread {
|
|||||||
for (DeviceSsj deviceSsj : deviceSsjs) {
|
for (DeviceSsj deviceSsj : deviceSsjs) {
|
||||||
ssjList.put(deviceSsj.getDeviceCode(), deviceSsj);
|
ssjList.put(deviceSsj.getDeviceCode(), deviceSsj);
|
||||||
}
|
}
|
||||||
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo("127.0.0.1", 1502));
|
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo("192.168.10.100", 502));
|
||||||
Thread plcSsjReadThread = new Thread(plcSsjRead, "plcSsjReadCustomThread");
|
Thread plcSsjReadThread = new Thread(plcSsjRead, "plcSsjReadCustomThread");
|
||||||
plcSsjReadCustomThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
|
plcSsjReadCustomThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
|
||||||
|
|
||||||
//plc充电桩读取线程
|
//plc充电桩读取线程
|
||||||
ConcurrentHashMap<String, DeviceCdz> cdzList = new ConcurrentHashMap<>();
|
// ConcurrentHashMap<String, DeviceCdz> cdzList = new ConcurrentHashMap<>();
|
||||||
List<DeviceCdz> deviceCdzList = deviceCdzService.selectDeviceCdzList(new DeviceCdz());
|
// List<DeviceCdz> deviceCdzList = deviceCdzService.selectDeviceCdzList(new DeviceCdz());
|
||||||
for (DeviceCdz deviceCdz : deviceCdzList) {
|
// for (DeviceCdz deviceCdz : deviceCdzList) {
|
||||||
cdzList.put(String.valueOf(deviceCdz.getId()), deviceCdz);
|
// cdzList.put(String.valueOf(deviceCdz.getId()), deviceCdz);
|
||||||
}
|
// }
|
||||||
PlcCdzRead plcCdzRead = new PlcCdzRead(cdzList, new PlcConnectInfo("127.0.0.1", 1502));
|
// PlcCdzRead plcCdzRead = new PlcCdzRead(cdzList, new PlcConnectInfo("192.168.10.100", 502));
|
||||||
Thread plcCdzReadThread = new Thread(plcCdzRead, "plcCdzjReadCustomThread");
|
// Thread plcCdzReadThread = new Thread(plcCdzRead, "plcCdzjReadCustomThread");
|
||||||
plcCdzjReadCustomThread = new CustomThread<PlcCdzRead>(plcCdzReadThread, plcCdzRead);
|
// plcCdzjReadCustomThread = new CustomThread<PlcCdzRead>(plcCdzReadThread, plcCdzRead);
|
||||||
|
|
||||||
|
|
||||||
ConcurrentHashMap<String, DeviceTsj> tsjList = new ConcurrentHashMap<>();
|
ConcurrentHashMap<String, DeviceTsj> tsjList = new ConcurrentHashMap<>();
|
||||||
@@ -142,14 +166,13 @@ public class ScheduleThread {
|
|||||||
tsjList.put(t.getName(), t);
|
tsjList.put(t.getName(), t);
|
||||||
}
|
}
|
||||||
//plc提升机读取线程
|
//plc提升机读取线程
|
||||||
PlcTsjRead plcTsjRead = new PlcTsjRead(tsjList, new PlcConnectInfo("127.0.0.1", 1502));
|
PlcTsjRead plcTsjRead = new PlcTsjRead(tsjList, new PlcConnectInfo("192.168.10.100", 502));
|
||||||
Thread plcTsjReadThread = new Thread(plcTsjRead, "plcTsjReadCustomThread");
|
Thread plcTsjReadThread = new Thread(plcTsjRead, "plcTsjReadCustomThread");
|
||||||
plcTsjReadCustomThread = new CustomThread<PlcTsjRead>(plcTsjReadThread, plcTsjRead);
|
plcTsjReadCustomThread = new CustomThread<PlcTsjRead>(plcTsjReadThread, plcTsjRead);
|
||||||
|
|
||||||
ConcurrentHashMap<String, DeviceSrgv> srgvList = new ConcurrentHashMap<>();
|
ConcurrentHashMap<String, DeviceSrgv> srgvList = new ConcurrentHashMap<>();
|
||||||
List<DeviceSrgv> srgvs = deviceSrgvService.selectDeviceSrgvList(new DeviceSrgv());
|
List<DeviceSrgv> srgvs = deviceSrgvService.selectDeviceSrgvList(new DeviceSrgv());
|
||||||
for (DeviceSrgv srgv : srgvs) {
|
for (DeviceSrgv srgv : srgvs) {
|
||||||
srgvList.put(srgv.getDeviceId().toString(), srgv);
|
|
||||||
switch (srgv.getDeviceId()) {
|
switch (srgv.getDeviceId()) {
|
||||||
case 1:
|
case 1:
|
||||||
PlcSrgvRead plcSrgvRead1 = new PlcSrgvRead(srgv, new PlcConnectInfo(srgv.getIp(), srgv.getPort()));
|
PlcSrgvRead plcSrgvRead1 = new PlcSrgvRead(srgv, new PlcConnectInfo(srgv.getIp(), srgv.getPort()));
|
||||||
@@ -162,6 +185,7 @@ public class ScheduleThread {
|
|||||||
plcSrgvReadCustomThread2 = new CustomThread<PlcSrgvRead>(plcSrgvReadThread2, plcSrgvRead2);
|
plcSrgvReadCustomThread2 = new CustomThread<PlcSrgvRead>(plcSrgvReadThread2, plcSrgvRead2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
srgvList.put(srgv.getDeviceId().toString(), srgv);
|
||||||
}
|
}
|
||||||
PlcSrgvRead.deviceSrgvMap = srgvList;
|
PlcSrgvRead.deviceSrgvMap = srgvList;
|
||||||
//监控线程
|
//监控线程
|
||||||
@@ -173,7 +197,7 @@ public class ScheduleThread {
|
|||||||
|
|
||||||
public void refreshThreadMap() {
|
public void refreshThreadMap() {
|
||||||
registerThread("plcSsjReadCustomThread", plcSsjReadCustomThread, "PLC输送机读取线程", "read");
|
registerThread("plcSsjReadCustomThread", plcSsjReadCustomThread, "PLC输送机读取线程", "read");
|
||||||
registerThread("plcCdzjReadCustomThread", plcCdzjReadCustomThread, "PLC充电桩读取线程", "read");
|
// registerThread("plcCdzjReadCustomThread", plcCdzjReadCustomThread, "PLC充电桩读取线程", "read");
|
||||||
registerThread("plcTsjReadCustomThread", plcTsjReadCustomThread, "PLC提升机读取线程", "read");
|
registerThread("plcTsjReadCustomThread", plcTsjReadCustomThread, "PLC提升机读取线程", "read");
|
||||||
registerThread("plcSrgvReadCustomThread1", plcSrgvReadCustomThread1, "PLC四向车1读取线程", "read");
|
registerThread("plcSrgvReadCustomThread1", plcSrgvReadCustomThread1, "PLC四向车1读取线程", "read");
|
||||||
registerThread("plcSrgvReadCustomThread2", plcSrgvReadCustomThread2, "PLC四向车2读取线程", "read");
|
registerThread("plcSrgvReadCustomThread2", plcSrgvReadCustomThread2, "PLC四向车2读取线程", "read");
|
||||||
@@ -202,7 +226,7 @@ public class ScheduleThread {
|
|||||||
plcTsjReadCustomThread.getThread().start();
|
plcTsjReadCustomThread.getThread().start();
|
||||||
monitoringCustomThread.getThread().start();
|
monitoringCustomThread.getThread().start();
|
||||||
//充电桩读取线程
|
//充电桩读取线程
|
||||||
plcCdzjReadCustomThread.getThread().start();
|
// plcCdzjReadCustomThread.getThread().start();
|
||||||
isRun = true;
|
isRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
public class PlcSrgvRead implements Runnable {
|
public class PlcSrgvRead implements Runnable {
|
||||||
|
|
||||||
public static ConcurrentHashMap<String, DeviceSrgv> deviceSrgvMap;
|
public static ConcurrentHashMap<String, DeviceSrgv> deviceSrgvMap;
|
||||||
private static ModbusTcpNet modbusTcpNet;
|
private ModbusTcpNet modbusTcpNet;
|
||||||
public static IReadWriteNet readWriteNet = null;
|
public IReadWriteNet readWriteNet = null;
|
||||||
public volatile boolean isRun = true;
|
public volatile boolean isRun = true;
|
||||||
private final String ip;
|
private final String ip;
|
||||||
private final int port;
|
private final int port;
|
||||||
@@ -39,14 +39,14 @@ public class PlcSrgvRead implements Runnable {
|
|||||||
this.station = (byte) 1;
|
this.station = (byte) 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean Write(String address, int[] value) {
|
public synchronized boolean write(String address, int[] value) {
|
||||||
|
|
||||||
OperateResult write = modbusTcpNet.Write(address, value);
|
OperateResult write = modbusTcpNet.Write(address, value);
|
||||||
return write.IsSuccess;
|
return write.IsSuccess;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean Write(String address, short[] value) {
|
public synchronized boolean write(String address, short[] value) {
|
||||||
|
|
||||||
OperateResult write = modbusTcpNet.Write(address, value);
|
OperateResult write = modbusTcpNet.Write(address, value);
|
||||||
return write.IsSuccess;
|
return write.IsSuccess;
|
||||||
@@ -58,9 +58,11 @@ public class PlcSrgvRead implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
while (isRun) {
|
while (isRun) {
|
||||||
try {
|
try {
|
||||||
if (IsConnect()) {
|
if (
|
||||||
|
IsConnect()) {
|
||||||
if (deviceSrgv != null) {
|
if (deviceSrgv != null) {
|
||||||
readSrgvPlc(deviceSrgv);
|
readSrgvPlc(deviceSrgv);
|
||||||
|
log.info("=====读取小车开始====IP{}",this.ip);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reConnect();
|
reConnect();
|
||||||
@@ -158,6 +160,7 @@ public class PlcSrgvRead implements Runnable {
|
|||||||
|
|
||||||
public void ConnectServer() {
|
public void ConnectServer() {
|
||||||
modbusTcpNet = new ModbusTcpNet();//创建一个Modbus对象
|
modbusTcpNet = new ModbusTcpNet();//创建一个Modbus对象
|
||||||
|
log.info("创建连接对象,IP{}",this.ip);
|
||||||
try {
|
try {
|
||||||
modbusTcpNet.setIpAddress(this.ip);
|
modbusTcpNet.setIpAddress(this.ip);
|
||||||
modbusTcpNet.setPort(this.port);
|
modbusTcpNet.setPort(this.port);
|
||||||
@@ -200,7 +203,7 @@ public class PlcSrgvRead implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSite(String siteId){
|
public String getSite(String siteId){
|
||||||
if (siteId.equals("030502")||siteId.equals("030501")||siteId.equals("030503")){
|
if (siteId.equals("030602")||siteId.equals("030601")||siteId.equals("030603")){
|
||||||
return "tsj";
|
return "tsj";
|
||||||
}else {
|
}else {
|
||||||
return siteId;
|
return siteId;
|
||||||
|
|||||||
@@ -118,9 +118,16 @@ public class PlcSsjRead implements Runnable {
|
|||||||
OperateResultExOne<byte[]> read4 = modbusTcpNet.Read("1115", (short) 16);//1115 条码
|
OperateResultExOne<byte[]> read4 = modbusTcpNet.Read("1115", (short) 16);//1115 条码
|
||||||
if (read4.IsSuccess) {
|
if (read4.IsSuccess) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (byte b : read4.Content) {
|
for (int i = 0; i < read4.Content.length; i += 2) {
|
||||||
int code = b & 0xFF;
|
if (i + 1 < read4.Content.length) {
|
||||||
if (code >= 32 && code <= 126) sb.append((char) code);
|
int hi = read4.Content[i + 1] & 0xFF;
|
||||||
|
int lo = read4.Content[i] & 0xFF;
|
||||||
|
if (hi >= 32 && hi <= 126) sb.append((char) hi);
|
||||||
|
if (lo >= 32 && lo <= 126) sb.append((char) lo);
|
||||||
|
} else {
|
||||||
|
int single = read4.Content[i] & 0xFF;
|
||||||
|
if (single >= 32 && single <= 126) sb.append((char) single);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String barcode = sb.toString();
|
String barcode = sb.toString();
|
||||||
ssjDevice.setTrayCode(barcode);
|
ssjDevice.setTrayCode(barcode);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class CdzThread implements Runnable {
|
|||||||
|
|
||||||
public boolean isRun = true;
|
public boolean isRun = true;
|
||||||
|
|
||||||
private final Integer LITTLE_BETTERY = 30;
|
private final Integer LITTLE_BETTERY = 60;
|
||||||
private final Integer MIDDLE_BETTERY = 70;
|
private final Integer MIDDLE_BETTERY = 70;
|
||||||
|
|
||||||
private ISrgvChargingJobService chargingJobService;
|
private ISrgvChargingJobService chargingJobService;
|
||||||
@@ -106,12 +106,12 @@ public class CdzThread implements Runnable {
|
|||||||
if (CollUtil.isNotEmpty(srgvChargingJobs)) {
|
if (CollUtil.isNotEmpty(srgvChargingJobs)) {
|
||||||
for (SrgvChargingJob srgvChargingJob : srgvChargingJobs) {
|
for (SrgvChargingJob srgvChargingJob : srgvChargingJobs) {
|
||||||
if ("1".equals(srgvChargingJob.getChargingStatus())) {
|
if ("1".equals(srgvChargingJob.getChargingStatus())) {
|
||||||
int i = PlcCdzRead.writeToCdz("1");
|
// int i = PlcCdzRead.writeToCdz("1");
|
||||||
if (i == 1) {
|
// if (i == 1) {
|
||||||
srgvChargingJob.setChargingStatus("2");
|
srgvChargingJob.setChargingStatus("2");
|
||||||
srgvChargingJob.setChargingDate(DateUtil.formatDateTime(DateUtil.date()));
|
srgvChargingJob.setChargingDate(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
chargingJobService.updateSrgvChargingJob(srgvChargingJob);
|
chargingJobService.updateSrgvChargingJob(srgvChargingJob);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,8 +156,8 @@ public class CdzThread implements Runnable {
|
|||||||
|
|
||||||
for (SrgvChargingJob srgvChargingJob : srgvChargingJobs) {
|
for (SrgvChargingJob srgvChargingJob : srgvChargingJobs) {
|
||||||
if ("0".equals(srgvChargingJob.getChargingStatus())) {
|
if ("0".equals(srgvChargingJob.getChargingStatus())) {
|
||||||
int i = PlcCdzRead.writeToCdz("2");
|
// int i = PlcCdzRead.writeToCdz("2");
|
||||||
if (i == 1) {
|
// if (i == 1) {
|
||||||
srgvChargingJob.setChargingStatus("1");
|
srgvChargingJob.setChargingStatus("1");
|
||||||
srgvChargingJob.setChargingDate(DateUtil.formatDateTime(DateUtil.date()));
|
srgvChargingJob.setChargingDate(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
chargingJobService.updateSrgvChargingJob(srgvChargingJob);
|
chargingJobService.updateSrgvChargingJob(srgvChargingJob);
|
||||||
@@ -165,7 +165,7 @@ public class CdzThread implements Runnable {
|
|||||||
//插入历史
|
//插入历史
|
||||||
chargingJobService.insertHistory(srgvChargingJob.getGuid());
|
chargingJobService.insertHistory(srgvChargingJob.getGuid());
|
||||||
chargingJobService.deleteSrgvChargingJobByGuid(srgvChargingJob.getGuid());
|
chargingJobService.deleteSrgvChargingJobByGuid(srgvChargingJob.getGuid());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ public class MonitoringThread implements Runnable {
|
|||||||
deviceSsjService.updateDeviceSsj(deviceSsj);
|
deviceSsjService.updateDeviceSsj(deviceSsj);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String cdzName : PlcCdzRead.deviceCdzMap.keySet()) {
|
// for (String cdzName : PlcCdzRead.deviceCdzMap.keySet()) {
|
||||||
DeviceCdz deviceCdz = PlcCdzRead.deviceCdzMap.get(cdzName);
|
// DeviceCdz deviceCdz = PlcCdzRead.deviceCdzMap.get(cdzName);
|
||||||
deviceCdzService.updateDeviceCdz(deviceCdz);
|
// deviceCdzService.updateDeviceCdz(deviceCdz);
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (String sRgv : PlcSrgvRead.deviceSrgvMap.keySet()) {
|
for (String sRgv : PlcSrgvRead.deviceSrgvMap.keySet()) {
|
||||||
deviceSrgvService.updateDeviceSrgv(PlcSrgvRead.deviceSrgvMap.get(sRgv));
|
deviceSrgvService.updateDeviceSrgv(PlcSrgvRead.deviceSrgvMap.get(sRgv));
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import com.ruoyi.schedule.plcRead.cdz.PlcCdzRead;
|
|||||||
import com.ruoyi.schedule.plcRead.srgv.PlcSrgvRead;
|
import com.ruoyi.schedule.plcRead.srgv.PlcSrgvRead;
|
||||||
import com.ruoyi.schedule.plcRead.srgv.roadUtil.PathFinder;
|
import com.ruoyi.schedule.plcRead.srgv.roadUtil.PathFinder;
|
||||||
import com.ruoyi.schedule.plcRead.tsj.PlcTsjRead;
|
import com.ruoyi.schedule.plcRead.tsj.PlcTsjRead;
|
||||||
|
import com.ruoyi.schedule.ScheduleThread;
|
||||||
|
import com.ruoyi.common.domain.CustomThread;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -75,7 +77,7 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
sRgvCodeList = new HashMap<>();
|
sRgvCodeList = new HashMap<>();
|
||||||
ArrayList<String> sRgvCodes = new ArrayList<>();
|
ArrayList<String> sRgvCodes = new ArrayList<>();
|
||||||
sRgvCodes.add("1");
|
sRgvCodes.add("1");
|
||||||
// sRgvCodes.add("2");
|
sRgvCodes.add("2");
|
||||||
sRgvCodeList.put("srgv", sRgvCodes);
|
sRgvCodeList.put("srgv", sRgvCodes);
|
||||||
|
|
||||||
wcsSagvQueueMapper = SpringUtils.getBean(IWcsSrgvQueueService.class);
|
wcsSagvQueueMapper = SpringUtils.getBean(IWcsSrgvQueueService.class);
|
||||||
@@ -103,7 +105,7 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
DeviceSrgv deviceSrgv = PlcSrgvRead.deviceSrgvMap.get(code);
|
DeviceSrgv deviceSrgv = PlcSrgvRead.deviceSrgvMap.get(code);
|
||||||
|
|
||||||
sRgvTask(deviceSrgv);
|
sRgvTask(deviceSrgv);
|
||||||
|
//小车创建队列
|
||||||
createCarQueue(deviceSrgv);
|
createCarQueue(deviceSrgv);
|
||||||
|
|
||||||
inCharging(deviceSrgv);
|
inCharging(deviceSrgv);
|
||||||
@@ -145,11 +147,11 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
DeviceCdz deviceCdz = PlcCdzRead.deviceCdzMap.get(chargingId);
|
DeviceCdz deviceCdz = PlcCdzRead.deviceCdzMap.get(chargingId);
|
||||||
if (ObjUtil.isNotNull(deviceCdz)) {
|
if (ObjUtil.isNotNull(deviceCdz)) {
|
||||||
//下发断电任务
|
//下发断电任务
|
||||||
int i = PlcCdzRead.writeToCdz("2");
|
// int i = PlcCdzRead.writeToCdz("2");
|
||||||
if (i == 1) {
|
// if (i == 1) {
|
||||||
srgvChargingJobMapper.insertHistory(srgvChargingJob.getGuid());
|
srgvChargingJobMapper.insertHistory(srgvChargingJob.getGuid());
|
||||||
srgvChargingJobMapper.deleteSrgvChargingJobByGuid(srgvChargingJob.getGuid());
|
srgvChargingJobMapper.deleteSrgvChargingJobByGuid(srgvChargingJob.getGuid());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,8 +177,8 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
String agvId = srgvChargingJob.getAgvId();
|
String agvId = srgvChargingJob.getAgvId();
|
||||||
String chargingId = srgvChargingJob.getChargingId();
|
String chargingId = srgvChargingJob.getChargingId();
|
||||||
DeviceSrgv srgv = PlcSrgvRead.deviceSrgvMap.get(agvId);
|
DeviceSrgv srgv = PlcSrgvRead.deviceSrgvMap.get(agvId);
|
||||||
DeviceCdz cdz = PlcCdzRead.deviceCdzMap.get(chargingId);
|
// DeviceCdz cdz = PlcCdzRead.deviceCdzMap.get(chargingId);
|
||||||
if (srgv.getCurrFloor().equals(cdz.getSzcs())) {
|
if (srgv.getCurrFloor()==1) {
|
||||||
//生成四向小车充电队列
|
//生成四向小车充电队列
|
||||||
String chargingSite = srgvChargingJob.getChargingSite();//充电桩站点
|
String chargingSite = srgvChargingJob.getChargingSite();//充电桩站点
|
||||||
WcsSrgvQueue wcsSrgvQueueParam = new WcsSrgvQueue();
|
WcsSrgvQueue wcsSrgvQueueParam = new WcsSrgvQueue();
|
||||||
@@ -257,57 +259,48 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
if (deviceSrgv.getWorkMode() == 5 && deviceSrgv.getStatus() == 1) {
|
if (deviceSrgv.getWorkMode() == 5 && deviceSrgv.getStatus() == 1) {
|
||||||
WcsSrgvQueue wcsSrgvQueue = wcsSagvQueueMapper.selectWcsSrgvQueueByAgvId(deviceSrgv.getDeviceId().toString());
|
WcsSrgvQueue wcsSrgvQueue = wcsSagvQueueMapper.selectWcsSrgvQueueByAgvId(deviceSrgv.getDeviceId().toString());
|
||||||
if (wcsSrgvQueue == null) {
|
if (wcsSrgvQueue == null) {
|
||||||
//找小车当前层作业,生成队列
|
List<MydoJob> inMydoJobs = mydoJobService.selectInJobList(deviceSrgv.getCurrFloor().toString());
|
||||||
//如果没有当前层作业,就找最近层换层作业,生成队列
|
//找小车当前层入库作业,生成队列
|
||||||
MydoJob mydoJob1 = new MydoJob();
|
if (!inMydoJobs.isEmpty()) {
|
||||||
mydoJob1.setTheFloor(deviceSrgv.getCurrFloor().toString());
|
//生成了从小车现在位置到提升机接货的队列 更新作业执行阶段为小车搬运
|
||||||
mydoJob1.setInOrOut("1");//货物入库
|
createCarQueue(inMydoJobs.get(0), deviceSrgv, "4", "0");
|
||||||
mydoJob1.setStatus("3");
|
|
||||||
// todo 定提升机到达阶段
|
|
||||||
mydoJob1.setExecutionPhase("3");
|
|
||||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(mydoJob1);
|
|
||||||
if (mydoJobs.isEmpty()) {
|
|
||||||
mydoJob1.setInOrOut("3");//空托盘入库
|
|
||||||
mydoJobs = mydoJobService.selectMydoJobList(mydoJob1);
|
|
||||||
}
|
|
||||||
if (!mydoJobs.isEmpty()) {
|
|
||||||
//生成了从小车现在位置到提升机接货的队列
|
|
||||||
createCarQueue(mydoJobs.get(0), deviceSrgv, "4", "0");
|
|
||||||
} else {
|
} else {
|
||||||
List<MydoJob> mydoJobs1 = mydoJobService.selectOutJobList(deviceSrgv.getCurrFloor().toString());
|
//找小车当前层出库作业,生成队列
|
||||||
|
List<MydoJob> outMydoJobs = mydoJobService.selectOutJobList(deviceSrgv.getCurrFloor().toString());
|
||||||
//当前层出库作业
|
//当前层出库作业
|
||||||
if (!mydoJobs1.isEmpty()) {
|
if (!outMydoJobs.isEmpty()) {
|
||||||
//找最外层作业存储过程
|
//找最外层作业存储过程
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("v_layer", deviceSrgv.getCurrFloor());
|
map.put("v_layer", deviceSrgv.getCurrFloor());
|
||||||
mydoJobService.selectMydoJobOutside(map);
|
mydoJobService.selectMydoJobOutside(map);
|
||||||
String jobId = map.get("v_job_ids").toString();
|
String jobId = map.get("v_job_ids").toString();
|
||||||
MydoJob mydoJob2 = mydoJobService.selectMydoJobByJobId(jobId);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(jobId);
|
||||||
//判断小车当前点是否是出库作业货位点,如果不是,就生成队列{},如果是生成已下发队列
|
//判断小车当前点是否是出库作业货位点,如果不是,就生成队列{},如果是生成已下发队列
|
||||||
WcsSrgvMap wcsSrgvMap = new WcsSrgvMap();
|
WcsSrgvMap wcsSrgvMap = new WcsSrgvMap();
|
||||||
wcsSrgvMap.setCargoSpaceId(mydoJob2.getCargoSpaceId());
|
wcsSrgvMap.setCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||||
List<WcsSrgvMap> wcsSrgvMaps = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap);
|
List<WcsSrgvMap> wcsSrgvMaps = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap);
|
||||||
if (!deviceSrgv.getCurrSite().equals(wcsSrgvMaps.get(0).getSiteId())) {
|
if (!deviceSrgv.getCurrSite().equals(wcsSrgvMaps.get(0).getSiteId())) {
|
||||||
createCarQueue(mydoJob2, deviceSrgv, "4", "0");
|
createCarQueue(mydoJob, deviceSrgv, "4", "0");
|
||||||
} else {
|
} else {
|
||||||
createCarQueue(mydoJob2, deviceSrgv, "4", "1");
|
createCarQueue(mydoJob, deviceSrgv, "4", "1");
|
||||||
}
|
}
|
||||||
mydoJob2.setStatus("3");
|
mydoJob.setStatus("3");//更新小车出库作业状态为正执行
|
||||||
mydoJobService.updateMydoJob(mydoJob2);
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
} else {
|
} else {
|
||||||
//别的层的出库作业和入库作业
|
//别的层的出库作业和入库作业
|
||||||
MydoJob job = null;
|
MydoJob job = null;
|
||||||
MydoJob mydoJob3 = new MydoJob();
|
MydoJob mydoJob3 = new MydoJob();
|
||||||
mydoJob3.setStatus("3");
|
|
||||||
mydoJob3.setInOut("1");
|
mydoJob3.setInOut("1");
|
||||||
|
mydoJob3.setStatus("3");
|
||||||
//todo 输送机阶段
|
//todo 输送机阶段
|
||||||
|
|
||||||
mydoJob3.setExecutionPhase("1");
|
mydoJob3.setExecutionPhase("1");
|
||||||
List<MydoJob> mydoJobs4 = mydoJobService.selectMydoJobList(mydoJob3);
|
List<MydoJob> mydoJobs4 = mydoJobService.selectMydoJobList(mydoJob3);
|
||||||
if (!mydoJobs4.isEmpty()) {
|
if (!mydoJobs4.isEmpty()) {
|
||||||
job = mydoJobs4.get(0);
|
job = mydoJobs4.get(0);
|
||||||
} else {
|
} else {
|
||||||
MydoJob mydoJob2 = new MydoJob();
|
MydoJob mydoJob2 = new MydoJob();
|
||||||
mydoJob2.setInOut("2");
|
mydoJob3.setInOut("2");
|
||||||
mydoJob2.setStatus("1");
|
mydoJob2.setStatus("1");
|
||||||
List<MydoJob> mydoJobs3 = mydoJobService.selectMydoJobList(mydoJob2);
|
List<MydoJob> mydoJobs3 = mydoJobService.selectMydoJobList(mydoJob2);
|
||||||
if (!mydoJobs3.isEmpty()) {
|
if (!mydoJobs3.isEmpty()) {
|
||||||
@@ -367,14 +360,14 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
//根据任务类型 ,生成队列
|
//根据任务类型 ,生成队列
|
||||||
if (Convert.toInt(mydoJob.getInOrOut()) < 20) {
|
if (Convert.toInt(mydoJob.getInOrOut()) < 20) {
|
||||||
wcsSagvQueueMapper.insertHistory(wcsSrgvQueue.getTaskNo());
|
wcsSagvQueueMapper.insertHistory(wcsSrgvQueue.getTaskNo());
|
||||||
wcsSagvQueueMapper.deleteWcsSrgvQueueByGuid(wcsSrgvQueue.getGuid());
|
|
||||||
createCarQueue(mydoJob, deviceSrgv, "1", "0");
|
createCarQueue(mydoJob, deviceSrgv, "1", "0");
|
||||||
|
wcsSagvQueueMapper.deleteWcsSrgvQueueByGuid(wcsSrgvQueue.getGuid());
|
||||||
} else {
|
} else {
|
||||||
wcsSagvQueueMapper.insertHistory(wcsSrgvQueue.getTaskNo());
|
wcsSagvQueueMapper.insertHistory(wcsSrgvQueue.getTaskNo());
|
||||||
|
createCarQueue(mydoJob, deviceSrgv, "2", "0");
|
||||||
wcsSagvQueueMapper.deleteWcsSrgvQueueByGuid(wcsSrgvQueue.getGuid());
|
wcsSagvQueueMapper.deleteWcsSrgvQueueByGuid(wcsSrgvQueue.getGuid());
|
||||||
mydoJob.setStatus("3");//作业修改为正执行
|
mydoJob.setStatus("3");//作业修改为正执行
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
createCarQueue(mydoJob, deviceSrgv, "2", "0");
|
|
||||||
}
|
}
|
||||||
} else if (deviceSrgv.getCurrSite().equals(wcsSrgvQueue.getDefault03()) && "8".equals(wcsSrgvQueue.getTaskType())) {
|
} else if (deviceSrgv.getCurrSite().equals(wcsSrgvQueue.getDefault03()) && "8".equals(wcsSrgvQueue.getTaskType())) {
|
||||||
wcsSagvQueueMapper.insertHistory(wcsSrgvQueue.getTaskNo());
|
wcsSagvQueueMapper.insertHistory(wcsSrgvQueue.getTaskNo());
|
||||||
@@ -419,18 +412,19 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
WcsSrgvMap wcsSrgvMap1 = new WcsSrgvMap();
|
WcsSrgvMap wcsSrgvMap1 = new WcsSrgvMap();
|
||||||
//TODO 小车取货之后会不会退出来,会退出来是4 不会退出来是3
|
//TODO 小车取货之后会不会退出来,会退出来是4 不会退出来是3
|
||||||
wcsSrgvMap1.setTheRow(4);
|
wcsSrgvMap1.setTheRow(4);
|
||||||
wcsSrgvMap1.setTheColumn(5);
|
wcsSrgvMap1.setTheColumn(6);
|
||||||
wcsSrgvMap1.setTheLayer(Convert.toInt(mydoJob1.getTheFloor()));
|
wcsSrgvMap1.setTheLayer(Convert.toInt(mydoJob1.getTheFloor()));
|
||||||
List<WcsSrgvMap> wcsSrgvMaps1 = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap1);
|
List<WcsSrgvMap> wcsSrgvMaps1 = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap1);
|
||||||
//点到点任务
|
//点到点任务
|
||||||
if (Integer.parseInt(mydoJob1.getInOrOut()) < 20 && "4".equals(taskType)) {
|
if (Integer.parseInt(mydoJob1.getInOrOut()) < 20 && "4".equals(taskType)) {
|
||||||
wcsSrgvQueue.setStartSite(deviceSrgv.getCurrSite());
|
wcsSrgvQueue.setStartSite(deviceSrgv.getCurrSite());
|
||||||
wcsSrgvQueue.setEndSite("tsj");
|
wcsSrgvQueue.setEndSite("tsj");
|
||||||
//入库的点到点直接进入提升机 不选停靠点 default03 是0305
|
//入库的点到点直接进入提升机 不选停靠点 default03 是0306
|
||||||
wcsSrgvMap1.setTheRow(3);
|
wcsSrgvMap1.setTheRow(3);
|
||||||
wcsSrgvMap1.setTheColumn(5);
|
wcsSrgvMap1.setTheColumn(6);
|
||||||
wcsSrgvMap1.setTheLayer(Convert.toInt(mydoJob1.getTheFloor()));
|
wcsSrgvMap1.setTheLayer(Convert.toInt(mydoJob1.getTheFloor()));
|
||||||
wcsSrgvMaps1 = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap1);
|
wcsSrgvMaps1 = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap1);
|
||||||
|
wcsSrgvQueue.setCargoPickSite("tsj");
|
||||||
wcsSrgvQueue.setDefault03(wcsSrgvMaps1.get(0).getSiteId());
|
wcsSrgvQueue.setDefault03(wcsSrgvMaps1.get(0).getSiteId());
|
||||||
} else if (Integer.parseInt(mydoJob1.getInOrOut()) < 20 && "1".equals(taskType)) {
|
} else if (Integer.parseInt(mydoJob1.getInOrOut()) < 20 && "1".equals(taskType)) {
|
||||||
wcsSrgvQueue.setStartSite("tsj");
|
wcsSrgvQueue.setStartSite("tsj");
|
||||||
@@ -438,9 +432,9 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
wcsSrgvMap.setCargoSpaceId(mydoJob1.getCargoSpaceId());
|
wcsSrgvMap.setCargoSpaceId(mydoJob1.getCargoSpaceId());
|
||||||
List<WcsSrgvMap> wcsSrgvMaps = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap);
|
List<WcsSrgvMap> wcsSrgvMaps = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap);
|
||||||
wcsSrgvQueue.setEndSite(wcsSrgvMaps.get(0).getSiteId());
|
wcsSrgvQueue.setEndSite(wcsSrgvMaps.get(0).getSiteId());
|
||||||
//入库的点到点从030501 到目标货位
|
//入库的点到点从030601 到目标货位
|
||||||
wcsSrgvMap1.setTheRow(3);
|
wcsSrgvMap1.setTheRow(3);
|
||||||
wcsSrgvMap1.setTheColumn(5);
|
wcsSrgvMap1.setTheColumn(6);
|
||||||
wcsSrgvMap1.setTheLayer(Convert.toInt(mydoJob1.getTheFloor()));
|
wcsSrgvMap1.setTheLayer(Convert.toInt(mydoJob1.getTheFloor()));
|
||||||
wcsSrgvMaps1 = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap1);
|
wcsSrgvMaps1 = wcsSrgvMapService.selectWcsSrgvMapList(wcsSrgvMap1);
|
||||||
wcsSrgvQueue.setDefault03(wcsSrgvMaps1.get(0).getSiteId());
|
wcsSrgvQueue.setDefault03(wcsSrgvMaps1.get(0).getSiteId());
|
||||||
@@ -495,7 +489,6 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
&& deviceSrgv.getAllowSend() == 1 //允许下发
|
&& deviceSrgv.getAllowSend() == 1 //允许下发
|
||||||
) {
|
) {
|
||||||
//处理tsj站点 换层去提升机前 入库去提升机里 出库去提升机里
|
//处理tsj站点 换层去提升机前 入库去提升机里 出库去提升机里
|
||||||
|
|
||||||
String startSite = getSite(wcsSrgvQueue.getStartSite(), wcsSrgvQueue.getTheFloor(), wcsSrgvQueue.getTaskType());
|
String startSite = getSite(wcsSrgvQueue.getStartSite(), wcsSrgvQueue.getTheFloor(), wcsSrgvQueue.getTaskType());
|
||||||
String endSite = getSite(wcsSrgvQueue.getEndSite(), wcsSrgvQueue.getTheFloor(), wcsSrgvQueue.getTaskType());
|
String endSite = getSite(wcsSrgvQueue.getEndSite(), wcsSrgvQueue.getTheFloor(), wcsSrgvQueue.getTaskType());
|
||||||
String currSite = deviceSrgv.getCurrSite();
|
String currSite = deviceSrgv.getCurrSite();
|
||||||
@@ -512,9 +505,7 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小车发送点对点任务
|
* 小车发送点对点任务
|
||||||
*/
|
*/
|
||||||
@@ -631,13 +622,13 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
if (endSite.equals("tsj")) {
|
if (endSite.equals("tsj")) {
|
||||||
switch (wcsSrgvQueue.getTheFloor()) {
|
switch (wcsSrgvQueue.getTheFloor()) {
|
||||||
case "1":
|
case "1":
|
||||||
endSite = "030501";
|
endSite = "030601";
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
endSite = "030502";
|
endSite = "030602";
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
endSite = "030503";
|
endSite = "030603";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -646,13 +637,13 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
if (startSite.equals("tsj")) {
|
if (startSite.equals("tsj")) {
|
||||||
switch (wcsSrgvQueue.getTheFloor()) {
|
switch (wcsSrgvQueue.getTheFloor()) {
|
||||||
case "1":
|
case "1":
|
||||||
startSite = "030501";
|
startSite = "030601";
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
startSite = "030502";
|
startSite = "030602";
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
startSite = "030503";
|
startSite = "030603";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -668,7 +659,7 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
} else {
|
} else {
|
||||||
SendData2 path = new SendData2();
|
SendData2 path = new SendData2();
|
||||||
path.setAddress("4004");//地址
|
path.setAddress("4004");//地址
|
||||||
path.setData(startSite + "," + endSite);
|
path.setData(startSite + "," + endSite+",0,0,0,0,0,0");
|
||||||
path.setType(2);
|
path.setType(2);
|
||||||
sendDataList.add(path);
|
sendDataList.add(path);
|
||||||
}
|
}
|
||||||
@@ -766,6 +757,13 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
|
|
||||||
boolean b = true;
|
boolean b = true;
|
||||||
|
|
||||||
|
ScheduleThread scheduleThread = SpringUtils.getBean(ScheduleThread.class);
|
||||||
|
CustomThread<?> ct = scheduleThread.threadMap.get("plcSrgvReadCustomThread" + deviceSrgv.getDeviceId());
|
||||||
|
PlcSrgvRead plcReader = ct != null ? (PlcSrgvRead) ct.getRunnable() : null;
|
||||||
|
if (plcReader == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (SendData2 sendData : sendDataList) {
|
for (SendData2 sendData : sendDataList) {
|
||||||
String address = sendData.getAddress();
|
String address = sendData.getAddress();
|
||||||
String data = sendData.getData();//
|
String data = sendData.getData();//
|
||||||
@@ -780,7 +778,7 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
.map(String::trim)
|
.map(String::trim)
|
||||||
.mapToInt(Integer::parseInt)
|
.mapToInt(Integer::parseInt)
|
||||||
.toArray();
|
.toArray();
|
||||||
boolean write = PlcSrgvRead.Write(address, intData);
|
boolean write = plcReader.write(address, intData);
|
||||||
|
|
||||||
if (!write) {
|
if (!write) {
|
||||||
b = false;
|
b = false;
|
||||||
@@ -802,7 +800,7 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean write = PlcSrgvRead.Write(address, shortData);
|
boolean write = plcReader.write(address, shortData);
|
||||||
|
|
||||||
if (!write) {
|
if (!write) {
|
||||||
b = false;
|
b = false;
|
||||||
@@ -969,19 +967,47 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
WcsSrgvQueue wcsSrgvQueue = wcsSrgvQueues.get(0);
|
WcsSrgvQueue wcsSrgvQueue = wcsSrgvQueues.get(0);
|
||||||
|
|
||||||
String startSite = null;
|
String startSite = null;
|
||||||
//打补丁 出库任务的default03 是040501 提升机前
|
//打补丁 出库任务的default03 是040601 提升机前
|
||||||
if (wcsSrgvQueue.getTaskType().equals("2")) {
|
|
||||||
startSite = wcsSrgvQueue.getStartSite();
|
|
||||||
}else {
|
|
||||||
startSite = wcsSrgvQueue.getDefault03();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// if (wcsSrgvQueue.getTaskType().equals("4")) {
|
||||||
|
// startSite = wcsSrgvQueue.getStartSite();
|
||||||
|
// }
|
||||||
|
// if (wcsSrgvQueue.getTaskType().equals("2")) {
|
||||||
|
// startSite = wcsSrgvQueue.getStartSite();
|
||||||
|
// }else {
|
||||||
|
// if(wcsSrgvQueue.getStartSite().equals("040601")){
|
||||||
|
// startSite=wcsSrgvQueue.getStartSite();
|
||||||
|
// }else {
|
||||||
|
// startSite = wcsSrgvQueue.getDefault03();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
startSite = wcsSrgvQueue.getStartSite();
|
||||||
|
if (startSite.equals("tsj")){
|
||||||
|
startSite=getSite(wcsSrgvQueue.getStartSite(),wcsSrgvQueue.getTheFloor(),wcsSrgvQueue.getTaskType());
|
||||||
|
}
|
||||||
if (!startSite.equals(currSite)) {
|
if (!startSite.equals(currSite)) {
|
||||||
wcsSrgvQueue.setIssued("1");
|
wcsSrgvQueue.setIssued("1");
|
||||||
wcsSrgvQueue.setExecutionStatus("3");
|
wcsSrgvQueue.setExecutionStatus("3");
|
||||||
wcsSrgvQueue.setStartDate(DateUtil.now());
|
wcsSrgvQueue.setStartDate(DateUtil.now());
|
||||||
wcsSagvQueueMapper.updateWcsSrgvQueue(wcsSrgvQueue);
|
wcsSagvQueueMapper.updateWcsSrgvQueue(wcsSrgvQueue);
|
||||||
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(wcsSrgvQueue.getTaskNo()));
|
||||||
|
mydoJob.setExecutionPhase("4");//小车搬运
|
||||||
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
}
|
}
|
||||||
|
String endSite = wcsSrgvQueue.getEndSite();
|
||||||
|
if (endSite.equals("tsj")){
|
||||||
|
endSite=getSite(wcsSrgvQueue.getEndSite(),wcsSrgvQueue.getTheFloor(),wcsSrgvQueue.getTaskType());
|
||||||
|
}
|
||||||
|
if (endSite.equals(currSite)) {
|
||||||
|
wcsSrgvQueue.setIssued("1");
|
||||||
|
wcsSrgvQueue.setExecutionStatus("3");
|
||||||
|
wcsSrgvQueue.setStartDate(DateUtil.now());
|
||||||
|
wcsSagvQueueMapper.updateWcsSrgvQueue(wcsSrgvQueue);
|
||||||
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(Long.valueOf(wcsSrgvQueue.getTaskNo()));
|
||||||
|
mydoJob.setExecutionPhase("4");//小车搬运
|
||||||
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -991,13 +1017,13 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
if (sitId.equals("tsj")) {
|
if (sitId.equals("tsj")) {
|
||||||
switch (floor) {
|
switch (floor) {
|
||||||
case "1":
|
case "1":
|
||||||
sitId = "040501";
|
sitId = "040601";
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
sitId = "040502";
|
sitId = "040602";
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
sitId = "040503";
|
sitId = "040603";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1007,13 +1033,13 @@ public class BaseSRgvThread implements Runnable, SRgvThreadInterface {
|
|||||||
if (sitId.equals("tsj")) {
|
if (sitId.equals("tsj")) {
|
||||||
switch (floor) {
|
switch (floor) {
|
||||||
case "1":
|
case "1":
|
||||||
sitId = "030501";
|
sitId = "030601";
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
sitId = "030502";
|
sitId = "030602";
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
sitId = "030503";
|
sitId = "030603";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ public class SsjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +88,14 @@ public class SsjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void inDispatch1(DeviceSsj deviceSsj) {
|
void inDispatch1(DeviceSsj deviceSsj) {
|
||||||
if (deviceSsj.getRkqq() == 1 && StrUtil.isNotBlank(deviceSsj.getTrayCode())) {
|
if (deviceSsj.getRkqq() == 1 ) {
|
||||||
|
if(deviceSsj.getTrayCode().equals("NoRead")||StrUtil.isBlank(deviceSsj.getTrayCode())){
|
||||||
|
int i = PlcSsjRead.writeToSsj("0", 11, 1);
|
||||||
|
if (i == 1) {
|
||||||
|
log.info(deviceSsj.getDeviceCode() + "未读到条码,下发退回,去向2");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 查是否有正执行的出库作业,有退回
|
// 查是否有正执行的出库作业,有退回
|
||||||
MydoJob queryJob = new MydoJob();
|
MydoJob queryJob = new MydoJob();
|
||||||
queryJob.setStatus("3");
|
queryJob.setStatus("3");
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ import com.ruoyi.device.srgv.service.IDeviceSrgvService;
|
|||||||
import com.ruoyi.device.srgv.service.impl.DeviceSrgvServiceImpl;
|
import com.ruoyi.device.srgv.service.impl.DeviceSrgvServiceImpl;
|
||||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||||
import com.ruoyi.device.tsj.domain.DeviceTsj;
|
import com.ruoyi.device.tsj.domain.DeviceTsj;
|
||||||
|
import com.ruoyi.job.domain.JobCallBack;
|
||||||
import com.ruoyi.job.domain.MydoJob;
|
import com.ruoyi.job.domain.MydoJob;
|
||||||
|
import com.ruoyi.job.service.IJobCallBackService;
|
||||||
import com.ruoyi.job.service.IMydoJobService;
|
import com.ruoyi.job.service.IMydoJobService;
|
||||||
import com.ruoyi.queue.srgv.domain.WcsSrgvQueue;
|
import com.ruoyi.queue.srgv.domain.WcsSrgvQueue;
|
||||||
import com.ruoyi.queue.srgv.service.IWcsSrgvQueueService;
|
import com.ruoyi.queue.srgv.service.IWcsSrgvQueueService;
|
||||||
@@ -42,7 +44,7 @@ public class TsjThread implements Runnable {
|
|||||||
private HashMap<String, String> inSsjList;
|
private HashMap<String, String> inSsjList;
|
||||||
private IMydoJobService mydoJobService;
|
private IMydoJobService mydoJobService;
|
||||||
private IDeviceSrgvService deviceSrgvService;
|
private IDeviceSrgvService deviceSrgvService;
|
||||||
|
private IJobCallBackService jobCallBackService;
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
tsjDeviceExecutionQueueService = SpringUtils.getBean(ITsjDeviceExecutionQueueService.class);
|
tsjDeviceExecutionQueueService = SpringUtils.getBean(ITsjDeviceExecutionQueueService.class);
|
||||||
@@ -51,6 +53,7 @@ public class TsjThread implements Runnable {
|
|||||||
wcsSrgvQueueService = SpringUtils.getBean(IWcsSrgvQueueService.class);
|
wcsSrgvQueueService = SpringUtils.getBean(IWcsSrgvQueueService.class);
|
||||||
mydoJobService =SpringUtils.getBean(IMydoJobService.class);
|
mydoJobService =SpringUtils.getBean(IMydoJobService.class);
|
||||||
deviceSrgvService=SpringUtils.getBean(DeviceSrgvServiceImpl.class);
|
deviceSrgvService=SpringUtils.getBean(DeviceSrgvServiceImpl.class);
|
||||||
|
jobCallBackService = SpringUtils.getBean(IJobCallBackService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -64,6 +67,12 @@ public class TsjThread implements Runnable {
|
|||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +85,7 @@ public class TsjThread implements Runnable {
|
|||||||
Long rwh = tsj.getRwh();//任务号
|
Long rwh = tsj.getRwh();//任务号
|
||||||
int yxxf = tsj.getYxxf();//允许下发
|
int yxxf = tsj.getYxxf();//允许下发
|
||||||
|
|
||||||
if (czfs == 1 && sbzt == 98 && jdbz == 11 && rwh > 999) {
|
if (czfs == 1 && sbzt == 99 && (jdbz == 0||jdbz == 11||jdbz == 8) && rwh > 999) {
|
||||||
//任务完成
|
//任务完成
|
||||||
finishTask(tsj);
|
finishTask(tsj);
|
||||||
}
|
}
|
||||||
@@ -107,9 +116,11 @@ public class TsjThread implements Runnable {
|
|||||||
if (CollUtil.isNotEmpty(wcsSrgvQueues)) {
|
if (CollUtil.isNotEmpty(wcsSrgvQueues)) {
|
||||||
WcsSrgvQueue wcsSrgvQueue = wcsSrgvQueues.get(0);
|
WcsSrgvQueue wcsSrgvQueue = wcsSrgvQueues.get(0);
|
||||||
String rwlx = "";
|
String rwlx = "";
|
||||||
|
String tarFloor = wcsSrgvQueue.getDefault07();
|
||||||
if ("2".equals(wcsSrgvQueue.getTaskType())) {
|
if ("2".equals(wcsSrgvQueue.getTaskType())) {
|
||||||
//出库
|
//出库
|
||||||
rwlx = "2";
|
rwlx = "2";
|
||||||
|
tarFloor="11";
|
||||||
}
|
}
|
||||||
if ("3".equals(wcsSrgvQueue.getTaskType())) {
|
if ("3".equals(wcsSrgvQueue.getTaskType())) {
|
||||||
//
|
//
|
||||||
@@ -122,8 +133,6 @@ public class TsjThread implements Runnable {
|
|||||||
TsjDeviceExecutionQueue tsjDeviceExecutionQueueByRwh = tsjDeviceExecutionQueueService.selectTsjDeviceExecutionQueueByRwh(Convert.toLong(deviceSrgv.getTaskNo()));
|
TsjDeviceExecutionQueue tsjDeviceExecutionQueueByRwh = tsjDeviceExecutionQueueService.selectTsjDeviceExecutionQueueByRwh(Convert.toLong(deviceSrgv.getTaskNo()));
|
||||||
if (tsjDeviceExecutionQueueByRwh == null && StrUtil.isNotEmpty(rwlx)) {
|
if (tsjDeviceExecutionQueueByRwh == null && StrUtil.isNotEmpty(rwlx)) {
|
||||||
String strFloor = wcsSrgvQueue.getTheFloor();
|
String strFloor = wcsSrgvQueue.getTheFloor();
|
||||||
String tarFloor = wcsSrgvQueue.getDefault07();
|
|
||||||
if (!Convert.toStr(tsj.getDqcs()).equals(strFloor)) {
|
|
||||||
//提升机层数和取车任务层数不一致
|
//提升机层数和取车任务层数不一致
|
||||||
//todo 判断目标楼层存在不存在其他小车
|
//todo 判断目标楼层存在不存在其他小车
|
||||||
TsjDeviceExecutionQueue tsjDeviceExecutionQueue = new TsjDeviceExecutionQueue();
|
TsjDeviceExecutionQueue tsjDeviceExecutionQueue = new TsjDeviceExecutionQueue();
|
||||||
@@ -141,8 +150,6 @@ public class TsjThread implements Runnable {
|
|||||||
tsjDeviceExecutionQueue.setTaskType("1");
|
tsjDeviceExecutionQueue.setTaskType("1");
|
||||||
tsjDeviceExecutionQueue.setRwlx(rwlx);
|
tsjDeviceExecutionQueue.setRwlx(rwlx);
|
||||||
tsjDeviceExecutionQueueService.insertTsjDeviceExecutionQueue(tsjDeviceExecutionQueue);
|
tsjDeviceExecutionQueueService.insertTsjDeviceExecutionQueue(tsjDeviceExecutionQueue);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,7 +192,7 @@ public class TsjThread implements Runnable {
|
|||||||
tsjDeviceExecutionQueue.setDeviceName(tsj.getName());
|
tsjDeviceExecutionQueue.setDeviceName(tsj.getName());
|
||||||
tsjDeviceExecutionQueue.setTaskNo(Convert.toLong(ssj.getTaskNo()));
|
tsjDeviceExecutionQueue.setTaskNo(Convert.toLong(ssj.getTaskNo()));
|
||||||
tsjDeviceExecutionQueue.setSrcRow("0");
|
tsjDeviceExecutionQueue.setSrcRow("0");
|
||||||
tsjDeviceExecutionQueue.setSrcLayer(String.valueOf(tsj.getDqcs()));
|
tsjDeviceExecutionQueue.setSrcLayer("11");
|
||||||
tsjDeviceExecutionQueue.setTarRow("0");
|
tsjDeviceExecutionQueue.setTarRow("0");
|
||||||
tsjDeviceExecutionQueue.setTarLayer(theFloor);
|
tsjDeviceExecutionQueue.setTarLayer(theFloor);
|
||||||
tsjDeviceExecutionQueue.setSendType("1");
|
tsjDeviceExecutionQueue.setSendType("1");
|
||||||
@@ -244,7 +251,7 @@ public class TsjThread implements Runnable {
|
|||||||
if (ObjUtil.isNotNull(tsjDeviceExecutionQueue)) {
|
if (ObjUtil.isNotNull(tsjDeviceExecutionQueue)) {
|
||||||
//完成提升机任务 插入历史表
|
//完成提升机任务 插入历史表
|
||||||
String senFlag= tsjDeviceExecutionQueue.getSendFlag()==null?"0":"1";
|
String senFlag= tsjDeviceExecutionQueue.getSendFlag()==null?"0":"1";
|
||||||
if (tsjDeviceExecutionQueue.getTarLayer().equals(String.valueOf(tsj.getDqcs()))&&senFlag.equals("1")){
|
if ((tsjDeviceExecutionQueue.getTarLayer().equals(String.valueOf(tsj.getDqcs()))||tsjDeviceExecutionQueue.getTarLayer().equals("11"))&&senFlag.equals("1")){
|
||||||
TsjDeviceExecutionQueueFinish tsjDeviceExecutionQueueFinish = new TsjDeviceExecutionQueueFinish();
|
TsjDeviceExecutionQueueFinish tsjDeviceExecutionQueueFinish = new TsjDeviceExecutionQueueFinish();
|
||||||
BeanUtil.copyProperties(tsjDeviceExecutionQueue, tsjDeviceExecutionQueueFinish);
|
BeanUtil.copyProperties(tsjDeviceExecutionQueue, tsjDeviceExecutionQueueFinish);
|
||||||
tsjDeviceExecutionQueueFinish.setFinishDate(DateUtil.formatDateTime(DateUtil.date()));
|
tsjDeviceExecutionQueueFinish.setFinishDate(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
@@ -255,6 +262,19 @@ public class TsjThread implements Runnable {
|
|||||||
mydoJob.setExecutionPhase("3");
|
mydoJob.setExecutionPhase("3");
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
}
|
}
|
||||||
|
if (mydoJob != null&&tsjDeviceExecutionQueue.getRwlx().equals("2")) {
|
||||||
|
mydoJob.setStatus("4");
|
||||||
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
|
mydoJobService.insertHistory(mydoJob.getJobId());
|
||||||
|
mydoJobService.deleteMydoJobByJobId(mydoJob.getJobId());
|
||||||
|
JobCallBack jobCallBack = new JobCallBack();
|
||||||
|
jobCallBack.setType("2");
|
||||||
|
jobCallBack.setMydojobId(mydoJob.getJobId());
|
||||||
|
jobCallBack.setStatus("0");
|
||||||
|
jobCallBack.setTaskNo(Convert.toLong(mydoJob.getTaskNo()));
|
||||||
|
jobCallBack.setCreateTime(new Date());
|
||||||
|
jobCallBackService.insertJobCallBack(jobCallBack);
|
||||||
|
}
|
||||||
log.info("提升机任务下发完成 taskNo{} 任务类型:{}", tsj.getRwh(), "提升机任务");
|
log.info("提升机任务下发完成 taskNo{} 任务类型:{}", tsj.getRwh(), "提升机任务");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
#主数据信息
|
#主数据信息
|
||||||
master:
|
master:
|
||||||
url: jdbc:sqlserver://172.16.2.170:1433;databaseName=FT542-wcs;
|
url: jdbc:sqlserver://192.168.10.200:1433;databaseName=FT542-wcs;
|
||||||
username: sa
|
username: sa
|
||||||
password: Flrd0914.
|
password: Flrd0914.
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ spring:
|
|||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 172.16.2.170
|
host: 192.168.10.200
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="theFloor != null and theFloor != ''"> and the_floor = #{theFloor}</if>
|
<if test="theFloor != null and theFloor != ''"> and the_floor = #{theFloor}</if>
|
||||||
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
|
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
|
||||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||||
|
<if test="inOut != null and inOut != '' and inOut == '1'"> and in_or_out < 20 </if>
|
||||||
|
<if test="inOut != null and inOut != '' and inOut == '2'"> and in_or_out >= 20</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -262,6 +264,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
<select id="selectOutJobList" resultMap="MydoJobResult">
|
<select id="selectOutJobList" resultMap="MydoJobResult">
|
||||||
<include refid="selectMydoJobVo"/>
|
<include refid="selectMydoJobVo"/>
|
||||||
where status=1 and in_or_out >20 and the_floor =#{theFloor}
|
where status=1 and in_or_out >=20 and the_floor =#{theFloor}
|
||||||
|
</select>
|
||||||
|
<select id="selectInJobList" resultMap="MydoJobResult">
|
||||||
|
<include refid="selectMydoJobVo"/>
|
||||||
|
where status=3 and in_or_out < 20 and the_floor =#{theFloor} and execution_phase=3
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user