📄 findorders.bsh
字号:
/* * Copyright (c) 2003-2005 The Open For Business Project - www.ofbiz.org * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * *@author Andy Zeneski (jaz@ofbiz.org) *@version $Rev: 7116 $ *@since 2.2*/import java.util.*;import java.sql.Timestamp;import org.ofbiz.entity.*;import org.ofbiz.entity.util.*;import org.ofbiz.entity.condition.*;import org.ofbiz.entity.transaction.*;import org.ofbiz.base.util.*;import org.ofbiz.product.product.*;module = "findOrders.bsh";delegator = request.getAttribute("delegator");security = request.getAttribute("security");// get the order typesorderTypes = delegator.findAll("OrderType", UtilMisc.toList("description"));context.put("orderTypes", orderTypes);// get the role typesroleTypes = delegator.findAll("RoleType", UtilMisc.toList("description"));context.put("roleTypes", roleTypes);// get the order statusesorderStatuses = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", "ORDER_STATUS"), UtilMisc.toList("sequenceId", "description"));context.put("orderStatuses", orderStatuses);// get websiteswebsites = delegator.findAll("WebSite", UtilMisc.toList("siteName"));context.put("webSites", websites);// get the storesstores = delegator.findAll("ProductStore", UtilMisc.toList("storeName"));context.put("productStores", stores);// get the channelschannels = delegator.findByAnd("Enumeration", UtilMisc.toMap("enumTypeId", "ORDER_SALES_CHANNEL"), UtilMisc.toList("sequenceId"));context.put("salesChannels", channels);// current role typecurrentRoleTypeId = request.getParameter("roleTypeId");if (currentRoleTypeId != null && currentRoleTypeId.length() > 0) { currentRole = delegator.findByPrimaryKeyCache("RoleType", UtilMisc.toMap("roleTypeId", currentRoleTypeId)); context.put("currentRole", currentRole);}// current selected typecurrentTypeId = request.getParameter("orderTypeId");if (currentTypeId != null && currentTypeId.length() > 0) { currentType = delegator.findByPrimaryKeyCache("OrderType", UtilMisc.toMap("orderTypeId", currentTypeId)); context.put("currentType", currentType);}// current selected statuscurrentStatusId = request.getParameter("orderStatusId");if (currentStatusId != null && currentStatusId.length() > 0) { currentStatus = delegator.findByPrimaryKeyCache("StatusItem", UtilMisc.toMap("statusId", currentStatusId)); context.put("currentStatus", currentStatus);}// current websitecurrentWebSiteId = request.getParameter("webSiteId");if (currentWebSiteId != null && currentWebSiteId.length() > 0) { currentWebSite = delegator.findByPrimaryKeyCache("WebSite", UtilMisc.toMap("webSiteId", currentWebSiteId)); context.put("currentWebSite", currentWebSite);}// current storecurrentProductStoreId = request.getParameter("productStoreId");if (currentProductStoreId != null && currentProductStoreId.length() > 0) { currentProductStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", currentProductStoreId)); context.put("currentProductStore", currentProductStore);}// current channelcurrentSalesChannelId = request.getParameter("salesChannelEnumId");if (currentSalesChannelId != null && currentSalesChannelId.length() > 0) { currentSalesChannel = delegator.findByPrimaryKey("Enumeration", UtilMisc.toMap("enumId", currentSalesChannelId)); context.put("currentSalesChannel", currentSalesChannel);}// create the fromDate for calendarfromCal = Calendar.getInstance();fromCal.setTime(new java.util.Date());//fromCal.set(Calendar.DAY_OF_WEEK, fromCal.getActualMinimum(Calendar.DAY_OF_WEEK));fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY));fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE));fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND));fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND));fromTs = new Timestamp(fromCal.getTimeInMillis());fromStr = fromTs.toString();fromStr = fromStr.substring(0, fromStr.indexOf('.'));context.put("fromDateStr", fromStr);// create the thruDate for calendartoCal = Calendar.getInstance();toCal.setTime(new java.util.Date());//toCal.set(Calendar.DAY_OF_WEEK, toCal.getActualMaximum(Calendar.DAY_OF_WEEK));toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY));toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE));toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND));toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND));toTs = new Timestamp(toCal.getTimeInMillis());toStr = toTs.toString();context.put("thruDateStr", toStr);// set the page parametersviewIndex = 1;try { viewIndex = Integer.valueOf((String) request.getParameter("VIEW_INDEX")).intValue();} catch (Exception e) { viewIndex = 1;}context.put("viewIndex", viewIndex);viewSize = 20;try { viewSize = Integer.valueOf((String) request.getParameter("VIEW_SIZE")).intValue();} catch (Exception e) { viewSize = 20;}context.put("viewSize", viewSize);// get the lookup flaglookupFlag = request.getParameter("lookupFlag");// blank param listparamList = "";// definedorderHeaderList = null;orderHeaderListSize = 0;lowIndex = 0;highIndex = 0;if (lookupFlag != null) { showAll = request.getParameter("showAll") != null ? request.getParameter("showAll") : "N"; paramList = paramList + "&lookupFlag=" + lookupFlag + "&showAll=" + showAll; locale = UtilHttp.getLocale(request); uiLabelMap = UtilProperties.getResourceBundleMap("OrderErrorUiLabels", locale); lookupErrorMessage = null; andExprs = new ArrayList(); entityName = "OrderHeader"; // check for a orderId (happens in some browsers) orderId = request.getParameter("orderId"); if (orderId != null && orderId.length() > 0) { paramList = paramList + "&orderId=" + orderId; andExprs.add(new EntityExpr("orderId", EntityOperator.EQUALS, orderId)); } // find the orders for party partyId = request.getParameter("partyId"); userLoginId = request.getParameter("userLoginId"); if (userLoginId != null && userLoginId.length() > 0) { requestedUserLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", userLoginId)); if (requestedUserLogin != null) { partyId = requestedUserLogin.getString("partyId"); } else { lookupErrorMessage = uiLabelMap.get("OrderNoUserLoginFoundForUserLoginId") + userLoginId; } } if (partyId != null && partyId.length() > 0) { paramList = paramList + "&partyId=" + partyId; entityName = "OrderHeaderAndRoles"; andExprs.add(new EntityExpr("partyId", EntityOperator.EQUALS, partyId)); } // item related correspondingPoId = request.getParameter("correspondingPoId"); if (correspondingPoId != null && correspondingPoId.length() > 0) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -