package com.steering.pss.ydm.Report;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.Util.StringUtils;
import com.steering.comm.converter.CoreConverter;
import com.steering.comm.db.DBCommon;

import java.util.ArrayList;

public class FrmGpRpt extends DBCommon {

	public CoreReturnObject getGpDataB(ArrayList<String> list,String[] arr,String custom)
	{
	return getGpDataB(list,arr,custom,"","");
	}

	public CoreReturnObject getGpDataB(ArrayList<String> list,String[] arr,String custom,String startTime,String endTime)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmGpRpt.getGpDataB");
		sql += CoreConverter.toSqlConditionString("BELONG_CODE", arr);
		sql += " AND SUPPLY_UNIT_CODE = '"+custom+"'";
		if(!list.get(0).equals(""))
		{
			sql += " AND JUDGE_STOVE_NO_OLD = '"+list.get(0)+"'";
		}
		if (!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(startTime)) {
			sql += " AND CREATE_TIME >= TO_DATE('" + startTime + "','YYYY-MM-DD HH24:MI:SS')";
			sql += " AND CREATE_TIME <= TO_DATE('" + endTime + "','YYYY-MM-DD HH24:MI:SS')";
		}
		sql += " group by JUDGE_ID,JUDGE_STOVE_NO_OLD,BATCH_NO_OLD,BATCH_GROUD_NO_OLD,SUPPLY_UNIT_CODE,SUPPLY_UNIT";
		return this.getData(sql);
	}
}
