Explorar el Código

充值该了RichTextAutoBottom控件的一个方法,输出内容后可以清除指定控件的值

章政 hace 8 años
padre
commit
98bc924553

+ 19 - 1
UAS-MES/CustomControl/RichText/RichTextAutoBottom.cs

@@ -15,7 +15,6 @@ namespace UAS_MES.CustomControl.RichText
         {
             InitializeComponent();
             TextChanged += RichTextBox_TextChange;
-
         }
 
         private void RichTextBox_TextChange(object sender, EventArgs e)
@@ -41,6 +40,25 @@ namespace UAS_MES.CustomControl.RichText
             }
         }
 
+        /// <summary>
+        /// 提示错误信息清楚指定控件的值
+        /// </summary>
+        /// <param name="str"></param>
+        /// <param name="color"></param>
+        /// <param name="ctl"></param>
+        public void AppendText(string str, Color color,Control ctl)
+        {
+            SelectionColor = color;
+            base.AppendText(str);
+            ctl.Text = "";
+            //如果颜色是红色则进行提示音
+            if (color == Color.Red && Entity.SystemInf.CheckAudioEnable)
+            {
+                thread = new Thread(PlaySound);
+                thread.Start();
+            }
+        }
+
         private void PlaySound()
         {
             //要加载COM组件:Microsoft speech object Library    

+ 2 - 2
UAS-MES/FunctionCode/Make/Make_TestCollection.Designer.cs

@@ -498,7 +498,7 @@
             // ChooseedReject
             // 
             this.ChooseedReject.Image = ((System.Drawing.Image)(resources.GetObject("ChooseedReject.Image")));
-            this.ChooseedReject.Location = new System.Drawing.Point(339, 417);
+            this.ChooseedReject.Location = new System.Drawing.Point(338, 417);
             this.ChooseedReject.Name = "ChooseedReject";
             this.ChooseedReject.Size = new System.Drawing.Size(50, 23);
             this.ChooseedReject.TabIndex = 45;
@@ -508,7 +508,7 @@
             // WaitReject
             // 
             this.WaitReject.Image = ((System.Drawing.Image)(resources.GetObject("WaitReject.Image")));
-            this.WaitReject.Location = new System.Drawing.Point(339, 353);
+            this.WaitReject.Location = new System.Drawing.Point(338, 353);
             this.WaitReject.Name = "WaitReject";
             this.WaitReject.Size = new System.Drawing.Size(50, 23);
             this.WaitReject.TabIndex = 44;

+ 9 - 14
UAS-MES/FunctionCode/Make/Make_TestCollection.cs

@@ -167,7 +167,6 @@ namespace UAS_MES.Make
                 bool ifFirst;
                 if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out ErrorMessage))
                 {
-
                     if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, ms_sncode.Text, User.UserCode, out oMakeCode, out oMSID, out ErrorMessage))
                     {
                         dt = (DataTable)dh.ExecuteSql("select ma_code,ma_prodcode,pr_detail,ma_qty from make left join product on ma_prodcode=pr_code where ma_code='" + oMakeCode + "'", "select");
@@ -184,15 +183,15 @@ namespace UAS_MES.Make
                             string stepcode = dt.Rows[0]["ms_stepcode"].ToString();
                             if (stepcode == User.CurrentStepCode && (status == "1" || status == "2"))
                             {
-                                OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red);
+                                OperateResult.AppendText(">>" + ms_sncode.Text + " 序列号已执行过" + User.CurrentStepCode + "工序,采集结果为良品\n", Color.Red, ms_sncode);
                                 return;
                             }
                         }
                         SetCollectResult();
                     }
-                    else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                    else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
                 }
-                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                else OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
             }
         }
 
@@ -320,11 +319,10 @@ namespace UAS_MES.Make
             {
                 //良品信息采集
                 if (LogicHandler.UpdateMakeMessage(ms_sncode.Text, ma_code.Text, "良品采集", User.UserSourceCode, User.UserCode, "检测合格", out ErrorMessage))
-                    OperateResult.AppendText(">>" + ms_sncode.Text + "已采集为良品\n", Color.Green);
+                    OperateResult.AppendText(">>" + ms_sncode.Text + "已采集为良品\n", Color.Green, ms_sncode);
                 else
-                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
+                    OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red, ms_sncode);
             }
-            ms_sncode.Text = "";
         }
 
         private void Save_Click(object sender, EventArgs e)
@@ -335,9 +333,7 @@ namespace UAS_MES.Make
                 return;
             }
             if (GoodProduct.Checked)
-            {
-                ms_code_KeyDown(sender,new KeyEventArgs(Keys.Enter));
-            }
+                ms_code_KeyDown(sender, new KeyEventArgs(Keys.Enter));
             else if (Reject.Checked)
             {
                 int RejectCount = ChoosedRejectList.Items.Count;
@@ -403,14 +399,13 @@ namespace UAS_MES.Make
                 dh.ExecuteSql("delete from makebad where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ma_code.Text + "'", "delete");
                 if (LogicHandler.SetTestNGDetail(ms_sncode.Text, ma_code.Text, User.UserName, User.UserSourceCode, "检查未通过", bgcode, bccode, bcremark, out ErrorMessage))
                 {
-                    OperateResult.AppendText(">>" + ms_sncode.Text + "已采集为不良\n", Color.Green);
+                    OperateResult.AppendText(">>" + ms_sncode.Text + "已采集为不良\n", Color.Green,ms_sncode);
                     //清除不良信息
                     bc_groupcode.DataSource = null;
                     bc_groupcode.Text = "";
                     bc_code.Text = "";
                     WaitRejectList.Items.Clear();
                     ChoosedRejectList.Items.Clear();
-                    ms_sncode.Text = "";
                     LoadCollectedNum();
                     WaitList.Clear();
                     ChoosedList.Clear();
@@ -431,7 +426,7 @@ namespace UAS_MES.Make
                     {
                         if (ChoosedRejectList.Items[i].ListView.Items[i].SubItems[2].Text == bc_code.Text)
                         {
-                            OperateResult.AppendText(">>已添加过不良代码" + bc_code.Text + "\n", Color.Red);
+                            OperateResult.AppendText(">>已添加过不良代码" + bc_code.Text + "\n", Color.Red,bc_code);
                             return;
                         }
                     }
@@ -441,7 +436,7 @@ namespace UAS_MES.Make
                         lvi.SubItems.Add(dt.Rows[0][j].ToString());
                     ChoosedRejectList.Items.Add(lvi);
                 }
-                else OperateResult.AppendText(">>不良代码" + bc_code.Text + "不存在\n", Color.Red);
+                else OperateResult.AppendText(">>不良代码" + bc_code.Text + "不存在\n", Color.Red, bc_code);
             }
         }
 

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

@@ -41,7 +41,7 @@
     <MinimumRequiredVersion>1.0.0.201</MinimumRequiredVersion>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <WebPage>publish.htm</WebPage>
-    <ApplicationRevision>204</ApplicationRevision>
+    <ApplicationRevision>205</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>true</UseApplicationTrust>
     <CreateDesktopShortcut>true</CreateDesktopShortcut>