增加价格
This commit is contained in:
@@ -7,16 +7,28 @@ using NX.ERP.Model;
|
||||
|
||||
namespace NX.ERP.U8
|
||||
{
|
||||
|
||||
|
||||
public class InvCost
|
||||
{
|
||||
|
||||
public double iInvNCost { get; set; }
|
||||
public double iInvSPrice { get; set; }
|
||||
public double iInvRCost { get; set; }
|
||||
public double iImpTaxRate { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class MaterialDAL
|
||||
{
|
||||
public IEnumerable<Material> GetList(string strWhere = "", object Param = null)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
|
||||
|
||||
var sql = @"select
|
||||
cInvCode AS MaterialCode ,
|
||||
cInvAddCode AS 存货代码,
|
||||
@@ -283,7 +295,7 @@ namespace NX.ERP.U8
|
||||
|
||||
public IEnumerable<Material> GetList(IEnumerable<string> codes)
|
||||
{
|
||||
return this.GetList(" cInvCode in @codes ",new { codes });
|
||||
return this.GetList(" cInvCode in @codes ", new { codes });
|
||||
}
|
||||
|
||||
|
||||
@@ -327,6 +339,75 @@ namespace NX.ERP.U8
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取库存单价
|
||||
/// </summary>
|
||||
/// <param name="cInvCode"></param>
|
||||
/// <param name="iInout"></param>
|
||||
/// <param name="iInvCost"></param>
|
||||
/// <param name="iImpTaxRate"></param>
|
||||
/// <returns></returns>
|
||||
public bool GetInvPrice(string cInvCode, int iInout, string whCode, out double iInvCost)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string empty = string.Empty;
|
||||
empty = ((iInout != 0) ? "cOutPrice" : "cInPrice");
|
||||
string strSQL = "SELECT cValue FROM Accinformation WITH(NOLOCK) WHERE cSysID = 'ST' AND cName = '" + empty + "'";
|
||||
string cType;
|
||||
InvCost cost;
|
||||
double _cost;
|
||||
using (var conn = U8LoginContext.Instance.Connection)
|
||||
{
|
||||
cType = conn.ExecuteScalar<string>(strSQL, null, null, 10, System.Data.CommandType.Text);
|
||||
strSQL = "SELECT iInvNCost,iInvSPrice,iInvRCost,iImpTaxRate FROM Inventory WITH(NOLOCK) WHERE cInvCode = '" + cInvCode + "'";
|
||||
cost = conn.Query<InvCost>(strSQL, null).FirstOrDefault();
|
||||
|
||||
strSQL = $@" SELECT (CASE WHEN convert(decimal(36,3),isnull(inum,0))=0 then 0 else iMoney / iNum END) AS iPrice
|
||||
from IA_Summary WHERE cWhCode='{whCode}' AND cInvCode='{cInvCode}' AND iMonth={DateTime.Today.Month - 1} and iyear ={DateTime.Today.Year}";
|
||||
_cost = conn.ExecuteScalar<double>(strSQL, null, null, 10, System.Data.CommandType.Text);
|
||||
}
|
||||
|
||||
switch (cType)
|
||||
{
|
||||
case "按计价方式取单价":
|
||||
iInvCost = _cost;
|
||||
break;
|
||||
case "计划单价":
|
||||
|
||||
iInvCost = cost.iInvRCost;
|
||||
break;
|
||||
case "参考成本":
|
||||
iInvCost = cost.iInvSPrice;
|
||||
break;
|
||||
|
||||
case "最新成本":
|
||||
iInvCost = cost.iInvNCost;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
throw new Exception("取得U8存货档案价格失败!");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取成本
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user