diff --git a/base/src/org/eevolution/model/reasoner/CRPReasoner.java b/base/src/org/eevolution/model/reasoner/CRPReasoner.java index 9589c169fd..69df996944 100644 --- a/base/src/org/eevolution/model/reasoner/CRPReasoner.java +++ b/base/src/org/eevolution/model/reasoner/CRPReasoner.java @@ -182,7 +182,7 @@ public class CRPReasoner */ private Timestamp getAvailableDate(MResourceType t, Timestamp dateTime, boolean isScheduleBackward) { - Timestamp date = TimeUtil.trunc(dateTime, TimeUtil.TRUNC_DAY); + Timestamp date = dateTime; int direction = isScheduleBackward ? -1 : +1; for (int i = 0; i <= 7; i++) { @@ -203,21 +203,21 @@ public class CRPReasoner public Timestamp getAvailableDate(MResource r, Timestamp dateTime, boolean isScheduleBackward) { MResourceType t = r.getResourceType(); - Timestamp date = TimeUtil.trunc(dateTime, TimeUtil.TRUNC_DAY); + Timestamp date = dateTime; ArrayList params = new ArrayList(); String whereClause; String orderByClause; int direction; if (isScheduleBackward) { - whereClause = "TRUNC("+MResourceUnAvailable.COLUMNNAME_DateFrom+") < ?"; + whereClause = MResourceUnAvailable.COLUMNNAME_DateFrom+" <= ?"; params.add(date); orderByClause = MResourceUnAvailable.COLUMNNAME_DateFrom+" DESC"; direction = 1; } else { - whereClause = "TRUNC("+MResourceUnAvailable.COLUMNNAME_DateTo+") > ?"; + whereClause = MResourceUnAvailable.COLUMNNAME_DateTo+" >= ?"; params.add(date); orderByClause = MResourceUnAvailable.COLUMNNAME_DateTo; direction = -1; diff --git a/base/src/org/eevolution/process/CRP.java b/base/src/org/eevolution/process/CRP.java index 57048c290c..c0685d4980 100644 --- a/base/src/org/eevolution/process/CRP.java +++ b/base/src/org/eevolution/process/CRP.java @@ -85,7 +85,7 @@ public class CRP extends SvrProcess { private String runCRP() { POResultSet rs = reasoner.getPPOrdersNotCompletedQuery(p_S_Resource_ID, get_TrxName()) - .scroll(); + .scroll(); try { while(rs.hasNext()) @@ -102,7 +102,7 @@ public class CRP extends SvrProcess { return "OK"; } - private void runCRP(MPPOrder order) + public void runCRP(MPPOrder order) { log.fine("PP_Order DocumentNo:" + order.getDocumentNo()); BigDecimal qtyOpen = order.getQtyOpen(); @@ -213,13 +213,12 @@ public class CRP extends SvrProcess { // Total duration of workflow node (seconds) ... // ... its static single parts ... long totalDuration = - //node.getQueuingTime() + + node.getQueuingTime() + node.getSetupTimeRequiered() // Use the present required setup time to notice later changes + node.getMovingTime() + node.getWaitingTime() ; // ... and its qty dependend working time ... (Use the present required duration time to notice later changes) - //totalDuration = totalDuration.add(qty.multiply(new BigDecimal(node.getDurationRequiered()))); totalDuration += qty.doubleValue() * node.getDuration(); // Returns the total duration of a node in milliseconds. @@ -315,6 +314,8 @@ public class CRP extends SvrProcess { log.fine(" --> start=" + start + " <---------------------------------------- "); return start; - } + } + + }