Browse Source

更新

master
gengby 2 years ago
parent
commit
7fc28d6f12
  1. 57
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  2. 17
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskRequest.java
  3. 44
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java
  4. 57
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  5. 20
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  6. 147
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  7. 2
      acs/nladmin-ui/src/views/login.vue

57
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -174,20 +174,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "1");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
map.put("Vehiclecode", inst.getVehicle_code());
map.put("Status", "1");
map.put("Devicecode", inst.getStart_device_code());
map.put("Taskcode", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
}
@ -235,20 +230,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "2");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
map.put("Vehiclecode", inst.getVehicle_code());
map.put("Status", "2");
map.put("Devicecode", inst.getStart_device_code());
map.put("Taskcode", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code());
}
@ -292,20 +282,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("vehicle_code", inst.getVehicle_code());
map.put("status", "3");
map.put("device_code", inst.getStart_point_code());
map.put("task_code", inst.getTask_code());
map.put("Vehiclecode", inst.getVehicle_code());
map.put("Status", "3");
map.put("Devicecode", inst.getNext_device_code());
map.put("Taskcode", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
}
} else {
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
}
@ -345,8 +330,24 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到编号{}对应的指令", ikey);
return;
}
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
Object reqWms = device.getExtraValue().get("reqWms");
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
JSONArray req = new JSONArray();
JSONObject map = new JSONObject();
map.put("Vehiclecode", inst.getVehicle_code());
map.put("Status", "4");
map.put("Devicecode", inst.getNext_device_code());
map.put("Taskcode", inst.getTask_code());
req.add(map);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货完成成功", inst.getInstruction_code());
} else {
log.warn("指令号:{},acs请求wms放货完成失败", inst.getInstruction_code());
}
}
}
}
//到达位置点

17
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskRequest.java

@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.data;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.HashMap;
@ -11,24 +12,28 @@ public class CancelTaskRequest extends BaseRequest {
/**
* 任务编号
*/
private String task_code;
@JsonProperty("Taskcode")
private String Taskcode;
/**
* 载具号
*/
String vehicle_code;
@JsonProperty("Vehiclecode")
String Vehiclecode;
/**
* 扩展属性
*/
Map<String,String> params = new HashMap<>();
@JsonProperty("Params")
Map<String,String> Params = new HashMap<>();
@Override
public String toString() {
return "CancelTaskRequest{" +
"task_code='" + task_code + '\'' +
", vehicle_code='" + vehicle_code + '\'' +
", params=" + params +
"Taskcode='" + Taskcode + '\'' +
", Vehiclecode='" + Vehiclecode + '\'' +
", Params=" + Params +
'}';
}
}

44
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java

@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.data;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.HashMap;
@ -13,63 +14,58 @@ public class CreateTaskRequest extends BaseRequest {
/**
* 任务编号
*/
private String task_code;
@JsonProperty("Taskcode")
private String Taskcode;
/**
* 取货点1
*/
String start_device_code;
@JsonProperty("Startdevicecode")
String Startdevicecode;
/**
* 放货点1
*/
String next_device_code;
@JsonProperty("Nextdevicecode")
String Nextdevicecode;
/**
* 优先级
*/
String priority = "1";
@JsonProperty("Priority")
String Priority = "1";
/**
* 载具号
*/
String vehicle_code;
@JsonProperty("Vehiclecode")
String Vehiclecode;
/**
* 载具类型
*/
String vehicle_type;
@JsonProperty("Vehicletype")
String Vehicletype;
/**
* 任务类型
*/
String task_type;
@JsonProperty("Tasktype")
String Tasktype;
/**
* 备注
*/
String remark;
@JsonProperty("Remark")
String Remark;
/**
* 扩展属性
*/
Map<String,String> params = new HashMap<>();
@Override
public String toString() {
return "CreateTaskRequest{" +
"task_code='" + task_code + '\'' +
", start_device_code='" + start_device_code + '\'' +
", next_device_code='" + next_device_code + '\'' +
", priority='" + priority + '\'' +
", vehicle_code='" + vehicle_code + '\'' +
", vehicle_type='" + vehicle_type + '\'' +
", task_type='" + task_type + '\'' +
", remark='" + remark + '\'' +
", params=" + params +
'}';
}
@JsonProperty("Params")
Map<String,String> Params = new HashMap<>();
}

