package market.Qms.metallurgy.mapper;
import java.util.List;

import market.Qms.metallurgy.vo.ComMsc;
import market.Qms.metallurgy.vo.ComMscStdCic;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.hnshituo.orm.GenericMapper;
public interface ComMscStdCicMapper extends  GenericMapper<ComMscStdCic, String> {
	
	@Select("select 'CICN'||to_char(nvl(max(to_number(substr(c.cic,-6))),0)+1,'fm099999') from  com_msc_std_cic c WHERE SUBSTR (cic, 0, 4) ='CICN'")
	public String getMaxNo();
	
	@Select("select 'CICG'||to_char(nvl(max(to_number(substr(c.cic,-6))),0)+1,'fm099999') from  com_msc_std_cic c WHERE SUBSTR (cic, 0, 4) ='CICG'")
	public String getmaxNOs();
	
	public List<ComMscStdCic> doFind(String param1);
	public List<ComMsc> findAll(String param);
	
	/**
	 * 根据msc作废
	 */
	public void doMscZf(String msc);
	
	/**
	 * 根据msc恢复
	 */
	public void doMscHf(String msc);
	
	@Update("update COM_MSC_STD_CIC a set a.validflag='2' where a.msc=#{msc} and validflag!=0")
	public void Submission(@Param("msc")String msc);
	
	@Update("update COM_MSC_STD_CIC a set a.validflag='3' where a.msc=#{msc} and validflag!=0")
	public void Submit(@Param("msc")String msc);
	
	@Update("update COM_MSC_STD_CIC a set a.validflag='1' where a.msc=#{msc} and validflag!=0")
	public void SubmitA(@Param("msc")String msc);
	
	@Update("UPDATE COM_MSC_STD_CIC SET DELETE_NAME = NULL,DELETE_TIME=NULL,VALIDFLAG=1 WHERE CIC =#{cic}")
	public void updatef(@Param("cic")String cic);
	
	public List<ComMscStdCic> doFindCic(@Param("msc")String msc,@Param("psc")String psc,@Param("val")String val);
	
	
	public List<ComMscStdCic> doFindCicByzl(ComMscStdCic cic);
	
	public List<ComMscStdCic> doFindCicBySql(String process_code,String customer_code,String prod_code_nk,String steel_code_nk,String delivery_state_code);

	public List<ComMscStdCic> findByPage(String validflag, String prod_code_nk, String steel_code_nk,
			String delivery_state_code, String std_code_nk, String std_type, Integer pageSize, Integer pageIndex);
	
	public List<ComMscStdCic> findByPageNk(String validflag, String prod_name_nk, String steel_name_nk,
			String delivery_state_desc, String process_desc, String grade_name, String customer_name, String std_type,
			Integer pageSize, Integer pageIndex);
}