package com.steering.pss.plnsaleord.stove;

import org.omg.CORBA.OBJ_ADAPTER;

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

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.StringTool;
import com.steering.pss.plnsaleord.stove.entity.PlnZyDbkMEntity;

/**
 * 物料选择
 * @author cheng
 *
 */
public class MaterialChoose extends DBCommon{
	public CoreReturnObject getMaterialInfo(String materialID,String process_desc) {
		CoreReturnObject returnObject=null;
		returnObject=this.getDataBySqlID("MaterialChoose.queryMaterial", new Object[]{materialID,process_desc});
		return returnObject;
	}
	
	public CoreReturnObject getGPInfo(String materialID,String process_desc) {
		CoreReturnObject returnObject=null;
		returnObject=this.getDataBySqlID("MaterialChoose.queryGP", new Object[]{materialID,process_desc});
		return returnObject;
	}
	
	public CoreReturnObject getGPInfo(String materialID,String judgeStoveNo,String ProPlanID,String GXPLANNO,String process_code) {
		CoreReturnObject returnObject = null;
		returnObject = this.getDataBySqlID("MaterialChoose.queryGPByStove",new Object[]{materialID,judgeStoveNo,ProPlanID,GXPLANNO,process_code});
		return returnObject;
	}
	
	public CoreReturnObject getMaterialbyStove(String materialID,String judgeStoveNo,String batchNO,String BatchGroupNo,String ProPlanID,String GXPLANNO,String process_code) {
		CoreReturnObject returnObject = null;
		returnObject = this.getDataBySqlID("MaterialChoose.queryMaterialByStoveBatch", new Object[]{materialID,judgeStoveNo,batchNO,BatchGroupNo,ProPlanID,GXPLANNO,process_code});
		return returnObject;
	}
	
	public CoreReturnObject getBindedMaterial(String process_code,String process_desc) {
		CoreReturnObject returnObject = null;
		returnObject = this.getDataBySqlID("MaterialChoose.queryBindedMaterial", new Object[]{process_code,process_desc,process_code});
		return returnObject;
	}
	
	public CoreReturnObject getBindedGp(String process_code,String process_desc)
	{
		CoreReturnObject returnObject = null;
		returnObject = this.getDataBySqlID("MaterialChoose.queryBindedGP", new Object[]{process_code,process_desc,process_code});
		return returnObject;
	}
	
	public CoreReturnObject GetMaxProdIndex(String tableName)
	{
		CoreReturnObject returnObject=null;
		try {
			String sqlString = CoreXmlSqlParsersFactory.getSql("MaterialChoose.queryMaxProdIndex");
			returnObject=this.getData(sqlString, new Object[]{tableName});
		} catch (Exception e) {
			returnObject.SetErrInfo(e.getMessage());
			// TODO: handle exception
		}
		return returnObject;
	}
	
	public CoreReturnObject UpdateMAT_ZC_M(String PROCESS_CDOE,String PROCESS_DESC,String MATERIAL_NO,String JUDGE_STOVE_NO,Integer USERCOUNT,String PRO_ORDER_ID,String GX_PLAN_NO,Integer LOCK_LIKU)
	{
		CoreReturnObject returnObject = null;
		returnObject=this.setDataBySqlID("MaterialChoose.updateMaterial", new Object[]{MATERIAL_NO,JUDGE_STOVE_NO,PROCESS_DESC,USERCOUNT,PROCESS_CDOE,PROCESS_DESC,PRO_ORDER_ID,GX_PLAN_NO,LOCK_LIKU});
		return returnObject;
	}
	
	public CoreReturnObject UpdateMAT_ZC_M_BACK(String PROCESS_CDOE,String PROCESS_DESC,String MATERIAL_NO,String JUDGE_STOVE_NO,String USERCOUNT,String PRO_ORDER_ID,Integer LOCK_LIKU)
	{
		CoreReturnObject returnObject = null;
		returnObject=this.setDataBySqlID("MaterialChoose.updateMaterialBack", new Object[]{MATERIAL_NO,JUDGE_STOVE_NO,PROCESS_CDOE,PROCESS_DESC,PRO_ORDER_ID,PROCESS_DESC,USERCOUNT,LOCK_LIKU});
		return returnObject;
	}
	
	public CoreReturnObject UpdateMAT_ZC_M_BACK_When_Finish(String PROCESS_CDOE,String PROCESS_DESC,String MATERIAL_NO,String JUDGE_STOVE_NO,String USERCOUNT,String PRO_ORDER_ID,Integer LOCK_LIKU)
	{
		CoreReturnObject returnObject = null;
		returnObject=this.setDataBySqlID("MaterialChoose.updateMaterialBackWhenFinish", new Object[]{MATERIAL_NO,JUDGE_STOVE_NO,PROCESS_CDOE,PROCESS_DESC,PRO_ORDER_ID,PROCESS_DESC,USERCOUNT,LOCK_LIKU});
		return returnObject;
	}
	
	public CoreReturnObject UpdateMAT_GP_M(String Material_No,String Judge_Stove_No,String ProcessCode,String UserCount,String ProcessDesc,String ProPlanId )
	{
		CoreReturnObject returnObject = null;
		returnObject=this.setDataBySqlID("MaterialChoose.updateGP", new Object[]{Material_No,Judge_Stove_No,ProcessCode,UserCount,ProcessCode,ProcessDesc,ProPlanId});
		return returnObject;
	}
	
	public CoreReturnObject UpdateMAT_GP_M_BACK(String Material_No,String Stove_No,String ProPlanId,String ProcessCode,String ProcessDesc)
	{
		CoreReturnObject returnObject = null;
		returnObject=this.setDataBySqlID("MaterialChoose.updateGPBack", new Object[]{Material_No,Stove_No,ProPlanId,ProcessCode,ProcessDesc,ProcessCode});
		return returnObject;
	}
	
	public CoreReturnObject querylockliku(String JUDGE_STOVE_NO,String BATCHEDNO,String BATCH_GROUD_NO,String PRO_PLAN_ID,String GX_PLAN_NO) {
		CoreReturnObject returnObject = null;
		if(StringTool.isNullOrEmpty(BATCHEDNO) && StringTool.isNullOrEmpty(BATCH_GROUD_NO))
		{
			returnObject = this.getDataBySqlID("MaterialChoose.queryGPLOCKLIKU", new Object[]{JUDGE_STOVE_NO,PRO_PLAN_ID,GX_PLAN_NO});
		}
		else {
			returnObject = this.getDataBySqlID("MaterialChoose.queryLOCKLIKU", new Object[]{JUDGE_STOVE_NO,BATCHEDNO,BATCH_GROUD_NO,PRO_PLAN_ID,GX_PLAN_NO});
		}
		return returnObject;
	}
	
	public CoreReturnObject querylockliku(String JudgeStoveNo,String ProPlanId,String GxPlanNo) {
		CoreReturnObject returnObject = null;
		returnObject = this.getDataBySqlID("MaterialChoose.queryGPLOCKLIKU", new Object[]{JudgeStoveNo,ProPlanId,GxPlanNo});
		return returnObject;
	}
	
}
