update:
apms上报失败msg推送
This commit is contained in:
parent
4af20b8551
commit
942bde619f
@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.core.dal.entity.CommunicationLog;
|
||||
@ -17,6 +18,7 @@ import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo;
|
||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
|
||||
import com.mt.wms.empty.vo.ApmsFinishProcessSheetVo;
|
||||
import com.mt.wms.empty.vo.ApmsStoveVo;
|
||||
import com.mt.wms.empty.websocket.WebSocketServer;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -27,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
@ -46,6 +50,8 @@ public class ApmsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CommunicationLogServiceBiz communicationLogServiceBiz;
|
||||
@Autowired
|
||||
private WebSocketServer webSocketServer;
|
||||
|
||||
static String Token = "";
|
||||
static LocalDateTime TokenExpireTime = LocalDateTime.now();
|
||||
@ -134,9 +140,20 @@ public class ApmsController extends BaseController {
|
||||
communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
|
||||
setCommonField(communicationLog);
|
||||
communicationLogServiceBiz.save(communicationLog);
|
||||
String body = response.body();
|
||||
JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(body);
|
||||
Object success = jsonObject.get("success");
|
||||
if (status == 200)
|
||||
{
|
||||
return successful(JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class));
|
||||
ApmsCreateProcessSheetVo apmsCreateProcessSheetVo = JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class);
|
||||
if (!apmsCreateProcessSheetVo.getSuccess()){
|
||||
try {
|
||||
webSocketServer.sendtoAll(apmsCreateProcessSheetVo.getMsg());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return successful(apmsCreateProcessSheetVo);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ public class ScheduledTask extends BaseService {
|
||||
/**
|
||||
* 正在加工的加工任务详情
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000*60)
|
||||
//Scheduled(fixedDelay = 1000*60)
|
||||
public void screen() throws IOException {
|
||||
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情
|
||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
|
||||
@ -199,7 +199,7 @@ public class ScheduledTask extends BaseService {
|
||||
/**
|
||||
* 查询加工完成的工业炉
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000*30)
|
||||
//@Scheduled(fixedDelay = 1000*30)
|
||||
public void taskForStockToKiln() throws IOException {
|
||||
//两辆车是否都空闲,只有两辆车都空闲才被允许做任务
|
||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));
|
||||
@ -250,7 +250,7 @@ public class ScheduledTask extends BaseService {
|
||||
}
|
||||
|
||||
//查询出正在加工的工业炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒
|
||||
@Scheduled(fixedDelay = 1000*30)
|
||||
//@Scheduled(fixedDelay = 1000*30)
|
||||
public void getFastValue(){
|
||||
//加工炉列表
|
||||
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE,1,3));
|
||||
@ -366,7 +366,7 @@ public class ScheduledTask extends BaseService {
|
||||
}
|
||||
|
||||
//查询出正在加工的工业炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次
|
||||
@Scheduled(fixedDelay = 1000*60*3)
|
||||
//@Scheduled(fixedDelay = 1000*60*3)
|
||||
public void getSlowValue(){
|
||||
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
|
||||
for (KilnInfo kilnInfo:kilnInfoList
|
||||
@ -538,7 +538,7 @@ public class ScheduledTask extends BaseService {
|
||||
|
||||
//遍历工业炉,空工业炉查询缓存区是否有等待加工的任务,
|
||||
//待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉
|
||||
@Scheduled(fixedDelay = 1000*60)
|
||||
//@Scheduled(fixedDelay = 1000*60)
|
||||
public void runTaskForEmptyKiln() throws IOException {
|
||||
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
|
||||
.eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0).orderByAsc(KilnInfo.TYPE));
|
||||
@ -608,7 +608,7 @@ public class ScheduledTask extends BaseService {
|
||||
}
|
||||
|
||||
//遍历正在工作炉子的报警变量,记录报警
|
||||
@Scheduled(fixedDelay = 1000*60)
|
||||
//@Scheduled(fixedDelay = 1000*60)
|
||||
public void listenKilnAlarm(){
|
||||
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
|
||||
for (KilnInfo kilnInfo:kilnInfoList
|
||||
@ -681,7 +681,7 @@ public class ScheduledTask extends BaseService {
|
||||
}
|
||||
|
||||
//监听车辆是否在线,定时恢复车辆状态会导致避让时等待时间过久,再次发起任务,造成重复发起
|
||||
@Scheduled(fixedDelay = 1000*60)
|
||||
//@Scheduled(fixedDelay = 1000*60)
|
||||
public void listenVehicleOnline() throws IOException {
|
||||
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS,1));
|
||||
for (VehicleInfo vehicleInfo:vehicleInfoList
|
||||
|
Loading…
Reference in New Issue
Block a user