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

import market.Com.vo.ComPsc;
import market.Qms.metallurgy.vo.ComMsc;

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 ComMscMapper extends GenericMapper<ComMsc,Object> {
	
	/**
	 * 查询msc与客户
	 * @param msc
	 * @param custCode
	 * @return
	 */
	Integer doFindMscByCust(String msc,String custCode);
	
	List<ComMsc> doFindMsc(String code,String val,String msc);
	
	List<ComPsc> doFindPsc(String prodname,String steelname,String stdname,String psc,String msc);
	List<ComPsc> dofindmsc(@Param("param1")String param1);
	
	List<String> doFindLine(String id);
	
	@Select("select 'MSC'||to_char(nvl(max(to_number(substr(a.msc,-5))),0)+1,'fm0000009999') from  COM_PSC_R_MSC a where a.psc=#{psc} ")
	public String GetMaxNo(@Param("psc")String psc);
	
	@Update("update com_msc a set a.validflag='B' where a.msc=#{msc}")
	public void Submission (@Param("msc") String msc);
	
	@Update("update com_msc a set a.validflag='C',remark=#{remark} , audit_time=sysdate ,audit_name =#{audit_name_nk}  where a.msc=#{msc} ")
	public void Submit (@Param("msc") String msc,@Param("remark")String remark,@Param("audit_name_nk")String audit_name_nk);
	
	@Update("update com_msc a set a.validflag='A', remark=#{remark} , audit_time=sysdate ,audit_name =#{audit_name_nk} where a.msc=#{msc} and validflag!='D'")
	public void SubmitA (@Param("msc") String msc,@Param("remark")String remark,@Param("audit_name_nk")String audit_name_nk);
	
	@Update("update com_msc a set a.validflag='E' where a.msc=#{msc}")
	public void SubmitE (@Param("msc") String msc);
	
}
