Merge remote-tracking branch 'origin/master'

This commit is contained in:
2024-06-15 15:10:09 +08:00
34 changed files with 613 additions and 361 deletions

View File

@@ -34,6 +34,7 @@ public class AgvWaitUtil {
AcsToWmsService acsToWmsService;
@Autowired
@Lazy
InstructionService instructionService;
@Autowired

View File

@@ -307,11 +307,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() > 0 && paperTubePickSiteDeviceDriver.getAction() == 1
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey);
}
@@ -478,11 +478,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 0 && paperTubePickSiteDeviceDriver.getAction() == 1
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货完成反馈,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey);
}
@@ -617,11 +617,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 1 && paperTubePickSiteDeviceDriver.getAction() == 1
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey);
}
@@ -792,10 +792,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), ikey);
}
@@ -909,11 +910,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 0 && paperTubePickSiteDeviceDriver.getAction() == 1
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足放货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey);
}
@@ -1107,11 +1108,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 1 && paperTubePickSiteDeviceDriver.getAction() == 1
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
paperTubePickSiteDeviceDriver.setFlag(3);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey);
}
@@ -1237,7 +1239,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
@@ -1369,7 +1372,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() > 0) {
if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";

View File

@@ -183,18 +183,17 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
} catch (Exception var17) {
var17.printStackTrace();
feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
@@ -218,13 +217,13 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
remark = "universal_no";
}
if (task != 0) {
remark = LangProcess.msg("universal_remark4");
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = LangProcess.msg("universal_remark5");
remark = "universal_remark5";
}
this.setFeedMessage(remark);
//}
@@ -261,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);
@@ -271,17 +270,20 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
map.put("to_target", address);
map.put("to_sub_volume_no", material_code);
map.put("to_command", "1");
map.put("to_is_labeling",StrUtil.isNotEmpty(to_is_labeling)?"0":"1");
if (StrUtil.equals("1",to_is_labeling)){
map.put("to_is_labeling","1");
}else {
map.put("to_is_labeling","0");
}
this.writing(map);
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse);
message = "申请行架任务成功";
message = "universal_message12";
requireSucess = true;
} else {
message = applyManipulatorActionResponse.getMessage();
map.put("to_command", 99);
this.writing(map);
requireSucess = true;
message = "申请行架任务失败";
message = "universal_message13";
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务反馈失败,返回参数:" + applyManipulatorActionResponse);
}
}
@@ -363,10 +365,10 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
map.put("isOnline", this.getIsonline());
map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
map.put("isError", this.getIserror());
map.put("message", message);
map.put("message", LangProcess.msg(message));
/*jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage",notCreateInstMessage);*/
map.put("feedMessage", feedMessage);
map.put("feedMessage", LangProcess.msg(feedMessage));
map.put("driver_type", "siemens_conveyor");
map.put("is_click", true);
JSONObject jo = new JSONObject(map);

View File

@@ -278,13 +278,13 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
feedMessage = "universal_feedMessage1";
}
if (action != 5) {
feedMessage = feedMessage + "two_message4";
feedMessage = "two_message4";
}
if (move != 1) {
feedMessage = feedMessage + "universal_feedMessage7";
feedMessage = "universal_feedMessage7";
}
if (task == 0) {
feedMessage = feedMessage + "universal_feedMessage8";
feedMessage = "universal_feedMessage8";
}
}
@@ -312,7 +312,6 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
} catch (Exception var17) {
var17.printStackTrace();
feedMessage = var17.getMessage();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol))
@@ -350,21 +349,21 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
} else {
if (mode == 2) {
//if (!requireSucess) {
String remark = "未查找任务原因为:";
String remark = "universal_remark1";
if (mode != 2) {
remark = remark + "工作模式(mode)不是待机状态";
remark = "universal_remark2";
}
if (move != 0) {
remark = remark + "光电信号(move)为有货状态";
remark = "universal_remark3";
}
if (task != 0) {
remark = remark + "当前上报任务号(task)应该为0";
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = remark + "右击该图标,将请求任务复位标记(requireSucess)改为否。";
remark ="universal_remark5";
}
this.setNotCreateTaskMessage(remark);
//}
@@ -420,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();
@@ -438,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 {
@@ -500,33 +507,32 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code());
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
notCreateInstMessage = startDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1");
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 = nextDevice.getDevice_code() + LangProcess.msg("universal_notCreateInstMessage1");
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 {
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
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);
@@ -549,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();
@@ -569,7 +575,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
notCreateInstMessage = "";
notCreateTaskMessage = "";
} else {
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
notCreateInstMessage = "universal_notCreateInstMessage";
}
return true;
}
@@ -689,8 +695,8 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
jo.put("isError", this.getIserror());
jo.put("message", LangProcess.msg(message));
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateInstMessage",notCreateInstMessage);
jo.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage));
jo.put("notCreateInstMessage",LangProcess.msg(notCreateInstMessage));
jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true);

