导出功能(发料记录汇总、维修任务管理、维修审核管理)

This commit is contained in:
jjLv 2025-10-10 20:58:21 +08:00
parent 9efa25e31a
commit 1f8e477105
8 changed files with 214 additions and 150 deletions

View File

@ -364,7 +364,7 @@ public class MaterialLeaseInfoController extends BaseController {
bean.setIsExport(0);
List<LeaseTotalInfo> list = materialLeaseInfoService.getLeaseInfoDetails(bean);
ExcelUtil<LeaseTotalInfo> util = new ExcelUtil<>(LeaseTotalInfo.class);
util.exportExcel(response, list, "综合查询--工器具领料记录查询", "工器具领料记录查询");
util.exportExcel(response, list, "综合查询--项目部材料站出库一览表", "项目部材料站出库一览表 (导出时间:" + DateUtils.getTime() + "" );
}
/**

View File

@ -25,6 +25,18 @@ public class LeaseTotalInfo {
private Long parentId;
@ApiModelProperty(value = "序号")
@Excel(name = "序号", isSequence = true, sort = 0)
private String serialNumber;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "领料工程")
@Excel(name = "领料工程")
private String projectName;
@ApiModelProperty(value = "工器具名称")
@Excel(name = "工器具名称")
private String maTypeName;
@ -41,30 +53,25 @@ public class LeaseTotalInfo {
private BigDecimal preNum;
@ApiModelProperty(value = "出库数量")
@Excel(name = "出库数量")
@Excel(name = "出库数量", cellType = Excel.ColumnType.NUMERIC)
private BigDecimal outNum;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位")
private String subUnitName;
@ApiModelProperty(value = "待出库数量")
private BigDecimal pendingNum;
@ApiModelProperty(value = "领料日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "领料日期", dateFormat = "yyyy-MM-dd", width = 30)
// @Excel(name = "领料日期", dateFormat = "yyyy-MM-dd", width = 30)
private String leaseDate;
@ApiModelProperty(value = "出库日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库日期", dateFormat = "yyyy-MM-dd", width = 30)
private String outDate;
@ApiModelProperty(value = "领料班组")
@Excel(name = "领料班组")
private String teamName;
@ApiModelProperty(value = "领料工程")
@Excel(name = "领料工程")
private String projectName;
@ApiModelProperty(value = "领料人")
@Excel(name = "班组长")
private String leasePerson;
@ -76,7 +83,10 @@ public class LeaseTotalInfo {
@ApiModelProperty(value = "领料单号")
@Excel(name = "领料单号")
private String code;
@ApiModelProperty(value = "出库日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库日期", dateFormat = "yyyy-MM-dd", width = 30)
private String outDate;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ -103,22 +113,16 @@ public class LeaseTotalInfo {
*/
private List<String> projectIdList;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部")
// @Excel(name = "项目部")
private String departName;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
// @Excel(name = "工程名称")
private String proName;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位")
private String subUnitName;
@ApiModelProperty(value = "工程id")
private String proId;
}

View File

