From d20c4451c55b2f70632f42eb05b26d1e80721954 Mon Sep 17 00:00:00 2001 From: gongxh Date: Mon, 15 Mar 2021 16:32:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=85=A5=E5=BA=93=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.BLL/Store/SotreIn.cs | 4 +-- NX.ERP.BLL/Store/SotreOut.cs | 4 +-- NX.ERP.U8/Store/MaterielStoreOutDAL.cs | 2 -- NX.ERP.U8/Store/OtherStoreInDAL.cs | 31 +++++++++++++++++-- NX.ERP.U8/Store/OtherStoreOutDAL.cs | 42 ++++++++++++++++++++++---- NX.ERP.U8/Store/ProductInDAL.cs | 27 ++++++++++++++++- 6 files changed, 94 insertions(+), 16 deletions(-) diff --git a/NX.ERP.BLL/Store/SotreIn.cs b/NX.ERP.BLL/Store/SotreIn.cs index 729e39c..f37e667 100644 --- a/NX.ERP.BLL/Store/SotreIn.cs +++ b/NX.ERP.BLL/Store/SotreIn.cs @@ -44,7 +44,7 @@ namespace NX.ERP.BLL.Store if (inbound.InboundType == Model.InboundType.productIn) { var dal = new NX.ERP.U8.Store.ProductInDAL(); - ID = dal.AddVoucher(new ERP.Model.Request.ProductStoreIn() + ID = dal.SaveVoucher(new ERP.Model.Request.ProductStoreIn() { Id = inbound.Id, @@ -71,7 +71,7 @@ namespace NX.ERP.BLL.Store if (inbound.InboundType == Model.InboundType.OtherIn) { var dal = new NX.ERP.U8.Store.OtherStoreInDAL(); - ID = dal.AddVocher(new ERP.Model.Request.OtherStoreInOut() + ID = dal.SaveVoucher(new ERP.Model.Request.OtherStoreInOut() { Id = inbound.Id, Code = inbound.InboundNo, diff --git a/NX.ERP.BLL/Store/SotreOut.cs b/NX.ERP.BLL/Store/SotreOut.cs index f7830b3..bdde731 100644 --- a/NX.ERP.BLL/Store/SotreOut.cs +++ b/NX.ERP.BLL/Store/SotreOut.cs @@ -43,7 +43,7 @@ namespace NX.ERP.BLL.Store if (outBound.OutboundType == Model.OutBoundType.SaleOut) { var dal = new U8.Store.SaleOutDAL(); - ID = dal.AddVoucher(new ERP.Model.Request.SaleStoreOut() + ID = dal.SaveVoucher(new ERP.Model.Request.SaleStoreOut() { Id = outBound.Id, Code = outBound.OutboundNo, @@ -68,7 +68,7 @@ namespace NX.ERP.BLL.Store if (outBound.OutboundType == Model.OutBoundType.OtherOut) { var dal = new U8.Store.OtherStoreOutDAL(); - ID = dal.AddVocher(new ERP.Model.Request.OtherStoreInOut() + ID = dal.SaveVoucher(new ERP.Model.Request.OtherStoreInOut() { Date = outBound.OutboundDate, WhCode = outBound.WarehouseCode, diff --git a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs index 8a576a4..f495c7a 100644 --- a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs +++ b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs @@ -169,8 +169,6 @@ namespace NX.ERP.U8.Store } } - - } diff --git a/NX.ERP.U8/Store/OtherStoreInDAL.cs b/NX.ERP.U8/Store/OtherStoreInDAL.cs index 4cd7bd5..4ddb930 100644 --- a/NX.ERP.U8/Store/OtherStoreInDAL.cs +++ b/NX.ERP.U8/Store/OtherStoreInDAL.cs @@ -95,11 +95,36 @@ namespace NX.ERP.U8.Store } - public bool UpdateVocher(Model.Request.OtherStoreInOut storeIn) + public string SaveVoucher(Model.Request.OtherStoreInOut storeIn) + { + var voucherParameter = this.LoadVoucher($"id='{storeIn.Id}'"); + if (voucherParameter.DomHead.selectSingleNode("//rs:data").childNodes.length == 0) + { + return this.AddVocher(storeIn); + } + else + { + if (this.UpdateVocher(storeIn, voucherParameter)) + { + return storeIn.Id.ToString(); + } + else + { + throw new Exception("保存错误"); + } + + } + } + + + + public bool UpdateVocher(Model.Request.OtherStoreInOut storeIn, VoucherParameter voucherParameter = null) { - var voucherParameter = base.LoadVoucher($" id={storeIn.Id}"); - + if (voucherParameter == null) + { + voucherParameter = base.LoadVoucher($" id={storeIn.Id}"); + } DOMDocument domBody = voucherParameter.DomBody; for (var n = 0; n < storeIn.details.Count(); n++) { diff --git a/NX.ERP.U8/Store/OtherStoreOutDAL.cs b/NX.ERP.U8/Store/OtherStoreOutDAL.cs index ddc889b..80a2ba7 100644 --- a/NX.ERP.U8/Store/OtherStoreOutDAL.cs +++ b/NX.ERP.U8/Store/OtherStoreOutDAL.cs @@ -93,11 +93,41 @@ namespace NX.ERP.U8.Store throw err; } } - public bool UpdateVocher(Model.Request.OtherStoreInOut storeIn) + + + public string SaveVoucher(Model.Request.OtherStoreInOut storeIn) + { + var voucherParameter = this.LoadVoucher($"id='{storeIn.Id}'"); + if (voucherParameter.DomHead.selectSingleNode("//rs:data").childNodes.length == 0) + { + return this.AddVocher(storeIn); + } + else + { + if (this.UpdateVocher(storeIn, voucherParameter)) + { + return storeIn.Id.ToString(); + } + else + { + throw new Exception("保存错误"); + } + + } + } + + + + + public bool UpdateVocher(Model.Request.OtherStoreInOut storeIn, VoucherParameter voucherParameter = null) { - - VoucherParameter voucherParameter = this.LoadVoucher($"id='{storeIn.Id}'"); + if (voucherParameter == null) + { + voucherParameter = this.LoadVoucher($"id='{storeIn.Id}'"); + } + + @@ -112,7 +142,7 @@ namespace NX.ERP.U8.Store bodyXml = domBody.createElement("z:row"); bodyXml.setAttribute("cinvcode", detail.InvCode); bodyXml.setAttribute("iquantity", detail.Quantity); - + bodyXml.setAttribute("cbatch", ""); @@ -129,12 +159,12 @@ namespace NX.ERP.U8.Store bodyXml.setAttribute("citemcode", ""); bodyXml.setAttribute("cbmemo", ""); bodyXml.setAttribute("editprop", "A"); - + bodyXml.setAttribute("irowno", domBody.selectSingleNode("//rs:data").childNodes.length + 1); domBody.selectSingleNode("//rs:data").appendChild(bodyXml); } - + var str = voucherParameter.DomBody.xml; Console.WriteLine(str); try diff --git a/NX.ERP.U8/Store/ProductInDAL.cs b/NX.ERP.U8/Store/ProductInDAL.cs index 8f54155..e6c4c8f 100644 --- a/NX.ERP.U8/Store/ProductInDAL.cs +++ b/NX.ERP.U8/Store/ProductInDAL.cs @@ -85,10 +85,35 @@ namespace NX.ERP.U8.Store } - public bool UpdateVoucher(ProductStoreIn storeIn) + + public string SaveVoucher(Model.Request.ProductStoreIn storeIn) { var voucherParameter = this.LoadVoucher($"id='{storeIn.Id}'"); + if (voucherParameter.DomHead.selectSingleNode("//rs:data").childNodes.length == 0) + { + return this.AddVoucher(storeIn); + } + else + { + if (this.UpdateVoucher(storeIn, voucherParameter)) + { + return storeIn.Id.ToString(); + } + else + { + throw new Exception("保存错误"); + } + } + } + + + public bool UpdateVoucher(ProductStoreIn storeIn, VoucherParameter voucherParameter=null) + { + if (voucherParameter == null) + { + voucherParameter = this.LoadVoucher($"id='{storeIn.Id}'"); + } DOMDocument domBody = voucherParameter.DomBody; if (storeIn.Source == "生产订单")