package com.uas.platform.b2b.erp.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.util.CollectionUtils;

import com.uas.platform.b2b.model.BarPackage;
import com.uas.platform.b2b.model.BarPackageDetail;

public class BarPackageDown {
	private Long pa_id;
	private String pa_prodcode;
	private String pa_outboxcode;
	private Date pa_packdate;
	private Long pa_level;
	private Long pa_packageqty;
	private Double pa_totalqty;
	private String pa_makecode;
	private String pa_status;
	private Date pa_indate;
	private List<BarPackageDownDtail> details;
	
	public Long getPa_id() {
		return pa_id;
	}

	public void setPa_id(Long pa_id) {
		this.pa_id = pa_id;
	}

	public String getPa_prodcode() {
		return pa_prodcode;
	}

	public void setPa_prodcode(String pa_prodcode) {
		this.pa_prodcode = pa_prodcode;
	}

	public String getPa_outboxcode() {
		return pa_outboxcode;
	}

	public void setPa_outboxcode(String pa_outboxcode) {
		this.pa_outboxcode = pa_outboxcode;
	}

	public Date getPa_packdate() {
		return pa_packdate;
	}

	public void setPa_packdate(Date pa_packdate) {
		this.pa_packdate = pa_packdate;
	}

	public Long getPa_level() {
		return pa_level;
	}

	public void setPa_level(Long pa_level) {
		this.pa_level = pa_level;
	}

	public Long getPa_packageqty() {
		return pa_packageqty;
	}

	public void setPa_packageqty(Long pa_packageqty) {
		this.pa_packageqty = pa_packageqty;
	}

	public Double getPa_totalqty() {
		return pa_totalqty;
	}

	public void setPa_totalqty(Double pa_totalqty) {
		this.pa_totalqty = pa_totalqty;
	}

	public String getPa_makecode() {
		return pa_makecode;
	}

	public void setPa_makecode(String pa_makecode) {
		this.pa_makecode = pa_makecode;
	}

	public String getPa_status() {
		return pa_status;
	}

	public void setPa_status(String pa_status) {
		this.pa_status = pa_status;
	}

	public Date getPa_indate() {
		return pa_indate;
	}

	public void setPa_indate(Date pa_indate) {
		this.pa_indate = pa_indate;
	}

	public List<BarPackageDownDtail> getDetails() {
		return details;
	}

	public void setDetails(List<BarPackageDownDtail> details) {
		this.details = details;
	}

	public BarPackageDown(BarPackage barPackge) {
		this.pa_id = barPackge.getId();
		this.pa_indate = barPackge.getIndate();
		this.pa_level = barPackge.getLevel();
		this.pa_makecode = barPackge.getMakecode();
		this.pa_outboxcode = barPackge.getOutboxcode();
		this.pa_packageqty = (long)barPackge.getPackageqty();
		this.pa_packdate = barPackge.getPackdate();
		this.pa_prodcode = barPackge.getProdcode();
		this.pa_status = barPackge.getStatus();
		this.pa_totalqty = barPackge.getTotalqty();
		if(! CollectionUtils.isEmpty(barPackge.getDetail())) {
			List<BarPackageDownDtail> downDetails = new  ArrayList<BarPackageDownDtail>();
			for(BarPackageDetail detail : barPackge.getDetail()) {
				downDetails.add(new BarPackageDownDtail(detail));
			}
			this.details = downDetails;
		}
	}
}
