修改导入显示

This commit is contained in:
admin
2020-12-19 13:04:35 +08:00
parent a82c4d5096
commit ee176b4e24
10 changed files with 383 additions and 173 deletions

View File

@@ -3,4 +3,9 @@
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup> </startup>
<appSettings>
<add key="url" value="http://192.168.0.242/U8EAI/import.asp"/>
<add key="conn" value=""/>
</appSettings>
</configuration> </configuration>

View File

@@ -29,118 +29,160 @@ namespace U8AppMain
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.panel1 = new System.Windows.Forms.Panel(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.BtnBomImport = new System.Windows.Forms.Button(); this.操作ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel2 = new System.Windows.Forms.Panel(); this.BtnReadExcel = new System.Windows.Forms.ToolStripMenuItem();
this.kryptonDataGridView1 = new ComponentFactory.Krypton.Toolkit.KryptonDataGridView(); this.导入ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.BtnImportExcel = new System.Windows.Forms.Button(); this.ImportBom = new System.Windows.Forms.ToolStripMenuItem();
this.textBox1 = new System.Windows.Forms.TextBox(); this.BtnPurchaseImport = new System.Windows.Forms.ToolStripMenuItem();
this.button1 = new System.Windows.Forms.Button(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1.SuspendLayout(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.panel2.SuspendLayout(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.kryptonDataGridView1)).BeginInit(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// panel1 // menuStrip1
// //
this.panel1.Controls.Add(this.button1); this.menuStrip1.Font = new System.Drawing.Font("Segoe UI", 9F);
this.panel1.Controls.Add(this.BtnImportExcel); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.panel1.Controls.Add(this.BtnBomImport); this.操作ToolStripMenuItem,
this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.导入ToolStripMenuItem});
this.panel1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1"; this.menuStrip1.Name = "menuStrip1";
this.panel1.Size = new System.Drawing.Size(800, 42); this.menuStrip1.Padding = new System.Windows.Forms.Padding(9, 4, 0, 4);
this.panel1.TabIndex = 0; this.menuStrip1.Size = new System.Drawing.Size(1200, 27);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
// //
// BtnBomImport // 操作ToolStripMenuItem
// //
this.BtnBomImport.Location = new System.Drawing.Point(108, 12); this.操作ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.BtnBomImport.Name = "BtnBomImport"; this.BtnReadExcel});
this.BtnBomImport.Size = new System.Drawing.Size(75, 23); this.操作ToolStripMenuItem.Name = "操作ToolStripMenuItem";
this.BtnBomImport.TabIndex = 0; this.操作ToolStripMenuItem.Size = new System.Drawing.Size(45, 19);
this.BtnBomImport.Text = "Bom导入"; this.操作ToolStripMenuItem.Text = "文件";
this.BtnBomImport.UseVisualStyleBackColor = true;
this.BtnBomImport.Click += new System.EventHandler(this.BtnBomImport_Click);
// //
// panel2 // BtnReadExcel
// //
this.panel2.Controls.Add(this.textBox1); this.BtnReadExcel.Name = "BtnReadExcel";
this.panel2.Controls.Add(this.kryptonDataGridView1); this.BtnReadExcel.Size = new System.Drawing.Size(180, 22);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.BtnReadExcel.Text = "读取Excel";
this.panel2.Location = new System.Drawing.Point(0, 42); this.BtnReadExcel.Click += new System.EventHandler(this.BtnReadExcel_Click);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(800, 408);
this.panel2.TabIndex = 1;
// //
// kryptonDataGridView1 // 导入ToolStripMenuItem
// //
this.kryptonDataGridView1.AllowUserToAddRows = false; this.导入ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.kryptonDataGridView1.AllowUserToDeleteRows = false; this.ImportBom,
this.kryptonDataGridView1.AllowUserToResizeRows = false; this.BtnPurchaseImport});
this.kryptonDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.导入ToolStripMenuItem.Name = "导入ToolStripMenuItem";
this.kryptonDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.导入ToolStripMenuItem.Size = new System.Drawing.Size(45, 19);
this.kryptonDataGridView1.Location = new System.Drawing.Point(0, 0); this.导入ToolStripMenuItem.Text = "导入";
this.kryptonDataGridView1.Name = "kryptonDataGridView1";
this.kryptonDataGridView1.ReadOnly = true;
this.kryptonDataGridView1.RowTemplate.Height = 23;
this.kryptonDataGridView1.Size = new System.Drawing.Size(800, 408);
this.kryptonDataGridView1.TabIndex = 0;
// //
// BtnImportExcel // ImportBom
// //
this.BtnImportExcel.Location = new System.Drawing.Point(12, 12); this.ImportBom.Name = "ImportBom";
this.BtnImportExcel.Name = "BtnImportExcel"; this.ImportBom.Size = new System.Drawing.Size(180, 22);
this.BtnImportExcel.Size = new System.Drawing.Size(75, 23); this.ImportBom.Text = "BOM";
this.BtnImportExcel.TabIndex = 1; this.ImportBom.Click += new System.EventHandler(this.ImportBom_Click);
this.BtnImportExcel.Text = "读取Exel";
this.BtnImportExcel.UseVisualStyleBackColor = true;
this.BtnImportExcel.Click += new System.EventHandler(this.BtnImportExcel_Click);
// //
// textBox1 // BtnPurchaseImport
// //
this.textBox1.Dock = System.Windows.Forms.DockStyle.Bottom; this.BtnPurchaseImport.Name = "BtnPurchaseImport";
this.textBox1.Location = new System.Drawing.Point(0, 147); this.BtnPurchaseImport.Size = new System.Drawing.Size(180, 22);
this.textBox1.Multiline = true; this.BtnPurchaseImport.Text = "请购单";
this.textBox1.Name = "textBox1"; this.BtnPurchaseImport.Click += new System.EventHandler(this.BtnPurchaseImport_Click);
this.textBox1.Size = new System.Drawing.Size(800, 261);
this.textBox1.TabIndex = 1;
// //
// button1 // splitContainer1
// //
this.button1.Location = new System.Drawing.Point(211, 12); this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.Name = "button1"; this.splitContainer1.Location = new System.Drawing.Point(0, 27);
this.button1.Size = new System.Drawing.Size(75, 23); this.splitContainer1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.button1.TabIndex = 2; this.splitContainer1.Name = "splitContainer1";
this.button1.Text = "请购单导入"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
this.button1.UseVisualStyleBackColor = true; //
this.button1.Click += new System.EventHandler(this.button1_Click); // splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.dataGridView1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.richTextBox1);
this.splitContainer1.Size = new System.Drawing.Size(1200, 722);
this.splitContainer1.SplitterDistance = 450;
this.splitContainer1.TabIndex = 0;
//
// richTextBox1
//
this.richTextBox1.BackColor = System.Drawing.Color.White;
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(1200, 268);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AllowUserToOrderColumns = true;
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.GridColor = System.Drawing.SystemColors.ActiveBorder;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(1200, 450);
this.dataGridView1.TabIndex = 0;
// //
// FrmMain // FrmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(1200, 749);
this.Controls.Add(this.panel2); this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.panel1); this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("微软雅黑", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "FrmMain"; this.Name = "FrmMain";
this.Text = "Form1"; this.Text = "U8导入";
this.panel1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.panel2.ResumeLayout(false); this.menuStrip1.PerformLayout();
this.panel2.PerformLayout(); this.splitContainer1.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.kryptonDataGridView1)).EndInit(); this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.ToolStripMenuItem 操作ToolStripMenuItem;
private System.Windows.Forms.Button BtnBomImport; private System.Windows.Forms.ToolStripMenuItem BtnReadExcel;
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.ToolStripMenuItem 导入ToolStripMenuItem;
private ComponentFactory.Krypton.Toolkit.KryptonDataGridView kryptonDataGridView1; private System.Windows.Forms.ToolStripMenuItem ImportBom;
private System.Windows.Forms.Button BtnImportExcel; private System.Windows.Forms.ToolStripMenuItem BtnPurchaseImport;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button button1; private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.DataGridView dataGridView1;
} }
} }

