add: 历史记录模块添加导出功能
This commit is contained in:
@@ -443,6 +443,26 @@
|
|||||||
<version>${commons-csv.version}</version>
|
<version>${commons-csv.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xerces</groupId>
|
||||||
|
<artifactId>xercesImpl</artifactId>
|
||||||
|
<version>2.12.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -389,6 +389,19 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
//查找有没有对应的指令
|
//查找有没有对应的指令
|
||||||
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code);
|
||||||
if (ObjectUtil.isNotNull(inst) && "1".equals(inst.getInstruction_type())) {
|
if (ObjectUtil.isNotNull(inst) && "1".equals(inst.getInstruction_type())) {
|
||||||
|
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(this.device_code);
|
||||||
|
if (routeLineDtos.size() < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
for (RouteLineDto routeLineDto : routeLineDtos) {
|
||||||
|
if (routeLineDto.getNext_device_code().equals(inst.getNext_device_code())) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
||||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||||
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
|
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
|
||||||
@@ -485,7 +498,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
instructionService.create(instdto);
|
instructionService.create(instdto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("指令创建失败!", e.getMessage());
|
log.error("指令创建失败!,{}", e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
taskdto.setTask_status("1");
|
taskdto.setTask_status("1");
|
||||||
|
|||||||
@@ -622,13 +622,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
map.put("to_task", inst.getInstruction_code());
|
map.put("to_task", inst.getInstruction_code());
|
||||||
|
|
||||||
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
|
||||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x"))) {
|
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z")) ) {
|
||||||
map.put("to_x", startDevice.getExtraValue().get("x"));
|
map.put("to_x", startDevice.getExtraValue().get("z"));
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) {
|
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x")) ) {
|
||||||
map.put("to_z", startDevice.getExtraValue().get("z"));
|
map.put("to_z", startDevice.getExtraValue().get("x"));
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y"))) {
|
if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y")) ) {
|
||||||
map.put("to_y", startDevice.getExtraValue().get("y"));
|
map.put("to_y", startDevice.getExtraValue().get("y"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,4 +154,12 @@ public class InstructionController {
|
|||||||
instructionService.init(id);
|
instructionService.init(id);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/downloadInstLogging")
|
||||||
|
@Log("导出指令记录")
|
||||||
|
@ApiOperation("导出指令记录")
|
||||||
|
//@PreAuthorize("@el.check('task:list')")
|
||||||
|
public void downloadInstLogging(HttpServletResponse response,@RequestParam Map whereJson) throws IOException {
|
||||||
|
instructionService.downloadInstLogging(instructionService.getInstList(whereJson), response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.acs.instruction.service;
|
package org.nl.acs.instruction.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||||
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||||
@@ -327,5 +328,21 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
* @param instruction1
|
* @param instruction1
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay);
|
List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件查询指令
|
||||||
|
* @param whereJson
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<JSONObject> getInstList(Map whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出指令记录
|
||||||
|
* @param instList
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
void downloadInstLogging(List<JSONObject> instList, HttpServletResponse response) throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1607,4 +1607,80 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
List<Instruction> instructions = ConvertUtil.convertList(instructionMybatis, Instruction.class);*/
|
List<Instruction> instructions = ConvertUtil.convertList(instructionMybatis, Instruction.class);*/
|
||||||
return instructionList;
|
return instructionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JSONObject> getInstList(Map whereJson) {
|
||||||
|
String task_code = (String) whereJson.get("code");
|
||||||
|
String vehicle_code = (String) whereJson.get("vehicle_code");
|
||||||
|
String material_type = (String) whereJson.get("material_type");
|
||||||
|
String status = (String) whereJson.get("status");
|
||||||
|
String point_code = (String) whereJson.get("point_code");
|
||||||
|
String create_time = (String) whereJson.get("createTime");
|
||||||
|
String end_time = (String) whereJson.get("end_time");
|
||||||
|
|
||||||
|
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (!StrUtil.isEmpty(task_code)) {
|
||||||
|
wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, task_code).or().like(InstructionMybatis::getTask_code, task_code));
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
|
wrapper.like(InstructionMybatis::getVehicle_code, vehicle_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(material_type)) {
|
||||||
|
wrapper.eq(InstructionMybatis::getMaterial, material_type);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(status)) {
|
||||||
|
wrapper.eq(InstructionMybatis::getInstruction_status, status);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(point_code)) {
|
||||||
|
wrapper.and(task -> task.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code));
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
||||||
|
wrapper.between(InstructionMybatis::getCreate_time, create_time, end_time);
|
||||||
|
}
|
||||||
|
List<InstructionMybatis> instructionMybatis = instructionMapper.selectList(wrapper);
|
||||||
|
List<JSONObject> array = new ArrayList<>();
|
||||||
|
if(instructionMybatis.size() > 0){
|
||||||
|
for (InstructionMybatis inst : instructionMybatis) {
|
||||||
|
JSONObject ins = new JSONObject();
|
||||||
|
ins.put("instruction_code", inst.getInstruction_code());
|
||||||
|
ins.put("task_code", inst.getTask_code());
|
||||||
|
ins.put("vehicle_code", inst.getVehicle_code());
|
||||||
|
ins.put("task_status", inst.getInstruction_status());
|
||||||
|
ins.put("start_point_code", inst.getStart_point_code());
|
||||||
|
ins.put("next_point_code", inst.getNext_point_code());
|
||||||
|
ins.put("matarial", inst.getMaterial());
|
||||||
|
ins.put("quantity", inst.getQuantity());
|
||||||
|
ins.put("remark", inst.getRemark());
|
||||||
|
ins.put("create_by", inst.getCreate_by());
|
||||||
|
ins.put("create_time", inst.getCreate_time());
|
||||||
|
ins.put("update_by", inst.getUpdate_by());
|
||||||
|
ins.put("update_time", inst.getUpdate_time());
|
||||||
|
array.add(ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadInstLogging(List<JSONObject> instList, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (JSONObject jsonObject : instList) {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("指令编码", jsonObject.getString("instruction_code"));
|
||||||
|
map.put("任务号", jsonObject.getString("task_code"));
|
||||||
|
map.put("载具号", jsonObject.getString("vehicle_code"));
|
||||||
|
map.put("指令状态", jsonObject.getString("task_status"));
|
||||||
|
map.put("起点", jsonObject.getString("start_point_code"));
|
||||||
|
map.put("终点", jsonObject.getString("next_point_code"));
|
||||||
|
map.put("物料", jsonObject.getString("matarial"));
|
||||||
|
map.put("数量", jsonObject.getString("quantity"));
|
||||||
|
map.put("备注", jsonObject.getString("remark"));
|
||||||
|
map.put("创建者", jsonObject.getString("create_by"));
|
||||||
|
map.put("创建时间", jsonObject.getString("create_time"));
|
||||||
|
map.put("修改者", jsonObject.getString("update_by"));
|
||||||
|
map.put("修改时间", jsonObject.getString("update_time"));
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,4 +156,22 @@ public class TaskController {
|
|||||||
public ResponseEntity<Object> findAllTaskFromCache() {
|
public ResponseEntity<Object> findAllTaskFromCache() {
|
||||||
return new ResponseEntity<>(taskService.findAllTaskFromCache(), HttpStatus.OK);
|
return new ResponseEntity<>(taskService.findAllTaskFromCache(), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/downloadTaskTreeLogging")
|
||||||
|
@Log("导出任务树形记录")
|
||||||
|
@ApiOperation("导出任务树形记录")
|
||||||
|
//@PreAuthorize("@el.check('task:list')")
|
||||||
|
public void downloadTaskTreeLogging(HttpServletResponse response,@RequestParam Map whereJson) throws IOException {
|
||||||
|
taskService.downloadTaskTreeLogging(taskService.getTaskAndInst(whereJson), response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/downloadTaskLogging")
|
||||||
|
@Log("导出任务树形记录")
|
||||||
|
@ApiOperation("导出任务树形记录")
|
||||||
|
//@PreAuthorize("@el.check('task:list')")
|
||||||
|
public void downloadTaskLogging(HttpServletResponse response,@RequestParam Map whereJson) throws IOException {
|
||||||
|
taskService.downloadTaskLogging(taskService.getTaskList(whereJson), response);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,4 +372,36 @@ public interface TaskService extends CommonService<Task> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer querySameDeviceReadyTask(String start_device, String next_device, String status);
|
Integer querySameDeviceReadyTask(String start_device, String next_device, String status);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条件查询任务和指令
|
||||||
|
* @param whereJson
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<JSONObject> getTaskAndInst(Map whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出任务树形记录
|
||||||
|
* @param taskAndInst
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
void downloadTaskTreeLogging(List<JSONObject> list, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出任务记录
|
||||||
|
* @param all
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
void downloadTaskLogging(List<JSONObject> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询任务
|
||||||
|
* @param whereJson
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<JSONObject> getTaskList(Map whereJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.acs.task.service.impl;
|
package org.nl.acs.task.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
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;
|
||||||
@@ -11,6 +12,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.AcsConfig;
|
import org.nl.acs.AcsConfig;
|
||||||
@@ -1677,6 +1679,176 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JSONObject> getTaskAndInst(Map whereJson) {
|
||||||
|
String task_code = (String) whereJson.get("task_code");
|
||||||
|
String vehicle_code = (String) whereJson.get("vehicle_code");
|
||||||
|
String material_type = (String) whereJson.get("material_type");
|
||||||
|
String status = (String) whereJson.get("status");
|
||||||
|
String point_code = (String) whereJson.get("point_code");
|
||||||
|
String create_time = (String) whereJson.get("createTime");
|
||||||
|
String end_time = (String) whereJson.get("end_time");
|
||||||
|
|
||||||
|
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (!StrUtil.isEmpty(task_code)) {
|
||||||
|
wrapper.eq(Task::getTask_code, task_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
|
wrapper.like(Task::getVehicle_code, vehicle_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(material_type)) {
|
||||||
|
wrapper.eq(Task::getMaterial, material_type);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(status)) {
|
||||||
|
wrapper.eq(Task::getTask_status, status);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(point_code)) {
|
||||||
|
wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code));
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
||||||
|
wrapper.between(Task::getCreate_time, create_time, end_time);
|
||||||
|
}
|
||||||
|
List<Task> taskList = taskMapper.selectList(wrapper);
|
||||||
|
List<JSONObject> array = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(taskList) && taskList.size() > 0) {
|
||||||
|
for (Task task : taskList) {
|
||||||
|
JSONObject ins = new JSONObject();
|
||||||
|
//ins.put("task_id", task.getTask_id());
|
||||||
|
ins.put("task_code", task.getTask_code());
|
||||||
|
ins.put("vehicle_code", task.getVehicle_code());
|
||||||
|
ins.put("task_status", task.getTask_status());
|
||||||
|
ins.put("priority", task.getPriority());
|
||||||
|
ins.put("start_point_code", task.getStart_point_code());
|
||||||
|
ins.put("next_point_code", task.getNext_point_code());
|
||||||
|
ins.put("start_point_code2", task.getStart_point_code2());
|
||||||
|
ins.put("next_point_code2", task.getNext_point_code2());
|
||||||
|
ins.put("matarial", task.getMaterial());
|
||||||
|
ins.put("quantity", task.getQuantity());
|
||||||
|
ins.put("remark", task.getRemark());
|
||||||
|
ins.put("create_by", task.getCreate_by());
|
||||||
|
ins.put("create_time", task.getCreate_time());
|
||||||
|
array.add(ins);
|
||||||
|
List<InstructionMybatis> list = instructionService.list(Wrappers.lambdaQuery(InstructionMybatis.class));
|
||||||
|
if (CollUtil.isNotEmpty(list) && list.size() > 0) {
|
||||||
|
for (InstructionMybatis inst : list) {
|
||||||
|
if(task.getTask_id().equals(inst.getTask_id())){
|
||||||
|
JSONObject ins1 = new JSONObject();
|
||||||
|
//ins1.put("task_id", inst.getInstruction_id());
|
||||||
|
ins1.put("task_code", inst.getInstruction_code());
|
||||||
|
ins1.put("vehicle_code", inst.getVehicle_code());
|
||||||
|
ins1.put("task_status", inst.getInstruction_status());
|
||||||
|
ins1.put("start_point_code", inst.getStart_point_code());
|
||||||
|
ins1.put("next_point_code", inst.getNext_point_code());
|
||||||
|
ins1.put("matarial", inst.getMaterial());
|
||||||
|
ins1.put("remark", inst.getRemark());
|
||||||
|
ins1.put("create_by", inst.getCreate_by());
|
||||||
|
ins1.put("create_time", inst.getCreate_time());
|
||||||
|
array.add(ins1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadTaskTreeLogging(List<JSONObject> taskAndInst, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (JSONObject jsonObject : taskAndInst) {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("任务号(指令编码)", jsonObject.getString("task_code"));
|
||||||
|
map.put("载具号", jsonObject.getString("vehicle_code"));
|
||||||
|
map.put("状态", jsonObject.getString("task_status"));
|
||||||
|
map.put("任务优先级", jsonObject.getString("priority"));
|
||||||
|
map.put("起点", jsonObject.getString("start_point_code"));
|
||||||
|
map.put("终点", jsonObject.getString("next_point_code"));
|
||||||
|
map.put("起点2", jsonObject.getString("start_point_code2"));
|
||||||
|
map.put("终点2", jsonObject.getString("next_point_code2"));
|
||||||
|
map.put("物料", jsonObject.getString("matarial"));
|
||||||
|
map.put("数量", jsonObject.getString("quantity"));
|
||||||
|
map.put("备注", jsonObject.getString("remark"));
|
||||||
|
map.put("创建者", jsonObject.getString("create_by"));
|
||||||
|
map.put("创建时间", jsonObject.getString("create_time"));
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadTaskLogging(List<JSONObject> taskAndInst, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (JSONObject jsonObject : taskAndInst) {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("任务号", jsonObject.getString("task_code"));
|
||||||
|
map.put("载具号", jsonObject.getString("vehicle_code"));
|
||||||
|
map.put("任务状态", jsonObject.getString("task_status"));
|
||||||
|
map.put("任务优先级", jsonObject.getString("priority"));
|
||||||
|
map.put("起点", jsonObject.getString("start_point_code"));
|
||||||
|
map.put("终点", jsonObject.getString("next_point_code"));
|
||||||
|
map.put("物料", jsonObject.getString("matarial"));
|
||||||
|
map.put("数量", jsonObject.getString("quantity"));
|
||||||
|
map.put("备注", jsonObject.getString("remark"));
|
||||||
|
map.put("创建者", jsonObject.getString("create_by"));
|
||||||
|
map.put("创建时间", jsonObject.getString("create_time"));
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JSONObject> getTaskList(Map whereJson) {
|
||||||
|
String task_code = (String) whereJson.get("task_code");
|
||||||
|
String vehicle_code = (String) whereJson.get("vehicle_code");
|
||||||
|
String material_type = (String) whereJson.get("material_type");
|
||||||
|
String status = (String) whereJson.get("status");
|
||||||
|
String point_code = (String) whereJson.get("point_code");
|
||||||
|
String create_time = (String) whereJson.get("createTime");
|
||||||
|
String end_time = (String) whereJson.get("end_time");
|
||||||
|
|
||||||
|
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (!StrUtil.isEmpty(task_code)) {
|
||||||
|
wrapper.eq(Task::getTask_code, task_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
|
wrapper.like(Task::getVehicle_code, vehicle_code);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(material_type)) {
|
||||||
|
wrapper.eq(Task::getMaterial, material_type);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(status)) {
|
||||||
|
wrapper.eq(Task::getTask_status, status);
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(point_code)) {
|
||||||
|
wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code));
|
||||||
|
}
|
||||||
|
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
|
||||||
|
wrapper.between(Task::getCreate_time, create_time, end_time);
|
||||||
|
}
|
||||||
|
List<Task> taskList = taskMapper.selectList(wrapper);
|
||||||
|
List<JSONObject> array = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(taskList) && taskList.size() > 0) {
|
||||||
|
for (Task task : taskList) {
|
||||||
|
JSONObject ins = new JSONObject();
|
||||||
|
//ins.put("task_id", task.getTask_id());
|
||||||
|
ins.put("task_code", task.getTask_code());
|
||||||
|
ins.put("vehicle_code", task.getVehicle_code());
|
||||||
|
ins.put("task_status", task.getTask_status());
|
||||||
|
ins.put("priority", task.getPriority());
|
||||||
|
ins.put("start_point_code", task.getStart_point_code());
|
||||||
|
ins.put("next_point_code", task.getNext_point_code());
|
||||||
|
ins.put("matarial", task.getMaterial());
|
||||||
|
ins.put("quantity", task.getQuantity());
|
||||||
|
ins.put("remark", task.getRemark());
|
||||||
|
ins.put("create_by", task.getCreate_by());
|
||||||
|
ins.put("create_time", task.getCreate_time());
|
||||||
|
array.add(ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer querySameTaskByType(String taskType) {
|
public Integer querySameTaskByType(String taskType) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||||||
* linux: /temp
|
* linux: /temp
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
|
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir");
|
||||||
/**
|
/**
|
||||||
* 定义GB的计算常量
|
* 定义GB的计算常量
|
||||||
*/
|
*/
|
||||||
@@ -210,7 +210,9 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
|||||||
File file = new File(tempPath);
|
File file = new File(tempPath);
|
||||||
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||||
// 一次性写出内容,使用默认样式,强制输出标题
|
// 一次性写出内容,使用默认样式,强制输出标题
|
||||||
writer.write(list, true);
|
for (Object item : list) {
|
||||||
|
writer.writeRow(item, true);
|
||||||
|
}
|
||||||
SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
|
SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
|
||||||
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
||||||
sheet.trackAllColumnsForAutoSizing();
|
sheet.trackAllColumnsForAutoSizing();
|
||||||
|
|||||||
BIN
acs/nladmin-ui/src/assets/images/logo2.png
Normal file
BIN
acs/nladmin-ui/src/assets/images/logo2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 120 KiB |
@@ -1,17 +1,17 @@
|
|||||||
export default {
|
export default {
|
||||||
'Auto': {
|
'Auto': {
|
||||||
'table': {
|
'table': {
|
||||||
'name': '名称',
|
'name': '名称',
|
||||||
'code': '编号',
|
'code': '编号',
|
||||||
'status': '状态',
|
'status': '状态',
|
||||||
'thread_name': '线程名',
|
'thread_name': '线程名',
|
||||||
'thread_state': '线程状态',
|
'thread_state': '线程状态',
|
||||||
'usedStatus': '使用状态',
|
'usedStatus': '使用状态',
|
||||||
'stopMessage': '停止信息',
|
'stopMessage': '停止信息',
|
||||||
'operate': '操作',
|
'operate': '操作'
|
||||||
},
|
},
|
||||||
'msg': {
|
'msg': {
|
||||||
'stop_msg': '确定停止该线程吗?'
|
'stop_msg': '确定停止该线程吗?'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,8 @@ export default {
|
|||||||
'inst_nextdevice_code': 'Command destination device',
|
'inst_nextdevice_code': 'Command destination device',
|
||||||
'destination_configuration': 'Destination configuration',
|
'destination_configuration': 'Destination configuration',
|
||||||
'operation': 'Operation',
|
'operation': 'Operation',
|
||||||
'device_is_not_null': 'Device code cannot be empty'
|
'device_is_not_null': 'Device code cannot be empty',
|
||||||
|
'mapping_relationship': 'Mapping relationship'
|
||||||
},
|
},
|
||||||
'rules': {
|
'rules': {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ export default {
|
|||||||
'inst_nextdevice_code': 'Perangkat tujuan perintah',
|
'inst_nextdevice_code': 'Perangkat tujuan perintah',
|
||||||
'destination_configuration': 'Konfigurasi tujuan',
|
'destination_configuration': 'Konfigurasi tujuan',
|
||||||
'operation': 'Operasi',
|
'operation': 'Operasi',
|
||||||
'device_is_not_null': 'Kode perangkat tidak boleh kosong'
|
'device_is_not_null': 'Kode perangkat tidak boleh kosong',
|
||||||
|
'mapping_relationship': 'Hubungan pemetaan'
|
||||||
},
|
},
|
||||||
'rules': {
|
'rules': {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ export default {
|
|||||||
'inst_nextdevice_code': '指令终点设备',
|
'inst_nextdevice_code': '指令终点设备',
|
||||||
'destination_configuration': '终点配置',
|
'destination_configuration': '终点配置',
|
||||||
'operation': '操作',
|
'operation': '操作',
|
||||||
'device_is_not_null': '设备编码不能为空'
|
'device_is_not_null': '设备编码不能为空',
|
||||||
|
'mapping_relationship': '映射关系'
|
||||||
},
|
},
|
||||||
'rules': {
|
'rules': {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ import crudOperation from '@crud/CRUD.operation'
|
|||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.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 i18n from '@/i18n'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
assigned_id: null,
|
assigned_id: null,
|
||||||
@@ -149,7 +150,7 @@ export default {
|
|||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({
|
return CRUD({
|
||||||
title: '映射关系', url: 'api/deviceAssigned', idField: 'assigned_id', sort: 'assignned_id', optShow: {
|
title: i18n.t('config.table.mapping_relationship'), url: 'api/deviceAssigned', idField: 'assigned_id', sort: 'assignned_id', optShow: {
|
||||||
add: true,
|
add: true,
|
||||||
edit: true,
|
edit: true,
|
||||||
del: true
|
del: true
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ import crudOperation from '@crud/CRUD.operation'
|
|||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.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 i18n from '@/i18n'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
assigned_id: null,
|
assigned_id: null,
|
||||||
@@ -149,7 +150,7 @@ export default {
|
|||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({
|
return CRUD({
|
||||||
title: '映射关系', url: 'api/deviceAssigned', idField: 'assigned_id', sort: 'assignned_id', optShow: {
|
title: i18n.t('config.table.mapping_relationship'), url: 'api/deviceAssigned', idField: 'assigned_id', sort: 'assignned_id', optShow: {
|
||||||
add: true,
|
add: true,
|
||||||
edit: true,
|
edit: true,
|
||||||
del: true
|
del: true
|
||||||
|
|||||||
@@ -58,12 +58,24 @@
|
|||||||
<Search />
|
<Search />
|
||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission" />
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="left"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
:loading="downLoadInstLogging"
|
||||||
|
@click="doExportInstLogging()"
|
||||||
|
>
|
||||||
|
{{ $t('common.Export') }}
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:before-close="crud.cancelCU"
|
:before-close="crud.cancelCU"
|
||||||
:visible.sync="crud.status.cu > 0"
|
:visible.sync="crud.status.cu"
|
||||||
:title="crud.status.title"
|
:title="crud.status.title"
|
||||||
width="500px"
|
width="500px"
|
||||||
>
|
>
|
||||||
@@ -129,6 +141,8 @@ import crudInstruction from '@/api/acs/instruction/instruction'
|
|||||||
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 { getDicts } from '@/views/system/dict/dict'
|
import { getDicts } from '@/views/system/dict/dict'
|
||||||
|
import { download } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
instruction_id: null,
|
instruction_id: null,
|
||||||
@@ -241,7 +255,25 @@ export default {
|
|||||||
console.log(err.response.data.message)
|
console.log(err.response.data.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
doExportInstLogging() {
|
||||||
|
this.downLoadTaskLogging = true
|
||||||
|
const params = {
|
||||||
|
code: this.query.task_code,
|
||||||
|
vehicle_code: this.query.vehicle_code,
|
||||||
|
material_type: this.query.material_type,
|
||||||
|
status: this.query.status,
|
||||||
|
point_code: this.crud.pointCode,
|
||||||
|
createTime: this.crud.createTime,
|
||||||
|
end_time: this.crud.endTime // 假设 this.crud.endTime 是你的结束时间
|
||||||
|
}
|
||||||
|
const url = '/api/instruction/downloadInstLogging'
|
||||||
|
download(url, params).then(result => {
|
||||||
|
downloadFile(result, this.crud.title + '数据', 'csv')
|
||||||
|
this.downLoadTaskTreeLogging = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.downLoadTaskTreeLogging = false
|
||||||
|
})
|
||||||
|
},
|
||||||
beforeHandleCommand(index, row, command) {
|
beforeHandleCommand(index, row, command) {
|
||||||
return {
|
return {
|
||||||
'index': index,
|
'index': index,
|
||||||
|
|||||||
@@ -69,7 +69,19 @@
|
|||||||
<Search />
|
<Search />
|
||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission" />
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="left"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
:loading="downLoadTaskLogging"
|
||||||
|
@click="doExportTaskLogging()"
|
||||||
|
>
|
||||||
|
{{ $t('common.Export') }}
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
@@ -263,6 +275,8 @@ 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 '@/views/system/dict/dict'
|
import { getDicts } from '@/views/system/dict/dict'
|
||||||
|
import { download } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
task_id: null,
|
task_id: null,
|
||||||
@@ -427,7 +441,25 @@ export default {
|
|||||||
console.log(err.response.data.message)
|
console.log(err.response.data.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
doExportTaskLogging() {
|
||||||
|
this.downLoadTaskLogging = true
|
||||||
|
const params = {
|
||||||
|
task_code: this.query.task_code,
|
||||||
|
vehicle_code: this.query.vehicle_code,
|
||||||
|
material_type: this.query.material_type,
|
||||||
|
status: this.query.status,
|
||||||
|
point_code: this.crud.pointCode,
|
||||||
|
createTime: this.crud.createTime,
|
||||||
|
end_time: this.crud.endTime // 假设 this.crud.endTime 是你的结束时间
|
||||||
|
}
|
||||||
|
const url = 'api/task/downloadTaskLogging'
|
||||||
|
download(url, params).then(result => {
|
||||||
|
downloadFile(result, this.crud.title + '数据', 'csv')
|
||||||
|
this.downLoadTaskTreeLogging = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.downLoadTaskTreeLogging = false
|
||||||
|
})
|
||||||
|
},
|
||||||
beforeHandleCommand(index, row, command) {
|
beforeHandleCommand(index, row, command) {
|
||||||
return {
|
return {
|
||||||
'index': index,
|
'index': index,
|
||||||
|
|||||||
@@ -69,7 +69,19 @@
|
|||||||
<Search />
|
<Search />
|
||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission" />
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="left"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
:loading="downLoadTaskTreeLogging"
|
||||||
|
@click="doExportTaskTreeLogging()"
|
||||||
|
>
|
||||||
|
{{ $t('common.Export') }}
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
<el-table
|
<el-table
|
||||||
ref="table"
|
ref="table"
|
||||||
@@ -123,6 +135,8 @@ 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 '@/views/system/dict/dict'
|
import { getDicts } from '@/views/system/dict/dict'
|
||||||
|
import { download } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
task_id: null,
|
task_id: null,
|
||||||
@@ -141,11 +155,16 @@ export default {
|
|||||||
dicts: ['task_status'],
|
dicts: ['task_status'],
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '任务', url: 'api/task/getAll', idField: 'task_id', sort: 'task_id,desc', crudMethod: { ...crudTask }, optShow: {
|
return [
|
||||||
}})
|
CRUD({ title: '任务', url: 'api/task/getAll', idField: 'task_id', sort: 'task_id,desc', crudMethod: { ...crudTask }, optShow: {
|
||||||
|
// ...
|
||||||
|
}})/* ,
|
||||||
|
CRUD({ title: '设备协议', url: 'api/device/protocol', idField: 'id', sort: 'id,desc', optShow: { download: false }}) */
|
||||||
|
]
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
downLoadTaskTreeLogging: false,
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
materialList: [],
|
materialList: [],
|
||||||
statusList: [],
|
statusList: [],
|
||||||
@@ -196,6 +215,25 @@ export default {
|
|||||||
resolve(res.content)
|
resolve(res.content)
|
||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
|
},
|
||||||
|
doExportTaskTreeLogging() {
|
||||||
|
this.downLoadTaskTreeLogging = true
|
||||||
|
const params = {
|
||||||
|
task_code: this.query.task_code,
|
||||||
|
vehicle_code: this.query.vehicle_code,
|
||||||
|
material_type: this.query.material_type,
|
||||||
|
status: this.query.is_over,
|
||||||
|
point_code: this.crud.pointCode,
|
||||||
|
createTime: this.crud.createTime,
|
||||||
|
end_time: this.crud.endTime // 假设 this.crud.endTime 是你的结束时间
|
||||||
|
}
|
||||||
|
const url = 'api/task/downloadTaskTreeLogging'
|
||||||
|
download(url, params).then(result => {
|
||||||
|
downloadFile(result, this.crud.title + '数据', 'csv')
|
||||||
|
this.downLoadTaskTreeLogging = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.downLoadTaskTreeLogging = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user