Commit 3bfe3755 LN

bug修改

1 个父辈 ad5b7d80
此文件类型无法预览
......@@ -18,7 +18,7 @@ namespace OnlineStore.AssemblyLine
{
internal partial class FrmEquipBase : FrmBase
{
internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal FrmEquipBase()
{
InitializeComponent();
......
......@@ -22,7 +22,7 @@ namespace OnlineStore.AssemblyLine
{
internal partial class FrmIOStatus : FrmBase
{
internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal FrmIOStatus()
{
Control.CheckForIllegalCrossThreadCalls = false;
......
......@@ -20,7 +20,7 @@ namespace OnlineStore.AssemblyLine
internal partial class FrmLineStore : Form
{
internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//internal static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private LineBean lineBean = null;
private List<TabPage> tabPageList = new List<TabPage>();
private bool LoadOk = false;
......
......@@ -44,7 +44,7 @@ namespace OnlineStore.AssemblyLine
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
public const int SW_RESTORE = 9;
public static IntPtr formhwnd;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
......@@ -124,7 +124,7 @@ namespace OnlineStore.AssemblyLine
static void LogUnhandledException(string type, string exceptionobj)
{
//这里可以进一步地写日志
LOGGER.Error("【" + type + "】" + exceptionobj);
LogUtil.error("【" + type + "】" + exceptionobj);
MessageBox.Show(exceptionobj, type);
LogUtil.error("【" + type + "】" + exceptionobj);
......
using log4net;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
......@@ -14,14 +15,14 @@ namespace StoreServer
{
public partial class LineStoreSystemService : ServiceBase
{
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public LineStoreSystemService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Start.");
LogUtil .info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Start.");
//初始化料仓
// DeviceControl.isNoDeviceDebug = true;
LineManager.Init();
......@@ -32,7 +33,7 @@ namespace StoreServer
}
else
{
LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + " ,启动时未找到 .LineBean");
LogUtil.info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + " ,启动时未找到 .LineBean");
}
}
protected override void OnStop()
......@@ -44,7 +45,7 @@ namespace StoreServer
IOManager.instance.CloseAllDO();
IOManager.instance.CloseAllConnection();
//AIManager.CloseConnect();
LOGGER.Info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Stop.");
LogUtil.info(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "*************************Stop.");
}
}
}
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{
public class ConfigAppSettings
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static int seq = 1;
......@@ -20,7 +20,7 @@ namespace OnlineStore.Common
{
if (seq.Equals(Int32.MaxValue))
{
LOGGER.Info("seq当前值:" + seq + ",重置seq=0");
LogUtil.info("seq当前值:" + seq + ",重置seq=0");
seq = 0;
}
Interlocked.Increment(ref seq);
......@@ -78,7 +78,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
......@@ -93,7 +93,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
......@@ -110,7 +110,7 @@ namespace OnlineStore.Common
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LOGGER.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
......@@ -145,7 +145,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",",ex);
LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + ",",ex);
}
}
......@@ -172,7 +172,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",",ex);
LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + ",",ex);
}
}
......@@ -206,7 +206,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",",ex);
LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + ",",ex);
}
}
}
......
......@@ -111,13 +111,14 @@ namespace OnlineStore.Common
try
{
var wc = new MyWebClient(timeOut);
using (var wc = new MyWebClient(timeOut))
{
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
} //LogUtil.info(result);
}
catch (WebException ex)
{
......@@ -149,15 +150,17 @@ namespace OnlineStore.Common
try
{
LogUtil.info( "HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
using (var wc = new WebClient { Encoding = encoding })
{
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
LogUtil.info( "receive << " + result);
LogUtil.info("receive << " + result);
return result;
}
}
}
catch (Exception e)
{
LogUtil.error("HTTP GET ERROR:" + e.Message, 102);
......
......@@ -6,12 +6,13 @@ using System.Net;
using System.IO;
using log4net;
using System.Text;
//using OnlineStore.Common;
namespace OnlineStore
{
public class NetTCPServer
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// TCP服务端监听
......@@ -118,13 +119,13 @@ namespace OnlineStore
NetworkStream ns = client.tcpClient.GetStream();
StreamReader sr = new StreamReader(ns);
string str = sr.ReadLine();
LOGGER.Info("读取到数据:"+str);
OnlineStore.Common. LogUtil.info("读取到数据:"+str);
byte[] recdata = new byte[ns.EndRead(ar)];
if (recdata.Length > 0)
{
//Array.Copy(client.Buffer, recdata, recdata.Length);
LOGGER.Info("读取到数据1111:" + Encoding.ASCII.GetString(recdata));
OnlineStore.Common. LogUtil.info("读取到数据1111:" + Encoding.ASCII.GetString(recdata));
//ns.BeginRead(client.Buffer, 0, client.Buffer.Length, new AsyncCallback(TCPCallBack), client);
}
else
......
......@@ -13,7 +13,7 @@ namespace OnlineStore.Common
{
public class TcpClient
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public delegate void HandleMessage(string message);
private Socket m_clientSocket = null;
......@@ -84,7 +84,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦" + ex.ToString());
LogUtil.error( "出错啦" + ex.ToString());
return false;
}
}
......@@ -109,12 +109,12 @@ namespace OnlineStore.Common
{
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage;
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " success!");
return true;
}
else
{
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " fail!");
}
}
catch (Exception ex)
......@@ -133,7 +133,7 @@ namespace OnlineStore.Common
if (!connResult.IsCompleted || (!m_clientSocket.Connected))
{
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " fail!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " fail!");
m_clientSocket.Close();
//处理连接不成功的动作
return false;
......@@ -143,7 +143,7 @@ namespace OnlineStore.Common
//处理连接成功的动作
m_clientSocket.BeginReceive(m_receiveBuffer, 0, m_receiveBuffer.Length, 0, new AsyncCallback(ReceiveCallBack), null);
onReceived = HandleMessage;
LogUtil.info(LOGGER, "Connect to " + serverIP + ":" + serverPort + " success!");
LogUtil.info( "Connect to " + serverIP + ":" + serverPort + " success!");
return true;
}
}
......@@ -165,17 +165,17 @@ namespace OnlineStore.Common
//Thread.Sleep(300);
m_clientSocket.Close();
//m_clientSocket = null;
LogUtil.info(LOGGER, "Socket closed!");
LogUtil.info( "Socket closed!");
}
else
{
LogUtil.error(LOGGER, "No socket is running!");
LogUtil.error( "No socket is running!");
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "close error :" + ex.ToString());
LogUtil.error( "close error :" + ex.ToString());
}
}
......@@ -190,7 +190,7 @@ namespace OnlineStore.Common
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER, "Send >> " + strSendData);
LogUtil.debug( "Send >> " + strSendData);
}
}
/// <summary>
......@@ -200,11 +200,11 @@ namespace OnlineStore.Common
{
if (strSendData.StartsWith("save"))
{
LogUtil.debug(LOGGER, "发送数据:" + strSendData);
LogUtil.debug( "发送数据:" + strSendData);
}
else
{
LogUtil.info(LOGGER, "发送数据:" + strSendData);
LogUtil.info( "发送数据:" + strSendData);
}
strSendData = strSendData + "\r\n";
......@@ -214,7 +214,7 @@ namespace OnlineStore.Common
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER, "Send >> " + strSendData);
LogUtil.debug( "Send >> " + strSendData);
}
}
private void ReceiveCallBack(IAsyncResult ar)
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{
public class TcpServer
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 接受消息时的间隔
/// </summary>
......@@ -45,7 +45,7 @@ namespace OnlineStore.Common
}
}
}
LogUtil.info(LOGGER, iplist + "]");
LogUtil.info( iplist + "]");
}
/// <summary>
......@@ -65,7 +65,7 @@ namespace OnlineStore.Common
m_serverThread = new Thread(new ThreadStart(ReceiveAccept));
m_serverThread.Start();
LogUtil.info(LOGGER, " Server start listen : " + m_serverPort);
LogUtil.info( " Server start listen : " + m_serverPort);
logLocalIp();
//this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Server started.");
......@@ -107,7 +107,7 @@ namespace OnlineStore.Common
client.ClientSocket = m_serverSocket.Accept();
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
client.AddStr = clientipe.Address.ToString()+":"+clientipe.Port.ToString();
LogUtil.info(LOGGER, "["+serverPort+"]有新的客户端链接上:[" + client.AddStr+"]");
LogUtil.info( "["+serverPort+"]有新的客户端链接上:[" + client.AddStr+"]");
AcceptClientEvent?.Invoke(client);
receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages);
......@@ -115,7 +115,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "ReceiveAccept方法,客户端【"+client.AddStr+"】:" + ex.Message);
LogUtil.error( "ReceiveAccept方法,客户端【"+client.AddStr+"】:" + ex.Message);
//throw new Exception(ex.Message);
}
}
......@@ -218,7 +218,7 @@ namespace OnlineStore.Common
}
catch (Exception ex)
{
LOGGER.Error(ex.ToString());
LogUtil.error(ex.ToString());
}
}
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.Common
public class UdpServer
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Thread m_serverThread;
private Socket udpServer;
......@@ -37,7 +37,7 @@ namespace OnlineStore.Common
}
}
}
LogUtil.info(LOGGER, iplist + "]");
LogUtil.info( iplist + "]");
}
......
......@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
//大料12号只能走1号2后皮带线
// 料架的架位大料时,架位1 - 6,12号优先走1 / 2号皮带线,
//7 - 11优先走3 / 4号皮带线
if (inoup.Equals(12))
if (inoup.rfidLoc.Equals(12))
{
// 大料12号只能走1号2后皮带线
mustLine = new List<int> { 1, 2 };
......
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
//public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16;
public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//public readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, AIOBOX> AIOMap = new Dictionary<string, AIOBOX>();
public Dictionary<string, List<Box_Sta>> DIValueMap = new Dictionary<string, List<Box_Sta>>();
......@@ -115,7 +115,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception error)
{
LogUtil.error(LOGGER, "连接IO模块 " + logName + " 出错:" + error.ToString());
LogUtil.error( "连接IO模块 " + logName + " 出错:" + error.ToString());
}
}
......@@ -328,12 +328,12 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "WriteSingleDO出错 没有连接IO模块:" + ioIp);
LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
}
}
catch (Exception ex)
{
LOGGER.Error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:", ex);
LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:", ex);
}
}
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds)
......@@ -353,11 +353,11 @@ namespace OnlineStore.DeviceLibrary
try
{
aioBox.WriteDO(StartAddress, aioBox.ReverseStatus(currBox_Sta));
LogUtil.debug(LOGGER, "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
LogUtil.debug( "**********定时回写入 IO [" + ioIp + "] [" + StartAddress + "]值" + aioBox.ReverseStatus(currBox_Sta) + "】:");
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "**********定时回写入 出错:", ex);
LogUtil.error( "**********定时回写入 出错:", ex);
}
};
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
......@@ -366,7 +366,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
LogUtil.error( "AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错 没有连接IO模块:" + ioIp);
}
}
catch (Exception ex)
......@@ -494,7 +494,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:", ex);
LogUtil.error( " GetIOValue [" + configIO.IO_IP + "] [" + configIO.GetIOAddr() + "] 获取数据出错:", ex);
}
return value;
}
......
......@@ -22,7 +22,7 @@ namespace OnlineStore.DeviceLibrary
//public static ushort DefaultDILength = 16;
//public static ushort DefaultDOLength = 16;
private static byte DefualtSlaveID = 255;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>();
public static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>();
public static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>();
......@@ -87,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception error)
{
LogUtil.error(LOGGER, "连接IO模块[" + ioIp + "]出错:" + error.ToString());
LogUtil.error( "连接IO模块[" + ioIp + "]出错:" + error.ToString());
}
}
public override void ReadAllDI(string ioIp, byte slaveId)
......@@ -122,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
// }
// catch (Exception ex)
// {
// LogUtil.error(LOGGER, "出错啦:",ex);
// LogUtil.error( "出错啦:",ex);
// }
// return false;
//}
......@@ -144,14 +144,14 @@ namespace OnlineStore.DeviceLibrary
else
{
ConnectionIP(io);
LogUtil.error(LOGGER, io + "当前没有连上,重连" + io);
LogUtil.error( io + "当前没有连上,重连" + io);
}
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦:",ex);
LogUtil.error( "出错啦:",ex);
}
Thread.Sleep(1);
}
......@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "ReadMultipleDI出错 没有连接IO模块:" + ioIp);
LogUtil.error( "ReadMultipleDI出错 没有连接IO模块:" + ioIp);
}
}
public static void ReadMultipleDO(string ioIp, byte slaveId, ushort StartAddress, ushort length)
......@@ -189,7 +189,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "ReadMultipleDO出错 没有连接IO模块:" + ioIp);
LogUtil.error( "ReadMultipleDO出错 没有连接IO模块:" + ioIp);
}
}
//关闭所有的DO
......@@ -235,7 +235,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "WriteMultipleDO 出错 没有连接IO模块:" + ioIp);
LogUtil.error( "WriteMultipleDO 出错 没有连接IO模块:" + ioIp);
}
}
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff)
......@@ -252,7 +252,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "WriteSingleDO 出错没有连接IO模块:" + ioIp);
LogUtil.error( "WriteSingleDO 出错没有连接IO模块:" + ioIp);
}
}
......@@ -282,11 +282,11 @@ namespace OnlineStore.DeviceLibrary
MBmaster.WriteSingleCoils(ID, StartAddress, newValue, slaveId);
KNDIO newIo = new KNDIO(ioIp, slaveId, StartAddress, newValue);
SaveDOValue(newIo, ioIp);
LogUtil.info(LOGGER, "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:");
LogUtil.info( "**********定时回写入 IO【" + ioIp + "," + StartAddress + ",值" + onOff + "】:");
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "**********定时回写入 出错:" ,ex);
LogUtil.error( "**********定时回写入 出错:" ,ex);
}
};
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
......@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(LOGGER, "WriteSingleDO出错 没有连接IO模块:" + ioIp);
LogUtil.error( "WriteSingleDO出错 没有连接IO模块:" + ioIp);
}
}
......@@ -327,7 +327,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "SaveDOValue出错:",ex);
LogUtil.error( "SaveDOValue出错:",ex);
}
}
public override IO_VALUE GetDOValue(string ioIP, byte slaveId, ushort StartAddress)
......@@ -393,7 +393,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "获取数据出错:",ex);
LogUtil.error( "获取数据出错:",ex);
}
return value;
}
......@@ -413,7 +413,7 @@ namespace OnlineStore.DeviceLibrary
{
finalData = Convert.ToString(values[0], 2).PadLeft(DILength, '0');
}
LOGGER.Debug("IO模块【" + ioIp + "】收到DI上传:【" + finalData + "】");
LogUtil.debug ("IO模块【" + ioIp + "】收到DI上传:【" + finalData + "】");
if (finalData.Length >= DILength)
{
List<KNDIO> kndList = new List<KNDIO>();
......@@ -444,7 +444,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "SaveDIData出错:",ex);
LogUtil.error( "SaveDIData出错:",ex);
//LOGGER.Error("处理接受数据出错:", ex);
}
}
......@@ -532,7 +532,7 @@ namespace OnlineStore.DeviceLibrary
switch (Func)
{
case 1:
LOGGER.Info("Read coils end:【" + reviceMsg + "】 ");
LogUtil.info("Read coils end:【" + reviceMsg + "】 ");
SaveDOData(ioIp, SlaveId, values);
break;
case 2:
......@@ -553,7 +553,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "处理接受数据出错:",ex);
LogUtil.error( "处理接受数据出错:",ex);
//LOGGER.Error("处理接受数据出错:", ex);
}
}
......@@ -580,7 +580,7 @@ namespace OnlineStore.DeviceLibrary
default:
break;
}
LOGGER.Error("接收数据出错:" +exc );
LogUtil.error("接收数据出错:" +exc );
//MessageBox.Show(exc, "Modbus slave exception");
}
......@@ -605,7 +605,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错啦:",ex);
LogUtil.error( "出错啦:",ex);
}
return false;
}
......
......@@ -16,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
public class MasterTcpClient
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// ------------------------------------------------------------------------
// Constants for access
private const byte fctReadCoil = 1;
......@@ -137,7 +137,7 @@ namespace OnlineStore.DeviceLibrary
connResult.AsyncWaitHandle.WaitOne(this.TimeOutTime, true); //等待2秒
if (!connResult.IsCompleted)
{
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!");
LogUtil.info( "Connect to " + ip + ":" + port + " fail!");
return;
}
else
......@@ -155,7 +155,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (System.IO.IOException error)
{
LogUtil.info(LOGGER, "Connect to " + ip + ":" + port + " fail!");
LogUtil.info( "Connect to " + ip + ":" + port + " fail!");
_connected = false;
throw (error);
}
......@@ -171,7 +171,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LOGGER.Error("IO模块[" + IP + "]出错:",ex);
LogUtil.error("IO模块[" + IP + "]出错:",ex);
}
}
......@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.debug(LOGGER, clientipe.ToString() + "收到数据(无需分包):" + str);
LogUtil.debug( clientipe.ToString() + "收到数据(无需分包):" + str);
ushort id = BitConverter.ToUInt16(rdata, 0);
byte function = rdata[7];
DataProcess(clientipe.ToString(), id, function, rdata);
......@@ -295,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (SocketException e)
{
LogUtil.error(LOGGER, "IO模块[" + IP + "]接收数据出现错误:" + e.ToString());
LogUtil.error( "IO模块[" + IP + "]接收数据出现错误:" + e.ToString());
if (socketClient != null)
{
socketClient.Close();
......@@ -335,7 +335,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "IO模块[" + IP + "]dispose出错:",ex);
LogUtil.error( "IO模块[" + IP + "]dispose出错:",ex);
}
socketClient.Close();
}
......@@ -515,7 +515,7 @@ namespace OnlineStore.DeviceLibrary
{
if (socketClient == null)
{
LOGGER.Error("发送数据时发现socketClient=null");
LogUtil.error("发送数据时发现socketClient=null");
return;
}
IPEndPoint clientipe = (IPEndPoint)socketClient.RemoteEndPoint;
......@@ -537,7 +537,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (SystemException error)
{
LogUtil.error(LOGGER, "IO模块 WriteAsyncData出错:" + error.ToString());
LogUtil.error( "IO模块 WriteAsyncData出错:" + error.ToString());
CallException(id, write_data[7], excExceptionConnectionLost, tcpSocketReviceBuffer);
}
}
......
......@@ -123,8 +123,8 @@ namespace OnlineStore.DeviceLibrary
bool findRightCode = false;
try
{
bool result = Camera._cam.CaptureOnImage(cameraName, out ho_Image);
if (!result || ho_Image == null)
ho_Image = Camera._cam.CaptureOnImage(cameraName );
if ( ho_Image == null)
{
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
......
......@@ -11,7 +11,7 @@ namespace OnlineStore.DeviceLibrary
{
public class LineServer
{
private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static TcpServer tcpserver = null;
public static bool IsStart = false;
......@@ -209,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
}
IsStart = true;
tcpserver.Start(port);
LogUtil.info(LOGGER, "流水线服务器在端口[" + port + "]监听!");
LogUtil.info( "流水线服务器在端口[" + port + "]监听!");
tcpserver.ReviceMsgEvent += tcp_ReviceMsgEvent;
}
......@@ -227,7 +227,7 @@ namespace OnlineStore.DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "关闭 监听出错:",ex);
LogUtil.error( "关闭 监听出错:",ex);
}
}
public static bool UpdateBoxDebug(int id, int isDebug)
......
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
......@@ -12,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary
public class CSVReaderBase
{
public static char Spilt_Char = ',';
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 获取一个类所有的《字段,AttributeName列名》集合
/// </summary>
......@@ -104,7 +105,7 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception e)
{
LOGGER.Error("出错:", e);
LogUtil.error("出错:", e);
}
if (File.Exists(filePath))
......@@ -117,7 +118,7 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception ex)
{
LOGGER.Error(ex.ToString());
LogUtil.error(ex.ToString());
return false;
}
return true;
......@@ -137,7 +138,7 @@ namespace OnlineStore.LoadCSVLibrary
}
}catch(Exception ex)
{
LOGGER.Error("出错:", ex);
LogUtil.error("出错:", ex);
}
return titleIndex;
}
......@@ -160,7 +161,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if (!titleIndex.ContainsKey(str))
{
LOGGER.Error("未找到必须列:" + str + ",加载数据失败!");
LogUtil.error("未找到必须列:" + str + ",加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:" + str + ",加载数据失败!");
}
}
......
using System;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
......@@ -45,7 +46,7 @@ namespace OnlineStore.LoadCSVLibrary
//必须有列【类型】
if (allTitleIndex.Count < 0 || !allTitleIndex.ContainsKey("类型"))
{
LOGGER.Error("未找到必须列:类型,加载数据失败!");
LogUtil.error("未找到必须列:类型,加载数据失败!");
throw new CVSFieldNotMatchingExection("未找到必须列:类型,加载数据失败!");
}
typeIndex = allTitleIndex["类型"];
......@@ -117,14 +118,14 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception ex)
{
LOGGER.Error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
LogUtil.error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
}
listIndex++;
}
}
catch (Exception ex)
{
LOGGER.Error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
LogUtil.error("filepath=" + filePath + ",index=" + index + ",key=" + key + "出错:" + ex.ToString());
}
}
bllIns.CheckField();
......@@ -162,7 +163,7 @@ namespace OnlineStore.LoadCSVLibrary
}
public static DeviceConfig LoadConfig(DeviceConfig config)
{
LOGGER.Debug("开始读取文件:" + config.ConfigFilePath);
LogUtil.info("开始读取文件:" + config.ConfigFilePath);
if (config == null || config.ConfigFilePath.Equals(""))
{
return null;
......@@ -225,7 +226,7 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception e)
{
LOGGER.Error("出错:" + e.ToString());
LogUtil.error("出错:" + e.ToString());
}
string newLine = "";
......
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -12,7 +13,7 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public class ConfigBase
{
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// DI=输入IO,DO=输出IO,PRO=属性,AXIS=轴
/// </summary>
......@@ -254,7 +255,7 @@ namespace OnlineStore.LoadCSVLibrary
}
catch (Exception ex)
{
LOGGER.Error("出错:", ex);
LogUtil.error("出错:", ex);
}
return value;
}
......
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -11,7 +12,7 @@ namespace OnlineStore.LoadCSVLibrary
{
public static Dictionary<int, Dictionary<string, ConfigIO>> SubDIList { get; set; }
public static Dictionary<int, Dictionary<string, ConfigIO>> SubDOList { get; set; }
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<string, string> ProIOIpMap = null;
public static Dictionary<string, string> ProRFIpMap = null;
public const string IOIP_Str = "PRO_AOI_IP";
......@@ -120,7 +121,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
}
else if (!ProIOIpMap.ContainsKey(con.ProName) && con.ProName.ToUpper().Contains(IOIP_Str.ToUpper()))
......@@ -133,7 +134,7 @@ namespace OnlineStore.LoadCSVLibrary
}
else
{
LOGGER.Error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
LogUtil.error("配置文件:" + this.ConfigFilePath + ",属性名=" + con.ProName + "的属性未找到匹配字段!");
}
}
......@@ -151,7 +152,7 @@ namespace OnlineStore.LoadCSVLibrary
string newType = io.ProName.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_");
if (DIList.ContainsKey(newType))
{
LOGGER.Error("配置DI:[" + io.ToString() + "] ProName重复 ");
LogUtil.error("配置DI:[" + io.ToString() + "] ProName重复 ");
}
else
{
......@@ -164,7 +165,7 @@ namespace OnlineStore.LoadCSVLibrary
}
if (SubDIList[io.SubType].ContainsKey(io.ProName))
{
LOGGER.Error("配置DI:[" + io.ToString() + "] ProName重复 ");
LogUtil.error("配置DI:[" + io.ToString() + "] ProName重复 ");
}
else
{
......@@ -175,7 +176,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if (DIList.ContainsKey(io.ProName))
{
LOGGER.Error("配置DI:[" + io.ToString() + "] ProName重复 ");
LogUtil.error("配置DI:[" + io.ToString() + "] ProName重复 ");
}
else
{
......@@ -198,7 +199,7 @@ namespace OnlineStore.LoadCSVLibrary
string newType = io.ProName.Replace("SW1_", "SW_").Replace("SW2_", "SW_").Replace("SW3_", "SW_").Replace("SW4_", "SW_");
if (DOList.ContainsKey(newType))
{
LOGGER.Error("配置DO:[" + io.ToString() + "] ProName重复 ");
LogUtil.error("配置DO:[" + io.ToString() + "] ProName重复 ");
}
else
{
......@@ -211,7 +212,7 @@ namespace OnlineStore.LoadCSVLibrary
}
if (SubDOList[io.SubType].ContainsKey(io.ProName))
{
LOGGER.Error("配置DO:[" + io.ToString() + "] ProName重复 ");
LogUtil.error("配置DO:[" + io.ToString() + "] ProName重复 ");
}
else
{
......@@ -222,7 +223,7 @@ namespace OnlineStore.LoadCSVLibrary
{
if (DOList.ContainsKey(io.ProName))
{
LOGGER.Error("配置DO:[" + io.ToString() + "] ProName重复 ");
LogUtil.error("配置DO:[" + io.ToString() + "] ProName重复 ");
}
else
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!