Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage
This commit is contained in:
commit
86ae16fa94
2 files changed
+49
-51
No files matched your search
+10
-7
@@ -51,9 +51,11 @@ namespace formula_manage
|
||||
// DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
|
||||
// DataTable MACHINEdataTable = new DataTable(); //建立Machine缓存
|
||||
DataTable RRODUCTdataTable = new DataTable(); //建立RRODUCT缓存
|
||||
// DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
|
||||
// DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
|
||||
|
||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||
private readonly string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||
//调用配置文件
|
||||
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini");
|
||||
|
||||
string TEXT_SQLIP;
|
||||
string TEXT_SQLNAME;
|
||||
@@ -74,7 +76,6 @@ namespace formula_manage
|
||||
InitializeComponent();
|
||||
this.Closing += Window_Closing; //添加窗口关闭事件
|
||||
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6"))) UserClass.TCPServer.Start(); //开启网路通讯
|
||||
|
||||
USER.Text = App.USER_Purview;
|
||||
@@ -128,7 +129,6 @@ namespace formula_manage
|
||||
|
||||
private void PrintForms()//传入可用打印模板
|
||||
{
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||
int dirID=0;
|
||||
|
||||
DataTable Report = new DataTable();
|
||||
@@ -157,9 +157,8 @@ namespace formula_manage
|
||||
Forms_.Text = Temp_m;
|
||||
}
|
||||
|
||||
private void sql_()
|
||||
private void sql_()
|
||||
{
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||
@@ -261,7 +260,11 @@ namespace formula_manage
|
||||
}
|
||||
|
||||
// UserClass.LogGing.LogGingDATA(Log_time + "HttpSERVER_STOP");
|
||||
//if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6"))) UserClass.HttpSERVER.Stop(); //停止网络通信
|
||||
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
|
||||
{
|
||||
UserClass.TCPServer.Btn_SendAll("SERVER_STOP");
|
||||
}
|
||||
|
||||
UserClass.LogGing.LogGingDATA("FORMULA_STOP");
|
||||
}
|
||||
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
||||
|
||||
+39
-44
@@ -24,7 +24,8 @@ namespace formula_manage.UserClass
|
||||
//字典集合:存储IP和Socket的集合
|
||||
public static Dictionary<string, Socket> OnLineList = new Dictionary<string, Socket>();
|
||||
|
||||
//当前时间
|
||||
DataTable IPdataTable = new DataTable(); //建立缓存
|
||||
//当前时间
|
||||
|
||||
private string CurrentTime
|
||||
{
|
||||
@@ -85,45 +86,46 @@ namespace formula_manage.UserClass
|
||||
while (true)
|
||||
{
|
||||
//定义一个2M的缓冲区
|
||||
byte[] buffer = new byte[1024 * 1024 * 2];
|
||||
byte[] buffer = new byte[1024 * 1024 * 2];
|
||||
|
||||
int length = -1;
|
||||
try
|
||||
{
|
||||
length = clientSocket.Receive(buffer);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
int length = -1;
|
||||
try
|
||||
|
||||
{
|
||||
|
||||
length = clientSocket.Receive(buffer);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//客户端下线了
|
||||
//更新在线列表
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||
// AddOnLine(ip, false);
|
||||
|
||||
OnLineList.Remove(ip);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
//客户端下线了
|
||||
//更新在线列表
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
UserClass.LogGing.LogGingDATA("IP_Line = " + ip);
|
||||
// AddOnLine(ip, false);
|
||||
|
||||
OnLineList.Remove(ip);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
infoR = econding.GetString(buffer, 0, length);
|
||||
//ShowMessage(info);
|
||||
string ip = clientSocket.RemoteEndPoint.ToString();
|
||||
Bn_Send(ip, infoR+"return");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,34 +171,27 @@ namespace formula_manage.UserClass
|
||||
/// <summary>
|
||||
/// 消息发送
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
public static void Bn_Send(string IP ,string DAT)
|
||||
{
|
||||
|
||||
if (OnLineList.ContainsKey(IP))
|
||||
{
|
||||
OnLineList[IP].Send(econding.GetBytes(DAT));
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
/// <summary>
|
||||
/// 群发功能
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btn_SendAll_Click(object sender, EventArgs e)
|
||||
if (OnLineList.ContainsKey(IP))
|
||||
{
|
||||
foreach (string item in this.lst_Online.Items)
|
||||
OnLineList[IP].Send(econding.GetBytes(DAT));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 群发功能
|
||||
/// </summary>
|
||||
public static void Btn_SendAll(string DAT)
|
||||
{
|
||||
foreach (string item in OnLineList.Keys.ToArray())
|
||||
{
|
||||
if (OnLineList.ContainsKey(item))
|
||||
{
|
||||
if (OnLineList.ContainsKey(item))
|
||||
{
|
||||
OnLineList[item].Send(econding.GetBytes(this.txt_Send.Text.Trim()));
|
||||
}
|
||||
OnLineList[item].Send(econding.GetBytes(DAT));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user