package market.Lms.Consumable.impl;

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

import market.Com.pb.PbMethod;
import market.Lms.Consumable.mapper.LmsConsumableOutGoodInfoMapper;
import market.Lms.Consumable.service.LmsConsumableOutGoodInfoService;
import market.Lms.Consumable.vo.LmsConsumableOutGoodInfo;

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

@RemoteService(path="LmsConsumableOutGoodInfo")
public class LmsConsumableOutGoodInfoServiceImpl extends BaseServiceImpl<LmsConsumableOutGoodInfo,Object> implements LmsConsumableOutGoodInfoService{

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

	//删除
	public void doDelete(LmsConsumableOutGoodInfo outGood){
		this.getMapper(LmsConsumableOutGoodInfoMapper.class).delete(outGood.getOut_good_no());
	}

	//修改
	public void doUpdate(LmsConsumableOutGoodInfo outGood){
		this.getMapper(LmsConsumableOutGoodInfoMapper.class).update(outGood);
	}

	//查询
	public LmsConsumableOutGoodInfo doQuery(String outGoodNo){
		LmsConsumableOutGoodInfo outGood = new LmsConsumableOutGoodInfo();
		outGood = this.getMapper(LmsConsumableOutGoodInfoMapper.class).findById(outGoodNo);
		return outGood;
	}

}
