using MSXML2; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace NX.ERP.U8.Store { public class OtherStoreInDAL : VoucherBase { public OtherStoreInDAL() : base("09") { } public string AddVocher(Model.Store.OtherStoreIn storeIn) { VoucherParameter voucherParameter = new VoucherParameter { 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("bpufirst", "0"); headXml.setAttribute("bisstqc", "0"); headXml.setAttribute("bomfirst", "0"); headXml.setAttribute("biafirst", "0"); headXml.setAttribute("brdflag", 1); headXml.setAttribute("ccode", storeIn.Code); headXml.setAttribute("ddate", storeIn.Date); headXml.setAttribute("cmaker", "/"); headXml.setAttribute("cvouchtype", this.VoucherID); headXml.setAttribute("vt_id", ""); headXml.setAttribute("editprop", "A"); headXml.setAttribute("cdepcode", ""); headXml.setAttribute("cpersoncode", ""); headXml.setAttribute("crdcode", ""); headXml.setAttribute("csource", "库存"); headXml.setAttribute("cwhcode", storeIn.WhCode); headXml.setAttribute("cbustype", "其他入库"); headXml.setAttribute("cmemo", ""); IXMLDOMElement bodyXml; 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); bodyXml.setAttribute("irowno", n + 1); 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"); domBody.selectSingleNode("//rs:data").appendChild(bodyXml); } domHead.selectSingleNode("//rs:data").appendChild(headXml); var str = voucherParameter.DomBody.xml; Console.WriteLine(str); try { return U8LoginContext.Instance.AddRdVoucher("U8API/PuStoreIn/Add", voucherParameter); } catch (Exception err) { throw err; } } } }