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

import market.Mes.Lengthwise.Performance.vo.MesCrSlittingWrkSum;
import market.Mes.Lengthwise.Performance.vo.MesPrdDetailReport;
import market.Mes.Tpm.vo.MesTpmD;
import market.Mes.Tpm.vo.MesTpmM;
import market.Mes.Tpm.vo.PlnSkinRollingView;
import market.Mes.Tpm.vo.TpmPrintView;

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

import com.hnshituo.orm.GenericMapper;

@SuppressWarnings("rawtypes")
public interface MesTpmMMapper extends GenericMapper<MesTpmM,Object> {

	List<PlnSkinRollingView> doQueryWeb(String memo1);

	List<MesCrSlittingWrkSum> doQueryWrkWeb(String memo1, String memo2, String memo3, String memo4);

	List<PlnSkinRollingView> doQueryWeb2(String memo1, String startTime, String endTime,
			String memo2, String memo3);

	List<MesTpmM> doQueryWeb3(String memo1, String memo2, String memo3);

	//Integer doQueryWeb4(String v_coil_no);//2019-03-13

	void doDelete(String memo1, String sr_plan_no, String object_no_vt,
			String material_no);

	Integer doCount1(String v_rejected_coil_no, String schedule_no,
			String material_no_vt, String material_no);

	void doUpdate(MesTpmM mcm);

	@Update(" update MES_TPM_M set material_no_vt = #{material_no_vt} where material_no = #{material_no}")
	void updatebymaterial_no(MesTpmM mcd);

	void doUpdate2(MesTpmM mes);

	void doUpdate3(MesTpmM mes);

	List<TpmPrintView> doQueryPrint1(String sr_plan_no, String object_no_vt,
			String object_no_vt2);

	List<TpmPrintView> doQueryPrint2(String sr_plan_no, String object_no_vt,
			String object_no_vt2);

	List<TpmPrintView> doQueryPrint3(String sr_plan_no, String object_no_vt,
			String object_no_vt2);

//	Integer doQueryWeb5(String v_coil_no, String sr_plan_no,
//			String entry_coil_no);

	void doDelete1(String sr_plan_no, String entry_coil_no);

	Integer doCount2(String v_reject_coil_no, String schedule_no,
			String material_no);

	@Select("select to_char(to_date(#{tc_time}, 'yyyymmdd'),  'yyyy-mm-dd') from dual ")
	String doQueryDate(String tc_time);

	List<HashMap> doQueryMesCrWeb1(int i, int j, MesTpmD mesTpmD,
			String startTime, String endTime, String swhere, String memo2);

	List<HashMap> doQueryMesCrWeb2(int i, int j, MesTpmD mesTpmD,
			String startTime, String endTime, String swhere, String memo2);

	long doQueryMesCrWebCount1(MesTpmD mesTpmD, String startTime,
			String endTime, String memo2, String swhere);

	List<HashMap> doQueryMesCrWeb1_mat(int i, int j, String swhere);

	List<HashMap> doQuerygejizuWeb(String startTime, String endTime, String string, String string2);

	List<TpmPrintView> doQueryPrint4(String sr_plan_no, String object_no_vt,
			String material_no);
	List<TpmPrintView> doQueryPrint5(String sr_plan_no, String object_no_vt,
			String material_no);
	List<TpmPrintView> doQueryPrint6(String sr_plan_no, String object_no_vt,
			String material_no);

	List<HashMap> doProductionWrkReport(MesTpmM object);

	List<HashMap> doProductionSteelReport(MesTpmM object);

	List<MesPrdDetailReport> doPrdDetailWeb_tpm(MesPrdDetailReport object, String memo1,
			String startTime, String endTime, String startTime2,
			String endTime2, String memo2, String memo3, String memo4,
			String memo5);

	List<HashMap> doQueryWebTrc(String memo1, String memo2);

	List<HashMap> doQueryWeb_zhiliang(MesTpmM mes, String startTime,
			String endTime, String string, String string2);

	List<HashMap> doQueryWeb_gejizu2(String startTime, String endTime, String string, String string2);
	
	//20201125 获取所有平整子卷重量
	@Select("select sum(t.coil_act_wgt) from mes_tpm_d t where t.schedule_no = #{schedule_no} and t.material_no = #{material_no}")
	public Double doQueryMesTpmDSumWgt(@Param("schedule_no")String schedule_no,@Param("material_no")String material_no);
	
	
	@Select("select m.material_no from mes_tpm_m m left join mes_tpm_d d on m.schedule_no = d.schedule_no and m.material_no = d.material_no where d.COIL_NO = #{coilNo}")
	String findM (@Param("coilNo") String coilNo);
	
	@Select("select * from MES_TPM_D where COIL_NO = #{coilNo}")
	MesTpmD findD (@Param("coilNo") String coilNo);
	
}
