Skip to Content
avatar image
Former Member

PACKINGLIST WHAREHOUSE LIST

Bom dia/ Good morning

Preciso que o endereço que foi retirado o item apareça no packing list, ja tentei de toda forma e não consegui, minha consulta para as notas de saida esta assim./ I need to address in wharehouse that was removed and appear to packing list, I've already tried and not get success, i need help.

-----------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------Busca os dados de notas com Lote SAIDA--------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------
SELECT 'SAIDA' as TIPO
, CONVERT (varchar, T0.DocDate,  103) AS 'DATA'
, T0.U_Hora AS 'HORA'
, T0.DocEntry AS 'Documento'
, T0.Serial AS 'Número da nota'
, T0.CardCode 
, T0.CardName 
, REPLACE(T0.Address2,CHAR(13)+CHAR(13),CHAR(13)) as 'Endereco'
, T1.ItemCode 
, T1.Dscription 
, T1.Quantity AS 'Quantidade'
, isnull(T14.DistNumber,99999999999) as 'BatchNum'
, case when T1.TreeType = 'S' THEN 0 
  ELSE T13.Quantity END Quantity
, T1.LineNum
, isnull(T2.SWW,'-')
, T4.ExpDate 
, T4.PrdDate
, T0.Docdate
, T5.Incoterms
, T2.InvntryUom AS UNLOTE
, T6.TrnspName 
, T7.CardName 
 FROM SBO_BMRMedical.dbo.OINV T0
 INNER JOIN SBO_BMRMedical.dbo.INV1 T1 ON T1.DocEntry = T0.DocEntry 
 INNER JOIN SBO_BMRMedical.dbo.OITM T2 ON T2.ItemCode = T1.ItemCode 
 INNER JOIN SBO_BMRMedical.dbo.INV12 T5 ON T0.DocEntry = T5.DocEntry
           INNER JOIN SBO_BMRMedical.dbo.OITL T12 ON T1.DocEntry = T12.DocEntry AND T12.DocType = T0.ObjType AND T12.ApplyLine = T1.LineNum AND T1.WhsCode = T12.LocCode --TESTE
           INNER JOIN SBO_BMRMedical.dbo.ITL1 T13 ON T12.LogEntry = T13.LogEntry --TESTE
           INNER JOIN SBO_BMRMedical.dbo.OBTN T14 ON T13.ItemCode = T14.ItemCode and T13.SysNumber = T14.SysNumber --teste
 INNER JOIN SBO_BMRMedical.dbo.OIBT T4 ON T4.BatchNum = T14.DistNumber AND T4.ItemCode = T12.ItemCode AND T1.ItemCode = T12.ItemCode AND T4.WhsCode = T1.WhsCode           
 LEFT JOIN SBO_BMRMedical.dbo.OSHP T6 ON T0.TrnspCode = T6.TrnspCode
 LEFT JOIN SBO_BMRMedical.dbo.OCRD T7 ON T7.CARDCODE = T5.CARRIER 
WHERE T2.ManBtchNum = 'Y' AND T0.DocDate >'2017-01-01' AND T0.U_Consig = 'N' /*and T0.U_Expedido = 'n'*/ and T0.Serial = 95100
UNION ALL
-----------------------------------------------------------------------------------------------------------------------------------------------------------
-- Busca os dados de notas com Nr de Série SAIDA-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------
SELECT 'SAIDA' as TIPO
, CONVERT (varchar,T0.DocDate,  103) AS 'DATA'
, T0.U_Hora AS 'HORA'
, T0.DocEntry
, T0.Serial
, T0.CardCode
, T0.CardName as 'Nome do cliente'
, REPLACE(T0.Address2,CHAR(13)+CHAR(13),CHAR(13)) as Endereco
, T1.ItemCode
, T1.Dscription
, T1.Quantity
, T9.IntrSerial
, 1
, T1.LineNum
, isnull(T2.SWW,'-')
, T9.ExpDate
, T9.PrdDate
, T0.Docdate
, T5.Incoterms
, T2.InvntryUom AS UNLOTE
, T6.TrnspName
, T7.CardName 
FROM  SBO_BMRMedical.dbo.OINV T0
INNER JOIN SBO_BMRMedical.dbo.INV1 T1 ON T1.DocEntry = T0.DocEntry 
INNER JOIN SBO_BMRMedical.dbo.OITM T2 ON T2.ItemCode = T1.ItemCode 
INNER JOIN SBO_BMRMedical.dbo.SRI1 T8 ON T0.DocEntry = T8.BaseEntry AND T0.ObjType = T8.BaseType AND T8.BaseLinNum = T1.LineNum AND T1.WhsCode = T8.WhsCode 
INNER JOIN SBO_BMRMedical.dbo.OSRI T9 ON T9.SysSerial = T8.SysSerial AND T9.ItemCode = T8.ItemCode AND T1.ItemCode = T8.ItemCode AND T9.WhsCode = T1.WhsCode 
INNER JOIN SBO_BMRMedical.dbo.INV12 T5 ON T0.DocEntry = T5.DocEntry
LEFT JOIN SBO_BMRMedical.dbo.OSHP T6 ON T0.TrnspCode = T6.TrnspCode
LEFT JOIN SBO_BMRMedical.dbo.OCRD T7 ON T7.CARDCODE = T5.CARRIER 
WHERE  T2.ManSerNum = 'Y' and T2.SWW IS NOT NULL AND T0.DocDate >'2017-01-01' AND T0.U_Consig = 'N' /*and T0.U_Expedido = 'n'*/  and T0.Serial = 95100
UNION ALL
-----------------------------------------------------------------------------------------------------------------------------------------------------------
-- Busca os itens sem numero de lote ou série SAIDA--------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------
SELECT  'SAIDA' as TIPO
, CONVERT (varchar,T0.DocDate,  103) AS 'DATA'
, T0.U_Hora AS 'HORA'
, T0.DocEntry
, T0.Serial
, T0.CardCode
, T0.CardName as 'Nome do cliente'
, REPLACE(T0.Address2,CHAR(13)+CHAR(13),CHAR(13)) as Endereco
, T1.ItemCode
, T1.Dscription
, 0 as Quantity
, '-' AS IntrSerial
, 0
, T1.LineNum
, T2.SWW
, '' as ExpDate
,0
, T0.Docdate
, T5.Incoterms
, T2.InvntryUom AS UNLOTE
, T6.TrnspName
, T7.CardName 
FROM SBO_BMRMedical.dbo.OINV T0
INNER JOIN SBO_BMRMedical.dbo.INV1 T1 ON T1.DocEntry = T0.DocEntry 
INNER JOIN SBO_BMRMedical.dbo.OITM T2 ON T2.ItemCode = T1.ItemCode 
LEFT JOIN SBO_BMRMedical.dbo.OSHP T6 ON T0.TrnspCode = T6.TrnspCode
INNER JOIN SBO_BMRMedical.dbo.INV12 T5 ON T0.DocEntry = T5.DocEntry
LEFT JOIN SBO_BMRMedical.dbo.OCRD T7 ON T7.CARDCODE = T5.CARRIER 
WHERE T1.TreeType = 'S' AND T0.DocDate >'2017-01-01' AND T0.U_Consig = 'N' /*and T0.U_Expedido = 'n'*/  and T0.Serial = 95100
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers