1. 增加拣选任务记录报表
This commit is contained in:
parent
048654698b
commit
755e6b4b95
|
|
@ -1,5 +1,8 @@
|
||||||
package com.wms.constants.enums;
|
package com.wms.constants.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum PickTaskStatusEnum {
|
public enum PickTaskStatusEnum {
|
||||||
TEMP(-1, "暂存"),
|
TEMP(-1, "暂存"),
|
||||||
NEW(0, "初始化"),
|
NEW(0, "初始化"),
|
||||||
|
|
@ -15,11 +18,13 @@ public enum PickTaskStatusEnum {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCode() {
|
public static String getValueByCode(Integer code) {
|
||||||
return code;
|
for (PickTaskStatusEnum value : PickTaskStatusEnum.values()) {
|
||||||
|
if (value.code.equals(code)) {
|
||||||
|
return value.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "错误枚举值";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import com.wms.entity.app.vo.FileVo;
|
||||||
import com.wms.entity.app.vo.UploadRecordVo;
|
import com.wms.entity.app.vo.UploadRecordVo;
|
||||||
import com.wms.entity.table.*;
|
import com.wms.entity.table.*;
|
||||||
import com.wms.service.*;
|
import com.wms.service.*;
|
||||||
|
import com.wms.service.business.IWorkService;
|
||||||
import com.wms.utils.HttpUtils;
|
import com.wms.utils.HttpUtils;
|
||||||
import com.wms.utils.StringUtils;
|
import com.wms.utils.StringUtils;
|
||||||
import com.wms.utils.excel.listener.*;
|
import com.wms.utils.excel.listener.*;
|
||||||
|
|
@ -37,9 +38,11 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.wms.config.InitLocalConfig.configMap;
|
||||||
import static com.wms.constants.WmsConstants.MYSQL_JSON_CI;
|
import static com.wms.constants.WmsConstants.MYSQL_JSON_CI;
|
||||||
import static com.wms.utils.HttpUtils.getIpAddr;
|
import static com.wms.utils.HttpUtils.getIpAddr;
|
||||||
import static com.wms.utils.StringUtils.convertJsonString;
|
import static com.wms.utils.StringUtils.convertJsonString;
|
||||||
|
|
@ -68,8 +71,10 @@ public class ExcelController {
|
||||||
private final WorkFlowService workFlowService;// 工作流服务
|
private final WorkFlowService workFlowService;// 工作流服务
|
||||||
private final WorkDateService workDateService;// 工作日历服务
|
private final WorkDateService workDateService;// 工作日历服务
|
||||||
private final IStockUpdateRecordService stockUpdateRecordService; // 库存更新记录服务
|
private final IStockUpdateRecordService stockUpdateRecordService; // 库存更新记录服务
|
||||||
|
private final IWorkService workService;
|
||||||
|
|
||||||
private final List<String> uploadFileHashStringList = new ArrayList<>();
|
private final List<String> uploadFileHashStringList = new ArrayList<>();
|
||||||
|
private final PickTaskRecordService pickTaskRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询上传记录
|
* 查询上传记录
|
||||||
|
|
@ -805,6 +810,38 @@ public class ExcelController {
|
||||||
.doWrite(goodsList.stream().map(WorkSummaryExcelVo::of).toList());
|
.doWrite(goodsList.stream().map(WorkSummaryExcelVo::of).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出拣选任务记录
|
||||||
|
*
|
||||||
|
* @param response 请求
|
||||||
|
*/
|
||||||
|
@PostMapping("/downloadPickTaskRecordsExcel")
|
||||||
|
@ResponseBody
|
||||||
|
public void downloadPickTaskRecordsExcel(@RequestBody PickTaskRecordQuery pickTaskRecordQuery, HttpServletResponse response) throws IOException {
|
||||||
|
logger.info("导出拣选任务记录,筛选参数:{},请求ip:{}", convertJsonString(pickTaskRecordQuery), 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();
|
||||||
|
List<PickTaskRecord> recordList = Collections.emptyList();
|
||||||
|
if (pickTaskRecordQuery.getWorkDate() != null) {
|
||||||
|
var queryWrapper = new LambdaQueryWrapper<PickTaskRecord>()
|
||||||
|
.like(StringUtils.isNotEmpty(pickTaskRecordQuery.getVehicleId()), PickTaskRecord::getVehicleId, pickTaskRecordQuery.getVehicleId())
|
||||||
|
.like(StringUtils.isNotEmpty(pickTaskRecordQuery.getStandId()), PickTaskRecord::getStandId, pickTaskRecordQuery.getStandId())
|
||||||
|
.between(PickTaskRecord::getArriveTime, pickTaskRecordQuery.getWorkDate().atStartOfDay(), pickTaskRecordQuery.getWorkDate().plusDays(1).atStartOfDay().minusSeconds(1));
|
||||||
|
recordList = pickTaskRecordService.list(queryWrapper);
|
||||||
|
}
|
||||||
|
EasyExcel.write(response.getOutputStream(), PickTaskRecordExcelVo.class)
|
||||||
|
.excelType(ExcelTypeEnum.XLSX)
|
||||||
|
.registerWriteHandler(horizontalCellStyleStrategy)
|
||||||
|
.sheet("拣选任务记录报表")
|
||||||
|
.doWrite(recordList.stream().map(PickTaskRecordExcelVo::fromPo).toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出工单
|
* 导出工单
|
||||||
*
|
*
|
||||||
|
|
@ -822,11 +859,56 @@ public class ExcelController {
|
||||||
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
response.setHeader("Content-Disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||||
// 内容样式
|
// 内容样式
|
||||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = ExcelContentStyle.getContentStyle();
|
HorizontalCellStyleStrategy horizontalCellStyleStrategy = ExcelContentStyle.getContentStyle();
|
||||||
// 查询参数
|
// 结果列表
|
||||||
LambdaQueryWrapper<KateOrders> kateOrdersLamdaQueryWrapper = new LambdaQueryWrapper<KateOrders>()
|
List<KateOrders> kateOrdersList = Collections.emptyList();
|
||||||
.eq(kateOrdersQuery.getPlanStartDate() != null, KateOrders::getPlanStartDate, kateOrdersQuery.getPlanStartDate())
|
if (kateOrdersQuery.getPlanStartDate() != null) {
|
||||||
.eq(kateOrdersQuery.getOrderStatus() != null, KateOrders::getOrderStatus, kateOrdersQuery.getOrderStatus());
|
// 添加进总汇总数据
|
||||||
List<KateOrders> kateOrdersList = kateOrdersService.list(kateOrdersLamdaQueryWrapper);
|
List<WorkFlow> allFlows = new ArrayList<>();
|
||||||
|
// 查询配置是否使用默认开工日期
|
||||||
|
String useReqmtDate = configMap.get(ConfigMapKeyEnum.USE_REQUIRE_DATE.getConfigKey());
|
||||||
|
if (!StringUtils.isEmpty(useReqmtDate) && useReqmtDate.equals("1")) {// 使用工单的开工日期
|
||||||
|
// 查询配置是否使用默认开工日期调整
|
||||||
|
String useDefaultAdjust = configMap.get(ConfigMapKeyEnum.USE_DEFAULT_ADJUST.getConfigKey());
|
||||||
|
if (!StringUtils.isEmpty(useDefaultAdjust) && useDefaultAdjust.equals("1")) {
|
||||||
|
workService.findCurrentDateWorks(allFlows, kateOrdersQuery.getPlanStartDate());
|
||||||
|
} else {
|
||||||
|
workService.findCurrentDateWorksUseConfig(allFlows, kateOrdersQuery.getPlanStartDate());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 获取当天所有的装载机工作
|
||||||
|
List<WorkFlow> thisDayMWLWorks = new ArrayList<>();
|
||||||
|
// 获取到当天所有的平地机工作
|
||||||
|
List<WorkFlow> thisDayMGWorks = new ArrayList<>();
|
||||||
|
// 需要合并第二天的平地机工作
|
||||||
|
List<WorkFlow> nextDayMGWorks = new ArrayList<>();
|
||||||
|
// 生成装载机工作流
|
||||||
|
workService.findWorks("", thisDayMWLWorks, "MWL", kateOrdersQuery.getPlanStartDate());
|
||||||
|
if (!thisDayMWLWorks.isEmpty()) {
|
||||||
|
allFlows.addAll(thisDayMWLWorks);
|
||||||
|
}
|
||||||
|
// 生成当天平地机工作流
|
||||||
|
workService.findWorks("", thisDayMGWorks, "NOT_MWL", kateOrdersQuery.getPlanStartDate());
|
||||||
|
if (!thisDayMGWorks.isEmpty()) {
|
||||||
|
allFlows.addAll(thisDayMGWorks);
|
||||||
|
// 查询配置是否需要合并第二天的配置
|
||||||
|
String ifMergeTomorrow = configMap.get(ConfigMapKeyEnum.IF_MERGE_TOMORROW.getConfigKey());
|
||||||
|
if (!StringUtils.isEmpty(ifMergeTomorrow) && ifMergeTomorrow.equals("1")) {
|
||||||
|
// 获取下一个工作日
|
||||||
|
LocalDate nextWorkDate = workService.nextWorkDate(kateOrdersQuery.getPlanStartDate());
|
||||||
|
if (nextWorkDate != null && nextWorkDate.isAfter(kateOrdersQuery.getPlanStartDate())) {
|
||||||
|
workService.findWorks("", nextDayMGWorks, "NOT_MWL", nextWorkDate);
|
||||||
|
}
|
||||||
|
if (!nextDayMGWorks.isEmpty()) {
|
||||||
|
// 添加第二天的平地机工作进汇总
|
||||||
|
allFlows.addAll(nextDayMGWorks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!allFlows.isEmpty()) {
|
||||||
|
kateOrdersList = kateOrdersService.listByIds(allFlows.stream().map(WorkFlow::getOrderId).distinct().toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
EasyExcel.write(response.getOutputStream(), KateOrdersExcelVo.class)
|
EasyExcel.write(response.getOutputStream(), KateOrdersExcelVo.class)
|
||||||
.excelType(ExcelTypeEnum.XLSX)
|
.excelType(ExcelTypeEnum.XLSX)
|
||||||
.registerWriteHandler(horizontalCellStyleStrategy)
|
.registerWriteHandler(horizontalCellStyleStrategy)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.wms.entity.app.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拣选任务记录查询
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PickTaskRecordQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 载具号
|
||||||
|
*/
|
||||||
|
@JsonProperty("vehicleId")
|
||||||
|
private String vehicleId;
|
||||||
|
/**
|
||||||
|
* 站台号
|
||||||
|
*/
|
||||||
|
@JsonProperty("standId")
|
||||||
|
private String standId;
|
||||||
|
/**
|
||||||
|
* 工作日期
|
||||||
|
*/
|
||||||
|
@JsonProperty("workDate")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private LocalDate workDate;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.wms.service.business;
|
package com.wms.service.business;
|
||||||
|
|
||||||
|
import com.wms.entity.table.WorkFlow;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,4 +43,12 @@ public interface IWorkService {
|
||||||
void distributeWorks();
|
void distributeWorks();
|
||||||
|
|
||||||
void distributeWorksMethod2();
|
void distributeWorksMethod2();
|
||||||
|
|
||||||
|
void findCurrentDateWorks(List<WorkFlow> workFlows, LocalDate currentWorkDate);
|
||||||
|
|
||||||
|
void findCurrentDateWorksUseConfig(List<WorkFlow> workFlows, LocalDate currentWorkDate);
|
||||||
|
|
||||||
|
void findWorks(String workStation, List<WorkFlow> workFlows, String model, LocalDate currentWorkDate);
|
||||||
|
|
||||||
|
LocalDate nextWorkDate(LocalDate currentDate);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ public class WorkServiceImplements implements IWorkService {
|
||||||
* @param currentDate 当前日期
|
* @param currentDate 当前日期
|
||||||
* @return 下一个工作日
|
* @return 下一个工作日
|
||||||
*/
|
*/
|
||||||
private LocalDate nextWorkDate(LocalDate currentDate) {
|
@Override
|
||||||
|
public LocalDate nextWorkDate(LocalDate currentDate) {
|
||||||
// 判断是否是当天开工
|
// 判断是否是当天开工
|
||||||
int indexOfCurrentDate = localWorkDateList.indexOf(currentDate);
|
int indexOfCurrentDate = localWorkDateList.indexOf(currentDate);
|
||||||
if (indexOfCurrentDate == -1) {
|
if (indexOfCurrentDate == -1) {
|
||||||
|
|
@ -903,7 +904,8 @@ public class WorkServiceImplements implements IWorkService {
|
||||||
* @param workFlows 工作流/工作任务
|
* @param workFlows 工作流/工作任务
|
||||||
* @param model 机型
|
* @param model 机型
|
||||||
*/
|
*/
|
||||||
private void findWorks(String workStation, List<WorkFlow> workFlows, String model, LocalDate currentWorkDate) {
|
@Override
|
||||||
|
public void findWorks(String workStation, List<WorkFlow> workFlows, String model, LocalDate currentWorkDate) {
|
||||||
String modelStr = Objects.equals(model, "MWL") ? "装载机" : "平地机";
|
String modelStr = Objects.equals(model, "MWL") ? "装载机" : "平地机";
|
||||||
//开始时间:
|
//开始时间:
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
|
@ -1029,19 +1031,20 @@ public class WorkServiceImplements implements IWorkService {
|
||||||
* @param workFlows 工作流
|
* @param workFlows 工作流
|
||||||
* @param currentWorkDate 日期
|
* @param currentWorkDate 日期
|
||||||
*/
|
*/
|
||||||
private void findCurrentDateWorks(List<WorkFlow> workFlows, LocalDate currentWorkDate) {
|
@Override
|
||||||
|
public void findCurrentDateWorks(List<WorkFlow> workFlows, LocalDate currentWorkDate) {
|
||||||
//开始时间:
|
//开始时间:
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
System.out.println("分析当日工作流,开始时间:" + startTime);
|
System.out.println("分析当日工作流,开始时间:" + startTime);
|
||||||
// 获取开工日期调整配置
|
// 获取开工日期调整配置
|
||||||
int dateAdjust = 0;
|
int dateAdjust = -1;
|
||||||
try {
|
try {
|
||||||
String dateAdjustStr = configMap.get(ConfigMapKeyEnum.START_DATE_ADJUST.getConfigKey());
|
String dateAdjustStr = configMap.get(ConfigMapKeyEnum.START_DATE_ADJUST.getConfigKey());
|
||||||
if (StringUtils.isNotEmpty(dateAdjustStr)) {
|
if (StringUtils.isNotEmpty(dateAdjustStr)) {
|
||||||
dateAdjust = Integer.parseInt(dateAdjustStr);
|
dateAdjust = Integer.parseInt(dateAdjustStr);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("获取开工日期调整配置失败:{},使用默认值0。", e.getMessage());
|
logger.error("获取开工日期调整配置失败:{},使用默认值-1。", e.getMessage());
|
||||||
}
|
}
|
||||||
// 获取到需要查询的需求日期
|
// 获取到需要查询的需求日期
|
||||||
int currentDateIndex = localWorkDateList.indexOf(currentWorkDate);
|
int currentDateIndex = localWorkDateList.indexOf(currentWorkDate);
|
||||||
|
|
@ -1124,7 +1127,8 @@ public class WorkServiceImplements implements IWorkService {
|
||||||
* @param workFlows 工作流
|
* @param workFlows 工作流
|
||||||
* @param currentWorkDate 日期
|
* @param currentWorkDate 日期
|
||||||
*/
|
*/
|
||||||
private void findCurrentDateWorksUseConfig(List<WorkFlow> workFlows, LocalDate currentWorkDate) {
|
@Override
|
||||||
|
public void findCurrentDateWorksUseConfig(List<WorkFlow> workFlows, LocalDate currentWorkDate) {
|
||||||
//开始时间:
|
//开始时间:
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
System.out.println("分析当日工作流,开始时间:" + startTime);
|
System.out.println("分析当日工作流,开始时间:" + startTime);
|
||||||
|
|
@ -1184,6 +1188,7 @@ public class WorkServiceImplements implements IWorkService {
|
||||||
}
|
}
|
||||||
if (currentDateKateWorkOrders.isEmpty()) {
|
if (currentDateKateWorkOrders.isEmpty()) {
|
||||||
logger.info("当前工作日没有待生成的工作流。");
|
logger.info("当前工作日没有待生成的工作流。");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
for (KateOrders tempOrder : currentDateKateWorkOrders) {
|
for (KateOrders tempOrder : currentDateKateWorkOrders) {
|
||||||
// 生成workFlow
|
// 生成workFlow
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.wms.utils;
|
package com.wms.utils;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WMS字符串工具类
|
* WMS字符串工具类
|
||||||
|
|
@ -27,6 +29,7 @@ public class StringUtils {
|
||||||
*/
|
*/
|
||||||
public static String toUnderScoreCase(String str)
|
public static String toUnderScoreCase(String str)
|
||||||
{
|
{
|
||||||
|
ApplicationContext applicationContext = SpringApplication.run(StringUtils.class);
|
||||||
if (str == null)
|
if (str == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -140,4 +143,34 @@ public class StringUtils {
|
||||||
public static String padRight(String value, int size, String padStr) {
|
public static String padRight(String value, int size, String padStr) {
|
||||||
return org.apache.commons.lang3.StringUtils.rightPad(value, size, padStr);
|
return org.apache.commons.lang3.StringUtils.rightPad(value, size, padStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时长;格式化,最高:xx天xx小时xx分xx秒
|
||||||
|
* @param origin 秒
|
||||||
|
* @return 格式化字符串
|
||||||
|
*/
|
||||||
|
public static String durationFormat(Long origin) {
|
||||||
|
long dayDiv = 60 * 60 * 24;
|
||||||
|
long hourDiv = 60 * 60;
|
||||||
|
long minuteDiv = 60;
|
||||||
|
long days = origin / dayDiv;
|
||||||
|
long hours = (origin % dayDiv) / hourDiv;
|
||||||
|
long minutes = (origin % hourDiv) / minuteDiv;
|
||||||
|
long seconds = origin % minuteDiv;
|
||||||
|
String finalStr = "";
|
||||||
|
if (days > 0) {
|
||||||
|
finalStr += days + "天";
|
||||||
|
}
|
||||||
|
if (hours > 0) {
|
||||||
|
finalStr += hours + "小时";
|
||||||
|
}
|
||||||
|
if (minutes > 0) {
|
||||||
|
finalStr += minutes + "分钟";
|
||||||
|
}
|
||||||
|
if (seconds > 0) {
|
||||||
|
finalStr += seconds + "秒";
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalStr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.wms.utils.excel.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||||
|
import com.wms.constants.enums.PickTaskStatusEnum;
|
||||||
|
import com.wms.entity.table.PickTaskRecord;
|
||||||
|
import com.wms.utils.StringUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拣选任务记录excelVo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PickTaskRecordExcelVo {
|
||||||
|
/**
|
||||||
|
* 拣选任务号
|
||||||
|
*/
|
||||||
|
@ExcelProperty("拣选任务号")
|
||||||
|
private String pickTaskId;
|
||||||
|
/**
|
||||||
|
* 载具号
|
||||||
|
*/
|
||||||
|
@ExcelProperty("载具号")
|
||||||
|
private String vehicleId;
|
||||||
|
/**
|
||||||
|
* 站台号
|
||||||
|
*/
|
||||||
|
@ExcelProperty("站台号")
|
||||||
|
private String standId;
|
||||||
|
/**
|
||||||
|
* 拣选任务状态
|
||||||
|
* -1:暂时不可发送
|
||||||
|
* 0:初始化
|
||||||
|
* 1:已发送
|
||||||
|
* 2:已完成
|
||||||
|
*/
|
||||||
|
@ExcelProperty("拣选任务状态")
|
||||||
|
private String pickStatus;
|
||||||
|
/**
|
||||||
|
* 到达时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty("到达时间")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime arriveTime;
|
||||||
|
/**
|
||||||
|
* 最近更新时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty("离开时间")
|
||||||
|
@DateTimeFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime lastUpdateTime;
|
||||||
|
/**
|
||||||
|
* 机型
|
||||||
|
* 1: 装载机;2: 平地机
|
||||||
|
*/
|
||||||
|
@ExcelProperty("机型")
|
||||||
|
private String machineType;
|
||||||
|
/**
|
||||||
|
* 区域类型
|
||||||
|
* 1: 前;2: 后
|
||||||
|
*/
|
||||||
|
@ExcelProperty("区域类型")
|
||||||
|
private String areaType;
|
||||||
|
/**
|
||||||
|
* 滞留时长
|
||||||
|
*/
|
||||||
|
@ExcelProperty("滞留时长")
|
||||||
|
private String useTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建vo
|
||||||
|
* @param pickTaskRecord po
|
||||||
|
* @return vo
|
||||||
|
*/
|
||||||
|
public static PickTaskRecordExcelVo fromPo(PickTaskRecord pickTaskRecord) {
|
||||||
|
PickTaskRecordExcelVo pickTaskRecordExcelVo = new PickTaskRecordExcelVo();
|
||||||
|
pickTaskRecordExcelVo.setPickTaskId(pickTaskRecord.getPickTaskId());
|
||||||
|
pickTaskRecordExcelVo.setVehicleId(pickTaskRecord.getVehicleId());
|
||||||
|
pickTaskRecordExcelVo.setStandId(pickTaskRecord.getStandId());
|
||||||
|
pickTaskRecordExcelVo.setPickStatus(PickTaskStatusEnum.getValueByCode(pickTaskRecord.getPickStatus()));
|
||||||
|
pickTaskRecordExcelVo.setLastUpdateTime(pickTaskRecord.getLastUpdateTime());
|
||||||
|
pickTaskRecordExcelVo.setArriveTime(pickTaskRecord.getArriveTime());
|
||||||
|
pickTaskRecordExcelVo.setMachineType(Objects.equals(pickTaskRecord.getMachineType(), 1) ? "装载机" : "平地机");
|
||||||
|
pickTaskRecordExcelVo.setAreaType(Objects.equals(pickTaskRecord.getAreaType(), 1) ? "前" : "后");
|
||||||
|
if (pickTaskRecord.getArriveTime() != null && pickTaskRecord.getLastUpdateTime() != null) {
|
||||||
|
pickTaskRecordExcelVo.setUseTime(StringUtils.durationFormat(pickTaskRecord.getArriveTime().until(pickTaskRecord.getLastUpdateTime(), ChronoUnit.SECONDS)));
|
||||||
|
} else {
|
||||||
|
pickTaskRecordExcelVo.setUseTime("到达时间与离开时间中有一个错误。");
|
||||||
|
}
|
||||||
|
|
||||||
|
return pickTaskRecordExcelVo;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user