设备直接利用率
公式: (1 - 停机时间 / 机器实际上班时间)* 100%
代码
CREATE FUNCTION [dbo].[udf_MachineExploitation]
(
@MachineHaltTime DECIMAL(18,6),
@WorkTime DECIMAL(18,6)
)
RETURNS DECIMAL(18,6)
AS
BEGIN
DECLARE @ReturnValue DECIMAL(18,6)
SET @ReturnValue= (CASE WHEN @WorkTime = 0 THEN NULL WHEN @WorkTime IS NULL THEN NULL WHEN @WorkTime <> 0 THEN (1- (ISNULL(@MachineHaltTime,0) / @WorkTime)) END)
RETURN @ReturnValue
END
(
@MachineHaltTime DECIMAL(18,6),
@WorkTime DECIMAL(18,6)
)
RETURNS DECIMAL(18,6)
AS
BEGIN
DECLARE @ReturnValue DECIMAL(18,6)
SET @ReturnValue= (CASE WHEN @WorkTime = 0 THEN NULL WHEN @WorkTime IS NULL THEN NULL WHEN @WorkTime <> 0 THEN (1- (ISNULL(@MachineHaltTime,0) / @WorkTime)) END)
RETURN @ReturnValue
END