diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index b3130ac..42d23e4 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -62,6 +62,7 @@ + @@ -72,6 +73,8 @@ + + diff --git a/NX.ERP.Model/Request/Customer.cs b/NX.ERP.Model/Request/Customer.cs new file mode 100644 index 0000000..01dd28f --- /dev/null +++ b/NX.ERP.Model/Request/Customer.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class Customer:BaseModel + { + private string customerCode; + private string customerName; + + public string CustomerCode { get => customerCode; set => customerCode = value; } + + public string CustomerName { get => customerName; set => customerName = value; } + } +} diff --git a/NX.ERP.Model/Request/Supplier.cs b/NX.ERP.Model/Request/Supplier.cs new file mode 100644 index 0000000..c0d7216 --- /dev/null +++ b/NX.ERP.Model/Request/Supplier.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class Supplier:BaseModel + { + private string supplierCode; + private string supplierName; + + + public string SupplierCode { get => supplierCode; set => supplierCode = value; } + public string SupplierName { get => supplierName; set => supplierName = value; } + + } +} diff --git a/NX.ERP.Model/Request/Unit.cs b/NX.ERP.Model/Request/Unit.cs new file mode 100644 index 0000000..8c4bd0e --- /dev/null +++ b/NX.ERP.Model/Request/Unit.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class Unit:BaseModel + { + private string unitCode; + private string unitName; + + + + public string UnitCode { get => unitCode; set => unitCode = value; } + public string UnitName { get => unitName; set => unitName = value; } + + } +} diff --git a/NX.ERP.Model/Response/Base/Customer.cs b/NX.ERP.Model/Response/Base/Customer.cs index 4afae33..18be0d1 100644 --- a/NX.ERP.Model/Response/Base/Customer.cs +++ b/NX.ERP.Model/Response/Base/Customer.cs @@ -5,7 +5,7 @@ using System.Text; namespace NX.ERP.Model { - public class Customer + public class Customer:BaseModel { private string customerCode; private string customerName; @@ -13,11 +13,11 @@ namespace NX.ERP.Model private string address; private string contract; private string contractPhone; - public string Code { get => customerCode; set => customerCode = value; } + public string CustomerCode { get => customerCode; set => customerCode = value; } public string PostalCode { get => postalCode; set => postalCode = value; } public string Address { get => address; set => address = value; } public string Contract { get => contract; set => contract = value; } public string ContractPhone { get => contractPhone; set => contractPhone = value; } - public string Name { get => customerName; set => customerName = value; } + public string CustomerName { get => customerName; set => customerName = value; } } } diff --git a/NX.ERP.Model/Response/Base/Supplier.cs b/NX.ERP.Model/Response/Base/Supplier.cs index 8cd36d5..eaca025 100644 --- a/NX.ERP.Model/Response/Base/Supplier.cs +++ b/NX.ERP.Model/Response/Base/Supplier.cs @@ -5,18 +5,20 @@ using System.Text; namespace NX.ERP.Model { - public class Supplier + public class Supplier:BaseModel { private string supplierCode; private string supplierName; - private string postalCode; + private string address; private string contract; - public string Code { get => supplierCode; set => supplierCode = value; } - public string Name { get => supplierName; set => supplierName = value; } - public string PostalCode { get => postalCode; set => postalCode = value; } + public string SupplierCode { get => supplierCode; set => supplierCode = value; } + public string SupplierName { get => supplierName; set => supplierName = value; } + public string Address { get => address; set => address = value; } public string Contract { get => contract; set => contract = value; } + + public string ContractPhone { get; set; } } } diff --git a/NX.ERP.Model/Response/Base/Unit.cs b/NX.ERP.Model/Response/Base/Unit.cs index ead43a4..edd0a5c 100644 --- a/NX.ERP.Model/Response/Base/Unit.cs +++ b/NX.ERP.Model/Response/Base/Unit.cs @@ -5,16 +5,19 @@ using System.Text; namespace NX.ERP.Model { - public class Unit + public class Unit:BaseModel { private string unitCode; private string unitName; private bool mainUnit; private string groupCode; - public string Code { get => unitCode; set => unitCode = value; } - public string Name { get => unitName; set => unitName = value; } + + public string UnitCode { get => unitCode; set => unitCode = value; } + public string UnitName { get => unitName; set => unitName = value; } public bool MainUnit { get => mainUnit; set => mainUnit = value; } public string GroupCode { get => groupCode; set => groupCode = value; } + + public decimal Changerate { get; set; } } } diff --git a/NX.ERP.U8/Base/CustomerDAL.cs b/NX.ERP.U8/Base/CustomerDAL.cs index 7d8d02f..e379163 100644 --- a/NX.ERP.U8/Base/CustomerDAL.cs +++ b/NX.ERP.U8/Base/CustomerDAL.cs @@ -9,24 +9,48 @@ namespace NX.ERP.U8 { public class CustomerDAL { - public IEnumerable GetList(string strWhere="",object Param=null) + public IEnumerable GetList(string strWhere = "", object Param = null) { using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { var sql = @" select - cCusCode AS Code, - cCusName AS Name, + cCusCode AS CustomerCode, + cCusName AS CustomerName, cCusPostCode AS PostalCode, cCusAddress AS Address, cCusPerson AS Contract,cCusPhone AS ContractPhone from Customer "; if (!string.IsNullOrEmpty(strWhere)) { - sql += $" where {strWhere}"; + sql += $" where {strWhere} "; } return conn.Query(sql, Param); } } + + public IEnumerable GetList(NX.ERP.Model.Request.Customer Params) + { + IList where = new List(); + if (string.IsNullOrEmpty(Params.CustomerCode)) + { + where.Add(" cCusCode like @CustomerCode "); + + } + + if (string.IsNullOrEmpty(Params.CustomerName)) + { + where.Add(" cCusName like @CustomerName "); + } + + return this.GetList(string.Join(" and ", where.ToArray()), new + { + CustomerCode = $"%{Params.CustomerCode}%", + CustomerName = $"%{Params.CustomerName}%" + }); + + } + + } } diff --git a/NX.ERP.U8/Base/SupplierDAL.cs b/NX.ERP.U8/Base/SupplierDAL.cs index 251791d..151a515 100644 --- a/NX.ERP.U8/Base/SupplierDAL.cs +++ b/NX.ERP.U8/Base/SupplierDAL.cs @@ -20,6 +20,7 @@ namespace NX.ERP.U8 cVenName AS Name, cVenPostCode AS PostalCode, cVenAddress AS Address, + cVenPhone as ContractPhone, cVenPerson AS Contract from Vendor "; if (!string.IsNullOrEmpty(strWhere)) { @@ -28,5 +29,31 @@ namespace NX.ERP.U8 return conn.Query(sql, null); } } + + + public IEnumerable GetList(NX.ERP.Model.Request.Supplier Params) + { + IList where = new List(); + if (string.IsNullOrEmpty(Params.SupplierCode)) + { + where.Add(" cVenCode like @SupplierCode "); + + } + + if (string.IsNullOrEmpty(Params.SupplierName)) + { + where.Add(" cVenName like @SupplierName "); + } + + return this.GetList(string.Join(" and ", where.ToArray()), new + { + SupplierCode = $"%{Params.SupplierCode}%", + SupplierName = $"%{Params.SupplierName}%" + }); + + + } + + } } diff --git a/NX.ERP.U8/Base/UnitDAL.cs b/NX.ERP.U8/Base/UnitDAL.cs index ead59be..e1b0e22 100644 --- a/NX.ERP.U8/Base/UnitDAL.cs +++ b/NX.ERP.U8/Base/UnitDAL.cs @@ -11,12 +11,12 @@ namespace NX.ERP.U8 public class UnitDAL { public IEnumerable GetList(string strWhere = "", object Param = null) - { + { using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) - { + { var sql = @"select - cComunitCode AS Code, - cComUnitName AS Name,bMainUnit as MainUnit, cGroupCode as GroupCode from ComputationUnit "; + cComunitCode AS UnitCode, + cComUnitName AS UnitName,bMainUnit as MainUnit, cGroupCode as GroupCode from ComputationUnit "; if (!string.IsNullOrEmpty(strWhere)) { sql += $" where {strWhere}"; @@ -24,5 +24,29 @@ namespace NX.ERP.U8 return conn.Query(sql, null); } } + + + public IEnumerable GetList(NX.ERP.Model.Request.Unit Params) + { + IList where = new List(); + if (string.IsNullOrEmpty(Params.UnitCode)) + { + where.Add(" cComunitCode like @UnitCode "); + + } + + if (string.IsNullOrEmpty(Params.UnitName)) + { + where.Add(" cComUnitName like @UnitName "); + } + + return this.GetList(string.Join(" and ", where.ToArray()), new + { + UnitCode = $"%{Params.UnitCode}%", + UnitName = $"%{Params.UnitName}%" + }); + + + } } } diff --git a/NX.ERP.WebAPi/Controllers/Base/CustomerController.cs b/NX.ERP.WebAPi/Controllers/Base/CustomerController.cs index 1c07a2d..6cb6535 100644 --- a/NX.ERP.WebAPi/Controllers/Base/CustomerController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/CustomerController.cs @@ -12,6 +12,7 @@ namespace NX.ERP.WebAPi.Controllers /// /// 客户信息 /// + /// public class CustomerController : ApiController { /// @@ -19,14 +20,22 @@ namespace NX.ERP.WebAPi.Controllers /// /// // GET api/values + + [Route("api/Customer/List")] [HttpGet] public IEnumerable List() { var customerDAL = new CustomerDAL(); return customerDAL.GetList(); - } + [Route("api/Customer/Query")] + [HttpPost] + public IEnumerable Query(NX.ERP.Model.Request.Customer Param) + { + var customerDAL = new CustomerDAL(); + return customerDAL.GetList(Param); + } // GET api/values/5 } diff --git a/NX.ERP.WebAPi/Controllers/Base/HomeController.cs b/NX.ERP.WebAPi/Controllers/Base/HomeController.cs index 7678bfc..7c14469 100644 --- a/NX.ERP.WebAPi/Controllers/Base/HomeController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/HomeController.cs @@ -10,8 +10,7 @@ namespace NX.ERP.WebAPi.Controllers { public ActionResult Index() { - ViewBag.Title = "Home Page"; - return View(); + return Redirect("/swagger"); } } } diff --git a/NX.ERP.WebAPi/Controllers/Base/SupplierController.cs b/NX.ERP.WebAPi/Controllers/Base/SupplierController.cs index 24a3d8a..8a03165 100644 --- a/NX.ERP.WebAPi/Controllers/Base/SupplierController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/SupplierController.cs @@ -10,6 +10,7 @@ namespace NX.ERP.WebAPi.Controllers { public class SupplierController : ApiController { + [Route("api/Supplier/List")] [HttpGet] public IEnumerable List() { @@ -17,5 +18,16 @@ namespace NX.ERP.WebAPi.Controllers return supplierDAL.GetList(); } + + [Route("api/Supplier/Query")] + [HttpPost] + public IEnumerable Query(NX.ERP.Model.Request.Supplier Param) + { + var customerDAL = new SupplierDAL(); + return customerDAL.GetList(Param); + + } } + + } \ No newline at end of file diff --git a/NX.ERP.WebAPi/Controllers/Base/UnitController.cs b/NX.ERP.WebAPi/Controllers/Base/UnitController.cs index eb036fe..c3e2f49 100644 --- a/NX.ERP.WebAPi/Controllers/Base/UnitController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/UnitController.cs @@ -7,8 +7,9 @@ using System.Web.Http; namespace NX.ERP.WebAPi.Controllers { - public class UnitController: ApiController + public class UnitController : ApiController { + [Route("api/Unit/List")] [HttpGet] public IEnumerable List() { @@ -16,5 +17,15 @@ namespace NX.ERP.WebAPi.Controllers return supplierDAL.GetList(); } + + + [Route("api/Unit/Query")] + [HttpPost] + public IEnumerable Query(NX.ERP.Model.Request.Unit Param) + { + var supplierDAL = new UnitDAL(); + return supplierDAL.GetList(Param); + + } } } \ No newline at end of file