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

import com.fasterxml.jackson.annotation.JsonIgnore;
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.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@ApiModel
@Data
@JsonIgnoreProperties(value = { "orgNumber","customerNumber","salerNumber" })
public class SalesOrderBean extends CommonOrderBean {

    @JsonProperty("FBillTypeID")
    private Map<String, String> billTypeID = new HashMap<String, String>() {
        {
            this.put(KingDeeCons.NUMBER, "XSDD01_SYS");
        }
    };

//    @JsonProperty("FBillNo")
//    @ApiModelProperty(value = "单号", required = true)
//    private String billNo;

    @JsonProperty("FDate")
    @ApiModelProperty(value = "日期", required = true)
    private String date;

    @ApiModelProperty(value = "组织编码")
    private String orgNumber;
    @JsonProperty("FSaleOrgId")
    private Map<String, String> saleOrgId = new HashMap<>();

    @ApiModelProperty(value = "客户")
    private String customerNumber;
    @JsonProperty("FCustId")
    private Map<String, String> custId = new HashMap<String, String>();

/*    @ApiModelProperty(value = "销售员")
    private String salerNumber;*/
/*    @JsonProperty("FSalerId")
    private Map<String, String> salerId = new HashMap<String, String>() {
        {
            this.put(KingDeeCons.NUMBER, KingDeeCons.SALERID);
        }
    };*/

    @JsonProperty("FNote")
    @ApiModelProperty(value = "备注")
    private String note;


    @JsonProperty("FRecConditionId")
    private Map<String, String> conditionId = new HashMap<String, String>() {
        {
            this.put(KingDeeCons.NUMBER, "001");
        }
    };


    @JsonProperty("FSaleOrderEntry")
    @ApiModelProperty(value = "订单明细", required = true)
    private List<SalesOrderItemBean> orderItems;


    @JsonIgnore
    private boolean isPushUpdate = false;

    public void setOrgNumber(String orgNumber) {
        this.orgNumber = orgNumber;
        this.saleOrgId.put(KingDeeCons.NUMBER, this.orgNumber);
    }

    public void setCustomerNumber(String customerNumber) {
        this.customerNumber = customerNumber;
        this.custId.put(KingDeeCons.NUMBER, this.customerNumber);
    }

/*
    public void setSalerNumber(String salerNumber) {
        this.salerNumber = salerNumber;
        this.salerId.put(KingDeeCons.NUMBER, this.salerNumber);
    }
*/

    @Override
    public boolean isPushUpdate() {
        return isPushUpdate;
    }

}
