rev:解决联调问题

This commit is contained in:
2024-03-14 18:02:00 +08:00
parent e4caec2918
commit 5ad7a02093
22 changed files with 887 additions and 691 deletions

View File

@@ -16,6 +16,7 @@ public class CommonFinalParam {
private final String BARRE = "-";
private final String POINT = ".";
public static final String ZERO = "0";
public static final String ONE = "1";
public static final String TWO = "2";
@@ -51,6 +52,20 @@ public class CommonFinalParam {
public static final int ACTION_TWO = 2;
public static final int ACTION_THREE = 3;
/**
* 申请任务type类型
*/
public static final String TYPE_ONE = "1";
public static final String TYPE_TWO = "2";
public static final String TYPE_THREE = "3";
public static final String TYPE_FOUR = "4";
public static final String TYPE_FIVE = "5";
public static final String TYPE_SIX = "6";
public static final String TYPE_SEVEN = "7";
/**
* 切割点符号
*/

View File

@@ -235,18 +235,18 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
List toInstructions;
//拔轴完成RGV工位上有货申请行架任务
if (mode == 2 && move == 1 && !requireSucess) {
if (mode == 4 && move == 1 && !requireSucess) {
applyTask();
} else {
if (mode == 2) {
//if (!requireSucess) {
String remark = "";;
String remark = "";
;
if (mode != 2) {
remark = remark + "universal_remark2";
}
if (move != 0) {
remark = remark + "universal_remark3";
remark = remark + "universal_remark3";
}
if (task != 0) {
remark = remark + LangProcess.msg("universal_remark4");
@@ -286,17 +286,19 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
public synchronized void applyTask() {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
ApplyManipulatorActionResponse applyManipulatorActionResponse;
String direction = (String) this.getDevice().getExtraValue().get("direction");
applyManipulatorActionRequest.setDevice_code(device_code);
applyManipulatorActionRequest.setLocation("1");
applyManipulatorActionRequest.setDirection(direction);//rgv申请位置
applyManipulatorActionRequest.setQzz_no(String.valueOf(barcode));//气涨轴编码
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
Map<String, Object> map = new LinkedHashMap<>();
if (applyManipulatorActionResponse.getCode() == 200) {
map.put("to_target",applyManipulatorActionResponse.getNext_point());
if (StrUtil.isEmpty(left)){
map.put("to_sub_volume_no", right);
} else {
map.put("to_sub_volume_no", left);
}
Map<String, String> data = applyManipulatorActionResponse.getData();
String point_code2 = data.get("point_code2");//目标站点
String material_code = data.get("material_code");//子卷号
map.put("to_target", point_code2);
map.put("to_sub_volume_no", material_code);
map.put("to_command", "1");
this.writing(map);
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse);
message = "申请行架任务成功";

View File

@@ -48,6 +48,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
* @author: TuQiang
* @Created: 2024/3/14
*/
/**
* 表处下料-行架机械手
*/
@@ -74,30 +79,49 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
//工作模式
/**
* 工作模式
*/
int mode = 0;
int last_mode = 0;
//光电信号
/**
* 光电信号
*/
int move = 0;
int last_move = 0;
//动作信号
/**
* 动作信号
*/
int action = 0;
int last_action = 0;
//行走列
/**
* 行走列
*/
int walk_y = 0;
int last_walk_y = 0;
//报警信号
/**
* 报警信号
*/
int error = 0;
int last_error = 0;
//任务号
/**
* 任务号
*/
int task = 0;
int last_task = 0;
//重量
/**
* 重量
*/
int weight = 0;
int last_weight = 0;
//条码
/**
* 条码
*/
int barcode = 0;
int last_barcode = 0;
@@ -119,26 +143,29 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
int hasGoods = 0;
String message = null;
Boolean iserror = false;
private Date instruction_update_time = new Date();
private int instruction_update_time_out = 1000;
Integer heartbeat_tag;
private Date instructionUpdateTime = new Date();
private int instructionUpdateTimeOut = 1000;
private Date instruction_require_time = new Date();
private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识
/**
* 行架机械手申请任务成功标识
*/
boolean requireSucess = false;
private int instruction_finished_time_out;
int branchProtocol = 0;
private String error_type = "hxhj_error_type";
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
/**
* 暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
*/
int flag;
String device_code;
//当前指令
/**
* 当前指令
*/
Instruction inst = null;
String notCreateTaskMessage = "";
@@ -177,36 +204,52 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("信号mode" + last_mode + "->" + mode)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("信号move" + last_move + "->" + move)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("信号action" + last_action + "->" + action)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("信号error" + last_error + "->" + error)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
// 更新指令状态
/**
* 更新指令状态
*/
if (mode == 3 && task > 0) {
Date date = new Date();
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
if (date.getTime() - this.instructionUpdateTime.getTime() < (long) this.instructionUpdateTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionUpdateTimeOut);
} else {
this.instruction_update_time = date;
//更改指令状态
this.instructionUpdateTime = date;
/**
* 更改指令状态
*/
if (task > 0) {
Instruction inst = checkInst();
if (inst != null) {
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
if (StrUtil.equals(inst.getInstruction_status(), CommonFinalParam.ZERO)) {
inst.setInstruction_status(CommonFinalParam.ONE);
inst.setExecute_device_code(this.device_code);
instructionService.update(inst);
@@ -216,12 +259,14 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
}
}
//反馈重量
/**
* 反馈重量
*/
if (mode == 3 && action == 5 && move == 1 && task > 0) {
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isNotEmpty(inst2)) {
String task_code = inst2.getTask_code();
TaskDto dto = taskserver.findByCode(task_code);
String taskCode = inst2.getTask_code();
TaskDto dto = taskserver.findByCode(taskCode);
JSONObject jo = new JSONObject();
jo.put("task_id", dto.getTask_id());
jo.put("task_code", dto.getTask_code());
@@ -274,7 +319,9 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
}
}
//任务完成
/**
* 任务完成
*/
if (mode == 3 && action == 6 && move == 0 && task > 0) {
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst2 != null) {
@@ -282,7 +329,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
try {
requireSucess = true;
message = "universal_message7";
finish_instruction(inst2);
finishInstruction(inst2);
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "6");
this.writing(map);
@@ -320,7 +367,9 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
/**
* 行架机械手申请任务
*/
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
@@ -370,10 +419,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
/**
* // * 申请任务
* // *
* // * @param
* //
* 申请任务
*/
public synchronized boolean applyTask() {
Date date = new Date();
@@ -395,26 +441,26 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
taskDtos = this.sortTask(taskDtos);
TaskDto taskDto = taskDtos.get(0);
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
String start_device_code = instruction.getStart_device_code();
String next_device_code = instruction.getNext_device_code();
String startCode = instruction.getStart_device_code();
String nextCode = instruction.getNext_device_code();
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction);
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
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()));
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", start_addr);
map.put("to_onset", startAddr);
map.put("to_task", instruction.getInstruction_code());
map.put("to_target", next_addr);
map.put("to_target", nextAddr);
this.writing(map);
this.setRequireSucess(true);
return true;
@@ -431,35 +477,35 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
}
}
if (!ObjectUtil.isEmpty(task)) {
String taskid = task.getTask_id();
String taskcode = task.getTask_code();
String vehiclecode = task.getVehicle_code();
String taskId = task.getTask_id();
String taskCode = task.getTask_code();
String vehicleCode = task.getVehicle_code();
String priority = task.getPriority();
String start_point_code = task.getStart_point_code();
String start_device_code = task.getStart_device_code();
String route_plan_code = task.getRoute_plan_code();
String next_point_code = task.getNext_point_code();
String next_device_code = task.getNext_device_code();
String startPointCode = task.getStart_point_code();
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());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRoute_plan_code(routePlanCode);
instdto.setRemark(task.getRemark());
instdto.setMaterial(task.getMaterial());
instdto.setQuantity(task.getQuantity());
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
instdto.setVehicle_code(vehiclecode);
instdto.setTask_id(taskId);
instdto.setTask_code(taskCode);
instdto.setVehicle_code(vehicleCode);
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setStart_device_code(startDeviceCode);
instdto.setNext_device_code(nextDeviceCode);
instdto.setStart_point_code(startPointCode);
instdto.setNext_point_code(nextPointCode);
instdto.setPriority(priority);
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(start_point_code);
instdto.setExecute_device_code(startPointCode);
try {
instructionService.create(instdto);
@@ -498,13 +544,13 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", start_addr);
map.put("to_onset", startAddr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_target", next_addr);
map.put("to_target", nextAddr);
this.writing(map);
this.setRequireSucess(true);
notCreateInstMessage = "";
@@ -517,7 +563,7 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
}
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
public synchronized boolean finishInstruction(Instruction inst) throws Exception {
instructionService.finish(inst);
return true;
}
@@ -553,6 +599,11 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
}
}
/**
* 任务排序
* @param taskDtos
* @return
*/
public List<TaskDto> sortTask(List<TaskDto> taskDtos) {
Collections.sort(taskDtos, new Comparator<TaskDto>() {
@Override
@@ -570,6 +621,10 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
return taskDtos;
}
/**
* 获取监控设备信息
* @return
*/
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
@@ -631,9 +686,9 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
@Override
public void setDeviceStatus(JSONObject data) {
String requestSucess = data.getString("requireSucess");
if (StrUtil.equals(requestSucess, "0")) {
if (StrUtil.equals(requestSucess, CommonFinalParam.ZERO)) {
this.requireSucess = false;
} else if (StrUtil.equals(requestSucess, "1")) {
} else if (StrUtil.equals(requestSucess, CommonFinalParam.ONE)) {
this.requireSucess = true;
}
}
@@ -644,8 +699,6 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
jo.put("device_code", this.getDevice().getDevice_code());
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("fault_code", String.valueOf(error));
jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError())));
jo.put("fault_type", error_type);
return jo;
}

View File

@@ -30,6 +30,7 @@ import org.nl.acs.task.service.TaskService;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +38,10 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author : TuQiang
* @date : 2024/3/14
*/
/**
* 下料按钮
@@ -75,12 +80,9 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
private String error_type = "hx_error_type";
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
private Date instructionRequireTime = new Date();
private int instructionRequireTimeOut = 3000;
public int heartbeat = 0;
public int mode = 0;
@@ -88,18 +90,18 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
public int action = 0;
public int error = 0;
public int last_heartbeat = 0;
public int last_mode = 0;
public int last_move = 0;
public int last_action = 0;
public int last_error = 0;
public int lastHeartbeat = 0;
public int lastMode = 0;
public int lastMove = 0;
public int lastAction = 0;
public int lastError = 0;
Boolean isonline = true;
Boolean iserror = false;
String device_code;
String deviceCode;
String message = null;
@@ -115,29 +117,41 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
@Override
public void execute() {
device_code = this.getDeviceCode();
deviceCode = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
action = this.itemProtocol.getItem_action();
error = this.itemProtocol.getItem_error();
if (mode != last_mode) {
if (mode != lastMode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号mode" + lastMode + "->" + mode)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
if (move != lastMove) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号move" + lastMove + "->" + move)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
if (action != lastAction) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号action" + lastAction + "->" + action)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
if (error != lastError) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号error" + lastError + "->" + error)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
@@ -192,10 +206,10 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
}
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
lastMode = mode;
lastMove = move;
lastAction = action;
lastError = error;
}
@@ -204,22 +218,22 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
*/
public synchronized void applyTakeFullVolume() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime()
< (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (date.getTime() - this.instructionRequireTime.getTime()
< (long) this.instructionRequireTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
return;
} else {
this.instruction_require_time = date;
this.instructionRequireTime = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message5";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(device_code);
blankingButtonRequest.setType("1");
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()== 200) {
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
this.writing("to_command","9");
message = "two_message7";
requireSucess = true;
@@ -238,22 +252,22 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
*/
public synchronized void cancelTask() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime()
< (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (date.getTime() - this.instructionRequireTime.getTime()
< (long) this.instructionRequireTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
return;
} else {
this.instruction_require_time = date;
this.instructionRequireTime = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message9";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(device_code);
blankingButtonRequest.setType("2");
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()== 200) {
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
this.writing("to_command","10");
message = "two_message11";
requireSucess = true;
@@ -272,22 +286,22 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
*/
public synchronized void applyTakeEmptyShaft() {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime()
< (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (date.getTime() - this.instructionRequireTime.getTime()
< (long) this.instructionRequireTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
return;
} else {
this.instruction_require_time = date;
this.instructionRequireTime = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message13";
BlankingButtonRequest blankingButtonRequest = new BlankingButtonRequest();
blankingButtonRequest.setDevice_code(device_code);
blankingButtonRequest.setType("2");
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()== 200) {
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
this.writing("to_command","10");
message = "two_message15";
requireSucess = true;
@@ -310,7 +324,7 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value);
}

View File

@@ -30,6 +30,8 @@ import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -69,12 +71,11 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
private String error_type = "hx_error_type";
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
private Date instructionRequireTime = new Date();
private int instructionRequireTimeOut = 3000;
public int heartbeat = 0;
public int mode = 0;
@@ -82,18 +83,18 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
public int action = 0;
public int error = 0;
public int last_heartbeat = 0;
public int last_mode = 0;
public int last_move = 0;
public int last_action = 0;
public int last_error = 0;
public int lastHeartbeat = 0;
public int lastMode = 0;
public int lastMove = 0;
public int lastAction = 0;
public int lastError = 0;
Boolean isonline = true;
Boolean iserror = false;
String device_code;
String deviceCode;
String message = null;
@@ -109,7 +110,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
@Override
public void execute() {
device_code = this.getDeviceCode();
deviceCode = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
@@ -117,22 +118,34 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
error = this.itemProtocol.getItem_error();
iserror = this.itemProtocol.isError;
if (mode != last_mode) {
if (mode != lastMode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号mode" + lastMode + "->" + mode)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
if (move != lastMove) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号move" + lastMove + "->" + move)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
if (action != lastAction) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号action" + lastAction + "->" + action)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
if (error != lastError) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号error" + lastError + "->" + error)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (mode == 0) {
@@ -151,9 +164,6 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 2:
log.debug("待机");
@@ -168,9 +178,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
}
break;
case 5:
/**
* 申请AGV取空放空的任务
*/
//申请AGV取空放空的任务
if (!requireSucess) {
applyAgvTask(mode);
}
@@ -194,10 +202,10 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
lastMode = mode;
lastMove = move;
lastAction = action;
lastError = error;
}
@@ -206,22 +214,22 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
*/
public synchronized void applyAgvTask(int mode) {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime()
< (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
if (date.getTime() - this.instructionRequireTime.getTime()
< (long) this.instructionRequireTimeOut) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instructionRequireTimeOut);
return;
} else {
this.instruction_require_time = date;
this.instructionRequireTime = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), CommonFinalParam.ONE)) {
message = "two_message17";
ApplyGreenFoilButtonRequest applyGreenFoilButtonRequest = new ApplyGreenFoilButtonRequest();
applyGreenFoilButtonRequest.setDevice_code(device_code);
applyGreenFoilButtonRequest.setDevice_code(deviceCode);
applyGreenFoilButtonRequest.setType(String.valueOf(mode));
ApplyGreenFoilButtonResponse response = acsToWmsService.applyGreenFoilButtonTask(applyGreenFoilButtonRequest);
if (ObjectUtil.isEmpty(response)) {
message = "two_message18";
} else {
if (response.getCode()== 200) {
if (response.getCode()== CommonFinalParam.STATUS_OPEN) {
if (mode==4){
this.writing("to_command","4");
}else if (mode==5){
@@ -253,7 +261,7 @@ public class GreenFoilMachineButtonDriver extends AbstractOpcDeviceDriver implem
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value);
}

View File

@@ -54,35 +54,32 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
//心跳
public int heartbeat = 0;
public int last_heartbeat = 0;
public int lastHeartbeat = 0;
//工作模式
int mode = 0;
int last_mode = 0;
int lastMode = 0;
//光电信号
int move = 0;
int last_move = 0;
int lastMove = 0;
//动作信号
int action = 0;
int last_action = 0;
int lastAction = 0;
//报警信号
int error = 0;
int last_error = 0;
int lastError = 0;
//数量
int qty = 0;
int last_qty = 0;
int lastQty = 0;
//类型
int type = 0;
int last_type = 0;
int to_command = 0;
int last_to_command = 0;
int lastType = 0;
Boolean isonline = true;
Boolean iserror = false;
String device_code;
String deviceCode;
String message = null;
@@ -97,7 +94,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
@Override
public void execute() {
device_code = this.getDeviceCode();
deviceCode = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
mode = this.itemProtocol.getItem_mode();
move = this.itemProtocol.getItem_move();
@@ -108,40 +105,38 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
iserror = this.itemProtocol.isError;
if (mode != last_mode) {
if (mode != lastMode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
logServer.deviceItemValue(this.deviceCode, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.deviceCode, "", "", "信号mode" + lastMode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
if (move != lastMove) {
logServer.deviceItemValue(this.deviceCode, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.deviceCode, "", "", "信号move" + lastMove + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
if (action != lastAction) {
logServer.deviceItemValue(this.deviceCode, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.deviceCode, "", "", "信号action" + lastAction + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
if (error != lastError) {
logServer.deviceItemValue(this.deviceCode, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.deviceCode, "", "", "信号error" + lastError + "->" + error);
}
if (qty != last_qty) {
logServer.deviceItemValue(this.device_code, "weight", String.valueOf(qty));
logServer.deviceExecuteLog(this.device_code, "", "", "信号qty" + last_qty + "->" + qty);
if (qty != lastQty) {
logServer.deviceItemValue(this.deviceCode, "weight", String.valueOf(qty));
logServer.deviceExecuteLog(this.deviceCode, "", "", "信号qty" + lastQty + "->" + qty);
}
if (type != last_type) {
logServer.deviceItemValue(this.device_code, "weight", String.valueOf(type));
logServer.deviceExecuteLog(this.device_code, "", "", "信号type" + last_type + "->" + type);
if (type != lastType) {
logServer.deviceItemValue(this.deviceCode, "weight", String.valueOf(type));
logServer.deviceExecuteLog(this.deviceCode, "", "", "信号type" + lastType + "->" + type);
}
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
last_qty = qty;
last_type = type;
lastMode = mode;
lastMove = move;
lastAction = action;
lastError = error;
lastQty = qty;
lastType = type;
}
@@ -154,7 +149,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value);
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.two_conveyor.plug_pull_device_site;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -34,6 +35,8 @@ public class ItemProtocol {
public static String item_weight2 = "weight2";
//纸管2规格
public static String item_material2 = "material2";
//气涨轴尺寸
public static String item_size = "size";
//下发命令
public static String item_to_command = "to_command";
@@ -43,14 +46,16 @@ public class ItemProtocol {
public static String item_to_material2 = "to_material2";
//纸管数量
public static String item_to_qty = "to_qty";
//气涨轴类型
//气涨轴类型 标箔/锂电 1/2
public static String item_to_qzz_type = "to_qzz_type";
//是否换轴
public static String item_to_weight1 = "to_weight1";
//尺寸
public static String item_to_size = "to_size";
//存储位置
public static String item_to_weight2 = "to_weight2";
//是否下发纸管号1
public static String item_to_volumn1 = "to_volumn1";
//纸管1尺寸
public static String item_to_size1 = "to_size1";
//纸管2尺寸
public static String item_to_size2 = "to_size2";
//是否下发纸管号2
public static String item_to_volumn2 = "to_volumn2";
private PlugPullDeviceSiteDeviceDriver driver;
@@ -82,26 +87,28 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_task);
}
public int getBarcode(){ return this.getOpcIntegerValue(item_barcode);}
public String getBarcode(){ return this.getOpcStringValue(item_barcode);}
public int getWeight1(){ return this.getOpcIntegerValue(item_weight1);}
public int getMaterial1(){ return this.getOpcIntegerValue(item_material1);}
public String getMaterial1(){ return this.getOpcStringValue(item_material1);}
public int getWeight2(){ return this.getOpcIntegerValue(item_weight2);}
public int getMaterial2(){ return this.getOpcIntegerValue(item_material2);}
public int getSize(){ return this.getOpcIntegerValue(item_size);}
public String getMaterial2(){ return this.getOpcStringValue(item_material2);}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
public int getTo_material1() {
return this.getOpcIntegerValue(item_to_material1);
public String getTo_material1() {
return this.getOpcStringValue(item_to_material1);
}
public int getTo_material2() {
return this.getOpcIntegerValue(item_to_material2);
public String getTo_material2() {
return this.getOpcStringValue(item_to_material2);
}
public int getTo_qty() {
@@ -112,16 +119,20 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_qzz_type);
}
public int getTo_weight2() {
return this.getOpcIntegerValue(item_to_weight2);
public String getTo_volumn1() {
return this.getOpcStringValue(item_to_volumn1);
}
public int getTo_size() {
return this.getOpcIntegerValue(item_to_size);
public int getTo_size1() {
return this.getOpcIntegerValue(item_to_size1);
}
public int getTo_weight1() {
return this.getOpcIntegerValue(item_to_weight1);
public int getTo_size2() {
return this.getOpcIntegerValue(item_to_size2);
}
public String getTo_volumn2() {
return this.getOpcStringValue(item_to_volumn1);
}
Boolean isonline;
@@ -144,6 +155,16 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isBlank(value)) {
} else {
return value;
}
return "0";
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
@@ -163,26 +184,28 @@ public class ItemProtocol {
list.add(new ItemDto(item_mode, "工作模式", "DB9.B1"));
list.add(new ItemDto(item_move, "光电信号", "DB9.B2"));
list.add(new ItemDto(item_action, "动作信号", "DB9.B3"));
list.add(new ItemDto(item_barcode, "气胀轴条码", "DB9.B4"));
list.add(new ItemDto(item_barcode, "气胀轴条码", "DB9.String224.60"));
list.add(new ItemDto(item_weight1, "纸管1重量", "DB9.B5"));
list.add(new ItemDto(item_material1, "纸管1规格", "DB9.B6"));
list.add(new ItemDto(item_material1, "纸管1规格", "DB9.String278.60"));
list.add(new ItemDto(item_weight2, "纸管2重量", "DB9.B7"));
list.add(new ItemDto(item_material2, "纸管2规格", "DB9.B8"));
list.add(new ItemDto(item_material2, "纸管2规格", "DB9.String332.60"));
list.add(new ItemDto(item_error, "报警信号", "DB9.B9"));
list.add(new ItemDto(item_task, "任务号", "DB9.D10"));
list.add(new ItemDto(item_size, "尺寸", "DB9.B11"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB10.W0"));
list.add(new ItemDto(item_to_material1, "纸管1规格", "DB10.W2"));
list.add(new ItemDto(item_to_material2, "纸管2规格", "DB10.W4"));
list.add(new ItemDto(item_to_material1, "纸管1规格", "DB10.String602.60"));
list.add(new ItemDto(item_to_material2, "纸管2规格", "DB10.String656.60"));
list.add(new ItemDto(item_to_qty, "纸管数量", "DB10.W6"));
list.add(new ItemDto(item_to_qzz_type, "气胀轴类型", "DB10.W8"));
list.add(new ItemDto(item_to_weight1, "纸管1标准重量", "DB10.W10"));
list.add(new ItemDto(item_to_weight2, "纸管2标准重量", "DB10.W12"));
list.add(new ItemDto(item_to_size, "尺寸", "DB10.W14"));
list.add(new ItemDto(item_to_volumn1, "下发纸管号1", "DB10.String610.60"));
list.add(new ItemDto(item_to_volumn2, "下发纸管号2", "DB10.String612.60"));
list.add(new ItemDto(item_to_size1, "下发纸管1尺寸", "DB10.W10"));
list.add(new ItemDto(item_to_size2, "下发纸管2尺寸", "DB10.W12"));
return list;
}

View File

@@ -7,6 +7,7 @@ import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
@@ -29,6 +30,8 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.language.LangProcess;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -61,70 +64,79 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
@Autowired
AgvService agvService = SpringContextHolder.getBean(AgvService.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private Date instruction_apply_time = new Date();
private int instruction_require_time_out = 3000;
//工作模式
int mode = 0;
int last_mode = 0;
int lastMode = 0;
//光电信号
int move = 0;
int last_move = 0;
int lastMove = 0;
//动作信号
int action = 0;
int last_action = 0;
int lastAction = 0;
//报警信号
int error = 0;
int last_error = 0;
int lastError = 0;
//任务号
int task = 0;
int last_task = 0;
int lastTask = 0;
//气涨轴尺寸
int size = 0;
int lastSize = 0;
int heartbeat = 0;
int last_heartbeat = 0;
int to_command = 0;
int last_to_command = 0;
int lastHeartbeat = 0;
int toCommand = 0;
int lastToCommand = 0;
//气胀轴条码
int barcode = 0;
int last_barcode = 0;
String barcode = null;
String lastBarcode = null;
//纸管1重量
int weight1 = 0;
int last_weight1 = 0;
int lastWeight1 = 0;
//纸管1规格
int material1 = 0;
int last_material1 = 0;
String material1 = null;
String lastMaterial1 = null;
//纸管2重量
int weight2 = 0;
int last_weight2 = 0;
int lastWeight2 = 0;
//纸管2规格
int material2 = 0;
int last_material2 = 0;
String material2 = null;
String lastMaterial2 = null;
int to_size = 0;
int last_to_size = 0;
//纸管1尺寸
int toSize1 = 0;
int lastToSize1 = 0;
int to_material1 = 0;
int last_to_material1 = 0;
//纸管2尺寸
int toSize2 = 0;
int lastToSize2 = 0;
int to_material2 = 0;
int last_to_material2 = 0;
String toMaterial1 = null;
String lastToMaterial1 = null;
int to_qty = 0;
int last_to_qty = 0;
String toMaterial2 = null;
String lastToMaterial2 = null;
int to_qzz_type = 0;
int last_to_qzz_type = 0;
int toQty = 0;
int lastToQty = 0;
int to_weight1 = 0;
int last_to_weight1 = 0;
int toQzzType = 0;
int lastToQzzType = 0;
int to_weight2 = 0;
int last_to_weight2 = 0;
//子卷号1
String toVolumn1 = null;
String lastToVolumn1 = null;
//子卷号2
String toVolumn2 = null;
String lastToVolumn2 = null;
Boolean isonline = true;
@@ -138,7 +150,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
*/
int flag;
String device_code;
String deviceCode;
String message = null;
@@ -154,8 +166,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
String feedMessage = "";
@Override
public void execute() {
device_code = this.getDeviceCode();
public void execute() throws Exception {
deviceCode = this.getDeviceCode();
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
@@ -166,98 +178,173 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
weight1 = this.itemProtocol.getWeight1();
material1 = this.itemProtocol.getMaterial1();
weight2 = this.itemProtocol.getWeight2();
size = this.itemProtocol.getSize();
material2 = this.itemProtocol.getMaterial2();
to_command = this.itemProtocol.getTo_command();
to_material1 = this.itemProtocol.getTo_material1();
to_material2 = this.itemProtocol.getTo_material2();
to_qty = this.itemProtocol.getTo_qty();
to_qzz_type = this.itemProtocol.getTo_qzz_type();
to_weight1 = this.itemProtocol.getTo_weight1();
to_weight2 = this.itemProtocol.getTo_weight2();
to_size = this.itemProtocol.getTo_size();
toCommand = this.itemProtocol.getTo_command();
toMaterial1 = this.itemProtocol.getTo_material1();
toMaterial2 = this.itemProtocol.getTo_material2();
toQty = this.itemProtocol.getTo_qty();
toQzzType = this.itemProtocol.getTo_qzz_type();
toVolumn1 = this.itemProtocol.getTo_volumn1();
toVolumn2 = this.itemProtocol.getTo_volumn2();
toSize1 = this.itemProtocol.getTo_size1();
toSize2 = this.itemProtocol.getTo_size2();
if (mode != last_mode) {
if (mode != lastMode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号mode" + lastMode + "->" + mode)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
if (move != lastMove) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号move" + lastMove + "->" + move)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
if (action != lastAction) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号action" + lastAction + "->" + action)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
if (error != lastError) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号error" + lastError + "->" + error)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (barcode != last_barcode) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(barcode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode" + last_barcode + "->" + barcode);
if (barcode != lastBarcode) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号barcode" + lastBarcode + "->" + barcode)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (weight1 != last_weight1) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(weight1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号weight1" + last_weight1 + "->" + weight1);
if (weight1 != lastWeight1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号weight1" + lastWeight1 + "->" + weight1)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (material1 != last_material1) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(material1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号material1" + last_material1 + "->" + material1);
if (material1 != lastMaterial1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号material1" + lastMaterial1 + "->" + material1)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (weight2 != last_weight2) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(weight2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号weight2" + last_weight2 + "->" + weight2);
if (weight2 != lastWeight2) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号weight2" + lastWeight2 + "->" + weight2)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (material2 != last_material2) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(material2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号material2" + last_material2 + "->" + material2);
if (material2 != lastMaterial2) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号material2" + lastMaterial2 + "->" + material2)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
if (task != lastTask) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号task" + lastTask + "->" + task)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
if (size != lastSize) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号size" + lastSize + "->" + size)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_material1 != last_to_material1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_material1" + last_to_material1 + "->" + to_material1);
if (toCommand != lastToCommand) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_command" + lastToCommand + "->" + toCommand)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_material2 != last_to_material2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_material2" + last_to_material2 + "->" + to_material2);
if (toMaterial1 != lastToMaterial1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_material1" + lastToMaterial1 + "->" + toMaterial1)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_qty != last_to_qty) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_qty" + last_to_qty + "->" + to_qty);
if (toMaterial2 != lastToMaterial2) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_material2" + lastToMaterial2 + "->" + toMaterial2)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_qzz_type != last_to_qzz_type) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_qzz_type" + last_to_qzz_type + "->" + to_qzz_type);
if (toQty != lastToQty) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_qty" + lastToQty + "->" + toQty)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_weight1 != last_to_weight1) {
logServer.deviceExecuteLog(this.device_code, "", "", "to_weight1" + last_to_weight1 + "->" + to_weight1);
if (toQzzType != lastToQzzType) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_qzz_type" + lastToQzzType + "->" + toQzzType)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_weight2 != last_to_weight2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_weight2" + last_to_weight2 + "->" + to_weight2);
if (toVolumn1 != lastToVolumn1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_volumn1" + lastToVolumn1 + "->" + toVolumn1)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (to_size != last_to_size) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_size" + last_to_size + "->" + to_size);
if (toVolumn2 != lastToVolumn2) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_volumn1" + lastToVolumn2 + "->" + toVolumn2)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (toSize1 != lastToSize1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_size1" + lastToSize1 + "->" + toSize1)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (toSize2 != lastToSize2) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(deviceCode)
.content("信号to_size2" + lastToSize2 + "->" + toSize2)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
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);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//插拔轴机工位申请任务
switch (mode) {
case 1:
@@ -270,24 +357,9 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
log.info(LangProcess.msg("universal_operation"));
break;
case 4:
if (task > 0) {
Instruction inst = instructionService.findByCode(String.valueOf(task));
TaskDto taskDto = taskserver.findByCode(inst.getTask_code());
if (StrUtil.equals("1", taskDto.getIs_bushing())) {
if (move == 1 && !requireSucess) {
//申请套管
apply_casing(mode);
}
} else {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_size", taskDto.getSize());
this.writing(map);
}
} else {
if (move == 1 && !requireSucess) {
//申请套管
apply_casing(mode);
}
if (!requireSucess) {
//申请套管
apply_casing(mode);
}
break;
case 5:
@@ -297,21 +369,21 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
}
break;
case 6:
if (!requireSucess && task > 0) {
if (!requireSucess) {
//拔轴完成
pullShaftSucess(mode);
}
break;
case 7:
if (!requireSucess && task > 0) {
if (!requireSucess) {
//申请拔轴
applyPullShaft(mode);
}
break;
case 8:
if (!requireSucess && task > 0) {
if (!requireSucess) {
//缓存线已满,申请行架任务
applyTask();
applyTask(mode);
}
break;
default:
@@ -319,48 +391,67 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
break;
}
}
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
last_task = task;
last_heartbeat = heartbeat;
last_barcode = barcode;
last_weight1 = weight1;
last_weight2 = weight2;
last_material1 = material1;
last_material2 = material2;
last_to_command = to_command;
last_to_material1 = to_material1;
last_to_material2 = to_material2;
last_to_qty = to_qty;
last_to_qzz_type = to_qzz_type;
last_to_weight2 = to_weight2;
last_to_weight1 = to_weight1;
last_to_size = to_size;
lastMode = mode;
lastMove = move;
lastAction = action;
lastError = error;
lastTask = task;
lastHeartbeat = heartbeat;
lastBarcode = barcode;
lastWeight1 = weight1;
lastWeight2 = weight2;
lastSize = size;
lastMaterial1 = material1;
lastMaterial2 = material2;
lastToCommand = toCommand;
lastToMaterial1 = toMaterial1;
lastToMaterial2 = toMaterial2;
lastToQty = toQty;
lastToQzzType = toQzzType;
lastToVolumn2 = toVolumn2;
lastToVolumn1 = toVolumn1;
lastToSize2 = toSize2;
lastToSize1 = toSize1;
}
/**
* 申请套管
*/
private synchronized void apply_casing(int mode) {
private synchronized void apply_casing(int mode) throws Exception {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst;
if (task != 0) {
inst = instructionService.findByCode(String.valueOf(task));
String task_code = inst.getTask_code();
TaskDto dto = taskserver.findByCode(task_code);
String size = dto.getSize();
applyPlugPullSiteRequest.setSize(size);
applyPlugPullSiteRequest.setTask_code(task_code);
}
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setType("1");
applyPlugPullSiteRequest.setDevice_code(deviceCode);
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE);
//气涨轴尺寸
applyPlugPullSiteRequest.setSize(String.valueOf(size));
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
this.writeSignal(mode);
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
Map<String, String> data = applyPlugPullSitResponse.getData();
String left = data.get("left");
String right = data.get("right");
String number = data.get("number");
String leftSize = data.get("left_size");
String rightSize = data.get("right_size");
Map<String, Object> map = new LinkedHashMap<>();
//下发纸管信息
//todo:纸管规格待定
if (StrUtil.isNotEmpty(left)) {
map.put("to_volumn1", left);
}
if (StrUtil.isNotEmpty(right)) {
map.put("to_volumn2", right);
}
if (StrUtil.isNotEmpty(leftSize)){
map.put("to_size1", leftSize);
}
if (StrUtil.isNotEmpty(rightSize)){
map.put("to_size2", rightSize);
}
map.put("to_command", mode);
map.put("to_qty", number);
this.writing(map);
requireSucess = true;
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse);
message = "申请套管成功";
} else {
message = applyPlugPullSitResponse.getMessage();
@@ -369,31 +460,27 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing(map);
requireSucess = true;
message = "申请套管失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
/**
* 套管完成
*/
private synchronized void bushingSucess(int mode) {
private synchronized void bushingSucess(int mode) throws Exception {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
if (task != 0) {
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setTask_code(task_code1);
}
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setDevice_code(deviceCode);
//上报规格和重量
applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1));
applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1));
applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2));
applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2));
applyPlugPullSiteRequest.setType("2");
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
this.writeSignal(mode);
logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.deviceCode, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse);
message = "套管完成成功";
} else {
message = applyPlugPullSitResponse.getMessage();
@@ -402,7 +489,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing(map);
requireSucess = true;
message = "申请套管失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
@@ -410,23 +497,19 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
/**
* 拔轴完成
*/
private synchronized void pullShaftSucess(int mode) {
private synchronized void pullShaftSucess(int mode) throws Exception {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
TaskDto taskDto = taskserver.findByCode(task_code1);
if (ObjectUtil.isNotEmpty(taskDto)){
}
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setDevice_code(deviceCode);
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
applyPlugPullSiteRequest.setType("3");
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
this.writeSignal(mode);
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", mode);
this.writing(map);
requireSucess = true;
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
message = "拔轴完成成功";
} else {
message = applyPlugPullSitResponse.getMessage();
@@ -434,32 +517,33 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
map.put("to_command", 99);
this.writing(map);
requireSucess = true;
message = "申请拔轴失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
message = "拔轴完成失败";
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
/**
* 申请拔轴
*/
private synchronized void applyPullShaft(int mode) {
private synchronized void applyPullShaft(int mode) throws Exception {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
TaskDto taskDto = taskserver.findByCode(task_code1);
if (ObjectUtil.isNotEmpty(taskDto)){
}
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setDevice_code(deviceCode);
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
applyPlugPullSiteRequest.setType("4");
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
this.writeSignal(mode);
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
message = "拔轴完成成功";
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
Map<String, String> data = applyPlugPullSitResponse.getData();
String leftSize = data.get("left_size");
String rightSzie = data.get("right_szie");
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_size1", leftSize);
map.put("to_size2", rightSzie);
map.put("to_command", mode);
this.writing(map);
requireSucess = true;
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
message = "申请拔轴成功";
} else {
message = applyPlugPullSitResponse.getMessage();
Map<String, Object> map = new LinkedHashMap<>();
@@ -467,30 +551,32 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
this.writing(map);
requireSucess = true;
message = "申请拔轴失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
/**
* 缓存线已满,生成行架任务
*/
private synchronized void applyTask() {
private synchronized void applyTask(int mode) throws Exception {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setType("5");
applyPlugPullSiteRequest.setDevice_code(deviceCode);
applyPlugPullSiteRequest.setSize(String.valueOf(size));
applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE);
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
message = "拔轴完成成功";
if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", mode);
this.writing(map);
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
message = "生成行架任务成功";
requireSucess = true;
} else {
message = applyPlugPullSitResponse.getMessage();
requireSucess = true;
message = "申请行架任务失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
logServer.deviceExecuteLog(this.deviceCode, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
@@ -499,7 +585,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
*
* @param mode
*/
public void writeSignal(int mode) {
public void writeSignal(int mode) throws Exception {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", mode);
this.writing(map);
@@ -525,11 +611,11 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
itemMap.put(to_param, json.getString("value"));
}
}
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号:" + itemMap);
this.control(itemMap);
}
public void writing(Map<String, Object> map) {
public void writing(Map<String, Object> map) throws Exception {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
@@ -538,7 +624,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
this.checkcontrol(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}

View File

@@ -45,14 +45,6 @@ public class ItemProtocol {
public static String item_to_sleeve = "to_sleeve";
//尺寸
public static String item_to_size = "to_size";
//代数
public static String item_to_version = "to_version";
//子卷数量
public static String item_to_qty = "to_qty";
//子卷1长度
public static String item_to_length1 = "to_length1";
//子卷2长度
public static String item_to_length2 = "to_length2";
public static String item_to_barcode = "to_barcode";
@@ -107,16 +99,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_size);
}
public int getTo_version() {
return this.getOpcIntegerValue(item_to_version);
}
public int getTo_qty() {
return this.getOpcIntegerValue(item_to_qty);
}
public int getTo_barcode() {
return this.getOpcIntegerValue(item_to_barcode);
public String getTo_barcode() {
return this.getOpcStringValue(item_to_barcode);
}
public int getTo_onset() {
@@ -139,13 +124,7 @@ public class ItemProtocol {
return this.getOpcFloatValue(item_y_position);
}
public float getTo_length1() {
return this.getOpcFloatValue(item_to_length1);
}
public float getTo_length2() {
return this.getOpcFloatValue(item_to_length2);
}
Boolean isonline;
Boolean isError;
@@ -190,6 +169,7 @@ public class ItemProtocol {
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB11.B0"));
@@ -209,15 +189,11 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_command, "下发命令", "DB12.W0"));
list.add(new ItemDto(item_to_onset, "下发起始站", "DB12.W2"));
list.add(new ItemDto(item_to_target, "下发目标站", "DB12.W4"));
list.add(new ItemDto(item_to_barcode, "下发气涨轴条码", "DB12.W4"));
list.add(new ItemDto(item_to_barcode, "下发气涨轴条码", "DB12.String602.60"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB12.D6"));
list.add(new ItemDto(item_to_pull, "是否拔轴", "DB12.W8"));
list.add(new ItemDto(item_to_sleeve, "是否套轴", "DB12.W10"));
list.add(new ItemDto(item_to_size, "尺寸", "DB12.W12"));
list.add(new ItemDto(item_to_version, "代数", "DB12.W14"));
list.add(new ItemDto(item_to_qty, "子卷数量", "DB12.W16"));
list.add(new ItemDto(item_to_length1, "子卷1长度", "DB12.W18"));
list.add(new ItemDto(item_to_length2, "子卷2长度", "DB12.W20"));
list.add(new ItemDto(item_to_size, "气涨轴尺寸", "DB12.W12"));
return list;
}

View File

@@ -68,64 +68,54 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
//工作模式
int mode = 0;
int last_mode = 0;
int lastMode = 0;
//光电信号
int move = 0;
int last_move = 0;
int lastMove = 0;
//动作信号
int action = 0;
int last_action = 0;
int lastAction = 0;
//行走列
int walk_y = 0;
int last_walk_y = 0;
int walkY = 0;
int lastWalkY = 0;
//报警信号
int error = 0;
int last_error = 0;
int lastError = 0;
//任务号
int task = 0;
int last_task = 0;
int lastTask = 0;
// x坐标
float x_position = 0;
float last_x_position = 0;
float xPosition = 0;
float lastXPosition = 0;
// y坐标
float y_position = 0;
float last_y_position = 0;
float yPosition = 0;
float lastYPosition = 0;
int heartbeat = 0;
int last_heartbeat = 0;
int to_command = 0;
int last_to_command = 0;
int lastHeartbeat = 0;
int toCommand = 0;
int lastToCommand = 0;
int to_target = 0;
int last_to_target = 0;
int toTarget = 0;
int lastToTarget = 0;
int to_task = 0;
int last_to_task = 0;
int toTask = 0;
int lastToTask = 0;
int to_onset = 0;
int last_to_onset = 0;
int toOnset = 0;
int lastToOnset = 0;
int to_pull = 0;
int last_to_pull = 0;
int toPull = 0;
int lastToPull = 0;
int to_sleeve = 0;
int last_to_sleeve = 0;
int toSleeve = 0;
int lastToSleeve = 0;
int to_size = 0;
int last_to_size = 0;
int toSize = 0;
int lastToSize = 0;
int to_version = 0;
int last_to_version = 0;
int to_qty = 0;
int last_to_qty = 0;
// 子卷1长度
float to_length1 = 0;
float last_to_length1 = 0;
// y坐标
float to_length2 = 0;
float last_to_length2 = 0;
String toBarcode = null;
String lastToBarcode = null;
@@ -179,89 +169,73 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
walk_y = this.itemProtocol.getWalk_y();
walkY = this.itemProtocol.getWalk_y();
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
heartbeat = this.itemProtocol.getHeartbeat();
to_command = this.itemProtocol.getTo_command();
to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task();
to_pull = this.itemProtocol.getTo_pull();
to_sleeve = this.itemProtocol.getTo_sleeve();
to_size = this.itemProtocol.getTo_size();
to_qty = this.itemProtocol.getTo_qty();
to_version = this.itemProtocol.getTo_version();
to_length1 = this.itemProtocol.getTo_length1();
to_length2 = this.itemProtocol.getTo_length2();
to_onset = this.itemProtocol.getTo_onset();
x_position = this.itemProtocol.getX_position();
y_position = this.itemProtocol.getY_position();
toCommand = this.itemProtocol.getTo_command();
toTarget = this.itemProtocol.getTo_target();
toTask = this.itemProtocol.getTo_task();
toPull = this.itemProtocol.getTo_pull();
toSleeve = this.itemProtocol.getTo_sleeve();
toSize = this.itemProtocol.getTo_size();
toOnset = this.itemProtocol.getTo_onset();
xPosition = this.itemProtocol.getX_position();
yPosition = this.itemProtocol.getY_position();
if (to_onset != last_to_onset) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + last_to_onset + "->" + to_onset);
if (toOnset != lastToOnset) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + lastToOnset + "->" + toOnset);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
if (toCommand != lastToCommand) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + lastToCommand + "->" + toCommand);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
if (toTarget != lastToTarget) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + lastToTarget + "->" + toTarget);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
if (toTask != lastToTask) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + lastToTask + "->" + toTask);
}
if (to_pull != last_to_pull) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_pull" + last_to_pull + "->" + to_pull);
if (toPull != lastToPull) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_pull" + lastToPull + "->" + toPull);
}
if (to_sleeve != last_to_sleeve) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_sleeve" + last_to_sleeve + "->" + to_sleeve);
if (toSleeve != lastToSleeve) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_sleeve" + lastToSleeve + "->" + toSleeve);
}
if (to_size != last_to_size) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_size" + last_to_size + "->" + to_size);
if (toSize != lastToSize) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_size" + lastToSize + "->" + toSize);
}
if (to_version != last_to_version) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_version" + last_to_version + "->" + to_version);
}
if (to_qty != last_to_qty) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_qty" + last_to_qty + "->" + to_qty);
}
if (to_length1 != last_to_length1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_length1" + last_to_length1 + "->" + to_length1);
}
if (to_length2 != last_to_length2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_length2" + last_to_length2 + "->" + to_length2);
}
if (mode != last_mode) {
if (mode != lastMode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + lastMode + "->" + mode);
}
if (move != last_move) {
if (move != lastMove) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + lastMove + "->" + move);
}
if (action != last_action) {
if (action != lastAction) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + lastAction + "->" + action);
}
if (error != last_error) {
if (error != lastError) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + lastError + "->" + error);
}
if (walk_y != last_walk_y) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y" + last_walk_y + "->" + walk_y);
if (walkY != lastWalkY) {
logServer.deviceItemValue(this.device_code, "walkY", String.valueOf(walkY));
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y" + lastWalkY + "->" + walkY);
}
if (task != last_task) {
if (task != lastTask) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + lastTask + "->" + task);
}
if (x_position != last_x_position) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + last_x_position + "->" + x_position);
if (xPosition != lastXPosition) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(xPosition));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + lastXPosition + "->" + xPosition);
}
if (y_position != last_y_position) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + last_y_position + "->" + y_position);
if (yPosition != lastYPosition) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(yPosition));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + lastYPosition + "->" + yPosition);
}
// 更新指令状态
@@ -289,14 +263,24 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
//任务完成
if (mode == 3 && action == 4 && move == 0 && task > 0) {
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst != null) {
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
try {
finish_instruction(inst2);
TaskDto dto = taskserver.findByCode(inst.getTask_code());
Map<String, Object> map = new LinkedHashMap<>();
if (ObjectUtil.isNotEmpty(dto)){
String interaction_json = dto.getInteraction_json();
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(interaction_json);
map.put("to_pull", jsonObject.getString("is_pulling"));
map.put("is_bushing", jsonObject.getString("is_bushing"));
map.put("to_size", jsonObject.getString("size"));
map.put("to_barcode", jsonObject.getString(""));
map.put("to_command", "5");
}
map.put("to_command", "5");
this.writing(map);
finish_instruction(inst);
} catch (Exception e) {
e.printStackTrace();
}
@@ -315,11 +299,11 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
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);
@@ -361,33 +345,27 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
last_mode = mode;
last_move = move;
last_action = action;
last_walk_y = walk_y;
last_error = error;
last_task = task;
last_heartbeat = heartbeat;
last_to_task = to_task;
last_to_command = to_command;
last_to_target = to_target;
last_to_onset = to_onset;
last_x_position = x_position;
last_y_position = y_position;
last_to_pull = to_pull;
last_to_sleeve = to_sleeve;
last_to_size = to_size;
last_to_version = to_version;
last_to_qty = to_qty;
last_to_length1 = to_length1;
last_to_length2 = to_length2;
lastMode = mode;
lastMove = move;
lastAction = action;
lastWalkY = walkY;
lastError = error;
lastTask = task;
lastHeartbeat = heartbeat;
lastToTask = toTask;
lastToCommand = toCommand;
lastToTarget = toTarget;
lastToOnset = toOnset;
lastXPosition = xPosition;
lastYPosition = yPosition;
lastToPull = toPull;
lastToSleeve = toSleeve;
lastToSize = toSize;
lastToBarcode = toBarcode;
}
/**
* // * 申请任务
* // *
* // * @param
* //
* 申请任务
*/
public synchronized boolean applyTask() {
Date date = new Date();
@@ -409,13 +387,13 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
taskDtos = this.sortTask(taskDtos);
TaskDto taskDto = taskDtos.get(0);
Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code());
String start_device_code = instruction.getStart_device_code();
String next_device_code = instruction.getNext_device_code();
String startCode = instruction.getStart_device_code();
String nextCode = instruction.getNext_device_code();
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction);
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
Device startDevice = deviceAppService.findDeviceByCode(startCode);
Device nextDevice = deviceAppService.findDeviceByCode(nextCode);
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "universal_notCreateInstMessage1";
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
@@ -424,13 +402,13 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
notCreateInstMessage = "universal_notCreateInstMessage1";
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", start_addr);
map.put("to_onset", startAddr);
map.put("to_task", instruction.getInstruction_code());
map.put("to_target", next_addr);
map.put("to_target", nextAddr);
this.writing(map);
this.setRequireSucess(true);
return true;
@@ -447,35 +425,35 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
if (!ObjectUtil.isEmpty(task)) {
String taskid = task.getTask_id();
String taskcode = task.getTask_code();
String vehiclecode = task.getVehicle_code();
String taskId = task.getTask_id();
String taskCode = task.getTask_code();
String vehicleCode = task.getVehicle_code();
String priority = task.getPriority();
String start_point_code = task.getStart_point_code();
String start_device_code = task.getStart_device_code();
String route_plan_code = task.getRoute_plan_code();
String next_point_code = task.getNext_point_code();
String next_device_code = task.getNext_device_code();
String startPointCode = task.getStart_point_code();
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());
instdto.setRoute_plan_code(route_plan_code);
instdto.setRoute_plan_code(routePlanCode);
instdto.setRemark(task.getRemark());
instdto.setMaterial(task.getMaterial());
instdto.setQuantity(task.getQuantity());
instdto.setTask_id(taskid);
instdto.setTask_code(taskcode);
instdto.setVehicle_code(vehiclecode);
instdto.setTask_id(taskId);
instdto.setTask_code(taskCode);
instdto.setVehicle_code(vehicleCode);
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setStart_device_code(startDeviceCode);
instdto.setNext_device_code(nextDeviceCode);
instdto.setStart_point_code(startPointCode);
instdto.setNext_point_code(nextPointCode);
instdto.setPriority(priority);
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
instdto.setExecute_device_code(start_point_code);
instdto.setExecute_device_code(startPointCode);
try {
instructionService.create(instdto);
@@ -502,13 +480,13 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
String startAddr = startDevice.getExtraValue().get("address").toString();
String nextAddr = nextDevice.getExtraValue().get("address").toString();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", start_addr);
map.put("to_onset", startAddr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_target", next_addr);
map.put("to_target", nextAddr);
this.writing(map);
this.setRequireSucess(true);
notCreateInstMessage = "";
@@ -612,7 +590,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
jo.put("move", move);
jo.put("action", action);
jo.put("task", task);
jo.put("walk_y", walk_y);
jo.put("walk_y", walkY);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
@@ -622,8 +600,8 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true);
jo.put("x", x_position);
jo.put("y", y_position);
jo.put("x", xPosition);
jo.put("y", yPosition);
return jo;
}

