You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/04/10 14:41:47 UTC

svn commit: r527108 - in /ofbiz/trunk/applications/manufacturing: config/ script/org/ofbiz/manufacturing/jobshopmgt/ servicedef/ webapp/manufacturing/WEB-INF/ webapp/manufacturing/WEB-INF/actions/jobshopmgt/ webapp/manufacturing/jobshopmgt/ widget/manu...

Author: jacopoc
Date: Tue Apr 10 05:41:46 2007
New Revision: 527108

URL: http://svn.apache.org/viewvc?view=rev&rev=527108
Log:
Implemented new production run's subscreen to view and add inventory item issuances.
Modified the existing issuance service to be more flexible.

Added:
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.bsh
Modified:
    ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties
    ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml
    ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunTabBar.ftl
    ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml

Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties?view=diff&rev=527108&r1=527107&r2=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties (original)
+++ ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties Tue Apr 10 05:41:46 2007
@@ -29,6 +29,7 @@
 ManufacturingBillOfMaterials=Bill Of Materials
 ManufacturingActualStartDateTime=Actual Start Date/Time
 ManufacturingActualEndDateTime=Actual End Date/Time
+ManufacturingActualMaterials=Actual Materials
 ManufacturingCalendar=Calendar
 ManufacturingCalendars=Calendars
 ManufacturingCalendarCapacity=ManufacturingCalendarCapacity

Modified: ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml?view=diff&rev=527108&r1=527107&r2=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml (original)
+++ ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml Tue Apr 10 05:41:46 2007
@@ -52,15 +52,18 @@
     </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">
-            <set field="parameters.workEffortGoodStdTypeId" value="PRUNT_PROD_NEEDED"/>
-            <entity-one entity-name="WorkEffortGoodStandard" value-name="workEffortGoodStandard"/>
+            <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"/>
+            <set from-field="workEffortGoodStandard.productId" field="productId"/>
+            <set from-field="workEffortGoodStandard.estimatedQuantity" field="estimatedQuantity"/>
         </else>
         </if-empty>
 
+        
         <!-- kind of like the inventory reservation routine, find InventoryItems to issue from, but instead of doing the reservation just create an issuance and an inventory item detail for the change -->
-        <if-not-empty field-name="workEffortGoodStandard.productId">
+        <if-not-empty field-name="productId">
             <now-timestamp-to-env env-name="nowTimestamp"/>
 
             <!-- NOTE: the inventory will be issued from the WorkEffort.facilityId -->
@@ -91,11 +94,11 @@
             </else>
             </if-compare>
             <field-to-list field-name="orderByString" list-name="orderByList"/>
-            <set from-field="workEffortGoodStandard.productId" field="lookupFieldMap.productId"/>
+            <set from-field="productId" field="lookupFieldMap.productId"/>
             <set from-field="workEffort.facilityId" field="lookupFieldMap.facilityId"/>
             <find-by-and entity-name="InventoryItem" map-name="lookupFieldMap" list-name="inventoryItemList" order-by-list-name="orderByList"/>
     
-            <set from-field="workEffortGoodStandard.estimatedQuantity" field="parameters.quantityNotIssued"/>
+            <set from-field="estimatedQuantity" field="parameters.quantityNotIssued"/>
 
             <iterate entry-name="inventoryItem" list-name="inventoryItemList">
                 <!-- this is a little trick to get the InventoryItem value object without doing a query, possible since all fields on InventoryItem are also on InventoryItemAndLocation with the same names -->
@@ -129,7 +132,7 @@
                     <!-- no non-ser inv item, create a non-ser InventoryItem with availableToPromise = -quantityNotIssued -->
                     <clear-field field-name="createInvItemInMap"/>
                     <clear-field field-name="createInvItemOutMap"/>
-                    <set field="createInvItemInMap.productId" from-field="workEffortGoodStandard.productId"/>
+                    <set field="createInvItemInMap.productId" from-field="productId"/>
                     <set field="createInvItemInMap.facilityId" from-field="workEffort.facilityId"/>
                     <set field="createInvItemInMap.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM"/>
                     <call-service service-name="createInventoryItem" in-map-name="createInvItemInMap">
@@ -160,8 +163,10 @@
 
                 <calculate field-name="quantityNotIssued" map-name="parameters"><number value="0"/></calculate>
             </if-compare>
