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

📄 orderaction.java

📁 简易java框架开源订销管理系统 v0.1 该系统是一个使用Java语言开发,以国内开源Web MVC框架EasyJWeb作系统引擎的Java Web应用系统.系统主要实现的功能有订单录入、打印
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		{
			scope+=" and vdate>=?";
			paras.add(vdate1);
		}
		if(!vdate2.equals(""))
		{
			scope+=" and vdate<?";
			paras.add(vdate2);
		}
		if(orderField.equals(""))
			{
			orderField="vdate";
			orderType="desc";				
			}		
		scope +=" order by "+orderField;
		System.out.println(scope);
		if(!orderType.equals(""))scope+=" "+orderType;		
		
		DbPageList pList=new DbPageList(OrderInfo.class,scope,paras);
		pList.doList(1,-1);	
		if(pList!=null)
		{
			List list=pList.getResult();
			BigDecimal total=new BigDecimal(0.0);
			if(list!=null)
			{					
				for(int i=0;i<list.size();i++)
				{
					total=total.add(((OrderInfo)list.get(i)).getAmount());	
				}
			}
			form.addResult("list",pList.getResult());
			form.addResult("pages",new Integer(pList.getPages()));
			form.addResult("rows",new Integer(pList.getRowCount()));
			form.addResult("page",new Integer(pList.getCurrentPage()));
			form.addResult("gotoPageHTML",CommUtil.showPageHtml(pList.getCurrentPage(),pList.getPages()));
			form.addResult("totalAmount",total);
			form.addResult("vdate",sdf.format(new Date()));
		}
		return module.findPage("listPrint");
	}	
	private void doEditLastInputOrder(WebForm form,ActiveUser user)
	{
		OrderInfo order=OrderInfo.findLastOrder();
		if(order!=null)
		{
			form.addResult("cid",order.getCid());
			form.addResult("totalAmount",order.getAmount());
			form.addResult("status",order.getStatus());
			form.addResult("vdate",order.getVdate());
			form.addResult("linkMan",order.getLinkMan());
			form.addResult("tel",order.getTel());
			form.addResult("customer",Customer.readBySn(order.getCustomerSn()));			
			form.addResult("orderSn",order.getSn());
			List list=order.children();
			if(list!=null){
			form.addResult("orderList",order.children());
			form.addResult("childNum",new Integer(list.size()));
			}
			list=OrderInfo.query("status=-1 and cid<>'"+order.getCid()+"'");		
			form.addResult("otherList",list);
		}		
	}
	private void doManageSave(WebForm form,ActiveUser user)
	{
		String cid=CommUtil.null2String(form.get("cid"));
		String sn=CommUtil.null2String(form.get("orderSn"));		
		OrderInfo order=null;
		if(!cid.equals(""))order=OrderInfo.read(cid);
		else if(!sn.equals(""))order=OrderInfo.readBySn(sn);
		boolean op=false;
		if(order!=null)
		{
			String payment=CommUtil.null2String(form.get("payment"));
			String delivery=CommUtil.null2String(form.get("delivery"));
			String deliveryDept=CommUtil.null2String(form.get("deliveryDeptSn"));			
			if(!payment.equals(""))order.setPayment(new Integer(payment));
			if(!delivery.equals(""))order.setDelivery(new Integer(delivery));
			order.setDeliveryDept(deliveryDept);
			op=order.update();
		}
		if(op)
		{
		form.addResult("msg","保存成功!");	
		}
		else
		{
	    form.addResult("msg","保存失败!");
		}
	}	

	private void doSave(WebForm form,ActiveUser user)
	{
		Object[] s=form.getTextElement().keySet().toArray();
		if(s!=null)
		{
			String orderSn=CommUtil.null2String(form.get("orderSn"));
			String cid=CommUtil.null2String(form.get("cid"));
			OrderInfo order=null;
			boolean isNew=true;
			List cList=new ArrayList();
			String ids="";
			for(int i=0;i<s.length;i++)
			{
			if(s[i].toString().indexOf("SN")==0)
			{
				Integer sequence=new Integer(s[i].toString().substring(2));
				cList.add(sequence);
				String childId=CommUtil.null2String(form.get("childId"+sequence.intValue()));
				if(!childId.equals(""))ids+="'"+childId+"',";
			}					
			}
			if(ids.endsWith(","))ids=ids.substring(0,ids.length()-1);
			if(!cid.equals(""))
			{
				 order=OrderInfo.read(cid);
				if(order!=null)
					{										
					order.delChildren(ids);
					isNew=false;
					}
			}
			if(orderSn.equals(""))orderSn=CommUtil.getOnlyID().substring(0,16);
			String customerSn=CommUtil.null2String(form.get("customerSn"));
			String vdate=CommUtil.null2String(form.get("vdate"));
			int status=CommUtil.null2Int(form.get("status"));
			String amount=CommUtil.null2String(form.get("totalAmount"));
			if(order==null)order=new OrderInfo();
			order.setSn(orderSn);
			order.setVdate(CommUtil.formatDate(vdate));
			order.setStatus(new Integer(status));
			order.setCustomerSn(customerSn);
			order.setLinkMan(CommUtil.null2String(form.get("linkMan")));
			order.setTel(CommUtil.null2String(form.get("tel")));
			order.setBelongDept(user.getDept());
			order.setHandPerson(user.getUserName());			
			order.setInputTime(new Date());
			order.setInputUser(user.getUserName());
			order.setAmount(new BigDecimal(amount));		
			if(isNew)order.save();
			else order.update();
			//System.out.println(cList.size());
			for(int i=0;i<cList.size();i++)
			{			
			//System.out.println(s[i]);
			Integer sequence=(Integer)cList.get(i);//new Integer(s[i].toString().substring(2));
			String childId=CommUtil.null2String(form.get("childId"+sequence.intValue()));
			String title=CommUtil.null2String(form.get("title"+sequence.intValue()));
			String productSn=CommUtil.null2String(form.get("SN"+sequence.intValue()));
			String num=CommUtil.null2String(form.get("num"+sequence.intValue()));
			String width=CommUtil.null2String(form.get("width"+sequence.intValue()));
			String height=CommUtil.null2String(form.get("height"+sequence.intValue()));
			String types=CommUtil.null2String(form.get("types"+sequence.intValue()));
			String unit=CommUtil.null2String(form.get("unit"+sequence.intValue()));
			String price=CommUtil.null2String(form.get("price"+sequence.intValue()));
			String dAmount=CommUtil.null2String(form.get("amount"+sequence.intValue()));
			String cStatus=CommUtil.null2String(form.get("status"+sequence.intValue()));
			String unitType=CommUtil.null2String(form.get("unitType"+sequence.intValue()));
			String cou=CommUtil.null2String(form.get("cou"+sequence.intValue()));
			//System.out.println("单位类型:"+unitType);
			OrderList od=null;		
			if(!childId.equals(""))od=OrderList.read(childId);
			else od=new OrderList();
			od.setProductSn(productSn);
			od.setTitle(title);
			od.setNum(new Float(num));
			od.setAmount(new BigDecimal(dAmount));
			od.setPrice(new BigDecimal(price));
			od.setOrderSn(orderSn);
			od.setUnit(unit);
			od.setTypes(types);
			od.setSequence(sequence);
			od.setStatus(new Integer(cStatus));		
			od.setWidth(new Float(width));
			od.setHeight(new Float(height));
			od.setUnitType(new Integer(unitType.equals("")?"0":unitType));
			//System.out.println(cou.equals("")+cou);
			od.setCou(new Integer(cou.equals("")?"1":cou));			
			
			if(!childId.equals(""))od.update();
			else od.save();			
			}
			form.addResult("msg","保存成功!");
		}		
	}
	private void doQuery(WebForm form,IActiveUser user) {
		ActiveUser u=(ActiveUser)user;	
		int currentPage=CommUtil.null2Int(form.get("page"));
		int pageSize=CommUtil.null2Int(form.get("pageSize"));
		String orderType=CommUtil.null2String(form.get("orderType"));
		String orderField=CommUtil.null2String(form.get("orderField"));	
		if(currentPage<1)currentPage=1;
		if(pageSize<1)pageSize=15;
		String scope="status>=0 and belongDept=?";
		Collection paras=new ArrayList();
		paras.add(u.getDept());
		String customerSn=CommUtil.null2String(form.get("customerSn"));		
		String vdate1=CommUtil.null2String(form.get("vdate1"));
		String vdate2=CommUtil.null2String(form.get("vdate2"));
		String customerTitle=CommUtil.null2String(form.get("customerTitle"));		
		if(!customerSn.equals(""))
		{
			scope+=" and customerSn=?";
			paras.add(customerSn);
		}		
		else if(!customerTitle.equals(""))
		{
			scope+=" and linkMan like ? ";
			paras.add(customerTitle);
		}
		if(vdate2.equals("")&& !vdate1.equals(""))
		{
			scope+=" and vdate=?";
			paras.add(vdate1);
		}
		else if(!vdate1.equals(""))
		{
			scope+=" and vdate>=?";
			paras.add(vdate1);
		}
		if(!vdate2.equals(""))
		{
			scope+=" and vdate<?";
			paras.add(vdate2);
		}
		if(orderField.equals(""))
			{
			orderField="vdate";
			orderType="desc";				
			}		
		scope +=" order by "+orderField;
		if(!orderType.equals(""))scope+=" "+orderType;		
		
		DbPageList pList=new DbPageList(OrderInfo.class,scope,paras);
		pList.doList(currentPage,pageSize);	
		if(pList!=null)
		{
			form.addResult("list",pList.getResult());
			form.addResult("pages",new Integer(pList.getPages()));
			form.addResult("rows",new Integer(pList.getRowCount()));
			form.addResult("page",new Integer(pList.getCurrentPage()));
			form.addResult("gotoPageHTML",CommUtil.showPageHtml(pList.getCurrentPage(),pList.getPages()));
		}
	}	
}

⌨️ 快捷键说明

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