package easydo.technology.model.vo;

import easydo.technology.model.ProcessStage;
import easydo.technology.model.ProductBom;
import easydo.technology.model.ProductOrder;
import easydo.technology.model.ProductOrderBom;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * 派工记录查询返回VO
 * 只包含前端需要的字段
 */
@Data
public class ProductOrderDispatchVO {
    private String id;
    private String code;
    private String name;
    private String orderId;
    private String bomId;
    private String stageId;
    private String routeId;
    private Integer orderNum;
    private BigDecimal processNum;
    private BigDecimal processTimeHour;
    private BigDecimal readyTimeHour;
    private BigDecimal moveNum;
    private BigDecimal moveTimeHour;
    private String status;
    private Boolean isReport;
    private Boolean isReview;
    private Boolean isRound;
    private Boolean isInspection;
    private String beginDate;
    private String endDate;
    private String createTime;
    private String tenantId;
    
    // 领料状态（计算字段）
    private String requisitionStatus;  // pending-未领料, partially-部分领料, complete-已领料
    
    // 关联对象（返回整表对象）
    private ProductOrder productOrder;
    private ProductOrderBom productOrderBom;
    private ProductBom productBom;
    private ProcessStage stage;
    private List<SimpleDispatchUserItem> userItems;
    private List<SimpleMaterialRequisition> materialRequisitions;  // 领料单列表
    
    @Data
    public static class SimpleDispatchUserItem {
        private String id;
        private Long userId;
        private String status;
        private Boolean isReport;
        private Boolean isReview;
        private SimpleUser user;
    }
    
    @Data
    public static class SimpleUser {
        private Long id;
        private String username;
        private String nickName;
    }
    
    @Data
    public static class SimpleMaterialRequisition {
        private String id;
        private String code;
        private String name;
        private String dispatchId;
        private String orderId;
        private String bomId;
        private String requisitionType;  // auto-领料, manual-补料
        private String outboundStatus;   // applied-申请完毕, pending-未出库, partial-部分出库, completed-出库完毕
        private String status;           // pending-未领料, complete-已领料
        private String requisitionDate;
        private Long receiverId;
        private String remark;
        private String tenantId;
        private Long createId;
        private String createTime;
        private Long updateId;
        private String updateTime;
    }
}
