From 275c9967be951e154e13663a7edafdba6e2676c8 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 18 Jan 2021 11:38:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=B7=E6=A0=BC=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/Response/Base/Materiel.cs | 20 +++++++++ NX.ERP.U8.App/FrmMain.cs | 6 +-- NX.ERP.U8/Base/BinDAL.cs | 6 ++- NX.ERP.U8/Base/MaterielDAL.cs | 56 ++++++++++++++++++++++++-- NX.ERP.U8/Store/ProductInDAL.cs | 3 ++ NX.ERP.WebAPi/NX.ERP.WebAPi.csproj | 5 --- NX.ERP.WebAPi/Web.config | 2 +- 7 files changed, 85 insertions(+), 13 deletions(-) diff --git a/NX.ERP.Model/Response/Base/Materiel.cs b/NX.ERP.Model/Response/Base/Materiel.cs index 174bbfb..da0c544 100644 --- a/NX.ERP.Model/Response/Base/Materiel.cs +++ b/NX.ERP.Model/Response/Base/Materiel.cs @@ -35,5 +35,25 @@ namespace NX.ERP.Model public int MinStock { get => minStock; set => minStock = value; } public int Aql { get => aql; set => aql = value; } public int Invccode { get => invccode; set => invccode = value; } + + + + + + + public double InvNCost { get; set; } + /// + /// 参考成本 + /// + public double InvSPrice { get; set; } + /// + /// 计划单价 + /// + public double InvRCost { get; set; } + + + public double ImpTaxRate { get; set; } + + } } diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index ceb175b..db421b2 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -426,15 +426,15 @@ namespace U8AppMain dal.AddVoucher(new NX.ERP.Model.Store.ProductStoreIn() { Source = "生产订单", - SourceCode = "SCDD210100010", + SourceCode = "SCDD200900013", Date = DateTime.Today, WhCode = "1", Details = new List() { new NX.ERP.Model.Store.ProductStoreInDetail() { Batch="", - InvCode="902009", - SourceDetailId=1000005568, + InvCode="904005", + SourceDetailId=1000003338, Quantity=1, Position="" } diff --git a/NX.ERP.U8/Base/BinDAL.cs b/NX.ERP.U8/Base/BinDAL.cs index 419ee53..0b2f4cd 100644 --- a/NX.ERP.U8/Base/BinDAL.cs +++ b/NX.ERP.U8/Base/BinDAL.cs @@ -10,7 +10,7 @@ namespace NX.ERP.U8.Base { public class BinDAL { - public IEnumerable GetList(string strwhere="",object Params=null) + public IEnumerable 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 GetListByWhCode(string Code) { return this.GetList(" cWhCode=@Code", new { Code }); } + + + } } diff --git a/NX.ERP.U8/Base/MaterielDAL.cs b/NX.ERP.U8/Base/MaterielDAL.cs index 644f1e3..bcd797d 100644 --- a/NX.ERP.U8/Base/MaterielDAL.cs +++ b/NX.ERP.U8/Base/MaterielDAL.cs @@ -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(sql, Param); } } + + + public Materiel GetModel(string Code) + { + return this.GetList(" cInvCode=@Code ", new { Code }).FirstOrDefault(); + } + + + /// + /// 获取成本 + /// + /// + /// + 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(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存货档案价格失败!"); + } + + + } + + } + + } } diff --git a/NX.ERP.U8/Store/ProductInDAL.cs b/NX.ERP.U8/Store/ProductInDAL.cs index 7f3817b..0cafbd0 100644 --- a/NX.ERP.U8/Store/ProductInDAL.cs +++ b/NX.ERP.U8/Store/ProductInDAL.cs @@ -58,6 +58,9 @@ namespace NX.ERP.U8.Store var detail = storeIn.Details[n]; bodyXml.setAttribute("cinvcode", detail.InvCode); bodyXml.setAttribute("iquantity", detail.Quantity); + var _cost = new MaterielDAL().GetCost(detail.InvCode, 0); + bodyXml.setAttribute("iunitcost", _cost); + bodyXml.setAttribute("iprice", new NX.ERP.U8.Account.Accinformation().FormatMoney(_cost * detail.Quantity)); bodyXml.setAttribute("irowno", n + 1); bodyXml.setAttribute("editprop", "A"); bodyXml.setAttribute("cbatch", detail.Batch); diff --git a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj index 65d83e1..120433a 100644 --- a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj +++ b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj @@ -141,11 +141,6 @@ ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll - - - ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll - - diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index 6d8aa25..5d32df1 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -68,7 +68,7 @@ - +