添加成品入库单
This commit is contained in:
90
NX.ERP.U8/Store/ProductInDAL.cs
Normal file
90
NX.ERP.U8/Store/ProductInDAL.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using MSXML2;
|
||||
using NX.ERP.Model.Store;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NX.ERP.U8.Store
|
||||
{
|
||||
public class ProductInDAL : VoucherBase
|
||||
{
|
||||
public ProductInDAL() : base("10", "U8API/ProductIn")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string AddVoucher(ProductStoreIn 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("cvouchtype", this.VoucherID);//DomHead[0]["cvouchtype"] = ""; //单据类型,string类型
|
||||
headXml.setAttribute("bpufirst", "0");
|
||||
headXml.setAttribute("bisstqc", "0");
|
||||
headXml.setAttribute("bomfirst", "0");
|
||||
headXml.setAttribute("biafirst", "0");
|
||||
headXml.setAttribute("brdflag", 1);
|
||||
headXml.setAttribute("ccode", "11");
|
||||
headXml.setAttribute("ddate", storeIn.Date);
|
||||
headXml.setAttribute("cmaker", "");
|
||||
|
||||
headXml.setAttribute("vt_id", "");
|
||||
headXml.setAttribute("editprop", "A");
|
||||
headXml.setAttribute("cdepcode", "");
|
||||
headXml.setAttribute("cpersoncode", "");
|
||||
headXml.setAttribute("crdcode", "");
|
||||
|
||||
if (storeIn.Source == "生产订单")
|
||||
{
|
||||
var momOrder = new Mom.MomOrderDAL().GetModel(storeIn.SourceCode);
|
||||
headXml.setAttribute("csource", storeIn.Source);
|
||||
headXml.setAttribute("cwhcode", storeIn.WhCode);
|
||||
headXml.setAttribute("cbustype", "成品入库");
|
||||
headXml.setAttribute("cmemo", "");
|
||||
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);
|
||||
bodyXml.setAttribute("irowno", n + 1);
|
||||
bodyXml.setAttribute("editprop", "A");
|
||||
bodyXml.setAttribute("cbatch", detail.Batch);
|
||||
bodyXml.setAttribute("cposition", detail.Position);
|
||||
var momOrderDetail = momOrder.momDetails.First(m => { return m.Id == detail.SourceDetailId; });
|
||||
headXml.setAttribute("cmpocode", momOrder.Code);
|
||||
headXml.setAttribute("iproorderid", momOrder.Id);
|
||||
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
domHead.selectSingleNode("//rs:data").appendChild(headXml);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
return AddRdVoucher(voucherParameter);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user