This commit is contained in:
admin
2020-12-18 15:12:05 +08:00
parent 1013a4d4fe
commit a95f32a6b0
7 changed files with 58 additions and 26 deletions

View File

@@ -36,7 +36,7 @@ namespace U8AppMain.Bom
}
[XmlElement(Type = typeof(ComponentRmkEnity))]
public List<ComponentRmkEnity> ComponentRmks
public List<ComponentRmkEnity> ComponentRmk
{
get
{

View File

@@ -6,6 +6,20 @@ using System.Threading.Tasks;
namespace U8AppMain.Bom
{
//<OpComponentId>10</OpComponentId>
// <BomId>4</BomId>
// <SortSeq>10</SortSeq>
// <OpSeq>0000</OpSeq>
// <InvCode>107001</InvCode>
// <EffBegDate>2000-01-07T00:00:00+08:00</EffBegDate>
// <EffEndDate>2099-12-31T00:00:00+08:00</EffEndDate>
// <FVFlag>1</FVFlag>
// <BaseQtyN>1.000000</BaseQtyN>
// <BaseQtyD>1.000000</BaseQtyD>
// <CompScrap>0.000</CompScrap>
// <ByproductFlag>false</ByproductFlag>
// <OptionsId>10</OptionsId>
public class ComponentEnity
{
@@ -14,16 +28,16 @@ namespace U8AppMain.Bom
public string SortSeq { get; set; }
public string OpSeq { get; set; }
public string OpSeq { get; set; } = "000";
public string InvCode { get; set; }
public DateTime EffBegDate { get; set; }
public DateTime EffBegDate { get; set; } = DateTime.Today;
public DateTime EffEndDate { get; set; }
public DateTime EffEndDate { get; set; } = DateTime.Now.AddYears(50);
public int FVFlag { get; set; }
public int FVFlag { get; set; } = 1;
public decimal BaseQtyN { get; set; }

View File

@@ -12,12 +12,15 @@ namespace U8AppMain.Bom
public int OptionsId { get; set; }
public int Offset { get; set; }
public bool AccuCostFlag { get; set; }
public string DrawDeptCode { get; set; }
public string Whcode { get; set; }
public bool OptionalFlag { get; set; }
public int MutexRule { get; set; }
public decimal PlanFactor { get; set; }
public bool AccuCostFlag { get; set; } = true;
public string DrawDeptCode { get; set; } = "";
public string Whcode { get; set; } = "";
public bool OptionalFlag { get; set; } = false;
public int MutexRule { get; set; } = 2;
public decimal PlanFactor { get; set; } = 100;
}
}

View File

@@ -9,12 +9,12 @@ namespace U8AppMain.Bom
public class VersionEnity
{
public int BomId { get; set; } = 0;
public string BomType { get; set; }
public string BomType { get; set; } = "1";
public int Version { get; set; }
public String VersionDesc { get; set; }
public string VersionDesc { get; set; }
public DateTime VersionEffDate { get; set; } = DateTime.Now;
public int Status { get; set; }
public int Status { get; set; } = 3;
//<BomType>1</BomType>
// <Version>70</Version>

View File

@@ -11,11 +11,11 @@ namespace U8AppMain.Bom
//sender="003" receiver="u8" roottag="Bom" docid="971742630" proc="add" codeexchanged="N" exportneedexch="N" paginate="0" display="物料清单" family="生产制造" timestamp="0x000000000027B6E6"
[System.Xml.Serialization.XmlAttribute]
public string Sender { get; set; } = "003";
public string sender { get; set; } = "003";
[System.Xml.Serialization.XmlAttribute]
public string receiver { get; set; } = "U8";
public string receiver { get; set; } = "u8";
[System.Xml.Serialization.XmlAttribute]
public string roottag { get; set; } = "BOM";
public string roottag { get; set; } = "Bom";
[System.Xml.Serialization.XmlAttribute]
public string docid { get; set; } = "971742630";

View File

@@ -34,6 +34,7 @@ namespace U8AppMain
this.panel2 = new System.Windows.Forms.Panel();
this.kryptonDataGridView1 = new ComponentFactory.Krypton.Toolkit.KryptonDataGridView();
this.BtnImportExcel = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.kryptonDataGridView1)).BeginInit();
@@ -61,6 +62,7 @@ namespace U8AppMain
//
// panel2
//
this.panel2.Controls.Add(this.textBox1);
this.panel2.Controls.Add(this.kryptonDataGridView1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 42);
@@ -92,6 +94,14 @@ namespace U8AppMain
this.BtnImportExcel.UseVisualStyleBackColor = true;
this.BtnImportExcel.Click += new System.EventHandler(this.BtnImportExcel_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(145, 193);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(515, 246);
this.textBox1.TabIndex = 1;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -103,6 +113,7 @@ namespace U8AppMain
this.Text = "Form1";
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.kryptonDataGridView1)).EndInit();
this.ResumeLayout(false);
@@ -115,6 +126,7 @@ namespace U8AppMain
private System.Windows.Forms.Panel panel2;
private ComponentFactory.Krypton.Toolkit.KryptonDataGridView kryptonDataGridView1;
private System.Windows.Forms.Button BtnImportExcel;
private System.Windows.Forms.TextBox textBox1;
}
}

View File

@@ -53,8 +53,9 @@ namespace U8AppMain
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.Field<string>("版本生效日"));
bom.Bom.Version.BomType = row.Field<string>("BOM类别");
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))
@@ -65,17 +66,18 @@ namespace U8AppMain
{
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);
}
@@ -88,8 +90,9 @@ namespace U8AppMain
//bom.Bom.ComponentBodies.Add(new Bom.ComponentBody());
//bom.Bom.ComponentBodies.Add(new Bom.ComponentBody());
var strbody = XmlHelper.XmlSerialize(bomLookup.Values.ToList()[0], Encoding.UTF8);
var response = await HttpHelper.Post("", strbody);
MessageBox.Show(response);
//var response = await HttpHelper.Post("", strbody);
this.textBox1.Text = strbody;
MessageBox.Show(strbody);
}
private void BtnImportExcel_Click(object sender, EventArgs e)