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 2008/04/16 16:15:55 UTC

svn commit: r648703 - in /ofbiz/trunk/applications/manufacturing: config/ script/org/ofbiz/manufacturing/jobshopmgt/ servicedef/ src/org/ofbiz/manufacturing/jobshopmgt/ webapp/manufacturing/WEB-INF/ webapp/manufacturing/WEB-INF/actions/jobshopmgt/ weba...

Author: jacopoc
Date: Wed Apr 16 07:15:31 2008
New Revision: 648703

URL: http://svn.apache.org/viewvc?rev=648703&view=rev
Log:
Implemented quick way to declare products produced by the production run: when the form is submitted, all the tasks are updated and, if required, materials are issued as well.

Modified:
    ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml
    ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml
    ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml
    ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
    ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml

Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml (original)
+++ ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml Wed Apr 16 07:15:31 2008
@@ -2042,6 +2042,10 @@
         <value xml:lang="th">สินค้า</value>
         <value xml:lang="zh">已生产</value>
     </property>
+    <property key="ManufacturingQuantityProducedIsHigherThanQuantityDeclared">
+        <value xml:lang="en">Quantity produced cannot be greater than the quantity declared.</value>
+        <value xml:lang="it">La quantità prodotta non puo' essere maggiore della quantita' dichiarata.</value>
+    </property>
     <property key="ManufacturingQuantityRejected">
         <value xml:lang="en">Rejected</value>
         <value xml:lang="es">Rechazado</value>
@@ -2090,6 +2094,10 @@
         <value xml:lang="ro">Executie Rapida Toate Sarcinile</value>
         <value xml:lang="th">ทำงานทั้งหมดอย่างรวดเร็ว</value>
         <value xml:lang="zh">快速运行全部任务</value>
+    </property>
+    <property key="ManufacturingQuickStartAllTasks">
+        <value xml:lang="en">Quick Start All Tasks</value>
+        <value xml:lang="it">Avvio Veloce Operazioni</value>
     </property>
     <property key="ManufacturingQuickRunTask">
         <value xml:lang="en">Quick Run Task</value>

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?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml (original)
+++ ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.xml Wed Apr 16 07:15:31 2008
@@ -67,7 +67,12 @@
                 <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"/>
+            <if-empty field-name="parameters.quantity">
+                <set from-field="workEffortGoodStandard.estimatedQuantity" field="estimatedQuantity"/>
+            <else>
+                <set from-field="parameters.quantity" field="estimatedQuantity" default-value="0.0" type="Double"/>
+            </else>
+            </if-empty>
         </else>
         </if-empty>
         

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?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original)
+++ ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Wed Apr 16 07:15:31 2008
@@ -193,6 +193,19 @@
         <attribute name="createLotIfNeeded" type="Boolean" mode="IN" optional="true"/>
         <attribute name="autoCreateLot" type="Boolean" mode="IN" optional="true"/>
     </service>
+    <service name="productionRunDeclareAndProduce" engine="java" transaction-timeout="7200"
+            location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="productionRunDeclareAndProduce" auth="true">
+        <description>
+            Create Inventory for product produced by a Production Run and if necessary add declared quantities to tasks (and issue materials, if needed).
+        </description>
+        <attribute name="workEffortId" type="String" mode="IN" optional="false"/>
+        <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/>
+        <attribute name="quantity" type="Double" mode="INOUT" optional="false"/>
+        <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/>
+        <attribute name="lotId" type="String" mode="IN" optional="true"/>
+        <attribute name="createLotIfNeeded" type="Boolean" mode="IN" optional="true"/>
+        <attribute name="autoCreateLot" type="Boolean" mode="IN" optional="true"/>
+    </service>
     <service name="productionRunTaskProduce" engine="java"
             location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="productionRunTaskProduce" auth="true">
         <description>
@@ -244,7 +257,7 @@
         </description>
         <attribute name="productionRunId" type="String" mode="IN" optional="false"/>
         <attribute name="productionRunTaskId" type="String" mode="IN" optional="false"/>
-        <attribute name="partyId" type="String" mode="IN" optional="false"/>
+        <attribute name="partyId" type="String" mode="IN" optional="true"/>
         <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="addQuantityProduced" type="Double" mode="IN" optional="true"/>
@@ -252,6 +265,7 @@
         <attribute name="addSetupTime" type="Double" mode="IN" optional="true"/>
         <attribute name="addTaskTime" type="Double" mode="IN" optional="true"/>
         <attribute name="comments" type="String" mode="IN" optional="true"/>