View File

@@ -98,7 +98,7 @@ public class ItemProtocol {
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB20.W0"));
list.add(new ItemDto(item_to_error, "下发命令", "DB20.W1"));
list.add(new ItemDto(item_to_error, "下发故障代码", "DB20.W1"));
return list;
}

View File

@@ -155,13 +155,13 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl
case 6:
// 称重完成
if (move > 0 && !requireSucess) {
weightSuccess();
// weightSuccess();
}
break;
case 7:
// 称重确认完成
if (move > 0 && !requireSucess) {
weightConfirmSuccess();
// weightConfirmSuccess();
}
break;
case 8:

View File

@@ -6,16 +6,7 @@ import lombok.Data;
public class ApplyManipulatorActionRequest extends BaseRequest {
private String vehicle_code;
private String device_code;
/**
* 1-
* 2-反馈新放货点
* 3-反馈新取货点
* 4-反馈二次放货点
* 6-套轴申请
* 7-套轴完成
* 8-拔轴完成
*/
private String type;
/**
* 行架任务号
@@ -35,15 +26,10 @@ public class ApplyManipulatorActionRequest extends BaseRequest {
/**
* 位置 1-左 2-右
*/
private String location;
private String direction;
/**
* 左子卷
* 气涨轴编
*/
private String left;
/**
* 右子卷号
*/
private String right;
private String qzz_no;
}

