修改
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
<Compile Include="Response\Pmc\PmcInventoryallRes.cs" />
|
||||
<Compile Include="Response\Pmc\PmcInventorymomRes.cs" />
|
||||
<Compile Include="Response\Store\MaterialApp.cs" />
|
||||
<Compile Include="Response\Store\BinStock.cs" />
|
||||
<Compile Include="Response\Store\Stock.cs" />
|
||||
<Compile Include="TimestampConverter.cs" />
|
||||
<Compile Include="Request\Arrival.cs" />
|
||||
|
||||
31
NX.ERP.Model/Response/Store/BinStock.cs
Normal file
31
NX.ERP.Model/Response/Store/BinStock.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NX.ERP.Model.Response.Store
|
||||
{
|
||||
/// <summary>
|
||||
/// 货位库存
|
||||
/// </summary>
|
||||
public class BinStock
|
||||
{
|
||||
//a.cInvCode,a.cPosCode,c.cPosName,(isnull(a.iQuantity,0)-isnull(b.iQuantity,0)) as iQuantity
|
||||
|
||||
private string materialCode;
|
||||
private string binName;
|
||||
private string _Qty;
|
||||
|
||||
private string materialName;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,22 +5,23 @@ using System.Text;
|
||||
|
||||
namespace NX.ERP.Model.Response.Store
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Stock
|
||||
{
|
||||
//a.cInvCode,a.cPosCode,c.cPosName,(isnull(a.iQuantity,0)-isnull(b.iQuantity,0)) as iQuantity
|
||||
|
||||
private string materialCode;
|
||||
private string binName;
|
||||
private string _Qty;
|
||||
|
||||
private string materialName;
|
||||
private decimal stockQty;
|
||||
private decimal arrivalQty;
|
||||
private decimal poQty;
|
||||
|
||||
|
||||
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; }
|
||||
|
||||
|
||||
public string MaterialName { get; set; }
|
||||
public decimal StockQty { get => stockQty; set => stockQty = value; }
|
||||
public decimal ArrivalQty { get => arrivalQty; set => arrivalQty = value; }
|
||||
public decimal PoQty { get => poQty; set => poQty = value; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -257,8 +257,6 @@ namespace NX.ERP.U8.AP
|
||||
try
|
||||
{
|
||||
AddRdVoucher(voucherParameter);
|
||||
|
||||
///处理单号不增加的异常
|
||||
var number = new NX.ERP.U8.VoucherHistory();
|
||||
number.IncNumber("P0", "单据日期", ApVouch.Date.ToString("yyyyMM"));
|
||||
var strsql = "select Auto_ID from AP_ApVouch where cDefine10=@id";
|
||||
@@ -266,10 +264,7 @@ namespace NX.ERP.U8.AP
|
||||
using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection)
|
||||
{
|
||||
code = conn.ExecuteScalar<string>(strsql, new { id }, null, 30, System.Data.CommandType.Text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return code;
|
||||
}
|
||||
catch (Exception err)
|
||||
|
||||
@@ -14,17 +14,17 @@ namespace NX.ERP.U8.Store
|
||||
/// <param name="strwhere"></param>
|
||||
/// <param name="Params"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<Model.Response.Store.Stock> GetList(string strwhere = "", object Params = null)
|
||||
public IEnumerable<Model.Response.Store.BinStock> GetList(string strwhere = "", object Params = null)
|
||||
{
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
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";
|
||||
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}";
|
||||
}
|
||||
return conn.Query<Model.Response.Store.Stock>(sql, Params);
|
||||
return conn.Query<Model.Response.Store.BinStock>(sql, Params);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -32,14 +32,14 @@ left join Inventory as b on a.cInvCode=b.cInvCode where ISNULL(iQuantity,0)<>0";
|
||||
/// </summary>
|
||||
/// <param name="Code"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<Model.Response.Store.Stock> GetListByMaterialCode(string Code)
|
||||
public IEnumerable<Model.Response.Store.BinStock> GetListByMaterialCode(string Code)
|
||||
{
|
||||
return this.GetList(" cInvCode like @Code", new { Code = $"%{Code}%" });
|
||||
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Model.Response.Store.Stock> GetList(NX.ERP.Model.Request.Stock stock)
|
||||
public IEnumerable<Model.Response.Store.BinStock> GetList(NX.ERP.Model.Request.Stock stock)
|
||||
{
|
||||
List<string> where = new List<string>();
|
||||
if (!string.IsNullOrEmpty(stock.MaterialCode))
|
||||
@@ -57,7 +57,7 @@ left join Inventory as b on a.cInvCode=b.cInvCode where ISNULL(iQuantity,0)<>0";
|
||||
{
|
||||
MaterialCode = stock.MaterialCode,
|
||||
MaterialName = $"%{stock.MaterialName}%",
|
||||
|
||||
|
||||
|
||||
}); ;
|
||||
|
||||
@@ -68,6 +68,61 @@ left join Inventory as b on a.cInvCode=b.cInvCode where ISNULL(iQuantity,0)<>0";
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="strwhere"></param>
|
||||
/// <param name="Params"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<Model.Response.Store.Stock> GetStock(string strwhere = "", object Params = null)
|
||||
{
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
var sql = @" select * from (select stock.cInvCode MaterialCode,stock.Qty as StockQty ,arrival.arrivalQty,d.cInvName as MaterialName,d.cInvStd as MaterialSpecsModel from (select cInvCode,SUM( iQuantity) as Qty from CurrentStock
|
||||
group by cInvCode ) as stock
|
||||
left join
|
||||
(select cInvCode,SUM(iQuantity)-SUM(fRealQuantity) as arrivalQty from PU_ArrivalVouchs a,PU_ArrivalVouch b
|
||||
where a.ID=b.ID and isnull(b.cverifier,'')<>'' and bNegative=0
|
||||
group by cInvCode) as arrival on stock.cInvCode=arrival.cInvCode
|
||||
left join Inventory as d on stock.cInvCode=d.cInvCode
|
||||
) as tbl where (StockQty<>0 or arrivalQty<>0)
|
||||
";
|
||||
if (!string.IsNullOrEmpty(strwhere))
|
||||
{
|
||||
sql += $" and {strwhere}";
|
||||
}
|
||||
return conn.Query<Model.Response.Store.Stock>(sql, Params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public IEnumerable<Model.Response.Store.Stock> GetStock(NX.ERP.Model.Request.Stock stock)
|
||||
{
|
||||
List<string> where = new List<string>();
|
||||
if (!string.IsNullOrEmpty(stock.MaterialCode))
|
||||
{
|
||||
where.Add(" cInvCode = @MaterialCode ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(stock.MaterialName))
|
||||
{
|
||||
where.Add(" cInvName like @MaterialName ");
|
||||
}
|
||||
|
||||
return this.GetStock(string.Join(" and ", where.ToArray()), new
|
||||
{
|
||||
MaterialCode = stock.MaterialCode,
|
||||
MaterialName = $"%{stock.MaterialName}%",
|
||||
|
||||
|
||||
}); ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
|
||||
[Obsolete]
|
||||
[HttpGet]
|
||||
[Route("api/Stock/GetStock")]
|
||||
public IEnumerable<Model.Response.Store.Stock> GetList([FromUri]string Code)
|
||||
public IEnumerable<Model.Response.Store.BinStock> GetList([FromUri]string Code)
|
||||
{
|
||||
return new U8.Store.StockDAL().GetListByMaterialCode(Code);
|
||||
}
|
||||
@@ -34,6 +34,15 @@ namespace NX.ERP.WebAPi.Controllers.Store
|
||||
[HttpPost]
|
||||
[Route("api/Stock/Query")]
|
||||
public IEnumerable<Model.Response.Store.Stock> GetList([FromBody] NX.ERP.Model.Request.Stock stock )
|
||||
{
|
||||
return new U8.Store.StockDAL().GetStock(stock);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/Stock/QueryBinStock")]
|
||||
public IEnumerable<Model.Response.Store.BinStock> GetBinList([FromBody] NX.ERP.Model.Request.Stock stock)
|
||||
{
|
||||
return new U8.Store.StockDAL().GetList(stock);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
-->
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="server" value="192.168.1.167" />
|
||||
<add key="AccId" value="002" />
|
||||
<add key="UserId" value="wx995" />
|
||||
<add key="Password" value="1" />
|
||||
<add key="EaiPort" value="80" />
|
||||
<add key="server" value="10.0.0.12" />
|
||||
<add key="AccId" value="u8-2@002" />
|
||||
<add key="UserId" value="wx995" />
|
||||
<add key="Password" value="1" />
|
||||
<add key="EaiPort" value="80" />
|
||||
<add key="EaiPath" value="U8EAI/import.asp" />
|
||||
<add key="webpages:Version" value="3.0.0.0" />
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
|
||||
Reference in New Issue
Block a user