From fd3fc7af4ca21a7ed936ef33dfb0d1323122f5af Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 7 Jan 2021 17:01:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.Model/Purchase/Arrival.cs | 2 +- NX.ERP.Model/Purchase/ArrivalDetail.cs | 8 ++ NX.ERP.Model/Store/PuStoreInDetail.cs | 4 +- NX.ERP.U8.App/FrmMain.cs | 8 +- NX.ERP.U8/Account/Accinformation.cs | 166 +++++++++++++++++++++++++ NX.ERP.U8/NX.ERP.U8.csproj | 1 + NX.ERP.U8/Purchase/ArrivalDAL.cs | 2 +- NX.ERP.U8/Store/PuStoreInDAL.cs | 28 ++++- NX.ERP.U8/U8LoginContext.cs | 72 ++++++++--- 9 files changed, 263 insertions(+), 28 deletions(-) create mode 100644 NX.ERP.U8/Account/Accinformation.cs diff --git a/NX.ERP.Model/Purchase/Arrival.cs b/NX.ERP.Model/Purchase/Arrival.cs index 026e074..1bc0855 100644 --- a/NX.ERP.Model/Purchase/Arrival.cs +++ b/NX.ERP.Model/Purchase/Arrival.cs @@ -28,7 +28,7 @@ namespace NX.ERP.Model.Purchase public string VenCode { get; set; } - public decimal TaxRate { get; set; } + public double TaxRate { get; set; } public string PTCode { get; set; } diff --git a/NX.ERP.Model/Purchase/ArrivalDetail.cs b/NX.ERP.Model/Purchase/ArrivalDetail.cs index a1a5481..f5ce27e 100644 --- a/NX.ERP.Model/Purchase/ArrivalDetail.cs +++ b/NX.ERP.Model/Purchase/ArrivalDetail.cs @@ -32,5 +32,13 @@ namespace NX.ERP.Model.Purchase public string OrderCode { get; set; } public int PoId { get; set; } + public double oricost { get; set; } + public decimal oritaxcost { get; set; } + public decimal orimoney { get; set; } + public decimal oritaxprice { get; set; } + public decimal orisum { get; set; } + + // b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.iorimoney as orimoney,b.oritaxprice as oritaxprice,b.iorisum as orisum, + } } diff --git a/NX.ERP.Model/Store/PuStoreInDetail.cs b/NX.ERP.Model/Store/PuStoreInDetail.cs index 394171f..f73073c 100644 --- a/NX.ERP.Model/Store/PuStoreInDetail.cs +++ b/NX.ERP.Model/Store/PuStoreInDetail.cs @@ -11,14 +11,14 @@ namespace NX.ERP.Model.Store private int puStoreInId; private string invcode; private string unit; - private decimal quantity; + private double quantity; public string Batch { get; set; } public int Id { get => id; set => id = value; } public int PuStoreInId { get => puStoreInId; set => puStoreInId = value; } public string Invcode { get => invcode; set => invcode = value; } public string Unit { get => unit; set => unit = value; } - public decimal Quantity { get => quantity; set => quantity = value; } + public double Quantity { get => quantity; set => quantity = value; } public int SorceDetailId { get; set; } diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index 2d0af00..0bdf179 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -310,18 +310,18 @@ namespace U8AppMain SupplierCode = "10001", Source = "采购到货单", Whcode = "1", - SourceCode = "CGDH210100002", - Maker = "222", + SourceCode = "CGDH210100185", + // Maker = "222", RdCode = "101", PuStoreInDetails = new List() { new NX.ERP.Model.Store.PuStoreInDetail(){ //Batch="001", Quantity=2, Id=1, - Invcode="201001", + Invcode="501241", PuStoreInId=1000021, - SorceDetailId=1000023146, + SorceDetailId=1000023622, } diff --git a/NX.ERP.U8/Account/Accinformation.cs b/NX.ERP.U8/Account/Accinformation.cs new file mode 100644 index 0000000..ebd81a2 --- /dev/null +++ b/NX.ERP.U8/Account/Accinformation.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Dapper; +namespace NX.ERP.U8.Account +{ + + + public class Accinfo + { + private string name; + private string caption; + private string value; + + public string Name { get => name; set => name = value; } + public string Caption { get => caption; set => caption = value; } + public string Value { get => value; set => this.value = value; } + } + public class Accinformation + { + + private IDictionary Infos; + private void LoadFormation() + { + using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) + { + var strSql = "SELECT cname as name,ccaption as caption,cvalue as value FROM accinformation WITH(NOLOCK) WHERE cname IN ('iQuanDecDgt','iExchRateDecDgt','iNumDecDgt','iRateDecDgt','iPriceDecDgt','iCurrencyDigits','iStrsPriDecDgt','iStrsQuanDecDgt','iVolumeDecDgt','iWeightDecDgt','iKLPoint','iBillPrice')"; + var list = conn.Query(strSql, null); + this.Infos = new Dictionary(); + foreach (var item in list) + { + Infos.Add(item.Name, item); + } + } + } + public int BillPrice + { + get + { + return int.Parse(GetValue("iBillPrice")); + } + } + + + public int iExchRateDecDgt + { + get + { + return int.Parse(GetValue("iExchRateDecDgt")); + } + } + + + public int NumDecDgt + { + get + { + return int.Parse(GetValue("iNumDecDgt")); + } + } + + public int StrsPriDecDgt + { + get + { + return int.Parse(GetValue("iStrsPriDecDgt")); + } + } + + + public int StrsQuanDecDgt + { + get + { + return int.Parse(GetValue("iStrsQuanDecDgt")); + } + } + + + public int VolumeDecDgt + { + get + { + return int.Parse(GetValue("iVolumeDecDgt")); + } + } + + public int iWeightDecDgt + { + get + { + return int.Parse(GetValue("iWeightDecDgt")); + } + } + + + public int iCurrencyDigits + { + get + { + return int.Parse(GetValue("iCurrencyDigits")); + } + } + public int PriceDecDgt + { + get + { + return int.Parse(GetValue("iPriceDecDgt")); + } + } + + + public int QuanDecDgt + { + get + { + return int.Parse(GetValue("iQuanDecDgt")); + } + } + public int KLPoint + { + get + { + return int.Parse(GetValue("iKLPoint")); + } + } + private string GetValue(string Name) + { + if (this.Infos == null) + { + this.LoadFormation(); + } + if (Infos.TryGetValue(Name, out var accinfo)) + { + return accinfo.Value; + } + return ""; + } + + + public double FormatMoney(double currMoney) + { + try + { + return Math.Round(currMoney, this.iCurrencyDigits); + } + catch (Exception) + { + throw; + } + } + + public decimal FormatMoney(decimal currMoney) + { + try + { + return Math.Round(currMoney, this.iCurrencyDigits); + } + catch (Exception) + { + throw; + } + } + } +} diff --git a/NX.ERP.U8/NX.ERP.U8.csproj b/NX.ERP.U8/NX.ERP.U8.csproj index 8e28965..56b6279 100644 --- a/NX.ERP.U8/NX.ERP.U8.csproj +++ b/NX.ERP.U8/NX.ERP.U8.csproj @@ -46,6 +46,7 @@ + diff --git a/NX.ERP.U8/Purchase/ArrivalDAL.cs b/NX.ERP.U8/Purchase/ArrivalDAL.cs index 1d92729..67416ad 100644 --- a/NX.ERP.U8/Purchase/ArrivalDAL.cs +++ b/NX.ERP.U8/Purchase/ArrivalDAL.cs @@ -16,7 +16,7 @@ namespace NX.ERP.U8.Purchase B.Autoid as id,b.ID as ArrivalID, b.cInvCode AS MaterielCode, b.cBatch AS BatchNo, - b.cUnitID AS UnitCode, + b.cUnitID AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum, B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid from pu_ArrHead as a left join pu_arrbody as b on a.id=b.id diff --git a/NX.ERP.U8/Store/PuStoreInDAL.cs b/NX.ERP.U8/Store/PuStoreInDAL.cs index 2cb57c3..9198c19 100644 --- a/NX.ERP.U8/Store/PuStoreInDAL.cs +++ b/NX.ERP.U8/Store/PuStoreInDAL.cs @@ -85,7 +85,7 @@ namespace NX.ERP.U8.Store iXMLDOMElement.setAttribute("cvouchtype", "01");//DomHead[0]["cvouchtype"] = ""; //单据类型,string类型 iXMLDOMElement.setAttribute("brdflag", 1); //DomHead[0]["brdflag"] = ""; //收发标志,int类型 iXMLDOMElement.setAttribute("csource", puStoreIn.Source); //DomHead[0]["csource"] = ""; //单据来源,int类型 - iXMLDOMElement.setAttribute("cmaker", puStoreIn.Maker);//DomHead[0]["cmaker"] = ""; //制单人,string类型 + iXMLDOMElement.setAttribute("cmaker", U8LoginContext.Instance.LoginUserName);//DomHead[0]["cmaker"] = ""; //制单人,string类型 iXMLDOMElement.setAttribute("vt_id", "27"); iXMLDOMElement.setAttribute("editprop", "A"); iXMLDOMElement.setAttribute("cdepcode", puStoreIn.Depcode); @@ -112,7 +112,7 @@ namespace NX.ERP.U8.Store iXMLDOMElement.setAttribute("ipurarriveid", Arrival.Id); iXMLDOMElement.setAttribute("darvdate", Arrival.Date); iXMLDOMElement.setAttribute("itaxrate", Arrival.TaxRate); - iXMLDOMElement.setAttribute("itaxrate", Arrival.TaxRate); + iXMLDOMElement.setAttribute("cptcode", Arrival.PTCode); domHead.selectSingleNode("//rs:data").appendChild(iXMLDOMElement); @@ -129,13 +129,33 @@ namespace NX.ERP.U8.Store iXMLDOMElement.setAttribute("iquantity", detail.Quantity); iXMLDOMElement.setAttribute("irowno", n); iXMLDOMElement.setAttribute("cbvencode", "10001"); + iXMLDOMElement.setAttribute("cbatch", detail.Batch); - iXMLDOMElement.setAttribute("carvcode", "2"); - iXMLDOMElement.setAttribute("ipurarriveid", "222"); + iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode); + iXMLDOMElement.setAttribute("cbarvcode", Arrival.ArrivalCode); + iXMLDOMElement.setAttribute("ipurarriveid", Arrival.Id); + iXMLDOMElement.setAttribute("iarrsid", detail.SorceDetailId); iXMLDOMElement.setAttribute("darvdate", DateTime.Today.ToShortDateString()); iXMLDOMElement.setAttribute("editprop", "A"); iXMLDOMElement.setAttribute("cpoid", arrivalDetail.OrderCode); iXMLDOMElement.setAttribute("iposid", arrivalDetail.posId); + var info = new NX.ERP.U8.Account.Accinformation(); + + //iorimoney = FormatMoney(iunitcost * iQuan); + //ioritaxprice = FormatMoney(iunitcost * iQuan * (itaxrate / 100.0)); + //iorisum = FormatMoney(iunitcost * (1.0 + itaxrate / 100.0) * iQuan); + //itaxcost = FormatUPrice(iunitcost * (1.0 + itaxrate / 100.0)); + + + var iorisum = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0)) * detail.Quantity); + var ioritaxprice = info.FormatMoney(arrivalDetail.oricost * (Arrival.TaxRate / 100.0) * detail.Quantity); + var iorimoney = info.FormatMoney(arrivalDetail.oricost * detail.Quantity); + var oritaxcost = info.FormatMoney(arrivalDetail.oricost * (1.00 + (Arrival.TaxRate / 100.0))); + iXMLDOMElement.setAttribute("ioricost", arrivalDetail.oricost); + iXMLDOMElement.setAttribute("ioritaxcost", oritaxcost); + iXMLDOMElement.setAttribute("iorimoney", iorimoney); + iXMLDOMElement.setAttribute("ioritaxprice", ioritaxprice); + iXMLDOMElement.setAttribute("iorisum", iorisum); domBody.selectSingleNode("//rs:data").appendChild(iXMLDOMElement); } diff --git a/NX.ERP.U8/U8LoginContext.cs b/NX.ERP.U8/U8LoginContext.cs index 7b7ec70..b535cc7 100644 --- a/NX.ERP.U8/U8LoginContext.cs +++ b/NX.ERP.U8/U8LoginContext.cs @@ -5,7 +5,7 @@ using System.Text; using U8Login; using UFIDA.U8.U8APIFramework; using UFIDA.U8.U8MOMAPIFramework; - +using Dapper; namespace NX.ERP.U8 { public class U8LoginContext : IDisposable @@ -49,6 +49,31 @@ namespace NX.ERP.U8 } } + + + //public int GetDefaultPoTaxRate() + //{ + + // try + // { + // string strSQL = "Select cValue from AccInformation Where cSysID=N'PU' and cName=N'iDefaultZHBVRate'"; + // using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) + // { + // return conn.ExecuteScalar(strSQL, null, null, 0, System.Data.CommandType.Text); + + // } + // } + // catch (Exception) + // { + // throw; + // } + // finally + // { + + // } + //} + + public void Dispose() { if (uiLogin != null) @@ -77,6 +102,21 @@ namespace NX.ERP.U8 return this.ClsLogin.UFDataConnstringForNet; } } + public string LoginUserName + { + get + { + return this.ClsLogin.cUserName; + } + } + + public string LoginUserId + { + get + { + return this.ClsLogin.cUserId; + } + } /// /// ADO的链接字符串 /// @@ -135,12 +175,12 @@ namespace NX.ERP.U8 } - public void AddRdVoucher(string URL,VoucherParameter para) + public void AddRdVoucher(string URL, VoucherParameter para) { try { U8EnvContext u8EnvContext = new U8EnvContext(); - u8EnvContext.U8Login =this.ClsLogin; + u8EnvContext.U8Login = this.ClsLogin; U8ApiAddress apiAddress = new U8ApiAddress(URL); U8ApiBroker u8ApiBroker = new U8ApiBroker(apiAddress, u8EnvContext); @@ -151,7 +191,7 @@ namespace NX.ERP.U8 { u8ApiBroker.AssignNormalValue("domPosition", para.DomPosition); } - + u8ApiBroker.AssignNormalValue("cnnFrom", null); if (para.DOMMsg != null) { @@ -174,21 +214,21 @@ namespace NX.ERP.U8 if (exception is MomSysException) { MomSysException ex = exception as MomSysException; - + } else if (exception is MomBizException) { MomBizException ex2 = exception as MomBizException; - + } string exceptionString = u8ApiBroker.GetExceptionString(); if (exceptionString.Length != 0) { - + } } para.ReturnValue = false; - + u8ApiBroker.Release(); return; } @@ -228,7 +268,7 @@ namespace NX.ERP.U8 } catch (Exception ex3) { - + throw ex3; } } @@ -255,21 +295,21 @@ namespace NX.ERP.U8 if (exception is MomSysException) { MomSysException ex = exception as MomSysException; - + } else if (exception is MomBizException) { MomBizException ex2 = exception as MomBizException; - + } string exceptionString = u8ApiBroker.GetExceptionString(); if (exceptionString.Length != 0) { - + } } para.ReturnValue = false; - + u8ApiBroker.Release(); return; } @@ -297,14 +337,14 @@ namespace NX.ERP.U8 } catch (Exception ex3) { - + throw new Exception("装载供应链库存单据失败!"); } } - - + +