소스 검색

修改放大镜BUG,维修作业功能开发

章政 8 년 전
부모
커밋
6b1e90e22f

+ 3 - 7
UAS-MES/CustomControl/TextBoxWithIcon/SearchTextBox.Designer.cs

@@ -29,7 +29,7 @@
         private void InitializeComponent()
         {
             this.Search_Icon = new UAS_MES.CustomControl.ClickPicBox.ClickPicBox();
-            this.TextBox = new UAS_MES.CustomControl.TextBoxWithIcon.MaCodeTextBox();
+            this.TextBox = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.Search_Icon)).BeginInit();
             this.SuspendLayout();
             // 
@@ -56,11 +56,7 @@
             this.TextBox.Location = new System.Drawing.Point(0, 0);
             this.TextBox.Name = "TextBox";
             this.TextBox.Power = null;
-
-            this.TextBox.Size = new System.Drawing.Size(247, 28);
-
-            this.TextBox.Size = new System.Drawing.Size(178, 21);
-
+            this.TextBox.Size = new System.Drawing.Size(178, 25);
             this.TextBox.Str = null;
             this.TextBox.Str1 = null;
             this.TextBox.Str2 = null;
@@ -87,6 +83,6 @@
         #endregion
 
         private ClickPicBox.ClickPicBox Search_Icon;
-        private MaCodeTextBox TextBox;
+        private EnterTextBox TextBox;
     }
 }

+ 0 - 38
UAS-MES/CustomControl/TextBoxWithIcon/SearchTextBox.cs

@@ -270,44 +270,6 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
         public void TextBox_Leave(object sender, EventArgs e)
         {
             TextBox.BackColor = System.Drawing.Color.White;
-            //if (TextBox.Text != "") {
-            //    DataHelper dh = new DataHelper();
-
-            //    List<string> fields = new List<string>();
-            //    //获取查询的字段
-            //    string[] field = selectField.Replace(",", "#").Trim().Split('#');
-            //    for (int i = 0; i < field.Length; i++)
-            //    {
-            //        if (i % 2 == 0)
-            //            fields.Add(field[i]);
-            //    }
-            //    //将查询到的结果返回界面
-            //    string sql = "select " + BaseUtil.AddField(fields.ToArray()) + " from " + tableName + " where " + Tag + "='" + TextBox.Text + "'";
-            //    if (condition != null)
-            //    {
-            //        sql += " and " + condition;
-            //    }
-            //    DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
-            //    FormCollection fmCollection = Application.OpenForms;
-            //    if (dt.Rows.Count > 0)
-            //    {
-            //        for (int i = 0; i < dt.Columns.Count; i++)
-            //        {
-            //            for (int j = 0; j < SetValueField.Length; j++)
-            //            {
-            //                //利用字段的Tag属性来和列名进行比对
-            //                object tag = fmCollection[FormName].Controls[SetValueField[j]].Tag;
-            //                if (SetValueField[j] == dt.Columns[i].ColumnName.ToLower() || (tag != null && tag == dt.Columns[i].ColumnName.ToLower()))
-            //                {
-            //                    fmCollection[FormName].Controls[SetValueField[j]].Text = dt.Rows[0][dt.Columns[i].ColumnName].ToString();
-            //                }
-            //            }
-            //        }
-            //        LeaveFindData = true;
-            //    }
-            //    else
-            //        LeaveFindData = false;
-            //}
         }
 
         private void SearchTextBox_Load(object sender, EventArgs e)

+ 4 - 4
UAS-MES/FunctionCode/Employee/Employee_ChooseUserToGroup.Designer.cs

@@ -66,7 +66,7 @@
             // 
             this.ug_code_title.AutoSize = true;
             this.ug_code_title.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ug_code_title.Location = new System.Drawing.Point(157, 12);
+            this.ug_code_title.Location = new System.Drawing.Point(155, 12);
             this.ug_code_title.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ug_code_title.Name = "ug_code_title";
             this.ug_code_title.Size = new System.Drawing.Size(0, 27);
@@ -87,7 +87,7 @@
             // 
             this.ug_name_title.AutoSize = true;
             this.ug_name_title.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ug_name_title.Location = new System.Drawing.Point(157, 52);
+            this.ug_name_title.Location = new System.Drawing.Point(155, 52);
             this.ug_name_title.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ug_name_title.Name = "ug_name_title";
             this.ug_name_title.Size = new System.Drawing.Size(0, 27);
@@ -383,7 +383,7 @@
             this.em_code3.Power = null;
             this.em_code3.SelectField = null;
             this.em_code3.SetValueField = null;
-            this.em_code3.Size = new System.Drawing.Size(230, 26);
+            this.em_code3.Size = new System.Drawing.Size(223, 25);
             this.em_code3.TabIndex = 258;
             this.em_code3.TableName = null;
             this.em_code3.Tag = "em_code";
@@ -402,7 +402,7 @@
             this.em_code2.Power = null;
             this.em_code2.SelectField = null;
             this.em_code2.SetValueField = null;
-            this.em_code2.Size = new System.Drawing.Size(227, 26);
+            this.em_code2.Size = new System.Drawing.Size(219, 25);
             this.em_code2.TabIndex = 259;
             this.em_code2.TableName = null;
             this.em_code2.Tag = "em_code";

+ 17 - 66
UAS-MES/FunctionCode/Make/Make_NewMatainInf.Designer.cs

@@ -28,34 +28,23 @@
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
-            "",
-            "主板"}, -1);
-            System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem(new string[] {
-            "",
-            "液晶屏"}, -1);
-            System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem(new string[] {
-            "",
-            "电路板"}, -1);
+            System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("主板");
+            System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("液晶屏");
+            System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("电路板");
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Make_NewMatainInf));
             this.mbc_component_lsv = new System.Windows.Forms.ListView();
             this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.mbc_component = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nrg_name_lsv = new System.Windows.Forms.ListView();
-            this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nrg_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nrg_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nr_name_lsv = new System.Windows.Forms.ListView();
-            this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nr_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nr_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nr_groupcode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.mbr_dutycode_lsv = new System.Windows.Forms.ListView();
-            this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nd_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.nd_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.mbr_solutioncode_lsv = new System.Windows.Forms.ListView();
-            this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.so_code = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.so_name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.Cancel = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -71,14 +60,10 @@
             // 
             // mbc_component_lsv
             // 
-            this.mbc_component_lsv.CheckBoxes = true;
             this.mbc_component_lsv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.columnHeader1,
-            this.mbc_component});
+            this.columnHeader1});
             this.mbc_component_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            listViewItem1.StateImageIndex = 0;
-            listViewItem2.StateImageIndex = 0;
-            listViewItem3.StateImageIndex = 0;
+            this.mbc_component_lsv.FullRowSelect = true;
             this.mbc_component_lsv.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
             listViewItem1,
             listViewItem2,
