package com.xisc.pm.app.service.autoboard.dto;

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

import com.xisc.pm.api.dto.PmProContYieldResposeDTO;
import com.xisc.pm.infra.enums.FormPlateMode;

import lombok.Data;

@Data
public class PmPdResultDTO {
    
    private BigDecimal szLen ;
    
    private BigDecimal szWid ;
    
    private BigDecimal sumWt ;
    
    private BigDecimal spCount ;
    
    private List<BigDecimal> lens ;
    
    private List<PmContBoardParam> pmContBoardParams;
    
    private String formPlateCode ;
    
    private List<String> block1 ;
    private List<String> block2 ;
    
    private PmContBoardParam axisPmContBoardParam;
    
    private PmProContYieldResposeDTO respose ;
    
    private PmAutoBoardExecParam current ;
    
    private Long transFlag = 0L;
    
    public PmPdResultDTO(BigDecimal szLen, BigDecimal szWid, BigDecimal spCount , BigDecimal sumWt, List<BigDecimal> lens,
            List<PmContBoardParam> pmContBoardParams, String formPlateCode, List<String> block1, List<String> block2 , PmContBoardParam axisPmContBoardParam) {
        super();
        this.szLen = szLen;
        this.szWid = szWid;
        this.spCount = spCount;
        this.sumWt = sumWt;
        if(lens != null) {
            this.lens = new ArrayList<BigDecimal>(lens.size());
            this.lens.addAll(lens);
        }
        this.pmContBoardParams = pmContBoardParams;
        this.formPlateCode = formPlateCode;
        FormPlateMode formPlateMode = FormPlateMode.getByCode(formPlateCode);
        if(FormPlateMode.S.getType().equals(formPlateMode.getType())) {
            if(!FormPlateMode.S2.equals(formPlateMode) && !FormPlateMode.S3.equals(formPlateMode)) {
                if(axisPmContBoardParam.getOrderWid().multiply(BigDecimal.valueOf(2L)).compareTo(szWid) == 0) {
                    this.formPlateCode = FormPlateMode.S1.getCode();
                } else {
                    this.formPlateCode = FormPlateMode.S7.getCode();
                }
            }
        }
        
        if(block1 != null) {
            this.block1 = new ArrayList<String>(block1.size());
            this.block1.addAll(block1);
        }
        if(block2 != null) {
            this.block2 = new ArrayList<String>(block2.size());
            this.block2.addAll(block2);
        }
        this.axisPmContBoardParam = axisPmContBoardParam;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "PmPdResultDTO [szLen=" + szLen + ", szWid=" + szWid + ", sumWt=" + sumWt + ", spCount=" + spCount
                + ", lens=" + lens + ", formPlateCode=" + formPlateCode
                + ", block1=" + block1 + ", block2=" + block2 + ",axisOrderNo=" + axisPmContBoardParam.getOrderNo() 
                + ",comandYield=" + respose.getCommandYield() + ", moldWid=" + current.getMoldWidth() + ", moldTck=" + current.getMoldThick() 
                + ", mscLineNo=" + current.getMscLineNo() +"]";
    }
    
    
    
}