View File

@@ -8,13 +8,4 @@ import java.util.Map;
@Data
public class ApplyManipulatorActionResponse extends BaseResponse{
private Map<String, String> data = new HashMap();
/**
* 子卷号
*/
private String barcode;
/**
* 终点
*/
private String next_point;
}

View File

@@ -9,4 +9,5 @@ import java.util.Map;
public class ApplyPlugPullSitResponse extends BaseResponse {
private Map<String, String> data = new HashMap();
}

View File

@@ -195,5 +195,14 @@ public class CreateTaskRequest extends BaseRequest {
private String bushing_num;
private String paper_array;
/**
* 任务扩展字段
*/
private JSONObject interaction_json;
/**
* 是否拔轴 0/1
*/
private String is_pulling;
}

View File

@@ -107,6 +107,6 @@ public interface WmsToAcsService {
* @param jsonObject
* @return
*/
PutWeightActionResponse putWeightAction(String jsonObject) throws Exception;
Map<String, Object> putWeightAction(String jsonObject) throws Exception;
}

View File

@@ -82,7 +82,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
public CreateTaskResponse crateTask(String param) {
try {
MDC.put(log_file_type, log_type);
log.info("crateTask-----输入参数{}", param);
log.info("crateTask-----输入参数{}", param);
JSONArray datas = JSONArray.parseArray(param);
CreateTaskResponse response = new CreateTaskResponse();
// ParamService paramService = SpringContextHolder.getBean(ParamService.class);
@@ -114,6 +114,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String truss_type = request.getTruss_type();
String empty_site = request.getEmpty_site();
String is_bushing = request.getIs_bushing();
String is_pulling = request.getIs_pulling();
String size = request.getSize();
String version = request.getVersion();
String bushing_num = request.getBushing_num();
@@ -336,6 +337,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("truss_type", JSONUtil.toJsonStr(truss_type));
jo.put("empty_site", JSONUtil.toJsonStr(empty_site));
jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing));
jo.put("is_pulling", JSONUtil.toJsonStr(is_pulling));
jo.put("size", JSONUtil.toJsonStr(size));
jo.put("version", JSONUtil.toJsonStr(version));
jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num));
@@ -464,19 +466,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
@Override
public PutWeightActionResponse putWeightAction(String jsonObject) throws Exception {
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);
PutWeightActionResponse response = new PutWeightActionResponse();
JSONArray errArr = new JSONArray();
JSONObject jo = new JSONObject();
for (int i = 0; i < datas.size(); i++) {
String data = datas.get(i).toString();
PutWeightActionRequest request = JsonUtl.format(data, PutWeightActionRequest.class);
String device_code = request.getDevice_code();
String code = request.getCode();
String value = request.getValue();
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);
@@ -484,21 +483,35 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver;
if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) {
wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver();
wasteFoilWeighingStationDriver.writing(code, value);
try {
Thread.sleep(1000); //休眠1秒
//称重完成
if (StrUtil.equals("1", type)) {
Thread.sleep(1000); //休眠1秒
if (wasteFoilWeighingStationDriver.getMode() == 6) {
jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量
jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量
jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差
wasteFoilWeighingStationDriver.writing("to_command", "6");
}
}
//称重确认信号
else if (StrUtil.equals("2", type)) {
Thread.sleep(1000); //休眠1秒
if (wasteFoilWeighingStationDriver.getMode() == 7) {
wasteFoilWeighingStationDriver.writing("to_command", "8");
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
response.setCode(200);
response.setMessage("success");
LuceneLogDto luceneLogDto = new LuceneLogDto("putWeightAction", String.valueOf(response.getCode()),
jsonObject, String.valueOf(response), "LMS下发动作");
luceneExecuteLogService.interfaceExecuteLog(luceneLogDto);
log.info("putWeightAction--------------:输出参数:" + response);
return response;
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);
}

View File

@@ -3,13 +3,16 @@ package org.nl.acs.opc;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.opc.service.dto.OpcServerManageDto;
import org.nl.acs.udw.UnifiedDataAccessor;
import org.nl.acs.udw.UnifiedDataAccessorFactory;
import org.nl.acs.udw.UnifiedDataAppService;
import org.nl.common.enums.LogTypeEnum;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.openscada.opc.lib.da.*;
import java.util.*;
@@ -422,7 +425,14 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
Object obj = accessor_value.getValue(relate);
sb.append("key:" + relate + "value:" + obj + ";");
}
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb});
// log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb});
if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time")) {
// 存在上次点位值为null情况 则不记录日志
LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1),
String.valueOf(itemDto.getHis_item_value()), String.valueOf(itemDto.getItem_value()));
luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc());
log.info("{}", JSON.toJSONString(luceneLogDto));
}
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{};信号快照:{}", new Object[]{itemId, his, value, sb});
} else {
// if(his instanceof int[]){
@@ -437,7 +447,13 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
// log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value});
// }
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value});
// log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value});
if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time")) {
LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1),
String.valueOf(itemDto.getHis_item_value()), String.valueOf(itemDto.getItem_value()));
luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc());
log.info("{}", JSON.toJSONString(luceneLogDto));
}
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value});
}
}

