package com.steering.pss.sale.order.bomGeneration.server;

import com.steering.pss.sale.order.bomGeneration.model.DesignBomAEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomBEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomCEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomDEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomEEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomFEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomGEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomIEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomJEntity;

/**
 * 电炉BOM清单
 * 
 * @author Administrator
 * 
 */
public class BomCode {
	/**
	 * 生成电炉Bom清单
	 * 
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param inMaterialDesc
	 *            投入物料描述
	 * @param bom
	 *            bom主键
	 * @param gradeCode
	 *            钢种代码
	 * @param gradeName
	 *            钢种描述
	 * @return List<DesignBomAEntity>
	 * @throws SQLException
	 */
	public static DesignBomAEntity generationBomA(String inMaterialNo,
			String inMaterialDesc, String bom, String gradeCode,
			String gradeName) {
		DesignBomAEntity bomA = new DesignBomAEntity();
		bomA.setBom(bom);
		bomA.setInMaterialNo(inMaterialNo);
		bomA.setInMaterialDesc(inMaterialDesc);
		bomA.setOutMaterialNo(gradeCode);
		bomA.setOutMaterialDesc(gradeName);
		return bomA;
	}

	/**
	 * 生成铸造BOM
	 * 
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param inMaterialDesc
	 *            投入物料描述
	 * @param prefix
	 *            前缀
	 * @param bom
	 *            BOM主键
	 * @param specCode
	 *            规格代码
	 * @param specName
	 *            规格描述
	 * @param gradeCode
	 *            钢种代码
	 * @param gradeName
	 *            钢种描述
	 * @return DesignBomBEntity
	 */
	public static DesignBomBEntity generationBomB(String inMaterialNo,
			String inMaterialDesc, String prefix, String bom, String specCode,
			String specName, String gradeCode, String gradeName) {
		DesignBomBEntity bomB = new DesignBomBEntity();
		bomB.setBom(bom);
		bomB.setInMaterialDesc(inMaterialDesc);
		bomB.setInMaterialNo(inMaterialNo);
		bomB.setOutMaterialDesc(prefix + specName + "," + gradeName);
		bomB.setOutMaterialNo(prefix + specCode + gradeCode);
		return bomB;
	}

	/**
	 * 铸造BOM清单
	 * 
	 * @param prefix
	 *            前缀
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param inMaterialDesc
	 *            投入物料描述
	 * @param bom
	 *            BOM主键
	 * @param gradeCode
	 *            钢种代码
	 * @param gradeName
	 *            钢种描述
	 * @param specCode
	 *            规格代码
	 * @param specName
	 *            规格描述
	 * @return DesignBomCEntity
	 */
	public static DesignBomCEntity generationBomC(String prefix,
			String inMaterialNo, String inMaterialDesc, String bom,
			String gradeCode, String gradeName, String specCode, String specName) {
		DesignBomCEntity bomC = new DesignBomCEntity();
		bomC.setBom(bom);
		bomC.setInMaterialDesc(inMaterialDesc);
		bomC.setInMaterialNo(inMaterialNo);
		bomC.setOutMaterialNo(prefix + specCode + gradeCode);
		bomC.setOutMaterialDesc(prefix + specName + "," + gradeName);
		return bomC;
	}

	/**
	 * 轧管BOM清单
	 * 
	 * @param inMaterialNo
	 *            投入物料代码
	 * @param inMaterialDesc
	 *            投入物料描述
	 * @param prefix
	 *            前缀
	 * @param specCode
	 *            轧管规格代码
	 * @param specName
	 *            轧管规格描述
	 * @param bom
	 *            BOM主键
	 * 
	 * @param gradeCode
	 *            钢种代码
	 * @param gradeName
	 *            钢种名称
	 * @return DesignBomDEntity
	 */
	public static DesignBomDEntity generationBomD(String inMaterialNo,
			String inMaterialDesc, String prefix, String specCode,
			String specName, String bom, String gradeCode, String gradeName,
			String flag) {
		DesignBomDEntity bomD = new DesignBomDEntity();
		bomD.setBom(bom);
		bomD.setInMaterialNo(inMaterialNo);
		bomD.setInMaterialDesc(inMaterialDesc);
		// 轧管产出物料描述
		if (flag.equals("0")) {
			bomD.setOutMaterialDesc(prefix + specName + "," + gradeName);
			// 轧管产出物料代码
			bomD.setOutMaterialNo(prefix + specCode + gradeCode);
		} else {
			bomD.setOutMaterialDesc(gradeName);
			// 轧管产出物料代码
			bomD.setOutMaterialNo(gradeCode);
		}

		return bomD;
	}

