using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
namespace Tango.BL.Dispensing
{
///
/// Represents a transparent liquid (Diluter) IDS pack dispensing calculator.
///
///
[DispensingCalc(IdsPackFormulas.TransparentLiquid)]
public class TransparentLiquidDispensingCalc : DispensingCalcBase
{
///
/// Calculates the required nanoliter per centimeter.
///
/// The liquid volume.
///
public override double CalculateNanoliterPerCentimeter(LiquidVolume liquidVolume)
{
if (liquidVolume.Configuration != null && liquidVolume.RML != null && liquidVolume.ProcessParametersTable != null)
{
double nlPcmSum = liquidVolume.BrushStop.LiquidVolumes.Where(x => x.IdsPack.LiquidType.HasPigment).Sum(x => x.NanoliterPerCentimeter);
nlPcmSum = Math.Max(0, liquidVolume.ProcessParametersTable.MinInkUptake - nlPcmSum);
if (nlPcmSum < liquidVolume.ProcessParametersTable.MinInkUptake * 0.02d)
{
nlPcmSum = 0;
}
return nlPcmSum;
}
else
{
return 0d;
}
}
///
/// Coerces the specified liquid volume.
///
/// The liquid volume.
///
public override double CoerceVolume(LiquidVolume liquidVolume)
{
if (liquidVolume.ProcessParametersTable != null)
{
return Math.Max(100d - liquidVolume.BrushStop.LiquidVolumes.Where(x => x.IdsPack.LiquidType.HasPigment).Sum(x => x.Volume), 0);
}
else
{
return liquidVolume.Volume;
}
}
}
}