/***文档注释***********************************************
 * 作者            ：
 * 创建日期     ：2018-01-30
 * 描述            ：质量设计-MSC（主记录）
1、同一条合同行只有一条质量设计主数据，之前的有效标识全部置为“0”
 * 注意事项     ：
 * 遗留BUG   ：
 * 修改日期     ：
 * 修改人员     ：
 * 修改内容     ：
***********************************************************/
package market.Qms.slmord.impl;

import java.util.List;

import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Qms.slmord.mapper.SlmOrdDesignMscDMapper;
import market.Qms.slmord.mapper.SlmOrdDesignMscMapper;
import market.Qms.slmord.service.SlmOrdDesignMscService;
import market.Qms.slmord.vo.SlmOrdDesignMsc;
import market.Qms.slmord.vo.SlmOrdDesignMscD;

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

@RemoteService(path="SlmOrdDesignMscService")
public class SlmOrdDesignMscServiceImpl extends BaseServiceImpl<SlmOrdDesignMsc,Object> implements SlmOrdDesignMscService {

	/**
	 * 获取主、副产品码
	 * @param designKey
	 * @return
	 */
	public ResultModel GetSlmOrdDesignMsc(String designKey){
		ResultModel rm=new ResultModel();
		try{
			SlmOrdDesignMsc _designMsc=new SlmOrdDesignMsc();
			_designMsc.setDesign_key(designKey);
			_designMsc.setValidflag("1");
			List<SlmOrdDesignMsc> listDesign=this.getMapper(SlmOrdDesignMscMapper.class).find(_designMsc, 0, 0);
			SlmOrdDesignMscD _designMscD=new SlmOrdDesignMscD();
			_designMscD.setDesign_key(designKey);
			_designMscD.setValidflag("1");
			List<SlmOrdDesignMscD> listDesignD=this.getMapper(SlmOrdDesignMscDMapper.class).find(_designMscD, 0, 0);
			for (SlmOrdDesignMscD slmOrdDesignMscD : listDesignD) {
				SlmOrdDesignMsc designMsc=new SlmOrdDesignMsc();
				designMsc.setPsc(slmOrdDesignMscD.getPsc());
				designMsc.setPsc_desc(slmOrdDesignMscD.getPsc_desc());
				listDesign.add(designMsc);
			}
			rm.setData(listDesign);
			rm.setState("200");
			rm.setMsgInfo("获取数据成功");
		}catch(Exception ex){
			rm.setState("500");
			rm.setErrorInfo(ex.getMessage());
			rm.setMsgInfo("获取数据失败");
		}
		return rm;
	}
	
	/**
	 * 
	 * @param cp
	 * @return
	 */
	public ResultModel doSlect(CommonPage<SlmOrdDesignMsc> cp) {
		ResultModel rm = new ResultModel();
		try {

			SlmOrdDesignMsc Tk = new SlmOrdDesignMsc();
			List<SlmOrdDesignMsc> list = this.getMapper(SlmOrdDesignMscMapper.class).find(Tk, 0, 0);
				rm.setData(list);
				rm.setState("200");
		} catch (Exception e) {
			rm.setState("500");
			rm.setMsgInfo("查询失败");
		}
		return rm;
	}

}
