rev:优化测试出现的问题

This commit is contained in:
2024-07-06 17:30:10 +08:00
parent 4f678392e0
commit d810379d1e
9 changed files with 145 additions and 63 deletions

View File

@@ -59,7 +59,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
boolean bConnected = true;
boolean isReConnect = false;
int i = 1 ;
int i = 1;
boolean requireSucessRegion = false;
boolean requireSucessTake = false;
boolean requireSucessPut = false;
@@ -191,7 +191,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
inst.setAgv_jobno(String.valueOf(index));
inst.setSend_status("1");
instructionService.update(inst);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
}
flag = true;
}
@@ -219,13 +219,13 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
e.printStackTrace();
}
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0,0,0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
}
//请求删除任务
//(需要WCS反馈)
else if (phase == 0x30) {
// data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0,0,0);
data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0, 0, 0);
}
//任务删除确认
//(需要WCS反馈)
@@ -244,21 +244,20 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
try {
standardAutodoorDeviceDriver.writing("to_open", "1");
standardAutodoorDeviceDriver.writing("to_close", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1) {
log.info("下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getOpen());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
}
try {
standardAutodoorDeviceDriver.writing("to_open", "1");
standardAutodoorDeviceDriver.writing("to_close", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
// }
if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1) {
log.info("下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getOpen());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
}
}
} else {
log.info(agvaddr + "对应设备号为空!");
}
@@ -271,16 +270,20 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
try {
standardAutodoorDeviceDriver.writing("to_close", "1");
standardAutodoorDeviceDriver.writing("to_open", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
try {
standardAutodoorDeviceDriver.writing("to_close", "1");
standardAutodoorDeviceDriver.writing("to_open", "0");
} catch (Exception e) {
log.info("下发电气信号失败:" + e.getMessage());
e.printStackTrace();
}
// }
if (standardAutodoorDeviceDriver.getClose() == 1) {
log.info("读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
log.info("未下发NDC信号原因: 读取关门信号值为:{}", standardAutodoorDeviceDriver.getClose());
}
}
} else {
log.info(device_code + "对应设备号为空!");
}

View File

@@ -1015,6 +1015,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String task_code = inst.getTask_code();
EXECUTOR.submit(() -> {
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode())
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
acsToWmsService.actionFinishRequest2(jsonObject);
}
});
} else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
try {
@@ -1053,6 +1068,21 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
String task_code = inst.getTask_code();
EXECUTOR.submit(() -> {
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
.content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode())
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
acsToWmsService.actionFinishRequest2(jsonObject);
}
});
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {

View File

@@ -66,18 +66,11 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
logServer.deviceExecuteLog(this.device_code, "", "", "信号open" + last_open + "->" + open);
}
if (close != last_close) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号close" + last_close + "->" + close);
if(close ==1 ){
this.writing("to_close","0");
}
}
if (toClose != last_toClose) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号toClose" + last_toClose + "->" + toClose);
}
if (toOpen != last_toOpen) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号toOpen" + last_toOpen + "->" + toOpen);
}
last_open = open;
last_close = close;
last_toClose = toClose;
@@ -86,11 +79,15 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
public void writing(String param, String value) {
// String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
// + "." + param;
// Map<String, Object> itemMap = new HashMap<String, Object>();
// itemMap.put(to_param, Integer.parseInt(value));
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {
this.toDoorCommandControl.control(param,value);
} catch (Exception e) {

View File

@@ -304,6 +304,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
logServer.deviceExecuteLog(this.device_code,"","","申请套管");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + "当前mode值为:" + mode)
@@ -317,6 +318,11 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE);
//气涨轴尺寸
applyPlugPullSiteRequest.setSize(String.valueOf(size));
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("type", CommonFinalParam.TYPE_ONE);
param.put("size", String.valueOf(size));
logServer.deviceExecuteLog(this.device_code, "", "", "申请套轴请求,参数:" + param);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
@@ -399,6 +405,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
logServer.deviceExecuteLog(this.device_code,"","","套管完成");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + "当前mode值为:" + mode)
@@ -415,6 +422,14 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2));
applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2));
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO);
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("type", CommonFinalParam.TYPE_TWO);
param.put("weight1", String.valueOf(weight1));
param.put("material1", String.valueOf(material1));
param.put("weight1", String.valueOf(weight1));
param.put("material1", String.valueOf(material1));
logServer.deviceExecuteLog(this.device_code, "", "", "套管完成请求,参数:" + param);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
@@ -432,8 +447,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("to_command", 99);
this.writing(map);
requireSucess = true;
message = "申请套管失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
message = "套管完成失败";
logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成失败,返回参数:" + applyPlugPullSitResponse);
}
}
@@ -448,6 +463,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
logServer.deviceExecuteLog(this.device_code,"","","拔轴完成");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + "当前mode值为:" + mode)
@@ -460,13 +476,18 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE);
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("type", CommonFinalParam.TYPE_THREE);
param.put("barcode", String.valueOf(barcode));
logServer.deviceExecuteLog(this.device_code, "", "", "拔轴完成请求,参数:" + param);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", mode);
this.writing(map);
requireSucess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴完成,返回参数:" + applyPlugPullSitResponse);
message = "拔轴完成成功";
} else {
message = applyPlugPullSitResponse.getMessage();
@@ -475,7 +496,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing(map);
requireSucess = true;
message = "拔轴完成失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴完成反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
}
@@ -489,6 +510,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
logServer.deviceExecuteLog(this.device_code,"","","申请拔轴");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + "当前mode值为:" + mode)
@@ -501,6 +523,11 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode));
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR);
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("type", CommonFinalParam.TYPE_FOUR);
param.put("barcode", String.valueOf(barcode));
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴请求,参数:" + param);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
Map<String, String> data = applyPlugPullSitResponse.getData();
@@ -558,6 +585,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return;
} else {
logServer.deviceExecuteLog(this.device_code,"","","缓存线已满,生成行架任务");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + "当前mode值为:" + mode)
@@ -570,19 +598,24 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setSize(String.valueOf(size));
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE);
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("type", CommonFinalParam.TYPE_FIVE);
param.put("size", String.valueOf(size));
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,参数:" + param);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", mode);
this.writing(map);
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyPlugPullSitResponse);
message = "生成行架任务成功";
requireSucess = true;
} else {
message = applyPlugPullSitResponse.getMessage();
requireSucess = true;
message = "申请行架任务失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务失败,返回参数:" + applyPlugPullSitResponse);
}
}
}

