Commit 6e29a642 LN

界面调整

1 个父辈 54093547
...@@ -30,12 +30,29 @@ ...@@ -30,12 +30,29 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmComponentList)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmComponentList));
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lblInfo = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.cmbSType = new System.Windows.Forms.ComboBox();
this.btnSearch = new System.Windows.Forms.Button();
this.txtSFeng = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.txtSDes = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.txtSPn = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtSName = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.txtBomFilePath = new System.Windows.Forms.TextBox(); this.txtBomFilePath = new System.Windows.Forms.TextBox();
this.btnBomImport = new System.Windows.Forms.Button(); this.btnBomImport = new System.Windows.Forms.Button();
this.btnDownLoad = new System.Windows.Forms.Button(); this.btnDownLoad = new System.Windows.Forms.Button();
this.groupInfo = new System.Windows.Forms.GroupBox(); this.groupInfo = new System.Windows.Forms.GroupBox();
this.lblTuijian = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.cmbSuanfa = new System.Windows.Forms.ComboBox();
this.btnNew = new System.Windows.Forms.Button();
this.txtPartNum = new System.Windows.Forms.TextBox(); this.txtPartNum = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.txtFengzhuang = new System.Windows.Forms.TextBox(); this.txtFengzhuang = new System.Windows.Forms.TextBox();
...@@ -49,11 +66,14 @@ ...@@ -49,11 +66,14 @@
this.Column_PN = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_PN = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_F = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_F = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Suanfa = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_suanfavalue = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Des = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column_Des = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Del = new System.Windows.Forms.DataGridViewLinkColumn(); this.Column_Del = new System.Windows.Forms.DataGridViewLinkColumn();
this.btnBack = new System.Windows.Forms.Button(); this.btnBack = new System.Windows.Forms.Button();
this.btnNew = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupInfo.SuspendLayout(); this.groupInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit();
...@@ -64,6 +84,7 @@ ...@@ -64,6 +84,7 @@
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.groupBox3);
this.groupBox1.Controls.Add(this.groupBox2); this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.btnDownLoad); this.groupBox1.Controls.Add(this.btnDownLoad);
this.groupBox1.Controls.Add(this.groupInfo); this.groupBox1.Controls.Add(this.groupInfo);
...@@ -77,29 +98,181 @@ ...@@ -77,29 +98,181 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "元器件库管理"; this.groupBox1.Text = "元器件库管理";
// //
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.lblInfo);
this.groupBox3.Controls.Add(this.label9);
this.groupBox3.Controls.Add(this.cmbSType);
this.groupBox3.Controls.Add(this.btnSearch);
this.groupBox3.Controls.Add(this.txtSFeng);
this.groupBox3.Controls.Add(this.label6);
this.groupBox3.Controls.Add(this.txtSDes);
this.groupBox3.Controls.Add(this.label8);
this.groupBox3.Controls.Add(this.txtSPn);
this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Controls.Add(this.txtSName);
this.groupBox3.Controls.Add(this.label4);
this.groupBox3.Location = new System.Drawing.Point(7, 18);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(881, 94);
this.groupBox3.TabIndex = 75;
this.groupBox3.TabStop = false;
//
// lblInfo
//
this.lblInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblInfo.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblInfo.Location = new System.Drawing.Point(594, 69);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(281, 17);
this.lblInfo.TabIndex = 86;
this.lblInfo.Text = "lblInfo";
this.lblInfo.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(446, 23);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(44, 17);
this.label9.TabIndex = 85;
this.label9.Text = "算法:";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// cmbSType
//
this.cmbSType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbSType.FormattingEnabled = true;
this.cmbSType.Items.AddRange(new object[] {
"算法A",
"算法B",
"算法C",
"算法D",
"算法E",
"--未配置--",
"--所有--"});
this.cmbSType.Location = new System.Drawing.Point(496, 20);
this.cmbSType.Name = "cmbSType";
this.cmbSType.Size = new System.Drawing.Size(92, 25);
this.cmbSType.TabIndex = 84;
//
// btnSearch
//
this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSearch.Location = new System.Drawing.Point(745, 12);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(130, 37);
this.btnSearch.TabIndex = 83;
this.btnSearch.Text = "查询";
this.btnSearch.UseVisualStyleBackColor = true;
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// txtSFeng
//
this.txtSFeng.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSFeng.Location = new System.Drawing.Point(292, 20);
this.txtSFeng.MaxLength = 30;
this.txtSFeng.Name = "txtSFeng";
this.txtSFeng.Size = new System.Drawing.Size(130, 23);
this.txtSFeng.TabIndex = 82;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(242, 23);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(44, 17);
this.label6.TabIndex = 81;
this.label6.Text = "封装:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtSDes
//
this.txtSDes.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSDes.Location = new System.Drawing.Point(292, 55);
this.txtSDes.MaxLength = 30;
this.txtSDes.Multiline = true;
this.txtSDes.Name = "txtSDes";
this.txtSDes.Size = new System.Drawing.Size(296, 23);
this.txtSDes.TabIndex = 80;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(242, 58);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(44, 17);
this.label8.TabIndex = 79;
this.label8.Text = "描述:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtSPn
//
this.txtSPn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSPn.Location = new System.Drawing.Point(93, 20);
this.txtSPn.MaxLength = 30;
this.txtSPn.Name = "txtSPn";
this.txtSPn.Size = new System.Drawing.Size(130, 23);
this.txtSPn.TabIndex = 78;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(9, 23);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 17);
this.label3.TabIndex = 77;
this.label3.Text = "元器件编号:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtSName
//
this.txtSName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSName.Location = new System.Drawing.Point(93, 55);
this.txtSName.MaxLength = 30;
this.txtSName.Name = "txtSName";
this.txtSName.Size = new System.Drawing.Size(130, 23);
this.txtSName.TabIndex = 76;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(45, 58);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 75;
this.label4.Text = "产品:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox2 // groupBox2
// //
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.button1); this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Controls.Add(this.txtBomFilePath); this.groupBox2.Controls.Add(this.txtBomFilePath);
this.groupBox2.Controls.Add(this.btnBomImport); this.groupBox2.Controls.Add(this.btnBomImport);
this.groupBox2.Location = new System.Drawing.Point(853, 343); this.groupBox2.Location = new System.Drawing.Point(902, 401);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(399, 187); this.groupBox2.Size = new System.Drawing.Size(365, 187);
this.groupBox2.TabIndex = 74; this.groupBox2.TabIndex = 74;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "上传更新元器件库"; this.groupBox2.Text = "上传更新元器件库(相同料号将覆盖原有信息)";
// //
// button1 // button1
// //
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(243, 117); this.button1.Location = new System.Drawing.Point(224, 118);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(130, 45); this.button1.Size = new System.Drawing.Size(130, 45);
this.button1.TabIndex = 12; this.button1.TabIndex = 12;
this.button1.Text = "保存元器件库"; this.button1.Text = "保存元器件库";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// txtBomFilePath // txtBomFilePath
// //
...@@ -108,7 +281,7 @@ ...@@ -108,7 +281,7 @@
this.txtBomFilePath.Location = new System.Drawing.Point(18, 37); this.txtBomFilePath.Location = new System.Drawing.Point(18, 37);
this.txtBomFilePath.Multiline = true; this.txtBomFilePath.Multiline = true;
this.txtBomFilePath.Name = "txtBomFilePath"; this.txtBomFilePath.Name = "txtBomFilePath";
this.txtBomFilePath.Size = new System.Drawing.Size(355, 61); this.txtBomFilePath.Size = new System.Drawing.Size(336, 61);
this.txtBomFilePath.TabIndex = 10; this.txtBomFilePath.TabIndex = 10;
// //
// btnBomImport // btnBomImport
...@@ -121,24 +294,27 @@ ...@@ -121,24 +294,27 @@
this.btnBomImport.TabIndex = 8; this.btnBomImport.TabIndex = 8;
this.btnBomImport.Text = "选择文件"; this.btnBomImport.Text = "选择文件";
this.btnBomImport.UseVisualStyleBackColor = true; this.btnBomImport.UseVisualStyleBackColor = true;
this.btnBomImport.Click += new System.EventHandler(this.btnBomImport_Click);
// //
// btnDownLoad // btnDownLoad
// //
this.btnDownLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnDownLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnDownLoad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnDownLoad.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDownLoad.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnDownLoad.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDownLoad.Location = new System.Drawing.Point(941, 598); this.btnDownLoad.Location = new System.Drawing.Point(990, 621);
this.btnDownLoad.Name = "btnDownLoad"; this.btnDownLoad.Name = "btnDownLoad";
this.btnDownLoad.Size = new System.Drawing.Size(130, 45); this.btnDownLoad.Size = new System.Drawing.Size(130, 45);
this.btnDownLoad.TabIndex = 71; this.btnDownLoad.TabIndex = 71;
this.btnDownLoad.Text = "下载模板"; this.btnDownLoad.Text = "下载元器件库";
this.btnDownLoad.UseVisualStyleBackColor = true; this.btnDownLoad.UseVisualStyleBackColor = true;
this.btnDownLoad.Click += new System.EventHandler(this.btnDownLoad_Click); this.btnDownLoad.Click += new System.EventHandler(this.btnDownLoad_Click);
// //
// groupInfo // groupInfo
// //
this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.groupInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right))); this.groupInfo.Controls.Add(this.lblTuijian);
this.groupInfo.Controls.Add(this.label10);
this.groupInfo.Controls.Add(this.cmbSuanfa);
this.groupInfo.Controls.Add(this.btnNew); this.groupInfo.Controls.Add(this.btnNew);
this.groupInfo.Controls.Add(this.txtPartNum); this.groupInfo.Controls.Add(this.txtPartNum);
this.groupInfo.Controls.Add(this.label7); this.groupInfo.Controls.Add(this.label7);
...@@ -149,29 +325,78 @@ ...@@ -149,29 +325,78 @@
this.groupInfo.Controls.Add(this.txtName); this.groupInfo.Controls.Add(this.txtName);
this.groupInfo.Controls.Add(this.label1); this.groupInfo.Controls.Add(this.label1);
this.groupInfo.Controls.Add(this.btnSave); this.groupInfo.Controls.Add(this.btnSave);
this.groupInfo.Location = new System.Drawing.Point(853, 22); this.groupInfo.Location = new System.Drawing.Point(902, 18);
this.groupInfo.Name = "groupInfo"; this.groupInfo.Name = "groupInfo";
this.groupInfo.Size = new System.Drawing.Size(399, 315); this.groupInfo.Size = new System.Drawing.Size(365, 353);
this.groupInfo.TabIndex = 68; this.groupInfo.TabIndex = 68;
this.groupInfo.TabStop = false; this.groupInfo.TabStop = false;
this.groupInfo.Text = "元器件基本信息"; this.groupInfo.Text = "元器件基本信息";
// //
// lblTuijian
//
this.lblTuijian.AutoSize = true;
this.lblTuijian.Location = new System.Drawing.Point(224, 236);
this.lblTuijian.Name = "lblTuijian";
this.lblTuijian.Size = new System.Drawing.Size(32, 17);
this.lblTuijian.TabIndex = 88;
this.lblTuijian.Text = "推荐";
this.lblTuijian.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(38, 236);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(44, 17);
this.label10.TabIndex = 87;
this.label10.Text = "算法:";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// cmbSuanfa
//
this.cmbSuanfa.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbSuanfa.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbSuanfa.FormattingEnabled = true;
this.cmbSuanfa.Items.AddRange(new object[] {
"算法A",
"算法B",
"算法C",
"算法D",
"算法E",
"--未配置--"});
this.cmbSuanfa.Location = new System.Drawing.Point(88, 230);
this.cmbSuanfa.Name = "cmbSuanfa";
this.cmbSuanfa.Size = new System.Drawing.Size(130, 28);
this.cmbSuanfa.TabIndex = 86;
//
// btnNew
//
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNew.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNew.Location = new System.Drawing.Point(88, 288);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(130, 45);
this.btnNew.TabIndex = 75;
this.btnNew.Text = "新增";
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// txtPartNum // txtPartNum
// //
this.txtPartNum.Enabled = false; this.txtPartNum.Enabled = false;
this.txtPartNum.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtPartNum.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtPartNum.Location = new System.Drawing.Point(102, 41); this.txtPartNum.Location = new System.Drawing.Point(88, 41);
this.txtPartNum.MaxLength = 30; this.txtPartNum.MaxLength = 30;
this.txtPartNum.Name = "txtPartNum"; this.txtPartNum.Name = "txtPartNum";
this.txtPartNum.Size = new System.Drawing.Size(271, 29); this.txtPartNum.Size = new System.Drawing.Size(266, 29);
this.txtPartNum.TabIndex = 74; this.txtPartNum.TabIndex = 74;
// //
// label7 // label7
// //
this.label7.AutoSize = true; this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(28, 48); this.label7.Location = new System.Drawing.Point(2, 48);
this.label7.Name = "label7"; this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(68, 17); this.label7.Size = new System.Drawing.Size(80, 17);
this.label7.TabIndex = 73; this.label7.TabIndex = 73;
this.label7.Text = "元器件编号:"; this.label7.Text = "元器件编号:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
...@@ -179,16 +404,16 @@ ...@@ -179,16 +404,16 @@
// txtFengzhuang // txtFengzhuang
// //
this.txtFengzhuang.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtFengzhuang.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtFengzhuang.Location = new System.Drawing.Point(102, 131); this.txtFengzhuang.Location = new System.Drawing.Point(88, 127);
this.txtFengzhuang.MaxLength = 30; this.txtFengzhuang.MaxLength = 30;
this.txtFengzhuang.Name = "txtFengzhuang"; this.txtFengzhuang.Name = "txtFengzhuang";
this.txtFengzhuang.Size = new System.Drawing.Size(271, 29); this.txtFengzhuang.Size = new System.Drawing.Size(266, 29);
this.txtFengzhuang.TabIndex = 70; this.txtFengzhuang.TabIndex = 70;
// //
// label5 // label5
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(52, 138); this.label5.Location = new System.Drawing.Point(38, 134);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(44, 17); this.label5.Size = new System.Drawing.Size(44, 17);
this.label5.TabIndex = 69; this.label5.TabIndex = 69;
...@@ -197,18 +422,18 @@ ...@@ -197,18 +422,18 @@
// //
// txtDes // txtDes
// //
this.txtDes.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtDes.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtDes.Location = new System.Drawing.Point(102, 176); this.txtDes.Location = new System.Drawing.Point(88, 170);
this.txtDes.MaxLength = 30; this.txtDes.MaxLength = 30;
this.txtDes.Multiline = true; this.txtDes.Multiline = true;
this.txtDes.Name = "txtDes"; this.txtDes.Name = "txtDes";
this.txtDes.Size = new System.Drawing.Size(271, 46); this.txtDes.Size = new System.Drawing.Size(266, 46);
this.txtDes.TabIndex = 66; this.txtDes.TabIndex = 66;
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(52, 183); this.label2.Location = new System.Drawing.Point(38, 176);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17); this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 34; this.label2.TabIndex = 34;
...@@ -218,16 +443,16 @@ ...@@ -218,16 +443,16 @@
// txtName // txtName
// //
this.txtName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.txtName.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtName.Location = new System.Drawing.Point(102, 86); this.txtName.Location = new System.Drawing.Point(88, 84);
this.txtName.MaxLength = 30; this.txtName.MaxLength = 30;
this.txtName.Name = "txtName"; this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(271, 29); this.txtName.Size = new System.Drawing.Size(266, 29);
this.txtName.TabIndex = 33; this.txtName.TabIndex = 33;
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(52, 93); this.label1.Location = new System.Drawing.Point(38, 91);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 17); this.label1.Size = new System.Drawing.Size(44, 17);
this.label1.TabIndex = 32; this.label1.TabIndex = 32;
...@@ -238,7 +463,7 @@ ...@@ -238,7 +463,7 @@
// //
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSave.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(243, 242); this.btnSave.Location = new System.Drawing.Point(224, 288);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(130, 45); this.btnSave.Size = new System.Drawing.Size(130, 45);
this.btnSave.TabIndex = 4; this.btnSave.TabIndex = 4;
...@@ -258,16 +483,18 @@ ...@@ -258,16 +483,18 @@
this.Column_PN, this.Column_PN,
this.Column_Name, this.Column_Name,
this.Column_F, this.Column_F,
this.Column_Suanfa,
this.Column_suanfavalue,
this.Column_Des, this.Column_Des,
this.Column_Del}); this.Column_Del});
this.dgvList.Location = new System.Drawing.Point(7, 22); this.dgvList.Location = new System.Drawing.Point(7, 118);
this.dgvList.MultiSelect = false; this.dgvList.MultiSelect = false;
this.dgvList.Name = "dgvList"; this.dgvList.Name = "dgvList";
this.dgvList.ReadOnly = true; this.dgvList.ReadOnly = true;
this.dgvList.RowHeadersWidth = 10; this.dgvList.RowHeadersWidth = 10;
this.dgvList.RowTemplate.Height = 23; this.dgvList.RowTemplate.Height = 23;
this.dgvList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvList.Size = new System.Drawing.Size(830, 684); this.dgvList.Size = new System.Drawing.Size(881, 594);
this.dgvList.TabIndex = 32; this.dgvList.TabIndex = 32;
this.dgvList.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvList_CellContentClick); this.dgvList.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvList_CellContentClick);
this.dgvList.SelectionChanged += new System.EventHandler(this.dgvList_SelectionChanged); this.dgvList.SelectionChanged += new System.EventHandler(this.dgvList_SelectionChanged);
...@@ -293,6 +520,19 @@ ...@@ -293,6 +520,19 @@
this.Column_F.ReadOnly = true; this.Column_F.ReadOnly = true;
this.Column_F.Width = 150; this.Column_F.Width = 150;
// //
// Column_Suanfa
//
this.Column_Suanfa.HeaderText = "算法";
this.Column_Suanfa.Name = "Column_Suanfa";
this.Column_Suanfa.ReadOnly = true;
//
// Column_suanfavalue
//
this.Column_suanfavalue.HeaderText = "算法值";
this.Column_suanfavalue.Name = "Column_suanfavalue";
this.Column_suanfavalue.ReadOnly = true;
this.Column_suanfavalue.Visible = false;
//
// Column_Des // Column_Des
// //
this.Column_Des.HeaderText = "描述"; this.Column_Des.HeaderText = "描述";
...@@ -316,24 +556,17 @@ ...@@ -316,24 +556,17 @@
this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBack.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(1096, 598); this.btnBack.Location = new System.Drawing.Point(1126, 621);
this.btnBack.Name = "btnBack"; this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(130, 45); this.btnBack.Size = new System.Drawing.Size(130, 45);
this.btnBack.TabIndex = 6; this.btnBack.TabIndex = 6;
this.btnBack.Text = "返回"; this.btnBack.Text = "关闭";
this.btnBack.UseVisualStyleBackColor = true; this.btnBack.UseVisualStyleBackColor = true;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click); this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
// //
// btnNew // openFileDialog1
// //
this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.openFileDialog1.FileName = "openFileDialog1";
this.btnNew.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnNew.Location = new System.Drawing.Point(88, 242);
this.btnNew.Name = "btnNew";
this.btnNew.Size = new System.Drawing.Size(130, 45);
this.btnNew.TabIndex = 75;
this.btnNew.Text = "新增";
this.btnNew.UseVisualStyleBackColor = true;
// //
// FrmComponentList // FrmComponentList
// //
...@@ -349,6 +582,8 @@ ...@@ -349,6 +582,8 @@
this.Load += new System.EventHandler(this.FrmPointType_Load); this.Load += new System.EventHandler(this.FrmPointType_Load);
this.Shown += new System.EventHandler(this.FrmComponentList_Shown); this.Shown += new System.EventHandler(this.FrmComponentList_Shown);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout(); this.groupBox2.PerformLayout();
this.groupInfo.ResumeLayout(false); this.groupInfo.ResumeLayout(false);
...@@ -378,11 +613,30 @@ ...@@ -378,11 +613,30 @@
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox txtBomFilePath; private System.Windows.Forms.TextBox txtBomFilePath;
private System.Windows.Forms.Button btnBomImport; private System.Windows.Forms.Button btnBomImport;
private System.Windows.Forms.Button btnNew;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox txtSFeng;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox txtSDes;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtSPn;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtSName;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnSearch;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox cmbSType;
private System.Windows.Forms.Label lblInfo;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.ComboBox cmbSuanfa;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_PN; private System.Windows.Forms.DataGridViewTextBoxColumn Column_PN;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Name; private System.Windows.Forms.DataGridViewTextBoxColumn Column_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_F; private System.Windows.Forms.DataGridViewTextBoxColumn Column_F;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Suanfa;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_suanfavalue;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Des; private System.Windows.Forms.DataGridViewTextBoxColumn Column_Des;
private System.Windows.Forms.DataGridViewLinkColumn Column_Del; private System.Windows.Forms.DataGridViewLinkColumn Column_Del;
private System.Windows.Forms.Button btnNew; private System.Windows.Forms.Label lblTuijian;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -11,23 +11,23 @@ using System.Windows.Forms; ...@@ -11,23 +11,23 @@ using System.Windows.Forms;
using System.IO; using System.IO;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
namespace OnlineStore.AutoCountClient namespace OnlineStore.AutoCountClient
{ {
internal partial class FrmComponentList : FrmBase internal partial class FrmComponentList : FrmBase
{ {
public static FrmComponentList instance = new FrmComponentList(); internal FrmComponentList()
private FrmComponentList()
{ {
InitializeComponent(); InitializeComponent();
} }
private void FrmPointType_Load(object sender, EventArgs e) private void FrmPointType_Load(object sender, EventArgs e)
{ {
cmbSType.SelectedIndex = 5;
btnSearch_Click(null, null);
} }
private DataGridViewRow SetRowInfo(DataGridViewRow view, ComponetInfo com) private DataGridViewRow SetRowInfo(DataGridViewRow view, ComponetInfo com)
{ {
if (view == null) if (view == null)
...@@ -39,71 +39,97 @@ namespace OnlineStore.AutoCountClient ...@@ -39,71 +39,97 @@ namespace OnlineStore.AutoCountClient
view.Cells[this.Column_Name.Index].Value = com.ProductName.ToString(); view.Cells[this.Column_Name.Index].Value = com.ProductName.ToString();
view.Cells[Column_F.Index].Value = com.Encapsulations.ToString(); view.Cells[Column_F.Index].Value = com.Encapsulations.ToString();
view.Cells[this.Column_Des.Index].Value = com.Describe.ToString(); view.Cells[this.Column_Des.Index].Value = com.Describe.ToString();
view.Cells[this.Column_Suanfa.Index].Value = ParamManager.GetSufanStr(com.Sufan);
view.Cells[this.Column_suanfavalue.Index].Value = com.Sufan;
return view; return view;
} }
private ComponetInfo GetFormCom(DataGridViewRow row)
{
ComponetInfo obj = getRowPointInfo(row);
obj.Describe = FormUtil.GetValue(txtDes);
obj.ProductName = FormUtil.GetValue(txtName);
obj.Encapsulations = FormUtil.GetValue(txtFengzhuang);
obj.PartNum = FormUtil.GetValue(txtPartNum);
obj.Sufan = -1;
if (cmbSuanfa.SelectedIndex < 5)
{
obj.Sufan = cmbSuanfa.SelectedIndex;
}
return obj;
}
private void btnSave_Click(object sender, EventArgs e) private void btnSave_Click(object sender, EventArgs e)
{ {
////if (groupInfo.Text.StartsWith("新增")) ComponetInfo obj = new ComponetInfo();
////{ if (groupInfo.Text.StartsWith("新增"))
//// //AddCom(); {
////} obj = GetFormCom(null);
////else if (obj.PartNum .Equals(""))
//{ {
// if (dgvList.SelectedRows != null && dgvList.SelectedRows.Count > 0) MessageBox.Show("请输入元器件编号");
// { txtPartNum.Focus();
// int rowIndex = dgvList.SelectedRows[0].Index; return;
}
// DataGridViewRow row = dgvList.Rows[rowIndex]; if (CSVBomManager.allComMap.ContainsKey(obj.PartNum))
// ComponetInfo obj = getRowPointInfo(row); {
// if (obj == null) MessageBox.Show("元器件编号【"+obj.PartNum+"】已存在,请重新输入");
// { txtPartNum.Focus();
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectC,"请选择元器件!")); return;
// return; }
// }
// if (cmbPositionNumList.SelectedIndex < 0) if (obj.Encapsulations.Equals(""))
// { {
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.SelectCPosition,"请选择元器件位置!")); MessageBox.Show("请输入元器件封装");
// cmbPositionNumList.Focus(); txtName.Focus();
// return; return;
// } }
// TSAVPosition position = (TSAVPosition)cmbPositionNumList.SelectedItem;
CSVBomManager.SaveComponet(obj);
// obj.ComponentName = FormUtil.getValue(txtName); DataGridViewRow row = SetRowInfo(null, obj);
// obj.ComponentDes = FormUtil.getValue(txtDes); dgvList.Rows.Add(row);
// obj.ComCount = FormUtil.GetIntValue(txtCount); MessageBox.Show("新增元器件【" + obj.PartNum + "】保存成功!");
// obj.Notes = FormUtil.getValue(txtNotes); groupInfo.Text = "元器件【" + obj.PartNum + "】的基本信息";
// obj.PartNum = FormUtil.getValue(txtPartNum);
if (obj.Sufan >= 0)
// obj.PositionNum = position.PositionNum; {
ParamManager.UpdateParam(new CountParam(obj.PartNum, RobotManager.robot.XrayBean.ThresholdValue, 3, obj.Sufan));
// if (obj.ComponentName.Equals("")) ParamManager.SaveMapToFile();
// { }
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComName,"请输入元器件名称!")); }
// txtName.Focus(); else
// return; {
// } if (dgvList.SelectedRows != null && dgvList.SelectedRows.Count > 0)
// //if (obj.PositionNum.Equals("")) {
// //{ int rowIndex = dgvList.SelectedRows[0].Index;
// // MessageBox.Show("请输入元器件所在位置!");
// // this.txtPosition.Focus(); DataGridViewRow row = dgvList.Rows[rowIndex];
// // return; obj = GetFormCom(row);
// //} if (obj == null)
// if (obj.ComCount<=0) {
// { MessageBox.Show("请选择元器件!");
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.WriteComNum,"请输入元器件数量!")); return;
// txtCount.Focus(); }
// return;
// } if (obj.Encapsulations.Equals(""))
{
// CSVReaderBomManager.SaveComponet(cmbList.Text, obj); MessageBox.Show("请输入元器件封装!");
// //ComponentManager.Update(obj); txtName.Focus();
// SetRowInfo(dgvList.Rows[rowIndex], obj); return;
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.ComSaveOk,"元器件【{0}】保存成功!", obj.PartNum + "-" + obj.ComponentName )); }
// groupInfo.Text = ResourceCulture.GetString(ResourceCulture.ComInfo,"元器件【{0}】的基本信息",obj.PartNum + "-" + obj.ComponentName);
// } CSVBomManager.SaveComponet(obj);
//} SetRowInfo(dgvList.Rows[rowIndex], obj);
MessageBox.Show("元器件【" + obj.PartNum + "】保存成功!");
groupInfo.Text = "元器件【" + obj.PartNum + "】的基本信息";
if (obj.Sufan >= 0)
{
ParamManager.UpdateParam(new CountParam(obj.PartNum, RobotManager.robot.XrayBean.ThresholdValue, 3, obj.Sufan));
ParamManager.SaveMapToFile();
}
}
}
} }
private void btnDel_Click(object sender, EventArgs e) private void btnDel_Click(object sender, EventArgs e)
...@@ -118,6 +144,10 @@ namespace OnlineStore.AutoCountClient ...@@ -118,6 +144,10 @@ namespace OnlineStore.AutoCountClient
private ComponetInfo getRowPointInfo(DataGridViewRow row) private ComponetInfo getRowPointInfo(DataGridViewRow row)
{ {
ComponetInfo point = new ComponetInfo(); ComponetInfo point = new ComponetInfo();
if (row == null)
{
return point;
}
try try
{ {
if (row.Cells[Column_PN.Name].Value == null) if (row.Cells[Column_PN.Name].Value == null)
...@@ -132,7 +162,7 @@ namespace OnlineStore.AutoCountClient ...@@ -132,7 +162,7 @@ namespace OnlineStore.AutoCountClient
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error( "保存数据出错:" + ex.ToString()); LogUtil.error("保存数据出错:" + ex.ToString());
return null; return null;
} }
return point; return point;
...@@ -143,7 +173,7 @@ namespace OnlineStore.AutoCountClient ...@@ -143,7 +173,7 @@ namespace OnlineStore.AutoCountClient
ComponetInfo obj = getRowPointInfo(row); ComponetInfo obj = getRowPointInfo(row);
if (obj == null) if (obj == null)
{ {
MessageBox.Show( "请选择元器件!" ); MessageBox.Show("请选择元器件!");
return; return;
} }
txtPartNum.Tag = obj; txtPartNum.Tag = obj;
...@@ -151,16 +181,33 @@ namespace OnlineStore.AutoCountClient ...@@ -151,16 +181,33 @@ namespace OnlineStore.AutoCountClient
txtDes.Text = obj.Describe; txtDes.Text = obj.Describe;
txtFengzhuang.Text = obj.Encapsulations.ToString(); txtFengzhuang.Text = obj.Encapsulations.ToString();
txtPartNum.Text = obj.PartNum; txtPartNum.Text = obj.PartNum;
int index = -1; if (obj.Sufan >= 0 && obj.Sufan < 5)
{
lblTuijian.Text = "";
cmbSuanfa.SelectedIndex = obj.Sufan;
}
else
{
cmbSuanfa.SelectedIndex = 5;
CountParam p = ParamManager.GetOptimalParamByPN(obj.PartNum);
if (p != null&&p.Sign>=0)
{
lblTuijian.Text = "推荐:" + ParamManager.GetSufanStr(p.Sign);
}
else
{
lblTuijian.Text = "";
}
}
txtPartNum.Enabled = false;
groupInfo.Text = "元器件【"+ obj.PartNum + "】的基本信息"; groupInfo.Text = "元器件【" + obj.PartNum + "】的基本信息";
} }
private void DeleteCom(int rowIndex) private void DeleteCom(int rowIndex)
{ {
DataGridViewRow row = dgvList.Rows[rowIndex]; DataGridViewRow row = dgvList.Rows[rowIndex];
ComponetInfo obj = getRowPointInfo(row); ComponetInfo obj = getRowPointInfo(row);
if (MessageBox.Show( if (MessageBox.Show("确认要删除元器件【" + obj.PartNum + "】吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
"确认要删除元器件【" + obj.PartNum + "】吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
{ {
return; return;
} }
...@@ -174,9 +221,7 @@ namespace OnlineStore.AutoCountClient ...@@ -174,9 +221,7 @@ namespace OnlineStore.AutoCountClient
private void btnBack_Click(object sender, EventArgs e) private void btnBack_Click(object sender, EventArgs e)
{ {
//this.Close(); this.Close();
this.Visible = false;
//FrmMenu.frmMain.Visible = true;
} }
private void dgvList_CellContentClick(object sender, DataGridViewCellEventArgs e) private void dgvList_CellContentClick(object sender, DataGridViewCellEventArgs e)
...@@ -202,27 +247,18 @@ namespace OnlineStore.AutoCountClient ...@@ -202,27 +247,18 @@ namespace OnlineStore.AutoCountClient
private void btnDownLoad_Click(object sender, EventArgs e) private void btnDownLoad_Click(object sender, EventArgs e)
{ {
//SaveFileDialog sfd = new SaveFileDialog(); SaveFileDialog sfd = new SaveFileDialog();
//sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
//sfd.FileName = ResourceCulture.GetString( "元器件库模板"); sfd.FileName = "元器件库";
//sfd.Filter = @"csv|*.csv"; sfd.Filter = @"csv|*.csv";
//DialogResult result = sfd.ShowDialog(); DialogResult result = sfd.ShowDialog();
//if (result.Equals(DialogResult.OK)) if (result.Equals(DialogResult.OK))
//{ {
// string filePath = sfd.FileName; string filePath = sfd.FileName;
// //if (Directory.Exists(filePath)) CSVBomManager.SaveToFile(filePath);
// { MessageBox.Show("元器件库信息已导出:" + filePath);
// string sourcePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Componet_Template); }
// if (File.Exists(filePath))
// {
// File.Delete(filePath);
// }
// //复制文件
// File.Copy(sourcePath, filePath);
// MessageBox.Show(ResourceCulture.GetString(ResourceCulture.DemoSave,"模板已保存在:" )+ filePath);
// }
//}
} }
...@@ -238,6 +274,148 @@ namespace OnlineStore.AutoCountClient ...@@ -238,6 +274,148 @@ namespace OnlineStore.AutoCountClient
} }
private void btnNew_Click(object sender, EventArgs e)
{
txtPartNum.Tag = "";
txtName.Text = "";
txtDes.Text = "";
txtFengzhuang.Text = "";
txtPartNum.Text = "";
cmbSuanfa.SelectedIndex = 5;
txtPartNum.Enabled = true;
groupInfo.Text = "新增元器件";
}
private List<ComponetInfo> FileComList = new List<ComponetInfo>();
private void btnBomImport_Click(object sender, EventArgs e)
{
this.txtBomFilePath.Text = "";
openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
DialogResult result = this.openFileDialog1.ShowDialog();
if (result.Equals(DialogResult.OK))
{
string fileName = this.openFileDialog1.FileName;
FileComList = CSVBomManager.ReadFile(fileName);
if (FileComList.Count > 0)
{
this.txtBomFilePath.Text = fileName;
}
else
{
MessageBox.Show("请选择正确的文件");
}
}
}
private void button1_Click(object sender, EventArgs e)
{
if (FileComList.Count <= 0 || txtBomFilePath.Text.Equals(""))
{
MessageBox.Show("请选择有效的元器件库文件 ");
btnBomImport.Focus();
return;
}
string msg = "上传元器件库,";
foreach (ComponetInfo obj in FileComList)
{
if (CSVBomManager.allComMap.ContainsKey(obj.PartNum))
{
CSVBomManager.allComMap[obj.PartNum] = obj;
msg += "\r\n 更新" + obj.ToStr();
}
else
{
CSVBomManager.allComMap.Add(obj.PartNum, obj);
msg += "\r\n 新增" + obj.ToStr();
}
}
bool result = CSVBomManager.SaveToFile();
msg += "\r\n 保存到文件:" + CSVBomManager.getFilePath() + ",=" + result;
LogUtil.info(msg);
btnSearch_Click(null, null);
}
private void btnSearch_Click(object sender, EventArgs e)
{
btnSearch.Enabled = false;
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
try
{
string sPn = FormUtil.GetValue(txtSPn);
string sDes = FormUtil.GetValue(txtSDes);
string sFeng = FormUtil.GetValue(txtSFeng);
string sName = FormUtil.GetValue(txtSName);
int type = cmbSType.SelectedIndex;
List<ComponetInfo> AllList = new List<ComponetInfo>(CSVBomManager.allComMap.Values);
dgvList.Rows.Clear();
int count = 0;
foreach (ComponetInfo com in AllList)
{
if (String.IsNullOrEmpty(sPn).Equals(false) && (!com.PartNum.Contains(sPn)))
{
continue;
}
if (String.IsNullOrEmpty(sDes).Equals(false) && (!com.Describe.Contains(sDes)))
{
continue;
}
if (String.IsNullOrEmpty(sFeng).Equals(false) && (!com.Encapsulations.Contains(sFeng)))
{
continue;
}
if (String.IsNullOrEmpty(sName).Equals(false) && (!com.ProductName.Contains(sName)))
{
continue;
}
CountParam param = ParamManager.GetParamByPN(com.PartNum);
if (param != null)
{
com.Sufan = param.Sign;
}
else
{
com.Sufan = -1;
}
int seleIndex = cmbSType.SelectedIndex;
if (seleIndex < 5)
{
if (param == null)
{
continue;
}
else if (!param.Sign.Equals(seleIndex))
{
continue;
}
}
else if (seleIndex.Equals(5))
{
if (!(param == null))
{
continue;
}
}
DataGridViewRow row = SetRowInfo(null, com);
dgvList.Rows.Add(row);
count++;
}
lblInfo.Text = "共" + AllList.Count + "条记录,当前查询到" + count + "条";
}catch(Exception ex)
{
LogUtil.error("查询数据出错:" + ex.ToString());
}
btnSearch.Enabled = true;
this.Cursor = System.Windows.Forms.Cursors.Default ;
}
} }
} }
...@@ -123,12 +123,21 @@ ...@@ -123,12 +123,21 @@
<metadata name="Column_F.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_F.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_Suanfa.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_suanfavalue.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Des.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Des.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_Del.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Del.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
......
...@@ -117,7 +117,7 @@ namespace OnlineStore.AutoCountClient ...@@ -117,7 +117,7 @@ namespace OnlineStore.AutoCountClient
} }
else else
{ {
ShowType(0); ShowType(-1);
} }
imgCurrImg.HorizontalScroll.Value = 173; imgCurrImg.HorizontalScroll.Value = 173;
...@@ -136,7 +136,7 @@ namespace OnlineStore.AutoCountClient ...@@ -136,7 +136,7 @@ namespace OnlineStore.AutoCountClient
return; return;
} }
CurrType = type; CurrType = type;
int index = 1; int index = 0;
btnTest.Text = "请选择算法"; btnTest.Text = "请选择算法";
foreach (Button btn in SelBtnList) foreach (Button btn in SelBtnList)
{ {
...@@ -153,7 +153,7 @@ namespace OnlineStore.AutoCountClient ...@@ -153,7 +153,7 @@ namespace OnlineStore.AutoCountClient
} }
index++; index++;
} }
bool isShowBtn = (type > 0); bool isShowBtn = (type >= 0&&type<5);
btnTest.Enabled = isShowBtn; btnTest.Enabled = isShowBtn;
btnNext.Enabled = isShowBtn; btnNext.Enabled = isShowBtn;
...@@ -169,11 +169,24 @@ namespace OnlineStore.AutoCountClient ...@@ -169,11 +169,24 @@ namespace OnlineStore.AutoCountClient
MessageBox.Show("未加载图片,无法点料"); MessageBox.Show("未加载图片,无法点料");
return; return;
} }
int index = 0;
foreach (Button btn in SelBtnList)
{
if (index.Equals(CurrType))
{
btnTest.Text = btn.Tag + "-点料测试";
break;
}
index++;
}
LogUtil.info( Name + "用户点击 "+btnTest.Text); LogUtil.info( Name + "用户点击 "+btnTest.Text);
try try
{ {
btnTest.Enabled = false; btnTest.Enabled = false;
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
int th = (int)numTh.Value; int th = (int)numTh.Value;
int wsize = (int)numWSize.Value; int wsize = (int)numWSize.Value;
Asa.API.EyemImage tpDstImg; Asa.API.EyemImage tpDstImg;
...@@ -188,6 +201,7 @@ namespace OnlineStore.AutoCountClient ...@@ -188,6 +201,7 @@ namespace OnlineStore.AutoCountClient
LogUtil.error("点料测试出错:" + ex.ToString()); LogUtil.error("点料测试出错:" + ex.ToString());
} }
btnTest.Enabled = true; btnTest.Enabled = true;
this.Cursor = System.Windows.Forms.Cursors.Default ;
} }
...@@ -215,24 +229,38 @@ namespace OnlineStore.AutoCountClient ...@@ -215,24 +229,38 @@ namespace OnlineStore.AutoCountClient
private void btnSaveParam_Click(object sender, EventArgs e) private void btnSaveParam_Click(object sender, EventArgs e)
{ {
SaveCurrParam(); SaveCurrParam();
int leftC = (ImageList.Count - currIndex - 1);
DialogResult result = MessageBox.Show("当前第[" + (currIndex + 1) + "]张图片,还剩余[" + (ImageList.Count - currIndex - 1) + "]张图片未选择算法,是否结束学习?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (leftC > 0)
{
DialogResult result = MessageBox.Show("当前第[" + (currIndex + 1) + "]张图片,还剩余[" + leftC + "]张图片未选择算法,是否结束学习?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
if (result.Equals(DialogResult.Yes)) if (result.Equals(DialogResult.Yes))
{ {
ParamManager.SaveMapToFile();
IsSave = true;
this.Close();
} }
else else
{ {
return; return;
} }
} }
ParamManager.SaveMapToFile();
IsSave = true;
this.Close();
}
private void btnNext_Click(object sender, EventArgs e) private void btnNext_Click(object sender, EventArgs e)
{ {
btnNext.Enabled = false;
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
try
{
SaveCurrParam(); SaveCurrParam();
ShowNextImg(); ShowNextImg();
}catch(Exception ex)
{
LogUtil.error("下一张 报错:" + ex.ToString());
}
btnNext.Enabled = true;
this.Cursor = System.Windows.Forms.Cursors.Default;
} }
private void btnCancel_Click(object sender, EventArgs e) private void btnCancel_Click(object sender, EventArgs e)
...@@ -313,23 +341,23 @@ namespace OnlineStore.AutoCountClient ...@@ -313,23 +341,23 @@ namespace OnlineStore.AutoCountClient
private void buttonA_Click(object sender, EventArgs e) private void buttonA_Click(object sender, EventArgs e)
{ {
ShowType(1); ShowType(0);
} }
private void buttonB_Click(object sender, EventArgs e) private void buttonB_Click(object sender, EventArgs e)
{ {
ShowType(2); ShowType(1);
} }
private void buttonC_Click(object sender, EventArgs e) private void buttonC_Click(object sender, EventArgs e)
{ {
ShowType(3); ShowType(2);
} }
private void buttonD_Click(object sender, EventArgs e) private void buttonD_Click(object sender, EventArgs e)
{ {
ShowType(4); ShowType(3);
} }
private void buttonE_Click(object sender, EventArgs e) private void buttonE_Click(object sender, EventArgs e)
{ {
ShowType(5); ShowType(4);
} }
} }
} }
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.设置TToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.设置TToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.元器件学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.元器件学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
this.二维码学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.二维码学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
...@@ -88,6 +87,9 @@ ...@@ -88,6 +87,9 @@
this.启用蜂鸣器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.启用蜂鸣器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lblXrayWork = new System.Windows.Forms.Label(); this.lblXrayWork = new System.Windows.Forms.Label();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
this.元器件库ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.panWork.SuspendLayout(); this.panWork.SuspendLayout();
...@@ -346,7 +348,7 @@ ...@@ -346,7 +348,7 @@
// //
this.设置TToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.设置TToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.元器件学习ToolStripMenuItem, this.元器件学习ToolStripMenuItem,
this.toolStripSeparator16, this.toolStripSeparator17,
this.二维码学习ToolStripMenuItem, this.二维码学习ToolStripMenuItem,
this.toolStripSeparator7, this.toolStripSeparator7,
this.toolStripMenuItem2, this.toolStripMenuItem2,
...@@ -359,43 +361,38 @@ ...@@ -359,43 +361,38 @@
// 元器件学习ToolStripMenuItem // 元器件学习ToolStripMenuItem
// //
this.元器件学习ToolStripMenuItem.Name = "元器件学习ToolStripMenuItem"; this.元器件学习ToolStripMenuItem.Name = "元器件学习ToolStripMenuItem";
this.元器件学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.元器件学习ToolStripMenuItem.Size = new System.Drawing.Size(234, 26);
this.元器件学习ToolStripMenuItem.Text = "元器件学习"; this.元器件学习ToolStripMenuItem.Text = "元器件学习";
this.元器件学习ToolStripMenuItem.Click += new System.EventHandler(this.元器件学习ToolStripMenuItem_Click); this.元器件学习ToolStripMenuItem.Click += new System.EventHandler(this.元器件学习ToolStripMenuItem_Click);
// //
// toolStripSeparator16
//
this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(177, 6);
//
// 二维码学习ToolStripMenuItem // 二维码学习ToolStripMenuItem
// //
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem"; this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(234, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码学习"; this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click); this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
// //
// toolStripSeparator7 // toolStripSeparator7
// //
this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator7.Size = new System.Drawing.Size(231, 6);
// //
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 26); this.toolStripMenuItem2.Size = new System.Drawing.Size(234, 26);
this.toolStripMenuItem2.Text = "AGV调试"; this.toolStripMenuItem2.Text = "AGV调试";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
// //
// toolStripSeparator6 // toolStripSeparator6
// //
this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator6.Size = new System.Drawing.Size(231, 6);
// //
// 标签编辑ToolStripMenuItem // 标签编辑ToolStripMenuItem
// //
this.标签编辑ToolStripMenuItem.Name = "标签编辑ToolStripMenuItem"; this.标签编辑ToolStripMenuItem.Name = "标签编辑ToolStripMenuItem";
this.标签编辑ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.标签编辑ToolStripMenuItem.Size = new System.Drawing.Size(234, 26);
this.标签编辑ToolStripMenuItem.Text = "标签编辑"; this.标签编辑ToolStripMenuItem.Text = "标签编辑";
this.标签编辑ToolStripMenuItem.Click += new System.EventHandler(this.标签编辑ToolStripMenuItem_Click); this.标签编辑ToolStripMenuItem.Click += new System.EventHandler(this.标签编辑ToolStripMenuItem_Click);
// //
...@@ -404,6 +401,8 @@ ...@@ -404,6 +401,8 @@
this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.帮助ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem3, this.toolStripMenuItem3,
this.toolStripSeparator5, this.toolStripSeparator5,
this.元器件库ToolStripMenuItem,
this.toolStripSeparator16,
this.清空日志ToolStripMenuItem, this.清空日志ToolStripMenuItem,
this.toolStripSeparator10, this.toolStripSeparator10,
this.复制日志ToolStripMenuItem, this.复制日志ToolStripMenuItem,
...@@ -578,6 +577,23 @@ ...@@ -578,6 +577,23 @@
this.lblXrayWork.Text = "警告:点料过程中,请勿开门"; this.lblXrayWork.Text = "警告:点料过程中,请勿开门";
this.lblXrayWork.Visible = false; this.lblXrayWork.Visible = false;
// //
// toolStripSeparator17
//
this.toolStripSeparator17.Name = "toolStripSeparator17";
this.toolStripSeparator17.Size = new System.Drawing.Size(231, 6);
//
// 元器件库ToolStripMenuItem
//
this.元器件库ToolStripMenuItem.Name = "元器件库ToolStripMenuItem";
this.元器件库ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.元器件库ToolStripMenuItem.Text = "元器件库";
this.元器件库ToolStripMenuItem.Click += new System.EventHandler(this.元器件库ToolStripMenuItem_Click);
//
// toolStripSeparator16
//
this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(177, 6);
//
// FrmRobotMain // FrmRobotMain
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
...@@ -670,8 +686,10 @@ ...@@ -670,8 +686,10 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator15; private System.Windows.Forms.ToolStripSeparator toolStripSeparator15;
private System.Windows.Forms.ToolStripMenuItem 启用蜂鸣器ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 启用蜂鸣器ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 元器件学习ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 元器件学习ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator16;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator17;
private System.Windows.Forms.ToolStripMenuItem 元器件库ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator16;
} }
} }
...@@ -112,6 +112,9 @@ namespace OnlineStore.AutoCountClient ...@@ -112,6 +112,9 @@ namespace OnlineStore.AutoCountClient
{ {
开机自动启动ToolStripMenuItem.Text = "开机自动启动"; 开机自动启动ToolStripMenuItem.Text = "开机自动启动";
} }
CSVBomManager.LoadAllCom();
LoadStoreData(); LoadStoreData();
LoadListView(); LoadListView();
LogUtil.logBox = this.logBox; LogUtil.logBox = this.logBox;
...@@ -899,5 +902,10 @@ namespace OnlineStore.AutoCountClient ...@@ -899,5 +902,10 @@ namespace OnlineStore.AutoCountClient
frm.ShowDialog(); frm.ShowDialog();
} }
} }
private void 元器件库ToolStripMenuItem_Click(object sender, EventArgs e)
{
FrmComponentList frm = new FrmComponentList();
frm.ShowDialog();
}
} }
} }
...@@ -9,6 +9,11 @@ namespace OnlineStore.Common ...@@ -9,6 +9,11 @@ namespace OnlineStore.Common
{ {
public class FormUtil public class FormUtil
{ {
public static string GetValue(TextBox txt)
{
string value = txt.Text;
return value;
}
public static int GetIntValue(TextBox txt) public static int GetIntValue(TextBox txt)
{ {
int value = 0; int value = 0;
......
...@@ -182,7 +182,9 @@ ...@@ -182,7 +182,9 @@
<None Include="XRAY\countParam.csv"> <None Include="XRAY\countParam.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="XRAY\pnDetailedList.csv" /> <None Include="XRAY\pnDetailedList.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
物料编号,描述,产品,封装 物料编号,描述,产品,封装
2B.C0132.051,#SKT MICRO USB3.0B GF H2.83 BK,#SKT,未找到 2B.C0132.051,#SKT MICRO USB3.0B GF H2.83 BK,#SKT111,未找到
2K.D1091.102,HEAD ML1R 2P ST D1.25 JS-1147V,HEAD,未找到 2K.D1091.102,HEAD ML1R 2P ST D1.25 JS-1147V,HEAD,未找到
2K.D2128.102,HEAD ML 1R2P D.8 RT H1.7,HEAD,未找到 2K.D2128.102,HEAD ML 1R2P D.8 RT H1.7,HEAD,未找到
2K.E2021.102,HEAD FML 1R2P D0.8 H1.75,HEAD,未找到 2K.E2021.102,HEAD FML 1R2P D0.8 H1.75,HEAD,未找到
......
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
...@@ -20,6 +21,31 @@ namespace OnlineStore.DeviceLibrary ...@@ -20,6 +21,31 @@ namespace OnlineStore.DeviceLibrary
ConfigFilePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.CounParamConfig); ConfigFilePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.CounParamConfig);
countParamMap = LoadParamMap( ); countParamMap = LoadParamMap( );
} }
public static string GetSufanStr(int type)
{
if (type.Equals(0))
{
return "算法A";
}
else if (type.Equals(1))
{
return "算法B";
}
else if (type.Equals(2))
{
return "算法C";
}
else if (type.Equals(3))
{
return "算法D";
}
else if (type.Equals(4))
{
return "算法E";
}
return "";
}
public static CountParam GetParamByPN(string pn) public static CountParam GetParamByPN(string pn)
{ {
if (countParamMap.ContainsKey(pn)) if (countParamMap.ContainsKey(pn))
...@@ -152,6 +178,51 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,6 +178,51 @@ namespace OnlineStore.DeviceLibrary
if (param == null) if (param == null)
{ {
//TODO //TODO
ComponetInfo com = CSVBomManager.GetCom(currPN);
if (com == null)
{
LogUtil.info("元器件库未找到 PN=" + currPN + " 的元器件");
return param;
}
List<ComponetInfo> FZList = new List<ComponetInfo>();
Dictionary<int, int> sufaCount = new Dictionary<int, int>();
int maxSufa = -1;
int maxCount = 0;
foreach (ComponetInfo obj in CSVBomManager.allComMap.Values)
{
if (obj.Encapsulations.Trim().Equals(com.Encapsulations.Trim()))
{
CountParam p = GetParamByPN(obj.PartNum);
if (p != null)
{
obj.Sufan = p.Sign;
if (sufaCount.ContainsKey(obj.Sufan))
{
sufaCount[obj.Sufan]++;
}
else
{
sufaCount.Add(obj.Sufan, 1);
}
if (sufaCount[obj.Sufan] > maxCount)
{
maxCount = sufaCount[obj.Sufan];
maxSufa = obj.Sufan;
}
}
FZList.Add(obj);
}
}
if (maxCount >= 1)
{
LogUtil.info("元器件【" + com.ToStr() + "】查找到最优算法:【" + maxSufa + "】");
param = new CountParam(currPN, RobotManager.robot.XrayBean.ThresholdValue, 3, maxSufa);
}
} }
return param; return param;
} }
......
...@@ -22,7 +22,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -22,7 +22,7 @@ namespace OnlineStore.LoadCSVLibrary
public static bool LoadAllCom() public static bool LoadAllCom()
{ {
string fileName = getFilePath(); string fileName = getFilePath();
if (!Directory.Exists(fileName)) if (!File.Exists(fileName))
{ {
return false; return false;
} }
...@@ -30,20 +30,20 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -30,20 +30,20 @@ namespace OnlineStore.LoadCSVLibrary
{ {
string bomName = Path.GetFileNameWithoutExtension(fileName); //-->BenXHCMS string bomName = Path.GetFileNameWithoutExtension(fileName); //-->BenXHCMS
List<ComponetInfo> list = ReadFile(fileName); List<ComponetInfo> list = ReadFile(fileName);
Dictionary<string, ComponetInfo> map = new Dictionary<string, ComponetInfo>(); allComMap = new Dictionary<string, ComponetInfo>();
foreach (ComponetInfo com in list) foreach (ComponetInfo com in list)
{ {
if (com == null || com.PartNum == null || com.Encapsulations == null) if (com == null || com.PartNum == null || com.Encapsulations == null)
{ {
continue; continue;
} }
if (map.ContainsKey(com.PartNum)) if (allComMap.ContainsKey(com.PartNum))
{ {
LogUtil.error("元器件库【" + bomName + "】【" + com.PartNum + "】重复"); LogUtil.error("元器件库【" + bomName + "】【" + com.PartNum + "】重复");
} }
else else
{ {
map.Add(com.PartNum, com); allComMap.Add(com.PartNum, com);
} }
} }
} }
...@@ -144,54 +144,14 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -144,54 +144,14 @@ namespace OnlineStore.LoadCSVLibrary
{ {
if (!allComMap.ContainsKey(com.PartNum)) if (!allComMap.ContainsKey(com.PartNum))
{ {
return false; allComMap.Add(com.PartNum, com);
}
System.Type type = typeof(ComponetInfo);
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(ComponetInfo));
List<string> cvsTitleList = new List<string>(proTitleMap.Values);
List<string> propertyList = new List<string>(proTitleMap.Keys);
int IdIndex = propertyList.IndexOf("PartNum");
int csvIndex = -1;
string filePath = getFilePath();
int idIndex = propertyList.IndexOf("PartNum");
string[] lines = ReadCSVFile(filePath);
int index = 0;
Dictionary<string, int> titleIndex = new Dictionary<string, int>();
foreach (var line in lines)
{
var array = line.Split(',');
if (index == 0)
{
titleIndex = GetTitleIndex(line, cvsTitleList);
} }
else else
{ {
if (array.Length == titleIndex.Count) allComMap[com.PartNum] = com;
{
if (csvIndex < 0)
{
csvIndex = titleIndex[cvsTitleList[idIndex]];
}
string value = array[csvIndex];
if (value.Equals(com.PartNum))
{
//更新缓存
allComMap.Remove(com.PartNum);
allComMap.Add(com.PartNum, com);
string newValue = ObjToString(com, titleIndex, proTitleMap);
lines[index] = newValue;
return WriteCSVFile(filePath, lines);
}
}
}
index++;
} }
return true;
return SaveToFile();
} }
private static string ObjToString(ComponetInfo position, Dictionary<string, int> titleIndex, Dictionary<string, string> proTitleMap) private static string ObjToString(ComponetInfo position, Dictionary<string, int> titleIndex, Dictionary<string, string> proTitleMap)
...@@ -250,12 +210,15 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -250,12 +210,15 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary> /// <summary>
/// 增加一个元器件库 /// 增加一个元器件库
/// </summary> /// </summary>
public static bool SaveToFile() public static bool SaveToFile(string filePath = "")
{ {
try try
{ {
List<ComponetInfo> comList = new List<ComponetInfo>(); List<ComponetInfo> comList = new List<ComponetInfo>(allComMap.Values);
string filePath = getFilePath(); if (String.IsNullOrEmpty(filePath))
{
filePath = getFilePath();
}
System.Type type = typeof(ComponetInfo); System.Type type = typeof(ComponetInfo);
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(ComponetInfo)); Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(ComponetInfo));
...@@ -337,5 +300,13 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -337,5 +300,13 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[CSVAttribute("封装")] [CSVAttribute("封装")]
public string Encapsulations { get; set; } public string Encapsulations { get; set; }
public int Sufan = -1;
public string ToStr()
{
return "[" + PartNum + "][" + ProductName + "][" + Encapsulations + "][" + Describe + "]";
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!