57
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java

@ -19,6 +19,7 @@ import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
@ -97,22 +98,32 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String task_code = "";
for (int i = 0; i < data.size(); i++) {
JSONObject json = (JSONObject) data.get(i);
task_code = json.getString("task_code");
AddressDto getToken = addressService.findByCode("getToken");
String getToken_url = getToken.getMethods_url();
HttpResponse getTokenResult = null;
try {
getTokenResult = HttpRequest
.get(wmsurl + getToken_url)
.execute();
} catch (Exception e) {
logServer.extLog("获取token", "反馈任务状态获取token失败" + e.getMessage());
return null;
}
TaskDto taskDto = taskService.findByCode(task_code);
String vehicle_code = taskDto.getVehicle_code();
HttpResponse result2 = null;
String token = getTokenResult.body();
logServer.extLog("获取token", "反馈任务状态获取token成功" + token);
HttpResponse result = null;
log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString());
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
String methods_url = addressDto.getMethods_url();
String url = wmsurl + methods_url;
try {
result2 = HttpRequest.post(wmsurl + methods_url)
.header("Authorization", token).body(String.valueOf(data))
result = HttpRequest
.post(url + "?token=" + token)
.header("Content-Type", "application/json")
.body(String.valueOf(data))
.execute();
// //System.out.println(result2);
} catch (Exception e) {
@ -122,18 +133,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("feedbackTaskStatusToWms-----输出参数{}", msg);
}
String type = "";
if (result2.getStatus() == 200) {
if (result.getStatus() == 200) {
type = "info";
} else {
type = "error";
}
JSONObject jo = JSONObject.parseObject(result2.body());
JSONObject jo = JSONObject.parseObject(result.body());
log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
return result2;
return result;
} finally {
MDC.remove(log_file_type);
}
@ -472,7 +480,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
@Override
public UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest param) {
try {
@ -534,6 +541,22 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public HttpResponse feedAgvTaskStatus(JSONArray from) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto getToken = addressService.findByCode("getToken");
String getToken_url = getToken.getMethods_url();
HttpResponse getTokenResult = null;
try {
getTokenResult = HttpRequest
.get(wmsUrl + getToken_url)
.execute();
} catch (Exception e) {
logServer.extLog("获取token", e.getMessage());
return null;
}
String token = getTokenResult.body();
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
@ -541,7 +564,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
log.info("feedAgvTaskStatus----请求参数{}", from);
try {
result = HttpRequest.post(url)
result = HttpRequest.post(url + "?token=" + token)
.body(String.valueOf(from))
.execute();
System.out.println(result);

20
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -71,8 +71,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONArray errArr = new JSONArray();
for (int i = 0; i < reqs.size(); i++) {
CancelTaskRequest request = reqs.get(i);
String task_code = request.getTask_code();
String vehicle_code = request.getVehicle_code();
String task_code = request.getTaskcode();
String vehicle_code = request.getVehiclecode();
Map<String, String> params = request.getParams();
if (StrUtil.isEmpty(task_code)) {
throw new WDKException("任务号不能为空");
@ -460,13 +460,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONArray errArr = new JSONArray();
for (int i = 0; i < reqs.size(); i++) {
CreateTaskRequest req = reqs.get(i);
String task_code = req.getTask_code();
String start_device_code = req.getStart_device_code();
String next_device_code = req.getNext_device_code();
String task_code = req.getTaskcode();
String start_device_code = req.getStartdevicecode();
String next_device_code = req.getNextdevicecode();
String priority = req.getPriority();
String vehicle_code = req.getVehicle_code();
String vehicle_type = req.getVehicle_type();
String task_type = req.getTask_type();
String vehicle_code = req.getVehiclecode();
String vehicle_type = req.getVehicletype();
String task_type = req.getTasktype();
String remark = req.getRemark();
Map<String, String> params = req.getParams();
@ -542,14 +542,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (StrUtil.isEmpty(start_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", req.getStart_device_code() + " 该设备号未找到对应点位");
json.put("message", req.getStartdevicecode() + " 该设备号未找到对应点位");
errArr.add(json);
continue;
}
if (StrUtil.isEmpty(next_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", req.getNext_device_code() + " 该设备号未找到对应点位");
json.put("message", req.getNextdevicecode() + " 该设备号未找到对应点位");
errArr.add(json);
continue;
}

147
acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -702,16 +702,15 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", dto.getTask_code());
feed_jo.put("task_status", dto.getTask_status());
feed_jo.put("Taskcode", dto.getTask_code());
feed_jo.put("Taskstatus", dto.getTask_status());
JSONArray ja = new JSONArray();
ja.add(feed_jo);
String message = null;
HttpResponse body = null;
boolean flag = false;
try {
body = acstowmsService.feedbackTaskStatusToWms(ja);
// body = acstowmsService.feedbackTaskStatusToWms(ja);
} catch (Exception e) {
flag = true;
message = e.getMessage();
@ -719,71 +718,71 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
} finally {
}
if (flag) {
if (ObjectUtil.isEmpty(feefbackdto)) {
feefbackdto = new TaskFeedbackDto();
feefbackdto.setTask_id(entity.getTask_id());
feefbackdto.setTask_code(entity.getTask_code());
feefbackdto.setTask_status(entity.getTask_status());
feefbackdto.setVehicle_type(entity.getVehicle_type());
feefbackdto.setVehicle_code(entity.getVehicle_code());
feefbackdto.setStart_device_code(entity.getStart_device_code());
feefbackdto.setStart_point_code(entity.getStart_point_code());
feefbackdto.setNext_device_code(entity.getNext_device_code());
feefbackdto.setNext_point_code(entity.getNext_point_code());
feefbackdto.setError_code("400");
feefbackdto.setIs_finished("0");
feefbackdto.setRemark(message);
taskFeedbackService.create(feefbackdto);
} else {
feefbackdto.setTask_status(entity.getTask_status());
feefbackdto.setStart_device_code(entity.getStart_device_code());
feefbackdto.setStart_point_code(entity.getStart_point_code());
feefbackdto.setNext_device_code(entity.getNext_device_code());
feefbackdto.setNext_point_code(entity.getNext_point_code());
feefbackdto.setError_code("400");
feefbackdto.setRemark(message);
taskFeedbackService.update(feefbackdto);
}
} else {
int status = body.getStatus();
JSONObject jo = JSONObject.parseObject(body.body());
if (ObjectUtil.isEmpty(feefbackdto)) {
feefbackdto = new TaskFeedbackDto();
feefbackdto.setTask_id(entity.getTask_id());
feefbackdto.setTask_code(entity.getTask_code());
feefbackdto.setTask_status(entity.getTask_status());
feefbackdto.setVehicle_type(entity.getVehicle_type());
feefbackdto.setVehicle_code(entity.getVehicle_code());
feefbackdto.setError_code(String.valueOf(body.getStatus()));
feefbackdto.setStart_device_code(entity.getStart_device_code());
feefbackdto.setStart_point_code(entity.getNext_point_code());
feefbackdto.setNext_device_code(entity.getNext_device_code());
feefbackdto.setNext_point_code(entity.getNext_point_code());
if (status == 200) {
if (StrUtil.equals(entity.getTask_status(), "2")) {
feefbackdto.setIs_finished("1");
} else {
feefbackdto.setIs_finished("0");
}
} else {
feefbackdto.setIs_finished("0");
feefbackdto.setRemark(jo.getString("message"));
}
taskFeedbackService.create(feefbackdto);
} else {
feefbackdto.setTask_status(entity.getTask_status());
if (status == 200) {
} else {
if (StrUtil.equals(entity.getTask_status(), "2")) {
feefbackdto.setIs_finished("1");
} else {
feefbackdto.setIs_finished("0");
}
}
taskFeedbackService.update(feefbackdto);
}
}
// if (flag) {
// if (ObjectUtil.isEmpty(feefbackdto)) {
// feefbackdto = new TaskFeedbackDto();
// feefbackdto.setTask_id(entity.getTask_id());
// feefbackdto.setTask_code(entity.getTask_code());
// feefbackdto.setTask_status(entity.getTask_status());
// feefbackdto.setVehicle_type(entity.getVehicle_type());
// feefbackdto.setVehicle_code(entity.getVehicle_code());
// feefbackdto.setStart_device_code(entity.getStart_device_code());
// feefbackdto.setStart_point_code(entity.getStart_point_code());
// feefbackdto.setNext_device_code(entity.getNext_device_code());
// feefbackdto.setNext_point_code(entity.getNext_point_code());
// feefbackdto.setError_code("400");
// feefbackdto.setIs_finished("0");
// feefbackdto.setRemark(message);
// taskFeedbackService.create(feefbackdto);
// } else {
// feefbackdto.setTask_status(entity.getTask_status());
// feefbackdto.setStart_device_code(entity.getStart_device_code());
// feefbackdto.setStart_point_code(entity.getStart_point_code());
// feefbackdto.setNext_device_code(entity.getNext_device_code());
// feefbackdto.setNext_point_code(entity.getNext_point_code());
// feefbackdto.setError_code("400");
// feefbackdto.setRemark(message);
// taskFeedbackService.update(feefbackdto);
// }
// } else {
// int status = body.getStatus();
// JSONObject jo = JSONObject.parseObject(body.body());
// if (ObjectUtil.isEmpty(feefbackdto)) {
// feefbackdto = new TaskFeedbackDto();
// feefbackdto.setTask_id(entity.getTask_id());
// feefbackdto.setTask_code(entity.getTask_code());
// feefbackdto.setTask_status(entity.getTask_status());
// feefbackdto.setVehicle_type(entity.getVehicle_type());
// feefbackdto.setVehicle_code(entity.getVehicle_code());
// feefbackdto.setError_code(String.valueOf(body.getStatus()));
// feefbackdto.setStart_device_code(entity.getStart_device_code());
// feefbackdto.setStart_point_code(entity.getNext_point_code());
// feefbackdto.setNext_device_code(entity.getNext_device_code());
// feefbackdto.setNext_point_code(entity.getNext_point_code());
// if (status == 200) {
// if (StrUtil.equals(entity.getTask_status(), "2")) {
// feefbackdto.setIs_finished("1");
// } else {
// feefbackdto.setIs_finished("0");
// }
// } else {
// feefbackdto.setIs_finished("0");
// feefbackdto.setRemark(jo.getString("message"));
// }
// taskFeedbackService.create(feefbackdto);
// } else {
// feefbackdto.setTask_status(entity.getTask_status());
// if (status == 200) {
// } else {
// if (StrUtil.equals(entity.getTask_status(), "2")) {
// feefbackdto.setIs_finished("1");
// } else {
// feefbackdto.setIs_finished("0");
// }
// }
// taskFeedbackService.update(feefbackdto);
// }
// }
}
}
@ -819,9 +818,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
System.out.println(feefbackdto == null);
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getTask_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
feed_jo.put("Taskcode", entity.getTask_code());
feed_jo.put("Taskstatus", entity.getTask_status());
JSONArray ja = new JSONArray();
ja.add(feed_jo);
String message = null;
@ -953,9 +951,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getTask_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
feed_jo.put("Taskcode", entity.getTask_code());
feed_jo.put("Taskstatus", entity.getTask_status());
JSONArray ja = new JSONArray();
ja.add(feed_jo);
acstowmsService.feedbackTaskStatusToWms(ja);

2
acs/nladmin-ui/src/views/login.vue

@ -50,7 +50,7 @@ export default {
name: 'Login',
data() {
return {
title: '诺力开发平台',
title: '中泰龙ACS平台',
title_param: 'platform',
Background: Background,
codeUrl: '',

Loading…
Cancel
Save