add: 联调

This commit is contained in:
ls
2024-11-28 14:53:08 +08:00
parent 073aca284d
commit 6091ad4684
12 changed files with 283 additions and 107 deletions

View File

@@ -534,6 +534,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("等待LMS系统进行确认离开设备号{},指令号:{}", device_code, ikey);
message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey;
}
}
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("finish_task"))
&& StrUtil.equals("true", device.getExtraValue().get("finish_task").toString())) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setOption(0);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -1509,12 +1514,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
//申请烘箱行架任务
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task"))
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task").toString())) {
if (manipulatorAgvStationDeviceDriver.getTo_command() != 4 && !manipulatorAgvStationDeviceDriver.getOvenGantryTask()) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
String task_code = inst.getTask_code();
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code);
@@ -1538,31 +1543,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
//行架取货完成后反馈ndc
// if ((manipulatorAgvStationDeviceDriver.getAction() == 4)) {
//
// manipulatorAgvStationDeviceDriver.setOvenGantryTask(false);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(this.getDeviceCode())
// .content("agvphase:" + phase + "反馈:" + data)
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// } else {
// log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey);
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
// .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
// .build();
// logDto.setLog_level(4);
// luceneExecuteLogService.deviceExecuteLog(logDto);
// }
} else {
// try {
// manipulatorAgvStationDeviceDriver.writing(4);
// } catch (Exception e) {
// e.printStackTrace();
// }
try {
manipulatorAgvStationDeviceDriver.writing(4);
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@@ -1783,6 +1770,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//废泊处理的时候要判断是否允许任务完成
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("finish_task"))
&& StrUtil.equals("true", device.getExtraValue().get("finish_task").toString())) {
if (standardOrdinarySiteDeviceDriver.getOption() == 3) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
} else {
log.info("等待LMS系统进行确认允许任务完成信号设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
logServer.deviceExecuteLog(device.getDevice_code(), "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content("等待LMS系统进行确认允许任务完成信号,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -1813,19 +1816,50 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
try {
manipulatorAgvStationDeviceDriver.writing(5);
} catch (Exception e) {
e.printStackTrace();
//行架到达安全位
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task"))
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task").toString())) {
//行架取货完成后反馈ndc
if ((manipulatorAgvStationDeviceDriver.getAction() == 4)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
manipulatorAgvStationDeviceDriver.setOvenGantryTask(false);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
manipulatorAgvStationDeviceDriver.writing(5);
} catch (Exception e) {
e.printStackTrace();
}
} else {
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
try {
manipulatorAgvStationDeviceDriver.writing(5);
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
manipulatorAgvStationDeviceDriver.setOvenGantryTask(true);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
try {
@@ -2034,23 +2068,42 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
//申请烘箱行架任务
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task"))
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task").toString())) {
if (manipulatorAgvStationDeviceDriver.getTo_command() != 4 && !manipulatorAgvStationDeviceDriver.getOvenGantryTask()) {
String task_code = inst.getTask_code();
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("申请烘箱行架任务,参数:" + jsonObject)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String response = acsToWmsService.applyOvenGantryTask(jsonObject);
JSONObject jo = JSON.parseObject(response);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请烘箱行架任务,参数,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
if (jo.getInteger("status") == 200) {
manipulatorAgvStationDeviceDriver.setOvenGantryTask(true);
manipulatorAgvStationDeviceDriver.writing(4);
}
}
try {
manipulatorAgvStationDeviceDriver.writing(4);
} catch (Exception e) {
e.printStackTrace();
}
//收卷辊放货忽略取货校验
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_pickup_check"))
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_pickup_check").toString())) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
try {
manipulatorAgvStationDeviceDriver.writing(4);
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
@@ -2060,7 +2113,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
try {
@@ -2204,18 +2256,51 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
try {
manipulatorAgvStationDeviceDriver.writing(5);
} catch (Exception e) {
e.printStackTrace();
//行架到达安全位
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task"))
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task").toString())) {
//行架取货完成后反馈ndc
if ((manipulatorAgvStationDeviceDriver.getAction() == 4)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
manipulatorAgvStationDeviceDriver.setOvenGantryTask(false);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
manipulatorAgvStationDeviceDriver.writing(5);
} catch (Exception e) {
e.printStackTrace();
}
} else {
log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(manipulatorAgvStationDeviceDriver.getDeviceCode())
.content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
try {
manipulatorAgvStationDeviceDriver.writing(5);
} catch (Exception e) {
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {

View File

@@ -80,7 +80,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
public int error = 0;
public int door = 0;
public float temperature = 0;
public int to_temperature = 0;
public float to_temperature = 0;
public int countdown_house = 0;
public int countdown_min = 0;
public int countdown_sec = 0;
@@ -88,7 +88,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
public int task = 0;
public int error1 = 0;
public int material = 0;
public int consumption = 0;
public float consumption = 0;
public float voltageA = 0;
public float voltageB = 0;
public float voltageC = 0;
@@ -110,7 +110,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
public int last_task = 0;
public int last_error1 = 0;
public int last_material = 0;
public int last_consumption = 0;
public float last_consumption = 0;
public float last_voltageA = 0;
public float last_voltageB = 0;
public float last_voltageC = 0;
@@ -118,6 +118,7 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
public float last_currentB = 0;
public float last_currentC = 0;
Boolean isonline = true;
Boolean iserror = false;
@@ -140,8 +141,8 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
@Override
public void execute() {
device_code = this.getDeviceCode();
device_code
= this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
@@ -251,15 +252,19 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String str = acsToWmsService.outHotTaskApply(apply);
JSONObject jo = JSON.parseObject(str);
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("烘箱完成反馈LMS,参数,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "烘箱完成反馈LMS,参数,接口返回:" + jo;
return;
if (jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("烘箱完成反馈LMS,参数,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);
message = "烘箱完成反馈LMS,参数,接口返回:" + jo;
requireSucess = true;
return;
}
}
}

View File

@@ -85,8 +85,8 @@ public class ItemProtocol {
public int getItem_error1(){
return this.getOpcIntegerValue(item_error1);
} ;
public int getItem_consumption(){
return this.getOpcIntegerValue(item_consumption);
public float getItem_consumption(){
return this.getOpcFloatValue(item_consumption);
} ;
public float getItem_voltageA(){
return this.getOpcFloatValue(item_voltageA);
@@ -107,8 +107,8 @@ public class ItemProtocol {
return this.getOpcFloatValue(item_currentC);
} ;
public int getItem_to_temperature(){
return this.getOpcIntegerValue(item_to_temperature);
public float getItem_to_temperature(){
return this.getOpcFloatValue(item_to_temperature);
} ;
Boolean isonline;

View File

@@ -953,8 +953,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (StrUtil.isNotEmpty(taskDto.getOven_time())) {
//下发烘箱时间
int time = Integer.parseInt(taskDto.getOven_time());
int hours = (time / (60 * 60)); // 整数小时
int minutes = (time % (60 * 60)) / 60; // 剩余分钟
int hours = time / 60; // 整数小时
int minutes = time % 60 ; // 剩余分钟
map.put("to_time_house", String.valueOf(hours));
map.put("to_time_min", String.valueOf(minutes));
hongXiangConveyorDeviceDriver.writing(map);
@@ -1050,6 +1050,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
instructionService.finish(inst);
return true;

View File

@@ -44,7 +44,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Override
public JSONObject getHotPointStatus(JSONArray deviceRows) {
String api = "api/wms/querydevice";
return AcsUtil.notifyAcs(api, deviceRows);
return AcsUtil.notifyAcs5(api, deviceRows);
}
@Override

View File

@@ -200,6 +200,7 @@ public class BakingPdaServiceImpl implements BakingPdaService {
rawOrder.setIs_baking(isBaking);
rawOrder.setRoll_type(rollType);
rawOrder.setWind_roll(rollCode);
rawOrder.setBaking_temperature(temperature);
rawOrder.setBaking_time(time);
TaskUtils.setRawOrderCreateByDefault(rawOrder);
rawOrder.setProduct_area("A1");

View File

@@ -44,9 +44,10 @@ public class AutoCreateInHotTask {
List<SchBasePoint> hotNotTaskPoints = pointService.getHotNotTaskPoint("A1", HX_REGION,
null, "2");
log.info("找到待烘烤的暂存位:{}", hotNotTaskPoints);
//烘箱入烘箱任务行架不支持
// 获取烘箱点位状态是暂存且需要烘烤的点位数据。
List<StIvtHotpointivt> hotPoints = hotpointivtService.getNeedBakingPoint();
log.info("找到待烘烤的烘箱位:{}", hotPoints);
// List<StIvtHotpointivt> hotPoints = hotpointivtService.getNeedBakingPoint();
// log.info("找到待烘烤的烘箱位:{}", hotPoints);
// 合并一起
List<NeedBakingDto> collect1 = hotNotTaskPoints.stream().map(item -> NeedBakingDto
.builder()
@@ -54,15 +55,16 @@ public class AutoCreateInHotTask {
.workorder_id(item.getSource_id())
.vehicle_code(item.getVehicle_code())
.update_time(item.getUpdate_time()).build()).collect(Collectors.toList());
List<NeedBakingDto> collect2 = hotPoints.stream().map(item -> NeedBakingDto
.builder()
.point_code(item.getPoint_code())
.vehicle_code(item.getFull_vehicle_code())
.workorder_id(item.getWorkorder_id())
.update_time(item.getUpdate_time()).build()).collect(Collectors.toList());
//烘箱入烘箱任务行架不支持
// List<NeedBakingDto> collect2 = hotPoints.stream().map(item -> NeedBakingDto
// .builder()
// .point_code(item.getPoint_code())
// .vehicle_code(item.getFull_vehicle_code())
// .workorder_id(item.getWorkorder_id())
// .update_time(item.getUpdate_time()).build()).collect(Collectors.toList());
List<NeedBakingDto> combinedList = new ArrayList<>();
combinedList.addAll(collect1);
combinedList.addAll(collect2);
// combinedList.addAll(collect2);
combinedList.sort(Comparator.comparing(NeedBakingDto::getUpdate_time));
log.info("排序后的数据 {}", combinedList);
// 调用自动入烘箱的任务

View File

@@ -4,11 +4,14 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.RedisUtils;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.pdm.ivt.hot.service.IstIvtHotpointivtService;
import org.nl.wms.pdm.ivt.hot.service.dao.StIvtHotpointivt;
import org.nl.wms.quartz.dto.HotDeviceAndEreaDto;
import org.nl.wms.util.URLEnum;
import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +22,7 @@ import java.util.List;
/**
* 自动查询烘箱温度
*
* @Author: lyd
* @Date: 2024/8/9
*/
@@ -31,6 +35,8 @@ public class AutoQueryDeviceStatus {
private WmsToAcsService wmsToAcsService;
@Autowired
private IstIvtHotpointivtService hotpointivtService;
@Autowired
private ISysParamService paramService;
@SneakyThrows
public void run() {
@@ -43,7 +49,7 @@ public class AutoQueryDeviceStatus {
if (device_rows.size() == 0) {
continue;
}
JSONArray array= JSONArray.parseArray(JSON.toJSONString(device_rows));
JSONArray array = JSONArray.parseArray(JSON.toJSONString(device_rows));
JSONObject jo = wmsToAcsService.getHotPointStatus(array);
JSONArray de_rows = jo.getJSONArray("data");
for (int i = 0; i < de_rows.size(); i++) {
@@ -63,9 +69,27 @@ public class AutoQueryDeviceStatus {
if (StrUtil.isEmpty(countdown_sec)) {
countdown_sec = "0";
}
String last_time = countdown_house + "小时" + countdown_min + "分钟";
redisUtils.hset(device_code, "temperature", row.getString("temperature"));
redisUtils.hset(device_code, "last_time", last_time);
//实际温度小于预设关机温度,烘箱改为关机状态
// String temperature = (String) redisUtils.hget(device_code, "temperature");
// String hotNotuseTemperature = paramService.findByCode("HOT_NOTUSE_TEMPERATURE").getValue();
// if (!StrUtil.equals(row.getString("temperature"), temperature) && row.getString("temperature").compareTo(hotNotuseTemperature) < 0) {
// hotpointivtService.update(new LambdaUpdateWrapper<StIvtHotpointivt>()
// .set(StIvtHotpointivt::getIs_used, "0")
// .eq(StIvtHotpointivt::getPoint_code, device_code));
// }
//如果烘箱关机则温度为0
if ("0".equals(row.getString("mode"))){
String last_time = countdown_house + "小时" + countdown_min + "分钟";
redisUtils.hset(device_code, "temperature","0");
redisUtils.hset(device_code, "last_time", last_time);
}else {
String last_time = countdown_house + "小时" + countdown_min + "分钟";
redisUtils.hset(device_code, "temperature", row.getString("temperature"));
redisUtils.hset(device_code, "last_time", last_time);
}
}
} catch (Exception e) {
log.info("获取温度出现异常:{}", e);

View File

@@ -35,7 +35,8 @@ import java.util.List;
public class AcsUtil {
/**
* 对数组进行拆分独自下发
* @param api 请求路径
*
* @param api 请求路径
* @param list 数据数组
* @return acs响应
*/
@@ -79,10 +80,10 @@ public class AcsUtil {
result.put("message", "网络不通,操作失败!");
result.put("data", new JSONObject());
log.error("ACS出现异常: {}", e);
log.info("下发ACS任务失败原因是----------------------------------------+"+ msg);
log.info("下发ACS任务失败原因是----------------------------------------+" + msg);
}
if (!StrUtil.equals(result.getString("status"), "200")) {
log.info("下发acs任务失败原因是----------------------------------------+"+ result.getString("message"));
log.info("下发acs任务失败原因是----------------------------------------+" + result.getString("message"));
throw new BadRequestException(result.getString("message"));
} else {
//如果向ACS下发任务变更任务状态为下发
@@ -98,16 +99,67 @@ public class AcsUtil {
}
}
log.info("下发acs任务结果是----------------------------------------+"+ result);
log.info("下发acs任务结果是----------------------------------------+" + result);
return result;
}
public static JSONObject notifyAcs5(String api, JSONArray list) {
log.info("下发ACS参数----------------------------------------+" + api + ",---" + list.toString());
//判断是否连接ACS系统
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
JSONObject result = new JSONObject();
if (StrUtil.equals("0", isConnect)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功但未连接ACS!");
result.put("data", new JSONObject());
return result;
}
JSONObject jo = list.getJSONObject(0);
String product_area = jo.getString("product_area");
if (StrUtil.isEmpty(product_area)) {
throw new BadRequestException("区域不能为空!下发信息:" + jo);
}
String acs_url = URLEnum.find(product_area);
if (StrUtil.isEmpty(acs_url)) {
log.info(product_area);
throw new BadRequestException("未查询到区域对应的acs地址");
}
String url = acs_url + api;
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(list))
.execute().body();
result = JSONObject.parseObject(resultMsg);
log.info("下发acs任务成功返回参数----------------------------------------+" + api + ",---" + result.toString());
} catch (Exception e) {
//acs抛异常这里
String msg = e.getMessage();
//ConnectException: Connection refused: connect
//网络不通
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", "网络不通,操作失败!");
result.put("data", new JSONObject());
log.error("ACS出现异常: {}", e);
log.info("下发ACS任务失败原因是----------------------------------------+" + msg);
}
if (!StrUtil.equals(result.getString("status"), "200")) {
log.info("下发acs任务失败原因是----------------------------------------+" + result.getString("message"));
throw new BadRequestException(result.getString("message"));
}
log.info("下发acs任务结果是----------------------------------------+" + result);
return result;
}
/**
* 原生默认请求方法: 默认执行的参数都是jsonArray
*
* @param api
* @param list
* @return
* @param <T>
* @return
*/
public static <T> ResultForAcs notifyAcs2(String api, List<T> list) {
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
@@ -149,10 +201,11 @@ public class AcsUtil {
/**
* 新的请求方式:对象中包含数组
*
* @param api
* @param object
* @return
* @param <T>
* @return
*/
public static <T> AcsResponse notifyAcs3(String api, T object) {
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
@@ -189,9 +242,11 @@ public class AcsUtil {
}
return resultForAcs;
}
/**
* 数组一次性下发
* @param api 请求路径
*
* @param api 请求路径
* @param list 数据数组
* @return acs响应
*/

View File

@@ -97,6 +97,9 @@ public class AutoInHotTrussTask extends AbstractTask {
}
// 临时测试
// task.setPoint_code2(hxPoint.getPoint_code());
}
if (ObjectUtil.isEmpty(task.getPoint_code2())) {
log.error("找不到缓存温度为:{} 的可用烘箱位置", bakingTemperature);
break;
}
JSONObject param = new JSONObject();

View File

@@ -70,8 +70,8 @@ public class InHotTrussTask extends AbstractTask {
String flag = "0";
PdmBiRawfoilworkorder order = rawfoilworkorderService.getByContainerName(orderCode);
// TODO: 没有设置是否烘烤、时间、温度、不继续
if (GeneralDefinition.YES.equals(order.getIs_baking())) {
String bakingTemperature = order.getBaking_temperature();
requestObj.put("baking_temperature", bakingTemperature);
requestObj.put("baking_time", order.getBaking_time());
@@ -90,7 +90,6 @@ public class InHotTrussTask extends AbstractTask {
}
// 临时测试
// task.setPoint_code2(hotPoint.getPoint_code());
break;
}
}
// 没有烘烤位置或者没有找到对应的点就区待烘烤区, 就去待烘烤

View File

@@ -10,7 +10,7 @@ nl:
password: NLABC&ld123
database: ldnx_lms2
redis:
ip: 192.168.20.15
ip: 127.0.0.1
port: 6379
password: null
database: 1