package cn.iocoder.yudao.module.mes.controller.admin.qc.vo;
|
|
import cn.idev.excel.annotation.ExcelProperty;
|
import lombok.Data;
|
|
import java.math.BigDecimal;
|
import java.time.LocalDateTime;
|
import java.time.format.DateTimeFormatter;
|
|
/**
|
* MES 质检检验单导出 Excel VO(IQC/IPQC/OQC/RQC 共用)
|
*
|
* <p>导出列:检验单名称 / 物料名称 / 批号 / 检测日期 / 检验指标 / 判定依据 / 检验结果 / 检验人 / 审核人 / 备注。
|
* 检验指标、判定依据取自检验单行明细;审核人暂无数据来源,导出为空列。
|
*
|
* @author 超级管理员
|
*/
|
@Data
|
public class MesQcQualityExportVO {
|
|
@ExcelProperty("检验单名称")
|
private String docName;
|
|
@ExcelProperty("物料名称")
|
private String itemName;
|
|
@ExcelProperty("批号")
|
private String batchNo;
|
|
@ExcelProperty("检测日期")
|
private String inspectDate;
|
|
@ExcelProperty("检验指标")
|
private String indicatorNames;
|
|
@ExcelProperty("判定依据")
|
private String judgementBasis;
|
|
@ExcelProperty("检验结果")
|
private String checkResultText;
|
|
@ExcelProperty("检验人")
|
private String inspectorName;
|
|
@ExcelProperty("审核人")
|
private String auditorName;
|
|
@ExcelProperty("备注")
|
private String remark;
|
|
/**
|
* 格式化检测日期(仅日期),null 返回空串
|
*/
|
public static String formatDateTime(LocalDateTime dateTime) {
|
if (dateTime == null) {
|
return "";
|
}
|
return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
}
|
|
/**
|
* 去掉数值尾部无意义的 0,如 35.000000 -> 35、2.500000 -> 2.5
|
*/
|
public static String formatDecimal(BigDecimal value) {
|
if (value == null) {
|
return "";
|
}
|
return value.stripTrailingZeros().toPlainString();
|
}
|
|
/**
|
* 组装单个检测项的判定依据文本:
|
* 上下限均有 -> "下限~上限";仅有上限 -> "≤上限";仅有下限 -> "≥下限";
|
* 均无但给了标准值 -> "标准值 标准值";否则返回空串。
|
*/
|
public static String buildRangeText(BigDecimal standardValue, BigDecimal minThreshold, BigDecimal maxThreshold) {
|
if (maxThreshold != null && minThreshold != null) {
|
return formatDecimal(minThreshold) + "~" + formatDecimal(maxThreshold);
|
}
|
if (maxThreshold != null) {
|
return "≤" + formatDecimal(maxThreshold);
|
}
|
if (minThreshold != null) {
|
return "≥" + formatDecimal(minThreshold);
|
}
|
if (standardValue != null) {
|
return "标准值 " + formatDecimal(standardValue);
|
}
|
return "";
|
}
|
|
}
|