package com.prolog.eis.dto.page;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @desc:
 * @author: zhangJie
 * @date: 2023/7/14 14:23
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PickOutboundOrderDetailRespDto {

    @ApiModelProperty("物料编码")
    private String itemCode;
    @ApiModelProperty("物料名称")
    private String itemName;
    @ApiModelProperty("库存数量")
    private BigDecimal storeNum;
    @ApiModelProperty("计划数量")
    private BigDecimal outNum;
    @ApiModelProperty("缺货数量")
    private BigDecimal lackNum;
    @ApiModelProperty("异常信息")
    private String errMsg;

    public BigDecimal computeLackNum() {
        BigDecimal storeNum = this.getStoreNum();
        BigDecimal outNum = this.getOutNum();
        BigDecimal lackNum = outNum.subtract(storeNum);
        return lackNum.compareTo(BigDecimal.ZERO) > 0 ? lackNum : BigDecimal.ZERO;
    }
}