+        <attribute name="issueRequiredComponents" type="Boolean" mode="IN" optional="true"/>
     </service>
     <service name="quickRunProductionRunTask" engine="java"
             location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="quickRunProductionRunTask" auth="true">
@@ -262,6 +276,11 @@
     <service name="quickRunAllProductionRunTasks" engine="java"
             location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="quickRunAllProductionRunTasks" auth="true">
         <description>Quick runs all the tasks of a ProductionRun to the completed status, also issuing components if necessary.</description>
+        <attribute name="productionRunId" type="String" mode="IN" optional="false"/>
+    </service>
+    <service name="quickStartAllProductionRunTasks" engine="java"
+            location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="quickStartAllProductionRunTasks" auth="true">
+        <description>Quick starts all the tasks of a ProductionRun.</description>
         <attribute name="productionRunId" type="String" mode="IN" optional="false"/>
     </service>
     <service name="quickChangeProductionRunStatus" engine="java"

Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Wed Apr 16 07:15:31 2008
@@ -714,14 +714,14 @@
         GenericValue theTask = null;
         GenericValue oneTask = null;
         boolean allTaskCompleted = true;
-        boolean allPrecTaskCompleted = true;
+        boolean allPrecTaskCompletedOrRunning = true;
         for (int i = 0; i < tasks.size(); i++) {
             oneTask = (GenericValue)tasks.get(i);
             if (oneTask.getString("workEffortId").equals(taskId)) {
                 theTask = oneTask;
             } else {
-                if (theTask == null && allPrecTaskCompleted && !oneTask.getString("currentStatusId").equals("PRUN_COMPLETED")) {
-                    allPrecTaskCompleted = false;
+                if (theTask == null && allPrecTaskCompletedOrRunning && (!oneTask.getString("currentStatusId").equals("PRUN_COMPLETED") && !oneTask.getString("currentStatusId").equals("PRUN_RUNNING"))) {
+                    allPrecTaskCompletedOrRunning = false;
                 }
                 if (allTaskCompleted && !oneTask.getString("currentStatusId").equals("PRUN_COMPLETED")) {
                     allTaskCompleted = false;
@@ -747,7 +747,7 @@
         if ((currentStatusId.equals("PRUN_CREATED") || currentStatusId.equals("PRUN_SCHEDULED")) && (statusId == null || statusId.equals("PRUN_RUNNING"))) {
             // change the production run task status to PRUN_RUNNING
             // if necessary change the production run (header) status to PRUN_RUNNING
-            if (!allPrecTaskCompleted) {
+            if (!allPrecTaskCompletedOrRunning) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotStartPrevTasksNotCompleted", locale));
             }
             if (productionRun.getGenericValue().getString("currentStatusId").equals("PRUN_CREATED")) {
@@ -804,7 +804,7 @@
                     return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale));
                 }
             }
-            // change only the production run (header) status to PRUN_COMPLETED
+            // change only the production run task status to PRUN_COMPLETED
             serviceContext.clear();
             serviceContext.put("workEffortId", taskId);
             serviceContext.put("currentStatusId", "PRUN_COMPLETED");
@@ -1456,7 +1456,7 @@
         if (lastTask == null) {
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale));
         }
-        if ("WIP".equals("productTypeId")) {
+        if ("WIP".equals(productionRun.getProductProduced().getString("productTypeId"))) {
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductIsWIP", locale));
         }
         Double quantityProduced = productionRun.getGenericValue().getDouble("quantityProduced");
@@ -1625,6 +1625,66 @@
         return result;
     }
 