@@ -89,39 +74,28 @@
             this.mbc_component_lsv.TabIndex = 1;
             this.mbc_component_lsv.UseCompatibleStateImageBehavior = false;
             this.mbc_component_lsv.View = System.Windows.Forms.View.Details;
-            this.mbc_component_lsv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.OnlyCheckOne_ItemChecked);
+            this.mbc_component_lsv.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.ListView_ItemSelectionChanged);
             // 
             // columnHeader1
             // 
-            this.columnHeader1.Text = "";
-            this.columnHeader1.Width = 28;
-            // 
-            // mbc_component
-            // 
-            this.mbc_component.Text = "不良组件";
-            this.mbc_component.Width = 164;
+            this.columnHeader1.Text = "不良组件";
+            this.columnHeader1.Width = 137;
             // 
             // nrg_name_lsv
             // 
-            this.nrg_name_lsv.CheckBoxes = true;
             this.nrg_name_lsv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.columnHeader3,
             this.nrg_code,
             this.nrg_name});
             this.nrg_name_lsv.Cursor = System.Windows.Forms.Cursors.Default;
             this.nrg_name_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.nrg_name_lsv.FullRowSelect = true;
             this.nrg_name_lsv.Location = new System.Drawing.Point(309, 159);
             this.nrg_name_lsv.Name = "nrg_name_lsv";
             this.nrg_name_lsv.Size = new System.Drawing.Size(264, 190);
             this.nrg_name_lsv.TabIndex = 2;
             this.nrg_name_lsv.UseCompatibleStateImageBehavior = false;
             this.nrg_name_lsv.View = System.Windows.Forms.View.Details;
-            this.nrg_name_lsv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.OnlyCheckOne_ItemChecked);
-            // 
-            // columnHeader3
-            // 
-            this.columnHeader3.Text = "";
-            this.columnHeader3.Width = 30;
+            this.nrg_name_lsv.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.ListView_ItemSelectionChanged);
             // 
             // nrg_code
             // 
@@ -135,25 +109,19 @@
             // 
             // nr_name_lsv
             // 
-            this.nr_name_lsv.CheckBoxes = true;
             this.nr_name_lsv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.columnHeader9,
             this.nr_code,
             this.nr_name,
             this.nr_groupcode});
             this.nr_name_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.nr_name_lsv.FullRowSelect = true;
             this.nr_name_lsv.Location = new System.Drawing.Point(581, 159);
             this.nr_name_lsv.Name = "nr_name_lsv";
             this.nr_name_lsv.Size = new System.Drawing.Size(241, 381);
             this.nr_name_lsv.TabIndex = 3;
             this.nr_name_lsv.UseCompatibleStateImageBehavior = false;
             this.nr_name_lsv.View = System.Windows.Forms.View.Details;
-            this.nr_name_lsv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.OnlyCheckOne_ItemChecked);
-            // 
-            // columnHeader9
-            // 
-            this.columnHeader9.Text = "";
-            this.columnHeader9.Width = 30;
+            this.nr_name_lsv.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.ListView_ItemSelectionChanged);
             // 
             // nr_code
             // 
@@ -170,24 +138,18 @@
             // 
             // mbr_dutycode_lsv
             // 
-            this.mbr_dutycode_lsv.CheckBoxes = true;
             this.mbr_dutycode_lsv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.columnHeader5,
             this.nd_code,
             this.nd_name});
             this.mbr_dutycode_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mbr_dutycode_lsv.FullRowSelect = true;
             this.mbr_dutycode_lsv.Location = new System.Drawing.Point(12, 355);
             this.mbr_dutycode_lsv.Name = "mbr_dutycode_lsv";
             this.mbr_dutycode_lsv.Size = new System.Drawing.Size(291, 185);
             this.mbr_dutycode_lsv.TabIndex = 5;
             this.mbr_dutycode_lsv.UseCompatibleStateImageBehavior = false;
             this.mbr_dutycode_lsv.View = System.Windows.Forms.View.Details;
-            this.mbr_dutycode_lsv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.OnlyCheckOne_ItemChecked);
-            // 
-            // columnHeader5
-            // 
-            this.columnHeader5.Text = "";
-            this.columnHeader5.Width = 30;
+            this.mbr_dutycode_lsv.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.ListView_ItemSelectionChanged);
             // 
             // nd_code
             // 
@@ -201,24 +163,18 @@
             // 
             // mbr_solutioncode_lsv
             // 
-            this.mbr_solutioncode_lsv.CheckBoxes = true;
             this.mbr_solutioncode_lsv.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.columnHeader7,
             this.so_code,
             this.so_name});
             this.mbr_solutioncode_lsv.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mbr_solutioncode_lsv.FullRowSelect = true;
             this.mbr_solutioncode_lsv.Location = new System.Drawing.Point(309, 355);
             this.mbr_solutioncode_lsv.Name = "mbr_solutioncode_lsv";
             this.mbr_solutioncode_lsv.Size = new System.Drawing.Size(264, 185);
             this.mbr_solutioncode_lsv.TabIndex = 6;
             this.mbr_solutioncode_lsv.UseCompatibleStateImageBehavior = false;
             this.mbr_solutioncode_lsv.View = System.Windows.Forms.View.Details;
-            this.mbr_solutioncode_lsv.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.OnlyCheckOne_ItemChecked);
-            // 
-            // columnHeader7
-            // 
-            this.columnHeader7.Text = "";
-            this.columnHeader7.Width = 30;
+            this.mbr_solutioncode_lsv.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.ListView_ItemSelectionChanged);
             // 
             // so_code
             // 
@@ -398,20 +354,15 @@
         private System.Windows.Forms.ListView mbr_solutioncode_lsv;
         private CustomControl.ButtonUtil.NormalButton Cancel;
         private CustomControl.ButtonUtil.NormalButton Save;
-        private System.Windows.Forms.ColumnHeader columnHeader1;
-        private System.Windows.Forms.ColumnHeader mbc_component;
-        private System.Windows.Forms.ColumnHeader columnHeader3;
         private System.Windows.Forms.ColumnHeader nrg_name;
-        private System.Windows.Forms.ColumnHeader columnHeader5;
         private System.Windows.Forms.ColumnHeader nd_code;
-        private System.Windows.Forms.ColumnHeader columnHeader7;
         private System.Windows.Forms.ColumnHeader so_code;
-        private System.Windows.Forms.ColumnHeader columnHeader9;
         private System.Windows.Forms.ColumnHeader nr_name;
         private System.Windows.Forms.ColumnHeader nrg_code;
         private System.Windows.Forms.ColumnHeader nr_code;
         private System.Windows.Forms.ColumnHeader nr_groupcode;
         private System.Windows.Forms.ColumnHeader nd_name;
         private System.Windows.Forms.ColumnHeader so_name;
