/***文档注释***********************************************
 * 作者            ：
 * 创建日期     ：2018-01-30
 * 描述            ：质量设计状态-技术设计状态明细
 * 注意事项     ：
 * 遗留BUG   ：
 * 修改日期     ：
 * 修改人员     ：
 * 修改内容     ：
***********************************************************/
package market.Qms.slmord.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import market.Api.Qms.vo.DetailMsc;
import market.Com.mapper.ComBaseSampleMapper;
import market.Com.vo.ComBaseSample;
import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Qms.com.mapper.PscMapper;
import market.Qms.com.vo.Psc;
import market.Qms.common.DataHelper;
import market.Qms.metallurgy.mapper.ComBaseStdMapper;
import market.Qms.metallurgy.mapper.ComMscMapper;
import market.Qms.metallurgy.mapper.ComMscStdChemMapper;
import market.Qms.metallurgy.mapper.ComMscStdCicMapper;
import market.Qms.metallurgy.mapper.ComMscStdDetectionCMapper;
import market.Qms.metallurgy.mapper.ComMscStdDetectionMapper;
import market.Qms.metallurgy.mapper.ComMscStdSpecCMapper;
import market.Qms.metallurgy.mapper.ComMscStdSpecMapper;
import market.Qms.metallurgy.mapper.ComPscRMscMapper;
import market.Qms.metallurgy.vo.ComMsc;
import market.Qms.metallurgy.vo.ComMscStdChem;
import market.Qms.metallurgy.vo.ComMscStdCic;
import market.Qms.metallurgy.vo.ComMscStdDetection;
import market.Qms.metallurgy.vo.ComMscStdDetectionC;
import market.Qms.metallurgy.vo.ComMscStdPhy;
import market.Qms.metallurgy.vo.ComMscStdSpec;
import market.Qms.metallurgy.vo.ComMscStdSpecC;
import market.Qms.metallurgy.vo.ComPscRMsc;
import market.Qms.slmord.mapper.SlmOrdDesignAdditionalMapper;
import market.Qms.slmord.mapper.SlmOrdDesignDeptMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscCftMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscCftRGzMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlGxPrlMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlGzMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlPcLstMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlPcMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlPrcMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlStiMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscPlStiTcMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStdCicMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStdCicSmpMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStdDicMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStdMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStdPicMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStdPicSmpMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStdSicMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStsPlPcLstMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStsPlPcMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStsTklgLstMapper;
import market.Qms.slmord.mapper.SlmOrdDesignStsTklgMapper;
import market.Qms.slmord.mapper.SlmOrdDesignZbsTemplateMapper;
import market.Qms.slmord.service.SlmOrdDesignStsTklgLstService;
import market.Qms.slmord.vo.SlmOrdDesignDept;
import market.Qms.slmord.vo.SlmOrdDesignMsc;
import market.Qms.slmord.vo.SlmOrdDesignStd;
import market.Qms.slmord.vo.SlmOrdDesignStdCicSmp;
import market.Qms.slmord.vo.SlmOrdDesignStsTklg;
import market.Qms.slmord.vo.SlmOrdDesignStsTklgLst;
import market.Slm.ContractManagement.impl.SlmCustAlphaServiceImpl;
import market.Slm.ContractManagement.vo.SlmCustAlpha;
import market.Slm.OrderManagement.mapper.SlmProcessPlanMapper;
import market.Slm.OrderManagement.vo.SlmContractProcessPlan;
import market.Slm.OrderManagement.vo.SlmProcessPlan;

import com.hnshituo.basic.service.impl.BaseServiceImpl;
import com.hnshituo.basic.spring.remoting.annotation.RemoteService;
import com.ibm.icu.text.DecimalFormat;


@RemoteService(path = "SlmOrdDesignStsTklgLstService")
public class SlmOrdDesignStsTklgLstServiceImpl extends BaseServiceImpl<SlmOrdDesignStsTklgLst, Object> implements SlmOrdDesignStsTklgLstService {

	/**
	 * 生成随机 DESIGN_KEY
	 * 
	 * @return
	 */
	public static String getUUID() {
		UUID uuid = UUID.randomUUID();
		String str = uuid.toString();
		String uuidStr = str.replace("-", "");
		return uuidStr;
	}

	/**
	 * 评审信息查询
	 */
	public ResultModel doSlectTk(CommonPage<SlmOrdDesignStsTklgLst> cp) {
		ResultModel rm = new ResultModel();
		try {

			SlmOrdDesignStsTklgLst Tk = new SlmOrdDesignStsTklgLst();
			if (cp.getObject().getOrder_pk() != null && !"".equals(cp.getObject().getOrder_pk())) {
				Tk.setOrder_pk(cp.getObject().getOrder_pk());
				Tk.setValidflag("1");
				List<SlmOrdDesignStsTklgLst> lst=this.getMapper(SlmOrdDesignStsTklgLstMapper.class).findWithCondition(Tk, null, "SEQ_INDEX", 0, 0);
				//rm.setData(this.getMapper(SlmOrdDesignStsTklgLstMapper.class).find(Tk, 0, 0));
				rm.setData(lst);
				rm.setState("200");
			} else {
				rm.setState("500");
				rm.setMsgInfo("查询失败");
				return rm;
			}
		} catch (Exception e) {
			rm.setState("500");
			rm.setMsgInfo("查询失败");
		}
		return rm;

	}

	/**
	 * 质量设计主程序
	 * 
	 * @param cp
	 * @return
	 * @throws Exception
	 */
	public ResultModel doQualityDesign(CommonPage<SlmContractProcessPlan> cp) throws Exception {
		ResultModel rm = new ResultModel();
		ResultModel msg = new ResultModel();

		SlmOrdDesignStsTklgLst Lst = new SlmOrdDesignStsTklgLst();

		// 初步验证技术评审所需信息是否合理
		if (!InfoValidation(msg, cp.getObject())) {
			rm.setMsgInfo(msg.getMsgInfo());
			rm.setState("500");
			return rm;
		}

		// 生成随机 DESIGN_KEY
		String designKey = getUUID();

		ReviewPrepare(cp.getObject(), "admin");

		SlmOrdDesignMsc ordermsc = InsertDesignMsc(designKey, cp.getObject(), "admin");

		InitDesignDetail(ordermsc, "admin", designKey);

		// 交付标准
		boolean bool = ValidationStdCIC(msg, ordermsc, "0", "1");
		if (bool) {

			Lst = SetDesignStsTklgLst(designKey, "S", "11", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "成分标准",
					msg.getState());
			doSaveStar(Lst);
		} else {

			Lst = SetDesignStsTklgLst(designKey, "F", "91", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "成分标准",
					msg.getState());
			doSaveStar(Lst);
		}

		boolean boolP = ValidationStdPIC(msg, ordermsc, "0", "1");
		if (boolP) {

			Lst = SetDesignStsTklgLst(designKey, "S", "11", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "理化标准",
					msg.getState());
			doSaveStar(Lst);
		} else {
			Lst = SetDesignStsTklgLst(designKey, "F", "91", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "理化标准",
					msg.getState());
			doSaveStar(Lst);
		}

		boolean boolS = ValidationStdSIC(msg, ordermsc, "0", "1");
		if (boolS) {
			Lst = SetDesignStsTklgLst(designKey, "S", "11", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "公差标准",
					msg.getState());
			doSaveStar(Lst);
		} else {

			Lst = SetDesignStsTklgLst(designKey, "F", "91", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "公差标准",
					msg.getState());
			doSaveStar(Lst);
		}

		boolean boolD = ValidationStdDIC(msg, ordermsc, "0", "1");
		if (boolD) {
			Lst = SetDesignStsTklgLst(designKey, "S", "11", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "探伤标准",
					msg.getState());

			doSaveStar(Lst);
		} else {

			Lst = SetDesignStsTklgLst(designKey, "F", "91", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "探伤标准",
					msg.getState());
			doSaveStar(Lst);
		}

		boolean boolDept = ValidationMscNDept(msg, ordermsc);
		if (boolDept && "无要求".equals(msg.getErrorInfo())) {
			Lst = SetDesignStsTklgLst(designKey, "S", "00", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "MSC(n)管理科室",
					msg.getState());
			doSaveStar(Lst);
		} else if (boolDept && !"无要求".equals(msg.getErrorInfo())) {
			Lst = SetDesignStsTklgLst(designKey, "S", "11", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "MSC(n)管理科室",
					msg.getState());
			doSaveStar(Lst);
		} else {
			Lst = SetDesignStsTklgLst(designKey, "F", "91", "MSC", "MSC管理科室描述", msg.getMsgInfo(), "MSC(n)管理科室",
					msg.getState());
			doSaveStar(Lst);
		}
		return rm;

	}

	/**
	 * 装载设计明细状态信息
	 * 
	 * @param line
	 * @param lst
	 * @param lstItem
	 *            明细项目
	 * @param sts
	 *            设计状态
	 * @param stsRs
	 *            设计状态原因
	 * @param stsDesc
	 *            设计状态结果描述
	 * @param objKey
	 *            设计对象Key 值
	 */
	private SlmOrdDesignStsTklgLst SetDesignStsTklgLst(String designKey, String Design_sts, String Design_sts_rs,
			String Section_code, String Section_name, String Design_sts_desc, String Lst_item, String key) {
		SlmOrdDesignStsTklgLst lst = new SlmOrdDesignStsTklgLst();
		lst.setDesign_key(designKey);
		lst.setDesign_sts(Design_sts);
		lst.setDesign_sts_rs(Design_sts_rs);
		lst.setSection_code(Section_code);
		lst.setSection_name(Section_name);
		lst.setDesign_sts_desc(Design_sts_desc);
		lst.setLst_item(Lst_item);
		lst.setDesign_obj_key(key);
		return lst;
	}

	/**
	 * 更新质量设计状态
	 * 
	 * @param Lst
	 */
	public void doSaveStar(SlmOrdDesignStsTklgLst Lst) {
		SlmOrdDesignStsTklg tkl = new SlmOrdDesignStsTklg();
		tkl.setDesign_key(Lst.getDesign_key());
		tkl.setDesign_sts(Lst.getDesign_sts());
		this.getMapper(SlmOrdDesignStsTklgMapper.class).update(tkl);
		this.getMapper(SlmOrdDesignStsTklgLstMapper.class).update(Lst);
	}

