package cn.iocoder.yudao.module.order.vo.orderSplitItem;

import cn.iocoder.yudao.module.order.vo.order.OrderWarehouseInDetailsVO;
import cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationCreateReqVO;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
@ToString
@EqualsAndHashCode
@ApiModel("管理后台 - 订单拆单项规格记录")
public class OrderSpiltItemSpecsRecordVO {

    /**
     * 入仓记录id
     */
    @ApiModelProperty(value = "入仓记录id", required = true)
    @NotNull(message = "入仓记录id不能为空")
    private Long warehouseInId;

    @ApiModelProperty(value = "件数", required = true)
    @NotNull(message = "件数不能为空")
    private Integer num;

    @ApiModelProperty(value = "数量")
    private Integer quantity;

    @ApiModelProperty(value = "重量")
    private BigDecimal weight;

    @ApiModelProperty(value = "收费重量")
    private BigDecimal chargeWeight;

    @ApiModelProperty(value = "体积")
    private BigDecimal volume;

    @ApiModelProperty(value = "收费体积")
    private BigDecimal chargeVolume;

    @ApiModelProperty(value = "箱规")
    private String boxGauge;

    @ApiModelProperty(value = "入仓规格类型")
    private Integer specificationType;

    @ApiModelProperty(value = "入仓时间")
    private Date inTime;

    @ApiModelProperty(value = "快递单号")
    private String expressNo;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "入仓货物-单位", required = true)
    private String unit;

    @ApiModelProperty(value = "入仓货物-储位信息")
    private List<OrderLocationCreateReqVO> orderLocationList;

    @ApiModelProperty(value = "入仓纪录明细列表")
    private List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList;


    public BigDecimal getWeight() {
        if (Objects.nonNull(this.weight)) {
            return weight.setScale(2, RoundingMode.HALF_UP);
        }
        return null;
    }

    public void setWeight(BigDecimal weight) {
        if (Objects.nonNull(weight)) {
            this.weight = weight.setScale(2, RoundingMode.HALF_UP);
        }
    }

    public BigDecimal getChargeWeight() {
        if (Objects.nonNull(this.chargeWeight)) {
            return chargeWeight.setScale(2, RoundingMode.HALF_UP);
        }
        return null;
    }

    public void setChargeWeight(BigDecimal chargeWeight) {
        if (Objects.nonNull(chargeWeight)) {
            this.chargeWeight = chargeWeight.setScale(2, RoundingMode.HALF_UP);
        }
    }

    public BigDecimal getVolume() {
        if (Objects.nonNull(volume)) {
            return volume.setScale(2, RoundingMode.HALF_UP);
        }
        return null;
    }

    public void setVolume(BigDecimal volume) {
        if (Objects.nonNull(volume)) {
            this.volume = volume.setScale(2, RoundingMode.HALF_UP);
        }
    }

    public BigDecimal getChargeVolume() {
        if (Objects.nonNull(chargeVolume)) {
            return chargeVolume.setScale(2, RoundingMode.HALF_UP);
        }
        return null;
    }

    public void setChargeVolume(BigDecimal chargeVolume) {
        if (Objects.nonNull(chargeVolume)) {
            this.chargeVolume = chargeVolume.setScale(2, RoundingMode.HALF_UP);
        }
    }
}
