svn commit: r451821 - in /incubator/ofbiz/trunk/applications/product: entitydef/entitymodel.xml entitydef/entitymodel_shipment.xml script/org/ofbiz/shipment/issuance/IssuanceServices.xml servicedef/services_shipment.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r451821 - in /incubator/ofbiz/trunk/applications/product: entitydef/entitymodel.xml entitydef/entitymodel_shipment.xml script/org/ofbiz/shipment/issuance/IssuanceServices.xml servicedef/services_shipment.xml

jonesde
Author: jonesde
Date: Sun Oct  1 15:06:53 2006
New Revision: 451821

URL: http://svn.apache.org/viewvc?view=rev&rev=451821
Log:
Added data model changes and issuance service to issue inventory to a FixedAssetMaint for use as a Part; there is no accounting handled in this but the idea would be to convert the inventory to supplies

Modified:
    incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml
    incubator/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml
    incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml
    incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml

Modified: incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?view=diff&rev=451821&r1=451820&r2=451821
==============================================================================
--- incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml Sun Oct  1 15:06:53 2006
@@ -1126,6 +1126,8 @@
       <field name="shipmentId" type="id"></field>
       <field name="shipmentItemSeqId" type="id"></field>
       <field name="workEffortId" type="id"></field>
+      <field name="fixedAssetId" type="id"></field>
+      <field name="maintHistSeqId" type="id"></field>
       <field name="itemIssuanceId" type="id"></field>
       <field name="receiptId" type="id"></field>
       <field name="physicalInventoryId" type="id"></field>
@@ -1142,6 +1144,10 @@
         <key-map field-name="orderItemSeqId"/>
         <key-map field-name="shipGroupSeqId"/>
         <key-map field-name="inventoryItemId"/>
+      </relation>
+      <relation type="one" fk-name="INV_ITDTL_FAMNT" rel-entity-name="FixedAssetMaint">
+        <key-map field-name="fixedAssetId"/>
+        <key-map field-name="maintHistSeqId"/>
       </relation>
       <relation type="one" fk-name="INV_ITDTL_ITMIS" rel-entity-name="ItemIssuance">
         <key-map field-name="itemIssuanceId"/>

Modified: incubator/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml?view=diff&rev=451821&r1=451820&r2=451821
==============================================================================
--- incubator/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml (original)
+++ incubator/ofbiz/trunk/applications/product/entitydef/entitymodel_shipment.xml Sun Oct  1 15:06:53 2006
@@ -51,6 +51,8 @@
       <field name="inventoryItemId" type="id"></field>
       <field name="shipmentId" type="id"></field>
       <field name="shipmentItemSeqId" type="id"></field>
+      <field name="fixedAssetId" type="id"></field>
+      <field name="maintHistSeqId" type="id"></field>
       <field name="issuedDateTime" type="date-time"></field>
       <field name="issuedByUserLoginId" type="id-vlong"></field>
       <field name="quantity" type="floating-point"></field>
@@ -70,6 +72,10 @@
       <relation type="one" fk-name="ITEM_ISS_SHITM" rel-entity-name="ShipmentItem">
         <key-map field-name="shipmentId"/>
         <key-map field-name="shipmentItemSeqId"/>
+      </relation>
+      <relation type="one" fk-name="ITEM_ISS_FAMNT" rel-entity-name="FixedAssetMaint">
+        <key-map field-name="fixedAssetId"/>
+        <key-map field-name="maintHistSeqId"/>
       </relation>
       <relation type="one-nofk" rel-entity-name="OrderHeader">
         <key-map field-name="orderId"/>

Modified: incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml?view=diff&rev=451821&r1=451820&r2=451821
==============================================================================
--- incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml (original)
+++ incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml Sun Oct  1 15:06:53 2006
@@ -146,7 +146,7 @@
 
         <!-- make sure specified quantity is not empty -->
         <if-empty field-name="parameters.quantity">