View File

@@ -307,6 +307,7 @@ public class TaskDto implements Serializable {
* 交互字段
*/
private String interaction_json;
private JSONObject interactionJson;
/**
@@ -338,4 +339,9 @@ public class TaskDto implements Serializable {
* 扩展属性
*/
String params2;
/**
* 是否拔轴 0/1
*/
private String is_pulling;
}

View File

@@ -9,7 +9,7 @@ universal_delivery=\u53D6\u8D27\u4E2D
universal_completed=\u53D6\u8D27\u5B8C\u6210
universal_releasing=\u653E\u8D27\u4E2D
universal_releasing_completed=\u653E\u8D27\u5B8C\u6210
universal_remark1=\u672A\u67E5\u627E\u4EFB\u52A1\u539F\u56E0\u4E3A\uFF1A
universal_remark1=\u672A\u67E5\u627E\u4EFB\u52A1\u539F\u56E0\u4E3A
universal_remark2=\u5DE5\u4F5C\u6A21\u5F0F(mode)\u4E0D\u662F\u5F85\u673A\u72B6\u6001
universal_remark3=\u5149\u7535\u4FE1\u53F7(move)\u4E3A\u6709\u8D27\u72B6\u6001
universal_remark4=\u5F53\u524D\u4E0A\u62A5\u4EFB\u52A1\u53F7(task)\u5E94\u8BE5\u4E3A0

View File

@@ -188,6 +188,23 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="RGV位置" prop="direction" label-width="100px">
<el-select
v-model="form.direction"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in directions"
:key="item.key"
:label="item.label"
:value="item.key"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
@@ -358,6 +375,13 @@ export default {
label: '2楼'
}],
address: '',
directions: [{
key: '1',
label: '左边'
}, {
key: '2',
label: '右边'
}],
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],