IDEMPIERE-2889 Reservations wrong after a MR with three lines of same PO Line
This commit is contained in:
parent
51b8033632
commit
136b0f147d
|
@ -1350,6 +1350,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
{
|
{
|
||||||
BigDecimal toDelivered = oLine.getQtyOrdered()
|
BigDecimal toDelivered = oLine.getQtyOrdered()
|
||||||
.subtract(oLine.getQtyDelivered());
|
.subtract(oLine.getQtyDelivered());
|
||||||
|
if (toDelivered.signum() < 0) // IDEMPIERE-2889
|
||||||
|
toDelivered = Env.ZERO;
|
||||||
if (sLine.getMovementQty().compareTo(toDelivered) > 0)
|
if (sLine.getMovementQty().compareTo(toDelivered) > 0)
|
||||||
overReceipt = sLine.getMovementQty().subtract(
|
overReceipt = sLine.getMovementQty().subtract(
|
||||||
toDelivered);
|
toDelivered);
|
||||||
|
|
|
@ -111,7 +111,7 @@ public abstract class CreateFrom implements ICreateFrom
|
||||||
{
|
{
|
||||||
sql = sql.append(" AND o.M_Warehouse_ID=? ");
|
sql = sql.append(" AND o.M_Warehouse_ID=? ");
|
||||||
}
|
}
|
||||||
sql = sql.append("ORDER BY o.DateOrdered");
|
sql = sql.append("ORDER BY o.DateOrdered,o.DocumentNo");
|
||||||
//
|
//
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
|
|
@ -192,7 +192,9 @@ public abstract class CreateFromShipment extends CreateFrom
|
||||||
|
|
||||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||||
StringBuilder sql = new StringBuilder("SELECT "
|
StringBuilder sql = new StringBuilder("SELECT "
|
||||||
+ "l.QtyOrdered-SUM(COALESCE(m.Qty,0))," // 1
|
+ "l.QtyOrdered-SUM(COALESCE(m.Qty,0))"
|
||||||
|
// subtract drafted lines from this or other orders IDEMPIERE-2889
|
||||||
|
+ "-COALESCE((SELECT SUM(MovementQty) FROM M_InOutLine iol JOIN M_InOut io ON iol.M_InOut_ID=io.M_InOut_ID WHERE l.C_OrderLine_ID=iol.C_OrderLine_ID AND io.Processed='N'),0)," // 1
|
||||||
+ "CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END," // 2
|
+ "CASE WHEN l.QtyOrdered=0 THEN 0 ELSE l.QtyEntered/l.QtyOrdered END," // 2
|
||||||
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
|
+ " l.C_UOM_ID,COALESCE(uom.UOMSymbol,uom.Name)," // 3..4
|
||||||
+ " p.M_Locator_ID, loc.Value, " // 5..6
|
+ " p.M_Locator_ID, loc.Value, " // 5..6
|
||||||
|
|
Loading…
Reference in New Issue