fix: rgv、标准版机械手、定时删除Lucene日志
This commit is contained in:
@@ -152,7 +152,7 @@ public class AgvWaitUtil {
|
|||||||
param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString());
|
param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString());
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(inst.getCarno())
|
.device_code(inst.getCarno())
|
||||||
.content("诺宝取货完成请求lms:" + inst.getTask_code() + "--" + ActionTypeEnum.IN_FINISHING.getCode().toString())
|
.content("诺宝取货完成请求lms:" + inst.getTask_code() + "--" + ActionTypeEnum.IN_FINISHING.getStatus())
|
||||||
.build();
|
.build();
|
||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
@@ -168,7 +168,7 @@ public class AgvWaitUtil {
|
|||||||
} else {
|
} else {
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
.device_code(inst.getCarno())
|
.device_code(inst.getCarno())
|
||||||
.content("追加动诺宝作块失败,返回参数:" + jo.getString("body"))
|
.content("请求lms追加动诺宝作块失败,返回参数:" + jo.getString("body"))
|
||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
|||||||
@@ -778,7 +778,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
//如果是放货二次分配,取放货二次分配需要重新追加动作块
|
//如果是放货二次分配,取放货二次分配需要重新追加动作块
|
||||||
if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
|
if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
|
||||||
Integer actionType = ActionTypeEnum.OUT_STOCK.getCode();
|
Integer actionType = ActionTypeEnum.OUT_STOCK.getCode();
|
||||||
String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto);
|
String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto);
|
||||||
// sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), deviceCodeNow, instructionDto);
|
// sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), deviceCodeNow, instructionDto);
|
||||||
log.info("放货二次分配追加诺宝成功,新点位 - {}", newPointCode);
|
log.info("放货二次分配追加诺宝成功,新点位 - {}", newPointCode);
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
@@ -823,14 +823,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
if (address.contains("GET")) {
|
if (address.contains("GET")) {
|
||||||
//取货完成
|
//取货完成
|
||||||
JSONObject jsonObject = agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
|
JSONObject jsonObject = agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
|
||||||
if (StringUtil.equals("200",jsonObject.getString("status"))){
|
if (StringUtil.equals("200", jsonObject.getString("status"))) {
|
||||||
log.info("仙工AGV取货完成后离开,设备号 - {}", deviceCodeNow);
|
log.info("仙工AGV取货完成后离开,设备号 - {}", deviceCodeNow);
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
} else if (address.contains("PUT")) {
|
} else if (address.contains("PUT")) {
|
||||||
//放货完成
|
//放货完成
|
||||||
JSONObject jsonObject = agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
|
JSONObject jsonObject = agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
|
||||||
if (StringUtil.equals("200",jsonObject.getString("status"))){
|
if (StringUtil.equals("200", jsonObject.getString("status"))) {
|
||||||
log.info("仙工AGV放货完成后离开,设备号 - {}", deviceCodeNow);
|
log.info("仙工AGV放货完成后离开,设备号 - {}", deviceCodeNow);
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
@@ -842,7 +842,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String applyCCAgvTask(String task_code, Instruction instructionDto) {
|
private String applyCCAgvTask(String task_code, Instruction instructionDto) {
|
||||||
try {
|
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("task_code", task_code);
|
param.put("task_code", task_code);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
@@ -873,12 +872,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
throw new BadRequestException("叉车二次分配请求lms返回失败");
|
throw new BadRequestException("叉车二次分配请求lms返回失败");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAddSequencesToCCAgv(String instructionCode, String nextPoint, Instruction instructionDto) {
|
private void sendAddSequencesToCCAgv(String instructionCode, String nextPoint, Instruction instructionDto) {
|
||||||
@@ -956,47 +949,44 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String applyXGAgvTask(String task_code, Integer actionType, Instruction instructionDto) {
|
private String applyXGAgvTask(String task_code, Integer actionType, Instruction instructionDto) {
|
||||||
try {
|
|
||||||
JSONObject param = new JSONObject();
|
|
||||||
param.put("taskCode", task_code);
|
|
||||||
param.put("actionType", actionType.toString());
|
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(instructionDto.getCarno())
|
|
||||||
.content("二次分配请求lms,参数:" + task_code + "--" + AgvActionTypeEnum.getStatus(actionType) )
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
String response = acsToWmsService.secondaryAllocationPoint(param);
|
|
||||||
JSONObject jo = JSON.parseObject(response);
|
|
||||||
if (jo.getInteger("status") == 200) {
|
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
|
||||||
.device_code(instructionDto.getCarno())
|
|
||||||
.content("二次分配请求lms,参数,接口返回:" + jo)
|
|
||||||
.build();
|
|
||||||
logDto2.setLog_level(4);
|
|
||||||
//二次分配更新点位
|
|
||||||
updataTask(instructionDto, jo.getString("data"));
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
|
||||||
if (!ActionTypeEnum.IN_FINISHING.getCode().equals(actionType)) {
|
|
||||||
//请求成功调用诺宝追加动作块
|
|
||||||
sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto);
|
|
||||||
}
|
|
||||||
return jo.getString("data");
|
|
||||||
|
|
||||||
} else {
|
JSONObject param = new JSONObject();
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
param.put("taskCode", task_code);
|
||||||
.device_code(instructionDto.getCarno())
|
param.put("actionType", actionType.toString());
|
||||||
.content("二次分配请求lms,返回参数:" + jo.getString("body"))
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.build();
|
.device_code(instructionDto.getCarno())
|
||||||
logDto2.setLog_level(4);
|
.content("二次分配请求lms,参数:" + task_code + "--" + ActionTypeEnum.getStatus(actionType))
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
.build();
|
||||||
throw new BadRequestException("二次分配请求lms返回失败");
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
String response = acsToWmsService.secondaryAllocationPoint(param);
|
||||||
|
JSONObject jo = JSON.parseObject(response);
|
||||||
|
if (jo.getInteger("status") == 200) {
|
||||||
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
|
.device_code(instructionDto.getCarno())
|
||||||
|
.content("二次分配请求lms,参数,接口返回:" + jo)
|
||||||
|
.build();
|
||||||
|
logDto2.setLog_level(4);
|
||||||
|
//二次分配更新点位
|
||||||
|
updataTask(instructionDto, jo.getString("data"));
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
if (!ActionTypeEnum.IN_FINISHING.getCode().equals(actionType)) {
|
||||||
|
//请求成功调用诺宝追加动作块
|
||||||
|
sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
return jo.getString("data");
|
||||||
e.printStackTrace();
|
|
||||||
|
} else {
|
||||||
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
|
.device_code(instructionDto.getCarno())
|
||||||
|
.content("二次分配请求lms,返回参数:" + jo.getString("body"))
|
||||||
|
.build();
|
||||||
|
logDto2.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
throw new BadRequestException("二次分配请求lms返回失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updataTask(Instruction instructionDto, String newPoint) {
|
private void updataTask(Instruction instructionDto, String newPoint) {
|
||||||
|
|||||||
@@ -196,7 +196,8 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
if (move != 0 && task > 0) {
|
if (move != 0 && task > 0) {
|
||||||
if (null!=inst) {
|
if (null!=inst) {
|
||||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||||
} update_instruction_status();
|
}
|
||||||
|
update_instruction_status();
|
||||||
}
|
}
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
var17.printStackTrace();
|
var17.printStackTrace();
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
|
|||||||
String response = acsToWmsService.deviceApplyTwo(param);
|
String response = acsToWmsService.deviceApplyTwo(param);
|
||||||
JSONObject jo = JSON.parseObject(response);
|
JSONObject jo = JSON.parseObject(response);
|
||||||
message = "申请捆扎,参数,接口返回:" + jo;
|
message = "申请捆扎,参数,接口返回:" + jo;
|
||||||
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
|
if ( jo.getInteger("status") == 200) {
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
.device_code(device_code)
|
.device_code(device_code)
|
||||||
.content("申请捆扎,参数,接口返回:" + jo)
|
.content("申请捆扎,参数,接口返回:" + jo)
|
||||||
@@ -376,6 +376,8 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
message = "申请捆扎报错,参数,接口返回:" + jo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -444,6 +444,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
map2.put("value", 23);
|
map2.put("value", 23);
|
||||||
list2.add(map2);
|
list2.add(map2);
|
||||||
this.writing(list2);
|
this.writing(list2);
|
||||||
|
requireSucess = true;
|
||||||
} else {
|
} else {
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
.device_code(device_code)
|
.device_code(device_code)
|
||||||
@@ -451,6 +452,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
message = "申请高度等级报错,返回参数:" + jo;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -511,6 +513,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
message = "申请退货入库报错,返回参数:" + jo;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -677,6 +680,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
map.put("value", mode);
|
map.put("value", mode);
|
||||||
list1.add(map);
|
list1.add(map);
|
||||||
this.writing(list1);
|
this.writing(list1);
|
||||||
|
requireSucess = true;
|
||||||
} else {
|
} else {
|
||||||
this.iserror = false;
|
this.iserror = false;
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
@@ -684,6 +688,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
|||||||
.content("木箱、子卷入库申请入库任务,返回参数:" + response)
|
.content("木箱、子卷入库申请入库任务,返回参数:" + response)
|
||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
|
message = "木箱、子卷入库申请入库任务报错,返回参数:" + jo;
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
requireSucess = true;
|
||||||
packagePLCData(jo);
|
packagePLCData(jo);
|
||||||
String isUncap = jo.getString("isUncap");
|
String isUncap = jo.getString("isUncap");
|
||||||
if ("1".equals(isUncap)){
|
if ("1".equals(isUncap)){
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package org.nl.acs.device_driver.one_manipulator.rgv;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
public class
|
||||||
|
ItemProtocol {
|
||||||
|
|
||||||
|
//心跳
|
||||||
|
public static String item_heartbeat = "heartbeat";
|
||||||
|
//工作模式
|
||||||
|
public static String item_mode = "mode";
|
||||||
|
//光电信号
|
||||||
|
public static String item_move = "move";
|
||||||
|
//动作信号
|
||||||
|
public static String item_action = "action";
|
||||||
|
//行走列
|
||||||
|
public static String item_walk_y = "walk_y";
|
||||||
|
//任务号
|
||||||
|
public static String item_task = "task";
|
||||||
|
//报警
|
||||||
|
public static String item_error = "error";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private OneRgvDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(OneRgvDeviceDriver driver){
|
||||||
|
this.driver=driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeartbeat() {
|
||||||
|
return this.getOpcIntegerValue(item_heartbeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMode() {
|
||||||
|
return this.getOpcIntegerValue(item_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMove() {
|
||||||
|
return this.getOpcIntegerValue(item_move);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAction() {
|
||||||
|
return this.getOpcIntegerValue(item_action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWalk_y() {
|
||||||
|
return this.getOpcIntegerValue(item_walk_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getError() {
|
||||||
|
return this.getOpcIntegerValue(item_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getTask() {
|
||||||
|
return this.getOpcIntegerValue(item_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Boolean isonline;
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if (value == null) {
|
||||||
|
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||||
|
setIsonline(false);
|
||||||
|
} else {
|
||||||
|
setIsonline(true);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpcStringValue(String protocol) {
|
||||||
|
String value = this.driver.getStringValue(protocol);
|
||||||
|
if (StrUtil.isBlank(value)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList<ItemDto> list = new ArrayList<>();
|
||||||
|
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||||
|
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
|
||||||
|
list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
|
||||||
|
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
||||||
|
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
||||||
|
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
||||||
|
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
ArrayList<ItemDto> list = new ArrayList<>();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package org.nl.acs.device_driver.one_manipulator.rgv;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class OneRgvDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "one_rgv";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "一楼rgv";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "一楼rgv";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new OneRgvDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return OneRgvDeviceDriver.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
|
List<DeviceType> types = new LinkedList();
|
||||||
|
types.add(DeviceType.rgv);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getReadableItemDtos() {
|
||||||
|
return ItemProtocol.getReadableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return ItemProtocol.getWriteableItemDtos();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
package org.nl.acs.device_driver.one_manipulator.rgv;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||||
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
|
import org.nl.acs.history.ErrorUtil;
|
||||||
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
|
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||||
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||||
|
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.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RGV
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OneRgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||||
|
|
||||||
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
@Autowired
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||||
|
@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;
|
||||||
|
//气涨轴条码
|
||||||
|
String barcode;
|
||||||
|
String last_barcode;
|
||||||
|
|
||||||
|
|
||||||
|
int heartbeat = 0;
|
||||||
|
int last_heartbeat = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String to_sub_volume_no;
|
||||||
|
String last_to_sub_volume_no;
|
||||||
|
|
||||||
|
Boolean isonline = true;
|
||||||
|
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 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请求离开区域
|
||||||
|
int flag;
|
||||||
|
|
||||||
|
String device_code;
|
||||||
|
|
||||||
|
String left = "1";
|
||||||
|
String right = "2";
|
||||||
|
|
||||||
|
//当前指令
|
||||||
|
Instruction inst = null;
|
||||||
|
|
||||||
|
//0 无任务执行 1更新指令状态 2下发电气信号 3允许取货 允许放货 5放货完成
|
||||||
|
int now_steps_type = 0;
|
||||||
|
String notCreateTaskMessage = "";
|
||||||
|
String notCreateInstMessage = "";
|
||||||
|
String feedMessage = "";
|
||||||
|
|
||||||
|
|
||||||
|
List<String> getDeviceCodeList = null;
|
||||||
|
|
||||||
|
List<String> putDeviceCodeList = null;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
try {
|
||||||
|
device_code = this.getDeviceCode();
|
||||||
|
mode = this.itemProtocol.getMode();
|
||||||
|
move = this.itemProtocol.getMove();
|
||||||
|
action = this.itemProtocol.getAction();
|
||||||
|
walk_y = this.itemProtocol.getWalk_y();
|
||||||
|
error = this.itemProtocol.getError();
|
||||||
|
task = this.itemProtocol.getTask();
|
||||||
|
heartbeat = this.itemProtocol.getHeartbeat();
|
||||||
|
|
||||||
|
|
||||||
|
if (mode != last_mode) {
|
||||||
|
requireSucess = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception var17) {
|
||||||
|
var17.printStackTrace();
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == 0) {
|
||||||
|
this.setIsonline(false);
|
||||||
|
message = "universal_off-line";
|
||||||
|
//有报警
|
||||||
|
} else if (error != 0) {
|
||||||
|
this.setIserror(true);
|
||||||
|
message = "universal_message3";
|
||||||
|
//无报警
|
||||||
|
} else {
|
||||||
|
this.setIsonline(true);
|
||||||
|
this.setIserror(false);
|
||||||
|
message = "";
|
||||||
|
Instruction instruction = null;
|
||||||
|
List toInstructions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
last_mode = mode;
|
||||||
|
last_move = move;
|
||||||
|
last_action = action;
|
||||||
|
last_walk_y = walk_y;
|
||||||
|
last_error = error;
|
||||||
|
last_task = task;
|
||||||
|
last_heartbeat = heartbeat;
|
||||||
|
last_barcode = barcode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* // * 申请任务
|
||||||
|
* // *
|
||||||
|
* // * @param
|
||||||
|
* //
|
||||||
|
*/
|
||||||
|
public synchronized void applyTask() {
|
||||||
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
|
String direction = (String) this.getDevice().getExtraValue().get("direction");
|
||||||
|
applyManipulatorActionRequest.setDevice_code(device_code);
|
||||||
|
applyManipulatorActionRequest.setDirection(direction);//rgv申请位置
|
||||||
|
applyManipulatorActionRequest.setQzz_no(String.valueOf(barcode));//气涨轴编码
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||||
|
Map<String, String> data = applyManipulatorActionResponse.getData();
|
||||||
|
String point_code2 = data.get("point_code2");//目标站点
|
||||||
|
Device deviceByCode = deviceAppService.findDeviceByCode(point_code2);
|
||||||
|
String address = deviceByCode.getExtraValue().get("address").toString();
|
||||||
|
String material_code = data.get("material_code");//子卷号
|
||||||
|
String to_is_labeling = data.get("to_is_labeling");//是否贴标
|
||||||
|
map.put("to_target", address);
|
||||||
|
map.put("to_sub_volume_no", material_code);
|
||||||
|
map.put("to_command", "1");
|
||||||
|
if (StrUtil.equals("1",to_is_labeling)){
|
||||||
|
map.put("to_is_labeling","1");
|
||||||
|
}else {
|
||||||
|
map.put("to_is_labeling","0");
|
||||||
|
}
|
||||||
|
this.writing(map);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse);
|
||||||
|
message = "universal_message12";
|
||||||
|
requireSucess = true;
|
||||||
|
} else {
|
||||||
|
map.put("to_command", 99);
|
||||||
|
this.writing(map);
|
||||||
|
requireSucess = true;
|
||||||
|
message = "universal_message13";
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务反馈失败,返回参数:" + applyManipulatorActionResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing(Map<String, Object> map) {
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||||
|
map.forEach((key, value) -> {
|
||||||
|
if (ObjectUtil.isNotEmpty(value)) {
|
||||||
|
itemMap.put(getToParam() + key, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||||
|
this.control(itemMap);
|
||||||
|
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content("下发多个电气信号" + itemMap)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(3);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToParam() {
|
||||||
|
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceStatusName() {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
String mode = "";
|
||||||
|
String move = "";
|
||||||
|
String action = "";
|
||||||
|
String walk_y = "";
|
||||||
|
if (this.getMode() == 0) {
|
||||||
|
mode = LangProcess.msg("universal_off-line");
|
||||||
|
} else if (this.getMode() == 1) {
|
||||||
|
mode = LangProcess.msg("universal_stand-alone");
|
||||||
|
} else if (this.getMode() == 2) {
|
||||||
|
mode = LangProcess.msg("universal_standby");
|
||||||
|
} else if (this.getMode() == 3) {
|
||||||
|
mode = LangProcess.msg("universal_operation");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getMove() == 0) {
|
||||||
|
move = LangProcess.msg("universal_no");
|
||||||
|
map.put("hasGoods", false);
|
||||||
|
} else if (this.getMove() == 1) {
|
||||||
|
move = LangProcess.msg("universal_yes");
|
||||||
|
map.put("hasGoods", true);
|
||||||
|
} else if (this.getMove() == 2) {
|
||||||
|
move = LangProcess.msg("universal_two_yes");
|
||||||
|
map.put("hasGoods", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
String requireSucess = LangProcess.msg("universal_actionMessage4");
|
||||||
|
if (this.requireSucess) {
|
||||||
|
requireSucess = LangProcess.msg("universal_actionMessage5");
|
||||||
|
}
|
||||||
|
map.put("requireSucess", requireSucess);
|
||||||
|
if (this.getAction() == 1) {
|
||||||
|
action = LangProcess.msg("universal_delivery");
|
||||||
|
} else if (this.getAction() == 2) {
|
||||||
|
action = LangProcess.msg("universal_completed");
|
||||||
|
} else if (this.getAction() == 3) {
|
||||||
|
action = LangProcess.msg("universal_releasing");
|
||||||
|
} else if (this.getAction() == 4) {
|
||||||
|
action = LangProcess.msg("universal_releasing_completed");
|
||||||
|
}
|
||||||
|
|
||||||
|
map.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
map.put("mode", mode);
|
||||||
|
map.put("move", move);
|
||||||
|
/*jo.put("action", action);*/
|
||||||
|
/*jo.put("task", task);*/
|
||||||
|
/*jo.put("walk_y", this.walk_y);*/
|
||||||
|
map.put("isOnline", this.getIsonline());
|
||||||
|
map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
|
||||||
|
map.put("isError", this.getIserror());
|
||||||
|
map.put("message", LangProcess.msg(message));
|
||||||
|
/*jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
|
jo.put("notCreateInstMessage",notCreateInstMessage);*/
|
||||||
|
map.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
|
map.put("driver_type", "siemens_conveyor");
|
||||||
|
map.put("is_click", true);
|
||||||
|
JSONObject jo = new JSONObject(map);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
String requestSucess = data.getString("requireSucess");
|
||||||
|
if (StrUtil.equals(requestSucess, "0")) {
|
||||||
|
this.requireSucess = false;
|
||||||
|
} else if (StrUtil.equals(requestSucess, "1")) {
|
||||||
|
this.requireSucess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject feedLmsRealFailedInfo() {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Instruction checkInst() {
|
||||||
|
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||||
|
if (this.task > 0) {
|
||||||
|
if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
|
||||||
|
return this.inst;
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package org.nl.acs.device_driver.one_manipulator.standard_manipulator;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
public class
|
||||||
|
ItemProtocol {
|
||||||
|
|
||||||
|
//心跳
|
||||||
|
public static String item_heartbeat = "heartbeat";
|
||||||
|
//工作模式
|
||||||
|
public static String item_mode = "mode";
|
||||||
|
//光电信号
|
||||||
|
public static String item_move = "move";
|
||||||
|
//动作信号
|
||||||
|
public static String item_action = "action";
|
||||||
|
//行走列
|
||||||
|
public static String item_walk_y = "walk_y";
|
||||||
|
//任务号
|
||||||
|
public static String item_task = "task";
|
||||||
|
//报警
|
||||||
|
public static String item_error = "error";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private StandardManipulatoDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(StandardManipulatoDeviceDriver driver){
|
||||||
|
this.driver=driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeartbeat() {
|
||||||
|
return this.getOpcIntegerValue(item_heartbeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMode() {
|
||||||
|
return this.getOpcIntegerValue(item_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMove() {
|
||||||
|
return this.getOpcIntegerValue(item_move);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAction() {
|
||||||
|
return this.getOpcIntegerValue(item_action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWalk_y() {
|
||||||
|
return this.getOpcIntegerValue(item_walk_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getError() {
|
||||||
|
return this.getOpcIntegerValue(item_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getTask() {
|
||||||
|
return this.getOpcIntegerValue(item_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Boolean isonline;
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if (value == null) {
|
||||||
|
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||||
|
setIsonline(false);
|
||||||
|
} else {
|
||||||
|
setIsonline(true);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpcStringValue(String protocol) {
|
||||||
|
String value = this.driver.getStringValue(protocol);
|
||||||
|
if (StrUtil.isBlank(value)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList<ItemDto> list = new ArrayList<>();
|
||||||
|
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||||
|
list.add(new ItemDto(item_mode, "工作模式", "DB1.B1"));
|
||||||
|
list.add(new ItemDto(item_move, "光电信号", "DB1.B2"));
|
||||||
|
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
|
||||||
|
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
||||||
|
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
||||||
|
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
ArrayList<ItemDto> list = new ArrayList<>();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
package org.nl.acs.device_driver.one_manipulator.standard_manipulator;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||||
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
|
import org.nl.acs.history.ErrorUtil;
|
||||||
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
|
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||||
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
|
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||||
|
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.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RGV
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed {
|
||||||
|
|
||||||
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
@Autowired
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
@Autowired
|
||||||
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceExtraService deviceExtraService = SpringContextHolder.getBean(DeviceExtraServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||||
|
@Autowired
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||||
|
@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;
|
||||||
|
//气涨轴条码
|
||||||
|
String barcode;
|
||||||
|
String last_barcode;
|
||||||
|
|
||||||
|
|
||||||
|
int heartbeat = 0;
|
||||||
|
int last_heartbeat = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String to_sub_volume_no;
|
||||||
|
String last_to_sub_volume_no;
|
||||||
|
|
||||||
|
Boolean isonline = true;
|
||||||
|
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 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请求离开区域
|
||||||
|
int flag;
|
||||||
|
|
||||||
|
String device_code;
|
||||||
|
|
||||||
|
String left = "1";
|
||||||
|
String right = "2";
|
||||||
|
|
||||||
|
//当前指令
|
||||||
|
Instruction inst = null;
|
||||||
|
|
||||||
|
//0 无任务执行 1更新指令状态 2下发电气信号 3允许取货 允许放货 5放货完成
|
||||||
|
int now_steps_type = 0;
|
||||||
|
String notCreateTaskMessage = "";
|
||||||
|
String notCreateInstMessage = "";
|
||||||
|
String feedMessage = "";
|
||||||
|
|
||||||
|
|
||||||
|
List<String> getDeviceCodeList = null;
|
||||||
|
|
||||||
|
List<String> putDeviceCodeList = null;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
try {
|
||||||
|
device_code = this.getDeviceCode();
|
||||||
|
mode = this.itemProtocol.getMode();
|
||||||
|
move = this.itemProtocol.getMove();
|
||||||
|
action = this.itemProtocol.getAction();
|
||||||
|
walk_y = this.itemProtocol.getWalk_y();
|
||||||
|
error = this.itemProtocol.getError();
|
||||||
|
task = this.itemProtocol.getTask();
|
||||||
|
heartbeat = this.itemProtocol.getHeartbeat();
|
||||||
|
|
||||||
|
|
||||||
|
if (mode != last_mode) {
|
||||||
|
requireSucess = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception var17) {
|
||||||
|
var17.printStackTrace();
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == 0) {
|
||||||
|
this.setIsonline(false);
|
||||||
|
message = "universal_off-line";
|
||||||
|
//有报警
|
||||||
|
} else if (error != 0) {
|
||||||
|
this.setIserror(true);
|
||||||
|
message = "universal_message3";
|
||||||
|
//无报警
|
||||||
|
} else {
|
||||||
|
this.setIsonline(true);
|
||||||
|
this.setIserror(false);
|
||||||
|
message = "";
|
||||||
|
Instruction instruction = null;
|
||||||
|
List toInstructions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
last_mode = mode;
|
||||||
|
last_move = move;
|
||||||
|
last_action = action;
|
||||||
|
last_walk_y = walk_y;
|
||||||
|
last_error = error;
|
||||||
|
last_task = task;
|
||||||
|
last_heartbeat = heartbeat;
|
||||||
|
last_barcode = barcode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* // * 申请任务
|
||||||
|
* // *
|
||||||
|
* // * @param
|
||||||
|
* //
|
||||||
|
*/
|
||||||
|
public synchronized void applyTask() {
|
||||||
|
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
|
||||||
|
ApplyManipulatorActionResponse applyManipulatorActionResponse;
|
||||||
|
String direction = (String) this.getDevice().getExtraValue().get("direction");
|
||||||
|
applyManipulatorActionRequest.setDevice_code(device_code);
|
||||||
|
applyManipulatorActionRequest.setDirection(direction);//rgv申请位置
|
||||||
|
applyManipulatorActionRequest.setQzz_no(String.valueOf(barcode));//气涨轴编码
|
||||||
|
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
if (applyManipulatorActionResponse.getstatus() == 200) {
|
||||||
|
Map<String, String> data = applyManipulatorActionResponse.getData();
|
||||||
|
String point_code2 = data.get("point_code2");//目标站点
|
||||||
|
Device deviceByCode = deviceAppService.findDeviceByCode(point_code2);
|
||||||
|
String address = deviceByCode.getExtraValue().get("address").toString();
|
||||||
|
String material_code = data.get("material_code");//子卷号
|
||||||
|
String to_is_labeling = data.get("to_is_labeling");//是否贴标
|
||||||
|
map.put("to_target", address);
|
||||||
|
map.put("to_sub_volume_no", material_code);
|
||||||
|
map.put("to_command", "1");
|
||||||
|
if (StrUtil.equals("1",to_is_labeling)){
|
||||||
|
map.put("to_is_labeling","1");
|
||||||
|
}else {
|
||||||
|
map.put("to_is_labeling","0");
|
||||||
|
}
|
||||||
|
this.writing(map);
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务,返回参数:" + applyManipulatorActionResponse);
|
||||||
|
message = "universal_message12";
|
||||||
|
requireSucess = true;
|
||||||
|
} else {
|
||||||
|
map.put("to_command", 99);
|
||||||
|
this.writing(map);
|
||||||
|
requireSucess = true;
|
||||||
|
message = "universal_message13";
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "申请行架任务反馈失败,返回参数:" + applyManipulatorActionResponse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writing(Map<String, Object> map) {
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||||
|
map.forEach((key, value) -> {
|
||||||
|
if (ObjectUtil.isNotEmpty(value)) {
|
||||||
|
itemMap.put(getToParam() + key, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||||
|
this.control(itemMap);
|
||||||
|
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content("下发多个电气信号" + itemMap)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(3);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToParam() {
|
||||||
|
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceStatusName() {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
String mode = "";
|
||||||
|
String move = "";
|
||||||
|
String action = "";
|
||||||
|
String walk_y = "";
|
||||||
|
if (this.getMode() == 0) {
|
||||||
|
mode = LangProcess.msg("universal_off-line");
|
||||||
|
} else if (this.getMode() == 1) {
|
||||||
|
mode = LangProcess.msg("universal_stand-alone");
|
||||||
|
} else if (this.getMode() == 2) {
|
||||||
|
mode = LangProcess.msg("universal_standby");
|
||||||
|
} else if (this.getMode() == 3) {
|
||||||
|
mode = LangProcess.msg("universal_operation");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getMove() == 0) {
|
||||||
|
move = LangProcess.msg("universal_no");
|
||||||
|
map.put("hasGoods", false);
|
||||||
|
} else if (this.getMove() == 1) {
|
||||||
|
move = LangProcess.msg("universal_yes");
|
||||||
|
map.put("hasGoods", true);
|
||||||
|
} else if (this.getMove() == 2) {
|
||||||
|
move = LangProcess.msg("universal_two_yes");
|
||||||
|
map.put("hasGoods", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
String requireSucess = LangProcess.msg("universal_actionMessage4");
|
||||||
|
if (this.requireSucess) {
|
||||||
|
requireSucess = LangProcess.msg("universal_actionMessage5");
|
||||||
|
}
|
||||||
|
map.put("requireSucess", requireSucess);
|
||||||
|
if (this.getAction() == 1) {
|
||||||
|
action = LangProcess.msg("universal_delivery");
|
||||||
|
} else if (this.getAction() == 2) {
|
||||||
|
action = LangProcess.msg("universal_completed");
|
||||||
|
} else if (this.getAction() == 3) {
|
||||||
|
action = LangProcess.msg("universal_releasing");
|
||||||
|
} else if (this.getAction() == 4) {
|
||||||
|
action = LangProcess.msg("universal_releasing_completed");
|
||||||
|
}
|
||||||
|
|
||||||
|
map.put("device_name", this.getDevice().getDevice_name());
|
||||||
|
map.put("mode", mode);
|
||||||
|
map.put("move", move);
|
||||||
|
/*jo.put("action", action);*/
|
||||||
|
/*jo.put("task", task);*/
|
||||||
|
/*jo.put("walk_y", this.walk_y);*/
|
||||||
|
map.put("isOnline", this.getIsonline());
|
||||||
|
map.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError())));
|
||||||
|
map.put("isError", this.getIserror());
|
||||||
|
map.put("message", LangProcess.msg(message));
|
||||||
|
/*jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
|
jo.put("notCreateInstMessage",notCreateInstMessage);*/
|
||||||
|
map.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
|
map.put("driver_type", "siemens_conveyor");
|
||||||
|
map.put("is_click", true);
|
||||||
|
JSONObject jo = new JSONObject(map);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDeviceStatus(JSONObject data) {
|
||||||
|
String requestSucess = data.getString("requireSucess");
|
||||||
|
if (StrUtil.equals(requestSucess, "0")) {
|
||||||
|
this.requireSucess = false;
|
||||||
|
} else if (StrUtil.equals(requestSucess, "1")) {
|
||||||
|
this.requireSucess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject feedLmsRealFailedInfo() {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Instruction checkInst() {
|
||||||
|
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||||
|
if (this.task > 0) {
|
||||||
|
if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
|
||||||
|
return this.inst;
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
return inst;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package org.nl.acs.device_driver.one_manipulator.standard_manipulator;
|
||||||
|
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
import org.nl.acs.device.domain.Device;
|
||||||
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class StandardManipulatorDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "standard_manipulator";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "标准版机械手";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "标准版机械手";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new StandardManipulatoDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return StandardManipulatoDeviceDriver.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceType> getFitDeviceTypes() {
|
||||||
|
List<DeviceType> types = new LinkedList();
|
||||||
|
types.add(DeviceType.robot);
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getReadableItemDtos() {
|
||||||
|
return ItemProtocol.getReadableItemDtos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemDto> getWriteableItemDtos() {
|
||||||
|
return ItemProtocol.getWriteableItemDtos();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
|||||||
import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver;
|
import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver;
|
||||||
import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO;
|
import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO;
|
||||||
import org.nl.acs.enums.VolumeTwoTypeEnum;
|
import org.nl.acs.enums.VolumeTwoTypeEnum;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.acs.history.ErrorUtil;
|
import org.nl.acs.history.ErrorUtil;
|
||||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||||
@@ -34,6 +36,7 @@ import org.nl.acs.opc.DeviceAppService;
|
|||||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||||
|
import org.nl.acs.task.enums.ActionTypeEnum;
|
||||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
import org.nl.acs.task.enums.TaskTypeEnum;
|
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
@@ -44,12 +47,13 @@ import org.nl.config.SpringContextHolder;
|
|||||||
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.LuceneExecuteLogService;
|
||||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 捆扎智能行架
|
* 子卷下线行架
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@@ -58,6 +62,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
|
|
||||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);;
|
||||||
|
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
|
||||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
@@ -192,6 +198,10 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
}
|
}
|
||||||
updateInstructionStatus();
|
updateInstructionStatus();
|
||||||
}
|
}
|
||||||
|
//四个点行架任务,满轴放货完成后调lms生成rgv任务
|
||||||
|
if (action == 6 && task > 0 ){
|
||||||
|
creatAGV();
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
var17.printStackTrace();
|
var17.printStackTrace();
|
||||||
@@ -264,6 +274,45 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
last_to_type = to_type;
|
last_to_type = to_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void creatAGV() {
|
||||||
|
Instruction instruction = checkInst();
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("taskCode", instruction.getTask_code());
|
||||||
|
param.put("actionType",ActionTypeEnum.RELEASE_FINISHING.getCode() );
|
||||||
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content("满轴放货完成请求lms,参数:" + task + "--" +ActionTypeEnum.RELEASE_FINISHING.getStatus())
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
String response = acsToWmsService.secondaryAllocationPoint(param);
|
||||||
|
JSONObject jo = JSON.parseObject(response);
|
||||||
|
if (jo.getInteger("status") == 200) {
|
||||||
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content("满轴放货完成请求lms,参数,接口返回:" + jo)
|
||||||
|
.build();
|
||||||
|
logDto2.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
Map<String, Object> map1 = new HashMap<>();
|
||||||
|
List list = new ArrayList();
|
||||||
|
map1.put("code", "to_command");
|
||||||
|
map1.put("value", 6);
|
||||||
|
list.add(map1);
|
||||||
|
this.writing(list);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
|
.device_code(device_code)
|
||||||
|
.content("满轴放货完成请求lms,返回参数:" + jo)
|
||||||
|
.build();
|
||||||
|
logDto2.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
throw new BadRequestException("满轴放货完成请求lms返回失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void updateInstructionStatus() {
|
private void updateInstructionStatus() {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
|||||||
@@ -294,6 +294,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
|
|
||||||
Boolean iserror = false;
|
Boolean iserror = false;
|
||||||
|
|
||||||
|
String inst_message;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Device getDevice() {
|
public Device getDevice() {
|
||||||
@@ -334,6 +336,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
|
|
||||||
// 更新指令状态
|
// 更新指令状态
|
||||||
if (mode == 3 && task > 0 && command == 1 && error == 0) {
|
if (mode == 3 && task > 0 && command == 1 && error == 0) {
|
||||||
|
if (null!=inst) {
|
||||||
|
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||||
|
}
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
@@ -1240,6 +1245,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
jo.put("isOnline", this.getIsonline());
|
jo.put("isOnline", this.getIsonline());
|
||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("notCreateInstMessage", notCreateInstMessage);
|
jo.put("notCreateInstMessage", notCreateInstMessage);
|
||||||
|
jo.put("inst_message", this.inst_message);
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,16 @@ public enum ActionTypeEnum {
|
|||||||
/**
|
/**
|
||||||
* 防货二次分配
|
* 防货二次分配
|
||||||
*/
|
*/
|
||||||
OUT_STOCK(2, "防货二次分配"),
|
OUT_STOCK(2, "放货二次分配"),
|
||||||
/**
|
/**
|
||||||
* 取货完成
|
* 取货完成
|
||||||
*/
|
*/
|
||||||
IN_FINISHING(3, "取货完成");
|
IN_FINISHING(3, "取货完成"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行架四个点任务放满轴完成
|
||||||
|
*/
|
||||||
|
RELEASE_FINISHING(4, "满轴放货完成");
|
||||||
|
|
||||||
Integer code;
|
Integer code;
|
||||||
String status;
|
String status;
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public enum AgvActionTypeEnum {
|
|||||||
*/
|
*/
|
||||||
IN_OUT_STOCK(4, "取放货二次分配");
|
IN_OUT_STOCK(4, "取放货二次分配");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Integer code;
|
Integer code;
|
||||||
String status;
|
String status;
|
||||||
|
|
||||||
|
|||||||
@@ -972,34 +972,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
instdto.setAgv_system_type(agv_system_type);
|
instdto.setAgv_system_type(agv_system_type);
|
||||||
instdto.setStart_height(start_height);
|
instdto.setStart_height(start_height);
|
||||||
instdto.setNext_height(next_height);
|
instdto.setNext_height(next_height);
|
||||||
|
instdto.setAgv_action_type(acsTask.getAgv_action_type());
|
||||||
//判断agv系统
|
|
||||||
//1、1楼叉车系统
|
|
||||||
//2、2楼1区域AGV系统
|
|
||||||
//3、2楼2区域AGV系统 -已废弃
|
|
||||||
if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) {
|
|
||||||
// task_type
|
|
||||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
|
||||||
//2、分切 Itype=3取满、取空、放满、放空;
|
|
||||||
//3、普通任务 Itype=2:取货、放货;
|
|
||||||
//4、叉车任务
|
|
||||||
//5、输送任务
|
|
||||||
//6、行架
|
|
||||||
//7、立库
|
|
||||||
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
|
|
||||||
instdto.setAgv_inst_type(CommonFinalParam.ONE);
|
|
||||||
} else if (StrUtil.equals(task_type, "3")) {
|
|
||||||
instdto.setAgv_inst_type("2");
|
|
||||||
} else if (StrUtil.equals(task_type, "2")) {
|
|
||||||
instdto.setAgv_inst_type("3");
|
|
||||||
} else if (StrUtil.equals(task_type, "8")) {
|
|
||||||
instdto.setAgv_inst_type("2");
|
|
||||||
} else {
|
|
||||||
log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
instdto.setAgv_inst_type("4");
|
|
||||||
}
|
|
||||||
instructionservice.create2(instdto);
|
instructionservice.create2(instdto);
|
||||||
acsTask.setTask_status(CommonFinalParam.ONE);
|
acsTask.setTask_status(CommonFinalParam.ONE);
|
||||||
this.update(acsTask);
|
this.update(acsTask);
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ public class AutoCreateInst {
|
|||||||
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.AGV_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.AGV_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String taskid = acsTask.getTask_id();
|
String taskid = acsTask.getTask_id();
|
||||||
String taskcode = acsTask.getTask_code();
|
String taskcode = acsTask.getTask_code();
|
||||||
String task_type = acsTask.getTask_type();
|
String task_type = acsTask.getTask_type();
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ import led_screen from './driver/led_screen'
|
|||||||
import standard_station from '@/views/acs/device/driver/standard_station'
|
import standard_station from '@/views/acs/device/driver/standard_station'
|
||||||
import double_belt_conveyor from '@/views/acs/device/driver/double_belt_conveyor.vue'
|
import double_belt_conveyor from '@/views/acs/device/driver/double_belt_conveyor.vue'
|
||||||
import with_station_device from '@/views/acs/device/driver/with_station_device.vue'
|
import with_station_device from '@/views/acs/device/driver/with_station_device.vue'
|
||||||
import standard_manipulator from '@/views/acs/device/driver/standard_manipulator.vue'
|
|
||||||
import box_manipulator from '@/views/acs/device/driver/box_manipulator.vue'
|
import box_manipulator from '@/views/acs/device/driver/box_manipulator.vue'
|
||||||
import conveyor_with_scanner_weight from '@/views/acs/device/driver/conveyor_with_scanner_weight.vue'
|
import conveyor_with_scanner_weight from '@/views/acs/device/driver/conveyor_with_scanner_weight.vue'
|
||||||
import box_manipulator_site from '@/views/acs/device/driver/box_manipulator_site.vue'
|
import box_manipulator_site from '@/views/acs/device/driver/box_manipulator_site.vue'
|
||||||
@@ -134,6 +133,8 @@ import scanner_weight_conveyor from '@/views/acs/device/driver/one_conveyor/scan
|
|||||||
import un_box_lable_conveyor from '@/views/acs/device/driver/one_conveyor/un_box_lable_conveyor.vue'
|
import un_box_lable_conveyor from '@/views/acs/device/driver/one_conveyor/un_box_lable_conveyor.vue'
|
||||||
import xg_agv_car from '@/views/acs/device/driver/agv/xg_agv_car.vue'
|
import xg_agv_car from '@/views/acs/device/driver/agv/xg_agv_car.vue'
|
||||||
import oven_inspect_site from '@/views/acs/device/driver/oven_inspect_site.vue'
|
import oven_inspect_site from '@/views/acs/device/driver/oven_inspect_site.vue'
|
||||||
|
import one_rgv from '@/views/acs/device/driver/one_manipulator/one_rgv.vue'
|
||||||
|
import standard_manipulator from '@/views/acs/device/driver/one_manipulator/standard_manipulator.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceConfig',
|
name: 'DeviceConfig',
|
||||||
components: {
|
components: {
|
||||||
@@ -194,7 +195,8 @@ export default {
|
|||||||
manipulator_agv_station,
|
manipulator_agv_station,
|
||||||
volume_two_manipulator,
|
volume_two_manipulator,
|
||||||
manipulator_cache,
|
manipulator_cache,
|
||||||
paper_tube_pick_size
|
paper_tube_pick_size,
|
||||||
|
one_rgv
|
||||||
},
|
},
|
||||||
dicts: ['device_type'],
|
dicts: ['device_type'],
|
||||||
mixins: [crud],
|
mixins: [crud],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<!--标准版行架机械手-->
|
<!--一楼RGV-->
|
||||||
<div>
|
<div>
|
||||||
<el-card class="box-card" shadow="never">
|
<el-card class="box-card" shadow="never">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
@@ -52,132 +52,12 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="电气调度号" label-width="150px">
|
<el-form-item label="电气调度号" label-width="150px">
|
||||||
<el-input v-model="form.OPCServer" />
|
<el-input v-model="form.address" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="box-card" shadow="never">
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span class="role-span">指令相关:</span>
|
|
||||||
</div>
|
|
||||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="检验有货">
|
|
||||||
<el-switch v-model="form.inspect_in_stocck" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="取货校验" label-width="150px">
|
|
||||||
<el-switch v-model="form.ignore_pickup_check" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="放货校验" label-width="150px">
|
|
||||||
<el-switch v-model="form.ignore_release_check" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="呼叫">
|
|
||||||
<el-switch v-model="form.apply_task" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="响应" label-width="150px">
|
|
||||||
<el-switch v-model="form.manual_create_task" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="关联设备" prop="device_code">
|
|
||||||
<el-select
|
|
||||||
v-model="form.link_device_code"
|
|
||||||
filterable
|
|
||||||
multiple
|
|
||||||
clearable
|
|
||||||
placeholder="请选择"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in deviceList"
|
|
||||||
:key="item.device_code"
|
|
||||||
:label="item.device_name"
|
|
||||||
:value="item.device_code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
|
|
||||||
<el-select
|
|
||||||
v-model="form.link_three_lamp"
|
|
||||||
filterable
|
|
||||||
clearable
|
|
||||||
placeholder="请选择"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in deviceList"
|
|
||||||
:key="item.device_code"
|
|
||||||
:label="item.device_name"
|
|
||||||
:value="item.device_code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="是否输入物料" label-width="150px">
|
|
||||||
<el-switch v-model="form.input_material" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="取货点" prop="device_code">
|
|
||||||
<el-select
|
|
||||||
v-model="form.get_device_code"
|
|
||||||
multiple
|
|
||||||
filterable
|
|
||||||
reserve-keyword
|
|
||||||
placeholder="请选择"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in deviceList"
|
|
||||||
:key="item.device_code"
|
|
||||||
:label="item.device_code"
|
|
||||||
:value="item.device_code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="放货点" prop="device_code" label-width="100px">
|
|
||||||
<el-select
|
|
||||||
v-model="form.put_device_code"
|
|
||||||
filterable
|
|
||||||
reserve-keyword
|
|
||||||
multiple
|
|
||||||
placeholder="请选择"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in deviceList"
|
|
||||||
:key="item.device_code"
|
|
||||||
:label="item.device_name"
|
|
||||||
:value="item.device_code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<el-card class="box-card" shadow="never">
|
<el-card class="box-card" shadow="never">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span class="role-span">AGV相关:</span>
|
<span class="role-span">AGV相关:</span>
|
||||||
@@ -234,52 +114,6 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="box-card" shadow="never">
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span class="role-span">PLC写入字段:</span>
|
|
||||||
</div>
|
|
||||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
|
||||||
<el-table
|
|
||||||
v-loading="false"
|
|
||||||
:data="data2"
|
|
||||||
:max-height="550"
|
|
||||||
size="small"
|
|
||||||
style="width: 100%;margin-bottom: 15px"
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-table-column prop="name" label="用途" />
|
|
||||||
<el-table-column prop="code" label="别名要求" />
|
|
||||||
<el-table-column prop="db" label="DB块">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input
|
|
||||||
v-model="data2[scope.$index].db"
|
|
||||||
size="mini"
|
|
||||||
class="edit-input"
|
|
||||||
@input="finishWriteEdit(data2[scope.$index])"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dbr_value2">
|
|
||||||
<template slot="header">
|
|
||||||
<el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>
|
|
||||||
</template>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="dbw_value">
|
|
||||||
<template slot="header">
|
|
||||||
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
|
||||||
</template>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-form>
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
<el-card class="box-card" shadow="never">
|
<el-card class="box-card" shadow="never">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span class="role-span" />
|
<span class="role-span" />
|
||||||
@@ -313,7 +147,7 @@ import crud from '@/mixins/crud'
|
|||||||
import deviceCrud from '@/api/acs/device/device'
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'StandardManipulator',
|
name: 'Rgv',
|
||||||
mixins: [crud],
|
mixins: [crud],
|
||||||
props: {
|
props: {
|
||||||
parentForm: {
|
parentForm: {
|
||||||
@@ -329,7 +163,14 @@ export default {
|
|||||||
plc_code: '',
|
plc_code: '',
|
||||||
opc_id: '',
|
opc_id: '',
|
||||||
opc_code: '',
|
opc_code: '',
|
||||||
load_device_code: '',
|
address: '',
|
||||||
|
directions: [{
|
||||||
|
key: '1',
|
||||||
|
label: '左边'
|
||||||
|
}, {
|
||||||
|
key: '2',
|
||||||
|
label: '右边'
|
||||||
|
}],
|
||||||
configLoading: false,
|
configLoading: false,
|
||||||
dataOpcservers: [],
|
dataOpcservers: [],
|
||||||
dataOpcPlcs: [],
|
dataOpcPlcs: [],
|
||||||
@@ -342,12 +183,11 @@ export default {
|
|||||||
ignore_release_check: true,
|
ignore_release_check: true,
|
||||||
apply_task: true,
|
apply_task: true,
|
||||||
link_three_lamp: '',
|
link_three_lamp: '',
|
||||||
|
link_scanner: '',
|
||||||
manual_create_task: true,
|
manual_create_task: true,
|
||||||
is_pickup: true,
|
is_pickup: true,
|
||||||
is_release: true,
|
is_release: true,
|
||||||
link_device_code: [],
|
link_device_code: []
|
||||||
get_device_code: [],
|
|
||||||
put_device_code: []
|
|
||||||
},
|
},
|
||||||
rules: {}
|
rules: {}
|
||||||
}
|
}
|
||||||
@@ -397,29 +237,25 @@ export default {
|
|||||||
finishReadEdit(data) {
|
finishReadEdit(data) {
|
||||||
// 编辑的是code列,并且值包含mode
|
// 编辑的是code列,并且值包含mode
|
||||||
if (data.code.indexOf('mode') !== -1) {
|
if (data.code.indexOf('mode') !== -1) {
|
||||||
debugger
|
|
||||||
const dbValue = data.db
|
const dbValue = data.db
|
||||||
// .之前的字符串
|
// .之前的字符串
|
||||||
// const beforeStr = dbValue.match(/(\S*)\./)[1]
|
const beforeStr = dbValue.substring(0, 2)
|
||||||
// .之后的字符串
|
// .之后的字符串
|
||||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
const afterStr = dbValue.substring(2)
|
||||||
// 取最后数字
|
for (const val in this.data1) {
|
||||||
const endNumber = afterStr.substring(1)
|
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||||
// 最后为非数字
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 2)
|
||||||
if (isNaN(parseInt(endNumber))) {
|
}
|
||||||
return
|
if (this.data1[val].code.indexOf('action') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 4)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 6)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 8)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// for (const val in this.data1) {
|
|
||||||
// if (this.data1[val].code.indexOf('move') !== -1) {
|
|
||||||
// this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
|
|
||||||
// }
|
|
||||||
// if (this.data1[val].code.indexOf('error') !== -1) {
|
|
||||||
// this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
|
|
||||||
// }
|
|
||||||
// if (this.data1[val].code.indexOf('task') !== -1) {
|
|
||||||
// this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
finishWriteEdit(data) {
|
finishWriteEdit(data) {
|
||||||
@@ -427,23 +263,17 @@ export default {
|
|||||||
if (data.code.indexOf('to_command') !== -1) {
|
if (data.code.indexOf('to_command') !== -1) {
|
||||||
const dbValue = data.db
|
const dbValue = data.db
|
||||||
// .之前的字符串
|
// .之前的字符串
|
||||||
// const beforeStr = dbValue.match(/(\S*)\./)[1]
|
const beforeStr = dbValue.substring(0, 2)
|
||||||
// .之后的字符串
|
// .之后的字符串
|
||||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
const afterStr = dbValue.substring(2)
|
||||||
// 取最后数字
|
for (const val in this.data2) {
|
||||||
const endNumber = afterStr.substring(1)
|
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||||
// 最后为非数字
|
this.data2[val].db = beforeStr + (parseInt(afterStr) + 2)
|
||||||
if (isNaN(parseInt(endNumber))) {
|
}
|
||||||
return
|
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||||
|
this.data2[val].db = beforeStr + (parseInt(afterStr) + 4)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// for (const val in this.data2) {
|
|
||||||
// if (this.data2[val].code.indexOf('to_target') !== -1) {
|
|
||||||
// this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
|
|
||||||
// }
|
|
||||||
// if (this.data2[val].code.indexOf('to_task') !== -1) {
|
|
||||||
// this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeOpc(val) {
|
changeOpc(val) {
|
||||||
@@ -0,0 +1,351 @@
|
|||||||
|
<template>
|
||||||
|
<!--标准版机械手-->
|
||||||
|
<div>
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">设备协议:</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
OpcServer:
|
||||||
|
<el-select
|
||||||
|
v-model="opc_id"
|
||||||
|
placeholder="无"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
@change="changeOpc"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dataOpcservers"
|
||||||
|
:key="item.opc_id"
|
||||||
|
:label="item.opc_name"
|
||||||
|
:value="item.opc_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
PLC:
|
||||||
|
<el-select
|
||||||
|
v-model="plc_id"
|
||||||
|
placeholder="无"
|
||||||
|
clearable
|
||||||
|
@change="changePlc"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dataOpcPlcs"
|
||||||
|
:key="item.plc_id"
|
||||||
|
:label="item.plc_name"
|
||||||
|
:value="item.plc_id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">输送系统:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="电气调度号" label-width="150px">
|
||||||
|
<el-input v-model="form.address" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span">PLC读取字段:</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
|
||||||
|
<el-table
|
||||||
|
v-loading="false"
|
||||||
|
:data="data1"
|
||||||
|
:max-height="550"
|
||||||
|
size="small"
|
||||||
|
style="width: 100%;margin-bottom: 15px"
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-table-column prop="name" label="用途" />
|
||||||
|
<el-table-column prop="code" label="别名要求" />
|
||||||
|
<el-table-column prop="db" label="DB块">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input
|
||||||
|
v-model="data1[scope.$index].db"
|
||||||
|
size="mini"
|
||||||
|
class="edit-input"
|
||||||
|
@input="finishReadEdit(data1[scope.$index])"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="dbr_value">
|
||||||
|
<template slot="header">
|
||||||
|
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
<el-card class="box-card" shadow="never">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span class="role-span" />
|
||||||
|
<el-button
|
||||||
|
:loading="false"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="mini"
|
||||||
|
style="float: right; padding: 6px 9px"
|
||||||
|
type="primary"
|
||||||
|
@click="doSubmit"
|
||||||
|
>保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
queryDriverConfig,
|
||||||
|
updateConfig,
|
||||||
|
testRead,
|
||||||
|
testwrite
|
||||||
|
} from '@/api/acs/device/driverConfig'
|
||||||
|
import { selectOpcList } from '@/api/acs/device/opc'
|
||||||
|
import { selectPlcList } from '@/api/acs/device/opcPlc'
|
||||||
|
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
|
||||||
|
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'StandardManipulator',
|
||||||
|
mixins: [crud],
|
||||||
|
props: {
|
||||||
|
parentForm: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
device_code: '',
|
||||||
|
device_id: '',
|
||||||
|
plc_id: '',
|
||||||
|
plc_code: '',
|
||||||
|
opc_id: '',
|
||||||
|
opc_code: '',
|
||||||
|
address: '',
|
||||||
|
configLoading: false,
|
||||||
|
dataOpcservers: [],
|
||||||
|
dataOpcPlcs: [],
|
||||||
|
deviceList: [],
|
||||||
|
data1: [],
|
||||||
|
data2: [],
|
||||||
|
form: {
|
||||||
|
inspect_in_stocck: true,
|
||||||
|
ignore_pickup_check: true,
|
||||||
|
ignore_release_check: true,
|
||||||
|
apply_task: true,
|
||||||
|
link_three_lamp: '',
|
||||||
|
link_scanner: '',
|
||||||
|
manual_create_task: true,
|
||||||
|
is_pickup: true,
|
||||||
|
is_release: true,
|
||||||
|
link_device_code: []
|
||||||
|
},
|
||||||
|
rules: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// 从父表单获取设备编码
|
||||||
|
this.device_id = this.$props.parentForm.device_id
|
||||||
|
this.device_code = this.$props.parentForm.device_code
|
||||||
|
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
|
||||||
|
// 给表单赋值,并且属性不能为空
|
||||||
|
if (data.form) {
|
||||||
|
const arr = Object.keys(data.form)
|
||||||
|
// 不为空
|
||||||
|
if (arr.length > 0) {
|
||||||
|
this.form = data.form
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 给表单赋值,并且属性不能为空
|
||||||
|
if (data.parentForm) {
|
||||||
|
const arr = Object.keys(data.parentForm)
|
||||||
|
// 不为空
|
||||||
|
if (arr.length > 0) {
|
||||||
|
this.opc_code = data.parentForm.opc_code
|
||||||
|
this.plc_code = data.parentForm.plc_code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.data1 = data.rs
|
||||||
|
this.data2 = data.ws
|
||||||
|
this.sliceItem()
|
||||||
|
})
|
||||||
|
selectPlcList().then(data => {
|
||||||
|
this.dataOpcPlcs = data
|
||||||
|
this.plc_id = this.$props.parentForm.opc_plc_id
|
||||||
|
})
|
||||||
|
selectOpcList().then(data => {
|
||||||
|
this.dataOpcservers = data
|
||||||
|
this.opc_id = this.$props.parentForm.opc_server_id
|
||||||
|
})
|
||||||
|
deviceCrud.selectDeviceList().then(data => {
|
||||||
|
this.deviceList = data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
finishReadEdit(data) {
|
||||||
|
// 编辑的是code列,并且值包含mode
|
||||||
|
if (data.code.indexOf('mode') !== -1) {
|
||||||
|
const dbValue = data.db
|
||||||
|
// .之前的字符串
|
||||||
|
const beforeStr = dbValue.substring(0, 2)
|
||||||
|
// .之后的字符串
|
||||||
|
const afterStr = dbValue.substring(2)
|
||||||
|
for (const val in this.data1) {
|
||||||
|
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 2)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('action') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 4)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 6)
|
||||||
|
}
|
||||||
|
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||||
|
this.data1[val].db = beforeStr + (parseInt(afterStr) + 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
finishWriteEdit(data) {
|
||||||
|
// 编辑的是code列,并且值包含mode
|
||||||
|
if (data.code.indexOf('to_command') !== -1) {
|
||||||
|
const dbValue = data.db
|
||||||
|
// .之前的字符串
|
||||||
|
const beforeStr = dbValue.substring(0, 2)
|
||||||
|
// .之后的字符串
|
||||||
|
const afterStr = dbValue.substring(2)
|
||||||
|
for (const val in this.data2) {
|
||||||
|
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||||
|
this.data2[val].db = beforeStr + (parseInt(afterStr) + 2)
|
||||||
|
}
|
||||||
|
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||||
|
this.data2[val].db = beforeStr + (parseInt(afterStr) + 4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeOpc(val) {
|
||||||
|
this.dataOpcservers.forEach(item => {
|
||||||
|
if (item.opc_id === val) {
|
||||||
|
this.opc_code = item.opc_code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
selectListByOpcID(val).then(data => {
|
||||||
|
this.dataOpcPlcs = data
|
||||||
|
this.plc_id = ''
|
||||||
|
this.plc_code = ''
|
||||||
|
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
|
||||||
|
this.plc_id = this.dataOpcPlcs[0].plc_id
|
||||||
|
this.plc_code = this.dataOpcPlcs[0].plc_code
|
||||||
|
}
|
||||||
|
this.sliceItem()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changePlc(val) {
|
||||||
|
this.dataOpcPlcs.forEach(item => {
|
||||||
|
if (item.plc_id === val) {
|
||||||
|
this.plc_code = item.plc_code
|
||||||
|
this.sliceItem()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_read1() {
|
||||||
|
testRead(this.data1, this.opc_id).then(data => {
|
||||||
|
this.data1 = data
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_read2() {
|
||||||
|
testRead(this.data2, this.opc_id).then(data => {
|
||||||
|
this.data2 = data
|
||||||
|
console.log(this.data2)
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
test_write1() {
|
||||||
|
testwrite(this.data2, this.opc_id).then(data => {
|
||||||
|
this.notify('操作成功!', 'success')
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
doSubmit() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.configLoading = true
|
||||||
|
// 根据驱动类型判断是否为路由设备
|
||||||
|
const parentForm = this.parentForm
|
||||||
|
parentForm.is_route = true
|
||||||
|
parentForm.plc_id = this.plc_id
|
||||||
|
parentForm.opc_id = this.opc_id
|
||||||
|
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
|
||||||
|
this.notify('保存成功', 'success')
|
||||||
|
this.configLoading = false
|
||||||
|
}).catch(err => {
|
||||||
|
this.configLoading = false
|
||||||
|
console.log(err.response.data.message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sliceItem() { // 拼接DB的Item值
|
||||||
|
this.data1.forEach(item => {
|
||||||
|
const str = item.code
|
||||||
|
// 是否包含.
|
||||||
|
if (str.search('.') !== -1) {
|
||||||
|
// 截取最后一位
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||||
|
} else {
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.data2.forEach(item => {
|
||||||
|
const str = item.code
|
||||||
|
// 是否包含.
|
||||||
|
if (str.search('.') !== -1) {
|
||||||
|
// 截取最后一位
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
|
||||||
|
} else {
|
||||||
|
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user