更新
This commit is contained in:
@@ -197,8 +197,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
}
|
}
|
||||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||||
standardAutodoorDeviceDriver.writing("to_open","1");
|
|
||||||
standardAutodoorDeviceDriver.writing("to_close","0");
|
try {
|
||||||
|
standardAutodoorDeviceDriver.writing("to_open","1");
|
||||||
|
standardAutodoorDeviceDriver.writing("to_close","0");
|
||||||
|
} catch (Exception e){
|
||||||
|
log.info("下发电气信号失败:"+e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if(standardAutodoorDeviceDriver.getOpen() == 1){
|
if(standardAutodoorDeviceDriver.getOpen() == 1){
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||||
}
|
}
|
||||||
@@ -211,9 +217,13 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
}
|
}
|
||||||
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
|
||||||
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
|
||||||
standardAutodoorDeviceDriver.writing("to_close","1");
|
try {
|
||||||
standardAutodoorDeviceDriver.writing(
|
standardAutodoorDeviceDriver.writing("to_close","1");
|
||||||
"to_open","0");
|
standardAutodoorDeviceDriver.writing("to_open","0");
|
||||||
|
} catch (Exception e){
|
||||||
|
log.info("下发电气信号失败:"+e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ public enum DriverTypeEnum {
|
|||||||
|
|
||||||
PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor"),
|
PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor"),
|
||||||
|
|
||||||
STANDARD_AUTODOOR(20, "standard_autodoor", "标准版-自动门", "autodoor");
|
STANDARD_AUTODOOR(20, "standard_autodoor", "标准版-自动门", "autodoor"),
|
||||||
|
|
||||||
|
LAMP_THREE_COLOR(21, "lamp_three_color", "标准版-三色灯", "三色灯");
|
||||||
|
|
||||||
|
|
||||||
//驱动索引
|
//驱动索引
|
||||||
|
|||||||
@@ -127,30 +127,6 @@ public class DeviceController {
|
|||||||
return new ResponseEntity<>(deviceService.selectDeviceListByRegion(region), HttpStatus.OK);
|
return new ResponseEntity<>(deviceService.selectDeviceListByRegion(region), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/selectListOne")
|
|
||||||
@Log("查询区域一设备")
|
|
||||||
@ApiOperation("查询区域一设备")
|
|
||||||
//@PreAuthorize("@el.check('routePlan:list')")
|
|
||||||
public ResponseEntity<Object> selectListOne() {
|
|
||||||
return new ResponseEntity<>(deviceService.selectDeviceListOne(), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/selectListTwo")
|
|
||||||
@Log("查询区域二设备")
|
|
||||||
@ApiOperation("查询区域二设备")
|
|
||||||
//@PreAuthorize("@el.check('routePlan:list')")
|
|
||||||
public ResponseEntity<Object> selectListTwo() {
|
|
||||||
return new ResponseEntity<>(deviceService.selectDeviceListTwo(), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/selectListThree")
|
|
||||||
@Log("查询区域三设备")
|
|
||||||
@ApiOperation("查询区域三设备")
|
|
||||||
//@PreAuthorize("@el.check('routePlan:list')")
|
|
||||||
public ResponseEntity<Object> selectListThree() {
|
|
||||||
return new ResponseEntity<>(deviceService.selectDeviceListThree(), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/type/{type}")
|
@GetMapping("/type/{type}")
|
||||||
@Log("根据设备类型查询已配置设备")
|
@Log("根据设备类型查询已配置设备")
|
||||||
@ApiOperation("根据类型查询设备")
|
@ApiOperation("根据类型查询设备")
|
||||||
|
|||||||
@@ -143,26 +143,6 @@ public interface DeviceService {
|
|||||||
*/
|
*/
|
||||||
JSONArray selectDeviceDevicerInfo(String status);
|
JSONArray selectDeviceDevicerInfo(String status);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询区域一设备
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
JSONArray selectDeviceListOne();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询区域二设备
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
JSONArray selectDeviceListTwo();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询区域三设备
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
JSONArray selectDeviceListThree();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新驱动配置信息
|
* 更新驱动配置信息
|
||||||
@@ -298,4 +278,9 @@ public interface DeviceService {
|
|||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
void excelImport(MultipartFile file, HttpServletRequest request);
|
void excelImport(MultipartFile file, HttpServletRequest request);
|
||||||
|
|
||||||
|
void addDeviceCodeByAddress(StorageCellDto dto);
|
||||||
|
|
||||||
|
void updateDeviceCodeByAddress(StorageCellDto dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,152 +406,6 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSONArray selectDeviceListOne() {
|
|
||||||
//设备基础信息表【acs_device】
|
|
||||||
JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '1'", "seq_num").getResultJSONArray(0);
|
|
||||||
//acs_device_extra
|
|
||||||
WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
|
|
||||||
JSONArray result = new JSONArray();
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
|
||||||
JSONObject obj = arr.getJSONObject(i);
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("device_id", obj.getString("device_id"));
|
|
||||||
json.put("device_code", obj.getString("device_code"));
|
|
||||||
json.put("checked", false);
|
|
||||||
json.put("device_name", obj.getString("device_name"));
|
|
||||||
Device device = deviceAppService.findDeviceByCode(obj.getString("device_code"));
|
|
||||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
|
|
||||||
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
|
|
||||||
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
|
|
||||||
}
|
|
||||||
JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0);
|
|
||||||
for (int m = 0; m < extraArr.size(); m++) {
|
|
||||||
JSONObject jsonObject = extraArr.getJSONObject(m);
|
|
||||||
String extra_code = jsonObject.getString("extra_code");
|
|
||||||
//定点作业:自动创建任务
|
|
||||||
if ("auto_create_task".equals(extra_code)) {
|
|
||||||
json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//呼叫
|
|
||||||
if ("apply_task".equals(extra_code)) {
|
|
||||||
json.put("apply_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//响应
|
|
||||||
if ("manual_create_task".equals(extra_code)) {
|
|
||||||
json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//清除
|
|
||||||
if ("auto_clean_task".equals(extra_code)) {
|
|
||||||
json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
result.add(json);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSONArray selectDeviceListTwo() {
|
|
||||||
//设备基础信息表【acs_device】
|
|
||||||
JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '2'", "seq_num").getResultJSONArray(0);
|
|
||||||
//acs_device_extra
|
|
||||||
WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
|
|
||||||
JSONArray result = new JSONArray();
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
|
||||||
JSONObject obj = arr.getJSONObject(i);
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("device_id", obj.getString("device_id"));
|
|
||||||
json.put("checked", false);
|
|
||||||
json.put("device_code", obj.getString("device_code"));
|
|
||||||
json.put("device_name", obj.getString("device_name"));
|
|
||||||
Device device = deviceAppService.findDeviceByCode(obj.getString("device_code"));
|
|
||||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
|
|
||||||
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
|
|
||||||
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
|
|
||||||
}
|
|
||||||
JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0);
|
|
||||||
for (int m = 0; m < extraArr.size(); m++) {
|
|
||||||
JSONObject jsonObject = extraArr.getJSONObject(m);
|
|
||||||
String extra_code = jsonObject.getString("extra_code");
|
|
||||||
//定点作业:自动创建任务
|
|
||||||
if ("auto_create_task".equals(extra_code)) {
|
|
||||||
json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//呼叫
|
|
||||||
if ("apply_task".equals(extra_code)) {
|
|
||||||
json.put("apply_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//响应
|
|
||||||
if ("manual_create_task".equals(extra_code)) {
|
|
||||||
json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//清除
|
|
||||||
if ("auto_clean_task".equals(extra_code)) {
|
|
||||||
json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
result.add(json);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSONArray selectDeviceListThree() {
|
|
||||||
//设备基础信息表【acs_device】
|
|
||||||
JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND region = '3'", "seq_num").getResultJSONArray(0);
|
|
||||||
//acs_device_extra
|
|
||||||
WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
|
|
||||||
JSONArray result = new JSONArray();
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
|
||||||
JSONObject obj = arr.getJSONObject(i);
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("device_id", obj.getString("device_id"));
|
|
||||||
json.put("device_code", obj.getString("device_code"));
|
|
||||||
json.put("checked", false);
|
|
||||||
json.put("device_name", obj.getString("device_name"));
|
|
||||||
Device device = deviceAppService.findDeviceByCode(obj.getString("device_code"));
|
|
||||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
|
||||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
|
||||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
json.put("quantity", standardOrdinarySiteDeviceDriver.getQty());
|
|
||||||
json.put("material_type", standardOrdinarySiteDeviceDriver.getMaterial());
|
|
||||||
json.put("remark", standardOrdinarySiteDeviceDriver.getRemark());
|
|
||||||
}
|
|
||||||
JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0);
|
|
||||||
for (int m = 0; m < extraArr.size(); m++) {
|
|
||||||
JSONObject jsonObject = extraArr.getJSONObject(m);
|
|
||||||
String extra_code = jsonObject.getString("extra_code");
|
|
||||||
//定点作业:自动创建任务
|
|
||||||
if ("auto_create_task".equals(extra_code)) {
|
|
||||||
json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//呼叫
|
|
||||||
if ("apply_task".equals(extra_code)) {
|
|
||||||
json.put("apply_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//响应
|
|
||||||
if ("manual_create_task".equals(extra_code)) {
|
|
||||||
json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
//清除
|
|
||||||
if ("auto_clean_task".equals(extra_code)) {
|
|
||||||
json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
result.add(json);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONArray selectDeviceDevicerInfo(String status) {
|
public JSONArray selectDeviceDevicerInfo(String status) {
|
||||||
@@ -1515,6 +1369,35 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeviceCodeByAddress(StorageCellDto dto){
|
||||||
|
Iterator iterator = storageCells.iterator();
|
||||||
|
StorageCellDto dto1 = null;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
|
||||||
|
if(StrUtil.equals(storageCellDto.getStorage_code(),dto.getStorage_code())){
|
||||||
|
storageCells.remove(storageCellDto);
|
||||||
|
storageCells.add(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addDeviceCodeByAddress(StorageCellDto dto){
|
||||||
|
Iterator iterator = storageCells.iterator();
|
||||||
|
StorageCellDto dto1 = null;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
|
||||||
|
if(StrUtil.equals(storageCellDto.getStorage_code(),dto.getStorage_code())){
|
||||||
|
dto1 = storageCellDto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ObjectUtil.isEmpty(dto1)){
|
||||||
|
storageCells.add(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Device> findCacheDevice() {
|
public List<Device> findCacheDevice() {
|
||||||
List<Device> list = deviceAppService.findAllDevice();
|
List<Device> list = deviceAppService.findAllDevice();
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.service.DeviceExtraService;
|
||||||
|
import org.nl.acs.device.service.DeviceService;
|
||||||
import org.nl.acs.device.service.StorageCellService;
|
import org.nl.acs.device.service.StorageCellService;
|
||||||
import org.nl.acs.device.service.dto.StorageCellDto;
|
import org.nl.acs.device.service.dto.StorageCellDto;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
@@ -40,6 +42,9 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class StorageCellServiceImpl implements StorageCellService {
|
public class StorageCellServiceImpl implements StorageCellService {
|
||||||
|
|
||||||
|
private final DeviceService deviceService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
String storage_code = MapUtil.getStr(whereJson, "storage_code");
|
String storage_code = MapUtil.getStr(whereJson, "storage_code");
|
||||||
@@ -105,11 +110,11 @@ public class StorageCellServiceImpl implements StorageCellService {
|
|||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_by(currentUsername);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||||
|
|
||||||
wo.insert(json);
|
wo.insert(json);
|
||||||
|
deviceService.addDeviceCodeByAddress(dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -125,8 +130,9 @@ public class StorageCellServiceImpl implements StorageCellService {
|
|||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||||
|
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
|
deviceService.updateDeviceCodeByAddress(dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -255,15 +255,12 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
|
|
||||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + param;
|
+ "." + param;
|
||||||
//String opcservcerid = this.getDevice().getOpc_server_id();
|
|
||||||
//Server server = ReadUtil.getServer(opcservcerid);
|
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
|
||||||
itemMap.put(to_param, Integer.parseInt(value));
|
itemMap.put(to_param, Integer.parseInt(value));
|
||||||
// itemMap.put(to_param, Integer.parseInt(value));
|
|
||||||
this.control(itemMap);
|
this.control(itemMap);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writing(int type, int command) {
|
public void writing(int type, int command) {
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.lamp_three_color;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ItemProtocol {
|
||||||
|
|
||||||
|
public static String item_to_command = "to_command";
|
||||||
|
|
||||||
|
|
||||||
|
private LampThreecolorDeviceDriver driver;
|
||||||
|
|
||||||
|
public ItemProtocol(LampThreecolorDeviceDriver driver) {
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getToCommand() {
|
||||||
|
return this.getOpcIntegerValue(item_to_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getOpcIntegerValue(String protocol) {
|
||||||
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
|
if (value == null) {
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<ItemDto> getWriteableItemDtos() {
|
||||||
|
ArrayList list = new ArrayList();
|
||||||
|
list.add(new ItemDto(item_to_command, "作业命令", "08011"));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.lamp_three_color;
|
||||||
|
|
||||||
|
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.ArrayList;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准版-三色灯
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LampThreecolorDefination implements OpcDeviceDriverDefination {
|
||||||
|
@Override
|
||||||
|
public String getDriverCode() {
|
||||||
|
return "lamp_three_color";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverName() {
|
||||||
|
return "标准版-三色灯";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDriverDescription() {
|
||||||
|
return "标准版-三色灯";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceDriver getDriverInstance(Device device) {
|
||||||
|
return (new LampThreecolorDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||||
|
return LampThreecolorDeviceDriver.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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package org.nl.acs.device_driver.basedriver.lamp_three_color;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||||
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.openscada.opc.lib.da.Server;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准版-三色灯
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
|
||||||
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||||
|
|
||||||
|
String container;
|
||||||
|
String container_type_desc;
|
||||||
|
String last_container_type_desc;
|
||||||
|
String last_container;
|
||||||
|
//放货准备锁
|
||||||
|
String putReadyLock = null;
|
||||||
|
//有货标记
|
||||||
|
protected boolean has_goods_tag = false;
|
||||||
|
String devicecode;
|
||||||
|
int mode = 0;
|
||||||
|
int action = 0;
|
||||||
|
int error = 0;
|
||||||
|
int move = 0;
|
||||||
|
int task = 0;
|
||||||
|
int last_action = 0;
|
||||||
|
int last_mode = 0;
|
||||||
|
int last_error = 0;
|
||||||
|
int last_move = 0;
|
||||||
|
int last_task = 0;
|
||||||
|
|
||||||
|
boolean hasVehicle = false;
|
||||||
|
boolean isReady = false;
|
||||||
|
protected int instruction_num = 0;
|
||||||
|
protected int instruction_num_truth = 0;
|
||||||
|
protected boolean hasGoods = false;
|
||||||
|
boolean isFold = false;
|
||||||
|
private String assemble_check_tag;
|
||||||
|
private Boolean sampleMode0;
|
||||||
|
private Boolean sampleMode3;
|
||||||
|
private Integer sampleError;
|
||||||
|
private Boolean sampleOnline;
|
||||||
|
protected String displayMessage = null;
|
||||||
|
public int display_message_time_out = 30000;
|
||||||
|
public Date display_message_time;
|
||||||
|
protected String current_stage_instruction_message;
|
||||||
|
protected String last_stage_instruction_message;
|
||||||
|
Integer heartbeat_tag;
|
||||||
|
private Date instruction_require_time = new Date();
|
||||||
|
private Date instruction_finished_time = new Date();
|
||||||
|
|
||||||
|
private int instruction_require_time_out;
|
||||||
|
boolean requireSucess = false;
|
||||||
|
|
||||||
|
private int instruction_finished_time_out;
|
||||||
|
|
||||||
|
int branchProtocol = 0;
|
||||||
|
|
||||||
|
String device_code = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice() {
|
||||||
|
return this.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
String message = null;
|
||||||
|
device_code = this.getDevice().getDevice_code();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import org.nl.acs.device_driver.DeviceDriver;
|
|||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
@@ -374,6 +375,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
//Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
//Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||||
|
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||||
|
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
|
||||||
// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
// if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||||
// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
|
// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||||
// hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
// hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
||||||
@@ -390,6 +393,28 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes));
|
hongXiangConveyorDeviceDriver.writing("to_time_min", String.valueOf(minutes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||||
|
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
// hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
|
||||||
|
|
||||||
|
if(StrUtil.startWith(taskDto.getTask_code(), "-")){
|
||||||
|
if(ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))){
|
||||||
|
String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString();
|
||||||
|
Device lampDevice = deviceAppService.findDeviceByCode(lamp);
|
||||||
|
if(ObjectUtil.isEmpty(lampDevice)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lampDevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
|
||||||
|
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lampDevice.getDeviceDriver();
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "下发报警灯"+ lamp +"报警信号");
|
||||||
|
lampThreecolorDeviceDriver.writing("to_command","1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (this.getNow_steps_type() == 5) {
|
if (this.getNow_steps_type() == 5) {
|
||||||
this.writing("to_command", "5");
|
this.writing("to_command", "5");
|
||||||
this.setNow_steps_type(6);
|
this.setNow_steps_type(6);
|
||||||
@@ -843,11 +868,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writing(int command) {
|
public void writing(int command) {
|
||||||
//String opcservcerid = this.getDevice().getOpc_server_id();
|
|
||||||
//Server server = ReadUtil.getServer(opcservcerid);
|
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
this.control(itemMap);
|
this.control(itemMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//将扩展表中的字符串数据转换成集合
|
//将扩展表中的字符串数据转换成集合
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ import siemens_conveyor_ckk from '@/views/acs/device/driver/siemens_conveyor_ckk
|
|||||||
import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor'
|
import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor'
|
||||||
import photoelectric_inspection_site from '@/views/acs/device/driver/photoelectric_inspection_site'
|
import photoelectric_inspection_site from '@/views/acs/device/driver/photoelectric_inspection_site'
|
||||||
import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
|
import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
|
||||||
|
import lamp_three_color from '@/views/acs/device/driver/lamp_three_color'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceConfig',
|
name: 'DeviceConfig',
|
||||||
@@ -126,7 +128,8 @@ export default {
|
|||||||
siemens_conveyor_ckk,
|
siemens_conveyor_ckk,
|
||||||
siemens_onefloor_agv_conveyor,
|
siemens_onefloor_agv_conveyor,
|
||||||
photoelectric_inspection_site,
|
photoelectric_inspection_site,
|
||||||
standard_autodoor
|
standard_autodoor,
|
||||||
|
lamp_three_color
|
||||||
},
|
},
|
||||||
dicts: ['device_type'],
|
dicts: ['device_type'],
|
||||||
mixins: [crud],
|
mixins: [crud],
|
||||||
|
|||||||
@@ -105,6 +105,14 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<el-table-column prop="dbw_value">
|
||||||
<template slot="header">
|
<template slot="header">
|
||||||
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
|
||||||
@@ -278,6 +286,15 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
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_read1() {
|
test_read1() {
|
||||||
testRead(this.data1, this.opc_id).then(data => {
|
testRead(this.data1, this.opc_id).then(data => {
|
||||||
this.data1 = data
|
this.data1 = data
|
||||||
|
|||||||
Reference in New Issue
Block a user