/***文档注释***********************************************
 * 作者            ：      易鑫
 * 创建日期     ：2018-02-6
 * 描述            ：成分实绩信息表
 * 注意事项     ：
 * 遗留BUG   ：
 * 修改日期     ：
 * 修改人员     ：
 * 修改内容     ：
***********************************************************/
package market.Qms.qcm.service.impl;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import javax.script.ScriptException;

import market.Com.impl.PbModelDbServiceImpl;
import market.Com.mapper.ComBasePhyMapper;
import market.Com.vo.ComBasePhy;
import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Lms.Warehouse.vo.IfRawMtrCoilM;
import market.Lms.Warehouse.vo.IfRawMtrCoilPfmc;
import market.Lms.Warehouse.vo.YdmProductDetail;
import market.Qms.common.DataHelper;
import market.Qms.qcm.mapper.QcmChemResultMapper;
import market.Qms.qcm.mapper.QcmJhyElementsMapper;
import market.Qms.qcm.mapper.QcmJhySampleConsignDMapper;
import market.Qms.qcm.mapper.QcmJhySampleROrdMapper;
import market.Qms.qcm.mapper.QcmJudgeChemicalMapper;
import market.Qms.qcm.mapper.QcmJudgePhysicalUtmDMapper;
import market.Qms.qcm.mapper.QcmPhyJudgeResultMapper;
import market.Qms.qcm.service.QcmJhyElementsService;
import market.Qms.qcm.vo.QcmChemResult;
import market.Qms.qcm.vo.QcmJhyElements;
import market.Qms.qcm.vo.QcmJhySampleConsignD;
import market.Qms.qcm.vo.QcmJhySampleROrd;
import market.Qms.qcm.vo.QcmJudgeChemical;
import market.Qms.qcm.vo.QcmJudgePhysicalUtmD;
import market.Qms.qcm.vo.QcmPhyJudgeResult;
import market.Qms.slmord.impl.SlmOrdDesignStdCicServiceImpl;
import market.Qms.slmord.vo.OrdJudgeStd;
import market.Qms.slmord.vo.SlmOrdDesignStdCic;

import com.hnshituo.basic.service.impl.BaseServiceImpl;
import com.hnshituo.basic.service.support.PageModel;
import com.hnshituo.basic.spring.remoting.annotation.RemoteService;

@RemoteService(path="QcmJhyElementsService")
public class QcmJhyElementsServiceImpl extends BaseServiceImpl<QcmJhyElements, String> implements QcmJhyElementsService {
	
	/**
	 * 创建成分判定记录
	 * @param listEle 成分检验信息
	 * @param sampleOrd 判定数据源
	 * @param pass 是否合格
	 * @return
	 */
	public QcmJudgeChemical CreateJudgeRecord(List<QcmJhyElements> listEle,QcmJhySampleROrd sampleOrd,boolean pass)
	{
		String proAssaynos="",semiAssaynos="";//成品化验号、熔炼化验号
		for (QcmJhyElements qcmJhyElements : listEle) {
			if(qcmJhyElements.getAssay_type().equals("L")){
				semiAssaynos+=","+qcmJhyElements.getAssay_no();
			}else{
				proAssaynos+=","+qcmJhyElements.getAssay_no();
			}
		}
		QcmJudgeChemical judge=new QcmJudgeChemical();
		int count=0;
		SimpleDateFormat sdf=new SimpleDateFormat("yyMMdd");
		String date=sdf.format(new Date());
//		获取材质结果集编号最大值
		List<QcmJudgeChemical> qrlist=this.getMapper(QcmJudgeChemicalMapper.class)
				.findWithCondition(null, "cic_id like 'C"+date+"%'", "cic_id DESC", 0, 1);
		if(qrlist!=null&&qrlist.size()>0){
			String s=qrlist.get(0).getCic_id();
			count=Integer.parseInt(s.substring(s.length()-4, s.length()));
		}
		count++;
		String cic_id="C"+sdf.format(new Date())+String.format("%04d",count);
		judge.setCic_id(cic_id);
		judge.setAssay_no_cp(proAssaynos.replaceFirst(",",""));
		judge.setAssay_no_rl(semiAssaynos.replaceFirst(",",""));
		judge.setBatch_no(sampleOrd.getBatch_no());
		judge.setCic_memo("系统自动判定");
		judge.setCic_result_code(pass?"40740101":"40740102");
		judge.setCic_result_desc(pass?"合格":"不合格");
		judge.setContract_line_no(sampleOrd.getContract_line_no());
		judge.setDesign_key(sampleOrd.getDesign_key());
		judge.setHeat_no(sampleOrd.getHeat_no());
		judge.setInspection_lot(sampleOrd.getInspection_lot());
		judge.setJudge_name("System");
		judge.setJudge_ttime(new Date());
		judge.setPline_code(listEle.get(0).getPline_code());
		judge.setPline_name(listEle.get(0).getPline_name());
		judge.setPsc(sampleOrd.getPsc());
		judge.setSmp_no(sampleOrd.getSmp_no());
		return judge;
	}
	
