package market.Qms.metallurgy.mapper;

import java.util.List;

import market.Qms.metallurgy.vo.ComMscStdDetection;

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 ComMscStdDetectionMapper extends GenericMapper<ComMscStdDetection, Object> {
    /**
     * 获得最大编号
     * @return
     */
	@Select("select 'DICN'||to_char(nvl(max(to_number(substr(t.dic,-6))),0)+1,'fm099999') from  com_msc_std_detection t WHERE SUBSTR (dic, 0, 4) ='DICN'")
	public String getMax();
	
	@Select("select 'DICG'||to_char(nvl(max(to_number(substr(t.dic,-6))),0)+1,'fm099999') from  com_msc_std_detection t WHERE SUBSTR (dic, 0, 4) ='DICG'")
	public String getMaxs();
	
	@Update("UPDATE COM_MSC_STD_DETECTION SET VALIDFLAG =1,DELETE_NAME = NULL,DELETE_TIME = NULL WHERE dic =#{dic}")
	public void updatec(@Param("dic") String dic);
	
	@Update("update COM_MSC_STD_DETECTION a set a.validflag=0 where a.msc=#{msc}")
	public void updateZf(@Param("msc") String msc);
	
	@Update("update COM_MSC_STD_DETECTION a set a.validflag=1 where a.msc=#{msc}")
	public void updateHf(@Param("msc") String msc);
	
	@Update("update COM_MSC_STD_DETECTION a set a.validflag=2 where a.msc=#{msc} and validflag!=0")
	public void Submission(@Param("msc") String msc);
	
	@Update("update COM_MSC_STD_DETECTION a set a.validflag=3 where a.msc=#{msc} and validflag!=0")
	public void Submit(@Param("msc") String msc);
	
	@Update("update COM_MSC_STD_DETECTION a set a.validflag=1 where a.msc=#{msc} and validflag!=0")
	public void SubmitA(@Param("msc") String msc);
	
	public List<ComMscStdDetection> doFindDetection(@Param("msc")String msc,@Param("psc")String psc,@Param("val")String val);

	public List<ComMscStdDetection> doFindDicByzl(ComMscStdDetection dic);
	
	public List<ComMscStdDetection> doFindDeteBySql(String process_code,String customer_code,String prod_code_nk,String steel_code_nk,String delivery_state_code);

	public List<ComMscStdDetection> 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<ComMscStdDetection> findByPageNk(String validflag, String prod_name_nk, String steel_name_nk,
			String delivery_state_desc, String process_desc, String customer_name, String std_type, Integer pageSize,
			Integer pageIndex);
}