99 lines
2.2 KiB
C#
99 lines
2.2 KiB
C#
![]() |
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Linq;
|
|||
|
using System.Net.NetworkInformation;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using ComposerSDK;
|
|||
|
using Epost.Common;
|
|||
|
using Epost.DAL;
|
|||
|
using Epost.Model;
|
|||
|
|
|||
|
public class ControllCheckBLL
|
|||
|
{
|
|||
|
//添加
|
|||
|
public static List<string> xglist = new List<string>();
|
|||
|
ControlDAL dal = new ControlDAL();
|
|||
|
Dictionary<string, bool> list = new Dictionary<string, bool>();
|
|||
|
// ErrorLogBLL logBLL = new ErrorLogBLL();
|
|||
|
|
|||
|
#region 检查网络连接状态
|
|||
|
public bool CheckForInternetConnection(string ip)
|
|||
|
{
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
bool t = false;
|
|||
|
Ping p1 = new Ping();
|
|||
|
PingReply reply = p1.Send(ip);
|
|||
|
if (reply.Status == IPStatus.Success)
|
|||
|
{
|
|||
|
t = true;
|
|||
|
}
|
|||
|
else if (reply.Status == IPStatus.TimedOut)
|
|||
|
{
|
|||
|
t = false;
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
t = false;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return t;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
LogHelper.WriteLogInfo("" + ex, LogHelper.Log_Type.ERROR);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 检查数据库连接状态
|
|||
|
public bool CheckSqlServer()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
bool t = dal.OpenSql();
|
|||
|
return t;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
LogHelper.WriteLogInfo("检查数据库连接状态报错:"+ ex.ToString(),LogHelper.Log_Type.ERROR);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
public string get_type(string type)
|
|||
|
{
|
|||
|
switch (type)
|
|||
|
{
|
|||
|
case "1":
|
|||
|
return "播种标签";
|
|||
|
case "2":
|
|||
|
return "订单显示器";
|
|||
|
case "3":
|
|||
|
return "完成标签";
|
|||
|
case "4":
|
|||
|
return "信号灯";
|
|||
|
case "5":
|
|||
|
return "中分扫描枪";
|
|||
|
case "6":
|
|||
|
return "播种扫描枪";
|
|||
|
case "7":
|
|||
|
return "出货标签";
|
|||
|
case "9":
|
|||
|
return "M3";
|
|||
|
default:
|
|||
|
return "";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|