-            <string-to-list string="Not issuing Order Item Ship Group Inventory Reservation to shipment [${parameters.shipmentId}] because the quantity to issue is empty for order [${orderItemShipGrpInvRes.orderId}] order item [${orderItemShipGrpInvRes.orderItemSeqId}] inventoryItem [${orderItemShipGrpInvRes.inventoryItemId}]" list-name="error_list"/>
+            <add-error><fail-message message="Not issuing Order Item Ship Group Inventory Reservation to shipment [${parameters.shipmentId}] because the quantity to issue is empty for order [${orderItemShipGrpInvRes.orderId}] order item [${orderItemShipGrpInvRes.orderItemSeqId}] inventoryItem [${orderItemShipGrpInvRes.inventoryItemId}]"/></add-error>
         </if-empty>
         <if-empty field-name="orderItemShipGrpInvRes.quantity">
             <log level="info" message="Order item reservation amount is null! PK lookup: ${OrderItemShipGrpInvResLookupPk}"/>
@@ -154,11 +154,11 @@
 
         <!-- make sure specified quantity is not less than or equal to 0 -->
         <if-compare field-name="parameters.quantity" operator="less-equals" value="0" type="Double">
-            <string-to-list string="Not issuing Order Item Ship Group Inventory Reservation to shipment [${parameters.shipmentId}] because the quantity to issue [${parameters.quantity}] is less than or equal to 0 for order [${orderItemShipGrpInvRes.orderId}] order item [${orderItemShipGrpInvRes.orderItemSeqId}] inventoryItem [${orderItemShipGrpInvRes.inventoryItemId}]" list-name="error_list"/>
+            <add-error><fail-message message="Not issuing Order Item Ship Group Inventory Reservation to shipment [${parameters.shipmentId}] because the quantity to issue [${parameters.quantity}] is less than or equal to 0 for order [${orderItemShipGrpInvRes.orderId}] order item [${orderItemShipGrpInvRes.orderItemSeqId}] inventoryItem [${orderItemShipGrpInvRes.inventoryItemId}]"/></add-error>
         </if-compare>
         <!-- make sure specified quantity is not greater than reserved quantity left to be issued, ie orderItemShipGrpInvRes.quantity -->
         <if-compare-field field-name="parameters.quantity" operator="greater" to-field-name="orderItemShipGrpInvRes.quantity" type="Double">
-            <string-to-list string="Not issuing Order Item Ship Group Inventory Reservation to shipment [${parameters.shipmentId}] because the quantity to issue [${parameters.quantity}] is greater than the quantity left to issue [${orderItemShipGrpInvRes.quantity}] for order [${orderItemShipGrpInvRes.orderId}] order item [${orderItemShipGrpInvRes.orderItemSeqId}] inventoryItem [${orderItemShipGrpInvRes.inventoryItemId}]" list-name="error_list"/>
+            <add-error><fail-message message="Not issuing Order Item Ship Group Inventory Reservation to shipment [${parameters.shipmentId}] because the quantity to issue [${parameters.quantity}] is greater than the quantity left to issue [${orderItemShipGrpInvRes.quantity}] for order [${orderItemShipGrpInvRes.orderId}] order item [${orderItemShipGrpInvRes.orderItemSeqId}] inventoryItem [${orderItemShipGrpInvRes.inventoryItemId}]"/></add-error>
         </if-compare-field>
 
         <check-errors/>
@@ -313,7 +313,7 @@
         </if-not-empty>
 
         <set from-field="userLogin.userLoginId" field="itemIssuanceCreate.issuedByUserLoginId"/>
-        <call-service service-name="createItemIssuance" in-map-name="itemIssuanceCreate" >
+        <call-service service-name="createItemIssuance" in-map-name="itemIssuanceCreate">
             <result-to-field result-name="itemIssuanceId"/>
         </call-service>
         <field-to-result field-name="itemIssuanceId"/>
@@ -333,5 +333,45 @@
         <set from-field="userLogin.partyId" field="itemIssuanceRoleCreate.partyId"/>
         <set value="PACKER" field="itemIssuanceRoleCreate.roleTypeId"/>
         <call-service service-name="createItemIssuanceRole" in-map-name="itemIssuanceRoleCreate"/>
