rev:加定时
This commit is contained in:
@@ -24,6 +24,7 @@ import org.nl.modules.quartz.task.QueryXGTGroupStatus;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@@ -109,6 +110,9 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
* 车号
|
||||
*/
|
||||
private String car_no;
|
||||
private Date instruction_require_time = new Date();
|
||||
|
||||
private int instruction_require_time_out = 5000;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
@@ -133,8 +137,16 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
|
||||
@Override
|
||||
public void executeLogic() {
|
||||
if (this.error != this.lastError ) {
|
||||
if (this.error == 1 || this.error == 5) {
|
||||
this.requireSuccess = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.requireSuccess) {
|
||||
this.executeLogicBefore();
|
||||
}
|
||||
|
||||
this.executeLogicBefore();
|
||||
if (!this.online) {
|
||||
this.message = "设备离线";
|
||||
} else if (this.mode == 0) {
|
||||
@@ -150,74 +162,90 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
}
|
||||
|
||||
private void executeLogicBefore() {
|
||||
// 告诉agv急停(车辆)
|
||||
if (error == 1) {
|
||||
// 只给agv下发第二个互斥组,例如GS01A2
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
// 根据当前互斥组设备里的状态
|
||||
JSONObject param = new JSONObject();
|
||||
String[] paramArr = {this.currentDeviceCode};
|
||||
param.put("blockGroup", paramArr);
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
// 告诉agv急停(车辆)
|
||||
if (error == 1) {
|
||||
// 只给agv下发第二个互斥组,例如GS01A2
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
// 根据当前互斥组设备里的状态
|
||||
JSONObject param = new JSONObject();
|
||||
String[] paramArr = {this.currentDeviceCode};
|
||||
param.put("blockGroup", paramArr);
|
||||
|
||||
UnifiedResponse<List<JSONObject>> objectUnifiedResponse = SpringContextHolder.getBean(XianGongAgvService.class).blockGroupStatus(param);
|
||||
List<JSONObject> dataList = objectUnifiedResponse.getData();
|
||||
UnifiedResponse<List<JSONObject>> objectUnifiedResponse = SpringContextHolder.getBean(XianGongAgvService.class).blockGroupStatus(param);
|
||||
List<JSONObject> dataList = objectUnifiedResponse.getData();
|
||||
|
||||
String[] carArr = {dataList.get(0).getString("id")};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
if (ObjectUtil.isNotEmpty(carArr[0])) {
|
||||
// 请求下发agv急停
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
xianGongAgv.sendOrderStopToXZ(json);
|
||||
boolean success1 = objectUnifiedResponse.isSuccess();
|
||||
if (success1) {
|
||||
requireSuccess = true;
|
||||
}
|
||||
|
||||
String[] carArr = {dataList.get(0).getString("id")};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
if (ObjectUtil.isNotEmpty(carArr[0])) {
|
||||
// 请求下发agv急停
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
UnifiedResponse<Object> objectUnifiedResponse1 = xianGongAgv.sendOrderStopToXZ(json);
|
||||
boolean success = objectUnifiedResponse1.isSuccess();
|
||||
if (success) {
|
||||
requireSuccess = true;
|
||||
} else {
|
||||
requireSuccess = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* // 告诉agv急停(互斥组)
|
||||
if (error == 1) {
|
||||
JSONObject json = new JSONObject();
|
||||
// 只给agv下发第二个互斥组,例如GS01A2
|
||||
// 给光栅下发命令5
|
||||
if (error == 5) {
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
// 给输送线写5
|
||||
String[] key = {"toCommand"};
|
||||
Integer[] value = {5};
|
||||
writing(Arrays.asList(key),Arrays.asList(value));
|
||||
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
json.put("block_name", this.currentDeviceCode);
|
||||
// 根据当前互斥组设备里的状态
|
||||
JSONObject param = new JSONObject();
|
||||
String[] paramArr = {this.currentDeviceCode};
|
||||
param.put("blockGroup", paramArr);
|
||||
|
||||
// 请求下发agv急停
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
xianGongAgv.sendOrderStopToXZ(json);
|
||||
}
|
||||
}*/
|
||||
UnifiedResponse<List<JSONObject>> objectUnifiedResponse = SpringContextHolder.getBean(XianGongAgvService.class).blockGroupStatus(param);
|
||||
List<JSONObject> dataList = objectUnifiedResponse.getData();
|
||||
|
||||
// 给光栅下发命令5
|
||||
if (error == 5) {
|
||||
String substring = this.currentDeviceCode.substring(this.currentDeviceCode.length() - 1);
|
||||
if (substring.equals("2")) {
|
||||
// 给输送线写5
|
||||
String[] key = {"toCommand"};
|
||||
Integer[] value = {5};
|
||||
writing(Arrays.asList(key),Arrays.asList(value));
|
||||
boolean success1 = objectUnifiedResponse.isSuccess();
|
||||
if (success1) {
|
||||
requireSuccess = true;
|
||||
}
|
||||
|
||||
// 根据当前互斥组设备里的状态
|
||||
JSONObject param = new JSONObject();
|
||||
String[] paramArr = {this.currentDeviceCode};
|
||||
param.put("blockGroup", paramArr);
|
||||
String[] carArr = {dataList.get(0).getString("id")};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
|
||||
UnifiedResponse<List<JSONObject>> objectUnifiedResponse = SpringContextHolder.getBean(XianGongAgvService.class).blockGroupStatus(param);
|
||||
List<JSONObject> dataList = objectUnifiedResponse.getData();
|
||||
// 请求下发agv继续
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
UnifiedResponse<Object> objectUnifiedResponse1 = xianGongAgv.sendOrderContinueToXZ(json);
|
||||
|
||||
String[] carArr = {dataList.get(0).getString("id")};
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicles", carArr);
|
||||
|
||||
// 请求下发agv继续
|
||||
XianGongAgvServiceImpl xianGongAgv = SpringContextHolder.getBean(XianGongAgvServiceImpl.class);
|
||||
//创建订单序列
|
||||
xianGongAgv.sendOrderContinueToXZ(json);
|
||||
boolean success = objectUnifiedResponse1.isSuccess();
|
||||
if (success) {
|
||||
requireSuccess = true;
|
||||
} else {
|
||||
requireSuccess = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user