package com.steering.mes.mcp.Vrp;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.converter.CoreConverter;
import com.steering.comm.db.DBCommon;

public class FrmComm extends DBCommon{

	/***
	 * 获取产线
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getPlineCode(String ProcessCode)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmComm.getPlineCode");
		sql += " AND PROCESS_CODE='" + ProcessCode+"' ";
		sql += " ORDER BY T.PLINE_NAME";
		return this.getData(sql);
	}


	/***
	 * 获取产线
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getPlineCode(String[] arr)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmComm.getPlineCode");
		sql += CoreConverter.toSqlConditionString("T.DEPARTMENT_CODE", arr);
		sql += " ORDER BY T.PLINE_NAME";
		return this.getData(sql);
	}



	/***
	 * 获取外委产线
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getPlineCodeW(String[] arr)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmComm.getPlineCodeW");
		sql += CoreConverter.toSqlConditionString("T1.DEPARTMENT_CODE", arr);
		sql += " ORDER BY T1.PLINE_NAME";
		return this.getData(sql);
	}


	/***
	 * 获取产线
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getPlineCode(String[] arr,String ProcessCode)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmComm.getPlineCode");
		sql += CoreConverter.toSqlConditionString("T.DEPARTMENT_CODE", arr);
		sql += " AND PROCESS_CODE='" + ProcessCode+"' ";
		sql += " ORDER BY T.PLINE_NAME";
		return this.getData(sql);
	}



	/***
	 * 获取检查站
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getCheckStation(String[] arr,String ProcessCode)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmComm.getCheckStation");
		sql += CoreConverter.toSqlConditionString("T.DEPARTMENT_CODE", arr);
		sql += " AND PROCESS_CODE='" + ProcessCode+"' ";
		sql += " ORDER BY C.BASENAME";
		return this.getData(sql);
	}

	/***
	 * 获取生产厂
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getProStation(String[] arr,String ProcessCode)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmComm.getProStation");
		sql += CoreConverter.toSqlConditionString("T.DEPARTMENT_CODE", arr);
		sql += " AND PROCESS_CODE='" + ProcessCode+"' ";
		sql += " ORDER BY C.BASENAME";
		return this.getData(sql);
	}


	/***
	 * 获取产线(第一行为空)
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getPlineCodeName(String[] arr,String ProcessCode)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmComm.getPlineCodeName");
		sql += CoreConverter.toSqlConditionString("T.DEPARTMENT_CODE", arr);
		sql += " AND PROCESS_CODE='" + ProcessCode+"' ";
		sql += " ORDER BY PLINE_NAME DESC";
		return this.getData(sql);
	}




}
