package market.Lms.Consumable.impl;

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

import market.Com.pb.PbMethod;
import market.Lms.Consumable.mapper.LmsConsumableOutInfoMapper;
import market.Lms.Consumable.service.LmsConsumableOutInfoService;
import market.Lms.Consumable.vo.LmsConsumableOutInfo;

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

@RemoteService(path="LmsConsumableOutInfo")
public class LmsConsumableOutInfoServiceImpl extends BaseServiceImpl<LmsConsumableOutInfo,Object> implements LmsConsumableOutInfoService{

	//新增
	public String doAdd(LmsConsumableOutInfo out){
		String id = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())+PbMethod.RandomCreate(3);
		String userId = (String) this.getSession().getAttribute(HomeService.SESSION_USER_ID);
		String userName=(String) this.getSession().getAttribute(HomeService.SESSION_USER_NAME);
		if(out.getOut_no()==null)
			out.setOut_no(id);
		out.setCreate_man_no(userId);
		out.setCreate_man_name(userName);
		out.setCreate_time(new Date());
		out.setValid_flag("1");
		this.getMapper(LmsConsumableOutInfoMapper.class).insert(out);
		return id;
	}

	//删除
	public void doDelete(LmsConsumableOutInfo out){
		this.getMapper(LmsConsumableOutInfoMapper.class).delete(out.getOut_no());
	}

	//修改
	public void doUpdate(LmsConsumableOutInfo out){
		this.getMapper(LmsConsumableOutInfoMapper.class).update(out);
	}

	//查询
	public LmsConsumableOutInfo doQuery(String outNo){
		LmsConsumableOutInfo out = new LmsConsumableOutInfo();
		out = this.getMapper(LmsConsumableOutInfoMapper.class).findById(outNo);
		return out;
	}
}