View File

@@ -10,6 +10,8 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.IO; using System.IO;
using System.Configuration;
namespace U8AppMain namespace U8AppMain
{ {
public partial class FrmMain : Form public partial class FrmMain : Form
@@ -19,56 +21,69 @@ namespace U8AppMain
InitializeComponent(); InitializeComponent();
} }
private DataTable dataTable;
private async void BtnBomImport_Click(object sender, EventArgs e)
{
var bomLookup = new Dictionary<string, Bom.ufinterface>(); private void PrintLog(ResultEnity.ufinterface info)
foreach (DataRow row in this.dataTable.Rows) {
this.richTextBox1.SelectionColor = Color.Black;
this.richTextBox1.AppendText($"单据:{info.requestroottag} 操作:{info.proc} \r\n");
foreach (var item in info.Items)
{ {
var bom = new Bom.ufinterface(); string tag;
var comp = new Bom.ComponentBody(); if (item.succeed == "0")
bom.Bom.Version.Version = Convert.ToInt32(row["版本号"]);
bom.Bom.Version.VersionDesc = row.Field<string>("版本说明");
bom.Bom.Parent.InvCode = row.Field<string>("母件编码");
bom.Bom.Version.VersionEffDate = DateTime.Parse(row["版本生效日"].ToString());
//bom.Bom.Version.BomType ="1" row.Field<string>("BOM类别");
bom.Bom.Parent.ParentScrap = decimal.Parse(row["母件损耗率"].ToString());
var strKey = $"{bom.Bom.Parent.InvCode}-{bom.Bom.Version.Version}";
if (bomLookup.ContainsKey(strKey))
{ {
bom = bomLookup[strKey]; this.richTextBox1.SelectionColor = Color.Green;
tag = "成功";
} }
else else
{ {
bomLookup.Add(strKey, bom); this.richTextBox1.SelectionColor = Color.Red;
tag = "出错";
} }
comp.Component.OpComponentId = bom.Bom.ComponentBodies.Count; this.richTextBox1.AppendText($"[{tag}] 单号:({item.key}),信息:{item.dsc} \r\n");
comp.Component.EffBegDate = bom.Bom.Version.VersionEffDate;
comp.Component.InvCode = row.Field<string>("子件编码");
comp.Component.SortSeq = row.Field<string>("行号");
comp.Component.OptionsId = bom.Bom.ComponentBodies.Count;
comp.Component.BaseQtyN = decimal.Parse(row["基本用量分子"].ToString());
comp.Component.BaseQtyD = decimal.Parse(row["基础数量分母"].ToString());
comp.Component.CompScrap = decimal.Parse(row["子件损耗率"].ToString());
comp.ComponentOpt.WIPType = row["供应类型"].ToString();
comp.ComponentOpt.OptionsId = bom.Bom.ComponentBodies.Count;
bom.Bom.ComponentBodies.Add(comp);
} }
foreach (var item in bomLookup.Values) this.richTextBox1.SelectionColor = Color.Black;
{ this.richTextBox1.AppendText($"---------------------------------------------------------------------------------------\r\n");
var strbody = XmlHelper.XmlSerialize(item, Encoding.UTF8);
var response = await HttpHelper.Post("", strbody);
this.textBox1.Text += response;
}
} }
private void BtnImportExcel_Click(object sender, EventArgs e)
private async Task<ResultEnity.ufinterface> HttpPost(string body)
{
try
{
var response = await HttpHelper.Post(url, body);
return XmlHelper.XmlDeserialize<ResultEnity.ufinterface>(response, Encoding.UTF8);
// var strResult = $"单据:{result.requestroottag} 操作:{result.proc} \r\n";
//foreach (var item in result.Items)
//{
// strResult += $" 单号:{item.key} 单号:{item.u8key} ------------执行结果: {item.dsc} \r\n";
//}
// return strResult;
}
catch (Exception err)
{
this.richTextBox1.Text = err.Message;
return null;
//return err.Message;
}
}
private string url = ConfigurationManager.AppSettings.Get("url");
private DataTable dataTable;
private void BtnReadExcel_Click(object sender, EventArgs e)
{ {
var opentFileDlg = new OpenFileDialog var opentFileDlg = new OpenFileDialog
{ {
Filter = "EXCEL2003|*.xls|EXCLE2007|*.xlsx" Filter = "EXCEL文件(*.xls;*.xlsx)|*.xls;*.xlsx"
}; };
if (opentFileDlg.ShowDialog() == DialogResult.OK) if (opentFileDlg.ShowDialog() == DialogResult.OK)
@@ -77,50 +92,130 @@ namespace U8AppMain
using (var file = new FileStream(opentFileDlg.FileName, FileMode.Open)) using (var file = new FileStream(opentFileDlg.FileName, FileMode.Open))
{ {
dataTable = ExcelHelper.ExcelToDataTable(file); dataTable = ExcelHelper.ExcelToDataTable(file);
this.kryptonDataGridView1.DataSource = dataTable; this.dataGridView1.DataSource = dataTable;
} }
} }
return; return;
} }
private async void button1_Click(object sender, EventArgs e) private async void ImportBom_Click(object sender, EventArgs e)
{ {
if (this.dataTable == null || this.dataTable.Rows.Count == 0)
var bomLookup = new Dictionary<string, Purchase.ufinterface>();
foreach (DataRow row in this.dataTable.Rows)
{ {
var purchase = new Purchase.ufinterface(); return;
var body = new Purchase.entry();
purchase.purchaseapp.header.code = row["请购单号"].ToString();
purchase.purchaseapp.header.date = row["请购日"].ToString();
purchase.purchaseapp.header.departmentcode = row["部门编码"].ToString();
purchase.purchaseapp.header.personcode = row["请购人"].ToString();
purchase.purchaseapp.header.purchasetypecode = row["采购类型编号"].ToString();
purchase.purchaseapp.header.maker = row["制单人"].ToString();
var strKey = purchase.purchaseapp.header.code;
if (bomLookup.ContainsKey(strKey))
{
purchase = bomLookup[strKey];
}
else
{
bomLookup.Add(strKey, purchase);
}
body.inventorycode = row["存货编码"].ToString();
body.requiredate = purchase.purchaseapp.header.date;
body.quantity = decimal.Parse(row["数量"].ToString());
purchase.purchaseapp.body.Add(body);
} }
var bomLookup = new Dictionary<string, Bom.ufinterface>();
try
{
foreach (DataRow row in this.dataTable.Rows)
{
var bom = new Bom.ufinterface();
var comp = new Bom.ComponentBody();
bom.Bom.Version.Version = Convert.ToInt32(row["版本号"]);
bom.Bom.Version.VersionDesc = row.Field<string>("版本说明");
bom.Bom.Parent.InvCode = row.Field<string>("母件编码");
bom.Bom.Version.VersionEffDate = DateTime.Parse(row["版本生效日"].ToString());
bom.Bom.Parent.ParentScrap = decimal.Parse(row["母件损耗率"].ToString());
var strKey = $"{bom.Bom.Parent.InvCode}-{bom.Bom.Version.Version}";
if (bomLookup.ContainsKey(strKey))
{
bom = bomLookup[strKey];
}
else
{
bomLookup.Add(strKey, bom);
}
comp.Component.OpComponentId = bom.Bom.ComponentBodies.Count;
comp.Component.EffBegDate = bom.Bom.Version.VersionEffDate;
comp.Component.InvCode = row.Field<string>("子件编码");
comp.Component.SortSeq = row.Field<string>("行号");
comp.Component.OptionsId = bom.Bom.ComponentBodies.Count;
comp.Component.BaseQtyN = decimal.Parse(row["基本用量分子"].ToString());
comp.Component.BaseQtyD = decimal.Parse(row["基础数量分母"].ToString());
comp.Component.CompScrap = decimal.Parse(row["子件损耗率"].ToString());
comp.ComponentOpt.WIPType = row["供应类型"].ToString();
comp.ComponentOpt.OptionsId = bom.Bom.ComponentBodies.Count;
bom.Bom.ComponentBodies.Add(comp);
}
}
catch (Exception err)
{
this.richTextBox1.SelectionColor = Color.Red;
this.richTextBox1.AppendText("读取数据出错\r\n");
return;
}
foreach (var item in bomLookup.Values)
{
var strbody = XmlHelper.XmlSerialize(item, Encoding.UTF8);
var response = await this.HttpPost(strbody);
PrintLog(response);
Application.DoEvents();
}
}
private async void BtnPurchaseImport_Click(object sender, EventArgs e)
{
if (this.dataTable == null || this.dataTable.Rows.Count == 0)
{
return;
}
var bomLookup = new Dictionary<string, Purchase.ufinterface>();
try
{
foreach (DataRow row in this.dataTable.Rows)
{
var purchase = new Purchase.ufinterface();
var body = new Purchase.entry();
purchase.purchaseapp.header.code = row["请购单号"].ToString();
purchase.purchaseapp.header.date = row["请购日"].ToString();
purchase.purchaseapp.header.departmentcode = row["部门编码"].ToString();
purchase.purchaseapp.header.personcode = row["请购人"].ToString();
purchase.purchaseapp.header.purchasetypecode = row["采购类型编号"].ToString();
purchase.purchaseapp.header.maker = row["制单人"].ToString();
var strKey = purchase.purchaseapp.header.code;
if (bomLookup.ContainsKey(strKey))
{
purchase = bomLookup[strKey];
}
else
{
bomLookup.Add(strKey, purchase);
}
body.inventorycode = row["存货编码"].ToString();
body.requiredate = purchase.purchaseapp.header.date;
body.quantity = decimal.Parse(row["数量"].ToString());
purchase.purchaseapp.body.Add(body);
}
}
catch (Exception)
{
this.richTextBox1.SelectionColor = Color.Red;
this.richTextBox1.AppendText("读取数据出错\r\n");
return;
}
foreach (var item in bomLookup.Values) foreach (var item in bomLookup.Values)
{ {
var strbody = XmlHelper.XmlSerialize(item, Encoding.UTF8); var strbody = XmlHelper.XmlSerialize(item, Encoding.UTF8);
var response = await HttpHelper.Post("", strbody); var response = await this.HttpPost(strbody);
this.textBox1.Text += response; PrintLog(response);
Application.DoEvents();
} }
} }
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
richTextBox1.SelectionStart = richTextBox1.Text.Length;
//滚动到光标位置
richTextBox1.ScrollToCaret();
}
} }
} }

