Author: jacopoc
Date: Tue Mar 13 03:33:43 2007 New Revision: 517636 URL: http://svn.apache.org/viewvc?view=rev&rev=517636 Log: Added to production runs support for serialized inventory creation. Modified: 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/jobshopmgt/ProductionRunForms.xml Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml?view=diff&rev=517636&r1=517635&r2=517636 ============================================================================== --- ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml (original) +++ ofbiz/trunk/applications/manufacturing/servicedef/services_production_run.xml Tue Mar 13 03:33:43 2007 @@ -170,7 +170,7 @@ <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="true"/> - <attribute name="createSerializedInventory" type="Boolean" mode="IN" optional="true"/> + <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"/> @@ -186,7 +186,7 @@ <attribute name="facilityId" type="String" mode="IN" optional="true"/> <attribute name="unitCost" type="Double" mode="IN" optional="true"/> <attribute name="currencyUomId" type="String" mode="IN" optional="true"/> - <attribute name="createSerializedInventory" type="Boolean" mode="IN" optional="true"/> + <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/> <attribute name="inventoryItemIds" type="List" mode="OUT" optional="false"/> </service> <service name="productionRunTaskReturnMaterial" engine="java" @@ -197,7 +197,7 @@ <attribute name="workEffortId" type="String" mode="IN" optional="false"/> <attribute name="productId" type="String" mode="IN" optional="false"/> <attribute name="quantity" type="Double" mode="IN" optional="true"/> - <attribute name="createSerializedInventory" type="Boolean" mode="IN" optional="true"/> + <attribute name="inventoryItemTypeId" type="String" mode="IN" optional="true"/> </service> <service name="checkDecomposeInventoryItem" engine="java" location="org.ofbiz.manufacturing.jobshopmgt.ProductionRunServices" invoke="checkDecomposeInventoryItem" auth="true"> 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=517636&r1=517635&r2=517636 ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Tue Mar 13 03:33:43 2007 @@ -1229,14 +1229,14 @@ // Optional input fields Double quantity = (Double)context.get("quantity"); - Boolean createSerializedInventory = (Boolean)context.get("createSerializedInventory"); + String inventoryItemTypeId = (String)context.get("inventoryItemTypeId"); String lotId = (String)context.get("lotId"); Boolean createLotIfNeeded = (Boolean)context.get("createLotIfNeeded"); Boolean autoCreateLot = (Boolean)context.get("autoCreateLot"); // The default is non-serialized inventory item - if (createSerializedInventory == null) { - createSerializedInventory = Boolean.FALSE; + if (UtilValidate.isEmpty(inventoryItemTypeId)) { + inventoryItemTypeId = "NON_SERIAL_INV_ITEM"; } // The default is to create a lot if the lotId is given, but the lot doesn't exist if (createLotIfNeeded == null) { @@ -1317,13 +1317,13 @@ Map outputMap = dispatcher.runSync("getProductionRunCost", UtilMisc.toMap("userLogin", userLogin, "workEffortId", productionRunId)); BigDecimal totalCost = (BigDecimal)outputMap.get("totalCost"); // FIXME - unitCost = totalCost.divide(new BigDecimal(quantity.intValue()), decimals, rounding); + unitCost = totalCost.divide(new BigDecimal(quantity.doubleValue()), decimals, rounding); } catch (GenericServiceException e) { Debug.logWarning(e.getMessage(), module); return ServiceUtil.returnError(e.getMessage()); } - if (createSerializedInventory.booleanValue()) { + if ("SERIALIZED_INV_ITEM".equals(inventoryItemTypeId)) { try { int numOfItems = quantity.intValue(); for (int i = 0; i < numOfItems; i++) { @@ -1331,7 +1331,7 @@ "inventoryItemTypeId", "SERIALIZED_INV_ITEM", "statusId", "INV_AVAILABLE"); serviceContext.put("facilityId", productionRun.getGenericValue().getString("facilityId")); - serviceContext.put("datetimeReceived", UtilDateTime.nowDate()); + serviceContext.put("datetimeReceived", UtilDateTime.nowTimestamp()); serviceContext.put("comments", "Created by production run " + productionRunId); if (unitCost.compareTo(ZERO) != 0) { serviceContext.put("unitCost", new Double(unitCost.doubleValue())); @@ -1432,11 +1432,11 @@ String facilityId = (String)context.get("facilityId"); String currencyUomId = (String)context.get("currencyUomId"); Double unitCost = (Double)context.get("unitCost"); - Boolean createSerializedInventory = (Boolean)context.get("createSerializedInventory"); + String inventoryItemTypeId = (String)context.get("inventoryItemTypeId"); // The default is non-serialized inventory item - if (createSerializedInventory == null) { - createSerializedInventory = Boolean.FALSE; + if (UtilValidate.isEmpty(inventoryItemTypeId)) { + inventoryItemTypeId = "NON_SERIAL_INV_ITEM"; } if (facilityId == null) { @@ -1445,7 +1445,7 @@ facilityId = productionRun.getGenericValue().getString("facilityId"); } List inventoryItemIds = new ArrayList(); - if (createSerializedInventory.booleanValue()) { + if ("SERIALIZED_INV_ITEM".equals(inventoryItemTypeId)) { try { int numOfItems = quantity.intValue(); for (int i = 0; i < numOfItems; i++) { @@ -1563,18 +1563,15 @@ } catch(GenericEntityException gee) { return ServiceUtil.returnError(gee.getMessage()); } - Boolean createSerializedInventory = (Boolean)context.get("createSerializedInventory"); - // The default is non-serialized inventory item - if (createSerializedInventory == null) { - createSerializedInventory = Boolean.FALSE; - } + String inventoryItemTypeId = (String)context.get("inventoryItemTypeId"); + // TODO: if the task is not running, then return an error message. try { Map inventoryResult = dispatcher.runSync("productionRunTaskProduce", UtilMisc.toMap("workEffortId", productionRunTaskId, "productId", productId, "quantity", quantity, - "createSerializedInventory", createSerializedInventory, + "inventoryItemTypeId", inventoryItemTypeId, "userLogin", userLogin)); if (ServiceUtil.isError(inventoryResult)) { return ServiceUtil.returnError("Error calling productionRunTaskProduce: " + ServiceUtil.getErrorMessage(inventoryResult)); Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml?view=diff&rev=517636&r1=517635&r2=517636 ============================================================================== --- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml (original) +++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml Tue Mar 13 03:33:43 2007 @@ -189,25 +189,16 @@ <field name="productionRunName" title="${uiLabelMap.ManufacturingProductionRunName}"><display/></field> <field name="description" title="${uiLabelMap.CommonDescription}"><display/></field> <field name="quantity" title="${uiLabelMap.ManufacturingProduceQuantity}" use-when="${showQuantity}!=null"><text/></field> + <field name="inventoryItemTypeId" use-when="${showQuantity}!=null"> + <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="${uiLabelButton}" use-when="${showQuantity}!=null"> <submit button-type="button"/> </field> <field name="quantityProduced" title="${uiLabelMap.ManufacturingQuantityProduced}"><display/></field> <field name="quantityRejected" title="${uiLabelMap.ManufacturingQuantityRejected}"><display/></field> - <sort-order> - <sort-field name="productionRunName"/> - <sort-field name="description"/> - <sort-field name="estimatedStartDate"/> - <sort-field name="actualStartDate"/> - <sort-field name="estimatedCompletionDate"/> - <sort-field name="actualCompletionDate"/> - <sort-field name="productId"/> - <sort-field name="quantityToProduce"/> - <sort-field name="quantity"/> - <sort-field name="submitButton"/> - <sort-field name="quantityProduced"/> - <sort-field name="quantityRejected"/> - </sort-order> </form> <form name="ListProductionRunDeclRoutingTasks" type="list" target="ProductionRunDeclaration" title="" list-name="productionRunRoutingTasks"> |
Free forum by Nabble | Edit this page |