+        private System.Windows.Forms.ColumnHeader columnHeader1;
     }
 }

+ 24 - 21
UAS-MES/FunctionCode/Make/Make_NewMatainInf.cs

@@ -122,38 +122,26 @@ namespace UAS_MES.Make
             Close();
         }
 
-        private void OnlyCheckOne_ItemChecked(object sender, ItemCheckedEventArgs e)
-        {
-            if (e.Item.Checked)
-            {
-                foreach (ListViewItem item in (sender as ListView).CheckedItems)
-                {
-                    if (item != e.Item)
-                        item.Checked = false;
-                }
-            }
-        }
-
         private int GetListViewCheckCount(ListView lsv)
         {
             int CheckedNum = 0;
             //已存在在ListView中的Item是不能添加到其他ListView中的,需要调用其克隆的方法
             for (int i = lsv.Items.Count - 1; i >= 0; i--)
             {
-                if (lsv.Items[i].Checked)
+                if (lsv.Items[i].Selected)
                     CheckedNum++;
             }
             return CheckedNum;
         }
 
-        private string GetListViewCheckItemText(ListView lsv)
+        private string GetListViewSelectedItemText(ListView lsv)
         {
             string Text = "";
             //已存在在ListView中的Item是不能添加到其他ListView中的,需要调用其克隆的方法
             for (int i = lsv.Items.Count - 1; i >= 0; i--)
             {
-                if (lsv.Items[i].Checked)
-                    Text = lsv.Items[i].SubItems[1].Text;
+                if (lsv.Items[i].Selected)
+                    Text = lsv.Items[i].SubItems[0].Text;
             }
             return Text;
         }
@@ -177,11 +165,16 @@ namespace UAS_MES.Make
             if (ErrorMessage == "")
             {
                 ErrorMessage = "";
-                string mbccomponent = GetListViewCheckItemText(mbc_component_lsv);
-                string nrgname = GetListViewCheckItemText(nrg_name_lsv);
-                string nrname = GetListViewCheckItemText(nr_name_lsv);
-                string mbrdutycode = GetListViewCheckItemText(mbr_dutycode_lsv);
-                string mbrsolutioncode = GetListViewCheckItemText(mbr_solutioncode_lsv);
+                string mbccomponent = GetListViewSelectedItemText(mbc_component_lsv);
+                string nrgname = GetListViewSelectedItemText(nrg_name_lsv);
+                string nrname = GetListViewSelectedItemText(nr_name_lsv);
+                string mbrdutycode = GetListViewSelectedItemText(mbr_dutycode_lsv);
+                string mbrsolutioncode = GetListViewSelectedItemText(mbr_solutioncode_lsv);
+                Console.WriteLine(mbccomponent);
+                Console.WriteLine(nrgname);
+                Console.WriteLine(nrname);
+                Console.WriteLine(mbrdutycode);
+                Console.WriteLine(mbrsolutioncode);
                 dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + sncode + "' and ms_status=3", "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -223,5 +216,15 @@ namespace UAS_MES.Make
             else
                 MessageBox.Show(ErrorMessage + "未勾选");
         }
+
+        private void ListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
+        { 
+            e.Item.BackColor = Color.LightBlue;
+            foreach (ListViewItem item in (sender as ListView).Items)
+            {
+                if (item != e.Item)
+                    item.BackColor = Color.White;
+            }
+        }
     }
 }

+ 93 - 51
UAS-MES/FunctionCode/Make/Make_Repair.Designer.cs

@@ -34,7 +34,7 @@
             this.label1 = new System.Windows.Forms.Label();
             this.ma_craftcode_label = new System.Windows.Forms.Label();
             this.st_rstepcode_label = new System.Windows.Forms.Label();
-            this.ma_prodcode_label = new System.Windows.Forms.Label();
+            this.ms_prodcode_label = new System.Windows.Forms.Label();
             this.pr_detail_label = new System.Windows.Forms.Label();
             this.label14 = new System.Windows.Forms.Label();
             this.bc_name_label = new System.Windows.Forms.Label();
@@ -57,10 +57,14 @@
             this.ComponentSource = new System.Windows.Forms.BindingSource(this.components);
             this.bc_code = new System.Windows.Forms.Label();
             this.bg_code = new System.Windows.Forms.Label();
+            this.nr_code = new System.Windows.Forms.Label();
+            this.prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.mbp_partdgv = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithCheckBox();
             this.mbp_part1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.mbp_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.mbl_locdgv = new UAS_MES.CustomControl.DataGrid_View.DataGridViewWithCheckBox();
             this.mbl_loc1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.mbl_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.RefreshTreeView = new UAS_MES.CustomControl.ClickPicBox.ClickPicBox();
             this.GetSNCode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.NewRepairInf = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
@@ -77,7 +81,7 @@
             this.mb_badremark = new UAS_MES.CustomControl.TextBoxWithIcon.TextBoxWithTextArea();
             this.OperatResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
             this.ms_makecode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
-            this.ma_prodcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
+            this.ms_prodcode = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pr_detail = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.Clean = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.ms_sncode = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
@@ -87,7 +91,6 @@
             this.SaveBadLocation = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.Scrap = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.RepairComplete = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
-            this.prodcode = new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox();
             this.panel2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.LocationSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.ComponentSource)).BeginInit();
@@ -145,18 +148,18 @@
             this.st_rstepcode_label.TabIndex = 65;
             this.st_rstepcode_label.Text = "回流工序";
             // 
-            // ma_prodcode_label
+            // ms_prodcode_label
             // 
-            this.ma_prodcode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            this.ms_prodcode_label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
-            this.ma_prodcode_label.AutoSize = true;
-            this.ma_prodcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_prodcode_label.Location = new System.Drawing.Point(622, 51);
-            this.ma_prodcode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.ma_prodcode_label.Name = "ma_prodcode_label";
-            this.ma_prodcode_label.Size = new System.Drawing.Size(92, 27);
-            this.ma_prodcode_label.TabIndex = 62;
-            this.ma_prodcode_label.Text = "产品编号";
+            this.ms_prodcode_label.AutoSize = true;
+            this.ms_prodcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_prodcode_label.Location = new System.Drawing.Point(622, 51);
+            this.ms_prodcode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ms_prodcode_label.Name = "ms_prodcode_label";
+            this.ms_prodcode_label.Size = new System.Drawing.Size(92, 27);
+            this.ms_prodcode_label.TabIndex = 62;
+            this.ms_prodcode_label.Text = "产品编号";
             // 
             // pr_detail_label
             // 
@@ -389,12 +392,43 @@
             this.bg_code.TabIndex = 123;
             this.bg_code.Visible = false;
             // 
