This commit is contained in:
张江玮
2023-03-31 17:52:14 +08:00
parent 18e9643ddd
commit e556fd53af
40 changed files with 550 additions and 398 deletions

View File

@@ -1,12 +1,27 @@
package org.nl.acs.device_driver.driver;
import org.nl.acs.ext.wms.data.JsonUtl;
import org.nl.acs.opc.OpcConfig;
import org.nl.acs.opc.OpcServerService;
import org.nl.acs.opc.OpcServerServiceImpl;
import org.nl.exception.WDKException;
import org.nl.modules.udw.UnifiedDataAccessor;
import org.nl.modules.udw.UnifiedDataAccessorFactory;
import org.nl.utils.SpringContextHolder;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver {
UnifiedDataAccessor opcUdw;
private Date sendTime;
private String last_items;
private int noLog_sendTimeOut;
private Date noLog_sendTime;
private String noLog_last_items;
public AbstractOpcDeviceDriver() {
this.opcUdw = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
}
@@ -15,4 +30,82 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
public UnifiedDataAccessor getOpcValueAccessor() {
return this.opcUdw;
}
public boolean control(Map<String, Object> itemValues) {
Iterator<Map.Entry<String, Object>> it = itemValues.entrySet().iterator();
ItemValue p2[];
p2 = new ItemValue[itemValues.size()];
int i=0;
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
System.out.println("即将写入值:"+entry.getKey() + ":" + entry.getValue());
p2[i] = new ItemValue();
p2[i].setItem_code(entry.getKey());
p2[i].setItem_value(entry.getValue());
i++;
}
return this.control(p2);
}
public boolean control(ItemValue[] itemValues) {
if (itemValues != null && itemValues.length != 0) {
String this_items = JsonUtl.parseWithoutException(itemValues);
boolean need_write = false;
StringBuilder sb = new StringBuilder();
ItemValue[] var5 = itemValues;
int var6 = itemValues.length;
for (int var7 = 0; var7 < var6; ++var7) {
ItemValue itemValue = var5[var7];
String code = itemValue.getItem_code();
Object udw_value = this.getUdwValue(code);
Object write_value = itemValue.getItem_value();
sb.append(code);
sb.append(":");
sb.append(JsonUtl.parseWithoutException(udw_value));
sb.append(";");
// if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
// need_write = true;
// }
}
need_write = true;
if (need_write) {
Date date = new Date();
/*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) {
log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check);
return false;
}*/
this.last_items = this_items;
this.sendTime = date;
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
opcServerService.writeInteger(this.getOpcServer(), itemValues);
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
ItemValue[] var17 = itemValues;
int var18 = itemValues.length;
for (int var19 = 0; var19 < var18; ++var19) {
ItemValue itemValue = var17[var19];
String code = itemValue.getItem_code();
Object value = itemValue.getItem_value();
opcValueAccessor.setValue(code, value);
}
}
return true;
} else {
throw new WDKException("下发 无内容");
}
}
}

View File

@@ -91,4 +91,8 @@ public interface OpcDeviceDriver extends DeviceDriver {
return this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDeviceCode() + "." + item;
}
default Object getUdwValue(String protocol) {
return this.getOpcValueAccessor().getValue(protocol);
}
}

View File

@@ -137,11 +137,10 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
log.info("下发PLC信号{},{}", to_command, command);
System.out.println("设备:" + devicecode + ",下发PLC信号" + to_command + ",value:" + command);
}

View File

@@ -388,12 +388,11 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -424,18 +423,17 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command);
}
@@ -446,8 +444,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -459,7 +456,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_task, command);
logServer.deviceExecuteLog(this.device_code, "", "", to_task + " 写入 " + command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -467,17 +464,16 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param,value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
if (obj == null || StrUtil.isEmpty(fieldName)) {
if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性

View File

@@ -164,7 +164,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -328,31 +328,29 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (value instanceof String) {
itemMap.put(to_param, value);
} else {
itemMap.put(to_param, Integer.parseInt(value));
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command);
}

View File

@@ -201,15 +201,14 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
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>();
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -217,12 +216,11 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}

View File

