MInOut: BF [ 1884379 ] MM Doc: MA should be created on complete and for each line
This commit is contained in:
parent
cab309511f
commit
e2ca6313fa
|
@ -1108,7 +1108,6 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
|
||||
if (!isReversal()) // don't change reversal
|
||||
{
|
||||
checkMaterialPolicy(); // set MASI
|
||||
createConfirmation();
|
||||
}
|
||||
|
||||
|
@ -1224,6 +1223,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
|
||||
log.info("Line=" + sLine.getLine() + " - Qty=" + sLine.getMovementQty());
|
||||
|
||||
checkMaterialPolicy(sLine);
|
||||
// Stock Movement - Counterpart MOrder.reserveStock
|
||||
if (product != null
|
||||
&& product.isStocked() )
|
||||
|
@ -1497,21 +1497,16 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
* Check Material Policy
|
||||
* Sets line ASI
|
||||
*/
|
||||
private void checkMaterialPolicy()
|
||||
private void checkMaterialPolicy(MInOutLine line)
|
||||
{
|
||||
int no = MInOutLineMA.deleteInOutMA(getM_InOut_ID(), get_TrxName());
|
||||
int no = MInOutLineMA.deleteInOutLineMA(line.getM_InOutLine_ID(), get_TrxName());
|
||||
if (no > 0)
|
||||
log.config("Delete old #" + no);
|
||||
MInOutLine[] lines = getLines(false);
|
||||
|
||||
// Incoming Trx
|
||||
String MovementType = getMovementType();
|
||||
boolean inTrx = MovementType.charAt(1) == '+'; // V+ Vendor Receipt
|
||||
|
||||
// Check Lines
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
MInOutLine line = lines[i];
|
||||
boolean needSave = false;
|
||||
MProduct product = line.getProduct();
|
||||
|
||||
|
@ -1605,7 +1600,6 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
|
||||
if (needSave && !line.save())
|
||||
log.severe("NOT saved " + line);
|
||||
} // for all lines
|
||||
} // checkMaterialPolicy
|
||||
|
||||
|
||||
|
|
|
@ -89,6 +89,19 @@ public class MInOutLineMA extends X_M_InOutLineMA
|
|||
return DB.executeUpdate(sql, trxName);
|
||||
} // deleteInOutMA
|
||||
|
||||
/**
|
||||
* Delete all Material Allocation for InOutLine
|
||||
* @param M_InOutLine_ID Shipment Line
|
||||
* @param trxName transaction
|
||||
* @return number of rows deleted or -1 for error
|
||||
*/
|
||||
public static int deleteInOutLineMA (int M_InOutLine_ID, String trxName)
|
||||
{
|
||||
String sql = "DELETE FROM M_InOutLineMA ma WHERE ma.M_InOutLine_ID=?";
|
||||
return DB.executeUpdate(sql, M_InOutLine_ID, trxName);
|
||||
} // deleteInOutLineMA
|
||||
|
||||
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MInOutLineMA.class);
|
||||
|
||||
|
|
Loading…
Reference in New Issue