-            <set value="WEGS_COMPLETED" field="workEffortGoodStandard.statusId"/>
-            <store-value value-name="workEffortGoodStandard"/>
+            <if-not-empty field-name="workEffortGoodStandard">
+                <set value="WEGS_COMPLETED" field="workEffortGoodStandard.statusId"/>
+                <store-value value-name="workEffortGoodStandard"/>
+            </if-not-empty>
         </if-not-empty>
     </simple-method>
     <simple-method method-name="issueProductionRunTaskComponentInline" short-description="Does a issuance for one InventoryItem, meant to be called in-line">

Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml?view=diff&rev=527108&r1=527107&r2=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original)
+++ ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Tue Apr 10 05:41:46 2007
@@ -146,6 +146,7 @@
         </description>
         <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
         <attribute name="productId" type="String" mode="IN" optional="false"/>
+        <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"/>

Added: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.bsh?view=auto&rev=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.bsh (added)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.bsh Tue Apr 10 05:41:46 2007
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.widget.html.HtmlFormWrapper;
+
+
+productionRunId = request.getParameter("productionRunId");
+if (UtilValidate.isEmpty(productionRunId)) {
+    productionRunId = request.getParameter("workEffortId");
+}
+
+List taskInfos = new ArrayList();
+List tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK"), UtilMisc.toList("workEffortId"));
+Iterator tasksIt = tasks.iterator();
+while (tasksIt.hasNext()) {
+    GenericValue task = (GenericValue)tasksIt.next();
+    List records = delegator.findByAnd("InventoryItemDetail", UtilMisc.toMap("workEffortId", task.getString("workEffortId")));
+    HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml", "ProductionRunTaskActualComponents", request, response);
+    taskForm.putInContext("records", records);
+    taskInfos.add(UtilMisc.toMap("task", task, "taskForm", taskForm));
+}
+context.put("taskInfos", taskInfos);

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml?view=diff&rev=527108&r1=527107&r2=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml Tue Apr 10 05:41:46 2007
@@ -580,6 +580,16 @@
         <response name="success" type="view" value="ProductionRunComponents"/>
         <response name="error" type="view" value="ProductionRunComponents"/>
     </request-map>
+    <request-map uri="ProductionRunActualComponents">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="ProductionRunActualComponents"/>
+    </request-map>
+    <request-map uri="issueProductionRunTaskComponent">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="issueProductionRunTaskComponent"/>
+        <response name="success" type="view" value="ProductionRunActualComponents"/>
+        <response name="error" type="view" value="ProductionRunActualComponents"/>
+    </request-map>
     <request-map uri="ProductionRunAssocs">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ProductionRunAssocs"/>
@@ -793,6 +803,7 @@
     <view-map name="ProductionRunCosts" page="component://manufacturing/widget/manufacturing/JobshopScreens.xml#ProductionRunCosts" type="screen"/>
     <view-map name="ProductionRunTasks" page="component://manufacturing/widget/manufacturing/JobshopScreens.xml#ProductionRunTasks" type="screen"/>
     <view-map name="ProductionRunComponents" page="component://manufacturing/widget/manufacturing/JobshopScreens.xml#ProductionRunComponents" type="screen"/>
+    <view-map name="ProductionRunActualComponents" page="component://manufacturing/widget/manufacturing/JobshopScreens.xml#ProductionRunActualComponents" type="screen"/>
     <view-map name="ProductionRunFixedAssets" page="component://manufacturing/widget/manufacturing/JobshopScreens.xml#ProductionRunFixedAssets" type="screen"/>
     <view-map name="ProductionRunAssocs" page="component://manufacturing/widget/manufacturing/JobshopScreens.xml#ProductionRunAssocs" type="screen"/>
     <view-map name="WorkWithShipmentPlans" page="component://manufacturing/widget/manufacturing/JobshopScreens.xml#WorkWithShipmentPlans" type="screen"/>

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml?view=diff&rev=527108&r1=527107&r2=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml Tue Apr 10 05:41:46 2007
@@ -606,4 +606,37 @@
             <hyperlink target="deleteProductionRunComponent?workEffortId=${workEffortId}&amp;fromDate=${fromDate}&amp;productId=${productId}&amp;workEffortGoodStdTypeId=${workEffortGoodStdTypeId}&amp;productionRunId=${productionRunId}" description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
         </field>
     </form>
