package market.Mes.Lengthwise.Plan.mapper;
import java.util.HashMap;
import java.util.List;

import market.Mes.Cuttolength.Plan.vo.CommentDetialAndCuttD;
import market.Mes.Lengthwise.Plan.vo.MesCrCrossCuttingD;
import market.Mes.Lengthwise.Plan.vo.MesCrCrossCuttingM;
import market.Mes.Lengthwise.Plan.vo.PlnMaterielDetail;

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

import com.hnshituo.orm.GenericMapper;

public interface MesCrCrossCuttingDMapper extends GenericMapper<MesCrCrossCuttingD,Object> {
	
	Integer findByProcessNo(@Param("processNo")String processNo);
	
	Integer findByPackingNo(@Param("packNo")String PackingNo);
	
	MesCrCrossCuttingD findAllByPackingNo(@Param("packNo")String PackingNo);
	
	void deleteByProcessNo(String ProcessNo);
	
	//修改板垛相关重量
	int updateCuttingD(@Param("vWgtSort")String vWgtSort,@Param("vWgtValue")String vWgtValue,
			@Param("vOprname")String vOprname,@Param("vPackingNo")String vPackingNo,@Param("serialNo")String v_serial_no);
	
	//查询标签信息
	MesCrCrossCuttingD  findAllByLabel(String PackingNo);
	
	//逐一循环板垛实绩
	List<MesCrCrossCuttingD> FindMescrcrDByprocessNo(String process_no);
	
	List<MesCrCrossCuttingD> FindMescrcrDByprocessNo1(String process_no);
	//挂单
	int  UpdateBypackingNo(CommentDetialAndCuttD d, String string);	
	//脱单
	int  UpdateBypackingNo2(CommentDetialAndCuttD d, String string);	
	
	
	//调用物流模块接口，逐一删除各板垛库存实绩（接口由物流模块提供）； 
	List<MesCrCrossCuttingD> findAllCuttingD(String process_no);
	
	//清空所有板垛实绩的虚拟板垛号、生产订单号、订单号信息
	int updateCuttingDAll(String username,String process);
	int updateCuttingDAll2(String username,String process);
	
	
	//修改板垛实绩记录
	int updateMescrcrossD(MesCrCrossCuttingD d,String username,String vpackNo);
	
	//
	Integer doQuery(String process, String v_packing_no);
	
	//insert
	//插入板垛实绩记录(批量新增)
	int doinsweb(PlnMaterielDetail cur,MesCrCrossCuttingM v_rec_ccm,String vOprname,String v_packing_no, String v_packing_ext);
	//doinsert2
	//插入板垛实绩记录(新增)
	int doinsweb2(String planNo,MesCrCrossCuttingM v_rec_ccm,PlnMaterielDetail v_rec_pmd,String name, String v_packing_no_ext);

//	List<MesCrCrossCuttingD> doQueryPrint(HashMap<String, Object> param);
//
//	List<MesCrCrossCuttingD> doQueryPrint1(HashMap<String, Object> param);

	List<MesCrCrossCuttingD> doQueryPrint(List<String> strList, String string);

	List<MesCrCrossCuttingD> doQueryPrint1(List<String> strList, String string);

	List<MesCrCrossCuttingD> doQueryMes(String process_no, String string);

	void updateMdd(Double v_sum, String string);

	void updateMdd1(Double v_sum, String packing_no);

	void updateD(String process_no, String vWrkDate, String vWrkOrd,
			String vWrkGrp);

	Integer doQuery2(String string, String v_packing_no);

	List<HashMap> doQueryMesCrWeb1(int i, int j, MesCrCrossCuttingD object,
			String startTime, String endTime,@Param("swhere") String swhere, String string);

	List<HashMap> doQueryMesCrWeb2(int i, int j, MesCrCrossCuttingD object,
			String startTime, String endTime,@Param("swhere") String swhere, String string);
	List<HashMap>doQueryMesCrWeb3(int i, int j, MesCrCrossCuttingD object,
					String startTime, String endTime,@Param("swhere") String swhere);
			List<HashMap> doQueryMesCrWeb4(int i, int j, MesCrCrossCuttingD object,
					String startTime, String endTime,@Param("swhere") String swhere);

	long doQueryMesCrWebCount1(MesCrCrossCuttingD object, String startTime,
					String endTime, String string, String swhere);

	List<HashMap> doQueryMesCrWeb1_mat(int i, int j, String swhere);
	
	@Select("select m.material_no from mes_cr_cross_cutting_m m left join mes_cr_cross_cutting_d d on m.process_no = d.process_no where d.PACKING_NO = #{coilNo}")
	String findM (@Param("coilNo") String coilNo);
	
	@Select("select * from MES_CR_CROSS_CUTTING_D where PACKING_NO = #{coilNo}")
	MesCrCrossCuttingD findD(@Param("coilNo") String coilNo);
	
}
