This commit is contained in:
2023-12-12 15:22:03 +08:00
13 changed files with 1070 additions and 38 deletions

View File

@@ -63,7 +63,9 @@ public enum DriverTypeEnum {
INDOOR_MANIPULATOR(24,"indoor_manipulator","内包间-行架机械手","station"), INDOOR_MANIPULATOR(24,"indoor_manipulator","内包间-行架机械手","station"),
PLUGGING_UNPLUGGING_MACHINE(25,"plugging_unplugging_machine","插拔轴机","station"); PLUGGING_UNPLUGGING_MACHINE(25,"plugging_unplugging_machine","插拔轴机","station"),
RGV(28,"rgv","rgv","conveyor");
//驱动索引 //驱动索引

View File

@@ -99,6 +99,9 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i
String material2 = null; String material2 = null;
String last_material2 = null; String last_material2 = null;
int qty = 0;
int last_qty = 0;
//下发命令 //下发命令
int to_command = 0; int to_command = 0;
@@ -135,6 +138,7 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
material1 = this.itemProtocol.getMaterial1(); material1 = this.itemProtocol.getMaterial1();
material2 = this.itemProtocol.getMaterial2(); material2 = this.itemProtocol.getMaterial2();
qty = this.itemProtocol.getQty();
to_command = this.itemProtocol.getTo_command(); to_command = this.itemProtocol.getTo_command();
@@ -186,6 +190,11 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move); logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
} }
if (qty != last_qty) {
logServer.deviceItemValue(this.device_code, "qty", String.valueOf(qty));
logServer.deviceExecuteLog(this.device_code, "", "", "信号qty" + last_qty + "->" + qty);
}
if (move != 0 && task > 1) { if (move != 0 && task > 1) {
update_instruction_status(); update_instruction_status();
} }

View File

@@ -28,6 +28,8 @@ public class ItemProtocol {
public static String item_material1 = "material1"; public static String item_material1 = "material1";
//物料2 //物料2
public static String item_material2 = "material2"; public static String item_material2 = "material2";
//数量
public static String item_qty = "qty";
//下发命令 //下发命令
public static String item_to_command = "to_command"; public static String item_to_command = "to_command";
@@ -48,6 +50,10 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_move); return this.getOpcIntegerValue(item_move);
} }
public int getQty() {
return this.getOpcIntegerValue(item_qty);
}
public int getCarrier_direction() { public int getCarrier_direction() {
return this.getOpcIntegerValue(item_carrier_direction); return this.getOpcIntegerValue(item_carrier_direction);
} }
@@ -108,12 +114,13 @@ public class ItemProtocol {
list.add(new ItemDto(item_task, "任务号", "DB101.W6")); list.add(new ItemDto(item_task, "任务号", "DB101.W6"));
list.add(new ItemDto(item_material1, "物料1", "DB101.W7")); list.add(new ItemDto(item_material1, "物料1", "DB101.W7"));
list.add(new ItemDto(item_material2, "物料2", "DB101.W8")); list.add(new ItemDto(item_material2, "物料2", "DB101.W8"));
list.add(new ItemDto(item_qty, "数量", "DB101.W114"));
return list; return list;
} }
public static List<ItemDto> getWriteableItemDtos() { public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB102.W4")); list.add(new ItemDto(item_to_command, "下发命令", "DB201.W4"));
return list; return list;
} }

View File

@@ -146,6 +146,11 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
bushingSucess(); bushingSucess();
} }
break; break;
case 6:
if (task1 > 0 && !requireSucess) {
pullingSucess();
}
break;
default: default:
break; break;
@@ -159,6 +164,31 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
last_task2 = task2; last_task2 = task2;
} }
private synchronized void pullingSucess() {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
ApplyManipulatorActionResponse applyManipulatorActionResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
String task_code1 = inst1.getTask_code();
applyManipulatorActionRequest.setTask_code1(task_code1);
applyManipulatorActionRequest.setType("8");
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
if (applyManipulatorActionResponse.getstatus()==200) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 6);
this.writing(map);
requireSucess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyManipulatorActionResponse);
message = "拔轴完成成功";
}else{
message = applyManipulatorActionResponse.getMessage();
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 99);
requireSucess = true;
message = "拔轴失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyManipulatorActionResponse);
}
}
private synchronized void bushingSucess() { private synchronized void bushingSucess() {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
@@ -175,6 +205,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
if (applyManipulatorActionResponse.getstatus()==200) { if (applyManipulatorActionResponse.getstatus()==200) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 5); map.put("to_command", 5);
this.writing(map);
requireSucess = true; requireSucess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
message = "套轴完成成功"; message = "套轴完成成功";
@@ -182,6 +213,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
message = applyManipulatorActionResponse.getMessage(); message = applyManipulatorActionResponse.getMessage();
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 99); map.put("to_command", 99);
this.writing(map);
requireSucess = true; requireSucess = true;
message = "套轴失败"; message = "套轴失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
@@ -203,6 +235,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
if (applyManipulatorActionResponse.getstatus()==200) { if (applyManipulatorActionResponse.getstatus()==200) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 4); map.put("to_command", 4);
this.writing(map);
requireSucess = true; requireSucess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
message = "套轴申请成功"; message = "套轴申请成功";
@@ -210,6 +243,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
message = applyManipulatorActionResponse.getMessage(); message = applyManipulatorActionResponse.getMessage();
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 99); map.put("to_command", 99);
this.writing(map);
requireSucess = true; requireSucess = true;
message = "申请失败"; message = "申请失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse);
@@ -225,22 +259,32 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
} }
} }
public void writing(List list) { /**
* 抽取统一下发电气信号前缀
*
* @return
*/
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
//String opcservcerid = this.getDevice().getOpc_server_id(); /**
//Server server = ReadUtil.getServer(opcservcerid); * 多个信号一起下发电气
Map<String, Object> itemMap = new HashMap<String, Object>(); *
for (int i = 0; i < list.size(); i++) { * @param map
Object ob = list.get(i); */
JSONObject json = (JSONObject) JSONObject.toJSON(ob); public void writing(Map<String, Object> map) {
if (!StrUtil.isEmpty(json.getString("value"))) { DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() Map<String, Object> itemMap = new LinkedHashMap<>();
+ "." + json.getString("code"); map.forEach((key, value) -> {
itemMap.put(to_param, json.getString("value")); if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
} }
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
} }
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
this.control(itemMap);
} }
//将扩展表中的字符串数据转换成集合 //将扩展表中的字符串数据转换成集合

View File

