This commit is contained in:
lgh 2022-07-07 15:22:46 +08:00
parent b2319f2a51
commit 0c67641710
3 changed files with 12 additions and 9 deletions

View File

@ -48,7 +48,7 @@ public class HttpClient {
public static String httpPost(String url, String json) throws IOException { public static String httpPost(String url, String json) throws IOException {
//OkHttpClient httpClient = new OkHttpClient(); //OkHttpClient httpClient = new OkHttpClient();
OkHttpClient httpClient = new OkHttpClient().newBuilder().connectTimeout(300L, TimeUnit.SECONDS) OkHttpClient httpClient = new OkHttpClient().newBuilder().connectTimeout(300L, TimeUnit.MINUTES)
.writeTimeout(60*30, TimeUnit.SECONDS) .writeTimeout(60*30, TimeUnit.SECONDS)
.readTimeout(60*30, TimeUnit.SECONDS) .readTimeout(60*30, TimeUnit.SECONDS)
.build(); .build();

View File

@ -128,10 +128,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());
logger.info(String.valueOf(status));
//执行成功,托盘进炉 //执行成功,托盘进炉
if (status==1){ if (status==1){
//开始记录能源消耗 // 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());
@ -215,7 +216,8 @@ public class AsynRunTaskService extends BaseService {
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue()); Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
//执行成功,托盘进炉 //执行成功,托盘进炉
if (status==1){ if (status==1){
asynStartRecordConsume(currTaskId,currTask.getKilnId()); // TODO: 2022/7/7
//asynStartRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新调度表状态为完成 //更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -413,8 +415,9 @@ public class AsynRunTaskService extends BaseService {
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){
//加工完成记录结束时能源消耗
asynEndRecordConsume(currTaskId,currTask.getKilnId()); // TODO: 2022/7/7 加工完成记录结束时能源消耗
//asynEndRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新关系表状态为完成 //更新关系表状态为完成
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());

View File

@ -77,7 +77,7 @@ public class ScheduledTask extends BaseService {
@Test @Test
public void test() throws IOException { public void test() throws IOException {
} }
@Scheduled(fixedDelay = 1000*60) //@Scheduled(fixedDelay = 1000*60)
public void testWebsocket() throws IOException { public void testWebsocket() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情 //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1)); List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
@ -179,7 +179,7 @@ public class ScheduledTask extends BaseService {
/** /**
* 查询加工完成的窑炉 * 查询加工完成的窑炉
*/ */
//@Scheduled(fixedDelay = 1000*60*3) @Scheduled(fixedDelay = 1000*60*2)
public void taskForStockToKiln() throws IOException { public void taskForStockToKiln() throws IOException {
//两辆车是否都空闲只有两辆车都空闲才被允许做任务 //两辆车是否都空闲只有两辆车都空闲才被允许做任务
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0)); List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));
@ -195,7 +195,7 @@ public class ScheduledTask extends BaseService {
Long kilnId = currTask.getKilnId(); Long kilnId = currTask.getKilnId();
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId); KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
PlcNameSpace plcNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>() PlcNameSpace plcNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 1) .eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.TYPE, 0) .eq(PlcNameSpace.TYPE, 0)
.eq(PlcNameSpace.EQ_ID,kilnId)); .eq(PlcNameSpace.EQ_ID,kilnId));
//通过允许出炉信号来判定是否加工完成 //通过允许出炉信号来判定是否加工完成