add : 测试入库
This commit is contained in:
@@ -204,7 +204,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
break;
|
||||
case 2:
|
||||
//申请任务
|
||||
if (move > 0 && !requireSucess) {
|
||||
if (move > 0 && task == 0 && !requireSucess) {
|
||||
instruction_require();
|
||||
}
|
||||
break;
|
||||
@@ -283,7 +283,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
if (mode == 2) {
|
||||
finish_instruction();
|
||||
|
||||
@@ -134,15 +134,7 @@ public class ItemProtocol {
|
||||
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (StrUtil.isEmpty(value)) {
|
||||
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.one_conveyor.scanner_weight_conveyor;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -355,6 +356,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
String route_plan_code = taskdto.getRoute_plan_code();
|
||||
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(taskdto.getStart_device_code(), taskdto.getNext_device_code(), route_plan_code);
|
||||
if (CollectionUtil.isEmpty(shortPathsList)){
|
||||
return false;
|
||||
}
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
String path = routeLineDto.getPath();
|
||||
String[] str = path.split("->");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.one_conveyor.scanner_weight_conveyor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
@@ -153,13 +154,13 @@ public class ItemProtocol {
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (value == null) {
|
||||
if (StrUtil.isBlank(value)) {
|
||||
//throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)});
|
||||
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
return "0";
|
||||
}
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
|
||||
@@ -265,14 +265,17 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
|
||||
//放货完成
|
||||
if (mode == 3 && action == 4 && move == 0) {
|
||||
if ( action == 4 && move == 0) {
|
||||
if (inst != null) {
|
||||
try {
|
||||
logServer.deviceExecuteLog(this.device_code,"","","放货完成");
|
||||
finish_instruction(inst);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 5);
|
||||
this.writing(map);
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 5);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
message = "放货完成";
|
||||
} catch (Exception e) {
|
||||
message = "放货失败";
|
||||
@@ -351,27 +354,51 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
|
||||
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 1);
|
||||
map.put("to_target", next_addr);
|
||||
map.put("to_onset", start_addr);
|
||||
map.put("to_task", instdto.getInstruction_code());
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 1);
|
||||
list.add(map1);
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("code", "to_target");
|
||||
map2.put("value", next_addr);
|
||||
list.add(map2);
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("code", "to_onset");
|
||||
map3.put("value", start_addr);
|
||||
list.add(map3);
|
||||
Map<String, Object> map4 = new HashMap<>();
|
||||
map4.put("code", "to_task");
|
||||
map4.put("value", instdto.getInstruction_code());
|
||||
list.add(map4);
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getItem_to_seq())) {
|
||||
map.put("to_seq", interactionJsonDTO.getItem_to_seq());
|
||||
Map<String, Object> map5 = new HashMap<>();
|
||||
map5.put("code", "to_seq");
|
||||
map5.put("value", interactionJsonDTO.getItem_to_seq());
|
||||
list.add(map5);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getItem_to_last_one())) {
|
||||
map.put("to_last_one", interactionJsonDTO.getItem_to_last_one());
|
||||
Map<String, Object> map6 = new HashMap<>();
|
||||
map6.put("code", "to_last_one");
|
||||
map6.put("value", interactionJsonDTO.getItem_to_last_one());
|
||||
list.add(map6);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getItem_to_direction())) {
|
||||
map.put("to_direction", interactionJsonDTO.getItem_to_direction());
|
||||
Map<String, Object> map7 = new HashMap<>();
|
||||
map7.put("code", "to_direction");
|
||||
map7.put("value", interactionJsonDTO.getItem_to_direction());
|
||||
list.add(map7);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getItem_to_max_no())) {
|
||||
map.put("to_max_no", interactionJsonDTO.getItem_to_max_no());
|
||||
Map<String, Object> map8 = new HashMap<>();
|
||||
map8.put("code", "to_max_no");
|
||||
map8.put("value", interactionJsonDTO.getItem_to_max_no());
|
||||
list.add(map8);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
this.writing(map);
|
||||
this.writing(list);
|
||||
} catch (Exception e) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||
@@ -394,24 +421,33 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
/**
|
||||
* 下发
|
||||
* @param map
|
||||
*
|
||||
*/
|
||||
public void writing(Map<String, Object> map) {
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
itemMap.put(getToParam() + key, value);
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object ob = list.get(i);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + json.getString("code");
|
||||
itemMap.put(to_param, json.getString("value"));
|
||||
}
|
||||
});
|
||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||
}
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -89,8 +89,8 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
int last_to_task = 0;
|
||||
int to_layer = 0;
|
||||
int last_to_layer = 0;
|
||||
int to_barcode = 0;
|
||||
int last_to_barcode = 0;
|
||||
String to_barcode = null;
|
||||
String last_to_barcode = null;
|
||||
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
@@ -246,9 +246,12 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
try {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "放货完成");
|
||||
finish_instruction(inst);
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 5);
|
||||
this.writing(map);
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 5);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
message = "放货完成";
|
||||
} catch (Exception e) {
|
||||
message = "放货失败";
|
||||
@@ -325,9 +328,6 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
//创建指令后修改任务状态
|
||||
taskDto.setTask_status("1");
|
||||
taskserver.update(taskDto);
|
||||
} catch (Exception e) {
|
||||
notCreateInstMessage = e.getMessage();
|
||||
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
|
||||
@@ -336,32 +336,61 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||
+ ",指令终点:" + instdto.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString());
|
||||
//创建指令后修改任务状态
|
||||
taskDto.setTask_status("1");
|
||||
taskserver.update(taskDto);
|
||||
requireSucess = true;
|
||||
|
||||
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command", 1);
|
||||
map.put("to_target", next_addr);
|
||||
map.put("to_onset", start_addr);
|
||||
map.put("to_task", instdto.getInstruction_code());
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 1);
|
||||
list.add(map1);
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("code", "to_target");
|
||||
map2.put("value", next_addr);
|
||||
list.add(map2);
|
||||
Map<String, Object> map3 = new HashMap<>();
|
||||
map3.put("code", "to_onset");
|
||||
map3.put("value", start_addr);
|
||||
list.add(map3);
|
||||
Map<String, Object> map4 = new HashMap<>();
|
||||
map4.put("code", "to_task");
|
||||
map4.put("value", instdto.getInstruction_code());
|
||||
list.add(map4);
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTo_weight())) {
|
||||
map.put("to_wedth", interactionJsonDTO.getTo_weight());
|
||||
Map<String, Object> map5 = new HashMap<>();
|
||||
map5.put("code", "to_weight");
|
||||
map5.put("value", interactionJsonDTO.getTo_weight());
|
||||
list.add(map5);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTo_length())) {
|
||||
map.put("to_length", interactionJsonDTO.getTo_length());
|
||||
Map<String, Object> map6 = new HashMap<>();
|
||||
map6.put("code", "to_length");
|
||||
map6.put("value", interactionJsonDTO.getTo_length());
|
||||
list.add(map6);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTo_height())) {
|
||||
map.put("to_height", interactionJsonDTO.getTo_height());
|
||||
Map<String, Object> map7 = new HashMap<>();
|
||||
map7.put("code", "to_height");
|
||||
map7.put("value", interactionJsonDTO.getTo_height());
|
||||
list.add(map7);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTo_barcode())) {
|
||||
map.put("to_barcode", interactionJsonDTO.getTo_barcode());
|
||||
Map<String, Object> map8 = new HashMap<>();
|
||||
map8.put("code", "to_barcode");
|
||||
map8.put("value", interactionJsonDTO.getTo_barcode());
|
||||
list.add(map8);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTo_layer())) {
|
||||
map.put("to_layer", interactionJsonDTO.getTo_layer());
|
||||
Map<String, Object> map9 = new HashMap<>();
|
||||
map9.put("code", "to_layer");
|
||||
map9.put("value", interactionJsonDTO.getTo_layer());
|
||||
list.add(map9);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
this.writing(map);
|
||||
this.writing(list);
|
||||
} catch (Exception e) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
|
||||
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
|
||||
@@ -378,18 +407,32 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
}
|
||||
|
||||
public void writing(Map<String, Object> map) {
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
itemMap.put(getToParam() + key, value);
|
||||
|
||||
|
||||
public void writing(List list) {
|
||||
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object ob = list.get(i);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(ob);
|
||||
if (!StrUtil.isEmpty(json.getString("value"))) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + json.getString("code");
|
||||
itemMap.put(to_param, json.getString("value"));
|
||||
}
|
||||
});
|
||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||
this.control(itemMap);
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
}
|
||||
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap);
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.one_manipulator.box_storage_manipulator;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
@@ -132,8 +133,8 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_layer);
|
||||
}
|
||||
|
||||
public int getTo_barcode() {
|
||||
return this.getOpcIntegerValue(item_to_barcode);
|
||||
public String getTo_barcode() {
|
||||
return this.getOpcStringValue(item_to_barcode);
|
||||
}
|
||||
|
||||
public int getTo_command() {
|
||||
@@ -160,6 +161,16 @@ public class ItemProtocol {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getOpcStringValue(String protocol) {
|
||||
String value = this.driver.getStringValue(protocol);
|
||||
if (StrUtil.isBlank(value)) {
|
||||
// log.error("读取错误!");
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
|
||||
@@ -169,8 +180,6 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
|
||||
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
|
||||
list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB1.B7"));
|
||||
list.add(new ItemDto(item_to_layer, "下发木箱层数", "DB1.B8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -183,6 +192,8 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W14"));
|
||||
list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W16"));
|
||||
list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W18"));
|
||||
list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB601.STRING1.50"));
|
||||
list.add(new ItemDto(item_to_layer, "下发木箱层数", "DB601.W22"));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user