package market.Qms.metallurgy.mapper;

import java.util.List;

import market.Qms.metallurgy.vo.ComMscStdSpec;

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 ComMscStdSpecMapper extends GenericMapper<ComMscStdSpec, String> {
    /**
     * 获得最大编号
     * @return
     */
	@Select("select 'SICN'||to_char(nvl(max(to_number(substr(t.sic,-6))),0)+1,'fm099999') from  com_msc_std_spec t WHERE SUBSTR (sic, 0, 4) ='SICN'")
	public String getMax();
	
	@Select("select 'SICG'||to_char(nvl(max(to_number(substr(t.sic,-6))),0)+1,'fm099999') from  com_msc_std_spec t WHERE SUBSTR (sic, 0, 4) ='SICG'")
	public String getMaxs();
	
	@Update("UPDATE COM_MSC_STD_SPEC SET VALIDFLAG = 1,DELETE_NAME = NULL,DELETE_TIME = NULL WHERE SIC = #{sic}")
	public void updates(@Param("sic") String sic);
	
	@Update("UPDATE COM_MSC_STD_SPEC_C SET VALIDFLAG = 1,DELETE_NAME = NULL,DELETE_TIME = NULL WHERE SIC = #{sic} AND INDEX_SEQ = #{index}")
	public void updatec(@Param("sic") String sic,@Param("index") Integer index);
	
	@Update("  update COM_MSC_STD_SPEC a set a.validflag=0 where a.msc=#{msc}")
	public void updateMscZf(@Param("msc") String msc);
	
	@Update("  update COM_MSC_STD_SPEC a set a.validflag=1 where a.msc=#{msc}")
	public void updateMscHf(@Param("msc") String msc);
	
	@Update("  update COM_MSC_STD_SPEC a set a.validflag=2 where a.msc=#{msc} and validflag!=0")
	public void Submission(@Param("msc") String msc);
	
	@Update("  update COM_MSC_STD_SPEC a set a.validflag=3 where a.msc=#{msc} and validflag!=0")
	public void Submit(@Param("msc") String msc);
	
	@Update("  update COM_MSC_STD_SPEC a set a.validflag=1 where a.msc=#{msc} and validflag!=0")
	public void SubmitA(@Param("msc") String msc);
	
	public List<ComMscStdSpec> doFinidSpec(@Param("msc")String msc,@Param("psc")String psc,@Param("val")String val);

	public List<ComMscStdSpec> doFindSicByzl(ComMscStdSpec sic);
	
	public List<ComMscStdSpec> doFindSpecBySql(String process_code,String customer_code,String prod_code_nk,String steel_code_nk,String delivery_state_code);

	public List<ComMscStdSpec> doFindSpecBySql(String process_code,String customer_code,String prod_code_nk,String steel_code_nk,String delivery_state_code, String precisiconTypeCode);

	public List<ComMscStdSpec> findByPage(String validflag, String prod_code_nk, String steel_code_nk,
			String delivery_state_code, String std_code, String std_type, Object object, Object object2);
	public List<ComMscStdSpec> findByPageNk(String validflag, String prod_name_nk, String steel_name_nk,
			String delivery_state_desc, String process_desc, String customer_name, String std_type,
			String precisicon_type_desc, Integer pageSize, Integer pageIndex);
}