本文整理汇总了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"));
}
示例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"));
}