This commit is contained in:
chi
2025-04-24 16:24:01 +09:00
parent f71b963851
commit 20dd87a9d0
55 changed files with 961 additions and 1085 deletions

View File

@@ -1,18 +1,19 @@
using Microsoft.Speech.Synthesis;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Media;
using COMM;
using System.Threading.Tasks;
using COMM;
using System.Net.NetworkInformation;
using System.Net;
using System.Management;
using System.Data.SqlClient;
using System.Data;
using AR;
using System.Security.Policy;
using Project.StateMachine;
using System.Data.SqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Synthesis;
using System.Media;
using System.Runtime.InteropServices;
namespace Project
{
@@ -61,8 +62,18 @@ namespace Project
public static Device.Socket sock_debug;
private static SpeechSynthesizer voice;
public static MediaPlayer mplayer;
public static SoundPlayer mplayer;
[DllImport("winmm.dll")]
private static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume);
public static void SetVolume(int volume)
{
// volume은 0~100 사이의 값
uint vol = (uint)((volume / 100.0) * 0xFFFF);
waveOutSetVolume(IntPtr.Zero, vol);
setting.musicvol = volume;
}
public static bool CheckPassword()
{
@@ -76,7 +87,11 @@ namespace Project
public static void Speak(string m, Boolean force = false, bool addlog = true)
{
if (force == false && PUB.setting.Enable_Speak == false) return;
if (force == false && PUB.setting.Enable_Speak == false)
{
Console.WriteLine("speech disabled");
return;
}
if (force)
voice.SpeakAsyncCancelAll();
if (voice.State == SynthesizerState.Ready)
@@ -123,7 +138,7 @@ namespace Project
/// <summary>
/// 시스템로그
/// </summary>
public static arUtil.Log log, logagv, logplc, logbms, logxbee;
public static AR.Log log, logagv, logplc, logbms, logxbee;
public static Boolean bPlayMusic = false;
@@ -139,7 +154,7 @@ namespace Project
/// <summary>
/// 상태머신
/// </summary>
public static StateMachine sm; //상태머신분리 190529
public static StateMachine.StateMachine sm; //상태머신분리 190529
public static System.IO.DirectoryInfo path;
@@ -155,11 +170,11 @@ namespace Project
counter.Load();
//log
log = new arUtil.Log();
logagv = new arUtil.Log();
logplc = new arUtil.Log();
logbms = new arUtil.Log();
logxbee = new arUtil.Log();
log = new AR.Log();
logagv = new AR.Log();
logplc = new AR.Log();
logbms = new AR.Log();
logxbee = new AR.Log();
logagv.FileNameFormat = "{yyyyMMdd}_agv";
logplc.FileNameFormat = "{yyyyMMdd}_plc";
@@ -178,22 +193,46 @@ namespace Project
Result = new CResult();
//state machine
sm = new StateMachine();
sm = new StateMachine.StateMachine();
path = new System.IO.DirectoryInfo(Util.CurrentPath);
mplayer = new MediaPlayer
{
Volume = PUB.setting.musicvol / 100.0
};
mplayer = new SoundPlayer();
if (PUB.setting.musicfile.isEmpty() == false)
if (System.IO.File.Exists(PUB.setting.musicfile))
PUB.mplayer.Open(new Uri(PUB.setting.musicfile));
{
PUB.mplayer.SoundLocation = PUB.setting.musicfile;
SetVolume(PUB.setting.musicvol);
}
voice = new SpeechSynthesizer();
voice.SelectVoice("Microsoft Server Speech Text to Speech Voice (ko-KR, Heami)");
try
{
// 한국어 음성을 찾아서 설정
var koreanVoice = voice.GetInstalledVoices()
.Where(v => v.VoiceInfo.Culture.Name.StartsWith("ko"))
.FirstOrDefault();
if (koreanVoice != null)
{
voice.SelectVoice(koreanVoice.VoiceInfo.Name);
}
else
{
// 한국어 음성이 없으면 기본 음성 사용
var defaultVoice = voice.GetInstalledVoices().FirstOrDefault();
if (defaultVoice != null)
{
voice.SelectVoice(defaultVoice.VoiceInfo.Name);
}
}
}
catch
{
// 음성 설정 실패 시 기본값 사용
}
voice.SetOutputToDefaultAudioDevice();
var file_version = System.IO.Path.Combine(Util.CurrentPath, "version.txt");
@@ -362,13 +401,9 @@ namespace Project
}
}
if (ip == "" || mac == "")
{
return;
}
if (ip == "" || mac == "") return;
SqlConnection conn = new SqlConnection("Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=Amkor123!");
var conn = new SqlConnection(AGV4.Properties.Settings.Default.CS);// "Data Source=10.131.15.18;Initial Catalog=EE;Persist Security Info=True;User ID=eeuser;Password=Amkor123!");
conn.Open();
string ProcName = "AddPrgmUser3";
SqlCommand cmd = new SqlCommand(ProcName, conn)