add:增加看板及报表
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.biBoard;
|
||||
|
||||
import org.nl.wms.biBoard.screen.service.dto.AgvStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class StaticData {
|
||||
public static Map<String,AgvStatus> agv_status= new HashMap<>();
|
||||
|
||||
public void sync(String carId,AgvStatus agvStatus){
|
||||
agv_status.put(carId,agvStatus);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.wms.biBoard.consumptionReport;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.biBoard.consumptionReport.service.IConsumeReportService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/report")
|
||||
@Slf4j
|
||||
public class ReportController {
|
||||
|
||||
@Autowired
|
||||
private IConsumeReportService iConsumeReportService;
|
||||
|
||||
@GetMapping("/consumeReport")
|
||||
@Log("班组焊材消耗报表查询")
|
||||
public ResponseEntity<Object> queryConsumeReport(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iConsumeReportService.queryConsumeReport(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/consumeReport/download")
|
||||
@Log("导出班组焊材消耗报表")
|
||||
public void downloadConsumeReport(@RequestParam Map whereJson, HttpServletResponse response) {
|
||||
iConsumeReportService.downloadConsumeReport(whereJson, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.nl.wms.biBoard.consumptionReport.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 班组焊材消耗报表 DTO
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Data
|
||||
public class ConsumeReportDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Integer rowNum;
|
||||
|
||||
/**
|
||||
* 班组编码
|
||||
*/
|
||||
private String groupCode;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String materialSpec;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 领料重量
|
||||
*/
|
||||
private BigDecimal receiveQty;
|
||||
|
||||
/**
|
||||
* 退料重量
|
||||
*/
|
||||
private BigDecimal returnQty;
|
||||
|
||||
/**
|
||||
* 消耗重量
|
||||
*/
|
||||
private BigDecimal consumeQty;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String qtyUnitName;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.wms.biBoard.consumptionReport.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.biBoard.consumptionReport.dto.ConsumeReportDto;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 班组焊材消耗报表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
public interface IConsumeReportService {
|
||||
|
||||
/**
|
||||
* 分页查询班组焊材消耗报表
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<ConsumeReportDto> queryConsumeReport(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 导出班组焊材消耗报表
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param response : 响应对象
|
||||
*/
|
||||
void downloadConsumeReport(Map whereJson, HttpServletResponse response);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.nl.wms.biBoard.consumptionReport.service;
|
||||
|
||||
public class ReportService {
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.wms.biBoard.consumptionReport.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.biBoard.consumptionReport.dto.ConsumeReportDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 班组焊材消耗报表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConsumeReportMapper {
|
||||
|
||||
/**
|
||||
* 班组焊材消耗报表分页查询
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<ConsumeReportDto>
|
||||
*/
|
||||
IPage<ConsumeReportDto> queryConsumeReport(Page<ConsumeReportDto> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 班组焊材消耗报表合计
|
||||
* @param whereJson 查询条件
|
||||
* @return ConsumeReportDto
|
||||
*/
|
||||
ConsumeReportDto queryConsumeReportSum(@Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 班组焊材消耗报表全部数据(用于导出)
|
||||
* @param whereJson 查询条件
|
||||
* @return List<ConsumeReportDto>
|
||||
*/
|
||||
List<ConsumeReportDto> queryConsumeReportAll(@Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?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.nl.wms.biBoard.report.service.dao.mapper.ConsumeReportMapper">
|
||||
|
||||
<!-- 班组焊材消耗报表分页查询 -->
|
||||
<select id="queryConsumeReport" resultType="org.nl.wms.biBoard.consumptionReport.dto.ConsumeReportDto">
|
||||
SELECT
|
||||
@rownum := @rownum + 1 AS rowNum,
|
||||
bom.create_id AS groupCode,
|
||||
bom.create_name AS groupName,
|
||||
mater.material_code AS materialCode,
|
||||
mater.material_name AS materialName,
|
||||
mater.material_spec AS materialSpec,
|
||||
bom.bom_code AS batchNo,
|
||||
bom.real_qty AS receiveQty,
|
||||
(IFNULL(bom.return_one_qty, 0) + IFNULL(bom.return_two_qty, 0)) AS returnQty,
|
||||
(bom.real_qty - IFNULL(bom.return_one_qty, 0) - IFNULL(bom.return_two_qty, 0)) AS consumeQty,
|
||||
bom.qty_unit_name AS qtyUnitName
|
||||
FROM
|
||||
pdm_bom_callmaterial bom
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = bom.material_id,
|
||||
(SELECT @rownum := 0) r
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.groupCode != null and param.groupCode != ''">
|
||||
AND bom.create_id = #{param.groupCode}
|
||||
</if>
|
||||
<if test="param.materialCode != null and param.materialCode != ''">
|
||||
AND (mater.material_code LIKE CONCAT('%', #{param.materialCode}, '%')
|
||||
OR mater.material_name LIKE CONCAT('%', #{param.materialCode}, '%'))
|
||||
</if>
|
||||
<if test="param.batchNo != null and param.batchNo != ''">
|
||||
AND bom.bom_code LIKE CONCAT('%', #{param.batchNo}, '%')
|
||||
</if>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(bom.create_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(bom.create_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY bom.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 班组焊材消耗报表合计 -->
|
||||
<select id="queryConsumeReportSum" resultType="org.nl.wms.biBoard.consumptionReport.dto.ConsumeReportDto">
|
||||
SELECT
|
||||
SUM(bom.real_qty) AS receiveQty,
|
||||
SUM(IFNULL(bom.return_one_qty, 0) + IFNULL(bom.return_two_qty, 0)) AS returnQty,
|
||||
SUM(bom.real_qty - IFNULL(bom.return_one_qty, 0) - IFNULL(bom.return_two_qty, 0)) AS consumeQty,
|
||||
'KG' AS qtyUnitName
|
||||
FROM
|
||||
pdm_bom_callmaterial bom
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = bom.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.groupCode != null and param.groupCode != ''">
|
||||
AND bom.create_id = #{param.groupCode}
|
||||
</if>
|
||||
<if test="param.materialCode != null and param.materialCode != ''">
|
||||
AND (mater.material_code LIKE CONCAT('%', #{param.materialCode}, '%')
|
||||
OR mater.material_name LIKE CONCAT('%', #{param.materialCode}, '%'))
|
||||
</if>
|
||||
<if test="param.batchNo != null and param.batchNo != ''">
|
||||
AND bom.bom_code LIKE CONCAT('%', #{param.batchNo}, '%')
|
||||
</if>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(bom.create_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(bom.create_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 班组焊材消耗报表全部数据(用于导出) -->
|
||||
<select id="queryConsumeReportAll" resultType="org.nl.wms.biBoard.consumptionReport.dto.ConsumeReportDto">
|
||||
SELECT
|
||||
bom.create_id AS groupCode,
|
||||
bom.create_name AS groupName,
|
||||
mater.material_code AS materialCode,
|
||||
mater.material_name AS materialName,
|
||||
mater.material_spec AS materialSpec,
|
||||
bom.bom_code AS batchNo,
|
||||
bom.real_qty AS receiveQty,
|
||||
(IFNULL(bom.return_one_qty, 0) + IFNULL(bom.return_two_qty, 0)) AS returnQty,
|
||||
(bom.real_qty - IFNULL(bom.return_one_qty, 0) - IFNULL(bom.return_two_qty, 0)) AS consumeQty,
|
||||
bom.qty_unit_name AS qtyUnitName
|
||||
FROM
|
||||
pdm_bom_callmaterial bom
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = bom.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.groupCode != null and param.groupCode != ''">
|
||||
AND bom.create_id = #{param.groupCode}
|
||||
</if>
|
||||
<if test="param.materialCode != null and param.materialCode != ''">
|
||||
AND (mater.material_code LIKE CONCAT('%', #{param.materialCode}, '%')
|
||||
OR mater.material_name LIKE CONCAT('%', #{param.materialCode}, '%'))
|
||||
</if>
|
||||
<if test="param.batchNo != null and param.batchNo != ''">
|
||||
AND bom.bom_code LIKE CONCAT('%', #{param.batchNo}, '%')
|
||||
</if>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(bom.create_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(bom.create_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY bom.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,172 @@
|
||||
package org.nl.wms.biBoard.consumptionReport.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.biBoard.consumptionReport.dto.ConsumeReportDto;
|
||||
import org.nl.wms.biBoard.consumptionReport.service.IConsumeReportService;
|
||||
import org.nl.wms.biBoard.consumptionReport.service.dao.mapper.ConsumeReportMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 班组焊材消耗报表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Service
|
||||
public class ConsumeReportServiceImpl implements IConsumeReportService {
|
||||
|
||||
@Autowired
|
||||
private ConsumeReportMapper consumeReportMapper;
|
||||
|
||||
@Override
|
||||
public IPage<ConsumeReportDto> queryConsumeReport(Map whereJson, PageQuery page) {
|
||||
IPage<ConsumeReportDto> resultPage = consumeReportMapper.queryConsumeReport(
|
||||
new Page<>(page.getPage() + 1, page.getSize()), whereJson);
|
||||
|
||||
// 添加合计行
|
||||
List<ConsumeReportDto> records = resultPage.getRecords();
|
||||
ConsumeReportDto sumDto = consumeReportMapper.queryConsumeReportSum(whereJson);
|
||||
|
||||
if (!CollectionUtils.isEmpty(records) && sumDto != null) {
|
||||
sumDto.setGroupCode("合计");
|
||||
records.add(sumDto);
|
||||
}
|
||||
|
||||
resultPage.setRecords(records);
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadConsumeReport(Map whereJson, HttpServletResponse response) {
|
||||
// 查询所有数据
|
||||
List<ConsumeReportDto> dataList = consumeReportMapper.queryConsumeReportAll(whereJson);
|
||||
if (CollectionUtils.isEmpty(dataList)){
|
||||
throw new RuntimeException("数据为空");
|
||||
}
|
||||
try {
|
||||
// 创建工作簿
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
Sheet sheet = workbook.createSheet("班组焊材消耗报表");
|
||||
|
||||
// 创建标题样式
|
||||
CellStyle titleStyle = workbook.createCellStyle();
|
||||
Font titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontHeightInPoints((short) 12);
|
||||
titleStyle.setFont(titleFont);
|
||||
titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
titleStyle.setBorderBottom(BorderStyle.THIN);
|
||||
titleStyle.setBorderTop(BorderStyle.THIN);
|
||||
titleStyle.setBorderLeft(BorderStyle.THIN);
|
||||
titleStyle.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 创建数据样式
|
||||
CellStyle dataStyle = workbook.createCellStyle();
|
||||
dataStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
dataStyle.setBorderBottom(BorderStyle.THIN);
|
||||
dataStyle.setBorderTop(BorderStyle.THIN);
|
||||
dataStyle.setBorderLeft(BorderStyle.THIN);
|
||||
dataStyle.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 创建标题行
|
||||
Row headerRow = sheet.createRow(0);
|
||||
String[] headers = {"序号", "班组编码", "班组名称", "物料编码", "物料名称", "规格型号", "批次", "领料重量", "退料重量", "消耗重量", "单位"};
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell cell = headerRow.createCell(i);
|
||||
cell.setCellValue(headers[i]);
|
||||
cell.setCellStyle(titleStyle);
|
||||
sheet.setColumnWidth(i, 4000);
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
int rowNum = 1;
|
||||
BigDecimal totalReceive = BigDecimal.ZERO;
|
||||
BigDecimal totalReturn = BigDecimal.ZERO;
|
||||
BigDecimal totalConsume = BigDecimal.ZERO;
|
||||
|
||||
for (ConsumeReportDto dto : dataList) {
|
||||
Row row = sheet.createRow(rowNum);
|
||||
|
||||
createCell(row, 0, rowNum, dataStyle);
|
||||
createCell(row, 1, dto.getGroupCode(), dataStyle);
|
||||
createCell(row, 2, dto.getGroupName(), dataStyle);
|
||||
createCell(row, 3, dto.getMaterialCode(), dataStyle);
|
||||
createCell(row, 4, dto.getMaterialName(), dataStyle);
|
||||
createCell(row, 5, dto.getMaterialSpec(), dataStyle);
|
||||
createCell(row, 6, dto.getBatchNo(), dataStyle);
|
||||
createCell(row, 7, dto.getReceiveQty(), dataStyle);
|
||||
createCell(row, 8, dto.getReturnQty(), dataStyle);
|
||||
createCell(row, 9, dto.getConsumeQty(), dataStyle);
|
||||
createCell(row, 10, dto.getQtyUnitName(), dataStyle);
|
||||
|
||||
if (dto.getReceiveQty() != null) totalReceive = totalReceive.add(dto.getReceiveQty());
|
||||
if (dto.getReturnQty() != null) totalReturn = totalReturn.add(dto.getReturnQty());
|
||||
if (dto.getConsumeQty() != null) totalConsume = totalConsume.add(dto.getConsumeQty());
|
||||
|
||||
rowNum++;
|
||||
}
|
||||
|
||||
// 添加合计行
|
||||
Row sumRow = sheet.createRow(rowNum);
|
||||
createCell(sumRow, 0, "", dataStyle);
|
||||
createCell(sumRow, 1, "合计", dataStyle);
|
||||
createCell(sumRow, 2, "", dataStyle);
|
||||
createCell(sumRow, 3, "", dataStyle);
|
||||
createCell(sumRow, 4, "", dataStyle);
|
||||
createCell(sumRow, 5, "", dataStyle);
|
||||
createCell(sumRow, 6, "", dataStyle);
|
||||
createCell(sumRow, 7, totalReceive, dataStyle);
|
||||
createCell(sumRow, 8, totalReturn, dataStyle);
|
||||
createCell(sumRow, 9, totalConsume, dataStyle);
|
||||
createCell(sumRow, 10, "KG", dataStyle);
|
||||
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode("班组焊材消耗报表_" + DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss"), "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
// 输出
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
workbook.close();
|
||||
outputStream.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("导出Excel失败"+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void createCell(Row row, int column, Object value, CellStyle style) {
|
||||
Cell cell = row.createCell(column);
|
||||
if (value == null) {
|
||||
cell.setCellValue("");
|
||||
} else if (value instanceof BigDecimal) {
|
||||
cell.setCellValue(((BigDecimal) value).doubleValue());
|
||||
} else if (value instanceof Integer) {
|
||||
cell.setCellValue((Integer) value);
|
||||
} else {
|
||||
cell.setCellValue(value.toString());
|
||||
}
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.nl.wms.biBoard.materialRequisition;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.biBoard.materialRequisition.service.IIosReportService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 领料出库及退料入库数据报表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/iosReport")
|
||||
@Slf4j
|
||||
public class IosReportController {
|
||||
|
||||
@Autowired
|
||||
private IIosReportService iIosReportService;
|
||||
|
||||
@GetMapping
|
||||
@Log("领料出库及退料入库数据报表查询")
|
||||
public ResponseEntity<Object> queryIosReport(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iIosReportService.queryIosReport(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/download")
|
||||
@Log("导出领料出库及退料入库数据报表")
|
||||
public void downloadIosReport(@RequestParam Map whereJson, HttpServletResponse response) {
|
||||
iIosReportService.downloadIosReport(whereJson, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.nl.wms.biBoard.materialRequisition.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 领料出库及退料入库数据报表 DTO
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Data
|
||||
public class IosReportDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Integer rowNum;
|
||||
|
||||
/**
|
||||
* 领退时间
|
||||
*/
|
||||
private String confirmTime;
|
||||
|
||||
/**
|
||||
* 班组编码
|
||||
*/
|
||||
private String groupCode;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 领退类型
|
||||
*/
|
||||
private String iosType;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String materialSpec;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String batchNo;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String qtyUnitName;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.wms.biBoard.materialRequisition.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.biBoard.materialRequisition.dto.IosReportDto;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 领料出库及退料入库数据报表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
public interface IIosReportService {
|
||||
|
||||
/**
|
||||
* 分页查询领料出库及退料入库数据报表
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<IosReportDto> queryIosReport(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 导出领料出库及退料入库数据报表
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param response : 响应对象
|
||||
*/
|
||||
void downloadIosReport(Map whereJson, HttpServletResponse response);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.wms.biBoard.materialRequisition.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.biBoard.materialRequisition.dto.IosReportDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 领料出库及退料入库数据报表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface IosReportMapper {
|
||||
|
||||
/**
|
||||
* 领料出库及退料入库数据报表分页查询
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<IosReportDto>
|
||||
*/
|
||||
IPage<IosReportDto> queryIosReport(Page<IosReportDto> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 领料出库及退料入库数据报表合计
|
||||
* @param whereJson 查询条件
|
||||
* @return IosReportDto
|
||||
*/
|
||||
IosReportDto queryIosReportSum(@Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 领料出库及退料入库数据报表全部数据(用于导出)
|
||||
* @param whereJson 查询条件
|
||||
* @return List<IosReportDto>
|
||||
*/
|
||||
List<IosReportDto> queryIosReportAll(@Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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.nl.wms.biBoard.iosReport.service.dao.mapper.IosReportMapper">
|
||||
|
||||
<!-- 领料出库及退料入库数据报表分页查询 -->
|
||||
<select id="queryIosReport" resultType="org.nl.wms.biBoard.materialRequisition.dto.IosReportDto">
|
||||
SELECT
|
||||
@rownum := @rownum + 1 AS rowNum,
|
||||
DATE_FORMAT(inv.confirm_time, '%Y-%m-%d %H:%i:%s') AS confirmTime,
|
||||
inv.confirm_optid AS groupCode,
|
||||
inv.confirm_optname AS groupName,
|
||||
CASE inv.bill_type
|
||||
WHEN '1001' THEN '领料'
|
||||
WHEN '0002' THEN '退料'
|
||||
ELSE ''
|
||||
END AS iosType,
|
||||
mater.material_code AS materialCode,
|
||||
mater.material_name AS materialName,
|
||||
mater.material_spec AS materialSpec,
|
||||
dtl.pcsn AS batchNo,
|
||||
dtl.real_qty AS weight,
|
||||
dtl.qty_unit_name AS qtyUnitName
|
||||
FROM
|
||||
st_ivt_iostorinv inv
|
||||
INNER JOIN st_ivt_iostorinvdtl dtl ON inv.iostorinv_id = dtl.iostorinv_id
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id,
|
||||
(SELECT @rownum := 0) r
|
||||
<where>
|
||||
inv.bill_status = '99'
|
||||
AND inv.bill_type IN ('1001', '0002')
|
||||
<if test="param.groupCode != null and param.groupCode != ''">
|
||||
AND inv.confirm_optid = #{param.groupCode}
|
||||
</if>
|
||||
<if test="param.materialCode != null and param.materialCode != ''">
|
||||
AND (mater.material_code LIKE CONCAT('%', #{param.materialCode}, '%')
|
||||
OR mater.material_name LIKE CONCAT('%', #{param.materialCode}, '%'))
|
||||
</if>
|
||||
<if test="param.batchNo != null and param.batchNo != ''">
|
||||
AND dtl.pcsn LIKE CONCAT('%', #{param.batchNo}, '%')
|
||||
</if>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(inv.confirm_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(inv.confirm_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY inv.confirm_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 领料出库及退料入库数据报表合计 -->
|
||||
<select id="queryIosReportSum" resultType="org.nl.wms.biBoard.materialRequisition.dto.IosReportDto">
|
||||
SELECT
|
||||
SUM(dtl.real_qty) AS weight,
|
||||
'KG' AS qtyUnitName
|
||||
FROM
|
||||
st_ivt_iostorinv inv
|
||||
INNER JOIN st_ivt_iostorinvdtl dtl ON inv.iostorinv_id = dtl.iostorinv_id
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
|
||||
<where>
|
||||
inv.bill_status = '99'
|
||||
AND inv.bill_type IN ('1001', '0002')
|
||||
<if test="param.groupCode != null and param.groupCode != ''">
|
||||
AND inv.confirm_optid = #{param.groupCode}
|
||||
</if>
|
||||
<if test="param.materialCode != null and param.materialCode != ''">
|
||||
AND (mater.material_code LIKE CONCAT('%', #{param.materialCode}, '%')
|
||||
OR mater.material_name LIKE CONCAT('%', #{param.materialCode}, '%'))
|
||||
</if>
|
||||
<if test="param.batchNo != null and param.batchNo != ''">
|
||||
AND dtl.pcsn LIKE CONCAT('%', #{param.batchNo}, '%')
|
||||
</if>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(inv.confirm_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(inv.confirm_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 领料出库及退料入库数据报表全部数据(用于导出) -->
|
||||
<select id="queryIosReportAll" resultType="org.nl.wms.biBoard.materialRequisition.dto.IosReportDto">
|
||||
SELECT
|
||||
DATE_FORMAT(inv.confirm_time, '%Y-%m-%d %H:%i:%s') AS confirmTime,
|
||||
inv.confirm_optid AS groupCode,
|
||||
inv.confirm_optname AS groupName,
|
||||
CASE inv.bill_type
|
||||
WHEN '1001' THEN '领料'
|
||||
WHEN '0002' THEN '退料'
|
||||
ELSE ''
|
||||
END AS iosType,
|
||||
mater.material_code AS materialCode,
|
||||
mater.material_name AS materialName,
|
||||
mater.material_spec AS materialSpec,
|
||||
dtl.pcsn AS batchNo,
|
||||
dtl.real_qty AS weight,
|
||||
dtl.qty_unit_name AS qtyUnitName
|
||||
FROM
|
||||
st_ivt_iostorinv inv
|
||||
INNER JOIN st_ivt_iostorinvdtl dtl ON inv.iostorinv_id = dtl.iostorinv_id
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
|
||||
<where>
|
||||
inv.bill_status = '99'
|
||||
AND inv.bill_type IN ('1001', '0002')
|
||||
<if test="param.groupCode != null and param.groupCode != ''">
|
||||
AND inv.confirm_optid = #{param.groupCode}
|
||||
</if>
|
||||
<if test="param.materialCode != null and param.materialCode != ''">
|
||||
AND (mater.material_code LIKE CONCAT('%', #{param.materialCode}, '%')
|
||||
OR mater.material_name LIKE CONCAT('%', #{param.materialCode}, '%'))
|
||||
</if>
|
||||
<if test="param.batchNo != null and param.batchNo != ''">
|
||||
AND dtl.pcsn LIKE CONCAT('%', #{param.batchNo}, '%')
|
||||
</if>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(inv.confirm_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(inv.confirm_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY inv.confirm_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,168 @@
|
||||
package org.nl.wms.biBoard.materialRequisition.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.biBoard.materialRequisition.dto.IosReportDto;
|
||||
import org.nl.wms.biBoard.materialRequisition.service.IIosReportService;
|
||||
import org.nl.wms.biBoard.materialRequisition.service.dao.mapper.IosReportMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 领料出库及退料入库数据报表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Service
|
||||
public class IosReportServiceImpl implements IIosReportService {
|
||||
|
||||
@Autowired
|
||||
private IosReportMapper iosReportMapper;
|
||||
|
||||
@Override
|
||||
public IPage<IosReportDto> queryIosReport(Map whereJson, PageQuery page) {
|
||||
IPage<IosReportDto> resultPage = iosReportMapper.queryIosReport(
|
||||
new Page<>(page.getPage() + 1, page.getSize()), whereJson);
|
||||
|
||||
// 添加合计行
|
||||
List<IosReportDto> records = resultPage.getRecords();
|
||||
IosReportDto sumDto = iosReportMapper.queryIosReportSum(whereJson);
|
||||
|
||||
if (!CollectionUtils.isEmpty(records) && sumDto != null) {
|
||||
sumDto.setGroupCode("合计");
|
||||
records.add(sumDto);
|
||||
}
|
||||
|
||||
resultPage.setRecords(records);
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadIosReport(Map whereJson, HttpServletResponse response) {
|
||||
// 查询所有数据
|
||||
List<IosReportDto> dataList = iosReportMapper.queryIosReportAll(whereJson);
|
||||
if (CollectionUtils.isEmpty(dataList)){
|
||||
throw new RuntimeException("数据为空");
|
||||
}
|
||||
try {
|
||||
// 创建工作簿
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
Sheet sheet = workbook.createSheet("焊材领退明细报表");
|
||||
|
||||
// 创建标题样式
|
||||
CellStyle titleStyle = workbook.createCellStyle();
|
||||
Font titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontHeightInPoints((short) 12);
|
||||
titleStyle.setFont(titleFont);
|
||||
titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
titleStyle.setBorderBottom(BorderStyle.THIN);
|
||||
titleStyle.setBorderTop(BorderStyle.THIN);
|
||||
titleStyle.setBorderLeft(BorderStyle.THIN);
|
||||
titleStyle.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 创建数据样式
|
||||
CellStyle dataStyle = workbook.createCellStyle();
|
||||
dataStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
dataStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
dataStyle.setBorderBottom(BorderStyle.THIN);
|
||||
dataStyle.setBorderTop(BorderStyle.THIN);
|
||||
dataStyle.setBorderLeft(BorderStyle.THIN);
|
||||
dataStyle.setBorderRight(BorderStyle.THIN);
|
||||
|
||||
// 创建标题行
|
||||
Row headerRow = sheet.createRow(0);
|
||||
String[] headers = {"序号", "领退时间", "班组编码", "班组名称", "领退类型", "物料编码", "物料名称", "规格型号", "批次", "重量", "单位"};
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
Cell cell = headerRow.createCell(i);
|
||||
cell.setCellValue(headers[i]);
|
||||
cell.setCellStyle(titleStyle);
|
||||
sheet.setColumnWidth(i, 4000);
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
int rowNum = 1;
|
||||
BigDecimal totalWeight = BigDecimal.ZERO;
|
||||
|
||||
for (IosReportDto dto : dataList) {
|
||||
Row row = sheet.createRow(rowNum);
|
||||
|
||||
createCell(row, 0, rowNum, dataStyle);
|
||||
createCell(row, 1, dto.getConfirmTime(), dataStyle);
|
||||
createCell(row, 2, dto.getGroupCode(), dataStyle);
|
||||
createCell(row, 3, dto.getGroupName(), dataStyle);
|
||||
createCell(row, 4, dto.getIosType(), dataStyle);
|
||||
createCell(row, 5, dto.getMaterialCode(), dataStyle);
|
||||
createCell(row, 6, dto.getMaterialName(), dataStyle);
|
||||
createCell(row, 7, dto.getMaterialSpec(), dataStyle);
|
||||
createCell(row, 8, dto.getBatchNo(), dataStyle);
|
||||
createCell(row, 9, dto.getWeight(), dataStyle);
|
||||
createCell(row, 10, dto.getQtyUnitName(), dataStyle);
|
||||
|
||||
if (dto.getWeight() != null) totalWeight = totalWeight.add(dto.getWeight());
|
||||
|
||||
rowNum++;
|
||||
}
|
||||
|
||||
// 添加合计行
|
||||
Row sumRow = sheet.createRow(rowNum);
|
||||
createCell(sumRow, 0, "", dataStyle);
|
||||
createCell(sumRow, 1, "", dataStyle);
|
||||
createCell(sumRow, 2, "合计", dataStyle);
|
||||
createCell(sumRow, 3, "", dataStyle);
|
||||
createCell(sumRow, 4, "", dataStyle);
|
||||
createCell(sumRow, 5, "", dataStyle);
|
||||
createCell(sumRow, 6, "", dataStyle);
|
||||
createCell(sumRow, 7, "", dataStyle);
|
||||
createCell(sumRow, 8, "", dataStyle);
|
||||
createCell(sumRow, 9, totalWeight, dataStyle);
|
||||
createCell(sumRow, 10, "KG", dataStyle);
|
||||
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode("焊材领退明细报表_" + DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss"), "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
// 输出
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
workbook.close();
|
||||
outputStream.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("导出Excel失败"+ e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void createCell(Row row, int column, Object value, CellStyle style) {
|
||||
Cell cell = row.createCell(column);
|
||||
if (value == null) {
|
||||
cell.setCellValue("");
|
||||
} else if (value instanceof BigDecimal) {
|
||||
cell.setCellValue(((BigDecimal) value).doubleValue());
|
||||
} else if (value instanceof Integer) {
|
||||
cell.setCellValue((Integer) value);
|
||||
} else {
|
||||
cell.setCellValue(value.toString());
|
||||
}
|
||||
cell.setCellStyle(style);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.nl.wms.biBoard.screen;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.biBoard.screen.service.IScreenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 智慧大屏 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/screen")
|
||||
@Slf4j
|
||||
public class ScreenController {
|
||||
|
||||
@Autowired
|
||||
private IScreenService iScreenService;
|
||||
|
||||
@GetMapping("/inventory")
|
||||
@SaIgnore
|
||||
// @Log("获取库存统计数据")
|
||||
public ResponseEntity<Object> getInventoryData() {
|
||||
return new ResponseEntity<>(iScreenService.getInventoryData(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/agvStatus")
|
||||
@SaIgnore
|
||||
// @Log("获取AGV状态")
|
||||
public ResponseEntity<Object> getAgvStatus() {
|
||||
return new ResponseEntity<>(iScreenService.getAgvStatus(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/tempTrend")
|
||||
@SaIgnore
|
||||
// @Log("获取当天温度走势")
|
||||
public ResponseEntity<Object> getTempTrend() {
|
||||
return new ResponseEntity<>(iScreenService.getTempTrend(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/todayReport")
|
||||
@SaIgnore
|
||||
// @Log("获取当天报表数据")
|
||||
public ResponseEntity<Object> getTodayReport() {
|
||||
return new ResponseEntity<>(iScreenService.getTodayReport(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/weekReport")
|
||||
@SaIgnore
|
||||
// @Log("获取本周报表数据")
|
||||
public ResponseEntity<Object> getWeekReport() {
|
||||
return new ResponseEntity<>(iScreenService.getWeekReport(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/materialTop5")
|
||||
@SaIgnore
|
||||
// @Log("获取焊材使用Top5")
|
||||
public ResponseEntity<Object> getMaterialTop5() {
|
||||
return new ResponseEntity<>(iScreenService.getMaterialTop5(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.wms.biBoard.screen.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 智慧大屏 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
public interface IScreenService {
|
||||
|
||||
/**
|
||||
* 获取库存统计数据
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getInventoryData();
|
||||
|
||||
/**
|
||||
* 获取AGV状态
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getAgvStatus();
|
||||
|
||||
/**
|
||||
* 获取当天温度走势
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getTempTrend();
|
||||
|
||||
/**
|
||||
* 获取当天报表数据
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getTodayReport();
|
||||
|
||||
/**
|
||||
* 获取本周报表数据
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getWeekReport();
|
||||
|
||||
/**
|
||||
* 获取焊材使用Top5
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getMaterialTop5();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.nl.wms.biBoard.screen.service.dao.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 智慧大屏 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScreenMapper {
|
||||
|
||||
/**
|
||||
* 获取库存分类统计
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getInventoryCategory();
|
||||
|
||||
/**
|
||||
* 获取库存前5数量及物料占比
|
||||
* @return List
|
||||
*/
|
||||
List<Map<String, Object>> getInventoryTop5();
|
||||
|
||||
/**
|
||||
* 获取库位统计
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> getStructStatistics();
|
||||
|
||||
/**
|
||||
* 获取温度走势
|
||||
* @param params 参数
|
||||
* @return List
|
||||
*/
|
||||
List<Map<String, Object>> getTempTrend(@Param("param") Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取班组焊材消耗报表
|
||||
* @param params 参数
|
||||
* @return List
|
||||
*/
|
||||
List<Map<String, Object>> getConsumeReport(@Param("param") Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取班组领退料明细报表
|
||||
* @param params 参数
|
||||
* @return List
|
||||
*/
|
||||
List<Map<String, Object>> getIosReport(@Param("param") Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取焊材使用Top5
|
||||
* @param params 参数
|
||||
* @return List
|
||||
*/
|
||||
List<Map<String, Object>> getMaterialTop5(@Param("param") Map<String, Object> params);
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<?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.nl.wms.biBoard.screen.service.dao.mapper.ScreenMapper">
|
||||
|
||||
<!-- 获取库存分类统计 -->
|
||||
<select id="getInventoryCategory" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
COUNT(DISTINCT s.struct_id) as totalCount,
|
||||
SUM(CASE WHEN s.storagevehicle_code IS NOT NULL AND s.is_emptyvehicle = '0' THEN 1 ELSE 0 END) as hasGoodsCount,
|
||||
SUM(CASE WHEN s.is_emptyvehicle = '1' THEN 1 ELSE 0 END) as emptyBoxCount,
|
||||
SUM(CASE WHEN s.storagevehicle_code IS NULL THEN 1 ELSE 0 END) as noGoodsCount
|
||||
FROM st_ivt_structattr s
|
||||
WHERE s.is_delete = '0' AND s.is_used = '1'
|
||||
</select>
|
||||
|
||||
<!-- 获取库存前5数量及物料占比 -->
|
||||
<select id="getInventoryTop5" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
st_ivt_structattr.struct_code,
|
||||
st_ivt_structattr.storagevehicle_code,
|
||||
md_pb_groupplate.qty,
|
||||
md_pb_groupplate.material_id,
|
||||
md_me_materialbase.material_name
|
||||
FROM
|
||||
st_ivt_structattr
|
||||
LEFT JOIN md_pb_groupplate on st_ivt_structattr.storagevehicle_code = md_pb_groupplate.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase on md_pb_groupplate.material_id = md_me_materialbase.material_id
|
||||
where st_ivt_structattr.storagevehicle_code is not null and st_ivt_structattr.storagevehicle_code != ''
|
||||
ORDER BY md_pb_groupplate.qty desc limit 5
|
||||
</select>
|
||||
|
||||
<!-- 获取库位统计 -->
|
||||
<select id="getStructStatistics" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
SUM(CASE WHEN s.storagevehicle_code IS NOT NULL AND s.is_emptyvehicle = '0' THEN 1 ELSE 0 END) as hasGoods,
|
||||
SUM(CASE WHEN s.is_emptyvehicle = '1' THEN 1 ELSE 0 END) as emptyBox,
|
||||
SUM(CASE WHEN s.storagevehicle_code IS NULL THEN 1 ELSE 0 END) as noGoods
|
||||
FROM st_ivt_structattr s
|
||||
WHERE s.is_delete = '0' AND s.is_used = '1'
|
||||
</select>
|
||||
|
||||
<!-- 获取温度走势 -->
|
||||
<select id="getTempTrend" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
DATE_FORMAT(record_timee, '%H:%i') as time,
|
||||
temp as temperature
|
||||
FROM bi_temp_record
|
||||
<where>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND record_datee >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND record_datee <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY record_timee ASC
|
||||
</select>
|
||||
|
||||
<!-- 获取班组焊材消耗报表 -->
|
||||
<select id="getConsumeReport" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
bom.create_id AS groupCode,
|
||||
bom.create_name AS groupName,
|
||||
mater.material_code AS materialCode,
|
||||
mater.material_name AS materialName,
|
||||
bom.real_qty AS receiveQty,
|
||||
(IFNULL(bom.return_one_qty, 0) + IFNULL(bom.return_two_qty, 0)) AS returnQty,
|
||||
(bom.real_qty - IFNULL(bom.return_one_qty, 0) - IFNULL(bom.return_two_qty, 0)) AS consumeQty
|
||||
FROM
|
||||
pdm_bom_callmaterial bom
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = bom.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(bom.create_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(bom.create_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY bom.create_time DESC
|
||||
LIMIT 10
|
||||
</select>
|
||||
|
||||
<!-- 获取班组领退料明细报表 -->
|
||||
<select id="getIosReport" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
DATE_FORMAT(inv.confirm_time, '%Y-%m-%d %H:%i:%s') AS confirmTime,
|
||||
inv.confirm_optid AS groupCode,
|
||||
inv.confirm_optname AS groupName,
|
||||
CASE inv.bill_type
|
||||
WHEN '1001' THEN '领料'
|
||||
WHEN '0002' THEN '退料'
|
||||
ELSE ''
|
||||
END AS iosType,
|
||||
mater.material_code AS materialCode,
|
||||
mater.material_name AS materialName,
|
||||
dtl.real_qty AS weight
|
||||
FROM
|
||||
st_ivt_iostorinv inv
|
||||
INNER JOIN st_ivt_iostorinvdtl dtl ON inv.iostorinv_id = dtl.iostorinv_id
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
|
||||
<where>
|
||||
inv.bill_status = '99'
|
||||
AND inv.bill_type IN ('1001', '0002')
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(inv.confirm_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(inv.confirm_time) <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY inv.confirm_time DESC
|
||||
LIMIT 10
|
||||
</select>
|
||||
|
||||
<!-- 获取焊材使用Top5 -->
|
||||
<select id="getMaterialTop5" resultType="java.util.HashMap">
|
||||
SELECT
|
||||
mater.material_code AS materialCode,
|
||||
mater.material_name AS materialName,
|
||||
SUM(dtl.real_qty) AS totalQty
|
||||
FROM
|
||||
st_ivt_iostorinv inv
|
||||
INNER JOIN st_ivt_iostorinvdtl dtl ON inv.iostorinv_id = dtl.iostorinv_id
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
|
||||
WHERE
|
||||
inv.bill_status = '99'
|
||||
AND inv.bill_type = '1001'
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND DATE(inv.confirm_time) >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND DATE(inv.confirm_time) <= #{param.endDate}
|
||||
</if>
|
||||
GROUP BY
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
LIMIT 5
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.nl.wms.biBoard.screen.service.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgvStatus {
|
||||
private String carId;
|
||||
/**
|
||||
* 车辆类型:潜伏式AGV,料箱式AGV
|
||||
*/
|
||||
private String carType;
|
||||
/**
|
||||
* 车辆图标:对应在resources/static
|
||||
*/
|
||||
private String icon = "resources/static/icon/料箱式AGV.png";
|
||||
/**
|
||||
* 当前执行任务号
|
||||
*/
|
||||
private String taskCode;
|
||||
/**
|
||||
* 电量单位%
|
||||
*/
|
||||
private String power;
|
||||
/**
|
||||
* 0待机 1正常 2故障
|
||||
*/
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package org.nl.wms.biBoard.screen.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.nl.wms.biBoard.StaticData;
|
||||
import org.nl.wms.biBoard.screen.service.dto.AgvStatus;
|
||||
import org.nl.wms.biBoard.screen.service.IScreenService;
|
||||
import org.nl.wms.biBoard.screen.service.dao.mapper.ScreenMapper;
|
||||
import org.nl.wms.biBoard.temp.service.dao.mapper.BiTempRecordMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 智慧大屏 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Service
|
||||
public class ScreenServiceImpl implements IScreenService {
|
||||
|
||||
@Autowired
|
||||
private ScreenMapper screenMapper;
|
||||
|
||||
@Autowired
|
||||
private BiTempRecordMapper biTempRecordMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getInventoryData() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 库存分类统计
|
||||
Map<String, Object> categoryData = screenMapper.getInventoryCategory();
|
||||
result.put("category", categoryData);
|
||||
|
||||
// 库存前5数量及物料占比
|
||||
List<Map<String, Object>> top5List = screenMapper.getInventoryTop5();
|
||||
result.put("top5", top5List);
|
||||
|
||||
// 库位统计:有货、空料箱、无货
|
||||
Map<String, Object> structData = screenMapper.getStructStatistics();
|
||||
result.put("structStat", structData);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAgvStatus() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 从StaticData获取AGV状态
|
||||
Map<String, AgvStatus> agvStatusMap = StaticData.agv_status;
|
||||
agvStatusMap.put("1",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("2")
|
||||
.icon("潜伏式AGV.png")
|
||||
.carType("潜伏式AGV").power("66").taskCode("123123").build());
|
||||
agvStatusMap.put("1",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("1")
|
||||
.carType("CTU料箱AGV")
|
||||
.icon("料箱式AGV.png")
|
||||
.power("77")
|
||||
.taskCode("33322")
|
||||
.build());
|
||||
agvStatusMap.put("2",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("2")
|
||||
.carType("CTU料箱AGV")
|
||||
.icon("料箱式AGV.png")
|
||||
.power("77")
|
||||
.taskCode("33322")
|
||||
.build());
|
||||
agvStatusMap.put("3",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("3")
|
||||
.carType("CTU料箱AGV")
|
||||
.icon("料箱式AGV.png")
|
||||
.power("77")
|
||||
.taskCode("33322")
|
||||
.build());
|
||||
agvStatusMap.put("5",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("5")
|
||||
.carType("CTU料箱AGV")
|
||||
.icon("料箱式AGV.png")
|
||||
.power("77")
|
||||
.taskCode("33322")
|
||||
.build());
|
||||
agvStatusMap.put("4",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("4")
|
||||
.carType("CTU料箱AGV")
|
||||
.icon("料箱式AGV.png")
|
||||
.power("77")
|
||||
.taskCode("33322")
|
||||
.build());
|
||||
agvStatusMap.put("6",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("6")
|
||||
.carType("CTU料箱AGV")
|
||||
.icon("料箱式AGV.png")
|
||||
.power("77")
|
||||
.taskCode("33322")
|
||||
.build());
|
||||
agvStatusMap.put("7",AgvStatus.builder()
|
||||
.status("1")
|
||||
.carId("7")
|
||||
.carType("CTU料箱AGV")
|
||||
.icon("料箱式AGV.png")
|
||||
.power("77")
|
||||
.taskCode("33322")
|
||||
.build());
|
||||
Object[] objects = agvStatusMap.values().toArray();
|
||||
result.put("agvList", objects);
|
||||
result.put("total", objects.length);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTempTrend() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 查询当天温度记录
|
||||
String today = DateUtil.today();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("startDate", today);
|
||||
params.put("endDate", today);
|
||||
|
||||
List<Map<String, Object>> tempList = screenMapper.getTempTrend(params);
|
||||
|
||||
result.put("tempData", tempList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTodayReport() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
String today = DateUtil.today();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
// params.put("startDate", today);
|
||||
// params.put("endDate", today);
|
||||
|
||||
// 班组焊材消耗报表
|
||||
List<Map<String, Object>> consumeList = screenMapper.getConsumeReport(params);
|
||||
result.put("consumeReport", consumeList);
|
||||
|
||||
// 班组领退料明细报表
|
||||
List<Map<String, Object>> iosList = screenMapper.getIosReport(params);
|
||||
result.put("iosReport", iosList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getWeekReport() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 获取本周开始和结束日期
|
||||
LocalDate now = LocalDate.now();
|
||||
LocalDate weekStart = now.minusDays(now.getDayOfWeek().getValue() - 1);
|
||||
LocalDate weekEnd = now;
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("startDate", weekStart.format(formatter));
|
||||
params.put("endDate", weekEnd.format(formatter));
|
||||
|
||||
// 班组焊材消耗报表
|
||||
List<Map<String, Object>> consumeList = screenMapper.getConsumeReport(params);
|
||||
result.put("consumeReport", consumeList);
|
||||
|
||||
// 班组领退料明细报表
|
||||
List<Map<String, Object>> iosList = screenMapper.getIosReport(params);
|
||||
result.put("iosReport", iosList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMaterialTop5() {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
String today = DateUtil.today();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
// params.put("startDate", today);
|
||||
// params.put("endDate", today);
|
||||
|
||||
// 焊材使用前Top5(通过领料出库单查询汇总)
|
||||
List<Map<String, Object>> top5List = screenMapper.getMaterialTop5(params);
|
||||
result.put("top5", top5List);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.biBoard.temp.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.biBoard.temp.service.IBiTempRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 温度记录表 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/tempRecord")
|
||||
@Slf4j
|
||||
public class TempRecordController {
|
||||
|
||||
@Autowired
|
||||
private IBiTempRecordService iBiTempRecordService;
|
||||
|
||||
@GetMapping
|
||||
@Log("分页查询温度记录")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iBiTempRecordService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.wms.biBoard.temp.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.biBoard.temp.service.dao.BiTempRecord;
|
||||
import org.nl.wms.biBoard.temp.service.dto.BiTempRecordDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 温度记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
public interface IBiTempRecordService extends IService<BiTempRecord> {
|
||||
|
||||
/**
|
||||
* 分页查询温度记录
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<BiTempRecordDto> queryAll(Map whereJson, PageQuery page);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.wms.biBoard.temp.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 温度记录表
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("bi_temp_record")
|
||||
public class BiTempRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 温度:acs定时获取
|
||||
*/
|
||||
private BigDecimal temp;
|
||||
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
private LocalDateTime recordTimee;
|
||||
|
||||
/**
|
||||
* 记录日期
|
||||
*/
|
||||
private LocalDate recordDatee;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.wms.biBoard.temp.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.biBoard.temp.service.dao.BiTempRecord;
|
||||
import org.nl.wms.biBoard.temp.service.dto.BiTempRecordDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 温度记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
public interface BiTempRecordMapper extends BaseMapper<BiTempRecord> {
|
||||
|
||||
/**
|
||||
* 温度记录分页查询
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<BiTempRecordDto>
|
||||
*/
|
||||
IPage<BiTempRecordDto> queryAllByPage(Page<BiTempRecordDto> page, @Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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.nl.wms.biBoard.temp.service.dao.mapper.BiTempRecordMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="org.nl.wms.biBoard.temp.service.dao.BiTempRecord">
|
||||
<id column="id" property="id" />
|
||||
<result column="temp" property="temp" />
|
||||
<result column="record_timee" property="recordTimee" />
|
||||
<result column="record_datee" property="recordDatee" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 温度记录分页查询 -->
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.biBoard.temp.service.dto.BiTempRecordDto">
|
||||
SELECT
|
||||
id,
|
||||
temp,
|
||||
DATE_FORMAT(record_timee, '%Y-%m-%d %H:%i:%s') as recordTimee,
|
||||
DATE_FORMAT(record_datee, '%Y-%m-%d') as recordDatee,
|
||||
'自动记录' as recorder
|
||||
FROM bi_temp_record
|
||||
<where>
|
||||
<if test="param.startDate != null and param.startDate != ''">
|
||||
AND record_datee >= #{param.startDate}
|
||||
</if>
|
||||
<if test="param.endDate != null and param.endDate != ''">
|
||||
AND record_datee <= #{param.endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY record_timee DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.nl.wms.biBoard.temp.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 温度记录表 DTO
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Data
|
||||
public class BiTempRecordDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
private BigDecimal temp;
|
||||
|
||||
/**
|
||||
* 记录时间
|
||||
*/
|
||||
private String recordTimee;
|
||||
|
||||
/**
|
||||
* 记录日期
|
||||
*/
|
||||
private String recordDatee;
|
||||
|
||||
/**
|
||||
* 记录人
|
||||
*/
|
||||
private String recorder;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.biBoard.temp.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.biBoard.temp.service.IBiTempRecordService;
|
||||
import org.nl.wms.biBoard.temp.service.dao.BiTempRecord;
|
||||
import org.nl.wms.biBoard.temp.service.dao.mapper.BiTempRecordMapper;
|
||||
import org.nl.wms.biBoard.temp.service.dto.BiTempRecordDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 温度记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author System
|
||||
* @since 2026-03-07
|
||||
*/
|
||||
@Service
|
||||
public class BiTempRecordServiceImpl extends ServiceImpl<BiTempRecordMapper, BiTempRecord> implements IBiTempRecordService {
|
||||
|
||||
@Override
|
||||
public IPage<BiTempRecordDto> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()), whereJson);
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,11 @@ server:
|
||||
nl:
|
||||
config:
|
||||
mysql:
|
||||
ip: 192.168.81.251
|
||||
ip: 127.0.0.1
|
||||
port: 3306
|
||||
username: root
|
||||
password: P@ssw0rd.
|
||||
database: xujiang_hanyun_wms
|
||||
password: 123456
|
||||
database: xghy_wmsa
|
||||
# ip: 127.0.0.1
|
||||
# port: 3306
|
||||
# username: root
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.3 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 173 KiB |
Reference in New Issue
Block a user