@@ -126,7 +126,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -278,10 +278,9 @@ public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements D
public void executing(int command, Instruction instruction, String appendMessage) {
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -290,27 +289,25 @@ public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements D
String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command1;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command1, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(String type, String value) {
String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command1;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(type, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -318,11 +315,10 @@ public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements D
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command1;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}

View File

@@ -811,7 +811,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -977,66 +977,66 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
String two_qty = content.getString("two_qty");
String tool_coordinate = content.getString("tool_coordinate");
this.writing("to_material_qty", StrUtil.isEmpty(qty) ? "0" : qty);
this.writing("to_material_code", StrUtil.isEmpty(material_code) ? "0" : material_code);
this.writing("to_product_code", StrUtil.isEmpty(product_code) ? "0" : product_code);
this.writing("to_AlongSide", StrUtil.isEmpty(AlongSide) ? "0" : AlongSide);
this.writing("to_BshortSide", StrUtil.isEmpty(BshortSide) ? "0" : BshortSide);
this.writing("to_Htrapezoidal", StrUtil.isEmpty(Htrapezoidal) ? "0" : Htrapezoidal);
this.writing("to_Wthickness", StrUtil.isEmpty(Wthickness) ? "0" : Wthickness);
this.writing("to_tray_qty", StrUtil.isEmpty(qty) ? "0" : qty);
this.writing("to_tray_high", StrUtil.isEmpty(tray_high) ? "0" : tray_high);
this.writing("to_crib_category", StrUtil.isEmpty(crib_category) ? "0" : crib_category);
this.writing("to_palletX1_line", StrUtil.isEmpty(palletX1_line) ? "0" : palletX1_line);
this.writing("to_palletY1_row", StrUtil.isEmpty(palletY1_row) ? "0" : palletY1_row);
this.writing("to_palletA1_angle", StrUtil.isEmpty(palletA1_angle) ? "0" : palletA1_angle);
this.writing("to_palletX2_line", StrUtil.isEmpty(palletX2_line) ? "0" : palletX2_line);
this.writing("to_palletY2_row", StrUtil.isEmpty(palletY2_row) ? "0" : palletY2_row);
this.writing("to_palletA2_angle", StrUtil.isEmpty(palletA2_angle) ? "0" : palletA2_angle);
this.writing("to_palletX3_line", StrUtil.isEmpty(palletX3_line) ? "0" : palletX3_line);
this.writing("to_palletY3_row", StrUtil.isEmpty(palletY3_row) ? "0" : palletY3_row);
this.writing("to_palletA3_angle", StrUtil.isEmpty(palletA3_angle) ? "0" : palletA3_angle);
this.writing("to_pressCribX1_line", StrUtil.isEmpty(pressCribX1_line) ? "0" : pressCribX1_line);
this.writing("to_pressCribY1_row", StrUtil.isEmpty(pressCribY1_row) ? "0" : pressCribY1_row);
this.writing("to_pressCribA1_angle", StrUtil.isEmpty(pressCribA1_angle) ? "0" : pressCribA1_angle);
this.writing("to_pressCribX2_line", StrUtil.isEmpty(pressCribX2_line) ? "0" : pressCribX2_line);
this.writing("to_pressCribY2_row", StrUtil.isEmpty(pressCribY2_row) ? "0" : pressCribY2_row);
this.writing("to_pressCribA2_angle", StrUtil.isEmpty(pressCribA2_angle) ? "0" : pressCribA2_angle);
this.writing("to_pressCribX3_line", StrUtil.isEmpty(pressCribX3_line) ? "0" : pressCribX3_line);
this.writing("to_pressCribY3_row", StrUtil.isEmpty(pressCribY3_row) ? "0" : pressCribY3_row);
this.writing("to_pressCribA3_angle", StrUtil.isEmpty(pressCribA3_angle) ? "0" : pressCribA3_angle);
this.writing("to_Zoffset", StrUtil.isEmpty(Zoffset) ? "0" : Zoffset);
this.writing("to_pallet_layerQty", StrUtil.isEmpty(pallet_layerQty) ? "0" : pallet_layerQty);
this.writing("to_pressCrib_layerQty", StrUtil.isEmpty(pressCrib_layerQty) ? "0" : pressCrib_layerQty);
this.writing("to_codeLayerX1_interval", StrUtil.isEmpty(codeLayerX1_interval) ? "0" : codeLayerX1_interval);
this.writing("to_codeLayerY1_interval", StrUtil.isEmpty(codeLayerY1_interval) ? "0" : codeLayerY1_interval);
this.writing("to_codeLayerX2_interval", StrUtil.isEmpty(codeLayerX2_interval) ? "0" : codeLayerX2_interval);
this.writing("to_codeLayerY2_interval", StrUtil.isEmpty(codeLayerY2_interval) ? "0" : codeLayerY2_interval);
this.writing("to_codeLayerX3_interval", StrUtil.isEmpty(codeLayerX3_interval) ? "0" : codeLayerX3_interval);
this.writing("to_codeLayerY3_interval", StrUtil.isEmpty(codeLayerY3_interval) ? "0" : codeLayerY3_interval);
this.writing("to_codeLayerX1_offset", StrUtil.isEmpty(codeLayerX1_offset) ? "0" : codeLayerX1_offset);
this.writing("to_codeLayerY1_offset", StrUtil.isEmpty(codeLayerY1_offset) ? "0" : codeLayerY1_offset);
this.writing("to_codeLayerX2_offset", StrUtil.isEmpty(codeLayerX2_offset) ? "0" : codeLayerX2_offset);
this.writing("to_codeLayerY2_offset", StrUtil.isEmpty(codeLayerY2_offset) ? "0" : codeLayerY2_offset);
this.writing("to_codeLayerX3_offset", StrUtil.isEmpty(codeLayerX3_offset) ? "0" : codeLayerX3_offset);
this.writing("to_codeLayerY3_offset", StrUtil.isEmpty(codeLayerY3_offset) ? "0" : codeLayerY3_offset);
this.writing("to_pressLayerX1_interval", StrUtil.isEmpty(pressLayerX1_interval) ? "0" : pressLayerX1_interval);
this.writing("to_pressLayerY1_interval", StrUtil.isEmpty(pressLayerY1_interval) ? "0" : pressLayerY1_interval);
this.writing("to_pressLayerX2_interval", StrUtil.isEmpty(pressLayerX2_interval) ? "0" : pressLayerX2_interval);
this.writing("to_pressLayerY2_interval", StrUtil.isEmpty(pressLayerY2_interval) ? "0" : pressLayerY2_interval);
this.writing("to_pressLayerX3_interval", StrUtil.isEmpty(pressLayerX3_interval) ? "0" : pressLayerX3_interval);
this.writing("to_pressLayerY3_interval", StrUtil.isEmpty(pressLayerY3_interval) ? "0" : pressLayerY3_interval);
this.writing("to_pressLayerX1_offset", StrUtil.isEmpty(pressLayerX1_offset) ? "0" : pressLayerX1_offset);
this.writing("to_pressLayerY1_offset", StrUtil.isEmpty(pressLayerY1_offset) ? "0" : pressLayerY1_offset);
this.writing("to_pressLayerX2_offset", StrUtil.isEmpty(pressLayerX2_offset) ? "0" : pressLayerX2_offset);
this.writing("to_pressLayerY2_offset", StrUtil.isEmpty(pressLayerY2_offset) ? "0" : pressLayerY2_offset);
this.writing("to_pressLayerX3_offset", StrUtil.isEmpty(pressLayerX3_offset) ? "0" : pressLayerX3_offset);
this.writing("to_pressLayerY3_offset", StrUtil.isEmpty(pressLayerY3_offset) ? "0" : pressLayerY3_offset);
this.writing("to_one_cribTotal", StrUtil.isEmpty(one_cribTotal) ? "0" : one_cribTotal);
this.writing("to_two_cribTotal", StrUtil.isEmpty(two_cribTotal) ? "0" : two_cribTotal);
this.writing("to_one_qty", StrUtil.isEmpty(one_qty) ? "0" : one_qty);
this.writing("to_two_qty", StrUtil.isEmpty(two_qty) ? "0" : two_qty);
this.writing("to_tool_coordinate", StrUtil.isEmpty(tool_coordinate) ? "0" : tool_coordinate);
this.writing("to_material_qty", StrUtil.isBlank(qty) ? "0" : qty);
this.writing("to_material_code", StrUtil.isBlank(material_code) ? "0" : material_code);
this.writing("to_product_code", StrUtil.isBlank(product_code) ? "0" : product_code);
this.writing("to_AlongSide", StrUtil.isBlank(AlongSide) ? "0" : AlongSide);
this.writing("to_BshortSide", StrUtil.isBlank(BshortSide) ? "0" : BshortSide);
this.writing("to_Htrapezoidal", StrUtil.isBlank(Htrapezoidal) ? "0" : Htrapezoidal);
this.writing("to_Wthickness", StrUtil.isBlank(Wthickness) ? "0" : Wthickness);
this.writing("to_tray_qty", StrUtil.isBlank(qty) ? "0" : qty);
this.writing("to_tray_high", StrUtil.isBlank(tray_high) ? "0" : tray_high);
this.writing("to_crib_category", StrUtil.isBlank(crib_category) ? "0" : crib_category);
this.writing("to_palletX1_line", StrUtil.isBlank(palletX1_line) ? "0" : palletX1_line);
this.writing("to_palletY1_row", StrUtil.isBlank(palletY1_row) ? "0" : palletY1_row);
this.writing("to_palletA1_angle", StrUtil.isBlank(palletA1_angle) ? "0" : palletA1_angle);
this.writing("to_palletX2_line", StrUtil.isBlank(palletX2_line) ? "0" : palletX2_line);
this.writing("to_palletY2_row", StrUtil.isBlank(palletY2_row) ? "0" : palletY2_row);
this.writing("to_palletA2_angle", StrUtil.isBlank(palletA2_angle) ? "0" : palletA2_angle);
this.writing("to_palletX3_line", StrUtil.isBlank(palletX3_line) ? "0" : palletX3_line);
this.writing("to_palletY3_row", StrUtil.isBlank(palletY3_row) ? "0" : palletY3_row);
this.writing("to_palletA3_angle", StrUtil.isBlank(palletA3_angle) ? "0" : palletA3_angle);
this.writing("to_pressCribX1_line", StrUtil.isBlank(pressCribX1_line) ? "0" : pressCribX1_line);
this.writing("to_pressCribY1_row", StrUtil.isBlank(pressCribY1_row) ? "0" : pressCribY1_row);
this.writing("to_pressCribA1_angle", StrUtil.isBlank(pressCribA1_angle) ? "0" : pressCribA1_angle);
this.writing("to_pressCribX2_line", StrUtil.isBlank(pressCribX2_line) ? "0" : pressCribX2_line);
this.writing("to_pressCribY2_row", StrUtil.isBlank(pressCribY2_row) ? "0" : pressCribY2_row);
this.writing("to_pressCribA2_angle", StrUtil.isBlank(pressCribA2_angle) ? "0" : pressCribA2_angle);
this.writing("to_pressCribX3_line", StrUtil.isBlank(pressCribX3_line) ? "0" : pressCribX3_line);
this.writing("to_pressCribY3_row", StrUtil.isBlank(pressCribY3_row) ? "0" : pressCribY3_row);
this.writing("to_pressCribA3_angle", StrUtil.isBlank(pressCribA3_angle) ? "0" : pressCribA3_angle);
this.writing("to_Zoffset", StrUtil.isBlank(Zoffset) ? "0" : Zoffset);
this.writing("to_pallet_layerQty", StrUtil.isBlank(pallet_layerQty) ? "0" : pallet_layerQty);
this.writing("to_pressCrib_layerQty", StrUtil.isBlank(pressCrib_layerQty) ? "0" : pressCrib_layerQty);
this.writing("to_codeLayerX1_interval", StrUtil.isBlank(codeLayerX1_interval) ? "0" : codeLayerX1_interval);
this.writing("to_codeLayerY1_interval", StrUtil.isBlank(codeLayerY1_interval) ? "0" : codeLayerY1_interval);
this.writing("to_codeLayerX2_interval", StrUtil.isBlank(codeLayerX2_interval) ? "0" : codeLayerX2_interval);
this.writing("to_codeLayerY2_interval", StrUtil.isBlank(codeLayerY2_interval) ? "0" : codeLayerY2_interval);
this.writing("to_codeLayerX3_interval", StrUtil.isBlank(codeLayerX3_interval) ? "0" : codeLayerX3_interval);
this.writing("to_codeLayerY3_interval", StrUtil.isBlank(codeLayerY3_interval) ? "0" : codeLayerY3_interval);
this.writing("to_codeLayerX1_offset", StrUtil.isBlank(codeLayerX1_offset) ? "0" : codeLayerX1_offset);
this.writing("to_codeLayerY1_offset", StrUtil.isBlank(codeLayerY1_offset) ? "0" : codeLayerY1_offset);
this.writing("to_codeLayerX2_offset", StrUtil.isBlank(codeLayerX2_offset) ? "0" : codeLayerX2_offset);
this.writing("to_codeLayerY2_offset", StrUtil.isBlank(codeLayerY2_offset) ? "0" : codeLayerY2_offset);
this.writing("to_codeLayerX3_offset", StrUtil.isBlank(codeLayerX3_offset) ? "0" : codeLayerX3_offset);
this.writing("to_codeLayerY3_offset", StrUtil.isBlank(codeLayerY3_offset) ? "0" : codeLayerY3_offset);
this.writing("to_pressLayerX1_interval", StrUtil.isBlank(pressLayerX1_interval) ? "0" : pressLayerX1_interval);
this.writing("to_pressLayerY1_interval", StrUtil.isBlank(pressLayerY1_interval) ? "0" : pressLayerY1_interval);
this.writing("to_pressLayerX2_interval", StrUtil.isBlank(pressLayerX2_interval) ? "0" : pressLayerX2_interval);
this.writing("to_pressLayerY2_interval", StrUtil.isBlank(pressLayerY2_interval) ? "0" : pressLayerY2_interval);
this.writing("to_pressLayerX3_interval", StrUtil.isBlank(pressLayerX3_interval) ? "0" : pressLayerX3_interval);
this.writing("to_pressLayerY3_interval", StrUtil.isBlank(pressLayerY3_interval) ? "0" : pressLayerY3_interval);
this.writing("to_pressLayerX1_offset", StrUtil.isBlank(pressLayerX1_offset) ? "0" : pressLayerX1_offset);
this.writing("to_pressLayerY1_offset", StrUtil.isBlank(pressLayerY1_offset) ? "0" : pressLayerY1_offset);
this.writing("to_pressLayerX2_offset", StrUtil.isBlank(pressLayerX2_offset) ? "0" : pressLayerX2_offset);
this.writing("to_pressLayerY2_offset", StrUtil.isBlank(pressLayerY2_offset) ? "0" : pressLayerY2_offset);
this.writing("to_pressLayerX3_offset", StrUtil.isBlank(pressLayerX3_offset) ? "0" : pressLayerX3_offset);
this.writing("to_pressLayerY3_offset", StrUtil.isBlank(pressLayerY3_offset) ? "0" : pressLayerY3_offset);
this.writing("to_one_cribTotal", StrUtil.isBlank(one_cribTotal) ? "0" : one_cribTotal);
this.writing("to_two_cribTotal", StrUtil.isBlank(two_cribTotal) ? "0" : two_cribTotal);
this.writing("to_one_qty", StrUtil.isBlank(one_qty) ? "0" : one_qty);
this.writing("to_two_qty", StrUtil.isBlank(two_qty) ? "0" : two_qty);
this.writing("to_tool_coordinate", StrUtil.isBlank(tool_coordinate) ? "0" : tool_coordinate);
Thread.sleep(1000);
this.writing(this.mode);
@@ -1284,11 +1284,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
if (obj == null || StrUtil.isEmpty(fieldName)) {
if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性
@@ -1308,11 +1308,10 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_feedback;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command);
}
@@ -1324,12 +1323,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
@@ -1371,9 +1369,9 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
}
String onoff_status = "";
if (this.getOnoff_status() == 1) {
if (this.getOnoff_status() == 0) {
onoff_status = "关机";
} else if (this.getOnoff_status() == 2) {
} else if (this.getOnoff_status() == 1) {
onoff_status = "开机";
}

View File

@@ -203,7 +203,7 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -570,17 +570,16 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int type, int command) {
@@ -590,8 +589,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -601,7 +599,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
} else if (type == 3) {
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -609,23 +607,21 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command);
}

