svn commit: r1768228 - in /ofbiz/trunk/applications/manufacturing: config/ManufacturingUiLabels.xml minilang/jobshopmgt/ProductionRunServices.xml

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

svn commit: r1768228 - in /ofbiz/trunk/applications/manufacturing: config/ManufacturingUiLabels.xml minilang/jobshopmgt/ProductionRunServices.xml

diveshdutta
Author: diveshdutta
Date: Sat Nov  5 14:56:00 2016
New Revision: 1768228

URL: http://svn.apache.org/viewvc?rev=1768228&view=rev
Log:
Improvement: If production is already completed (aka all its routing task also completed/cancelled) then don't allow new material to be added from Actual Material screen, Any completed taks for uncomplete Production Run should have WEGS created in COMPLETED status and WEIA created as well by issuing the added item's qty.

(OFBIZ-7559) (OFBIZ-7468)

Thanks: Swapnil Shah for suggestions and Anuj Jain for your patch

Modified:
    ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml
    ofbiz/trunk/applications/manufacturing/minilang/jobshopmgt/ProductionRunServices.xml

Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml?rev=1768228&r1=1768227&r2=1768228&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml (original)
+++ ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml Sat Nov  5 14:56:00 2016
@@ -811,6 +811,9 @@
         <value xml:lang="zh">指定固定资产</value>
         <value xml:lang="zh-TW">指定固定資產</value>
     </property>
+    <property key="ManufacturingAddProdCompInCompCanStatusError">
+        <value xml:lang="en">Can't Add Component in Cancelled/Closed Production Run.</value>
+    </property>s
     <property key="ManufacturingAddProductionRunProductComponent">
         <value xml:lang="de">Komponente zu Produktionsauftrag hinzufügen</value>
         <value xml:lang="en">Add ProductComponent to ProductionRun</value>

Modified: ofbiz/trunk/applications/manufacturing/minilang/jobshopmgt/ProductionRunServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/minilang/jobshopmgt/ProductionRunServices.xml?rev=1768228&r1=1768227&r2=1768228&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/minilang/jobshopmgt/ProductionRunServices.xml (original)
+++ ofbiz/trunk/applications/manufacturing/minilang/jobshopmgt/ProductionRunServices.xml Sat Nov  5 14:56:00 2016
@@ -108,7 +108,29 @@ 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">
+
+        <!-- NOTE: the inventory will be issued from the WorkEffort.facilityId -->
+        <entity-one entity-name="WorkEffort" value-field="workEffort"/>
+        <entity-one entity-name="WorkEffort" value-field="productionRun">
+            <field-map field-name="workEffortId" from-field="workEffort.workEffortParentId"/>
+        </entity-one>
+        <if>
+            <condition>
+                <or>
+                    <if-compare field="productionRun.currentStatusId" operator="equals" value="PRUN_CANCELLED"/>
+                    <if-compare field="productionRun.currentStatusId" operator="equals" value="PRUN_CLOSED"/>
+                </or>
+            </condition>
+            <then>
+                <add-error>
+                    <fail-property property="ManufacturingAddProdCompInCompCanStatusError" resource="ManufacturingUiLabels"/>
+                </add-error>
+            </then>
+        </if>
+        <check-errors/>
+
         <if-empty field="parameters.fromDate">
+            <set field="productId" from-field="parameters.productId"/>
             <set from-field="parameters.quantity" field="estimatedQuantity" default-value="0.0" type="BigDecimal"/>
         <else>
             <entity-one entity-name="WorkEffortGoodStandard" value-field="workEffortGoodStandard" auto-field-map="false">
@@ -130,10 +152,13 @@ under the License.
                 <set field="createWorkEffortGoodStdMap.productId" from-field="parameters.productId"/>
                 <set field="createWorkEffortGoodStdMap.workEffortGoodStdTypeId" value="PRUNT_PROD_NEEDED"/>
                 <set field="createWorkEffortGoodStdMap.fromDate" from-field="parameters.fromDate" />
-            <set field="createWorkEffortGoodStdMap.estimatedQuantity" from-field="parameters.quantity"/>
+                <set field="createWorkEffortGoodStdMap.estimatedQuantity" from-field="parameters.quantity"/>
                 <set field="createWorkEffortGoodStdMap.statusId" value="WEGS_CREATED"/>
                 <call-service service-name="createWorkEffortGoodStandard" in-map-name="createWorkEffortGoodStdMap"/>
-                <set field="productId" from-field="parameters.productId"/>
+                <!-- if the task is in completed status we want to make WEIA for the added product as well -->
+                <if-compare value="workEffort.currentStatusId" operator="equals" field="PRUN_COMPLETED">
+                    <set field="productId" from-field="parameters.productId"/>
+                </if-compare>
             </if-empty>
         </else>
         </if-empty>
@@ -142,9 +167,6 @@ under the License.
         <if-not-empty field="productId">
             <now-timestamp field="nowTimestamp"/>
 
-            <!-- NOTE: the inventory will be issued from the WorkEffort.facilityId -->
-            <entity-one entity-name="WorkEffort" value-field="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="parameters.reserveOrderEnumId">
                 <set value="+expireDate" field="orderByString"/>