+    </simple-method>
+    
+    <simple-method method-name="issueInventoryItemToFixedAssetMaint" short-description="Issue InventoryItem To FixedAssetMaint">
+        <entity-one entity-name="InventoryItem" value-name="inventoryItem"/>
+        <entity-one entity-name="FixedAssetMaint" value-name="fixedAssetMaint"/>
+
+        <!-- make sure specified quantity is not less than or equal to 0 -->
+        <if-compare field-name="parameters.quantity" operator="less-equals" value="0" type="Double">
+            <add-error><fail-message message="Not issuing InventoryItem to FixedAssetMaint [${fixedAssetMaint.fixedAssetId:fixedAssetMaint.maintHistSeqId}] because the quantity to issue [${parameters.quantity}] is less than or equal to 0 for inventoryItem [${inventoryItem.inventoryItemId}]"/></add-error>
+        </if-compare>
+        <!-- make sure specified quantity is not greater than available quantity left to be issued, ie intentoryItem.availableToPromiseTotal -->
+        <if-compare-field field-name="parameters.quantity" operator="greater" to-field-name="intentoryItem.availableToPromiseTotal" type="Double">
+            <add-error><fail-message message="Not issuing InventoryItem to FixedAssetMaint [${fixedAssetMaint.fixedAssetId:fixedAssetMaint.maintHistSeqId}] because the quantity to issue [${parameters.quantity}] is greater than the quantity left to issue (ie the ATP or Available To Promise) [${intentoryItem.availableToPromiseTotal}] for inventoryItem [${orderItemShipGrpInvRes.inventoryItemId}]"/></add-error>
+        </if-compare-field>
+        
+        <check-errors/>
+        
+        <!-- create the ItemIssuance -->
+        <set from-field="parameters.quantity" field="itemIssuanceCreate.quantity"/>
+        <set from-field="fixedAssetMaint.fixedAssetId" field="itemIssuanceCreate.fixedAssetId"/>
+        <set from-field="fixedAssetMaint.maintHistSeqId" field="itemIssuanceCreate.maintHistSeqId"/>
+        <set from-field="userLogin.userLoginId" field="itemIssuanceCreate.issuedByUserLoginId"/>
+        <call-service service-name="createItemIssuance" in-map-name="itemIssuanceCreate">
+            <result-to-field result-name="itemIssuanceId"/>
+        </call-service>
+        <field-to-result field-name="itemIssuanceId"/>
+
+        <!-- Decrement InventoryItem quantityOnHand AND availableToPromise since there was no reservation -->
+        <!-- instead of updating InventoryItem, add an InventoryItemDetail -->
+        <set from-field="inventoryItem.inventoryItemId" field="createDetailMap.inventoryItemId"/>
+        <set from-field="fixedAssetMaint.fixedAssetId" field="createDetailMap.fixedAssetId"/>
+        <set from-field="fixedAssetMaint.maintHistSeqId" field="createDetailMap.maintHistSeqId"/>
+        <set from-field="itemIssuanceId" field="createDetailMap.itemIssuanceId"/>
+        <calculate field-name="createDetailMap.quantityOnHandDiff" type="Double">
+            <calcop field-name="parameters.quantity" operator="negative"/>
+        </calculate>
+        <calculate field-name="createDetailMap.availableToPromiseDiff" type="Double">
+            <calcop field-name="parameters.quantity" operator="negative"/>
+        </calculate>
+        <call-service service-name="createInventoryItemDetail" in-map-name="createDetailMap"/>
     </simple-method>
 </simple-methods>

Modified: incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?view=diff&rev=451821&r1=451820&r2=451821
==============================================================================
--- incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ incubator/ofbiz/trunk/applications/product/servicedef/services_shipment.xml Sun Oct  1 15:06:53 2006
@@ -353,7 +353,15 @@
         <attribute name="shipmentItemSeqId" type="String" mode="OUT" optional="false"/>
         <attribute name="itemIssuanceId" type="String" mode="OUT" optional="false"/>
     </service>
-
+    <service name="issueInventoryItemToFixedAssetMaint" engine="simple"
+        location="org/ofbiz/shipment/issuance/IssuanceServices.xml" invoke="issueInventoryItemToFixedAssetMaint" auth="true">
+        <description>Issue an InventoryItem to a FixedAssetMaint - for conversion to use as supples/parts</description>
+        <auto-attributes entity-name="InventoryItem" include="pk" mode="IN" optional="false"/>
+        <auto-attributes entity-name="FixedAssetMaint" include="pk" mode="IN" optional="false"/>
+        <attribute name="quantity" type="Double" mode="IN" optional="false"/>
+        <attribute name="itemIssuanceId" type="String" mode="OUT" optional="false"/>
+    </service>
+    
     <!-- Pack Order Services -->
     <service name="packSingleItem" engine="java"
             location="org.ofbiz.shipment.packing.PackingServices" invoke="addPackLine" auth="true">