@@ -0,0 +1,103 @@
package org.nl.acs.device_driver.basedriver.rgv;
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_move1 = "move1";
public static String item_move2 = "move2";
public static String item_error = "error";
public static String item_task = "task";
public static String item_qty1 = "qty1";
public static String item_qty2 = "qty2";
public static String item_to_command = "to_command";
private RgvDeviceDriver driver;
public ItemProtocol(RgvDeviceDriver driver) {
this.driver = driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove1() {
return this.getOpcIntegerValue(item_move1);
}
public int getMove2() {
return this.getOpcIntegerValue(item_move2);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getQty1() {
return this.getOpcIntegerValue(item_qty1);
}
public int getQty2() {
return this.getOpcIntegerValue(item_qty2);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
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 static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB102.W0"));
list.add(new ItemDto(item_mode, "工作状态", "DB102.W2"));
list.add(new ItemDto(item_move1, "光电开关信号1", "DB102.W4"));
list.add(new ItemDto(item_move1, "光电开关信号2", "DB102.W6"));
list.add(new ItemDto(item_qty1, "工位1重量", "DB102.REAL8"));
list.add(new ItemDto(item_qty2, "工位2重量", "DB102.REAL12"));
list.add(new ItemDto(item_error, "报警信号", "DB102.W16"));
list.add(new ItemDto(item_task, "任务号(行架任务号)", "DB102.D18"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB202.W0"));
return list;
}
}

View File

@@ -0,0 +1,57 @@
package org.nl.acs.device_driver.basedriver.rgv;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
@Service
public class RgvDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "rgv";
}
@Override
public String getDriverName() {
return "rgv";
}
@Override
public String getDriverDescription() {
return "rgv";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new RgvDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return RgvDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,294 @@
package org.nl.acs.device_driver.basedriver.rgv;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
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.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Data
@RequiredArgsConstructor
public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
@Autowired
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@Autowired
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
int mode = 0;
int last_mode = 0;
int error = 0;
int last_error = 0;
int move1 = 0;
int last_move1 = 0;
int move2 = 0;
int last_move2 = 0;
int qty1 = 0;
int last_qty1 = 0;
int qty2 = 0;
int last_qty2 = 0;
int task = 0;
int last_task = 0;
Boolean isonline = true;
Boolean iserror = false;
//行架机械手申请任务成功标识
boolean requireSucess = false;
//当前指令
Instruction inst = null;
//1-执行任务2-取货完成3-放货完成;
int flag;
String device_code;
String message = null;
@Override
public Device getDevice() {
return this.device;
}
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
move1 = this.itemProtocol.getMove1();
move2 = this.itemProtocol.getMove2();
qty1 = this.itemProtocol.getQty1();
qty2 = this.itemProtocol.getQty2();
task = this.itemProtocol.getTask();
if (mode != last_mode) {
this.requireSucess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
}
if (move1 != last_move1) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move1" + last_move1 + "->" + move1);
}
if (move2 != last_move2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move2" + last_move2 + "->" + move2);
}
} catch (Exception var17) {
}
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
//有报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
message = "";
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
return;
case 2:
break;
case 3:
break;
case 4:
if (task > 0 && !requireSucess && (qty1 > 0 || qty2 > 0)) {
feedbackQty();
}
break;
default:
break;
}
}
last_mode = mode;
last_error = error;
last_move1 = move1;
last_move2 = move2;
last_task = task;
last_qty1 = qty1;
last_qty2 = qty2;
}
private void feedbackQty() {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
ApplyManipulatorActionResponse applyManipulatorActionResponse;
Instruction inst1 = checkInst();
String task_code = inst1.getTask_code();
applyManipulatorActionRequest.setType("2");
if (qty1 > 0) {
applyManipulatorActionRequest.setQty(String.valueOf(qty1));
}
if (qty2 > 0) {
applyManipulatorActionRequest.setQty(String.valueOf(qty2));
}
applyManipulatorActionRequest.setTask_code1(task_code);
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
if (applyManipulatorActionResponse.getstatus() == 200) {
requireSucess = true;
message = "反馈LMS成功...";
logServer.deviceExecuteLog(this.device_code, "", "", "反馈重量请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 4);
this.writing(map);
} else {
requireSucess = false;
message = "完成反馈LMS失败" + String.valueOf(applyManipulatorActionResponse);
logServer.deviceExecuteLog(this.device_code, "", "", "反馈重量请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse));
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 99);
this.writing(map);
}
}
/**
* 抽取统一下发电气信号前缀
*
* @return
*/
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
/**
* 多个信号一起下发电气
*
* @param map
*/
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);
}
}
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;
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move1 = "";
String move2 = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getMove1() == 0 && this.getMove2() == 0) {
move1 = "无货";
move2 = "无货";
jo.put("hasGoods", false);
} else if (this.getMove1() == 1 || this.getMove2() == 1) {
jo.put("hasGoods", true);
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move1", move1);
jo.put("move2", move2);
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
}

View File

@@ -13,6 +13,7 @@ public class ApplyManipulatorActionRequest extends BaseRequest {
* 5-反馈二次放货点 * 5-反馈二次放货点
* 6-套轴申请 * 6-套轴申请
* 7-套轴完成 * 7-套轴完成
* 8-拔轴完成
*/ */
private String type; private String type;
@@ -35,5 +36,10 @@ public class ApplyManipulatorActionRequest extends BaseRequest {
* 取货完成1 放货完成2 * 取货完成1 放货完成2
*/ */
private String action; private String action;
/**
* 重量
*/
private String qty;
} }