	/**
	 * 成分自动判定实现
	 * @return
	 * @throws ScriptException 
	 */
	@Override
	public void AutoJudge() throws Exception{
			//获取未判定的初样数据
			String condition=" d.Smp_type_code='409801' and Judge_status='0'";
			List<QcmJhySampleROrd> listOrd=this.getMapper(QcmJhySampleROrdMapper.class).GetSampleChemInfo(condition);
			QcmJhySampleConsignDMapper consignDMapper=this.getMapper(QcmJhySampleConsignDMapper.class);
			QcmJhySampleConsignD _consignD=new QcmJhySampleConsignD();
			for (QcmJhySampleROrd qcmJhySampleROrd : listOrd) {
				//获取取样编号
				_consignD.setSmp_no(qcmJhySampleROrd.getSmp_no());
				_consignD.setInspection_lot(qcmJhySampleROrd.getInspection_lot());
				_consignD.setHeat_no(qcmJhySampleROrd.getHeat_no());
				List<QcmJhySampleConsignD> listConsignD=consignDMapper.find(_consignD, 0, 0);
				//上面listConsignD 只会查出一条数据，如果有多条数据需要跟设计确认是如何进行关联的
				
				//根据取样编号查询检验实绩信息
				CommonPage<QcmJhyElements> com=new CommonPage<>();
				QcmJhyElements _ele=new QcmJhyElements();
				_ele.setSpecimen_no(listConsignD.get(0).getSpecimen_no());
				com.setObject(_ele);
				ResultModel rm=GetElementsInfo(com);
				List<QcmJhyElements> listEle=(List<QcmJhyElements>)rm.getData();
				if(listEle.size()<1){
					continue;
				}
				
				//查询判定标准，最后一个参数需要调用生产计划相关接口获取当前使用的制程号
				ResultModel cicModel=this.getBean(SlmOrdDesignStdCicServiceImpl.class).GetOrdJudgeStdCic(qcmJhySampleROrd.getDesign_key(), qcmJhySampleROrd.getPsc(),listConsignD.get(0).getPline_code(), "000001");
				OrdJudgeStd<SlmOrdDesignStdCic> stdCic=(OrdJudgeStd<SlmOrdDesignStdCic>)cicModel.getData();
				
				//开始判定：内控>客户>交付，//2018-06-05 去掉‘出现不合格则停止继续对比’改为‘判内控还有交付、客户一起判，存两套结果’
				boolean pass=true;
				if(!stdCic.isNkQuote()&&stdCic.getListStdNK().size()>0){
					pass=CompareResult(stdCic.getListStdNK(),listEle);
					UpdateData(listEle, qcmJhySampleROrd, pass);
				}
				//判定客户、交付标准
				if(stdCic.getListStdGB().size()>0){
					if (stdCic.getListStdKH()!=null&&pass) {
						pass=CompareResult(stdCic.getListStdKH(),listEle);
					}
					if(pass){
						pass=CompareResult(stdCic.getListStdGB(),listEle);
					}
					UpdateData(listEle, qcmJhySampleROrd, pass);
				}
				for (QcmJhyElements q : listEle) {
					if (q.getAssay_no()!=null&&!q.getAssay_no().equals("")) {
						String qrm = this.getMapper(QcmChemResultMapper.class).getsample(q.getAssay_no());
						if(qrm!=null&&!qrm.equals("")) {
							continue;
						}
					}
				  QcmChemResult qcr=new QcmChemResult();
				  qcr.setAssay_no(q.getAssay_no());
				  qcr.setChem_code(q.getChem_code());
				  qcr.setChem_name(q.getChem_name());
				  qcr.setChem_value(q.getChem_value());
				  qcr.setCreate_name(q.getCreate_name());
				  this.getMapper(QcmChemResultMapper.class).insert(qcr);
				}
			}
	}
	
