Index: applications/product/servicedef/services_shipment.xml
===================================================================
--- applications/product/servicedef/services_shipment.xml (revision 393)
+++ applications/product/servicedef/services_shipment.xml (working copy)
@@ -554,4 +554,16 @@
Generic Shipment Cost Estimate Calc Service - Use ShipmentCostEstimate Entities
+
+
+ For a TRANSFER shipment, automatically completes all inventory transfers related to the item issuances on
+ the shipment.
+
+
+
+
+
+
+
Index: applications/product/servicedef/secas_shipment.xml
===================================================================
--- applications/product/servicedef/secas_shipment.xml (revision 393)
+++ applications/product/servicedef/secas_shipment.xml (working copy)
@@ -105,4 +105,11 @@
+
+
+
+
+
+
+
Index: applications/product/widget/facility/ShipmentScreens.xml
===================================================================
--- applications/product/widget/facility/ShipmentScreens.xml (revision 393)
+++ applications/product/widget/facility/ShipmentScreens.xml (working copy)
@@ -148,6 +148,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
===================================================================
--- applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (revision 393)
+++ applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (working copy)
@@ -889,4 +889,56 @@
// don't return an error
return ServiceUtil.returnSuccess();
}
+
+ public static Map createInventoryTransfersForTransferShipment(DispatchContext dctx, Map context) {
+ GenericDelegator delegator = dctx.getDelegator();
+ LocalDispatcher dispatcher = dctx.getDispatcher();
+ GenericValue userLogin = (GenericValue) context.get("userLogin");
+
+ String shipmentId = (String) context.get("shipmentId");
+ Map results = ServiceUtil.returnSuccess();
+
+ try {
+ GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
+ if (shipment == null) {
+ return ServiceUtil.returnError("No shipment was found for shipmentId [" + shipmentId + "]");
+ } else if (!shipment.getString("shipmentTypeId").equals("TRANSFER")) {
+ Debug.logInfo("Shipment [" + shipmentId + "] is not a transfer shipment, returning success", module);
+ return ServiceUtil.returnSuccess();
+ }
+
+ // get all the item issuances and complete their inventory transfers
+ List itemIssuances = shipment.getRelated("ItemIssuance");
+ for (Iterator it = itemIssuances.iterator(); it.hasNext(); ) {
+ GenericValue itemIssuance = (GenericValue) it.next();
+
+ List inventoryTransfers = itemIssuance.getRelated("InventoryTransfer");
+ for (Iterator it2 = inventoryTransfers.iterator(); it2.hasNext(); ) {
+ GenericValue inventoryTransfer = (GenericValue) it2.next();
+ Map tmpResult = dispatcher.runSync("completeInventoryTransfer", UtilMisc.toMap("inventoryTransferId", inventoryTransfer.get("inventoryTransferId"), "userLogin", userLogin));
+ if (ServiceUtil.isError(tmpResult)) {
+ return tmpResult;
+ }
+ }
+
+ /* Map tmpResult = dispatcher.runSync("createInventoryTransfer", UtilMisc.toMap("xferQty", itemIssuance.getDouble("quantity"),
+ "inventoryItemId", itemIssuance.getString("inventoryItemId"), "facilityIdTo", shipment.getString("destinationFacilityId"),
+ "itemIssuanceId", itemIssuance.getString("itemIssuanceId"), "userLogin", userLogin));
+ if (ServiceUtil.isError(tmpResult)) {
+ return tmpResult;
+ } else if (tmpResult.get("inventoryTransferId") == null) {
+ return ServiceUtil.returnError("No inventoryTransferId from inventory transfer of item issuance [" + itemIssuance.getString("itemIssuanceId") + "], result is " + tmpResult);
+ } else {
+ // this means it ran correctly - now complete the inventory transfer
+
+ }
+ Debug.logInfo("--REMOVE--inventory transfer created for " + itemIssuance, module); */
+ }
+ } catch (GenericEntityException ex) {
+ return ServiceUtil.returnError(ex.getMessage());
+ } catch (GenericServiceException ex) {
+ return ServiceUtil.returnError(ex.getMessage());
+ }
+ return results;
+ }
}
Index: applications/product/entitydef/entitygroup.xml
===================================================================
--- applications/product/entitydef/entitygroup.xml (revision 393)
+++ applications/product/entitydef/entitygroup.xml (working copy)
@@ -105,6 +105,7 @@
+
Index: applications/product/entitydef/entitymodel.xml
===================================================================
--- applications/product/entitydef/entitymodel.xml (revision 393)
+++ applications/product/entitydef/entitymodel.xml (working copy)
@@ -1280,6 +1280,35 @@
+
+ This entity combines InventoryItem and InventoryTransfer to allow searching for
+ a particular product which are to be transferred
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: applications/product/webapp/facility/WEB-INF/controller.xml
===================================================================
--- applications/product/webapp/facility/WEB-INF/controller.xml (revision 393)
+++ applications/product/webapp/facility/WEB-INF/controller.xml (working copy)
@@ -747,6 +747,15 @@
+
+
+
+
+
+
+
@@ -997,6 +1006,7 @@
+
Index: applications/product/webapp/facility/shipment/ShipmentTabBar.ftl
===================================================================
--- applications/product/webapp/facility/shipment/ShipmentTabBar.ftl (revision 393)
+++ applications/product/webapp/facility/shipment/ShipmentTabBar.ftl (working copy)
@@ -37,12 +37,17 @@
<#if shipment.shipmentTypeId?exists && shipment.shipmentTypeId='SALES_SHIPMENT'>
${uiLabelMap.ProductShipmentPlan}
#if>
- ${uiLabelMap.ProductOrderItems}
<#if shipment.shipmentTypeId?exists && shipment.shipmentTypeId='PURCHASE_SHIPMENT'>
<#if shipment.destinationFacilityId?exists>
+ ${uiLabelMap.ProductOrderItems}
${uiLabelMap.ProductReceiveInventory}
#if>
- <#else>
+ <#elseif shipment.shipmentTypeId?exists && shipment.shipmentTypeId='TRANSFER'>
+ ${uiLabelMap.ProductTransferShipmentItems}
+ ${uiLabelMap.ProductPackages}
+ ${uiLabelMap.ProductRouteSegments}
+ <#else> <#-- probably a sales shipment -->
+ ${uiLabelMap.ProductOrderItems}
${uiLabelMap.ProductItems}
${uiLabelMap.ProductPackages}
${uiLabelMap.ProductRouteSegments}