添加基础信息查询的接口

This commit is contained in:
admin
2021-01-19 10:19:10 +08:00
parent caae14f652
commit 7f130871c6
19 changed files with 368 additions and 45 deletions

29
NX.ERP.Model/BaseModel.cs Normal file
View File

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

View File

@@ -60,6 +60,10 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseModel.cs" />
<Compile Include="Request\Bin.cs" />
<Compile Include="Request\Materiel.cs" />
<Compile Include="Request\MaterielType.cs" />
<Compile Include="Request\OtherStoreIn.cs" />
<Compile Include="Request\OtherStoreInDetail.cs" />
<Compile Include="Request\OtherStoreOut.cs" />
@@ -68,6 +72,7 @@
<Compile Include="Request\ProductStoreInDetail.cs" />
<Compile Include="Request\SaleStoreOut.cs" />
<Compile Include="Request\SaleStoreOutDetail.cs" />
<Compile Include="Request\Warehouse.cs" />
<Compile Include="Response\Store\MaterielStoreOut.cs" />
<Compile Include="Response\Store\MaterielStoreOutDetail.cs" />
<Compile Include="Request\PuStoreIn.cs" />

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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; }
/// <summary>
@@ -55,5 +71,6 @@ namespace NX.ERP.Model
public double ImpTaxRate { get; set; }
}
}

View File

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

View File

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

View File

@@ -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<Bin> GetList(NX.ERP.Model.Request.Bin Param)
{
List<string> where = new List<string>();
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}%"
});
}
}

View File

@@ -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<Materiel> GetList(IEnumerable<string> codes)
{
return this.GetList(" cInvCode=@codes ", codes);
}
public IEnumerable<Materiel> GetList(NX.ERP.Model.Request.Materiel materiel)
{
List<string> where = new List<string>();
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
}); ;
}
/// <summary>
/// 获取成本
/// </summary>
@@ -309,7 +355,6 @@ namespace NX.ERP.U8
case "最新成本":
return inv.InvNCost;
default:
{
throw new Exception("取得U8存货档案价格失败!");

View File

@@ -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<MaterielType>(sql, Param);
}
}
public IEnumerable<Model.MaterielType> GetList(NX.ERP.Model.Request.MaterielType materielType)
{
List<string> where = new List<string>();
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
});
}
}
}

View File

@@ -12,10 +12,10 @@ namespace NX.ERP.U8
public IEnumerable<Warehouse> 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<Warehouse>(sql, Param);
}
}
public IEnumerable<Warehouse> GetList(NX.ERP.Model.Request.Warehouse Params)
{
List<string> where = new List<string>();
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}%"
});
}
}
}

View File

@@ -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.

View File

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

View File

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

View File

@@ -9,6 +9,7 @@ namespace NX.ERP.WebAPi.Controllers
{
public class PositionController : ApiController
{
[Route("api/Position/List")]
[HttpGet]
public IEnumerable<Model.Bin> List()
{
@@ -16,11 +17,13 @@ namespace NX.ERP.WebAPi.Controllers
return binDAL.GetList();
}
[HttpGet]
public IEnumerable<Model.Bin> GetList(string Code)
[Route("api/Position/Query")]
[HttpPost]
public IEnumerable<Model.Bin> Query(NX.ERP.Model.Request.Bin Param)
{
var binDAL = new BinDAL();
return binDAL.GetListByWhCode(Code);
return binDAL.GetList(Param);
}

View File

@@ -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<Model.Warehouse> List()
{
var warehouseDAL = new WarehouseDAL();
return warehouseDAL.GetList();
}
[Route("api/Warehouse/Query")]
[HttpPost]
public IEnumerable<Model.Warehouse> List([FromBody] NX.ERP.Model.Request.Warehouse Params)
{
var warehouseDAL = new WarehouseDAL();
return warehouseDAL.GetList(Params);
}
}
}