View File

@@ -215,10 +215,16 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
//反馈重量
if (mode == 3 && action == 5 && move == 0 && StrUtil.isNotEmpty(sub_volume_no) && !requireSucess) {
logServer.deviceExecuteLog(this.device_code,"","","反馈重量");
ApplyfeedbackSubVolumeWeightRequest applyfeedbackSubVolumeWeightRequest = new ApplyfeedbackSubVolumeWeightRequest();
ApplyfeedbackSubVolumeWeightResponse applyPlugPullSitResponse;
applyfeedbackSubVolumeWeightRequest.setSub_volume(sub_volume_no);
applyfeedbackSubVolumeWeightRequest.setWeight1(String.valueOf(weight));
applyfeedbackSubVolumeWeightRequest.setWeight1(weight);
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("sub_volume", sub_volume_no);
param.put("weight1", weight);
logServer.deviceExecuteLog(this.device_code, "", "", "反馈重量,参数:" + param);
applyPlugPullSitResponse = acsToWmsService.applyfeedbackSubVolumeWeight(applyfeedbackSubVolumeWeightRequest);
if(applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN){
Map<String, Object> map = new LinkedHashMap<>();

View File

@@ -13,6 +13,6 @@ public class ApplyfeedbackSubVolumeWeightRequest {
/**
* 子卷重量
*/
private String weight1;
private double weight1;
}

View File

@@ -166,6 +166,10 @@ public class LuceneServiceImpl implements LuceneService {
if (whereJson.get("method") != null){
Query termQuery = new TermQuery(new Term("method", (String) whereJson.get("method")));
booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST);
} else {
// 使用 TermRangeQuery 来检查字段是否存在和不为空
Query rangeQuery = TermRangeQuery.newStringRange("method", null, null, false, false);
booleanQueryBuilder.add(rangeQuery, BooleanClause.Occur.MUST);
}
TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("logTime", SortField.Type.LONG,true)), 20000, 0);
searcher.search(booleanQueryBuilder.build(), collector);
@@ -177,17 +181,13 @@ public class LuceneServiceImpl implements LuceneService {
for (ScoreDoc scoreDoc : scoreDocs) {
Document doc = open.document(scoreDoc.doc);
JSONObject object = new JSONObject();
if (ObjectUtil.isNotEmpty(doc.get("method"))) {
object.put("content", doc.get("fieldContent"));
object.put("logTime", doc.get("logTime") );
object.put("method", doc.get("method"));
object.put("requestparam", doc.get("requestparam"));
object.put("responseparam", doc.get("responseparam"));
if (doc.get("fieldContent") != null) {
list.add(object);
}
object.put("content", doc.get("fieldContent"));
object.put("logTime", doc.get("logTime") );
object.put("method", doc.get("method"));
object.put("requestparam", doc.get("requestparam"));
object.put("responseparam", doc.get("responseparam"));
if (ObjectUtil.isNotEmpty(doc.get("fieldContent"))) {
list.add(object);
}
}
open.close();

View File

@@ -157,7 +157,7 @@
</el-table-column>
<el-table-column prop="dbr_value2">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
@@ -354,6 +354,15 @@ export default {
console.log(err.response.data.message)
})
},
test_read2() {
testRead(this.data2, this.opc_id).then(data => {
this.data2 = data
console.log(this.data2)
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {

View File

@@ -8,14 +8,18 @@
<!-- style="width: 200px;"-->
<!-- class="filter-item"-->
<!-- />-->
<el-input
<el-select
v-model="query.method"
clearable
filterable
size="small"
placeholder="请输入你要搜索的方法名"
style="width: 200px;"
class="filter-item"
/>
style="width: 200px"
@change="crud.toQuery"
>
<el-option v-for="item in methods" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-input
v-model="query.requestparam"
clearable
@@ -104,7 +108,7 @@ export default {
queryAddressCodeList().then(data => {
this.methods = data.content
})
},
}
}
</script>