View File

@@ -202,7 +202,7 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -582,17 +582,16 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int type, int command) {
@@ -602,8 +601,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -615,7 +613,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
itemMap.put(to_task, command);
logServer.deviceExecuteLog(this.device_code, "", "", to_task + " 写入 " + command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -623,22 +621,20 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command);
}

View File

@@ -186,7 +186,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -178,18 +178,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
logServer.deviceExecuteLog(this.device_code, "", "", "信号status" + last_status + "->" + status);
}
if (move_1 != last_move_1) {
if (move_1 == 0) {
this.setRequireSucess1(false);
logServer.deviceExecuteLog(this.device_code, "", "", "前工位有货变无货复位前工位请求标记requireSucess1:"+requireSucess1);
}
logServer.deviceItemValue(this.device_code, "move_1", String.valueOf(move_1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_1" + last_move_1 + "->" + move_1);
}
if (move_2 != last_move_2) {
if (move_2 == 0) {
this.setRequireSucess2(false);
logServer.deviceExecuteLog(this.device_code, "", "", "前工位有货变无货复位前工位请求标记requireSucess1:"+requireSucess1);
}
logServer.deviceItemValue(this.device_code, "move_2", String.valueOf(move_2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move_2" + last_move_2 + "->" + move_2);
}
@@ -249,6 +241,14 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
logServer.deviceItemValue(this.device_code, "specifications", specifications);
logServer.deviceExecuteLog(this.device_code, "", "", "信号specifications" + last_specifications + "->" + specifications);
}
if (move_1 == 0 && task1 == 0) {
this.setRequireSucess1(false);
logServer.deviceExecuteLog(this.device_code, "", "", "前工位无货且无任务复位前工位请求标记requireSucess1:"+requireSucess1);
}
if (move_2 == 0 && task2 == 0) {
this.setRequireSucess2(false);
logServer.deviceExecuteLog(this.device_code, "", "", "后工位无货且无任务复位后工位请求标记requireSucess2:"+requireSucess1);
}
if (task1 > 0) {
@@ -432,10 +432,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
List<String> device_code_list = Arrays.asList(demoArray);
TaskDto task = null;
if (mode == 3) {
Instruction inst2 = instructionService.findByCode(String.valueOf(task2));
device_code_list = new ArrayList<String>() {{
add(inst2.getNext_device_code());
}};
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
device_code_list = new ArrayList<>();
device_code_list.add(inst2.getNext_device_code());
logServer.deviceExecuteLog(device_code, "", "", "前工位申请起点为" + inst2.getNext_device_code() + "的任务");
}
for (int i = 0; i < device_code_list.size(); i++) {
if (ObjectUtil.isNotEmpty(taskserver.queryTaskByDeviceCode(device_code_list.get(i).replace("\"", "")))) {
@@ -581,11 +581,6 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
logServer.deviceExecuteLog(this.device_code, "", "", "申请后工位空盘任务成功,requireSucess2"+requireSucess2+",指令号:"+instdto.getInstruction_code());
} else {
if (mode == 2 && move_2 == 0 && action_2 == 0 && move_1 == 0 && task2 == 0 && !requireSucess1) {
logServer.deviceExecuteLog(this.device_code, "", "", "申请后工位空盘任务未找到,开始申请前工位任务,requireSucess1"+requireSucess1);
instruction_require();
}
}
}
return true;
@@ -604,12 +599,11 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
@@ -623,10 +617,9 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
public void executing(int command, Instruction instruction, String appendMessage) {
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -638,18 +631,17 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing1(int command) {
String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command1;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command1, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command1 + " 写入 " + command);
}
@@ -657,23 +649,21 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
String to_command2 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command2;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command2, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command2 + " 写入 " + command);
}
public void writing(int type, int command) {
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
if (obj == null || StrUtil.isEmpty(fieldName)) {
if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性

View File

@@ -745,7 +745,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -1127,25 +1127,23 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
}
public void executing(int command, Instruction instruction, String appendMessage) {
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int feedback) {
String to_feedback = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_feedback;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_feedback, feedback);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_feedback + " 写入 " + feedback);
}
@@ -1153,10 +1151,9 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_feedback;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -1164,17 +1161,16 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
if (obj == null || StrUtil.isEmpty(fieldName)) {
if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性

View File

@@ -127,7 +127,7 @@ public class ItemProtocol {
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -566,17 +566,16 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int type, int command) {
@@ -586,8 +585,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -599,18 +597,17 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
itemMap.put(to_task, command);
logServer.deviceExecuteLog(this.device_code, "", "", to_task + " 写入 " + command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command);
}

View File

@@ -812,7 +812,7 @@ public class ItemProtocol {
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
if (StrUtil.isBlank(value)) {
} else {
return value;

View File

@@ -1211,66 +1211,66 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
String two_qty = content.getString("two_qty");
String tool_coordinate = content.getString("tool_coordinate");
this.writing("to_material_qty", StrUtil.isEmpty(qty) ? "0" : qty);
this.writing("to_material_code", StrUtil.isEmpty(material_code) ? "0" : material_code );
this.writing("to_product_code", StrUtil.isEmpty(product_code) ? "0" : product_code );
this.writing("to_AlongSide", StrUtil.isEmpty(AlongSide) ? "0" : AlongSide );
this.writing("to_BshortSide", StrUtil.isEmpty(BshortSide) ? "0" : BshortSide );
this.writing("to_Htrapezoidal", StrUtil.isEmpty(Htrapezoidal) ? "0" : Htrapezoidal );
this.writing("to_Wthickness", StrUtil.isEmpty(Wthickness) ? "0" : Wthickness );
this.writing("to_tray_qty", StrUtil.isEmpty(qty) ? "0" : qty );
this.writing("to_tray_high", StrUtil.isEmpty(tray_high) ? "0" : tray_high );
this.writing("to_crib_category", StrUtil.isEmpty(crib_category) ? "0" : crib_category );
this.writing("to_palletX1_line", StrUtil.isEmpty(palletX1_line) ? "0" : palletX1_line );
this.writing("to_palletY1_row", StrUtil.isEmpty(palletY1_row) ? "0" : palletY1_row );
this.writing("to_palletA1_angle", StrUtil.isEmpty(palletA1_angle) ? "0" : palletA1_angle );
this.writing("to_palletX2_line", StrUtil.isEmpty(palletX2_line) ? "0" : palletX2_line );
this.writing("to_palletY2_row", StrUtil.isEmpty(palletY2_row) ? "0" : palletY2_row );
this.writing("to_palletA2_angle", StrUtil.isEmpty(palletA2_angle) ? "0" : palletA2_angle );
this.writing("to_palletX3_line", StrUtil.isEmpty(palletX3_line) ? "0" : palletX3_line );
this.writing("to_palletY3_row", StrUtil.isEmpty(palletY3_row) ? "0" : palletY3_row );
this.writing("to_palletA3_angle", StrUtil.isEmpty(palletA3_angle) ? "0" : palletA3_angle );
this.writing("to_pressCribX1_line", StrUtil.isEmpty(pressCribX1_line) ? "0" : pressCribX1_line );
this.writing("to_pressCribY1_row", StrUtil.isEmpty(pressCribY1_row) ? "0" : pressCribY1_row );
this.writing("to_pressCribA1_angle", StrUtil.isEmpty(pressCribA1_angle) ? "0" : pressCribA1_angle );
this.writing("to_pressCribX2_line", StrUtil.isEmpty(pressCribX2_line) ? "0" : pressCribX2_line );
this.writing("to_pressCribY2_row", StrUtil.isEmpty(pressCribY2_row) ? "0" : pressCribY2_row );
this.writing("to_pressCribA2_angle", StrUtil.isEmpty(pressCribA2_angle) ? "0" : pressCribA2_angle );
this.writing("to_pressCribX3_line", StrUtil.isEmpty(pressCribX3_line) ? "0" : pressCribX3_line );
this.writing("to_pressCribY3_row", StrUtil.isEmpty(pressCribY3_row) ? "0" : pressCribY3_row );
this.writing("to_pressCribA3_angle", StrUtil.isEmpty(pressCribA3_angle) ? "0" : pressCribA3_angle );
this.writing("to_Zoffset", StrUtil.isEmpty(Zoffset) ? "0" : Zoffset );
this.writing("to_pallet_layerQty", StrUtil.isEmpty(pallet_layerQty) ? "0" : pallet_layerQty );
this.writing("to_pressCrib_layerQty", StrUtil.isEmpty(pressCrib_layerQty) ? "0" : pressCrib_layerQty );
this.writing("to_codeLayerX1_interval", StrUtil.isEmpty(codeLayerX1_interval) ? "0" : codeLayerX1_interval );
this.writing("to_codeLayerY1_interval", StrUtil.isEmpty(codeLayerY1_interval) ? "0" : codeLayerY1_interval );
this.writing("to_codeLayerX2_interval", StrUtil.isEmpty(codeLayerX2_interval) ? "0" : codeLayerX2_interval );
this.writing("to_codeLayerY2_interval", StrUtil.isEmpty(codeLayerY2_interval) ? "0" : codeLayerY2_interval );
this.writing("to_codeLayerX3_interval", StrUtil.isEmpty(codeLayerX3_interval) ? "0" : codeLayerX3_interval );
this.writing("to_codeLayerY3_interval", StrUtil.isEmpty(codeLayerY3_interval) ? "0" : codeLayerY3_interval );
this.writing("to_codeLayerX1_offset", StrUtil.isEmpty(codeLayerX1_offset) ? "0" : codeLayerX1_offset );
this.writing("to_codeLayerY1_offset", StrUtil.isEmpty(codeLayerY1_offset) ? "0" : codeLayerY1_offset );
this.writing("to_codeLayerX2_offset", StrUtil.isEmpty(codeLayerX2_offset) ? "0" : codeLayerX2_offset );
this.writing("to_codeLayerY2_offset", StrUtil.isEmpty(codeLayerY2_offset) ? "0" : codeLayerY2_offset );
this.writing("to_codeLayerX3_offset", StrUtil.isEmpty(codeLayerX3_offset) ? "0" : codeLayerX3_offset );
this.writing("to_codeLayerY3_offset", StrUtil.isEmpty(codeLayerY3_offset) ? "0" : codeLayerY3_offset );
this.writing("to_pressLayerX1_interval", StrUtil.isEmpty(pressLayerX1_interval) ? "0" : pressLayerX1_interval );
this.writing("to_pressLayerY1_interval", StrUtil.isEmpty(pressLayerY1_interval) ? "0" : pressLayerY1_interval );
this.writing("to_pressLayerX2_interval", StrUtil.isEmpty(pressLayerX2_interval) ? "0" : pressLayerX2_interval );
this.writing("to_pressLayerY2_interval", StrUtil.isEmpty(pressLayerY2_interval) ? "0" : pressLayerY2_interval );
this.writing("to_pressLayerX3_interval", StrUtil.isEmpty(pressLayerX3_interval) ? "0" : pressLayerX3_interval );
this.writing("to_pressLayerY3_interval", StrUtil.isEmpty(pressLayerY3_interval) ? "0" : pressLayerY3_interval );
this.writing("to_pressLayerX1_offset", StrUtil.isEmpty(pressLayerX1_offset) ? "0" : pressLayerX1_offset );
this.writing("to_pressLayerY1_offset", StrUtil.isEmpty(pressLayerY1_offset) ? "0" : pressLayerY1_offset );
this.writing("to_pressLayerX2_offset", StrUtil.isEmpty(pressLayerX2_offset) ? "0" : pressLayerX2_offset );
this.writing("to_pressLayerY2_offset", StrUtil.isEmpty(pressLayerY2_offset) ? "0" : pressLayerY2_offset );
this.writing("to_pressLayerX3_offset", StrUtil.isEmpty(pressLayerX3_offset) ? "0" : pressLayerX3_offset );
this.writing("to_pressLayerY3_offset", StrUtil.isEmpty(pressLayerY3_offset) ? "0" : pressLayerY3_offset );
this.writing("to_one_cribTotal", StrUtil.isEmpty(one_cribTotal) ? "0" : one_cribTotal );
this.writing("to_two_cribTotal", StrUtil.isEmpty(two_cribTotal) ? "0" : two_cribTotal );
this.writing("to_one_qty", StrUtil.isEmpty(one_qty) ? "0" : one_qty );
this.writing("to_two_qty", StrUtil.isEmpty(two_qty) ? "0" : two_qty );
this.writing("to_tool_coordinate", StrUtil.isEmpty(tool_coordinate) ? "0" : tool_coordinate );
this.writing("to_material_qty", StrUtil.isBlank(qty) ? "0" : qty);
this.writing("to_material_code", StrUtil.isBlank(material_code) ? "0" : material_code );
this.writing("to_product_code", StrUtil.isBlank(product_code) ? "0" : product_code );
this.writing("to_AlongSide", StrUtil.isBlank(AlongSide) ? "0" : AlongSide );
this.writing("to_BshortSide", StrUtil.isBlank(BshortSide) ? "0" : BshortSide );
this.writing("to_Htrapezoidal", StrUtil.isBlank(Htrapezoidal) ? "0" : Htrapezoidal );
this.writing("to_Wthickness", StrUtil.isBlank(Wthickness) ? "0" : Wthickness );
this.writing("to_tray_qty", StrUtil.isBlank(qty) ? "0" : qty );
this.writing("to_tray_high", StrUtil.isBlank(tray_high) ? "0" : tray_high );
this.writing("to_crib_category", StrUtil.isBlank(crib_category) ? "0" : crib_category );
this.writing("to_palletX1_line", StrUtil.isBlank(palletX1_line) ? "0" : palletX1_line );
this.writing("to_palletY1_row", StrUtil.isBlank(palletY1_row) ? "0" : palletY1_row );
this.writing("to_palletA1_angle", StrUtil.isBlank(palletA1_angle) ? "0" : palletA1_angle );
this.writing("to_palletX2_line", StrUtil.isBlank(palletX2_line) ? "0" : palletX2_line );
this.writing("to_palletY2_row", StrUtil.isBlank(palletY2_row) ? "0" : palletY2_row );
this.writing("to_palletA2_angle", StrUtil.isBlank(palletA2_angle) ? "0" : palletA2_angle );
this.writing("to_palletX3_line", StrUtil.isBlank(palletX3_line) ? "0" : palletX3_line );
this.writing("to_palletY3_row", StrUtil.isBlank(palletY3_row) ? "0" : palletY3_row );
this.writing("to_palletA3_angle", StrUtil.isBlank(palletA3_angle) ? "0" : palletA3_angle );
this.writing("to_pressCribX1_line", StrUtil.isBlank(pressCribX1_line) ? "0" : pressCribX1_line );
this.writing("to_pressCribY1_row", StrUtil.isBlank(pressCribY1_row) ? "0" : pressCribY1_row );
this.writing("to_pressCribA1_angle", StrUtil.isBlank(pressCribA1_angle) ? "0" : pressCribA1_angle );
this.writing("to_pressCribX2_line", StrUtil.isBlank(pressCribX2_line) ? "0" : pressCribX2_line );
this.writing("to_pressCribY2_row", StrUtil.isBlank(pressCribY2_row) ? "0" : pressCribY2_row );
this.writing("to_pressCribA2_angle", StrUtil.isBlank(pressCribA2_angle) ? "0" : pressCribA2_angle );
this.writing("to_pressCribX3_line", StrUtil.isBlank(pressCribX3_line) ? "0" : pressCribX3_line );
this.writing("to_pressCribY3_row", StrUtil.isBlank(pressCribY3_row) ? "0" : pressCribY3_row );
this.writing("to_pressCribA3_angle", StrUtil.isBlank(pressCribA3_angle) ? "0" : pressCribA3_angle );
this.writing("to_Zoffset", StrUtil.isBlank(Zoffset) ? "0" : Zoffset );
this.writing("to_pallet_layerQty", StrUtil.isBlank(pallet_layerQty) ? "0" : pallet_layerQty );
this.writing("to_pressCrib_layerQty", StrUtil.isBlank(pressCrib_layerQty) ? "0" : pressCrib_layerQty );
this.writing("to_codeLayerX1_interval", StrUtil.isBlank(codeLayerX1_interval) ? "0" : codeLayerX1_interval );
this.writing("to_codeLayerY1_interval", StrUtil.isBlank(codeLayerY1_interval) ? "0" : codeLayerY1_interval );
this.writing("to_codeLayerX2_interval", StrUtil.isBlank(codeLayerX2_interval) ? "0" : codeLayerX2_interval );
this.writing("to_codeLayerY2_interval", StrUtil.isBlank(codeLayerY2_interval) ? "0" : codeLayerY2_interval );
this.writing("to_codeLayerX3_interval", StrUtil.isBlank(codeLayerX3_interval) ? "0" : codeLayerX3_interval );
this.writing("to_codeLayerY3_interval", StrUtil.isBlank(codeLayerY3_interval) ? "0" : codeLayerY3_interval );
this.writing("to_codeLayerX1_offset", StrUtil.isBlank(codeLayerX1_offset) ? "0" : codeLayerX1_offset );
this.writing("to_codeLayerY1_offset", StrUtil.isBlank(codeLayerY1_offset) ? "0" : codeLayerY1_offset );
this.writing("to_codeLayerX2_offset", StrUtil.isBlank(codeLayerX2_offset) ? "0" : codeLayerX2_offset );
this.writing("to_codeLayerY2_offset", StrUtil.isBlank(codeLayerY2_offset) ? "0" : codeLayerY2_offset );
this.writing("to_codeLayerX3_offset", StrUtil.isBlank(codeLayerX3_offset) ? "0" : codeLayerX3_offset );
this.writing("to_codeLayerY3_offset", StrUtil.isBlank(codeLayerY3_offset) ? "0" : codeLayerY3_offset );
this.writing("to_pressLayerX1_interval", StrUtil.isBlank(pressLayerX1_interval) ? "0" : pressLayerX1_interval );
this.writing("to_pressLayerY1_interval", StrUtil.isBlank(pressLayerY1_interval) ? "0" : pressLayerY1_interval );
this.writing("to_pressLayerX2_interval", StrUtil.isBlank(pressLayerX2_interval) ? "0" : pressLayerX2_interval );
this.writing("to_pressLayerY2_interval", StrUtil.isBlank(pressLayerY2_interval) ? "0" : pressLayerY2_interval );
this.writing("to_pressLayerX3_interval", StrUtil.isBlank(pressLayerX3_interval) ? "0" : pressLayerX3_interval );
this.writing("to_pressLayerY3_interval", StrUtil.isBlank(pressLayerY3_interval) ? "0" : pressLayerY3_interval );
this.writing("to_pressLayerX1_offset", StrUtil.isBlank(pressLayerX1_offset) ? "0" : pressLayerX1_offset );
this.writing("to_pressLayerY1_offset", StrUtil.isBlank(pressLayerY1_offset) ? "0" : pressLayerY1_offset );
this.writing("to_pressLayerX2_offset", StrUtil.isBlank(pressLayerX2_offset) ? "0" : pressLayerX2_offset );
this.writing("to_pressLayerY2_offset", StrUtil.isBlank(pressLayerY2_offset) ? "0" : pressLayerY2_offset );
this.writing("to_pressLayerX3_offset", StrUtil.isBlank(pressLayerX3_offset) ? "0" : pressLayerX3_offset );
this.writing("to_pressLayerY3_offset", StrUtil.isBlank(pressLayerY3_offset) ? "0" : pressLayerY3_offset );
this.writing("to_one_cribTotal", StrUtil.isBlank(one_cribTotal) ? "0" : one_cribTotal );
this.writing("to_two_cribTotal", StrUtil.isBlank(two_cribTotal) ? "0" : two_cribTotal );
this.writing("to_one_qty", StrUtil.isBlank(one_qty) ? "0" : one_qty );
this.writing("to_two_qty", StrUtil.isBlank(two_qty) ? "0" : two_qty );
this.writing("to_tool_coordinate", StrUtil.isBlank(tool_coordinate) ? "0" : tool_coordinate );
Thread.sleep(1000);
this.writing(this.mode);
@@ -1550,11 +1550,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
if (obj == null || StrUtil.isEmpty(fieldName)) {
if (obj == null || StrUtil.isBlank(fieldName)) {
return null;
}
//获取这个类的所有属性
@@ -1574,11 +1574,10 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_feedback;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command);
}
@@ -1586,12 +1585,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
ReadUtil.write(itemMap, server);
this.control(itemMap);
logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value);
}
@@ -1637,9 +1635,9 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
}
String onoff_status = "";
if (this.getOnoff_status() == 1) {
if (this.getOnoff_status() == 0) {
onoff_status = "关机";
} else if (this.getOnoff_status() == 2) {
} else if (this.getOnoff_status() == 1) {
onoff_status = "开机";
}

View File

@@ -195,7 +195,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem
}
if (specialOrdinarySiteDeviceDriver.hasGoods != 0 && !StrUtil.equals(specialOrdinarySiteDeviceDriver.getMaterial(), "0")
&& !StrUtil.equals(specialOrdinarySiteDeviceDriver.getMaterial(), "1")
&& (StrUtil.equals(startdevice.getIslock(), "false") || StrUtil.isEmpty(startdevice.getIslock()))) {
&& (StrUtil.equals(startdevice.getIslock(), "false") || StrUtil.isBlank(startdevice.getIslock()))) {
flag = true;
dto.setMaterial(specialOrdinarySiteDeviceDriver.getMaterial());
break;
@@ -207,7 +207,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem
if (!flag) {
return false;
}
if (StrUtil.isEmpty(start_device_code)) {
if (StrUtil.isBlank(start_device_code)) {
requireSucess = true;
branchProtocol = 0;
//throw new RuntimeException("该设备未找到对应路由");
@@ -360,7 +360,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem
dto.setPriority("101");
RouteLineDto jo = routeLineServer.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);
@@ -408,7 +408,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem
dto.setQuantity(new BigDecimal(this.getQty()));
RouteLineDto jo = routeLineServer.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}

View File

@@ -139,11 +139,10 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
log.info("下发PLC信号{},{}", to_command, command);
System.out.println("设备:" + devicecode + ",下发PLC信号" + to_command + ",value:" + command);

View File

@@ -203,7 +203,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
break;
case 2:
//申请任务
if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
if (!StrUtil.isBlank(material) && !StrUtil.isBlank(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) {
this.instruction_require(container);
}
break;
@@ -302,28 +302,26 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -335,13 +333,12 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
itemMap.put(to_target, target);
itemMap.put(to_task, task);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int type, int command) {
@@ -351,8 +348,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -362,7 +358,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
} else if (type == 3) {
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -402,7 +398,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
dto.setPriority("101");
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);

View File

@@ -531,17 +531,16 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing() {
@@ -552,13 +551,12 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_target, deviceAppservice.findDeviceByCode(inst.getNext_device_code()).getAddress());
itemMap.put(to_task, inst.getInstruction_code());
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command, int target, int task) {
@@ -569,24 +567,22 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
itemMap.put(to_target, target);
itemMap.put(to_task, task);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int type, int command) {
@@ -596,8 +592,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -608,7 +603,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public boolean instruction_require(String container_code) throws Exception {
@@ -639,7 +634,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
* 开始平均分配
*/
String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
if (StrUtil.isBlank(this_device_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
@@ -745,7 +740,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
* 开始平均分配
*/
String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
if (StrUtil.isBlank(this_device_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);

View File

@@ -152,7 +152,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
public String formatBarcode() throws Exception {
String barcode = this.barcode();
if (!StrUtil.isEmpty(barcode)) {
if (!StrUtil.isBlank(barcode)) {
barcode = barcode.trim();
}
@@ -172,7 +172,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
private ScannerDeviceDriver getScanner() throws Exception {
String scanner_code = (String) this.getDevice().getExtraValue().get(StandardConveyorWithScannerConfig.relation_scanner);
if (StrUtil.isEmpty(scanner_code)) {
if (StrUtil.isBlank(scanner_code)) {
throw new Exception("未配置读码器");
} else {
Device device = deviceAppservice.findDeviceByCode(scanner_code);
@@ -270,10 +270,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
break;
case 2:
//申请任务
if (hasGoods > 0 && !StrUtil.isEmpty(barcode()) && height > 0 && !requireSucess) {
if (hasGoods > 0 && !StrUtil.isBlank(barcode()) && height > 0 && !requireSucess) {
instruction_require(barcode());
}
if (hasGoods > 0 && !StrUtil.isEmpty(barcode()) && height > 0 && !applySucess) {
if (hasGoods > 0 && !StrUtil.isBlank(barcode()) && height > 0 && !applySucess) {
instruction_apply(barcode());
}
}
@@ -352,17 +352,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing() {
@@ -373,13 +372,12 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_target, deviceAppservice.findDeviceByCode(inst.getNext_device_code()).getAddress());
itemMap.put(to_task, inst.getInstruction_code());
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command, int target, int task) {
@@ -390,24 +388,22 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
itemMap.put(to_target, target);
itemMap.put(to_task, task);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int type, int command) {
@@ -417,8 +413,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -429,7 +424,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public boolean instruction_require(String container_code) throws Exception {
@@ -459,7 +454,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
* 开始平均分配
*/
String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
if (StrUtil.isBlank(this_device_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);
@@ -563,7 +558,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
* 开始平均分配
*/
String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code());
if (StrUtil.isEmpty(this_device_code)) {
if (StrUtil.isBlank(this_device_code)) {
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code);
RouteLineDto routeLineDto = shortPathsList.get(0);

View File

@@ -255,28 +255,26 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -287,8 +285,7 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -298,7 +295,7 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver
} else if (type == 3) {
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -336,7 +333,7 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver
dto.setPriority("101");
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_device_code(next_device_codecode);

View File

@@ -222,7 +222,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
} else if (mode == 2) {
try {
// if (StrUtil.isEmpty(container)) {
// if (StrUtil.isBlank(container)) {
// //判断条码是否为空,否则申请任务
// return;
// }
@@ -374,7 +374,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
List<Instruction> container_instructions = new ArrayList();
String barcode = this.getLast_container();
if (!StrUtil.isEmpty(barcode)) {
if (!StrUtil.isBlank(barcode)) {
Map map = new HashMap();
map.put("vehicle_code", barcode);
container_instructions = instructionService.queryAll(map);
@@ -438,17 +438,16 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}

View File

@@ -188,7 +188,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
dto.setPriority("101");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// if(StrUtil.isBlank(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
dto.setNext_point_code(this.getDeviceCode());
@@ -262,7 +262,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
// dto.setPriority("101");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// if(StrUtil.isBlank(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
// dto.setNext_point_code(next_device_codecode);
@@ -351,28 +351,26 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -383,8 +381,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -394,7 +391,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
} else if (type == 3) {
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -430,7 +427,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
dto.setPriority("101");
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);

View File

@@ -189,7 +189,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
}
}
}
if (StrUtil.isEmpty(next_device_code)) {
if (StrUtil.isBlank(next_device_code)) {
throw new RuntimeException("该设备未找到对应路由");
}
@@ -257,7 +257,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
}
}
}
if (StrUtil.isEmpty(next_device_code)) {
if (StrUtil.isBlank(next_device_code)) {
throw new RuntimeException("该设备未找到对应路由");
}
@@ -305,7 +305,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
dto.setPriority("101");
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);
@@ -354,7 +354,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
dto.setQuantity(new BigDecimal(this.getQty()));
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
if (StrUtil.isBlank(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}

View File

@@ -234,18 +234,17 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
}
public void executing(Server server, Map<String, Object> itemMap) {
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -258,8 +257,7 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
+ "." + ItemProtocol.item_to_onset;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
@@ -269,7 +267,7 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
} else if (type == 3) {
itemMap.put(to_task, command);
}
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
@@ -282,14 +280,13 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements
+ "." + ItemProtocol.item_to_onset;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_onset,appService.findDeviceByCode(inst.getStart_device_code()).getAddress());
itemMap.put(to_target,appService.findDeviceByCode(inst.getNext_device_code()).getAddress());
itemMap.put(to_task, inst.getInstruction_code());
ReadUtil.write(itemMap, server);
this.control(itemMap);
}
/**

View File

@@ -26,12 +26,12 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
public String getIp() {
String ip = (String) this.getDevice().getExtraValue().get("scannerIP");
return StrUtil.isEmpty(ip) ? null : ip;
return StrUtil.isBlank(ip) ? null : ip;
}
public String readBarcode() throws Exception {
String ip = this.getIp();
if (StrUtil.isEmpty(ip)) {
if (StrUtil.isBlank(ip)) {
throw new Exception("ip未配置");
} else {
String result = (String) this.accessor_value.getValue(this.getIp());
@@ -41,7 +41,7 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
public void writeBarcode(String barcode) throws Exception {
String ip = this.getIp();
if (StrUtil.isEmpty(ip)) {
if (StrUtil.isBlank(ip)) {
throw new Exception("ip未配置");
} else {
this.accessor_value.setValueWithPersistence(this.getIp(), barcode);
@@ -50,7 +50,7 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements
public void cleanBarcode() throws Exception {
String ip = this.getIp();
if (StrUtil.isEmpty(ip)) {
if (StrUtil.isBlank(ip)) {
throw new Exception("ip未配置");
} else {
this.accessor_value.setValueWithPersistence(this.getIp(), (Object) null);

View File

@@ -0,0 +1,125 @@
package org.nl.acs.ext.wms.data;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.type.TypeFactory;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class JsonUtl {
private static ObjectMapper objectMapper = null;
private static ObjectMapper objectMapperLog = null;
private JsonUtl() {
}
private static ObjectMapper init() {
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule();
// simpleModule.addSerializer(Enum.class, new EnumSerializer());
// simpleModule.addSerializer(Date.class, new DateSerializer());
// simpleModule.addDeserializer(Enum.class, new EnumDeserializer());
// simpleModule.addDeserializer(Date.class, new DateDeserializers.DateDeserializer());
objectMapper.registerModule(simpleModule);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
public static ObjectMapper getInstance() {
if (objectMapper == null) {
Class var0 = JsonUtl.class;
synchronized(JsonUtl.class) {
if (objectMapper == null) {
objectMapper = init();
}
}
}
return objectMapper;
}
public static ObjectMapper getInstanceLog() {
if (objectMapperLog == null) {
Class var0 = JsonUtl.class;
synchronized(JsonUtl.class) {
if (objectMapperLog == null) {
objectMapperLog = init();
objectMapperLog.setSerializationInclusion(Include.NON_NULL);
}
}
}
return objectMapperLog;
}
public static ObjectMapper getObjectMapper() {
return getInstance();
}
public static String parse(Object object) throws RuntimeException {
try {
return getObjectMapper().writeValueAsString(object);
} catch (JsonProcessingException var2) {
throw new RuntimeException(var2);
}
}
public static String parseWithoutException(Object object) {
try {
return parse(object);
} catch (Exception var2) {
return null;
}
}
public static String parseLog(Object object) {
try {
return getInstanceLog().writeValueAsString(object);
} catch (Exception var2) {
return null;
}
}
public static <T> T format(String json, Class<T> clazz) throws RuntimeException {
try {
return getObjectMapper().readValue(json, clazz);
} catch (IOException var3) {
throw new RuntimeException(var3);
}
}
public static <T> List<T> formatList(String json, Class<T> clazz) throws RuntimeException {
try {
JavaType type = getObjectMapper().getTypeFactory().constructParametricType(List.class, new Class[]{clazz});
return (List)getObjectMapper().readValue(json, type);
} catch (IOException var3) {
throw new RuntimeException(var3);
}
}
public static <T, U> Map<T, U> formatMap(String json, Class<T> clazzKey, Class<U> clazzValue) throws RuntimeException {
try {
JavaType type = getObjectMapper().getTypeFactory().constructParametricType(Map.class, new Class[]{clazzKey, clazzValue});
return (Map)getObjectMapper().readValue(json, type);
} catch (IOException var4) {
throw new RuntimeException(var4);
}
}
public static <T> List<List<T>> formatListTwo(String json, Class<T> clazz) throws RuntimeException {
try {
TypeFactory typeFactory = getObjectMapper().getTypeFactory();
JavaType type = typeFactory.constructParametrizedType(List.class, List.class, new Class[]{clazz});
type = typeFactory.constructParametrizedType(List.class, List.class, new JavaType[]{type});
return (List)getObjectMapper().readValue(json, type);
} catch (IOException var4) {
throw new RuntimeException(var4);
}
}
}

View File

@@ -843,9 +843,9 @@ public class StageServiceImpl implements StageService {
}
String onoff_status = "";
if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 1) {
if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 0) {
onoff_status = "关机";
} else if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 2) {
} else if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 1) {
onoff_status = "开机";
}

View File

@@ -14,10 +14,7 @@ spring:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:jn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rljn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
# password: ${DB_PWD:P@ssw0rd}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456}
# 初始连接数
initial-size: 5