no message

main
HUOJIN\92525 2026-02-09 17:58:45 +08:00
parent 8482bae482
commit 332c585e35
7 changed files with 211 additions and 56 deletions

View File

@ -1,10 +1,22 @@
package org.cpte.modules.agvTask.controller;
import java.util.Arrays;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
import org.cpte.modules.agvTask.vo.ExportAgvTask;
import org.cpte.modules.constant.enums.AgvStatusEnum;
import org.cpte.modules.constant.enums.BusinessTypeEnum;
import org.cpte.modules.constant.enums.InventoryStatusEnum;
import org.cpte.modules.inventory.vo.ExportInventory;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.cpte.modules.agvTask.entity.AgvTask;
@ -14,9 +26,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.aspect.annotation.AutoLog;
@ -34,6 +48,9 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
@Slf4j
public class AgvTaskController extends JeecgController<AgvTask, IAgvTaskService> {
@Autowired
private AgvTaskMapper agvTaskMapper;
@Autowired
private IAgvTaskService agvTaskService;
@ -148,8 +165,74 @@ public class AgvTaskController extends JeecgController<AgvTask, IAgvTaskService>
*/
@RequiresPermissions("agvTask:data_agv_task:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AgvTask agvTask) {
return super.exportXls(request, agvTask, AgvTask.class, "AGV任务表");
public void exportXls(HttpServletRequest request, HttpServletResponse response, AgvTask agvTask) {
try {
List<ExportAgvTask> agvTaskList = agvTaskMapper.queryExportAgvTask(agvTask);
List<Map<String, Object>> dataList = new ArrayList<>();
for (ExportAgvTask agv : agvTaskList) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("TES任务号", agv.getTesId());
dataMap.put("任务号", agv.getId());
dataMap.put("柜号", agv.getConNo());
dataMap.put("物料", agv.getItemCode());
dataMap.put("容器", agv.getCarrierCode());
dataMap.put("业务类型", BusinessTypeEnum.getDescByValue(agv.getType()));
dataMap.put("起点", agv.getStartCode());
dataMap.put("终点", agv.getEndCode());
dataMap.put("创建时间", agv.getCreateTime());
dataMap.put("下发时间", agv.getStartTime());
dataMap.put("完成时间", agv.getEndTime());
dataMap.put("完成耗时", agv.getEndConst());
dataMap.put("顶升时间", agv.getOutBinTime());
dataMap.put("顶升耗时", agv.getOutConst());
// 添加其他需要导出的字段
dataList.add(dataMap);
}
List<ExcelExportEntity> entityList = new ArrayList<>();
// 根据实际的库存实体字段设置表头
entityList.add(new ExcelExportEntity("TES任务号", "TES任务号", 10));
entityList.add(new ExcelExportEntity("任务号", "任务号", 20));
entityList.add(new ExcelExportEntity("柜号", "柜号", 15));
entityList.add(new ExcelExportEntity("物料", "物料", 15));
entityList.add(new ExcelExportEntity("容器", "容器", 15));
entityList.add(new ExcelExportEntity("业务类型", "业务类型", 15));
entityList.add(new ExcelExportEntity("起点", "起点", 20));
entityList.add(new ExcelExportEntity("终点", "终点", 20));
entityList.add(new ExcelExportEntity("创建时间", "创建时间", 20));
entityList.add(new ExcelExportEntity("下发时间", "下发时间", 20));
entityList.add(new ExcelExportEntity("完成时间", "完成时间", 20));
entityList.add(new ExcelExportEntity("完成耗时", "完成耗时", 20));
entityList.add(new ExcelExportEntity("顶升时间", "顶升时间", 20));
entityList.add(new ExcelExportEntity("顶升耗时", "顶升耗时", 20));
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "TES任务信息"), entityList, dataList);
/* // 自动调整列宽
Sheet sheet = workbook.getSheetAt(0);
for (int i = 0; i < entityList.size(); i++) {
sheet.autoSizeColumn(i);
}*/
// 设置响应头
response.setContentType("application/vnd.ms-excel");
String fileName = "TES任务信息.xls";
// 对文件名进行URL编码解决中文字符编码问题
String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=UTF-8''" + encodedFileName);
// 直接写入响应输出流
workbook.write(response.getOutputStream());
response.flushBuffer();
} catch (IOException e) {
log.info("excel导出错误:" + e.getMessage());
try {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.getWriter().write("导出失败: " + e.getMessage());
} catch (IOException ex) {
log.error("导出错误处理失败", ex);
}
}
}
/**

View File

@ -1,8 +1,6 @@
package org.cpte.modules.agvTask.entity;
import java.io.Serializable;
import java.sql.Timestamp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@ -13,11 +11,7 @@ import lombok.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.experimental.Accessors;
import javax.persistence.Column;
/**
* @Description: AGV
@ -45,15 +39,13 @@ public class AgvTask implements Serializable {
/**
* ID
*/
@Excel(name = "上游ID", width = 15)
@Schema(description = "上游ID")
@Schema(description = "TES任务号")
@JsonSerialize(using = ToStringSerializer.class)
private java.lang.Long tesId;
/**
* ID
*/
@Excel(name = "业务ID", width = 15)
@Schema(description = "业务ID")
@JsonSerialize(using = ToStringSerializer.class)
private java.lang.Long businessDetailId;
@ -61,7 +53,6 @@ public class AgvTask implements Serializable {
/**
*
*/
@Excel(name = "物料", width = 15)
@Schema(description = "物料")
@Dict(dictTable = "base_item", dicCode = "id", dicText = "item_code")
@JsonSerialize(using = ToStringSerializer.class)
@ -73,66 +64,69 @@ public class AgvTask implements Serializable {
/**
*
*/
@Excel(name = "柜号", width = 15)
@Schema(description = "柜号")
private java.lang.String conNo;
/**
*
*/
@Excel(name = "载具编号", width = 15)
@Schema(description = "载具编号")
private java.lang.String carrierCode;
/**
*
*/
@Excel(name = "载具类型", width = 15)
@Schema(description = "载具类型")
private java.lang.String carrierType;
/**
*
*/
@Excel(name = "任务类型", width = 15)
@Schema(description = "任务类型")
private java.lang.String taskType;
/**
*
*/
@Excel(name = "业务类型", width = 15)
@Schema(description = "业务类型")
@Dict(dicCode = "business_type")
private java.lang.String type;
/**
*
*/
@TableField(exist = false)
private String type_MultiString;
/**
*
*/
@Excel(name = "任务状态", width = 15)
@Schema(description = "任务状态")
@Dict(dicCode = "agv_task_status")
private java.lang.Integer status;
/**
*
*/
@TableField(exist = false)
private String status_MultiString;
/**
*
*/
@Excel(name = "优先级", width = 15)
@Schema(description = "优先级")
private java.lang.Integer priority;
/**
*
*/
@Excel(name = "起点位置", width = 15)
@Schema(description = "起点位置")
private java.lang.String startCode;
/**
*
*/
@Excel(name = "终点位置", width = 15)
@Schema(description = "终点位置")
private java.lang.String endCode;
/**
* AGV
*/
@Excel(name = "AGV供应商", width = 15)
@Schema(description = "AGV供应商")
@Dict(dicCode = "agv_vendor")
private java.lang.String agvVendor;
@ -140,14 +134,12 @@ public class AgvTask implements Serializable {
/**
* 0,1
*/
@Excel(name = "是否整托", width = 15)
@Schema(description = "是否整托")
private java.lang.Integer izAll;
/**
*
*/
@Excel(name = "返回报文", width = 15)
@Schema(description = "返回报文")
private java.lang.String resMessage;
/**
@ -180,7 +172,6 @@ public class AgvTask implements Serializable {
/**
* ID
*/
@Excel(name = "租户ID", width = 15)
@Schema(description = "租户ID")
private java.lang.Long tenantId;
/**
@ -195,6 +186,13 @@ public class AgvTask implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建日期")
private java.util.Date createTime;
@TableField(exist = false)
private String createTime_begin;
@TableField(exist = false)
private String createTime_end;
/**
*
*/

View File

@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.cpte.modules.agvTask.entity.AgvTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.cpte.modules.agvTask.vo.ExportAgvTask;
import org.cpte.modules.dashboard.vo.WorkstationTask;
import java.util.List;
@ -16,6 +17,14 @@ import java.util.Map;
* @Version: V1.0
*/
public interface AgvTaskMapper extends BaseMapper<AgvTask> {
/**
* AGV
*
* @return List<AgvTask>
*/
List<ExportAgvTask> queryExportAgvTask(@Param("agvTask") AgvTask agvTask);
/**
* AGV
*

View File

@ -1,6 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.cpte.modules.agvTask.mapper.AgvTaskMapper">
<select id="queryExportAgvTask" resultType="org.cpte.modules.agvTask.vo.ExportAgvTask">
select
agv.tes_id,
agv.id,
agv.con_no,
agv.carrier_code,
item.item_code,
agv.type,
agv.status,
agv.start_code,
agv.end_code,
agv.create_time,
agv.start_time,
agv.end_time,
CONCAT(
FLOOR(TIMESTAMPDIFF(SECOND, agv.start_time, agv.end_time) / 60),
'分',
MOD(TIMESTAMPDIFF(SECOND, agv.start_time, agv.end_time), 60),
'秒'
) AS end_const,
agv.out_bin_time,
CONCAT(
FLOOR(TIMESTAMPDIFF(SECOND, agv.out_bin_time, agv.end_time) / 60),
'分',
MOD(TIMESTAMPDIFF(SECOND, agv.out_bin_time, agv.end_time), 60),
'秒'
) AS out_const
from data_agv_task agv
left join base_item item on item.id=agv.item_id
<where>
<if test="agvTask.id != null">
AND agv.id = #{agvTask.id}
</if>
<if test="agvTask.carrierCode != null">
AND agv.carrier_code = #{agvTask.carrierCode}
</if>
<if test="agvTask.status_MultiString != null and agvTask.status_MultiString != ''">
AND agv.status IN
<foreach collection="agvTask.status_MultiString.split(',')"
item="status"
open="("
separator=","
close=")">
#{status}
</foreach>
</if>
<if test="agvTask.type_MultiString != null and agvTask.type_MultiString != ''">
AND agv.type IN
<foreach collection="agvTask.type_MultiString.split(',')"
item="type"
open="("
separator=","
close=")">
#{type}
</foreach>
</if>
<if test="agvTask.createTime != null">
AND agv.create_time >= #{agvTask.createTime}
</if>
</where>
order by agv.id
</select>
<select id="queryByLastEndCode" resultType="org.cpte.modules.agvTask.entity.AgvTask">
(SELECT * FROM data_agv_task
WHERE start_code = #{endCode}

View File

@ -0,0 +1,25 @@
package org.cpte.modules.agvTask.vo;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ExportAgvTask {
private Long tesId;
private Long id;
private String conNo;
private String carrierCode;
private String itemCode;
private String type;
private Integer status;
private String startCode;
private String endCode;
private String createTime;
private String startTime;
private String endTime;
private String endConst;
private String outBinTime;
private String outConst;
}

View File

@ -22,31 +22,17 @@ import org.cpte.modules.constant.enums.InventoryStatusEnum;
import org.cpte.modules.inventory.mapper.InventoryMapper;
import org.cpte.modules.inventory.vo.ExportInventory;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
import org.cpte.modules.inventory.entity.Inventory;
import org.cpte.modules.inventory.service.IInventoryService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.jeecg.common.aspect.annotation.AutoLog;

View File

@ -43,7 +43,6 @@ public class Inventory implements Serializable {
/**
* ID
*/
@Excel(name = "物料", width = 15,dictTable ="base_item",dicText = "item_code",dicCode = "id")
@Schema(description = "物料")
@Dict(dictTable = "base_item", dicCode = "id", dicText = "item_code")
@JsonSerialize(using = ToStringSerializer.class)
@ -59,7 +58,6 @@ public class Inventory implements Serializable {
/**
*
*/
@Excel(name = "库位", width = 15,dictTable ="base_point",dicText = "point_code",dicCode = "id")
@Schema(description = "库位")
@Dict(dictTable = "base_point", dicCode = "id", dicText = "point_code")
@JsonSerialize(using = ToStringSerializer.class)
@ -68,7 +66,6 @@ public class Inventory implements Serializable {
/**
*
*/
@Excel(name = "容器", width = 15,dictTable ="base_stock",dicText = "stock_code",dicCode = "id")
@Schema(description = "容器")
@Dict(dictTable = "base_stock", dicCode = "id", dicText = "stock_code")
@JsonSerialize(using = ToStringSerializer.class)
@ -76,20 +73,17 @@ public class Inventory implements Serializable {
/**
*
*/
@Excel(name = "数量", width = 15)
@Schema(description = "数量")
private java.math.BigDecimal quantity;
/**
*
*/
@Excel(name = "分配数", width = 15)
@Schema(description = "分配数")
private java.math.BigDecimal queuedQty;
/**
*
*/
@Excel(name = "库存状态", width = 15,dicCode="inventory_status")
@Schema(description = "库存状态")
@Dict(dicCode = "inventory_status")
private java.lang.Integer status;
@ -115,7 +109,6 @@ public class Inventory implements Serializable {
/**
*
*/
@Excel(name="仓库代码",width = 15,dictTable ="base_item_key",dicText = "wh_code",dicCode = "id")
@Schema(description = "仓库代码")
@TableField(exist = false)
private java.lang.String whCode;
@ -123,21 +116,18 @@ public class Inventory implements Serializable {
/**
*
*/
@Excel(name = "项目号", width = 15)
@Schema(description = "项目号")
@TableField(exist = false)
private java.lang.String project;
/**
*
*/
@Excel(name = "任务号", width = 15)
@Schema(description = "任务号")
@TableField(exist = false)
private java.lang.String taskNo;
/**
*
*/
@Excel(name = "批次号", width = 15)
@Schema(description = "批次号")
@TableField(exist = false)
private java.lang.String propC1;
@ -145,7 +135,6 @@ public class Inventory implements Serializable {
/**
*
*/
@Excel(name = "赛意库存状态", width = 15)
@Schema(description = "赛意库存状态")
@TableField(exist = false)
private java.lang.String propC3;
@ -169,7 +158,6 @@ public class Inventory implements Serializable {
/**
*
*/
@Excel(name = "日期", width = 15,format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建日期")