View File

@@ -112,10 +112,22 @@ public interface AcsToWmsService {
// 输送线有货变成无货时向lms请求 // 输送线有货变成无货时向lms请求
HttpResponse shipDeviceUpdate(JSONObject param); HttpResponse shipDeviceUpdate(JSONObject param);
//task变化时向LMS请求
HttpResponse taskDeviceUpdate(JSONObject param); HttpResponse taskDeviceUpdate(JSONObject param);
void sendDeviceStatus(JSONObject param); void sendDeviceStatus(JSONObject param);
/**
* 向lms申请反馈
* @param param
* @return
*/
ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param); ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param);
/**
* 向LMS反馈缓存库取/放货完成
* @param param
* @return
*/
ApplyManipulatorActionResponse actionFinishRequest(ApplyManipulatorActionRequest param); ApplyManipulatorActionResponse actionFinishRequest(ApplyManipulatorActionRequest param);
} }

View File

@@ -34,6 +34,7 @@ import org.nl.acs.device_driver.basedriver.paper_tube_device2.Paper;
import org.nl.acs.device_driver.basedriver.paper_tube_device2.PaperTubeConveyor2DeviceDriver; import org.nl.acs.device_driver.basedriver.paper_tube_device2.PaperTubeConveyor2DeviceDriver;
import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver; import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver;
import org.nl.acs.device_driver.basedriver.rgv.RgvDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver;
@@ -252,6 +253,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
IndoorManipulatorDeviceDriver indoorManipulatorDeviceDriver; IndoorManipulatorDeviceDriver indoorManipulatorDeviceDriver;
//套管工位 //套管工位
CasingStationConveyorDeviceDriver casingStationConveyorDeviceDriver; CasingStationConveyorDeviceDriver casingStationConveyorDeviceDriver;
//RGV
RgvDeviceDriver rgvDeviceDriver;
if (datas.size() == 0) { if (datas.size() == 0) {
throw new BadRequestException("缺少输入参数!"); throw new BadRequestException("缺少输入参数!");
@@ -315,6 +318,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("task", casingStationConveyorDeviceDriver.getTask()); jo.put("task", casingStationConveyorDeviceDriver.getTask());
jo.put("material1", casingStationConveyorDeviceDriver.getMaterial1()); jo.put("material1", casingStationConveyorDeviceDriver.getMaterial1());
jo.put("material2", casingStationConveyorDeviceDriver.getMaterial2()); jo.put("material2", casingStationConveyorDeviceDriver.getMaterial2());
jo.put("qty", casingStationConveyorDeviceDriver.getQty());
} else if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) { } else if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) {
@@ -326,7 +330,19 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("material_code", ObjectUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial()) ? "" : paperTubeConveyorDeviceDriver.getMaterial()); jo.put("material_code", ObjectUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial()) ? "" : paperTubeConveyorDeviceDriver.getMaterial());
jo.put("out_finish", paperTubeConveyorDeviceDriver.getOut_finish()); jo.put("out_finish", paperTubeConveyorDeviceDriver.getOut_finish());
} else if (device.getDeviceDriver() instanceof DeviceStatusDeviceDriver) { } else if (device.getDeviceDriver() instanceof RgvDeviceDriver) {
rgvDeviceDriver = (RgvDeviceDriver) device.getDeviceDriver();
jo.put("device_code", parent_device_code);
jo.put("qty1", rgvDeviceDriver.getQty1());
jo.put("qty2", rgvDeviceDriver.getQty2());
jo.put("mode", rgvDeviceDriver.getMode());
jo.put("move1", rgvDeviceDriver.getMove1());
jo.put("move2", rgvDeviceDriver.getMove2());
jo.put("task", rgvDeviceDriver.getTask());
jo.put("error", rgvDeviceDriver.getError());
}else if (device.getDeviceDriver() instanceof DeviceStatusDeviceDriver) {
deviceStatusDeviceDriver = (DeviceStatusDeviceDriver) device.getDeviceDriver(); deviceStatusDeviceDriver = (DeviceStatusDeviceDriver) device.getDeviceDriver();
jo.put("device_code", deviceStatusDeviceDriver.getDevice().getDevice_code()); jo.put("device_code", deviceStatusDeviceDriver.getDevice().getDevice_code());
jo.put("device_name", deviceStatusDeviceDriver.getDevice().getDevice_name()); jo.put("device_name", deviceStatusDeviceDriver.getDevice().getDevice_name());

View File

@@ -105,6 +105,7 @@ import casing_station from '@/views/acs/device/driver/casing_station'
import device_status from '@/views/acs/device/driver/device_status' import device_status from '@/views/acs/device/driver/device_status'
import indoor_manipulator from '@/views/acs/device/driver/indoor_manipulator' import indoor_manipulator from '@/views/acs/device/driver/indoor_manipulator'
import plugging_unplugging_machine from '@/views/acs/device/driver/plugging_unplugging_machine' import plugging_unplugging_machine from '@/views/acs/device/driver/plugging_unplugging_machine'
import rgv from '@/views/acs/device/driver/rgv'
export default { export default {
name: 'DeviceConfig', name: 'DeviceConfig',
@@ -140,7 +141,8 @@ export default {
casing_station, casing_station,
device_status, device_status,
indoor_manipulator, indoor_manipulator,
plugging_unplugging_machine plugging_unplugging_machine,
rgv
}, },
dicts: ['device_type'], dicts: ['device_type'],
mixins: [crud], mixins: [crud],

View File

@@ -0,0 +1,500 @@
<template>
<!--RGV站点-->
<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">指令相关</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
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-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">AGV相关</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.is_pickup" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="放货">
<el-switch v-model="form.is_release" />
</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">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">
<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: 'Rgv',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
opc_id: '',
opc_code: '',
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: '',
manual_create_task: true,
is_pickup: true,
is_release: true,
link_device_code: [],
address: ''
},
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) {
debugger
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('inventory_qty') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
if (this.data1[val].code.indexOf('out_finish') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 6)
}
}
}
},
finishWriteEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('to_command') !== -1) {
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data2) {
if (this.data2[val].code.indexOf('to_out_qty') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
}
}
},
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>

