Misc cleanups and refactoring for the issueProductionRunComponent* services; added ability to specify the location from where the materials are issued.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@577408 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato
2007-09-19 18:11:58 +00:00
parent 9eb823a1db
commit e0cbf4c3fc
3 changed files with 20 additions and 18 deletions
@@ -31,20 +31,16 @@ under the License.
<set value="WEGS_CREATED" field="lookupComponentsMap.statusId"/>
<set field="lookupComponentsMap.workEffortGoodStdTypeId" value="PRUNT_PROD_NEEDED"/>
<find-by-and entity-name="WorkEffortGoodStandard" list-name="components" map-name="lookupComponentsMap" />
<find-by-and entity-name="WorkEffortGoodStandard" list-name="components" map-name="lookupComponentsMap"/>
<filter-list-by-date list-name="components"/>
<!-- now go through each work effort good standard and call a service to issue the inventory -->
<iterate list-name="components" entry-name="component">
<if-not-empty field-name="component.productId">
<clear-field field-name="callSvcMap"/>
<set-service-fields to-map-name="callSvcMap" service-name="issueProductionRunTaskComponent" map-name="component"/>
<set from-field="workEffort" field="callSvcMap.workEffort"/>
<set from-field="component" field="callSvcMap.workEffortGoodStandard"/>
<set from-field="reserveOrderEnumId" field="callSvcMap.reserveOrderEnumId"/>
<set field="callSvcMap.description" value="BOM Part"/>
<call-service service-name="issueProductionRunTaskComponent" in-map-name="callSvcMap"/>
<set value="WEGS_COMPLETED" field="component.statusId"/>
<store-value value-name="component"/>
</if-not-empty>
</iterate>
<log level="info" message="Issued inventory for workEffortId ${workEffort.workEffortId}."/>
@@ -52,11 +48,16 @@ under the License.
</if-not-empty>
</simple-method>
<simple-method method-name="issueProductionRunTaskComponent" short-description="Issues the Inventory for a Production Run Task Component" login-required="false">
<if-empty field-name="parameters.workEffortGoodStandard">
<if-empty field-name="parameters.fromDate">
<set from-field="parameters.productId" field="productId"/>
<set from-field="parameters.quantity" field="estimatedQuantity" default-value="0.0" type="Double"/>
<else>
<set from-field="parameters.workEffortGoodStandard" field="workEffortGoodStandard"/>
<entity-one entity-name="WorkEffortGoodStandard" value-name="workEffortGoodStandard" auto-field-map="false">
<field-map field-name="workEffortId" env-name="parameters.workEffortId"/>
<field-map field-name="productId" env-name="parameters.productId"/>
<field-map field-name="fromDate" env-name="parameters.fromDate"/>
<field-map field-name="workEffortGoodStdTypeId" value="PRUNT_PROD_NEEDED"/>
</entity-one>
<set from-field="workEffortGoodStandard.productId" field="productId"/>
<set from-field="workEffortGoodStandard.estimatedQuantity" field="estimatedQuantity"/>
</else>
@@ -68,12 +69,7 @@ under the License.
<now-timestamp-to-env env-name="nowTimestamp"/>
<!-- NOTE: the inventory will be issued from the WorkEffort.facilityId -->
<if-empty field-name="parameters.workEffort">
<entity-one entity-name="WorkEffort" value-name="workEffort"/>
<else>
<set from-field="parameters.workEffort" field="workEffort"/>
</else>
</if-empty>
<entity-one entity-name="WorkEffort" value-name="workEffort"/>
<!-- before we do the find, put together the orderBy list based on which reserveOrderEnumId is specified -->
<if-compare value="INVRO_FIFO_EXP" operator="equals" field-name="reserveOrderEnumId" map-name="parameters">
@@ -97,6 +93,9 @@ under the License.
<field-to-list field-name="orderByString" list-name="orderByList"/>
<set from-field="productId" field="lookupFieldMap.productId"/>
<set from-field="workEffort.facilityId" field="lookupFieldMap.facilityId"/>
<if-not-empty field-name="parameters.locationSeqId">
<set from-field="parameters.locationSeqId" field="lookupFieldMap.locationSeqId"/>
</if-not-empty>
<find-by-and entity-name="InventoryItem" map-name="lookupFieldMap" list-name="inventoryItemList" order-by-list-name="orderByList"/>
<set from-field="estimatedQuantity" field="parameters.quantityNotIssued"/>
@@ -145,13 +145,17 @@ under the License.
location="org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml" invoke="issueProductionRunTaskComponent" auth="false">
<description>
Issues the Inventory for a Production Run Task Component. For more info see the issueProductionRunTask service.
If fromDate is passed, then the WorkEffortGoodStandard record with pk composed of (workEffortId|productId|fromDate)
with type PRUNT_PROD_NEEDED is retrieved and used to get the quantity; its status is also updated to COMPLETED after
the issuance is done.
If locationSeqId is provided, then the items are only issued from the inventory items associated to the location.
</description>
<attribute name="workEffortId" type="String" mode="IN" optional="false"/>
<attribute name="productId" type="String" mode="IN" optional="false"/>
<attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
<attribute name="quantity" type="Double" mode="IN" optional="true"/>
<attribute name="workEffort" type="GenericValue" mode="IN" optional="true"/>
<attribute name="workEffortGoodStandard" type="GenericValue" mode="IN" optional="true"/>
<attribute name="reserveOrderEnumId" type="String" mode="IN" optional="true"/>
<attribute name="locationSeqId" type="String" mode="IN" optional="true"/>
<attribute name="reasonEnumId" type="String" mode="IN" optional="true"/>
<attribute name="description" type="String" mode="IN" optional="true"/>
</service>
@@ -635,8 +635,7 @@ under the License.
<form name="IssueProductionRunComponent" type="single" target="issueProductionRunTaskComponent" title="">
<auto-fields-service service-name="issueProductionRunTaskComponent"/>
<field name="productionRunId"><hidden/></field>
<field name="workEffort"><ignored/></field>
<field name="workEffortGoodStandard"><ignored/></field>
<field name="fromDate"><ignored/></field>
<field name="reserveOrderEnumId"><ignored/></field>
<field name="workEffortId" title="${uiLabelMap.ManufacturingTask}">
<drop-down allow-empty="false">