diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index bef88d2..953f962 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -78,6 +78,8 @@ + + diff --git a/NX.ERP.Model/Store/ProductStoreIn.cs b/NX.ERP.Model/Store/ProductStoreIn.cs new file mode 100644 index 0000000..9c4a5a7 --- /dev/null +++ b/NX.ERP.Model/Store/ProductStoreIn.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Store +{ + public class ProductStoreIn + { + public DateTime Date { get; set; } + public string Source { get; set; } + public string SourceCode { get; set; } + public string WhCode { get; set; } + public IList Details { get; set; } = new List(); + } +} diff --git a/NX.ERP.Model/Store/ProductStoreInDetail.cs b/NX.ERP.Model/Store/ProductStoreInDetail.cs new file mode 100644 index 0000000..0e9e513 --- /dev/null +++ b/NX.ERP.Model/Store/ProductStoreInDetail.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Store +{ + public class ProductStoreInDetail + { + public string InvCode { get; set; } + public int Quantity { get; set; } + public string Batch { get; set; } + public string Position { get; set; } + public int SourceDetailId { get; set; } + } +} diff --git a/NX.ERP.U8.App/FrmMain.Designer.cs b/NX.ERP.U8.App/FrmMain.Designer.cs index 5dcdb4b..5e16c30 100644 --- a/NX.ERP.U8.App/FrmMain.Designer.cs +++ b/NX.ERP.U8.App/FrmMain.Designer.cs @@ -47,6 +47,7 @@ namespace U8AppMain this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.销售出库ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.成品入库ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -77,7 +78,8 @@ namespace U8AppMain this.材料出库单ToolStripMenuItem, this.其他入库ToolStripMenuItem, this.其他出库ToolStripMenuItem, - this.销售出库ToolStripMenuItem}); + this.销售出库ToolStripMenuItem, + this.成品入库ToolStripMenuItem}); this.操作ToolStripMenuItem.Name = "操作ToolStripMenuItem"; this.操作ToolStripMenuItem.Size = new System.Drawing.Size(45, 19); this.操作ToolStripMenuItem.Text = "文件"; @@ -229,6 +231,13 @@ namespace U8AppMain this.销售出库ToolStripMenuItem.Text = "销售出库"; this.销售出库ToolStripMenuItem.Click += new System.EventHandler(this.销售出库ToolStripMenuItem_Click); // + // 成品入库ToolStripMenuItem + // + this.成品入库ToolStripMenuItem.Name = "成品入库ToolStripMenuItem"; + this.成品入库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.成品入库ToolStripMenuItem.Text = " 成品入库"; + this.成品入库ToolStripMenuItem.Click += new System.EventHandler(this.成品入库ToolStripMenuItem_Click); + // // FrmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); @@ -271,6 +280,7 @@ namespace U8AppMain private System.Windows.Forms.ToolStripMenuItem 其他入库ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 其他出库ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 销售出库ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 成品入库ToolStripMenuItem; } } diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index e0a12f9..885ff4e 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -420,5 +420,29 @@ namespace U8AppMain } }); } + + private void 成品入库ToolStripMenuItem_Click(object sender, EventArgs e) + { + var dal = new NX.ERP.U8.Store.ProductInDAL(); + dal.AddVoucher(new NX.ERP.Model.Store.ProductStoreIn() + { + Source = "生产订单", + SourceCode = "SCDD210100010", + Date = DateTime.Today, + WhCode = "1", + Details = new List() { + new NX.ERP.Model.Store.ProductStoreInDetail() + { + Batch="", + InvCode="902009", + SourceDetailId=1000005568, + Quantity=1, + Position="" + } + } + + }); ; + } } + } diff --git a/NX.ERP.U8/NX.ERP.U8.csproj b/NX.ERP.U8/NX.ERP.U8.csproj index be33b6f..6da86c4 100644 --- a/NX.ERP.U8/NX.ERP.U8.csproj +++ b/NX.ERP.U8/NX.ERP.U8.csproj @@ -48,6 +48,7 @@ + diff --git a/NX.ERP.U8/Store/ProductInDAL.cs b/NX.ERP.U8/Store/ProductInDAL.cs new file mode 100644 index 0000000..b229ef8 --- /dev/null +++ b/NX.ERP.U8/Store/ProductInDAL.cs @@ -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; + } + + } + + + } +} diff --git a/NX.ERP.U8/Store/SaleOutDAL.cs b/NX.ERP.U8/Store/SaleOutDAL.cs index 230a70a..17531cc 100644 --- a/NX.ERP.U8/Store/SaleOutDAL.cs +++ b/NX.ERP.U8/Store/SaleOutDAL.cs @@ -39,7 +39,8 @@ namespace NX.ERP.U8.Store headXml.setAttribute("ccode", storeOut.Code); headXml.setAttribute("ddate", storeOut.Date); headXml.setAttribute("cmaker", ""); - headXml.setAttribute("vt_id", ""); + + headXml.setAttribute("vt_id",""); headXml.setAttribute("editprop", "A"); headXml.setAttribute("cdepcode", ""); headXml.setAttribute("cpersoncode", "");