/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.yuntong.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.yuntong.business.vo.Y_splitInfoVO;
import com.yuntong.service.Y_ISplitRegister;
import com.yuntong.service.impl.Y_RegisterManagerService;

/** 
 * MyEclipse Struts
 * Creation date: 04-07-2007
 * 初始化未估价货票管理界面
 * XDoclet definition:
 * @struts.action validate="true"
 */
public class Y_GoWGHPAction extends Action {
	private Log log = LogFactory.getLog(Y_RegisterManagerService.class);
	private Y_ISplitRegister register;	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		//初始化厂商信息
		List flist=register.findAllFactoryInfo();
		//初始化客户信息
		List clist=register.findAllClientInfo();
		Y_splitInfoVO spInfo=new Y_splitInfoVO();		
		//1.得到总页数
		int pageNum=register.getPageNum(16);
		
		//设置总页数
		spInfo.setPageNum(pageNum+1);
		log.info("总页数:"+pageNum);
		//设置每页大小
		spInfo.setPageSize(16);
		//设置当前页
		spInfo.setCurPage(1);
		//得到第一页
		List list=register.findSplitRegisterInfo(16, 1);
		HttpSession session=request.getSession();
		//保存页面信息
		session.removeAttribute("Y_pageinfo");
		session.setAttribute("Y_pageinfo", list);
		//保存分页信息
		session.removeAttribute("Y_spInfo");
		session.setAttribute("Y_spInfo", spInfo);
		//保存厂商信息
		session.setAttribute("Y_fselect", flist);
		//保存客户信息
		session.setAttribute("Y_cselect", clist);
		//删除查询条件
		session.removeAttribute("Y_selectr2");
		log.info("--------------------------------初始未估货票页面成功-----------------------------------");
		return mapping.findForward("gowghp");
	}
	public Y_ISplitRegister getRegister() {
		return register;
	}
	public void setRegister(Y_ISplitRegister register) {
		this.register = register;
	}
}