下发RGV托盘类型更新
This commit is contained in:
@@ -29,6 +29,7 @@ import org.nl.wql.core.bean.WQLObject;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -655,6 +656,23 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
|
||||
ReadUtil.write(itemMap, server);
|
||||
}
|
||||
|
||||
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
|
||||
if (obj == null || StrUtil.isEmpty(fieldName)) {
|
||||
return null;
|
||||
}
|
||||
//获取这个类的所有属性
|
||||
Field[] fields = obj.getClass().getDeclaredFields();
|
||||
boolean flag = false;
|
||||
//循环遍历所有的fields
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].getName().equals("item_" + fieldName)) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
@@ -495,6 +495,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
LnshSplitManipulatorDeviceDriver lnshSplitManipulatorDeviceDriver;
|
||||
//拆码垛机械手
|
||||
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
|
||||
//双工位RGV
|
||||
LnshRGVDeviceDriver lnshRGVDeviceDriver;
|
||||
|
||||
//晟华覆膜机
|
||||
if (device.getDeviceDriver() instanceof LnshLaminatingMachineDeviceDriver) {
|
||||
@@ -523,6 +525,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
rljnPackagePalletSplitManipulatorDeviceDriver.writing(code, value);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
|
||||
lnshRGVDeviceDriver = (LnshRGVDeviceDriver) device.getDeviceDriver();
|
||||
org.nl.acs.device_driver.lnsh.lnsh_rgv.ItemProtocol itemProtocol = new org.nl.acs.device_driver.lnsh.lnsh_rgv.ItemProtocol(lnshRGVDeviceDriver);
|
||||
if (!lnshRGVDeviceDriver.isExistFieldName(code, itemProtocol)) {
|
||||
throw new Exception("设备:" + device_code + "未找到对应信号:" + code);
|
||||
}
|
||||
lnshRGVDeviceDriver.writing(code, value);
|
||||
}
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
|
||||
Reference in New Issue
Block a user