Make To Kit functionality update Qty of MO

http://sourceforge.net/tracker2/?func=detail&aid=2553930&group_id=176962&atid=879335
This commit is contained in:
vpj-cd 2009-01-31 23:33:02 +00:00
parent f611178c2d
commit 79662c2957
3 changed files with 34 additions and 14 deletions

View File

@ -78,7 +78,7 @@ public class LiberoValidator implements ModelValidator
log.info(po.get_TableName() + " Type: "+type);
boolean isChange = (TYPE_AFTER_NEW == type || (TYPE_AFTER_CHANGE == type && MPPMRP.isChanged(po)));
boolean isDelete = (TYPE_BEFORE_DELETE == type);
boolean isCompleted = false;
boolean isReleased = false;
boolean isVoided = false;
DocAction doc = null;
if (po instanceof DocAction)
@ -92,7 +92,7 @@ public class LiberoValidator implements ModelValidator
if (doc != null)
{
String docStatus = doc.getDocStatus();
isCompleted = DocAction.STATUS_InProgress.equals(docStatus)
isReleased = DocAction.STATUS_InProgress.equals(docStatus)
|| DocAction.STATUS_Completed.equals(docStatus);
isVoided = DocAction.STATUS_Voided.equals(docStatus);
}
@ -115,7 +115,7 @@ public class LiberoValidator implements ModelValidator
// or you change DatePromised
else if (type == TYPE_AFTER_CHANGE && order.isSOTrx())
{
if (isCompleted || MPPMRP.isChanged(order))
if (isReleased || MPPMRP.isChanged(order))
{
MPPMRP.C_Order(order, false);
}
@ -134,7 +134,7 @@ public class LiberoValidator implements ModelValidator
}
// Update MRP when Sales Order have document status in process or complete and
// you change relevant fields
else if(order.isSOTrx() && isCompleted)
else if(order.isSOTrx() && isReleased)
{
MPPMRP.C_OrderLine(ol, false);
}

View File

@ -459,10 +459,27 @@ public class MPPMRP extends X_PP_MRP
{
if (!order.isProcessed())
{
//if you chance product in order line the Manufacturing order is void
if(order.getM_Product_ID() != ol.getM_Product_ID())
{
order.setDescription("");
order.setQtyEntered(Env.ZERO);
order.setC_OrderLine_ID(0);
order.voidIt();
order.setDocStatus(MPPOrder.DOCSTATUS_Voided);
order.setDocAction(MPPOrder.ACTION_None);
order.save();
ol.setDescription("");
ol.saveEx();
}
if(order.getQtyEntered().compareTo(ol.getQtyEntered()) != 0)
{
order.setQty(ol.getQtyEntered());
order.saveEx();
if(order.getQtyEntered().signum() != 0)
{
order.setQty(ol.getQtyEntered());
order.saveEx();
}
}
if(order.getDatePromised().compareTo(ol.getDatePromised()) != 0)
{

View File

@ -267,14 +267,17 @@ public class MPPOrder extends X_PP_Order implements DocAction
return false;
}
if( is_ValueChanged(MPPOrder.COLUMNNAME_QtyEntered) && getDocStatus().equals(MPPOrder.DOCSTATUS_Drafted))
{
deleteWorkflowAndBOM();
explotion();
boolean explotion = DocAction.STATUS_Drafted.equals(getDocStatus())
|| DocAction.STATUS_InProgress.equals(getDocStatus());
if( is_ValueChanged(MPPOrder.COLUMNNAME_QtyEntered) && explotion)
{
deleteWorkflowAndBOM();
explotion();
}
if( is_ValueChanged(MPPOrder.COLUMNNAME_QtyEntered) && !getDocStatus().equals(MPPOrder.DOCSTATUS_Drafted))
if( is_ValueChanged(MPPOrder.COLUMNNAME_QtyEntered) && !explotion)
{
throw new AdempiereException("Cannot Change Quantity, Only is allow with Draft Status"); // TODO: Create Message for Translation
throw new AdempiereException("Cannot Change Quantity, Only is allow with Draft or In Process Status"); // TODO: Create Message for Translation
}
if (!newRecord)
@ -703,8 +706,8 @@ public class MPPOrder extends X_PP_Order implements DocAction
if (m_processMsg != null)
return false;
// setProcessed(true);
// setDocAction(DOCACTION_None);
setProcessed(true);
setDocAction(DOCACTION_None);
return false;
} // voidIt