上报APMS步骤改为单步骤任务或多步骤任务的第一步进炉加工上报接口为creatProcess,其他步骤进炉加工上报接口为startProcess
This commit is contained in:
parent
a440684232
commit
10e46121c3
@ -98,12 +98,12 @@ public class CurrTaskController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//通知apms创建一个生产单
|
//通知apms创建一个生产单
|
||||||
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
//ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||||
apmsCreateSheet.setWorkShopCode("BM");
|
//apmsCreateSheet.setWorkShopCode("BM");
|
||||||
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
//apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
apmsCreateSheet.setTechCode(param.getCraftCode());
|
//apmsCreateSheet.setTechCode(param.getCraftCode());
|
||||||
//fixme 暂时没有正式user,使用测试账户
|
//fixme 暂时没有正式user,使用测试账户
|
||||||
apmsCreateSheet.setStartUser("QJJP03");
|
//apmsCreateSheet.setStartUser("QJJP03");
|
||||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||||
param.getDetParams().forEach(e -> {
|
param.getDetParams().forEach(e -> {
|
||||||
CreateItem createItem = new CreateItem();
|
CreateItem createItem = new CreateItem();
|
||||||
@ -112,28 +112,28 @@ public class CurrTaskController extends BaseController {
|
|||||||
createItem.setWeight(e.getWeight().doubleValue());
|
createItem.setWeight(e.getWeight().doubleValue());
|
||||||
createItems.add(createItem);
|
createItems.add(createItem);
|
||||||
});
|
});
|
||||||
apmsCreateSheet.setStoveCode(kilnCode);
|
//apmsCreateSheet.setStoveCode(kilnCode);
|
||||||
apmsCreateSheet.setItems(createItems);
|
//apmsCreateSheet.setItems(createItems);
|
||||||
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
//R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||||
|
|
||||||
if (processSheet.getData().getSuccess())
|
//if (processSheet.getData().getSuccess())
|
||||||
{
|
//{
|
||||||
//apms创建成功后写入数据库
|
//apms创建成功后写入数据库
|
||||||
param.setAutoTaskType(0);
|
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();
|
||||||
//将返回的生产单号写入到主任务中。
|
//将返回的生产单号写入到主任务中。
|
||||||
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
|
//CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
|
||||||
currTaskById.setSheetNo(sheetNo);
|
//currTaskById.setSheetNo(sheetNo);
|
||||||
currTaskService.updateCurrTaskById(currTaskById);
|
//currTaskService.updateCurrTaskById(currTaskById);
|
||||||
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||||
return successful(0,"创建成功,任务添加至等待执行队列。","");
|
return successful(0,"创建成功,任务添加至等待执行队列。","");
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
return failed("创建失败,APMS报错:" + processSheet.getData().getMsg());
|
// return failed("创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "createAutoTask")
|
@PostMapping(value = "createAutoTask")
|
||||||
@ -173,6 +173,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
{
|
{
|
||||||
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (i==1){
|
if (i==1){
|
||||||
//通知apms创建一个生产单
|
//通知apms创建一个生产单
|
||||||
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||||
@ -195,9 +196,10 @@ public class CurrTaskController extends BaseController {
|
|||||||
apmsCreateProcessSheet=processSheet.getData().getSuccess();
|
apmsCreateProcessSheet=processSheet.getData().getSuccess();
|
||||||
sheetNo=processSheet.getData().getSheetNo();
|
sheetNo=processSheet.getData().getSheetNo();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (apmsCreateProcessSheet)
|
//if (apmsCreateProcessSheet)
|
||||||
{
|
//{
|
||||||
//apms创建成功后写入数据库
|
//apms创建成功后写入数据库
|
||||||
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());
|
||||||
@ -237,18 +239,18 @@ 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());
|
currTaskById.setAutoExeTaskId(autoExeTask.getId());
|
||||||
currTaskService.updateCurrTaskById(currTaskById);
|
currTaskService.updateCurrTaskById(currTaskById);
|
||||||
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||||
//return successful("创建成功,任务添加至等待执行队列。");
|
//return successful("创建成功,任务添加至等待执行队列。");
|
||||||
|
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
return failed("创建失败,APMS报错:" + processSheet.getData().getMsg());
|
// return failed("创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||||
}
|
//}
|
||||||
i++;
|
//i++;
|
||||||
}
|
}
|
||||||
return successful(0,"操作成功,任务加入待执行队列","");
|
return successful(0,"操作成功,任务加入待执行队列","");
|
||||||
}
|
}
|
||||||
|
@ -81,16 +81,17 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
|
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
|
||||||
@Resource
|
@Resource
|
||||||
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
||||||
|
|
||||||
//窑炉可用未满的情况下,调用车辆起点为提升台终点为窑炉
|
//窑炉可用未满的情况下,调用车辆起点为提升台终点为窑炉
|
||||||
@Async("asyncServiceExecutor")
|
@Async("asyncServiceExecutor")
|
||||||
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);
|
||||||
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
|
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
|
||||||
//检查车辆是否冲突,冲突则避让
|
//检查车辆是否冲突,冲突则避让
|
||||||
rgvStatus(vehicleId,currTask);
|
rgvStatus(vehicleId, currTask);
|
||||||
//新建一条执行任务的关系表存放任务执行信息
|
//新建一条执行任务的关系表存放任务执行信息
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask = new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
runTask.setTaskCode(currTask.getTaskCode());
|
runTask.setTaskCode(currTask.getTaskCode());
|
||||||
runTask.setVehicleId(vehicleId);
|
runTask.setVehicleId(vehicleId);
|
||||||
@ -98,27 +99,19 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
runTask.setEndPosition(currTask.getTargetPosition());
|
runTask.setEndPosition(currTask.getTargetPosition());
|
||||||
runTask.setBeginTime(LocalDateTime.now());
|
runTask.setBeginTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.save(runTask);
|
runTaskServiceBiz.save(runTask);
|
||||||
|
//任务为自动任务第一步或任务为非自动任务时创建生产单,其他情况下开始生产单
|
||||||
|
if (isFirstTask(currTask)) {
|
||||||
//通知apms创建一个生产单
|
//通知apms创建一个生产单
|
||||||
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
Boolean createProcess = apmsCreateProcess(currTask);
|
||||||
apmsCreateSheet.setWorkShopCode("BM");
|
if (!createProcess) {
|
||||||
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
return;
|
||||||
apmsCreateSheet.setTechCode(currTask.getCraftCodeId().toString());
|
}
|
||||||
//fixme 暂时没有正式user,使用测试账户
|
} else {
|
||||||
apmsCreateSheet.setStartUser("QJJP03");
|
//通知apms开始生产单
|
||||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
Boolean startProcess = apmsStartProcess(currTask);
|
||||||
currTaskDetList.forEach(e -> {
|
if (!startProcess) {
|
||||||
CreateItem createItem = new CreateItem();
|
return;
|
||||||
createItem.setItemCode(e.getIdenCardNum());
|
}
|
||||||
createItem.setQuantity(e.getQuantity().intValue());
|
|
||||||
createItem.setWeight(e.getWeight().doubleValue());
|
|
||||||
createItems.add(createItem);
|
|
||||||
});
|
|
||||||
apmsCreateSheet.setStoveCode(CodeGeneratorHelper.getStoveCode(currTask.getKilnName()+String.format("%02d",currTask.getCraftCodeId())));
|
|
||||||
apmsCreateSheet.setItems(createItems);
|
|
||||||
R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet);
|
|
||||||
if (!processSheet.getData().getSuccess()){
|
|
||||||
logger.info(currTaskId+"创建失败,APMS报错:" + processSheet.getData().getMsg());
|
|
||||||
webSocketServer.sendtoUser("创建失败,APMS报错:" + processSheet.getData().getMsg(),"1");
|
|
||||||
}
|
}
|
||||||
//调用车辆填入起终点,得到车辆执行结果
|
//调用车辆填入起终点,得到车辆执行结果
|
||||||
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
||||||
@ -126,10 +119,10 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||||
logger.info(String.valueOf(status));
|
logger.info(String.valueOf(status));
|
||||||
//执行成功,托盘进炉
|
//执行成功,托盘进炉
|
||||||
if (status==1){
|
if (status == 1) {
|
||||||
// TODO: 2022/7/7 开始记录能源消耗
|
// TODO: 2022/7/7 开始记录能源消耗
|
||||||
asynStartRecordConsume(currTaskId,currTask.getKilnId());
|
asynStartRecordConsume(currTaskId, currTask.getKilnId());
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||||
//更新调度表状态为完成
|
//更新调度表状态为完成
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTask.setEndTime(LocalDateTime.now());
|
runTask.setEndTime(LocalDateTime.now());
|
||||||
@ -143,31 +136,28 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更新小车状态
|
//更新小车状态
|
||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
// TODO: 2022/7/6 上报apms加工单开始
|
} else {
|
||||||
apmsStartProcess(currTask);
|
|
||||||
|
|
||||||
}else {
|
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.updateById(runTask);
|
runTaskServiceBiz.updateById(runTask);
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行失败===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
||||||
logger.info("任务 "+currTask.getTaskCode()+" 车辆从液压台台到加工炉过程中失败。");
|
logger.info("任务 " + currTask.getTaskCode() + " 车辆从液压台台到加工炉过程中失败。");
|
||||||
// TODO: 2021/12/14 websocket推送到前端,小车管理界面添加一个重置小车状态的接口。
|
// TODO: 2021/12/14 websocket推送到前端,小车管理界面添加一个重置小车状态的接口。
|
||||||
webSocketServer.sendtoAll("任务 "+currTask.getTaskCode()+" 车辆从液压台台到加工炉过程中失败。");
|
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从液压台台到加工炉过程中失败。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//窑炉可用未满的情况下,调用车辆起点为缓存区终点为窑炉
|
//窑炉可用未满的情况下,调用车辆起点为缓存区终点为窑炉
|
||||||
public void asynRunTaskForStockToKiln(Long stockInfokId,Long vehicleId) throws IOException {
|
public void asynRunTaskForStockToKiln(Long stockInfokId, Long vehicleId) throws IOException {
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getById(stockInfokId);
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getById(stockInfokId);
|
||||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||||
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);List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
|
||||||
//检查车辆是否冲突,冲突则避让
|
//检查车辆是否冲突,冲突则避让
|
||||||
rgvStatus(vehicleId,currTask);
|
rgvStatus(vehicleId, currTask);
|
||||||
//新建一条执行任务的关系表存放任务执行信息
|
//新建一条执行任务的关系表存放任务执行信息
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask = new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
runTask.setTaskCode(currTask.getTaskCode());
|
runTask.setTaskCode(currTask.getTaskCode());
|
||||||
runTask.setVehicleId(vehicleId);
|
runTask.setVehicleId(vehicleId);
|
||||||
@ -179,15 +169,29 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//修改缓存区存储情况表状态
|
//修改缓存区存储情况表状态
|
||||||
inStockInfo.setStatus(1);
|
inStockInfo.setStatus(1);
|
||||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||||
|
//任务为自动任务第一步或任务为非自动任务时创建生产单,其他情况下开始生产单
|
||||||
|
if (isFirstTask(currTask)) {
|
||||||
|
//通知apms创建一个生产单
|
||||||
|
Boolean createProcess = apmsCreateProcess(currTask);
|
||||||
|
if (!createProcess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//通知apms开始生产单
|
||||||
|
Boolean startProcess = apmsStartProcess(currTask);
|
||||||
|
if (!startProcess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 调用车辆填入起终点,得到车辆执行结果
|
// 调用车辆填入起终点,得到车辆执行结果
|
||||||
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
||||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||||
//执行成功,托盘进炉
|
//执行成功,托盘进炉
|
||||||
if (status==1){
|
if (status == 1) {
|
||||||
// TODO: 2022/7/7
|
// TODO: 2022/7/7
|
||||||
asynStartRecordConsume(currTaskId,currTask.getKilnId());
|
asynStartRecordConsume(currTaskId, currTask.getKilnId());
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||||
//更新调度表状态为完成
|
//更新调度表状态为完成
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTask.setEndTime(LocalDateTime.now());
|
runTask.setEndTime(LocalDateTime.now());
|
||||||
@ -196,8 +200,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更改缓存区存储状态,添加缓存区存储历史情况记录
|
//更改缓存区存储状态,添加缓存区存储历史情况记录
|
||||||
inStockInfo.setStatus(2);
|
inStockInfo.setStatus(2);
|
||||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||||
InStockInfoHis inStockInfoHis=new InStockInfoHis();
|
InStockInfoHis inStockInfoHis = new InStockInfoHis();
|
||||||
BeanUtils.copyProperties(inStockInfo,inStockInfoHis);
|
BeanUtils.copyProperties(inStockInfo, inStockInfoHis);
|
||||||
inStockInfoHisServiceBiz.save(inStockInfoHis);
|
inStockInfoHisServiceBiz.save(inStockInfoHis);
|
||||||
inStockInfoServiceBiz.removeById(inStockInfo);
|
inStockInfoServiceBiz.removeById(inStockInfo);
|
||||||
//更改库位状态
|
//更改库位状态
|
||||||
@ -212,29 +216,28 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更新小车状态
|
//更新小车状态
|
||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
// TODO: 2022/7/6 上报apms生产单开始加工
|
} else {
|
||||||
apmsStartProcess(currTask);
|
|
||||||
}else {
|
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.updateById(runTask);
|
runTaskServiceBiz.updateById(runTask);
|
||||||
logger.info("任务 "+currTask.getTaskCode()+" 车辆从缓存区到加工炉过程中失败。");
|
logger.info("任务 " + currTask.getTaskCode() + " 车辆从缓存区到加工炉过程中失败。");
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行失败===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
||||||
// TODO: 2021/12/14 websocket推送到前端,小车管理界面添加一个重置小车状态的接口。
|
// TODO: 2021/12/14 websocket推送到前端,小车管理界面添加一个重置小车状态的接口。
|
||||||
// TODO: 2021/12/14 websocket推送到前端,执行失败后车辆在中途,缓存区存储情况怎么修改?
|
// TODO: 2021/12/14 websocket推送到前端,执行失败后车辆在中途,缓存区存储情况怎么修改?
|
||||||
webSocketServer.sendtoAll("任务 "+currTask.getTaskCode()+" 车辆从缓存区到加工炉过程中失败。");
|
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从缓存区到加工炉过程中失败。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//窑炉已满,调用车辆起点为提升台,终点为缓存区
|
//窑炉已满,调用车辆起点为提升台,终点为缓存区
|
||||||
@Async("asyncServiceExecutor")
|
@Async("asyncServiceExecutor")
|
||||||
public void asynRunTaskToWarehouse(Long currTaskId,Long vehicleId) throws IOException {
|
public void asynRunTaskToWarehouse(Long currTaskId, Long vehicleId) throws IOException {
|
||||||
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);
|
||||||
//检查车辆是否冲突,冲突则避让
|
//检查车辆是否冲突,冲突则避让
|
||||||
rgvStatus(vehicleId,currTask);
|
rgvStatus(vehicleId, currTask);
|
||||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask = new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
runTask.setTaskCode(currTask.getTaskCode());
|
runTask.setTaskCode(currTask.getTaskCode());
|
||||||
runTask.setVehicleId(vehicleId);
|
runTask.setVehicleId(vehicleId);
|
||||||
@ -244,7 +247,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
runTaskServiceBiz.save(runTask);
|
runTaskServiceBiz.save(runTask);
|
||||||
|
|
||||||
//添加一条库位详情到in_stock_info表
|
//添加一条库位详情到in_stock_info表
|
||||||
InStockInfo inStockInfo=new InStockInfo();
|
InStockInfo inStockInfo = new InStockInfo();
|
||||||
inStockInfo.setStatus(1);
|
inStockInfo.setStatus(1);
|
||||||
inStockInfo.setInterCode(IDGenerator.gen("HCT", "yyyyMMddHHmm", 2, "WAREHOUSE_CODE"));
|
inStockInfo.setInterCode(IDGenerator.gen("HCT", "yyyyMMddHHmm", 2, "WAREHOUSE_CODE"));
|
||||||
inStockInfo.setTaskId(currTask.getId());
|
inStockInfo.setTaskId(currTask.getId());
|
||||||
@ -260,8 +263,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
||||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||||
if (status==1){
|
if (status == 1) {
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||||
//更新关系表状态为完成
|
//更新关系表状态为完成
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTask.setStatus(2);
|
runTask.setStatus(2);
|
||||||
@ -278,24 +281,25 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更新小车状态
|
//更新小车状态
|
||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
}else {
|
} else {
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.updateById(runTask);
|
runTaskServiceBiz.updateById(runTask);
|
||||||
logger.info("任务 "+currTask.getTaskCode()+" 车辆从液压台到缓存区过程中失败。");
|
logger.info("任务 " + currTask.getTaskCode() + " 车辆从液压台到缓存区过程中失败。");
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行失败===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
||||||
webSocketServer.sendtoAll("任务 "+currTask.getTaskCode()+" 车辆从液压台到缓存区过程中失败。");
|
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从液压台到缓存区过程中失败。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//窑炉加工完成,调用车辆入库到缓存区
|
//窑炉加工完成,调用车辆入库到缓存区
|
||||||
@Async("asyncServiceExecutor")
|
@Async("asyncServiceExecutor")
|
||||||
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);
|
||||||
//检查车辆是否冲突,冲突则避让
|
//检查车辆是否冲突,冲突则避让
|
||||||
rgvStatus(vehicleId,currTask);
|
rgvStatus(vehicleId, currTask);
|
||||||
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
//新建一条执行任务的关系表存放任务执行信息,终点为缓存区空闲库位
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask = new RunTask();
|
||||||
runTask.setTaskId(currTask.getId());
|
runTask.setTaskId(currTask.getId());
|
||||||
runTask.setTaskCode(currTask.getTaskCode());
|
runTask.setTaskCode(currTask.getTaskCode());
|
||||||
runTask.setVehicleId(vehicleId);
|
runTask.setVehicleId(vehicleId);
|
||||||
@ -311,7 +315,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
currTask.setOutRunTaskId(runTask.getId());
|
currTask.setOutRunTaskId(runTask.getId());
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
//添加一条库位详情到in_stock_info表
|
//添加一条库位详情到in_stock_info表
|
||||||
InStockInfo inStockInfo=new InStockInfo();
|
InStockInfo inStockInfo = new InStockInfo();
|
||||||
inStockInfo.setStatus(1);
|
inStockInfo.setStatus(1);
|
||||||
inStockInfo.setInterCode(IDGenerator.gen("HCT", "yyyyMMddHHmm", 2, "WAREHOUSE_CODE"));
|
inStockInfo.setInterCode(IDGenerator.gen("HCT", "yyyyMMddHHmm", 2, "WAREHOUSE_CODE"));
|
||||||
inStockInfo.setTaskId(currTask.getId());
|
inStockInfo.setTaskId(currTask.getId());
|
||||||
@ -326,11 +330,11 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
||||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||||
if (status==1){
|
if (status == 1) {
|
||||||
|
|
||||||
// TODO: 2022/7/7 加工完成,记录结束时能源消耗
|
// TODO: 2022/7/7 加工完成,记录结束时能源消耗
|
||||||
asynEndRecordConsume(currTaskId,currTask.getKilnId());
|
asynEndRecordConsume(currTaskId, currTask.getKilnId());
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||||
//更新关系表状态为完成
|
//更新关系表状态为完成
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTask.setStatus(2);
|
runTask.setStatus(2);
|
||||||
@ -349,16 +353,16 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
// TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单,等所有加工步骤都完成后上报apms完成生产单。
|
// TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单,等所有加工步骤都完成后上报apms完成生产单。
|
||||||
logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"开始上报apm完成处理生产单!");
|
logger.info("任务:" + currTaskId + " 生产单号:" + currTask.getSheetNo() + "开始上报apm完成处理生产单!");
|
||||||
ApmsEndProcess apmsEndProcess=new ApmsEndProcess();
|
ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
|
||||||
apmsEndProcess.setEndTime(LocalDateTime.now().toString());
|
apmsEndProcess.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
apmsEndProcess.setEndUser("QJJP03");
|
apmsEndProcess.setEndUser("QJJP03");
|
||||||
apmsEndProcess.setSheetNo(currTask.getSheetNo());
|
apmsEndProcess.setSheetNo(currTask.getSheetNo());
|
||||||
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
|
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
|
||||||
if (apmsEndProcessVoR.getCode()!=0){
|
if (apmsEndProcessVoR.getCode() != 0) {
|
||||||
logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"上报apm完成处理生产单失败!");
|
logger.info("任务:" + currTaskId + " 生产单号:" + currTask.getSheetNo() + "上报apm完成处理生产单失败!");
|
||||||
}
|
}
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
//两步且是第二步
|
//两步且是第二步
|
||||||
List<AutoExeTask> twoSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
|
List<AutoExeTask> twoSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
|
||||||
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 1)
|
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 1)
|
||||||
@ -367,20 +371,20 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
List<AutoExeTask> threeSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
|
List<AutoExeTask> threeSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
|
||||||
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 2)
|
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 2)
|
||||||
.eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
.eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
||||||
if (!(threeSpet.size()!=0||twoSpet.size()!=0)){
|
if (!(threeSpet.size() != 0 || twoSpet.size() != 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("任务:"+currTask.getTaskCode()+"开始上报apms完成生产单!");
|
logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单!");
|
||||||
ApmsFinishProcessSheet apmsFinishProcessSheet=new ApmsFinishProcessSheet();
|
ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet();
|
||||||
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
|
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
|
||||||
apmsFinishProcessSheet.setEndTime(LocalDateTime.now().toString());
|
apmsFinishProcessSheet.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
apmsFinishProcessSheet.setEndUser("QJJP03");
|
apmsFinishProcessSheet.setEndUser("QJJP03");
|
||||||
List<FinishItem> finishItems=new ArrayList<>();
|
List<FinishItem> finishItems = new ArrayList<>();
|
||||||
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTaskId));
|
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTaskId));
|
||||||
for (CurrTaskDet currTaskDet:currTaskDets
|
for (CurrTaskDet currTaskDet : currTaskDets
|
||||||
) {
|
) {
|
||||||
FinishItem finishItem=new FinishItem();
|
FinishItem finishItem = new FinishItem();
|
||||||
BigDecimal bigDecimal = new BigDecimal(currTaskDet.getWeight());
|
BigDecimal bigDecimal = new BigDecimal(currTaskDet.getWeight());
|
||||||
finishItem.setFinishWeight(bigDecimal.doubleValue());
|
finishItem.setFinishWeight(bigDecimal.doubleValue());
|
||||||
finishItem.setFinishQuantity(Math.round(currTaskDet.getQuantity()));
|
finishItem.setFinishQuantity(Math.round(currTaskDet.getQuantity()));
|
||||||
@ -389,67 +393,68 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
}
|
}
|
||||||
apmsFinishProcessSheet.setItems(finishItems);
|
apmsFinishProcessSheet.setItems(finishItems);
|
||||||
R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet);
|
R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet);
|
||||||
if (apmsFinishProcessSheetVoR.getCode()!=0){
|
if (apmsFinishProcessSheetVoR.getCode() != 0) {
|
||||||
logger.info("任务:"+currTask.getTaskCode()+"完成后上报apms完成生产单失败!");
|
logger.info("任务:" + currTask.getTaskCode() + "完成后上报apms完成生产单失败!");
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.updateById(runTask);
|
runTaskServiceBiz.updateById(runTask);
|
||||||
logger.info("任务 "+currTask.getTaskCode()+" 车辆从窑炉到缓存区过程中失败。");
|
logger.info("任务 " + currTask.getTaskCode() + " 车辆从窑炉到缓存区过程中失败。");
|
||||||
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行失败===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
||||||
// 2021/12/14 websocket推送到前端
|
// 2021/12/14 websocket推送到前端
|
||||||
webSocketServer.sendtoAll("任务 "+currTask.getTaskCode()+" 车辆从窑炉到缓存区过程中失败。");
|
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从窑炉到缓存区过程中失败。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//出库。起点为缓存区库位,终点为提升台
|
//出库。起点为缓存区库位,终点为提升台
|
||||||
@Async("asyncServiceExecutor")
|
@Async("asyncServiceExecutor")
|
||||||
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) {
|
||||||
Long anotherVehicleId=2L;
|
Long anotherVehicleId = 2L;
|
||||||
Boolean rgv2Online = rgvOnline(anotherVehicleId);
|
Boolean rgv2Online = rgvOnline(anotherVehicleId);
|
||||||
if (rgv2Online){
|
if (rgv2Online) {
|
||||||
//获取RGV2当前位置
|
//获取RGV2当前位置
|
||||||
Double rgv2CurrPosition = RGVCurrPosition(2);
|
Double rgv2CurrPosition = RGVCurrPosition(2);
|
||||||
//两辆小车是否冲突
|
//两辆小车是否冲突
|
||||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv2CurrPosition);
|
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv2CurrPosition);
|
||||||
if (conflictBoolean){
|
if (conflictBoolean) {
|
||||||
Integer status = moveRgv(2, 1L, 2,0);
|
Integer status = moveRgv(2, 1L, 2, 0);
|
||||||
if (status!=1){
|
if (status != 1) {
|
||||||
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败===");
|
logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行失败===");
|
||||||
// 2022/3/6 websocket通知页面
|
// 2022/3/6 websocket通知页面
|
||||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行失败");
|
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行失败");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位39,执行成功===");
|
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行成功===");
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
logger.info("RGV2不在线,跳过检测是否避让。");
|
logger.info("RGV2不在线,跳过检测是否避让。");
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
Boolean rgv1Online = rgvOnline(1L);
|
Boolean rgv1Online = rgvOnline(1L);
|
||||||
if (rgv1Online){
|
if (rgv1Online) {
|
||||||
//获取RGV1当前位置
|
//获取RGV1当前位置
|
||||||
Double rgv1CurrPosition = RGVCurrPosition(1);
|
Double rgv1CurrPosition = RGVCurrPosition(1);
|
||||||
//两辆小车是否冲突
|
//两辆小车是否冲突
|
||||||
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv1CurrPosition);
|
Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv1CurrPosition);
|
||||||
if (conflictBoolean){
|
if (conflictBoolean) {
|
||||||
Integer status = moveRgv(1, 1L, 12,0);
|
Integer status = moveRgv(1, 1L, 12, 0);
|
||||||
if (status!=1){
|
if (status != 1) {
|
||||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败===");
|
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败===");
|
||||||
// 2022/3/6 websocket通知页面
|
// 2022/3/6 websocket通知页面
|
||||||
webSocketServer.sendtoAll(LocalDateTime.now()+"执行出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行失败");
|
webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆"+vehicleId+"移动到点位1,执行成功===");
|
logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行成功===");
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
logger.info("RGV1不在线,跳过检测是否避让。");
|
logger.info("RGV1不在线,跳过检测是否避让。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RunTask runTask=new RunTask();
|
RunTask runTask = new RunTask();
|
||||||
// setCommonField(runTask);
|
// setCommonField(runTask);
|
||||||
runTask.setVehicleId(vehicleId);
|
runTask.setVehicleId(vehicleId);
|
||||||
runTask.setBeginTime(LocalDateTime.now());
|
runTask.setBeginTime(LocalDateTime.now());
|
||||||
@ -466,8 +471,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
||||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||||
Integer status = sendTaskToRgv(vehicleId, 0L, startPoint, endPoint, 0);
|
Integer status = sendTaskToRgv(vehicleId, 0L, startPoint, endPoint, 0);
|
||||||
if (status==1){
|
if (status == 1) {
|
||||||
logger.info("===执行任务出库任务,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
|
logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||||
//更新调度任务表状态为完成
|
//更新调度任务表状态为完成
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTask.setStatus(2);
|
runTask.setStatus(2);
|
||||||
@ -478,8 +483,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
inStockInfo.setInTime(LocalDateTime.now());
|
inStockInfo.setInTime(LocalDateTime.now());
|
||||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||||
//缓存区存储历史
|
//缓存区存储历史
|
||||||
InStockInfoHis inStockInfoHis=new InStockInfoHis();
|
InStockInfoHis inStockInfoHis = new InStockInfoHis();
|
||||||
BeanUtils.copyProperties(inStockInfo,inStockInfoHis);
|
BeanUtils.copyProperties(inStockInfo, inStockInfoHis);
|
||||||
inStockInfoHisServiceBiz.save(inStockInfoHis);
|
inStockInfoHisServiceBiz.save(inStockInfoHis);
|
||||||
inStockInfoServiceBiz.removeById(inStockInfo.getId());
|
inStockInfoServiceBiz.removeById(inStockInfo.getId());
|
||||||
//更新库位状态
|
//更新库位状态
|
||||||
@ -489,37 +494,38 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
|
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
|
||||||
vehicleInfo.setStatus(0);
|
vehicleInfo.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
vehicleInfoServiceBiz.updateById(vehicleInfo);
|
||||||
}else {
|
} else {
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.updateById(runTask);
|
runTaskServiceBiz.updateById(runTask);
|
||||||
logger.info("任务 "+runTask.getTaskCode()+" 车辆从缓存区到提升平台过程中失败。");
|
logger.info("任务 " + runTask.getTaskCode() + " 车辆从缓存区到提升平台过程中失败。");
|
||||||
logger.info("===执行任务出库任务,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行失败===");
|
logger.info("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
||||||
System.out.println("===执行任务出库任务,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行失败===");
|
System.out.println("===执行任务出库任务,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
||||||
// 2021/12/14 websocket推送到前端
|
// 2021/12/14 websocket推送到前端
|
||||||
webSocketServer.sendtoAll("出库任务车辆从缓存区到提升平台过程中失败。");
|
webSocketServer.sendtoAll("出库任务车辆从缓存区到提升平台过程中失败。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//允许进炉信号为true,记录开始加工时的能源消耗数据,再写定时任务记录加工过程的消耗数据,再写一个异步方法,加工任务结束的时候记录一下各项消耗的值
|
//允许进炉信号为true,记录开始加工时的能源消耗数据,再写定时任务记录加工过程的消耗数据,再写一个异步方法,加工任务结束的时候记录一下各项消耗的值
|
||||||
public void asynStartRecordConsume(Long currTaskId,Long kilnId){
|
public void asynStartRecordConsume(Long currTaskId, Long kilnId) {
|
||||||
// TODO: 2022/2/17
|
// TODO: 2022/2/17
|
||||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||||
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
||||||
.eq(PlcNameSpace.EQ_ID, kilnId)
|
.eq(PlcNameSpace.EQ_ID, kilnId)
|
||||||
.eq(PlcNameSpace.EQ_TYPE, 0));
|
.eq(PlcNameSpace.EQ_TYPE, 0));
|
||||||
String nameSpaceNote = nameSpace.getName();
|
String nameSpaceNote = nameSpace.getName();
|
||||||
switch (kilnInfo.getType()){
|
switch (kilnInfo.getType()) {
|
||||||
//加工炉
|
//加工炉
|
||||||
case 1:
|
case 1:
|
||||||
//实际温度
|
//实际温度
|
||||||
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
|
Double actualTemp = readPlc(nameSpaceNote, "ActualTemp");
|
||||||
//设定温度
|
//设定温度
|
||||||
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
|
Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
|
||||||
//油槽实际温度
|
//油槽实际温度
|
||||||
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
|
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
|
||||||
//油槽设定温度
|
//油槽设定温度
|
||||||
Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp");
|
Double setUpOilTemp = readPlc(nameSpaceNote, "SetUpOilTemp");
|
||||||
ParTemValue parTemValue=new ParTemValue();
|
ParTemValue parTemValue = new ParTemValue();
|
||||||
parTemValue.setSetTemValue(setUpTemp.floatValue());
|
parTemValue.setSetTemValue(setUpTemp.floatValue());
|
||||||
parTemValue.setActTemValue(actualTemp.floatValue());
|
parTemValue.setActTemValue(actualTemp.floatValue());
|
||||||
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
|
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
|
||||||
@ -529,12 +535,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parTemValue.setCreateTime(LocalDateTime.now());
|
parTemValue.setCreateTime(LocalDateTime.now());
|
||||||
parTemValueServiceBiz.save(parTemValue);
|
parTemValueServiceBiz.save(parTemValue);
|
||||||
//电度值
|
//电度值
|
||||||
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
|
Double electricalValue = readPlc(nameSpaceNote, "ElectricalValue");
|
||||||
//A向电压
|
//A向电压
|
||||||
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue=new ParEleValue();
|
ParEleValue parEleValue = new ParEleValue();
|
||||||
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -547,7 +553,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
|
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
|
||||||
//二号油搅拌转速
|
//二号油搅拌转速
|
||||||
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
|
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
|
||||||
ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue();
|
ParRotSpeedValue parRotSpeedValue = new ParRotSpeedValue();
|
||||||
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
|
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
|
||||||
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
|
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
|
||||||
parRotSpeedValue.setKilnId(kilnId);
|
parRotSpeedValue.setKilnId(kilnId);
|
||||||
@ -566,7 +572,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
|
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
|
||||||
//设定碳势
|
//设定碳势
|
||||||
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
|
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
|
||||||
ParGasValue parGasValue=new ParGasValue();
|
ParGasValue parGasValue = new ParGasValue();
|
||||||
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
|
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
|
||||||
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
||||||
parGasValue.setMethanolFlow(methanolFlow.floatValue());
|
parGasValue.setMethanolFlow(methanolFlow.floatValue());
|
||||||
@ -581,10 +587,10 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//回火炉
|
//回火炉
|
||||||
case 2:
|
case 2:
|
||||||
//实际温度
|
//实际温度
|
||||||
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
|
actualTemp = readPlc(nameSpaceNote, "ActualTemp");
|
||||||
//设定温度
|
//设定温度
|
||||||
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
|
setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
|
||||||
ParTemValue parTemValue2=new ParTemValue();
|
ParTemValue parTemValue2 = new ParTemValue();
|
||||||
parTemValue2.setSetTemValue(setUpTemp.floatValue());
|
parTemValue2.setSetTemValue(setUpTemp.floatValue());
|
||||||
parTemValue2.setActTemValue(actualTemp.floatValue());
|
parTemValue2.setActTemValue(actualTemp.floatValue());
|
||||||
parTemValue2.setKilnId(kilnId);
|
parTemValue2.setKilnId(kilnId);
|
||||||
@ -592,12 +598,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parTemValue2.setCreateTime(LocalDateTime.now());
|
parTemValue2.setCreateTime(LocalDateTime.now());
|
||||||
parTemValueServiceBiz.save(parTemValue2);
|
parTemValueServiceBiz.save(parTemValue2);
|
||||||
//电度值
|
//电度值
|
||||||
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
|
electricalValue = readPlc(nameSpaceNote, "TotalElectricity");
|
||||||
//A向电压
|
//A向电压
|
||||||
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue2=new ParEleValue();
|
ParEleValue parEleValue2 = new ParEleValue();
|
||||||
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -610,16 +616,16 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//氮化炉
|
//氮化炉
|
||||||
case 3:
|
case 3:
|
||||||
//实际温度
|
//实际温度
|
||||||
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
|
actualTemp = readPlc(nameSpaceNote, "ActualTemp");
|
||||||
//设定温度
|
//设定温度
|
||||||
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
|
setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
|
||||||
//炉压
|
//炉压
|
||||||
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
|
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
|
||||||
//外一区温度
|
//外一区温度
|
||||||
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
|
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
|
||||||
//外二区温度
|
//外二区温度
|
||||||
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
|
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
|
||||||
ParTemValue parTemValue3=new ParTemValue();
|
ParTemValue parTemValue3 = new ParTemValue();
|
||||||
parTemValue3.setSetTemValue(setUpTemp.floatValue());
|
parTemValue3.setSetTemValue(setUpTemp.floatValue());
|
||||||
parTemValue3.setActTemValue(actualTemp.floatValue());
|
parTemValue3.setActTemValue(actualTemp.floatValue());
|
||||||
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
|
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
|
||||||
@ -630,12 +636,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parTemValue3.setCreateTime(LocalDateTime.now());
|
parTemValue3.setCreateTime(LocalDateTime.now());
|
||||||
parTemValueServiceBiz.save(parTemValue3);
|
parTemValueServiceBiz.save(parTemValue3);
|
||||||
//电度值
|
//电度值
|
||||||
electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
|
electricalValue = readPlc(nameSpaceNote, "ElectricalValue");
|
||||||
//A向电压
|
//A向电压
|
||||||
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue3=new ParEleValue();
|
ParEleValue parEleValue3 = new ParEleValue();
|
||||||
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -653,12 +659,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//分解率
|
//分解率
|
||||||
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
|
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
|
||||||
//氨气量
|
//氨气量
|
||||||
ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow");
|
ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow");
|
||||||
//氮气量
|
//氮气量
|
||||||
nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow");
|
nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
|
||||||
//二氧化碳量
|
//二氧化碳量
|
||||||
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CarbonDioxideFlow");
|
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CarbonDioxideFlow");
|
||||||
ParGasValue parGasValue3=new ParGasValue();
|
ParGasValue parGasValue3 = new ParGasValue();
|
||||||
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
|
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
|
||||||
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
||||||
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
|
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
|
||||||
@ -673,12 +679,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//清洗炉
|
//清洗炉
|
||||||
case 4:
|
case 4:
|
||||||
//电度值
|
//电度值
|
||||||
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
|
electricalValue = readPlc(nameSpaceNote, "TotalElectricity");
|
||||||
//A向电压
|
//A向电压
|
||||||
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue4=new ParEleValue();
|
ParEleValue parEleValue4 = new ParEleValue();
|
||||||
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -689,29 +695,30 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parEleValueServiceBiz.save(parEleValue4);
|
parEleValueServiceBiz.save(parEleValue4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.info("任务:"+currTaskId+"开始在"+kilnInfo.getKilnName()+"加工,能源消耗开始统计。");
|
logger.info("任务:" + currTaskId + "开始在" + kilnInfo.getKilnName() + "加工,能源消耗开始统计。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//允许出炉信号为true,记录结束加工时的能源消耗数据
|
//允许出炉信号为true,记录结束加工时的能源消耗数据
|
||||||
public void asynEndRecordConsume(Long currTaskId,Long kilnId){
|
public void asynEndRecordConsume(Long currTaskId, Long kilnId) {
|
||||||
// TODO: 2022/2/17
|
// TODO: 2022/2/17
|
||||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||||
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
|
||||||
.eq(PlcNameSpace.EQ_ID, kilnId)
|
.eq(PlcNameSpace.EQ_ID, kilnId)
|
||||||
.eq(PlcNameSpace.EQ_TYPE, 0));
|
.eq(PlcNameSpace.EQ_TYPE, 0));
|
||||||
String nameSpaceNote = nameSpace.getName();
|
String nameSpaceNote = nameSpace.getName();
|
||||||
switch (kilnInfo.getType()){
|
switch (kilnInfo.getType()) {
|
||||||
//加工炉
|
//加工炉
|
||||||
case 1:
|
case 1:
|
||||||
//实际温度
|
//实际温度
|
||||||
Double actualTemp =readPlc(nameSpaceNote,"ActualTemp");
|
Double actualTemp = readPlc(nameSpaceNote, "ActualTemp");
|
||||||
//设定温度
|
//设定温度
|
||||||
Double setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
|
Double setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
|
||||||
//油槽实际温度
|
//油槽实际温度
|
||||||
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
|
Double actualOilTemp = readPlc(nameSpaceNote, "ActualOilTemp");
|
||||||
//油槽设定温度
|
//油槽设定温度
|
||||||
Double setUpOilTemp = readPlc(nameSpaceNote,"SetUpOilTemp");
|
Double setUpOilTemp = readPlc(nameSpaceNote, "SetUpOilTemp");
|
||||||
ParTemValue parTemValue=new ParTemValue();
|
ParTemValue parTemValue = new ParTemValue();
|
||||||
parTemValue.setSetTemValue(setUpTemp.floatValue());
|
parTemValue.setSetTemValue(setUpTemp.floatValue());
|
||||||
parTemValue.setActTemValue(actualTemp.floatValue());
|
parTemValue.setActTemValue(actualTemp.floatValue());
|
||||||
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
|
parTemValue.setOilTankSetTemValue(setUpOilTemp.floatValue());
|
||||||
@ -721,12 +728,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parTemValue.setCreateTime(LocalDateTime.now());
|
parTemValue.setCreateTime(LocalDateTime.now());
|
||||||
parTemValueServiceBiz.save(parTemValue);
|
parTemValueServiceBiz.save(parTemValue);
|
||||||
//电度值
|
//电度值
|
||||||
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
|
Double electricalValue = readPlc(nameSpaceNote, "ElectricalValue");
|
||||||
//A向电压
|
//A向电压
|
||||||
Double phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
Double phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
Double phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
Double phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue=new ParEleValue();
|
ParEleValue parEleValue = new ParEleValue();
|
||||||
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -739,7 +746,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
|
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
|
||||||
//二号油搅拌转速
|
//二号油搅拌转速
|
||||||
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
|
Double oilStirringSpeed2 = readPlc(nameSpaceNote, "OilStirringSpeed2");
|
||||||
ParRotSpeedValue parRotSpeedValue=new ParRotSpeedValue();
|
ParRotSpeedValue parRotSpeedValue = new ParRotSpeedValue();
|
||||||
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
|
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed1.floatValue());
|
||||||
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
|
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
|
||||||
parRotSpeedValue.setKilnId(kilnId);
|
parRotSpeedValue.setKilnId(kilnId);
|
||||||
@ -758,7 +765,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
|
Double actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
|
||||||
//设定碳势
|
//设定碳势
|
||||||
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
|
Double setupCarbon = readPlc(nameSpaceNote, "SetupCarbon");
|
||||||
ParGasValue parGasValue=new ParGasValue();
|
ParGasValue parGasValue = new ParGasValue();
|
||||||
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
|
parGasValue.setNitFlowValue(nitrogenFlow.floatValue());
|
||||||
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
parGasValue.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
||||||
parGasValue.setMethanolFlow(methanolFlow.floatValue());
|
parGasValue.setMethanolFlow(methanolFlow.floatValue());
|
||||||
@ -773,10 +780,10 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//回火炉
|
//回火炉
|
||||||
case 2:
|
case 2:
|
||||||
//实际温度
|
//实际温度
|
||||||
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
|
actualTemp = readPlc(nameSpaceNote, "ActualTemp");
|
||||||
//设定温度
|
//设定温度
|
||||||
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
|
setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
|
||||||
ParTemValue parTemValue2=new ParTemValue();
|
ParTemValue parTemValue2 = new ParTemValue();
|
||||||
parTemValue2.setSetTemValue(setUpTemp.floatValue());
|
parTemValue2.setSetTemValue(setUpTemp.floatValue());
|
||||||
parTemValue2.setActTemValue(actualTemp.floatValue());
|
parTemValue2.setActTemValue(actualTemp.floatValue());
|
||||||
parTemValue2.setKilnId(kilnId);
|
parTemValue2.setKilnId(kilnId);
|
||||||
@ -784,12 +791,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parTemValue2.setCreateTime(LocalDateTime.now());
|
parTemValue2.setCreateTime(LocalDateTime.now());
|
||||||
parTemValueServiceBiz.save(parTemValue2);
|
parTemValueServiceBiz.save(parTemValue2);
|
||||||
//电度值
|
//电度值
|
||||||
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
|
electricalValue = readPlc(nameSpaceNote, "TotalElectricity");
|
||||||
//A向电压
|
//A向电压
|
||||||
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue2=new ParEleValue();
|
ParEleValue parEleValue2 = new ParEleValue();
|
||||||
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue2.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue2.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue2.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -802,16 +809,16 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//氮化炉
|
//氮化炉
|
||||||
case 3:
|
case 3:
|
||||||
//实际温度
|
//实际温度
|
||||||
actualTemp =readPlc(nameSpaceNote,"ActualTemp");
|
actualTemp = readPlc(nameSpaceNote, "ActualTemp");
|
||||||
//设定温度
|
//设定温度
|
||||||
setUpTemp = readPlc(nameSpaceNote,"SetUpTemp");
|
setUpTemp = readPlc(nameSpaceNote, "SetUpTemp");
|
||||||
//炉压
|
//炉压
|
||||||
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
|
Double furnacePressure = readPlc(nameSpaceNote, "FurnacePressure");
|
||||||
//外一区温度
|
//外一区温度
|
||||||
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
|
Double outerZoneITemperature = readPlc(nameSpaceNote, "OuterZoneITemperature");
|
||||||
//外二区温度
|
//外二区温度
|
||||||
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
|
Double outerZone2Temperature = readPlc(nameSpaceNote, "OuterZone2Temperature");
|
||||||
ParTemValue parTemValue3=new ParTemValue();
|
ParTemValue parTemValue3 = new ParTemValue();
|
||||||
parTemValue3.setSetTemValue(setUpTemp.floatValue());
|
parTemValue3.setSetTemValue(setUpTemp.floatValue());
|
||||||
parTemValue3.setActTemValue(actualTemp.floatValue());
|
parTemValue3.setActTemValue(actualTemp.floatValue());
|
||||||
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
|
parTemValue3.setOuterZone1Temp(outerZoneITemperature.floatValue());
|
||||||
@ -822,12 +829,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parTemValue3.setCreateTime(LocalDateTime.now());
|
parTemValue3.setCreateTime(LocalDateTime.now());
|
||||||
parTemValueServiceBiz.save(parTemValue3);
|
parTemValueServiceBiz.save(parTemValue3);
|
||||||
//电度值
|
//电度值
|
||||||
electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
|
electricalValue = readPlc(nameSpaceNote, "ElectricalValue");
|
||||||
//A向电压
|
//A向电压
|
||||||
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue3=new ParEleValue();
|
ParEleValue parEleValue3 = new ParEleValue();
|
||||||
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue3.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue3.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue3.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -845,12 +852,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//分解率
|
//分解率
|
||||||
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
|
Double decompositionRate = readPlc(nameSpaceNote, "DecompositionRate");
|
||||||
//氨气量
|
//氨气量
|
||||||
ammoniaFlow=readPlc(nameSpaceNote,"AmmoniaFlow");
|
ammoniaFlow = readPlc(nameSpaceNote, "AmmoniaFlow");
|
||||||
//氮气量
|
//氮气量
|
||||||
nitrogenFlow=readPlc(nameSpaceNote,"NitrogenFlow");
|
nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
|
||||||
//二氧化碳量
|
//二氧化碳量
|
||||||
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CarbonDioxideFlow");
|
Double carbonDioxideFlow = readPlc(nameSpaceNote, "CarbonDioxideFlow");
|
||||||
ParGasValue parGasValue3=new ParGasValue();
|
ParGasValue parGasValue3 = new ParGasValue();
|
||||||
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
|
parGasValue3.setNitFlowValue(nitrogenFlow.floatValue());
|
||||||
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
parGasValue3.setAmmoniaFlowValue(ammoniaFlow.floatValue());
|
||||||
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
|
parGasValue3.setActualNitPotValue(actualCarbon.floatValue());
|
||||||
@ -865,12 +872,12 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//清洗炉
|
//清洗炉
|
||||||
case 4:
|
case 4:
|
||||||
//电度值
|
//电度值
|
||||||
electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
|
electricalValue = readPlc(nameSpaceNote, "TotalElectricity");
|
||||||
//A向电压
|
//A向电压
|
||||||
phaseAVoltage = readPlc(nameSpaceNote,"PhaseAVoltage");
|
phaseAVoltage = readPlc(nameSpaceNote, "PhaseAVoltage");
|
||||||
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
phaseBVoltage = readPlc(nameSpaceNote, "PhaseBVoltage");
|
||||||
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
phaseCVoltage = readPlc(nameSpaceNote, "PhaseCVoltage");
|
||||||
ParEleValue parEleValue4=new ParEleValue();
|
ParEleValue parEleValue4 = new ParEleValue();
|
||||||
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
|
parEleValue4.setAVoltagevValue(phaseAVoltage.floatValue());
|
||||||
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
|
parEleValue4.setAVoltagevValue(phaseBVoltage.floatValue());
|
||||||
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
|
parEleValue4.setAVoltagevValue(phaseCVoltage.floatValue());
|
||||||
@ -881,27 +888,29 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
parEleValueServiceBiz.save(parEleValue4);
|
parEleValueServiceBiz.save(parEleValue4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.info("任务:"+currTaskId+"开始在"+kilnInfo.getKilnName()+"加工,能源消耗开始统计。");
|
logger.info("任务:" + currTaskId + "开始在" + kilnInfo.getKilnName() + "加工,能源消耗开始统计。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取变量值
|
* 获取变量值
|
||||||
|
*
|
||||||
* @param nameSpace nameSpace前缀
|
* @param nameSpace nameSpace前缀
|
||||||
* @param variableName 变量名称
|
* @param variableName 变量名称
|
||||||
* @return 变量值
|
* @return 变量值
|
||||||
*/
|
*/
|
||||||
private Double readPlc(String nameSpace, String variableName){
|
private Double readPlc(String nameSpace, String variableName) {
|
||||||
String identifier=nameSpace.concat(variableName);
|
String identifier = nameSpace.concat(variableName);
|
||||||
Map<String, Object> json = new HashMap();
|
Map<String, Object> json = new HashMap();
|
||||||
json.put("nameSpace", 6);
|
json.put("nameSpace", 6);
|
||||||
json.put("plcName", "plc1");
|
json.put("plcName", "plc1");
|
||||||
json.put("identifier",identifier);
|
json.put("identifier", identifier);
|
||||||
String result = null;
|
String result = null;
|
||||||
try {
|
try {
|
||||||
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.info("能源消耗统计:获取 "+identifier+" 的值失败");
|
logger.info("能源消耗统计:获取 " + identifier + " 的值失败");
|
||||||
}
|
}
|
||||||
return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
|
return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||||
}
|
}
|
||||||
@ -909,17 +918,18 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
/**
|
/**
|
||||||
* RGV1的当前位置
|
* RGV1的当前位置
|
||||||
* id 小车表示
|
* id 小车表示
|
||||||
|
*
|
||||||
* @return 小车位置值(距离原点的值)
|
* @return 小车位置值(距离原点的值)
|
||||||
*/
|
*/
|
||||||
private Double RGVCurrPosition(Integer id){
|
private Double RGVCurrPosition(Integer id) {
|
||||||
Map<String, Object> json = new HashMap();
|
Map<String, Object> json = new HashMap();
|
||||||
json.put("nameSpace", 6);
|
json.put("nameSpace", 6);
|
||||||
json.put("plcName", "plc1");
|
json.put("plcName", "plc1");
|
||||||
if (id==1){
|
if (id == 1) {
|
||||||
json.put("identifier","S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.CurrentPosition");
|
json.put("identifier", "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV1ToWCS.CurrentPosition");
|
||||||
}
|
}
|
||||||
if (id==2){
|
if (id == 2) {
|
||||||
json.put("identifier","S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.CurrentPosition");
|
json.put("identifier", "S7-1200 station_2.Boutique.DB500_PLCToWCS.RGV2ToWCS.CurrentPosition");
|
||||||
}
|
}
|
||||||
String result = null;
|
String result = null;
|
||||||
try {
|
try {
|
||||||
@ -929,17 +939,18 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
logger.info("获取RGV1的当前位置失败");
|
logger.info("获取RGV1的当前位置失败");
|
||||||
}
|
}
|
||||||
Double value = Double.valueOf(JSONObject.parseObject(result).get("result").toString());
|
Double value = Double.valueOf(JSONObject.parseObject(result).get("result").toString());
|
||||||
return value*0.0001;
|
return value * 0.0001;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移动RGV
|
* 移动RGV
|
||||||
|
*
|
||||||
* @param vehicleId 车辆id
|
* @param vehicleId 车辆id
|
||||||
* @param currTaskId 任务id
|
* @param currTaskId 任务id
|
||||||
* @param sendRow 终点
|
* @param sendRow 终点
|
||||||
* @return json字符串
|
* @return json字符串
|
||||||
*/
|
*/
|
||||||
private Integer moveRgv(Integer vehicleId,Long currTaskId,Integer sendRow,Integer processNumber){
|
private Integer moveRgv(Integer vehicleId, Long currTaskId, Integer sendRow, Integer processNumber) {
|
||||||
//若冲突
|
//若冲突
|
||||||
// 执行小车移位任务,移位任务可以直接让小车移位到两端
|
// 执行小车移位任务,移位任务可以直接让小车移位到两端
|
||||||
Map<String, Object> json = new HashMap();
|
Map<String, Object> json = new HashMap();
|
||||||
@ -948,18 +959,18 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
|
|
||||||
json.put("taskType", 4);
|
json.put("taskType", 4);
|
||||||
json.put("sendRow", sendRow);
|
json.put("sendRow", sendRow);
|
||||||
json.put("pickRow",0);
|
json.put("pickRow", 0);
|
||||||
json.put("taskNo",1);
|
json.put("taskNo", 1);
|
||||||
json.put("ideNumber",currTaskId);
|
json.put("ideNumber", currTaskId);
|
||||||
json.put("processNumber",processNumber);
|
json.put("processNumber", processNumber);
|
||||||
String taskJson = JSON.toJSONString(json);
|
String taskJson = JSON.toJSONString(json);
|
||||||
logger.info("===执行任务:"+currTaskId+" 时车辆位置冲突,即将执行车辆位移任务,车辆"+vehicleId+"移动到点位"+sendRow+"===");
|
logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,即将执行车辆位移任务,车辆" + vehicleId + "移动到点位" + sendRow + "===");
|
||||||
String result =null;
|
String result = null;
|
||||||
try {
|
try {
|
||||||
if (vehicleId==1){
|
if (vehicleId == 1) {
|
||||||
result=HttpClient.httpPost("http://192.168.6.51:8009/rgv1/sendTask",taskJson);
|
result = HttpClient.httpPost("http://192.168.6.51:8009/rgv1/sendTask", taskJson);
|
||||||
}else {
|
} else {
|
||||||
result=HttpClient.httpPost("http://192.168.6.51:8009/rgv2/sendTask",taskJson);
|
result = HttpClient.httpPost("http://192.168.6.51:8009/rgv2/sendTask", taskJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject jsonObject = JSON.parseObject(result);
|
JSONObject jsonObject = JSON.parseObject(result);
|
||||||
@ -974,6 +985,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送搬运任务到RGV
|
* 发送搬运任务到RGV
|
||||||
|
*
|
||||||
* @param vehicleId RGV
|
* @param vehicleId RGV
|
||||||
* @param currTaskId 任务id
|
* @param currTaskId 任务id
|
||||||
* @param startPoint 起点
|
* @param startPoint 起点
|
||||||
@ -981,23 +993,23 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
* @param processNumber 工艺好
|
* @param processNumber 工艺好
|
||||||
* @return status状态码
|
* @return status状态码
|
||||||
*/
|
*/
|
||||||
private Integer sendTaskToRgv(Long vehicleId,Long currTaskId,Long startPoint,Long endPoint,Integer processNumber){
|
private Integer sendTaskToRgv(Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) {
|
||||||
Map<String, Object> json = new HashMap();
|
Map<String, Object> json = new HashMap();
|
||||||
// taskType 1 搬运
|
// taskType 1 搬运
|
||||||
json.put("taskType", 1);
|
json.put("taskType", 1);
|
||||||
json.put("sendRow", endPoint);
|
json.put("sendRow", endPoint);
|
||||||
json.put("pickRow",startPoint);
|
json.put("pickRow", startPoint);
|
||||||
json.put("taskNo",currTaskId);
|
json.put("taskNo", currTaskId);
|
||||||
json.put("ideNumber",1);
|
json.put("ideNumber", 1);
|
||||||
json.put("processNumber",processNumber);
|
json.put("processNumber", processNumber);
|
||||||
String taskJson = JSON.toJSONString(json);
|
String taskJson = JSON.toJSONString(json);
|
||||||
String result =null;
|
String result = null;
|
||||||
logger.info("===执行任务:"+currTaskId+" ,即将执行车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"===");
|
logger.info("===执行任务:" + currTaskId + " ,即将执行车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "===");
|
||||||
try {
|
try {
|
||||||
if (vehicleId==1){
|
if (vehicleId == 1) {
|
||||||
result = HttpClient.httpPost("http://192.168.6.51:8009/rgv1/sendTask", taskJson);
|
result = HttpClient.httpPost("http://192.168.6.51:8009/rgv1/sendTask", taskJson);
|
||||||
}
|
}
|
||||||
if (vehicleId==2){
|
if (vehicleId == 2) {
|
||||||
result = HttpClient.httpPost("http://192.168.6.51:8009/rgv2/sendTask", taskJson);
|
result = HttpClient.httpPost("http://192.168.6.51:8009/rgv2/sendTask", taskJson);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -1008,18 +1020,65 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
return Integer.parseInt(String.valueOf(jsonObject.get("msg")));
|
return Integer.parseInt(String.valueOf(jsonObject.get("msg")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void apmsStartProcess(CurrTask currTask) {
|
/**
|
||||||
ApmsStartProcess apmsStartProcess = new ApmsStartProcess();
|
* 上报apms创建生产单并开始处理
|
||||||
apmsStartProcess.setStartTime(LocalDateTime.now().toString());
|
*
|
||||||
|
* @param currTask 任务
|
||||||
|
* @return 成功与否
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private Boolean apmsCreateProcess(CurrTask currTask) throws IOException {
|
||||||
|
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||||
|
//通知apms创建一个生产单
|
||||||
|
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||||
|
apmsCreateSheet.setWorkShopCode("BM");
|
||||||
|
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
|
apmsCreateSheet.setTechCode(currTask.getCraftCodeId().toString());
|
||||||
|
//fixme 暂时没有正式user,使用测试账户
|
||||||
|
apmsCreateSheet.setStartUser("QJJP03");
|
||||||
|
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||||
|
currTaskDetList.forEach(e -> {
|
||||||
|
CreateItem createItem = new CreateItem();
|
||||||
|
createItem.setItemCode(e.getIdenCardNum());
|
||||||
|
createItem.setQuantity(e.getQuantity().intValue());
|
||||||
|
createItem.setWeight(e.getWeight().doubleValue());
|
||||||
|
createItems.add(createItem);
|
||||||
|
});
|
||||||
|
apmsCreateSheet.setStoveCode(CodeGeneratorHelper.getStoveCode(currTask.getKilnName() + String.format("%02d", currTask.getCraftCodeId())));
|
||||||
|
apmsCreateSheet.setItems(createItems);
|
||||||
|
logger.info(currTask.getId() + "开始创建apms生产单号");
|
||||||
|
R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet);
|
||||||
|
if (!processSheet.getData().getSuccess()) {
|
||||||
|
logger.info(currTask.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||||
|
webSocketServer.sendtoUser("创建失败,APMS报错:" + processSheet.getData().getMsg(), "1");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
logger.info(currTask.getId() + "创建apms生产单号成功");
|
||||||
|
currTask.setSheetNo(processSheet.getData().getSheetNo());
|
||||||
|
currTaskServiceBiz.updateById(currTask);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报apms开始加工
|
||||||
|
* @param currTask
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Boolean apmsStartProcess(CurrTask currTask) {
|
||||||
|
ApmsStartProcess apmsStartProcess=new ApmsStartProcess();
|
||||||
apmsStartProcess.setStartUser("QJJP03");
|
apmsStartProcess.setStartUser("QJJP03");
|
||||||
apmsStartProcess.setSheetNo(currTask.getSheetNo());
|
apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
apmsStartProcess.setTechName(currTask.getCraftCodeId().toString());
|
apmsStartProcess.setTechName(currTask.getCraftCodeId().toString());
|
||||||
apmsStartProcess.setStoveCode(kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode());
|
apmsStartProcess.setSheetNo(currTask.getSheetNo());
|
||||||
|
apmsStartProcess.setStoveCode(CodeGeneratorHelper.getStoveCode(currTask.getKilnName()+String.format("%02d",currTask.getCraftCodeId())));
|
||||||
R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess);
|
R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess);
|
||||||
if (apmsStartProcessR.getCode() != 0) {
|
if (apmsStartProcessR.getCode() != 0) {
|
||||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
|
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功");
|
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 车辆是否在线
|
* 车辆是否在线
|
||||||
@ -1103,4 +1162,18 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断任务是否为单步骤任务,多步骤任务第一步
|
||||||
|
* @param currTask 任务
|
||||||
|
* @return 单步骤任务true,多步骤任务第一步true,其他false
|
||||||
|
*/
|
||||||
|
public Boolean isFirstTask(CurrTask currTask){
|
||||||
|
if (currTask.getAutoExeTaskId()==1){
|
||||||
|
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
|
||||||
|
return count>0;
|
||||||
|
}else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public class RunTaskUtils {
|
|||||||
.eq(PlcNameSpace.EQ_TYPE, 0)
|
.eq(PlcNameSpace.EQ_TYPE, 0)
|
||||||
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())).getName();
|
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())).getName();
|
||||||
String result = readPlcToString(kilnNamePlace, "AllowIn");
|
String result = readPlcToString(kilnNamePlace, "AllowIn");
|
||||||
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
|
boolean resultBoolean = Boolean.parseBoolean(JSONObject.parseObject(result).get("result").toString());
|
||||||
//窑炉状态为不可用
|
//窑炉状态为不可用
|
||||||
if (kilnInfo.getStatus() == 1) {
|
if (kilnInfo.getStatus() == 1) {
|
||||||
return R.failed("目标窑炉不可用!");
|
return R.failed("目标窑炉不可用!");
|
||||||
|
Loading…
Reference in New Issue
Block a user