更新
This commit is contained in:
@@ -24,6 +24,9 @@ public class HailiangPackerStationDevice extends AbstractDriverService {
|
||||
Boolean requireSucess = hailiangPackerStationDeviceDriver.getRequireSucess();
|
||||
jo.put("requestSucess",StageActorUtil.getRequestSucess(requireSucess));
|
||||
jo.put("requireSucess",StageActorUtil.getRequireSucess(requireSucess));
|
||||
Boolean fullrequireSucess = hailiangPackerStationDeviceDriver.getFullrequireSucess();
|
||||
jo.put("fullrequestSucess",StageActorUtil.getRequestSucess(fullrequireSucess));
|
||||
jo.put("fullrequireSucess",StageActorUtil.getRequireSucess(fullrequireSucess));
|
||||
jo.put("driver_type",device.getDeviceDriverDefination().getDriverCode());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -856,6 +856,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
String islock = form.getString("islock");
|
||||
String requireSucess = form.getString("requireSucess");
|
||||
String fullrequireSucess = form.getString("fullrequireSucess");
|
||||
if (device_code.indexOf(".") != -1) {
|
||||
device_code = device_code.substring(0, device_code.indexOf("."));
|
||||
}
|
||||
@@ -959,6 +960,13 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
hailiangPackerStationDeviceDriver.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
if(StrUtil.isNotEmpty(fullrequireSucess)) {
|
||||
if (fullrequireSucess.equals("0")){
|
||||
hailiangPackerStationDeviceDriver.setFullrequireSucess(false);
|
||||
} else {
|
||||
hailiangPackerStationDeviceDriver.setFullrequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
private int instruction_require_time_out = 3000;
|
||||
//请求成功标记
|
||||
Boolean requireSucess = false;
|
||||
Boolean fullrequireSucess = false;
|
||||
//申请指令成功标记
|
||||
Boolean applySucess = false;
|
||||
String inst_message;
|
||||
@@ -203,7 +204,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
if (req_task_empty != last_req_task_empty) {
|
||||
if (req_task_empty == 0) {
|
||||
this.setRequireSucess(false);
|
||||
this.setFullrequireSucess(false);
|
||||
}
|
||||
logServer.deviceLog(this.device_code, "req_task_empty", String.valueOf(req_task_empty));
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "信号req_task_empty:" + last_req_task_empty + "->" + req_task_empty);
|
||||
@@ -306,13 +307,12 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,move:" + move + ",mode:" + mode + ",requireSucess:" + requireSucess + "开始申请缺料请求任务");
|
||||
apply_task();
|
||||
}
|
||||
|
||||
}
|
||||
if (!fullrequireSucess){
|
||||
if (mode == 1 && req_task_empty == 1 && move == 1) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,move:" + move + ",mode:" + mode + ",requireSucess:" + requireSucess + "开始申请请求取走空料斗任务");
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":,move:" + move + ",mode:" + mode + ",fullrequireSucess:" + fullrequireSucess + "开始申请请求取走空料斗任务");
|
||||
apply_take_empty_task();
|
||||
}
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", "是否请求成功:requireSucess:" + requireSucess);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
//生成任务成功
|
||||
if (flag) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":取走空料斗任务创建成功");
|
||||
requireSucess = true;
|
||||
fullrequireSucess = true;
|
||||
} else {
|
||||
//如果都没有则调用mes接口申请入缓存线
|
||||
//生成任务
|
||||
|
||||
@@ -118,7 +118,7 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
String inst_message;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
private Date instruction_apply_time = new Date();
|
||||
int agvphase=0;
|
||||
int index =0;
|
||||
|
||||
@@ -245,14 +245,11 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
List toInstructions;
|
||||
|
||||
if(!requireSucess){
|
||||
Device device = deviceAppservice.findDeviceByCode(device_code);
|
||||
Integer min_num = Integer.parseInt(device.getExtraValue().get("min_num")+"");
|
||||
// TODO 是否需要手自动状态开启判断条件
|
||||
if ( mode == 1 && storage_stock_num < min_num ) {
|
||||
if ( mode == 1) {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":requireSucess:" + requireSucess + "开始申请任务");
|
||||
applyOutCacheLineTask();
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":requireSucess:" + requireSucess + "倒料位数量:"+storage_stock_num+"最小数量:"+min_num+ "申请任务失败,不符合条件");
|
||||
logServer.deviceLogToacs(this.device_code,"","",device_code+":requireSucess:" + requireSucess + "申请任务失败,不符合条件");
|
||||
}
|
||||
} else {
|
||||
logServer.deviceLogToacs(this.device_code,"","","是否请求成功:requireSucess:"+requireSucess);
|
||||
@@ -312,60 +309,70 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
}
|
||||
|
||||
public synchronized boolean applyOutCacheLineTask() throws Exception {
|
||||
Boolean flag = false;
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code",device_code);
|
||||
json.put("type","2");
|
||||
HttpResponse httpResponse = acsToWmsService.applyOutCacheLineTask(json);
|
||||
String body = httpResponse.body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
String ext_task_id = jsonObject.getString("ext_task_id");
|
||||
String task_code = jsonObject.getString("task_code");
|
||||
String start_device_code = jsonObject.getString("start_device_code");
|
||||
String put_device_code = jsonObject.getString("put_device_code");
|
||||
String next_device_code = jsonObject.getString("next_device_code");
|
||||
String task_type = jsonObject.getString("task_type");
|
||||
TaskDto onedto = new TaskDto();
|
||||
String now = DateUtil.now();
|
||||
onedto.setTask_id(IdUtil.simpleUUID());
|
||||
onedto.setQuantity(String.valueOf(full_number));
|
||||
onedto.setCreate_by(this.getDevice().getDevice_code());
|
||||
onedto.setUpdate_by(this.getDevice().getDevice_code());
|
||||
onedto.setRoute_plan_code("normal");
|
||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
onedto.setTask_code("-" + taskcode);
|
||||
onedto.setTask_status("0");
|
||||
onedto.setPriority("101");
|
||||
onedto.setAgv_system_type("1");
|
||||
onedto.setTask_type(task_type);
|
||||
onedto.setExt_task_id(ext_task_id);
|
||||
onedto.setTask_id(IdUtil.simpleUUID());
|
||||
onedto.setTask_code(task_code);
|
||||
onedto.setStart_device_code(start_device_code);
|
||||
onedto.setStart_point_code(start_device_code);
|
||||
onedto.setPut_device_code(put_device_code);
|
||||
onedto.setPut_point_code(put_device_code);
|
||||
onedto.setNext_point_code(next_device_code);
|
||||
onedto.setNext_device_code(next_device_code);
|
||||
onedto.setUpdate_time(now);
|
||||
onedto.setCreate_time(now);
|
||||
|
||||
try {
|
||||
taskserver.create(onedto);
|
||||
flag = true;
|
||||
} catch (Exception e) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":创建任务失败," + String.valueOf(e.getMessage()));
|
||||
}
|
||||
//生成任务成功
|
||||
if (flag) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":专机生成任务成功");
|
||||
requireSucess = true;
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
//如果都没有则调用mes接口申请入缓存线
|
||||
//生成任务
|
||||
//前往缓存线
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":分配任务缓存线");
|
||||
Boolean flag = false;
|
||||
Device device = deviceAppservice.findDeviceByCode(device_code);
|
||||
Integer min_num = Integer.parseInt(device.getExtraValue().get("min_num")+"");
|
||||
if (storage_stock_num < min_num ){
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code",device_code);
|
||||
json.put("type","2");
|
||||
HttpResponse httpResponse = acsToWmsService.applyOutCacheLineTask(json);
|
||||
String body = httpResponse.body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
String ext_task_id = jsonObject.getString("ext_task_id");
|
||||
String task_code = jsonObject.getString("task_code");
|
||||
String start_device_code = jsonObject.getString("start_device_code");
|
||||
String put_device_code = jsonObject.getString("put_device_code");
|
||||
String next_device_code = jsonObject.getString("next_device_code");
|
||||
String task_type = jsonObject.getString("task_type");
|
||||
TaskDto onedto = new TaskDto();
|
||||
String now = DateUtil.now();
|
||||
onedto.setTask_id(IdUtil.simpleUUID());
|
||||
onedto.setQuantity(String.valueOf(full_number));
|
||||
onedto.setCreate_by(this.getDevice().getDevice_code());
|
||||
onedto.setUpdate_by(this.getDevice().getDevice_code());
|
||||
onedto.setRoute_plan_code("normal");
|
||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
onedto.setTask_code("-" + taskcode);
|
||||
onedto.setTask_status("0");
|
||||
onedto.setPriority("101");
|
||||
onedto.setAgv_system_type("1");
|
||||
onedto.setTask_type(task_type);
|
||||
onedto.setExt_task_id(ext_task_id);
|
||||
onedto.setTask_id(IdUtil.simpleUUID());
|
||||
onedto.setTask_code(task_code);
|
||||
onedto.setStart_device_code(start_device_code);
|
||||
onedto.setStart_point_code(start_device_code);
|
||||
onedto.setPut_device_code(put_device_code);
|
||||
onedto.setPut_point_code(put_device_code);
|
||||
onedto.setNext_point_code(next_device_code);
|
||||
onedto.setNext_device_code(next_device_code);
|
||||
onedto.setUpdate_time(now);
|
||||
onedto.setCreate_time(now);
|
||||
try {
|
||||
taskserver.create(onedto);
|
||||
flag = true;
|
||||
} catch (Exception e) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":创建任务失败," + String.valueOf(e.getMessage()));
|
||||
}
|
||||
}
|
||||
//生成任务成功
|
||||
if (flag) {
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":专机生成任务成功");
|
||||
requireSucess = true;
|
||||
} else {
|
||||
//如果都没有则调用mes接口申请入缓存线
|
||||
//生成任务
|
||||
//前往缓存线
|
||||
logServer.deviceLogToacs(this.device_code, "", "", device_code + ":分配任务缓存线");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user