package com.steering.pss.ydm.Report;

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

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

public class FrmQuantity extends DBCommon{

	/***
	 * 查询量差
	 * @param mothYear
	 * @param arr
	 * @return
	 */
	public CoreReturnObject getQuantity(String mothYear,String[] arr,String supplyUnit)
	{
		String sql = CoreXmlSqlParsersFactory.getSql("FrmQuantity.getQuantity");
		sql +=CoreConverter.toSqlConditionString("BELONG_CODE", arr);
		if(supplyUnit.equals("120501"))
		{
			sql += " AND (SUPPLY_UNIT_CODE = '"+supplyUnit+"' OR SUPPLY_UNIT_CODE IS NULL)";
		}else if(supplyUnit.equals("120504")){
			sql += " AND SUPPLY_UNIT_CODE = '"+supplyUnit+"'";
		}
		sql += " group by BAL_YEAR_MONTH,STOCKTAKING_TYPE_NAME,STOCKTAKING_RSN_NAME,JUDGE_STOVE_NO,BATCH_NO,BATCH_GROUD_NO,PRODUCCODE,PRODUCNAME,STD_CODE,STD_NAME,GRADECODE,GRADENAME,STEELCODE,STEELNAME,STD_STYLE,STD_STYLE_DESC,SPEC_CODE,SPEC_NAME,MODEL_CODE,MODEL_DESC,BELONG_CODE,BELONG_NAME";
		sql += " order by CREATE_TIME desc";
		return this.getData(sql, new Object[]{mothYear});
	}
	//ACT_WEIGHT,ACT_COUNT,
}
