當前位置: 首頁>>代碼示例>>Java>>正文


Java PackingSession類代碼示例

本文整理匯總了Java中org.ofbiz.shipment.packing.PackingSession的典型用法代碼示例。如果您正苦於以下問題:Java PackingSession類的具體用法?Java PackingSession怎麽用?Java PackingSession使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PackingSession類屬於org.ofbiz.shipment.packing包,在下文中一共展示了PackingSession類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testMultipleInventoryItemIssuance

import org.ofbiz.shipment.packing.PackingSession; //導入依賴的package包/類
public void testMultipleInventoryItemIssuance() throws Exception {
    String facilityId = "ScipioShopWarehouse";
    String productId="CAM-2644";
    String orderId="DEMO81015";
    String orderItemSeqId="00001";
    String shipGroupSeqId="00001";
    String shipmentItemSeqId = "00001";
    
    PackingSession packSession = new PackingSession(dispatcher, userLogin, facilityId, null, orderId, shipGroupSeqId);
    packSession.addOrIncreaseLine(orderId, orderItemSeqId, shipGroupSeqId, productId, BigDecimal.valueOf(6L), 1,
        BigDecimal.valueOf(1000L), false);
    String shipmentId = packSession.complete(false);

    GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).cache().queryOne();

    // Test the OrderShipment is correct
    List<GenericValue> orderShipments = orderHeader.getRelated("OrderShipment", null, null, false);
    
    assertFalse("No OrderShipment for order", UtilValidate.isEmpty(orderShipments));
    assertEquals( "Incorrect number of OrderShipments for order", 1, orderShipments.size());
    
    GenericValue orderShipment = orderShipments.get(0);
    assertEquals(orderItemSeqId, orderShipment.getString("orderItemSeqId"));
    assertEquals(shipGroupSeqId, orderShipment.getString("shipGroupSeqId"));
    assertEquals(shipmentId, orderShipment.getString("shipmentId"));
    assertEquals(shipmentItemSeqId, orderShipment.getString("shipmentItemSeqId"));
    BigDecimal actual = orderShipment.getBigDecimal("quantity");
    assertTrue("Incorrect quantity in OrderShipment. Expected 6.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(6L))==0);

    // Test the ItemIssuances are correct
    List<GenericValue> itemIssuances = orderHeader.getRelated("ItemIssuance", null, UtilMisc.toList("itemIssuanceId"), false);
    assertFalse("No ItemIssuances for order", UtilValidate.isEmpty(itemIssuances));
    assertEquals( "Incorrect number of ItemIssuances for order", 2, itemIssuances.size());
    
    GenericValue itemIssuance = itemIssuances.get(0);
    assertEquals(orderItemSeqId, itemIssuance.getString("orderItemSeqId"));
    assertEquals(shipGroupSeqId, itemIssuance.getString("shipGroupSeqId"));
    assertEquals(shipmentId, itemIssuance.getString("shipmentId"));
    assertEquals(shipmentItemSeqId, itemIssuance.getString("shipmentItemSeqId"));
    assertEquals("9001", itemIssuance.getString("inventoryItemId"));
    actual = itemIssuance.getBigDecimal("quantity");
    assertTrue("Incorrect quantity in ItemIssuance. Expected 5.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(5L))==0);

    itemIssuance = itemIssuances.get(1);
    assertEquals(orderItemSeqId, itemIssuance.getString("orderItemSeqId"));
    assertEquals(shipGroupSeqId, itemIssuance.getString("shipGroupSeqId"));
    assertEquals(shipmentId, itemIssuance.getString("shipmentId"));
    assertEquals(shipmentItemSeqId, itemIssuance.getString("shipmentItemSeqId"));
    assertEquals("9025", itemIssuance.getString("inventoryItemId"));
    actual = itemIssuance.getBigDecimal("quantity");
    assertTrue("Incorrect quantity in ItemIssuance. Expected 1.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(1L))==0);

    // Test reservations have been removed
    List<GenericValue> reservations = orderHeader.getRelated("OrderItemShipGrpInvRes", null, null, false);
    assertTrue("Reservations exist for order - should have been deleted", UtilValidate.isEmpty(reservations));
    
    // Test order header status is now ORDER_COMPLETED
    assertEquals(orderHeader.getString("statusId"), "ORDER_COMPLETED");
    
    // Test order items status are now ITEM_COMPLETED
    List<GenericValue> orderItems = orderHeader.getRelated("OrderItem", null, null, false);
    
    for ( GenericValue orderItem : orderItems )
        assertEquals("ITEM_COMPLETED", orderItem.getString("statusId"));
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:66,代碼來源:IssuanceTest.java

示例2: testMultipleInventoryItemIssuance

import org.ofbiz.shipment.packing.PackingSession; //導入依賴的package包/類
public void testMultipleInventoryItemIssuance() throws Exception {
    String facilityId = "WebStoreWarehouse";
    String productId="GZ-2644";
    String orderId="DEMO81015";
    String orderItemSeqId="00001";
    String shipGroupSeqId="00001";
    String shipmentItemSeqId = "00001";
    
    PackingSession packSession = new PackingSession(dispatcher, userLogin, facilityId, null, orderId, shipGroupSeqId);
    packSession.addOrIncreaseLine(orderId, orderItemSeqId, shipGroupSeqId, productId, BigDecimal.valueOf(6L), 1,
        BigDecimal.valueOf(1000L), false);
    String shipmentId = packSession.complete(false);

    GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), true);

    // Test the OrderShipment is correct
    List<GenericValue> orderShipments = orderHeader.getRelated("OrderShipment", null, null, false);
    
    assertFalse("No OrderShipment for order", UtilValidate.isEmpty(orderShipments));
    assertEquals( "Incorrect number of OrderShipments for order", 1, orderShipments.size());
    
    GenericValue orderShipment = orderShipments.get(0);
    assertEquals(orderItemSeqId, orderShipment.getString("orderItemSeqId"));
    assertEquals(shipGroupSeqId, orderShipment.getString("shipGroupSeqId"));
    assertEquals(shipmentId, orderShipment.getString("shipmentId"));
    assertEquals(shipmentItemSeqId, orderShipment.getString("shipmentItemSeqId"));
    BigDecimal actual = orderShipment.getBigDecimal("quantity");
    assertTrue("Incorrect quantity in OrderShipment. Expected 6.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(6L))==0);

    // Test the ItemIssuances are correct
    List<GenericValue> itemIssuances = orderHeader.getRelated("ItemIssuance", null, UtilMisc.toList("itemIssuanceId"), false);
    assertFalse("No ItemIssuances for order", UtilValidate.isEmpty(itemIssuances));
    assertEquals( "Incorrect number of ItemIssuances for order", 2, itemIssuances.size());
    
    GenericValue itemIssuance = itemIssuances.get(0);
    assertEquals(orderItemSeqId, itemIssuance.getString("orderItemSeqId"));
    assertEquals(shipGroupSeqId, itemIssuance.getString("shipGroupSeqId"));
    assertEquals(shipmentId, itemIssuance.getString("shipmentId"));
    assertEquals(shipmentItemSeqId, itemIssuance.getString("shipmentItemSeqId"));
    assertEquals("9001", itemIssuance.getString("inventoryItemId"));
    actual = itemIssuance.getBigDecimal("quantity");
    assertTrue("Incorrect quantity in ItemIssuance. Expected 5.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(5L))==0);

    itemIssuance = itemIssuances.get(1);
    assertEquals(orderItemSeqId, itemIssuance.getString("orderItemSeqId"));
    assertEquals(shipGroupSeqId, itemIssuance.getString("shipGroupSeqId"));
    assertEquals(shipmentId, itemIssuance.getString("shipmentId"));
    assertEquals(shipmentItemSeqId, itemIssuance.getString("shipmentItemSeqId"));
    assertEquals("9025", itemIssuance.getString("inventoryItemId"));
    actual = itemIssuance.getBigDecimal("quantity");
    assertTrue("Incorrect quantity in ItemIssuance. Expected 1.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(1L))==0);

    // Test reservations have been removed
    List<GenericValue> reservations = orderHeader.getRelated("OrderItemShipGrpInvRes", null, null, false);
    assertTrue("Reservations exist for order - should have been deleted", UtilValidate.isEmpty(reservations));
    
    // Test order header status is now ORDER_COMPLETED
    assertEquals(orderHeader.getString("statusId"), "ORDER_COMPLETED");
    
    // Test order items status are now ITEM_COMPLETED
    List<GenericValue> orderItems = orderHeader.getRelated("OrderItem", null, null, false);
    
    for ( GenericValue orderItem : orderItems )
        assertEquals("ITEM_COMPLETED", orderItem.getString("statusId"));
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:66,代碼來源:IssuanceTest.java


注:本文中的org.ofbiz.shipment.packing.PackingSession類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。