Author: jacopoc
Date: Wed Mar 28 04:22:32 2007 New Revision: 523281 URL: http://svn.apache.org/viewvc?view=rev&rev=523281 Log: Implemented status transitions for scheduled production runs. Modified: 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/widget/manufacturing/JobshopScreens.xml 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?view=diff&rev=523281&r1=523280&r2=523281 ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Wed Mar 28 04:22:32 2007 @@ -514,9 +514,45 @@ result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); return result; } - - // PRUN_CREATED --> PRUN_DOC_PRINTED - if (currentStatusId.equals("PRUN_CREATED") && (statusId == null || statusId.equals("PRUN_DOC_PRINTED"))) { + + // PRUN_CREATED --> PRUN_SCHEDULED + if (currentStatusId.equals("PRUN_CREATED") && statusId.equals("PRUN_SCHEDULED")) { + // change the production run status to PRUN_SCHEDULED + Map serviceContext = new HashMap(); + serviceContext.clear(); + serviceContext.put("workEffortId", productionRunId); + serviceContext.put("currentStatusId", statusId); + serviceContext.put("userLogin", userLogin); + Map resultService = null; + try { + resultService = dispatcher.runSync("updateWorkEffort", serviceContext); + } catch (GenericServiceException e) { + Debug.logError(e, "Problem calling the updateWorkEffort service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + } + // change the production run tasks status to PRUN_CLOSED + Iterator tasks = productionRun.getProductionRunRoutingTasks().iterator(); + while (tasks.hasNext()) { + GenericValue task = (GenericValue)tasks.next(); + serviceContext.clear(); + serviceContext.put("workEffortId", task.getString("workEffortId")); + serviceContext.put("currentStatusId", statusId); + serviceContext.put("userLogin", userLogin); + resultService = null; + try { + resultService = dispatcher.runSync("updateWorkEffort", serviceContext); + } catch (GenericServiceException e) { + Debug.logError(e, "Problem calling the updateWorkEffort service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + } + } + result.put("newStatusId", statusId); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_CLOSED"), locale)); + return result; + } + + // PRUN_CREATED or PRON_SCHEDULED --> PRUN_DOC_PRINTED + if ((currentStatusId.equals("PRUN_CREATED") || currentStatusId.equals("PRUN_SCHEDULED")) && (statusId == null || statusId.equals("PRUN_DOC_PRINTED"))) { // change only the production run (header) status to PRUN_DOC_PRINTED Map serviceContext = new HashMap(); serviceContext.clear(); @@ -683,9 +719,9 @@ return result; } - // PRUN_CREATED --> PRUN_RUNNING + // PRUN_CREATED or PRUN_SCHEDULED --> PRUN_RUNNING // this should be called only when the first task is started - if (currentStatusId.equals("PRUN_CREATED") && (statusId == null || statusId.equals("PRUN_RUNNING"))) { + 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) { @@ -2224,23 +2260,24 @@ serviceContext.put("statusId", "PRUN_DOC_PRINTED"); serviceContext.put("userLogin", userLogin); resultService = dispatcher.runSync("changeProductionRunStatus", serviceContext); - } - if (statusId.equals("PRUN_COMPLETED") || - statusId.equals("PRUN_CLOSED")) { - serviceContext.clear(); + } else if (statusId.equals("PRUN_COMPLETED") || + statusId.equals("PRUN_CLOSED")) { serviceContext.put("productionRunId", productionRunId); serviceContext.put("userLogin", userLogin); resultService = dispatcher.runSync("quickRunAllProductionRunTasks", serviceContext); - } - if (statusId.equals("PRUN_CLOSED")) { + } else if (statusId.equals("PRUN_CLOSED")) { // Put in warehouse the products manufactured - serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); serviceContext.put("userLogin", userLogin); resultService = dispatcher.runSync("productionRunProduce", serviceContext); serviceContext.clear(); serviceContext.put("productionRunId", productionRunId); serviceContext.put("statusId", "PRUN_CLOSED"); + serviceContext.put("userLogin", userLogin); + resultService = dispatcher.runSync("changeProductionRunStatus", serviceContext); + } else { + serviceContext.put("productionRunId", productionRunId); + serviceContext.put("statusId", statusId); serviceContext.put("userLogin", userLogin); resultService = dispatcher.runSync("changeProductionRunStatus", serviceContext); } 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?view=diff&rev=523281&r1=523280&r2=523281 ============================================================================== --- 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 Mar 28 04:22:32 2007 @@ -175,7 +175,8 @@ if (startTaskId == null && issueTaskId == null && completeTaskId == null && - task.getString("currentStatusId").equals("PRUN_CREATED")) { + ("PRUN_CREATED".equals(task.getString("currentStatusId")) || + "PRUN_SCHEDULED".equals(task.getString("currentStatusId")))) { startTaskId = task.getString("workEffortId"); } } 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=523281&r1=523280&r2=523281 ============================================================================== --- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml Wed Mar 28 04:22:32 2007 @@ -645,6 +645,12 @@ <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"/> + <response name="success" type="view" value="EditProductionRun"/> + <response name="error" type="view" value="EditProductionRun"/> + </request-map> <request-map uri="quickChangeProductionRunStatus"> <security https="true" auth="true"/> <event type="service" invoke="quickChangeProductionRunStatus"/> 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=523281&r1=523280&r2=523281 ============================================================================== --- ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml (original) +++ ofbiz/trunk/applications/manufacturing/widget/manufacturing/JobshopScreens.xml Wed Mar 28 04:22:32 2007 @@ -90,7 +90,7 @@ <decorator-section name="body"> <container> <link target="PrintProductionRun?productionRunId=${productionRunId}" text="${uiLabelMap.CommonPrint}" style="buttontext"/> - <link target="quickChangeProductionRunStatus?productionRunId=${productionRunId}&statusId=PRUN_SCHEDULED" text="${uiLabelMap.ManufacturingSchedule}" style="buttontext"/> + <link target="scheduleProductionRun?productionRunId=${productionRunId}&statusId=PRUN_SCHEDULED" text="${uiLabelMap.ManufacturingSchedule}" style="buttontext"/> <link target="changeProductionRunStatusToPrinted?productionRunId=${productionRunId}" text="${uiLabelMap.ManufacturingConfirmProductionRun}" style="buttontext"/> <link target="quickChangeProductionRunStatus?productionRunId=${productionRunId}&statusId=PRUN_COMPLETED" text="${uiLabelMap.ManufacturingQuickComplete}" style="buttontext"/> <link target="quickChangeProductionRunStatus?productionRunId=${productionRunId}&statusId=PRUN_CLOSED" text="${uiLabelMap.ManufacturingQuickClose}" style="buttontext"/> |
Free forum by Nabble | Edit this page |