选定好车辆后,在检查车辆位置是否冲突阶段检查车辆是否在线,不在线则不检测冲突。
添加单步骤任务和多步骤任务相关bug修改。 增加定时任务检查车辆在线并且空闲,置车辆状态为空闲。 一个订单对应多张标识卡,首页当前任务客户名称改为以表示卡号差对应订单获取。
This commit is contained in:
parent
d8e4cb5bfa
commit
002a0cd1c3
@ -119,6 +119,7 @@ public class CurrTaskController extends BaseController {
|
||||
if (processSheet.getData().getSuccess())
|
||||
{
|
||||
//apms创建成功后写入数据库
|
||||
param.setAutoTaskType(0);
|
||||
R<IdVo> mainTask = currTaskService.createProcessTask(param);
|
||||
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
|
||||
String sheetNo = processSheet.getData().getSheetNo();
|
||||
@ -127,7 +128,7 @@ public class CurrTaskController extends BaseController {
|
||||
currTaskById.setSheetNo(sheetNo);
|
||||
currTaskService.updateCurrTaskById(currTaskById);
|
||||
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||
return successful("创建成功,任务添加至等待执行队列。");
|
||||
return successful(0,"创建成功,任务添加至等待执行队列。","");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -249,7 +250,7 @@ public class CurrTaskController extends BaseController {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
return successful(0,"操作成功,任务加入待执行队列","");
|
||||
}
|
||||
|
||||
@PostMapping(value = "mainCurrentTaskNow")
|
||||
|
@ -78,6 +78,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
AutoExeTaskServiceBiz autoExeTaskServiceBiz;
|
||||
@Autowired
|
||||
KilnInfoServiceBiz kilnInfoServiceBiz;
|
||||
@Autowired
|
||||
LocationServiceBiz locationServiceBiz;
|
||||
|
||||
@Override
|
||||
public CurrTaskVo getCurrTask(IdParam idParam) {
|
||||
@ -104,7 +106,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
BeanUtils.copyProperties(param, currTask);
|
||||
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
|
||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
||||
if (param.getAutoTaskType()==1){
|
||||
if (param.getAutoTaskType()!=0){
|
||||
currTask.setIsAuto(1);
|
||||
}
|
||||
|
||||
@ -256,6 +258,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
}
|
||||
);
|
||||
e.setCustomers(customers);
|
||||
e.setKilnName(e.getTargetPosition());
|
||||
e.setLocationName(locationServiceBiz.getById(e.getLocationId()).getLocationName());
|
||||
});
|
||||
return successful(pageVo);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic
|
||||
List<CurrTaskDetVo> currTaskDetVoList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class);
|
||||
for (CurrTaskDetVo currTaskDetVo:currTaskDetVoList
|
||||
) {
|
||||
String costomerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq("order_no", currTaskDetVo.getOrderNo())).getCustomerName();
|
||||
String costomerName = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, currTaskDetVo.getIdenCardNum())).getCustomerName();
|
||||
currTaskDetVo.setCustomer(costomerName);
|
||||
}
|
||||
return successful(currTaskDetVoList);
|
||||
|
@ -86,35 +86,8 @@ public class AsynRunTaskService extends BaseService {
|
||||
public void asynRunTask(Long currTaskId,Long vehicleId) throws IOException {
|
||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||
if (vehicleId==1){
|
||||
//获取RGV2当前位置
|
||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv2CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(2, currTaskId, 2,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
||||
}
|
||||
}else {
|
||||
//获取RGV1当前位置
|
||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv1CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(1, currTaskId, 12,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
||||
}
|
||||
}
|
||||
//检查车辆是否冲突,冲突则避让
|
||||
rgvStatus(vehicleId,currTask);
|
||||
//新建一条执行任务的关系表存放任务执行信息
|
||||
RunTask runTask=new RunTask();
|
||||
runTask.setTaskId(currTask.getId());
|
||||
@ -168,35 +141,8 @@ public class AsynRunTaskService extends BaseService {
|
||||
Long currTaskId = inStockInfo.getTaskId();
|
||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||
if (vehicleId==1){
|
||||
//获取RGV2当前位置
|
||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(),currTask.getTargetPosition(), rgv2CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(2, currTaskId, 2,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
||||
}
|
||||
}else {
|
||||
//获取RGV1当前位置
|
||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId,location.getCode(),currTask.getTargetPosition(), rgv1CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(1, currTaskId, 12,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
||||
}
|
||||
}
|
||||
//检查车辆是否冲突,冲突则避让
|
||||
rgvStatus(vehicleId,currTask);
|
||||
//新建一条执行任务的关系表存放任务执行信息
|
||||
RunTask runTask=new RunTask();
|
||||
runTask.setTaskId(currTask.getId());
|
||||
@ -262,35 +208,8 @@ public class AsynRunTaskService extends BaseService {
|
||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||
Location location = locationServiceBiz.getById(currTask.getLocationId());
|
||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||
if (vehicleId==1){
|
||||
//获取RGV2当前位置
|
||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), location.getCode(), rgv2CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(2, currTaskId, 2,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
||||
}
|
||||
}else {
|
||||
//获取RGV1当前位置
|
||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), location.getCode(), rgv1CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(1, currTaskId, 12,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
||||
}
|
||||
}
|
||||
//检查车辆是否冲突,冲突则避让
|
||||
rgvStatus(vehicleId,currTask);
|
||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||
RunTask runTask=new RunTask();
|
||||
runTask.setTaskId(currTask.getId());
|
||||
@ -327,7 +246,6 @@ public class AsynRunTaskService extends BaseService {
|
||||
runTaskServiceBiz.updateById(runTask);
|
||||
//更新currTask表
|
||||
currTask.setCacheSatatus(2);
|
||||
currTask.setStatus(3);
|
||||
currTask.setUpdateTime(LocalDateTime.now());
|
||||
currTaskServiceBiz.updateById(currTask);
|
||||
//更新in_stock_info表
|
||||
@ -351,37 +269,8 @@ public class AsynRunTaskService extends BaseService {
|
||||
public void asynRunTaskForKilnToWarehouse(Long currTaskId,Long vehicleId) throws IOException {
|
||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||
if (vehicleId==1){
|
||||
//获取RGV2当前位置
|
||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getOutStartPosition(), currTask.getOutTargetPosition(), rgv2CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(2, currTaskId, 2,currTask.getPlcValue());
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败===");
|
||||
// 2022/3/6 websocket通知页面
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
||||
}
|
||||
}else {
|
||||
//获取RGV1当前位置
|
||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getOutStartPosition(), currTask.getOutTargetPosition(), rgv1CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(1, currTaskId, 12,currTask.getPlcValue());
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败===");
|
||||
// 2022/3/6 websocket通知页面
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
||||
}
|
||||
}
|
||||
//检查车辆是否冲突,冲突则避让
|
||||
rgvStatus(vehicleId,currTask);
|
||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||
RunTask runTask=new RunTask();
|
||||
runTask.setTaskId(currTask.getId());
|
||||
@ -495,6 +384,9 @@ public class AsynRunTaskService extends BaseService {
|
||||
public void asynRunOutStock(Long locationId,String yeyaTaiCode,Long vehicleId) throws IOException {
|
||||
Location location = locationServiceBiz.getById(locationId);
|
||||
if (vehicleId==1){
|
||||
Long anotherVehicleId=2L;
|
||||
Boolean rgv2Online = rgvOnline(anotherVehicleId);
|
||||
if (rgv2Online){
|
||||
//获取RGV2当前位置
|
||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||
//两辆小车是否冲突
|
||||
@ -510,6 +402,12 @@ public class AsynRunTaskService extends BaseService {
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
||||
}
|
||||
}else {
|
||||
logger.info("RGV2不在线,跳过检测是否避让。");
|
||||
}
|
||||
|
||||
}else {
|
||||
Boolean rgv1Online = rgvOnline(1L);
|
||||
if (rgv1Online){
|
||||
//获取RGV1当前位置
|
||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||
//两辆小车是否冲突
|
||||
@ -524,6 +422,9 @@ public class AsynRunTaskService extends BaseService {
|
||||
}
|
||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
||||
}
|
||||
}else {
|
||||
logger.info("RGV1不在线,跳过检测是否避让。");
|
||||
}
|
||||
}
|
||||
RunTask runTask=new RunTask();
|
||||
// setCommonField(runTask);
|
||||
@ -1096,4 +997,86 @@ public class AsynRunTaskService extends BaseService {
|
||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 车辆是否在线
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
*/
|
||||
private Boolean rgvOnline(Long vehicleId) throws IOException {
|
||||
String identifier=null;
|
||||
if (vehicleId==1){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
|
||||
}
|
||||
if (vehicleId==2){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
|
||||
}
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier",identifier);
|
||||
String result = null;
|
||||
try {
|
||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取车辆"+vehicleId+"当前是否在线失败");
|
||||
}
|
||||
Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
return online;
|
||||
}
|
||||
|
||||
/**
|
||||
* 传入车辆ID,检查另一辆车是否在线,如果在线,检查是否位置冲突,冲突则避让。若另一辆车不在线,则不检查是否冲突。
|
||||
* @param vehicleId
|
||||
* @param currTask
|
||||
* @throws IOException
|
||||
*/
|
||||
private void rgvStatus(Long vehicleId,CurrTask currTask) throws IOException {
|
||||
Long currTaskId = currTask.getId();
|
||||
if (vehicleId==1){
|
||||
Long anotherVehicleId=2L;
|
||||
Boolean rgv2Online = rgvOnline(anotherVehicleId);
|
||||
if (rgv2Online){
|
||||
//获取RGV2当前位置
|
||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv2CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(2, currTaskId, 2,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位39,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位39,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位39,执行成功===");
|
||||
}
|
||||
}else {
|
||||
logger.info("RGV2不在线,跳过检测是否避让。");
|
||||
}
|
||||
|
||||
}else {
|
||||
Long anotherVehicleId=1L;
|
||||
Boolean rgv1Online = rgvOnline(anotherVehicleId);
|
||||
|
||||
if (rgv1Online){
|
||||
|
||||
//获取RGV1当前位置
|
||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||
//两辆小车是否冲突
|
||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, currTask.getStartPosition(), currTask.getTargetPosition(), rgv1CurrPosition);
|
||||
if (conflictBoolean){
|
||||
Integer status = moveRgv(1, currTaskId, 12,0);
|
||||
if (status!=1){
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位1,执行失败===");
|
||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行任务:"+currTask.getTaskCode()+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位1,执行失败");
|
||||
return;
|
||||
}
|
||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,执行车辆位移任务,车辆"+anotherVehicleId+"移动到点位1,执行成功===");
|
||||
}
|
||||
}else {
|
||||
logger.info("RGV1不在线,跳过检测是否避让。");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,7 @@ public class RunTaskUtils {
|
||||
//计算出路径最短的车辆id
|
||||
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition());
|
||||
if (vehicleId==0){
|
||||
logger.info("两辆车都不在线,请检查后重试!");
|
||||
return R.failed("两辆车都不在线,请检查后重试!");
|
||||
}
|
||||
//占用车辆
|
||||
@ -407,5 +408,61 @@ public class RunTaskUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆是否在线
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
*/
|
||||
private Boolean rgvOnline(Long vehicleId) throws IOException {
|
||||
String identifier=null;
|
||||
if (vehicleId==1){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
|
||||
}
|
||||
if (vehicleId==2){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
|
||||
}
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier",identifier);
|
||||
String result = null;
|
||||
try {
|
||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取车辆"+vehicleId+"当前是否在线失败");
|
||||
}
|
||||
Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
return online;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆是否空闲
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
*/
|
||||
private Boolean rgvFree(Long vehicleId) throws IOException {
|
||||
String identifier=null;
|
||||
if (vehicleId==1){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free";
|
||||
}
|
||||
if (vehicleId==2){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free";
|
||||
}
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier",identifier);
|
||||
String result = null;
|
||||
try {
|
||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取车辆"+vehicleId+"当前是否空闲失败");
|
||||
}
|
||||
Boolean free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
return free;
|
||||
}
|
||||
}
|
||||
|
@ -580,13 +580,22 @@ public class ScheduledTask extends BaseService {
|
||||
logger.info("==结束查询炉子是否有报警==");
|
||||
}
|
||||
|
||||
//监听车辆是否在线(暂时不用)
|
||||
//监听车辆是否在线
|
||||
@Scheduled(fixedDelay = 1000*60)
|
||||
public void listenVehicleOnline() throws IOException {
|
||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
|
||||
.eq(VehicleInfo.STATUS, 0));
|
||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS,1));
|
||||
for (VehicleInfo vehicleInfo:vehicleInfoList
|
||||
) {
|
||||
|
||||
Boolean rgvOnline = rgvOnline(vehicleInfo.getId());
|
||||
Boolean rgvFree = rgvFree(vehicleInfo.getId());
|
||||
if (!rgvOnline){
|
||||
webSocketServer.sendtoUser("当前存在车辆不在线,请移动停用的车辆到轨道尽头处或者改车辆为线上模式,如果已经车辆停用,请忽略本提示消息。","1");
|
||||
}
|
||||
if (rgvOnline&&rgvFree){
|
||||
vehicleInfo.setStatus(0);
|
||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||
logger.info("检测到车辆:"+vehicleInfo.getId()+" 显示状态为占用,实际状态为空闲。自动置车辆状态为空闲。");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -661,5 +670,61 @@ public class ScheduledTask extends BaseService {
|
||||
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 车辆是否在线
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
*/
|
||||
private Boolean rgvOnline(Long vehicleId) throws IOException {
|
||||
String identifier=null;
|
||||
if (vehicleId==1){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Online";
|
||||
}
|
||||
if (vehicleId==2){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Online";
|
||||
}
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier",identifier);
|
||||
String result = null;
|
||||
try {
|
||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取车辆"+vehicleId+"当前是否在线失败");
|
||||
}
|
||||
Boolean online = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
return online;
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆是否空闲
|
||||
* @param vehicleId 车辆id
|
||||
* @return true/false
|
||||
* @throws IOException plc访问失败
|
||||
*/
|
||||
private Boolean rgvFree(Long vehicleId) throws IOException {
|
||||
String identifier=null;
|
||||
if (vehicleId==1){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.Free";
|
||||
}
|
||||
if (vehicleId==2){
|
||||
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.Free";
|
||||
}
|
||||
Map<String, Object> json = new HashMap();
|
||||
json.put("nameSpace", 6);
|
||||
json.put("plcName", "plc1");
|
||||
json.put("identifier",identifier);
|
||||
String result = null;
|
||||
try {
|
||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取车辆"+vehicleId+"当前是否空闲失败");
|
||||
}
|
||||
Boolean free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||
return free;
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,11 @@ public class CurrTaskMainQueryVo extends BaseVo implements PageVo.ConvertVo {
|
||||
*/
|
||||
@ApiModelProperty("库位")
|
||||
private String locationName;
|
||||
/**
|
||||
* 库位
|
||||
*/
|
||||
@ApiModelProperty("库位id")
|
||||
private Long locationId;
|
||||
/**
|
||||
* 窑炉名称
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user