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