package com.zfire.mall.manager.bean.k3.bill;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.zfire.mall.manager.constant.KingDeeCons;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@ApiModel
@Data
@JsonIgnoreProperties(value = { "materialNumber","walletNumber" })
public class SalesOrderItemBean {

    /**
     * 物料编码
     */
    @JsonProperty("FMaterialId")
    @Setter(AccessLevel.NONE)
    private Map<String, String> materialId = new HashMap<String, String>();

    /**
     * 钱包编码
     */
    @JsonProperty("F_kls_Assistant")
    @Setter(AccessLevel.NONE)
    private Map<String, String> walletId = new HashMap<String, String>();

    /**
     * 物料编码
     */
    @JsonProperty("FStockUnitID")
    @Setter(AccessLevel.NONE)
    private Map<String, String> unitId = new HashMap<String, String>();

    @JsonProperty("FQty")
    @ApiModelProperty(value = "销售数量", required = true)
    private BigDecimal qty;

    @JsonProperty("FTaxPrice")
    @ApiModelProperty(value = "含税单价", required = true)
    private BigDecimal taxPrice;

    @JsonProperty("FDiscount")
    @ApiModelProperty(value = "折扣额", required = true)
    private BigDecimal discount;

    @JsonProperty("FEntryNote")
    @ApiModelProperty(value = "备注", required = true)
    private String entryNote;

    @ApiModelProperty(value = "物料编码", required = true)
    private String materialNumber;
    @ApiModelProperty(value = "钱包编码", required = true)
    private String walletNumber;
    @ApiModelProperty(value = "单位编码", required = true)
    private String unit;

    @JsonProperty("F_kls_Text")
    @ApiModelProperty(value = "供应链标识（默认存明细id）", required = true)
    private String supplyColVal;

    @JsonProperty("FOrderEntryPlan")
    @ApiModelProperty(value = "供应链标识（默认存明细id）", required = true)
    private List<Map<String,Object>> fOrderEntryPlan = new ArrayList<>();

    @JsonProperty("F_kls_Base")
    @ApiModelProperty(value = "金蝶部门编号", required = false)
    private Map<String,String> k3OrgNumber = new HashMap<>();

    public void setfOrderEntryPlan(String fDate){
        Map<String,Object> map = new HashMap<>();
        map.put("FPlanQty",qty);
        map.put(KingDeeCons.FPLAN_DATE,fDate);
        fOrderEntryPlan.add(map);
    }

    public void setMaterialNumber(String materialNumber) {
        this.materialNumber = materialNumber;
        this.materialId.put(KingDeeCons.NUMBER, this.materialNumber);
    }

    public void setWalletNumber(String walletNumber) {
        this.walletNumber = walletNumber;
        this.walletId.put(KingDeeCons.NUMBER, this.walletNumber);
    }

    public void setUnit(String unit) {
        this.unit = unit;
        this.unitId.put(KingDeeCons.NUMBER, this.unit);
    }

    public void setK3OrgNumber(String k3OrgNumber){
        this.k3OrgNumber.put(KingDeeCons.NUMBER,k3OrgNumber);
    }
}
