package market.Mes.MaterielTrack.mapper;
import java.util.HashMap;
import java.util.List;

import market.Api.Mes.impl.Judge_Prc_Info;
import market.Mes.MaterielTrack.vo.PrcMaterielProcess;

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

import com.hnshituo.orm.GenericMapper;

public interface PrcMaterielProcessMapper extends GenericMapper<PrcMaterielProcess,Object> {

	List<PrcMaterielProcess> doQuery(PrcMaterielProcess pmp);

	List<PrcMaterielProcess> doQueryAry(PrcMaterielProcess pmp);

	List<HashMap> doFindFather(String object_no);

	List<HashMap> doFindBrother(String object_no);

	List<HashMap> doFindSon(String object_no);

	List<PrcMaterielProcess> doFindByObjAndPrc(PrcMaterielProcess pmp);

	List<PrcMaterielProcess> doQueryAry1(PrcMaterielProcess pmp);

	List<Judge_Prc_Info> findMatInfo(@Param("object_no")String object_no);
	
	@Select("select * from PRC_MATERIEL_PROCESS where CREATE_TIME >= to_timestamp(#{startTime}, 'yyyy-MM-dd HH24:mi:ss') and CREATE_TIME <= to_timestamp(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')")
	List<PrcMaterielProcess> queryProcessPerF (@Param("startTime")String startTime, @Param("endTime")String endTime);
	
	@Select("select * from PRC_MATERIEL_PROCESS where OBJECT_NO like concat(concat('%',#{coilNo}),'%') order by CREATE_TIME")
	List<PrcMaterielProcess> queryProcessByCoil(@Param("coilNo")String coilNo);
	
	@Select("select '优特钢' as FACTORY, COIL_NO as INVID, CHARGE_TIME as FROMTIME, DISCHARGE_TIME as TOTIME, 'YTTH' as WORKID from MES_CR_ANNEAL_M where CHARGE_TIME >= to_date(#{startTime}, 'yyyy-MM-dd HH24:mi:ss') and DISCHARGE_TIME <= to_date(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')")
	List<HashMap> queryTHProd (@Param("startTime")String startTime, @Param("endTime")String endTime);
	
	@Select("select '优特钢' as FACTORY, d.COIL_NO as INVID, m.TP_STR_TIME as FROMTIME, m.TP_END_TIME as TOTIME, 'YTZZ' as WORKID from MES_RCM_M m left join mes_rcm_d d on m.process_no = d.process_no where m.TP_STR_TIME >= to_date(#{startTime}, 'yyyy-MM-dd HH24:mi:ss') and m.TP_END_TIME <= to_date(#{endTime}, 'yyyy-MM-dd HH24:mi:ss')")
	List<HashMap> queryZZProd (@Param("startTime")String startTime, @Param("endTime")String endTime);
	
	
}
