Author: jacopoc
Date: Thu Mar 8 01:17:55 2007
New Revision: 515981
URL: http://svn.apache.org/viewvc?view=rev&rev=515981
Log:
Improved information in the MRP log with a new field (in the
InventoryEventPlanned entity) to keep track of the event (order, requirement
etc...) that originated the request.
Modified:
ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml
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/webapp/manufacturing/mrp/findInventoryEventPlan.ftl
Modified: ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml?view=diff&rev=515981&r1=515980&r2=515981
==============================================================================
--- ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml Thu Mar 8
01:17:55 2007
@@ -166,6 +166,7 @@
<field name="eventDate" type="date-time"></field>
<field name="inventoryEventPlanTypeId" type="id-ne"></field>
<field name="eventQuantity" type="floating-point"></field>
+ <field name="eventName" type="name"></field>
<prim-key field="productId"/>
<prim-key field="eventDate"/>
<prim-key field="inventoryEventPlanTypeId"/>
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?view=diff&rev=515981&r1=515980&r2=515981
==============================================================================
---
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java
(original)
+++
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java
Thu Mar 8 01:17:55 2007
@@ -22,6 +22,7 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
@@ -47,14 +48,13 @@
*/
public static Map createInventoryEventPlanned(DispatchContext ctx, Map
context) {
GenericDelegator delegator = ctx.getDelegator();
- // No permission checking because this services is call from other
services/
Map parameters = UtilMisc.toMap("productId", context.get("productId"),
"eventDate", context.get("eventDate"),
-
"inventoryEventPlanTypeId",context.get("inventoryEventPlanTypeId"));
+ "inventoryEventPlanTypeId",
context.get("inventoryEventPlanTypeId"));
Double quantity = (Double)context.get("eventQuantity");
GenericValue inventoryEventPlanned = null;
try {
- createOrUpdateInventoryEventPlanned(parameters, quantity,
delegator);
+ createOrUpdateInventoryEventPlanned(parameters, quantity,
(String)context.get("eventName"), delegator);
} catch (GenericEntityException e) {
Debug.logError(e,"Error :
delegator.findByPrimaryKey(\"InventoryEventPlanned\", parameters
=)"+parameters, module);
return ServiceUtil.returnError("Problem, on database access, for
more detail look at the log");
@@ -62,16 +62,21 @@
return ServiceUtil.returnSuccess();
}
- public static void createOrUpdateInventoryEventPlanned(Map
inventoryEventPlannedKeyMap, Double newQuantity, GenericDelegator delegator)
throws GenericEntityException {
+ public static void createOrUpdateInventoryEventPlanned(Map
inventoryEventPlannedKeyMap, Double newQuantity, String eventName,
GenericDelegator delegator) throws GenericEntityException {
GenericValue inventoryEventPlanned = null;
inventoryEventPlanned =
delegator.findByPrimaryKey("InventoryEventPlanned",
inventoryEventPlannedKeyMap);
if (inventoryEventPlanned == null) {
inventoryEventPlanned =
delegator.makeValue("InventoryEventPlanned", inventoryEventPlannedKeyMap);
inventoryEventPlanned.put("eventQuantity", newQuantity);
+ inventoryEventPlanned.put("eventName", eventName);
inventoryEventPlanned.create();
} else {
double qties = newQuantity.doubleValue() +
((Double)inventoryEventPlanned.get("eventQuantity")).doubleValue();
inventoryEventPlanned.put("eventQuantity", new Double(qties));
+ if (!UtilValidate.isEmpty(eventName)) {
+ String existingEventName =
inventoryEventPlanned.getString("eventName");
+ inventoryEventPlanned.put("eventName",
(UtilValidate.isEmpty(existingEventName)? eventName: existingEventName + ", " +
eventName));
+ }
inventoryEventPlanned.store();
}
}
Modified:
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java?view=diff&rev=515981&r1=515980&r2=515981
==============================================================================
---
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java
(original)
+++
ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java
Thu Mar 8 01:17:55 2007
@@ -160,7 +160,7 @@
}
parameters = UtilMisc.toMap("productId", productId, "eventDate",
estimatedShipDate, "inventoryEventPlanTypeId", "SALE_ORDER_SHIP");
try {
-
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, delegator);
+
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, genericResult.getString("orderId") + "-" +
genericResult.getString("orderItemSeqId"), delegator);
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Problem initializing the
InventoryEventPlanned entity (SALE_ORDER_SHIP)");
}
@@ -191,7 +191,7 @@
parameters = UtilMisc.toMap("productId", productId, "eventDate",
estimatedShipDate, "inventoryEventPlanTypeId", "PROD_REQ_RECP");
try {
-
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, delegator);
+
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, genericResult.getString("requirementId"), delegator);
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Problem initializing the
InventoryEventPlanned entity (PROD_REQ_RECP)");
}
@@ -245,7 +245,7 @@
parameters = UtilMisc.toMap("productId", productId, "eventDate",
estimatedShipDate, "inventoryEventPlanTypeId", "PUR_ORDER_RECP");
try {
-
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, delegator);
+
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, genericResult.getString("orderId") + "-" +
genericResult.getString("orderItemSeqId"), delegator);
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Problem initializing the
InventoryEventPlanned entity (PUR_ORDER_RECP)");
}
@@ -276,7 +276,7 @@
parameters = UtilMisc.toMap("productId", productId, "eventDate",
estimatedShipDate, "inventoryEventPlanTypeId", "MANUF_ORDER_REQ");
try {
-
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, delegator);
+
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, genericResult.getString("workEffortId"), delegator);
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Problem initializing the
InventoryEventPlanned entity (MRP_REQUIREMENT)");
}
@@ -322,7 +322,7 @@
parameters = UtilMisc.toMap("productId", productId, "eventDate",
estimatedShipDate, "inventoryEventPlanTypeId", "MANUF_ORDER_RECP");
try {
-
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, delegator);
+
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
eventQuantityTmp, genericResult.getString("workEffortId"), delegator);
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Problem initializing the
InventoryEventPlanned entity (MANUF_ORDER_RECP)");
}
@@ -436,7 +436,7 @@
parameters.put("inventoryEventPlanTypeId",
"MRP_REQUIREMENT");
double componentEventQuantity = node.getQuantity();
try {
-
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
new Double(-1.0 * componentEventQuantity), delegator);
+
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters,
new Double(-1.0 * componentEventQuantity), null, delegator);
} catch (GenericEntityException e) {
Debug.logError("Error :
delegator.findByPrimaryKey(\"InventoryEventPlanned\", parameters)
="+parameters+"--"+e.getMessage(), module);
}
@@ -538,7 +538,7 @@
stockTmp = findProductMrpQoh(product, facilityId,
dispatcher);
try {
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(UtilMisc.toMap("productId",
product.getString("productId"), "inventoryEventPlanTypeId", "INITIAL_QOH",
"eventDate", now),
-
new Double(stockTmp),
+
new Double(stockTmp), null,
delegator);
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Problem running
createOrUpdateInventoryEventPlanned");
@@ -625,7 +625,7 @@
"eventDate", eventDate,
"inventoryEventPlanTypeId", (isbuild? "PROP_MANUF_O_RECP" : "PROP_PUR_O_RECP"));
try {
-
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new
Double(proposedOrder.getQuantity()), delegator);
+
InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new
Double(proposedOrder.getQuantity()), null, delegator);
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Problem running
createOrUpdateInventoryEventPlanned");
}
Modified:
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl?view=diff&rev=515981&r1=515980&r2=515981
==============================================================================
---
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl
(original)
+++
ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl
Thu Mar 8 01:17:55 2007
@@ -147,13 +147,14 @@
<tr>
<td align="left"><div
class="tableheadtext">${uiLabelMap.CommonDescription}</div></td>
<td align="center"> </td>
+ <td align="left"><div
class="tableheadtext">${uiLabelMap.CommonEventName}</div></td>
<td align="left"><div
class="tableheadtext">${uiLabelMap.CommonEventDate}</div></td>
<td align="center"> </td>
<td align="right"><div
class="tableheadtext">${uiLabelMap.CommonQuantity}</div></td>
<td align="right"><div
class="tableheadtext">${uiLabelMap.ManufacturingTotalQuantity}</div></td>
</tr>
<tr>
- <td colspan='6'><hr class='sepbar'></td>
+ <td colspan="7"><hr class="sepbar"/></td>
</tr>
<#assign count = lowIndex>
<#assign productTmp = "">
@@ -183,7 +184,7 @@
</div>
</#if>
</td>
- <td colspan="4" align="right">
+ <td colspan="5" align="right">
<#assign initialQohEvent =
Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("InventoryEventPlanned",
Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId",
"INITIAL_QOH", "productId", inven.productId)))>
<#if initialQohEvent?exists &&
initialQohEvent.eventQuantity?has_content>
<#assign quantityAvailableAtDate =
initialQohEvent.eventQuantity>
@@ -198,6 +199,7 @@
<tr class="${rowClass}">
<td><div
class='tabletext'>${inventoryEventPlannedType.get("description",locale)}</div></td>
<td> </td>
+ <td>${inven.eventName?if_exists}</td>
<td><div
class='tabletext'>${inven.getString("eventDate")}</div></td>
<td> </td>
<td><div class='tabletext'align="right">
${inven.getString("eventQuantity")}</div></td>