set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTERPROCEDURE [dbo].[sp_rfid_label_operation]
@prodStep varchar(255),
@operationGrp varchar(255),
@MajorOperationNo varchar(255),
@MajorOperationNoTo varchar(255),
@MajorOperationName varchar(255),
@dateAddFrom dateTime,
@dateAddTo DateTime
AS
declare @dateFrom DateTime, @dateTo DateTime
select @dateFrom = CONVERT(datetime, Convert(char(8), @dateAddFrom, 112)+ ' 00:00:00.000', 120)
select @dateTo = CONVERT(datetime, Convert(char(8), @dateAddTo, 112)+ ' 23:59:59.998', 120)
select
operation_no = operation.data2,
production_step = production_step.data2,
operation_group = operation_group.data2,
operation_name = operation.data4,
rfid_serial = (select top 1 rfid_serial from rfid_step_serial where major_step = operation.data2 ),
date_add = operation.update_date
from system_table operation (nolock) Left join system_table production_step On production_step.sysno = operation.data1 and production_step.type = 'SP'
Left join system_table operation_group(nolock) On operation_group.sysno = operation.data9 and operation_group.type = 'DPT'
--Left joinrfid_step_serialas tt On operation.data2 = tt.major_step
where operation.type = 'MAJR'
and (@prodStep is Null or @prodStep = '' or production_step.data2 = @prodStep)
and (@operationGrp is Null or @operationGrp = '' or operation_group.data2 = @operationGrp)
and (@MajorOperationNo is Null or @MajorOperationNo = '' or operation.data2 >= @MajorOperationNo)
and (@MajorOperationNoTo is Null or @MajorOperationNoTo = '' or operation.data2 <= @MajorOperationNoTo)
and (@MajorOperationName is Null or @MajorOperationName = '' or operation.data4 = @MajorOperationName)
and (@dateFrom is null or operation.update_date >= @dateFrom)
and (@dateTo is nullor operation.update_date <= @dateTo)
and exists(select 1 from rfid_step_serial where major_step = operation.data2)
谁能帮我分析一下
这存储过程是什麼意思?
问题补充:
越详细越好 |