@ -9,6 +9,7 @@ import javax.validation.constraints.NotNull;
import cn.hutool.core.convert.Convert;
import com.bonus.common.biz.annotation.StoreLog;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.basic.domain.report.LeaseOutInfo;
@ -95,7 +96,7 @@ public class RepairAuditDetailsController extends BaseController {
repairAuditDetailsService.queryTimeCope(bean);
List<ScrapApplyDetailsVO> list = repairAuditDetailsService.selectRepairQuestList(bean);
ExcelUtil<ScrapApplyDetailsVO> util = new ExcelUtil<>(ScrapApplyDetailsVO.class);
util.exportExcel(response, list, "修试审核任务列表");
util.exportExcel(response, list, "修试审核任务列表", "修试审核数据一览表(导出时间:" + DateUtils.getTime() + "");
}
/**

View File

@ -3,6 +3,7 @@ package com.bonus.material.repair.controller;
import cn.hutool.core.convert.Convert;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
@ -255,7 +256,7 @@ public class RepairController extends BaseController {
list = new ArrayList<>();
}
ExcelUtil<RepairTask> util = new ExcelUtil<>(RepairTask.class);
util.exportExcel(response, list, "维修任务列表");
util.exportExcel(response, list, "维修任务列表", "维修任务一览表 (导出时间:" + DateUtils.getTime() + "");
}
@ApiOperation(value = "获取修试后入库列表")

View File

@ -40,53 +40,86 @@ public class RepairTask {
@ApiModelProperty(value = "维修拆分父级id")
private Long parentId;
/**
* 维修单号
*/
@ApiModelProperty(value = "维修单号")
@Excel(name = "维修单号",sort = 1)
private String repairCode;
@ApiModelProperty(value = "序号")
@Excel(name = "序号", isSequence = true, sort = 0)
private String serialNumber;
/**
* 退料单位名称
*/
@ApiModelProperty(value = "退料单位名称")
@Excel(name = "退料单位名称",sort = 2)
@Excel(name = "退料单位名称",sort = 1)
private String backUnit;
/**
* 退料工程名称
*/
@ApiModelProperty(value = "退料工程名称")
@Excel(name = "退料工程名称",sort = 3)
@Excel(name = "退料工程名称",sort = 2)
private String backPro;
/**
* 退料单号
*/
@ApiModelProperty(value = "退料单号")
@Excel(name = "退料单号",sort = 3)
private String backCode;
/**
* 维修单号
*/
@ApiModelProperty(value = "维修单号")
@Excel(name = "维修单号",sort = 4)
private String repairCode;
/**
* 维修机具类型
*/
@ApiModelProperty(value = "维修机具类型")
@Excel(name = "物资名称",sort = 5)
private String type;
/**
* 规格型号
*/
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号",sort = 6)
private String typeName;
@ApiModelProperty(value = "退料数量")
@Excel(name = "退料数量",sort = 7)
private BigDecimal returnNum;
/**
* 维修总量
*/
@ApiModelProperty(value = "维修总量")
@Excel(name = "维修数量",sort = 8)
private BigDecimal repairNum;
/**
* 维修报废数量
*/
@ApiModelProperty(value = "报废数量")
@Excel(name = "报废数量",sort = 9)
private BigDecimal scrapNum;
@ApiModelProperty(value = "待维修数量")
@Excel(name = "待维修数量",sort = 10)
private BigDecimal beRepairedNum;
/**
* 任务创建人
*/
@ApiModelProperty(value = "任务创建人")
@Excel(name = "任务创建人",sort = 11)
private String createName;
/**
* 任务创建时间
*/
@ApiModelProperty(value = "任务创建时间")
@Excel(name = "任务创建时间",sort = 12)
private String createTime;
/**
* 任务创建人
*/
@ApiModelProperty(value = "任务创建人")
private Long createBy;
/**
* 任务创建人
*/
@ApiModelProperty(value = "任务创建人")
@Excel(name = "任务创建人",sort = 4)
private String createName;
/**
* 任务创建时间
*/
@ApiModelProperty(value = "任务创建时间")
@Excel(name = "任务创建时间",sort = 5)
private String createTime;
/**
* 退料单号
*/
@ApiModelProperty(value = "退料单号")
@Excel(name = "退料单号",sort = 6)
private String backCode;
/**
* 维修状态
*/
@ApiModelProperty(value = "维修状态")
@Excel(name = "维修状态",sort = 7)
// @Excel(name = "维修状态",sort = 7)
private String repairStatus;
/**
* 关键字
@ -110,47 +143,26 @@ public class RepairTask {
@ApiModelProperty(value = "维修状态编码CODE")
private String repairStatusCode;
/**
* 维修机具类型
*/
@ApiModelProperty(value = "维修机具类型")
@Excel(name = "维修机具类型",sort = 8)
private String type;
/**
* 规格型号
*/
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号",sort = 9)
private String typeName;
/**
* 编码
*/
@ApiModelProperty(value = "编码")
@Excel(name = "编码",sort = 10)
// @Excel(name = "编码",sort = 10)
private String code;
/**
* 维修总量
*/
@ApiModelProperty(value = "维修总量")
@Excel(name = "维修总量",sort = 11)
private BigDecimal repairNum;
/**
* 维修合格数量
*/
@ApiModelProperty(value = "维修合格数量")
@Excel(name = "维修合格数量",sort = 12)
// @Excel(name = "维修合格数量",sort = 12)
private BigDecimal repairedNum;
/**
* 维修报废数量
*/
@ApiModelProperty(value = "报废数量")
@Excel(name = "维修报废数量",sort = 13)
private BigDecimal scrapNum;
/**
* 待修状态
*/
@ApiModelProperty(value = "待修状态")
@Excel(name = "待修状态",sort = 14)
// @Excel(name = "待修状态",sort = 14)
private String status;
/**
* 维修人员
@ -162,7 +174,7 @@ public class RepairTask {
* 维修时间
*/
@ApiModelProperty(value = "维修时间")
@Excel(name = "维修时间",sort = 16)
// @Excel(name = "维修时间",sort = 16)
private String updateTime;
/** 导出选中列表 */

View File

@ -5,6 +5,7 @@ import com.bonus.material.scrap.domain.ScrapAuditorSet;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
@ -21,11 +22,16 @@ public class ScrapApplyDetailsVO {
/**
* 报废审核单号
*/
@Excel(name = "任务单号",sort = 4)
// @Excel(name = "任务单号",sort = 4)
private String scrapNum;
@ApiModelProperty(value = "维修任务单号")
private String repairTaskCode;
@ApiModelProperty(value = "序号")
@Excel(name = "序号", isSequence = true, sort = 0)
private String serialNumber;
/**
* 单位名称
*/
@ -35,44 +41,64 @@ public class ScrapApplyDetailsVO {
/**
* 工程名称
*/
@Excel(name = "工程名称",sort = 2)
@Excel(name = "退料工程",sort = 2)
private String projectName;
@Excel(name = "退料单号",sort = 3)
private String backCode;
@Excel(name = "维修审核单号",sort = 4)
private String auditCode;
@Excel(name = "物资类型",sort = 5)
private String typeName2;
@Excel(name = "退料数量",sort = 6, cellType = Excel.ColumnType.NUMERIC)
private BigDecimal repairNum2;
@Excel(name = "合格数量",sort = 7, cellType = Excel.ColumnType.NUMERIC)
private BigDecimal repairedNum;
@Excel(name = "报废数量",sort = 8, cellType = Excel.ColumnType.NUMERIC)
private BigDecimal scrapNum3;
@Excel(name = "维修人",sort = 9)
private String createBy2;
@Excel(name = "审核时间", dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 10)
private String auditTime;
/**
* 维修班组名称
*/
@Excel(name = "维修班组",sort = 6)
// @Excel(name = "维修班组",sort = 6)
//@ApiModelProperty(value = "维修班组")
private String teamName;
/**
* 任务创建人
*/
@Excel(name = "提交人",sort = 7)
// @Excel(name = "提交人",sort = 7)
private String createBy;
/**
* 机具类型
*/
@Excel(name = "物资类型",sort = 5)
// @Excel(name = "物资类型",sort = 5)
private String itemType;
/**
* 创建时间
*/
@Excel(name = "提交时间",sort = 8)
// @Excel(name = "提交时间",sort = 8)
private String createTime;
/**
* 维修单号
*/
@Excel(name = "维修审核单号",sort = 3)
// @Excel(name = "维修审核单号",sort = 3)
private String repairNum;
/**
* 审核状态
*/
@Excel(name = "状态",sort = 9,readConverterExp = "10=维修审核进行中,11=维修审核完成,12=维修审核被驳回")
// @Excel(name = "状态",sort = 9,readConverterExp = "10=维修审核进行中,11=维修审核完成,12=维修审核被驳回")
private Integer taskStatus;
/**

View File

@ -331,21 +331,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-- 第一个查询(时间条件:小于 2025-08-20
SELECT DISTINCT
tk.task_id AS taskId,
tk.CODE AS scrapNum,
tt2.CODE AS repairTaskCode,
tk.task_status AS taskStatus,
bui.unit_name AS unitName,
bpl.pro_name AS projectName,
su.nick_name AS createBy,
tk.create_time AS createTime,
tk.remark,
tk.CODE AS repairNum,
rad.audit_time as auditTime,
GROUP_CONCAT(DISTINCT mt4.type_id) AS firstId
tk.CODE as auditCode,
tt3.`code` as backCode,
GROUP_CONCAT(DISTINCT mt1.type_name) AS typeName2,
rn.scrapNum AS scrapNum3,
rn.repairNum as repairNum2,
rn.repairedNum as repairedNum,
tk.task_status AS taskStatus,
rad.create_by AS createBy2,
rad.create_time AS auditTime
FROM
tm_task tk
LEFT JOIN tm_task tt ON tk.pre_task_id = tt.task_id
LEFT JOIN repair_audit_details rad ON tk.task_id = rad.task_id
LEFT JOIN (
SELECT
rad.task_id,
SUM(rad.scrap_num) AS scrapNum,
SUM(rad.repair_num) as repairNum,
SUM(rad.repaired_num) as repairedNum
from repair_audit_details rad
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
</if>
GROUP BY rad.task_id
) rn on rn.task_id = tk.task_id
LEFT JOIN repair_apply_details raad on raad.task_id = rad.repair_id
LEFT JOIN tm_task tt3 on tt3.task_id = raad.back_id
LEFT JOIN tm_task tt2 ON tt2.task_id = rad.repair_id
LEFT JOIN tm_task_agreement tta ON rad.repair_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
@ -354,10 +367,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt ON rad.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN sys_user su ON su.user_id = tk.create_by
LEFT JOIN ma_type mt3 ON mt1.parent_id = mt3.type_id AND mt3.del_flag = '0'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.del_flag = '0'
LEFT JOIN ma_type mt3 ON mt1.parent_id = mt3.type_id
AND mt3.del_flag = '0'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
AND mt4.del_flag = '0'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
</if>
WHERE
tk.task_type = #{taskType} and tt2.CODE is not null
@ -388,41 +403,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
GROUP BY
tk.CODE
UNION
-- 第二个查询(时间条件:>= 2025-08-20
SELECT DISTINCT
tk.task_id AS taskId,
tk.CODE AS scrapNum,
tt.CODE AS repairTaskCode,
tk.task_status AS taskStatus,
bui.unit_name AS unitName,
bpl.pro_name AS projectName,
su.nick_name AS createBy,
tk.create_time AS createTime,
tk.remark,
tk.CODE AS repairNum,
rad.audit_time as auditTime,
GROUP_CONCAT(DISTINCT mt4.type_id) AS firstId
tk.CODE as auditCode,
baii.`code` as backCode,
GROUP_CONCAT(DISTINCT mt1.type_name) AS typeName2,
rn.scrapNum AS scrapNum3,
rn.repairNum as repairNum2,
rn.repairedNum as repairedNum,
tk.task_status AS taskStatus,
su.nick_name AS createBy2,
rad.audit_time AS auditTime
FROM
tm_task tk
LEFT JOIN tm_task tt ON tk.pre_task_id = tt.task_id
LEFT JOIN (
SELECT
rad.task_id,
SUM(rad.scrap_num) AS scrapNum,
SUM(rad.repair_num) as repairNum,
SUM(rad.repaired_num) as repairedNum,
rad.audit_time
from repair_audit_details rad
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
</if>
GROUP BY rad.task_id
) rn on rn.task_id = tk.task_id
LEFT JOIN repair_audit_details rad ON tk.task_id = rad.task_id
LEFT JOIN back_apply_info baii on baii.id = rad.back_id
LEFT JOIN tm_task_agreement tta ON tk.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project bpl ON bai.project_id = bpl.pro_id
LEFT JOIN bm_unit bui ON bai.unit_id = bui.unit_id
LEFT JOIN repair_audit_details rad ON tk.task_id = rad.task_id
LEFT JOIN ma_type mt ON rad.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN sys_user su ON su.user_id = tk.create_by
LEFT JOIN ma_type mt3 ON mt1.parent_id = mt3.type_id AND mt3.del_flag = '0'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id AND mt4.del_flag = '0'
LEFT JOIN ma_type mt3 ON mt1.parent_id = mt3.type_id
AND mt3.del_flag = '0'
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
AND mt4.del_flag = '0'
<if test="userId != null">
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
JOIN ma_type_repair mtr ON mtr.type_id = rad.type_id AND mtr.user_id = #{userId}
</if>
WHERE
tk.task_type = #{taskType} and tt.CODE is not null
tk.task_type = #{taskType}
AND tk.create_time &gt;= '2025-08-20 00:00:00'
<if test="backUnit != null and backUnit != ''">
AND bui.unit_id = #{backUnit}
@ -458,7 +486,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<otherwise>
ORDER BY
taskStatus,
createTime DESC
auditTime DESC
</otherwise>
</choose>
</select>

View File

@ -336,40 +336,32 @@
<select id="exportRepairTaskList" resultType="com.bonus.material.repair.domain.RepairTask">
SELECT
rd.task_id,
tt.CODE AS repairCode,
bui.unit_name AS backUnit,
bpi.pro_name AS backPro,
su.nick_name AS createName,
tt.create_time AS createTime,
bai.CODE AS backCode,
tt.task_status AS repairStatusCode,
tt.company_id AS companyId,
mt2.type_name AS type,
mt.type_name AS typeName,
mm.ma_code AS CODE,
rd.repair_num AS repairNum,
rd.repaired_num AS repairedNum,
rd.scrap_num AS scrapNum,
case rd.status when '0' then '未完成' when '1' then '已完成' else '' end as status,
su2.nick_name as repairer,
rd.update_time as updateTime
bui.unit_name AS backUnit,
bpi.pro_name AS backPro,
tt.CODE AS repairCode,
bai.CODE AS backCode,
mt2.type_name AS type,
mt.type_name AS typeName,
rd.repair_num AS returnNum,
rd.repaired_num AS repairNum,
rd.repair_num - rd.repaired_num as beRepairedNum,
rd.scrap_num AS scrapNum,
rd.create_by AS createName,
tt.create_time AS createTime
FROM
repair_apply_details rd
LEFT JOIN ma_type mt ON rd.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN tm_task tt ON rd.task_id = tt.task_id
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
LEFT JOIN tm_task_agreement tta ON rd.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
LEFT JOIN bm_unit bui ON bai2.unit_id = bui.unit_id
LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id and bpi.del_flag = '0'
LEFT JOIN sys_user su ON rd.create_by = su.user_id
left join sys_user su2 on rd.repairer = su2.user_id
LEFT JOIN ma_machine mm ON mm.ma_id = rd.ma_id
repair_apply_details rd
LEFT JOIN ma_type mt ON rd.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN tm_task tt ON rd.task_id = tt.task_id
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
LEFT JOIN tm_task_agreement tta ON rd.task_id = tta.task_id
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
LEFT JOIN bm_unit bui ON bai2.unit_id = bui.unit_id
LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id
AND bpi.del_flag = '0'
where 1=1
<if test="keyWord != null and keyWord != ''">
AND (locate(#{keyWord}, su.nick_name) > 0
AND (locate(#{keyWord}, rd.create_by) > 0
or locate(#{keyWord}, tt.CODE) > 0)
</if>
<if test="backUnit != null and backUnit != ''">