+    <form name="ProductionRunTaskActualComponents" type="list" target="updateProductionRunComponent" paginate-target="ProductionRunActualComponents" title="" list-name="records">
+        <row-actions>
+            <set field="quantityOnHandDiff" value="${bsh:-1*quantityOnHandDiff}"/> 
+        </row-actions>
+        <field name="inventoryItemId" widget-style="buttontext">
+            <hyperlink target="/facility/control/EditInventoryItem?inventoryItemId=${inventoryItemId}" description="${inventoryItemId}" also-hidden="false" target-type="inter-app"/>
+        </field>
+        <field name="productId" entry-name="inventoryItemId">
+            <display-entity entity-name="InventoryItem" key-field-name="inventoryItemId" description="${productId}"/>
+        </field>
+        <field name="workEffortId"><hidden/></field>
+        <field name="productionRunId"><hidden/></field>
+        <field name="quantityOnHandDiff" title="${uiLabelMap.CommonQuantity}"><display/></field>
+    </form>
+    <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="reserveOrderEnumId"><ignored/></field>
+        <field name="workEffortId" title="${uiLabelMap.ManufacturingTask}">
+            <drop-down allow-empty="false">
+                <entity-options entity-name="WorkEffort" description="${workEffortName} [${workEffortId}]">
+                    <entity-constraint name="workEffortParentId" env-name="productionRunId"/>
+                    <entity-order-by field-name="workEffortId"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="productId">
+            <lookup target-form-name="LookupProduct"/>
+        </field>
+        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
 </forms>

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunTabBar.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunTabBar.ftl?view=diff&rev=527108&r1=527107&r2=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunTabBar.ftl (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunTabBar.ftl Tue Apr 10 05:41:46 2007
@@ -29,6 +29,7 @@
         <a href="<@o...@ofbizUrl>" class="${selectedClassMap.fixedAssets?default(unselectedClassName)}">${uiLabelMap.AccountingFixedAssets}</a>
         <#else>
         <a href="<@o...@ofbizUrl>" class="${selectedClassMap.declaration?default(unselectedClassName)}">${uiLabelMap.ManufacturingProductionRunDeclaration}</a>
+        <a href="<@o...@ofbizUrl>" class="${selectedClassMap.actualComponents?default(unselectedClassName)}">${uiLabelMap.ManufacturingActualMaterials}</a>
         </#if>
         <a href="<@o...@ofbizUrl>" class="${selectedClassMap.assocs?default(unselectedClassName)}">${uiLabelMap.ManufacturingProductionRunAssocs}</a>
         <a href="<@o...@ofbizUrl>" class="${selectedClassMap.costs?default(unselectedClassName)}">${uiLabelMap.ManufacturingActualCosts}</a>

Modified: ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml?view=diff&rev=527108&r1=527107&r2=527108
==============================================================================
--- ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml (original)
+++ ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml Tue Apr 10 05:41:46 2007
@@ -334,6 +334,37 @@
             </widgets>
         </section>
     </screen>
+    <screen name="ProductionRunActualComponents">
+        <section>
+            <actions>
+                <set field="title" value="Production Run Actual Components"/>
+                <set field="titleProperty" value="ManufacturingProductionRunActualComponents"/>
+                <set field="tabButtonItem" value="actualComponents"/>
+                <set field="headerItem" value="jobshop"/>
+                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
+                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="500"/>
+
+                <set field="productionRunId" from-field="parameters.productionRunId"/>
+                <entity-one entity-name="WorkEffort" value-name="productionRun">
+                    <field-map field-name="workEffortId" env-name="productionRunId"/>
+                </entity-one>
+                <script location="component://manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.bsh"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonJobshopDecorator" location="${parameters.commonJobshopDecorator}">
+                    <decorator-section name="body">
+                        <container>
+                            <label style="head2">${uiLabelMap.ManufacturingActualMaterials}</label>
+                        </container>
+                        <include-form name="IssueProductionRunComponent" location="component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml"/>
+                        <platform-specific>
+                            <html><html-template location="component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunTasksInfo.ftl"/></html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
     <screen name="ProductionRunFixedAssets">
         <section>
             <actions>