修改基础资料

This commit is contained in:
admin
2021-01-20 16:31:45 +08:00
parent 7045313454
commit 0e95475880
14 changed files with 191 additions and 23 deletions

View File

@@ -62,6 +62,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="BaseModel.cs" /> <Compile Include="BaseModel.cs" />
<Compile Include="Request\Bin.cs" /> <Compile Include="Request\Bin.cs" />
<Compile Include="Request\Customer.cs" />
<Compile Include="Request\Materiel.cs" /> <Compile Include="Request\Materiel.cs" />
<Compile Include="Request\MaterielType.cs" /> <Compile Include="Request\MaterielType.cs" />
<Compile Include="Request\OtherStoreIn.cs" /> <Compile Include="Request\OtherStoreIn.cs" />
@@ -72,6 +73,8 @@
<Compile Include="Request\ProductStoreInDetail.cs" /> <Compile Include="Request\ProductStoreInDetail.cs" />
<Compile Include="Request\SaleStoreOut.cs" /> <Compile Include="Request\SaleStoreOut.cs" />
<Compile Include="Request\SaleStoreOutDetail.cs" /> <Compile Include="Request\SaleStoreOutDetail.cs" />
<Compile Include="Request\Supplier.cs" />
<Compile Include="Request\Unit.cs" />
<Compile Include="Request\Warehouse.cs" /> <Compile Include="Request\Warehouse.cs" />
<Compile Include="Response\Store\MaterielStoreOut.cs" /> <Compile Include="Response\Store\MaterielStoreOut.cs" />
<Compile Include="Response\Store\MaterielStoreOutDetail.cs" /> <Compile Include="Response\Store\MaterielStoreOutDetail.cs" />

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -5,7 +5,7 @@ using System.Text;
namespace NX.ERP.Model namespace NX.ERP.Model
{ {
public class Customer public class Customer:BaseModel
{ {
private string customerCode; private string customerCode;
private string customerName; private string customerName;
@@ -13,11 +13,11 @@ namespace NX.ERP.Model
private string address; private string address;
private string contract; private string contract;
private string contractPhone; 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 PostalCode { get => postalCode; set => postalCode = value; }
public string Address { get => address; set => address = value; } public string Address { get => address; set => address = value; }
public string Contract { get => contract; set => contract = value; } public string Contract { get => contract; set => contract = value; }
public string ContractPhone { get => contractPhone; set => contractPhone = 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; }
} }
} }

View File

@@ -5,18 +5,20 @@ using System.Text;
namespace NX.ERP.Model namespace NX.ERP.Model
{ {
public class Supplier public class Supplier:BaseModel
{ {
private string supplierCode; private string supplierCode;
private string supplierName; private string supplierName;
private string postalCode;
private string address; private string address;
private string contract; private string contract;
public string Code { get => supplierCode; set => supplierCode = value; } public string SupplierCode { get => supplierCode; set => supplierCode = value; }
public string Name { get => supplierName; set => supplierName = value; } public string SupplierName { get => supplierName; set => supplierName = value; }
public string PostalCode { get => postalCode; set => postalCode = value; }
public string Address { get => address; set => address = value; } public string Address { get => address; set => address = value; }
public string Contract { get => contract; set => contract = value; } public string Contract { get => contract; set => contract = value; }
public string ContractPhone { get; set; }
} }
} }

View File

@@ -5,16 +5,19 @@ using System.Text;
namespace NX.ERP.Model namespace NX.ERP.Model
{ {
public class Unit public class Unit:BaseModel
{ {
private string unitCode; private string unitCode;
private string unitName; private string unitName;
private bool mainUnit; private bool mainUnit;
private string groupCode; 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 bool MainUnit { get => mainUnit; set => mainUnit = value; }
public string GroupCode { get => groupCode; set => groupCode = value; } public string GroupCode { get => groupCode; set => groupCode = value; }
public decimal Changerate { get; set; }
} }
} }

View File

@@ -9,24 +9,48 @@ namespace NX.ERP.U8
{ {
public class CustomerDAL public class CustomerDAL
{ {
public IEnumerable<Customer> GetList(string strWhere="",object Param=null) public IEnumerable<Customer> 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
cCusCode AS Code, cCusCode AS CustomerCode,
cCusName AS Name, cCusName AS CustomerName,
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 ";
if (!string.IsNullOrEmpty(strWhere)) if (!string.IsNullOrEmpty(strWhere))
{ {
sql += $" where {strWhere}"; sql += $" where {strWhere} ";
} }
return conn.Query<Customer>(sql, Param); return conn.Query<Customer>(sql, Param);
} }
} }
public IEnumerable<Customer> GetList(NX.ERP.Model.Request.Customer Params)
{
IList<string> where = new List<string>();
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}%"
});
}
} }
} }