+    public static Map productionRunDeclareAndProduce(DispatchContext ctx, Map context) {
+        Map result = FastMap.newInstance();
+        GenericDelegator delegator = ctx.getDelegator();
+        LocalDispatcher dispatcher = ctx.getDispatcher();
+        Locale locale = (Locale) context.get("locale");
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        // Mandatory input fields
+        String productionRunId = (String)context.get("workEffortId");
+        
+        // Optional input fields
+        Double quantity = (Double)context.get("quantity");
+       
+        // The production run is loaded
+        ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
+
+        Double quantityProduced = productionRun.getGenericValue().getDouble("quantityProduced");
+        Double quantityToProduce = productionRun.getGenericValue().getDouble("quantityToProduce");
+        if (quantityProduced == null) {
+            quantityProduced = new Double(0);
+        }
+        if (quantityToProduce == null) {
+            quantityToProduce = new Double(0);
+        }
+        double minimumQuantityProducedByTask = quantityProduced.doubleValue() + quantity.doubleValue();
+        if (minimumQuantityProducedByTask > quantityToProduce.doubleValue()) {
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingQuantityProducedIsHigherThanQuantityDeclared", locale));
+        }
+
+        List tasks = productionRun.getProductionRunRoutingTasks();
+        for (int i = 0; i < tasks.size(); i++) {
+            GenericValue oneTask = (GenericValue)tasks.get(i);
+            String taskId = oneTask.getString("workEffortId");
+            if ("PRUN_RUNNING".equals(oneTask.getString("currentStatusId"))) {
+                Double quantityDeclared = oneTask.getDouble("quantityProduced");
+                if (quantityDeclared == null) {
+                    quantityDeclared = new Double(0);
+                }
+                if (minimumQuantityProducedByTask > quantityDeclared.doubleValue()) {
+                    try {
+                        Map serviceContext = UtilMisc.toMap("productionRunId", productionRunId, "productionRunTaskId", taskId);
+                        serviceContext.put("addQuantityProduced", new Double(minimumQuantityProducedByTask - quantityDeclared.doubleValue()));
+                        serviceContext.put("issueRequiredComponents", Boolean.TRUE);
+                        serviceContext.put("userLogin", userLogin);
+                        Map resultService = dispatcher.runSync("updateProductionRunTask", serviceContext);
+                    } catch (GenericServiceException e) {
+                        Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", module);
+                        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale));
+                    }
+                }
+            }
+        }
+        try {
+            result = dispatcher.runSync("productionRunProduce", context);
+        } catch (GenericServiceException e) {
+            Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale));
+        }
+        return result;
+    }
+
     public static Map productionRunTaskProduce(DispatchContext ctx, Map context) {
         Map result = new HashMap();
         GenericDelegator delegator = ctx.getDelegator();
@@ -1804,6 +1864,9 @@
         String productionRunId = (String)context.get("productionRunId");
         String workEffortId = (String)context.get("productionRunTaskId");
         String partyId = (String)context.get("partyId");
+        if (UtilValidate.isEmpty(partyId)) {
+            partyId = userLogin.getString("partyId");
+        }
         
         // Optional input fields
         Timestamp fromDate = (Timestamp)context.get("fromDate");
@@ -1813,7 +1876,11 @@
         Double addSetupTime = (Double)context.get("addSetupTime");
         Double addTaskTime = (Double)context.get("addTaskTime");
         String comments = (String)context.get("comments");
+        Boolean issueRequiredComponents = (Boolean)context.get("issueRequiredComponents");
         
+        if (issueRequiredComponents == null) {
+            issueRequiredComponents = Boolean.FALSE;
+        }
         if (fromDate == null) {
             fromDate = UtilDateTime.nowTimestamp();
         }
@@ -1882,6 +1949,41 @@
         double totalQuantityProduced = quantityProduced.doubleValue() + addQuantityProduced.doubleValue();
         double totalQuantityRejected = quantityRejected.doubleValue() + addQuantityRejected.doubleValue();
         
+        if (issueRequiredComponents.booleanValue() && addQuantityProduced.doubleValue() > 0) {
+            Double quantityToProduce = theTask.getDouble("quantityToProduce");
+            if (quantityToProduce == null) {
+                quantityToProduce = new Double(0);
+            }
+            if (quantityToProduce.doubleValue() > 0) {
+                try {
+                    List<GenericValue> components = theTask.getRelated("WorkEffortGoodStandard");
+                    for (GenericValue component : components) {
+                        double totalRequiredMaterialQuantity = component.getDouble("estimatedQuantity").doubleValue() * totalQuantityProduced / quantityToProduce.doubleValue();
+                        // now get the units that have been already issued and subtract them
+                        List<GenericValue> issuances = delegator.findByAnd("WorkEffortAndInventoryAssign", UtilMisc.toMap("workEffortId", workEffortId, "productId", component.getString("productId")));
+                        double totalIssued = 0.0;
+                        for (GenericValue issuance : issuances) {
+                            Double issued = issuance.getDouble("quantity");
+                            if (issued != null) {
+                                totalIssued += issued.doubleValue();
+                            }
+                        }
+                        double requiredQuantity = totalRequiredMaterialQuantity - totalIssued;
+                        if (requiredQuantity > 0) {
+                            Map serviceContext = UtilMisc.toMap("workEffortId", workEffortId, "productId", component.getString("productId"), "fromDate", component.getTimestamp("fromDate"));
+                            serviceContext.put("quantity", new Double(requiredQuantity));
+                            serviceContext.put("userLogin", userLogin);
+                            Map resultService = dispatcher.runSync("issueProductionRunTaskComponent", serviceContext);
+                        }
+                    }
+                } catch(GenericEntityException gee) {
+                    
+                } catch(GenericServiceException gee) {
+                    
+                }
+            }
+        }
+
         // Create a new TimeEntry
         try {
             String timeEntryId = delegator.getNextSeqId("TimeEntry");
@@ -2426,6 +2528,41 @@
         return result;
     }
 
+    public static Map quickStartAllProductionRunTasks(DispatchContext ctx, Map context) {
+        Map result = ServiceUtil.returnSuccess();
+        GenericDelegator delegator = ctx.getDelegator();
+        LocalDispatcher dispatcher = ctx.getDispatcher();
+        Locale locale = (Locale) context.get("locale");
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        
+        String productionRunId = (String) context.get("productionRunId");
+
+        ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
+        if (!productionRun.exist()){
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale));
+        }
+        List tasks = productionRun.getProductionRunRoutingTasks();
+        GenericValue oneTask = null;
+        String taskId = null;
+        for (int i = 0; i < tasks.size(); i++) {
+            oneTask = (GenericValue)tasks.get(i);
+            taskId = oneTask.getString("workEffortId");
+            if ("PRUN_CREATED".equals(oneTask.getString("currentStatusId"))) {
+                try {
+                    Map serviceContext = UtilMisc.toMap("productionRunId", productionRunId, "workEffortId", taskId);
+                    serviceContext.put("statusId", "PRUN_RUNNING");
+                    serviceContext.put("issueAllComponents", Boolean.FALSE);
+                    serviceContext.put("userLogin", userLogin);
+                    Map resultService = dispatcher.runSync("changeProductionRunTaskStatus", serviceContext);
+                } catch (GenericServiceException e) {
+                    Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", module);
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale));
+                }
+            }
+        }
+        return result;
+    }
+
     /**
      * Quick moves a ProductionRun to the passed in status, performing all
      * the needed tasks in the way.
@@ -2441,6 +2578,7 @@
         
         String productionRunId = (String) context.get("productionRunId");
         String statusId = (String) context.get("statusId");
+        String startAllTasks = (String) context.get("startAllTasks");
 
         try {
             Map serviceContext = null;
@@ -2455,7 +2593,13 @@
                 serviceContext.put("statusId", "PRUN_DOC_PRINTED");
                 serviceContext.put("userLogin", userLogin);
                 resultService = dispatcher.runSync("changeProductionRunStatus", serviceContext);
-            } 
+            }
+            if (statusId.equals("PRUN_RUNNING") && "Y".equals(startAllTasks)) {
+                serviceContext.clear();
+                serviceContext.put("productionRunId", productionRunId);
+                serviceContext.put("userLogin", userLogin);
+                resultService = dispatcher.runSync("quickStartAllProductionRunTasks", serviceContext);
+            }
             if (statusId.equals("PRUN_COMPLETED") ||
                        statusId.equals("PRUN_CLOSED")) {
                 serviceContext.clear();

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh Wed Apr 16 07:15:31 2008
@@ -86,9 +86,12 @@
         if (quantityDeclared == null) {
             quantityDeclared = new Double(0);
         }
+        if (lastTask != null && ("PRUN_RUNNING".equals(lastTask.getString("currentStatusId")) || "PRUN_COMPLETED".equals(lastTask.getString("currentStatusId")))) {
+            context.put("canDeclareAndProduce", "Y");
+        }
         double maxQuantity = quantityDeclared.doubleValue() - quantityProduced.doubleValue();
 
-        HashMap productionRunData= new HashMap();
+        HashMap productionRunData = new HashMap();
         productionRunData.put("workEffortId",productionRunId);
         productionRunData.put("productId", productionRun.getProductProduced().getString("productId"));
         if (maxQuantity > 0 && !"WIP".equals(productionRun.getProductProduced().getString("productTypeId"))) {

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?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml Wed Apr 16 07:15:31 2008
@@ -623,6 +623,12 @@
         <response name="success" type="view" value="ProductionRunDeclaration"/>
         <response name="error" type="view" value="ProductionRunDeclaration"/>
     </request-map>
+    <request-map uri="quickStartAllProductionRunTasks">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="quickStartAllProductionRunTasks"/>
+        <response name="success" type="view" value="ProductionRunDeclaration"/>
+        <response name="error" type="view" value="ProductionRunDeclaration"/>
+    </request-map>
     <request-map uri="scheduleProductionRun">
         <security https="true" auth="true"/>
         <event type="service" invoke="quickChangeProductionRunStatus"/>
@@ -644,6 +650,12 @@
     <request-map uri="productionRunProduce">
         <security https="true" auth="true"/>
         <event type="service" invoke="productionRunProduce"/>
+        <response name="success" type="view" value="ProductionRunDeclaration"/>
+        <response name="error" type="view" value="ProductionRunDeclaration"/>
+    </request-map>
+    <request-map uri="productionRunDeclareAndProduce">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="productionRunDeclareAndProduce"/>
         <response name="success" type="view" value="ProductionRunDeclaration"/>
         <response name="error" type="view" value="ProductionRunDeclaration"/>
     </request-map>

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?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml Wed Apr 16 07:15:31 2008
@@ -252,6 +252,19 @@
             <submit button-type="button"/>
         </field>
     </form>
+    <form name="ProductionRunDeclareAndProduce" type="single" target="productionRunDeclareAndProduce" title="" default-map-name="productionRunData"
+        header-row-style="header-row" default-table-style="basic-table">
+        <field name="workEffortId"><hidden/></field>
+        <field name="quantity" title="${uiLabelMap.ManufacturingProduceQuantity}" tooltip="If required, materials will be issued as well."><text/></field>
+        <field name="inventoryItemTypeId">
+            <drop-down allow-empty="false" no-current-selected-key="NON_SERIAL_INV_ITEM">
+                <entity-options entity-name="InventoryItemType" description="${description}"/>
+            </drop-down>
+        </field>
+        <field name="submitButton" title="${uiLabelMap.CommonAdd}">
+            <submit button-type="button"/>
+        </field>
+    </form>
    
     <form name="ListProductionRunDeclRoutingTasks" type="list" target="ProductionRunDeclaration" title="" list-name="productionRunRoutingTasks"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">

Modified: ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml?rev=648703&r1=648702&r2=648703&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml (original)
+++ ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml Wed Apr 16 07:15:31 2008
@@ -218,6 +218,7 @@
                                     </and>
                                 </condition>
                                 <widgets>
+                                    <link target="quickStartAllProductionRunTasks?productionRunId=${productionRunId}" text="${uiLabelMap.ManufacturingQuickStartAllTasks}" style="buttontext"/>
                                     <link target="quickRunAllProductionRunTasks?productionRunId=${productionRunId}" text="${uiLabelMap.ManufacturingQuickRunAllTasks}" style="buttontext"/>
                                     <link target="quickChangeProductionRunStatus?productionRunId=${productionRunId}&amp;statusId=PRUN_COMPLETED" text="${uiLabelMap.ManufacturingQuickComplete}" style="buttontext"/>
                                     <link target="quickChangeProductionRunStatus?productionRunId=${productionRunId}&amp;statusId=PRUN_CLOSED" text="${uiLabelMap.ManufacturingQuickClose}" style="buttontext"/>
@@ -254,6 +255,27 @@
                                         <section>
                                             <widgets>                                        
                                                 <include-form name="ProductionRunProduce" location="component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml"/>
+                                            </widgets>
+                                        </section>
+                                    </container>
+                                   </container>                                
+                            </widgets>
+                        </section>
+                        <section>
+                            <condition>
+                                <if-compare field-name="canDeclareAndProduce" operator="equals" value="Y"/>
+                            </condition>
+                            <widgets>
+                                <container style="screenlet">
+                                    <container style="screenlet-title-bar">
+                                        <container style="h3">
+                                            <label text="${uiLabelMap.ManufacturingProductionRunDeclareAndProduce}"/>
+                                        </container>
+                                    </container>
+                                    <container style="screenlet-body">
+                                        <section>
+                                            <widgets>                                        
+                                                <include-form name="ProductionRunDeclareAndProduce" location="component://manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml"/>
                                             </widgets>
                                         </section>
                                     </container>