package cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseIn;

import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseIn.handler.OrderWarehouseInDetailsTypeHandler;
import cn.iocoder.yudao.module.order.vo.order.OrderWarehouseInDetailsVO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;

import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 入仓货物详情 DO
 *
 * @author yanghao
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "ecw_order_warehouse_in", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OrderWarehouseInDO extends BaseDO {

    /**
     * 主键ID
     */
    @TableId
    private Long id;
    /**
     * 订单ID
     */
    private Long orderId;
    /**
     * 订单编号
     */
    private String orderNo;
    /**
     * 订单项id
     */
    private Long orderItemId;

    /**
     * 箱/件数
     */
    private Integer cartonsNum;
    /**
     * 所有箱内总货物数量
     */
    private Integer quantityAll;
    /**
     * 单位
     */
    private String unit;

    /**
     * 入仓规格类型  1箱/2整板 见字典 warehousing_specification_type
     */
    private Integer specificationType;
    /**
     * 箱规
     */
    private String boxGauge;
    /**
     * 体积
     */
    private BigDecimal volume;
    /**
     * 重量
     */
    private BigDecimal weight;
    /**
     * 快递单号
     */
    private String expressNo;
    /**
     * 入仓时间
     */
    private Date inTime;

    /**
     * 入仓来源 字典order_warehouse_in_source 1-始发港入仓、2-调拨入仓、3-目的港入仓、4-退场入仓
     */
    private Integer source;


    /**
     * 重货方数
     */
    private BigDecimal heavyNumber;


    /**
     * 泡货方数
     */
    private BigDecimal lightNumber;

    /**
     * 备注
     */
    private String remark;


    /**
     * 入仓纪录明细VO
     */
    @TableField(value = "order_warehouse_in_details", typeHandler = OrderWarehouseInDetailsTypeHandler.class)
    private List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList;


    @TableField(exist = false)
    private String locationId;


    public void set(String field, Object value) {
        try {
            Field f = getClass().getDeclaredField(field);
            f.setAccessible(true);
            f.set(this, value);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
