MInOut.checkMaterialPolicy - fix indentation
This commit is contained in:
parent
911728ba84
commit
316306e951
|
@ -1561,7 +1561,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
|
|
||||||
// Need to have Location
|
// Need to have Location
|
||||||
if (product != null
|
if (product != null
|
||||||
&& line.getM_Locator_ID() == 0)
|
&& line.getM_Locator_ID() == 0)
|
||||||
{
|
{
|
||||||
//MWarehouse w = MWarehouse.get(getCtx(), getM_Warehouse_ID());
|
//MWarehouse w = MWarehouse.get(getCtx(), getM_Warehouse_ID());
|
||||||
line.setM_Warehouse_ID(getM_Warehouse_ID());
|
line.setM_Warehouse_ID(getM_Warehouse_ID());
|
||||||
|
@ -1569,35 +1569,35 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
needSave = true;
|
needSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attribute Set Instance
|
// Attribute Set Instance
|
||||||
// Create an Attribute Set Instance to any receipt FIFO/LIFO
|
// Create an Attribute Set Instance to any receipt FIFO/LIFO
|
||||||
if (product != null && line.getM_AttributeSetInstance_ID() == 0)
|
if (product != null && line.getM_AttributeSetInstance_ID() == 0)
|
||||||
|
{
|
||||||
|
//Validate Transaction
|
||||||
|
//if (inTrx)
|
||||||
|
if (getMovementType().compareTo(MInOut.MOVEMENTTYPE_CustomerReturns) == 0 || getMovementType().compareTo(MInOut.MOVEMENTTYPE_VendorReceipts) == 0 )
|
||||||
{
|
{
|
||||||
//Validate Transaction
|
MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(), 0, get_TrxName());
|
||||||
//if (inTrx)
|
asi.setClientOrg(getAD_Client_ID(), 0);
|
||||||
if (getMovementType().compareTo(MInOut.MOVEMENTTYPE_CustomerReturns) == 0 || getMovementType().compareTo(MInOut.MOVEMENTTYPE_VendorReceipts) == 0 )
|
asi.setM_AttributeSet_ID(product.getM_AttributeSet_ID());
|
||||||
|
if (!asi.save())
|
||||||
{
|
{
|
||||||
MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(), 0, get_TrxName());
|
throw new IllegalStateException("Error try create ASI Reservation");
|
||||||
asi.setClientOrg(getAD_Client_ID(), 0);
|
}
|
||||||
asi.setM_AttributeSet_ID(product.getM_AttributeSet_ID());
|
if (asi.save())
|
||||||
if (!asi.save())
|
{
|
||||||
{
|
line.setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
|
||||||
throw new IllegalStateException("Error try create ASI Reservation");
|
log.config("New ASI=" + line);
|
||||||
}
|
needSave = true;
|
||||||
if (asi.save())
|
}
|
||||||
{
|
|
||||||
line.setM_AttributeSetInstance_ID(asi.getM_AttributeSetInstance_ID());
|
|
||||||
log.config("New ASI=" + line);
|
|
||||||
needSave = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Create consume the Attribute Set Instance using policy FIFO/LIFO
|
// Create consume the Attribute Set Instance using policy FIFO/LIFO
|
||||||
else if(getMovementType().compareTo(MInOut.MOVEMENTTYPE_VendorReturns) == 0 || getMovementType().compareTo(MInOut.MOVEMENTTYPE_CustomerShipment) == 0)
|
else if(getMovementType().compareTo(MInOut.MOVEMENTTYPE_VendorReturns) == 0 || getMovementType().compareTo(MInOut.MOVEMENTTYPE_CustomerShipment) == 0)
|
||||||
{
|
{
|
||||||
String MMPolicy = product.getMMPolicy();
|
String MMPolicy = product.getMMPolicy();
|
||||||
MStorage[] storages = MStorage.getAllWithASI(getCtx(),
|
MStorage[] storages = MStorage.getAllWithASI(getCtx(),
|
||||||
line.getM_Product_ID(), line.getM_Locator_ID(),
|
line.getM_Product_ID(), line.getM_Locator_ID(),
|
||||||
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
MClient.MMPOLICY_FiFo.equals(MMPolicy), get_TrxName());
|
||||||
BigDecimal qtyToDeliver = line.getMovementQty();
|
BigDecimal qtyToDeliver = line.getMovementQty();
|
||||||
/*for (int ii = 0; ii < storages.length; ii++)
|
/*for (int ii = 0; ii < storages.length; ii++)
|
||||||
{
|
{
|
||||||
|
@ -1642,7 +1642,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
if (qtyToDeliver.signum() == 0)
|
if (qtyToDeliver.signum() == 0)
|
||||||
break;
|
break;
|
||||||
} // for all storages
|
} // for all storages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (MStorage storage: storages)
|
for (MStorage storage: storages)
|
||||||
{
|
{
|
||||||
|
@ -1659,21 +1659,21 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
MInOutLineMA ma = new MInOutLineMA (line,
|
MInOutLineMA ma = new MInOutLineMA (line,
|
||||||
storage.getM_AttributeSetInstance_ID(),
|
storage.getM_AttributeSetInstance_ID(),
|
||||||
qtyToDeliver);
|
qtyToDeliver);
|
||||||
if (!ma.save())
|
if (!ma.save())
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Error try create ASI Reservation");
|
throw new IllegalStateException("Error try create ASI Reservation");
|
||||||
}
|
}
|
||||||
qtyToDeliver = Env.ZERO;
|
qtyToDeliver = Env.ZERO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MInOutLineMA ma = new MInOutLineMA (line,
|
MInOutLineMA ma = new MInOutLineMA (line,
|
||||||
storage.getM_AttributeSetInstance_ID(),
|
storage.getM_AttributeSetInstance_ID(),
|
||||||
storage.getQtyOnHand());
|
storage.getQtyOnHand());
|
||||||
if (!ma.save())
|
if (!ma.save())
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Error try create ASI Reservation");
|
throw new IllegalStateException("Error try create ASI Reservation");
|
||||||
}
|
}
|
||||||
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
|
qtyToDeliver = qtyToDeliver.subtract(storage.getQtyOnHand());
|
||||||
log.fine( ma + ", QtyToDeliver=" + qtyToDeliver);
|
log.fine( ma + ", QtyToDeliver=" + qtyToDeliver);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue