From 0502a30fda47b750d11e60a28adc0f05863c64f6 Mon Sep 17 00:00:00 2001 From: gongxh Date: Mon, 15 Mar 2021 11:24:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=87=BA=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Store/OtherStoreInDAL.cs | 52 ++++++++++++++++++- .../Store/OtherStoreInController.cs | 14 ++++- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/NX.ERP.U8/Store/OtherStoreInDAL.cs b/NX.ERP.U8/Store/OtherStoreInDAL.cs index 23bc44e..256a6f8 100644 --- a/NX.ERP.U8/Store/OtherStoreInDAL.cs +++ b/NX.ERP.U8/Store/OtherStoreInDAL.cs @@ -37,9 +37,9 @@ namespace NX.ERP.U8.Store headXml.setAttribute("brdflag", 1); headXml.setAttribute("ccode", storeIn.Code); headXml.setAttribute("ddate", storeIn.Date); - headXml.setAttribute("cmaker",storeIn.Maker); + headXml.setAttribute("cmaker", storeIn.Maker); headXml.setAttribute("cvouchtype", this.VoucherID); - headXml.setAttribute("vt_id",new VT().GetDefaltVTID("0301")); + headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0301")); headXml.setAttribute("editprop", "A"); headXml.setAttribute("cdepcode", ""); headXml.setAttribute("cpersoncode", ""); @@ -96,5 +96,53 @@ namespace NX.ERP.U8.Store } + + + public bool UpdateVocher(Model.Request.OtherStoreInOut storeIn) + { + + var voucherParameter = base.LoadVoucher($" cCode={storeIn.Code}"); + + DOMDocument domBody = voucherParameter.DomBody; + for (var n = 0; n < storeIn.details.Count(); n++) + { + var detail = storeIn.details[n]; + var bodyXml = domBody.createElement("z:row"); + bodyXml.setAttribute("cinvcode", detail.InvCode); + bodyXml.setAttribute("iquantity", detail.Quantity); + bodyXml.setAttribute("cbatch", ""); + bodyXml.setAttribute("cposition", detail.Position); + bodyXml.setAttribute("cvmivencode", ""); + bodyXml.setAttribute("dmadedate", ""); + bodyXml.setAttribute("dvdate", ""); + bodyXml.setAttribute("iexpiratdatecalcu", ""); + bodyXml.setAttribute("cmassunit", ""); + bodyXml.setAttribute("imassdate", ""); + bodyXml.setAttribute("cexpirationdate", ""); + bodyXml.setAttribute("dexpirationdate", ""); + bodyXml.setAttribute("citem_class", ""); + 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 + { + return base.UpdateRdVoucher(voucherParameter); + } + catch (Exception err) + { + + throw err; + } + + + } + + } } diff --git a/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs b/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs index d8a86d5..f9f7b7e 100644 --- a/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/OtherStoreInController.cs @@ -6,8 +6,8 @@ using System.Web.Http; namespace NX.ERP.WebAPi.Controllers.Store { - - public class OtherStoreInController:ApiController + + public class OtherStoreInController : ApiController { [Obsolete] [Route("api/OtherIn/Add")] @@ -17,5 +17,15 @@ namespace NX.ERP.WebAPi.Controllers.Store var dal = new NX.ERP.U8.Store.OtherStoreInDAL(); return dal.AddVocher(storeIn); } + + + + [Route("api/OtherIn/Update")] + [HttpPost] + public bool UpdteVoucher([FromBody] Model.Request.OtherStoreInOut storeIn) + { + var dal = new NX.ERP.U8.Store.OtherStoreInDAL(); + return dal.UpdateVocher(storeIn); + } } } \ No newline at end of file