View File

@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.two_conveyor.blanking_button;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -28,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;
@@ -35,10 +37,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author : TuQiang
* @date : 2024/3/14
@@ -102,7 +101,7 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
Boolean iserror = false;
String deviceCode;
String device_code;
String message = null;
@@ -118,7 +117,7 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
@Override
public void execute() {
deviceCode = this.getDeviceCode();
device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
@@ -156,22 +155,31 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
case 3:
log.debug("运行中");
break;
case 9:
case 10:
// 表处下满料请求
if (!requireSucess) {
applyTakeFullVolume();
}
break;
case 10:
//表处上空轴请求
if (!requireSucess) {
applyTakeEmptyShaft();
boolean b = applyTake();
if (b) {
requireSucess = true;
}
}
break;
case 11:
//表处上空轴请求
if (!requireSucess) {
boolean b = applyTake();
if (b) {
requireSucess = true;
}
}
break;
case 9:
// 取消任务
if (!requireSucess) {
cancelTask();
boolean b = cancelTake();
if (b) {
requireSucess = true;
}
}
break;
default:
@@ -184,110 +192,134 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
lastMove = move;
lastAction = action;
lastError = error;
}
/**
* 表处下满料请求
*/
public synchronized void applyTakeFullVolume() {
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();
if (date.getTime() - this.instructionRequireTime.getTime()
< (long) this.instructionRequireTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
return;
return false;
} else {
this.instructionRequireTime = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message5";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(deviceCode);
blankingButtonRequest.setType(CommonFinalParam.TYPE_ONE);
BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "two_message6";
} else {
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
this.writing("to_command","9");
message = "two_message7";
requireSucess = true;
} else {
requireSucess = false;
message = "two_message8";
this.writing("to_command","99");
}
JSONObject jo = new JSONObject();
jo.put("device_code", this.getDevice_code());
if (this.mode==10) {
jo.put("type",CommonFinalParam.TYPE_TWO);
}
if (this.mode==11) {
jo.put("type",CommonFinalParam.TYPE_THREE);
}
HttpResponse httpResponse = acsToWmsService.applyBlankButtonTask(jo);
JSONObject jsonObject = null;
if(ObjectUtil.isNotEmpty(httpResponse)){
String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body);
}
if(ObjectUtil.isNotNull(jsonObject) && jsonObject.getInteger("status") == 200){
Map map = new HashMap();
//反馈表处下满料请求
if (this.mode==10) {
map.put("to_command", 10);
}
//反馈表处上空轴请求
if (this.mode==11) {
map.put("to_command", 11);
}
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 true;
}else{
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("反馈LMS表处按钮任务失败" + httpResponse.body())
.build();
logDto.setLog_level(3);
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
}
}
/**
* 取消任务
*/
public synchronized void cancelTask() {
Date date = new Date();
if (date.getTime() - this.instructionRequireTime.getTime()
< (long) this.instructionRequireTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
return;
} else {
this.instructionRequireTime = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message9";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(deviceCode);
blankingButtonRequest.setType(CommonFinalParam.TYPE_SIX);
BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "two_message10";
} else {
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
this.writing("to_command","10");
message = "two_message11";
requireSucess = true;
} else {
requireSucess = false;
message = "two_message12";
this.writing("to_command","99");
}
}
}
}
}
/**
* 表处上空轴请求
*/
public synchronized void applyTakeEmptyShaft() {
Date date = new Date();
if (date.getTime() - this.instructionRequireTime.getTime()
< (long) this.instructionRequireTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
return;
} else {
this.instructionRequireTime = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message13";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(deviceCode);
blankingButtonRequest.setType(CommonFinalParam.TYPE_TWO);
BlankingButtonResponse response = acsToWmsService.applyBlankButtonTask(blankingButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "two_message14";
} else {
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
this.writing("to_command","10");
message = "two_message15";
requireSucess = true;
} else {
requireSucess = false;
message = "two_message16";
this.writing("to_command","99");
}
}
}
}
}
public void writing(String param, String value) {
@@ -298,9 +330,9 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
logDto.setLog_level(3);
@@ -369,4 +401,28 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
public void setDeviceStatus(JSONObject data) {
}
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
public void writing(Map<String, Object> map) throws Exception {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.checkcontrol(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
logDto.setLog_level(3);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
}

View File

@@ -100,7 +100,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
Boolean iserror = false;
String deviceCode;
String device_code;
String message = null;
@@ -116,7 +116,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
@Override
public void execute() {
deviceCode = this.getDeviceCode();
device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
@@ -206,7 +206,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message17";
ApplyGreenFoilButtonRequest applyGreenFoilButtonRequest = new ApplyGreenFoilButtonRequest();
applyGreenFoilButtonRequest.setDevice_code(deviceCode);
applyGreenFoilButtonRequest.setDevice_code(device_code);
applyGreenFoilButtonRequest.setType(String.valueOf(mode));
ApplyGreenFoilButtonResponse response = acsToWmsService.applyGreenFoilButtonTask(applyGreenFoilButtonRequest);
if (ObjectUtil.isEmpty(response)) {
@@ -242,9 +242,9 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);

View File

@@ -86,7 +86,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
Boolean iserror = false;
String deviceCode;
String device_code;
String message = null;
@@ -101,7 +101,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
@Override
public void execute() {
deviceCode = this.getDeviceCode();
device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
@@ -139,9 +139,9 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
} catch (Exception e) {
e.printStackTrace();
}
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.device_code(device_code)
.content("下发多个电气信号" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
@@ -163,7 +163,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
this.checkcontrol(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.deviceCode)
.device_code(this.device_code)
.content("下发多个电气信号" + itemMap)
.build();
logDto.setLog_level(3);

View File

@@ -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);

View File

@@ -20,6 +20,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.InteractionJsonDTO;
import org.nl.acs.device_driver.two_conveyor.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.pull_head_manipulator.ItemProtocol;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
@@ -379,6 +380,14 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
if (!ObjectUtil.isEmpty(task)) {
String nextDeviceCode = task.getNext_device_code();
Device device = deviceAppService.findDeviceByCode(nextDeviceCode);
PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver;
if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) {
plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver();
if (plugPullDeviceSiteDeviceDriver.getMode() != 2 && plugPullDeviceSiteDeviceDriver.getMove() != 0)
return false;
}
String taskId = task.getTask_id();
String taskCode = task.getTask_code();
String vehicleCode = task.getVehicle_code();
@@ -387,7 +396,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
String startDeviceCode = task.getStart_device_code();
String routePlanCode = task.getRoute_plan_code();
String nextPointCode = task.getNext_point_code();
String nextDeviceCode = task.getNext_device_code();
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());

View File

@@ -224,10 +224,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
remark = "universal_remark2";
}
if (move1 != 0) {
remark = remark + "universal_remark6";
remark = "universal_remark6";
}
if (move2 != 0) {
remark = remark + "universal_remark7";
remark = "universal_remark7";
}
if (task != 0) {
remark = "universal_remark4";
@@ -292,19 +292,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
feedMessage = "universal_feedMessage6";
} else {
if (mode != 3) {
feedMessage += "universal_feedMessage1";
feedMessage = "universal_feedMessage1";
}
if (action != 9) {
feedMessage += "universal_feedMessage9";
feedMessage = "universal_feedMessage9";
}
if (move1 != 0) {
feedMessage += "universal_feedMessage10";
feedMessage = "universal_feedMessage10";
}
if (move2 != 0) {
feedMessage += "universal_feedMessage11";
feedMessage = "universal_feedMessage11";
}
if (task == 0) {
feedMessage += "universal_feedMessage4";
feedMessage = "universal_feedMessage4";
}
}
}
@@ -321,12 +321,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} else {
this.instruction_head_time = date;
String link_device_code = String.valueOf(this.getDevice().getExtraValue().get("link_device_code"));
Device device = deviceAppservice.findDeviceByCode(link_device_code);
List<String> extraDeviceCodes = getExtraDeviceCodes1(link_device_code);
String linkCode = extraDeviceCodes.get(0);
Device device = deviceAppservice.findDeviceByCode(linkCode);
SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver;
if (device.getDeviceDriver()instanceof SlitTwoManipulatorDeviceDriver) {
if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
//如果禁用
if (slitTwoManipulatorDeviceDriver.getIs_disable()==1){
if (slitTwoManipulatorDeviceDriver.getIs_disable() == 1) {
//就去走关联设备异常取放货工位的任务 任务生成成功返回true 就不会走下面正常生成任务的逻辑
try {
flag = instruction_require2();
@@ -338,6 +340,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
}
//没有生成异常取放货工位的任务 就生成正常关联取放货工位的任务
//抓取工位
if (ObjectUtil.isEmpty(getDeviceCodeList)) {
getDeviceCodeList = this.getExtraDeviceCodes("get_device_code");
@@ -396,6 +399,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
} else {
this.instruction_head_time = date;
//抓取工位
if (ObjectUtil.isEmpty(getDeviceCodeList)) {
getDeviceCodeList = this.getExtraDeviceCodes("error_get_device_code");
}
@@ -426,7 +430,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
for (int j = 0; j < taskDtoList.size(); j++) {
task = taskDtoList.get(j);
// 9 行架任务
// 6 行架任务
if (ObjectUtil.isNotEmpty(task) && !StrUtil.equals(task.getTask_type(), "6")) {
task = null;
continue;
@@ -717,6 +721,26 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
//将扩展表中的字符串数组数据转换成集合
public List<String> getExtraDeviceCodes1(String extraValue) {
if (StrUtil.isEmpty(extraValue)) {
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);
List<String> devicesList = new ArrayList<>();
String[] devices = devicesString.split(",");
for (int i = 0; i < devices.length; i++) {
String s = devices[i].replace("\"", "").replace("\"", "");
devicesList.add(s);
}
return devicesList;
}
/**
* 将扩展表中的字符串数据转换成集合
*
* @param extraName
* @return
*/
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
@@ -839,7 +863,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
jo.put("message", message);
jo.put("is_click", true);
jo.put("driver_type", "slit_two_manipulator");
jo.put("notCreateTaskMessage", notCreateTaskMessage);
jo.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage));
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
jo.put("feedMessage", LangProcess.msg(feedMessage));
return jo;

View File

@@ -110,4 +110,12 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.putWeightAction(whereJson), HttpStatus.OK);
}
@PostMapping("/getTubeMsg")
@Log("wms下发废箔重量")
@SaIgnore
public ResponseEntity<Object> getTubeMes(@RequestBody String whereJson) throws Exception {
return new ResponseEntity<>(wmstoacsService.getTubeMes(whereJson), HttpStatus.OK);
}
}

View File

@@ -148,7 +148,7 @@ public interface AcsToWmsService {
* @param param
* @return
*/
BlankingButtonResponse applyBlankButtonTask(BlankingButtonRequest param);
HttpResponse applyBlankButtonTask(JSONObject param);
/**
* 向lms申请反馈

View File

@@ -117,4 +117,5 @@ public interface WmsToAcsService {
*/
Map<String, Object> putWeightAction(String jsonObject) throws Exception;
Map<String, Object> getTubeMes(String whereJson) throws Exception;
}

View File

@@ -381,8 +381,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public ApplyGreenFoilButtonResponse applyGreenFoilButtonTask(ApplyGreenFoilButtonRequest param) {
try {
MDC.put(log_file_type, log_type);
ApplyGreenFoilButtonResponse applyGreenFoilButtonResponse = new ApplyGreenFoilButtonResponse();
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
@@ -409,49 +407,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
luceneLogService.interfaceExecuteLog(luceneLogDto);
}
return applyGreenFoilButtonResponse;
} finally {
MDC.remove(log_file_type);
}
}
@Override
public BlankingButtonResponse applyBlankButtonTask(BlankingButtonRequest param) {
public HttpResponse applyBlankButtonTask(JSONObject param) {
HttpResponse result = null;
try {
MDC.put(log_file_type, log_type);
BlankingButtonResponse blankingButtonResponse = new BlankingButtonResponse();
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyButtonTask");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
log.info("BlankingButtonRequest----请求参数{}", param);
try {
// String result = "";
String result = HttpRequest.post(url)
.body(JSON.toJSONString(param))
.execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
log.info("BlankingButtonResponse----返回参数{}", result);
blankingButtonResponse = JSONObject.toJavaObject(jsonObject, BlankingButtonResponse.class);
} catch (Exception e) {
JSONObject map = new JSONObject();
map.put("status", 400);
map.put("message", e.getMessage());
return JSONObject.toJavaObject(map, BlankingButtonResponse.class);
}
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"BlankingButtonRequest", String.valueOf(blankingButtonResponse.getCode()),
JSON.toJSONString(param), String.valueOf(blankingButtonResponse.getMessage()), "ACS向LMS申请表处下料位按钮任务");
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyButtonTask");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
log.info("applyBlankButtonTask----反馈表处按钮请求路径{}", url);
try {
result = HttpRequest.post(url)
.header("Authorization", token)
.body(String.valueOf(param))
.execute();
} catch (Exception e) {
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);
}
return blankingButtonResponse;
log.info("applyBlankButtonTask - 反馈表处按钮{}", result.body());
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyBlankButtonTask", String.valueOf(result.getStatus()),
JSON.toJSONString(result.body()),
String.valueOf(result.body()), "反馈下发表处任务");
luceneLogService.interfaceExecuteLog(luceneLogDto);
return result;
} 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();
@@ -462,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());
@@ -490,46 +491,43 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public ApplyfeedbackSubVolumeWeightResponse applyfeedbackSubVolumeWeight(ApplyfeedbackSubVolumeWeightRequest param) {
log.info("向LMS申请反馈,请求参数{}",param);
try {
MDC.put(log_file_type, log_type);
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);
}
return applyfeedbackSubVolumeWeightResponse;
} finally {
MDC.remove(log_file_type);
}
}
@Override
public ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param) {
log.info("向LMS申请反馈,请求参数{}", param);
try {
MDC.put(log_file_type, log_type);
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");
@@ -537,28 +535,29 @@ 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;
} finally {
MDC.remove(log_file_type);
}
}
@Override

