using MSXML2; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace NX.ERP.U8.Store { public class BinChangeDAL : STVoucherBase { public BinChangeDAL() : base("19", "U8API/BinChange") { } public string AddVocher(Model.Request.BinChange binChange) { STVoucherParameter voucherParameter = new STVoucherParameter { VoucherType = this.VoucherID, DomHead = new DOMDocumentClass(), DomBody = new DOMDocumentClass() }; DOMDocument domHead = voucherParameter.DomHead; DOMDocument domBody = voucherParameter.DomBody; voucherParameter.DomHead.loadXML(HeadTemplate); voucherParameter.DomBody.loadXML(BodyTemplate); IXMLDOMElement headXml = domHead.createElement("z:row"); headXml.setAttribute("id", 0); headXml.setAttribute("ddate", DateTime.Now.ToShortDateString()); headXml.setAttribute("ddate", DateTime.Now.ToShortDateString()); headXml.setAttribute("cwhcode", binChange.whCode); headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0313")); headXml.setAttribute("cvouchcode", "00000009998"); foreach (var item in binChange.binChangeDetails) { var bodyXml = domBody.createElement("z:row"); bodyXml.setAttribute("cinvcode", item.InvCode); bodyXml.setAttribute("cbposcode", item.SoucePositon); bodyXml.setAttribute("caposcode", item.DestPostion); bodyXml.setAttribute("iquantity", item.Qty); domBody.selectSingleNode("//rs:data").appendChild(bodyXml); } domHead.selectSingleNode("//rs:data").appendChild(headXml); return this.AddRdVoucher(voucherParameter); } } }