增加价格
This commit is contained in:
@@ -7,16 +7,28 @@ using NX.ERP.Model;
|
|||||||
|
|
||||||
namespace NX.ERP.U8
|
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 class MaterialDAL
|
||||||
{
|
{
|
||||||
public IEnumerable<Material> GetList(string strWhere = "", object Param = null)
|
public IEnumerable<Material> GetList(string strWhere = "", object Param = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using (var conn = U8LoginContext.Instance.Connection)
|
using (var conn = U8LoginContext.Instance.Connection)
|
||||||
{
|
{
|
||||||
|
|
||||||
var sql = @"select
|
var sql = @"select
|
||||||
cInvCode AS MaterialCode ,
|
cInvCode AS MaterialCode ,
|
||||||
cInvAddCode AS 存货代码,
|
cInvAddCode AS 存货代码,
|
||||||
@@ -283,7 +295,7 @@ namespace NX.ERP.U8
|
|||||||
|
|
||||||
public IEnumerable<Material> GetList(IEnumerable<string> codes)
|
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>
|
||||||
/// 获取成本
|
/// 获取成本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ namespace NX.ERP.U8.Store
|
|||||||
|
|
||||||
headXml.setAttribute("cwhcode", storeOut.Whcode);
|
headXml.setAttribute("cwhcode", storeOut.Whcode);
|
||||||
headXml.setAttribute("csource", storeOut.Source);
|
headXml.setAttribute("csource", storeOut.Source);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (storeOut.Source == "生产订单")
|
if (storeOut.Source == "生产订单")
|
||||||
{
|
{
|
||||||
headXml.setAttribute("cbustype", "领料");
|
headXml.setAttribute("cbustype", "领料");
|
||||||
@@ -104,6 +108,17 @@ namespace NX.ERP.U8.Store
|
|||||||
#region 明细
|
#region 明细
|
||||||
|
|
||||||
bodyXml = domBody.createElement("z:row");
|
bodyXml = domBody.createElement("z:row");
|
||||||
|
var metail = new NX.ERP.U8.MaterialDAL().GetInvPrice(detail.InvCode, 1, storeOut.Whcode, out var _cost);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bodyXml.setAttribute("iunitcost", _cost);
|
||||||
|
var info = new Account.Accinformation();
|
||||||
|
bodyXml.setAttribute("iprice", info.FormatMoney(_cost * detail.Quantity));
|
||||||
|
|
||||||
|
|
||||||
//bodyXml.setAttribute("autoid", n);
|
//bodyXml.setAttribute("autoid", n);
|
||||||
bodyXml.setAttribute("cinvcode", detail.InvCode);
|
bodyXml.setAttribute("cinvcode", detail.InvCode);
|
||||||
bodyXml.setAttribute("iquantity", detail.Quantity);
|
bodyXml.setAttribute("iquantity", detail.Quantity);
|
||||||
@@ -216,7 +231,17 @@ namespace NX.ERP.U8.Store
|
|||||||
}
|
}
|
||||||
#region 明细
|
#region 明细
|
||||||
|
|
||||||
bodyXml = domBody.createElement("z:row"); //bodyXml.setAttribute("autoid", n);
|
bodyXml = domBody.createElement("z:row");
|
||||||
|
var metail = new NX.ERP.U8.MaterialDAL().GetInvPrice(detail.InvCode, 1, storeOut.Whcode, out var _cost);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bodyXml.setAttribute("iunitcost", _cost);
|
||||||
|
var info = new Account.Accinformation();
|
||||||
|
bodyXml.setAttribute("iprice", info.FormatMoney(_cost * detail.Quantity));
|
||||||
|
|
||||||
bodyXml.setAttribute("cinvcode", detail.InvCode);
|
bodyXml.setAttribute("cinvcode", detail.InvCode);
|
||||||
bodyXml.setAttribute("iquantity", detail.Quantity);
|
bodyXml.setAttribute("iquantity", detail.Quantity);
|
||||||
bodyXml.setAttribute("irowno", n + 1);
|
bodyXml.setAttribute("irowno", n + 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user