	/**
	 * 墩拔扩Bom
	 * 
	 * @param prefix
	 *            前缀(例如:W)
	 * @param inMaterialNo
	 *            投入物料
	 * @param inMaterialDesc
	 *            产出物料
	 * @param bom
	 *            bom主键
	 * @param specCode
	 *            规格代码
	 * @param specDesc
	 *            规格描述
	 * @param gradeCode
	 *            钢种代码
	 * @param gradeName
	 *            钢种描述
	 * @return DesignBomEEntity
	 */
	public static DesignBomEEntity generationBomE(String prefix,
			String inMaterialNo, String inMaterialDesc, String bom,
			String specCode, String specDesc, String gradeCode,
			String gradeName, String flag) {
		DesignBomEEntity bomE = new DesignBomEEntity();
		bomE.setBom(bom);
		bomE.setInMaterialNo(inMaterialNo);
		bomE.setInMaterialDesc(inMaterialDesc);
		if (flag.equals("0")) {
			bomE.setOutMaterialNo(prefix + specCode + gradeCode);
			bomE.setOutMaterialDesc(prefix + specDesc + "," + gradeName);
		} else {
			bomE.setOutMaterialNo(gradeCode);
			bomE.setOutMaterialDesc(gradeName);
		}

		return bomE;
	}

	/**
	 * 热处理BOM清单
	 * 
	 * @param prefix
	 *            前缀
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param inMaterialDesc
	 *            投入物料描述
	 * @param bom
	 *            BOM主键
	 * @param stdStyle
	 *            标准类别代码
	 * @param stdStyleDesc
	 *            标准类别描述
	 * @param specCode
	 *            规格代码
	 * @param specName
	 *            规格描述
	 * @param steelCode
	 *            钢级代码
	 * @param steelName
	 *            钢级描述
	 * @return DesignBomEEntity
	 */
	public static DesignBomFEntity generationBomF(String prefix,
			String inMaterialNo, String inMaterialDesc, String bom,
			String stdStyle, String stdStyleDesc, String specCode,
			String specName, String steelCode, String steelName, String flag) {
		DesignBomFEntity bomE = new DesignBomFEntity();
		bomE.setBom(bom);
		bomE.setInMaterialDesc(inMaterialDesc);
		bomE.setInMaterialNo(inMaterialNo);
		if (flag.equals("0")) {
			bomE.setOutMaterialDesc(prefix + specName + "," + stdStyleDesc
					+ "," + steelName);
			bomE.setOutMaterialNo(prefix + specCode + stdStyle + steelCode);
		} else {
			bomE.setOutMaterialDesc(steelName);
			bomE.setOutMaterialNo(steelCode);
		}

		return bomE;
	}

	/**
	 * 接箍加工BOM清单
	 * 
	 * @param bom
	 * @param bomJg
	 * @param inMaterialNo
	 * @param inMaterialDesc
	 * @param midMaterialNo
	 * @param midMaterialDesc
	 * @param outMaterialNo
	 * @param outMaterialDesc
	 * @return
	 */
	public static DesignBomGEntity generationBomG(String bom, String bomJg,
			String inMaterialNo, String inMaterialDesc, String midMaterialNo,
			String midMaterialDesc, String outMaterialNo, String outMaterialDesc) {
		DesignBomGEntity bomG = new DesignBomGEntity();
		bomG.setBom(bom);
		bomG.setBomJg(bomJg);
		bomG.setInMaterialNo(inMaterialNo);
		bomG.setInMaterialDesc(inMaterialDesc);
		bomG.setMidMaterialNo(midMaterialNo);
		bomG.setMidMaterialDesc(midMaterialDesc);
		bomG.setOutMaterialNo(outMaterialNo);
		bomG.setOutMaterialDesc(outMaterialDesc);
		return bomG;
	}

	/**
	 * 加工BOM清单
	 * 
	 * @param bom
	 * @param inMaterialNo
	 * @param inMaterialDesc
	 * @param outMaterialNo
	 * @param outMaterialDesc
	 * @return
	 */
	public static DesignBomIEntity generationBomI(String bom,
			String inMaterialNo, String inMaterialDesc, String outMaterialNo,
			String outMaterialDesc) {
		DesignBomIEntity bomI = new DesignBomIEntity();
		bomI.setBom(bom);
		bomI.setInMaterialNo(inMaterialNo);
		bomI.setInMaterialDesc(inMaterialDesc);
		bomI.setOutMaterialNo(outMaterialNo);
		bomI.setOutMaterialDesc(outMaterialDesc);
		return bomI;
	}

	/**
	 * 接箍BOM清单
	 * 
	 * @param bom
	 * @param bomJg
	 * @param outMaterialNo
	 * @param outMaterialDesc
	 * @return
	 */
	public static DesignBomJEntity generationBomJ(String bom, String bomJg,
			String outMaterialNo, String outMaterialDesc) {
		DesignBomJEntity bomJ = new DesignBomJEntity();
		bomJ.setBom(bom);
		bomJ.setBomJg(bomJg);
		bomJ.setOutMaterialDesc(outMaterialDesc);
		bomJ.setOutMaterialNo(outMaterialNo);
		return bomJ;
	}

}
