package cn.estsh.i3plus.pojo.model.wms;

import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil;
import io.swagger.annotations.ApiParam;
import lombok.Data;

import java.io.Serializable;

/**
 * @Description 消息样式实体类
 * @Reference
 * @Author dragon
 * @CreateDate 2019/8/26 10:36
 * @Modify
 */
@Data
public class WmsMessageStyleModel implements Serializable {
    private static final long serialVersionUID = -810847996371452831L;
    @ApiParam("任务状态")
    public Integer taskStatus;
    @ApiParam("单据明细状态")
    public Integer odStatus;
    @ApiParam("扫码明细状态")
    public Integer wsStatus;
    @ApiParam("消息")
    public String message;

    @ApiParam("前景色")
    public String foregroundColor;
    @ApiParam("背景色")
    public String backgroundColor;
    @ApiParam("是否粗体")
    public boolean isBold;
    @ApiParam("是否斜体")
    public boolean isItalics;
    @ApiParam("字号")
    public Integer fontSize;

    public WmsMessageStyleModel() {
    }

    public WmsMessageStyleModel(String message, Integer selectQty) {
        this.message = message;
        this.wsStatus = selectQty;
    }

    public WmsMessageStyleModel(String message) {
        this.message = message;
    }

    public WmsMessageStyleModel(String message, double transQty, double actQty) {
        this.message = message;
        if (actQty == 0) {//未处理
            this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.CREATE.getValue();
        } else if (transQty > actQty) {//处理中
            this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT.getValue();
        } else if (actQty == transQty) {//处理完成
            this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT_FINISH.getValue();
        } else if (transQty < actQty) {//处理中 处理数量可以大于需求数量
            this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT_FINISH.getValue();
        }
    }

    public WmsMessageStyleModel(String message, double transQty, double actQty, boolean showRed) {
        this.message = message;
        if (actQty == 0) {//未处理
            this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.CREATE.getValue();
        } else if (transQty > actQty) {//处理中
            this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT.getValue();
        } else if (actQty == transQty) {//处理完成
            this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT_FINISH.getValue();
        } else if (transQty < actQty) {//处理数量大于需求数量-显示红色
            if (showRed) {
                this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.CLOSED.getValue();
            } else {
                this.odStatus = WmsEnumUtil.MASTER_ORDER_STATUS.RECEIPT_FINISH.getValue();
            }
        }
    }
}
