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
|
if (!isReversal()) // don't change reversal
|
||||||
{
|
{
|
||||||
checkMaterialPolicy(); // set MASI
|
|
||||||
createConfirmation();
|
createConfirmation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1224,6 +1223,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
|
|
||||||
log.info("Line=" + sLine.getLine() + " - Qty=" + sLine.getMovementQty());
|
log.info("Line=" + sLine.getLine() + " - Qty=" + sLine.getMovementQty());
|
||||||
|
|
||||||
|
checkMaterialPolicy(sLine);
|
||||||
// Stock Movement - Counterpart MOrder.reserveStock
|
// Stock Movement - Counterpart MOrder.reserveStock
|
||||||
if (product != null
|
if (product != null
|
||||||
&& product.isStocked() )
|
&& product.isStocked() )
|
||||||
|
@ -1497,21 +1497,16 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
* Check Material Policy
|
* Check Material Policy
|
||||||
* Sets line ASI
|
* 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)
|
if (no > 0)
|
||||||
log.config("Delete old #" + no);
|
log.config("Delete old #" + no);
|
||||||
MInOutLine[] lines = getLines(false);
|
|
||||||
|
|
||||||
// Incoming Trx
|
// Incoming Trx
|
||||||
String MovementType = getMovementType();
|
String MovementType = getMovementType();
|
||||||
boolean inTrx = MovementType.charAt(1) == '+'; // V+ Vendor Receipt
|
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;
|
boolean needSave = false;
|
||||||
MProduct product = line.getProduct();
|
MProduct product = line.getProduct();
|
||||||
|
|
||||||
|
@ -1605,7 +1600,6 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
|
|
||||||
if (needSave && !line.save())
|
if (needSave && !line.save())
|
||||||
log.severe("NOT saved " + line);
|
log.severe("NOT saved " + line);
|
||||||
} // for all lines
|
|
||||||
} // checkMaterialPolicy
|
} // checkMaterialPolicy
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,19 @@ public class MInOutLineMA extends X_M_InOutLineMA
|
||||||
return DB.executeUpdate(sql, trxName);
|
return DB.executeUpdate(sql, trxName);
|
||||||
} // deleteInOutMA
|
} // 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 */
|
/** Logger */
|
||||||
private static CLogger s_log = CLogger.getCLogger (MInOutLineMA.class);
|
private static CLogger s_log = CLogger.getCLogger (MInOutLineMA.class);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue