Error to Calculate Start Date finish Date Schedule
http://sourceforge.net/tracker2/?func=detail&aid=2525014&group_id=176962&atid=879332 error introducing in 6445 http://adempiere.svn.sourceforge.net/viewvc/adempiere?view=rev&revision=6445 Teo, I do not understand Why you apply a TRUNC for the dates it do not is right in you refactory, so the CRP do not work the way right for the trunc dates, in Manufacturing Management all the dates are management with time. Kind regards Victor Perez www.e-evolution.com
This commit is contained in:
parent
61311d2269
commit
ed4cbb8113
|
|
@ -182,7 +182,7 @@ public class CRPReasoner
|
||||||
*/
|
*/
|
||||||
private Timestamp getAvailableDate(MResourceType t, Timestamp dateTime, boolean isScheduleBackward)
|
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;
|
int direction = isScheduleBackward ? -1 : +1;
|
||||||
for (int i = 0; i <= 7; i++)
|
for (int i = 0; i <= 7; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -203,21 +203,21 @@ public class CRPReasoner
|
||||||
public Timestamp getAvailableDate(MResource r, Timestamp dateTime, boolean isScheduleBackward)
|
public Timestamp getAvailableDate(MResource r, Timestamp dateTime, boolean isScheduleBackward)
|
||||||
{
|
{
|
||||||
MResourceType t = r.getResourceType();
|
MResourceType t = r.getResourceType();
|
||||||
Timestamp date = TimeUtil.trunc(dateTime, TimeUtil.TRUNC_DAY);
|
Timestamp date = dateTime;
|
||||||
ArrayList<Object> params = new ArrayList<Object>();
|
ArrayList<Object> params = new ArrayList<Object>();
|
||||||
String whereClause;
|
String whereClause;
|
||||||
String orderByClause;
|
String orderByClause;
|
||||||
int direction;
|
int direction;
|
||||||
if (isScheduleBackward)
|
if (isScheduleBackward)
|
||||||
{
|
{
|
||||||
whereClause = "TRUNC("+MResourceUnAvailable.COLUMNNAME_DateFrom+") < ?";
|
whereClause = MResourceUnAvailable.COLUMNNAME_DateFrom+" <= ?";
|
||||||
params.add(date);
|
params.add(date);
|
||||||
orderByClause = MResourceUnAvailable.COLUMNNAME_DateFrom+" DESC";
|
orderByClause = MResourceUnAvailable.COLUMNNAME_DateFrom+" DESC";
|
||||||
direction = 1;
|
direction = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
whereClause = "TRUNC("+MResourceUnAvailable.COLUMNNAME_DateTo+") > ?";
|
whereClause = MResourceUnAvailable.COLUMNNAME_DateTo+" >= ?";
|
||||||
params.add(date);
|
params.add(date);
|
||||||
orderByClause = MResourceUnAvailable.COLUMNNAME_DateTo;
|
orderByClause = MResourceUnAvailable.COLUMNNAME_DateTo;
|
||||||
direction = -1;
|
direction = -1;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public class CRP extends SvrProcess {
|
||||||
private String runCRP()
|
private String runCRP()
|
||||||
{
|
{
|
||||||
POResultSet<MPPOrder> rs = reasoner.getPPOrdersNotCompletedQuery(p_S_Resource_ID, get_TrxName())
|
POResultSet<MPPOrder> rs = reasoner.getPPOrdersNotCompletedQuery(p_S_Resource_ID, get_TrxName())
|
||||||
.scroll();
|
.scroll();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while(rs.hasNext())
|
while(rs.hasNext())
|
||||||
|
|
@ -102,7 +102,7 @@ public class CRP extends SvrProcess {
|
||||||
return "OK";
|
return "OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runCRP(MPPOrder order)
|
public void runCRP(MPPOrder order)
|
||||||
{
|
{
|
||||||
log.fine("PP_Order DocumentNo:" + order.getDocumentNo());
|
log.fine("PP_Order DocumentNo:" + order.getDocumentNo());
|
||||||
BigDecimal qtyOpen = order.getQtyOpen();
|
BigDecimal qtyOpen = order.getQtyOpen();
|
||||||
|
|
@ -213,13 +213,12 @@ public class CRP extends SvrProcess {
|
||||||
// Total duration of workflow node (seconds) ...
|
// Total duration of workflow node (seconds) ...
|
||||||
// ... its static single parts ...
|
// ... its static single parts ...
|
||||||
long totalDuration =
|
long totalDuration =
|
||||||
//node.getQueuingTime()
|
+ node.getQueuingTime()
|
||||||
+ node.getSetupTimeRequiered() // Use the present required setup time to notice later changes
|
+ node.getSetupTimeRequiered() // Use the present required setup time to notice later changes
|
||||||
+ node.getMovingTime()
|
+ node.getMovingTime()
|
||||||
+ node.getWaitingTime()
|
+ node.getWaitingTime()
|
||||||
;
|
;
|
||||||
// ... and its qty dependend working time ... (Use the present required duration time to notice later changes)
|
// ... 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();
|
totalDuration += qty.doubleValue() * node.getDuration();
|
||||||
|
|
||||||
// Returns the total duration of a node in milliseconds.
|
// Returns the total duration of a node in milliseconds.
|
||||||
|
|
@ -315,6 +314,8 @@ public class CRP extends SvrProcess {
|
||||||
|
|
||||||
log.fine(" --> start=" + start + " <---------------------------------------- ");
|
log.fine(" --> start=" + start + " <---------------------------------------- ");
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue