rev: 修改
This commit is contained in:
@@ -236,17 +236,17 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
package org.nl.common.utils;/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -13,18 +13,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.utils;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.poi.excel.BigExcelWriter;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
@@ -34,6 +36,7 @@ import java.io.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -44,9 +47,10 @@ import java.util.Map;
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-27
|
||||
*/
|
||||
@Slf4j
|
||||
public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FileUtil.class);
|
||||
private Integer batchWriteExcelRowAmount = 500;
|
||||
|
||||
/**
|
||||
* 系统临时目录
|
||||
@@ -205,26 +209,116 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
* 导出excel
|
||||
*/
|
||||
public static void downloadExcel(List<Map<String, Object>> list, HttpServletResponse response) throws IOException {
|
||||
String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||
File file = new File(tempPath);
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(list, true);
|
||||
SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
|
||||
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
||||
sheet.trackAllColumnsForAutoSizing();
|
||||
//列宽自适应
|
||||
writer.autoSizeColumnAll();
|
||||
//response为HttpServletResponse对象
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
// 终止后删除临时文件
|
||||
file.deleteOnExit();
|
||||
writer.flush(out, true);
|
||||
//此处记得关闭输出Servlet流
|
||||
IoUtil.close(out);
|
||||
ServletOutputStream out = null;
|
||||
BigExcelWriter writer;
|
||||
try {
|
||||
String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||
File file = new File(tempPath);
|
||||
writer = ExcelUtil.getBigWriter(file);
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(list, true);
|
||||
SXSSFSheet sheet = (SXSSFSheet) writer.getSheet();
|
||||
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
||||
sheet.trackAllColumnsForAutoSizing();
|
||||
//列宽自适应
|
||||
writer.autoSizeColumnAll();
|
||||
//response为HttpServletResponse对象
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
|
||||
out = response.getOutputStream();
|
||||
// 终止后删除临时文件
|
||||
file.deleteOnExit();
|
||||
writer.flush(out, true);
|
||||
} finally {
|
||||
//此处记得关闭输出Servlet流
|
||||
if (ObjectUtil.isNotEmpty(out)) {
|
||||
IoUtil.close(out);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 流导出:后续改成导出文件
|
||||
* @param list
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
public void downloadExcelIO(List<Map<String,String>> list, String[] columnExcelNameArr, HttpServletResponse response) {
|
||||
List<Map<String,String>> lastRestDataList = list;
|
||||
List<List<Map<String,String>>> dataPiece = Lists.partition(list, 5000);
|
||||
int blockNum = 0;
|
||||
int blockNumMax = dataPiece.size();
|
||||
List<String> allFileLocations = new ArrayList<>();
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
boolean allFinish = false;
|
||||
while (!allFinish) {
|
||||
int thisFileRowNumber = 1;
|
||||
SXSSFWorkbook wb = null;
|
||||
try {
|
||||
// if (blockNum<blockNumMax){
|
||||
// lastRestDataList = dataPiece.get(blockNum);
|
||||
// blockNum++;
|
||||
// }
|
||||
// if (blockNum==blockNumMax){
|
||||
// allFinish = true;
|
||||
// }
|
||||
wb = new SXSSFWorkbook(this.batchWriteExcelRowAmount);// 流式写入EXCEL,只保留少数行(比如50行)数据在内存,防止内存溢出
|
||||
Sheet sh = wb.createSheet();
|
||||
Row titleRow = sh.createRow(0);
|
||||
for (int cellNum = 0; cellNum < columnExcelNameArr.length; cellNum++) {
|
||||
Cell cell = titleRow.createCell(cellNum);
|
||||
cell.setCellValue(columnExcelNameArr[cellNum]);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(lastRestDataList)) {
|
||||
for (int i = 0; i < lastRestDataList.size(); i++) {
|
||||
Row dataRow = sh.createRow(thisFileRowNumber);
|
||||
Map<String, String> columnMap = lastRestDataList.get(i);
|
||||
for (int cellNum = 0; cellNum < columnExcelNameArr.length; cellNum++) {
|
||||
Cell cell = dataRow.createCell(cellNum);
|
||||
String valueStr = columnMap.get(columnExcelNameArr[cellNum]);
|
||||
cell.setCellValue(valueStr);
|
||||
}
|
||||
thisFileRowNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
String localFilePath = SYS_TEM_DIR + IdUtil.fastSimpleUUID()+ blockNum + ".xlsx";
|
||||
allFileLocations.add(localFilePath);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename="+localFilePath);
|
||||
out = response.getOutputStream();
|
||||
wb.write(out);
|
||||
// 必须清理流式写入Excel生成的临时文件
|
||||
wb.dispose();
|
||||
allFinish = true;
|
||||
}catch (Exception ex){
|
||||
log.warn(ex.getMessage());
|
||||
throw new BadRequestException(ex.getMessage());
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (IOException e) {log.warn(e.getMessage());}
|
||||
}
|
||||
if (wb != null) {
|
||||
try {
|
||||
wb.dispose();
|
||||
} catch (Exception e) {log.warn(e.getMessage());}
|
||||
}
|
||||
}
|
||||
}
|
||||
}finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (IOException e) {log.warn(e.getMessage());}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFileType(String type) {
|
||||
@@ -249,7 +343,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
// 1M
|
||||
int len = 1024 * 1024;
|
||||
if (size > (maxSize * len)) {
|
||||
throw new BadRequestException(LangProcess.msg("error_File_1"));
|
||||
throw new BadRequestException("文件超出规定大小!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,5 +437,6 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
public static String getMd5(File file) {
|
||||
return getMd5(getByte(file));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -67,5 +69,11 @@ public class SysLogController {
|
||||
logService.delAllByInfo();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(@RequestParam Map map, HttpServletResponse response, String[] product_area) throws IOException {
|
||||
logService.download(map, response, product_area);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -54,4 +56,6 @@ public interface ISysLogService extends IService<SysLog> {
|
||||
*/
|
||||
@Async
|
||||
void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog log);
|
||||
|
||||
void download(Map map, HttpServletResponse response, String[] product_area) throws IOException;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.StringUtils;
|
||||
import org.nl.common.utils.ValidationUtil;
|
||||
import org.nl.system.service.logging.ISysLogService;
|
||||
@@ -25,12 +27,11 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -112,6 +113,38 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||
logDto.setCreate_time(DateUtil.now());
|
||||
logMapper.insert(logDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Map map, HttpServletResponse response, String[] product_area) throws IOException {
|
||||
String blurry = ObjectUtil.isNotEmpty(map.get("blurry"))?map.get("blurry").toString():null;
|
||||
String log_type = ObjectUtil.isNotEmpty(map.get("log_type"))?map.get("log_type").toString():null;
|
||||
String username = ObjectUtil.isNotEmpty(map.get("username"))?map.get("username").toString():null;
|
||||
String begin_time = ObjectUtil.isNotEmpty(map.get("begin_time"))?map.get("begin_time").toString():null;
|
||||
String end_time = ObjectUtil.isNotEmpty(map.get("end_time"))?map.get("end_time").toString():null;
|
||||
LambdaQueryWrapper<SysLog> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(ObjectUtil.isNotEmpty(log_type), SysLog::getLog_type, log_type)
|
||||
.eq(ObjectUtil.isNotEmpty(username), SysLog::getUsername, username)
|
||||
.like(ObjectUtil.isNotEmpty(blurry), SysLog::getDescription, blurry)
|
||||
.le(ObjectUtil.isNotEmpty(end_time), SysLog::getCreate_time, end_time)
|
||||
.ge(ObjectUtil.isNotEmpty(begin_time), SysLog::getCreate_time, begin_time)
|
||||
.orderByDesc(SysLog::getCreate_time);
|
||||
List<SysLog> dataList = this.list(lam);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
SysLog sysLog = dataList.get(i);
|
||||
Map<String, Object> mp = new LinkedHashMap<>();
|
||||
mp.put("用户名", SecurityUtils.getCurrentNickName());
|
||||
mp.put("IP", sysLog.getRequest_ip());
|
||||
mp.put("IP来源", sysLog.getAddress());
|
||||
mp.put("描述", sysLog.getDescription());
|
||||
mp.put("浏览器", sysLog.getBrowser());
|
||||
mp.put("请求耗时", sysLog.getTime() + "ms");
|
||||
mp.put("创建日期", sysLog.getCreate_time());
|
||||
list.add(mp);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据方法和传入的参数获取请求参数
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,8 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -71,4 +73,10 @@ public class SchBaseTaskController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(@RequestParam Map map, HttpServletResponse response, String[] product_area) throws IOException {
|
||||
schBaseTaskService.download(map, response, product_area);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,6 +150,14 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
*/
|
||||
List<SchBasePoint> getNoTaskPointByRegionAndType(String region, String type, String pointStatus);
|
||||
|
||||
/**
|
||||
* 获取可用点位(成品-需要按照入库顺序排序)
|
||||
* @param region
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<SchBasePoint> getNoTaskPointByRegionAndTypeCp(String region, String type, String pointStatus);
|
||||
|
||||
/**
|
||||
* 获取可以直接上料的缠绕机
|
||||
* @return
|
||||
|
||||
@@ -8,6 +8,8 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.dto.SchBaseTaskQuery;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -81,4 +83,6 @@ public interface ISchBaseTaskService extends IService<SchBaseTask> {
|
||||
List<SchBaseTask> getTaskByQuery(LambdaQueryWrapper<SchBaseTask> lam);
|
||||
|
||||
Integer haveTaskAll(String deviceCode);
|
||||
|
||||
void download(Map map, HttpServletResponse response, String[] product_area) throws IOException;
|
||||
}
|
||||
|
||||
@@ -81,5 +81,7 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
|
||||
List<SchBasePoint> getNoTaskPointByRegionAndType(String region, String type, String pointStatus);
|
||||
|
||||
List<SchBasePoint> getNoTaskPointByRegionAndTypeCp(String region, String type, String pointStatus);
|
||||
|
||||
List<SchBasePoint> getCRUsedDevice();
|
||||
}
|
||||
|
||||
@@ -185,6 +185,21 @@
|
||||
t.point_code2 = p.point_code OR t.point_code3 = p.point_code OR t.point_code4 = p.point_code)
|
||||
AND '5' > t.task_status)
|
||||
</select>
|
||||
<select id="getNoTaskPointByRegionAndTypeCp" resultType="org.nl.wms.sch_manage.service.dao.SchBasePoint">
|
||||
SELECT *
|
||||
FROM sch_base_point p
|
||||
WHERE p.region_code = #{region}
|
||||
AND p.point_type = #{type}
|
||||
AND p.point_status = #{pointStatus}
|
||||
AND p.is_used = TRUE
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM sch_base_task t
|
||||
WHERE t.is_delete = '0'
|
||||
AND (t.point_code1 = p.point_code OR
|
||||
t.point_code2 = p.point_code OR t.point_code3 = p.point_code OR t.point_code4 = p.point_code)
|
||||
AND '5' > t.task_status)
|
||||
order by p.in_order_seq
|
||||
</select>
|
||||
<select id="getCRUsedDevice" resultType="org.nl.wms.sch_manage.service.dao.SchBasePoint">
|
||||
SELECT p.*
|
||||
FROM sch_base_point p
|
||||
|
||||
@@ -26,40 +26,46 @@ public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> {
|
||||
|
||||
IPage<SchBaseTask> selectPageLeftJoin(IPage<SchBaseTask> pages, SchBaseTaskQuery whereJson, List<String> collect);
|
||||
|
||||
List<SchBaseTask> downloadTask(Map whereJson, List<String> collect);
|
||||
|
||||
/**
|
||||
* 手持查询任务
|
||||
*
|
||||
* @param whereJson {
|
||||
* search: 载具号、起点、终点、任务号
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
List<JSONObject> queryPdaTask(@Param("param") JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 手持查询历史记录
|
||||
*
|
||||
* @param whereJson {
|
||||
* search: 载具号、起点、终点、任务号
|
||||
* start_time: 开始时间
|
||||
* end_time: 结束时间
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
List<JSONObject> queryPdaHistoryTask(@Param("param") JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取载具任务
|
||||
*
|
||||
* @param page
|
||||
* @param whereJson {
|
||||
* storagevehicle_code
|
||||
* }
|
||||
* }
|
||||
* @return JSONObject
|
||||
*/
|
||||
IPage<JSONObject> getVehicleTask(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 获取点对点送货任务
|
||||
*
|
||||
* @param page
|
||||
* @param whereJson {
|
||||
* storagevehicle_code
|
||||
* }
|
||||
* }
|
||||
* @return JSONObject
|
||||
*/
|
||||
IPage<JSONObject> getPointtoPoint(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
@@ -75,6 +75,48 @@
|
||||
</where>
|
||||
ORDER BY t.create_time DESC
|
||||
</select>
|
||||
<select id="downloadTask" resultType="org.nl.wms.sch_manage.service.dao.SchBaseTask">
|
||||
SELECT
|
||||
t.*,
|
||||
tc.config_name,
|
||||
tc.task_name,
|
||||
mb.material_name
|
||||
FROM
|
||||
`sch_base_task` t
|
||||
LEFT JOIN sch_base_taskconfig tc ON tc.config_code = t.config_code
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = t.material_id
|
||||
<where>
|
||||
<if test="whereJson.task_code != null">
|
||||
AND t.task_code = #{whereJson.task_code}
|
||||
</if>
|
||||
<if test="whereJson.config_code != null">
|
||||
AND t.config_code = #{whereJson.config_code}
|
||||
</if>
|
||||
<if test="whereJson.point_code != null">
|
||||
AND (t.point_code1 LIKE '%${whereJson.point_code}%'
|
||||
OR t.point_code2 LIKE '%${whereJson.point_code}%')
|
||||
</if>
|
||||
<if test="whereJson.unFinished != null">
|
||||
AND t.task_status <![CDATA[<=]]> #{whereJson.unFinished}
|
||||
</if>
|
||||
<if test="whereJson.vehicle_code != null">
|
||||
AND t.vehicle_code = #{whereJson.vehicle_code}
|
||||
</if>
|
||||
<if test="whereJson.end_time != null">
|
||||
AND t.create_time <![CDATA[<=]]> #{whereJson.end_time}
|
||||
</if>
|
||||
<if test="whereJson.begin_time != null">
|
||||
AND t.create_time <![CDATA[>=]]> #{whereJson.begin_time}
|
||||
</if>
|
||||
<if test="collect != null and collect != ''">
|
||||
AND t.task_status IN
|
||||
<foreach collection="collect" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="queryPdaTask" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
|
||||
@@ -339,6 +339,11 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
return this.baseMapper.getNoTaskPointByRegionAndType(region, type, pointStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getNoTaskPointByRegionAndTypeCp(String region, String type, String pointStatus) {
|
||||
return this.baseMapper.getNoTaskPointByRegionAndTypeCp(region, type, pointStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getCRUsedDevice() {
|
||||
return this.baseMapper.getCRUsedDevice();
|
||||
|
||||
@@ -14,7 +14,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
@@ -27,10 +29,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -190,4 +191,33 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
return this.count(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Map map, HttpServletResponse response, String[] product_area) throws IOException {
|
||||
List<String> collect = ObjectUtil.isNotEmpty(map.get("more_task_status"))
|
||||
? Arrays.stream(map.get("more_task_status").toString().split(",")).collect(Collectors.toList()) : null;
|
||||
if (collect != null) {
|
||||
if (collect.contains(TaskStatus.UNFINISHED.getCode())) {
|
||||
collect = null;
|
||||
map.put("unFinished",TaskStatus.EXECUTING.getCode());
|
||||
}
|
||||
}
|
||||
List<SchBaseTask> dataList = schBaseTaskMapper.downloadTask(map, collect);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
SchBaseTask schBaseTask = dataList.get(i);
|
||||
Map<String, Object> mp = new LinkedHashMap<>();
|
||||
mp.put("任务编码", schBaseTask.getTask_code());
|
||||
mp.put("载具编码", schBaseTask.getVehicle_code());
|
||||
mp.put("任务状态", schBaseTask.getRemark());
|
||||
mp.put("配置编码", schBaseTask.getConfig_code());
|
||||
mp.put("配置名称", schBaseTask.getConfig_name());
|
||||
mp.put("起点", schBaseTask.getPoint_code1());
|
||||
mp.put("终点", schBaseTask.getPoint_code2());
|
||||
mp.put("创建人", schBaseTask.getCreate_name());
|
||||
mp.put("创建时间", schBaseTask.getCreate_time());
|
||||
list.add(mp);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class WrappingDownTask extends AbstractTask {
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
// 查找空闲的成品区
|
||||
List<SchBasePoint> list = pointService.getNoTaskPointByRegionAndType("CPQ01", "1", "1");
|
||||
List<SchBasePoint> list = pointService.getNoTaskPointByRegionAndTypeCp("CPQ01", "1", "1");
|
||||
if (list.size() == 0) {
|
||||
throw new BadRequestException("成品区没有空闲点位!");
|
||||
}
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
<div class="head-container">
|
||||
<Search />
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-thumb"
|
||||
size="mini"
|
||||
:loading="showDtlLoading"
|
||||
@click="down"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
@@ -49,6 +60,8 @@ import Search from './search'
|
||||
import CRUD, { presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'ErrorLog',
|
||||
@@ -59,6 +72,7 @@ export default {
|
||||
mixins: [presenter()],
|
||||
data() {
|
||||
return {
|
||||
showDtlLoading: false,
|
||||
errorInfo: '', dialog: false
|
||||
}
|
||||
},
|
||||
@@ -96,6 +110,23 @@ export default {
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
down() {
|
||||
if (this.currentRow !== null) {
|
||||
const data = this.crud.query
|
||||
if (this.crud.query.createTime !== undefined) {
|
||||
data.begin_time = this.crud.query.createTime[0]
|
||||
data.end_time = this.crud.query.createTime[1]
|
||||
}
|
||||
data.log_type = 'ERROR'
|
||||
this.showDtlLoading = true
|
||||
download('/api/logs/download', data).then(result => {
|
||||
downloadFile(result, '日志查询', 'xlsx')
|
||||
this.showDtlLoading = false
|
||||
}).catch(() => {
|
||||
this.showDtlLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
<div class="head-container">
|
||||
<Search />
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-thumb"
|
||||
size="mini"
|
||||
:loading="showDtlLoading"
|
||||
@click="down"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
</div>
|
||||
<!--表格渲染-->
|
||||
@@ -49,6 +60,8 @@ import CRUD, { presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import i18n from '@/i18n'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'Log',
|
||||
@@ -65,6 +78,11 @@ export default {
|
||||
download: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showDtlLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
confirmDelAll() {
|
||||
this.$confirm(i18n.t('ErrorLog.msg.m1'), i18n.t('common.Operate'), {
|
||||
@@ -84,6 +102,23 @@ export default {
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
down() {
|
||||
if (this.currentRow !== null) {
|
||||
const data = this.crud.query
|
||||
if (this.crud.query.createTime !== undefined) {
|
||||
data.begin_time = this.crud.query.createTime[0]
|
||||
data.end_time = this.crud.query.createTime[1]
|
||||
}
|
||||
data.log_type = 'INFO'
|
||||
this.showDtlLoading = true
|
||||
download('/api/logs/download', data).then(result => {
|
||||
downloadFile(result, '日志查询', 'xlsx')
|
||||
this.showDtlLoading = false
|
||||
}).catch(() => {
|
||||
this.showDtlLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,19 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, 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="down"
|
||||
>
|
||||
导出
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="800px">
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="115px" label-suffix=":">
|
||||
@@ -261,6 +273,8 @@ import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import {download} from "@/api/data";
|
||||
import {downloadFile} from "@/utils";
|
||||
|
||||
const defaultForm = {
|
||||
task_id: null,
|
||||
@@ -322,6 +336,7 @@ export default {
|
||||
},
|
||||
rules: {
|
||||
},
|
||||
showDtlLoading: false,
|
||||
taskStatusList: [],
|
||||
taskConfigList: []
|
||||
}
|
||||
@@ -390,6 +405,22 @@ export default {
|
||||
}).catch(err => {
|
||||
console.log(err.response.data.message)
|
||||
})
|
||||
},
|
||||
down() {
|
||||
if (this.currentRow !== null) {
|
||||
const data = this.crud.query
|
||||
if (this.crud.query.createTime !== undefined) {
|
||||
data.begin_time = this.crud.query.createTime[0]
|
||||
data.end_time = this.crud.query.createTime[1]
|
||||
}
|
||||
this.showDtlLoading = true
|
||||
download('/api/schBaseTask/download', data).then(result => {
|
||||
downloadFile(result, '任务查询', 'xlsx')
|
||||
this.showDtlLoading = false
|
||||
}).catch(() => {
|
||||
this.showDtlLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user