add: 堆垛机开发
This commit is contained in:
@@ -39,7 +39,7 @@ public enum DriverTypeEnum {
|
|||||||
|
|
||||||
LED_SCREEN(15, "led_screen", "LED点阵屏", "screen"),
|
LED_SCREEN(15, "led_screen", "LED点阵屏", "screen"),
|
||||||
|
|
||||||
DOUBLE_STATION_STACKER(16, "double_station_stacker", "双工位堆垛机", "double_station_stacker");
|
DOUBLE_STATION_STACKER(16, "double_station_stacker", "标准版-双工位堆垛机", "double_station_stacker");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ public class DoubleStationStackerDefination implements OpcDeviceDriverDefination
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverName() {
|
public String getDriverName() {
|
||||||
return "双工位堆垛机";
|
return "标准版-双工位堆垛机";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverDescription() {
|
public String getDriverDescription() {
|
||||||
return "双工位堆垛机";
|
return "标准版-双工位堆垛机";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic
|
|||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.instruction.domain.Instruction;
|
import org.nl.acs.instruction.domain.Instruction;
|
||||||
|
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
@@ -65,64 +66,93 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
//工作模式
|
//工作模式
|
||||||
Integer mode = 0;
|
Integer mode = 0;
|
||||||
Integer last_mode = 0;
|
Integer last_mode = 0;
|
||||||
//作业状态
|
|
||||||
Integer command = 0;
|
|
||||||
Integer last_command = 0;
|
|
||||||
//任务号
|
|
||||||
Integer task = 0;
|
|
||||||
Integer last_task = 0;
|
|
||||||
//y轴报警(载货台)
|
|
||||||
Integer error = 0;
|
|
||||||
Integer last_error = 0;
|
|
||||||
//行走排号
|
|
||||||
Integer z = 0;
|
|
||||||
Integer last_z = 0;
|
|
||||||
//行走列号
|
|
||||||
Integer x = null;
|
|
||||||
Integer last_x = null;
|
|
||||||
//行走层号
|
|
||||||
Integer y = 0;
|
|
||||||
Integer last_y = 0;
|
|
||||||
//行走开关信号
|
//行走开关信号
|
||||||
Float move = 0F;
|
Float move = 0F;
|
||||||
Float last_move = 0F;
|
Float last_move = 0F;
|
||||||
//载货台开关信号
|
|
||||||
Float cargoMove = 0F;
|
|
||||||
Float last_cargoMove = 0F;
|
|
||||||
//行走动作信号
|
//行走动作信号
|
||||||
Float action = 0F;
|
Float action = 0F;
|
||||||
Float last_action = 0F;
|
Float last_action = 0F;
|
||||||
|
//前叉作业状态
|
||||||
|
Integer front_command = 0;
|
||||||
|
Integer last_front_command = 0;
|
||||||
|
//前叉任务号
|
||||||
|
Integer front_task = 0;
|
||||||
|
Integer last_front_task = 0;
|
||||||
|
|
||||||
//行走激光数值
|
//行走激光数值
|
||||||
Integer distancex = 0;
|
Integer distancex = 0;
|
||||||
Integer last_distancex = 0;
|
Integer last_distancex = 0;
|
||||||
//起升激光数值
|
|
||||||
Integer distancey = 0;
|
|
||||||
Integer last_distancey = 0;
|
|
||||||
//载货台超限信号
|
|
||||||
Float cargoError = 0F;
|
|
||||||
Float last_cargoError = 0F;
|
|
||||||
//货叉探货信号
|
|
||||||
Float forkCargo = 0F;
|
|
||||||
Float last_forkCargo = 0F;
|
|
||||||
//货叉位置信号
|
|
||||||
Float forkLocation = 0F;
|
|
||||||
Float last_forkLocation = 0F;
|
|
||||||
//货叉动作信号
|
|
||||||
Float forkAction = 0F;
|
|
||||||
Float last_forkAction = 0F;
|
|
||||||
//特殊开关量1
|
//特殊开关量1
|
||||||
Float special1 = 0F;
|
Float special1 = 0F;
|
||||||
Float last_special1 = 0F;
|
Float last_special1 = 0F;
|
||||||
//特殊开关量2
|
//特殊开关量2
|
||||||
Float special2 = 0F;
|
Float special2 = 0F;
|
||||||
Float last_special2 = 0F;
|
Float last_special2 = 0F;
|
||||||
//托盘条码
|
|
||||||
int[] trayCode;
|
|
||||||
int[] last_trayCode;
|
|
||||||
//水箱和消防缓存位有无货
|
//水箱和消防缓存位有无货
|
||||||
Float storage_cache = 0F;
|
Float storage_cache = 0F;
|
||||||
Float last_storage_cache = 0F;
|
Float last_storage_cache = 0F;
|
||||||
|
|
||||||
|
|
||||||
|
//后叉作业状态
|
||||||
|
Integer back_command = 0;
|
||||||
|
Integer last_back_command = 0;
|
||||||
|
//后叉任务号
|
||||||
|
Integer back_task = 0;
|
||||||
|
Integer last_back_task = 0;
|
||||||
|
|
||||||
|
//前叉Z轴报警(货叉)
|
||||||
|
Integer front_ZError = 0;
|
||||||
|
Integer last_front_ZError = 0;
|
||||||
|
//后叉Z轴报警(货叉)
|
||||||
|
Integer back_ZError = 0;
|
||||||
|
Integer last_back_ZError = 0;
|
||||||
|
|
||||||
|
//前叉行走排号
|
||||||
|
Integer front_z = 0;
|
||||||
|
Integer last_front_z = 0;
|
||||||
|
//前行走列号
|
||||||
|
Integer front_x = 0;
|
||||||
|
Integer last_front_x = 0;
|
||||||
|
//前行走层号
|
||||||
|
Integer front_y = 0;
|
||||||
|
Integer last_front_y = 0;
|
||||||
|
//后叉行走排号
|
||||||
|
Integer back_z = 0;
|
||||||
|
Integer last_back_z = 0;
|
||||||
|
//后行走列号
|
||||||
|
Integer back_x = 0;
|
||||||
|
Integer last_back_x = 0;
|
||||||
|
//后行走层号
|
||||||
|
Integer back_y = 0;
|
||||||
|
Integer last_back_y = 0;
|
||||||
|
|
||||||
|
//前货叉探货信号
|
||||||
|
Float front_forkCargo = 0F;
|
||||||
|
Float last_front_forkCargo = 0F;
|
||||||
|
|
||||||
|
//后货叉探货信号
|
||||||
|
Float back_forkCargo = 0F;
|
||||||
|
Float last_back_forkCargo = 0F;
|
||||||
|
|
||||||
|
|
||||||
|
//前货叉位置信号
|
||||||
|
Float front_forkLocation = 0F;
|
||||||
|
Float last_front_forkLocation = 0F;
|
||||||
|
//后货叉位置信号
|
||||||
|
Float back_forkLocation = 0F;
|
||||||
|
Float last_back_forkLocation = 0F;
|
||||||
|
|
||||||
|
//前货叉动作信号
|
||||||
|
Float front_forkAction = 0F;
|
||||||
|
Float last_front_forkAction = 0F;
|
||||||
|
//后货叉动作信号
|
||||||
|
Float back_forkAction = 0F;
|
||||||
|
Float last_back_forkAction = 0F;
|
||||||
|
|
||||||
|
|
||||||
String message = null;
|
String message = null;
|
||||||
|
|
||||||
String device_code = null;
|
String device_code = null;
|
||||||
@@ -139,9 +169,6 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
//请求成功标记
|
//请求成功标记
|
||||||
Boolean requireSucess = false;
|
Boolean requireSucess = false;
|
||||||
|
|
||||||
//当前指令
|
|
||||||
Instruction inst = null;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Device getDevice() {
|
public Device getDevice() {
|
||||||
@@ -151,128 +178,14 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
@Override
|
@Override
|
||||||
public void execute() throws Exception {
|
public void execute() throws Exception {
|
||||||
try {
|
try {
|
||||||
device_code = this.getDeviceCode();
|
//设置参数
|
||||||
heartbeat = this.itemProtocol.getItem_heartbeat();
|
setData();
|
||||||
item_deviceCode = this.itemProtocol.getItem_deviceCode();
|
|
||||||
mode = this.itemProtocol.getItem_mode();
|
|
||||||
|
|
||||||
move = this.itemProtocol.getItem_move();
|
//记录日志
|
||||||
special1 = this.itemProtocol.getItem_special1();
|
setLog();
|
||||||
special2 = this.itemProtocol.getItem_special2();
|
|
||||||
storage_cache = this.itemProtocol.getItem_storage_cache();
|
|
||||||
|
|
||||||
|
//更新指令状态
|
||||||
if (!item_deviceCode.equals(last_item_deviceCode)) {
|
updateAllstatues();
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(item_deviceCode));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_item_deviceCode + "->" + item_deviceCode);
|
|
||||||
}
|
|
||||||
if (!mode.equals(last_mode)) {
|
|
||||||
requireSucess = false;
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
|
||||||
}
|
|
||||||
if (!command.equals(last_command)) {
|
|
||||||
requireSucess = false;
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(command));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_command + "->" + command);
|
|
||||||
}
|
|
||||||
if (!task.equals(last_task)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_task + "->" + task);
|
|
||||||
}
|
|
||||||
if (!error.equals(last_error)) {
|
|
||||||
if (0 != error) {
|
|
||||||
}
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(error));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_error + "->" + error);
|
|
||||||
}
|
|
||||||
if (!z.equals(last_z)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(z));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_z + "->" + z);
|
|
||||||
}
|
|
||||||
if (!x.equals(last_x)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(x));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_x + "->" + x);
|
|
||||||
}
|
|
||||||
if (!y.equals(last_y)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(y));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_y + "->" + y);
|
|
||||||
}
|
|
||||||
if (!move.equals(last_move)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(move));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_move + "->" + move);
|
|
||||||
}
|
|
||||||
if (!cargoMove.equals(last_cargoMove)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(cargoMove));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_cargoMove + "->" + cargoMove);
|
|
||||||
}
|
|
||||||
if (!action.equals(last_action)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(action));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_action + "->" + action);
|
|
||||||
}
|
|
||||||
if (!distancex.equals(last_distancex)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(distancex));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_distancex + "->" + distancex);
|
|
||||||
}
|
|
||||||
if (!distancey.equals(last_distancey)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(distancey));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_distancey + "->" + distancey);
|
|
||||||
}
|
|
||||||
if (!cargoError.equals(last_cargoError)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(cargoError));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_cargoError + "->" + cargoError);
|
|
||||||
}
|
|
||||||
if (!forkCargo.equals(last_forkCargo)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(forkCargo));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_forkCargo + "->" + forkCargo);
|
|
||||||
}
|
|
||||||
if (!forkLocation.equals(last_forkLocation)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(forkLocation));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_forkLocation + "->" + forkLocation);
|
|
||||||
}
|
|
||||||
if (!forkAction.equals(last_forkAction)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(forkAction));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_forkAction + "->" + forkAction);
|
|
||||||
}
|
|
||||||
if (!special1.equals(last_special1)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(special1));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_special1 + "->" + special1);
|
|
||||||
}
|
|
||||||
if (!special2.equals(last_special2)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(special2));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_special2 + "->" + special2);
|
|
||||||
}
|
|
||||||
if (!Arrays.equals(trayCode, last_trayCode)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", Arrays.toString(trayCode));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + Arrays.toString(last_trayCode) + "->" + Arrays.toString(trayCode));
|
|
||||||
}
|
|
||||||
if (!storage_cache.equals(last_storage_cache)) {
|
|
||||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(storage_cache));
|
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_storage_cache + "->" + storage_cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 更新指令状态
|
|
||||||
if (mode == 3 && task > 0) {
|
|
||||||
Date date = new Date();
|
|
||||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.instruction_update_time = date;
|
|
||||||
//更改指令状态
|
|
||||||
if (task > 0) {
|
|
||||||
Instruction inst = checkInst();
|
|
||||||
if (inst != null) {
|
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
|
||||||
inst.setInstruction_status("1");
|
|
||||||
inst.setExecute_device_code(this.device_code);
|
|
||||||
instructionService.update(inst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
var17.printStackTrace();
|
var17.printStackTrace();
|
||||||
@@ -282,30 +195,16 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
|
|
||||||
if (mode != 3) {
|
if (mode != 3) {
|
||||||
message = "未联机";
|
message = "未联机";
|
||||||
|
} else if (front_ZError != 0 || back_ZError != 0) {
|
||||||
} else if (error != 0) {
|
|
||||||
message = "有报警";
|
message = "有报警";
|
||||||
//指定库位满入
|
|
||||||
if (error == 5) {
|
|
||||||
|
|
||||||
}
|
|
||||||
//空出
|
|
||||||
if (error == 6) {
|
|
||||||
|
|
||||||
}
|
|
||||||
//浅货位有货
|
|
||||||
if (error == 16) {
|
|
||||||
//放货
|
|
||||||
if (cargoMove == 1) {
|
|
||||||
|
|
||||||
} else if (cargoMove == 0) {
|
|
||||||
//取货
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
HashMap map = new HashMap();
|
HashMap map = new HashMap();
|
||||||
|
if ( front_command == 0 || back_command ==0 ){
|
||||||
|
applyTask();
|
||||||
|
requireSucess = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 0:
|
case 0:
|
||||||
applyTask();
|
applyTask();
|
||||||
@@ -408,39 +307,80 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
last_heartbeat = heartbeat;
|
last_heartbeat = heartbeat;
|
||||||
last_item_deviceCode = item_deviceCode;
|
last_item_deviceCode = item_deviceCode;
|
||||||
last_mode = mode;
|
last_mode = mode;
|
||||||
last_command = command;
|
last_front_command = front_command;
|
||||||
last_task = task;
|
last_back_command = back_command;
|
||||||
last_error = error;
|
last_front_task = front_task;
|
||||||
last_z = z;
|
last_back_task = back_task;
|
||||||
last_x = x;
|
|
||||||
last_y = y;
|
|
||||||
last_move = move;
|
last_move = move;
|
||||||
last_cargoMove = cargoMove;
|
last_front_ZError = front_ZError;
|
||||||
|
last_back_ZError = back_ZError;
|
||||||
|
last_front_z = front_z;
|
||||||
|
last_back_z = back_z;
|
||||||
|
last_front_x = front_x;
|
||||||
|
last_back_x = back_x;
|
||||||
|
last_front_y = front_y;
|
||||||
|
last_back_y = back_y;
|
||||||
last_action = action;
|
last_action = action;
|
||||||
last_distancex = distancex;
|
last_distancex = distancex;
|
||||||
last_distancey = distancey;
|
last_front_forkCargo = front_forkCargo;
|
||||||
last_cargoError = cargoError;
|
last_back_forkCargo = back_forkCargo;
|
||||||
last_forkCargo = forkCargo;
|
last_front_forkLocation = front_forkLocation;
|
||||||
last_forkLocation = forkLocation;
|
last_back_forkLocation = back_forkLocation;
|
||||||
last_forkAction = forkAction;
|
last_front_forkAction = front_forkAction;
|
||||||
|
last_back_forkAction = back_forkAction;
|
||||||
last_special1 = special1;
|
last_special1 = special1;
|
||||||
last_special2 = special2;
|
last_special2 = special2;
|
||||||
last_trayCode = trayCode;
|
|
||||||
last_storage_cache = storage_cache;
|
last_storage_cache = storage_cache;
|
||||||
/*last_stacker_rpm = stacker_rpm;
|
|
||||||
last_stacker_electricCurrent = stacker_electricCurrent;
|
|
||||||
last_stacker_runing_time = stacker_runing_time;
|
|
||||||
last_stacker_workingHours = stacker_workingHours;
|
|
||||||
last_cargo_rpm = cargo_rpm;
|
|
||||||
last_cargo_electric_Current = cargo_electric_Current;
|
|
||||||
last_cargo_workingHour = cargo_workingHour;
|
|
||||||
last_cargo_runingTimes = cargo_runingTimes;
|
|
||||||
last_fork_rpm = fork_rpm;
|
|
||||||
last_fork_electric_Current = fork_electric_Current;
|
|
||||||
last_fork_workingHours = fork_workingHours;
|
|
||||||
last_fork_runingTimes = fork_runingTimes;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAllstatues() {
|
||||||
|
if (mode == 3 && front_task > 0) {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
updateInstructionStatus(front_task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == 3 && back_task > 0) {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
//更改指令状态
|
||||||
|
updateInstructionStatus(back_task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode == 3 && back_task > 0 && front_task > 0) {
|
||||||
|
Date date = new Date();
|
||||||
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.instruction_update_time = date;
|
||||||
|
//更改指令状态
|
||||||
|
updateInstructionStatus(front_task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateInstructionStatus(Integer task) {
|
||||||
|
if (task > 0) {
|
||||||
|
Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||||
|
if (inst != null) {
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||||
|
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||||
|
inst.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请任务
|
* 申请任务
|
||||||
@@ -491,6 +431,12 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
instructionList = this.sortInst(instructionList);
|
instructionList = this.sortInst(instructionList);
|
||||||
|
|
||||||
|
//筛选符合条件的指令
|
||||||
|
for (Instruction instruction : instructionList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
inst = instructionList.get(0);
|
inst = instructionList.get(0);
|
||||||
//指令未执行
|
//指令未执行
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||||
@@ -710,21 +656,148 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
|
|||||||
return devicesList;
|
return devicesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction checkInst() {
|
private void setData() {
|
||||||
if (ObjectUtil.isNotEmpty(this.inst)) {
|
device_code = this.getDeviceCode();
|
||||||
if (this.task > 0) {
|
heartbeat = this.itemProtocol.getItem_heartbeat();
|
||||||
if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
|
item_deviceCode = this.itemProtocol.getItem_deviceCode();
|
||||||
return this.inst;
|
mode = this.itemProtocol.getItem_mode();
|
||||||
} else {
|
move = this.itemProtocol.getItem_move();
|
||||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
front_command = this.itemProtocol.getItem_front_command();
|
||||||
return inst;
|
back_command = this.itemProtocol.getItem_back_command();
|
||||||
}
|
front_task = this.itemProtocol.getItem_front_task();
|
||||||
}
|
front_ZError = this.itemProtocol.getItem_front_ZError();
|
||||||
} else {
|
back_ZError = this.itemProtocol.getItem_back_ZError();
|
||||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
front_z = this.itemProtocol.getItem_front_z();
|
||||||
return inst;
|
front_x = this.itemProtocol.getItem_front_x();
|
||||||
}
|
front_y = this.itemProtocol.getItem_front_y();
|
||||||
return null;
|
back_z = this.itemProtocol.getItem_back_z();
|
||||||
|
back_x = this.itemProtocol.getItem_back_x();
|
||||||
|
back_y = this.itemProtocol.getItem_back_y();
|
||||||
|
front_forkCargo = this.itemProtocol.getItem_front_forkCargo();
|
||||||
|
back_forkCargo = this.itemProtocol.getItem_back_forkCargo();
|
||||||
|
front_forkLocation = this.itemProtocol.getItem_front_forkLocation();
|
||||||
|
back_forkLocation = this.itemProtocol.getItem_back_forkLocation();
|
||||||
|
back_forkAction = this.itemProtocol.getItem_back_forkAction();
|
||||||
|
front_forkAction = this.itemProtocol.getItem_front_forkAction();
|
||||||
|
special1 = this.itemProtocol.getItem_special1();
|
||||||
|
special2 = this.itemProtocol.getItem_special2();
|
||||||
|
storage_cache = this.itemProtocol.getItem_storage_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setLog() {
|
||||||
|
if (!item_deviceCode.equals(last_item_deviceCode)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(item_deviceCode));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号item_deviceCode:" + last_item_deviceCode + "->" + item_deviceCode);
|
||||||
|
}
|
||||||
|
if (!mode.equals(last_mode)) {
|
||||||
|
requireSucess = false;
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||||
|
}
|
||||||
|
if (!front_command.equals(last_front_command)) {
|
||||||
|
requireSucess = false;
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_command));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_command:" + last_front_command + "->" + front_command);
|
||||||
|
}
|
||||||
|
if (!back_command.equals(last_back_command)) {
|
||||||
|
requireSucess = false;
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_command));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_command:" + last_back_command + "->" + back_command);
|
||||||
|
}
|
||||||
|
if (!front_task.equals(last_front_task)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_task));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_task:" + last_front_task + "->" + front_task);
|
||||||
|
}
|
||||||
|
if (!back_task.equals(last_back_task)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_task));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_task:" + last_back_task + "->" + back_task);
|
||||||
|
}
|
||||||
|
if (!front_ZError.equals(last_front_ZError)) {
|
||||||
|
if (0 != front_ZError) {
|
||||||
|
}
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_ZError));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_ZError:" + last_front_ZError + "->" + front_ZError);
|
||||||
|
}
|
||||||
|
if (!back_ZError.equals(last_back_ZError)) {
|
||||||
|
if (0 != back_ZError) {
|
||||||
|
}
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_ZError));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_ZError:" + last_back_ZError + "->" + back_ZError);
|
||||||
|
}
|
||||||
|
if (!back_z.equals(last_back_z)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_z));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_z:" + last_back_z + "->" + back_z);
|
||||||
|
}
|
||||||
|
if (!back_x.equals(last_back_x)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_x));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_x:" + last_back_x + "->" + back_x);
|
||||||
|
}
|
||||||
|
if (!back_y.equals(last_back_y)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_y));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_y:" + last_back_y + "->" + back_y);
|
||||||
|
}
|
||||||
|
if (!front_z.equals(last_front_z)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_z));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_z:" + last_front_z + "->" + front_z);
|
||||||
|
}
|
||||||
|
if (!front_x.equals(last_front_x)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_x));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_x:" + last_front_x + "->" + front_x);
|
||||||
|
}
|
||||||
|
if (!front_y.equals(last_front_y)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_y));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_y:" + last_front_y + "->" + front_y);
|
||||||
|
}
|
||||||
|
if (!move.equals(last_move)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(move));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||||
|
}
|
||||||
|
if (!action.equals(last_action)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(action));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action);
|
||||||
|
}
|
||||||
|
if (!distancex.equals(last_distancex)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(distancex));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号distancex:" + last_distancex + "->" + distancex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!front_forkCargo.equals(last_front_forkCargo)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_forkCargo));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_forkCargo:" + last_front_forkCargo + "->" + front_forkCargo);
|
||||||
|
}
|
||||||
|
if (!front_forkLocation.equals(last_front_forkLocation)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_forkLocation));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_forkLocation:" + last_front_forkLocation + "->" + front_forkLocation);
|
||||||
|
}
|
||||||
|
if (!front_forkAction.equals(last_front_forkAction)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(front_forkAction));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号front_forkAction:" + last_front_forkAction + "->" + front_forkAction);
|
||||||
|
}
|
||||||
|
if (!back_forkCargo.equals(last_back_forkCargo)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_forkCargo));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_forkCargo:" + last_back_forkCargo + "->" + back_forkCargo);
|
||||||
|
}
|
||||||
|
if (!back_forkLocation.equals(last_back_forkLocation)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_forkLocation));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_forkLocation:" + last_back_forkLocation + "->" + back_forkLocation);
|
||||||
|
}
|
||||||
|
if (!back_forkAction.equals(last_back_forkAction)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(back_forkAction));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号back_forkAction:" + last_back_forkAction + "->" + back_forkAction);
|
||||||
|
}
|
||||||
|
if (!special1.equals(last_special1)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(special1));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号special1:" + last_special1 + "->" + special1);
|
||||||
|
}
|
||||||
|
if (!special2.equals(last_special2)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(special2));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号special2:" + last_special2 + "->" + special2);
|
||||||
|
}
|
||||||
|
if (!storage_cache.equals(last_storage_cache)) {
|
||||||
|
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(storage_cache));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号storage_cache:" + last_storage_cache + "->" + storage_cache);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,12 +217,82 @@ public class ItemProtocol {
|
|||||||
public float getItem_move(){
|
public float getItem_move(){
|
||||||
return this.getOpcFloatValue(item_move);
|
return this.getOpcFloatValue(item_move);
|
||||||
}
|
}
|
||||||
public Integer getItem_distancex(){
|
|
||||||
return this.getOpcIntegerValue(item_distancex);
|
|
||||||
|
public Integer getItem_front_command(){
|
||||||
|
return this.getOpcIntegerValue(item_front_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItem_back_command(){
|
||||||
|
return this.getOpcIntegerValue(item_back_command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItem_front_task(){
|
||||||
|
return this.getOpcIntegerValue(item_front_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItem_front_ZError(){
|
||||||
|
return this.getOpcIntegerValue(item_front_ZError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getItem_back_ZError(){
|
||||||
|
return this.getOpcIntegerValue(item_back_ZError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getItem_front_z(){
|
||||||
|
return this.getOpcIntegerValue(item_front_z);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getItem_front_x(){
|
||||||
|
return this.getOpcIntegerValue(item_front_x);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItem_front_y(){
|
||||||
|
return this.getOpcIntegerValue(item_front_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItem_back_z(){
|
||||||
|
return this.getOpcIntegerValue(item_front_z);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getItem_back_x(){
|
||||||
|
return this.getOpcIntegerValue(item_front_x);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItem_back_y(){
|
||||||
|
return this.getOpcIntegerValue(item_front_y);
|
||||||
}
|
}
|
||||||
public float getItem_special1(){
|
public float getItem_special1(){
|
||||||
return this.getOpcFloatValue(item_special1);
|
return this.getOpcFloatValue(item_special1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getItem_front_forkCargo(){
|
||||||
|
return this.getOpcFloatValue(item_front_forkCargo);
|
||||||
|
}
|
||||||
|
public float getItem_back_forkCargo(){
|
||||||
|
return this.getOpcFloatValue(item_back_forkCargo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getItem_front_forkLocation(){
|
||||||
|
return this.getOpcFloatValue(item_front_forkLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getItem_back_forkLocation(){
|
||||||
|
return this.getOpcFloatValue(item_back_forkLocation);
|
||||||
|
}
|
||||||
|
public float getItem_front_forkAction(){
|
||||||
|
return this.getOpcFloatValue(item_front_forkAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getItem_back_forkAction(){
|
||||||
|
return this.getOpcFloatValue(item_back_forkAction);
|
||||||
|
}
|
||||||
|
|
||||||
public float getItem_special2(){
|
public float getItem_special2(){
|
||||||
return this.getOpcFloatValue(item_special2);
|
return this.getOpcFloatValue(item_special2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-permission="['admin','customPolicy:del']" label="操作" width="150px" align="center">
|
<el-table-column v-permission="['admin','customPolicy:del']" :label="$t('common.Operate')" width="150px" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation
|
||||||
:data="scope.row"
|
:data="scope.row"
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
/>
|
/>
|
||||||
<el-button slot="right" size="mini" style="margin-left: -1px;margin-right: 2px" type="text">
|
<el-button slot="right" size="mini" style="margin-left: -1px;margin-right: 2px" type="text">
|
||||||
<router-link :to="'/device/customPolicy/task?key_code='+ scope.row.key_code +'&id='+scope.row.id">
|
<router-link :to="'/device/customPolicy/task?key_code='+ scope.row.key_code +'&id='+scope.row.id">
|
||||||
定义策略
|
{{ $t('customPolicy.title') }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -81,6 +81,7 @@ import crudOperation from '@crud/CRUD.operation'
|
|||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import deviceCrud from '@/api/acs/device/device'
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
|
import i18n from '@/i18n'
|
||||||
|
|
||||||
const defaultForm = { id: null, create_time: null, update_time: null, key_code: null, unit_code: ' deviceCustomerDequeStrategy' }
|
const defaultForm = { id: null, create_time: null, update_time: null, key_code: null, unit_code: ' deviceCustomerDequeStrategy' }
|
||||||
export default {
|
export default {
|
||||||
@@ -89,7 +90,7 @@ export default {
|
|||||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '自定义策略', url: 'api/customPolicy', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCustomPolicy }})
|
return CRUD({ title: i18n.t('customPolicy.title'), url: 'api/customPolicy', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCustomPolicy }})
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user