	/**
	 * 新增判定记录
	 * @param listEle
	 * @param qcmJhySampleROrd
	 * @param pass
	 */
	public void UpdateData(List<QcmJhyElements> listEle,QcmJhySampleROrd qcmJhySampleROrd,boolean pass){
		QcmJudgeChemical chemical=CreateJudgeRecord(listEle, qcmJhySampleROrd, pass);
		this.getMapper(QcmJudgeChemicalMapper.class).insert(chemical);
		//修改委托为已判定
		QcmJhySampleROrd ord=new QcmJhySampleROrd();
		ord.setSmp_no(chemical.getSmp_no());
		ord.setContract_line_no(chemical.getContract_line_no());
		ord.setPsc(chemical.getPsc());
		ord.setJudge_status("1");
		ord.setAssay_no_rl(chemical.getAssay_no_rl());
		ord.setAssay_no_cp(chemical.getAssay_no_cp());
		ord.setJudge_memo(chemical.getCic_memo());
		ord.setJudge_name(chemical.getJudge_name());
		ord.setJudge_time(chemical.getJudge_ttime());
		ord.setJudge_result_code(chemical.getCic_result_code());
		ord.setJudge_result_desc(chemical.getCic_result_desc());
		this.getMapper(QcmJhySampleROrdMapper.class).update(ord);
	}
	
