[OFBiz] SVN: r5999 - in trunk/applications/manufacturing:
src/org/ofbiz/manufacturing/bom
src/org/ofbiz/manufacturing/jobshopmgt
src/org/ofbiz/manufacturing/mrp
webapp/manufacturing/WEB-INF/actions/jobshopmgt
webapp/manufacturing/jobshopmgt widget/manufacturing
jacopo at svn.ofbiz.org
jacopo at svn.ofbiz.org
Fri Oct 21 09:58:53 EDT 2005
Author: jacopo
Date: 2005-10-21 08:58:25 -0500 (Fri, 21 Oct 2005)
New Revision: 5999
Modified:
trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java
trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java
trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java
trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/EditProductionRun.bsh
trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh
trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/CreateProductionRun.ftl
trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ShipmentPlanStockReportPrepare.bsh
trunk/applications/manufacturing/widget/manufacturing/CuttingListReport.bsh
Log:
This is a rather big commit.
It includes several internal cleanups and refactorings and the first version of the implementation of the task time calculation based on formulae.
Modified: trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java
===================================================================
--- trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/src/org/ofbiz/manufacturing/bom/BOMServices.java 2005-10-21 13:58:25 UTC (rev 5999)
@@ -420,6 +420,16 @@
}
result.put("components", components);
+ // also return a componentMap (useful in scripts and simple language code)
+ List componentsMap = new ArrayList();
+ Iterator componentsIt = components.iterator();
+ while (componentsIt.hasNext()) {
+ Map componentMap = new HashMap();
+ BOMNode node = (BOMNode)componentsIt.next();
+ componentMap.put("product", node.getProduct());
+ componentMap.put("quantity", new Double(node.getQuantity()));
+ }
+ result.put("componentsMap", componentsMap);
return result;
}
Modified: trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java
===================================================================
--- trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRun.java 2005-10-21 13:58:25 UTC (rev 5999)
@@ -31,6 +31,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
@@ -39,6 +40,8 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.manufacturing.techdata.TechDataServices;
@@ -67,6 +70,7 @@
protected GenericValue currentStatus;
protected List productionRunComponents;
protected List productionRunRoutingTasks;
+ protected LocalDispatcher dispatcher;
/**
* indicate if quantity or estimatedStartDate has been modified and
@@ -78,10 +82,10 @@
*/
private boolean quantityIsUpdated = false;
-
- public ProductionRun(GenericDelegator delegator, String productionRunId) {
+ public ProductionRun(String productionRunId, GenericDelegator delegator, LocalDispatcher dispatcher) {
try {
if (! UtilValidate.isEmpty(productionRunId)) {
+ this.dispatcher = dispatcher;
this.productionRun = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", productionRunId));
if (exist()) {
this.estimatedStartDate = productionRun.getTimestamp("estimatedStartDate");
@@ -259,7 +263,7 @@
GenericValue routingTask = (GenericValue) iter.next();
if (priority.compareTo(routingTask.getLong("priority")) <= 0){
// Calculate the estimatedCompletionDate
- long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, quantity);
+ long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, quantity, dispatcher);
endDate = TechDataServices.addForward(TechDataServices.getTechDataCalendar(routingTask),startDate, totalTime);
// update the routingTask
routingTask.set("estimatedStartDate",startDate);
@@ -389,20 +393,42 @@
this.productionRunRoutingTasks = null;
}
- public static long getEstimatedTaskTime(GenericValue task, Double quantity) {
- return getEstimatedTaskTime(task, (quantity != null? quantity.doubleValue(): 1));
+ public static long getEstimatedTaskTime(GenericValue task, Double quantity, LocalDispatcher dispatcher) {
+ return getEstimatedTaskTime(task, (quantity != null? quantity.doubleValue(): 1), dispatcher);
}
- public static long getEstimatedTaskTime(GenericValue task, double quantity) {
+ public static long getEstimatedTaskTime(GenericValue task, double quantity, LocalDispatcher dispatcher) {
if (task == null) return 0;
double setupTime = 0;
double taskTime = 1;
+ double totalTaskTime = 0;
if (task.get("estimatedSetupMillis") != null) {
setupTime = task.getDouble("estimatedSetupMillis").doubleValue();
}
if (task.get("estimatedMilliSeconds") != null) {
taskTime = task.getDouble("estimatedMilliSeconds").doubleValue();
}
- return (long)(setupTime + taskTime * quantity);
+ totalTaskTime = (setupTime + taskTime * quantity);
+ // TODO
+ if (task.get("estimateCalcMethod") != null) {
+ String serviceName = null;
+ try {
+ GenericValue genericService = task.getRelatedOne("CustomMethod");
+ if (genericService != null && genericService.getString("customMethodName") != null) {
+ serviceName = genericService.getString("customMethodName");
+ // call the service
+ // and put the value in totalTaskTime
+ Map estimateCalcServiceMap = UtilMisc.toMap("workEffort", task, "quantity", quantity);
+ Map serviceContext = UtilMisc.toMap("arguments", estimateCalcServiceMap);
+ // serviceContext.put("userLogin", userLogin);
+ Map resultService = dispatcher.runSync(serviceName, serviceContext);
+ totalTaskTime = ((Double)resultService.get("totalTime")).doubleValue();
+ }
+ } catch(Exception exc) {
+ Debug.logError(exc, "Problem calling the customMethod service " + serviceName);
+ }
+ }
+
+ return (long)totalTaskTime;
}
}
Modified: trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java
===================================================================
--- trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java 2005-10-21 13:58:25 UTC (rev 5999)
@@ -34,7 +34,9 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.service.LocalDispatcher;
+
/**
* Helper for Production Run maintenance
*
@@ -87,12 +89,12 @@
return (tasks != null && tasks.size() > 0);
}
- public static void getLinkedProductionRuns(GenericDelegator delegator, String productionRunId, List productionRuns) throws GenericEntityException {
- productionRuns.add(new ProductionRun(delegator, productionRunId));
+ public static void getLinkedProductionRuns(GenericDelegator delegator, LocalDispatcher dispatcher, String productionRunId, List productionRuns) throws GenericEntityException {
+ productionRuns.add(new ProductionRun(productionRunId, delegator, dispatcher));
List linkedWorkEfforts = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", UtilMisc.toMap("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY")));
for (int i = 0; i < linkedWorkEfforts.size(); i++) {
GenericValue link = (GenericValue)linkedWorkEfforts.get(i);
- getLinkedProductionRuns(delegator, link.getString("workEffortIdFrom"), productionRuns);
+ getLinkedProductionRuns(delegator, dispatcher, link.getString("workEffortIdFrom"), productionRuns);
}
}
Modified: trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
===================================================================
--- trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java 2005-10-21 13:58:25 UTC (rev 5999)
@@ -43,6 +43,9 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.manufacturing.bom.BOMTree;
import org.ofbiz.manufacturing.techdata.TechDataServices;
import org.ofbiz.product.config.ProductConfigWrapper;
@@ -81,7 +84,7 @@
String productionRunId = (String) context.get("productionRunId");
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (!productionRun.exist()){
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale));
}
@@ -92,7 +95,7 @@
try {
// First of all, make sure that there aren't production runs that depend on this one.
List mandatoryWorkEfforts = new ArrayList();
- ProductionRunHelper.getLinkedProductionRuns(delegator, productionRunId, mandatoryWorkEfforts);
+ ProductionRunHelper.getLinkedProductionRuns(delegator, dispatcher, productionRunId, mandatoryWorkEfforts);
for (int i = 1; i < mandatoryWorkEfforts.size(); i++) {
GenericValue mandatoryWorkEffort = ((ProductionRun)mandatoryWorkEfforts.get(i)).getGenericValue();
if (!(mandatoryWorkEffort.getString("currentStatusId").equals("PRUN_CANCELLED"))) {
@@ -293,7 +296,7 @@
Debug.logError(e.getMessage(), module);
}
// Calculate the estimatedCompletionDate
- long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, pRQuantity);
+ long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, pRQuantity, dispatcher);
Timestamp endDate = TechDataServices.addForward(TechDataServices.getTechDataCalendar(routingTask),startDate, totalTime);
serviceContext.clear();
@@ -387,6 +390,7 @@
public static Map updateProductionRun(DispatchContext ctx, Map context) {
Map result = new HashMap();
GenericDelegator delegator = ctx.getDelegator();
+ LocalDispatcher dispatcher = ctx.getDispatcher();
Security security = ctx.getSecurity();
Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -399,7 +403,7 @@
*/
String productionRunId = (String) context.get("productionRunId");
if (!UtilValidate.isEmpty(productionRunId)) {
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
if (!productionRun.getGenericValue().getString("currentStatusId").equals("PRUN_CREATED")) {
@@ -444,7 +448,7 @@
String productionRunId = (String) context.get("productionRunId");
String statusId = (String) context.get("statusId");
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (!productionRun.exist()){
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale));
}
@@ -587,7 +591,7 @@
String taskId = (String) context.get("taskId");
String statusId = (String) context.get("statusId");
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (!productionRun.exist()){
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale));
}
@@ -749,6 +753,7 @@
public static Map checkUpdatePrunRoutingTask(DispatchContext ctx, Map context) {
Map result = new HashMap();
GenericDelegator delegator = ctx.getDelegator();
+ LocalDispatcher dispatcher = ctx.getDispatcher();
Security security = ctx.getSecurity();
Locale locale = (Locale) context.get("locale");
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -762,7 +767,7 @@
String productionRunId = (String) context.get("productionRunId");
String routingTaskId = (String) context.get("routingTaskId");
if (! UtilValidate.isEmpty(productionRunId) && ! UtilValidate.isEmpty(routingTaskId)) {
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
if (!productionRun.getGenericValue().getString("currentStatusId").equals("PRUN_CREATED")) {
@@ -834,7 +839,7 @@
// Optional input fields
String workEffortId = (String)context.get("workEffortId");
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
List tasks = productionRun.getProductionRunRoutingTasks();
if (tasks == null || tasks.size() == 0){
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale));
@@ -904,7 +909,7 @@
String workEffortId = (String)context.get("workEffortId"); // the production run task
Double quantity = (Double) context.get("estimatedQuantity");
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
List components = productionRun.getProductionRunComponents();
if (components == null || components.size() == 0){
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentNotExists", locale));
@@ -986,7 +991,7 @@
Double estimatedMilliSeconds = (Double)context.get("estimatedMilliSeconds");
// The production run is loaded
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
Double pRQuantity = productionRun.getQuantity();
if (pRQuantity == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale));
@@ -1033,7 +1038,7 @@
}
if (estimatedCompletionDate == null) {
// Calculate the estimatedCompletionDate
- long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, pRQuantity);
+ long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, pRQuantity, dispatcher);
estimatedCompletionDate = TechDataServices.addForward(TechDataServices.getTechDataCalendar(routingTask), estimatedStartDate, totalTime);
}
Map serviceContext = new HashMap();
@@ -1106,7 +1111,7 @@
}
// The production run is loaded
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
// The last task is loaded
GenericValue lastTask = productionRun.getLastProductionRunRoutingTask();
if (lastTask == null) {
@@ -1305,7 +1310,7 @@
comments = "";
}
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (!productionRun.exist()){
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale));
}
@@ -1705,7 +1710,7 @@
String productionRunId = (String) context.get("productionRunId");
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (!productionRun.exist()){
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale));
}
@@ -1789,4 +1794,52 @@
return result;
}
+ /**
+ * Given a productId and an optional date, returns the total qty
+ * of productId reserved by production runs.
+ * @param ctx The DispatchContext that this service is operating in.
+ * @param context Map containing the input parameters.
+ * @return Map with the result of the service, the output parameters.
+ */
+ public static Map getProductionRunTotResQty(DispatchContext ctx, Map context) {
+ Map result = ServiceUtil.returnSuccess();
+ GenericDelegator delegator = ctx.getDelegator();
+ Locale locale = (Locale) context.get("locale");
+
+ String productId = (String) context.get("productId");
+ Timestamp startDate = (Timestamp) context.get("startDate");
+ if (startDate == null) {
+ startDate = UtilDateTime.nowTimestamp();
+ }
+ double totQty = 0.0;
+ try {
+ List findOutgoingProductionRunsConds = new LinkedList();
+
+ findOutgoingProductionRunsConds.add(new EntityExpr("productId", EntityOperator.EQUALS, productId));
+ findOutgoingProductionRunsConds.add(new EntityExpr("statusId", EntityOperator.EQUALS, "WIP_INCOMING_FULFIL"));
+ findOutgoingProductionRunsConds.add(new EntityExpr("estimatedStartDate", EntityOperator.LESS_THAN_EQUAL_TO, startDate));
+
+ List findOutgoingProductionRunsStatusConds = new LinkedList();
+ findOutgoingProductionRunsStatusConds.add(new EntityExpr("currentStatusId", EntityOperator.EQUALS, "PRUN_CREATED"));
+ findOutgoingProductionRunsStatusConds.add(new EntityExpr("currentStatusId", EntityOperator.EQUALS, "PRUN_DOC_PRINTED"));
+ findOutgoingProductionRunsStatusConds.add(new EntityExpr("currentStatusId", EntityOperator.EQUALS, "PRUN_RUNNING"));
+ findOutgoingProductionRunsConds.add(new EntityConditionList(findOutgoingProductionRunsStatusConds, EntityOperator.OR));
+
+ List outgoingProductionRuns = delegator.findByCondition("WorkEffortAndGoods", new EntityConditionList(findOutgoingProductionRunsConds, EntityOperator.AND), null, UtilMisc.toList("-estimatedStartDate"));
+ if (outgoingProductionRuns != null) {
+ for (int i = 0; i < outgoingProductionRuns.size(); i++) {
+ GenericValue outgoingProductionRun = (GenericValue)outgoingProductionRuns.get(i);
+ Double dblQty = outgoingProductionRun.getDouble("estimatedQuantity");
+ double qty = (dblQty != null? dblQty.doubleValue(): 0.0);
+ totQty += qty;
+ }
+ }
+ } catch (GenericEntityException e) {
+ Debug.logError(e, "Problem calling the getProductionRunTotResQty service", module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionResQtyCalc", locale));
+ }
+ result.put("reservedQuantity", new Double(totQty));
+ return result;
+ }
+
}
Modified: trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java
===================================================================
--- trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java 2005-10-21 13:58:25 UTC (rev 5999)
@@ -130,7 +130,7 @@
Debug.logError(e.getMessage(), module);
}
// Calculate the estimatedStartDate
- long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, quantity);
+ long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, quantity, dispatcher);
startDate = TechDataServices.addBackward(TechDataServices.getTechDataCalendar(routingTask),endDate, totalTime);
// record the routingTask with the startDate associated
result.put(routingTask.getString("workEffortId"),startDate);
Modified: trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/EditProductionRun.bsh
===================================================================
--- trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/EditProductionRun.bsh 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/EditProductionRun.bsh 2005-10-21 13:58:25 UTC (rev 5999)
@@ -38,12 +38,11 @@
delegator = request.getAttribute("delegator");
-// requestParams = UtilHttp.getParameterMap(request);
HashMap productionRunData= new HashMap();
productionRunId = request.getParameter("productionRunId");
if (!UtilValidate.isEmpty(productionRunId)) {
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
context.put("productionRunId", productionRunId);
context.put("productionRun", productionRun.getGenericValue());
Modified: trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh
===================================================================
--- trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.bsh 2005-10-21 13:58:25 UTC (rev 5999)
@@ -36,7 +36,6 @@
import org.ofbiz.widget.html.HtmlFormWrapper;
import org.ofbiz.manufacturing.jobshopmgt.ProductionRun;
-delegator = request.getAttribute("delegator");
userLogin = request.getAttribute("userLogin");
@@ -44,7 +43,7 @@
productionRunId = request.getParameter("productionRunId");
if (!UtilValidate.isEmpty(productionRunId)) {
- ProductionRun productionRun = new ProductionRun(delegator, productionRunId);
+ ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher);
if (productionRun.exist()){
context.put("productionRunId", productionRunId);
context.put("productionRun", productionRun.getGenericValue());
Modified: trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/CreateProductionRun.ftl
===================================================================
--- trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/CreateProductionRun.ftl 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/CreateProductionRun.ftl 2005-10-21 13:58:25 UTC (rev 5999)
@@ -62,7 +62,6 @@
<option value="${currentFacilityId.facilityId}">${currentFacilityId.facilityName} [${currentFacilityId.facilityId}]</option>
<option value="${currentFacilityId.facilityId}">---</option>
</#if>
- <option value=""></option>
<#list warehouses as warehouse>
<option value="${warehouse.facilityId}">${warehouse.facilityName} [${warehouse.facilityId}]</option>
</#list>
Modified: trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ShipmentPlanStockReportPrepare.bsh
===================================================================
--- trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ShipmentPlanStockReportPrepare.bsh 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/webapp/manufacturing/jobshopmgt/ShipmentPlanStockReportPrepare.bsh 2005-10-21 13:58:25 UTC (rev 5999)
@@ -29,7 +29,7 @@
userLogin = request.getSession().getAttribute("userLogin");
jrParameters = new HashMap();
-inventoryStock = new HashMap(); // MC01
+inventoryStock = new HashMap();
shipmentId = request.getParameter("shipmentId");
shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
@@ -56,21 +56,14 @@
recordGroup.put("QUANTITY", shipmentPlan.getDouble("quantity"));
product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", orderLine.getString("productId")));
recordGroup.put("PRODUCT_NAME", product.getString("internalName"));
- // -----------------------------
- // Viene invocato il servizio di esplosione
- // context contiene i dati di input per il servizio
Map context = UtilMisc.toMap("productId", orderLine.getString("productId"),
"quantity", shipmentPlan.getDouble("quantity"),
"fromDate", "" + new Date(),
"userLogin", userLogin);
- // result conterrà i dati di output
Map result = null;
- // qui viene invocato il servizio
result = dispatcher.runSync("getNotAssembledComponents",context);
if (result != null)
- // qui viene recuperato uno dei parametri di output (una lista di componenti)
components = (List)result.get("notAssembledComponents");
- // I componenti vengono letti
componentsIt = components.iterator();
while(componentsIt.hasNext()) {
oneComponent = (org.ofbiz.manufacturing.bom.BOMNode)componentsIt.next();
@@ -78,8 +71,7 @@
record.put("componentId", oneComponent.getProduct().getString("productId"));
record.put("componentName", oneComponent.getProduct().getString("internalName"));
record.put("componentQuantity", new Float(oneComponent.getQuantity()));
- // QUI DEVO AGGIUNGERE LA QUANTITA' DI MAGAZZINO MC01
- facilityId = shipment.getString("originFacilityId"); // MOBILIA
+ facilityId = shipment.getString("originFacilityId");
float qty = 0;
if (facilityId != null) {
if (!inventoryStock.containsKey(oneComponent.getProduct().getString("productId"))) {
@@ -94,7 +86,11 @@
inventoryStock.put(oneComponent.getProduct().getString("productId"), new Double(qty));
}
record.put("componentOnHand", new Float(qty));
- // FINE ROUTINE QUANTITA' DI MAGAZZINO MC01
+ // Now we get the product's qty already reserved by production runs
+ serviceInput = UtilMisc.toMap("productId", oneComponent.getProduct().getString("productId"));
+ serviceOutput = dispatcher.runSync("getProductionRunTotResQty", serviceInput);
+ resQty = serviceOutput.get("reservedQuantity");
+ record.put("reservedQuantity", new Double(resQty));
records.add(record);
}
Modified: trunk/applications/manufacturing/widget/manufacturing/CuttingListReport.bsh
===================================================================
--- trunk/applications/manufacturing/widget/manufacturing/CuttingListReport.bsh 2005-10-21 13:49:39 UTC (rev 5998)
+++ trunk/applications/manufacturing/widget/manufacturing/CuttingListReport.bsh 2005-10-21 13:58:25 UTC (rev 5999)
@@ -78,7 +78,7 @@
ArrayList productionRunTree = new ArrayList();
// TODO
if (weId != null) {
- ProductionRunHelper.getLinkedProductionRuns(delegator, weId.getString("workEffortId"), productionRunTree);
+ ProductionRunHelper.getLinkedProductionRuns(delegator, dispatcher, weId.getString("workEffortId"), productionRunTree);
for (int i = 0; i < productionRunTree.size(); i++) {
ProductionRun oneProductionRun = (ProductionRun)productionRunTree.get(i);
if (ProductionRunHelper.hasTask(delegator, selectWorkEffortNameParameter, oneProductionRun.getGenericValue().getString("workEffortId"))) {
More information about the Svn
mailing list