人员表现性
公式:(产出数 + 不良品) / 机器实际产能
代码
CREATE FUNCTION [dbo].[udf_PersonExpressive]
(
@OutputQuantity DECIMAL(18,6),
@DefectQuantity DECIMAL(18,6),
@ActualCapacity DECIMAL(18,6)
)
RETURNS DECIMAL(18,6)
AS
BEGIN
DECLARE @ReturnValue DECIMAL(18,6)
--计算总产出
DECLARE @GrossOutput DECIMAL(18,6)
SET @GrossOutput = (ISNULL(@OutputQuantity,0) + ISNULL(@DefectQuantity,0))
SELECT @ReturnValue = (CASE WHEN @ActualCapacity = 0 THEN NULL WHEN @ActualCapacity IS NULL THEN NULL WHEN @ActualCapacity <> 0 THEN (@GrossOutput / @ActualCapacity) END)
RETURN @ReturnValue
END
(
@OutputQuantity DECIMAL(18,6),
@DefectQuantity DECIMAL(18,6),
@ActualCapacity DECIMAL(18,6)
)
RETURNS DECIMAL(18,6)
AS
BEGIN
DECLARE @ReturnValue DECIMAL(18,6)
--计算总产出
DECLARE @GrossOutput DECIMAL(18,6)
SET @GrossOutput = (ISNULL(@OutputQuantity,0) + ISNULL(@DefectQuantity,0))
SELECT @ReturnValue = (CASE WHEN @ActualCapacity = 0 THEN NULL WHEN @ActualCapacity IS NULL THEN NULL WHEN @ActualCapacity <> 0 THEN (@GrossOutput / @ActualCapacity) END)
RETURN @ReturnValue
END