on 05-23-2014 12:54 AM
Buena tarde , estoy realizando una validacion para que no exista un picking de la misma ruta en el mismo dia, es decir realizo un picking de la ruta 10 el dia de hoy no puedo volver a hacerlo con la ruta 10 en el mismo dia, al momento he logrado bloquear las rutas en forma general , no me detecta que es para que funcione con la fecha actual, si alguien me puede ayudar a realizar este bloqueo , de antemano muchisimas gracias, adjunto el codigo que tengo hasta el momento, saludos cordiales
if @transaction_type in ('A','U') and @object_type = 'Picking'
begin
declare @Refe as Nvarchar(50)
set @Refe = (select u_ruta from [PRUEBAS_DB_Gourmet].[dbo].[@PICKINGENC] where DocEntry = @list_of_cols_val_tab_del)
IF Exists (SELECT COUNT(u_ruta) from [@PICKINGENC] WHERE U_Ruta = @Refe HAVING COUNT(U_Ruta) > '1')
begin
set @error =100-1
set @error_message ='No pueden existir 2 picking con la misma ruta el mismo dia , por favor Verifique'
end
end
Hola armando,
El @pickingenc es un UDO?.
Probaste
set @Refe = (select u_ruta from [PRUEBAS_DB_Gourmet].[dbo].[@PICKINGENC] where DocEntry = @list_of_cols_val_tab_del and docdate= getdate())
Saludos,
Wuilmer Venegas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
El T_SQL que me dio resultado fue este:
if @transaction_type in ('A','U') and @object_type = 'Picking'
begin
declare @fechaPick date
declare @Refe as Nvarchar(50)
set @Refe = (select u_ruta from [@PICKINGENC] where DocEntry = @list_of_cols_val_tab_del )
IF Exists (SELECT COUNT(u_ruta) from [PRUEBAS_DB_Gourmet].[dbo].[@PICKINGENC] WHERE
DATEDIFF(DAY,U_FechaPicking,GetDate()) < 1 and U_Ruta = @Refe HAVING COUNT(U_Ruta) > '1' )
begin
set @error =100-1
set @error_message ='No puede Existir 2 Picking para la misma ruta '
end
end
User | Count |
---|---|
91 | |
8 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.