package market.Lms.Consumable.impl;

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

import market.Com.pb.PbMethod;
import market.Lms.Consumable.mapper.LmsConsumableOveroutInfoMapper;
import market.Lms.Consumable.service.LmsConsumableOveroutInfoService;
import market.Lms.Consumable.vo.LmsConsumableOveroutInfo;

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

@RemoteService(path="LmsConsumableOveroutInfo")
public class LmsConsumableOveroutInfoServiceImpl extends BaseServiceImpl<LmsConsumableOveroutInfo,Object> implements LmsConsumableOveroutInfoService{

	//新增
	public String doAdd(LmsConsumableOveroutInfo overoutInfo){
		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);
		overoutInfo.setOverout_no(id);
		overoutInfo.setCreate_man_no(userId);
		overoutInfo.setCreate_man_name(userName);
		overoutInfo.setCreate_time(new Date());
		overoutInfo.setValid_flag("1");
		this.getMapper(LmsConsumableOveroutInfoMapper.class).insert(overoutInfo);
		return id;
	}

	//删除
	public void doDelete(LmsConsumableOveroutInfo overoutInfo){
		this.getMapper(LmsConsumableOveroutInfoMapper.class).delete(overoutInfo.getOverout_no());
	}

	//修改
	public void doUpdate(LmsConsumableOveroutInfo overoutInfo){
		this.getMapper(LmsConsumableOveroutInfoMapper.class).update(overoutInfo);
	}

	//查询
	public LmsConsumableOveroutInfo doQuery(String overoutInfoNo){
		LmsConsumableOveroutInfo overoutInfo = new LmsConsumableOveroutInfo();
		overoutInfo = this.getMapper(LmsConsumableOveroutInfoMapper.class).findById(overoutInfoNo);
		return overoutInfo;
	}
}