	/**
	 * 初步验证技术评审所需信息是否合理
	 * 
	 * @param msg
	 * @param orderLine
	 * @return
	 */
	private boolean InfoValidation(ResultModel msg, SlmContractProcessPlan orderLine) {
		if (orderLine == null) {
			msg.setMsgInfo("合同行信息不能为空");
			return false;
		}
		// 合同头PK、合同行PK、合同行流水号均不能为空
		if (DataHelper.IsNullOrSpace(orderLine.getOrder_seq()) || DataHelper.IsNullOrSpace(orderLine.getPlan_no())
				|| DataHelper.IsNullOrSpace(orderLine.getContract_pk())) {
			msg.setMsgInfo("合同头PK、加工订单号、合同行流水号不能为空");
			return false;
		}

		// msc、psc、均不能为空
		if (DataHelper.IsNullOrSpace(orderLine.getMsc()) || DataHelper.IsNullOrSpace(orderLine.getPsc())) {
			msg.setMsgInfo("MSC、PSC不能为空");
			return false;
		}

		// 查询合同行信息

		SlmProcessPlan line = new SlmProcessPlan();
		line.setPlan_no(orderLine.getPlan_no());

		List<SlmProcessPlan> lineList = this.getMapper(SlmProcessPlanMapper.class).find(line, 0, 0);

		if (lineList.size() < 1) {
			msg.setMsgInfo("合同行信息记录不能为空");
			return false;
		}
		if (lineList.get(0).getValid_flag().equals("0")) {
			msg.setMsgInfo("合同行信息记录已无效");
			return false;
		}

		// 验证产品码
		Psc psc = this.getMapper(PscMapper.class).findById(orderLine.getPsc());

		if (psc == null || "".equals(psc.getPsc())) {
			msg.setMsgInfo("合同对应的产品码不存在");
			return false;
		}

		if (psc.getValidflag().equals("0")) {
			msg.setMsgInfo("合同对应的产品码已无效");
			return false;
		}

		if (orderLine.getWidth() == null || orderLine.getThick() == null || "".equals(orderLine.getWidth())
				|| "".equals(orderLine.getThick())) {
			msg.setMsgInfo("合同行/订单行对应的产品规格（厚度、宽度）为空");
			return false;
		}
		return true;
	}

	/**
	 * 技术评审预处理
	 * 
	 * @param msg
	 * @param orderLine
	 * @return designKey
	 * @throws Exception
	 */
	private String ReviewPrepare(SlmContractProcessPlan orderLine, String userName) throws Exception {
		SlmOrdDesignMsc queryMsc = new SlmOrdDesignMsc();
		queryMsc.setOrder_pk(orderLine.getPlan_no());
		queryMsc.setValidflag("1");
		SlmOrdDesignMscMapper mapper = this.getMapper(SlmOrdDesignMscMapper.class);
		List<SlmOrdDesignMsc> listMsc = mapper.find(queryMsc, 0, 0);
		if (listMsc.size() > 0) {
			String oldKey = listMsc.get(0).getDesign_key();
			// 清理之前的评审结果
			mapper.DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStsTklgLstMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStsTklgMapper.class).DeleteByDesignKey(oldKey);

			// 制程
			this.getMapper(SlmOrdDesignMscPlMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscPlGxPrlMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscPlGzMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscPlPcMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscPlPcLstMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscPlPrcMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscPlStiMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscPlStiTcMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStsPlPcMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStsPlPcLstMapper.class).DeleteByDesignKey(oldKey);

			// 质量设计-交付标准
			this.getMapper(SlmOrdDesignStdCicMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStdCicSmpMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStdMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStdPicMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStdPicSmpMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStdSicMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignStdDicMapper.class).DeleteByDesignKey(oldKey);

			this.getMapper(SlmOrdDesignAdditionalMapper.class).DeleteByDesignKey(oldKey);
			// this.getMapper(SlmOrdDesignFallBackMapper.class).DeleteByDesignKey(oldKey);

			this.getMapper(SlmOrdDesignMscCftMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignMscCftRGzMapper.class).DeleteByDesignKey(oldKey);
			this.getMapper(SlmOrdDesignZbsTemplateMapper.class).DeleteByDesignKey(oldKey);

		}

