添加价格获取

This commit is contained in:
admin
2021-01-18 11:38:02 +08:00
parent 2b7346b4b1
commit 275c9967be
7 changed files with 85 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ namespace NX.ERP.U8.Base
{
public class BinDAL
{
public IEnumerable<Bin> GetList(string strwhere="",object Params=null)
public IEnumerable<Bin> GetList(string strwhere = "", object Params = null)
{
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{
@@ -24,10 +24,14 @@ namespace NX.ERP.U8.Base
}
}
public IEnumerable<Bin> GetListByWhCode(string Code)
{
return this.GetList(" cWhCode=@Code", new { Code });
}
}
}

View File

@@ -47,10 +47,10 @@ namespace NX.ERP.U8
bService AS 是否应税劳务,
bAccessary AS 是否成套件,
iTaxRate AS 税率,
iInvRCost AS 计划价或售价,
iInvSPrice AS 参考成本,
iInvRCost AS InvRCost,
iInvSPrice AS InvSPrice,
iInvLSCost AS 最低售价,
iInvNCost AS 最新成本,
iInvNCost AS InvNCost,
iInvAdvance AS 提前期,
iInvBatch AS 经济批量,
iOverStock AS 积压标准,
@@ -271,5 +271,55 @@ namespace NX.ERP.U8
return conn.Query<Materiel>(sql, Param);
}
}
public Materiel GetModel(string Code)
{
return this.GetList(" cInvCode=@Code ", new { Code }).FirstOrDefault();
}
/// <summary>
/// 获取成本
/// </summary>
/// <param name="invCode"></param>
/// <returns></returns>
public double GetCost(string invCode, int iInout)
{
var empty = (iInout != 0) ? "cOutPrice" : "cInPrice";
string strSQL = "SELECT cValue FROM Accinformation WITH(NOLOCK) WHERE cSysID = 'ST' AND cName = '" + empty + "'";
string cType;
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{
cType = conn.ExecuteScalar<string>(strSQL, null, null, 10, System.Data.CommandType.Text);
}
var inv = this.GetModel(invCode);
switch (cType)
{
case "按计价方式取单价":
return 0;
case "计划单价":
return inv.InvRCost;
case "参考成本":
return inv.InvSPrice;
case "最新成本":
return inv.InvNCost;
default:
{
throw new Exception("取得U8存货档案价格失败!");
}
}
}
}
}