package com.ruoyi.asset.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 退库单明细对象 ams_return_order_item
 * 
 * @author Yangk
 * @date 2026-06-15
 */
public class AmsReturnOrderItem extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 明细ID */
    private Long itemId;

    /** 退库单ID */
    @Excel(name = "退库单ID")
    private Long orderId;

    /** 退库单号快照 */
    @Excel(name = "退库单号快照")
    private String returnNo;

    /** 资产ID */
    @Excel(name = "资产ID")
    private Long assetId;

    /** 资产编码快照 */
    @Excel(name = "资产编码快照")
    private String assetCode;

    /** 资产名称快照 */
    @Excel(name = "资产名称快照")
    private String assetName;

    /** 资产类别ID快照 */
    @Excel(name = "资产类别ID快照")
    private Long categoryId;

    /** 类别编码快照 */
    @Excel(name = "类别编码快照")
    private String categoryCode;

    /** 类别名称快照 */
    @Excel(name = "类别名称快照")
    private String categoryName;

    /** 规格型号快照 */
    @Excel(name = "规格型号快照")
    private String specModel;

    /** 品牌快照 */
    @Excel(name = "品牌快照")
    private String brand;

    /** 
     * 资产当前状态。
     * 仅用于退库列表/详情页面的动态关联展示，不进行持久化存储。
     */
    private String assetStatus;

    /** 
     * 最近一次已完成领用单对应的源仓库ID。
     * 此字段为非持久化字段，仅在退库申请页面中用于：
     * 1. 默认带出资产退回的建议仓位；
     * 2. 作为后端单据“同一退库单只允许退回原同仓库来源资产”的分组校验依据。
     */
    private Long originWarehouseId;

    /** 最近一次已完成领用的原仓库编码（仅用于前端展示与比对，不持久化） */
    private String originWarehouseCode;

    /** 最近一次已完成领用的原仓库名称（仅用于前端展示与比对，不持久化） */
    private String originWarehouseName;

    /** 最近一次已完成领用的原仓库启用状态（仅用于页面原路退库合法性校验，不持久化） */
    private String originWarehouseEnabled;

    /** 
     * 最近一次已完成领用单对应的源位置ID。
     * 用以协助实现原路退库时对位置级别的默认回填与可用性审查。
     */
    private Long originLocationId;

    /** 最近一次已完成领用的原位置编码（仅用于前端展示，不持久化） */
    private String originLocationCode;

    /** 最近一次已完成领用的原位置名称（仅用于前端展示，不持久化） */
    private String originLocationName;

    /** 最近一次已完成领用的原位置启用状态（仅用于页面原路退库合法性校验，不持久化） */
    private String originLocationEnabled;

    /** 
     * 退库前使用人ID。
     * 此字段是关键的历史归属快照。在草稿保存时写入，并在单据提交与确认退库时，
     * 用来与资产台账（`ams_asset`）的实时使用人字段进行比对。若不一致，说明该资产已被转借或另作他用，必须阻断流程。
     */
    @Excel(name = "退库前使用人ID")
    private Long beforeUserId;

    /** 退库前使用人名称快照。记录资产退库前那一刻的责任人名称以备审计 */
    @Excel(name = "退库前使用人名称快照")
    private String beforeUserName;

    /** 
     * 退库前部门ID。
     * 同样作为归属历史快照，用于提交/确认时的防并发防脏写安全校验。
     */
    @Excel(name = "退库前部门ID")
    private Long beforeDeptId;

    /** 退库前部门名称快照。记录资产退库前那一刻的所属部门以备审计 */
    @Excel(name = "退库前部门名称快照")
    private String beforeDeptName;

    /** 
     * 退库后入库的仓库ID。
     * 实物退库完成确认后，资产当前的归属仓库将被变更为此ID，且资产状态回滚为“在库（IN_STOCK）”。
     */
    @Excel(name = "退库后仓库ID")
    private Long afterWarehouseId;

    /** 退库后仓库编码快照 */
    @Excel(name = "退库后仓库编码快照")
    private String afterWarehouseCode;

    /** 退库后仓库名称快照 */
    @Excel(name = "退库后仓库名称快照")
    private String afterWarehouseName;

    /** 
     * 退库后入库的资产具体存放位置ID。
     * 必须隶属于主表所选的接收仓库，否则会在保存/提交时校验失败。
     */
    @Excel(name = "退库后位置ID")
    private Long afterLocationId;

    /** 退库后位置编码快照 */
    @Excel(name = "退库后位置编码快照")
    private String afterLocationCode;

    /** 退库后位置名称快照 */
    @Excel(name = "退库后位置名称快照")
    private String afterLocationName;

    /** 删除标志：0存在，1删除 */
    private String delFlag;

    public void setItemId(Long itemId) 
    {
        this.itemId = itemId;
    }

    public Long getItemId() 
    {
        return itemId;
    }
    public void setOrderId(Long orderId) 
    {
        this.orderId = orderId;
    }

    public Long getOrderId() 
    {
        return orderId;
    }
    public void setReturnNo(String returnNo) 
    {
        this.returnNo = returnNo;
    }

    public String getReturnNo() 
    {
        return returnNo;
    }
    public void setAssetId(Long assetId) 
    {
        this.assetId = assetId;
    }

    public Long getAssetId() 
    {
        return assetId;
    }
    public void setAssetCode(String assetCode) 
    {
        this.assetCode = assetCode;
    }

    public String getAssetCode() 
    {
        return assetCode;
    }
    public void setAssetName(String assetName) 
    {
        this.assetName = assetName;
    }

    public String getAssetName() 
    {
        return assetName;
    }
    public void setCategoryId(Long categoryId) 
    {
        this.categoryId = categoryId;
    }

    public Long getCategoryId() 
    {
        return categoryId;
    }
    public void setCategoryCode(String categoryCode) 
    {
        this.categoryCode = categoryCode;
    }

    public String getCategoryCode() 
    {
        return categoryCode;
    }
    public void setCategoryName(String categoryName) 
    {
        this.categoryName = categoryName;
    }

    public String getCategoryName() 
    {
        return categoryName;
    }
    public void setSpecModel(String specModel) 
    {
        this.specModel = specModel;
    }

    public String getSpecModel() 
    {
        return specModel;
    }
    public void setBrand(String brand) 
    {
        this.brand = brand;
    }

    public String getBrand() 
    {
        return brand;
    }
    public void setAssetStatus(String assetStatus)
    {
        this.assetStatus = assetStatus;
    }

    public String getAssetStatus()
    {
        return assetStatus;
    }
    public Long getOriginWarehouseId()
    {
        return originWarehouseId;
    }

    public void setOriginWarehouseId(Long originWarehouseId)
    {
        this.originWarehouseId = originWarehouseId;
    }

    public String getOriginWarehouseCode()
    {
        return originWarehouseCode;
    }

    public void setOriginWarehouseCode(String originWarehouseCode)
    {
        this.originWarehouseCode = originWarehouseCode;
    }

    public String getOriginWarehouseName()
    {
        return originWarehouseName;
    }

    public void setOriginWarehouseName(String originWarehouseName)
    {
        this.originWarehouseName = originWarehouseName;
    }

    public String getOriginWarehouseEnabled()
    {
        return originWarehouseEnabled;
    }

    public void setOriginWarehouseEnabled(String originWarehouseEnabled)
    {
        this.originWarehouseEnabled = originWarehouseEnabled;
    }

    public Long getOriginLocationId()
    {
        return originLocationId;
    }

    public void setOriginLocationId(Long originLocationId)
    {
        this.originLocationId = originLocationId;
    }

    public String getOriginLocationCode()
    {
        return originLocationCode;
    }

    public void setOriginLocationCode(String originLocationCode)
    {
        this.originLocationCode = originLocationCode;
    }

    public String getOriginLocationName()
    {
        return originLocationName;
    }

    public void setOriginLocationName(String originLocationName)
    {
        this.originLocationName = originLocationName;
    }

    public String getOriginLocationEnabled()
    {
        return originLocationEnabled;
    }

    public void setOriginLocationEnabled(String originLocationEnabled)
    {
        this.originLocationEnabled = originLocationEnabled;
    }
    public void setBeforeUserId(Long beforeUserId) 
    {
        this.beforeUserId = beforeUserId;
    }

    public Long getBeforeUserId() 
    {
        return beforeUserId;
    }
    public void setBeforeUserName(String beforeUserName) 
    {
        this.beforeUserName = beforeUserName;
    }

    public String getBeforeUserName() 
    {
        return beforeUserName;
    }
    public void setBeforeDeptId(Long beforeDeptId) 
    {
        this.beforeDeptId = beforeDeptId;
    }

    public Long getBeforeDeptId() 
    {
        return beforeDeptId;
    }
    public void setBeforeDeptName(String beforeDeptName) 
    {
        this.beforeDeptName = beforeDeptName;
    }

    public String getBeforeDeptName() 
    {
        return beforeDeptName;
    }
    public void setAfterWarehouseId(Long afterWarehouseId) 
    {
        this.afterWarehouseId = afterWarehouseId;
    }

    public Long getAfterWarehouseId() 
    {
        return afterWarehouseId;
    }
    public void setAfterWarehouseCode(String afterWarehouseCode) 
    {
        this.afterWarehouseCode = afterWarehouseCode;
    }

    public String getAfterWarehouseCode() 
    {
        return afterWarehouseCode;
    }
    public void setAfterWarehouseName(String afterWarehouseName) 
    {
        this.afterWarehouseName = afterWarehouseName;
    }

    public String getAfterWarehouseName() 
    {
        return afterWarehouseName;
    }
    public void setAfterLocationId(Long afterLocationId) 
    {
        this.afterLocationId = afterLocationId;
    }

    public Long getAfterLocationId() 
    {
        return afterLocationId;
    }
    public void setAfterLocationCode(String afterLocationCode) 
    {
        this.afterLocationCode = afterLocationCode;
    }

    public String getAfterLocationCode() 
    {
        return afterLocationCode;
    }
    public void setAfterLocationName(String afterLocationName) 
    {
        this.afterLocationName = afterLocationName;
    }

    public String getAfterLocationName() 
    {
        return afterLocationName;
    }
    public void setDelFlag(String delFlag) 
    {
        this.delFlag = delFlag;
    }

    public String getDelFlag() 
    {
        return delFlag;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("itemId", getItemId())
            .append("orderId", getOrderId())
            .append("returnNo", getReturnNo())
            .append("assetId", getAssetId())
            .append("assetCode", getAssetCode())
            .append("assetName", getAssetName())
            .append("categoryId", getCategoryId())
            .append("categoryCode", getCategoryCode())
            .append("categoryName", getCategoryName())
            .append("specModel", getSpecModel())
            .append("brand", getBrand())
            .append("assetStatus", getAssetStatus())
            .append("originWarehouseId", getOriginWarehouseId())
            .append("originWarehouseName", getOriginWarehouseName())
            .append("originLocationId", getOriginLocationId())
            .append("originLocationName", getOriginLocationName())
            .append("beforeUserId", getBeforeUserId())
            .append("beforeUserName", getBeforeUserName())
            .append("beforeDeptId", getBeforeDeptId())
            .append("beforeDeptName", getBeforeDeptName())
            .append("afterWarehouseId", getAfterWarehouseId())
            .append("afterWarehouseCode", getAfterWarehouseCode())
            .append("afterWarehouseName", getAfterWarehouseName())
            .append("afterLocationId", getAfterLocationId())
            .append("afterLocationCode", getAfterLocationCode())
            .append("afterLocationName", getAfterLocationName())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .append("delFlag", getDelFlag())
            .toString();
    }
}
