diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj
index 71a47a3..c3c4118 100644
--- a/NX.ERP.Model/NX.ERP.Model.csproj
+++ b/NX.ERP.Model/NX.ERP.Model.csproj
@@ -86,6 +86,7 @@
+
diff --git a/NX.ERP.Model/Response/Store/BinStock.cs b/NX.ERP.Model/Response/Store/BinStock.cs
new file mode 100644
index 0000000..ec50e8b
--- /dev/null
+++ b/NX.ERP.Model/Response/Store/BinStock.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NX.ERP.Model.Response.Store
+{
+ ///
+ /// 货位库存
+ ///
+ 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;
+
+ ///
+ ///
+ ///
+ 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; }
+ }
+
+
+}
diff --git a/NX.ERP.Model/Response/Store/Stock.cs b/NX.ERP.Model/Response/Store/Stock.cs
index 8fe8bc0..71c9244 100644
--- a/NX.ERP.Model/Response/Store/Stock.cs
+++ b/NX.ERP.Model/Response/Store/Stock.cs
@@ -5,22 +5,23 @@ using System.Text;
namespace NX.ERP.Model.Response.Store
{
+ ///
+ ///
+ ///
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; }
}
-
-
}
diff --git a/NX.ERP.U8/AP/APVouch.cs b/NX.ERP.U8/AP/APVouch.cs
index 1e1cca5..06e2416 100644
--- a/NX.ERP.U8/AP/APVouch.cs
+++ b/NX.ERP.U8/AP/APVouch.cs
@@ -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(strsql, new { id }, null, 30, System.Data.CommandType.Text);
-
}
-
-
return code;
}
catch (Exception err)
diff --git a/NX.ERP.U8/Store/StockDAL.cs b/NX.ERP.U8/Store/StockDAL.cs
index 102c5d7..7546b3f 100644
--- a/NX.ERP.U8/Store/StockDAL.cs
+++ b/NX.ERP.U8/Store/StockDAL.cs
@@ -14,17 +14,17 @@ namespace NX.ERP.U8.Store
///
///
///
- public IEnumerable GetList(string strwhere = "", object Params = null)
+ public IEnumerable 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(sql, Params);
+ return conn.Query(sql, Params);
}
}
///
@@ -32,14 +32,14 @@ left join Inventory as b on a.cInvCode=b.cInvCode where ISNULL(iQuantity,0)<>0";
///
///
///
- public IEnumerable GetListByMaterialCode(string Code)
+ public IEnumerable GetListByMaterialCode(string Code)
{
return this.GetList(" cInvCode like @Code", new { Code = $"%{Code}%" });
}
- public IEnumerable GetList(NX.ERP.Model.Request.Stock stock)
+ public IEnumerable GetList(NX.ERP.Model.Request.Stock stock)
{
List where = new List();
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";
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IEnumerable 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(sql, Params);
+ }
+ }
+
+
+
+
+ public IEnumerable GetStock(NX.ERP.Model.Request.Stock stock)
+ {
+ List where = new List();
+ 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}%",
+
+
+ }); ;
+
+
+
+ }
+
}
}
diff --git a/NX.ERP.WebAPi/Controllers/Store/StockController.cs b/NX.ERP.WebAPi/Controllers/Store/StockController.cs
index dc3ebe8..2bcdbae 100644
--- a/NX.ERP.WebAPi/Controllers/Store/StockController.cs
+++ b/NX.ERP.WebAPi/Controllers/Store/StockController.cs
@@ -19,7 +19,7 @@ namespace NX.ERP.WebAPi.Controllers.Store
[Obsolete]
[HttpGet]
[Route("api/Stock/GetStock")]
- public IEnumerable GetList([FromUri]string Code)
+ public IEnumerable 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 GetList([FromBody] NX.ERP.Model.Request.Stock stock )
+ {
+ return new U8.Store.StockDAL().GetStock(stock);
+ }
+
+
+
+ [HttpPost]
+ [Route("api/Stock/QueryBinStock")]
+ public IEnumerable GetBinList([FromBody] NX.ERP.Model.Request.Stock stock)
{
return new U8.Store.StockDAL().GetList(stock);
}
diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config
index c9855bd..6d7a37b 100644
--- a/NX.ERP.WebAPi/Web.config
+++ b/NX.ERP.WebAPi/Web.config
@@ -5,11 +5,11 @@
-->
-
-
-
-
-
+
+
+
+
+