public List <Mes_Tra_SourceBarcode> FindByPage(Mes_Tra_SourceBarcode obj, ref PagerBase pager) { string sql = @"SELECT T1.* FROM Mes_Tra_SourceBarcode T1 WITH(NOLOCK) WHERE 1=1 "; if (!string.IsNullOrEmpty(obj.Barcode)) { sql += string.Format(" AND T1.Barcode Like '{0}%'", obj.Barcode); } if (!string.IsNullOrEmpty(obj.PackSN)) { sql += string.Format(" AND T1.PackSN Like '{0}%'", obj.PackSN); } if (!string.IsNullOrEmpty(obj.CreatedTimeStart)) { sql += string.Format(" AND T1.CreatedTime >='{0}'", obj.CreatedTimeStart); } if (!string.IsNullOrEmpty(obj.CreatedTimeEnd)) { sql += string.Format(" AND T1.CreatedTime <'{0}'", TConvertHelper.FormatDBDate(obj.CreatedTimeEnd).AddDays(1)); } string orderBy = pager.OrderBy; if (string.IsNullOrEmpty(orderBy)) { orderBy = "CreatedTime DESC"; } string cmdPageSql = string.Format(BaseDao.PageSql, orderBy, sql, pager.StartNo, pager.EndNo); string cmdCountSql = string.Format(BaseDao.CountSql, sql.Substring(sql.ToLower().IndexOf("from", StringComparison.Ordinal))); //查询总记录数 pager.TotalItemCount = this.CurDbSession.FromSql(cmdCountSql).ToScalar <int>(); //返回当前页的记录数 return(this.CurDbSession.FromSql(cmdPageSql).ToList <Mes_Tra_SourceBarcode>()); }
public List <Mes_Stock_InStock> FindByPage(Mes_Stock_InStock obj, ref PagerBase pager) { string sql = @"SELECT T1.* FROM Mes_Stock_InStock T1 WHERE 1=1 "; if (TConvertHelper.FormatDBInt(obj.BillType) > 0) { sql += string.Format(" AND T1.BillType = '{0}'", obj.BillType); } if (!string.IsNullOrEmpty(obj.BillNo)) { sql += string.Format(" AND T1.BillNo Like '%{0}%'", obj.BillNo); } if (!string.IsNullOrEmpty(obj.InStockDateStart)) { sql += string.Format(" AND T1.InStockDate >='{0}'", obj.InStockDateStart); } if (!string.IsNullOrEmpty(obj.InStockDateEnd)) { sql += string.Format(" AND T1.InStockDate <'{0}'", TConvertHelper.FormatDBDate(obj.InStockDateEnd).AddDays(1)); } if (obj.AuditStatus > 0) { sql += string.Format(" AND T1.AuditStatus = {0}", obj.AuditStatus); } if (obj.CheckStatus > 0) { sql += string.Format(" AND T1.CheckStatus = {0}", obj.CheckStatus); } if (!string.IsNullOrEmpty(obj.SupplierName)) { sql += string.Format(" AND T1.SupplierName Like '%{0}%'", obj.SupplierName); } if (!string.IsNullOrEmpty(obj.CreatedTimeStart)) { sql += string.Format(" AND T1.CreatedTime >='{0}'", obj.CreatedTimeStart); } if (!string.IsNullOrEmpty(obj.CreatedTimeEnd)) { sql += string.Format(" AND T1.CreatedTime <'{0}'", TConvertHelper.FormatDBDate(obj.CreatedTimeEnd).AddDays(1)); } string orderBy = pager.OrderBy; if (string.IsNullOrEmpty(orderBy)) { orderBy = "CreatedTime DESC"; } string cmdPageSql = string.Format(BaseDao.PageSql, orderBy, sql, pager.StartNo, pager.EndNo); string cmdCountSql = string.Format(BaseDao.CountSql, sql.Substring(sql.ToLower().IndexOf("from", StringComparison.Ordinal))); //查询总记录数 pager.TotalItemCount = this.CurDbSession.FromSql(cmdCountSql).ToScalar <int>(); //返回当前页的记录数 return(this.CurDbSession.FromSql(cmdPageSql).ToList <Mes_Stock_InStock>()); }
public List <Mes_Plan_SaleOrder> FindByPage(Mes_Plan_SaleOrder obj, ref PagerBase pager) { string sql = @"SELECT T1.*,T2.CustomerName FROM Mes_Plan_SaleOrder T1 WITH(NOLOCK) LEFT JOIN dbo.Mes_Sys_Customer T2 WITH(NOLOCK) ON T1.CustomerID = T2.ID WHERE OrderStatus<>20 "; if (TConvertHelper.FormatDBInt(obj.OrderType) > 0) { sql += string.Format(" AND T1.OrderType = '{0}'", obj.OrderType); } if (!string.IsNullOrEmpty(obj.OrderNo)) { sql += string.Format(" AND T1.OrderNo Like '%{0}%'", obj.OrderNo); } if (!string.IsNullOrEmpty(obj.OrderDateStart)) { sql += string.Format(" AND T1.OrderDate >='{0}'", obj.OrderDateStart); } if (!string.IsNullOrEmpty(obj.OrderDateEnd)) { sql += string.Format(" AND T1.OrderDate <'{0}'", TConvertHelper.FormatDBDate(obj.OrderDateEnd).AddDays(1)); } if (obj.OrderStatus > 0) { sql += string.Format(" AND T1.OrderStatus = {0}", obj.OrderStatus); } if (!string.IsNullOrEmpty(obj.CustomerName)) { sql += string.Format(" AND T1.CustomerName Like '%{0}%'", obj.CustomerName); } if (!string.IsNullOrEmpty(obj.CreatedTimeStart)) { sql += string.Format(" AND T1.CreatedTime >='{0}'", obj.CreatedTimeStart); } if (!string.IsNullOrEmpty(obj.CreatedTimeEnd)) { sql += string.Format(" AND T1.CreatedTime <'{0}'", TConvertHelper.FormatDBDate(obj.CreatedTimeEnd).AddDays(1)); } string orderBy = pager.OrderBy; if (string.IsNullOrEmpty(orderBy)) { orderBy = "CreatedTime DESC"; } string cmdPageSql = string.Format(BaseDao.PageSql, orderBy, sql, pager.StartNo, pager.EndNo); string cmdCountSql = string.Format(BaseDao.CountSql, sql.Substring(sql.ToLower().IndexOf("from", StringComparison.Ordinal))); //查询总记录数 pager.TotalItemCount = this.CurDbSession.FromSql(cmdCountSql).ToScalar <int>(); //返回当前页的记录数 return(this.CurDbSession.FromSql(cmdPageSql).ToList <Mes_Plan_SaleOrder>()); }
public List <Mes_Tra_OutStock> FindByPage(Mes_Tra_OutStock obj, ref PagerBase pager) { string sql = @"select T1.*,T2.OrgName as Show_OrgID from Mes_Tra_OutStock T1 with (nolock) Left join Mes_Sys_Organization T2 with (nolock) on T1.OrgID=T2.ID WHERE 1=1 "; if (!string.IsNullOrEmpty(obj.Barcode)) { sql += string.Format(" AND T1.Barcode='{0}'", obj.Barcode); } if (!string.IsNullOrEmpty(obj.SN)) { sql += string.Format(" AND T1.SN='{0}'", obj.SN); } if (!string.IsNullOrEmpty(obj.PackSN)) { sql += string.Format(" AND T1.PackSN='{0}'", obj.PackSN); } if (!string.IsNullOrEmpty(obj.MaterialProNo)) { sql += string.Format(" AND T1.MaterialProNo='{0}'", obj.MaterialProNo); } if (!string.IsNullOrEmpty(obj.MaterialCode)) { sql += string.Format(" AND T1.MaterialCode='{0}'", obj.MaterialCode); } if (!string.IsNullOrEmpty(obj.OrderNumber)) { sql += string.Format(" AND T1.OrderNumber='{0}'", obj.OrderNumber); } if (!string.IsNullOrEmpty(obj.ScanTimeStart)) { sql += string.Format(" AND T1.ScanTime>='{0}'", obj.ScanTimeStart); } if (!string.IsNullOrEmpty(obj.ScanTimeEnd)) { sql += string.Format(" AND T1.ScanTime<'{0}'", TConvertHelper.FormatDBDate(obj.ScanTimeEnd).AddDays(1)); } string orderBy = pager.OrderBy; if (string.IsNullOrEmpty(orderBy)) { orderBy = "ScanTime DESC"; } string cmdPageSql = string.Format(BaseDao.PageSql, orderBy, sql, pager.StartNo, pager.EndNo); string cmdCountSql = string.Format(BaseDao.CountSql, sql.Substring(sql.ToLower().IndexOf("from", StringComparison.Ordinal))); //查询总记录数 pager.TotalItemCount = this.CurDbSession.FromSql(cmdCountSql).ToScalar <int>(); //返回当前页的记录数 return(this.CurDbSession.FromSql(cmdPageSql).ToList <Mes_Tra_OutStock>()); }
public List <Mes_Plan_WorkOrder> FindByPage(Mes_Plan_WorkOrder obj, ref PagerBase pager) { string sql = @"SELECT T1.*,T2.WorkShopName FROM Mes_Plan_WorkOrder T1 LEFT JOIN dbo.Mes_Sys_WorkShop T2 ON T1.WorkShopCode = T2.WorkShopCode WHERE 1=1 "; if (TConvertHelper.FormatDBInt(obj.WorkOrderNumber) > 0) { sql += string.Format(" AND T1.WorkOrderNumber = '{0}'", obj.WorkOrderNumber); } if (!string.IsNullOrEmpty(obj.PlanCode)) { sql += string.Format(" AND T1.PlanCode LIKE '%{0}%'", obj.PlanCode); } if (!string.IsNullOrEmpty(obj.MaterialProNo)) { sql += string.Format(" AND T1.MaterialProNo= '{0}'", obj.MaterialProNo); } if (!string.IsNullOrEmpty(obj.MaterialCode)) { sql += string.Format(" AND T1.MaterialCode= '{0}'", obj.MaterialCode); } if (obj.WorkOrderStatus > 0) { sql += string.Format(" AND T1.WorkOrderStatus = {0}", obj.WorkOrderStatus); } if (!string.IsNullOrEmpty(obj.CreatedTimeStart)) { sql += string.Format(" AND T1.CreatedTime >='{0}'", obj.CreatedTimeStart); } if (!string.IsNullOrEmpty(obj.CreatedTimeEnd)) { sql += string.Format(" AND T1.CreatedTime <'{0}'", TConvertHelper.FormatDBDate(obj.CreatedTimeEnd).AddDays(1)); } string orderBy = pager.OrderBy; if (string.IsNullOrEmpty(orderBy)) { orderBy = "CreatedTime DESC"; } string cmdPageSql = string.Format(BaseDao.PageSql, orderBy, sql, pager.StartNo, pager.EndNo); string cmdCountSql = string.Format(BaseDao.CountSql, sql.Substring(sql.ToLower().IndexOf("from", StringComparison.Ordinal))); //查询总记录数 pager.TotalItemCount = this.CurDbSession.FromSql(cmdCountSql).ToScalar <int>(); //返回当前页的记录数 return(this.CurDbSession.FromSql(cmdPageSql).ToList <Mes_Plan_WorkOrder>()); }
public List <Mes_Stock_InStock> FindByCond(Mes_Stock_InStock obj) { string sql = @"SELECT T1.* FROM Mes_Stock_InStock T1 WHERE 1=1 "; if (TConvertHelper.FormatDBInt(obj.BillType) > 0) { sql += string.Format(" AND T1.BillType = '{0}'", obj.BillType); } if (!string.IsNullOrEmpty(obj.BillNo)) { sql += string.Format(" AND T1.BillNo Like '%{0}%'", obj.BillNo); } if (!string.IsNullOrEmpty(obj.InStockDateStart)) { sql += string.Format(" AND T1.InStockDate >='{0}'", obj.InStockDateStart); } if (!string.IsNullOrEmpty(obj.InStockDateEnd)) { sql += string.Format(" AND T1.InStockDate <'{0}'", TConvertHelper.FormatDBDate(obj.InStockDateEnd).AddDays(1)); } if (obj.AuditStatus > 0) { sql += string.Format(" AND T1.AuditStatus = {0}", obj.AuditStatus); } if (obj.CheckStatus > 0) { sql += string.Format(" AND T1.CheckStatus = {0}", obj.CheckStatus); } if (!string.IsNullOrEmpty(obj.SupplierName)) { sql += string.Format(" AND T1.SupplierName Like '%{0}%'", obj.SupplierName); } if (!string.IsNullOrEmpty(obj.CreatedTimeStart)) { sql += string.Format(" AND T1.CreatedTime >='{0}'", obj.CreatedTimeStart); } if (!string.IsNullOrEmpty(obj.CreatedTimeEnd)) { sql += string.Format(" AND T1.CreatedTime <'{0}'", TConvertHelper.FormatDBDate(obj.CreatedTimeEnd).AddDays(1)); } sql += " ORDER BY CreatedTime DESC"; //返回当前页的记录数 return(this.CurDbSession.FromSql(sql).ToList <Mes_Stock_InStock>()); }
public List <Mes_Sys_FlowConfig> FindByPage(Mes_Sys_FlowConfig obj, ref PagerBase pager) { string sql = @"SELECT T1.* FROM Mes_Sys_FlowConfig T1 WHERE 1=1 "; if (!string.IsNullOrEmpty(obj.BusinessType)) { sql += string.Format(" AND T1.BusinessType ='{0}'", obj.BusinessType); } if (!string.IsNullOrEmpty(obj.OptUserName)) { sql += string.Format(" AND T1.OptUserName LIKE '%{0}%'", obj.OptUserName); } if (!string.IsNullOrEmpty(obj.CreatedTimeStart)) { sql += string.Format(" AND T1.CreatedTime >='{0}'", obj.CreatedTimeStart); } if (!string.IsNullOrEmpty(obj.CreatedTimeEnd)) { sql += string.Format(" AND T1.CreatedTime <'{0}'", TConvertHelper.FormatDBDate(obj.CreatedTimeEnd).AddDays(1)); } string orderBy = pager.OrderBy; if (string.IsNullOrEmpty(orderBy)) { orderBy = "CreatedTime DESC"; } string cmdPageSql = string.Format(BaseDao.PageSql, orderBy, sql, pager.StartNo, pager.EndNo); string cmdCountSql = string.Format(BaseDao.CountSql, sql.Substring(sql.ToLower().IndexOf("from", StringComparison.Ordinal))); //查询总记录数 pager.TotalItemCount = this.CurDbSession.FromSql(cmdCountSql).ToScalar <int>(); //返回当前页的记录数 return(this.CurDbSession.FromSql(cmdPageSql).ToList <Mes_Sys_FlowConfig>()); }