+            // nr_code
+            // 
+            this.nr_code.AutoSize = true;
+            this.nr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.nr_code.ForeColor = System.Drawing.Color.Black;
+            this.nr_code.Location = new System.Drawing.Point(1235, 93);
+            this.nr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.nr_code.Name = "nr_code";
+            this.nr_code.Size = new System.Drawing.Size(0, 27);
+            this.nr_code.TabIndex = 125;
+            this.nr_code.Visible = false;
+            // 
+            // prodcode
+            // 
+            this.prodcode.AllPower = null;
+            this.prodcode.Caller = null;
+            this.prodcode.Condition = null;
+            this.prodcode.DBTitle = null;
+            this.prodcode.FormName = null;
+            this.prodcode.Location = new System.Drawing.Point(747, 374);
+            this.prodcode.Name = "prodcode";
+            this.prodcode.Power = null;
+            this.prodcode.SelectField = null;
+            this.prodcode.SetValueField = null;
+            this.prodcode.Size = new System.Drawing.Size(209, 25);
+            this.prodcode.TabIndex = 124;
+            this.prodcode.TableName = null;
+            this.prodcode.TextBoxEnable = true;
+            this.prodcode.TextKeyDown += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextKeyDown(this.prodcode_TextKeyDown);
+            // 
             // mbp_partdgv
             // 
             this.mbp_partdgv.AllowUserToAddRows = false;
             this.mbp_partdgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.mbp_partdgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
-            this.mbp_part1});
+            this.mbp_part1,
+            this.mbp_id});
             this.mbp_partdgv.Location = new System.Drawing.Point(647, 419);
             this.mbp_partdgv.Name = "mbp_partdgv";
             this.mbp_partdgv.RowTemplate.Height = 27;
@@ -408,12 +442,20 @@
             this.mbp_part1.HeaderText = "已选择不良零件";
             this.mbp_part1.Name = "mbp_part1";
             // 
+            // mbp_id
+            // 
+            this.mbp_id.DataPropertyName = "mbp_id";
+            this.mbp_id.HeaderText = "mbp_id";
+            this.mbp_id.Name = "mbp_id";
+            this.mbp_id.Visible = false;
+            // 
             // mbl_locdgv
             // 
             this.mbl_locdgv.AllowUserToAddRows = false;
             this.mbl_locdgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.mbl_locdgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
-            this.mbl_loc1});
+            this.mbl_loc1,
+            this.mbl_id});
             this.mbl_locdgv.Location = new System.Drawing.Point(248, 419);
             this.mbl_locdgv.Name = "mbl_locdgv";
             this.mbl_locdgv.RowTemplate.Height = 27;
@@ -427,6 +469,13 @@
             this.mbl_loc1.HeaderText = "已选择不良位置";
             this.mbl_loc1.Name = "mbl_loc1";
             // 
+            // mbl_id
+            // 
+            this.mbl_id.DataPropertyName = "mbl_id";
+            this.mbl_id.HeaderText = "mbl_id";
+            this.mbl_id.Name = "mbl_id";
+            this.mbl_id.Visible = false;
+            // 
             // RefreshTreeView
             // 
             this.RefreshTreeView.AllPower = null;
@@ -466,7 +515,7 @@
             this.NewRepairInf.DownImage = ((System.Drawing.Image)(resources.GetObject("NewRepairInf.DownImage")));
             this.NewRepairInf.Image = ((System.Drawing.Image)(resources.GetObject("NewRepairInf.Image")));
             this.NewRepairInf.IsShowBorder = true;
-            this.NewRepairInf.Location = new System.Drawing.Point(391, 631);
+            this.NewRepairInf.Location = new System.Drawing.Point(395, 631);
             this.NewRepairInf.Margin = new System.Windows.Forms.Padding(4);
             this.NewRepairInf.MoveImage = ((System.Drawing.Image)(resources.GetObject("NewRepairInf.MoveImage")));
             this.NewRepairInf.Name = "NewRepairInf";
@@ -486,7 +535,7 @@
             this.SaveRepairInf.DownImage = ((System.Drawing.Image)(resources.GetObject("SaveRepairInf.DownImage")));
             this.SaveRepairInf.Image = ((System.Drawing.Image)(resources.GetObject("SaveRepairInf.Image")));
             this.SaveRepairInf.IsShowBorder = true;
-            this.SaveRepairInf.Location = new System.Drawing.Point(535, 631);
+            this.SaveRepairInf.Location = new System.Drawing.Point(548, 631);
             this.SaveRepairInf.Margin = new System.Windows.Forms.Padding(4);
             this.SaveRepairInf.MoveImage = ((System.Drawing.Image)(resources.GetObject("SaveRepairInf.MoveImage")));
             this.SaveRepairInf.Name = "SaveRepairInf";
@@ -545,6 +594,7 @@
             this.mbr_solutioncode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
             this.mbr_solutioncode.BackColor = System.Drawing.Color.White;
+            this.mbr_solutioncode.Enabled = false;
             this.mbr_solutioncode.ID = null;
             this.mbr_solutioncode.Location = new System.Drawing.Point(747, 299);
             this.mbr_solutioncode.Margin = new System.Windows.Forms.Padding(4);
@@ -563,6 +613,7 @@
             this.mbc_component.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
             this.mbc_component.BackColor = System.Drawing.Color.White;
+            this.mbc_component.Enabled = false;
             this.mbc_component.ID = null;
             this.mbc_component.Location = new System.Drawing.Point(354, 299);
             this.mbc_component.Margin = new System.Windows.Forms.Padding(4);
@@ -581,6 +632,7 @@
             this.mbr_dutycode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
             this.mbr_dutycode.BackColor = System.Drawing.Color.White;
+            this.mbr_dutycode.Enabled = false;
             this.mbr_dutycode.ID = null;
             this.mbr_dutycode.Location = new System.Drawing.Point(1094, 248);
             this.mbr_dutycode.Margin = new System.Windows.Forms.Padding(4);
@@ -599,6 +651,7 @@
             this.nr_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
             this.nr_name.BackColor = System.Drawing.Color.White;
+            this.nr_name.Enabled = false;
             this.nr_name.ID = null;
             this.nr_name.Location = new System.Drawing.Point(747, 245);
             this.nr_name.Margin = new System.Windows.Forms.Padding(4);
@@ -610,6 +663,7 @@
             this.nr_name.Str2 = null;
             this.nr_name.TabIndex = 96;
             this.nr_name.Tag = "Read";
+            this.nr_name.TextChanged += new System.EventHandler(this.nr_name_TextChanged);
             // 
             // nrg_name
             // 
@@ -617,6 +671,7 @@
             this.nrg_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
             this.nrg_name.BackColor = System.Drawing.Color.White;
+            this.nrg_name.Enabled = false;
             this.nrg_name.ID = null;
             this.nrg_name.Location = new System.Drawing.Point(354, 248);
             this.nrg_name.Margin = new System.Windows.Forms.Padding(4);
@@ -698,17 +753,17 @@
             this.ms_makecode.Size = new System.Drawing.Size(0, 27);
             this.ms_makecode.TabIndex = 85;
             // 
-            // ma_prodcode
+            // ms_prodcode
             // 
-            this.ma_prodcode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            this.ms_prodcode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
             | System.Windows.Forms.AnchorStyles.Left)));
-            this.ma_prodcode.AutoSize = true;
-            this.ma_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_prodcode.Location = new System.Drawing.Point(750, 51);
-            this.ma_prodcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.ma_prodcode.Name = "ma_prodcode";
-            this.ma_prodcode.Size = new System.Drawing.Size(0, 27);
-            this.ma_prodcode.TabIndex = 83;
+            this.ms_prodcode.AutoSize = true;
+            this.ms_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ms_prodcode.Location = new System.Drawing.Point(750, 51);
+            this.ms_prodcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.ms_prodcode.Name = "ms_prodcode";
+            this.ms_prodcode.Size = new System.Drawing.Size(0, 27);
+            this.ms_prodcode.TabIndex = 83;
             // 
             // pr_detail
             // 
@@ -800,6 +855,7 @@
             this.cr_code.TableName = null;
             this.cr_code.Tag = "Read";
             this.cr_code.TextBoxEnable = true;
+            this.cr_code.UserControlTextChanged += new UAS_MES.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextChange(this.cr_code_UserControlTextChanged);
             // 
             // NewBadCode
             // 
@@ -826,6 +882,7 @@
             this.SaveBadLocation.AllPower = "ifall";
             this.SaveBadLocation.BackColor = System.Drawing.Color.Transparent;
             this.SaveBadLocation.DownImage = ((System.Drawing.Image)(resources.GetObject("SaveBadLocation.DownImage")));
+            this.SaveBadLocation.Enabled = false;
             this.SaveBadLocation.Image = ((System.Drawing.Image)(resources.GetObject("SaveBadLocation.Image")));
             this.SaveBadLocation.IsShowBorder = true;
             this.SaveBadLocation.Location = new System.Drawing.Point(549, 372);
@@ -846,7 +903,6 @@
             this.Scrap.AllPower = "ifall";
             this.Scrap.BackColor = System.Drawing.Color.Transparent;
             this.Scrap.DownImage = ((System.Drawing.Image)(resources.GetObject("Scrap.DownImage")));
-            this.Scrap.Enabled = false;
             this.Scrap.Image = ((System.Drawing.Image)(resources.GetObject("Scrap.Image")));
             this.Scrap.IsShowBorder = true;
             this.Scrap.Location = new System.Drawing.Point(964, 95);
@@ -867,7 +923,6 @@
             this.RepairComplete.AllPower = "ifall";
             this.RepairComplete.BackColor = System.Drawing.Color.Transparent;
             this.RepairComplete.DownImage = ((System.Drawing.Image)(resources.GetObject("RepairComplete.DownImage")));
-            this.RepairComplete.Enabled = false;
             this.RepairComplete.Image = ((System.Drawing.Image)(resources.GetObject("RepairComplete.Image")));
             this.RepairComplete.IsShowBorder = true;
             this.RepairComplete.Location = new System.Drawing.Point(838, 95);
@@ -883,28 +938,12 @@
             this.RepairComplete.UseVisualStyleBackColor = true;
             this.RepairComplete.Click += new System.EventHandler(this.RepairComplete_Click);
             // 
-            // prodcode
-            // 
-            this.prodcode.AllPower = null;
-            this.prodcode.Caller = null;
-            this.prodcode.Condition = null;
-            this.prodcode.DBTitle = null;
-            this.prodcode.FormName = null;
-            this.prodcode.Location = new System.Drawing.Point(747, 374);
-            this.prodcode.Name = "prodcode";
-            this.prodcode.Power = null;
-            this.prodcode.SelectField = null;
-            this.prodcode.SetValueField = null;
-            this.prodcode.Size = new System.Drawing.Size(209, 25);
-            this.prodcode.TabIndex = 124;
-            this.prodcode.TableName = null;
-            this.prodcode.TextBoxEnable = false;
-            // 
             // Make_Repair
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1327, 735);
+            this.Controls.Add(this.nr_code);
             this.Controls.Add(this.prodcode);
             this.Controls.Add(this.bg_code);
             this.Controls.Add(this.bc_code);
@@ -938,9 +977,9 @@
             this.Controls.Add(this.mb_badremark);
             this.Controls.Add(this.OperatResult);
             this.Controls.Add(this.ms_makecode);
-            this.Controls.Add(this.ma_prodcode);
+            this.Controls.Add(this.ms_prodcode);
             this.Controls.Add(this.pr_detail);
-            this.Controls.Add(this.ma_prodcode_label);
+            this.Controls.Add(this.ms_prodcode_label);
             this.Controls.Add(this.pr_detail_label);
             this.Controls.Add(this.Clean);
             this.Controls.Add(this.ms_sncode);
@@ -988,7 +1027,7 @@
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.Label ma_craftcode_label;
         private System.Windows.Forms.Label st_rstepcode_label;
-        private System.Windows.Forms.Label ma_prodcode_label;
+        private System.Windows.Forms.Label ms_prodcode_label;
         private System.Windows.Forms.Label pr_detail_label;
         private System.Windows.Forms.Label label14;
         private System.Windows.Forms.Label bc_name_label;
@@ -998,7 +1037,7 @@
         private CustomControl.TextBoxWithIcon.EnterTextBox ms_sncode;
         private CustomControl.ButtonUtil.NormalButton Clean;
         private CustomControl.ValueLabel.ValueLabel pr_detail;
-        private CustomControl.ValueLabel.ValueLabel ma_prodcode;
+        private CustomControl.ValueLabel.ValueLabel ms_prodcode;
         private CustomControl.ValueLabel.ValueLabel ms_makecode;
         private CustomControl.RichText.RichTextAutoBottom OperatResult;
         private CustomControl.TextBoxWithIcon.TextBoxWithTextArea mb_badremark;
@@ -1031,10 +1070,13 @@
         private CustomControl.DataGrid_View.DataGridViewWithCheckBox mbp_partdgv;
         private System.Windows.Forms.BindingSource LocationSource;
         private System.Windows.Forms.BindingSource ComponentSource;
-        private System.Windows.Forms.DataGridViewTextBoxColumn mbp_part1;
-        private System.Windows.Forms.DataGridViewTextBoxColumn mbl_loc1;
         private System.Windows.Forms.Label bc_code;
         private System.Windows.Forms.Label bg_code;
         private CustomControl.TextBoxWithIcon.SearchTextBox prodcode;
