fix
This commit is contained in:
@@ -33,6 +33,7 @@ import org.openscada.opc.lib.da.Server;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -197,14 +198,12 @@ public class HfRGVTwoDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
// }
|
||||
// }
|
||||
logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV前工位任务完成,开始反馈电气信号");
|
||||
this.writing("to_command1", "0");
|
||||
this.writing("to_onset1", "0");
|
||||
this.writing("to_target1", "0");
|
||||
this.writing("to_task1", "0");
|
||||
this.writing("to_command1", "0");
|
||||
this.writing("to_onset1", "0");
|
||||
this.writing("to_target1", "0");
|
||||
this.writing("to_task1", "0");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_onset1","0");
|
||||
map.put("to_target1", "0");
|
||||
map.put("to_task1","0");
|
||||
map.put("to_command1", "0");
|
||||
this.writing(map);
|
||||
this.setRequireHeadSucess(false);
|
||||
}
|
||||
}
|
||||
@@ -524,14 +523,12 @@ public class HfRGVTwoDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
this.isSetAddress(nextDevice);
|
||||
String start_addr = startDevice.getExtraValue().get("address").toString();
|
||||
String next_addr = nextDevice.getExtraValue().get("address").toString();
|
||||
this.writing("to_onset1", start_addr);
|
||||
this.writing("to_target1", next_addr);
|
||||
this.writing("to_task1", dto.getInstruction_code());
|
||||
this.writing("to_command1", "1");
|
||||
this.writing("to_onset1", start_addr);
|
||||
this.writing("to_target1", next_addr);
|
||||
this.writing("to_task1", dto.getInstruction_code());
|
||||
this.writing("to_command1", "1");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_onset1",start_addr);
|
||||
map.put("to_target1", next_addr);
|
||||
map.put("to_task1", dto.getInstruction_code());
|
||||
map.put("to_command1", "1");
|
||||
this.writing(map);
|
||||
logServer.deviceInfo("RGV申请前工位任务", this.getDevice_code(), "RGV前工位任务指令创建成功,信号写入成功");
|
||||
}
|
||||
|
||||
@@ -545,14 +542,12 @@ public class HfRGVTwoDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
this.isSetAddress(nextDevice);
|
||||
String start_addr = startDevice.getExtraValue().get("address").toString();
|
||||
String next_addr = nextDevice.getExtraValue().get("address").toString();
|
||||
this.writing("to_onset2", start_addr);
|
||||
this.writing("to_target2", next_addr);
|
||||
this.writing("to_task2", dto.getInstruction_code());
|
||||
this.writing("to_command2", "1");
|
||||
this.writing("to_onset2", start_addr);
|
||||
this.writing("to_target2", next_addr);
|
||||
this.writing("to_task2", dto.getInstruction_code());
|
||||
this.writing("to_command2", "1");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_onset2",start_addr);
|
||||
map.put("to_target2", next_addr);
|
||||
map.put("to_task2", dto.getInstruction_code());
|
||||
map.put("to_command2", "1");
|
||||
this.writing(map);
|
||||
logServer.deviceInfo("RGV申请后工位任务", this.getDevice_code(), "RGV后工位任务指令创建成功,信号写入成功");
|
||||
}
|
||||
|
||||
@@ -572,6 +567,36 @@ public class HfRGVTwoDeviceDriver extends AbstractOpcDeviceDriver implements Dev
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void writing(Map<String, Object> map) {
|
||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
itemMap.put(getToParam() + key, value);
|
||||
}
|
||||
});
|
||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try{
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e1){
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽取统一下发电气信号前缀
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getToParam() {
|
||||
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||
}
|
||||
|
||||
public void writing(String param, String value) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user