		return "";
	}

	/**
	 * 新增 质量设计 msc
	 * 
	 * @param mapper
	 * @param orderLine
	 * @param userName
	 * @throws Exception
	 */
	private SlmOrdDesignMsc InsertDesignMsc(String designKey, SlmContractProcessPlan orderLine, String userName)
			throws Exception {
		SlmOrdDesignMsc newMsc = new SlmOrdDesignMsc();
		try {

			newMsc.setDesign_key(designKey);
			newMsc.setContract_line_no(orderLine.getPlan_no());
			newMsc.setPsc(orderLine.getPsc());
			newMsc.setPsc_desc(orderLine.getPsc_desc());
			newMsc.setMsc(orderLine.getMsc());
			newMsc.setMsc_desc(orderLine.getMsc_desc());
			newMsc.setCust_alpha_no(orderLine.getCustomer_alpha_no());
			newMsc.setAlpha_code(orderLine.getUse_code());
			newMsc.setAlpha_name(orderLine.getUse_desc());
			newMsc.setProd_code(orderLine.getProd_code());
			newMsc.setProd_name(orderLine.getProd_name());
			newMsc.setSteel_code(orderLine.getSteel_code());
			newMsc.setSteel_name(orderLine.getSteel_name());
			// 交货状态代码
			newMsc.setDelivery_state_code(orderLine.getDelivery_state_code()); //
			// 交货状态代码
			newMsc.setDelivery_state_desc(orderLine.getDelivery_state_code());
			newMsc.setStd_code(orderLine.getStd_code());
			newMsc.setStd_name(orderLine.getStd_name());
			newMsc.setThick(orderLine.getThick());
			newMsc.setWidth(orderLine.getWidth());
			newMsc.setLength(orderLine.getLength());
			newMsc.setOrder_unit(orderLine.getDelivery_unit_name());
			// 订货量
			newMsc.setOrder_qty(orderLine.getOrder_quantity());
			// 最终用户代码
			newMsc.setFinal_user_code(orderLine.getUse_code());
			newMsc.setFinal_user_desc(orderLine.getUse_desc());
//			newMsc.setAdd_ask_no(orderLine.getAdd_ask_no());
			newMsc.setAdd_ask_no(orderLine.getAdd_ask_no());
			newMsc.setAdd_ask_desc(orderLine.getAdd_ask_desc());
			// newMsc.setMemo(String memo) ;
			// newMsc.setValidflag(orderLine.getvalidflag) ;
			newMsc.setCreate_name(userName);
			newMsc.setCreate_time(new Date());
			// newMsc.setUpdate_name(String update_name);
			// newMsc.setUpdate_time(Date update_time) ;
			// newMsc.setDelete_name(String delete_name) ;
			// newMsc.setDelete_time(Date delete_time);

			// Copy(orderLine,newMsc);
			newMsc.setCreate_name(userName);
			newMsc.setCreate_time(new Date());
			newMsc.setValidflag("1");
			this.getMapper(SlmOrdDesignMscMapper.class).insert(newMsc);
		} catch (Exception e) {
			return null;
		}
		return newMsc;
	}

	/**
	 * 获取 所有评审节点
	 * 
	 * @return list<String>
	 */
	private List<String> GetAllReviewNodes() {
		List<String> list = new ArrayList<>();
		list.add("MSC(0)");
		list.add("成分标准");
		list.add("理化标准");
		list.add("公差标准");
		list.add("探伤标准");
		list.add("MSC(n)管理科室");
		list.add("产品技术要求");
		list.add("MSC(n)");
		list.add("合同附加要求");
		list.add("制程");
		list.add("炼钢牌号");
		list.add("内控标准");
		list.add("适用产线");
		list.add("工艺标准");
		list.add("质保书模板");
		list.add("生产周期");
		return list;
	}

	/**
	 * 初始化设计明细数据
	 * 
	 * @param orderLine
	 * @param userName
	 * @param designKey
	 */
	public void InitDesignDetail(SlmOrdDesignMsc orderLine, String userName, String designKey) {
		SlmOrdDesignStd designStd = new SlmOrdDesignStd();
		designStd.setDesign_key(designKey);
		designStd.setPsc(orderLine.getPsc());
		this.getMapper(SlmOrdDesignStdMapper.class).insert(designStd);
		List<String> reviewNodes = GetAllReviewNodes();
		List<SlmOrdDesignStsTklgLst> listTklg = new ArrayList<>();
		int seq = 0;

		for (String node : reviewNodes) {
			SlmOrdDesignStsTklgLst status = new SlmOrdDesignStsTklgLst();
			status.setDesign_key(designKey);
			status.setOrder_pk(orderLine.getOrder_pk());
			status.setLst_item(node);
			status.setPsc(orderLine.getPsc());
			status.setDesign_sts("W");
			status.setDesign_sts_rs("");
			status.setDesign_sts_desc("");
			status.setFinal_user(orderLine.getFinal_user_code());
			status.setDesign_obj_key("");
			status.setSection_code("");
			status.setSection_name("");
			status.setCreate_name(userName);
			DecimalFormat df = new DecimalFormat("000");
			String index = df.format(seq + 1);
			seq++;
			status.setSeq_index(index);
			listTklg.add(status);
		}
		// 初始化设计主、从明细数据
		this.getMapper(SlmOrdDesignStsTklgLstMapper.class).insertBatch(listTklg);
		SlmOrdDesignStsTklg tklg = new SlmOrdDesignStsTklg();
		tklg.setDesign_key(designKey);
		tklg.setDesign_sts("W");
		tklg.setPrdcyc_meet("W");
		tklg.setCreate_name(userName);
		tklg.setCreate_time(new Date());
		tklg.setValidflag("1");
		tklg.setOrd_ln_pk(orderLine.getOrder_pk());
		this.getMapper(SlmOrdDesignStsTklgMapper.class).insert(tklg);
	}

	/**
	 * 成分标准
	 * 
	 * @param msc
	 *            冶金规范码
	 * @param orderLine
	 *            合同行设计类
	 * @param flag
	 *            0:交付标准，1:客户标准，2:内控标准
	 * @param flag1
	 *            0 只验证 1 数据插入
	 * @return
	 */
	private boolean ValidationStdCIC(ResultModel msg, SlmOrdDesignMsc orderLine, String flag, String flag1) {
		ComMscStdCicMapper mapper = this.getMapper(ComMscStdCicMapper.class);
		List<ComMscStdCic> listCic = new ArrayList<>();
		ComMscStdCic cic = new ComMscStdCic();
		try {

			// 如果冶金规范码已经生效，则查询已经审批通过的成分标准索引号
			ComMsc msc = this.getMapper(ComMscMapper.class).findById(orderLine.getMsc());

			if (msc == null) {
				msg.setMsgInfo("找不到对应冶金规范码信息");
				return false;
			}

			if ("D".equals(msc.getValidflag())) {
				msg.setMsgInfo("冶金规范码信息已失效");
				return false;
			}

			if (msc.getMsc_seq() == null || "".equals(msc.getMsc_seq())) {

				cic.setMsc(msc.getMsc());
				cic.setSteel_code_nk(orderLine.getSteel_code());
				cic.setProd_code_nk(orderLine.getProd_code());
				cic.setDelivery_state_code(orderLine.getDelivery_state_code());
				cic.setStd_code(orderLine.getStd_code());
				listCic = mapper.doFindCicByzl(cic);
			} else {
				cic.setMsc(msc.getMsc_seq());
				cic.setSteel_code_nk(orderLine.getSteel_code());
				cic.setProd_code_nk(orderLine.getProd_code());
				cic.setDelivery_state_code(orderLine.getDelivery_state_code());
				cic.setStd_code(orderLine.getStd_code());
				listCic = mapper.doFindCicByzl(cic);
			}

			if (listCic.size() < 1 || listCic == null) {
				msg.setMsgInfo("未找到满足条件的标准索引信息！");
				return false;
			}

			ComMscStdChemMapper chemMapper = this.getMapper(ComMscStdChemMapper.class);
			for (ComMscStdCic mscStdCic : listCic) {
				ComMscStdChem chem = new ComMscStdChem();
				chem.setCic(mscStdCic.getCic());
				chem.setValidflag("1");
				List<ComMscStdChem> listChem = chemMapper.find(chem, 0, 0);
				if (listChem.size() < 1) {
					msg.setMsgInfo("成分索引：" + chem.getCic() + "，找不到成分标准");
					return false;
				}
				// 维护的成分元素项
				List<String> chemsSize = new ArrayList<String>();
				List<ComMscStdChem> chemAs = new ArrayList<>();
				List<ComMscStdChem> chemslis = new ArrayList<ComMscStdChem>();
				List<ComBaseSample> cbsA = new ArrayList<ComBaseSample>();
				for (ComMscStdChem stdChem : listChem) {
					if (!chemsSize.contains(stdChem.getChemCode())) {
						chemsSize.add(stdChem.getChemCode());
					}

				}

				// 过滤限制规格
				// 宽厚比
				String dh = String.valueOf(orderLine.getWidth() / orderLine.getThick());
				// 厚宽比
				String hd = String.valueOf(orderLine.getThick() / orderLine.getWidth());
				// 内径
				String in = String.valueOf(orderLine.getWidth() - 2 * orderLine.getThick());
				chemAs = fiterChemByA(listChem, orderLine.getWidth().toString(), orderLine.getThick().toString(), dh,
						hd, in);

				List<String> chemsSizeB = new ArrayList<String>();
				for (ComMscStdChem che : chemAs) {
					int i = 0;
					for (ComMscStdChem cheB : chemAs) {
						if (che.getChemCode().equals(cheB.getChemCode())) {
							i++;
						}
						if (i > 1) {
							msg.setMsgInfo(che.getCic() + che.getChemName() + "存在多套标准信息，请确认！");
							return false;
						}
					}

					if (!chemsSizeB.contains(che.getChemCode())) {

						chemsSizeB.add(che.getChemCode());
					}
				}

				// for (int i = 0; i < chemsSize.size(); i++) {
				// if (!chemsSizeB.contains(chemsSize.get(i))) {
				//
				// msg.setMsgInfo("成分" + chemsSize.get(i).toString() +
				// "不存在满足条件的标准信息，请确认！");
				// return false;
				// }
				// }

				List<ComBaseSample> cbsa = this.getMapper(ComBaseSampleMapper.class).doSelectZlsj(mscStdCic.getCic(),
						orderLine.getProd_code(), orderLine.getSteel_code(), orderLine.getStd_code(), "1");

				for (ComBaseSample cbsaB : cbsa) {

					if ((!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMin_d_sign(), cbsaB.getMin_d()))
							|| (!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMax_d_sign(),
									cbsaB.getMax_d()))) {
						continue;
					}

					if ((!DataHelper.checkStr(orderLine.getThick().toString(), cbsaB.getMin_h_sign(), cbsaB.getMin_h()))
							|| (!DataHelper.checkStr(orderLine.getThick().toString(), cbsaB.getMax_h_sign(),
									cbsaB.getMax_h()))) {
						continue;
					}
					cbsA.add(cbsaB);
				}

				if (cbsA == null || cbsA.size() == 0) {
					msg.setMsgInfo("未找到满足条件的取样要求信息！");
					return false;
				} else if (cbsA.size() > 1) {
					msg.setMsgInfo("存在多套满足条件的取样要求，请指定一套取样要求！");
					return false;
				}

				if ("1".equals(flag1)) {
					SlmOrdDesignStd std = new SlmOrdDesignStd();
					std.setDesign_key(orderLine.getDesign_key());
					std.setCic(mscStdCic.getCic());
					std.setPsc(orderLine.getPsc());
					if ("0".equals(flag)) {
						// 修改交付标准索引号
						this.getMapper(SlmOrdDesignStdMapper.class).update(std);
					}
					this.getMapper(SlmOrdDesignStdCicMapper.class).doinsert(chemAs, orderLine.getDesign_key(),
							orderLine.getAlpha_code(), orderLine.getAlpha_name(), flag);

					SlmOrdDesignStdCicSmp Csmp = new SlmOrdDesignStdCicSmp();
					Csmp.setDesign_key(orderLine.getDesign_key());
					Csmp.setCic(mscStdCic.getCic());
					Csmp.setSmp_index(cbsA.get(0).getSmp_index());
					// Csmp.setLength(cbsA.get(0).getLength);
					// Csmp.setDesc_length(cbsA.get(0).getDesc_length);
					Csmp.setRate(cbsA.get(0).getRate());
					Csmp.setDesc_rate(cbsA.get(0).getDesc_rate());
					//Csmp.setDesc_count(cbsA.get(0).getDesc_count());
					Csmp.setPosition(cbsA.get(0).getPosition());
					Csmp.setDesc_position(cbsA.get(0).getDesc_position());
					//Csmp.setSample_count(cbsA.get(0).getSample_count());
					Csmp.setMemo(cbsA.get(0).getMemo());
					this.getMapper(SlmOrdDesignStdCicSmpMapper.class).insert(Csmp);
				}
			}
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	/**
	 * 验证材质标准
	 * 
	 * @param msg
	 * @param orderLine
	 * @param flag
	 *            0:交付标准，1:客户标准，2:内控标准
	 * @param flag1
	 *            0 只验证 1 数据插入
	 * @return
	 */
	private boolean ValidationStdPIC(ResultModel msg, SlmOrdDesignMsc orderLine, String flag, String flag1) {
/*		ComMscStdPicMapper mapper = this.getMapper(ComMscStdPicMapper.class);
		List<ComMscStdPic> listPic = new ArrayList<>();
		ComMscStdPic Pic = new ComMscStdPic();
		try {

			// 如果冶金规范码已经生效，则查询已经审批通过的成分标准索引号
			ComMsc msc = this.getMapper(ComMscMapper.class).findById(orderLine.getMsc());

			if (msc == null) {
				msg.setMsgInfo("找不到对应冶金规范码信息");
				return false;
			}

			if ("D".equals(msc.getValidflag())) {
				msg.setMsgInfo("冶金规范码信息已失效");
				return false;
			}

			if (msc.getMsc_seq() == null || "".equals(msc.getMsc_seq())) {

				Pic.setMsc(msc.getMsc());
				Pic.setSteelCode(orderLine.getSteel_code());
				Pic.setProdCodeNk(orderLine.getProd_code());
				Pic.setDeliveryStateCode(orderLine.getDelivery_state_code());
				Pic.setStdCodeNk(orderLine.getStd_code());
				listPic = mapper.doFindPicByzl(Pic);
			} else {
				Pic.setMsc(msc.getMsc_seq());
				Pic.setSteelCode(orderLine.getSteel_code());
				Pic.setProdCodeNk(orderLine.getProd_code());
				Pic.setDeliveryStateCode(orderLine.getDelivery_state_code());
				Pic.setStdCodeNk(orderLine.getStd_code());
				listPic = mapper.doFindPicByzl(Pic);
			}

			if (listPic.size() < 1 || listPic == null) {
				msg.setMsgInfo("未找到满足条件的标准索引信息！");
				return false;
			}

			ComMscStdPhyMapper PhyMapper = this.getMapper(ComMscStdPhyMapper.class);
			for (ComMscStdPic mscStdPic : listPic) {
				ComMscStdPhy Phy = new ComMscStdPhy();
				Phy.setPic(mscStdPic.getPic());
				Phy.setValidflag("1");
				List<ComMscStdPhy> listPhy = PhyMapper.find(Phy, 0, 0);
				if (listPhy.size() < 1) {
					msg.setMsgInfo("成分索引：" + Phy.getPic() + "，找不到成分标准");
					return false;
				}
				// 维护的成分元素项
				List<String> PhysSize = new ArrayList<String>();
				List<ComMscStdPhy> PhyAs = new ArrayList<>();
				List<ComMscStdPhy> Physlis = new ArrayList<ComMscStdPhy>();
				List<ComBaseSample> cbsA = new ArrayList<ComBaseSample>();
				for (ComMscStdPhy stdPhy : listPhy) {
					if (!PhysSize.contains(stdPhy.getPhyNameL() + stdPhy.getPhyNameM() + stdPhy.getPhyNameS()
							+ stdPhy.getItemNameD() + stdPhy.getItemNameT() + stdPhy.getItemNameS())) {
						PhysSize.add(stdPhy.getPhyNameL() + stdPhy.getPhyNameM() + stdPhy.getPhyNameS()
								+ stdPhy.getItemNameD() + stdPhy.getItemNameT() + stdPhy.getItemNameS());
					}

				}

				// 过滤限制规格
				// 宽厚比
				String dh = String.valueOf(orderLine.getWidth() / orderLine.getThick());
				// 厚宽比
				String hd = String.valueOf(orderLine.getThick() / orderLine.getWidth());
				// 内径
				String in = String.valueOf(orderLine.getWidth() - 2 * orderLine.getThick());
				PhyAs = fiterPhyByA(listPhy, orderLine.getWidth().toString(), orderLine.getThick().toString(), dh, hd,
						in);

				List<String> PhysSizeB = new ArrayList<String>();
				for (ComMscStdPhy che : PhyAs) {
					int i = 0;
					for (ComMscStdPhy cheB : PhyAs) {
						if (che.getPhyCodeL().equals(cheB.getPhyCodeL()) || che.getPhyCodeM().equals(cheB.getPhyCodeM())
								|| che.getPhyCodeS().equals(cheB.getPhyCodeS())
								|| che.getItemCodeD().equals(cheB.getItemCodeD())
								|| che.getItemCodeT().equals(cheB.getItemCodeT())
								|| che.getItemCodeS().equals(cheB.getItemCodeS())) {
							i++;
						}
						if (i > 1) {
							msg.setMsgInfo(che.getPic() + che.getPhyNameL() + che.getPhyNameM() + che.getPhyNameS()
									+ "存在多套标准信息，请确认！");
							return false;
						}
					}
					if (!PhysSizeB.contains(che.getPhyNameL() + che.getPhyNameM() + che.getPhyNameS()
							+ che.getItemNameD() + che.getItemNameT() + che.getItemNameS())) {

						PhysSizeB.add(che.getPhyNameL() + che.getPhyNameM() + che.getPhyNameS() + che.getItemNameD()
								+ che.getItemNameT() + che.getItemNameS());
					}
				}

				// for (int i = 0; i < PhysSize.size(); i++) {
				// if (!PhysSizeB.contains(PhysSize.get(i))) {
				//
				// msg.setMsgInfo("材质项" + PhysSize.get(i).toString() +
				// "不存在满足条件的标准信息，请确认！");
				// return false;
				// }
				// }

				List<ComBaseSample> cbsa = this.getMapper(ComBaseSampleMapper.class).doSelectZlsj(mscStdPic.getPic(),
						orderLine.getProd_code(), orderLine.getSteel_code(), orderLine.getStd_code(), "1");

				for (ComBaseSample cbsaB : cbsa) {

					if ((!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMin_d_sign(), cbsaB.getMin_d()))
							|| (!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMax_d_sign(),
									cbsaB.getMax_d()))) {
						continue;
					}

					if ((!DataHelper.checkStr(orderLine.getThick().toString(), cbsaB.getMin_h_sign(), cbsaB.getMin_h()))
							|| (!DataHelper.checkStr(orderLine.getThick().toString(), cbsaB.getMax_h_sign(),
									cbsaB.getMax_h()))) {
						continue;
					}
					cbsA.add(cbsaB);
				}

				if (cbsA == null || cbsA.size() == 0) {
					msg.setMsgInfo("未找到满足条件的取样要求信息！");
					return false;
				} else if (cbsA.size() > 1) {
					msg.setMsgInfo("存在多套满足条件的取样要求，请指定一套取样要求！");
					return false;
				}
				if ("1".equals(flag1)) {
					SlmOrdDesignStd std = new SlmOrdDesignStd();
					std.setDesign_key(orderLine.getDesign_key());
					std.setPic(mscStdPic.getPic());
					std.setPsc(orderLine.getPsc());
					if ("0".equals(flag)) {
						// 修改交付标准索引号
						this.getMapper(SlmOrdDesignStdMapper.class).update(std);
					}
					this.getMapper(SlmOrdDesignStdPicMapper.class).doinsert(PhyAs, orderLine.getDesign_key(),
							orderLine.getAlpha_code(), orderLine.getAlpha_name(), flag);

					SlmOrdDesignStdPicSmp Csmp = new SlmOrdDesignStdPicSmp();
					Csmp.setDesign_key(orderLine.getDesign_key());
					Csmp.setPic(mscStdPic.getPic());
					Csmp.setSmp_index(cbsA.get(0).getSmp_index());
					// Csmp.setLength(cbsA.get(0).getLength);
					// Csmp.setDesc_length(cbsA.get(0).getDesc_length);
					Csmp.setRate(cbsA.get(0).getRate());
					Csmp.setDesc_rate(cbsA.get(0).getDesc_rate());
					Csmp.setDesc_count(cbsA.get(0).getDesc_count());
					Csmp.setPosition(cbsA.get(0).getPosition());
					Csmp.setDesc_position(cbsA.get(0).getDesc_position());
					Csmp.setSample_count(cbsA.get(0).getSample_count());
					Csmp.setMemo(cbsA.get(0).getMemo());
					this.getMapper(SlmOrdDesignStdPicSmpMapper.class).insert(Csmp);
				}
			}
		} catch (Exception e) {
			return false;
		}*/
		return true;
	}

	/**
	 * 公差标准
	 * 
	 * @param msg
	 * @param orderLine
	 * @param flag
	 *            0:交付标准，1:客户标准，2:内控标准
	 * @param flag1
	 *            0 只验证 1 数据插入
	 * @return
	 */

	private boolean ValidationStdSIC(ResultModel msg, SlmOrdDesignMsc orderLine, String flag, String flag1) {
		ComMscStdSpecMapper mapper = this.getMapper(ComMscStdSpecMapper.class);
		List<ComMscStdSpec> listSic = new ArrayList<>();
		ComMscStdSpec Sic = new ComMscStdSpec();
		try {

			// 如果冶金规范码已经生效，则查询已经审批通过的成分标准索引号
			ComMsc msc = this.getMapper(ComMscMapper.class).findById(orderLine.getMsc());

			if (msc == null) {
				msg.setMsgInfo("找不到对应冶金规范码信息");
				return false;
			}

			if ("D".equals(msc.getValidflag())) {
				msg.setMsgInfo("冶金规范码信息已失效");
				return false;
			}

			if (msc.getMsc_seq() == null || "".equals(msc.getMsc_seq())) {

				Sic.setMsc(msc.getMsc());
				Sic.setSteelCodeNk(orderLine.getSteel_code());
				Sic.setProdCodeNk(orderLine.getProd_code());
				Sic.setDeliveryStateCode(orderLine.getDelivery_state_code());
				Sic.setStdCode(orderLine.getStd_code());
				listSic = mapper.doFindSicByzl(Sic);
			} else {
				Sic.setMsc(msc.getMsc_seq());
				Sic.setSteelCodeNk(orderLine.getSteel_code());
				Sic.setProdCodeNk(orderLine.getProd_code());
				Sic.setDeliveryStateCode(orderLine.getDelivery_state_code());
				Sic.setStdCode(orderLine.getStd_code());
				listSic = mapper.doFindSicByzl(Sic);
			}

			if (listSic.size() < 1 || listSic == null) {
				msg.setMsgInfo("未找到满足条件的标准索引信息！");
				return false;
			}

			ComMscStdSpecCMapper SpecCMapper = this.getMapper(ComMscStdSpecCMapper.class);
			for (ComMscStdSpec mscStdSic : listSic) {
				ComMscStdSpecC SpecC = new ComMscStdSpecC();
				SpecC.setSic(mscStdSic.getSic());
				SpecC.setValidflag("1");
				List<ComMscStdSpecC> listSpecC = SpecCMapper.find(SpecC, 0, 0);
				if (listSpecC.size() < 1) {
					msg.setMsgInfo("成分索引：" + SpecC.getSic() + "，找不到成分标准");
					return false;
				}
				// 维护的成分元素项
				List<String> SpecCsSize = new ArrayList<String>();
				List<ComMscStdSpecC> SpecCAs = new ArrayList<>();
				List<ComMscStdSpecC> SpecCslis = new ArrayList<ComMscStdSpecC>();
				List<ComBaseSample> cbsA = new ArrayList<ComBaseSample>();

				for (ComMscStdSpecC stdSpecC : listSpecC) {
					if (!SpecCsSize.contains(stdSpecC.getBiasName())) {
						SpecCsSize.add(stdSpecC.getBiasName());
					}
				}

				// 过滤限制规格
				// 宽厚比
				String dh = String.valueOf(orderLine.getWidth() / orderLine.getThick());
				// 厚宽比
				String hd = String.valueOf(orderLine.getThick() / orderLine.getWidth());
				// 内径
				String in = String.valueOf(orderLine.getWidth() - 2 * orderLine.getThick());
				SpecCAs = fiterSpecCByA(listSpecC, orderLine.getWidth().toString(), orderLine.getThick().toString(), dh,
						hd, in);

				List<String> SpecCsSizeB = new ArrayList<String>();
				for (ComMscStdSpecC che : SpecCAs) {
					int i = 0;
					for (ComMscStdSpecC cheB : SpecCAs) {
						if (che.getBiasCode().equals(cheB.getBiasCode())) {
							i++;
						}
						if (i > 1) {
							msg.setMsgInfo(che.getSic() + che.getBiasName() + "存在多套标准信息，请确认！");
							return false;
						}
					}
					if (!SpecCsSizeB.contains(che.getBiasName())) {

						SpecCsSizeB.add(che.getBiasName());
					}
				}

				// for (int i = 0; i < SpecCsSize.size(); i++) {
				// if (!SpecCsSizeB.contains(SpecCsSize.get(i))) {
				//
				// msg.setMsgInfo("公差项" + SpecCsSize.get(i).toString() +
				// "不存在满足条件的标准信息，请确认！");
				// return false;
				// }
				// }

				if ("1".equals(flag1)) {
					SlmOrdDesignStd std = new SlmOrdDesignStd();
					std.setDesign_key(orderLine.getDesign_key());
					std.setSic(mscStdSic.getSic());
					std.setPsc(orderLine.getPsc());
					if ("0".equals(flag)) {
						// 修改交付标准索引号
						this.getMapper(SlmOrdDesignStdMapper.class).update(std);
					}
					this.getMapper(SlmOrdDesignStdSicMapper.class).doinsert(SpecCAs, orderLine.getDesign_key(),
							orderLine.getAlpha_code(), orderLine.getAlpha_name(), flag);

				}

			}
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	/**
	 * 探伤标准
	 * 
	 * @param msg
	 * @param orderLine
	 * @param flag
	 *            0:交付标准，1:客户标准，2:内控标准
	 * @param flag1
	 *            0 只验证 1 数据插入
	 * @return
	 */

	private boolean ValidationStdDIC(ResultModel msg, SlmOrdDesignMsc orderLine, String flag, String flag1) {
		ComMscStdDetectionMapper mapper = this.getMapper(ComMscStdDetectionMapper.class);
		List<ComMscStdDetection> listDic = new ArrayList<>();
		ComMscStdDetection Dic = new ComMscStdDetection();
		try {

			// 如果冶金规范码已经生效，则查询已经审批通过的成分标准索引号
			ComMsc msc = this.getMapper(ComMscMapper.class).findById(orderLine.getMsc());

			if (msc == null) {
				msg.setMsgInfo("找不到对应冶金规范码信息");
				return false;
			}

			if ("D".equals(msc.getValidflag())) {
				msg.setMsgInfo("冶金规范码信息已失效");
				return false;
			}

			if (msc.getMsc_seq() == null || "".equals(msc.getMsc_seq())) {

				Dic.setMsc(msc.getMsc());
				Dic.setSteelCodeNk(orderLine.getSteel_code());
				Dic.setProdCodeNk(orderLine.getProd_code());
				Dic.setDeliveryStateCode(orderLine.getDelivery_state_code());
				Dic.setStdCodeNk(orderLine.getStd_code());
				listDic = mapper.doFindDicByzl(Dic);
			} else {
				Dic.setMsc(msc.getMsc_seq());
				Dic.setSteelCodeNk(orderLine.getSteel_code());
				Dic.setProdCodeNk(orderLine.getProd_code());
				Dic.setDeliveryStateCode(orderLine.getDelivery_state_code());
				Dic.setStdCodeNk(orderLine.getStd_code());
				listDic = mapper.doFindDicByzl(Dic);
			}

			if (listDic.size() < 1 || listDic == null) {
				msg.setMsgInfo("未找到满足条件的标准索引信息！");
				return false;
			}

			ComMscStdDetectionCMapper SpecCMapper = this.getMapper(ComMscStdDetectionCMapper.class);
			for (ComMscStdDetection mscStdDic : listDic) {
				ComMscStdDetectionC SpecC = new ComMscStdDetectionC();
				SpecC.setDic(mscStdDic.getDic());
				SpecC.setValidflag("1");
				List<ComMscStdDetectionC> listSpecC = SpecCMapper.find(SpecC, 0, 0);
				if (listSpecC.size() < 1) {
					msg.setMsgInfo("成分索引：" + SpecC.getDic() + "，找不到成分标准");
					return false;
				}
				// 维护的成分元素项
				List<String> SpecCsSize = new ArrayList<String>();
				List<ComMscStdDetectionC> SpecCAs = new ArrayList<>();
				List<ComMscStdDetectionC> SpecCslis = new ArrayList<ComMscStdDetectionC>();
				List<ComBaseSample> cbsA = new ArrayList<ComBaseSample>();
				for (ComMscStdDetectionC stdSpecC : listSpecC) {
					if (!SpecCsSize.contains(stdSpecC.getPhyNameS())) {
						SpecCsSize.add(stdSpecC.getPhyNameS());
					}
				}

				for (ComMscStdDetectionC cbsaB : listSpecC) {

					if ((!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMinDSign(), cbsaB.getMinD()))
							|| (!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMaxDSign(),
									cbsaB.getMaxD()))) {
						continue;
					}

					if ((!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMinHSign(), cbsaB.getMinH()))
							|| (!DataHelper.checkStr(orderLine.getWidth().toString(), cbsaB.getMaxHSign(),
									cbsaB.getMaxH()))) {
						continue;
					}
					SpecCAs.add(cbsaB);
				}

				List<String> SpecCsSizeB = new ArrayList<String>();
				for (ComMscStdDetectionC che : SpecCAs) {
					int i = 0;
					for (ComMscStdDetectionC cheB : SpecCAs) {
						if (che.getPhyCodeS().equals(cheB.getPhyCodeS())) {
							i++;
						}
						if (i > 1) {
							msg.setMsgInfo(che.getPhyNameS() + "存在多套标准信息，请确认！");
							return false;
						}
					}

					if (!SpecCsSizeB.contains(che.getPhyNameS())) {

						SpecCsSizeB.add(che.getPhyNameS());
					}
				}

				// for (int i = 0; i < SpecCsSize.size(); i++) {
				// if (!SpecCsSizeB.contains(SpecCsSize.get(i))) {
				//
				// msg.setMsgInfo("探伤项" + SpecCsSize.get(i).toString() +
				// "不存在满足条件的标准信息，请确认！");
				// return false;
				// }
				// }

				if ("1".equals(flag1)) {
					SlmOrdDesignStd std = new SlmOrdDesignStd();
					std.setDesign_key(orderLine.getDesign_key());
					std.setDic(mscStdDic.getDic());
					std.setPsc(orderLine.getPsc());
					{
						this.getMapper(SlmOrdDesignStdMapper.class).update(std);
					}
					this.getMapper(SlmOrdDesignStdDicMapper.class).doinsert(SpecCAs, orderLine.getDesign_key(),
							orderLine.getAlpha_code(), orderLine.getAlpha_name(), flag);

				}
			}
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	/**
	 * 过滤规格
	 * 
	 * @param chems
	 *            成分集合
	 * @param width
	 *            宽度
	 * @param thick
	 *            厚度
	 * @param DHProportion
	 *            宽厚比
	 * @param HDProportion
	 *            厚宽比
	 * @param innerProportion
	 *            内径
	 * @return
	 */
	public List<ComMscStdChem> fiterChemByA(List<ComMscStdChem> chems, String width, String thick, String DHProportion,
			String HDProportion, String innerProportion) {
		if (chems == null || chems.size() == 0) {
			return null;
		}
		List<ComMscStdChem> list = new ArrayList<ComMscStdChem>();

		// 过滤外径壁厚
		for (int i = 0; i < chems.size(); i++) {
			ComMscStdChem chem = chems.get(i);
			if (chem.getSizeCode() == null && chem.getSizeCode2() == null) {
				list.add(chem);
				continue;
			}
			// 宽度:400301 厚度:400302 宽厚比:400303 厚宽比 400304 内径 400305 长度 400306
			if (chem.getSizeCode2().equals("400301")) {
				if ((!DataHelper.checkStr(width, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(width, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400302")) {
				if ((!DataHelper.checkStr(thick, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(thick, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400303")) {
				if ((!DataHelper.checkStr(DHProportion, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(DHProportion, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400304")) {
				if ((!DataHelper.checkStr(HDProportion, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(HDProportion, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400305")) {
				if ((!DataHelper.checkStr(innerProportion, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(innerProportion, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}

			if (chem.getSizeCode().equals("400301")) {
				if ((!DataHelper.checkStr(width, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(width, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400302")) {
				if ((!DataHelper.checkStr(thick, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(thick, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400303")) {
				if ((!DataHelper.checkStr(DHProportion, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(DHProportion, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400304")) {
				if ((!DataHelper.checkStr(HDProportion, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(HDProportion, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400305")) {
				if ((!DataHelper.checkStr(innerProportion, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(innerProportion, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			list.add(chem);
		}
		return list;
	}

	/**
	 * 过滤规格
	 * 
	 * @param chems
	 *            材质集合
	 * @param width
	 *            宽度
	 * @param thick
	 *            厚度
	 * @param DHProportion
	 *            宽厚比
	 * @param HDProportion
	 *            厚宽比
	 * @param innerProportion
	 *            内径
	 * @return
	 */
	public List<ComMscStdPhy> fiterPhyByA(List<ComMscStdPhy> chems, String width, String thick, String DHProportion,
			String HDProportion, String innerProportion) {
		if (chems == null || chems.size() == 0) {
			return null;
		}
		List<ComMscStdPhy> list = new ArrayList<ComMscStdPhy>();

		// 过滤外径壁厚
		for (int i = 0; i < chems.size(); i++) {
			ComMscStdPhy chem = chems.get(i);
			if (chem.getSizeCode() == null && chem.getSizeCode2() == null) {
				list.add(chem);
				continue;
			}
			// 宽度:400301 厚度:400302 宽厚比:400303 厚宽比 400304 内径 400305 长度 400306
			if (chem.getSizeCode2().equals("400301")) {
				if ((!DataHelper.checkStr(width, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(width, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400302")) {
				if ((!DataHelper.checkStr(thick, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(thick, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400303")) {
				if ((!DataHelper.checkStr(DHProportion, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(DHProportion, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400304")) {
				if ((!DataHelper.checkStr(HDProportion, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(HDProportion, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}
			if (chem.getSizeCode2().equals("400305")) {
				if ((!DataHelper.checkStr(innerProportion, chem.getSizeMinSign2(), chem.getSizeMin2()))
						|| (!DataHelper.checkStr(innerProportion, chem.getSizeMaxSign2(), chem.getSizeMax2()))) {
					continue;
				}
			}

			if (chem.getSizeCode().equals("400301")) {
				if ((!DataHelper.checkStr(width, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(width, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400302")) {
				if ((!DataHelper.checkStr(thick, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(thick, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400303")) {
				if ((!DataHelper.checkStr(DHProportion, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(DHProportion, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400304")) {
				if ((!DataHelper.checkStr(HDProportion, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(HDProportion, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			if (chem.getSizeCode().equals("400305")) {
				if ((!DataHelper.checkStr(innerProportion, chem.getSizeMinSign(), chem.getSizeMin()))
						|| (!DataHelper.checkStr(innerProportion, chem.getSizeMaxSign(), chem.getSizeMax()))) {
					continue;
				}
			}
			list.add(chem);
		}
		return list;
	}

	/**
	 * 过滤规格
	 * 
	 * @param chems
	 *            公差集合
	 * @param width
	 *            宽度
	 * @param thick
	 *            厚度
	 * @param DHProportion
	 *            宽厚比
	 * @param HDProportion
	 *            厚宽比
	 * @param innerProportion
	 *            内径
	 * @return
	 */
	public List<ComMscStdSpecC> fiterSpecCByA(List<ComMscStdSpecC> chems, String width, String thick,
			String DHProportion, String HDProportion, String innerProportion) {
		if (chems == null || chems.size() == 0) {
			return null;
		}
		List<ComMscStdSpecC> list = new ArrayList<ComMscStdSpecC>();

		// 过滤外径壁厚
		for (int i = 0; i < chems.size(); i++) {
			ComMscStdSpecC chem = chems.get(i);
			if (chem.getBiasCodeC() == null && chem.getBiasCodeZ() == null) {
				list.add(chem);
				continue;
			}
			// 宽度:400301 厚度:400302 宽厚比:400303 厚宽比 400304 内径 400305 长度 400306
			if (chem.getBiasCodeC().equals("400301")) {
				if ((!DataHelper.checkStr(width, chem.getCminSign(), chem.getCmin()))
						|| (!DataHelper.checkStr(width, chem.getCmaxSign(), chem.getCmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeC().equals("400302")) {
				if ((!DataHelper.checkStr(thick, chem.getCminSign(), chem.getCmin()))
						|| (!DataHelper.checkStr(thick, chem.getCmaxSign(), chem.getCmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeC().equals("400303")) {
				if ((!DataHelper.checkStr(DHProportion, chem.getCminSign(), chem.getCmin()))
						|| (!DataHelper.checkStr(DHProportion, chem.getCmaxSign(), chem.getCmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeC().equals("400304")) {
				if ((!DataHelper.checkStr(HDProportion, chem.getCminSign(), chem.getCmin()))
						|| (!DataHelper.checkStr(HDProportion, chem.getCmaxSign(), chem.getCmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeC().equals("400305")) {
				if ((!DataHelper.checkStr(innerProportion, chem.getCminSign(), chem.getCmin()))
						|| (!DataHelper.checkStr(innerProportion, chem.getCmaxSign(), chem.getCmax()))) {
					continue;
				}
			}

			if (chem.getBiasCodeZ().equals("400301")) {
				if ((!DataHelper.checkStr(width, chem.getZminSign(), chem.getZmin()))
						|| (!DataHelper.checkStr(width, chem.getZmaxSign(), chem.getZmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeZ().equals("400302")) {
				if ((!DataHelper.checkStr(width, chem.getZminSign(), chem.getZmin()))
						|| (!DataHelper.checkStr(width, chem.getZmaxSign(), chem.getZmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeZ().equals("400303")) {
				if ((!DataHelper.checkStr(width, chem.getZminSign(), chem.getZmin()))
						|| (!DataHelper.checkStr(width, chem.getZmaxSign(), chem.getZmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeZ().equals("400304")) {
				if ((!DataHelper.checkStr(width, chem.getZminSign(), chem.getZmin()))
						|| (!DataHelper.checkStr(width, chem.getZmaxSign(), chem.getZmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeZ().equals("400305")) {
				if ((!DataHelper.checkStr(width, chem.getZminSign(), chem.getZmin()))
						|| (!DataHelper.checkStr(width, chem.getZmaxSign(), chem.getZmax()))) {
					continue;
				}
			}

			if (chem.getBiasCodeS().equals("400301")) {
				if ((!DataHelper.checkStr(width, chem.getSminSign(), chem.getSmin()))
						|| (!DataHelper.checkStr(width, chem.getSmaxSign(), chem.getSmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeS().equals("400302")) {
				if ((!DataHelper.checkStr(width, chem.getSminSign(), chem.getSmin()))
						|| (!DataHelper.checkStr(width, chem.getSmaxSign(), chem.getSmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeS().equals("400303")) {
				if ((!DataHelper.checkStr(width, chem.getSminSign(), chem.getSmin()))
						|| (!DataHelper.checkStr(width, chem.getSmaxSign(), chem.getSmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeS().equals("400304")) {
				if ((!DataHelper.checkStr(width, chem.getSminSign(), chem.getSmin()))
						|| (!DataHelper.checkStr(width, chem.getSmaxSign(), chem.getSmax()))) {
					continue;
				}
			}
			if (chem.getBiasCodeS().equals("400305")) {
				if ((!DataHelper.checkStr(width, chem.getSminSign(), chem.getSmin()))
						|| (!DataHelper.checkStr(width, chem.getSmaxSign(), chem.getSmax()))) {
					continue;
				}
			}

			list.add(chem);
		}
		return list;
	}

	// =================验证MSC(N) 管理科室 Start=================

	private boolean ValidationMscNDept(ResultModel msg, SlmOrdDesignMsc orderLine) {

		if (orderLine.getCust_alpha_no() == null || "".equals(orderLine.getCust_alpha_no())) {
			msg.setMsgInfo("无要求");
			return true;
		} else {
			SlmOrdDesignDept de = this.getMapper(SlmOrdDesignDeptMapper.class).findById(orderLine.getOrder_pk());

			if (de == null) {
				ComMsc msc = this.getMapper(ComMscMapper.class).findById(orderLine.getMsc());

				de.setOrd_ln_pk(orderLine.getOrder_pk());
				de.setDelivy_dept_code(msc.getSection_code());
				de.setDelivy_dept_desc(msc.getSection_name());
				de.setDept_code(msc.getDept_code());
				de.setDept_desc(msc.getDept_desc());
				de.setTech_dept_code(msc.getUnit_code_process());
				de.setTech_dept_desc(msc.getUnit_desc_process());
				this.getMapper(SlmOrdDesignDeptMapper.class).insert(de);
				msg.setMsgInfo("管理科室通过");
				return true;
			}

		}

		return true;
	}

	// =================验证产品技术要求 Start=================

	private boolean ValidationCustSpecialAsk(ResultModel msg, SlmOrdDesignMsc orderLine) {

		SlmOrdDesignStsTklgLst Lst = new SlmOrdDesignStsTklgLst();
		if (orderLine.getCust_alpha_no() == null || "".equals(orderLine.getCust_alpha_no())) {
			msg.setMsgInfo("无要求");
			return true;
		} else {
			List<ComPscRMsc> de = this.getMapper(SlmOrdDesignStsTklgLstMapper.class)
					.doSelect(orderLine.getCust_alpha_no());

			if (de != null && de.size() > 0) {
				// 交付标准
				boolean bool = ValidationStdCIC(msg, orderLine, "0", "0");
				if (!bool) {

					Lst = SetDesignStsTklgLst(orderLine.getDesign_key(), "F", "91", "MSC", "MSC管理科室描述",
							msg.getErrorInfo(), "产品技术要求", msg.getState());
					doSaveStar(Lst);
					return false;
				}

				boolean boolP = ValidationStdPIC(msg, orderLine, "0", "0");
				if (!boolP) {
					Lst = SetDesignStsTklgLst(orderLine.getDesign_key(), "F", "91", "MSC", "MSC管理科室描述",
							msg.getErrorInfo(), "产品技术要求", msg.getState());
					doSaveStar(Lst);
					return false;
				}

				boolean boolS = ValidationStdSIC(msg, orderLine, "0", "0");
				if (!boolS) {
					Lst = SetDesignStsTklgLst(orderLine.getDesign_key(), "F", "91", "MSC", "MSC管理科室描述",
							msg.getErrorInfo(), "产品技术要求", msg.getState());
					doSaveStar(Lst);
					return false;
				}

				boolean boolD = ValidationStdDIC(msg, orderLine, "0", "0");
				if (!boolD) {
					Lst = SetDesignStsTklgLst(orderLine.getDesign_key(), "F", "91", "MSC", "MSC管理科室描述",
							msg.getErrorInfo(), "产品技术要求", msg.getState());
					doSaveStar(Lst);
					return false;
				}

				Lst = SetDesignStsTklgLst(orderLine.getDesign_key(), "S", "11", "MSC", "MSC管理科室描述", "产品技术要求结束",
						"产品技术要求", msg.getState());
				doSaveStar(Lst);
				return true;
			} else {
				Lst = SetDesignStsTklgLst(orderLine.getDesign_key(), "F", "91", "MSC", "MSC管理科室描述", "存在技术要求待人工确认",
						"产品技术要求", msg.getState());
				doSaveStar(Lst);
				return false;
			}

		}
	}

	/**
	 * 技术评审通过
	 * @param psc
	 * @param cust_alpha_no
	 * @return
	 */
	public List<DetailMsc> PassedTheAssessment(String psc, String cust_alpha_no) {
		List<ComPscRMsc> prm = this.getMapper(ComPscRMscMapper.class).findPscRMsc(psc);

		CommonPage<SlmCustAlpha> sum = new CommonPage<SlmCustAlpha>();
		sum.getObject().setCust_alpha_no(cust_alpha_no);
		ResultModel web = this.getBean(SlmCustAlphaServiceImpl.class).doQueryWeb(sum);
		SlmCustAlpha aa = (SlmCustAlpha) web.getData();
		
		
		SlmCustAlpha aa2 = aa;
		List<DetailMsc> bb = new ArrayList<DetailMsc>();
		hasSomeWrong:  
		for (ComPscRMsc ps : prm) {
			DetailMsc detail = new DetailMsc();
			detail.setMsc(ps.getMsc());
			detail.setValidflag("1");
			detail = GetMscStd(detail);

			// 比较检验大项数目
			if (!((detail.getPhyList().size() > 0 && aa.getPhyList().size() > 0)
					|| (detail.getPhyList().size() == 0 && aa.getPhyList().size() == 0))
					|| !((detail.getChemList().size() > 0 && aa.getChemList().size() > 0)
							|| (detail.getChemList().size() == 0 && aa.getChemList().size() == 0))
					|| !((detail.getDetectionList().size() > 0 && aa.getDetectionList().size() > 0)
							|| (detail.getDetectionList().size() == 0 && aa.getDetectionList().size() == 0))
					|| !((detail.getSpecList().size() > 0 && aa.getSpecList().size() > 0)
							|| (detail.getSpecList().size() == 0 && aa.getSpecList().size() == 0))) {
				continue;
			}

			// 比较检验项数目
			List<String> Chem = new ArrayList<String>();
			for (int i = 0; i < detail.getChemList().size(); i++) {
				if (!Chem.contains(detail.getChemList().get(i).getChem_code())) {

					Chem.add(detail.getChemList().get(i).getChem_code());
				}
			}
			if (Chem.size() != aa.getChemList().size()) {
				continue;
			}

			List<String> Phy = new ArrayList<String>();
			for (int i = 0; i < detail.getPhyList().size(); i++) {
				if (!Phy.contains(detail.getPhyList().get(i).getPhy_code_l()
						+ detail.getPhyList().get(i).getPhy_code_m() + detail.getPhyList().get(i).getPhy_code_s()
						+ detail.getPhyList().get(i).getItem_code_d() + detail.getPhyList().get(i).getItem_code_t()
						+ detail.getPhyList().get(i).getItem_code_s())) {

					Phy.add(detail.getPhyList().get(i).getPhy_code_l() + detail.getPhyList().get(i).getPhy_code_m()
							+ detail.getPhyList().get(i).getPhy_code_s() + detail.getPhyList().get(i).getItem_code_d()
							+ detail.getPhyList().get(i).getItem_code_t()
							+ detail.getPhyList().get(i).getItem_code_s());
				}
			}
			if (Phy.size() != aa.getPhyList().size()) {
				continue;
			}

			List<String> Spe = new ArrayList<String>();
			for (int i = 0; i < detail.getSpecList().size(); i++) {
				if (!Spe.contains(detail.getSpecList().get(i).getBias_code())) {

					Spe.add(detail.getSpecList().get(i).getBias_code());
				}
			}
			if (Spe.size() != aa.getSpecList().size()) {
				continue;
			}

			List<String> Dic = new ArrayList<String>();
			for (int i = 0; i < detail.getDetectionList().size(); i++) {
				if (!Dic.contains(detail.getDetectionList().get(i).getPhy_code_s())) {

					Dic.add(detail.getDetectionList().get(i).getPhy_code_s());
				}
			}
			if (Dic.size() != aa.getDetectionList().size()) {
				continue;
			}
          //成分比较
			for (int i = 0; i < aa.getChemList().size(); i++) {
				// 比较检验项名称
				if (!Chem.contains(aa.getChemList().get(i).getChem_code())) {
					continue hasSomeWrong;
				}
				for (int j = 0; j < detail.getChemList().size(); j++) {
					//筛选标准不同的数据
					if (aa.getChemList().get(i).getChem_code() == detail.getChemList().get(j).getChem_code()) {
						if (aa.getChemList().get(i).getStdmax_sign() != detail.getChemList().get(j).getStdmax_sign()
								|| aa.getChemList().get(i).getStdmin() != detail.getChemList().get(j).getStdmin()
								|| aa.getChemList().get(i).getStdmax_sign() != detail.getChemList().get(j)
										.getStdmax_sign()
								|| aa.getChemList().get(i).getStdmax() != detail.getChemList().get(j).getStdmax()
								|| aa.getChemList().get(i).getStdtarget() != detail.getChemList().get(j)
										.getStdtarget()) {
							//筛选限制条件相同
							if (detail.getChemList().get(j).getSize_code().equals("")
									&& detail.getChemList().get(j).getSize_code2().equals("")) {
								continue hasSomeWrong;
							}
							if (!detail.getChemList().get(j).getSize_code().equals("")) {

								if(detail.getChemList().get(j).getSize_code().equals(aa.getChemList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign(),detail.getChemList().get(j).getSize_max(),detail.getChemList().get(j).getSize_min_sign(),detail.getChemList().get(j).getSize_min(),aa.getChemList().get(i).getSize_max_sign(),aa.getChemList().get(i).getSize_max(),aa.getChemList().get(i).getSize_min_sign(),aa.getChemList().get(i).getSize_min()))
									{
										continue hasSomeWrong;
									}
								}
								else if(detail.getChemList().get(j).getSize_code().equals(aa.getChemList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign(),detail.getChemList().get(j).getSize_max(),detail.getChemList().get(j).getSize_min_sign(),detail.getChemList().get(j).getSize_min(),aa.getChemList().get(i).getSize_max_sign2(),aa.getChemList().get(i).getSize_max2(),aa.getChemList().get(i).getSize_min_sign2(),aa.getChemList().get(i).getSize_min2()))
									{
										continue hasSomeWrong;
									}
								}
								else
								{
									continue hasSomeWrong;
								}
								
							}else if (!detail.getChemList().get(j).getSize_code2().equals("")) {

								if(detail.getChemList().get(j).getSize_code2().equals(aa.getChemList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign2(),detail.getChemList().get(j).getSize_max2(),detail.getChemList().get(j).getSize_min_sign2(),detail.getChemList().get(j).getSize_min2(),aa.getChemList().get(i).getSize_max_sign(),aa.getChemList().get(i).getSize_max(),aa.getChemList().get(i).getSize_min_sign(),aa.getChemList().get(i).getSize_min()))
									{
										continue hasSomeWrong;
									}
								}
								else if(detail.getChemList().get(j).getSize_code2().equals(aa.getChemList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign2(),detail.getChemList().get(j).getSize_max2(),detail.getChemList().get(j).getSize_min_sign2(),detail.getChemList().get(j).getSize_min2(),aa.getChemList().get(i).getSize_max_sign2(),aa.getChemList().get(i).getSize_max2(),aa.getChemList().get(i).getSize_min_sign2(),aa.getChemList().get(i).getSize_min2()))
									{
										continue hasSomeWrong;
									}
								}
								else
								{
									continue hasSomeWrong;
								}
								
							}else 
							{
								continue hasSomeWrong;	
							}
							
						}
						else
							//移除相同的标准项
						{
							//筛选限制条件相同
							if (detail.getChemList().get(j).getSize_code().equals("")
									&& detail.getChemList().get(j).getSize_code2().equals("")) {
								continue hasSomeWrong;
							}
							if (!detail.getChemList().get(j).getSize_code().equals("")) {

								if(detail.getChemList().get(j).getSize_code().equals(aa.getChemList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign(),detail.getChemList().get(j).getSize_max(),detail.getChemList().get(j).getSize_min_sign(),detail.getChemList().get(j).getSize_min(),aa.getChemList().get(i).getSize_max_sign(),aa.getChemList().get(i).getSize_max(),aa.getChemList().get(i).getSize_min_sign(),aa.getChemList().get(i).getSize_min()))
									{
										aa2.getChemList().remove(aa.getChemList().get(i));
									}
								}
								else if(detail.getChemList().get(j).getSize_code().equals(aa.getChemList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign(),detail.getChemList().get(j).getSize_max(),detail.getChemList().get(j).getSize_min_sign(),detail.getChemList().get(j).getSize_min(),aa.getChemList().get(i).getSize_max_sign2(),aa.getChemList().get(i).getSize_max2(),aa.getChemList().get(i).getSize_min_sign2(),aa.getChemList().get(i).getSize_min2()))
									{
										aa2.getChemList().remove(aa.getChemList().get(i));
									}
								}
								else
								{
									aa2.getChemList().remove(aa.getChemList().get(i));
								}
								
							}else if (!detail.getChemList().get(j).getSize_code2().equals("")) {

								if(detail.getChemList().get(j).getSize_code2().equals(aa.getChemList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign2(),detail.getChemList().get(j).getSize_max2(),detail.getChemList().get(j).getSize_min_sign2(),detail.getChemList().get(j).getSize_min2(),aa.getChemList().get(i).getSize_max_sign(),aa.getChemList().get(i).getSize_max(),aa.getChemList().get(i).getSize_min_sign(),aa.getChemList().get(i).getSize_min()))
									{
										aa2.getChemList().remove(aa.getChemList().get(i));
									}
								}
								else if(detail.getChemList().get(j).getSize_code2().equals(aa.getChemList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getChemList().get(j).getSize_max_sign2(),detail.getChemList().get(j).getSize_max2(),detail.getChemList().get(j).getSize_min_sign2(),detail.getChemList().get(j).getSize_min2(),aa.getChemList().get(i).getSize_max_sign2(),aa.getChemList().get(i).getSize_max2(),aa.getChemList().get(i).getSize_min_sign2(),aa.getChemList().get(i).getSize_min2()))
									{
										aa2.getChemList().remove(aa.getChemList().get(i));
									}
								}
								else
								{
									aa2.getChemList().remove(aa.getChemList().get(i));
								}
								
							}else 
							{
								aa2.getChemList().remove(aa.getChemList().get(i));	
							}
							
						}
					}
				}

			}
			
			//材质比较
			for (int i = 0; i < aa.getPhyList().size(); i++) {
				// 比较检验项名称
				if (!Phy.contains(aa.getPhyList().get(i).getPhy_code_l()+aa.getPhyList().get(i).getPhy_code_m()+aa.getPhyList().get(i).getPhy_code_s()+aa.getPhyList().get(i).getItem_code_d()+aa.getPhyList().get(i).getItem_code_s()+aa.getPhyList().get(i).getItem_code_t())) {
					continue hasSomeWrong;
				}
				for (int j = 0; j < detail.getPhyList().size(); j++) {
					//筛选标准不同的数据
					if (aa.getPhyList().get(i).getPhy_code_l()+aa.getPhyList().get(i).getPhy_code_m()+aa.getPhyList().get(i).getPhy_code_s()+aa.getPhyList().get(i).getItem_code_d()+aa.getPhyList().get(i).getItem_code_s()+aa.getPhyList().get(i).getItem_code_t() == detail.getPhyList().get(i).getPhy_code_l()+detail.getPhyList().get(i).getPhy_code_m()+detail.getPhyList().get(i).getPhy_code_s()+detail.getPhyList().get(i).getItem_code_d()+detail.getPhyList().get(i).getItem_code_s()+detail.getPhyList().get(i).getItem_code_t()) {
						if (aa.getPhyList().get(i).getStdmax_sign() != detail.getPhyList().get(j).getStdmax_sign()
								|| aa.getPhyList().get(i).getStdmin() != detail.getPhyList().get(j).getStdmin()
								|| aa.getPhyList().get(i).getStdmax_sign() != detail.getPhyList().get(j)
										.getStdmax_sign()
								|| aa.getPhyList().get(i).getStdmax() != detail.getPhyList().get(j).getStdmax()
								) {
							//筛选限制条件相同
							if (detail.getPhyList().get(j).getSize_code().equals("")
									&& detail.getPhyList().get(j).getSize_code2().equals("")) {
								continue hasSomeWrong;
							}
							if (!detail.getPhyList().get(j).getSize_code().equals("")) {

								if(detail.getPhyList().get(j).getSize_code().equals(aa.getPhyList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign(),detail.getPhyList().get(j).getSize_max(),detail.getPhyList().get(j).getSize_min_sign(),detail.getPhyList().get(j).getSize_min(),aa.getPhyList().get(i).getSize_max_sign(),aa.getPhyList().get(i).getSize_max(),aa.getPhyList().get(i).getSize_min_sign(),aa.getPhyList().get(i).getSize_min()))
									{
										continue hasSomeWrong;
									}
								}
								else if(detail.getPhyList().get(j).getSize_code().equals(aa.getPhyList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign(),detail.getPhyList().get(j).getSize_max(),detail.getPhyList().get(j).getSize_min_sign(),detail.getPhyList().get(j).getSize_min(),aa.getPhyList().get(i).getSize_max_sign2(),aa.getPhyList().get(i).getSize_max2(),aa.getPhyList().get(i).getSize_min_sign2(),aa.getPhyList().get(i).getSize_min2()))
									{
										continue hasSomeWrong;
									}
								}
								else
								{
									continue hasSomeWrong;
								}
								
							}else if (!detail.getPhyList().get(j).getSize_code2().equals("")) {

								if(detail.getPhyList().get(j).getSize_code2().equals(aa.getPhyList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign2(),detail.getPhyList().get(j).getSize_max2(),detail.getPhyList().get(j).getSize_min_sign2(),detail.getPhyList().get(j).getSize_min2(),aa.getPhyList().get(i).getSize_max_sign(),aa.getPhyList().get(i).getSize_max(),aa.getPhyList().get(i).getSize_min_sign(),aa.getPhyList().get(i).getSize_min()))
									{
										continue hasSomeWrong;
									}
								}
								else if(detail.getPhyList().get(j).getSize_code2().equals(aa.getPhyList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign2(),detail.getPhyList().get(j).getSize_max2(),detail.getPhyList().get(j).getSize_min_sign2(),detail.getPhyList().get(j).getSize_min2(),aa.getPhyList().get(i).getSize_max_sign2(),aa.getPhyList().get(i).getSize_max2(),aa.getPhyList().get(i).getSize_min_sign2(),aa.getPhyList().get(i).getSize_min2()))
									{
										continue hasSomeWrong;
									}
								}
								else
								{
									continue hasSomeWrong;
								}
								
							}else 
							{
								continue hasSomeWrong;	
							}
							
						}
						else
						{
							//筛选限制条件相同
							if (detail.getPhyList().get(j).getSize_code().equals("")
									&& detail.getPhyList().get(j).getSize_code2().equals("")) {
								aa2.getPhyList().remove(aa.getPhyList().get(i));
							}
							if (!detail.getPhyList().get(j).getSize_code().equals("")) {

								if(detail.getPhyList().get(j).getSize_code().equals(aa.getPhyList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign(),detail.getPhyList().get(j).getSize_max(),detail.getPhyList().get(j).getSize_min_sign(),detail.getPhyList().get(j).getSize_min(),aa.getPhyList().get(i).getSize_max_sign(),aa.getPhyList().get(i).getSize_max(),aa.getPhyList().get(i).getSize_min_sign(),aa.getPhyList().get(i).getSize_min()))
									{
										aa2.getPhyList().remove(aa.getPhyList().get(i));
									}
								}
								else if(detail.getPhyList().get(j).getSize_code().equals(aa.getPhyList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign(),detail.getPhyList().get(j).getSize_max(),detail.getPhyList().get(j).getSize_min_sign(),detail.getPhyList().get(j).getSize_min(),aa.getPhyList().get(i).getSize_max_sign2(),aa.getPhyList().get(i).getSize_max2(),aa.getPhyList().get(i).getSize_min_sign2(),aa.getPhyList().get(i).getSize_min2()))
									{
										aa2.getPhyList().remove(aa.getPhyList().get(i));
									}
								}
								else
								{
									aa2.getPhyList().remove(aa.getPhyList().get(i));
								}
								
							}else if (!detail.getPhyList().get(j).getSize_code2().equals("")) {

								if(detail.getPhyList().get(j).getSize_code2().equals(aa.getPhyList().get(i).getSize_code()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign2(),detail.getPhyList().get(j).getSize_max2(),detail.getPhyList().get(j).getSize_min_sign2(),detail.getPhyList().get(j).getSize_min2(),aa.getPhyList().get(i).getSize_max_sign(),aa.getPhyList().get(i).getSize_max(),aa.getPhyList().get(i).getSize_min_sign(),aa.getPhyList().get(i).getSize_min()))
									{
										aa2.getPhyList().remove(aa.getPhyList().get(i));
									}
								}
								else if(detail.getPhyList().get(j).getSize_code2().equals(aa.getPhyList().get(i).getSize_code2()))
								{
									if(JudgmentRange(detail.getPhyList().get(j).getSize_max_sign2(),detail.getPhyList().get(j).getSize_max2(),detail.getPhyList().get(j).getSize_min_sign2(),detail.getPhyList().get(j).getSize_min2(),aa.getPhyList().get(i).getSize_max_sign2(),aa.getPhyList().get(i).getSize_max2(),aa.getPhyList().get(i).getSize_min_sign2(),aa.getPhyList().get(i).getSize_min2()))
									{
										aa2.getPhyList().remove(aa.getPhyList().get(i));
									}
								}
								else
								{
									aa2.getPhyList().remove(aa.getPhyList().get(i));
								}
								
							}else 
							{
								aa2.getPhyList().remove(aa.getPhyList().get(i));
							}	
						}
					}
				}

			}
			
			
			//公差比较
			for (int i = 0; i < aa.getSpecList().size(); i++) {
				// 比较检验项名称
				if (!Spe.contains(aa.getSpecList().get(i).getBias_code())) {
					continue hasSomeWrong;
				}
				for (int j = 0; j < detail.getSpecList().size(); j++) {
					//筛选标准不同的数据
					if (aa.getSpecList().get(i).getBias_code() == detail.getSpecList().get(i).getBias_code()) {
						if (aa.getSpecList().get(i).getStd_max_formula() != detail.getSpecList().get(j).getStd_max_formula()
								|| aa.getSpecList().get(i).getStd_max_formula_v() != detail.getSpecList().get(j).getStd_max_formula_v()
								|| aa.getSpecList().get(i).getStd_max_in() != detail.getSpecList().get(j)
										.getStd_max_in()
								|| aa.getSpecList().get(i).getStd_max_percent() != detail.getSpecList().get(j).getStd_max_percent()
										|| aa.getSpecList().get(i).getStd_max_val() != detail.getSpecList().get(j).getStd_max_val()
												|| aa.getSpecList().get(i).getStd_min_formula() != detail.getSpecList().get(j).getStd_min_formula()
														|| aa.getSpecList().get(i).getStd_min_formula_v() != detail.getSpecList().get(j).getStd_min_formula_v()
														|| aa.getSpecList().get(i).getStd_min_in() != detail.getSpecList().get(j)
																.getStd_min_in()
														|| aa.getSpecList().get(i).getStd_min_percent() != detail.getSpecList().get(j).getStd_min_percent()
																|| aa.getSpecList().get(i).getStd_min_val() != detail.getSpecList().get(j).getStd_min_val()
								) {
							//筛选限制条件相同
							if (detail.getSpecList().get(j).getBias_code_c().equals("")
									&& detail.getSpecList().get(j).getBias_code_s().equals("")&& detail.getSpecList().get(j).getBias_code_z().equals("")) {
								continue hasSomeWrong;
							}
							if (!detail.getSpecList().get(j).getBias_code_s().equals("")) {

								if(detail.getSpecList().get(j).getBias_code_s().equals(aa.getSpecList().get(i).getBias_code_s()))
								{
									if(JudgmentRange(detail.getSpecList().get(j).getSmax_sign(),detail.getSpecList().get(j).getSmax(),detail.getSpecList().get(j).getSmin_sign(),detail.getSpecList().get(j).getSmin(),aa.getSpecList().get(i).getSmax_sign(),aa.getSpecList().get(i).getSmax(),aa.getSpecList().get(i).getSmin_sign(),aa.getSpecList().get(i).getSmin()))
									{
										continue hasSomeWrong;
									}
								}
								else if(detail.getSpecList().get(j).getBias_code_s().equals(aa.getSpecList().get(i).getBias_code_c()))
								{
									if(JudgmentRange(detail.getSpecList().get(j).getSmax_sign(),detail.getSpecList().get(j).getSmax(),detail.getSpecList().get(j).getSmin_sign(),detail.getSpecList().get(j).getSmin(),aa.getSpecList().get(i).getCmax_sign(),aa.getSpecList().get(i).getCmax(),aa.getSpecList().get(i).getCmin_sign(),aa.getSpecList().get(i).getCmin()))
									{
										continue hasSomeWrong;
									}
								}
								else
								{
									continue hasSomeWrong;
								}
								
							}
//								if (!detail.getSpecList().get(j).getSize_code2().equals("")) {
//
//								if(detail.getSpecList().get(j).getSize_code2().equals(aa.getSpecList().get(i).getSize_code()))
//								{
//									if(JudgmentRange(detail.getSpecList().get(j).getSize_max_sign2(),detail.getSpecList().get(j).getSize_max2(),detail.getSpecList().get(j).getSize_min_sign2(),detail.getSpecList().get(j).getSize_min2(),aa.getSpecList().get(i).getSize_max_sign(),aa.getSpecList().get(i).getSize_max(),aa.getSpecList().get(i).getSize_min_sign(),aa.getSpecList().get(i).getSize_min()))
//									{
//										continue hasSomeWrong;
//									}
//								}
//								else if(detail.getSpecList().get(j).getSize_code2().equals(aa.getSpecList().get(i).getSize_code2()))
//								{
//									if(JudgmentRange(detail.getSpecList().get(j).getSize_max_sign2(),detail.getSpecList().get(j).getSize_max2(),detail.getSpecList().get(j).getSize_min_sign2(),detail.getSpecList().get(j).getSize_min2(),aa.getSpecList().get(i).getSize_max_sign2(),aa.getSpecList().get(i).getSize_max2(),aa.getSpecList().get(i).getSize_min_sign2(),aa.getSpecList().get(i).getSize_min2()))
//									{
//										continue hasSomeWrong;
//									}
//								}
//								else
//								{
//									continue hasSomeWrong;
//								}
//							}
						
//							}
							
						}
						else
						{
							//筛选限制条件相同
							if (detail.getSpecList().get(j).getBias_code_c().equals("")
									&& detail.getSpecList().get(j).getBias_code_s().equals("")&& detail.getSpecList().get(j).getBias_code_z().equals("")) {
								aa2.getSpecList().remove(aa.getSpecList().get(i));
							}
							if (!detail.getSpecList().get(j).getBias_code_s().equals("")) {

								if(detail.getSpecList().get(j).getBias_code_s().equals(aa.getSpecList().get(i).getBias_code_s()))
								{
									if(JudgmentRange(detail.getSpecList().get(j).getSmax_sign(),detail.getSpecList().get(j).getSmax(),detail.getSpecList().get(j).getSmin_sign(),detail.getSpecList().get(j).getSmin(),aa.getSpecList().get(i).getSmax_sign(),aa.getSpecList().get(i).getSmax(),aa.getSpecList().get(i).getSmin_sign(),aa.getSpecList().get(i).getSmin()))
									{
										aa2.getSpecList().remove(aa.getSpecList().get(i));
									}
								}
								else if(detail.getSpecList().get(j).getBias_code_s().equals(aa.getSpecList().get(i).getBias_code_c()))
								{
									if(JudgmentRange(detail.getSpecList().get(j).getSmax_sign(),detail.getSpecList().get(j).getSmax(),detail.getSpecList().get(j).getSmin_sign(),detail.getSpecList().get(j).getSmin(),aa.getSpecList().get(i).getCmax_sign(),aa.getSpecList().get(i).getCmax(),aa.getSpecList().get(i).getCmin_sign(),aa.getSpecList().get(i).getCmin()))
									{
										aa2.getSpecList().remove(aa.getSpecList().get(i));
									}
								}
								else
								{
									aa2.getSpecList().remove(aa.getSpecList().get(i));
								}
								
							}
						}
					}
				}

				
				
	}
			
			//探伤比较
			for (int i = 0; i < aa.getDetectionList().size(); i++) {
				// 比较检验项名称
				if (!Spe.contains(aa.getDetectionList().get(i).getPhy_code_s())) {
					continue hasSomeWrong;
				}
				for (int j = 0; j < detail.getDetectionList().size(); j++) {
					//筛选标准不同的数据
					if (aa.getDetectionList().get(i).getPhy_code_s() == detail.getDetectionList().get(i).getPhy_code_s()) {
						if (aa.getDetectionList().get(i).getPosition_code() != detail.getDetectionList().get(j).getPosition_code()
								|| aa.getDetectionList().get(i).getStd_desc() != detail.getDetectionList().get(j).getStd_desc()
								|| aa.getDetectionList().get(i).getLv_code() != detail.getDetectionList().get(j)
										.getLv_code()
								|| aa.getDetectionList().get(i).getGroove_dir() != detail.getDetectionList().get(j).getGroove_dir()
										|| aa.getDetectionList().get(i).getGroove_pos() != detail.getDetectionList().get(j).getGroove_pos()
												|| aa.getDetectionList().get(i).getCoverage() != detail.getDetectionList().get(j).getCoverage()
														|| aa.getDetectionList().get(i).getRate() != detail.getDetectionList().get(j).getRate()
														|| aa.getDetectionList().get(i).getDesc_val() != detail.getDetectionList().get(j)
																.getDesc_val()
														
								) {
							//筛选限制条件相同
							if (detail.getDetectionList().get(j).getPhy_code_s().equals("")
									&& detail.getDetectionList().get(j).getMax_d_sign().equals("")&& detail.getDetectionList().get(j).getMax_h_sign().equals("")&& detail.getDetectionList().get(j).getMin_d_sign().equals("")&& detail.getDetectionList().get(j).getMin_h_sign().equals("")) {
								continue hasSomeWrong;
							}
							

								
									if(JudgmentRange(detail.getDetectionList().get(j).getMax_d_sign(),detail.getDetectionList().get(j).getMax_d(),detail.getDetectionList().get(j).getMin_d_sign(),detail.getDetectionList().get(j).getMin_d(),"<",aa.getDetectionList().get(i).getMax_d(),">",aa.getDetectionList().get(i).getMin_d())&&
											JudgmentRange(detail.getDetectionList().get(j).getMax_h_sign(),detail.getDetectionList().get(j).getMax_h(),detail.getDetectionList().get(j).getMin_h_sign(),detail.getDetectionList().get(j).getMin_h(),"<",aa.getDetectionList().get(i).getMax_h(),">",aa.getDetectionList().get(i).getMin_h()))
									{
										continue hasSomeWrong;
									}
								
								
							

						}
						else
						{
							//筛选限制条件相同
							if (detail.getDetectionList().get(j).getPhy_code_s().equals("")
									&& detail.getDetectionList().get(j).getMax_d_sign().equals("")&& detail.getDetectionList().get(j).getMax_h_sign().equals("")&& detail.getDetectionList().get(j).getMin_d_sign().equals("")&& detail.getDetectionList().get(j).getMin_h_sign().equals("")) {
								aa2.getDetectionList().remove(aa.getDetectionList().get(i));
							}
							

								
									if(JudgmentRange(detail.getDetectionList().get(j).getMax_d_sign(),detail.getDetectionList().get(j).getMax_d(),detail.getDetectionList().get(j).getMin_d_sign(),detail.getDetectionList().get(j).getMin_d(),"<",aa.getDetectionList().get(i).getMax_d(),">",aa.getDetectionList().get(i).getMin_d())&&
											JudgmentRange(detail.getDetectionList().get(j).getMax_h_sign(),detail.getDetectionList().get(j).getMax_h(),detail.getDetectionList().get(j).getMin_h_sign(),detail.getDetectionList().get(j).getMin_h(),"<",aa.getDetectionList().get(i).getMax_h(),">",aa.getDetectionList().get(i).getMin_h()))
									{
										aa2.getDetectionList().remove(aa.getDetectionList().get(i));
									}
								
						}
					}
				}
			}
			
			
		bb.add(detail);

		}

		return bb;

	}
	
	
	
	
	
	
	
	
	
	

	/**
	 * 验证限制条件
	 * @param singMaxA
	 * @param MaxA
	 * @param singMinA
	 * @param MinA
	 * @param singMaxB
	 * @param MaxB
	 * @param singMinB
	 * @param MinB
	 * @return
	 */
	public boolean JudgmentRange(String singMaxA,String MaxA,String singMinA,String MinA,String singMaxB,String MaxB,String singMinB,String MinB)
	{
		
		if(Double.valueOf(MaxA)<Double.valueOf(MaxB))
		{
			return false;
		}
		if(Double.valueOf(MaxA)==Double.valueOf(MaxB))
		{
			if(singMaxA.equals("=")&&!singMaxB.equals("="))
			{
				return false;
			}
			
			if(singMaxA.equals("<")&&!singMaxB.equals("<"))
			{
				return false;
			}
			
		}
		
		if(Double.valueOf(MinA)>Double.valueOf(MinB))
		{
			return false;
		}
		if(Double.valueOf(MinA)==Double.valueOf(MinB))
		{
			if(singMinA.equals("=")&&!singMinB.equals("="))
			{
				return false;
			}
			
			if(singMinA.equals(">")&&!singMinB.equals(">"))
			{
				return false;
			}
			
		}
		
		
		return true;
		
	}
	
	
	
	
	public DetailMsc GetMscStd(DetailMsc object) {

		DetailMsc detail = new DetailMsc();
		try {

			List<market.Api.Qms.vo.ComMscStdChem> dofindchem = this.getMapper(ComBaseStdMapper.class)
					.dofindchem(object);
			List<market.Api.Qms.vo.ComMscStdDetectionC> dofinddetection = this.getMapper(ComBaseStdMapper.class)
					.dofinddetection(object.getMsc(), object.getValidflag());
			List<market.Api.Qms.vo.ComMscStdPhy> dofindphy = this.getMapper(ComBaseStdMapper.class).dofindphy(object);
			List<market.Api.Qms.vo.ComMscStdSpecC> dofindspec = this.getMapper(ComBaseStdMapper.class)
					.dofindspec(object.getMsc(), object.getValidflag());

			detail.setChemList(dofindchem);
			detail.setDetectionList(dofinddetection);
			detail.setPhyList(dofindphy);
			detail.setSpecList(dofindspec);

		} catch (Exception ex) {

			ex.printStackTrace();
		}
		return detail;
	}

}