更新
This commit is contained in:
@@ -17,6 +17,7 @@ import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
@@ -30,6 +31,7 @@ import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -89,10 +91,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
Integer heartbeat_tag;
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date require_apply_labeling_time = new Date();
|
||||
private Date require_apply_strangulation_time = new Date();
|
||||
private Date require_empty_in_time = new Date();
|
||||
private Date require_empty_out_time = new Date();
|
||||
|
||||
private int instruction_require_time_out;
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
boolean requireApplyLabelingSuccess = false;
|
||||
boolean requireApplyLaStrangulationSuccess = false;
|
||||
boolean requireEmptyInSuccess = false;
|
||||
boolean requireEmptyOutSuccess = false;
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
@@ -124,7 +134,29 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
task = this.itemProtocol.getTask();
|
||||
if (mode != last_mode) {
|
||||
if (mode == 2) {
|
||||
this.setRequireSucess(false);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireSucess:" + requireSucess);
|
||||
requireSucess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireSucess:" + requireSucess);
|
||||
}
|
||||
if (mode == 4) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireApplyLabelingSuccess:" + requireApplyLabelingSuccess);
|
||||
requireApplyLabelingSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireApplyLabelingSuccess:" + requireApplyLabelingSuccess);
|
||||
}
|
||||
if (mode == 5) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireApplyLaStrangulationSuccess:" + requireApplyLaStrangulationSuccess);
|
||||
requireApplyLaStrangulationSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireApplyLaStrangulationSuccess:" + requireApplyLaStrangulationSuccess);
|
||||
}
|
||||
if (mode == 6) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireEmptyInSuccess:" + requireEmptyInSuccess);
|
||||
requireEmptyInSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireEmptyInSuccess:" + requireEmptyInSuccess);
|
||||
}
|
||||
if (mode == 7) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireEmptyOutSuccess:" + requireEmptyOutSuccess);
|
||||
requireEmptyOutSuccess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireEmptyOutSuccess:" + requireEmptyOutSuccess);
|
||||
}
|
||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||
@@ -233,6 +265,31 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
if (move > 0 && !requireSucess) {
|
||||
instruction_require();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
//申请贴标
|
||||
if (move > 0 && !requireApplyLabelingSuccess) {
|
||||
applyLabeling();
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
//申请困扎
|
||||
if (move > 0 && !requireApplyLaStrangulationSuccess) {
|
||||
applyLaStrangulation();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
//空托盘满垛入库申请
|
||||
if (move > 0 && !requireEmptyInSuccess) {
|
||||
emptyIn();
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
//空托盘满垛出库申请
|
||||
if (move > 0 && !requireEmptyOutSuccess) {
|
||||
emptyOut();
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -274,7 +331,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
|
||||
protected void thingToNothing() throws Exception {
|
||||
this.setRequireSucess(false);
|
||||
requireSucess = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -356,9 +413,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
String requestSucess = data.getString("requireSucess");
|
||||
if (StrUtil.equals(requestSucess, "0")) {
|
||||
this.setRequireSucess(false);
|
||||
this.requireSucess = false;
|
||||
} else {
|
||||
this.setRequireSucess(true);
|
||||
this.requireSucess = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,4 +532,66 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void applyLabeling() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_labeling_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
this.require_apply_labeling_time = date;
|
||||
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
|
||||
new ApplyLabelingAndBindingRequest();
|
||||
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0);
|
||||
String start_point_code = null;
|
||||
if (!ObjectUtil.isEmpty(device_json)) {
|
||||
start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code");
|
||||
}
|
||||
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
|
||||
applyLabelingAndBindingRequest.setType("1");
|
||||
acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
requireApplyLabelingSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void applyLaStrangulation() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
this.require_apply_strangulation_time = date;
|
||||
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
|
||||
new ApplyLabelingAndBindingRequest();
|
||||
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0);
|
||||
String start_point_code = null;
|
||||
if (!ObjectUtil.isEmpty(device_json)) {
|
||||
start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code");
|
||||
}
|
||||
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
|
||||
applyLabelingAndBindingRequest.setType("2");
|
||||
acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
|
||||
requireApplyLaStrangulationSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void emptyIn() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_empty_in_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
this.require_empty_in_time = date;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void emptyOut() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.require_empty_out_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return;
|
||||
} else {
|
||||
this.require_empty_out_time = date;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -157,9 +157,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
task2 = this.itemProtocol.getTask2();
|
||||
|
||||
if (mode != last_mode) {
|
||||
//if (mode == 2) {
|
||||
this.setRequireSucess(false);
|
||||
//}
|
||||
if (mode == 2) {
|
||||
logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为:" + requireSucess);
|
||||
requireSucess = false;
|
||||
logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为:" + requireSucess);
|
||||
}
|
||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
@@ -840,7 +842,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
this.sendSignalType(instructionDto, type);
|
||||
|
||||
//请求任务成功
|
||||
this.setRequireSucess(true);
|
||||
requireSucess = true;
|
||||
return flag;
|
||||
}
|
||||
|
||||
@@ -949,7 +951,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
this.sendSignalType(instdto, type);
|
||||
|
||||
//请求任务成功
|
||||
this.setRequireSucess(true);
|
||||
requireSucess = true;
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user