View File

@@ -22,6 +22,7 @@ import org.nl.acs.device_driver.one_conveyor.fold_disc_site.FoldDiscSiteDeviceDr
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver;
import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver;
import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.blank_manipulator.BlankManipulatorDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver;
@@ -56,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
@@ -78,6 +76,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Autowired
private InstructionService instructionService;
@Autowired
private LuceneExecuteLogService luceneLogService;
@Autowired
private AcsToLiKuService acsToLiKuService;
@@ -489,19 +490,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Override
public PutActionResponse putAction(String jsonObject) throws Exception {
try {
MDC.put(log_file_type, log_type);
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,78 +549,119 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
}
response.setStatus(200);
response.setMessage("success");
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"putAction", String.valueOf(response.getCode()),
jsonObject, String.valueOf(response), "LMS下发动作");
luceneExecuteLogService.interfaceExecuteLog(luceneLogDto);
log.info("putAction--------------:输出参数:" + response);
return response;
} finally {
MDC.remove(log_file_type);
}
response.setMessage("success");
LuceneLogDto luceneLogDto1 = new LuceneLogDto(4, "putAction", String.valueOf(response.getCode()),
jsonObject, String.valueOf(response), "LMS下发动作");
luceneExecuteLogService.interfaceExecuteLog(luceneLogDto);
log.info("putAction--------------:输出参数:" + response);
return response;
}
@Override
public Map<String, Object> putWeightAction(String jsonObject) throws Exception {
try {
MDC.put(log_file_type, log_type);
log.info("putWeightAction--------------:输入参数" + jsonObject);
JSONArray datas = JSONArray.parseArray(jsonObject);
JSONObject jo = new JSONObject();
for (int i = 0; i < datas.size(); i++) {
JSONObject data = (JSONObject) datas.get(i);
String device_code = data.getString("device_code");
String type = data.getString("type");
Device device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new Exception("未找到对应设备:" + device_code);
}
WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver;
if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) {
wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver();
try {
//称重完成
if (StrUtil.equals("1", type)) {
wasteFoilWeighingStationDriver.writing("to_command", "6");
Thread.sleep(1000); //休眠1秒
while (true) {
if (wasteFoilWeighingStationDriver.getMode()==6){
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量
jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量
break;
}
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++) {
JSONObject data = (JSONObject) datas.get(i);
String device_code = data.getString("device_code");
String type = data.getString("type");
Device device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new Exception("未找到对应设备:" + device_code);
}
WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver;
if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) {
wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver();
try {
//称重完成
if (StrUtil.equals("1", type)) {
wasteFoilWeighingStationDriver.writing("to_command", "6");
Thread.sleep(1000); //休眠1秒
while (true) {
if (wasteFoilWeighingStationDriver.getMode() == 6) {
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量
jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差
break;
}
wasteFoilWeighingStationDriver.writing("to_command", "0");
}
//称重确认信号
else if (StrUtil.equals("2", type)) {
wasteFoilWeighingStationDriver.writing("to_command", "7");
Thread.sleep(1000); //休眠1秒
while (true) {
if (wasteFoilWeighingStationDriver.getMode()==7){
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量
jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差
break;
}
}
wasteFoilWeighingStationDriver.writing("to_command", "0");
}
} catch (InterruptedException e) {
e.printStackTrace();
wasteFoilWeighingStationDriver.writing("to_command", "0");
}
//称重确认信号
else if (StrUtil.equals("2", type)) {
wasteFoilWeighingStationDriver.writing("to_command", "7");
Thread.sleep(1000); //休眠1秒
while (true) {
if (wasteFoilWeighingStationDriver.getMode() == 7) {
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
jo.put("lastWeight", wasteFoilWeighingStationDriver.getOld_weight());//上一次重量
jo.put("weightGap", wasteFoilWeighingStationDriver.getGap_weight());//重量差
break;
}
}
wasteFoilWeighingStationDriver.writing("to_command", "0");
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK.value());
resultJson.put("message", "操作成功");
resultJson.put("data", jo);
log.info("putWeightAction--------------:输出参数" + resultJson.toString());
return resultJson;
} finally {
MDC.remove(log_file_type);
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK.value());
resultJson.put("message", "操作成功");
resultJson.put("data", jo);
log.info("putWeightAction--------------:输出参数" + resultJson.toString());
return resultJson;
}
@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++) {
JSONObject data = (JSONObject) datas.get(i);
String device_code = data.getString("device_code");
String to_material = data.getString("to_material");
String to_spec = data.getString("to_spec");
String to_qty = data.getString("to_qty");
Device device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device)) {
throw new Exception("未找到对应设备:" + device_code);
}
PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver;
if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {
//反馈管芯信息
Thread.sleep(1000); //休眠1秒
while (true) {
if (paperTubePickSiteDeviceDriver.getMode() == 2 && paperTubePickSiteDeviceDriver.getFlag() == 3) {
jo.put("to_material", to_material);//当前重量
jo.put("to_spec", to_spec);//上一次重量
jo.put("to_qty", to_qty);//重量差
break;
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK.value());
resultJson.put("message", "操作成功");
resultJson.put("data", jo);
log.info("putWeightAction--------------:输出参数" + resultJson.toString());
return resultJson;
}
@Override

View File

@@ -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);
/**
* 根据终点查询指令

View File

@@ -1725,6 +1725,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<>();

View File

@@ -24,7 +24,8 @@ public class DeviceStageMonitorServiceImpl implements DeviceStageMonitorService
@Override
public JSONArray getData(JSONArray jsonArray) throws Exception {
public JSONArray
getData(JSONArray jsonArray) throws Exception {
JSONArray arr = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject obj = new JSONObject();

View File

@@ -33,7 +33,7 @@ public @interface Query {
// Dong ZhaoYang 2017/8/7 查询方式
Type type() default Type.EQUAL;
/**
/**r
* 连接查询的属性名如User类中的dept
*/
String joinName() default "";

View File

@@ -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;

View File

@@ -10,7 +10,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.67}:${DB_PORT:3306}/${DB_NAME:lzhl_acs2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}