+        private System.Windows.Forms.Label nr_code;
+        private System.Windows.Forms.DataGridViewTextBoxColumn mbp_part1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn mbp_id;
+        private System.Windows.Forms.DataGridViewTextBoxColumn mbl_loc1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn mbl_id;
     }
 }

+ 192 - 37
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
@@ -31,6 +32,8 @@ namespace UAS_MES.Make
         bool GetSelectData = false;
 
         string mb_id = "";
+
+        string mbr_id = "";
         /// <summary>
         /// 存放父节点信息
         /// </summary>
@@ -50,7 +53,7 @@ namespace UAS_MES.Make
 
         AutoSizeFormClass asc = new AutoSizeFormClass();
 
-        string macode;   
+        string macode;
 
         string msid = "";
 
@@ -76,7 +79,7 @@ namespace UAS_MES.Make
             cd_stepcode.TableName = "craftdetail left join step on st_code=cd_stepcode left join craft on cd_crid=cr_id";
             cd_stepcode.SetValueField = new string[] { "cd_stepcode" };
             cd_stepcode.SelectField = "cd_stepname # 工序名称 ,cd_stepcode # 工序编号,cd_stepno # 执行顺序";
-            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "'";
+
 
             prodcode.FormName = Name;
             prodcode.TableName = dbtable1.Replace(":macode", macode).Replace(":sncode", GetSNCode.Text);
@@ -100,22 +103,30 @@ namespace UAS_MES.Make
                 //验证工序是否正确
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
+
                     BadInf_1.Clear();
                     if (LogicHandler.GetMakeInfo(GetSNCode.Text, out macode, out ErrorMessage))
                     {
-                        //验证makeserial或者ms_firstsn表序列号是否存在
-                        sql.Clear();
-                        sql.Append("select max(ms_id) ms_id from makeserial where ms_makecode ='" + macode + "' and(ms_sncode");
-                        sql.Append("='" + GetSNCode.Text + "' or ms_firstsn in (select firstsn from makesnrelation ");
-                        sql.Append("where sn='" + GetSNCode.Text + "'))");
-                        dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                        if (dt.Rows.Count > 0)
+                        if (LogicHandler.CheckStepSNAndMacode(macode, User.UserSourceCode, GetSNCode.Text, User.UserCode, out macode, out msid, out ErrorMessage))
                         {
-                            msid = dt.Rows[0]["ms_id"].ToString();
-                            LoadBadInfTree(sender, e);
+                            //验证makeserial或者ms_firstsn表序列号是否存在
+                            sql.Clear();
+                            sql.Append("select max(ms_id) ms_id,ms_makecode,ms_prodcode,ms_sncode,pr_detail ");
+                            sql.Append("from makeserial left join product on pr_code=ms_prodcode where ms_makecode ='" + macode + "' and(ms_sncode");
+                            sql.Append("='" + GetSNCode.Text + "' or ms_firstsn in (select firstsn from makesnrelation ");
+                            sql.Append("where sn='" + GetSNCode.Text + "')) group by ms_makecode,ms_prodcode,ms_sncode,pr_detail");
+                            dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                            if (dt.Rows.Count > 0)
+                            {
+                                msid = dt.Rows[0]["ms_id"].ToString();
+                                BaseUtil.SetFormValue(this.Controls, dt);
+                                LoadBadInfTree(sender, e);
+                            }
+                            else
+                                OperatResult.AppendText(">>序列号" + GetSNCode.Text + "不存在\n", Color.Red);
                         }
                         else
-                            OperatResult.AppendText(">>序列号" + GetSNCode.Text + "不存在\n", Color.Red);
+                            OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                     }
                     else
                         OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
@@ -143,17 +154,16 @@ namespace UAS_MES.Make
             }
             if (e.Node.Level == 1)
             {
-                string mbr_id = e.Node.Tag.ToString();
+                mbr_id = e.Node.Tag.ToString();
                 nrg_name.Text = BadInf_2[mbr_id]["nrg_name"];
                 nr_name.Text = BadInf_2[mbr_id]["nr_name"];
+                nr_code.Text = BadInf_2[mbr_id]["nr_code"];
                 mbr_solutioncode.Text = BadInf_2[mbr_id]["mbr_solutioncode"];
                 mbr_dutycode.Text = BadInf_2[mbr_id]["mbr_dutycode"];
                 mbc_component.Text = dh.getFieldDataByCondition("makebadrscom", "mbc_component", "mbc_mbrid=" + mbr_id).ToString();
                 //加载两个Grid的数据源
-                ComponentSource.DataSource = (DataTable)dh.ExecuteSql("select mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
-                LocationSource.DataSource = (DataTable)dh.ExecuteSql("select mbl_loc from makebadrsloc where mbl_mbrid=" + mbr_id, "select");
-                mbl_locdgv.DataSource = LocationSource;
-                mbp_partdgv.DataSource = ComponentSource;
+                mbp_partdgv.DataSource = (DataTable)dh.ExecuteSql("select mbp_id,mbp_part from makebadrspart where mbp_mbrid=" + mbr_id, "select");
+                mbl_locdgv.DataSource = (DataTable)dh.ExecuteSql("select mbl_id,mbl_loc from makebadrsloc where mbl_mbrid=" + mbr_id, "select");
             }
         }
 
@@ -188,7 +198,7 @@ namespace UAS_MES.Make
                 //添加子节点
                 sql.Clear();
                 sql.Append("select mbr_id,mbr_brcode,mbr_brgcode,mbr_solutioncode,so_name,mbr_dutycode,nd_name,");
-                sql.Append("nrg_name,nr_name from makebadreason left join QUA_NGReason left join QUA_NGREASONGROUP on ");
+                sql.Append("nrg_name,nr_name,nr_code from makebadreason left join QUA_NGReason left join QUA_NGREASONGROUP on ");
                 sql.Append("nrg_code=nr_group on nr_code=mbr_brcode left join solution ");
                 sql.Append("on so_code=mbr_solutioncode left join ngduty on nd_code=mbr_dutycode where mbr_mbid=" + mb_id);
                 DataTable dt1 = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
@@ -208,6 +218,7 @@ namespace UAS_MES.Make
                     dic1.Add("so_name", dt1.Rows[j]["so_name"].ToString());
                     dic1.Add("nrg_name", dt1.Rows[j]["nrg_name"].ToString());
                     dic1.Add("nr_name", dt1.Rows[j]["nr_name"].ToString());
+                    dic1.Add("nr_code", dt1.Rows[j]["nr_code"].ToString());
                     tnode_1.Text = dt1.Rows[j]["mbr_brgcode"].ToString();
                     if (!BadInf_2.ContainsKey(mbr_id))
                         BadInf_2.Add(mbr_id, dic1);
