" A INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_WMSKanBanSettle GROUP BY MaterialCode, Kanban HAVING COUNT(1) = 1 ) B ON A.Kanban = B.Kanban \n"+
" AND A.MaterialCode = B.MaterialCode\n"+
" AND A.MaterialCode = B.MaterialCode and A.WMSDeliveryNote is not null\n"+
" LEFT JOIN Set_material t1 ON A.MaterialCode = t1.CustomerPartCode\n";