IDEMPIERE-2629 M_StorageOnHand Qty and Total M_Transaction Qty did not match / remove some unneeded agressive locking to minimize deadlocks
This commit is contained in:
parent
e27bff24d5
commit
e423b11f73
|
@ -1853,7 +1853,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
String MMPolicy = product.getMMPolicy();
|
String MMPolicy = product.getMMPolicy();
|
||||||
Timestamp minGuaranteeDate = getMovementDate();
|
Timestamp minGuaranteeDate = getMovementDate();
|
||||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),
|
||||||
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName(), true);
|
minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName(), false);
|
||||||
BigDecimal qtyToDeliver = qty;
|
BigDecimal qtyToDeliver = qty;
|
||||||
for (MStorageOnHand storage: storages)
|
for (MStorageOnHand storage: storages)
|
||||||
{
|
{
|
||||||
|
@ -1897,7 +1897,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
|
|
||||||
private BigDecimal autoBalanceNegative(MInOutLine line, MProduct product,BigDecimal qtyToReceive) {
|
private BigDecimal autoBalanceNegative(MInOutLine line, MProduct product,BigDecimal qtyToReceive) {
|
||||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouseNegative(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
MStorageOnHand[] storages = MStorageOnHand.getWarehouseNegative(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||||
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), line.getM_Locator_ID(), get_TrxName(), true);
|
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), line.getM_Locator_ID(), get_TrxName(), false);
|
||||||
|
|
||||||
Timestamp dateMPolicy = null;
|
Timestamp dateMPolicy = null;
|
||||||
|
|
||||||
|
|
|
@ -625,7 +625,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
{
|
{
|
||||||
//auto balance negative on hand
|
//auto balance negative on hand
|
||||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouseNegative(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
MStorageOnHand[] storages = MStorageOnHand.getWarehouseNegative(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||||
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), line.getM_Locator_ID(), get_TrxName(), true);
|
null, MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), line.getM_Locator_ID(), get_TrxName(), false);
|
||||||
for (MStorageOnHand storage : storages)
|
for (MStorageOnHand storage : storages)
|
||||||
{
|
{
|
||||||
if (storage.getQtyOnHand().signum() < 0)
|
if (storage.getQtyOnHand().signum() < 0)
|
||||||
|
@ -656,7 +656,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
||||||
{
|
{
|
||||||
String MMPolicy = product.getMMPolicy();
|
String MMPolicy = product.getMMPolicy();
|
||||||
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), getM_Warehouse_ID(), line.getM_Product_ID(), 0,
|
||||||
null, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName(), true);
|
null, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, line.getM_Locator_ID(), get_TrxName(), false);
|
||||||
|
|
||||||
BigDecimal qtyToDeliver = qtyDiff.negate();
|
BigDecimal qtyToDeliver = qtyDiff.negate();
|
||||||
for (MStorageOnHand storage: storages)
|
for (MStorageOnHand storage: storages)
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class MProductionLine extends X_M_ProductionLine {
|
||||||
|
|
||||||
// create transactions and update stock used in production
|
// create transactions and update stock used in production
|
||||||
MStorageOnHand[] storages = MStorageOnHand.getAll( getCtx(), getM_Product_ID(),
|
MStorageOnHand[] storages = MStorageOnHand.getAll( getCtx(), getM_Product_ID(),
|
||||||
getM_Locator_ID(), get_TrxName(), true, 120);
|
getM_Locator_ID(), get_TrxName(), false, 0);
|
||||||
|
|
||||||
MProductionLineMA lineMA = null;
|
MProductionLineMA lineMA = null;
|
||||||
MTransaction matTrx = null;
|
MTransaction matTrx = null;
|
||||||
|
@ -181,6 +181,7 @@ public class MProductionLine extends X_M_ProductionLine {
|
||||||
} else {
|
} else {
|
||||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Saved transaction for " + toString());
|
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Saved transaction for " + toString());
|
||||||
}
|
}
|
||||||
|
DB.getDatabase().forUpdate(storages[sl], 120);
|
||||||
storages[sl].changeQtyOnHand(lineQty, false);
|
storages[sl].changeQtyOnHand(lineQty, false);
|
||||||
if ( !storages[sl].save(get_TrxName()) ) {
|
if ( !storages[sl].save(get_TrxName()) ) {
|
||||||
log.log(Level.SEVERE, "Could not update storage for " + toString());
|
log.log(Level.SEVERE, "Could not update storage for " + toString());
|
||||||
|
|
Loading…
Reference in New Issue