From 04b0c07d1e7aaf3b5b371c2ae68c8dd7a8ffef53 Mon Sep 17 00:00:00 2001 From: "dequan.zhang" <13820060@qq.com> Date: Mon, 25 Sep 2023 09:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A3=B0=E9=9F=B3=E6=8F=90=E7=A4=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6BUG=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forms/Operation/OperationForm.cs | 37 ++++++++++++++----- .../QMAPP.WinForm/Properties/AssemblyInfo.cs | 4 +- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs index 953ce95..0669b3a 100644 --- a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs @@ -639,8 +639,11 @@ namespace QMAPP.WinForm.Forms.Operation { txtCode.Text = ""; //PlaySound.PlaySounds.Play(@errorSoundPath); - System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); - media.Play(); + if (File.Exists(errorSoundPath)) + { + System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); + media.Play(); + } this.lblError.Text = "请先选择设备!"; this.lblError.ForeColor = Color.White; this.lblError.BackColor = Color.Red; @@ -654,8 +657,11 @@ namespace QMAPP.WinForm.Forms.Operation { txtCode.Text = ""; //PlaySound.PlaySounds.Play(@errorSoundPath); - System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); - media.Play(); + if (File.Exists(errorSoundPath)) + { + System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); + media.Play(); + } this.lblError.Text = "请输入条码!"; this.lblError.ForeColor = Color.White; this.lblError.BackColor = Color.Red; @@ -676,8 +682,13 @@ namespace QMAPP.WinForm.Forms.Operation { txtCode.Text = ""; //PlaySound.PlaySounds.Play(@errorSoundPath); - System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); - media.Play(); + + if (File.Exists(errorSoundPath)) + { + System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); + media.Play(); + } + this.lblError.Text = "输入条码不是本工序可接受格式!"; this.lblError.ForeColor = Color.White; this.lblError.BackColor = Color.Red; @@ -766,8 +777,11 @@ namespace QMAPP.WinForm.Forms.Operation if (!result.Success) //如果采集数据输入失败 { //PlaySound.PlaySounds.Play(@errorSoundPath); - System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); - media.Play(); + if (File.Exists(errorSoundPath)) + { + System.Media.SoundPlayer media = new System.Media.SoundPlayer(errorSoundPath); + media.Play(); + } this.lblError.Text = result.Message; this.lblError.ForeColor = Color.White; this.lblError.BackColor = Color.Red; @@ -806,8 +820,11 @@ namespace QMAPP.WinForm.Forms.Operation //PlaySound.PlaySounds.Play(@okSoundPath); if (!"770,018,278".Contains(productCode.Substring(0, 3))) { - System.Media.SoundPlayer media = new System.Media.SoundPlayer(@okSoundPath); - media.Play(); + if(File.Exists(@okSoundPath)) + { + System.Media.SoundPlayer media = new System.Media.SoundPlayer(@okSoundPath); + media.Play(); + } } diff --git a/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs b/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs index c0418ed..c9e51d5 100644 --- a/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs +++ b/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2023.08.30.01")] -[assembly: AssemblyFileVersion("2023.08.30.01")] +[assembly: AssemblyVersion("2023.09.21.01")] +[assembly: AssemblyFileVersion("2023.09.21.01")]