rev:现场代码优化
This commit is contained in:
@@ -29,10 +29,18 @@ public interface TaskConfigService {
|
|||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
*
|
*
|
||||||
* @param task_config_id ID
|
* @param task_config_id ID
|
||||||
* @return Address
|
* @return TaskConfigDto
|
||||||
*/
|
*/
|
||||||
TaskConfigDto findById(String task_config_id);
|
TaskConfigDto findById(String task_config_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
*
|
||||||
|
* @param startCode
|
||||||
|
* @return TaskConfigDto
|
||||||
|
*/
|
||||||
|
TaskConfigDto findByStartCode(String startCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -54,6 +54,17 @@ public class TaskConfigServiceImpl implements TaskConfigService {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskConfigDto findByStartCode(String startCode) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("task_config");
|
||||||
|
JSONObject json = wo.query("point_code1 ='" + startCode + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(json)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final TaskConfigDto obj = json.toJavaObject(TaskConfigDto.class);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(TaskConfigDto dto) {
|
public void create(TaskConfigDto dto) {
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
|||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
|
||||||
this.devicecode = this.getDevice().getDevice_code();
|
this.devicecode = this.getDevice().getDevice_code();
|
||||||
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
|
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
|
||||||
Instruction instruction = instructionService.findByCodeFromCache(this.reqTakeInstCode);
|
Instruction instruction = instructionService.findByCodeFromCache(this.reqTakeInstCode);
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(2000);
|
|
||||||
this.devicecode = this.getDevice().getDevice_code();
|
this.devicecode = this.getDevice().getDevice_code();
|
||||||
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
|
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
|
||||||
Instruction instruction = instructionService.findByCodeFromCache(this.reqTakeInstCode);
|
Instruction instruction = instructionService.findByCodeFromCache(this.reqTakeInstCode);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package org.nl.acs.ext.wms.service;
|
package org.nl.acs.ext.wms.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.modules.layout.mapLayout.dto.AgvStatus;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface NDCToAcsService {
|
public interface NDCToAcsService {
|
||||||
|
|
||||||
@@ -10,4 +13,11 @@ public interface NDCToAcsService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
JSONObject agvCallback(JSONObject requestParam) throws Exception;
|
JSONObject agvCallback(JSONObject requestParam) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有AGV
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, AgvStatus> findAllAgvFromCache();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,14 @@ import org.nl.acs.instruction.service.InstructionService;
|
|||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
import org.nl.acs.opc.Device;
|
import org.nl.acs.opc.Device;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.modules.layout.mapLayout.dto.AgvStatus;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -34,6 +39,8 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DeviceAppService deviceAppService;
|
private DeviceAppService deviceAppService;
|
||||||
|
|
||||||
|
Map<String, AgvStatus> AGVDeviceStatus = new HashMap();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject agvCallback(JSONObject requestParam) throws Exception{
|
public JSONObject agvCallback(JSONObject requestParam) throws Exception{
|
||||||
JSONObject resp = new JSONObject();
|
JSONObject resp = new JSONObject();
|
||||||
@@ -99,10 +106,30 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
case RELEASE_COMPLETE:
|
case RELEASE_COMPLETE:
|
||||||
if (TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase) || TaskPhaseEnum.PICKUP_COMPLETE.getValue().equals(taskPhase)){
|
if (TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase) || TaskPhaseEnum.PICKUP_COMPLETE.getValue().equals(taskPhase)){
|
||||||
device = deviceAppService.findDeviceByCode(instruction.getStart_point_code());
|
device = deviceAppService.findDeviceByCode(instruction.getStart_point_code());
|
||||||
|
AgvStatus agvStatus = AgvStatus.builder()
|
||||||
|
.carId(instruction.getCarno())
|
||||||
|
.action(TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)?"AGV请求取货上报" : "AGV取货完成上报")
|
||||||
|
.actionInfo(TaskPhaseEnum.PICKUP_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)?"AGV请求取货上报" : "AGV取货完成上报").build();
|
||||||
|
if (AGVDeviceStatus.containsKey(instruction.getCarno())){
|
||||||
|
AGVDeviceStatus.remove(instruction.getCarno());
|
||||||
|
AGVDeviceStatus.put(instruction.getCarno(),agvStatus);
|
||||||
|
}else {
|
||||||
|
AGVDeviceStatus.put(instruction.getCarno(),agvStatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//taskPhase 请求放货上报,放货完成上报
|
//taskPhase 请求放货上报,放货完成上报
|
||||||
if (TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)||TaskPhaseEnum.RELEASE_COMPLETE.getValue().equals(taskPhase)){
|
if (TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)||TaskPhaseEnum.RELEASE_COMPLETE.getValue().equals(taskPhase)){
|
||||||
device = deviceAppService.findDeviceByCode(instruction.getNext_point_code());
|
device = deviceAppService.findDeviceByCode(instruction.getNext_point_code());
|
||||||
|
AgvStatus agvStatus = AgvStatus.builder()
|
||||||
|
.carId(instruction.getCarno())
|
||||||
|
.action(TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)?"AGV请求放货上报":"AGV放货完成上报")
|
||||||
|
.actionInfo(TaskPhaseEnum.RELEASE_REQUEST_OR_RESPONSE.getValue().equals(taskPhase)?"AGV请求放货上报":"AGV放货完成上报").build();
|
||||||
|
if (AGVDeviceStatus.containsKey(instruction.getCarno())){
|
||||||
|
AGVDeviceStatus.remove(instruction.getCarno());
|
||||||
|
AGVDeviceStatus.put(instruction.getCarno(),agvStatus);
|
||||||
|
}else {
|
||||||
|
AGVDeviceStatus.put(instruction.getCarno(),agvStatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (device == null){
|
if (device == null){
|
||||||
resp.put("code", "400");
|
resp.put("code", "400");
|
||||||
@@ -183,6 +210,17 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
else if (MsgTypeEnum.AGV_POWER_RPT.getValue().equals(type)){
|
else if (MsgTypeEnum.AGV_POWER_RPT.getValue().equals(type)){
|
||||||
int agvId = params.getIntValue("agvId");
|
int agvId = params.getIntValue("agvId");
|
||||||
int stateValue = params.getIntValue("stateValue");
|
int stateValue = params.getIntValue("stateValue");
|
||||||
|
AgvStatus agvStatus = AgvStatus.builder()
|
||||||
|
.carId(String.valueOf(agvId))
|
||||||
|
.action("AGV电量上报")
|
||||||
|
.actionInfo("AGV电量上报")
|
||||||
|
.power(stateValue).build();
|
||||||
|
if (AGVDeviceStatus.containsKey(String.valueOf(agvId))){
|
||||||
|
AGVDeviceStatus.remove(String.valueOf(agvId));
|
||||||
|
AGVDeviceStatus.put(String.valueOf(agvId),agvStatus);
|
||||||
|
}else {
|
||||||
|
AGVDeviceStatus.put(String.valueOf(agvId),agvStatus);
|
||||||
|
}
|
||||||
resp.put("code", "200");
|
resp.put("code", "200");
|
||||||
resp.put("message", "更新指令执行中成功");
|
resp.put("message", "更新指令执行中成功");
|
||||||
log.info("---响应kit请求---"+resp.toString());
|
log.info("---响应kit请求---"+resp.toString());
|
||||||
@@ -195,6 +233,22 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
int yLocation = params.getIntValue("yLocation");
|
int yLocation = params.getIntValue("yLocation");
|
||||||
int angle = params.getIntValue("angle");
|
int angle = params.getIntValue("angle");
|
||||||
int speed = params.getIntValue("speed");
|
int speed = params.getIntValue("speed");
|
||||||
|
AgvStatus agvStatus = AgvStatus.builder()
|
||||||
|
.status(String.valueOf(stateValue))
|
||||||
|
.carId(String.valueOf(agvId))
|
||||||
|
.action("AGV状态上报")
|
||||||
|
.actionInfo("AGV状态上报")
|
||||||
|
.icon("/Users/mima0000/Desktop/car.png")
|
||||||
|
.fileId("3029")
|
||||||
|
.x(new Random().nextInt(1189) + 100)
|
||||||
|
.y(new Random().nextInt(1189) + 100)
|
||||||
|
.angle(new Random().nextInt(160) + 10).build();
|
||||||
|
if (AGVDeviceStatus.containsKey(String.valueOf(agvId))){
|
||||||
|
AGVDeviceStatus.remove(String.valueOf(agvId));
|
||||||
|
AGVDeviceStatus.put(String.valueOf(agvId),agvStatus);
|
||||||
|
}else {
|
||||||
|
AGVDeviceStatus.put(String.valueOf(agvId),agvStatus);
|
||||||
|
}
|
||||||
resp.put("code", "200");
|
resp.put("code", "200");
|
||||||
resp.put("message", "更新指令执行中成功");
|
resp.put("message", "更新指令执行中成功");
|
||||||
log.info("---响应kit请求---"+resp.toString());
|
log.info("---响应kit请求---"+resp.toString());
|
||||||
@@ -213,4 +267,9 @@ public class NDCToAcsServiceImpl implements NDCToAcsService {
|
|||||||
log.info("---响应kit请求---"+resp.toString());
|
log.info("---响应kit请求---"+resp.toString());
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, AgvStatus> findAllAgvFromCache() {
|
||||||
|
return AGVDeviceStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.dto.TaskQuery;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -135,8 +136,8 @@ public class TaskController {
|
|||||||
@ApiOperation("导出任务")
|
@ApiOperation("导出任务")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
//@PreAuthorize("@el.check('task:list')")
|
//@PreAuthorize("@el.check('task:list')")
|
||||||
public void download(HttpServletResponse response, Map whereJson) throws IOException {
|
public void download(HttpServletResponse response, TaskQuery query) throws IOException {
|
||||||
taskService.download(taskService.queryAll(whereJson), response);
|
taskService.download1(query, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("一体机触发任务")
|
@Log("一体机触发任务")
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package org.nl.acs.task.service;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.acs.instruction.service.dto.Instruction;
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.dto.TaskQuery;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -26,7 +27,7 @@ public interface TaskService {
|
|||||||
* @param page 分页参数
|
* @param page 分页参数
|
||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
*/
|
*/
|
||||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
Map<String, Object> queryAll(Map whereJson,Pageable page);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在缓存中查询所有任务列表
|
* 在缓存中查询所有任务列表
|
||||||
@@ -66,7 +67,7 @@ public interface TaskService {
|
|||||||
* @param whereJson 条件参数
|
* @param whereJson 条件参数
|
||||||
* @return List<AcsTaskDto>
|
* @return List<AcsTaskDto>
|
||||||
*/
|
*/
|
||||||
List<TaskDto> queryAll(Map whereJson);
|
List<TaskDto> queryAll(TaskQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
@@ -349,4 +350,5 @@ public interface TaskService {
|
|||||||
|
|
||||||
List<TaskDto> queryAllByCache();
|
List<TaskDto> queryAllByCache();
|
||||||
|
|
||||||
|
void download1(TaskQuery query, HttpServletResponse response) throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.nl.acs.task.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TaskQuery implements Serializable {
|
||||||
|
private String task_code;
|
||||||
|
private String vehicle_code;
|
||||||
|
private String material_type;
|
||||||
|
private String status;
|
||||||
|
private String point_code;
|
||||||
|
private String createTime;
|
||||||
|
private String end_time;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.acs.task.service.impl;
|
package org.nl.acs.task.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -35,6 +36,7 @@ import org.nl.acs.task.TaskInstructionLock;
|
|||||||
import org.nl.acs.task.service.TaskFeedbackService;
|
import org.nl.acs.task.service.TaskFeedbackService;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.acs.task.service.dto.TaskQuery;
|
||||||
import org.nl.common.utils.MapOf;
|
import org.nl.common.utils.MapOf;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.FileUtil;
|
import org.nl.modules.common.utils.FileUtil;
|
||||||
@@ -281,10 +283,41 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TaskDto> queryAll(Map whereJson) {
|
public List<TaskDto> queryAll(TaskQuery query) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
HashMap<String, String> map = new HashMap<>();
|
||||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
map.put("flag", "2");
|
||||||
List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
String task_code = query.getTask_code();
|
||||||
|
String vehicle_code = query.getVehicle_code();
|
||||||
|
String material_type = query.getMaterial_type();
|
||||||
|
String status = query.getStatus();
|
||||||
|
String point_code = query.getPoint_code();
|
||||||
|
String create_time = query.getCreateTime();
|
||||||
|
String end_time = query.getEnd_time();
|
||||||
|
if (!StrUtil.isEmpty(task_code)) {
|
||||||
|
map.put("task_code", task_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
|
map.put("vehicle_code", vehicle_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(material_type)) {
|
||||||
|
map.put("material_type", material_type);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(status)) {
|
||||||
|
map.put("status", status);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(point_code)) {
|
||||||
|
map.put("point_code", point_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
||||||
|
map.put("create_time", create_time);
|
||||||
|
map.put("end_time", end_time);
|
||||||
|
}
|
||||||
|
JSONObject jsonObject1 =
|
||||||
|
WQL.getWO("QTASK_QUERY")
|
||||||
|
.addParamMap(map)
|
||||||
|
.pageQuery(0,1000, "create_time desc");
|
||||||
|
JSONArray array = jsonObject1.getJSONArray("content");
|
||||||
|
List<TaskDto> list = array.toJavaList(TaskDto.class);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1693,4 +1726,28 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
public List<TaskDto> queryAllByCache() {
|
public List<TaskDto> queryAllByCache() {
|
||||||
return this.tasks;
|
return this.tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download1(TaskQuery query, HttpServletResponse response) throws IOException {
|
||||||
|
List<TaskDto> taskDtos = taskService.queryAll(query);
|
||||||
|
if (CollUtil.isEmpty(taskDtos)){
|
||||||
|
throw new RuntimeException("没有数据!");
|
||||||
|
}
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < taskDtos.size(); i++) {
|
||||||
|
TaskDto taskDto = taskDtos.get(i);
|
||||||
|
Device startDevice = deviceAppService.findDeviceByCode(taskDto.getStart_device_code());
|
||||||
|
Device nextDevice = deviceAppService.findDeviceByCode(taskDto.getNext_device_code());
|
||||||
|
Map<String, Object> mp = new LinkedHashMap<>();
|
||||||
|
mp.put("任务编号", taskDto.getTask_code());
|
||||||
|
mp.put("起点编码", taskDto.getStart_device_code());
|
||||||
|
mp.put("起点名称", startDevice.getDevice_name());
|
||||||
|
mp.put("终点编码", taskDto.getNext_device_code());
|
||||||
|
mp.put("终点名称", nextDevice.getDevice_name());
|
||||||
|
mp.put("创建时间", taskDto.getCreate_time());
|
||||||
|
mp.put("完成时间", taskDto.getUpdate_time());
|
||||||
|
list.add(mp);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package org.nl.hand.rest;
|
package org.nl.hand.rest;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.acs.device.service.TaskConfigService;
|
||||||
|
import org.nl.acs.device.service.dto.TaskConfigDto;
|
||||||
import org.nl.common.utils.MapOf;
|
import org.nl.common.utils.MapOf;
|
||||||
import org.nl.common.utils.TableDataInfo;
|
import org.nl.common.utils.TableDataInfo;
|
||||||
import org.nl.hand.service.PadService;
|
import org.nl.hand.service.PadService;
|
||||||
@@ -27,6 +30,7 @@ import java.util.Map;
|
|||||||
public class PadController {
|
public class PadController {
|
||||||
|
|
||||||
private final PadService padService;
|
private final PadService padService;
|
||||||
|
private final TaskConfigService taskConfigService;
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Log("任务列表")
|
@Log("任务列表")
|
||||||
@@ -86,15 +90,27 @@ public class PadController {
|
|||||||
@PostMapping("/slj")
|
@PostMapping("/slj")
|
||||||
@Log("三联件配送")
|
@Log("三联件配送")
|
||||||
public ResponseEntity<Object> sendSLJ(@RequestBody TaskPad taskPad) {
|
public ResponseEntity<Object> sendSLJ(@RequestBody TaskPad taskPad) {
|
||||||
HashMap<String,String> mapping = MapOf.of("E504020-04", "E504021-04", "E504021-04", "E504020-04",
|
|
||||||
"E504020-02", "E504022-04", "E504020-02", "E504022-04");
|
|
||||||
String point = taskPad.getPoint();
|
String point = taskPad.getPoint();
|
||||||
String endPoint = mapping.get(point);
|
TaskConfigDto taskConfigDto = taskConfigService.findByStartCode(point);
|
||||||
if (StringUtils.isEmpty(endPoint)){
|
if (ObjectUtil.isEmpty(taskConfigDto)){
|
||||||
throw new BadRequestException(point+"当前点位没有对应映射点");
|
throw new BadRequestException(point+"当前点位没有对应映射点");
|
||||||
}
|
}
|
||||||
taskPad.setStart(point);
|
taskPad.setStart(point);
|
||||||
taskPad.setEnd(endPoint);
|
taskPad.setEnd(taskConfigDto.getPoint_code2());
|
||||||
|
padService.callTask(taskPad);
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/ycxb")
|
||||||
|
@Log("油车线边配送")
|
||||||
|
public ResponseEntity<Object> sendYCXB(@RequestBody TaskPad taskPad) {
|
||||||
|
String point = taskPad.getPoint();
|
||||||
|
TaskConfigDto taskConfigDto = taskConfigService.findByStartCode(point);
|
||||||
|
if (ObjectUtil.isEmpty(taskConfigDto)){
|
||||||
|
throw new BadRequestException(point+"当前点位没有对应映射点");
|
||||||
|
}
|
||||||
|
taskPad.setStart(point);
|
||||||
|
taskPad.setEnd(taskConfigDto.getPoint_code2());
|
||||||
padService.callTask(taskPad);
|
padService.callTask(taskPad);
|
||||||
return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,30 +199,36 @@ public class PadServiceImpl implements PadService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void signalInteract(TaskPad pad) {
|
public void signalInteract(TaskPad pad) {
|
||||||
String 安全交互位 = pad.getPoint();
|
String point = pad.getPoint();
|
||||||
String 载具号 = pad.getVehicle_code();
|
String vehicle_code = pad.getVehicle_code();
|
||||||
String 交互类型 = pad.getType();
|
String type = pad.getType();
|
||||||
Device device = deviceAppService.findDeviceByCode(安全交互位);
|
Device device = deviceAppService.findDeviceByCode(point);
|
||||||
if (device ==null){
|
if (device ==null){
|
||||||
throw new BadRequestException("当前安全交互位未配置驱动信息"+安全交互位);
|
throw new BadRequestException("当前安全交互位未配置驱动信息"+point);
|
||||||
}
|
}
|
||||||
Object url = device.getExtraValue().get("address");
|
Object url = device.getExtraValue().get("address");
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
throw new BadRequestException("当前安全交互位未配置交互地址"+安全交互位);
|
throw new BadRequestException("当前安全交互位未配置交互地址"+point);
|
||||||
}
|
}
|
||||||
HashMap of = MapOf.of("point", 安全交互位
|
HashMap of = MapOf.of("point", point
|
||||||
, "type", 交互类型
|
, "type", type
|
||||||
, "containerCode", 载具号
|
, "containerCode", vehicle_code
|
||||||
, "url", url);
|
, "url", url);
|
||||||
//1.请求取货2取货完成3请求放货4放货完成
|
//1.请求取货2取货完成3请求放货4放货完成
|
||||||
HttpResponse result = null;
|
HttpResponse result = null;
|
||||||
switch (交互类型){
|
switch (type){
|
||||||
case "1":
|
case "1":
|
||||||
case "3":
|
case "3":
|
||||||
|
if (type.equals("3")){
|
||||||
|
of.put("type", "2");
|
||||||
|
}
|
||||||
result = acsToHJXService.actionRequest(new JSONObject(of));
|
result = acsToHJXService.actionRequest(new JSONObject(of));
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
case "4":
|
case "4":
|
||||||
|
if (type.equals("2")){
|
||||||
|
of.put("type", "3");
|
||||||
|
}
|
||||||
result = acsToHJXService.actionFinish(new JSONObject(of));
|
result = acsToHJXService.actionFinish(new JSONObject(of));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.modules.layout.mapLayout.controller;
|
|||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.acs.ext.wms.service.NDCToAcsService;
|
||||||
import org.nl.common.utils.query.PageQuery;
|
import org.nl.common.utils.query.PageQuery;
|
||||||
import org.nl.modules.layout.mapLayout.dao.AgvLayoutMapQuery;
|
import org.nl.modules.layout.mapLayout.dao.AgvLayoutMapQuery;
|
||||||
import org.nl.modules.layout.mapLayout.dto.AgvLayoutMapDto;
|
import org.nl.modules.layout.mapLayout.dto.AgvLayoutMapDto;
|
||||||
@@ -15,10 +16,7 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地图布局Controller
|
* 地图布局Controller
|
||||||
@@ -30,6 +28,8 @@ public class AgvLayoutMapController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AgvLayoutMapService agvLayoutMapService;
|
private AgvLayoutMapService agvLayoutMapService;
|
||||||
|
@Autowired
|
||||||
|
private NDCToAcsService ndcToAcsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
@@ -81,27 +81,33 @@ public class AgvLayoutMapController {
|
|||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity<AgvLayoutMapDto> initLayout(Long id) {
|
public ResponseEntity<AgvLayoutMapDto> initLayout(Long id) {
|
||||||
AgvLayoutMapDto agvLayoutMapDto = agvLayoutMapService.initLayoutMap(id);
|
AgvLayoutMapDto agvLayoutMapDto = agvLayoutMapService.initLayoutMap(id);
|
||||||
return new ResponseEntity<>(agvLayoutMapDto,HttpStatus.OK);
|
return new ResponseEntity<>(agvLayoutMapDto, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("status")
|
@GetMapping("status")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity<List> status(String carId) {
|
public ResponseEntity<List> status(String carId) {
|
||||||
|
Map<String, AgvStatus> map = ndcToAcsService.findAllAgvFromCache();
|
||||||
|
// Map<String,AgvStatus> map = new HashMap<>();
|
||||||
List<AgvStatus> list = new ArrayList<>();
|
List<AgvStatus> list = new ArrayList<>();
|
||||||
for (int i = 0; i < 4; i++) {
|
for (AgvStatus status : map.values()) {
|
||||||
AgvStatus build = AgvStatus.builder()
|
list.add(status);
|
||||||
.status("2")
|
|
||||||
.carId(String.valueOf(i + 1))
|
|
||||||
.action("请求取货")
|
|
||||||
.actionInfo("申请取货中")
|
|
||||||
.taskCode("33876")
|
|
||||||
.icon("/Users/mima0000/Desktop/car.png")
|
|
||||||
.fileId("3029")
|
|
||||||
.x(new Random().nextInt(1189) + 100)
|
|
||||||
.y(new Random().nextInt(1189) + 100)
|
|
||||||
.power(66)
|
|
||||||
.angle(new Random().nextInt(160) + 10).build();
|
|
||||||
list.add(build);
|
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(list,HttpStatus.OK);
|
// for (int i = 0; i < 4; i++) {
|
||||||
|
// AgvStatus build = AgvStatus.builder()
|
||||||
|
// .status("2")
|
||||||
|
// .carId(String.valueOf(i + 1))
|
||||||
|
// .action("请求取货")
|
||||||
|
// .actionInfo("申请取货中")
|
||||||
|
// .taskCode("33876")
|
||||||
|
// .icon("/Users/mima0000/Desktop/car.png")
|
||||||
|
// .fileId("3029")
|
||||||
|
// .x(new Random().nextInt(1189) + 100)
|
||||||
|
// .y(new Random().nextInt(1189) + 100)
|
||||||
|
// .power(66)
|
||||||
|
// .angle(new Random().nextInt(160) + 10).build();
|
||||||
|
// list.add(build);
|
||||||
|
// }
|
||||||
|
return new ResponseEntity<>(list, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
|||||||
|
|
||||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||||
VUE_APP_BASE_API = 'http:// 10.4.46.150:8011'
|
VUE_APP_BASE_API = 'http:// 172.30.15.231:8011'
|
||||||
# 如果接口是 http 形式, wss 需要改为 ws
|
# 如果接口是 http 形式, wss 需要改为 ws
|
||||||
VUE_APP_WS_API = 'ws:// 10.4.46.150:8011'
|
VUE_APP_WS_API = 'ws:// 172.30.15.231:8011'
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ window.g = {
|
|||||||
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
|
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
|
||||||
},
|
},
|
||||||
prod: {
|
prod: {
|
||||||
VUE_APP_BASE_API: 'http://10.4.46.150:8011'
|
VUE_APP_BASE_API: 'http://172.30.15.231:8011'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
<span v-if="scope.row.instruction_status=='0' ">就绪</span>
|
<span v-if="scope.row.instruction_status=='0' ">就绪</span>
|
||||||
<span v-if="scope.row.instruction_status=='1' ">执行中</span>
|
<span v-if="scope.row.instruction_status=='1' ">执行中</span>
|
||||||
<span v-if="scope.row.instruction_status=='2' ">完成</span>
|
<span v-if="scope.row.instruction_status=='2' ">完成</span>
|
||||||
|
<span v-if="scope.row.instruction_status=='3' ">取消</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="start_point_code" label="起点" />
|
<el-table-column prop="start_point_code" label="起点" />
|
||||||
|
|||||||
@@ -66,10 +66,31 @@
|
|||||||
class="filter-item"
|
class="filter-item"
|
||||||
@keyup.enter.native="crud.toQuery"
|
@keyup.enter.native="crud.toQuery"
|
||||||
/>
|
/>
|
||||||
<Search />
|
<el-date-picker
|
||||||
|
v-model="query.createTime"
|
||||||
|
type="datetimerange"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
align="right"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
/>
|
||||||
|
<rrOperation />
|
||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission" />
|
<crudOperation :permission="permission" >
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-thumb"
|
||||||
|
size="mini"
|
||||||
|
:loading="showDtlLoading"
|
||||||
|
@click="downdtl"
|
||||||
|
>
|
||||||
|
导出
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
@@ -237,6 +258,7 @@
|
|||||||
<span v-if="scope.row.task_status=='0' ">就绪</span>
|
<span v-if="scope.row.task_status=='0' ">就绪</span>
|
||||||
<span v-if="scope.row.task_status=='1' ">执行中</span>
|
<span v-if="scope.row.task_status=='1' ">执行中</span>
|
||||||
<span v-if="scope.row.task_status=='2' ">完成</span>
|
<span v-if="scope.row.task_status=='2' ">完成</span>
|
||||||
|
<span v-if="scope.row.task_status=='3' ">取消</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="priority" label="任务优先级" />
|
<el-table-column prop="priority" label="任务优先级" />
|
||||||
@@ -259,10 +281,13 @@ import Search from '@/views/monitor/lucene/time'
|
|||||||
import crudTask from '@/api/acs/task/task'
|
import crudTask from '@/api/acs/task/task'
|
||||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
|
import rrOperation from '@crud/RR.operation'
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from '@crud/Pagination'
|
||||||
import deviceCrud from '@/api/acs/device/device'
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
import routeCurd from '@/api/acs/route/routePlan'
|
import routeCurd from '@/api/acs/route/routePlan'
|
||||||
import { getDicts } from '@/api/system/dict'
|
import { getDicts } from '@/api/system/dict'
|
||||||
|
import { download } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
task_id: null,
|
task_id: null,
|
||||||
@@ -286,7 +311,7 @@ const defaultForm = {
|
|||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'Task',
|
name: 'Task',
|
||||||
components: { pagination, crudOperation, Search },
|
components: { pagination, crudOperation, rrOperation, Search },
|
||||||
dicts: ['task_status'],
|
dicts: ['task_status'],
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
@@ -356,6 +381,7 @@ export default {
|
|||||||
toZList: [],
|
toZList: [],
|
||||||
start_flag: false,
|
start_flag: false,
|
||||||
end_flag: false,
|
end_flag: false,
|
||||||
|
showDtlLoading: false,
|
||||||
permission: {
|
permission: {
|
||||||
add: ['admin', 'task:add'],
|
add: ['admin', 'task:add'],
|
||||||
edit: ['admin', 'task:edit'],
|
edit: ['admin', 'task:edit'],
|
||||||
@@ -538,6 +564,29 @@ export default {
|
|||||||
this.form.to_y = ''
|
this.form.to_y = ''
|
||||||
this.form.to_z = ''
|
this.form.to_z = ''
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
downdtl() {
|
||||||
|
if (this.currentRow !== null) {
|
||||||
|
crud.downloadLoading = true
|
||||||
|
const data = {
|
||||||
|
'task_code': this.crud.query.task_code,
|
||||||
|
'vehicle_code': this.crud.query.vehicle_code,
|
||||||
|
'material_type': this.crud.query.material_type,
|
||||||
|
'status': this.crud.query.status,
|
||||||
|
'point_code': this.crud.query.point_code,
|
||||||
|
'createTime': this.crud.query.createTime[0],
|
||||||
|
'end_time': this.crud.query.createTime[1]
|
||||||
|
}
|
||||||
|
this.showDtlLoading = true
|
||||||
|
download('/api/task/download', data).then(result => {
|
||||||
|
downloadFile(result, '任务详情', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
this.showDtlLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
crud.downloadLoading = false
|
||||||
|
this.showDtlLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
<span v-if="scope.row.task_status=='0' ">就绪</span>
|
<span v-if="scope.row.task_status=='0' ">就绪</span>
|
||||||
<span v-if="scope.row.task_status=='1' ">执行中</span>
|
<span v-if="scope.row.task_status=='1' ">执行中</span>
|
||||||
<span v-if="scope.row.task_status=='2' ">完成</span>
|
<span v-if="scope.row.task_status=='2' ">完成</span>
|
||||||
|
<span v-if="scope.row.task_status=='3' ">取消</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="priority" label="任务优先级" />
|
<el-table-column prop="priority" label="任务优先级" />
|
||||||
|
|||||||
@@ -134,6 +134,7 @@
|
|||||||
<span v-if="scope.row.instruction_status=='0' ">就绪</span>
|
<span v-if="scope.row.instruction_status=='0' ">就绪</span>
|
||||||
<span v-if="scope.row.instruction_status=='1' ">执行中</span>
|
<span v-if="scope.row.instruction_status=='1' ">执行中</span>
|
||||||
<span v-if="scope.row.instruction_status=='2' ">完成</span>
|
<span v-if="scope.row.instruction_status=='2' ">完成</span>
|
||||||
|
<span v-if="scope.row.instruction_status=='3' ">取消</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="send_status" label="下发状态">
|
<el-table-column prop="send_status" label="下发状态">
|
||||||
|
|||||||
@@ -338,6 +338,7 @@
|
|||||||
<span v-if="scope.row.task_status==='0' ">就绪</span>
|
<span v-if="scope.row.task_status==='0' ">就绪</span>
|
||||||
<span v-if="scope.row.task_status==='1' ">执行中</span>
|
<span v-if="scope.row.task_status==='1' ">执行中</span>
|
||||||
<span v-if="scope.row.task_status==='2' ">完成</span>
|
<span v-if="scope.row.task_status==='2' ">完成</span>
|
||||||
|
<span v-if="scope.row.task_status==='3' ">取消</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="priority" label="优先级" width="100" />
|
<el-table-column prop="priority" label="优先级" width="100" />
|
||||||
|
|||||||
Reference in New Issue
Block a user