@@ -227,12 +238,58 @@ namespace UAS_MES.Make
 
         private void RepairComplete_Click(object sender, EventArgs e)
         {
-
+            int RejectNum = int.Parse(dh.getFieldDataByCondition("makebad", "count(0) cn", "mb_sncode='" + GetSNCode.Text + "' and mb_status not in (1,-1)").ToString());
+            if (RejectNum > 0)
+            {
+                OperatResult.AppendText(">>维修结果必须为已维修或无不良\n", Color.Red);
+            }
+            else
+            {
+                dt = (DataTable)dh.ExecuteSql("select cr_id from craft where cr_statuscode='AUDITED' and cr_code='" + cr_code.Text + "'", "select");
+                if (dt.Rows.Count == 0)
+                {
+                    OperatResult.AppendText(">>回流工序不存在\n", Color.Red);
+                }
+                else
+                {
+                    string cr_id = dt.Rows[0]["cr_id"].ToString();
+                    dt = (DataTable)dh.ExecuteSql("select cd_ifinput from craftdetail left join step on st_code=cd_stepcode where cd_crid='" + cr_id + "' and cd_stepcode='" + cd_stepcode.Text + "' and st_statuscode='AUDITED'", "select");
+                    if (dt.Rows.Count == 0)
+                    {
+                        OperatResult.AppendText(">>回流工序不在回流工艺中\n", Color.Red);
+                    }
+                    else
+                    {
+                        dh.UpdateByCondition("makeserial", "ms_nextstepcode='" + cd_stepcode.Text + "',ms_craftcode='" + cr_code.Text + "',ms_stepcode='" + User.CurrentStepCode + "',ms_status=1", "ms_sncode='" + ms_sncode.Text + "'");
+                        dh.ExecuteSql(insert_makeprocess.Replace("#", "完成维修"), "insert", ms_sncode.Text, User.CurrentStepCode);
+                        OperatResult.AppendText(">>序列号" + ms_sncode.Text + "回流成功\n", Color.Green);
+                        GetSNCode.Clear();
+                    }
+                }
+            }
         }
 
         private void Scrap_Click(object sender, EventArgs e)
         {
-
+            //判断是否有无法维修的记录
+            int ScrapNum = int.Parse(dh.getFieldDataByCondition("makebad", "count(0) cn", "mb_sncode='" + ms_sncode.Text + "'").ToString());
+            if (ScrapNum == 0)
+            {
+                OperatResult.AppendText(">>存在无法维修的记录才允许报废\n", Color.Red);
+            }
+            else
+            {
+                string confirm = MessageBox.Show(this.ParentForm, "此操作不可撤销,是否确认报废", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk).ToString();
+                if (confirm == "Yes")
+                {
+                    dh.UpdateByCondition("makeserial", "ms_status=4,ms_nextstepcode='',ms_stepcode='" + User.CurrentStepCode + "'", "ms_sncode='" + ms_sncode.Text + "' and ms_makecode='" + macode + "'");
+                    dh.UpdateByCondition("make", "MA_NGMADEQTY=nvl(MA_NGMADEQTY,0)+1", "ma_code='" + macode + "'");
+                    OperatResult.AppendText(">>报废成功\n", Color.Green);
+                    GetSNCode.Clear();
+                    BaseUtil.CleanForm(this);
+                    BadCodeTree.Nodes.Clear();
+                }
+            }
         }
 
         private void NewBadCode_Click(object sender, EventArgs e)
@@ -253,42 +310,140 @@ namespace UAS_MES.Make
 
         private void SaveRepairInf_Click(object sender, EventArgs e)
         {
-
+            //保存不良零件
+            DataTable dt = (DataTable)mbp_partdgv.DataSource;
+            List<string> prodcode = new List<string>();
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (dt.Rows[i]["mbp_id"].ToString() == "")
+                    prodcode.Add(dt.Rows[i]["mbp_part"].ToString());
+            }
+            sql.Clear();
+            sql.Append("insert into makebadrspart(mbp_id,mbp_mbrid,mbp_part,mbp_badcode,");
+            sql.Append("mbp_brcode,mbp_sncode,mbp_makecode,mbp_indate,mbp_inman)");
+            sql.Append("select makebadrspart_seq.nextval," + mbr_id + ",:prodcode,");
+            sql.Append("'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
+            sql.Append("sysdate,'" + User.UserCode + "' from dual");
+            dh.BatchInsert(sql.GetString(), new string[] { "prodcode" }, prodcode.ToArray());
+            //保存不良位置
+            dt = (DataTable)mbl_locdgv.DataSource;
+            List<string> location = new List<string>();
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                if (dt.Rows[i]["mbl_id"].ToString() == "")
+                    location.Add(dt.Rows[i]["mbl_loc"].ToString());
+            }
+            sql.Clear();
+            sql.Append("insert into makebadrsloc(mbl_id,mbl_mbrid,mbl_loc,mbl_badcode,mbl_brcode,");
+            sql.Append("mbl_sncode,mbl_makecode,mbl_indate ,mbl_inman) select makebadrsloc_seq.nextval," + mbr_id);
+            sql.Append(",:location,'" + bc_code.Text + "','" + nr_code.Text + "','" + GetSNCode.Text + "','" + macode + "',");
+            sql.Append("sysdate,'" + User.UserCode + "' from dual");
+            dh.BatchInsert(sql.GetString(), new string[] { "location" }, location.ToArray());
+            MessageBox.Show("保存成功");
         }
 
         private void DeleteRepairInf_Click(object sender, EventArgs e)
         {
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + GetSNCode.Text + "' and ms_status=3", "select");
+            if (dt.Rows.Count > 0)
+            {
+                if (mbr_id != "")
+                {
+                    string delete1 = "delete from  makebadrsloc where mbl_mbrid=" + mbr_id;
+                    string delete2 = "delete from makebadrspart where mbp_mbrid=" + mbr_id;
+                    string delete3 = "delete from makebadrscom where mbc_mbrid=" + mbr_id;
+                    string delete4 = "delete from makebadreason where mbr_id" + mbr_id;
+                    dh.ExecuteSQLTran(delete1, delete2, delete3, delete4);
+                    MessageBox.Show("删除成功");
+                }
+                else MessageBox.Show("必须选择不了原因");
+            }
+            else
+                MessageBox.Show("序列号错误,不存在或者不处于维修状态");
+        }
 
+        private void SaveBadLocation_Click(object sender, EventArgs e)
+        {
+            DataTable dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + GetSNCode.Text + "' and ms_status=3", "select");
+            if (dt.Rows.Count > 0)
+            {
+                if (mbl_loc.Text != "")
+                {
+                    if (mbr_id != "")
+                    {
+                        dt = (DataTable)mbl_locdgv.DataSource;
+                        DataRow dr = dt.NewRow();
+                        dr["mbl_loc"] = mbl_loc.Text;
+                        dt.Rows.Add(dr);
+                    }
+                    else MessageBox.Show("请先选择不良原因");
+                }
+            }
+            else
+                MessageBox.Show("序列号错误,不存在或者不处于维修状态");
         }
 
