package market.Lms.Consumable.impl;

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

import market.Com.pb.PbMethod;
import market.Lms.Consumable.mapper.LmsConsumableWriteOffInfoMapper;
import market.Lms.Consumable.service.LmsConsumableWriteOffInfoService;
import market.Lms.Consumable.vo.LmsConsumableWriteOffInfo;

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

@RemoteService(path="LmsConsumableWriteOffInfo")
public class LmsConsumableWriteOffInfoServiceImpl extends BaseServiceImpl<LmsConsumableWriteOffInfo,Object> implements LmsConsumableWriteOffInfoService{
	//新增
	public String doAdd(LmsConsumableWriteOffInfo write){
		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);
		write.setOff_no(id);
		write.setCreate_man_no(userId);
		write.setCreate_man_name(userName);
		write.setCreate_time(new Date());
		write.setValid_flag("1");
		this.getMapper(LmsConsumableWriteOffInfoMapper.class).insert(write);
		return id;
	}

	//删除
	public void doDelete(LmsConsumableWriteOffInfo write){
		this.getMapper(LmsConsumableWriteOffInfoMapper.class).delete(write.getOff_no());
	}

	//修改
	public void doUpdate(LmsConsumableWriteOffInfo write){
		this.getMapper(LmsConsumableWriteOffInfoMapper.class).update(write);
	}

	//查询
	public LmsConsumableWriteOffInfo doQuery(String writeNo){
		LmsConsumableWriteOffInfo write = new LmsConsumableWriteOffInfo();
		write = this.getMapper(LmsConsumableWriteOffInfoMapper.class).findById(writeNo);
		return write;
	}
}
