fix:优化现场联调出现的问题以及添加日志
This commit is contained in:
@@ -260,7 +260,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
|
||||
applyManipulatorActionRequest.setQzz_no(String.valueOf(barcode));//气涨轴编码
|
||||
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if (applyManipulatorActionResponse.getCode() == 200) {
|
||||
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||
Map<String, String> data = applyManipulatorActionResponse.getData();
|
||||
String point_code2 = data.get("point_code2");//目标站点
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(point_code2);
|
||||
|
||||
@@ -419,10 +419,12 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
Device startDevice = deviceAppService.findDeviceByCode(startCode);
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(nextCode);
|
||||
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
String startAddr = startDevice.getExtraValue().get("address").toString();
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
@@ -437,17 +439,23 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
Device startDevice2 = deviceAppService.findDeviceByCode(startCode2);
|
||||
Device nextDevice2 = deviceAppService.findDeviceByCode(nextCode2);
|
||||
if (ObjectUtil.isEmpty(startDevice2.getExtraValue().get("address"))) {
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
|
||||
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice2.getExtraValue().get("address"))) {
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
String start_addr2 = startDevice2.getExtraValue().get("address").toString();
|
||||
String next_addr2 = nextDevice2.getExtraValue().get("address").toString();
|
||||
map.put("to_onset2", start_addr2);
|
||||
map.put("to_target2", next_addr2);
|
||||
}
|
||||
this.writing(map);
|
||||
try {
|
||||
this.writing(map);
|
||||
} catch (Exception e) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
|
||||
+ ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage());
|
||||
}
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
} else {
|
||||
@@ -502,21 +510,21 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
notCreateInstMessage ="universal_notCreateInstMessage1";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(startDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1"))
|
||||
.content(startDevice.getDevice_code() + "未设置电气调度号!")
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
|
||||
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
|
||||
notCreateInstMessage = "universal_notCreateInstMessage1";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(nextDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1"))
|
||||
.content(nextDevice.getDevice_code() + "未设置电气调度号!")
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
|
||||
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
|
||||
|
||||
}
|
||||
try {
|
||||
@@ -524,7 +532,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(LangProcess.msg("universal_message9") + e.getMessage())
|
||||
.content(device_code+"创建指令时出现异常:" + e.getMessage())
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -547,10 +555,10 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
Device startDevice2 = deviceAppService.findDeviceByCode(startDeviceCode2);
|
||||
Device nextDevice2 = deviceAppService.findDeviceByCode(nextDeviceCode2);
|
||||
if (ObjectUtil.isEmpty(startDevice2.getExtraValue().get("address"))) {
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice2.getDevice_code()));
|
||||
throw new BadRequestException("设备:" + startDevice2.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(nextDevice2.getExtraValue().get("address"))) {
|
||||
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice2.getDevice_code()));
|
||||
throw new BadRequestException("设备:" + nextDevice2.getDevice_code() + "未设置电气调度号!");
|
||||
}
|
||||
String start_addr2 = startDevice2.getExtraValue().get("address").toString();
|
||||
String next_addr2 = nextDevice2.getExtraValue().get("address").toString();
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
@@ -175,7 +176,7 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
case 9:
|
||||
// 取消任务
|
||||
if (!requireSucess) {
|
||||
boolean b = applyTake();
|
||||
boolean b = cancelTake();
|
||||
if (b) {
|
||||
requireSucess = true;
|
||||
}
|
||||
@@ -193,6 +194,77 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
lastError = error;
|
||||
}
|
||||
|
||||
private boolean cancelTake() {
|
||||
Date date = new Date();
|
||||
boolean flag = false;
|
||||
if (date.getTime() - this.instructionRequireTime.getTime()
|
||||
< (long) this.instructionRequireTimeOut) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
|
||||
return false;
|
||||
} else {
|
||||
String deviceCode = device_code + "_X";
|
||||
//根据起点设备编号查询当前是否有就绪任务
|
||||
TaskDto taskDto = taskserver.findByStartCodeAndReady(deviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDto)){
|
||||
try {
|
||||
taskserver.cancel(taskDto.getTask_id());
|
||||
Map map = new HashMap();
|
||||
map.put("to_command", 9);
|
||||
try {
|
||||
this.writing(map);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("下发信号报错" + map)
|
||||
.build();
|
||||
logDto.setLog_level(3);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
//根据终点设备编号查询当前是否有就绪任务
|
||||
TaskDto dto = taskserver.findByEndCodeAndReady(deviceCode);
|
||||
if (ObjectUtil.isNotEmpty(dto)){
|
||||
try {
|
||||
taskserver.cancel(dto.getTask_id());
|
||||
Map map = new HashMap();
|
||||
map.put("to_command", 9);
|
||||
try {
|
||||
this.writing(map);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("下发信号报错" + map)
|
||||
.build();
|
||||
logDto.setLog_level(3);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (!flag){
|
||||
Map map = new HashMap();
|
||||
map.put("to_command", 99);
|
||||
try {
|
||||
this.writing(map);
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("下发信号报错" + map)
|
||||
.build();
|
||||
logDto.setLog_level(3);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
private boolean applyTake() {
|
||||
Date date = new Date();
|
||||
@@ -203,9 +275,6 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
} else {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", this.getDevice_code());
|
||||
if (this.mode==9) {
|
||||
jo.put("type",CommonFinalParam.TYPE_ONE);
|
||||
}
|
||||
if (this.mode==10) {
|
||||
jo.put("type",CommonFinalParam.TYPE_TWO);
|
||||
}
|
||||
@@ -220,10 +289,6 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
}
|
||||
if(ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200){
|
||||
Map map = new HashMap();
|
||||
//反馈取消任务
|
||||
if (this.mode==9) {
|
||||
map.put("to_command", 9);
|
||||
}
|
||||
//反馈表处下满料请求
|
||||
if (this.mode==10) {
|
||||
map.put("to_command", 10);
|
||||
|
||||
@@ -213,29 +213,26 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
message = LangProcess.msg("universal_off-line");
|
||||
message = "universal_off-line";
|
||||
//有报警
|
||||
} else if (error != 0) {
|
||||
this.setIserror(true);
|
||||
message = LangProcess.msg("universal_message3");
|
||||
message ="universal_message3";
|
||||
//无报警
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
if(requireSucess){
|
||||
message = LangProcess.msg("universal_actionMessage5");
|
||||
}
|
||||
//插拔轴机工位申请任务
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug(LangProcess.msg("universal_stand-alone"));
|
||||
log.debug("设备运转模式:等待工作");
|
||||
break;
|
||||
case 2:
|
||||
log.info(LangProcess.msg("universal_standby"));
|
||||
log.info("待机");
|
||||
break;
|
||||
case 3:
|
||||
log.info(LangProcess.msg("universal_operation"));
|
||||
log.info("运行中");
|
||||
break;
|
||||
case 4:
|
||||
if (!requireSucess) {
|
||||
@@ -307,6 +304,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
@@ -314,7 +318,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//气涨轴尺寸
|
||||
applyPlugPullSiteRequest.setSize(String.valueOf(size));
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("申请贴标成功:" + applyPlugPullSitResponse.getData())
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
Map<String, String> data = applyPlugPullSitResponse.getData();
|
||||
String number = data.get("number");
|
||||
String leftSize = data.get("leftSize");
|
||||
@@ -370,6 +380,13 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
@@ -380,7 +397,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
|
||||
this.writeSignal(mode);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse);
|
||||
message = "套管完成成功";
|
||||
@@ -406,13 +423,20 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
@@ -440,13 +464,20 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, String> data = applyPlugPullSitResponse.getData();
|
||||
//拔管1物料
|
||||
Object to_material3 = data.get("currentLeft");
|
||||
@@ -502,13 +533,20 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code+"当前mode值为:" + mode)
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode);
|
||||
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse;
|
||||
applyPlugPullSiteRequest.setDevice_code(device_code);
|
||||
applyPlugPullSiteRequest.setSize(String.valueOf(size));
|
||||
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE);
|
||||
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
|
||||
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
|
||||
if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", mode);
|
||||
this.writing(map);
|
||||
|
||||
@@ -417,16 +417,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
AddressDto addressDto = addressService.findByCode("applyButtonTask");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("applyBlankButtonTask----反馈表处按钮请求路径{}", param);
|
||||
log.info("applyBlankButtonTask----反馈表处按钮请求路径{}", url);
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(param))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.info("feedbackDie-----输出参数{}", msg);
|
||||
//网络不通
|
||||
String message = e.getMessage();
|
||||
log.info("applyBlankButtonTask----反馈表处按钮请求失败{}", message);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyBlankButtonTask", String.valueOf(result.getStatus()),
|
||||
JSON.toJSONString(result),
|
||||
String.valueOf(result.body()), "反馈下发表处任务报错");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
log.info("applyBlankButtonTask - 反馈表处按钮{}", result.body());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyBlankButtonTask", String.valueOf(result.getStatus()),
|
||||
@@ -434,19 +437,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String.valueOf(result.body()), "反馈下发表处任务");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyBlankButtonTask", String.valueOf(result.getStatus()),
|
||||
JSON.toJSONString(result),
|
||||
String.valueOf(result.body()), "反馈下发表处任务报错");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return null;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplyPlugPullSitResponse applyPlugPullSiteRequest(ApplyPlugPullSiteRequest param) {
|
||||
log.info("向LMS申请反馈,请求参数{}",param);
|
||||
String result = "";
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse = new ApplyPlugPullSitResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
@@ -455,19 +457,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("ApplyPlugPullSiteRequest----请求参数:{}", JSONObject.toJSONString(param));
|
||||
try {
|
||||
// String result = "";
|
||||
String result = HttpRequest.post(url)
|
||||
//
|
||||
result = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("ApplyPlugPullSitResponse----返回参数{}", result);
|
||||
applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getCode()),
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()),
|
||||
JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请"
|
||||
+ ("1".equals(param.getType()) ? "套轴": "2".equals(param.getType()) ? "套轴完成": "3".equals(param.getType()) ? "拔轴完成":
|
||||
"4".equals(param.getType()) ? "拔轴": "缓存线已满,生成行架任务"));
|
||||
+ ("1".equals(param.getType()) ? "套轴" : "2".equals(param.getType()) ? "套轴完成" : "3".equals(param.getType()) ? "拔轴完成" :
|
||||
"4".equals(param.getType()) ? "拔轴" : "缓存线已满,生成行架任务"));
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("ApplyPlugPullSitResponse----返回参数{}", result);
|
||||
applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()),
|
||||
JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请失败");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 400);
|
||||
map.put("message", e.getMessage());
|
||||
@@ -483,28 +491,31 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
@Override
|
||||
public ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeight(ApplyfeedbackSubVolumeWeightRequest param) {
|
||||
log.info("向LMS申请反馈,请求参数{}",param);
|
||||
ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse = new ApplyfeedbackSubVolumeWeightResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyfeedbackSubVolumeWeightRequest");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("applyfeedbackSubVolumeWeightRequest----请求参数:{}", JSONObject.toJSONString(param));
|
||||
try {
|
||||
// String result = "";
|
||||
String result = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("applyfeedbackSubVolumeWeightRequest----返回参数{}", result);
|
||||
applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class);
|
||||
} catch (Exception e) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 400);
|
||||
map.put("message", e.getMessage());
|
||||
return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class);
|
||||
}
|
||||
log.info("向LMS申请反馈,请求参数{}", param);
|
||||
String result = "";
|
||||
ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeightResponse = new ApplyfeedbackSubVolumeWeightResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyfeedbackSubVolumeWeightRequest");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("applyfeedbackSubVolumeWeightRequest----请求参数:{}", JSONObject.toJSONString(param));
|
||||
try {
|
||||
//
|
||||
result = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("applyfeedbackSubVolumeWeightRequest----返回参数{}", result);
|
||||
applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class);
|
||||
} catch (Exception e) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("applyfeedbackSubVolumeWeightRequest----返回参数{}", result);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 400);
|
||||
map.put("message", e.getMessage());
|
||||
return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class);
|
||||
}
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyfeedbackSubVolumeWeightRequest", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS反馈LMS子卷重量");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
@@ -515,7 +526,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Override
|
||||
public ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param) {
|
||||
log.info("向LMS申请反馈,请求参数{}", param);
|
||||
ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse();
|
||||
String result = "";
|
||||
ApplyManipulatorActionResponse applyManipulatorActionResponse = new ApplyManipulatorActionResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyManipulatorAction");
|
||||
@@ -523,21 +535,26 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("ApplyManipulatorActionRequest----请求参数:{}", JSONObject.toJSONString(param));
|
||||
try {
|
||||
// String result = "";
|
||||
String result = HttpRequest.post(url)
|
||||
result = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("ApplyManipulatorActionResponse----返回参数{}", result);
|
||||
applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class);
|
||||
} catch (Exception e) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("ApplyManipulatorActionResponse----返回参数{}", result);
|
||||
applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈子卷重量失败");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 400);
|
||||
map.put("message", e.getMessage());
|
||||
return JSONObject.toJavaObject(map, ApplyManipulatorActionResponse.class);
|
||||
}
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈子卷重量");
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "ApplyManipulatorActionRequest", String.valueOf(applyManipulatorActionResponse.getCode()),
|
||||
JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "ACS向LMS申请反馈子卷重量成功");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
return applyManipulatorActionResponse;
|
||||
@@ -547,6 +564,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
public GetWasteFoilWeightResponse feedbackWeight(GetWasteFoilWeightRequest param) {
|
||||
log.info("向LMS申请反馈,请求参数{}", param);
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
GetWasteFoilWeightResponse getWasteFoilWeightResponse = new GetWasteFoilWeightResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
|
||||
@@ -57,10 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -79,6 +76,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneLogService;
|
||||
|
||||
@Autowired
|
||||
private AcsToLiKuService acsToLiKuService;
|
||||
|
||||
@@ -490,17 +490,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@Override
|
||||
public PutActionResponse putAction(String jsonObject) throws Exception {
|
||||
log.info("putAction--------------:输入参数" + jsonObject);
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
PutActionResponse response = new PutActionResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
PutActionRequest request = JsonUtl.format(data, PutActionRequest.class);
|
||||
String device_code = request.getDevice_code();
|
||||
String code = request.getCode();
|
||||
String value = request.getValue();
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
log.info("putAction--------------:输入参数" + jsonObject);
|
||||
String date = new Date().toString();
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"LMS反馈ACS动作信号");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
PutActionResponse response = new PutActionResponse();
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
String data = datas.get(i).toString();
|
||||
PutActionRequest request = JsonUtl.format(data, PutActionRequest.class);
|
||||
String device_code = request.getDevice_code();
|
||||
String code = request.getCode();
|
||||
String value = request.getValue();
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
@@ -547,7 +550,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "putAction", String.valueOf(response.getCode()),
|
||||
LuceneLogDto luceneLogDto1 = new LuceneLogDto(4, "putAction", String.valueOf(response.getCode()),
|
||||
jsonObject, String.valueOf(response), "LMS下发动作");
|
||||
luceneExecuteLogService.interfaceExecuteLog(luceneLogDto);
|
||||
log.info("putAction--------------:输出参数:" + response);
|
||||
@@ -557,6 +560,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Override
|
||||
public Map<String, Object> putWeightAction(String jsonObject) throws Exception {
|
||||
log.info("putWeightAction--------------:输入参数" + jsonObject);
|
||||
String date = new Date().toString();
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"LMS反馈ACS废箔重量");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
JSONObject jo = new JSONObject();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
@@ -615,6 +621,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Override
|
||||
public Map<String, Object> getTubeMes(String jsonObject) throws Exception {
|
||||
log.info("getTubeMes--------------:输入参数" + jsonObject);
|
||||
String date = new Date().toString();
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, jsonObject, date+"获取管芯信息");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
JSONArray datas = JSONArray.parseArray(jsonObject);
|
||||
JSONObject jo = new JSONObject();
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.CommonService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -333,6 +334,22 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByDeviceCodeFromCache(String devicecode);
|
||||
|
||||
/**
|
||||
* 根据起点设备编号查询当前是否有就绪指令
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
Instruction findByStartCodeAndReady(String device_code);
|
||||
|
||||
/**
|
||||
* 根据终点设备编号查询当前是否有就绪指令
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
Instruction findByEndCodeAndReady(String device_code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据终点查询指令
|
||||
|
||||
@@ -1723,6 +1723,24 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByStartCodeAndReady(String device_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
.filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), device_code)
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()))
|
||||
.findFirst();
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByEndCodeAndReady(String device_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
.filter(instruction -> StrUtil.equals(instruction.getNext_device_code(), device_code)
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()))
|
||||
.findFirst();
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay) {
|
||||
List<Instruction> instructionList = new ArrayList<>();
|
||||
|
||||
@@ -92,13 +92,18 @@ public class LuceneLogDto {
|
||||
final String requestparam, final String responseparam, final String content) {
|
||||
super();
|
||||
this.log_level = log_level;
|
||||
this.method = method;
|
||||
this.status_code = status;
|
||||
this.requestparam = requestparam;
|
||||
this.responseparam = responseparam;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public LuceneLogDto(final Integer log_level, final String requestparam, final String content) {
|
||||
super();
|
||||
this.log_level = log_level;
|
||||
this.requestparam = requestparam;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public LuceneLogDto(final String device_code, final String remark) {
|
||||
super();
|
||||
this.device_code = device_code;
|
||||
|
||||
Reference in New Issue
Block a user