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

📄 editshipmentroutesegments.bsh

📁 国外的一套开源CRM
💻 BSH
字号:
/*
 *  Copyright (c) 2003 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     David E. Jones (jonesde@ofbiz.org)
 *@version    $Revision: 1.3 $
 *@since      2.2
 */

import java.util.*;
import org.ofbiz.entity.*;
import org.ofbiz.base.util.*;

delegator = request.getAttribute("delegator");

shipmentId = request.getParameter("shipmentId");
if (UtilValidate.isEmpty(shipmentId)) {
    shipmentId = context.get("shipmentId");
}

shipment = null;
if (UtilValidate.isNotEmpty(shipmentId)) {
    shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
}

if (shipment != null) {
    shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, UtilMisc.toList("shipmentRouteSegmentId"));
    shipmentRouteSegmentDatas = new LinkedList();
    if (shipmentRouteSegments != null && shipmentRouteSegments.size() > 0) {
        shipmentRouteSegmentIter = shipmentRouteSegments.iterator();
        while (shipmentRouteSegmentIter.hasNext()) {
            shipmentRouteSegment = shipmentRouteSegmentIter.next();
            shipmentRouteSegmentData = new HashMap();
            shipmentRouteSegmentData.put("shipmentRouteSegment", shipmentRouteSegment);
            shipmentRouteSegmentData.put("originFacility", shipmentRouteSegment.getRelatedOne("OriginFacility"));
            shipmentRouteSegmentData.put("destFacility", shipmentRouteSegment.getRelatedOne("DestFacility"));
            shipmentRouteSegmentData.put("originPostalAddress", shipmentRouteSegment.getRelatedOne("OriginPostalAddress"));
            shipmentRouteSegmentData.put("originTelecomNumber", shipmentRouteSegment.getRelatedOne("OriginTelecomNumber"));
            shipmentRouteSegmentData.put("destPostalAddress", shipmentRouteSegment.getRelatedOne("DestPostalAddress"));
            shipmentRouteSegmentData.put("destTelecomNumber", shipmentRouteSegment.getRelatedOne("DestTelecomNumber"));
            shipmentRouteSegmentData.put("shipmentMethodType", shipmentRouteSegment.getRelatedOne("ShipmentMethodType"));
            shipmentRouteSegmentData.put("carrierPerson", shipmentRouteSegment.getRelatedOne("CarrierPerson"));
            shipmentRouteSegmentData.put("carrierPartyGroup", shipmentRouteSegment.getRelatedOne("CarrierPartyGroup"));
            shipmentRouteSegmentData.put("shipmentPackageRouteSegs", shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg"));
            shipmentRouteSegmentData.put("carrierServiceStatusItem", shipmentRouteSegment.getRelatedOne("CarrierServiceStatusItem"));
            shipmentRouteSegmentData.put("currencyUom", shipmentRouteSegment.getRelatedOne("CurrencyUom"));
            shipmentRouteSegmentData.put("billingWeightUom", shipmentRouteSegment.getRelatedOne("BillingWeightUom"));
            if (UtilValidate.isNotEmpty(shipmentRouteSegment.getString("carrierServiceStatusId"))) {
                shipmentRouteSegmentData.put("carrierServiceStatusValidChangeToDetails", delegator.findByAnd("StatusValidChangeToDetail", UtilMisc.toMap("statusId", shipmentRouteSegment.get("carrierServiceStatusId")), UtilMisc.toList("sequenceId")));
            } else {
                shipmentRouteSegmentData.put("carrierServiceStatusValidChangeToDetails", delegator.findByAnd("StatusValidChangeToDetail", UtilMisc.toMap("statusId", "SHRSCS_NOT_STARTED"), UtilMisc.toList("sequenceId")));
            }
            shipmentRouteSegmentDatas.add(shipmentRouteSegmentData);
        }
    }
    
    shipmentPackages = shipment.getRelated("ShipmentPackage", null, UtilMisc.toList("shipmentPackageSeqId"));
    facilities = delegator.findAll("Facility", UtilMisc.toList("facilityName"));
    shipmentMethodTypes = delegator.findAll("ShipmentMethodType", UtilMisc.toList("description"));
    weightUoms = delegator.findByAnd("Uom", UtilMisc.toMap("uomTypeId", "WEIGHT_MEASURE"));
    currencyUoms = delegator.findByAnd("Uom", UtilMisc.toMap("uomTypeId", "CURRENCY_MEASURE"));
    
    carrierPartyRoles = delegator.findByAnd("PartyRole", UtilMisc.toMap("roleTypeId", "CARRIER"));
    carrierPartyDatas = new LinkedList();
    carrierPartyRoleIter = carrierPartyRoles.iterator();
    while (carrierPartyRoleIter.hasNext()) {
        carrierPartyRole = carrierPartyRoleIter.next();
        party = carrierPartyRole.getRelatedOne("Party");
        carrierPartyData = new HashMap();
        carrierPartyData.put("party", party);
        carrierPartyData.put("person", party.getRelatedOne("Person"));
        carrierPartyData.put("partyGroup", party.getRelatedOne("PartyGroup"));
        carrierPartyDatas.add(carrierPartyData);
    }
    
    context.put("shipment", shipment);
    context.put("shipmentRouteSegmentDatas", shipmentRouteSegmentDatas);
    context.put("shipmentPackages", shipmentPackages);
    context.put("facilities", facilities);
    context.put("shipmentMethodTypes", shipmentMethodTypes);
    context.put("weightUoms", weightUoms);
    context.put("currencyUoms", currencyUoms);
    context.put("carrierPartyDatas", carrierPartyDatas);
}

context.put("shipmentId", shipmentId);

nowTimestampString = UtilDateTime.nowTimestamp().toString();
context.put("nowTimestampString", nowTimestampString);
    

⌨️ 快捷键说明

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