View File

@@ -20,6 +20,7 @@ namespace NX.ERP.U8
cVenName AS Name, cVenName AS Name,
cVenPostCode AS PostalCode, cVenPostCode AS PostalCode,
cVenAddress AS Address, cVenAddress AS Address,
cVenPhone as ContractPhone,
cVenPerson AS Contract from Vendor "; cVenPerson AS Contract from Vendor ";
if (!string.IsNullOrEmpty(strWhere)) if (!string.IsNullOrEmpty(strWhere))
{ {
@@ -28,5 +29,31 @@ namespace NX.ERP.U8
return conn.Query<Supplier>(sql, null); return conn.Query<Supplier>(sql, null);
} }
} }
public IEnumerable<Supplier> GetList(NX.ERP.Model.Request.Supplier Params)
{
IList<string> where = new List<string>();
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}%"
});
}
} }
} }

View File

@@ -15,8 +15,8 @@ namespace NX.ERP.U8
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 Code, cComunitCode AS UnitCode,
cComUnitName AS Name,bMainUnit as MainUnit, cGroupCode as GroupCode from ComputationUnit "; cComUnitName AS UnitName,bMainUnit as MainUnit, cGroupCode as GroupCode from ComputationUnit ";
if (!string.IsNullOrEmpty(strWhere)) if (!string.IsNullOrEmpty(strWhere))
{ {
sql += $" where {strWhere}"; sql += $" where {strWhere}";
@@ -24,5 +24,29 @@ namespace NX.ERP.U8
return conn.Query<Unit>(sql, null); return conn.Query<Unit>(sql, null);
} }
} }
public IEnumerable<Unit> GetList(NX.ERP.Model.Request.Unit Params)
{
IList<string> where = new List<string>();
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}%"
});
}
} }
} }

View File

@@ -12,6 +12,7 @@ namespace NX.ERP.WebAPi.Controllers
/// <summary> /// <summary>
/// 客户信息 /// 客户信息
/// </summary> /// </summary>
///
public class CustomerController : ApiController public class CustomerController : ApiController
{ {
/// <summary> /// <summary>
@@ -19,14 +20,22 @@ namespace NX.ERP.WebAPi.Controllers
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
// GET api/values // GET api/values
[Route("api/Customer/List")]
[HttpGet] [HttpGet]
public IEnumerable<Model.Customer> List() public IEnumerable<Model.Customer> List()
{ {
var customerDAL = new CustomerDAL(); var customerDAL = new CustomerDAL();
return customerDAL.GetList(); return customerDAL.GetList();
} }
[Route("api/Customer/Query")]
[HttpPost]
public IEnumerable<Model.Customer> Query(NX.ERP.Model.Request.Customer Param)
{
var customerDAL = new CustomerDAL();
return customerDAL.GetList(Param);
}
// GET api/values/5 // GET api/values/5
} }

View File

@@ -10,8 +10,7 @@ namespace NX.ERP.WebAPi.Controllers
{ {
public ActionResult Index() public ActionResult Index()
{ {
ViewBag.Title = "Home Page"; return Redirect("/swagger");
return View();
} }
} }
} }

View File

@@ -10,6 +10,7 @@ namespace NX.ERP.WebAPi.Controllers
{ {
public class SupplierController : ApiController public class SupplierController : ApiController
{ {
[Route("api/Supplier/List")]
[HttpGet] [HttpGet]
public IEnumerable<Supplier> List() public IEnumerable<Supplier> List()
{ {
@@ -17,5 +18,16 @@ namespace NX.ERP.WebAPi.Controllers
return supplierDAL.GetList(); return supplierDAL.GetList();
} }
[Route("api/Supplier/Query")]
[HttpPost]
public IEnumerable<Model.Supplier> Query(NX.ERP.Model.Request.Supplier Param)
{
var customerDAL = new SupplierDAL();
return customerDAL.GetList(Param);
}
} }
} }

View File

@@ -7,8 +7,9 @@ using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers namespace NX.ERP.WebAPi.Controllers
{ {
public class UnitController: ApiController public class UnitController : ApiController
{ {
[Route("api/Unit/List")]
[HttpGet] [HttpGet]
public IEnumerable<Model.Unit> List() public IEnumerable<Model.Unit> List()
{ {
@@ -16,5 +17,15 @@ namespace NX.ERP.WebAPi.Controllers
return supplierDAL.GetList(); return supplierDAL.GetList();
} }
[Route("api/Unit/Query")]
[HttpPost]
public IEnumerable<Model.Unit> Query(NX.ERP.Model.Request.Unit Param)
{
var supplierDAL = new UnitDAL();
return supplierDAL.GetList(Param);
}
} }
} }