日期:2014-05-16 浏览次数:20684 次
declare @t int, @int1 int, @int2 int
select @int1 = (select int_value from [dbo].[OEE] where mach_id=9001 and type_id=2 and start_time=@t and end_time=(@t+1))
select @int2 = (select int_value from [dbo].[OEE] where mach_id=9001 and type_id=10 and start_time=@t and end_time=(@t+1))
set @t=1286888400
while @t< 1286913601
begin
select
case
when @int1=128 and @int2 in (1,2,4)
then insert into [dbo].[OEE] (type_id, bool_value) values (111, 1)
else
insert into [dbo].[OEE] (type_id, bool_value) values (111, 0)
set @t=@t+1
end
DECLARE @t INT,
@int1 INT,
@int2 INT
SET @t = 1286888400
WHILE @t < 1286913601
BEGIN
SELECT @int1 = int_value
FROM [dbo].[OEE]
WHERE mach_id = 9001
AND TYPE_ID = 2
AND start_time = @t
AND end_time = (@t + 1)
SELECT @int2 = int_value
FROM [dbo].[OEE]
WHERE mach_id = 9001
AND TYPE_ID = 10
AND start_time = @t
AND end_time = (@t + 1)
IF @int1 = 128
AND @int2 IN (1, 2, 4)
INSERT INTO [dbo].[OEE]
(
TYPE_ID,