添加查询条件

This commit is contained in:
admin
2021-01-11 09:07:29 +08:00
parent cbd3c4555a
commit e20107b10d
7 changed files with 40 additions and 12 deletions

View File

@@ -10,13 +10,17 @@ namespace NX.ERP.U8.Base
{ {
public class BinDAL public class BinDAL
{ {
public IEnumerable<Bin> GetList() public IEnumerable<Bin> GetList(string strwhere="",object Params=null)
{ {
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{ {
var sql = @"select cPosCode as BinCode,cPosName as BinName,iPosGrade,bPosEnd,cWhCode as WarehouseCode, var sql = @"select cPosCode as BinCode,cPosName as BinName,iPosGrade,bPosEnd,cWhCode as WarehouseCode,
iMaxCubage as VolumeLimit, iMaxweight as WeightLimit,cMemo,cBarCode from Position"; iMaxCubage as VolumeLimit, iMaxweight as WeightLimit,cMemo,cBarCode from Position";
return conn.Query<Bin>(sql, null); if (!string.IsNullOrEmpty(strwhere))
{
sql += $" where {strwhere}";
}
return conn.Query<Bin>(sql, Params);
} }
} }
} }

View File

@@ -9,7 +9,7 @@ namespace NX.ERP.U8
{ {
public class CustomerDAL public class CustomerDAL
{ {
public IEnumerable<Customer> GetList() public IEnumerable<Customer> GetList(string strWhere="",object Param=null)
{ {
@@ -21,7 +21,11 @@ namespace NX.ERP.U8
cCusPostCode AS PostalCode, cCusPostCode AS PostalCode,
cCusAddress AS Address, cCusAddress AS Address,
cCusPerson AS Contract,cCusPhone AS ContractPhone from Customer "; cCusPerson AS Contract,cCusPhone AS ContractPhone from Customer ";
return conn.Query<Customer>(sql, null); if (!string.IsNullOrEmpty(strWhere))
{
sql += $" where {strWhere}";
}
return conn.Query<Customer>(sql, Param);
} }
} }
} }

View File

@@ -9,7 +9,7 @@ namespace NX.ERP.U8
{ {
public class MaterielDAL public class MaterielDAL
{ {
public IEnumerable<Materiel> GetList() public IEnumerable<Materiel> GetList(string strWhere = "", object Param = null)
{ {
@@ -264,7 +264,11 @@ namespace NX.ERP.U8
bSpecialOrder AS 客户订单专用, bSpecialOrder AS 客户订单专用,
bTrackSaleBill AS 销售跟单 bTrackSaleBill AS 销售跟单
from Inventory"; from Inventory";
return conn.Query<Materiel>(sql, null); if (!string.IsNullOrEmpty(strWhere))
{
sql += $" where {strWhere}";
}
return conn.Query<Materiel>(sql, Param);
} }
} }
} }

View File

@@ -9,12 +9,16 @@ namespace NX.ERP.U8
{ {
public class MaterielTypeDAL public class MaterielTypeDAL
{ {
public IEnumerable<MaterielType> GetList() public IEnumerable<MaterielType> GetList(string strWhere = "", object Param = null)
{ {
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{ {
var sql = @"select cInvCCode AS MaterielTypeCode,cInvCName AS MaterielTypeName from InventoryClass "; var sql = @"select cInvCCode AS MaterielTypeCode,cInvCName AS MaterielTypeName from InventoryClass ";
return conn.Query<MaterielType>(sql, null); if (!string.IsNullOrEmpty(strWhere))
{
sql += $" where {strWhere}";
}
return conn.Query<MaterielType>(sql, Param);
} }
} }
} }

View File

@@ -9,7 +9,7 @@ namespace NX.ERP.U8
{ {
public class SupplierDAL public class SupplierDAL
{ {
public IEnumerable<Supplier> GetList() public IEnumerable<Supplier> GetList(string strWhere = "", object Param = null)
{ {
@@ -21,6 +21,10 @@ namespace NX.ERP.U8
cVenPostCode AS PostalCode, cVenPostCode AS PostalCode,
cVenAddress AS Address, cVenAddress AS Address,
cVenPerson AS Contract from Vendor "; cVenPerson AS Contract from Vendor ";
if (!string.IsNullOrEmpty(strWhere))
{
sql += $" where {strWhere}";
}
return conn.Query<Supplier>(sql, null); return conn.Query<Supplier>(sql, null);
} }
} }

View File

@@ -10,13 +10,17 @@ namespace NX.ERP.U8
{ {
public class UnitDAL public class UnitDAL
{ {
public IEnumerable<Unit> GetList() public IEnumerable<Unit> GetList(string strWhere = "", object Param = null)
{ {
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{ {
var sql = @"select var sql = @"select
cComunitCode AS UnitCode, cComunitCode AS UnitCode,
cComUnitName AS UnitName,bMainUnit as MainUnit, cGroupCode as GroupCode from ComputationUnit "; cComUnitName AS UnitName,bMainUnit as MainUnit, cGroupCode as GroupCode from ComputationUnit ";
if (!string.IsNullOrEmpty(strWhere))
{
sql += $" where {strWhere}";
}
return conn.Query<Unit>(sql, null); return conn.Query<Unit>(sql, null);
} }
} }

View File

@@ -9,14 +9,18 @@ namespace NX.ERP.U8
{ {
public class WarehouseDAL public class WarehouseDAL
{ {
public IEnumerable<Warehouse> GetList() public IEnumerable<Warehouse> GetList(string strWhere = "", object Param = null)
{ {
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{ {
var sql = "select cWhCode as WarehouseCode,cWhName as WarehouseName from Warehouse"; var sql = "select cWhCode as WarehouseCode,cWhName as WarehouseName from Warehouse";
return conn.Query<Warehouse>(sql, null); if (!string.IsNullOrEmpty(strWhere))
{
sql += $" where {strWhere}";
}
return conn.Query<Warehouse>(sql, Param);
} }
} }
} }