fix 任务指令日志
This commit is contained in:
@@ -1113,7 +1113,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
instructionService.update(inst);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task + ",载具号:"+ inst.getVehicle_code());
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1")) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0") ) {
|
||||
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
|
||||
@@ -530,6 +530,22 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
message = "下发电气任务号成功";
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||
, instdto.getInstruction_code())) {
|
||||
this.writing(list);
|
||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(ObjectUtil.isEmpty(instdto.getInstruction_code())){
|
||||
requireSucess = false;
|
||||
applySucess = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
message = "任务号:" + task.getTask_code() + "未找到指令";
|
||||
}
|
||||
@@ -602,6 +618,21 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
+ "已存在对应任务,下发电气信号");
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||
, instdto.getInstruction_code())) {
|
||||
this.writing(list);
|
||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(ObjectUtil.isEmpty(instdto.getInstruction_code())){
|
||||
requireSucess = false;
|
||||
applySucess = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message = "任务号:" + taskdto.getTask_code() + "未找到指令";
|
||||
}
|
||||
@@ -647,6 +678,21 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
message = "下发电气任务号成功";
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||
, instdto.getInstruction_code())) {
|
||||
this.writing(list);
|
||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(ObjectUtil.isEmpty(instdto.getInstruction_code())){
|
||||
requireSucess = false;
|
||||
applySucess = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code
|
||||
@@ -776,6 +822,21 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
// }
|
||||
requireSucess = true;
|
||||
applySucess = true;
|
||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||
, instdto.getInstruction_code())) {
|
||||
this.writing(list);
|
||||
logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发信号");
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(ObjectUtil.isEmpty(instdto.getInstruction_code())){
|
||||
requireSucess = false;
|
||||
applySucess = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
message = "申请任务中...";
|
||||
|
||||
@@ -414,9 +414,14 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
instructions.add(dto);
|
||||
|
||||
try{
|
||||
instructions.add(dto);
|
||||
log.warn("指令添加到指令列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("指令添加到指令列表异常:" + dto.toString() +e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -530,7 +535,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
instructions.add(dto);
|
||||
try{
|
||||
instructions.add(dto);
|
||||
log.warn("指令添加到指令列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("指令添加到指令列表异常:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -645,7 +655,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
instructions.add(dto);
|
||||
try{
|
||||
instructions.add(dto);
|
||||
log.warn("指令添加到指令列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("指令添加到指令列表异常:" + dto.toString() +e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -732,7 +747,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
// agvService.addOrderSequences(dto);
|
||||
// }
|
||||
// }
|
||||
instructions.add(dto);
|
||||
try{
|
||||
instructions.add(dto);
|
||||
log.warn("指令添加到指令列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("指令添加到指令列表异常:" + dto.toString() +e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -747,7 +767,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
|
||||
wo.update(json);
|
||||
removeByCodeFromCache(dto.getInstruction_code());
|
||||
instructions.add(dto);
|
||||
try{
|
||||
instructions.add(dto);
|
||||
log.warn("指令添加到指令列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("指令添加到指令列表异常:" + dto.toString() +e.getMessage());
|
||||
}
|
||||
|
||||
// this.reload();
|
||||
}
|
||||
|
||||
@@ -1580,9 +1606,18 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
@Override
|
||||
public boolean removeByCodeFromCache(String code) {
|
||||
CopyOnWriteArrayList<Instruction> instructions = (CopyOnWriteArrayList<Instruction>) this.instructions;
|
||||
instructions.removeIf((inst) -> {
|
||||
return inst.getInstruction_code().equals(code);
|
||||
});
|
||||
|
||||
try{
|
||||
instructions.removeIf((inst) -> {
|
||||
if(StrUtil.equals(inst.getInstruction_code(),code)){
|
||||
log.warn("指令移除指令列表:"+inst.toString());
|
||||
}
|
||||
return inst.getInstruction_code().equals(code);
|
||||
});
|
||||
} catch (Exception e){
|
||||
log.warn("指令移除指令列表列表异常:" + e.getMessage());
|
||||
}
|
||||
|
||||
// while (iterator.hasNext()) {
|
||||
// Instruction instruction = iterator.next();
|
||||
// if (instruction.getInstruction_code().equals(code)) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.opc;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.udw.UnifiedDataAccessor;
|
||||
@@ -191,8 +192,9 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
if (true) {
|
||||
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
}
|
||||
|
||||
accessor_value.setValue(itemId, value);
|
||||
if(!ObjectUtil.isEmpty(value)){
|
||||
accessor_value.setValue(itemId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -520,8 +520,15 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
synchronized (TaskServiceImpl.class) {
|
||||
// synchronized (TaskServiceImpl.class) {
|
||||
// tasks.add(dto);
|
||||
// }
|
||||
|
||||
try{
|
||||
tasks.add(dto);
|
||||
log.warn("任务添加到任务列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,7 +680,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
|
||||
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
|
||||
tasks.add(dto);
|
||||
try{
|
||||
tasks.add(dto);
|
||||
log.warn("任务添加到任务列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
|
||||
}
|
||||
}
|
||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
@@ -1296,9 +1308,18 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
@Override
|
||||
public boolean removeByCodeFromCache(String code) {
|
||||
CopyOnWriteArrayList<TaskDto> taskDtos = (CopyOnWriteArrayList<TaskDto>) this.tasks;
|
||||
taskDtos.removeIf((task) -> {
|
||||
return task.getTask_code().equals(code);
|
||||
});
|
||||
try{
|
||||
|
||||
taskDtos.removeIf((task) -> {
|
||||
if(StrUtil.equals(task.getTask_code(),code)){
|
||||
log.warn("任务移除任务列表成功:"+task.toString());
|
||||
}
|
||||
return task.getTask_code().equals(code);
|
||||
});
|
||||
} catch (Exception e){
|
||||
log.warn("指令移除任务列表异常:"+e.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1525,7 +1546,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
@Override
|
||||
public void updateByCodeFromCache(TaskDto dto) {
|
||||
removeByCodeFromCache(dto.getTask_code());
|
||||
tasks.add(dto);
|
||||
try{
|
||||
tasks.add(dto);
|
||||
log.warn("任务添加到任务列表:"+dto.toString());
|
||||
} catch (Exception e){
|
||||
log.warn("任务添加到任务列表异常:"+ dto.toString() +e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user