SELECT A1.DocNo AS DispatchCode, CAST(A2.DocLineNo AS NVARCHAR(10)) AS DispatchRow, A2.SONo AS SOCode, CAST(A2.SrcDocNo AS NVARCHAR(10)) AS SORow, A3.Code AS CusCode, A4.Name AS CusName, '·¢»õ' AS Type, A5.Code AS InvCode, A7.Code AS WHCode, A2.ShipQtyInvAmount AS Quantity, A9.Code AS ComUnitCode, A1.BusinessDate AS VoucherDate, A1.Status AS Status FROM dbo.SM_Ship A1 LEFT JOIN dbo.SM_ShipLine A2 ON A2.Ship=A1.ID LEFT JOIN dbo.CBO_Customer A3 ON A1.OrderBy_Customer=A3.ID LEFT JOIN dbo.CBO_Customer_Trl A4 ON A4.ID = A3.ID AND A4.SysMLFlag='zh-CN' LEFT JOIN dbo.CBO_ItemMaster A5 ON A2.ItemInfo_ItemID=A5.ID LEFT JOIN dbo.CBO_ItemMaster_Trl A6 ON A6.ID = A5.ID AND A6.SysMLFlag='zh-CN' LEFT JOIN dbo.CBO_Wh A7 ON A2.WH=A7.ID LEFT JOIN dbo.CBO_Wh_Trl A8 ON A8.ID = A7.ID AND A8.SysMLFlag='zh-CN' LEFT JOIN dbo.Base_UOM A9 ON A2.InvUom=A9.ID LEFT JOIN dbo.Base_UOM_Trl A10 ON A10.ID = A9.ID AND A10.SysMLFlag='zh-CN' SELECT A1.DocNo AS DispatchCode, CAST(A2.DocLineNo AS NVARCHAR(10)) AS DispatchRow, FROM dbo.PM_Receivement A1 LEFT JOIN dbo.PM_RcvLine A2 ON A2.Receivement=A1.ID LEFT JOIN dbo.PM_RcvLine_Trl A3 ON A2.ID=A3.ID AND A3.SysMLFlag='zh-CN' WHERE ReceivementType=0 SELECT A2.* FROM dbo.PM_Receivement A1 LEFT JOIN dbo.PM_RcvLine A2 ON A2.Receivement=A1.ID WHERE ReceivementType=0