工作流和工作总结查询条件优化
This commit is contained in:
parent
62aece5bbd
commit
06d99038cd
|
|
@ -780,12 +780,21 @@ public class ExcelController {
|
||||||
// 内容样式
|
// 内容样式
|
||||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = ExcelContentStyle.getContentStyle();
|
HorizontalCellStyleStrategy horizontalCellStyleStrategy = ExcelContentStyle.getContentStyle();
|
||||||
// 查询参数
|
// 查询参数
|
||||||
|
String gooodsId = workSummaryQuery.getGoodsId();
|
||||||
|
//用逗号分隔
|
||||||
|
List<String> goodsIdList = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(gooodsId)) {
|
||||||
|
String[] goodsIds = gooodsId.split(",");
|
||||||
|
//转为List
|
||||||
|
goodsIdList = Arrays.asList(goodsIds);
|
||||||
|
}
|
||||||
|
// 查询参数
|
||||||
var workSummaryQueryWrapper = new LambdaQueryWrapper<WorkSummary>()
|
var workSummaryQueryWrapper = new LambdaQueryWrapper<WorkSummary>()
|
||||||
.eq(workSummaryQuery.getLackStatus() != null, WorkSummary::getLackStatus, workSummaryQuery.getLackStatus())
|
.eq(workSummaryQuery.getLackStatus() != null, WorkSummary::getLackStatus, workSummaryQuery.getLackStatus())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkStation()), WorkSummary::getWorkStation, workSummaryQuery.getWorkStation())
|
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkStation()), WorkSummary::getWorkStation, workSummaryQuery.getWorkStation())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkOrder()), WorkSummary::getWorkOrder, workSummaryQuery.getWorkOrder())
|
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkOrder()), WorkSummary::getWorkOrder, workSummaryQuery.getWorkOrder())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkCenter()), WorkSummary::getWorkCenter, workSummaryQuery.getWorkCenter())
|
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkCenter()), WorkSummary::getWorkCenter, workSummaryQuery.getWorkCenter())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getGoodsId()), WorkSummary::getGoodsId, workSummaryQuery.getGoodsId());
|
.in(!goodsIdList.isEmpty(), WorkSummary::getGoodsId, goodsIdList);
|
||||||
if(workSummaryQuery.getWorkDate() != null && workSummaryQuery.getWorkEndDate() != null) {
|
if(workSummaryQuery.getWorkDate() != null && workSummaryQuery.getWorkEndDate() != null) {
|
||||||
workSummaryQueryWrapper.between(WorkSummary::getWorkDate, workSummaryQuery.getWorkDate(), workSummaryQuery.getWorkEndDate());
|
workSummaryQueryWrapper.between(WorkSummary::getWorkDate, workSummaryQuery.getWorkDate(), workSummaryQuery.getWorkEndDate());
|
||||||
|
|
||||||
|
|
@ -800,7 +809,57 @@ public class ExcelController {
|
||||||
.sheet("工作分析报表")
|
.sheet("工作分析报表")
|
||||||
.doWrite(goodsList.stream().map(WorkSummaryExcelVo::of).toList());
|
.doWrite(goodsList.stream().map(WorkSummaryExcelVo::of).toList());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 导出工作流总结
|
||||||
|
*
|
||||||
|
* @param response 请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/downloadWorkFlowExcel")
|
||||||
|
@ResponseBody
|
||||||
|
public String downloadWorkFlowExcel(@RequestBody WorkFlowQuery workFlowQuery, HttpServletResponse response) throws IOException {
|
||||||
|
logger.info("导出工作流,筛选参数:{},请求ip:{}", convertJsonString(workFlowQuery), getIpAddr(servletRequest));
|
||||||
|
//设置响应格式
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
||||||
|
String fileName = URLEncoder.encode("工作流报表", StandardCharsets.UTF_8).replaceAll("\\+", "%20");
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||||
|
// 内容样式
|
||||||
|
HorizontalCellStyleStrategy horizontalCellStyleStrategy = ExcelContentStyle.getContentStyle();
|
||||||
|
// 查询参数
|
||||||
|
String gooodsId = workFlowQuery.getGoodsId();
|
||||||
|
//用逗号分隔
|
||||||
|
List<String> goodsIdList = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(gooodsId)) {
|
||||||
|
String[] goodsIds = gooodsId.split(",");
|
||||||
|
//转为List
|
||||||
|
goodsIdList = Arrays.asList(goodsIds);
|
||||||
|
}
|
||||||
|
var workSummaryQueryWrapper = new LambdaQueryWrapper<WorkFlow>()
|
||||||
|
.eq(StringUtils.isNotEmpty(workFlowQuery.getWorkStation()), WorkFlow::getWorkStation, workFlowQuery.getWorkStation())
|
||||||
|
.eq(StringUtils.isNotEmpty(workFlowQuery.getWorkOrder()), WorkFlow::getWorkOrder, workFlowQuery.getWorkOrder())
|
||||||
|
.eq(StringUtils.isNotEmpty(workFlowQuery.getWorkCenter()), WorkFlow::getWorkCenter, workFlowQuery.getWorkCenter())
|
||||||
|
.eq(workFlowQuery.getLightStatus() != null, WorkFlow::getLightStatus, workFlowQuery.getLightStatus())
|
||||||
|
.eq(workFlowQuery.getWorkStatus() != null, WorkFlow::getWorkStatus, workFlowQuery.getWorkStatus())
|
||||||
|
.eq(workFlowQuery.getMachineType() != null, WorkFlow::getMachineType, workFlowQuery.getMachineType())
|
||||||
|
.in(!goodsIdList.isEmpty(), WorkFlow::getGoodsId, goodsIdList);
|
||||||
|
|
||||||
|
List<WorkFlow> goodsList = workFlowService.list(workSummaryQueryWrapper);
|
||||||
|
ResponseEntity responseEntity = new ResponseEntity();
|
||||||
|
if(goodsList.isEmpty()){
|
||||||
|
responseEntity.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
responseEntity.setMessage("数据为空,导出失败");
|
||||||
|
return convertJsonString(responseEntity);
|
||||||
|
}
|
||||||
|
EasyExcel.write(response.getOutputStream(), KateWorkFlowExcelVo.class)
|
||||||
|
.excelType(ExcelTypeEnum.XLSX)
|
||||||
|
.registerWriteHandler(horizontalCellStyleStrategy)
|
||||||
|
.sheet("工作流分析报表")
|
||||||
|
.doWrite(goodsList.stream().map(KateWorkFlowExcelVo::of).toList());
|
||||||
|
responseEntity.setCode(ResponseCode.OK.getCode());
|
||||||
|
responseEntity.setMessage("导出成功");
|
||||||
|
return convertJsonString(responseEntity);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 导出库存更新记录
|
* 导出库存更新记录
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -720,14 +720,23 @@ public class KateWorkQueryController {
|
||||||
ResponseEntity response = new ResponseEntity();
|
ResponseEntity response = new ResponseEntity();
|
||||||
try {
|
try {
|
||||||
Page<WorkFlow> page = workFlowQuery.toMpPage();
|
Page<WorkFlow> page = workFlowQuery.toMpPage();
|
||||||
|
// 查询参数
|
||||||
|
String gooodsId = workFlowQuery.getGoodsId();
|
||||||
|
//用逗号分隔
|
||||||
|
List<String> goodsIdList = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(gooodsId)) {
|
||||||
|
String[] goodsIds = gooodsId.split(",");
|
||||||
|
//转为List
|
||||||
|
goodsIdList = Arrays.asList(goodsIds);
|
||||||
|
}
|
||||||
Page<WorkFlow> workFlowsPage = workFlowService.page(page, new LambdaQueryWrapper<WorkFlow>()
|
Page<WorkFlow> workFlowsPage = workFlowService.page(page, new LambdaQueryWrapper<WorkFlow>()
|
||||||
.eq(workFlowQuery.getLightStatus() != null, WorkFlow::getLightStatus, workFlowQuery.getLightStatus())
|
.eq(workFlowQuery.getLightStatus() != null, WorkFlow::getLightStatus, workFlowQuery.getLightStatus())
|
||||||
.eq(workFlowQuery.getWorkStatus() != null, WorkFlow::getWorkStatus, workFlowQuery.getWorkStatus())
|
.eq(workFlowQuery.getWorkStatus() != null, WorkFlow::getWorkStatus, workFlowQuery.getWorkStatus())
|
||||||
|
.eq(workFlowQuery.getMachineType() != null, WorkFlow::getMachineType, workFlowQuery.getMachineType())
|
||||||
.like(StringUtils.isNotEmpty(workFlowQuery.getWorkStation()), WorkFlow::getWorkStation, workFlowQuery.getWorkStation())
|
.like(StringUtils.isNotEmpty(workFlowQuery.getWorkStation()), WorkFlow::getWorkStation, workFlowQuery.getWorkStation())
|
||||||
.like(StringUtils.isNotEmpty(workFlowQuery.getWorkOrder()), WorkFlow::getWorkOrder, workFlowQuery.getWorkOrder())
|
.like(StringUtils.isNotEmpty(workFlowQuery.getWorkOrder()), WorkFlow::getWorkOrder, workFlowQuery.getWorkOrder())
|
||||||
.like(StringUtils.isNotEmpty(workFlowQuery.getWorkCenter()), WorkFlow::getWorkCenter, workFlowQuery.getWorkCenter())
|
.like(StringUtils.isNotEmpty(workFlowQuery.getWorkCenter()), WorkFlow::getWorkCenter, workFlowQuery.getWorkCenter())
|
||||||
.like(StringUtils.isNotEmpty(workFlowQuery.getGoodsId()), WorkFlow::getGoodsId, workFlowQuery.getGoodsId())
|
.in(!goodsIdList.isEmpty(), WorkFlow::getGoodsId, goodsIdList));
|
||||||
.eq(workFlowQuery.getMachineType() != null, WorkFlow::getMachineType, workFlowQuery.getMachineType()));
|
|
||||||
PageDto<WorkFlowVo> pageDto = PageDto.of(workFlowsPage, workFlow -> BeanUtil.copyProperties(workFlow, WorkFlowVo.class));
|
PageDto<WorkFlowVo> pageDto = PageDto.of(workFlowsPage, workFlow -> BeanUtil.copyProperties(workFlow, WorkFlowVo.class));
|
||||||
logger.info("查询工作流成功。");
|
logger.info("查询工作流成功。");
|
||||||
response.setCode(ResponseCode.OK.getCode());
|
response.setCode(ResponseCode.OK.getCode());
|
||||||
|
|
@ -799,12 +808,21 @@ public class KateWorkQueryController {
|
||||||
logger.info("接收到查询工作总结请求:{},请求ip:{}", convertJsonString(workSummaryQuery), HttpUtils.getIpAddr(servletRequest));
|
logger.info("接收到查询工作总结请求:{},请求ip:{}", convertJsonString(workSummaryQuery), HttpUtils.getIpAddr(servletRequest));
|
||||||
ResponseEntity response = new ResponseEntity();
|
ResponseEntity response = new ResponseEntity();
|
||||||
try {
|
try {
|
||||||
|
// 查询参数
|
||||||
|
String gooodsId = workSummaryQuery.getGoodsId();
|
||||||
|
//用逗号分隔
|
||||||
|
List<String> goodsIdList = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(gooodsId)) {
|
||||||
|
String[] goodsIds = gooodsId.split(",");
|
||||||
|
//转为List
|
||||||
|
goodsIdList = Arrays.asList(goodsIds);
|
||||||
|
}
|
||||||
var workSummaryQueryWrapper = new LambdaQueryWrapper<WorkSummary>()
|
var workSummaryQueryWrapper = new LambdaQueryWrapper<WorkSummary>()
|
||||||
.eq(workSummaryQuery.getLackStatus() != null, WorkSummary::getLackStatus, workSummaryQuery.getLackStatus())
|
.eq(workSummaryQuery.getLackStatus() != null, WorkSummary::getLackStatus, workSummaryQuery.getLackStatus())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkStation()), WorkSummary::getWorkStation, workSummaryQuery.getWorkStation())
|
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkStation()), WorkSummary::getWorkStation, workSummaryQuery.getWorkStation())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkOrder()), WorkSummary::getWorkOrder, workSummaryQuery.getWorkOrder())
|
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkOrder()), WorkSummary::getWorkOrder, workSummaryQuery.getWorkOrder())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkCenter()), WorkSummary::getWorkCenter, workSummaryQuery.getWorkCenter())
|
.like(StringUtils.isNotEmpty(workSummaryQuery.getWorkCenter()), WorkSummary::getWorkCenter, workSummaryQuery.getWorkCenter())
|
||||||
.like(StringUtils.isNotEmpty(workSummaryQuery.getGoodsId()), WorkSummary::getGoodsId, workSummaryQuery.getGoodsId());
|
.in(!goodsIdList.isEmpty(), WorkSummary::getGoodsId, goodsIdList);
|
||||||
if(workSummaryQuery.getWorkDate() != null && workSummaryQuery.getWorkEndDate() != null) {
|
if(workSummaryQuery.getWorkDate() != null && workSummaryQuery.getWorkEndDate() != null) {
|
||||||
if(workSummaryQuery.getWorkEndDate().isBefore(workSummaryQuery.getWorkDate())) {
|
if(workSummaryQuery.getWorkEndDate().isBefore(workSummaryQuery.getWorkDate())) {
|
||||||
response.setCode(ResponseCode.ERROR.getCode());
|
response.setCode(ResponseCode.ERROR.getCode());
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,6 @@ public class TaskController {
|
||||||
* 请求头部信息
|
* 请求头部信息
|
||||||
*/
|
*/
|
||||||
private final HttpServletRequest servletRequest;
|
private final HttpServletRequest servletRequest;
|
||||||
/**
|
|
||||||
* WMS任务服务
|
|
||||||
*/
|
|
||||||
private final IWmsTaskService wmsTaskService;
|
private final IWmsTaskService wmsTaskService;
|
||||||
/**
|
/**
|
||||||
* 验证服务
|
* 验证服务
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.wms.entity.app.vo;
|
package com.wms.entity.app.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ public class Task {
|
||||||
private String taskId;
|
private String taskId;
|
||||||
/**
|
/**
|
||||||
* 任务类型
|
* 任务类型
|
||||||
|
* 1:入库
|
||||||
|
* 2:出库
|
||||||
|
* 10:盘点
|
||||||
|
* 9:移库
|
||||||
*/
|
*/
|
||||||
@TableField("task_type")
|
@TableField("task_type")
|
||||||
private Integer taskType;
|
private Integer taskType;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ public class WorkFlow {
|
||||||
private Integer lightStatus;
|
private Integer lightStatus;
|
||||||
/**
|
/**
|
||||||
* 工作状态
|
* 工作状态
|
||||||
|
* -1: 暂存状态
|
||||||
* 0:未开始
|
* 0:未开始
|
||||||
* 1:正在做
|
* 1:正在做
|
||||||
* 2:已完成
|
* 2:已完成
|
||||||
|
|
@ -88,6 +89,8 @@ public class WorkFlow {
|
||||||
private String opUser;
|
private String opUser;
|
||||||
/**
|
/**
|
||||||
* 机器类型
|
* 机器类型
|
||||||
|
* 1:装载机
|
||||||
|
* 2:平地机
|
||||||
*/
|
*/
|
||||||
@TableField("machine_type")
|
@TableField("machine_type")
|
||||||
private Integer machineType;
|
private Integer machineType;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -379,6 +380,9 @@ public class WorkServiceImplements implements IWorkService {
|
||||||
* @param model 机型
|
* @param model 机型
|
||||||
*/
|
*/
|
||||||
private void findWorks(String workStation, List<WorkFlow> workFlows, String model, LocalDate currentWorkDate) {
|
private void findWorks(String workStation, List<WorkFlow> workFlows, String model, LocalDate currentWorkDate) {
|
||||||
|
//开始时间:
|
||||||
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
System.out.println("开始时间:" + startTime);
|
||||||
// 查到当前站台所有的小工位
|
// 查到当前站台所有的小工位
|
||||||
LambdaQueryWrapper<WorkStationConfig> stationConfigQueryWrapper = new LambdaQueryWrapper<WorkStationConfig>()
|
LambdaQueryWrapper<WorkStationConfig> stationConfigQueryWrapper = new LambdaQueryWrapper<WorkStationConfig>()
|
||||||
.eq(StringUtils.isNotEmpty(workStation), WorkStationConfig::getWorkStation, workStation);
|
.eq(StringUtils.isNotEmpty(workStation), WorkStationConfig::getWorkStation, workStation);
|
||||||
|
|
@ -489,6 +493,12 @@ public class WorkServiceImplements implements IWorkService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//结束时间
|
||||||
|
LocalDateTime endTime = LocalDateTime.now();
|
||||||
|
// 用时
|
||||||
|
long duration = Duration.between(startTime, endTime).toMillis();
|
||||||
|
logger.info("生成当天工作流耗时:{}ms", duration);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,8 @@ public class JobServiceImpl implements IJobService {
|
||||||
jobBeans.add(new JobBean("CommonTaskSender", CommonTaskSender.class, "0/2 * * * * ?", 2000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
jobBeans.add(new JobBean("CommonTaskSender", CommonTaskSender.class, "0/2 * * * * ?", 2000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||||
jobBeans.add(new JobBean("PickTaskSender", PickTaskSender.class, "0/2 * * * * ?", 2000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
jobBeans.add(new JobBean("PickTaskSender", PickTaskSender.class, "0/2 * * * * ?", 2000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||||
jobBeans.add(new JobBean("PickOutTaskSender", PickOutTaskSender.class, "0/2 * * * * ?", 2000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
jobBeans.add(new JobBean("PickOutTaskSender", PickOutTaskSender.class, "0/2 * * * * ?", 2000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||||
jobBeans.add(new JobBean("KateWorkExecutor", KateWorkExecutor.class, "0/20 * * * * ?", 20000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
// jobBeans.add(new JobBean("KateWorkExecutor", KateWorkExecutor.class, "0/20 * * * * ?", 20000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||||
|
jobBeans.add(new JobBean("KateWorkExecutor", KateWorkExecutor.class, "0 0 * * * ?", 20000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||||
jobBeans.add(new JobBean("DataClearExecutor", DataClearExecutor.class, "0 0 22 * * ?", null, JobTimerTypeEnums.CRON.getType(), 1));
|
jobBeans.add(new JobBean("DataClearExecutor", DataClearExecutor.class, "0 0 22 * * ?", null, JobTimerTypeEnums.CRON.getType(), 1));
|
||||||
for (JobBean jobBean : jobBeans) {
|
for (JobBean jobBean : jobBeans) {
|
||||||
createJob(jobBean);
|
createJob(jobBean);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.wms.utils.excel.vo;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.wms.entity.table.WorkStationConfig;
|
import com.wms.entity.table.WorkStationConfig;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user