package cn.iocoder.yudao.module.mes.controller.pub.trace.vo;
import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchProcessTraceRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchPurchaseSourceRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchSalesTargetRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* H5 扫码溯源 - 全程溯源信息 Response VO
*
* 以「信息区块」模块化组织,核心信息(品种/批次/人员/质检/入库)始终返回;
* 采购来源、销售去向、加工流转为可选扩展区块(有数据才非空)。后续新增数据源按同一模式追加区块字段。
*/
@Schema(description = "H5 扫码溯源 - 全程溯源信息 Response VO")
@Data
public class MesProTracePublicRespVO {
@Schema(description = "追溯入口类型:BAG-袋码 / PALLET-托盘码 / BATCH-批次码", example = "BAG")
private String sourceType;
@Schema(description = "请求的追溯码(原始扫码值)", example = "PC20260828twoITEM_001")
private String requestCode;
// ====== 品种信息区块 ======
@Schema(description = "品种编码")
private String itemCode;
@Schema(description = "品种名称")
private String itemName;
@Schema(description = "品种规格")
private String itemSpecification;
// ====== 生产批次信息区块 ======
@Schema(description = "批次号")
private String batchCode;
@Schema(description = "临时批次码")
private String tempCode;
@Schema(description = "批次状态", example = "20")
private Integer batchStatus;
@Schema(description = "批次状态名称", example = "生产中")
private String batchStatusName;
@Schema(description = "生产日期")
private LocalDateTime produceDate;
@Schema(description = "产线编码")
private String lineCode;
@Schema(description = "产线名称")
private String lineName;
@Schema(description = "责任人用户编号")
private Long ownerUserId;
@Schema(description = "责任人姓名")
private String ownerUserName;
@Schema(description = "计划数量")
private BigDecimal planQuantity;
@Schema(description = "已生成袋码数量")
private Integer bagQuantity;
@Schema(description = "已生成托盘数量")
private Integer palletQuantity;
@Schema(description = "入库时间")
private LocalDateTime inboundTime;
@Schema(description = "备注")
private String remark;
// ====== 生产人员区块 ======
@Schema(description = "生产人员列表")
private List workers;
// ====== 托盘区块 ======
@Schema(description = "托盘总数")
private Integer palletCount;
@Schema(description = "托盘列表")
private List pallets;
// ====== 袋码区块 ======
@Schema(description = "袋码总数")
private Long bagTotal;
@Schema(description = "袋码列表(最多 100 条)")
private List bags;
// ====== 入库事件区块 ======
@Schema(description = "最新入库事件")
private InboundVO inbound;
// ====== 质检信息区块 ======
@Schema(description = "种子质检信息")
private QualityVO quality;
// ====== 可选扩展区块(有数据才返回,空表返回空列表) ======
@Schema(description = "采购来源(可选)")
private List purchaseSources;
@Schema(description = "销售去向(可选)")
private List salesTargets;
@Schema(description = "加工流转(可选)")
private List processTraces;
@Schema(description = "生产人员")
@Data
public static class WorkerVO {
@Schema(description = "岗位类型", example = "20")
private Integer workerType;
@Schema(description = "岗位类型名称", example = "操作工")
private String workerTypeName;
@Schema(description = "姓名")
private String userName;
@Schema(description = "备注")
private String remark;
}
@Schema(description = "托盘信息")
@Data
public static class PalletVO {
@Schema(description = "托盘码")
private String code;
@Schema(description = "托盘序号")
private Integer palletNo;
@Schema(description = "已装袋数")
private Integer bagCount;
@Schema(description = "可装袋数")
private Integer capacity;
}
@Schema(description = "袋码信息")
@Data
public static class BagVO {
@Schema(description = "袋码")
private String code;
@Schema(description = "袋序号")
private Integer bagNo;
@Schema(description = "绑定托盘码")
private String palletCode;
@Schema(description = "状态", example = "20")
private Integer status;
@Schema(description = "状态名称", example = "已导出印刷")
private String statusName;
@Schema(description = "入库时间")
private LocalDateTime inboundTime;
}
@Schema(description = "入库事件")
@Data
public static class InboundVO {
@Schema(description = "事件号")
private String eventId;
@Schema(description = "设备编码")
private String deviceCode;
@Schema(description = "产线编码")
private String lineCode;
@Schema(description = "入库数量")
private BigDecimal quantity;
@Schema(description = "状态", example = "1")
private String status;
@Schema(description = "事件时间")
private LocalDateTime eventTime;
}
@Schema(description = "种子质检信息")
@Data
public static class QualityVO {
@Schema(description = "质检结果", example = "1")
private Integer result;
@Schema(description = "质检结果名称", example = "合格")
private String resultName;
@Schema(description = "不合格原因")
private String reason;
@Schema(description = "检验员姓名")
private String inspectorName;
@Schema(description = "检验时间")
private LocalDateTime inspectedAt;
@Schema(description = "质检指标列表")
private List indicators;
}
@Schema(description = "质检指标")
@Data
public static class IndicatorVO {
@Schema(description = "指标编码", example = "purity")
private String indicatorCode;
@Schema(description = "指标名称", example = "纯度")
private String indicatorName;
@Schema(description = "检测值")
private BigDecimal value;
@Schema(description = "下限")
private BigDecimal minValue;
@Schema(description = "上限")
private BigDecimal maxValue;
@Schema(description = "是否合格")
private Boolean pass;
}
}