rev:输送线配置
This commit is contained in:
@@ -205,31 +205,25 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* 模板方法
|
||||
*/
|
||||
public void issueInstruction() {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (!isTimeValid(currentTimeMillis)) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.requireTimeOut);
|
||||
} else {
|
||||
this.requireTime = currentTimeMillis;
|
||||
// 查找指令
|
||||
Instruction instruction = instructionService.findByStartCodeAndReady(getDeviceCode());
|
||||
if (null == instruction) {
|
||||
message = "无指令...";
|
||||
return;
|
||||
}
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
if (ObjectUtil.isEmpty(nextAddr) || "0".equals(nextAddr)) {
|
||||
message = "请配置电气调度号";
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 1);
|
||||
map.put("to_target", nextAddr);
|
||||
map.put("to_task", instruction.getInstruction_code());
|
||||
writing(map);
|
||||
requireSuccess = true;
|
||||
// 查找指令
|
||||
Instruction instruction = instructionService.findByStartCodeAndReady(getDeviceCode());
|
||||
if (null == instruction) {
|
||||
message = "无指令...";
|
||||
return;
|
||||
}
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
|
||||
String nextAddr = nextDevice.getExtraValue().get("address").toString();
|
||||
if (ObjectUtil.isEmpty(nextAddr) || "0".equals(nextAddr)) {
|
||||
message = "请配置电气调度号";
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 1);
|
||||
map.put("to_target", nextAddr);
|
||||
map.put("to_task", instruction.getInstruction_code());
|
||||
writing(map);
|
||||
requireSuccess = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,16 +7,16 @@ import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public enum ItemProtocol implements DeviceDriverBaseReader.KeyProvider {
|
||||
HEARTBEAT("heartbeat", "心跳", "DB600.B1"),
|
||||
MODE("mode", "工作模式", "DB600.B2"),
|
||||
MOVE("move", "光电信号", "DB600.B3"),
|
||||
ACTION("action", "动作信号", "DB600.B4"),
|
||||
ERROR("error", "报警信号", "DB600.B5"),
|
||||
MATERIAL_BARCODE("material_barcode", "物料编码", "DB600.String6.50"),
|
||||
TASK("task", "任务号", "DB600.W58"),
|
||||
TO_COMMAND("to_command", "下发命令", "DB601.W0"),
|
||||
TO_TARGET("to_target", "下发目标站", "DB601.W2"),
|
||||
TO_TASK("to_task", "下发任务号", "DB601.D4");
|
||||
HEARTBEAT("heartbeat", "心跳", "DB600.B0"),
|
||||
MODE("mode", "工作模式", "DB600.B1"),
|
||||
MOVE("move", "光电信号", "DB600.B2"),
|
||||
ACTION("action", "动作信号", "DB600.B3"),
|
||||
ERROR("error", "报警信号", "DB600.B4"),
|
||||
MATERIAL_BARCODE("material_barcode", "物料编码", "DB600.STRING6.207"),
|
||||
TASK("task", "任务号", "DB600.D208"),
|
||||
TO_COMMAND("to_command", "下发命令", "DB601.W218"),
|
||||
TO_TARGET("to_target", "下发目标站", "DB601.W220"),
|
||||
TO_TASK("to_task", "下发任务号", "DB601.D222");
|
||||
|
||||
private final String key;
|
||||
private final String description;
|
||||
|
||||
@@ -7,19 +7,19 @@ import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public enum ItemProtocol implements DeviceDriverBaseReader.KeyProvider {
|
||||
HEARTBEAT("heartbeat", "心跳", "DB600.B1"),
|
||||
MODE("mode", "工作模式", "DB600.B2"),
|
||||
MOVE("move", "光电信号", "DB600.B3"),
|
||||
ACTION("action", "动作信号", "DB600.B4"),
|
||||
ERROR("error", "报警信号", "DB600.B5"),
|
||||
HEIGHT("height", "高度类型", "DB600.B6"),
|
||||
BARCODE("barcode", "托盘码", "DB600.Sring7.50"),
|
||||
MATERIAL_BARCODE("material_barcode", "物料编码", "DB600.String59.50"),
|
||||
WEIGHT("weight", "重量", "DB600.D112"),
|
||||
TASK("task", "任务号", "DB600.D116"),
|
||||
TO_COMMAND("to_command", "下发命令", "DB601.W0"),
|
||||
TO_TARGET("to_target", "下发目标站", "DB601.W2"),
|
||||
TO_TASK("to_task", "下发任务号", "DB601.D4");
|
||||
HEARTBEAT("heartbeat", "心跳", "DB600.B0"),
|
||||
MODE("mode", "工作模式", "DB600.B1"),
|
||||
MOVE("move", "光电信号", "DB600.B2"),
|
||||
ACTION("action", "动作信号", "DB600.B3"),
|
||||
ERROR("error", "报警信号", "DB600.B4"),
|
||||
HEIGHT("height", "高度类型", "DB600.B5"),
|
||||
BARCODE("barcode", "托盘码", "DB600.STRING6.57"),
|
||||
MATERIAL_BARCODE("material_barcode", "物料编码", "DB600.STRING58.100"),
|
||||
WEIGHT("weight", "重量", "DB600.REAL260"),
|
||||
TASK("task", "任务号", "DB600.D264"),
|
||||
TO_COMMAND("to_command", "下发命令", "DB601.W274"),
|
||||
TO_TARGET("to_target", "下发目标站", "DB601.W276"),
|
||||
TO_TASK("to_task", "下发任务号", "DB601.D278");
|
||||
|
||||
private final String key;
|
||||
private final String description;
|
||||
|
||||
@@ -227,10 +227,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
|
||||
} else {
|
||||
this.requireTime = currentTimeMillis;
|
||||
|
||||
if (this.move != 1) {
|
||||
this.message = "无货不允许请求,请检查move信号";
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(this.task) || 0 == task) {
|
||||
message = "任务号不存在!";
|
||||
return;
|
||||
|
||||
@@ -342,126 +342,22 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('mode') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('carrier_direction') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.syncDbBlock(data, this.data1)
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('to_command') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
console.log(endNumber)
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_command') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_container_type') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 10)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_length') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 12)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 14)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_height') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 16)
|
||||
}
|
||||
}
|
||||
this.syncDbBlock(data, this.data2)
|
||||
},
|
||||
syncDbBlock(data, rows) {
|
||||
const match = (data.db || '').match(/^DB(\d+)\./i)
|
||||
if (!match) {
|
||||
return
|
||||
}
|
||||
// 只同步 DB 块编号,保留每个字段原有的数据类型和偏移。
|
||||
rows.forEach((row) => {
|
||||
if (typeof row.db === 'string') {
|
||||
row.db = row.db.replace(/^(DB)\d+(?=\.)/i, (_, prefix) => prefix + match[1])
|
||||
}
|
||||
})
|
||||
},
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach((item) => {
|
||||
|
||||
@@ -422,46 +422,22 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.substring(0, 2)
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.substring(2)
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db = beforeStr + (parseInt(afterStr) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('action') !== -1) {
|
||||
this.data1[val].db = beforeStr + (parseInt(afterStr) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db = beforeStr + (parseInt(afterStr) + 6)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db = beforeStr + (parseInt(afterStr) + 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.syncDbBlock(data, this.data1)
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('to_command') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.substring(0, 2)
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.substring(2)
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db = beforeStr + (parseInt(afterStr) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db = beforeStr + (parseInt(afterStr) + 4)
|
||||
}
|
||||
}
|
||||
this.syncDbBlock(data, this.data2)
|
||||
},
|
||||
syncDbBlock(data, rows) {
|
||||
const match = (data.db || '').match(/^DB(\d+)\./i)
|
||||
if (!match) {
|
||||
return
|
||||
}
|
||||
// 只同步 DB 块编号,保留每个字段原有的数据类型和偏移。
|
||||
rows.forEach((row) => {
|
||||
if (typeof row.db === 'string') {
|
||||
row.db = row.db.replace(/^(DB)\d+(?=\.)/i, (_, prefix) => prefix + match[1])
|
||||
}
|
||||
})
|
||||
},
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach(item => {
|
||||
|
||||
@@ -305,126 +305,22 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
finishReadEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('mode') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
for (const val in this.data1) {
|
||||
if (this.data1[val].code.indexOf('mode') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('move') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 1)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('carrier_direction') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('error') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data1[val].code.indexOf('task') !== -1) {
|
||||
this.data1[val].db =
|
||||
beforeStr + '.' + 'D' + (parseInt(endNumber) + 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.syncDbBlock(data, this.data1)
|
||||
},
|
||||
finishWriteEdit(data) {
|
||||
// 编辑的是code列,并且值包含mode
|
||||
if (data.code.indexOf('to_command') !== -1) {
|
||||
const dbValue = data.db
|
||||
// .之前的字符串
|
||||
const beforeStr = dbValue.match(/(\S*)\./)[1]
|
||||
// .之后的字符串
|
||||
const afterStr = dbValue.match(/\.(\S*)/)[1]
|
||||
// 取最后数字
|
||||
const endNumber = afterStr.substring(1)
|
||||
// 最后为非数字
|
||||
if (isNaN(parseInt(endNumber))) {
|
||||
return
|
||||
}
|
||||
console.log(endNumber)
|
||||
for (const val in this.data2) {
|
||||
if (this.data2[val].code.indexOf('to_command') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 0)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_target') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 2)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_container_type') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 4)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_task') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_strap_times') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 10)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_length') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 12)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_weight') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 14)
|
||||
}
|
||||
if (this.data2[val].code.indexOf('to_height') !== -1) {
|
||||
this.data2[val].db =
|
||||
beforeStr +
|
||||
'.' +
|
||||
afterStr.substring(0, 1) +
|
||||
(parseInt(endNumber) + 16)
|
||||
}
|
||||
}
|
||||
this.syncDbBlock(data, this.data2)
|
||||
},
|
||||
syncDbBlock(data, rows) {
|
||||
const match = (data.db || '').match(/^DB(\d+)\./i)
|
||||
if (!match) {
|
||||
return
|
||||
}
|
||||
// 只同步 DB 块编号,保留每个字段原有的数据类型和偏移。
|
||||
rows.forEach((row) => {
|
||||
if (typeof row.db === 'string') {
|
||||
row.db = row.db.replace(/^(DB)\d+(?=\.)/i, (_, prefix) => prefix + match[1])
|
||||
}
|
||||
})
|
||||
},
|
||||
changeOpc(val) {
|
||||
this.dataOpcservers.forEach((item) => {
|
||||
|
||||
Reference in New Issue
Block a user