View File

@@ -35,6 +35,8 @@ universal_message8=\u8BFB\u53D6\u4FE1\u53F7\u503C\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message9=\u521B\u5EFA\u6307\u4EE4\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message10=\u4E0B\u53D1\u591A\u4E2A\u7535\u6C14\u4FE1\u53F7:
universal_message11=\u4FE1\u53F7\u8FDE\u63A5\u5F02\u5E38\uFF01
universal_message12=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u6210\u529F\uFF01
universal_message13=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u5931\u8D25\uFF01
universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001
universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001
universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001

View File

@@ -33,6 +33,8 @@ universal_message8=An exception occurred when reading the signal value:
universal_message9=An exception occurred while creating the directive
universal_message10=Multiple electrical signals are issued
universal_message11=The signal connection is abnormal!
universal_message12=Successfully applied for shelving task!
universal_message13=Application for shelving task failed!
universal_feedMessage1=mode is not in the running state
universal_feedMessage2=action signal (action signal) is not a release completed status
universal_feedMessage3=Photoelectric signal (move) is not out of stock

View File

@@ -32,6 +32,8 @@ universal_message7=Misi tercapai ...
universal_message8=Pengecualian terjadi saat membaca nilai sinyal:
universal_message9=Pengecualian terjadi saat membuat direktif
universal_message10=Beberapa sinyal listrik dikeluarkan
universal_message12=Aplikasi untuk tugas perancah berhasil!
universal_message13=Gagal melamar tugas memeras!
universal_message11=Koneksi sinyal tidak normal!
universal_feedMessage1=Mode kerja tidak untuk mode dalam mode
universal_feedMessage2=Sinyal aksi tidak lengkap untuk penempatan

View File

@@ -33,6 +33,8 @@ universal_message8=\u8BFB\u53D6\u4FE1\u53F7\u503C\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message9=\u521B\u5EFA\u6307\u4EE4\u65F6\u51FA\u73B0\u5F02\u5E38:
universal_message10=\u4E0B\u53D1\u591A\u4E2A\u7535\u6C14\u4FE1\u53F7
universal_message11=\u4FE1\u53F7\u8FDE\u63A5\u5F02\u5E38\uFF01
universal_message12=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u6210\u529F\uFF01
universal_message13=\u7533\u8BF7\u884C\u67B6\u4EFB\u52A1\u5931\u8D25\uFF01
universal_feedMessage1=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u4E3A\u8FD0\u884C\u4E2D\u72B6\u6001
universal_feedMessage2=\u52A8\u4F5C\u4FE1\u53F7(action)\u4E0D\u4E3A\u653E\u8D27\u5B8C\u6210\u72B6\u6001
universal_feedMessage3=\u5149\u7535\u4FE1\u53F7(move)\u4E0D\u4E3A\u65E0\u8D27\u72B6\u6001