修正API

This commit is contained in:
gongxh
2021-05-21 13:06:45 +08:00
parent edae082c51
commit 4abb93fd80
23 changed files with 201 additions and 28 deletions

View File

@@ -67,6 +67,7 @@
<Compile Include="BaseBill.cs" />
<Compile Include="BaseModel.cs" />
<Compile Include="Request\BinChange.cs" />
<Compile Include="Request\Bom.cs" />
<Compile Include="Request\Inventorybu.cs" />
<Compile Include="Request\Inventoryall.cs" />
<Compile Include="Request\MaterialAppProvide.cs" />
@@ -74,6 +75,7 @@
<Compile Include="Request\PoOrderRequest.cs" />
<Compile Include="Request\SnOrderRequest.cs" />
<Compile Include="Request\SaleOrderRequest.cs" />
<Compile Include="Request\Stock.cs" />
<Compile Include="Response\MOM\Bom.cs" />
<Compile Include="Response\Pmc\PmcInventoryallRes.cs" />
<Compile Include="Response\Pmc\PmcInventorymomRes.cs" />

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class Bom
{
// bom_type
//version
//version_desc
//parent_code
public int? BomType { get; set; }
public int? Version { get; set; }
public string VersionDesc { get; set; }
public string ParentCode { get; set; }
}
}

View File

@@ -18,7 +18,9 @@ namespace NX.ERP.Model.Request
public string SpecsModel { get; set; }
public DateTime? ModifyDate { get; set; }
}

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 Stock
{
private string _code;
private string _name;
public string MaterialCode { get => _code; set => _code = value; }
public string MaterialName { get => _name; set => _name = value; }
}
}

View File

@@ -94,6 +94,16 @@ namespace NX.ERP.Model
public DateTime? ModifyDate { get; set; }
public bool IsPurchase { get; set; }
public bool IsSelf { get; set; }
public bool IsSub { get; set; }
//bPurchase,bSelf,IsSub

View File

@@ -13,9 +13,13 @@ namespace NX.ERP.Model.Response.Store
private string binName;
private string _Qty;
private string materialName;
public string MaterialCode { get => materialCode; set => materialCode = value; }
public string BinCode { get => binName; set => binName = value; }
public string Qty { get => _Qty; set => _Qty = value; }
public string MaterialName { get => materialName; set => materialName = value; }
}

View File

@@ -54,8 +54,8 @@ namespace NX.ERP.U8
cReplaceItem AS 替换件,
cPosition AS 货位编码,
bSale AS 是否销售,
bPurchase AS 是否外购,
bSelf AS 是否自制,
bPurchase AS IsPurchase,
bSelf AS IsSelf,
bComsume AS 是否生产耗用,
bProducing AS 是否在制,
bService AS 是否应税劳务,
@@ -325,13 +325,18 @@ namespace NX.ERP.U8
where.Add(" cInvCCode = @MaterialTypeCode ");
}
if (Material.ModifyDate != null)
{
where.Add(" dModifyDate >= @ModifyDate ");
}
return this.GetList(string.Join(" and ", where.ToArray()), new
{
MaterialCode = Material.MaterialCode,
MaterialName = $"%{Material.MaterialName}%",
SpecsModel = Material.SpecsModel,
MaterialTypeCode = Material.MaterialTypeCode
MaterialTypeCode = Material.MaterialTypeCode,
ModifyDate = Material.ModifyDate
}); ;

View File

@@ -54,5 +54,47 @@ namespace NX.ERP.U8.Mom
}
public IEnumerable<NX.ERP.Model.Response.MOM.Bom> GetList(NX.ERP.Model.Request.Bom bom)
{
List<string> where = new List<string>();
if (!string.IsNullOrEmpty(bom.ParentCode))
{
where.Add(" c.InvCode = @ParentCode ");
}
if (!string.IsNullOrEmpty(bom.VersionDesc))
{
where.Add(" a.VersionDesc like @VersionDesc ");
}
if (bom.BomType.HasValue)
{
where.Add(" a.BomType = @BomType ");
}
if (bom.Version.HasValue)
{
where.Add(" a.Version = @Version ");
}
return this.GetList(string.Join(" and ", where.ToArray()), new
{
ParentCode = bom.ParentCode,
VersionDesc =$"%{bom.VersionDesc}%",
BomType = bom.BomType,
Version =bom.Version,
}); ;
}
}
}

View File

