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

import java.text.SimpleDateFormat;
import java.util.Date;

import market.Com.vo.CommonPage;
import market.Com.vo.ResultModel;
import market.Qms.qcm.mapper.QcmJudgeMarginalMapper;
import market.Qms.qcm.service.QcmJudgeMarginalService;
import market.Qms.qcm.vo.QcmJudgeMarginal;

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

@RemoteService(path="QcmJudgeMarginalService")
public class QcmJudgeMarginalServiceImpl extends BaseServiceImpl<QcmJudgeMarginal, String> implements QcmJudgeMarginalService {
	
	/**
	 * 确认按钮
	 * @param qm
	 * @return
	 */
	public ResultModel doAddMarginal(CommonPage<QcmJudgeMarginal> qm) {
		ResultModel rm =new ResultModel();
		QcmJudgeMarginal marginal =qm.getObject();
		try {
			//生产索引号
			String id =this.getMapper(QcmJudgeMarginalMapper.class).doFindLs();
			marginal.setMarginalIndex(id);
			//取当前时间为检测时间
			SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmssSSS");
			Date time =null;
			time= sdf.parse(sdf.format(new Date()));
			marginal.setJudgeTime(time);
			//获取contractLineNo
			String line =this.getMapper(QcmJudgeMarginalMapper.class).GexMaxLineNo();
			line =marginal.getContractLineNo()+line;
			this.getMapper(QcmJudgeMarginalMapper.class).insert(marginal);
			rm.setState("200");
		} catch (Exception e) {
			rm.setMsgInfo("确认失败");
			rm.setState("500");
		}
		return rm;
	}
	
}
