diff --git a/6.program/pom.xml b/6.program/pom.xml index 1f7fa6f..712e735 100644 --- a/6.program/pom.xml +++ b/6.program/pom.xml @@ -51,10 +51,10 @@ 5--> - jdbc:p6spy:mysql://mysql.picaiba.com:30307/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false + jdbc:p6spy:mysql://192.168.6.51:30306/mt_wms_qj?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false root - 1qaz@WSX3edc$RFV + ABC.10086 smtp.mxhichina.com diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index 733b89d..99ea8b8 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -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 json = new HashMap(); + Map 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; diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java index e912a2f..fc5cd7b 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java @@ -232,7 +232,7 @@ public class RunTaskUtils { if (count >0) { List locationList = locationServiceBiz.list(new QueryWrapper() .eq(Location.STATUS, 0) - .eq(Location.VALID, 1)); + .eq(Location.VALID, 1).orderByDesc(Location.ID)); //是否有小车在运行 List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper().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 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)); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index 1957f24..d00a586 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -337,7 +337,7 @@ public class ScheduledTask extends BaseService { //遍历窑炉,空窑炉查询缓存区是否有等待加工的任务, //待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉 - //@Scheduled(fixedDelay = 1000*10) + //@Scheduled(fixedDelay = 1000*30) public void runTaskForEmptyKiln() throws IOException { List kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper() .eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0)); @@ -409,7 +409,7 @@ public class ScheduledTask extends BaseService { Map 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); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java index 6a507c8..2b20860 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java @@ -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)){ diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java index 181d097..4d43ee4 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java @@ -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";