This commit is contained in:
2022-12-27 22:31:09 +08:00
parent 8a4f22bd0c
commit 4cce776c46
4 changed files with 124 additions and 40 deletions

View File

@@ -22,6 +22,7 @@ import org.nl.acs.device.service.*;
import org.nl.acs.device.service.dto.*;
import org.nl.acs.device_driver.DeviceDriverDefination;
import org.nl.acs.device_driver.ScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.slit_two_manipulator.SlitTwoManipulatorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
@@ -926,9 +927,12 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type);
device.setBatch(batch);
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver){
} else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) {
slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver();
slitTwoManipulatorDeviceDriver.setDeviceStatus(form);
} else if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
siemensConveyorDeviceDriver.setDeviceStatus(form);
}
}

View File

@@ -93,8 +93,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
private int instruction_require_time_out;
//行架机械手申请任务成功标识
boolean requireSucess = false;
//申请成功标记
Boolean applySucess = false;
private int instruction_finished_time_out;
int branchProtocol = 0;
@@ -125,6 +123,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
if (mode != last_mode) {
if (mode == 2) {
this.setRequireSucess(false);
}
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
@@ -145,6 +146,40 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (task > 0) {
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isNotEmpty(instruction)) {
if (StrUtil.equals(this.getDeviceCode(), instruction.getStart_device_code())) {
if (StrUtil.equals(instruction.getInstruction_status(), "0")) {
instruction.setInstruction_status("1");
instructionService.update(instruction);
}
String next_device_code = instruction.getNext_device_code();
Device device = deviceAppservice.findDeviceByCode(next_device_code);
if (ObjectUtil.isEmpty(device)) {
logServer.deviceExecuteLog(this.device_code, "", "", "任务号:" + task + "输送线任务未完成,目标站设备为空!");
return;
}
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
int nextTask = siemensConveyorDeviceDriver.getTask();
if (nextTask == task) {
inst_message = "指令号:" + instruction.getInstruction_code() + " " + instruction.getStart_point_code() + "->" + instruction.getNext_point_code() + " 载具号:" + instruction.getVehicle_code();
if (StrUtil.equals(instruction.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), instruction.getNext_device_code())) {
finish_instruction();
this.clearWrite();
}
}
}
}
}
}
} catch (Exception var17) {
return;
}
@@ -173,31 +208,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
List toInstructions;
if (mode != last_mode) {
this.setRequireSucess(false);
}
if (move != last_move) {
if (move == 0 && mode == 2) {
thingToNothing();
}
}
if (error != last_error) {
}
if (mode == 2 && move != 0 && task > 0) {
//inst_message
inst = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst != null) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
finish_instruction();
}
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
inst.setInstruction_status("1");
instructionService.update(inst);
}
}
}
// if (mode == 2 && move != 0 && task > 0) {
// //inst_message
// inst = instructionService.findByCodeFromCache(String.valueOf(task));
// if (inst != null) {
// inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
// if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
// finish_instruction();
// }
// if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
// inst.setInstruction_status("1");
// instructionService.update(inst);
// }
// }
// }
switch (mode) {
case 1:
@@ -228,6 +252,16 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
public void clearWrite() {
this.writing("to_command", "0");
this.writing("to_target", "0");
this.writing("to_container_type", "0");
this.writing("to_strap_times", "0");
this.writing("to_length", "0");
this.writing("to_weight", "0");
this.writing("to_height", "0");
}
public boolean exe_business() {
return true;
}
@@ -240,15 +274,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
protected void thingToNothing() throws Exception {
this.setRequireSucess(false);
this.setApplySucess(false);
this.writing("to_command", "0");
this.writing("to_target", "0");
this.writing("to_container_type", "0");
this.writing("to_task", "0");
this.writing("to_strap_times", "0");
this.writing("to_length", "0");
this.writing("to_weight", "0");
this.writing("to_height", "0");
}
@@ -263,7 +288,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
itemMap.put(to_param, value);
// itemMap.put(to_param, Integer.parseInt(value));
ReadUtil.write(itemMap, server);
logServer.deviceExecuteLog(device_code,"","","下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
public void executing(Server server, Map<String, Object> itemMap) {
@@ -306,6 +331,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
} else if (this.carrier_direction == 2) {
carrier_direction = "反转";
}
String requireSucess = "0";
if (this.requireSucess) {
requireSucess = "1";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
@@ -316,12 +345,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("is_click", true);
jo.put("requireSucess", requireSucess);
jo.put("driver_type", "siemens_conveyor");
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
String requestSucess = data.getString("requireSucess");
if (StrUtil.equals(requestSucess, "0")) {
this.setRequireSucess(false);
} else {
this.setRequireSucess(true);
}
}
// public void writing(int type, int command) {
@@ -427,7 +464,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
task.setTask_status("1");
taskserver.update(task);
requireSucess = true;
applySucess = true;
String next_addr = nextdevice.getExtraValue().get("address").toString();
this.writing("to_target", next_addr);
this.writing("to_task", instdto.getInstruction_code());

View File

@@ -279,6 +279,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (!StrUtil.equals(task.getTask_type(), "6")) {
continue;
}
if ((task.getStart_device_code().equals(start_device_code) || task.getStart_device_code2().equals(start_device_code)) && StrUtil.equals(task.getTask_status(), "0")) {
list.add(task);
}
@@ -292,6 +295,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (!StrUtil.equals(task.getTask_type(), "6")) {
continue;
}
if (task.getStart_device_code().equals(back_start_device_code) && StrUtil.equals(task.getTask_status(), "0")) {
list.add(task);
}
@@ -321,6 +327,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (!StrUtil.equals(task.getTask_type(), "6")) {
continue;
}
if ((task.getStart_device_code().equals(head_start_device_code) || task.getStart_device_code2().equals(head_start_device_code)) && StrUtil.equals(task.getTask_status(), "1")) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
if (ObjectUtil.isNotEmpty(instruction)) {
@@ -336,6 +345,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (!StrUtil.equals(task.getTask_type(), "6")) {
continue;
}
if ((task.getStart_device_code().equals(back_start_device_code)) && StrUtil.equals(task.getTask_status(), "1")) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
if (ObjectUtil.isNotEmpty(instruction)) {
@@ -1126,6 +1138,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
while (var3.hasNext()) {
TaskDto task = (TaskDto) var3.next();
if (!StrUtil.equals(task.getTask_type(), "5")) {
continue;
}
if (StrUtil.equals(task.getStart_device_code(), device_code) && StrUtil.equals(task.getTask_status(), "0")) {
return task;
}

View File

@@ -92,6 +92,24 @@
</div>
</el-dialog>
<el-dialog title="设备设置" :visible.sync="dialogFormVisible5" width="35%">
<el-form :model="form" size="small">
<el-form-item label="设备编号" prop="device_code" label-width="120px">
<el-input v-model="form.device_code" :disabled="true" />
</el-form-item>
<el-form-item label="请求标记" prop="is_disable" label-width="120px">
<el-radio-group v-model="form.requireSucess">
<el-radio-button :label="0"></el-radio-button>
<el-radio-button :label="1"></el-radio-button>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible5 = false"> </el-button>
<el-button type="primary" @click="dialogSave"> </el-button>
</div>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="设备设置" :visible.sync="dialogFormVisible1" width="35%">
<el-form :model="form" size="small">
@@ -140,6 +158,7 @@ export default {
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
dialogFormVisible5: false,
form: {
device_code: '',
hasGoodStatus: null,
@@ -278,6 +297,8 @@ export default {
this.$refs.child1.setForm(clickObj)
} else if (clickObj.data.driver_type === 'slit_two_manipulator') {
this.dialogFormVisible4 = true
} else if (clickObj.data.driver_type === 'siemens_conveyor') {
this.dialogFormVisible5 = true
} else {
this.dialogFormVisible = true
}
@@ -474,6 +495,9 @@ export default {
} else if (val === 'task2') {
const obj = { name: '后工位任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'task') {
const obj = { name: '任务号', value: data[val] }
this.arr.push(obj)
} else if (val === 'labeling_qty') {
const obj = { name: '贴标数量', value: data[val] }
this.arr.push(obj)
@@ -516,6 +540,9 @@ export default {
} else if (val === 'feedMessage') {
const obj = { name: '未反馈电气信号原因', value: data[val] }
this.arr.push(obj)
} else if (val === 'requireSucess') {
const obj = { name: '请求成功标记', value: data[val] }
this.arr.push(obj)
}
}
}
@@ -562,11 +589,13 @@ export default {
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
this.initStageData()
}).catch(err => {
this.dialogFormVisible = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
console.log(err.response.data.message)
})
},