using MESClassLibrary.BLL.Log; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Reflection; using System.Text; namespace MESClassLibrary.DAL.painting { public class PolishingNotStockDal { public DataTable PolishingNotStockkBarCode(string time1, string time2) { DataTable res = null; try { string sql = @"if OBJECT_ID(N'tempdb..#a',N'U') is not null DROP TABLE #a CREATE TABLE #a(barcode nvarchar(50)) INSERT INTO #a ( barcode ) (SELECT DISTINCT barcode FROM dbo.tb_InspectResult WHERE createTime BETWEEN '"+ time1 + @"' AND '"+ time2 +@"' AND inspectResult LIKE '%抛光%' AND barcode LIKE '22%') SELECT #a.barcode FROM #a LEFT OUTER JOIN dbo.tb_StockIn s ON #a.barcode=s.barcode where s.ID is null"; return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0]; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); } return res; } } }