This commit is contained in:
李广豪 2022-03-23 09:36:54 +08:00
parent 186a28bffc
commit 4531db10da
6 changed files with 28 additions and 24 deletions

View File

@ -51,10 +51,10 @@
<spring.redis.password><![CDATA["@WSXcde3"]]></spring.redis.password>
<spring.redis.database>5</spring.redis.database>-->
<!-- database -->
<spring.datasource.url>jdbc:p6spy:mysql://mysql.picaiba.com:30307/mt_wms_qj?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false
<spring.datasource.url>jdbc:p6spy:mysql://192.168.6.51:30306/mt_wms_qj?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false
</spring.datasource.url>
<spring.datasource.username>root</spring.datasource.username>
<spring.datasource.password>1qaz@WSX3edc$RFV</spring.datasource.password>
<spring.datasource.password>ABC.10086</spring.datasource.password>
<!-- email -->
<spring.mail.host>smtp.mxhichina.com</spring.mail.host>
<!-- #25 ssl 465 -->

View File

@ -79,7 +79,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv2CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(2, currTaskId, 39);
Integer status = moveRgv(2, currTaskId, 2,0);
if (status!=1){
logger.info("===执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败");
@ -93,7 +93,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv1CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(1, currTaskId, 1);
Integer status = moveRgv(1, currTaskId, 12,0);
if (status!=1){
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败");
@ -155,7 +155,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(),currTask.getTargetPosition(), rgv2CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(2, currTaskId, 39);
Integer status = moveRgv(2, currTaskId, 2,0);
if (status!=1){
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败");
@ -169,7 +169,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId,location.getCode(),currTask.getTargetPosition(), rgv1CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(1, currTaskId, 1);
Integer status = moveRgv(1, currTaskId, 12,0);
if (status!=1){
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败");
@ -210,10 +210,14 @@ public class AsynRunTaskService extends BaseService {
BeanUtils.copyProperties(inStockInfo,inStockInfoHis);
inStockInfoHisServiceBiz.save(inStockInfoHis);
inStockInfoServiceBiz.removeById(inStockInfo);
//更改库位状态
location.setStatus(0);
locationServiceBiz.updateById(location);
//更新currTask表状态
currTask.setIsIn(1);
currTask.setRunTaskId(runTask.getId());
currTask.setUpdateTime(LocalDateTime.now());
currTask.setBeginTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
//更新小车状态
vehicle.setStatus(0);
@ -241,7 +245,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), location.getCode(), rgv2CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(2, currTaskId, 39);
Integer status = moveRgv(2, currTaskId, 2,0);
if (status!=1){
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败");
@ -255,7 +259,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), location.getCode(), rgv1CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(1, currTaskId, 1);
Integer status = moveRgv(1, currTaskId, 12,0);
if (status!=1){
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败===");
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败");
@ -330,7 +334,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getOutStartPosition(), currTask.getOutTargetPosition(), rgv2CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(2, currTaskId, 39);
Integer status = moveRgv(2, currTaskId, 2,currTask.getPlcValue());
if (status!=1){
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败===");
// 2022/3/6 websocket通知页面
@ -345,7 +349,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getOutStartPosition(), currTask.getOutTargetPosition(), rgv1CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(1, currTaskId, 1);
Integer status = moveRgv(1, currTaskId, 12,currTask.getPlcValue());
if (status!=1){
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败===");
// 2022/3/6 websocket通知页面
@ -426,7 +430,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv2CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(2, 1L, 1);
Integer status = moveRgv(2, 1L, 2,0);
if (status!=1){
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39执行失败===");
// 2022/3/6 websocket通知页面
@ -441,7 +445,7 @@ public class AsynRunTaskService extends BaseService {
//两辆小车是否冲突
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv1CurrPosition);
if (conflictBoolean){
Integer status = moveRgv(1, 1L, 12);
Integer status = moveRgv(1, 1L, 12,0);
if (status!=1){
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1执行失败===");
// 2022/3/6 websocket通知页面
@ -941,10 +945,10 @@ public class AsynRunTaskService extends BaseService {
* @param sendRow 终点
* @return json字符串
*/
private Integer moveRgv(Integer vehicleId,Long currTaskId,Integer sendRow){
private Integer moveRgv(Integer vehicleId,Long currTaskId,Integer sendRow,Integer processNumber){
//若冲突
// 执行小车移位任务,移位任务可以直接让小车移位到两端
Map<String, Integer> json = new HashMap();
Map<String, Object> json = new HashMap();
//type=1为
// taskType 4 单移动
@ -952,8 +956,8 @@ public class AsynRunTaskService extends BaseService {
json.put("sendRow", sendRow);
json.put("pickRow",0);
json.put("taskNo",1);
json.put("ideNumber",1);
json.put("processNumber",1);
json.put("ideNumber",currTaskId);
json.put("processNumber",processNumber);
String taskJson = JSON.toJSONString(json);
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,即将执行车辆位移任务,车辆"+vehicleId+"移动到点位"+sendRow+"===");
String result =null;

View File

@ -232,7 +232,7 @@ public class RunTaskUtils {
if (count >0) {
List<Location> locationList = locationServiceBiz.list(new QueryWrapper<Location>()
.eq(Location.STATUS, 0)
.eq(Location.VALID, 1));
.eq(Location.VALID, 1).orderByDesc(Location.ID));
//是否有小车在运行
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 1));
if (vehicleInfoList.size()>0){
@ -349,9 +349,9 @@ public class RunTaskUtils {
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (aBoolean){
Map<String, Object> statusJson = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier+"TaskState");
statusJson.put("nameSpace", 6);
statusJson.put("plcName", "plc1");
statusJson.put("identifier",identifier+"TaskState");
String statusResult = null;
try {
statusResult = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(statusJson));

View File

@ -337,7 +337,7 @@ public class ScheduledTask extends BaseService {
//遍历窑炉空窑炉查询缓存区是否有等待加工的任务
//待加工任务存在且没有状态为正在进炉的情况下按照先进先出的规则选择待加工任务呼叫车辆进炉
//@Scheduled(fixedDelay = 1000*10)
//@Scheduled(fixedDelay = 1000*30)
public void runTaskForEmptyKiln() throws IOException {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
.eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0));
@ -409,7 +409,7 @@ public class ScheduledTask extends BaseService {
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",nameSpace.concat(name));
json.put("identifier",nameSpace+name);
String jsonString = JSON.toJSONString(json);
try {
String result = HttpClient.httpPost("http://localhost:8009/opcua/read", jsonString);

View File

@ -41,7 +41,7 @@ public class TaskDistanceUtils {
if (!rgvOnline(1L)){
//液压台4 1号回火炉只能调用车辆1
if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)){
if ("BMC1".equals(startPoint)||"BMC1".equals(endPoint)||"BMC2".equals(startPoint)||"BMC2".equals(endPoint)||"YYT004".equals(startPoint)||"YYT004".equals(endPoint)){
return 0L;
}
if (!rgvOnline(2L)){

View File

@ -84,7 +84,7 @@ public class WebSocketServer {
* */
@OnMessage
public void onMessage(String message, Session session) throws Exception {
log.info("来自客户端的消息:" + message);
//log.info("来自客户端的消息:" + message);
//可以自己约定字符串内容比如 内容|0 表示信息群发内容|X 表示信息发给id为X的用户
String sendMessage = message;
String sendUserId = "0";