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

import market.Qms.metallurgy.vo.ComMscBacklog;

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 ComMscBacklogMapper extends GenericMapper<ComMscBacklog,Object> {
	@Select("select to_char(nvl(max(to_number(substr(a.msc_pline,-6))),0)+1,'fm099999') from  COM_MSC_BACKLOG a where a.msc=#{msc}")
	public String GetMaxNo(String msc);
	
	public void UpdateLoG(ComMscBacklog log);
	
	@Update("update COM_MSC_BACKLOG a set a.validflag='2' where a.msc=#{msc} and validflag!=0")
	public void Submission(@Param("msc") String msc);
	
	@Update("update COM_MSC_BACKLOG a set a.validflag='3' where a.msc=#{msc} and validflag!=0")
	public void Submit(@Param("msc") String msc);
	
	@Update("update COM_MSC_BACKLOG a set a.validflag='1' where a.msc=#{msc} and validflag!=0")
	public void SubmitA(@Param("msc") String msc);
	
	@Update("update COM_MSC_BACKLOG a set a.validflag='0' where a.msc=#{msc}")
	public void SubmitD(@Param("msc") String msc);
	
	@Update("update COM_MSC_BACKLOG a set a.validflag='0' where a.msc=#{msc} and msc_pline=#{msc_pline}")
	public void UpdateZf(@Param("msc") String msc,@Param("msc_pline")String msc_pline);
	
	@Update("update COM_MSC_BACKLOG a set a.validflag='1' where a.msc=#{msc} and msc_pline=#{msc_pline}")
	public void UpdateHf(@Param("msc") String msc,@Param("msc_pline")String msc_pline);
	
	public List<ComMscBacklog> doFindZc(@Param("msc")String msc,@Param("val")String val);
	
	@Update("update COM_MSC_BACKLOG  set DELIVERY_STATE_CODE=null where msc=#{msc} and msc_pline=#{msc_pline}")
	public void UpdateDelivery(@Param("msc") String msc,@Param("msc_pline")String msc_pline);
}
