diff --git a/src/main/java/com/iflytop/handacid/app/core/state/ChannelState.java b/src/main/java/com/iflytop/handacid/app/core/state/ChannelState.java index 349a472..504cd3b 100644 --- a/src/main/java/com/iflytop/handacid/app/core/state/ChannelState.java +++ b/src/main/java/com/iflytop/handacid/app/core/state/ChannelState.java @@ -9,6 +9,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; +import java.math.BigDecimal; +import java.math.RoundingMode; + @Schema(description = "通道状态") @Data @Component @@ -47,6 +50,11 @@ public class ChannelState { @Schema(description = "领取溶液量(单位:mL)") private volatile Double receivedVolume; + public Integer getCurrentVolume() { + BigDecimal bd = BigDecimal.valueOf(currentVolume); + return bd.setScale(0, RoundingMode.DOWN).intValue(); + } + public ChannelState(ChannelCode channelCode, Double concentration, Double targetVolume, Double receivedVolume, Double currentVolume) { this.channelCode = channelCode; this.concentration = concentration;