报废报表
This commit is contained in:
parent
7ad75d209d
commit
d144384267
|
|
@ -7,6 +7,7 @@ import com.bonus.common.core.utils.ServletUtils;
|
|||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.back.domain.BackApplyInfo;
|
||||
import com.bonus.material.basic.domain.report.*;
|
||||
import com.bonus.material.basic.service.BmReportService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -410,4 +411,78 @@ public class BmReportController extends BaseController {
|
|||
util.exportExcel(response, list, "设备追溯查询-修饰入库报表详情查询");
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废报表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "设备追溯查询--报废报表")
|
||||
@GetMapping("/getScrapList")
|
||||
public AjaxResult getScrapList(ScrapInfo bean) {
|
||||
bean.setIsExport(1);
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<ScrapInfo> list = bmReportService.getScrapList(bean);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废报表查询不分页
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "设备追溯查询--报废报表查询不分页")
|
||||
@GetMapping("/getScrapListNoPage")
|
||||
public AjaxResult getScrapListNoPage(ScrapInfo bean) {
|
||||
bean.setIsExport(0);
|
||||
List<ScrapInfo> pageList = bmReportService.getScrapList(bean);
|
||||
ScrapInfo info = new ScrapInfo();
|
||||
if (CollectionUtils.isNotEmpty(pageList)) {
|
||||
ScrapInfo scrapInfo = pageList.get(0);
|
||||
info.setScrapNum(scrapInfo.getScrapNum());
|
||||
}
|
||||
return AjaxResult.success(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备追溯查询-报废报表查询
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation("导出设备追溯查询-报废报表查询")
|
||||
@PostMapping("/exportScrapList")
|
||||
public void exportScrapList(HttpServletResponse response, ScrapInfo bean)
|
||||
{
|
||||
bean.setIsExport(0);
|
||||
List<ScrapInfo> list = bmReportService.getScrapList(bean);
|
||||
ExcelUtil<ScrapInfo> util = new ExcelUtil<>(ScrapInfo.class);
|
||||
util.exportExcel(response, list, "设备追溯查询-报废报表报表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废报表查询详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "设备追溯查询--报废报表查询详情")
|
||||
@GetMapping("/getScrapDetailsList")
|
||||
public AjaxResult getScrapDetailsList(ScrapInfo bean) {
|
||||
startPage();
|
||||
List<ScrapDetailsInfo> list = bmReportService.getScrapDetailsList(bean);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备追溯查询-报废报表详情查询
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation("导出设备追溯查询-报废报表详情查询")
|
||||
@PostMapping("/exportScrapDetailsList")
|
||||
public void exportScrapDetailsList(HttpServletResponse response, ScrapInfo bean)
|
||||
{
|
||||
List<ScrapDetailsInfo> list = bmReportService.getScrapDetailsList(bean);
|
||||
ExcelUtil<ScrapDetailsInfo> util = new ExcelUtil<>(ScrapDetailsInfo.class);
|
||||
util.exportExcel(response, list, "设备追溯查询-报废报表详情查询");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.bonus.material.basic.domain.report;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 报废详情列表
|
||||
* @Author ma_sh
|
||||
* @create 2025/3/20 16:47
|
||||
*/
|
||||
@Data
|
||||
public class ScrapDetailsInfo {
|
||||
|
||||
@ApiModelProperty(value = "机具名称")
|
||||
@Excel(name = "机具名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "购置价")
|
||||
@Excel(name = "购置价")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.bonus.material.basic.domain.report;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 报废列表一级页面
|
||||
* @Author ma_sh
|
||||
* @create 2025/3/20 16:10
|
||||
*/
|
||||
@Data
|
||||
public class ScrapInfo {
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "是否导出 0 是,1 否")
|
||||
private Integer isExport;
|
||||
|
||||
private Long taskId;
|
||||
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value = "物资名称")
|
||||
@Excel(name = "物资名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
@Excel(name = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "报废数量")
|
||||
@Excel(name = "报废数量")
|
||||
private BigDecimal scrapNum;
|
||||
|
||||
@ApiModelProperty(value = "报废时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@Excel(name = "报废时间", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
private Date scrapTime;
|
||||
|
||||
@ApiModelProperty(value = "报废人员")
|
||||
@Excel(name = "报废人员")
|
||||
private String scrapPersonName;
|
||||
|
||||
@ApiModelProperty(value = "报废类型")
|
||||
@Excel(name = "报废类型")
|
||||
private String scrapType;
|
||||
|
||||
@ApiModelProperty(value = "报废单号")
|
||||
@Excel(name = "报废单号")
|
||||
private String scrapCode;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value = "管理方式")
|
||||
private String manageType;
|
||||
}
|
||||
|
|
@ -82,4 +82,18 @@ public interface BmReportMapper {
|
|||
List<RepairInputDetails> getRepairInputDetailsList(RepairInputDto bean);
|
||||
|
||||
LeaseOutInfo getLeaseInfoById(Long parentId);
|
||||
|
||||
/**
|
||||
* 报废报表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<ScrapInfo> getScrapList(ScrapInfo bean);
|
||||
|
||||
/**
|
||||
* 报废报表查询详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<ScrapDetailsInfo> getScrapDetailsList(ScrapInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,18 @@ public interface BmReportService {
|
|||
* @return
|
||||
*/
|
||||
List<RepairInputDetails> getRepairInputDetailsList(RepairInputDto bean);
|
||||
|
||||
/**
|
||||
* 报废报表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<ScrapInfo> getScrapList(ScrapInfo bean);
|
||||
|
||||
/**
|
||||
* 报废报表查询详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<ScrapDetailsInfo> getScrapDetailsList(ScrapInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,4 +249,57 @@ public class BmReportServiceImpl implements BmReportService {
|
|||
public List<RepairInputDetails> getRepairInputDetailsList(RepairInputDto bean) {
|
||||
return bmReportMapper.getRepairInputDetailsList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废报表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ScrapInfo> getScrapList(ScrapInfo bean) {
|
||||
BigDecimal totalScrapNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
List<ScrapInfo> list = bmReportMapper.getScrapList(bean);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
String keyWord = bean.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsScrapKeyword(item, keyWord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
for (ScrapInfo scrapInfo : list) {
|
||||
totalScrapNum = totalScrapNum.add(scrapInfo.getScrapNum());
|
||||
}
|
||||
}
|
||||
if (bean.getIsExport() == 0) {
|
||||
ScrapInfo info = new ScrapInfo();
|
||||
info.setScrapNum(totalScrapNum);
|
||||
info.setUnitName("合计");
|
||||
list.add(0, info);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废报表关键字过滤
|
||||
* @param item
|
||||
* @param keyWord
|
||||
* @return
|
||||
*/
|
||||
private boolean containsScrapKeyword(ScrapInfo item, String keyWord) {
|
||||
return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) ||
|
||||
(item.getTypeModelName() != null && item.getTypeModelName().contains(keyWord)) ||
|
||||
(item.getScrapCode() != null && item.getScrapCode().contains(keyWord)) ||
|
||||
(item.getScrapPersonName() != null && item.getScrapPersonName().contains(keyWord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废报表查询详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ScrapDetailsInfo> getScrapDetailsList(ScrapInfo bean) {
|
||||
return bmReportMapper.getScrapDetailsList(bean);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -766,11 +766,11 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
|||
scrapApplyDetails.setScrapSource("2");
|
||||
scrapApplyDetails.setStatus("0");
|
||||
scrapApplyDetails.setParentId(details.getId());
|
||||
scrapApplyDetails.setCreateBy(SecurityUtils.getUsername());
|
||||
scrapApplyDetails.setCreateTime(new Date());
|
||||
if (bean != null) {
|
||||
scrapApplyDetails.setScrapReason(bean.getScrapReason() == null ? "" : bean.getScrapReason());
|
||||
scrapApplyDetails.setScrapType(bean.getScrapType() == null ? null : bean.getScrapType());
|
||||
scrapApplyDetails.setCreateBy(bean.getCreateBy() == null ? SecurityUtils.getUsername() : bean.getCreateBy());
|
||||
}
|
||||
scrapApplyDetailsMapper.insertScrapApplyDetails(scrapApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -375,4 +375,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where lai.id=#{parentId}
|
||||
</select>
|
||||
|
||||
<select id="getScrapList" resultType="com.bonus.material.basic.domain.report.ScrapInfo">
|
||||
SELECT
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.unit_name AS unitName,
|
||||
SUM(IFNULL( sad.scrap_num, 0 )) AS scrapNum,
|
||||
MAX( sad.create_time ) AS scrapTime,
|
||||
GROUP_CONCAT( DISTINCT sad.create_by ) AS scrapPersonName,
|
||||
CASE sad.scrap_source
|
||||
WHEN 2 THEN '维修报废'
|
||||
WHEN 3 THEN '盘点报废'
|
||||
ELSE NULL
|
||||
END AS scrapType,
|
||||
tt.`code` AS scrapCode,
|
||||
sad.task_id AS taskId,
|
||||
sad.type_id AS typeId,
|
||||
mt.manage_type AS manageType
|
||||
FROM
|
||||
scrap_apply_details sad
|
||||
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN tm_task tt ON sad.task_id = tt.task_id
|
||||
WHERE
|
||||
sad.ledger_status = '1'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt1.type_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR mt.type_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR tt.`code` LIKE CONCAT('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY
|
||||
sad.task_id,
|
||||
sad.type_id
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
HAVING
|
||||
<![CDATA[DATE_FORMAT(MAX(sad.create_time), '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}]]>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getScrapDetailsList" resultType="com.bonus.material.basic.domain.report.ScrapDetailsInfo">
|
||||
SELECT
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.buy_price AS buyPrice,
|
||||
mm.ma_code AS maCode
|
||||
FROM
|
||||
scrap_apply_details sad
|
||||
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON sad.ma_id = mm.ma_id
|
||||
WHERE
|
||||
sad.task_id = #{taskId} AND sad.type_id = #{typeId}
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt1.type_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR mt.type_name LIKE CONCAT('%', #{keyWord}, '%')
|
||||
OR mm.ma_code LIKE CONCAT('%', #{keyWord}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -372,7 +372,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ma_id as maId,
|
||||
type_id as typeId,
|
||||
GROUP_CONCAT(DISTINCT scrap_reason) AS scrapReason,
|
||||
GROUP_CONCAT(DISTINCT scrap_type) AS scrapType
|
||||
GROUP_CONCAT(DISTINCT scrap_type) AS scrapType,
|
||||
GROUP_CONCAT(DISTINCT create_by) AS createBy
|
||||
FROM
|
||||
repair_apply_record
|
||||
WHERE repair_type = '3' and task_id = #{taskId} and type_id = #{typeId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue