opt: 输送线联调优化

This commit is contained in:
yanps
2024-04-30 13:35:59 +08:00
parent b6736b9a9d
commit 6dcf9c843b
8 changed files with 123 additions and 85 deletions

View File

@@ -484,8 +484,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) {
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
standardOrdinarySiteDeviceDriver.setAgvphase(0);
String task_code = standardOrdinarySiteDeviceDriver.getTask_code();
@@ -501,7 +500,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code());
}
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -616,8 +614,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) {
standardOrdinarySiteDeviceDriver.setOption(0);
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);

View File

@@ -511,8 +511,14 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (ObjectUtil.isEmpty(inst)) {
return false;
}
String interactionJson = taskDto.getInteraction_json();
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
String containerType = "";
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
containerType = interactionJsonDTO.getContainerType();
}
List list = new ArrayList();
writeData(next_addr, list, inst);
writeData(next_addr, list, inst,containerType);
// led_message = getLedMessage(inst);
requireSucess = true;
return true;
@@ -675,14 +681,20 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
taskserver.update(taskdto);
requireSucess = true;
String next_addr = nextdevice.getExtraValue().get("address").toString();
String interactionJson = taskdto.getInteraction_json();
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
String containerType = "";
if (ObjectUtil.isNotEmpty(interactionJsonDTO)) {
containerType = interactionJsonDTO.getContainerType();
}
List list = new ArrayList();
writeData(next_addr, list, instdto);
writeData(next_addr, list, instdto, containerType);
// led_message = getLedMessage(instdto);
requireSucess = true;
return true;
}
private void writeData(String next_addr, List list, Instruction inst) {
private void writeData(String next_addr, List list, Instruction inst,String containerType) {
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_target");
@@ -698,7 +710,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
List list4 = new ArrayList();
Map map3 = new HashMap();
map3.put("code", "to_container_type");
map3.put("value", inst.getVehicle_type());
map3.put("value", containerType);
list4.add(map3);
this.writing(list4);
List list3 = new ArrayList();

View File

@@ -130,8 +130,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
int last_hj_task = 0;
//重量
int weight = 0;
int last_weight = 0;
Float weight = 0.0F;
Float last_weight = 0.0F;
//托盘条码
String barcode = null;
@@ -533,7 +533,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority,start_device_code,next_device_code,containerType);
}else {
packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, taskdto.getStart_device_code(), taskdto.getNext_device_code(),containerType);
}
try {
@@ -561,7 +560,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_container_type");
map3.put("value", instdto.getVehicle_type());
map3.put("value", containerType);
list.add(map3);
Map map4 = new HashMap();
map3.put("code", "to_command");

View File

@@ -129,8 +129,8 @@ public class ItemProtocol {
return this.getOpcStringValue(item_material_barcode);
}
public int getWeight(){
return this.getOpcIntegerValue(item_weight);
public Float getWeight(){
return this.getOpcFloatValue(item_weight);
}
public int getTo_task() {
return this.getOpcIntegerValue(item_to_task);
@@ -179,6 +179,20 @@ public class ItemProtocol {
return 0;
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));

View File

@@ -76,6 +76,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int last_mode = 0;
int move = 0;
int action = 0;
int last_action = 0;
int error = 0;
int task = 0;
int heartbeat = 0;
@@ -99,6 +100,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识
boolean requireSucess = false;
boolean requireActionSucess = false;
private int instruction_finished_time_out;
@@ -149,11 +151,13 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
to_barcode = this.itemProtocol.getTo_barcode();
if (mode != last_mode) {
requireSucess = false;
}
if(action == last_action){
requireActionSucess = false;
}
// 更新指令状态
if (mode == 3 && task > 0) {
if (mode == 3 && task > 0 && !requireActionSucess) {
updateInstructionStatus();
}
@@ -214,6 +218,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
last_mode =mode;
last_action = action;
}
@@ -247,6 +252,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
map1.put("value", 5);
list.add(map1);
this.writing(list);
requireActionSucess = true;
message = "universal_message1";
} catch (Exception e) {
message = "universal_message2";

View File

@@ -113,6 +113,7 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
requireSucess = false;
}
lastMode = mode;
lastMove = move;
lastAction = action;

View File

@@ -13,11 +13,11 @@ import java.util.List;
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_action = "action";
public static String item_move = "move1";
public static String item_action = "action1";
public static String item_error = "error";
public static String item_qty = "qty";
public static String item_type = "type";
public static String item_type = "type1";
public static String item_to_command = "to_command";

View File

@@ -454,73 +454,82 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
@NotNull
private Map<String, Object> toStringObjectMap(Instruction instdto, String startAddr, String nextAddr, String interaction_json) {
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
//套管1物料
Object to_material1 = jsonObject.get("left");
//套管2物料
Object to_material2 = jsonObject.get("right");
//套管1规格
Object to_spec1 = jsonObject.get("leftSpec");
//套管2规格
Object to_spec2 = jsonObject.get("rightSpec");
//套管1尺寸
Object to_size1 = jsonObject.get("leftSize");
//套管2尺寸
Object to_size2 = jsonObject.get("rightSize");
//拔管1物料
Object to_material3 = jsonObject.get("currentLeft");
//拔管2物料
Object to_material4 = jsonObject.get("currentRight");
//拔管1尺寸
Object to_size3 = jsonObject.get("currentLeftSize");
//拔管2尺寸
Object to_size4 = jsonObject.get("currentRightSize");
//拔管1规格
Object to_spec3 = jsonObject.get("currentLeftSpec");
//拔管2规格
Object to_spec4 = jsonObject.get("currentRightSpec");
//套管数量
Object to_qty1 = jsonObject.get("casingCount");
//拔管数量
Object to_qty2 = jsonObject.get("pullCount");
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_pull", jsonObject.getString("is_pulling"));
map.put("is_bushing", jsonObject.getString("is_bushing"));
map.put("to_size", jsonObject.getString("qzz_size"));
map.put("to_barcode", jsonObject.getString("qzz_no"));
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", startAddr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_target", nextAddr);
//toTranscription(taskDto,map);
map.put("to_material1", to_material1);
if (ObjectUtil.isNotEmpty(to_material2)) {
map.put("to_material2", to_material2);
if(StrUtil.isNotEmpty(interaction_json) && !"".equals(interaction_json)){
JSONObject jsonObject = JSONObject.parseObject(interaction_json);
//套管1物料
Object to_material1 = jsonObject.get("left");
//套管2物料
Object to_material2 = jsonObject.get("right");
//套管1规格
Object to_spec1 = jsonObject.get("leftSpec");
//套管2规格
Object to_spec2 = jsonObject.get("rightSpec");
//套管1尺寸
Object to_size1 = jsonObject.get("leftSize");
//套管2尺寸
Object to_size2 = jsonObject.get("rightSize");
//拔管1物料
Object to_material3 = jsonObject.get("currentLeft");
//拔管2物料
Object to_material4 = jsonObject.get("currentRight");
//拔管1尺寸
Object to_size3 = jsonObject.get("currentLeftSize");
//拔管2尺寸
Object to_size4 = jsonObject.get("currentRightSize");
//拔管1规格
Object to_spec3 = jsonObject.get("currentLeftSpec");
//拔管2规格
Object to_spec4 = jsonObject.get("currentRightSpec");
//套管数量
Object to_qty1 = jsonObject.get("casingCount");
//拔管数量
Object to_qty2 = jsonObject.get("pullCount");
map.put("to_pull", jsonObject.getString("is_pulling"));
map.put("is_bushing", jsonObject.getString("is_bushing"));
map.put("to_size", jsonObject.getString("qzz_size"));
map.put("to_barcode", jsonObject.getString("qzz_no"));
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", startAddr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_target", nextAddr);
//toTranscription(taskDto,map);
map.put("to_material1", to_material1);
if (ObjectUtil.isNotEmpty(to_material2)) {
map.put("to_material2", to_material2);
}
map.put("to_spec1", to_spec1);
if (ObjectUtil.isNotEmpty(to_spec2)) {
map.put("to_spec2", to_spec2);
}
map.put("to_size1", to_size1);
if (ObjectUtil.isNotEmpty(to_size2)) {
map.put("to_size2", to_size2);
}
map.put("to_material3", to_material3);
if (ObjectUtil.isNotEmpty(to_material4)) {
map.put("to_material4", to_material4);
}
map.put("to_size3", to_size3);
if (ObjectUtil.isNotEmpty(to_size4)) {
map.put("to_size4", to_size4);
}
map.put("to_spec3", to_spec3);
if (ObjectUtil.isNotEmpty(to_spec4)) {
map.put("to_spec4", to_spec4);
}
map.put("to_qty1", to_qty1);
map.put("to_qty2", to_qty2);
return map;
}else{
map.put("to_command", CommonFinalParam.ONE);
map.put("to_onset", startAddr);
map.put("to_task", instdto.getInstruction_code());
map.put("to_target", nextAddr);
return map;
}
map.put("to_spec1", to_spec1);
if (ObjectUtil.isNotEmpty(to_spec2)) {
map.put("to_spec2", to_spec2);
}
map.put("to_size1", to_size1);
if (ObjectUtil.isNotEmpty(to_size2)) {
map.put("to_size2", to_size2);
}
map.put("to_material3", to_material3);
if (ObjectUtil.isNotEmpty(to_material4)) {
map.put("to_material4", to_material4);
}
map.put("to_size3", to_size3);
if (ObjectUtil.isNotEmpty(to_size4)) {
map.put("to_size4", to_size4);
}
map.put("to_spec3", to_spec3);
if (ObjectUtil.isNotEmpty(to_spec4)) {
map.put("to_spec4", to_spec4);
}
map.put("to_qty1", to_qty1);
map.put("to_qty2", to_qty2);
return map;
}
private void toTranscription(TaskDto taskDto,Map map){