fix ssx
This commit is contained in:
@@ -17,6 +17,7 @@ import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.Empty
|
|||||||
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
@@ -162,6 +163,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
HailiangSmartplcTestDeviceDriver hailiangSmartplcTestDeviceDriver;
|
HailiangSmartplcTestDeviceDriver hailiangSmartplcTestDeviceDriver;
|
||||||
HaoKaiAutoConveyorDeviceDriver haoKaiAutoConveyorDeviceDriver;
|
HaoKaiAutoConveyorDeviceDriver haoKaiAutoConveyorDeviceDriver;
|
||||||
PaintConveyorDeviceDriver paintConveyorDeviceDriver;
|
PaintConveyorDeviceDriver paintConveyorDeviceDriver;
|
||||||
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
|
||||||
|
|
||||||
//取货的进入前等待和离开等待
|
//取货的进入前等待和离开等待
|
||||||
if (action.equals("Load")) {
|
if (action.equals("Load")) {
|
||||||
@@ -216,6 +218,15 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
}
|
}
|
||||||
// is_feedback = true;
|
// is_feedback = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (addressdevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||||
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
if (siemensConveyorDeviceDriver.getAction() == 1 && siemensConveyorDeviceDriver.getMove() == 1) {
|
||||||
|
inst.setExecute_status("1");
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
//is_feedback = true;
|
||||||
|
|
||||||
}/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
}/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
} */else {
|
} */else {
|
||||||
@@ -258,7 +269,17 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
if (paintConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 2) {
|
if (paintConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 2) {
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
}
|
}
|
||||||
}/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
}
|
||||||
|
else if (addressdevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||||
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
siemensConveyorDeviceDriver.writing(2,0,0,0);
|
||||||
|
if (siemensConveyorDeviceDriver.getTo_command()==2) {
|
||||||
|
inst.setExecute_status("2");
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
//is_feedback = true;
|
||||||
|
}
|
||||||
|
/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
} */else {
|
} */else {
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
@@ -363,6 +384,15 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
}
|
}
|
||||||
// is_feedback = true;
|
// is_feedback = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (addressdevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||||
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
if (siemensConveyorDeviceDriver.getAction() == 1 && siemensConveyorDeviceDriver.getMove() == 0) {
|
||||||
|
inst.setExecute_status("3");
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
//is_feedback = true;
|
||||||
|
|
||||||
}/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
}/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
} else if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
} else if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||||
@@ -407,6 +437,15 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
|||||||
if (paintConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 3) {
|
if (paintConveyorDeviceDriver.getItemProtocol().getOpcIntegerValue("to_command") == 3) {
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (addressdevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||||
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
siemensConveyorDeviceDriver.writing(3,0,0,0);
|
||||||
|
if (siemensConveyorDeviceDriver.getTo_command()==3) {
|
||||||
|
inst.setExecute_status("4");
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
//is_feedback = true;
|
||||||
}/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
}/* else if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
} else if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
} else if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
message = "有报警";
|
message = "有报警";
|
||||||
//无报警
|
//无报警
|
||||||
} else {
|
} else {
|
||||||
System.out.println("执行到else了");
|
// System.out.println("执行到else了");
|
||||||
this.setIsonline(true);
|
this.setIsonline(true);
|
||||||
this.setIserror(false);
|
this.setIserror(false);
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
@@ -203,26 +203,26 @@ public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//满托入库
|
//满托入库
|
||||||
if (move == 1 && !requireSucessFullIn) {
|
// if (move == 1 && !requireSucessFullIn) {
|
||||||
Date date = new Date();
|
// Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
// if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||||
} else {
|
// } else {
|
||||||
logServer.deviceExecuteLog(device_code, "", "", "满托入库申请开始任务-");
|
// logServer.deviceExecuteLog(device_code, "", "", "满托入库申请开始任务-");
|
||||||
//向LMS发送请求,发送起点
|
// //向LMS发送请求,发送起点
|
||||||
jo.put("type", "2");
|
// jo.put("type", "2");
|
||||||
jo.put("point_code", device_code);
|
// jo.put("point_code", device_code);
|
||||||
jo.put("vehicle_num", "1");
|
// jo.put("vehicle_num", "1");
|
||||||
jo.put("vehicle_type", container_type);
|
// jo.put("vehicle_type", container_type);
|
||||||
jo.put("qty", number);
|
// jo.put("qty", number);
|
||||||
String result = acsToWmsService.applyTaskToWms(jo);
|
// String result = acsToWmsService.applyTaskToWms(jo);
|
||||||
JSONObject res_jo = JSONObject.parseObject(result);
|
// JSONObject res_jo = JSONObject.parseObject(result);
|
||||||
if (res_jo.getString("status").equals("200")) {
|
// if (res_jo.getString("status").equals("200")) {
|
||||||
requireSucessFullIn = true;
|
// requireSucessFullIn = true;
|
||||||
logServer.deviceExecuteLog(device_code, "", "", "满托入库任务申请成功-");
|
// logServer.deviceExecuteLog(device_code, "", "", "满托入库任务申请成功-");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
message = "有报警";
|
message = "有报警";
|
||||||
//无报警
|
//无报警
|
||||||
} else {
|
} else {
|
||||||
System.out.println("进入到else。。。。。设备号:" + device_code + ",mode = " + mode);
|
|
||||||
this.setIsonline(true);
|
this.setIsonline(true);
|
||||||
this.setIserror(false);
|
this.setIserror(false);
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
int last_mode = 0;
|
int last_mode = 0;
|
||||||
//光电信号
|
//光电信号
|
||||||
int move = 0;
|
int move = 0;
|
||||||
|
int action = 0;
|
||||||
|
int last_action = 0;
|
||||||
int last_move = 0;
|
int last_move = 0;
|
||||||
//托盘方向
|
//托盘方向
|
||||||
int carrier_direction = 0;
|
int carrier_direction = 0;
|
||||||
@@ -159,6 +161,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
device_code = this.getDeviceCode();
|
device_code = this.getDeviceCode();
|
||||||
mode = this.itemProtocol.getMode();
|
mode = this.itemProtocol.getMode();
|
||||||
move = this.itemProtocol.getMove();
|
move = this.itemProtocol.getMove();
|
||||||
|
action = this.itemProtocol.getAction();
|
||||||
carrier_direction = this.itemProtocol.getCarrier_direction();
|
carrier_direction = this.itemProtocol.getCarrier_direction();
|
||||||
error = this.itemProtocol.getError();
|
error = this.itemProtocol.getError();
|
||||||
task = this.itemProtocol.getTask();
|
task = this.itemProtocol.getTask();
|
||||||
@@ -174,6 +177,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
// logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat);
|
// logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (action != last_action) {
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action);
|
||||||
|
}
|
||||||
if (to_strap_times != last_to_strap_times) {
|
if (to_strap_times != last_to_strap_times) {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_strap_times:" + last_to_strap_times + "->" + to_strap_times);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_strap_times:" + last_to_strap_times + "->" + to_strap_times);
|
||||||
}
|
}
|
||||||
@@ -202,6 +208,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
}
|
}
|
||||||
if (move != last_move) {
|
if (move != last_move) {
|
||||||
message = null;
|
message = null;
|
||||||
|
requireSucess = false;
|
||||||
if (move == 0) {
|
if (move == 0) {
|
||||||
inst_message = null;
|
inst_message = null;
|
||||||
this.hand_barcode = null;
|
this.hand_barcode = null;
|
||||||
@@ -210,9 +217,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
if (move == 0 && last_move == 1) {
|
if (move == 0 && last_move == 1) {
|
||||||
last_vehicle_code = vehicle_code;
|
last_vehicle_code = vehicle_code;
|
||||||
last_inst_message = inst_message;
|
last_inst_message = inst_message;
|
||||||
if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) {
|
|
||||||
this.requiresShipDeviceUpdate = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||||
@@ -276,6 +280,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
last_action = action;
|
||||||
last_mode = mode;
|
last_mode = mode;
|
||||||
last_move = move;
|
last_move = move;
|
||||||
last_carrier_direction = carrier_direction;
|
last_carrier_direction = carrier_direction;
|
||||||
@@ -302,24 +307,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
|
|
||||||
public void clearWrite() {
|
public void clearWrite() {
|
||||||
|
|
||||||
List list = new ArrayList();
|
this.writing(0,0,0,0);
|
||||||
Map map = new HashMap();
|
|
||||||
map.put("code", "to_target");
|
|
||||||
map.put("value", "0");
|
|
||||||
list.add(map);
|
|
||||||
Map map2 = new HashMap();
|
|
||||||
map2.put("code", "to_task");
|
|
||||||
map2.put("value", "0");
|
|
||||||
list.add(map2);
|
|
||||||
Map map3 = new HashMap();
|
|
||||||
map3.put("code", "to_command");
|
|
||||||
map3.put("value", "0");
|
|
||||||
list.add(map3);
|
|
||||||
Map map4 = new HashMap();
|
|
||||||
map4.put("code", "to_strap_times");
|
|
||||||
map4.put("value", "0");
|
|
||||||
list.add(map4);
|
|
||||||
this.writing(0,0,0);
|
|
||||||
message = null;
|
message = null;
|
||||||
vehicle_code = null;
|
vehicle_code = null;
|
||||||
}
|
}
|
||||||
@@ -339,19 +327,22 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void writing(int command, int target, int task) {
|
public void writing(int command, int task,int target, int container_type) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command;
|
+ "." + ItemProtocol.item_to_command;
|
||||||
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target;
|
+ "." + ItemProtocol.item_to_target;
|
||||||
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task;
|
+ "." + ItemProtocol.item_to_task;
|
||||||
|
String to_container_type = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
|
+ "." + ItemProtocol.item_to_container_type;
|
||||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
Server server = ReadUtil.getServer(opcservcerid);
|
Server server = ReadUtil.getServer(opcservcerid);
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
itemMap.put(to_command, command);
|
itemMap.put(to_command, command);
|
||||||
itemMap.put(to_target, target);
|
itemMap.put(to_target, target);
|
||||||
itemMap.put(to_task, task);
|
itemMap.put(to_task, task);
|
||||||
|
itemMap.put(to_container_type, container_type);
|
||||||
ReadUtil.write(itemMap, server);
|
ReadUtil.write(itemMap, server);
|
||||||
server.disconnect();
|
server.disconnect();
|
||||||
}
|
}
|
||||||
@@ -457,11 +448,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
if (ObjectUtil.isNotEmpty(inst)) {
|
if (ObjectUtil.isNotEmpty(inst)) {
|
||||||
Device next_device = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
Device next_device = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
||||||
String next_addr = next_device.getExtraValue().get("address").toString();
|
String next_addr = next_device.getExtraValue().get("address").toString();
|
||||||
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr));
|
int vehicle_type = 0;
|
||||||
requireSucess = true;
|
if(ObjectUtil.isNotEmpty(taskdto.getVehicle_type())){
|
||||||
|
if(StrUtil.equals("4",taskdto.getVehicle_type())){
|
||||||
|
vehicle_type = 1;
|
||||||
|
} else if (StrUtil.equals("5",taskdto.getVehicle_type())){
|
||||||
|
vehicle_type = 2;
|
||||||
|
} else if (StrUtil.equals("6",taskdto.getVehicle_type())){
|
||||||
|
vehicle_type = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr),vehicle_type);
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
, inst.getInstruction_code())) {
|
, inst.getInstruction_code())) {
|
||||||
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr));
|
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr),vehicle_type);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
@@ -535,6 +535,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
instdto.setTask_id(taskid);
|
instdto.setTask_id(taskid);
|
||||||
instdto.setTask_code(taskcode);
|
instdto.setTask_code(taskcode);
|
||||||
instdto.setVehicle_code(vehiclecode);
|
instdto.setVehicle_code(vehiclecode);
|
||||||
|
instdto.setVehicle_type(taskdto.getVehicle_type());
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
instdto.setCreate_time(now);
|
instdto.setCreate_time(now);
|
||||||
instdto.setCreate_by("auto");
|
instdto.setCreate_by("auto");
|
||||||
@@ -555,14 +556,24 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
//创建指令后修改任务状态
|
//创建指令后修改任务状态
|
||||||
taskdto.setTask_status("1");
|
taskdto.setTask_status("1");
|
||||||
taskserver.update(taskdto);
|
taskserver.update(taskdto);
|
||||||
requireSucess = true;
|
|
||||||
Device next_device = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
Device next_device = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
||||||
String next_addr = next_device.getExtraValue().get("address").toString();
|
String next_addr = next_device.getExtraValue().get("address").toString();
|
||||||
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr));
|
|
||||||
requireSucess = true;
|
int vehicle_type = 0;
|
||||||
|
if(ObjectUtil.isNotEmpty(taskdto.getVehicle_type())){
|
||||||
|
if(StrUtil.equals("4",taskdto.getVehicle_type())){
|
||||||
|
vehicle_type = 1;
|
||||||
|
} else if (StrUtil.equals("5",taskdto.getVehicle_type())){
|
||||||
|
vehicle_type = 2;
|
||||||
|
} else if (StrUtil.equals("6",taskdto.getVehicle_type())){
|
||||||
|
vehicle_type = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr),vehicle_type);
|
||||||
|
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
, instdto.getInstruction_code())) {
|
, instdto.getInstruction_code())) {
|
||||||
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr));
|
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr),vehicle_type);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
@@ -574,6 +585,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
requireSucess = true;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//如果不存在则直接找对应指令
|
//如果不存在则直接找对应指令
|
||||||
@@ -585,11 +598,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
||||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||||
|
|
||||||
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr));
|
int vehicle_type = 0;
|
||||||
requireSucess = true;
|
if(ObjectUtil.isNotEmpty(inst.getVehicle_type())){
|
||||||
|
if(StrUtil.equals("4",inst.getVehicle_type())){
|
||||||
|
vehicle_type = 1;
|
||||||
|
} else if (StrUtil.equals("5",inst.getVehicle_type())){
|
||||||
|
vehicle_type = 2;
|
||||||
|
} else if (StrUtil.equals("6",inst.getVehicle_type())){
|
||||||
|
vehicle_type = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr),vehicle_type);
|
||||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||||
, inst.getInstruction_code())) {
|
, inst.getInstruction_code())) {
|
||||||
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr));
|
this.writing(1,Integer.parseInt(inst.getInstruction_code()),Integer.parseInt(next_addr),vehicle_type);
|
||||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号");
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
@@ -601,6 +623,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
requireSucess = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public interface OpcDeviceDriver extends DeviceDriver {
|
|||||||
|
|
||||||
//设备扩展表【acs_device_extra】
|
//设备扩展表【acs_device_extra】
|
||||||
WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
|
WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
|
||||||
JSONArray arr = extraTab.query("filed_type='02' and device_id = '" + this.getDevice().getDevice_id() + "'").getResultJSONArray(0);
|
JSONArray arr = extraTab.query(" (filed_type='02' or filed_type='03' )and device_id = '" + this.getDevice().getDevice_id() + "'").getResultJSONArray(0);
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
JSONObject json = arr.getJSONObject(i);
|
JSONObject json = arr.getJSONObject(i);
|
||||||
OpcItemDto dto = new OpcItemDto();
|
OpcItemDto dto = new OpcItemDto();
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ public class InstructionDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 载具类型
|
* 载具类型
|
||||||
*/
|
*/
|
||||||
private String vehicle_type;
|
private String vehicle_type ="0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* agv车号
|
* agv车号
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
log.error("创建指令:任务号:{},起点:{},终点:{},message:{}", task_code, start_device_code, next_device_code, "当前叠盘架:" + dto.getStart_device_code() + "叠盘数为0!");
|
log.error("创建指令:任务号:{},起点:{},终点:{},message:{}", task_code, start_device_code, next_device_code, "当前叠盘架:" + dto.getStart_device_code() + "叠盘数为0!");
|
||||||
throw new BadRequestException("当前叠盘架:" + dto.getStart_device_code() + "叠盘数为0!");
|
throw new BadRequestException("当前叠盘架:" + dto.getStart_device_code() + "叠盘数为0!");
|
||||||
}
|
}
|
||||||
dto.setStart_device_code(start_device_code + "." + i);
|
dto.setStart_device_code(start_device_code);
|
||||||
dto.setStart_parent_code(start_device_code + "." + i);
|
dto.setStart_parent_code(start_device_code + "." + i);
|
||||||
dto.setStart_point_code(start_device_code + "." + i);
|
dto.setStart_point_code(start_device_code + "." + i);
|
||||||
}
|
}
|
||||||
@@ -473,7 +473,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
|||||||
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "该任务需要放的托盘数量加原有的托盘数量之和大于叠盘架最大数量!");
|
logServer.createInstInfo("创建指令", task_code, start_device_code, next_device_code, "该任务需要放的托盘数量加原有的托盘数量之和大于叠盘架最大数量!");
|
||||||
throw new BadRequestException("当前叠盘架:" + dto.getStart_device_code() + "超出最大叠盘数量!");
|
throw new BadRequestException("当前叠盘架:" + dto.getStart_device_code() + "超出最大叠盘数量!");
|
||||||
}
|
}
|
||||||
dto.setNext_device_code(next_device_code + "." + i);
|
dto.setNext_device_code(next_device_code);
|
||||||
dto.setNext_parent_code(next_device_code + "." + i);
|
dto.setNext_parent_code(next_device_code + "." + i);
|
||||||
dto.setNext_point_code(next_device_code + "." + i);
|
dto.setNext_point_code(next_device_code + "." + i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
try {
|
try {
|
||||||
itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
System.out.println("数据同步异常:"+ this.getOpcServer().getOpc_code());
|
// System.out.println("数据同步异常:"+ this.getOpcServer().getOpc_code());
|
||||||
log.trace("数据同步异常:{}", this.getOpcServer().getOpc_code());
|
log.trace("数据同步异常:{}", this.getOpcServer().getOpc_code());
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
log.trace("{} 开始记时{}", tag, DateUtil.now());
|
log.trace("{} 开始记时{}", tag, DateUtil.now());
|
||||||
long duration = end - begin;
|
long duration = end - begin;
|
||||||
log.trace("{} 读取耗时:{}", tag, duration);
|
log.trace("{} 读取耗时:{}", tag, duration);
|
||||||
System.out.println("线程:"+tag + " 读取耗时:"+ duration);
|
// System.out.println("线程:"+tag + " 读取耗时:"+ duration);
|
||||||
if (duration > 1000L) {
|
if (duration > 1000L) {
|
||||||
if (!time_out) {
|
if (!time_out) {
|
||||||
log.warn(" {} 读取超时 : {}", tag, duration);
|
log.warn(" {} 读取超时 : {}", tag, duration);
|
||||||
@@ -140,7 +140,7 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ObjectUtil.isEmpty(itemStatus)) {
|
if(ObjectUtil.isEmpty(itemStatus)) {
|
||||||
System.out.println( tag + " :itemStatus is null");
|
// System.out.println( tag + " :itemStatus is null");
|
||||||
log.warn(" {} 读取异常 : {} itemStatus is null", tag);
|
log.warn(" {} 读取异常 : {} itemStatus is null", tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class TaskDto implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 载具类型
|
* 载具类型
|
||||||
*/
|
*/
|
||||||
private String vehicle_type;
|
private String vehicle_type ="0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务类型
|
* 任务类型
|
||||||
|
|||||||
Reference in New Issue
Block a user