package market.Qms.qcm.service.impl;

import java.util.List;

import market.Com.vo.ResultModel;
import market.Qms.common.DataHelper;
import market.Qms.qcm.mapper.QcmChemResultMapper;
import market.Qms.qcm.service.QcmChemResultService;
import market.Qms.qcm.vo.QcmChemResult;
import market.Qms.qcm.vo.QcmJudgeChemical;

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

@RemoteService(path="QcmChemResultService")
public class QcmChemResultServiceImpl extends BaseServiceImpl<QcmChemResult,String> implements QcmChemResultService { 
	
	/**
	 * 获取成分判定结果集
	 * @param chemCal
	 * @return
	 */
	public ResultModel GetChemResult(QcmJudgeChemical chemCal){
		ResultModel rm=new ResultModel("200","获取成分判定结果成功");
		try{
			//先查熔炼成分，再查成品成分
			QcmChemResultMapper resultMapper=this.getMapper(QcmChemResultMapper.class);
			String condition=DataHelper.CreateSqlCondition(chemCal.getAssay_no_rl().split(","), "assay_no");
			List<QcmChemResult> chemResult=resultMapper.findWithCondition(null, condition, "assay_no", 0, 0);
			condition=DataHelper.CreateSqlCondition(chemCal.getAssay_no_cp().split(","), "assay_no");
			List<QcmChemResult> chemResultCp=resultMapper.findWithCondition(null, condition, "assay_no", 0, 0);
			chemResult.addAll(chemResultCp);
			rm.setData(chemResult);
		}catch(Exception ex){
			rm.setState("500");
			rm.setMsgInfo("获取判定结果集失败");
			rm.setErrorInfo(ex.getMessage());
		}
		return rm;
	}
	
}