-        private void mbl_loc_KeyDown(object sender, KeyEventArgs e)
+        private void mbl_loc_TextChanged(object sender, EventArgs e)
         {
-            if (e.KeyCode == Keys.Enter)
+            if (mbl_loc.Text != "")
             {
-                sql.Clear();
-                sql.Append("select prodcode,pr_detail from (select distinct nvl(dsl_prodcode,msl_prodcode)");
-                sql.Append("prodcode from ReduceStepRecord left join devsmtlocation on dsl_linecode=rsd_linecode ");
-                sql.Append("and dsl_makecode=rsd_macode left join makesmtlocation on msl_linecode=rsd_linecode  ");
-                sql.Append("and msl_makecode=rsd_macode where rsd_macode='" + macode + "'  and rsd_sncode='" + GetSNCode.Text + "'");
-                sql.Append("and ((dsl_location='" + mbl_loc.Text + "' and dsl_validtime<sysdate and sysdate<dsl_invalidtime) ) or ");
-                sql.Append("(msl_location='" + mbl_loc.Text + "' and msl_validtime<sysdate and sysdate<msl_invalidtime)) left join ");
-                sql.Append("product on pr_code=prodcode");
-                DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                prodcode.TableName = dbtable2.Replace(":macode", macode).Replace(":sncode", GetSNCode.Text).Replace(":msl_location", mbl_loc.Text);
             }
         }
 
-        private void SaveBadLocation_Click(object sender, EventArgs e)
+        /// <summary>
+        /// 加载不良零件Grid
+        /// </summary>
+        private void LoadBadPart()
+        {
+        }
+
+        /// <summary>
+        /// 加载不良位置信息
+        /// </summary>
+        private void LoadBadLocation()
         {
 
         }
 
-        private void mbl_loc_TextChanged(object sender, EventArgs e)
+        private void nr_name_TextChanged(object sender, EventArgs e)
         {
-            if (mbl_loc.Text != "")
+            if (nr_name.Text == "")
+                SaveBadLocation.Enabled = false;
+            else
+                SaveBadLocation.Enabled = true;
+        }
+
+
+        private void mbl_loc_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
             {
-                Console.WriteLine("TextChange");
-                prodcode.TableName = dbtable2.Replace(":macode", macode).Replace(":sncode", GetSNCode.Text).Replace(":msl_location", mbl_loc.Text);
+                SaveBadLocation_Click(sender, e);
             }
         }
+
+        private void prodcode_TextKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                if (prodcode.Text != "")
+                {
+                    if (mbr_id != "")
+                    {
+                        DataTable dt = (DataTable)mbp_partdgv.DataSource;
+                        DataRow dr = dt.NewRow();
+                        dr["mbp_part"] = prodcode.Text;
+                        dt.Rows.Add(dr);
+                    }
+                    else MessageBox.Show("请先选择不良原因");
+                }
+            }
+        }
+
+        private void cr_code_UserControlTextChanged(object sender, EventArgs e)
+        {
+            cd_stepcode.Condition = "ST_STATUSCODE='AUDITED' and cr_code='" + cr_code.Text + "'";
+        }
     }
 }

+ 6 - 0
UAS-MES/FunctionCode/Make/Make_Repair.resx

@@ -126,9 +126,15 @@
   <metadata name="mbp_part1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="mbp_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <metadata name="mbl_loc1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="mbl_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="NewRepairInf.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>

+ 1 - 1
UAS-MES/Program.cs

@@ -91,7 +91,7 @@ namespace UAS_MES
             if (ex != null)
             {
                 sb.AppendLine(ex.Message);
-                //sb.AppendLine("【异常方法】:" + ex.TargetSite);
+                sb.AppendLine("【异常方法】:" + ex.StackTrace);
             }
             //else { sb.AppendLine("【未处理异常】:" + backStr); }
             return sb.ToString();

+ 28 - 0
UAS-MES/Settings.cs

@@ -0,0 +1,28 @@
+namespace UAS_MES.Properties {
+    
+    
+    // 通过此类可以处理设置类的特定事件: 
+    //  在更改某个设置的值之前将引发 SettingChanging 事件。
+    //  在更改某个设置的值之后将引发 PropertyChanged 事件。
+    //  在加载设置值之后将引发 SettingsLoaded 事件。
+    //  在保存设置值之前将引发 SettingsSaving 事件。
+    internal sealed partial class Settings {
+        
+        public Settings() {
+            // // 若要为保存和更改设置添加事件处理程序,请取消注释下列行: 
+            //
+            // this.SettingChanging += this.SettingChangingEventHandler;
+            //
+            // this.SettingsSaving += this.SettingsSavingEventHandler;
+            //
+        }
+        
+        private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
+            // 在此处添加用于处理 SettingChangingEvent 事件的代码。
+        }
+        
+        private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
+            // 在此处添加用于处理 SettingsSaving 事件的代码。
+        }
+    }
+}

+ 7 - 1
UAS-MES/UAS-MES.csproj

@@ -91,7 +91,7 @@
     <SignAssembly>false</SignAssembly>
   </PropertyGroup>
   <PropertyGroup>
-    <ApplicationIcon>Resources\U_Icon.ico</ApplicationIcon>
+    <ApplicationIcon>U_Icon.ico</ApplicationIcon>
   </PropertyGroup>
   <PropertyGroup />
   <PropertyGroup>
@@ -104,6 +104,10 @@
   <PropertyGroup />
   <PropertyGroup />
   <PropertyGroup />
+  <PropertyGroup />
+  <PropertyGroup />
+  <PropertyGroup />
+  <PropertyGroup />
   <PropertyGroup>
     <NoWin32Manifest>true</NoWin32Manifest>
   </PropertyGroup>
@@ -772,6 +776,7 @@
     <Compile Include="FunctionCode\SystemSetting\SystemSetting_ScaleTest.Designer.cs">
       <DependentUpon>SystemSetting_ScaleTest.cs</DependentUpon>
     </Compile>
+    <Compile Include="Settings.cs" />
     <EmbeddedResource Include="CustomControl\AccordionMenu\AccordionMenu.resx">
       <DependentUpon>AccordionMenu.cs</DependentUpon>
     </EmbeddedResource>
@@ -1048,6 +1053,7 @@
     <None Include="Resources\mailattachment.zip" />
   </ItemGroup>
   <ItemGroup>
+    <Content Include="U_Icon.ico" />
     <None Include="Resources\timg.jpg" />
     <None Include="Resources\matte_white_square_icon_business_tool_hammer_128px_571061_easyicon.net.ico" />
     <None Include="Resources\Image1.bmp" />

BIN
UAS-MES/U_Icon.ico