View File

@@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace U8AppMain.ResultEnity
{
public class Item
{
// <item key = "CGQGD2132133" succeed="0" dsc="ok" u8key="CGQGD2132133"></item>
[XmlAttribute]
public string key { get; set; }
[XmlAttribute]
public string succeed { get; set; }
[XmlAttribute]
public string dsc { get; set; }
[XmlAttribute]
public string u8key { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace U8AppMain.ResultEnity
{
public class ufinterface
{
// <ufinterface roottag = "return" docid="123" proc="add" sender="u8" receiver="003" 
// request-roottag="purchaseapp">
//    <item key = "CGQGD2132133" succeed="0" dsc="ok" u8key="CGQGD2132133"></item>
//</ufinterface>
[XmlAttribute]
public string roottag { get; set; }
[XmlAttribute]
public string docid { get; set; }
[XmlAttribute]
public string proc { get; set; }
[XmlAttribute]
public string receiver { get; set; }
[XmlAttribute(attributeName: "request-roottag")]
public string requestroottag { get; set; }
[XmlElement(Type = typeof(Item),ElementName ="item")]
public List<Item> Items { get; set; } = new List<Item>();
}
}

View File

@@ -36,23 +36,8 @@
<Reference Include="BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> <Reference Include="BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.6\lib\net40\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\packages\Portable.BouncyCastle.1.8.6\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference> </Reference>
<Reference Include="ComponentFactory.Krypton.Design, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e, processorArchitecture=MSIL"> <Reference Include="Dapper, Version=1.60.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Krypton.Components.Suite.4.5.9\lib\net20\ComponentFactory.Krypton.Design.dll</HintPath> <HintPath>..\packages\Dapper.1.60.6\lib\net451\Dapper.dll</HintPath>
</Reference>
<Reference Include="ComponentFactory.Krypton.Docking, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e, processorArchitecture=MSIL">
<HintPath>..\packages\Krypton.Components.Suite.4.5.9\lib\net20\ComponentFactory.Krypton.Docking.dll</HintPath>
</Reference>
<Reference Include="ComponentFactory.Krypton.Navigator, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e, processorArchitecture=MSIL">
<HintPath>..\packages\Krypton.Components.Suite.4.5.9\lib\net20\ComponentFactory.Krypton.Navigator.dll</HintPath>
</Reference>
<Reference Include="ComponentFactory.Krypton.Ribbon, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e, processorArchitecture=MSIL">
<HintPath>..\packages\Krypton.Components.Suite.4.5.9\lib\net20\ComponentFactory.Krypton.Ribbon.dll</HintPath>
</Reference>
<Reference Include="ComponentFactory.Krypton.Toolkit, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e, processorArchitecture=MSIL">
<HintPath>..\packages\Krypton.Components.Suite.4.5.9\lib\net20\ComponentFactory.Krypton.Toolkit.dll</HintPath>
</Reference>
<Reference Include="ComponentFactory.Krypton.Workspace, Version=4.5.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e, processorArchitecture=MSIL">
<HintPath>..\packages\Krypton.Components.Suite.4.5.9\lib\net20\ComponentFactory.Krypton.Workspace.dll</HintPath>
</Reference> </Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"> <Reference Include="ICSharpCode.SharpZipLib, Version=1.2.0.246, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath> <HintPath>..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
@@ -70,6 +55,7 @@
<HintPath>..\packages\NPOI.2.5.2\lib\net45\NPOI.OpenXmlFormats.dll</HintPath> <HintPath>..\packages\NPOI.2.5.2\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
@@ -105,6 +91,8 @@
<Compile Include="Purchase\HeaderEnity.cs" /> <Compile Include="Purchase\HeaderEnity.cs" />
<Compile Include="Purchase\PurchaseEnity.cs" /> <Compile Include="Purchase\PurchaseEnity.cs" />
<Compile Include="Purchase\ufinterface.cs" /> <Compile Include="Purchase\ufinterface.cs" />
<Compile Include="ResultEnity\Item.cs" />
<Compile Include="ResultEnity\ufinterface.cs" />
<Compile Include="XmlHelper.cs" /> <Compile Include="XmlHelper.cs" />
<EmbeddedResource Include="FrmMain.resx"> <EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon> <DependentUpon>FrmMain.cs</DependentUpon>

View File

@@ -53,6 +53,30 @@ namespace U8AppMain
} }
} }
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="s"></param>
/// <param name="encoding"></param>
/// <returns></returns>
public static T XmlDeserialize<T>(string s, Encoding encoding)
{
if (string.IsNullOrEmpty(s))
throw new ArgumentNullException("s");
if (encoding == null)
throw new ArgumentNullException("encoding");
XmlSerializer mySerializer = new XmlSerializer(typeof(T));
s = s.Replace(" ", " ");
using (MemoryStream ms = new MemoryStream(encoding.GetBytes(s)))
{
using (StreamReader sr = new StreamReader(ms, encoding))
{
return (T)mySerializer.Deserialize(sr);
}
}
}
} }

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Dapper" version="1.60.6" targetFramework="net452" />
<package id="Krypton.Components.Suite" version="4.5.9" targetFramework="net45" /> <package id="Krypton.Components.Suite" version="4.5.9" targetFramework="net45" />
<package id="NPOI" version="2.5.2" targetFramework="net45" /> <package id="NPOI" version="2.5.2" targetFramework="net45" />
<package id="Portable.BouncyCastle" version="1.8.6" targetFramework="net45" /> <package id="Portable.BouncyCastle" version="1.8.6" targetFramework="net45" />