Author: mrisaliti
Date: Wed Jan 19 20:24:04 2011 New Revision: 1060963 URL: http://svn.apache.org/viewvc?rev=1060963&view=rev Log: Internationalization of java services for manufacturing component (OFBIZ-4091) Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/routing/RoutingServices.java ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml ofbiz/trunk/applications/product/config/ProductUiLabels.xml Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml?rev=1060963&r1=1060962&r2=1060963&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml (original) +++ ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.xml Wed Jan 19 20:24:04 2011 @@ -799,6 +799,38 @@ <value xml:lang="zh">ç©ææ¸ å</value> <value xml:lang="zh_TW">ç©ææ¸ å®</value> </property> + <property key="ManufacturingBomErrorCreatingBillOfMaterialsTree"> + <value xml:lang="en">Error creating bill of materials tree: ${errorString}</value> + <value xml:lang="it">Errore durante la creazione dell'albero dei materiali: ${errorString}</value> + </property> + <property key="ManufacturingBomErrorLoadingShipmentItems"> + <value xml:lang="en">Error loading the ShipmentItems</value> + <value xml:lang="it">Errore durante il caricamento di ShipmentItems</value> + </property> + <property key="ManufacturingBomErrorLoadingShipmentPackages"> + <value xml:lang="en">Error loading the ShipmentPackages</value> + <value xml:lang="it">Errore durante il caricamento di ShipmentPackages</value> + </property> + <property key="ManufacturingBomErrorRunningDuplicatedAncestorSearch"> + <value xml:lang="en">Error running duplicated ancestor search: ${errorString}</value> + <value xml:lang="it">Errore durante l'esecuzione della ricerca duplicati antenato: ${errorString}</value> + </property> + <property key="ManufacturingBomErrorRunningInitLowLevelCode"> + <value xml:lang="en">Error running initLowLevelCode: ${errorString}</value> + <value xml:lang="it">Errore durante l'esecuzione di initLowLevelCode: ${errorString}</value> + </property> + <property key="ManufacturingBomErrorRunningMaxDethAlgorithm"> + <value xml:lang="en">Error running max depth algorithm: ${errorString}</value> + <value xml:lang="it">Errore durante l'esecuzione dell'algoritmo massima profondità : ${errorString}</value> + </property> + <property key="ManufacturingBomErrorRunningUpdateLowLevelCode"> + <value xml:lang="en">Error running updateLowLevelCode: ${errorString}</value> + <value xml:lang="it">Errore durante l'esecuzione di updateLowLevelCode: ${errorString}</value> + </property> + <property key="ManufacturingBomPackageAlreadyFound"> + <value xml:lang="en">Packages already found.</value> + <value xml:lang="it">Pacchi già trovati.</value> + </property> <property key="ManufacturingBomSimulation"> <value xml:lang="de">Stücklistensimulation</value> <value xml:lang="en">Bom Simulation</value> @@ -2282,6 +2314,78 @@ <value xml:lang="zh">ç产èµæºè®¡å</value> <value xml:lang="zh_TW">çç¢è³æºè¨å</value> </property> + <property key="ManufacturingMrpCannotCountRecords"> + <value xml:lang="en">Unable to count MrpEvent records.</value> + <value xml:lang="it">Non è possibile contare i records da i records da MrpEvent.</value> + </property> + <property key="ManufacturingMrpCannotFindCustomTimePeriod"> + <value xml:lang="en">Problem, we can not find CustomTimePeriod, for more detail look at the log</value> + <value xml:lang="it">Problema, non è possibile trovare CustomTimePeriod, più dettagli possono essere trovati nel log</value> + </property> + <property key="ManufacturingMrpCannotFindProductFacility"> + <value xml:lang="en">Unable to retrieve ProductFacility records.</value> + <value xml:lang="it">Non è possibile ricavare i records da ProductFacility.</value> + </property> + <property key="ManufacturingMrpCannotFindSalesForecasts"> + <value xml:lang="en">Problem, we can not find SalesForecasts, for more detail look at the log</value> + <value xml:lang="it">Problema, non è possibile trovare SalesForecasts, più dettagli possono essere trovati nel log</value> + </property> + <property key="ManufacturingMrpCannotFindSalesForecastDetails"> + <value xml:lang="en">Problem, we can not find SalesForecastDetails, for more detail look at the log</value> + <value xml:lang="it">Problema, non è possibile trovare SalesForecastDetails, più dettagli possono essere trovati nel log</value> + </property> + <property key="ManufacturingMrpCannotFindProductForEvent"> + <value xml:lang="en">Problem, can not find the product for a event, for more detail look at the log</value> + <value xml:lang="it">Problema, non è possibile trovare il prodotto per un'evento, più dettagli possono essere trovati nel log</value> + </property> + <property key="ManufacturingMrpCreateOrUpdateEvent"> + <value xml:lang="en">Error during creation or update MrpEvent, parameters: ${parameters}</value> + <value xml:lang="it">Errore durante la creazione o aggiornamento MrpEvent, parametri: ${parameters}</value> + </property> + <property key="ManufacturingMrpErrorForBomLevel"> + <value xml:lang="en">MRP Error retieving MRP event for the bom level: ${bomLevel}. Error: ${errorString}</value> + <value xml:lang="it">Errore MRP ricavando l'evento MRP per il livello di distinta base: ${bomLevel}. Errore: ${errorString}</value> + </property> + <property key="ManufacturingMrpErrorExplodingProduct"> + <value xml:lang="en">An error occurred exploding the product ${productId}</value> + <value xml:lang="it">E' successo un'errore durante l'espolosizione del prodotto ${productId}</value> + </property> + <property key="ManufacturingMrpErrorRunningInitMrpEvents"> + <value xml:lang="en">Error running the initMrpEvents service: ${errorString}</value> + <value xml:lang="it">Errore durante l'esecuzione del servizio initMrpEvents: ${errorString}</value> + </property> + <property key="ManufacturingMrpEventFindError"> + <value xml:lang="en">Problem, we can not find all the items of MrpEvent, for more detail look at the log</value> + <value xml:lang="it">Problema, non possaimo trovare tutte le righe di MrpEvent, per più dettagli controllare il log</value> + </property> + <property key="ManufacturingMrpEventProblemInitializing"> + <value xml:lang="en">Problem initializing the MrpEvent entity (${mrpEventTypeId})</value> + <value xml:lang="it">Problema di inizializzazione entità MrpEvent (${mrpEventTypeId})</value> + </property> + <property key="ManufacturingMrpEventRemoveError"> + <value xml:lang="en">Problem, we can not remove the MrpEvent items, for more detail look at the log</value> + <value xml:lang="it">Problema, non possaimo rimuovere le righe di MrpEvent, per più dettagli controllare il log</value> + </property> + <property key="ManufacturingMrpFacilityGroupCannotBeLoad"> + <value xml:lang="en">Problem loading facility group information: ${errorString}</value> + <value xml:lang="it">Problema durante il caricamento delle informazioni relative al gruppo stabilimento: ${errorString}</value> + </property> + <property key="ManufacturingMrpFacilityGroupIsNotAssociatedToFacility"> + <value xml:lang="en">No facility associated to facilityGroupId ${facilityGroupId}</value> + <value xml:lang="it">Nessuna stabilimento associato al gruppo stabilimento ${facilityGroupId}</value> + </property> + <property key="ManufacturingMrpFacilityGroupIsNotValid"> + <value xml:lang="en">facilityGroupId ${facilityGroupId} is not valid</value> + <value xml:lang="it">Gruppo stabilimento ${facilityGroupId} non è valido</value> + </property> + <property key="ManufacturingMrpFacilityNotAvailable"> + <value xml:lang="en">facilityId and facilityGroupId cannot be both null</value> + <value xml:lang="it">Stabilimento e gruppo stabilimento non possono essere entrambi nulli</value> + </property> + <property key="ManufacturingMrpFacilityOrManufacturingFacilityNotAvailable"> + <value xml:lang="en">facilityId and manufacturingFacilityId cannot be null</value> + <value xml:lang="it">Stabilimento e stabilimento di produzione non possono essere nulli</value> + </property> <property key="ManufacturingMrpInitialisation"> <value xml:lang="de">MRP-Initialisierung</value> <value xml:lang="en">IEP init.</value> @@ -2766,6 +2870,22 @@ <value xml:lang="zh">å ³è</value> <value xml:lang="zh_TW">éè¯</value> </property> + <property key="ManufacturingProductionRunCannotBeCancelled"> + <value xml:lang="en">Cannot cancel productionRun, not in a valid status</value> + <value xml:lang="it">Non è possibile cancellare l'ordin di produzione, non è in uno stato valido</value> + </property> + <property key="ManufacturingProductionRunCannotDecomposingInventoryItem"> + <value xml:lang="en">Error decomposing inventory item: inventory item with id ${inventoryItemId} not found.</value> + <value xml:lang="it">Errore duranta la decomposizione della riga inventario: riga inventario ${inventoryItemId} non trovata.</value> + </property> + <property key="ManufacturingProductionRunCannotDecomposingInventoryItemNoComponentsFound"> + <value xml:lang="en">Error decomposing inventory item: no components found for marketing package ${productId}.</value> + <value xml:lang="it">Errore duranta la decomposizione della riga inventario: nessun componente trovato per il pacco di vendita ${productId}.</value> + </property> + <property key="ManufacturingProductionRunCannotDecomposingInventoryItemNoMarketingPackagesFound"> + <value xml:lang="en">Error decomposing inventory item: no marketing packages found in inventory item ${inventoryItemId}.</value> + <value xml:lang="it">Errore duranta la decomposizione della riga inventario: nessun pacco di vendita trovato nella riga di inventario ${inventoryItemId}.</value> + </property> <property key="ManufacturingProductionRunClose"> <value xml:lang="de">Produktionsauftrag abschlieÃen</value> <value xml:lang="en">Close Production Run</value> @@ -2824,6 +2944,10 @@ <value xml:lang="zh">ç产è¿è¡ç»ä»¶</value> <value xml:lang="zh_TW">çç¢éè¡å 件</value> </property> + <property key="ManufacturingProductionRunErrorRunningSetEstimatedDeliveryDates"> + <value xml:lang="en">Problem running the setEstimatedDeliveryDates service</value> + <value xml:lang="it">Problema di esecuzione del servizio setEstimatedDeliveryDates</value> + </property> <property key="ManufacturingProductionRunCosts"> <value xml:lang="de">Produktionsauftrags-Kosten</value> <value xml:lang="en">Production Run Costs</value> @@ -2900,6 +3024,22 @@ <value xml:lang="zh">ç产è¿è¡åºå®èµäº§</value> <value xml:lang="zh_TW">çç¢éè¡åºå®è³ç¢</value> </property> + <property key="ManufacturingProductionRunForMarketingPackagesCreationError"> + <value xml:lang="en">Error creating a production run for marketing package for order ${orderId} ${orderItemSeqId}: ${errorString}</value> + <value xml:lang="it">Errore durante la creazione dell'ordine di produzione per il pacco di vendita per l'ordine ${orderId} ${orderItemSeqId}: ${errorString}</value> + </property> + <property key="ManufacturingProductionRunForMarketingPackagesOrderItemNotFound"> + <value xml:lang="en">Error creating a production run for marketing package for order ${orderId} ${orderItemSeqId}: order item not found.</value> + <value xml:lang="it">Errore durante la creazione dell'ordine di produzione per il pacco di vendita per l'ordine ${orderId} ${orderItemSeqId}: riga ordine non trovata.</value> + </property> + <property key="ManufacturingProductionRunFromConfigurationNotYetImplemented"> + <value xml:lang="en">Operation not yet implemented</value> + <value xml:lang="it">Operazione non è ancora implementata</value> + </property> + <property key="ManufacturingProductionRunFromConfigurationNotValid"> + <value xml:lang="en">Product Configuration Not Valid</value> + <value xml:lang="it">Configurazione non valida</value> + </property> <property key="ManufacturingProductionRunId"> <value xml:lang="de">Produktionsauftrags-Nr.</value> <value xml:lang="en">Production Run ID</value> @@ -2912,6 +3052,10 @@ <value xml:lang="zh">ç产è¿è¡æ è¯</value> <value xml:lang="zh_TW">çç¢å·è¡ID</value> </property> + <property key="ManufacturingProductionRunIsNotRequiredForProductId"> + <value xml:lang="en">No production run is required for product with id ${productId} in date ${startDate}; please verify the validity dates of the bill of materials and routing.</value> + <value xml:lang="it">Nessun ordine di produzione è richiesto per il prodotto ${productId} in data ${startDate}; verificare le date di validità dei materiali.</value> + </property> <property key="ManufacturingProductionRunName"> <value xml:lang="de">Produktionsauftrags-Name</value> <value xml:lang="en">Production Run Name</value> @@ -3081,6 +3225,10 @@ <value xml:lang="zh">ç产è¿è¡ç¶æ没ææ¹åï¼æ²¡æå®æå¿ è¦çç产è¿è¡</value> <value xml:lang="zh_TW">çç¢éè¡çæ æ²ææ¹è®ï¼æ²æå®æå¿ è¦ççç¢éè¡</value> </property> + <property key="ManufacturingProductionRunTaskCannotReturnMoreItems"> + <value xml:lang="en">Production Run Task with id ${productionRunTaskId} cannot return more items ${quantity} than the ones currently allocated ${quantityAllocated}</value> + <value xml:lang="it">Compito ordine di produzione ${productionRunTaskId} non può restituire più righe ${quantity} di quelle allocate attualmente ${quantityAllocated}</value> + </property> <property key="ManufacturingProductionRunTaskCannotStartDocsNotPrinted"> <value xml:lang="en">Production Run Task Cannot Start Docs Not Printed</value> <value xml:lang="it">Compito ordine di produzione non può iniziare con documento non stampato</value> @@ -3095,6 +3243,10 @@ <value xml:lang="zh">ç产è¿è¡ä»»å¡æ æ³å¯å¨ï¼ä¹åçä»»å¡æ²¡æå®æ</value> <value xml:lang="zh_TW">çç¢éè¡ä»»åç¡æ³ååï¼ä¹åçä»»åæ²æå®æ</value> </property> + <property key="ManufacturingProductionRunTaskNotFound"> + <value xml:lang="en">Cannot find the production run task with id: ${productionRunTaskId}</value> + <value xml:lang="it">Non è possibile trovare il compito dell'ordine di produzione: ${productionRunTaskId}</value> + </property> <property key="ManufacturingProductionRunTaskNotExists"> <value xml:lang="en">Production Run Task Not Exists</value> <value xml:lang="it">Compito ordine di produzione non esiste</value> @@ -3109,6 +3261,10 @@ <value xml:lang="zh">ç产è¿è¡ä»»å¡æ²¡ææ§è¡</value> <value xml:lang="zh_TW">çç¢éè¡ä»»åæ²æå·è¡</value> </property> + <property key="ManufacturingProductionRunTaskProduceError"> + <value xml:lang="en">Error calling productionRunTaskProduce: </value> + <value xml:lang="it">Errore durante l'esecuzione di productionRunTaskProduce: </value> + </property> <property key="ManufacturingProductionRunTaskStatusChanged"> <value xml:lang="en">Production Run Task Status Changed</value> <value xml:lang="it">Compito ordine di produzione stato cambiato</value> @@ -3127,6 +3283,38 @@ <value xml:lang="zh">ç产è¿è¡ä»»å¡</value> <value xml:lang="zh_TW">çç¢éè¡ä»»å</value> </property> + <property key="ManufacturingProductionRunTryToCreateWorkEffortAssoc"> + <value xml:lang="en">Error try to create workeffort assoc</value> + <value xml:lang="it">Errore durante il tentativo di creazione associazione impegno di lavoro</value> + </property> + <property key="ManufacturingProductionRunTryToGetBomListError"> + <value xml:lang="en">Error try to get BOM list from productAssoc</value> + <value xml:lang="it">Errore durante il tentativo di ottenere la lista della distinta base da productAssoc</value> + </property> + <property key="ManufacturingProductionRunUnableToCreateMaterialsCosts"> + <value xml:lang="en">Unable to create materials costs for the production run task ${productionRunTaskId}: ${errorString}</value> + <value xml:lang="it">Non è possibile create i costi dei materiali per il compito dell'ordine di produzione ${productionRunTaskId}: ${errorString}</value> + </property> + <property key="ManufacturingProductionRunUnableToCreateRoutingCosts"> + <value xml:lang="en">Unable to create routing costs for the production run task ${productionRunTaskId}: ${errorString}</value> + <value xml:lang="it">Non è possibile create i costi per il compito dell'ordine di produzione ${productionRunTaskId}: ${errorString}</value> + </property> + <property key="ManufacturingProductionRunUnableToFindCosts"> + <value xml:lang="en">Unable to find a currency for production run costs</value> + <value xml:lang="it">Non è possibile trovare una valuta per i costi dell'ordine di produzione</value> + </property> + <property key="ManufacturingProductionRunUnableToFindCostsForWorkEffort"> + <value xml:lang="en">Cannot retrieve costs for work effort ${workEffortId}: ${errorString}</value> + <value xml:lang="it">Non è possibile ricavare i costi per l'impegno di lavoro ${workEffortId}: ${errorString}</value> + </property> + <property key="ManufacturingProductionRunUnableToFindOverheadCosts"> + <value xml:lang="en">Unable to compute overhead costs for production run: ${errorString}</value> + <value xml:lang="it">Non è possibile elaborare gli ulteriori costo dell'ordine di produzione: ${errorString}</value> + </property> + <property key="ManufacturingProductionRunUnableToProgressTaskStatus"> + <value xml:lang="en">Unable to progress from status ${prevStatusId} for task ${taskId}</value> + <value xml:lang="it">Non è possibile cambiare lo stato da 'in corso' ${prevStatusId} per il compito ${taskId}</value> + </property> <property key="ManufacturingProposedOrder"> <value xml:lang="en">Proposed Order</value> <value xml:lang="es">Orden propuesta</value> @@ -3393,6 +3581,10 @@ <value xml:lang="zh">è§ç¨</value> <value xml:lang="zh_TW">è¦ç¨</value> </property> + <property key="ManufacturingRoutingErrorFindingTask"> + <value xml:lang="en">Error finding routing task with id: ${taskId}</value> + <value xml:lang="it">Errore durante la ricerca del ciclo per il compito: ${taskId}</value> + </property> <property key="ManufacturingRoutingHasNoRoutingTask"> <value xml:lang="de">Arbeitsplan besitzt keinen Arbeitsgang</value> <value xml:lang="en">Routing has no Routing Task</value> @@ -3898,6 +4090,14 @@ <value xml:lang="zh">ä¸åå¨ææ¯æ°æ®æ¥åå¨</value> <value xml:lang="zh_TW">ä¸åå¨æè¡è³ææ¥æé±</value> </property> + <property key="ManufacturingTechDataWorkEffortNotExist"> + <value xml:lang="en">Error finding desired WorkEffort records: ${errorString}</value> + <value xml:lang="it">Errore durante la ricerca dei records di WorkEffort: ${errorString}</value> + </property> + <property key="ManufacturingTechDataWorkEffortAssocNotExist"> + <value xml:lang="en">Error finding desired WorkEffortAssoc records: ${errorString}</value> + <value xml:lang="it">Errore durante la ricerca dei records di WorkEffortAssoc: ${errorString}</value> + </property> <property key="ManufacturingTimePeriod"> <value xml:lang="de">Zeitraum</value> <value xml:lang="en">Time Period</value> @@ -4097,6 +4297,10 @@ <value xml:lang="zh">人工æå¡ä¸åå¨</value> <value xml:lang="zh_TW">å·¥é ä¸åå¨</value> </property> + <property key="ManufacturinWorkOrderItemFulfillmentError"> + <value xml:lang="en">Error reading the WorkOrderItemFulfillment: ${errorString}</value> + <value xml:lang="it">Errore durante la letture di WorkOrderItemFulfillment: ${errorString}</value> + </property> <property key="ManufacturingWorkWithShipmentPlans"> <value xml:lang="de">Versandpläne</value> <value xml:lang="en">Shipment Plans</value> Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java?rev=1060963&r1=1060962&r2=1060963&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java Wed Jan 19 20:24:04 2011 @@ -68,6 +68,7 @@ public class BOMServices { String productId = (String) context.get("productId"); String fromDateStr = (String) context.get("fromDate"); String bomType = (String) context.get("bomType"); + Locale locale = (Locale) context.get("locale"); Date fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { @@ -88,7 +89,7 @@ public class BOMServices { bomTypes.add(((GenericValue)bomTypesValuesIt.next()).getString("productAssocTypeId")); } } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error running max depth algorithm: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningMaxDethAlgorithm", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } else { bomTypes.add(bomType); @@ -106,7 +107,7 @@ public class BOMServices { } } } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error running max depth algorithm: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningMaxDethAlgorithm", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } result.put("depth", Long.valueOf(maxDepth)); @@ -127,6 +128,7 @@ public class BOMServices { LocalDispatcher dispatcher = dctx.getDispatcher(); String productId = (String) context.get("productIdTo"); Boolean alsoComponents = (Boolean) context.get("alsoComponents"); + Locale locale = (Locale) context.get("locale"); if (alsoComponents == null) { alsoComponents = Boolean.TRUE; } @@ -197,7 +199,7 @@ public class BOMServices { } } } catch (Exception e) { - return ServiceUtil.returnError("Error running updateLowLevelCode: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); } result.put("lowLevelCode", llc); return result; @@ -213,6 +215,7 @@ public class BOMServices { Map<String, Object> result = FastMap.newInstance(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); + Locale locale = (Locale) context.get("locale"); try { List<GenericValue> products = delegator.findList("Product", null, null, @@ -240,7 +243,7 @@ public class BOMServices { } // FIXME: also all the variants llc should be updated? } catch (Exception e) { - return ServiceUtil.returnError("Error running initLowLevelCode: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningInitLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return result; } @@ -258,7 +261,7 @@ public class BOMServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); - + Locale locale = (Locale) context.get("locale"); String productId = (String) context.get("productId"); String productIdKey = (String) context.get("productIdTo"); Timestamp fromDate = (Timestamp) context.get("fromDate"); @@ -270,7 +273,7 @@ public class BOMServices { try { duplicatedProductAssoc = BOMHelper.searchDuplicatedAncestor(productId, productIdKey, bomType, fromDate, delegator, dispatcher, userLogin); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error running duplicated ancestor search: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningDuplicatedAncestorSearch", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } result.put("duplicatedProductAssoc", duplicatedProductAssoc); return result; @@ -297,6 +300,7 @@ public class BOMServices { Integer type = (Integer) context.get("type"); BigDecimal quantity = (BigDecimal) context.get("quantity"); BigDecimal amount = (BigDecimal) context.get("amount"); + Locale locale = (Locale) context.get("locale"); if (type == null) { type = Integer.valueOf(0); } @@ -316,7 +320,7 @@ public class BOMServices { try { tree = new BOMTree(productId, bomType, fromDate, type.intValue(), delegator, dispatcher, userLogin); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } if (tree != null && quantity != null) { tree.setRootQuantity(quantity); @@ -346,6 +350,7 @@ public class BOMServices { BigDecimal amount = (BigDecimal) context.get("amount"); String fromDateStr = (String) context.get("fromDate"); Boolean excludeWIPs = (Boolean) context.get("excludeWIPs"); + Locale locale = (Locale) context.get("locale"); if (quantity == null) { quantity = BigDecimal.ONE; @@ -380,7 +385,7 @@ public class BOMServices { tree.print(components, excludeWIPs.booleanValue()); if (components.size() > 0) components.remove(0); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } // // Product routing @@ -430,6 +435,7 @@ public class BOMServices { BigDecimal amount = (BigDecimal) context.get("amount"); String fromDateStr = (String) context.get("fromDate"); GenericValue userLogin = (GenericValue)context.get("userLogin"); + Locale locale = (Locale) context.get("locale"); if (quantity == null) { quantity = BigDecimal.ONE; @@ -458,7 +464,7 @@ public class BOMServices { tree.setRootAmount(amount); tree.print(components); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } Iterator<BOMNode> componentsIt = components.iterator(); while (componentsIt.hasNext()) { @@ -485,17 +491,17 @@ public class BOMServices { try { List<GenericValue> packages = delegator.findByAnd("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId)); if (!UtilValidate.isEmpty(packages)) { - return ServiceUtil.returnError("Packages already found."); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomPackageAlreadyFound", locale)); } } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error loading the ShipmentPackages"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorLoadingShipmentPackages", locale)); } // ShipmentItems are loaded List<GenericValue> shipmentItems = null; try { shipmentItems = delegator.findByAnd("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId)); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error loading the ShipmentItems"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorLoadingShipmentItems", locale)); } Iterator<GenericValue> shipmentItemsIt = shipmentItems.iterator(); Map<String, Object> orderReadHelpers = FastMap.newInstance(); @@ -507,8 +513,7 @@ public class BOMServices { try { orderShipments = delegator.findByAnd("OrderShipment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItem.getString("shipmentItemSeqId"))); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } GenericValue orderShipment = org.ofbiz.entity.util.EntityUtil.getFirst(orderShipments); if (orderShipment != null && !orderReadHelpers.containsKey(orderShipment.getString("orderId"))) { @@ -722,8 +727,7 @@ public class BOMServices { } dispatcher.runSync("createShipmentPackageContent", inputMap); } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } totalWidth = totalWidth.add(qty.multiply(productDepth)); if (qty.compareTo(maxQuantity) == 0) shipmentPackageSeqId = null; @@ -747,7 +751,7 @@ public class BOMServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); - + Locale locale = (Locale) context.get("locale"); String productId = (String) context.get("productId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); String fromDateStr = (String) context.get("fromDate"); @@ -776,7 +780,7 @@ public class BOMServices { tree.setRootQuantity(quantity); tree.getProductsInPackages(components); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } result.put("productsInPackages", components); 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=1060963&r1=1060962&r2=1060963&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 Jan 19 20:24:04 2011 @@ -66,6 +66,8 @@ public class ProductionRunServices { public static final String module = ProductionRunServices.class.getName(); public static final String resource = "ManufacturingUiLabels"; + public static final String resourceOrder = "OrderErrorUiLabels"; + public static final String resourceProduct = "ProductUiLabels"; private static BigDecimal ZERO = BigDecimal.ZERO; private static BigDecimal ONE = BigDecimal.ONE; @@ -163,7 +165,7 @@ public class ProductionRunServices { result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } - return ServiceUtil.returnError("Cannot cancel productionRun, not in a valid status"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotBeCancelled", locale)); } /** @@ -753,7 +755,6 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - String productionRunId = (String) context.get("productionRunId"); String taskId = (String) context.get("workEffortId"); String statusId = (String) context.get("statusId"); @@ -928,7 +929,7 @@ public class ProductionRunServices { "organizationPartyId", facility.getString("ownerPartyId"))); GenericValue partyAccountingPreference = (GenericValue)outputMap.get("partyAccountingPreference"); if (partyAccountingPreference == null) { - return ServiceUtil.returnError("Unable to find a currency for production run costs"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale)); } outputMap = dispatcher.runSync("getProductionRunCost", UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", productionRunId)); @@ -966,7 +967,7 @@ public class ProductionRunServices { } } } catch(Exception e) { - return ServiceUtil.returnError("Unable to compute overhead costs for production run: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindOverheadCosts", UtilMisc.toMap("errorString", e.getMessage()), locale)); } } @@ -985,10 +986,11 @@ public class ProductionRunServices { Map<String, Object> result = FastMap.newInstance(); Delegator delegator = ctx.getDelegator(); String workEffortId = (String)context.get("workEffortId"); + Locale locale = (Locale) context.get("locale"); try { GenericValue workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId)); if (workEffort == null) { - return ServiceUtil.returnError("Cannot find work effort [" + workEffortId + "]"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingWorkEffortNotExist", locale) + " " + workEffortId); } // Get all the valid CostComponents entries List<GenericValue> costComponents = EntityUtil.filterByDate(delegator.findByAnd("CostComponent", @@ -1010,7 +1012,7 @@ public class ProductionRunServices { result.put("totalCost", totalCost); result.put("totalCostNoMaterials", totalCostNoMaterials); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Cannot retrieve costs for work effort [" + workEffortId + "]: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCostsForWorkEffort", UtilMisc.toMap("workEffortId", workEffortId, "errorString", gee.getMessage()), locale)); } return result; } @@ -1021,6 +1023,7 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); String workEffortId = (String)context.get("workEffortId"); + Locale locale = (Locale) context.get("locale"); try { List<GenericValue> tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", workEffortId), UtilMisc.toList("workEffortId")); @@ -1039,7 +1042,7 @@ public class ProductionRunServices { } result.put("totalCost", totalCost); } catch (Exception exc) { - return ServiceUtil.returnError("Cannot retrieve costs for production run [" + workEffortId + "]: " + exc.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage()); } return result; } @@ -1048,13 +1051,14 @@ public class ProductionRunServices { Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); + Locale locale = (Locale) context.get("locale"); // this is the id of the actual (real) production run task String productionRunTaskId = (String)context.get("productionRunTaskId"); try { GenericValue workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", productionRunTaskId)); if (UtilValidate.isEmpty(workEffort)) { - return ServiceUtil.returnError("Cannot find the production run task with id [" + productionRunTaskId + "]"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotFound", UtilMisc.toMap("productionRunTaskId", productionRunTaskId), locale)); } double actualTotalMilliSeconds = 0.0; Double actualSetupMillis = workEffort.getDouble("actualSetupMillis"); @@ -1156,7 +1160,7 @@ public class ProductionRunServices { } } } catch (Exception e) { - return ServiceUtil.returnError("Unable to create routing costs for the production run task [" + productionRunTaskId + "]: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); } // materials costs: these are the costs derived from the materials used by the production run task try { @@ -1190,7 +1194,7 @@ public class ProductionRunServices { dispatcher.runSync("createCostComponent", inMap); } } catch (Exception e) { - return ServiceUtil.returnError("Unable to create materials costs for the production run task [" + productionRunTaskId + "]: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); } return ServiceUtil.returnSuccess(); } @@ -1294,8 +1298,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); if (UtilValidate.isEmpty(tasks)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); } if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && @@ -1313,8 +1316,7 @@ public class ProductionRunServices { } } if (!found) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); } } else { workEffortId = EntityUtil.getFirst(tasks).getString("workEffortId"); @@ -1343,8 +1345,7 @@ public class ProductionRunServices { dispatcher.runSync("createWorkEffortGoodStandard", serviceContext); } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the createWorkEffortGoodStandard service", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingProductionRunComponentNotAdded", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentNotAdded", locale)); } result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentAdded",UtilMisc.toMap("productionRunId", productionRunId), locale)); @@ -1367,8 +1368,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); List<GenericValue> components = productionRun.getProductionRunComponents(); if (UtilValidate.isEmpty(components)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingProductionRunComponentNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentNotExists", locale)); } if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && @@ -1670,7 +1670,7 @@ public class ProductionRunServices { Map<String, Object> outputMap = dispatcher.runSync("getPartyAccountingPreferences", UtilMisc.<String, Object>toMap("userLogin", userLogin, "organizationPartyId", facility.getString("ownerPartyId"))); GenericValue partyAccountingPreference = (GenericValue)outputMap.get("partyAccountingPreference"); if (partyAccountingPreference == null) { - return ServiceUtil.returnError("Unable to find a currency for production run costs"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale)); } outputMap = dispatcher.runSync("getProductCost", UtilMisc.<String, Object>toMap("userLogin", userLogin, "productId", productionRun.getProductProduced().getString("productId"), "currencyUomId", (String)partyAccountingPreference.get("baseCurrencyUomId"), "costComponentTypePrefix", "EST_STD")); unitCost = (BigDecimal)outputMap.get("productCost"); @@ -1832,8 +1832,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); } } } @@ -1845,8 +1844,7 @@ public class ProductionRunServices { result = dispatcher.runSync("productionRunProduce", inputMap); } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); } return result; } @@ -1967,6 +1965,7 @@ public class ProductionRunServices { String productId = (String)context.get("productId"); // Optional input fields BigDecimal quantity = (BigDecimal)context.get("quantity"); + Locale locale = (Locale) context.get("locale"); if (quantity == null || quantity.compareTo(ZERO) == 0) { return ServiceUtil.returnSuccess(); } @@ -1998,7 +1997,7 @@ public class ProductionRunServices { } } if (quantity.compareTo(totalIssued.subtract(totalReturned)) > 0) { - return ServiceUtil.returnError("Production Run Task with id [" + productionRunTaskId + "] cannot return more items [" + quantity + "] than the ones currently allocated [" + (totalIssued.subtract(totalReturned)) + "]"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotReturnMoreItems", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "quantity", quantity, "quantityAllocated", totalIssued.subtract(totalReturned)), locale)); } } catch (GenericEntityException gee) { return ServiceUtil.returnError(gee.getMessage()); @@ -2013,8 +2012,7 @@ public class ProductionRunServices { "productId", productId, "quantity", quantity, "inventoryItemTypeId", inventoryItemTypeId, "userLogin", userLogin)); if (ServiceUtil.isError(inventoryResult)) { - return ServiceUtil.returnError("Error calling productionRunTaskProduce: " + - ServiceUtil.getErrorMessage(inventoryResult)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskProduceError" + ServiceUtil.getErrorMessage(inventoryResult), locale)); } } catch (GenericServiceException exc) { return ServiceUtil.returnError(exc.getMessage()); @@ -2305,10 +2303,10 @@ public class ProductionRunServices { } if (config == null && configId != null) { // TODO: load the configuration - return ServiceUtil.returnError("Operation not yet implemented"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunFromConfigurationNotYetImplemented", locale)); } if (!config.isCompleted()) { - return ServiceUtil.returnError("ProductConfigurationNotValid"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunFromConfigurationNotValid", locale)); } if (quantity == null) { quantity = BigDecimal.ONE; @@ -2372,7 +2370,7 @@ public class ProductionRunServices { UtilMisc.toMap("productId", componentProductId, "productAssocTypeId", "MANUF_COMPONENT")); bomList = EntityUtil.filterByDate(bomList, UtilDateTime.nowTimestamp()); } catch (GenericEntityException e) { - return ServiceUtil.returnError("try to get BOM list from productAssoc"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTryToGetBomListError", locale)); } // if so create a mandatory predecessor to this production run if (UtilValidate.isNotEmpty(bomList)) { @@ -2392,7 +2390,7 @@ public class ProductionRunServices { } catch (GenericServiceException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); } catch (GenericEntityException e) { - return ServiceUtil.returnError("try to create workeffort assoc"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTryToCreateWorkEffortAssoc", locale)); } } else { @@ -2469,17 +2467,17 @@ public class ProductionRunServices { GenericValue productStore = delegator.getRelatedOne("ProductStore", order); isImmediatelyFulfilled = "Y".equals(productStore.getString("isImmediatelyFulfilled")); } catch (GenericEntityException e) { - return ServiceUtil.returnError("Error creating a production run for marketing package for order [" + orderId + " " + orderItemSeqId + "]: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); } GenericValue orderItem = null; try { orderItem = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId)); } catch (GenericEntityException e) { - return ServiceUtil.returnError("Error creating a production run for marketing package for order [" + orderId + " " + orderItemSeqId + "]: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); } if (orderItem == null) { - return ServiceUtil.returnError("Error creating a production run for marketing package for order [" + orderId + " " + orderItemSeqId + "]: order item not found."); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), locale)); } if (orderItem.get("quantity") == null) { Debug.logWarning("No quantity found for orderItem [" + orderItem +"], skipping production run of this marketing package", module); @@ -2530,7 +2528,7 @@ public class ProductionRunServices { try { delegator.create("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId, "orderId", orderId, "orderItemSeqId", orderItemSeqId)); } catch (GenericEntityException e) { - return ServiceUtil.returnError("Error creating a production run for marketing package for order [" + orderId + " " + orderItemSeqId + "]: " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); } try { @@ -2567,14 +2565,13 @@ public class ProductionRunServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); - String orderId = (String) context.get("orderId"); - String shipmentId = (String) context.get("shipmentId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); String shipGroupSeqId = (String) context.get("shipGroupSeqId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); String fromDateStr = (String) context.get("fromDate"); + Locale locale = (Locale) context.get("locale"); Date fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { @@ -2598,23 +2595,23 @@ public class ProductionRunServices { orderItem = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId)); } if (orderItem == null) { - return ServiceUtil.returnError("OrderItem [" + orderItemSeqId + "] not found."); + return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderErrorOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", ""), locale)); } if (quantity != null) { orderItem.set("quantity", quantity); } orderItems = UtilMisc.toList(orderItem); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error reading the OrderItem: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderProblemsReadingOrderItemInformation", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } else { try { orderItems = delegator.findByAnd("OrderItem", UtilMisc.toMap("orderId", orderId)); if (orderItems == null) { - return ServiceUtil.returnError("OrderItems for order [" + orderId + "] not found."); + return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderErrorOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", ""), locale)); } } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error reading the OrderItems: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderProblemsReadingOrderItemInformation", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } List<String> productionRuns = FastList.newInstance(); @@ -2664,7 +2661,7 @@ public class ProductionRunServices { continue; } } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error reading the WorkOrderItemFulfillment: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturinWorkOrderItemFulfillmentError", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } try { List<BOMNode> components = FastList.newInstance(); @@ -2674,7 +2671,7 @@ public class ProductionRunServices { tree.print(components); productionRuns.add(tree.createManufacturingOrders(null, fromDate, null, null, null, orderId, orderItem.getString("orderItemSeqId"), shipGroupSeqId, shipmentId, userLogin)); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } result.put("productionRuns" , productionRuns); @@ -2686,7 +2683,7 @@ public class ProductionRunServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin =(GenericValue)context.get("userLogin"); - + Locale locale = (Locale) context.get("locale"); String productId = (String)context.get("productId"); Timestamp startDate = (Timestamp)context.get("startDate"); BigDecimal quantity = (BigDecimal)context.get("quantity"); @@ -2706,10 +2703,10 @@ public class ProductionRunServices { tree.print(components); workEffortId = tree.createManufacturingOrders(facilityId, startDate, workEffortName, description, routingId, null, null, null, null, userLogin); } catch (GenericEntityException gee) { - return ServiceUtil.returnError("Error creating bill of materials tree: " + gee.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } if (workEffortId == null) { - return ServiceUtil.returnError("No production run is required for product with id [" + productId +"] in date [" + startDate + "]; please verify the validity dates of the bill of materials and routing."); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunIsNotRequiredForProductId", UtilMisc.toMap("productId", productId, "startDate", startDate), locale)); } List<String> productionRuns = FastList.newInstance(); result.put("productionRuns" , productionRuns); @@ -2748,7 +2745,7 @@ public class ProductionRunServices { resultService = dispatcher.runSync("changeProductionRunTaskStatus", serviceContext); currentStatusId = (String)resultService.get("newStatusId"); if (currentStatusId.equals(prevStatusId)) { - return ServiceUtil.returnError("Unable to progress from status [" + prevStatusId + "] for task [" + taskId + "]"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToProgressTaskStatus", UtilMisc.toMap("prevStatusId", prevStatusId, "taskId", taskId), locale)); } else { prevStatusId = currentStatusId; } @@ -2962,6 +2959,7 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); String inventoryItemId = (String)context.get("inventoryItemId"); + Locale locale = (Locale) context.get("locale"); /* BigDecimal quantity = (BigDecimal)context.get("quantityAccepted"); if (quantity != null && quantity.BigDecimalValue() == 0) { @@ -2971,14 +2969,14 @@ public class ProductionRunServices { try { GenericValue inventoryItem = delegator.findByPrimaryKey("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId)); if (inventoryItem == null) { - return ServiceUtil.returnError("Error: inventory item with id [" + inventoryItemId + "] not found."); + return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductInventoryItemNotFound", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale)); } if (inventoryItem.get("availableToPromiseTotal") != null && inventoryItem.getBigDecimal("availableToPromiseTotal").compareTo(ZERO) <= 0) { return ServiceUtil.returnSuccess(); } GenericValue product = inventoryItem.getRelatedOne("Product"); if (product == null) { - return ServiceUtil.returnError("Error: product with id [" + inventoryItem.get("productId") + "] not found."); + return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductProductNotFound", locale) + " " + inventoryItem.get("productId")); } if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) { Map<String, Object> serviceContext = UtilMisc.toMap("inventoryItemId", inventoryItemId, @@ -3003,6 +3001,7 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); Timestamp now = UtilDateTime.nowTimestamp(); GenericValue userLogin = (GenericValue) context.get("userLogin"); + Locale locale = (Locale) context.get("locale"); // Mandatory input fields String inventoryItemId = (String)context.get("inventoryItemId"); BigDecimal quantity = (BigDecimal)context.get("quantity"); @@ -3011,7 +3010,7 @@ public class ProductionRunServices { GenericValue inventoryItem = delegator.findByPrimaryKey("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId)); if (inventoryItem == null) { - return ServiceUtil.returnError("Error decomposing inventory item: inventory item with id [" + inventoryItemId + "] not found."); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale)); } // the work effort (disassemble order) is created Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("workEffortTypeId", "TASK", @@ -3033,7 +3032,7 @@ public class ProductionRunServices { resultService = dispatcher.runSync("issueInventoryItemToWorkEffort", serviceContext); BigDecimal issuedQuantity = (BigDecimal)resultService.get("quantityIssued"); if (issuedQuantity.compareTo(ZERO) == 0) { - return ServiceUtil.returnError("Error decomposing inventory item: no marketing packages found in inventory item [" + inventoryItem.getString("inventoryItemId") + "]."); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItemNoMarketingPackagesFound", UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId")), locale)); } // get the package's unit cost to compute a cost coefficient ratio which is the marketing package's actual unit cost divided by its standard cost // this ratio will be used to determine the cost of the marketing package components when they are returned to inventory @@ -3065,7 +3064,7 @@ public class ProductionRunServices { resultService = dispatcher.runSync("getManufacturingComponents", serviceContext); List<Map<String, Object>> components = UtilGenerics.checkList(resultService.get("componentsMap")); if (components == null || components.isEmpty()) { - return ServiceUtil.returnError("Error decomposing inventory item: no components found for marketing package [" + inventoryItem.getString("productId") + "]."); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItemNoComponentsFound", UtilMisc.toMap("productId", inventoryItem.getString("productId")), locale)); } Iterator<Map<String, Object>> componentsIt = components.iterator(); while (componentsIt.hasNext()) { @@ -3107,7 +3106,7 @@ public class ProductionRunServices { public static Map<String, Object> setEstimatedDeliveryDates(DispatchContext ctx, Map<String, ? extends Object> context) { Delegator delegator = ctx.getDelegator(); Timestamp now = UtilDateTime.nowTimestamp(); - + Locale locale = (Locale) context.get("locale"); Map<String, TreeMap<Timestamp, Object>> products = FastMap.newInstance(); try { @@ -3262,7 +3261,7 @@ public class ProductionRunServices { } } catch (GenericEntityException e) { Debug.logError(e, "Error", module); - return ServiceUtil.returnError("Problem running the setEstimatedDeliveryDates service"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunErrorRunningSetEstimatedDeliveryDates", locale)); } return ServiceUtil.returnSuccess(); } Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java?rev=1060963&r1=1060962&r2=1060963&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java Wed Jan 19 20:24:04 2011 @@ -19,10 +19,12 @@ package org.ofbiz.manufacturing.mrp; import java.math.BigDecimal; +import java.util.Locale; import java.util.Map; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; @@ -30,10 +32,10 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; - public class InventoryEventPlannedServices { public static final String module = InventoryEventPlannedServices.class.getName(); + public static final String resource = "ManufacturingUiLabels"; /** * @@ -46,6 +48,7 @@ public class InventoryEventPlannedServic */ public static Map<String, Object> createMrpEvent(DispatchContext ctx, Map<String, ? extends Object> context) { Delegator delegator = ctx.getDelegator(); + Locale locale = (Locale) context.get("locale"); Map<String, Object> parameters = UtilMisc.<String, Object>toMap("mrpId", context.get("mrpId"), "productId", context.get("productId"), "eventDate", context.get("eventDate"), @@ -55,7 +58,7 @@ public class InventoryEventPlannedServic createOrUpdateMrpEvent(parameters, quantity, (String)context.get("facilityId"), (String)context.get("eventName"), false, delegator); } catch (GenericEntityException e) { Debug.logError(e,"Error : findByPrimaryKey(\"MrpEvent\", parameters =)"+parameters, module); - return ServiceUtil.returnError("Problem, on database access, for more detail look at the log"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCreateOrUpdateEvent", UtilMisc.toMap("parameters", parameters), locale)); } return ServiceUtil.returnSuccess(); } |
Free forum by Nabble | Edit this page |