View File

@@ -186,27 +186,7 @@ public class CutConveyorTask extends AbstractAcsTask {
//判断载具上是否存在气涨轴 //判断载具上是否存在气涨轴
String vehicle_code = jsonTask.getString("vehicle_code"); String vehicle_code = jsonTask.getString("vehicle_code");
if (StrUtil.isNotEmpty(vehicle_code)) {
JSONObject out_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(out_jo)) {
throw new BadRequestException("未查询到对应的点位!");
}
String point_location = out_jo.getString("point_location");
JSONObject vehicle_jo = WQLObject.getWQLObject("md_pb_vehiclearea").query("point_location = '" + point_location + "' AND product_area = '" + jsonTask.getString("product_area") + "'").uniqueResult(0);
String qzz_generation = vehicle_jo.getString("qzz_generation");
JSONObject jo = new JSONObject();
jo.put("task_type", "010605");
jo.put("point_code1", "A1_FQSS_OUT");
jo.put("point_code2", "A1_RGV");
jo.put("truss_type", "1");
jo.put("vehicle_code", jsonTask.getString("vehicle_code"));
jo.put("product_area", jsonTask.getString("product_area"));
JSONObject request_param = new JSONObject();
request_param.put("have_generation", qzz_generation);
jo.put("request_param", request_param.toString());
PaperTrussTask paperTrussTask = SpringContextHolder.getBean(PaperTrussTask.class);
paperTrussTask.createTask(jo);
}
} }
//分切输送入任务 //分切输送入任务