⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 orderviewaction.java

📁 SSH示范
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.iplan.portal.order.action;

import java.util.ArrayList;
import java.util.List;

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

import org.apache.commons.beanutils.BasicDynaBean;
import org.apache.commons.beanutils.BasicDynaClass;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaClass;
import org.apache.commons.beanutils.DynaProperty;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.iplan.portal.admin.pojo.Area;
import com.iplan.portal.admin.service.IAreaService;
import com.iplan.portal.framework.Constants;
import com.iplan.portal.framework.base.struts.BaseAction;
import com.iplan.portal.order.pojo.OrderInfo;
import com.iplan.portal.order.service.ICustomerService;
import com.iplan.portal.order.service.IOrderService;
import com.iplan.portal.order.service.ISalespersonsService;
import com.iplan.portal.order.service.IWarehouseService;

/**
 * http://www.hao-se.cn
 * 
 * @author ws
 */
public class OrderViewAction extends BaseAction {
	IOrderService orderService;

	ICustomerService customerService;

	ISalespersonsService salespersonsService;

	IWarehouseService warehouseService;

	IAreaService areaService;

	public IOrderService getOrderService() {
		return orderService;
	}

	public void setOrderService(IOrderService orderService) {
		this.orderService = orderService;
	}

	public ICustomerService getCustomerService() {
		return customerService;
	}

	public void setCustomerService(ICustomerService customerService) {
		this.customerService = customerService;
	}

	public ISalespersonsService getSalespersonsService() {
		return salespersonsService;
	}

	public void setSalespersonsService(ISalespersonsService salespersonsService) {
		this.salespersonsService = salespersonsService;
	}

	public IWarehouseService getWarehouseService() {
		return warehouseService;
	}

	public void setWarehouseService(IWarehouseService warehouseService) {
		this.warehouseService = warehouseService;
	}

	public IAreaService getAreaService() {
		return areaService;
	}

	public void setAreaService(IAreaService areaService) {
		this.areaService = areaService;
	}

	public ActionForward select(ActionMapping actionMapping,
			ActionForm actionForm, HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {

		List list = this.getAreaService().getUsedAreaListByUserId(
				(httpServletRequest.getSession()
						.getAttribute(Constants.CURRENT_USER_GUID)).toString());
		httpServletRequest.setAttribute("items", list);

		String sign = httpServletRequest.getParameter("sign");
		httpServletRequest.setAttribute("sign", sign);

		return actionMapping.findForward("AreaSelectList");
	}

	public ActionForward list(ActionMapping actionMapping,
			ActionForm actionForm, HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		DynaActionForm daf = (DynaActionForm) actionForm;
		OrderInfo orderInfo = (OrderInfo) daf.get("orderInfo");
		String areaId = orderInfo.getAreaid();
		String userId = httpServletRequest.getSession().getAttribute(
				Constants.CURRENT_USER_GUID).toString();

		if (areaId == null || "".equals(areaId)) {
			areaId = (String) httpServletRequest.getSession().getAttribute(
					"areaid");
		} else {
			httpServletRequest.getSession().setAttribute("areaid", areaId);
		}

		List list = this.getOrderService().getOrderInfoList(areaId, userId);
		setOrderInfo(list, httpServletRequest);

		// 处理结果信息
		setOkInfo(httpServletRequest);

		Area area = this.getAreaService().getAreaById(areaId);
		httpServletRequest.setAttribute("areaName", area.getAreaName());

		return actionMapping.findForward("OrderInfoViewList");
	}

	public ActionForward edit(ActionMapping actionMapping,
			ActionForm actionForm, HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {

		DynaActionForm daf = (DynaActionForm) actionForm;
		String areaId = (String) httpServletRequest.getSession().getAttribute(
				"areaid");

		String update = (String) httpServletRequest.getParameter("update");
		if (update != null && !"".equals(update)) {
			httpServletRequest.setAttribute("update", update);
			String id = (String) httpServletRequest.getParameter("editnumber");
			OrderInfo orderInfo = this.getOrderService().getOrderInfoById(id);
			String ok = orderInfo.getOk();
			String handmadeFlg = orderInfo.getHandmadeFlg();

			if ("NO".equals(ok)) {
				orderInfo.setOk("订单正在处理中...");
			} else if ("OK".equals(ok)) {
				if ("OK".equals(handmadeFlg)) {
					orderInfo.setOk("订单处理完毕(手工单处理)");
				} else {
					orderInfo.setOk("订单处理完毕");
				}
			}
			daf.set("orderInfo", orderInfo);
		}

		setInfo(httpServletRequest, areaId);

		return actionMapping.findForward("OrderInfoViewEdit");
	}

	public ActionForward search(ActionMapping actionMapping,
			ActionForm actionForm, HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		DynaActionForm daf = (DynaActionForm) actionForm;
		OrderInfo orderInfo = (OrderInfo) daf.get("orderInfo");

		String areaId = (String) httpServletRequest.getSession().getAttribute(
				"areaid");

		String userId = httpServletRequest.getSession().getAttribute(
				Constants.CURRENT_USER_GUID).toString();
		// 订单月份
		String month = orderInfo.getMonth();
		if (month == null) {
			month = (String) httpServletRequest.getSession().getAttribute(Constants.OrderView_Month);
		} else {
			httpServletRequest.getSession().setAttribute(Constants.OrderView_Month, month);
		}

		// 订单处理结果
		String ok = orderInfo.getOk();
		if (ok == null) {
			ok = (String) httpServletRequest.getSession().getAttribute(Constants.OrderView_Ok);
		} else {
			httpServletRequest.getSession().setAttribute(Constants.OrderView_Ok, ok);
		}		
		
		// 订单号
		String orderNo = orderInfo.getOrderNo();
		if (orderNo == null) {
			orderNo = (String) httpServletRequest.getSession().getAttribute(Constants.OrderView_OrderNo);
		} else {
			httpServletRequest.getSession().setAttribute(Constants.OrderView_OrderNo, orderNo.trim());
			orderNo = orderNo.trim();
		}	
		
		// 订单日期
		String orderDateStr = orderInfo.getOrderDateStr();
		if (orderDateStr == null) {
			orderDateStr = (String) httpServletRequest.getSession().getAttribute(Constants.OrderView_OrderDateStr);
		} else {
			httpServletRequest.getSession().setAttribute(Constants.OrderView_OrderDateStr, orderDateStr);
		}	
		
		String orderDateStr2 = orderInfo.getOrderDateStr2();
		if (orderDateStr2 == null) {
			orderDateStr2 = (String) httpServletRequest.getSession().getAttribute(Constants.OrderView_OrderDateStr2);
		} else {
			httpServletRequest.getSession().setAttribute(Constants.OrderView_OrderDateStr2, orderDateStr2);
		}	
		
		// 客户名称
		String customerName = orderInfo.getCustomerName();
		if (customerName == null) {
			customerName = (String) httpServletRequest.getSession().getAttribute(Constants.OrderView_CustomerName);
		} else {
			httpServletRequest.getSession().setAttribute(Constants.OrderView_CustomerName, customerName.trim());
			customerName = customerName.trim();
		}	
		
		// 打印装箱单时间
		String printingDateStr = orderInfo.getPrintingDateStr();
		if (printingDateStr == null) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -