From 13ccee99e59dc0e88f8f881aeed6b952098783c0 Mon Sep 17 00:00:00 2001 From: gongxh Date: Mon, 15 Mar 2021 13:13:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.U8/Store/OtherStoreInDAL.cs | 3 -- NX.ERP.U8/Store/ProductInDAL.cs | 47 +++++++++++++++++++ NX.ERP.U8/Store/VoucherBase.cs | 12 ++--- .../Store/ProductStoreInController.cs | 14 +++++- 4 files changed, 65 insertions(+), 11 deletions(-) diff --git a/NX.ERP.U8/Store/OtherStoreInDAL.cs b/NX.ERP.U8/Store/OtherStoreInDAL.cs index 256a6f8..b42d037 100644 --- a/NX.ERP.U8/Store/OtherStoreInDAL.cs +++ b/NX.ERP.U8/Store/OtherStoreInDAL.cs @@ -55,9 +55,6 @@ namespace NX.ERP.U8.Store for (var n = 0; n < storeIn.details.Count(); n++) { var detail = storeIn.details[n]; - //var arrivalDetail = Arrival.ArrivalDetails.First(m => { return m.Id == detail.SorceDetailId; }); - //headXml.setAttribute("cordercode", arrivalDetail.OrderCode); - // headXml.setAttribute("ipurorderid", arrivalDetail.PoId); bodyXml = domBody.createElement("z:row"); bodyXml.setAttribute("cinvcode", detail.InvCode); bodyXml.setAttribute("iquantity", detail.Quantity); diff --git a/NX.ERP.U8/Store/ProductInDAL.cs b/NX.ERP.U8/Store/ProductInDAL.cs index 0f5535e..9e16882 100644 --- a/NX.ERP.U8/Store/ProductInDAL.cs +++ b/NX.ERP.U8/Store/ProductInDAL.cs @@ -85,5 +85,52 @@ namespace NX.ERP.U8.Store } + public bool UpdateVoucher(ProductStoreIn storeIn) + { + var voucherParameter = this.LoadVoucher($"cCode='{storeIn.Code}'"); + + DOMDocument domBody = voucherParameter.DomBody; + + if (storeIn.Source == "生产订单") + { + var momOrder = new Mom.MomOrderDAL().GetModel(storeIn.SourceCode); + + IXMLDOMElement bodyXml; + for (var n = 0; n < storeIn.Details.Count; n++) + { + bodyXml = domBody.createElement("z:row"); + var detail = storeIn.Details[n]; + bodyXml.setAttribute("cinvcode", detail.InvCode); + bodyXml.setAttribute("iquantity", detail.Quantity); + var _cost = new MaterialDAL().GetCost(detail.InvCode, 0); + bodyXml.setAttribute("iunitcost", _cost); + bodyXml.setAttribute("iprice", new Account.Accinformation().FormatMoney(_cost * detail.Quantity)); + + bodyXml.setAttribute("editprop", "A"); + + bodyXml.setAttribute("cbatch", detail.Batch); + bodyXml.setAttribute("cposition", detail.Position); + var momOrderDetail = momOrder.ProductDtlLst.First(m => { return m.ProductOrderDtlId == detail.SourceDetailId; }); + + bodyXml.setAttribute("cmocode", momOrder.ProductOrderNo); + bodyXml.setAttribute("impoids", detail.SourceDetailId); + bodyXml.setAttribute("irowno", domBody.selectSingleNode("//rs:data").childNodes.length + 1); + domBody.selectSingleNode("//rs:data").appendChild(bodyXml); + } + } + + try + { + return UpdateRdVoucher(voucherParameter); + } + catch (Exception err) + { + throw err; + } + + } + + + } } diff --git a/NX.ERP.U8/Store/VoucherBase.cs b/NX.ERP.U8/Store/VoucherBase.cs index 5a20863..1b96f63 100644 --- a/NX.ERP.U8/Store/VoucherBase.cs +++ b/NX.ERP.U8/Store/VoucherBase.cs @@ -192,9 +192,9 @@ namespace NX.ERP.U8.Store para.ErrMsg = u8ApiBroker.GetResult("errMsg") as string; u8ApiBroker.Release(); } - catch (Exception ex3) + catch (Exception err) { - throw ex3; + throw err; } } @@ -273,10 +273,10 @@ namespace NX.ERP.U8.Store u8ApiBroker.Release(); return true; } - catch (Exception ex3) + catch (Exception err) { - throw ex3; + throw err; } finally { @@ -362,10 +362,10 @@ namespace NX.ERP.U8.Store u8ApiBroker.Release(); return VoucherId; } - catch (Exception ex3) + catch (Exception err) { - throw ex3; + throw err; } finally { diff --git a/NX.ERP.WebAPi/Controllers/Store/ProductStoreInController.cs b/NX.ERP.WebAPi/Controllers/Store/ProductStoreInController.cs index 2b664b5..9092336 100644 --- a/NX.ERP.WebAPi/Controllers/Store/ProductStoreInController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/ProductStoreInController.cs @@ -6,8 +6,8 @@ using System.Web.Http; namespace NX.ERP.WebAPi.Controllers.Store { - - public class ProductStoreInController: ApiController + + public class ProductStoreInController : ApiController { [Obsolete] [Route("api/ProductStoreIn/Add")] @@ -17,5 +17,15 @@ namespace NX.ERP.WebAPi.Controllers.Store var dal = new NX.ERP.U8.Store.ProductInDAL(); return new { Id = dal.AddVoucher(storeIn) }; } + + + [Obsolete] + [Route("api/ProductStoreIn/Update")] + [HttpPost] + public bool UpdateVoucher([FromBody] Model.Request.ProductStoreIn storeIn) + { + var dal = new NX.ERP.U8.Store.ProductInDAL(); + return dal.UpdateVoucher(storeIn); + } } } \ No newline at end of file