日期:2014-05-17 浏览次数:20558 次
BEGIN
DECLARE @sql NVARCHAR(500);
SET NOCOUNT ON;
SET @sql = 'select wo.ProductName,w.WorkOrder, MIN(w.MoveInTime) as MIN_MoveInTime, MAX(w.moveouttime) as MAX_MoveOutTime, ';
SET @sql += 'CAST(DATEDIFF(HOUR, MIN(w.MoveInTime), MAX(w.moveouttime)) * 1.0/24 as DECIMAL(6,4)) as CycleTime ';
SET @sql +='from WaferHistory w WITH(NOLOCK), WorkOrder wo WITH(NOLOCK) where ';
SET @sql +='wo.completedate >=''' + @cls_time_DateFrom + ''' ';
SET @sql +='and wo.completedate <= '''+ @cls_time_DateTo+''' ';
SET @sql +='and wo.WorkOrderType = '''+ @wotype +''' ';
SET @sql +='and wo.WorkOrderID = w.WorkOrder ';
--if @productnames='Fales'
SET @sql +='and ''' + @productnames + ''' like '%'+wo.ProductName+'%' ';
SET @sql +='group by wo.productname,w.WorkOrder ';
SET @sql +='order by ProductName, w.WorkOrder ';
exec(@sql);
end
BEGIN
DECLARE @sql NVARCHAR(500);
SET NOCOUNT ON;
SET @sql = 'select wo.ProductName,w.WorkOrder, MIN(w.MoveInTime) as MIN_MoveInTime, MAX(w.moveouttime) as MAX_MoveOutTime, ';
SET @sql += 'CAST(DATEDIFF(HOUR, MIN(w.MoveInTime), MAX(w.moveouttime)) * 1.0/24 as DECIMAL(6,4)) as CycleTime ';
SET @sql +='from WaferHistory w WITH(NOLOCK), WorkOrder wo WITH(NOLOCK) where ';
SET @sql +='wo.completedate >=''' + @cls_time_DateFrom + ''' ';
SET @sql +='and wo.completedate <= '''+ @cls_time_DateTo+''' ';
SET @sql +='and wo.WorkOrderType = '''+ @wotype +''' ';
SET @sql +='and wo.WorkOrderID = w.WorkOrder&nb