更新
This commit is contained in:
@@ -238,7 +238,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
}
|
||||
} else {
|
||||
message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成";
|
||||
// message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成";
|
||||
inst_message = null;
|
||||
}
|
||||
}
|
||||
@@ -922,14 +922,14 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
JSONObject jo = JSON.parseObject(str);
|
||||
if (ObjectUtil.isEmpty(jo)) {
|
||||
message = "申请AGV搬运任务接口不通";
|
||||
requireSucess = true;
|
||||
// requireSucess = true;
|
||||
} else {
|
||||
if (jo.getInteger("status") == 200) {
|
||||
message = "申请AGV搬运任务成功";
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:"+jo);
|
||||
requireSucess = true;
|
||||
} else {
|
||||
requireSucess = true;
|
||||
// requireSucess = true;
|
||||
message = "申请AGV搬运任务失败," + jo.get("message").toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
@@ -72,8 +69,6 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
@Autowired
|
||||
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
|
||||
@@ -167,7 +162,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
if (move != last_move) {
|
||||
message = null;
|
||||
if (move == 0) {
|
||||
if (move == 0 ) {
|
||||
inst_message = null;
|
||||
requireSucess = false;
|
||||
this.clearWrite();
|
||||
@@ -180,13 +175,6 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction:" + last_carrier_direction + "->" + carrier_direction);
|
||||
}
|
||||
if (error != last_error) {
|
||||
if (error != 0) {
|
||||
DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setError_code(String.valueOf(error));
|
||||
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
|
||||
deviceErrorLogService.create(dto);
|
||||
}
|
||||
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error);
|
||||
}
|
||||
@@ -215,7 +203,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
} else {
|
||||
// logServer.deviceExecuteLog(device_code, "", "", "输送线任务开始反馈任务状态,反馈失败,查询不到指令号:" + task);
|
||||
message = "输送线任务反馈状态,查询不到指令号:" + task + "指令已完成";
|
||||
// message = "输送线任务反馈状态,查询不到指令号:" + task +"指令已完成";
|
||||
inst_message = null;
|
||||
}
|
||||
}
|
||||
@@ -256,11 +244,11 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
case 2:
|
||||
//申请任务
|
||||
if (move > 0 && !requireSucess) {
|
||||
try {
|
||||
instruction_require();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
instruction_require();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
@@ -495,10 +483,10 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
//instruction = instructionService.findByCode(String.valueOf(task));
|
||||
message = "任务号:" + task + "未找到对应立库指令,请检查";
|
||||
message ="任务号:"+task +"未找到对应立库指令,请检查";
|
||||
return false;
|
||||
}
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), "1")) {
|
||||
if(StrUtil.equals(instruction.getInstruction_status(),"1")){
|
||||
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
@@ -634,8 +622,8 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("指令创建失败!", e.getMessage());
|
||||
return false;
|
||||
log.error("指令创建失败!",e.getMessage());
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
taskdto.setTask_status("1");
|
||||
@@ -759,7 +747,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
String vehicle_code = "";
|
||||
if (task > 0) {
|
||||
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
if(ObjectUtil.isEmpty(instruction)){
|
||||
message = "申请捆扎电气设备任务号:" + task + "未找到对应指令";
|
||||
throw new RuntimeException("该电气任务号未找到对应指令!");
|
||||
}
|
||||
@@ -871,8 +859,8 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
this.instruction_require_time = date;
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
Instruction instruction = instructionService.findByCode(String.valueOf(task));
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
message = "指令号" + task + "未找到对应指令";
|
||||
if(ObjectUtil.isEmpty(instruction)){
|
||||
message = "指令号"+task+"未找到对应指令";
|
||||
return;
|
||||
}
|
||||
message = "申请AGV搬运任务中...";
|
||||
|
||||
@@ -861,6 +861,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public synchronized void emptyIn() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_empty_in_time.getTime()
|
||||
|
||||
@@ -120,6 +120,15 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_to_command2);
|
||||
}
|
||||
|
||||
public int getTo_task1() {
|
||||
return this.getOpcIntegerValue(item_to_task1);
|
||||
}
|
||||
|
||||
public int getTo_task2() {
|
||||
return this.getOpcIntegerValue(item_to_task2);
|
||||
}
|
||||
|
||||
|
||||
//是否有货
|
||||
public int hasGoods(int move) {
|
||||
return move;
|
||||
|
||||
@@ -66,6 +66,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//分切行架机械手是否禁用 0否 1是
|
||||
private int is_disable = 0;
|
||||
|
||||
Instruction cache_inst = null;
|
||||
String inst_type = null;
|
||||
|
||||
//工作模式
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -98,7 +101,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
int last_task2 = 0;
|
||||
int to_command1 = 0;
|
||||
int to_command2 = 0;
|
||||
|
||||
int to_task1 = 0;
|
||||
int to_task2 = 0;
|
||||
Boolean isonline = true;
|
||||
//前工位申请任务请求标记
|
||||
Boolean requireSucess = false;
|
||||
@@ -130,6 +134,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
|
||||
//请求超时时间
|
||||
private int instruction_require_time_out = 3000;
|
||||
//写入信号时间
|
||||
private int instruction_write_time_out = 1000;
|
||||
|
||||
|
||||
//后工位申请任务请求时间
|
||||
@@ -137,6 +143,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//前工位申请任务请求时间
|
||||
private Date instruction_head_time = new Date();
|
||||
|
||||
private Date instruction_write_time = new Date();
|
||||
|
||||
|
||||
String notCreateTaskMessage = "";
|
||||
String notCreateInstMessage = "";
|
||||
String feedMessage = "";
|
||||
@@ -167,10 +176,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
to_command1 = this.itemProtocol.getTo_command1();
|
||||
to_command2 = this.itemProtocol.getTo_command2();
|
||||
heartbeat = this.itemProtocol.getHeartbeat();
|
||||
to_task1 = this.itemProtocol.getTo_task1();
|
||||
to_task2 = this.itemProtocol.getTo_task2();
|
||||
// if(heartbeat != last_heartbeat){
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat);
|
||||
// }
|
||||
if (mode != last_mode) {
|
||||
inst_type = null;
|
||||
cache_inst = null;
|
||||
if (mode == 2) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为:" + requireSucess);
|
||||
requireSucess = false;
|
||||
@@ -647,10 +660,12 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task_check();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
feedMessage = e.getMessage();
|
||||
System.out.println("11111111:" + e.getMessage());
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
|
||||
}
|
||||
|
||||
@@ -747,6 +762,36 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
last_heartbeat = heartbeat;
|
||||
}
|
||||
|
||||
public synchronized boolean task_check() {
|
||||
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_write_time.getTime() < (long) this.instruction_write_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_write_time);
|
||||
return false;
|
||||
} else {
|
||||
if(ObjectUtil.isNotEmpty(cache_inst)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "程序逻辑校验,下发指令信号后电气任务号未变化,再次下发指令号:"+cache_inst.getInstruction_code() +",行架指令类型:"+type );
|
||||
|
||||
//前工位任务
|
||||
if (StrUtil.equals(inst_type, "1")) {
|
||||
if (task1 != Integer.parseInt(cache_inst.getInstruction_code())) {
|
||||
this.sendSignalType(cache_inst, inst_type);
|
||||
}
|
||||
} else if (StrUtil.equals(inst_type, "2")) {
|
||||
if (task2 != Integer.parseInt(cache_inst.getInstruction_code())) {
|
||||
this.sendSignalType(cache_inst, inst_type);
|
||||
}
|
||||
} else if (StrUtil.equals(inst_type, "3")) {
|
||||
if (task1 != Integer.parseInt(cache_inst.getInstruction_code()) || task2 != Integer.parseInt(cache_inst.getInstruction_code())) {
|
||||
this.sendSignalType(cache_inst, inst_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//关联设备异常申请任务
|
||||
public synchronized boolean instruction_require2() {
|
||||
Boolean flag = false;
|
||||
@@ -1197,7 +1242,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
this.writing(list);
|
||||
logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "再次下发电气信号");
|
||||
}
|
||||
|
||||
inst_type = type;
|
||||
cache_inst = dto;
|
||||
}
|
||||
|
||||
//判断点位是否设置电气值
|
||||
|
||||
@@ -464,11 +464,17 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(task));
|
||||
if (!ObjectUtil.isEmpty(task)) {
|
||||
Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) {
|
||||
if(ObjectUtil.isEmpty(instdto)){
|
||||
message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符";
|
||||
// this.setIserror(true);
|
||||
this.setIserror(true);
|
||||
return false;
|
||||
}
|
||||
if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) {
|
||||
message = "当前载具号" + container_code + "未找到就绪状态指令";
|
||||
this.setIserror(true);
|
||||
return false;
|
||||
}
|
||||
this.setIserror(false);
|
||||
if (ObjectUtil.isNotEmpty(instdto)) {
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
@@ -533,6 +539,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code());
|
||||
if (!StrUtil.equals(instdto.getStart_device_code(), this.device_code)) {
|
||||
message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符";
|
||||
this.setIserror(true);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务"
|
||||
+ "当前载具号" + container_code + "查找对应指令起点与当前设备不符");
|
||||
return false;
|
||||
@@ -578,6 +585,14 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1"))) {
|
||||
{
|
||||
Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1");
|
||||
if(!ObjectUtil.equal(instdto.getStart_device_code(),this.device_code)){
|
||||
message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符";
|
||||
this.setIserror(true);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务"
|
||||
+ "当前载具号" + container_code + "查找对应指令起点与当前设备不符");
|
||||
return false;
|
||||
}
|
||||
this.setIserror(false);
|
||||
if (to_task != Integer.parseInt(instdto.getInstruction_code())) {
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
@@ -671,21 +686,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
|
||||
if (!StrUtil.equals(taskdto.getStart_device_code(), this.device_code)) {
|
||||
message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符";
|
||||
// List list = new ArrayList();
|
||||
// Map map = new HashMap();
|
||||
// map.put("code","to_target");
|
||||
// map.put("value","1011");
|
||||
// list.add(map);
|
||||
// Map map2 = new HashMap();
|
||||
// map2.put("code","to_command");
|
||||
// map2.put("value","1");
|
||||
// Map map3 = new HashMap();
|
||||
// map3.put("code","to_task");
|
||||
// map3.put("value","0");
|
||||
// list.add(map3);
|
||||
// this.writing(list);
|
||||
// this.setRequireSucess(true);
|
||||
// this.setApplySucess(true);
|
||||
return false;
|
||||
}
|
||||
Instruction instdto = new Instruction();
|
||||
|
||||
@@ -59,7 +59,8 @@ public interface OpcDeviceDriver extends DeviceDriver {
|
||||
}
|
||||
|
||||
default Integer getIntegeregerValue(String protocol) {
|
||||
return (Integer) this.getValue(protocol);
|
||||
Object value = this.getValue(protocol)==null?"0":this.getValue(protocol);
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
|
||||
default Float getDoubleValue(String protocol) {
|
||||
|
||||
@@ -512,7 +512,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
} else {
|
||||
// Boolean result = createLkInst(task.getStorage_task_type(),dto);
|
||||
Resp resp = acsToLiKuService.sendInst(task.getStorage_task_type(), dto);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user