	/**
	 * 获取对比结果 
	 * @param stdCic 标准数据
	 * @param listEle 检验数据
	 * @return 
	 */
	public boolean CompareResult(List<SlmOrdDesignStdCic> stdCic,List<QcmJhyElements> listEle)  throws ScriptException{
		for (SlmOrdDesignStdCic cic : stdCic) {
			if(cic.getIsjudge().equals("0")){
				continue;
			}
			if(cic.getComplex_type().equals("1")){ //复合元素
				String express=cic.getChem_formula();
				for (QcmJhyElements qcmJhyElements : listEle) {
					express=express.replaceAll(qcmJhyElements.getChem_name(), qcmJhyElements.getChem_value());
				}
				double result=DataHelper.GetFormulaResult(express);
				boolean pass=DataHelper.checkSignAndValue(cic.getStdmax_sign(),DataHelper.GetDouble(cic.getStdmax()),DataHelper.GetString(result));
				if(!pass){
					return false;
				}
				pass=DataHelper.checkSignAndValue(cic.getStdmax_sign(),DataHelper.GetDouble(cic.getStdmax()),DataHelper.GetString(result));
				if(!pass){
					return false;
				}
				continue;
			}

			for (QcmJhyElements ele : listEle) {
				if(ele.getChem_code().equals(cic.getChem_code())){
					boolean pass=DataHelper.checkSignAndValue(cic.getStdmax_sign(),DataHelper.GetDouble(cic.getStdmax()),ele.getChem_value());
					if(!pass){
						return false;
					}
					pass=DataHelper.checkSignAndValue(cic.getStdmin_sign(),DataHelper.GetDouble(cic.getStdmin()),ele.getChem_value());
					if(!pass){
						return false;
					}
					break;
				}
			}
		}
		return true;
	}
	
	
	/**
	 * 获取成分检验实绩信息
	 * @param com
	 * @return
	 */
	public ResultModel GetElementsInfo(CommonPage<QcmJhyElements> com){
		ResultModel rm=new ResultModel("200","获取数据成功");
		try{
			QcmJhyElements ele=com.getObject();
			//"length(chem_name) desc" 这个排序对复合元素计算有用，慎重更改
			List<QcmJhyElements> listEle=this.getMapper(QcmJhyElementsMapper.class).findWithCondition(ele, null, "length(chem_name) desc", 0, 0);
			rm.setData(listEle);
		}catch(Exception ex){
			rm.setState("500");
			rm.setMsgInfo("获取成分检验信息出错");
			rm.setErrorInfo(ex.getMessage());
		}
		return rm;
	}
	/**
	 * 查询成分信息（化学元素动态加载）
	 * @param sum
	 * @return
	 */
	public List<ResultModel> getConponentInfo(CommonPage<QcmJhyElements> sum){
		List<ResultModel> listrm=new ArrayList<>();
		ResultModel rm=new ResultModel();
		ResultModel rm1=new ResultModel();
		listrm.add(rm);
		listrm.add(rm1);
		String con="1=1";
		List<String> str=new ArrayList<>();
		int pageIndex=sum.getPageIndex();
		int pageSize=sum.getPageSize();
		PageModel<QcmJhyElements> pm = new PageModel<QcmJhyElements>(pageIndex, pageSize);
		QcmJhyElements qje=sum.getObject();
		try {
			if (!DataHelper.IsNullOrSpace(qje.getMaterial_no())) {
				con+= " and material_no like '%"+qje.getMaterial_no()+"%'";
			}
			if (!DataHelper.IsNullOrSpace(qje.getHeat_no())) {
				con+= " and heat_no like '%"+qje.getHeat_no()+"%'";
			}
			if (!DataHelper.IsNullOrSpace(qje.getSteel_name())) {
				con+= " and steel_name like '%"+qje.getSteel_name()+"%'";
			}
			List<QcmJhyElements> listassay = this.getMapper(QcmJhyElementsMapper.class).findassay_no((pageIndex-1)*pageSize, (pageIndex-1)*pageSize+pageSize,con);
			List<QcmJhyElements> listassay1 = this.getMapper(QcmJhyElementsMapper.class).findassay_no1(con);
			List<QcmJhyElements> listqle=new ArrayList<>();
			for (QcmJhyElements s : listassay) {
				List<QcmJhyElements> listqle1 = this.getMapper(QcmJhyElementsMapper.class).findWithCondition(null, con+"and ASSAY_NO='"+s.getAssay_no()+"'", "create_time desc",0,0);
				for (QcmJhyElements qcmJhyElements : listqle1) {
					listqle.add(qcmJhyElements);
				}
			}
            pm.setRows(listqle);
            pm.setTotal(listassay1.size());
			List<String> liststr=new ArrayList<>();
            for (QcmJhyElements qle : listqle) {
		    	if (!str.contains(qle.getChem_name())) {
		    		liststr.add(qle.getChem_name());
		    		str.add(qle.getChem_name());
				}
			}
            rm1.setData(liststr);
		    rm.setState("200");
			rm.setData(pm);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			rm.setState("500");
			rm.setErrorInfo(e.getMessage());
		}
		return listrm;
	}
	/**
	 * 获取原料材质实绩信息
	 * @param sum
	 * @return
	 */
	public ResultModel getCoilMInfo(CommonPage<IfRawMtrCoilM> sum){
		ResultModel rm=new ResultModel();
		IfRawMtrCoilM ifrm=sum.getObject();
		PageModel<IfRawMtrCoilM> pm=new PageModel<>(sum.getPageIndex(), sum.getPageSize());
		try {
			String conn="1=1";
			if (!DataHelper.IsNullOrSpace(ifrm.getCoilNo())) {
				conn+=" and COIL_NO like'%"+ifrm.getCoilNo()+"%'";
			}
			if (!DataHelper.IsNullOrSpace(ifrm.getHeatno())) {
				conn+=" and heatno like '%"+ifrm.getHeatno()+"%'";
			}
			if (!DataHelper.IsNullOrSpace(ifrm.getSteelName())) {
				conn+=" and STEEL_CODE like '%"+ifrm.getSteelName()+"%'";
			}
			List<IfRawMtrCoilM> listifm = this.getBean(PbModelDbServiceImpl.class).getCoilMInfo(conn,(pm.getPageNumber()-1)*pm.getPageSize(),(pm.getPageNumber()-1)*pm.getPageSize()+pm.getPageSize());//select * from ( select temp.*, rownum row_num from ( SELECT COIL_NO,COIL_SOURCE,COIL_SORT,SUPPLIER_CODE,SUPPLIER_NAME,HEATNO,SMP_NO,PRD_CODE,PRD_NAME,STD_CODE,STD_NAME,STEEL_CODE,STEEL_NAME,COIL_THK,COIL_WDT,COIL_LEN,COIL_INN_DIA,COIL_OUT_DIA,COIL_THR_WGT,COIL_ACT_WGT,PRODUCE_TIME,FLAW_CODE1,FLAW_NAME1,FLAW_CODE2,FLAW_NAME2,FLAW_CODE3,FLAW_NAME3,FLAW_CODE4,FLAW_NAME4,FLAW_CODE5,FLAW_NAME5,CHEM_DEC_RST_CODE,CHEM_DEC_RST_NAME,SURFACE_DEC_RST_CODE,SURFACE_DEC_RST_NAME,SIZE_DEC_RST_CODE,SIZE_DEC_RST_NAME,PFMC_DEC_RST_CODE,PFMC_DEC_RST_NAME,WGT_DEC_RST_CODE,WGT_DEC_RST_NAME,TOTAL_DEC_RST_CODE,TOTAL_DEC_RST_NAME,STATUS,REMARK,CREATE_OPR,CREATE_TIME,CHEMID,PHYSID,ORDERNO,PRODORDERNO,ORD_NM,INSTR_COIL_THK,INSTR_COIL_WTH,DLIV_TP,TRANS_CAR_NO,PACKAGEL,DESTPCD FROM IF_RAW_MTR_COIL_M WHERE 1=1 ORDER BY PRODUCE_TIME ) temp where rownum <= 30) where row_num > 0 
            int count = this.getBean(PbModelDbServiceImpl.class).getCoilMInfocount(conn);
//			List<IfRawMtrCoilM> listifm = this.getMapper(IfRawMtrCoilMMapper.class).findWithCondition(null, conn, "PRODUCE_TIME", (pm.getPageNumber()-1)*pm.getPageSize(), pm.getPageSize());
//			int count = this.getMapper(IfRawMtrCoilMMapper.class).countWithCondition(null, null);
			pm.setRows(listifm);
			pm.setTotal(count);
			rm.setState("200");
			rm.setData(pm);
		} catch (Exception e) {
			// TODO: handle exception
			rm.setState("500");
			rm.setErrorInfo(e.getMessage());
			e.printStackTrace();
		}
		return rm;
	}
	/**
	 * 获取原材料实绩检验项目和实测值
	 * @param smp_no
	 * @return
	 */
	public ResultModel getCoilPfmcBySmp(String smp_no){
		ResultModel rm=new ResultModel();
		try {
			List<IfRawMtrCoilPfmc> listpfmc = this.getBean(PbModelDbServiceImpl.class).getCoilPfmcBySmp(smp_no);
//			List<IfRawMtrCoilPfmc> listpfmc =this.getMapper(IfRawMtrCoilPfmcMapper.class).getPfmcInfo(smp_no);
			rm.setData(listpfmc);
			rm.setState("200");
		} catch (Exception e) {
			// TODO: handle exception
			rm.setState("500");
			rm.setErrorInfo(e.getMessage());
		}
		return rm;
	}
	/**
	 * 查询质量跟踪接口（包含成分，材质，工艺信息）
	 * @param sum
	 * @return
	 */
	public List<ResultModel> getQualityInfo(CommonPage<YdmProductDetail> sum){
		List<ResultModel> listrm=new ArrayList<>();
		ResultModel rm=new ResultModel();
		ResultModel rm1=new ResultModel();
		listrm.add(rm);
		listrm.add(rm1);
		int pageIndex = sum.getPageIndex();
		int pageSize = sum.getPageSize();
		try {
			YdmProductDetail ypd=sum.getObject();
			List<String> str=new ArrayList<>();
			List<String> liststr=new ArrayList<>(); // 动态加载项
			
			String conn = "";
			if(!DataHelper.IsNullOrSpace(ypd.getCoilno())){
				conn += " and ypd.coilno like '%"+ypd.getCoilno()+"%'";
			}
			if (!DataHelper.IsNullOrSpace(sum.getMemo1())) {
				if ("C013".equals(sum.getMemo1())||"C014".equals(sum.getMemo1())
						||"C015".equals(sum.getMemo1())||"C017".equals(sum.getMemo1())) {
					//退火机组不新增产线查询条件，一次性查询所有的退火炉数据
					conn += " and cbm.pline_code in ('C013','C014','C015','C017')";
				}else {
					conn += " and cbm.pline_code = '"+sum.getMemo1()+"'";
				}				
			} 
			if (sum.getStartTime()!=null && !"".equals(sum.getStartTime())) {
				conn += " and ypd.producedate >= to_date('" + sum.getStartTime() + "','yyyy/mm/dd HH24:mi:ss')";
			}
			if (sum.getEndTime()!=null && !"".equals(sum.getEndTime())) {
				conn += " and ypd.producedate <= to_date('" + sum.getEndTime() + "','yyyy/mm/dd HH24:mi:ss')";
			}
			if (ypd.getDelivery_state_desc()!=null && !"".equals(ypd.getDelivery_state_desc())) {
				conn += " and ypd.delivery_state_desc like '%"+ypd.getDelivery_state_desc()+"%'";
			}
			if(!DataHelper.IsNullOrSpace(ypd.getSteel_name())){
				conn += " and cbs.steel_name like '%"+ypd.getSteel_name()+"%'";
			}
			//原料卷号
			if (!DataHelper.IsNullOrSpace(ypd.getMaterailcoilno())) {
				conn += " and ypd.materailcoilno like '%"+ypd.getMaterailcoilno()+"%'";
			}
			List<HashMap<String,String>> ypdList = null;
			if ("C013".equals(sum.getMemo1())||"C014".equals(sum.getMemo1())
					||"C015".equals(sum.getMemo1())||"C017".equals(sum.getMemo1())) {
				//退火
				ypdList = this.getMapper(QcmJhyElementsMapper.class).getQualityInfoForTH(conn,(pageIndex-1)*pageSize,pageSize*pageIndex);
			}else if ("C011".equals(sum.getMemo1())) {
				//平整
				ypdList = this.getMapper(QcmJhyElementsMapper.class).getQualityInfoForPZ(conn,(pageIndex-1)*pageSize,pageSize*pageIndex);
			}else if ("C016".equals(sum.getMemo1())) {
				//轧机
				ypdList = this.getMapper(QcmJhyElementsMapper.class).getQualityInfoForZJ(conn,(pageIndex-1)*pageSize,pageSize*pageIndex);
			}else if ("C012".equals(sum.getMemo1())) {
				//横剪
				ypdList = this.getMapper(QcmJhyElementsMapper.class).getQualityInfoForHJ(conn,(pageIndex-1)*pageSize,pageSize*pageIndex);
			}else if ("C002".equals(sum.getMemo1())||"C001".equals(sum.getMemo1())) {
				//纵剪(分条)
				ypdList = this.getMapper(QcmJhyElementsMapper.class).getQualityInfoForFT(conn,(pageIndex-1)*pageSize,pageSize*pageIndex);
			}else if ("C019".equals(sum.getMemo1())) {
				//酸洗
				ypdList = this.getMapper(QcmJhyElementsMapper.class).getQualityInfoForSX(conn,(pageIndex-1)*pageSize,pageSize*pageIndex);
			}
			
			//获取库存信息
			//ypdList = this.getMapper(QcmJhyElementsMapper.class).getQualityInfo(conn);
			/*for (HashMap<String,String> info : ypdList) {				
				// 成分实绩
				String materailcoilno = info.get("MATERAILCOILNO");
				List<QcmJhyElements> qjeList = this.getMapper(QcmJhyElementsMapper.class).findWithCondition(null, " MATERIAL_NO='"+materailcoilno+"'", null, 0, 0);
				for(QcmJhyElements qje: qjeList){
					info.put(qje.getChem_name(), qje.getChem_value());
				}
				
				// 材质实绩				
				String physresult_id = info.get("PHYSRESULT_ID");//材质ID
				if(!DataHelper.IsNullOrSpace(physresult_id)){
					List<QcmJudgePhysicalUtmD> qjdList = this.getMapper(QcmJudgePhysicalUtmDMapper.class).findWithCondition(null, "pic_id='"+ physresult_id +"'", null, 0, 0);
					if(qjdList != null && qjdList.size()>0){
						List<QcmPhyJudgeResult> qpjList = this.getMapper(QcmPhyJudgeResultMapper.class).findWithCondition(null, "phy_id='"+qjdList.get(0).getPhy_id()+"'", "PHY_CODE_L,PHY_CODE_S", 0, 0);
						for(QcmPhyJudgeResult qpj: qpjList){
							String phy_name_s = qpj.getPhy_name_s();
							if(!DataHelper.IsNullOrSpace(qpj.getPhy_name_s()) && !DataHelper.IsNullOrSpace(qpj.getVal1())){
								ComBasePhy cbp = this.getMapper(ComBasePhyMapper.class).findById(qpj.getPhy_code_s());
								if(!DataHelper.IsNullOrSpace(cbp.getPhy_unit())){
									phy_name_s += "("+cbp.getPhy_unit()+")";
								}
								info.put(phy_name_s, qpj.getVal1());
								if (!str.contains(phy_name_s)) {
						    		liststr.add(phy_name_s);
						    		str.add(phy_name_s);
								}
							}
						}
					}
				}			 	
			}*/
			 
			liststr.add("下屈服强度ReL(MPa)");
			liststr.add("抗拉强度Rm(MPa)");
			liststr.add("断后伸长率A(%)");
			liststr.add("A粗系");
			liststr.add("B粗系");
			liststr.add("C粗系");
			liststr.add("D粗系");
			int total = this.getMapper(QcmJhyElementsMapper.class).getQualityInfoCount(conn);
			PageModel<HashMap<String, String>> pm = new PageModel<HashMap<String, String>>(pageIndex, pageSize);
			pm.setRows(ypdList);
            pm.setTotal(total);
			rm.setData(pm);
			rm1.setData(liststr);
		} catch (Exception e) {
			e.printStackTrace();
			rm.setState("500");
			rm.setErrorInfo(e.getMessage());
		}
		return listrm;
	}
	
}
