diff --git a/NX.ERP.Model/BaseModel.cs b/NX.ERP.Model/BaseModel.cs new file mode 100644 index 0000000..ee95e34 --- /dev/null +++ b/NX.ERP.Model/BaseModel.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model +{ + public class BaseModel + { + private string remark1; + private string remark2; + private string remark3; + private string remark4; + private string remark5; + + public string Remark1 { get => remark1; set => remark1 = value; } + public string Remark2 { get => remark2; set => remark2 = value; } + public string Remark3 { get => remark3; set => remark3 = value; } + public string Remark4 { get => remark4; set => remark4 = value; } + public string Remark5 { get => remark5; set => remark5 = value; } + + // remark1 + //remark2 + //remark3 + //remark4 + //remark5 + + } +} diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index c18bb5e..b3130ac 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -60,6 +60,10 @@ + + + + @@ -68,6 +72,7 @@ + diff --git a/NX.ERP.Model/Request/Bin.cs b/NX.ERP.Model/Request/Bin.cs new file mode 100644 index 0000000..02276c3 --- /dev/null +++ b/NX.ERP.Model/Request/Bin.cs @@ -0,0 +1,35 @@ +using NX.ERP.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class Bin : BaseModel + { + + + // warehouse_code + //region_code + //bin_code + + private string _BinCode; + private string _BinName; + + private string _cBarCode; + + + + + public string BinCode { get => _BinCode; set => _BinCode = value; } + + + public string RegionCode { get; set; } + + public string WarehouseCode { get; set; } + + + + } +} diff --git a/NX.ERP.Model/Request/Materiel.cs b/NX.ERP.Model/Request/Materiel.cs new file mode 100644 index 0000000..4e6ed9d --- /dev/null +++ b/NX.ERP.Model/Request/Materiel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class Materiel + { + private string _code; + private string _name; + + public string MaterielCode { get => _code; set => _code = value; } + public string MaterielName { get => _name; set => _name = value; } + + + public string MaterielTypeCode { get; set; } + + public string SpecsModel { get; set; } + + + + + } +} diff --git a/NX.ERP.Model/Request/MaterielType.cs b/NX.ERP.Model/Request/MaterielType.cs new file mode 100644 index 0000000..361ef8f --- /dev/null +++ b/NX.ERP.Model/Request/MaterielType.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class MaterielType: BaseModel + { + private string materielTypeCode; + private string materielTypeName; + private int? _level; + private int? _isEnd; + + public string MaterielTypeCode { get => materielTypeCode; set => materielTypeCode = value; } + public string MaterielTypeName { get => materielTypeName; set => materielTypeName = value; } + public int? Level { get => _level; set => _level = value; } + public int? IsEnd { get => _isEnd; set => _isEnd = value; } + } +} diff --git a/NX.ERP.Model/Request/Warehouse.cs b/NX.ERP.Model/Request/Warehouse.cs new file mode 100644 index 0000000..e1cb2dd --- /dev/null +++ b/NX.ERP.Model/Request/Warehouse.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + public class Warehouse : BaseModel + { + private string warehouse_code; + private string warehouse_name; + + public string WarehouseCode { get => warehouse_code; set => warehouse_code = value; } + public string WarehouseName { get => warehouse_name; set => warehouse_name = value; } + } +} diff --git a/NX.ERP.Model/Response/Base/Bin.cs b/NX.ERP.Model/Response/Base/Bin.cs index a0eb51d..d1a891e 100644 --- a/NX.ERP.Model/Response/Base/Bin.cs +++ b/NX.ERP.Model/Response/Base/Bin.cs @@ -5,26 +5,24 @@ using System.Text; namespace NX.ERP.Model { - public class Bin + public class Bin:BaseModel { private string _BinCode; private string _BinName; - private string _IsPosGrade; - private bool _bPosEnd; - private string _WarehouseCode; - private int _VolumeLimit; - private int _WeightLimit; - private string _cMemo; + private string _cBarCode; - public string Code { get => _BinCode; set => _BinCode = value; } - public string Name { get => _BinName; set => _BinName = value; } - public string IsPosGrade { get => _IsPosGrade; set => _IsPosGrade = value; } - public bool BPosEnd { get => _bPosEnd; set => _bPosEnd = value; } - public string WhCode { get => _WarehouseCode; set => _WarehouseCode = value; } - public int VolumeLimit { get => _VolumeLimit; set => _VolumeLimit = value; } - public int WeightLimit { get => _WeightLimit; set => _WeightLimit = value; } - public string CMemo { get => _cMemo; set => _cMemo = value; } - public string CBarCode { get => _cBarCode; set => _cBarCode = value; } + + + + public string BinCode { get => _BinCode; set => _BinCode = value; } + public string BinName { get => _BinName; set => _BinName = value; } + + public string RegionCode { get; set; } + + public string WarehouseCode { get; set; } + + + public string BarCode { get => _cBarCode; set => _cBarCode = value; } } } diff --git a/NX.ERP.Model/Response/Base/Materiel.cs b/NX.ERP.Model/Response/Base/Materiel.cs index da0c544..3c30041 100644 --- a/NX.ERP.Model/Response/Base/Materiel.cs +++ b/NX.ERP.Model/Response/Base/Materiel.cs @@ -16,30 +16,46 @@ namespace NX.ERP.Model private int weight; private double unitPrice; private string unitCode; - private string specsModel; + private int maxStock; private int minStock; private int aql; private int invccode; - public string Code { get => _code; set => _code = value; } - public string Name { get => _name; set => _name = value; } + public string MaterielCode { get => _code; set => _code = value; } + public string MaterielName { get => _name; set => _name = value; } + + + public string MaterielTypeCode { get; set; } + + public string SpecsModel { get; set; } + + public string UnitCode { get => unitCode; set => unitCode = value; } + + + public int MinPackageQty { get; set; } + + public int TaxRate { get; set; } + public decimal Length { get => length; set => length = value; } public decimal Wide { get => wide; set => wide = value; } public decimal Height { get => height; set => height = value; } public int Volume { get => volume; set => volume = value; } public int Weight { get => weight; set => weight = value; } public double UnitPrice { get => unitPrice; set => unitPrice = value; } - public string UnitCode { get => unitCode; set => unitCode = value; } - public string SpecsModel { get => specsModel; set => specsModel = value; } + + public int MaxStock { get => maxStock; set => maxStock = value; } public int MinStock { get => minStock; set => minStock = value; } + + + public int Aql { get => aql; set => aql = value; } - public int Invccode { get => invccode; set => invccode = value; } + + + - - public double InvNCost { get; set; } /// @@ -55,5 +71,6 @@ namespace NX.ERP.Model public double ImpTaxRate { get; set; } + } } diff --git a/NX.ERP.Model/Response/Base/MaterielType.cs b/NX.ERP.Model/Response/Base/MaterielType.cs index f666165..52da440 100644 --- a/NX.ERP.Model/Response/Base/MaterielType.cs +++ b/NX.ERP.Model/Response/Base/MaterielType.cs @@ -5,12 +5,16 @@ using System.Text; namespace NX.ERP.Model { - public class MaterielType + public class MaterielType: BaseModel { private string materielTypeCode; private string materielTypeName; + private int _level; + private bool _isEnd; - public string Code { get => materielTypeCode; set => materielTypeCode = value; } - public string Name { get => materielTypeName; set => materielTypeName = value; } + public string MaterielTypeCode { get => materielTypeCode; set => materielTypeCode = value; } + public string MaterielTypeName { get => materielTypeName; set => materielTypeName = value; } + public int Level { get => _level; set => _level = value; } + public bool IsEnd { get => _isEnd; set => _isEnd = value; } } } diff --git a/NX.ERP.Model/Response/Base/Warehouse.cs b/NX.ERP.Model/Response/Base/Warehouse.cs index 7ccdb8f..16526e6 100644 --- a/NX.ERP.Model/Response/Base/Warehouse.cs +++ b/NX.ERP.Model/Response/Base/Warehouse.cs @@ -5,12 +5,12 @@ using System.Text; namespace NX.ERP.Model { - public class Warehouse + public class Warehouse: BaseModel { private string _WarehouseCode; private string _WarehouseName; - public string Code { get => _WarehouseCode; set => _WarehouseCode = value; } - public string Name { get => _WarehouseName; set => _WarehouseName = value; } + public string WarehouseCode { get => _WarehouseCode; set => _WarehouseCode = value; } + public string WarehouseName { get => _WarehouseName; set => _WarehouseName = value; } } } diff --git a/NX.ERP.U8/Base/BinDAL.cs b/NX.ERP.U8/Base/BinDAL.cs index 0b2f4cd..6756eed 100644 --- a/NX.ERP.U8/Base/BinDAL.cs +++ b/NX.ERP.U8/Base/BinDAL.cs @@ -14,7 +14,7 @@ namespace NX.ERP.U8.Base { using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { - var sql = @"select cPosCode as Code,cPosName as Name,iPosGrade,bPosEnd,cWhCode as WhCode, + var sql = @"select cPosCode as BinCode,cPosName as BinName,iPosGrade,bPosEnd,cWhCode as WarehouseCode, iMaxCubage as VolumeLimit, iMaxweight as WeightLimit,cMemo,cBarCode from Position"; if (!string.IsNullOrEmpty(strwhere)) { @@ -30,7 +30,35 @@ namespace NX.ERP.U8.Base { return this.GetList(" cWhCode=@Code", new { Code }); } - + + + public IEnumerable GetList(NX.ERP.Model.Request.Bin Param) + { + List where = new List(); + + if (!string.IsNullOrEmpty(Param.BinCode)) + { + where.Add(" cPosCode like @BinCode"); + } + + + if (!string.IsNullOrEmpty(Param.WarehouseCode)) + { + where.Add(" cWhCode like @WarehouseCode"); + } + + return this.GetList(string.Join(" and ", where.ToArray()), new + { + BinCode = $"%{Param.BinCode}%", + WarehouseCode=$"%{Param.WarehouseCode}%" + + }); + + + + } + + } diff --git a/NX.ERP.U8/Base/MaterielDAL.cs b/NX.ERP.U8/Base/MaterielDAL.cs index bcd797d..967aaf6 100644 --- a/NX.ERP.U8/Base/MaterielDAL.cs +++ b/NX.ERP.U8/Base/MaterielDAL.cs @@ -16,9 +16,9 @@ namespace NX.ERP.U8 using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { var sql = @"select - cInvCode AS Code , + cInvCode AS MaterielCode , cInvAddCode AS 存货代码, - cInvName AS Name , + cInvName AS MaterielName , fLength AS Length, fWidth AS Wide, fHeight AS Height, @@ -36,7 +36,7 @@ namespace NX.ERP.U8 iMassDate AS 保质期数, cMassUnit AS 保质期单位, iWarnDays AS 保质期预警天数, - cInvCCode AS InvCCode, + cInvCCode AS MaterielTypeCode, cReplaceItem AS 替换件, cPosition AS 货位编码, bSale AS 是否销售, @@ -46,7 +46,7 @@ namespace NX.ERP.U8 bProducing AS 是否在制, bService AS 是否应税劳务, bAccessary AS 是否成套件, - iTaxRate AS 税率, + iTaxRate AS TaxRate, iInvRCost AS InvRCost, iInvSPrice AS InvSPrice, iInvLSCost AS 最低售价, @@ -279,6 +279,52 @@ namespace NX.ERP.U8 } + public IEnumerable GetList(IEnumerable codes) + { + return this.GetList(" cInvCode=@codes ", codes); + } + + + + public IEnumerable GetList(NX.ERP.Model.Request.Materiel materiel) + { + List where = new List(); + if (!string.IsNullOrEmpty(materiel.MaterielCode)) + { + where.Add(" cInvCode like @MaterielCode "); + } + + if (!string.IsNullOrEmpty(materiel.MaterielName)) + { + where.Add(" cInvName like @MaterielName "); + } + + if (!string.IsNullOrEmpty(materiel.SpecsModel)) + { + where.Add(" cInvStd like @SpecsModel "); + } + + + + if (!string.IsNullOrEmpty(materiel.MaterielTypeCode)) + { + where.Add(" cInvCCode = @MaterielTypeCode "); + } + + + return this.GetList(string.Join(" and ", where.ToArray()), new + { + MaterielCode = $"%{materiel.MaterielCode}%", + MaterielName = $"%{materiel.MaterielName}%", + SpecsModel = materiel.SpecsModel, + MaterielTypeCode = materiel.MaterielTypeCode + + }); ; + + } + + + /// /// 获取成本 /// @@ -309,7 +355,6 @@ namespace NX.ERP.U8 case "最新成本": return inv.InvNCost; - default: { throw new Exception("取得U8存货档案价格失败!"); diff --git a/NX.ERP.U8/Base/MaterielTypeDAL.cs b/NX.ERP.U8/Base/MaterielTypeDAL.cs index d6d6239..a73b9b8 100644 --- a/NX.ERP.U8/Base/MaterielTypeDAL.cs +++ b/NX.ERP.U8/Base/MaterielTypeDAL.cs @@ -13,7 +13,7 @@ namespace NX.ERP.U8 { using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { - var sql = @"select cInvCCode AS Code,cInvCName AS Name from InventoryClass "; + var sql = @"select cInvCCode AS MaterielTypeCode,cInvCName AS MaterielTypeName,bInvCEnd as IsEnd,iInvCGrade as Level from InventoryClass "; if (!string.IsNullOrEmpty(strWhere)) { sql += $" where {strWhere}"; @@ -21,5 +21,42 @@ namespace NX.ERP.U8 return conn.Query(sql, Param); } } + + + public IEnumerable GetList(NX.ERP.Model.Request.MaterielType materielType) + { + List where = new List(); + if (!string.IsNullOrEmpty(materielType.MaterielTypeCode)) + { + where.Add(" cInvCCode like @MaterielTypeCode "); + } + + if (!string.IsNullOrEmpty(materielType.MaterielTypeName)) + { + where.Add(" cInvCName like @MaterielTypeName "); + } + + if (materielType.Level.HasValue) + { + where.Add(" iInvCGrade=@Level "); + } + + if (materielType.IsEnd.HasValue) + { + where.Add(" bInvCEnd=@IsEnd "); + } + return this.GetList(string.Join(" and ", where.ToArray()), new + { + MaterielTypeCode=$"%{materielType.MaterielTypeCode}%", + MaterielTypeName=$"%{materielType.MaterielTypeName}%", + materielType.Level, + materielType.IsEnd + }); + + } + + } + + } diff --git a/NX.ERP.U8/Base/WarehouseDAL.cs b/NX.ERP.U8/Base/WarehouseDAL.cs index 3d4d4ee..efd02fa 100644 --- a/NX.ERP.U8/Base/WarehouseDAL.cs +++ b/NX.ERP.U8/Base/WarehouseDAL.cs @@ -12,10 +12,10 @@ namespace NX.ERP.U8 public IEnumerable GetList(string strWhere = "", object Param = null) { - + using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { - var sql = "select cWhCode as Code,cWhName as Name from Warehouse"; + var sql = "select cWhCode as WarehouseCode,cWhName as WarehouseName from Warehouse"; if (!string.IsNullOrEmpty(strWhere)) { sql += $" where {strWhere}"; @@ -23,5 +23,33 @@ namespace NX.ERP.U8 return conn.Query(sql, Param); } } + public IEnumerable GetList(NX.ERP.Model.Request.Warehouse Params) + { + + List where = new List(); + + + if (!string.IsNullOrEmpty(Params.WarehouseCode)) + { + where.Add(" cWhCode like @WarehouseCode"); + + } + if (!string.IsNullOrEmpty(Params.WarehouseName)) + { + where.Add(" cWhName like @WarehouseName"); + + } + + return this.GetList(string.Join(" and ", where.ToArray()), new + { + WarehouseCode = $"%{Params.WarehouseCode}%", + WarehouseName = $"%{Params.WarehouseName}%" + }); + + } + + + + } } diff --git a/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs b/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs index 65499b7..fd5e64f 100644 --- a/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs +++ b/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs @@ -127,7 +127,7 @@ namespace NX.ERP.WebAPi // Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll // need to opt out of this behavior to avoid Schema Id conflicts. // - //c.UseFullTypeNameInSchemaIds(); + c.UseFullTypeNameInSchemaIds(); // Alternatively, you can provide your own custom strategy for inferring SchemaId's for // describing "complex" types in your API. diff --git a/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs b/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs index 116df17..53f882b 100644 --- a/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs @@ -10,6 +10,7 @@ namespace NX.ERP.WebAPi.Controllers { public class MaterielController : ApiController { + [Route("api/Materiel/List")] [HttpGet] public IEnumerable List() { @@ -17,5 +18,15 @@ namespace NX.ERP.WebAPi.Controllers return materielDAL.GetList(); } + [Route("api/Materiel/Query")] + [HttpPost] + public IEnumerable Query(NX.ERP.Model.Request.Materiel Param) + { + var materielDAL = new MaterielDAL(); + return materielDAL.GetList(Param); + + } + + } } \ No newline at end of file diff --git a/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs b/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs index 10c1a99..a58919a 100644 --- a/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs @@ -10,6 +10,7 @@ namespace NX.ERP.WebAPi.Controllers { public class MaterielTypeController:ApiController { + [Route("api/MaterielType/List")] [HttpGet] public IEnumerable List() { @@ -17,5 +18,15 @@ namespace NX.ERP.WebAPi.Controllers return materielType.GetList(); } + [Route("api/MaterielType/Query")] + [HttpPost] + public IEnumerable Query(NX.ERP.Model.Request.MaterielType Param) + { + var materielType = new MaterielTypeDAL(); + return materielType.GetList(Param); + + } + + } } \ No newline at end of file diff --git a/NX.ERP.WebAPi/Controllers/Base/PositionController.cs b/NX.ERP.WebAPi/Controllers/Base/PositionController.cs index 3b02d3e..84522de 100644 --- a/NX.ERP.WebAPi/Controllers/Base/PositionController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/PositionController.cs @@ -9,6 +9,7 @@ namespace NX.ERP.WebAPi.Controllers { public class PositionController : ApiController { + [Route("api/Position/List")] [HttpGet] public IEnumerable List() { @@ -16,11 +17,13 @@ namespace NX.ERP.WebAPi.Controllers return binDAL.GetList(); } - [HttpGet] - public IEnumerable GetList(string Code) + + [Route("api/Position/Query")] + [HttpPost] + public IEnumerable Query(NX.ERP.Model.Request.Bin Param) { var binDAL = new BinDAL(); - return binDAL.GetListByWhCode(Code); + return binDAL.GetList(Param); } diff --git a/NX.ERP.WebAPi/Controllers/Base/WarehouseController.cs b/NX.ERP.WebAPi/Controllers/Base/WarehouseController.cs index 851c632..ca48f7d 100644 --- a/NX.ERP.WebAPi/Controllers/Base/WarehouseController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/WarehouseController.cs @@ -7,13 +7,24 @@ using System.Web.Http; namespace NX.ERP.WebAPi.Controllers { - public class WarehouseController:ApiController + public class WarehouseController : ApiController { + [Route("api/Warehouse/List")] [HttpGet] public IEnumerable List() { var warehouseDAL = new WarehouseDAL(); return warehouseDAL.GetList(); } + [Route("api/Warehouse/Query")] + [HttpPost] + public IEnumerable List([FromBody] NX.ERP.Model.Request.Warehouse Params) + { + var warehouseDAL = new WarehouseDAL(); + return warehouseDAL.GetList(Params); + } + + + } } \ No newline at end of file