Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd
This commit is contained in:
commit
0c026853ef
@ -119,6 +119,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
if (processSheet.getData().getSuccess())
|
if (processSheet.getData().getSuccess())
|
||||||
{
|
{
|
||||||
//apms创建成功后写入数据库
|
//apms创建成功后写入数据库
|
||||||
|
param.setAutoTaskType(0);
|
||||||
R<IdVo> mainTask = currTaskService.createProcessTask(param);
|
R<IdVo> mainTask = currTaskService.createProcessTask(param);
|
||||||
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
|
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
|
||||||
String sheetNo = processSheet.getData().getSheetNo();
|
String sheetNo = processSheet.getData().getSheetNo();
|
||||||
@ -127,7 +128,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
currTaskById.setSheetNo(sheetNo);
|
currTaskById.setSheetNo(sheetNo);
|
||||||
currTaskService.updateCurrTaskById(currTaskById);
|
currTaskService.updateCurrTaskById(currTaskById);
|
||||||
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||||
return successful("创建成功,任务添加至等待执行队列。");
|
return successful(0,"创建成功,任务添加至等待执行队列。","");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -237,6 +238,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
//将返回的生产单号写入到主任务中。
|
//将返回的生产单号写入到主任务中。
|
||||||
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
|
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
|
||||||
currTaskById.setSheetNo(sheetNo);
|
currTaskById.setSheetNo(sheetNo);
|
||||||
|
currTaskById.setAutoExeTaskId(autoExeTask.getId());
|
||||||
currTaskService.updateCurrTaskById(currTaskById);
|
currTaskService.updateCurrTaskById(currTaskById);
|
||||||
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||||
//return successful("创建成功,任务添加至等待执行队列。");
|
//return successful("创建成功,任务添加至等待执行队列。");
|
||||||
@ -248,7 +250,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return null;
|
return successful(0,"操作成功,任务加入待执行队列","");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "mainCurrentTaskNow")
|
@PostMapping(value = "mainCurrentTaskNow")
|
||||||
|
@ -78,6 +78,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
AutoExeTaskServiceBiz autoExeTaskServiceBiz;
|
AutoExeTaskServiceBiz autoExeTaskServiceBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
KilnInfoServiceBiz kilnInfoServiceBiz;
|
KilnInfoServiceBiz kilnInfoServiceBiz;
|
||||||
|
@Autowired
|
||||||
|
LocationServiceBiz locationServiceBiz;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CurrTaskVo getCurrTask(IdParam idParam) {
|
public CurrTaskVo getCurrTask(IdParam idParam) {
|
||||||
@ -104,6 +106,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
BeanUtils.copyProperties(param, currTask);
|
BeanUtils.copyProperties(param, currTask);
|
||||||
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
|
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
|
||||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
||||||
|
if (param.getAutoTaskType()!=0){
|
||||||
|
currTask.setIsAuto(1);
|
||||||
|
}
|
||||||
|
|
||||||
//根据工艺号查询工艺id以及工艺plc值
|
//根据工艺号查询工艺id以及工艺plc值
|
||||||
CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, param.getCraftCode()));
|
CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, param.getCraftCode()));
|
||||||
@ -151,34 +156,76 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<String> deleteBySheetNo(String sheetNo) {
|
public R<String> deleteBySheetNo(String sheetNo) {
|
||||||
CurrTask byId = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
|
//一个生产单可能对应多个currTask,删除的时候查询是否对应多个,如果对应多个,自动循环删除所有currTask,当删除最后一条currTask时上报apms
|
||||||
//如果尚未执行(状态 0)
|
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
|
||||||
if (byId.getStatus() == 0)
|
if (currTaskList.size()>1){
|
||||||
{
|
int i=0;
|
||||||
|
for (CurrTask currTask:currTaskList
|
||||||
|
) {
|
||||||
|
i++;
|
||||||
|
if(currTask.getStatus()==0){
|
||||||
|
if (i==currTaskList.size()){
|
||||||
|
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
||||||
|
if (!apmsStartProcessR.getData().getSuccess()){
|
||||||
|
return failed(apmsStartProcessR.getData().getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Long currTaskId = currTask.getId();
|
||||||
|
if (currTask.getIsAuto()==1){
|
||||||
|
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||||
|
if (currTaskList2.size()==1){
|
||||||
|
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currTaskServiceBiz.removeById(currTaskId);
|
||||||
|
currTaskDetService.deleteByCurrTaskId(currTaskId);
|
||||||
|
|
||||||
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
}
|
||||||
if (apmsStartProcessR.getData().getSuccess())
|
if (currTask.getStatus()==2){
|
||||||
{
|
return failed("无法删除,任务已加工完成。");
|
||||||
Long currTaskId = byId.getId();
|
}if (currTask.getStatus()==1){
|
||||||
currTaskServiceBiz.removeById(currTaskId);
|
return failed("无法删除,任务正在执行中。");
|
||||||
currTaskDetService.deleteByCurrTaskId(currTaskId);
|
}
|
||||||
if (byId.getIsAuto()==1){
|
}
|
||||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, byId.getAutoExeTaskId()));
|
return successful(0,"APMS生产单删除成功。","");
|
||||||
if (currTaskList.size()==0){
|
}else {
|
||||||
autoExeTaskServiceBiz.removeById(byId.getAutoExeTaskId());
|
for (CurrTask currTask:currTaskList
|
||||||
|
) {
|
||||||
|
if (currTask.getStatus()==0){
|
||||||
|
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
||||||
|
if (apmsStartProcessR.getData().getSuccess())
|
||||||
|
{
|
||||||
|
Long currTaskId = currTask.getId();
|
||||||
|
if (currTask.getIsAuto()==1){
|
||||||
|
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||||
|
if (currTaskList2.size()==1){
|
||||||
|
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currTaskServiceBiz.removeById(currTaskId);
|
||||||
|
currTaskDetService.deleteByCurrTaskId(currTaskId);
|
||||||
|
if (currTask.getIsAuto()==1){
|
||||||
|
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||||
|
if (currTaskList2.size()==0){
|
||||||
|
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return successful(0,"APMS生产单删除成功。","");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return failed(apmsStartProcessR.getData().getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return successful("APMS生产单删除成功。");
|
if (currTask.getStatus()==2){
|
||||||
}
|
return failed("无法删除,任务已加工完成。");
|
||||||
else
|
}if (currTask.getStatus()==1){
|
||||||
{
|
return failed("无法删除,任务正在执行中。");
|
||||||
return failed(apmsStartProcessR.getData().getMsg());
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (byId.getStatus()==2){
|
return failed("根据生产单号删除任务失败!");
|
||||||
return failed("无法删除,任务已加工完成。");
|
|
||||||
}
|
|
||||||
return failed("无法删除,任务正在执行中。");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +258,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
e.setCustomers(customers);
|
e.setCustomers(customers);
|
||||||
|
e.setKilnName(e.getTargetPosition());
|
||||||
|
e.setLocationName(locationServiceBiz.getById(e.getLocationId()).getLocationName());
|
||||||
});
|
});
|
||||||
return successful(pageVo);
|
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);
|
List<CurrTaskDetVo> currTaskDetVoList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class);
|
||||||
for (CurrTaskDetVo currTaskDetVo:currTaskDetVoList
|
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);
|
currTaskDetVo.setCustomer(costomerName);
|
||||||
}
|
}
|
||||||
return successful(currTaskDetVoList);
|
return successful(currTaskDetVoList);
|
||||||
|
@ -86,35 +86,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
public void asynRunTask(Long currTaskId,Long vehicleId) throws IOException {
|
public void asynRunTask(Long currTaskId,Long vehicleId) throws IOException {
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||||
if (vehicleId==1){
|
//检查车辆是否冲突,冲突则避让
|
||||||
//获取RGV2当前位置
|
rgvStatus(vehicleId,currTask);
|
||||||
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,执行成功===");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新建一条执行任务的关系表存放任务执行信息
|
//新建一条执行任务的关系表存放任务执行信息
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask=new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
@ -168,35 +141,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Long currTaskId = inStockInfo.getTaskId();
|
Long currTaskId = inStockInfo.getTaskId();
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||||
if (vehicleId==1){
|
//检查车辆是否冲突,冲突则避让
|
||||||
//获取RGV2当前位置
|
rgvStatus(vehicleId,currTask);
|
||||||
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,执行成功===");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新建一条执行任务的关系表存放任务执行信息
|
//新建一条执行任务的关系表存放任务执行信息
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask=new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
@ -262,35 +208,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||||
Location location = locationServiceBiz.getById(currTask.getLocationId());
|
Location location = locationServiceBiz.getById(currTask.getLocationId());
|
||||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||||
if (vehicleId==1){
|
//检查车辆是否冲突,冲突则避让
|
||||||
//获取RGV2当前位置
|
rgvStatus(vehicleId,currTask);
|
||||||
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,执行成功===");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask=new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
@ -327,7 +246,6 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
runTaskServiceBiz.updateById(runTask);
|
runTaskServiceBiz.updateById(runTask);
|
||||||
//更新currTask表
|
//更新currTask表
|
||||||
currTask.setCacheSatatus(2);
|
currTask.setCacheSatatus(2);
|
||||||
currTask.setStatus(3);
|
|
||||||
currTask.setUpdateTime(LocalDateTime.now());
|
currTask.setUpdateTime(LocalDateTime.now());
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
//更新in_stock_info表
|
//更新in_stock_info表
|
||||||
@ -351,37 +269,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
public void asynRunTaskForKilnToWarehouse(Long currTaskId,Long vehicleId) throws IOException {
|
public void asynRunTaskForKilnToWarehouse(Long currTaskId,Long vehicleId) throws IOException {
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||||
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
|
||||||
if (vehicleId==1){
|
//检查车辆是否冲突,冲突则避让
|
||||||
//获取RGV2当前位置
|
rgvStatus(vehicleId,currTask);
|
||||||
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,执行成功===");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask=new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
@ -495,34 +384,46 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
public void asynRunOutStock(Long locationId,String yeyaTaiCode,Long vehicleId) throws IOException {
|
public void asynRunOutStock(Long locationId,String yeyaTaiCode,Long vehicleId) throws IOException {
|
||||||
Location location = locationServiceBiz.getById(locationId);
|
Location location = locationServiceBiz.getById(locationId);
|
||||||
if (vehicleId==1){
|
if (vehicleId==1){
|
||||||
//获取RGV2当前位置
|
Long anotherVehicleId=2L;
|
||||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
Boolean rgv2Online = rgvOnline(anotherVehicleId);
|
||||||
//两辆小车是否冲突
|
if (rgv2Online){
|
||||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv2CurrPosition);
|
//获取RGV2当前位置
|
||||||
if (conflictBoolean){
|
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||||
Integer status = moveRgv(2, 1L, 2,0);
|
//两辆小车是否冲突
|
||||||
if (status!=1){
|
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv2CurrPosition);
|
||||||
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败===");
|
if (conflictBoolean){
|
||||||
// 2022/3/6 websocket通知页面
|
Integer status = moveRgv(2, 1L, 2,0);
|
||||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败");
|
if (status!=1){
|
||||||
return;
|
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败===");
|
||||||
|
// 2022/3/6 websocket通知页面
|
||||||
|
webSocketServer.sendtoAll(LocalDateTime.now()+"执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
||||||
}
|
}
|
||||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
}else {
|
||||||
|
logger.info("RGV2不在线,跳过检测是否避让。");
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
//获取RGV1当前位置
|
Boolean rgv1Online = rgvOnline(1L);
|
||||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
if (rgv1Online){
|
||||||
//两辆小车是否冲突
|
//获取RGV1当前位置
|
||||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv1CurrPosition);
|
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||||
if (conflictBoolean){
|
//两辆小车是否冲突
|
||||||
Integer status = moveRgv(1, 1L, 12,0);
|
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv1CurrPosition);
|
||||||
if (status!=1){
|
if (conflictBoolean){
|
||||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败===");
|
Integer status = moveRgv(1, 1L, 12,0);
|
||||||
// 2022/3/6 websocket通知页面
|
if (status!=1){
|
||||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败");
|
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败===");
|
||||||
return;
|
// 2022/3/6 websocket通知页面
|
||||||
|
webSocketServer.sendtoAll(LocalDateTime.now()+"执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
||||||
}
|
}
|
||||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
}else {
|
||||||
|
logger.info("RGV1不在线,跳过检测是否避让。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask=new RunTask();
|
||||||
@ -1097,4 +998,86 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
}
|
}
|
||||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功");
|
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
|
//计算出路径最短的车辆id
|
||||||
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition());
|
Long vehicleId = taskDistanceUtils.chooseVehicle(currTask.getStartPosition(), currTask.getTargetPosition());
|
||||||
if (vehicleId==0){
|
if (vehicleId==0){
|
||||||
|
logger.info("两辆车都不在线,请检查后重试!");
|
||||||
return R.failed("两辆车都不在线,请检查后重试!");
|
return R.failed("两辆车都不在线,请检查后重试!");
|
||||||
}
|
}
|
||||||
//占用车辆
|
//占用车辆
|
||||||
@ -407,5 +408,61 @@ public class RunTaskUtils {
|
|||||||
}
|
}
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,7 @@ public class ScheduledTask extends BaseService {
|
|||||||
.eq(PlcNameSpace.TYPE, 0)
|
.eq(PlcNameSpace.TYPE, 0)
|
||||||
.eq(PlcNameSpace.EQ_ID, kilnId)).getName();
|
.eq(PlcNameSpace.EQ_ID, kilnId)).getName();
|
||||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||||
|
nowCurrTask.setTaskCode(nowCurrTask.getSheetNo());
|
||||||
nowCurrTask.setKilnCode(kilnInfo.getCode());
|
nowCurrTask.setKilnCode(kilnInfo.getCode());
|
||||||
//设定时间
|
//设定时间
|
||||||
Integer setupTime =1;
|
Integer setupTime =1;
|
||||||
@ -541,19 +542,35 @@ public class ScheduledTask extends BaseService {
|
|||||||
//报警状态为true
|
//报警状态为true
|
||||||
if (resultBoolean){
|
if (resultBoolean){
|
||||||
//任务状态为执行中且正在炉子中加工的任务
|
//任务状态为执行中且正在炉子中加工的任务
|
||||||
CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>()
|
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
|
||||||
.eq(CurrTask.KILN_ID, kilnInfo.getId())
|
.eq(CurrTask.KILN_ID, kilnInfo.getId())
|
||||||
.eq(CurrTask.IS_IN, 1)
|
.eq(CurrTask.IS_IN, 1)
|
||||||
.eq(CurrTask.STATUS, 1));
|
.eq(CurrTask.STATUS, 1));
|
||||||
AlarmInfo alarmInfo=new AlarmInfo();
|
if (currTaskList.size()!=0){
|
||||||
alarmInfo.setEquipmentId(currTask.getKilnId());
|
for (CurrTask currTask:currTaskList
|
||||||
alarmInfo.setEquipmentName(currTask.getKilnName());
|
) {
|
||||||
alarmInfo.setType(0);
|
AlarmInfo alarmInfo=new AlarmInfo();
|
||||||
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
|
alarmInfo.setEquipmentId(currTask.getKilnId());
|
||||||
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+":"+plcNameSpace.getNote());
|
alarmInfo.setEquipmentName(currTask.getKilnName());
|
||||||
alarmInfo.setTaskCode(currTask.getTaskCode());
|
alarmInfo.setType(0);
|
||||||
alarmInfo.setCreateTime(LocalDateTime.now());
|
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
|
||||||
alarmInfoServiceBiz.save(alarmInfo);
|
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+":"+plcNameSpace.getNote());
|
||||||
|
alarmInfo.setTaskCode(currTask.getTaskCode());
|
||||||
|
alarmInfo.setCreateTime(LocalDateTime.now());
|
||||||
|
alarmInfoServiceBiz.save(alarmInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AlarmInfo alarmInfo=new AlarmInfo();
|
||||||
|
alarmInfo.setEquipmentId(kilnInfo.getId());
|
||||||
|
alarmInfo.setEquipmentName(kilnInfo.getKilnName());
|
||||||
|
alarmInfo.setType(0);
|
||||||
|
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
|
||||||
|
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+":"+plcNameSpace.getNote());
|
||||||
|
alarmInfo.setTaskCode("0");
|
||||||
|
alarmInfo.setCreateTime(LocalDateTime.now());
|
||||||
|
alarmInfoServiceBiz.save(alarmInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -564,13 +581,22 @@ public class ScheduledTask extends BaseService {
|
|||||||
logger.info("==结束查询炉子是否有报警==");
|
logger.info("==结束查询炉子是否有报警==");
|
||||||
}
|
}
|
||||||
|
|
||||||
//监听车辆是否在线(暂时不用)
|
//监听车辆是否在线
|
||||||
|
@Scheduled(fixedDelay = 1000*60)
|
||||||
public void listenVehicleOnline() throws IOException {
|
public void listenVehicleOnline() throws IOException {
|
||||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
|
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS,1));
|
||||||
.eq(VehicleInfo.STATUS, 0));
|
|
||||||
for (VehicleInfo vehicleInfo:vehicleInfoList
|
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()+" 显示状态为占用,实际状态为空闲。自动置车辆状态为空闲。");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -645,5 +671,61 @@ public class ScheduledTask extends BaseService {
|
|||||||
return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
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("库位")
|
@ApiModelProperty("库位")
|
||||||
private String locationName;
|
private String locationName;
|
||||||
|
/**
|
||||||
|
* 库位
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("库位id")
|
||||||
|
private Long locationId;
|
||||||
/**
|
/**
|
||||||
* 窑炉名称
|
* 窑炉名称
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +31,11 @@ public class NowCurrTaskDetVo extends BaseVo implements PageVo.ConvertVo{
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "currtask任务code",example = "0")
|
@ApiModelProperty(value = "currtask任务code",example = "0")
|
||||||
private String taskCode;
|
private String taskCode;
|
||||||
|
/**
|
||||||
|
* 生产单号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "生产单号",example = "0")
|
||||||
|
private String sheetNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 炉子id
|
* 炉子id
|
||||||
|
Loading…
Reference in New Issue
Block a user