@@ -18,7 +18,8 @@ namespace NX.ERP.U8.Store
{
using (var conn = U8LoginContext.Instance.Connection)
{
var sql = @"select cInvCode as MaterialCode ,cPosCode as BinCode,iQuantity as Qty from InvPositionSum where ISNULL(iQuantity,0)<>0";
var sql = @" select a.cInvCode as MaterialCode ,cPosCode as BinCode,iQuantity as Qty,b.cInvName as MaterialName from InvPositionSum as a
left join Inventory as b on a.cInvCode=b.cInvCode where ISNULL(iQuantity,0)<>0";
if (!string.IsNullOrEmpty(strwhere))
{
sql += $" and {strwhere}";
@@ -38,6 +39,34 @@ namespace NX.ERP.U8.Store
}
public IEnumerable<Model.Response.Store.Stock> GetList(NX.ERP.Model.Request.Stock stock)
{
List<string> where = new List<string>();
if (!string.IsNullOrEmpty(stock.MaterialCode))
{
where.Add(" a.cInvCode = @MaterialCode ");
}
if (!string.IsNullOrEmpty(stock.MaterialName))
{
where.Add(" b.cInvName like @MaterialName ");
}
return this.GetList(string.Join(" and ", where.ToArray()), new
{
MaterialCode = stock.MaterialCode,
MaterialName = $"%{stock.MaterialName}%",
}); ;
}
}

View File

@@ -85,7 +85,7 @@ namespace NX.ERP.WebAPi
// });
// Set this flag to omit descriptions for any actions decorated with the Obsolete attribute
c.IgnoreObsoleteActions();
c.IgnoreObsoleteActions();
// Each operation be assigned one or more tags which are then used by consumers for various reasons.
// For example, the swagger-ui groups operations according to the first tag of each operation.

View File

@@ -8,6 +8,7 @@ namespace NX.ERP.WebAPi.Controllers.MOM
{
public class BomController : ApiController
{
[Obsolete]
[Route("api/Bom/List")]
[HttpGet]
@@ -15,5 +16,16 @@ namespace NX.ERP.WebAPi.Controllers.MOM
{
return new NX.ERP.U8.Mom.BomDAL().GetList();
}
[Route("api/Bom/Query")]
[HttpPost]
public IEnumerable<Model.Response.MOM.Bom> GetList(NX.ERP.Model.Request.Bom bom)
{
return new NX.ERP.U8.Mom.BomDAL().GetList(bom);
}
}
}

View File

@@ -9,6 +9,7 @@ namespace NX.ERP.WebAPi.Controllers.MOM
public class MomOrderController : ApiController
{
[Obsolete]
[Route("api/MomOrder/List")]
[HttpGet]
public IEnumerable<Model.MOM.MomOrder> List()
@@ -19,7 +20,7 @@ namespace NX.ERP.WebAPi.Controllers.MOM
}
[Route("api/MomOrder/List")]
[Route("api/MomOrder/Query")]
[HttpPost]
public IEnumerable<Model.MOM.MomOrder> List(NX.ERP.Model.Request.MomOrder momOrder)
{

View File

@@ -10,6 +10,7 @@ namespace NX.ERP.WebAPi.Controllers
{
public class FinanceController : ApiController
{
[Obsolete]
[HttpPost]
[Route("api/Finance/InventorySNDetail")]
public IEnumerable<object> Inventorysocode(NX.ERP.Model.Request.SnOrderRequest info)

View File

@@ -7,9 +7,11 @@ using System.Web;
using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers
{
{
public class PmcController : ApiController
{
[Obsolete]
[HttpPost]
[Route("api/Pmc/Inventoryall")]
public IEnumerable<NX.ERP.Model.PmcInventoryallRes> Inventoryall(NX.ERP.Model.Request.Inventoryall info)
@@ -18,7 +20,7 @@ namespace NX.ERP.WebAPi.Controllers
return dal.GetPmcInventoryallRes(info);
}
[Obsolete]
[HttpPost]
[Route("api/Pmc/Inventorymom")]
public IEnumerable<NX.ERP.Model.PmcInventorymomRes> Inventorymom(NX.ERP.Model.Request.MomOrderRequest info)
@@ -26,7 +28,7 @@ namespace NX.ERP.WebAPi.Controllers
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
return PmcQuery.Inventorymom(info).OrderByDescending(m=> m.Mocode).ThenBy(m => m.SortSeq).ThenBy(m => m.Invcode1);
}
[Obsolete]
[HttpPost]
[Route("api/Pmc/Inventorymonth")]
public IEnumerable<object> Inventorymonth(NX.ERP.Model.Request.Inventoryall info)
@@ -34,7 +36,7 @@ namespace NX.ERP.WebAPi.Controllers
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
return PmcQuery.Inventorymonth(info);
}
[Obsolete]
[HttpPost]
[Route("api/Pmc/Inventorysocode")]
public IEnumerable<object> Inventorysocode(NX.ERP.Model.Request.SaleOrderRequest info)
@@ -42,7 +44,7 @@ namespace NX.ERP.WebAPi.Controllers
var PmcQuery = new NX.ERP.U8.Pmc.PmcQuery();
return PmcQuery.Inventorysocode(info);
}
[Obsolete]
[HttpPost]
[Route("api/Pmc/InventoryPocode")]
public IEnumerable<object> InventoryPo(NX.ERP.Model.Request.PoOrderRequest info)
@@ -51,7 +53,7 @@ namespace NX.ERP.WebAPi.Controllers
return PmcQuery.InventoryPo(info);
}
[Obsolete]
[HttpPost]
[Route("api/Pmc/Inventorybu")]
public IEnumerable<object> Inventorybu(NX.ERP.Model.Request.Inventorybu info)

View File

@@ -11,6 +11,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
/// </summary>
public class BinChangeController : ApiController
{
/// <summary>
///添加货位调整单
@@ -19,7 +20,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
/// <returns></returns>
[Route("api/BinChange/Add")]
[HttpPost]
[Obsolete]
public string AddVoucher([FromBody] Model.Request.BinChange storeIn)
{
var dal = new NX.ERP.U8.Store.BinChangeDAL();

View File

@@ -8,6 +8,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
{
public class MaterialAppController : ApiController
{
[Obsolete]
[Route("api/MaterialApp/List")]
[HttpPost]
@@ -30,7 +31,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
[Obsolete]
[Route("api/MaterialApp/Model")]
[HttpGet]
@@ -41,7 +42,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
}
[Obsolete]
[Route("api/MaterialApp/ListByMoCode")]
[HttpGet]
@@ -51,7 +52,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
return dal.GetListByMoCode(MoCode, MoDetailId);
}
[Obsolete]
[Route("api/MaterialApp/DetailByMoCode")]
[HttpGet]
@@ -61,7 +62,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
return dal.GetDetailByMoCode(MoCode, MoDetailId);
}
[Route("api/MaterialApp/Provide")]
[Route("api/MaterialApp/Plan")]
[HttpPost]
public bool Provide([FromBody]NX.ERP.Model.Request.MaterialAppProvide provide)

View File

@@ -6,10 +6,11 @@ using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers.Store
{
public class MaterialStoreOutController:ApiController
{
[Obsolete]
[Route("api/MaterialOut/Add")]
[HttpPost]
@@ -21,6 +22,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
[Obsolete]
[Route("api/MaterialOut/Update")]
[HttpPost]

View File

@@ -6,7 +6,7 @@ using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers.Store
{
public class OtherStoreInController : ApiController
{
[Obsolete]
@@ -17,6 +17,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
var dal = new NX.ERP.U8.Store.OtherStoreInDAL();
return dal.AddVocher(storeIn);
}
[Obsolete]
[Route("api/OtherIn/Update")]
[HttpPost]
public bool UpdteVoucher([FromBody] Model.Request.OtherStoreInOut storeIn)

View File

@@ -6,7 +6,7 @@ using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers.Store
{
public class OtherStoreOutController : ApiController
{
[Obsolete]
@@ -18,7 +18,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
return dal.AddVocher(storeIn);
}
[Obsolete]
[Route("api/OtherOut/Update")]
[HttpPost]
public bool UpdateVoucher([FromBody] Model.Request.OtherStoreInOut storeIn)

View File

@@ -6,10 +6,10 @@ using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers.Store
{
public class PuStoreInController : ApiController
{
[Obsolete]
[Route("api/PuStoreIn/Add")]
[HttpPost]
public object AddVoucher([FromBody] Model.Request.PuStoreIn storeIn)
@@ -18,7 +18,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
return new { Id = dal.AddVocher(storeIn) };
}
[Obsolete]
[Route("api/PuStoreIn/Update")]
[HttpPost]
public object UpdateVoucher([FromBody] Model.Request.PuStoreIn storeIn)

View File

@@ -6,7 +6,7 @@ using System.Web.Http;
namespace NX.ERP.WebAPi.Controllers.Store
{
public class SaleStoreOutController : ApiController
{
[Obsolete]
@@ -18,7 +18,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
return new { Id = dal.AddVoucher(storeIn) };
}
[Obsolete]
[Route("api/SaleStoreOut/Update")]
[HttpPost]
public bool UpdateVoucher([FromBody] Model.Request.SaleStoreOut storeIn)

View File

@@ -16,11 +16,28 @@ namespace NX.ERP.WebAPi.Controllers.Store
/// </summary>
/// <param name="Code"></param>
/// <returns></returns>
[Obsolete]
[HttpGet]
[Route("api/Stock/GetStock")]
public IEnumerable<Model.Response.Store.Stock> GetList([FromUri]string Code)
{
return new U8.Store.StockDAL().GetListByMaterialCode(Code);
}
/// <summary>
/// 查询库存
/// </summary>
/// <param name="Code"></param>
/// <returns></returns>
[HttpPost]
[Route("api/Stock/Query")]
public IEnumerable<Model.Response.Store.Stock> GetList([FromBody] NX.ERP.Model.Request.Stock stock )
{
return new U8.Store.StockDAL().GetList(stock);
}
}
}

View File

@@ -10,6 +10,7 @@ namespace NX.ERP.WebAPi.Controllers.System
public class SystemController:ApiController
{
[Obsolete]
[HttpPost]
[Route("api/System/Login")]
public string Login(LoginEntity loginEntity)